diff -Nrcpad gcc-4.5.2/gcc/ada/ChangeLog gcc-4.6.0/gcc/ada/ChangeLog *** gcc-4.5.2/gcc/ada/ChangeLog Thu Dec 16 12:32:17 2010 --- gcc-4.6.0/gcc/ada/ChangeLog Fri Mar 25 16:54:59 2011 *************** *** 1,370 **** ! 2010-12-16 Release Manager ! ! * GCC 4.5.2 released. ! ! 2010-11-27 Eric Botcazou ! ! PR ada/40777 ! * gcc-interface/targtyps.c (get_target_double_scalar_alignment): Guard ! use of TARGET_64BIT macro. ! ! 2010-09-19 Eric Botcazou ! ! * gcc-interface/trans.c (gnat_pushdecl): Do not do anything special ! for PARM_DECLs. ! (end_subprog_body): If the body is a BIND_EXPR, make its associated ! block the top-level one. ! (build_function_stub): Build a statement group for the whole function. ! * gcc-interface/utils.c (Subprogram_Body_to_gnu): If copy-in/copy-out ! is used, create the enclosing block early and process first the OUT ! parameters. ! ! 2010-09-19 Eric Botcazou ! ! * gcc-interface/decl.c (gnat_to_gnu_entity) : Do ! not generate debug info for individual enumerators. ! ! 2010-08-30 Eric Botcazou ! ! * gcc-interface/utils.c (gnat_pushdecl): Remove test for PARM_DECLs. ! Attach fake PARM_DECLs to the topmost block of the function. ! ! 2010-07-31 Release Manager ! ! * GCC 4.5.1 released. ! ! 2010-07-11 Kai Tietz ! ! Merged back from trunk ! PR ada/43731 ! * gcc-interface/Makefile.in: Add rules for multilib x86/x64 ! mingw targets. ! ! 2010-04-25 Eric Botcazou ! ! * gcc-interface/trans.c (gnat_to_gnu) : Do not ! use memmove if the array type is bit-packed. ! ! 2010-04-14 Release Manager ! ! * GCC 4.5.0 released. ! ! 2010-03-10 Eric Botcazou ! ! * gcc-interface/Makefile.in (SPARC/Solaris): Use sparcv8plus. ! ! 2010-02-27 Eric Botcazou ! ! PR ada/42253 ! * gcc-interface/utils2.c (build_binary_op) : Assert that fat ! pointer base types are variant of each other. Apply special treatment ! for null to fat pointer types in all cases. ! ! 2010-01-28 Pascal Obry ! ! * s-win32.ads: Add some missing constants. ! ! 2010-01-28 Vincent Celier ! ! * prj-attr-pm.adb (Add_Attribute): Do nothing if To_Package is ! Unknown_Package. ! ! 2010-01-28 Robert Dewar ! ! * gnat_rm.texi: Minor correction ! ! 2010-01-27 Pascal Obry ! ! * g-awk.adb: ensure that an AWK session is reusable. ! ! 2010-01-27 Vasiliy Fofanov ! ! * g-regist.adb (For_Every_Key): Fix previous change. ! Minor reformatting. ! ! 2010-01-27 Thomas Quinot ! ! * lib-writ.ads: Current version of spec for new N (note) ALI lines ! ! 2010-01-27 Yannick Moy ! ! * a-cdlili.adb (Insert): Correct exception message when cursor ! designates wrong list. ! ! 2010-01-27 Vincent Celier ! ! * gnatcmd.adb: When there is only one main specified, the package ! support Switches (
) and attribute Switches is specified for the ! main, use these switches, instead of Default_Switches ("Ada"). ! ! 2010-01-27 Robert Dewar ! ! * sem_prag.adb, par-prag.adb, snames.ads-tmpl: pragma Dimension initial ! implementation. ! * exp_disp.adb: Minor reformatting ! ! 2010-01-27 Tristan Gingold ! ! * seh_init.c: Use __ImageBase instead of _ImageBase. ! ! 2010-01-27 Javier Miranda ! ! * exp_disp.ads, exp_disp.adb (Expand_Interface_Thunk): Modify the ! profile of interface thunks. The type of the controlling formal is now ! the covered interface type (instead of the target tagged type). ! ! 2010-01-27 Sergey Rybin ! ! * gnat_rm.texi, gnat_ugn.texi: Update gnatcheck doc. ! ! 2010-01-27 Robert Dewar ! ! * sinput.ads, sinput.adb (Sloc_Range): Applies to all nodes, formal ! changed from Expr to N. ! ! 2010-01-26 Thomas Quinot ! ! * gnat_ugn.texi: Adjust documentation of -gnatz switches. ! * usage.adb: Replace line for -gnatz with two lines for -gnatzc and ! -gnatzr. ! ! 2010-01-26 Vincent Celier ! ! * prj-attr.adb: Add new attribute Library_Install_Name_Option ! Replace attribute Run_Path_Origin_Supported with Run_Path_Origin ! * prj-nmsc.adb (Process_Project_Level_Simple_Attributes): Process ! attributes Run_Path_Option and Library_Install_Name_Option. ! * prj.ads (Project_Configuration): Replace component ! Run_Path_Origin_Supported with component Run_Path_Origin. Add new ! component Library_Install_Name_Option. ! * snames.ads-tmpl: Add new standard name Library_Install_Name_Option ! Replace Run_Path_Origin_Supported with Run_Path_Origin ! ! 2010-01-26 Ed Schonberg ! ! * sem_ch8.adb (Use_One_Package): Within an instance, an actual package ! is not hidden by a homograph declared in another actual package. ! ! 2010-01-26 Robert Dewar ! ! * par_sco.adb (Traverse_Declarations_Or_Statements): Only generate ! decisions for pragmas Assert, Check, Precondition, Postcondition if ! -gnata set. ! * scos.ads: Update comments. ! * get_scos.adb, put_scos.adb: Minor fix to code reading statement SCOs. ! Also remove obsolete code for CT (exit point) SCOs. ! ! 2010-01-26 Thomas Quinot ! ! * switch-c.adb: Fix handling of -gnatz* ! ! 2010-01-26 Robert Dewar ! ! * par_sco.adb (Traverse_Declarations_Or_Statements): Separate F/W ! qualifiers for FOR/WHILE loops ! * scos.ads: Use separate type letters F/W for for/while loops ! ! 2010-01-26 Robert Dewar ! ! * get_scos.adb (Get_SCOs): Implement new form of CS entries (multiple ! entries per line, one for each statement in the sequence). ! * par_sco.adb (Traverse_Declarations_Or_Statements): Increase array ! size from 100 to 10_000 for SC_Array to avoid any real possibility of ! overflow. Output decisions in for loops. ! Exclude labels from CS lines. ! * scos.ads: Clarify that label is not included in the entry point ! ! 2010-01-26 Robert Dewar ! ! * par_sco.adb (Traverse_Declarations_Or_Statments): Implement new ! format of statement sequence SCO entries (one location/statement). ! * put_scos.adb (Put_SCOs): Implement new format of CS lines ! * scos.ads: Update comments. ! * sem_eval.adb: Minor reformatting. ! ! 2010-01-26 Robert Dewar ! ! * par_sco.ads, par_sco.adb (Set_Statement_Entry): New handling of exits ! (Extend_Statement_Sequence): New procedures ! (Traverse_Declarations_Or_Statements): New handling for exits. ! ! 2010-01-26 Robert Dewar ! ! * par_sco.adb (Traverse_Declarations_Or_Statements): Add processing for ! Case. ! ! 2010-01-26 Robert Dewar ! ! * par_sco.adb (Is_Logical_Operator): Exclude AND/OR/XOR ! * scos.ads: Clarify handling of logical operators ! ! 2010-01-26 Arnaud Charlet ! ! * s-tpoben.adb: Update comments. ! ! 2010-01-26 Robert Dewar ! ! * freeze.adb (Set_Small_Size): Don't set size if alignment clause ! present. ! ! 2010-01-26 Robert Dewar ! ! * scos.ads: Clean up documentation, remove obsolete XOR references ! 2010-01-26 Vincent Celier ! ! * gnat_ugn.texi: Complete documentation on the restrictions for ! combined options in -gnatxxx switches. ! Fix typo. ! ! 2010-01-26 Arnaud Charlet ! ! * s-tpoben.adb (Initialize_Protection_Entries): If a PO is created from ! a controlled operation, abort is already deferred at this point, so we ! need to use Defer_Abort_Nestable. ! ! 2010-01-26 Vincent Celier ! ! * prj-conf.adb (Get_Config_Switches): Check for a default language for ! a project extending a project with no languages. ! ! 2010-01-26 Vincent Celier ! ! * switch-c.adb (Scan_Front_End_Switches): Take into account options ! that follow -gnatef. ! Allow -gnateG to be followed by other options. ! ! 2010-01-26 Robert Dewar ! ! * s-commun.ads, s-osprim-mingw.adb, s-stchop-vxworks.adb, sem_aggr.adb, ! s-vxwext.adb, sem_ch10.adb, sem_eval.adb, sem_prag.adb: Minor ! reformatting. ! ! 2010-01-26 Vasiliy Fofanov ! ! * g-regist.adb, g-regist.ads (For_Every_Key): New generic procedure ! that allows to iterate over all subkeys of a key. ! ! 2010-01-26 Ed Falis ! ! * sysdep.c: enable NFS for VxWorks MILS ! * env.c: enable __gnat_environ for VxWorks MILS ! * gcc-interface/Makefile.in: Add VxWorks MILS target pairs. ! ! 2010-01-25 Bob Duff ! ! * sem_aggr.adb (Resolve_Array_Aggregate): Check for the case where this ! is an internally-generated positional aggregate, and the bounds are ! already correctly set. We don't want to overwrite those bounds with ! bounds determined by context. ! ! 2010-01-25 Robert Dewar ! ! * g-sercom.ads, gnatcmd.adb, gnatlink.adb, a-ststio.adb, exp_ch6.adb, ! exp_ch9.adb, g-sechas.ads: Minor reformatting. ! ! 2010-01-25 Thomas Quinot ! ! * s-commun.adb (Last_Index): Count must be converted to SEO (a signed ! integer type) before subtracting 1, otherwise the computation may wrap ! (because size_t is modular) and cause the conversion to fail. ! ! 2010-01-25 Ed Falis ! ! * sysdep.c, init.c: Adapt to support full run-time on VxWorks MILS. ! ! 2010-01-25 Vincent Celier ! ! * prj-attr.adb: New attribute Run_Path_Origin_Required ! * prj-nmsc.adb (Process_Project_Level_Simple_Attributes): Process new ! attribute Run_Path_Origin_Required. ! * prj.ads (Project_Configuration): New component ! Run_Path_Origin_Supported. ! * snames.ads-tmpl: New standard name Run_Path_Origin_Required ! ! 2010-01-25 Ed Schonberg ! ! * sem_aggr.adb (Resolve_Array_Aggregate): If the bounds in a choice ! have errors, do not continue resolution of the aggregate. ! * sem_eval.adb (Eval_Indexed_Component): Do not attempt to evaluate if ! the array type indicates an error. ! ! 2010-01-25 Bob Duff ! ! * sinfo.ads: Minor comment fixes. ! ! 2010-01-25 Bob Duff ! ! * exp_ch4.adb, exp_aggr.adb: Minor comment fixes and code clean up. ! ! 2010-01-25 Arnaud Charlet ! ! * gnatvsn.ads (Current_Year): Update. ! ! 2010-01-25 Florian Villoing ! * gnat_ugn.texi: Fix typo. ! 2010-01-25 Thomas Quinot ! * scos.ads: Update specification. ! 2010-01-25 Ed Schonberg ! * sem_ch6.adb (Process_PPCs): If a postcondition is present and the ! enclosing subprogram has no previous spec, attach postcondition ! procedure to the defining entity for the body. ! 2010-01-25 Ed Schonberg ! * exp_aggr.adb (Build_Record_Aggr_Code); Do not generate call to ! initialization procedure of the ancestor part of an extension aggregate ! if it is an interface type. ! 2010-01-25 Vincent Celier ! * gnatlink.adb (Process_Binder_File): The directory for the shared ! version of libgcc in the run path options is found in the subdirectory ! indicated by __gnat_default_libgcc_subdir. ! * link.c: Declare new const char * __gnat_default_libgcc_subdir for ! each platform. ! 2010-01-25 Ed Schonberg ! * sem_prag.adb: More flexible pragma Annotate. ! 2010-01-22 Eric Botcazou ! * system-linux-armel.ads (Stack_Check_Probes): Set to True. ! * system-linux-armeb.ads (Stack_Check_Probes): Likewise. ! 2010-01-18 Eric Botcazou ! * gcc-interface/utils.c (create_var_decl_1): Fix formatting nits. ! 2010-01-18 Jan Hubicka ! PR middle-end/42068 ! * gcc-interface/utils.c (create_var_decl_1): Do not set COMMON flag for ! unit local variables. ! 2010-01-17 Laurent GUERBY ! * gcc-interface/Makefile.in: Fix typo in arm*-*-linux-gnueabi. ! 2010-01-11 Mikael Pettersson ! * gcc-interface/Makefile.in: Add arm*-*-linux-gnueabi. ! * system-linux-armeb.ads, system-linux-armel.ads: New files. ! 2010-01-09 Simon Wright ! PR ada/42626 ! * gcc-interface/Makefile.in (gnatlib-shared-darwin): Add missing ! end-quote. ! Copyright (C) 2010 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright --- 1,84 ---- ! 2011-03-25 Release Manager ! * GCC 4.6.0 released. ! 2011-02-14 Eric Botcazou ! * gcc-interface/misc.c (gnat_init_options): Do not concatenate -I and ! its argument, except for the special -I- switch. ! 2011-02-12 Gerald Pfeifer ! * gnat_ugn.texi (Compiling Different Versions of Ada): Update ! link to "Ada Issues". ! 2011-02-08 Eric Botcazou ! * gcc-interface/Makefile.in (x86-64 darwin): Handle multilibs. ! 2011-02-03 Eric Botcazou ! * gcc-interface/gigi.h (fill_vms_descriptor): Take GNU_TYPE instead of ! GNAT_FORMAL. ! * gcc-interface/utils2.c (fill_vms_descriptor): Move from here to... ! * gcc-interface/utils.c (fill_vms_descriptor): ...here. Take GNU_TYPE ! instead of GNAT_FORMAL. Protect the expression against multiple uses. ! Do not generate the check directly, instead instantiate the template ! check present in the descriptor. ! (make_descriptor_field): Move around. ! (build_vms_descriptor32): Build a template check in the POINTER field. ! (build_vms_descriptor): Remove useless suffixes. ! * gcc-interface/trans.c (call_to_gnu): Adjust fill_vms_descriptor call. ! 2011-01-26 Eric Botcazou ! PR bootstrap/47467 ! * targext.c: Include target files if IN_RTS is defined. ! 2011-01-26 Richard Guenther ! PR bootstrap/47467 ! * targext.c: Include config.h. ! * gcc-interface/Make-lang.in (ada/targext.o): Add $(CONFIG_H) ! dependency. ! 2011-01-04 Pascal Obry ! Eric Botcazou ! * gcc-interface/decl.c: Disable Stdcall convention handling for 64-bit. ! 2011-01-04 Eric Botcazou ! * gcc-interface/trans.c (Case_Statement_to_gnu): Put the SLOC of the ! end-of-case on the end label and its associated gotos, if any. ! 2011-01-04 Eric Botcazou ! * gcc-interface/trans.c (Subprogram_Body_to_gnu): Evaluate the ! expressions of the parameter cache within the statement group of ! the CICO mechanism. ! 2011-01-04 Olivier Hainque ! Eric Botcazou ! * gcc-interface/trans.c (BLOCK_SOURCE_END_LOCATION): Provide default. ! (set_end_locus_from_node): New function. ! (Subprogram_Body_to_gnu): Use it to mark both the inner BIND_EXPR we ! make and the function end_locus. ! (Compilation_Unit_to_gnu): Call it instead of a straight Sloc_to_locus ! for the elaboration subprogram. ! (set_gnu_expr_location_from_node) : Use it to attempt to ! set the end_locus of the expression as well. ! 2011-01-04 Eric Botcazou ! PR ada/47131 ! * gcc-interface/trans.c (Identifier_to_gnu): In SJLJ mode, do not make ! variables that are referenced in exception handlers volatile. ! Copyright (C) 2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright diff -Nrcpad gcc-4.5.2/gcc/ada/ChangeLog-2010 gcc-4.6.0/gcc/ada/ChangeLog-2010 *** gcc-4.5.2/gcc/ada/ChangeLog-2010 Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/ChangeLog-2010 Sun Jan 2 16:22:05 2011 *************** *** 0 **** --- 1,10088 ---- + 2010-12-31 Eric Botcazou + + * gcc-interface/decl.c (substitute_in_type): Do not deal with + LANG_TYPE, METHOD_TYPE or OFFSET_TYPE. + * gcc-interface/utils.c (handle_vector_size_attribute): Do not deal + with METHOD_TYPE or OFFSET_TYPE. + + 2010-12-22 Nathan Froyd + + * gcc-interface/utils.c (handle_nonnull_attribute): Use prototype_p. + (handle_sentinel_attribute): Likewise. + + 2010-12-20 Ralf Wildenhues + + PR bootstrap/47027 + * a-stwiun-shared.ads: Rewrap overlong comment line. + + * projects.texi: Fix typos. + * gnat_rm.texi: Likewise. + * gnat_ugn.texi: Likewise. + * sem_util.adb: Fix typo in variable, typos in comments. + * a-btgbso.adb: Fix typos in comments. + * a-cbdlli.adb, a-cbhase.ads, a-cdlili.adb, a-cobove.adb, + a-coinve.adb, a-convec.adb, a-direct.ads, a-strunb-shared.adb, + a-strunb-shared.ads, a-stuten.ads, a-stwiun-shared.adb, + a-stwiun-shared.ads, a-stzunb-shared.adb, a-stzunb-shared.ads, + a-suenco.adb, a-suenst.adb, a-suewst.adb, a-suezst.adb, ali.ads, + aspects.ads, atree.ads, binde.adb, bindgen.adb, checks.adb, + checks.ads, einfo.ads, err_vars.ads, errout.adb, errout.ads, + exp_aggr.adb, exp_attr.adb, exp_cg.adb, exp_ch3.adb, + exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, + exp_dbug.ads, exp_disp.adb, exp_fixd.ads, freeze.adb, + g-altive.ads, g-comlin.ads, g-excact.ads, g-mbdira.adb, + g-sechas.ads, g-sehash.ads, g-sha1.ads, g-sha224.ads, + g-sha256.ads, g-sha384.ads, g-sha512.ads, g-shsh32.ads, + g-shsh64.ads, g-socket.adb, g-socket.ads, g-sothco.ads, + gcc-interface/decl.c, gcc-interface/trans.c, + gcc-interface/utils2.c, gnat1drv.adb, init.c, inline.adb, + link.c, locales.c, make.adb, mingw32.h, namet.ads, osint.adb, + par-ch12.adb, par-ch13.adb, par-ch3.adb, par-ch4.adb, + par-prag.adb, par.adb, par_sco.adb, prepcomp.adb, + prj-conf.ads, prj-dect.adb, prj-env.adb, prj-env.ads, + prj-nmsc.adb, prj-tree.ads, prj-util.ads, prj.adb, prj.ads, + s-auxdec-vms-alpha.adb, s-auxdec-vms_64.ads, s-oscons-tmplt.c, + s-osinte-vxworks.ads, s-osprim-mingw.adb, s-regexp.adb, + s-stusta.adb, s-taprop-mingw.adb, s-taprop-solaris.adb, + scn.adb, scos.ads, sem.adb, sem_aggr.adb, sem_attr.adb, + sem_aux.adb, sem_aux.ads, sem_ch12.adb, sem_ch12.ads, + sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch4.adb, + sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_disp.adb, + sem_disp.ads, sem_eval.adb, sem_intr.adb, sem_prag.adb, + sem_res.adb, sem_scil.adb, sem_util.ads, sem_warn.adb, + sem_warn.ads, sinfo.ads, socket.c, styleg.adb, switch.ads, + sysdep.c, tb-alvxw.c, xoscons.adb: Likewise. + + 2010-12-13 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : + Build a stub DECL for the dummy fat pointer type in the unconstrained + array case. + * gcc-interface/utils.c (update_pointer_to): Set the DECL_ORIGINAL_TYPE + for all the variants in the fat pointer case. + + 2010-12-13 Eric Botcazou + + * gcc-interface/trans.c (can_be_lower_p): New predicate. + (Loop_Statement_to_gnu): Do not generate the entry condition if we know + that it will be true. + + 2010-12-03 Joseph Myers + + * gcc-interface/lang.opt (k8): New option. + + 2010-12-03 Alexandre Oliva + + * gnatvsn.adb (Gnat_Version_String): Don't overrun Ver_Len_Max. + * gnatvsn.ads (Ver_Len_Max): Bump up to 256. + * g-comver.adb (Ver_Len_Max): Likewise. + + 2010-12-03 Laurynas Biveinis + + * gcc-interface/decl.c (struct subst_pair_d): Remove GTY tag. + (variant_desc_d): Likewise. + + 2010-12-01 Joseph Myers + + * gcc-interface/misc.c (flag_compare_debug, flag_stack_check): + Undefine as macros then define as variables. + (gnat_post_options): Set variables from global_options. + + 2010-11-27 Eric Botcazou + + PR ada/46574 + * gcc-interface/utils2.c (compare_elmt_bitpos): Fix typos. + + 2010-11-27 Eric Botcazou + + PR ada/40777 + * gcc-interface/targtyps.c (get_target_double_scalar_alignment): Guard + use of TARGET_64BIT macro. + + 2010-11-27 Eric Botcazou + + * s-osinte-linux.ads (sigset_t): Use unsigned_char subtype directly. + (unsigned_long_long_t): New modular type. + (pthread_cond_t): Add alignment clause. + + 2010-11-27 Eric Botcazou + + * gnatvsn.adb (Version_String): Change type to C-like array of chars. + (Gnat_Version_String): Adjust to above change. + + 2010-11-18 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Also + use return-by-invisible-reference if the return type is By_Reference. + Tidy up and skip the processing of the return type if it is void. + + 2010-11-17 Joseph Myers + + * gcc-interface/misc.c (gnat_parse_file): Take no arguments. + + 2010-11-17 Eric Botcazou + + * gcc-interface/trans.c (addressable_p): Rewrite obsolete paragraph in + head comment. + + 2010-11-12 Joseph Myers + + * gcc-interface/Make-lang.in (ada/misc.o): Use $(OPTS_H). + * gcc-interface/misc.c (gnat_handle_option): Take location_t parameter. + + 2010-11-10 Eric Botcazou + + * gcc-interface/trans.c (gigi): Don't set 'pure' flag on SJLJ routines. + * gcc-interface/utils2.c (compare_arrays): Add LOC parameter. Set it + directly on all the comparison expressions. + (build_binary_op): Pass input_location to compare_arrays. + + 2010-11-10 Eric Botcazou + + * gcc-interface/trans.c (lvalue_required_p) ): Look + through it for elementary types as well. + : Adjust to above change. + : Likewise. + (gnat_to_gnu): Do not attempt to rewrite boolean literals. + + 2010-11-10 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity): Do not set DECL_ARTIFICIAL + on the reused DECL node coming from a renamed object. + Set DECL_IGNORED_P on the DECL node built for renaming entities if they + don't need debug info. + + 2010-11-09 Eric Botcazou + + * gcc-interface/utils.c (save_gnu_tree): Improve comments. + (get_gnu_tree): Likewise. + + 2010-11-09 Eric Botcazou + + * gcc-interface/decl.c (finish_fat_pointer_type): New function. + (gnat_to_gnu_entity) : Use it to build the fat pointer + type. + : Likewise. + + 2010-11-02 Eric Botcazou + + * gcc-interface/gigi.h (add_stmt_force): Declare. + (add_stmt_with_node_force): Likewise. + * gcc-interface/trans.c (Attribute_to_gnu): Don't set TREE_SIDE_EFFECTS + on the SAVE_EXPR built for cached expressions of parameter attributes. + (Subprogram_Body_to_gnu): Force evaluation of the SAVE_EXPR built for + cached expressions of parameter attributes. + (add_stmt_force): New function. + (add_stmt_with_node_force): Likewise. + + 2010-10-27 Eric Botcazou + + * gcc-interface/trans.c (gigi): Fix formatting issues. + (build_raise_check): Likewise. + (gnat_to_gnu): Likewise. + * gcc-interface/utils2.c (build_call_raise_range): Likewise. + (build_call_raise_column): Likewise. + + 2010-10-26 Robert Dewar + + * exp_ch5.adb, exp_prag.adb, sem_ch3.adb, exp_atag.adb, layout.adb, + sem_dist.adb, exp_ch7.adb, exp_util.adb, exp_attr.adb, exp_ch9.adb, + sem_ch10.adb, checks.adb, sem_prag.adb, par-endh.adb, sem_ch12.adb, + exp_smem.adb, sem_attr.adb, exp_ch4.adb, exp_ch6.adb, exp_ch8.adb, + sem_ch6.adb, exp_disp.adb, exp_aggr.adb, exp_dist.adb, sem_ch13.adb, + par-ch3.adb, par-ch5.adb, exp_strm.adb, exp_ch3.adb: Minor reformatting + * opt.ads: Minor comment fix. + + 2010-10-26 Vincent Celier + + * gnat_ugn.texi: Document option -s for gnatlink. + + 2010-10-26 Robert Dewar + + * opt.ads: Move documentation on checksum stuff here from prj-nmsc + * prj-nmsc.adb (Process_Project_Level_Array_Attributes): Move + documentation on checksum versions to opt.ads. + + 2010-10-26 Vincent Celier + + * opt.ads (Checksum_Accumulate_Token_Checksum): New Boolean flag, + defaulted to True. + (Checksum_GNAT_6_3): New name of Old_Checksums + (Checksum_GNAT_5_03): New name of Old_Old_Checksums + * prj-nmsc.adb (Process_Project_Level_Array_Attributes): Adapt to new + names of Opt flags. + Set Checksum_Accumulate_Token_Checksum to False if GNAT version is 5.03 + or before. + * scng.adb (Accumulate_Token_Checksum_GNAT_6_3): New name of procedure + Accumulate_Token_Checksum_Old. + (Accumulate_Token_Checksum_GNAT_5_03): New name of procedure + Accumulate_Token_Checksum_Old_Old. + (Nlit): Call Accumulate_Token_Checksum only if + Opt.Checksum_Accumulate_Token_Checksum is True. + (Scan): Ditto + + 2010-10-26 Robert Dewar + + * sem_ch13.adb (Build_Invariant_Procedure): New calling sequence. + (Build_Invariant_Procedure): Properly handle analysis of invariant + expression with proper end-of-visible-decls visibility. + * sem_ch13.ads (Build_Invariant_Procedure): Changed calling sequence. + * sem_ch3.adb (Process_Full_View): Don't build invariant procedure + (too late). + (Analyze_Private_Extension_Declaration): Propagate invariant flags. + * sem_ch7.adb (Analyze_Package_Specification): Build invariant + procedures. + + 2010-10-26 Vincent Celier + + * opt.ads (Old_Checksums, Old_Old_Checksums): New Boolean flags, + defaulted to False. + * prj-nmsc.adb (Process_Project_Level_Array_Attributes): When + processing attribute Toolchain_Version ("Ada"), set Opt.Old_Checksums + and Opt.Old_Old_Checksums depending on the GNAT version. + * scng.adb (Accumulate_Token_Checksum_Old): New procedure. + (Accumulate_Token_Checksum_Old_Old): New procedure. + (Scan): For keywords, when Opt.Old_Checksums is True, call one of the + alternative procedures Accumulate_Token_Checksum_Old or + Accumulate_Token_Checksum_Old_Old, instead of Accumulate_Token_Checksum. + + 2010-10-26 Richard Kenner + + * gcc-interface/utils2.c (build_compound_expr): New function. + * gcc-interface/gigi.h (build_compound_expr): Declare it. + * gcc-interface/trans.c (Attribute_to_gnu, call_to_gnu): Use it. + (gnat_to_gnu, case N_Expression_With_Actions): Likewise. + + 2010-10-26 Javier Miranda + + * sem_prag.adb (Process_Import_Or_Interface): Skip primitives of + interface types when processing all the entities in the homonym chain + that are declared in the same declarative part. + + 2010-10-26 Ed Schonberg + + * sem_ch3.adb (Process_Range_In_Decl): If the range is part of a + quantified expression, the insertion point for range checks will be + arbitrarily far in the tree. + * sem_ch5.adb (One_Bound): Use Insert_Actions for the declaration of + the temporary that holds the value of the bounds. + * sem_res.adb (Resolve_Quantified_Expressions): Disable expansion of + condition until the full expression is expanded. + + 2010-10-26 Robert Dewar + + * opt.ads: Comment fix. + * sem_cat.adb: Treat categorization errors as warnings in GNAT Mode. + * switch-c.adb: GNAT Mode does not set + Treat_Categorization_Errors_As_Warnings. + + 2010-10-26 Ed Schonberg + + * sem_ch8.adb (Analyze_Subprogram_Renaming): Improve warning when an + operator renames another one with a different name. + + 2010-10-26 Thomas Quinot + + * exp_ch4.adb, exp_pakd.adb: Minor reformatting. + + 2010-10-26 Bob Duff + + * namet.adb: Improve hash function. + + 2010-10-26 Thomas Quinot + + * sem_disp.adb: Minor reformatting. + + 2010-10-26 Robert Dewar + + * sem_ch3.adb, sem_ch4.adb, sem_disp.adb, switch-c.adb: Minor + reformatting. + * gnat_ugn.texi: Document -gnateP switch. + + 2010-10-26 Robert Dewar + + * opt.ads (Treat_Categorization_Errors_As_Warnings): New flag + * sem_cat.adb (Check_Categorization_Dependencies): + Use Check_Categorization_Dependencies + * switch-c.adb: GNAT Mode sets Treat_Categorization_Errors_As_Warnings + -gnateP sets Treat_Categorization_Errors_As_Warnings + * usage.adb: Add line for -gnateP switch + + 2010-10-26 Javier Miranda + + * sem_ch3.adb (Add_Internal_Interface_Entities): Handle primitives + inherited from the parent that cover interface primitives. + (Derive_Progenitor_Subprograms): Handle primitives inherited from + the parent that cover interface primitives. + * sem_disp.adb (Find_Primitive_Covering_Interface): When searching in + the list of primitives of the type extend the test to include inherited + private primitives. + * sem_ch6.ads (Is_Interface_Conformant): Add missing documentation. + * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Add missing + barrier to the loop searching for explicit overriding primitives. + * sem_ch4.adb (Analyze_Indexed_Component_Form): Add missing barrier + before accessing attribute Entity. + + 2010-10-26 Bob Duff + + * make.adb: Call Namet.Finalize, so we can get statistics. + + 2010-10-26 Geert Bosch + + * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Use the subprogram_body + node to determine wether the subprogram is a rewritten parameterized + expression. + + 2010-10-26 Robert Dewar + + * opt.ads: Minor code reorganization. Alphabetize Warning switches. + + 2010-10-26 Robert Dewar + + * sem_res.adb, xsinfo.adb: Minor reformatting. + + 2010-10-26 Bob Duff + + * namet.adb (Finalize): More cleanup of statistics printouts. + + 2010-10-26 Robert Dewar + + * ceinfo.adb: Minor reformatting. + + 2010-10-26 Javier Miranda + + * sem_ch6.adb (Check_Overriding_Indicator, New_Overloaded_Entity): When + setting attribute Overridden_Operation do not reference the entities + generated by Derive_Subprograms but their aliased entity (which + is the primitive inherited from the parent type). + + 2010-10-26 Bob Duff + + * namet.adb, namet.ads: Minor cleanup. + + 2010-10-26 Arnaud Charlet + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-26 Robert Dewar + + * einfo.ads, einfo.adb (Is_Base_Type): New function, use it where + appropriate. + * exp_ch6.adb, exp_dbug.adb, exp_disp.adb, freeze.adb, lib-xref.adb, + sem_aux.adb, sem_ch3.adb, sem_ch7.adb, sem_ch8.adb (Is_Base_Type): Use + this new abstraction where appropriate. + + 2010-10-26 Ed Schonberg + + * sem_ch12.adb: Code clean up. + + 2010-10-26 Paul Hilfinger + + * exp_dbug.ads: Document effect of 'pragma Unchecked_Union' on + debugging data. + + 2010-10-26 Ed Schonberg + + * sem_util.adb (Note_Possible_Modification): If the target of an + assignment is the bound variable in an iterator, the domain of + iteration, i.e. array or container, is modified as well. + + 2010-10-26 Bob Duff + + * Make-generated.in: Make the relevant make targets depend on + ceinfo.adb and csinfo.adb. + * csinfo.adb, ceinfo.adb: Make sure it raises an exception on failure, + so when called from xeinfo, the failure will be noticed. + * sinfo.ads: Update comments to reflect the fact that xsinfo runs csinfo + * xsinfo.adb, xeinfo.adb: Run ceinfo to check for errors. Close files. + + 2010-10-26 Ed Schonberg + + * exp_ch4.adb: Set properly parent field of operands of concatenation. + + 2010-10-26 Ed Schonberg + + * sem_res.adb (Check_Infinite_Recursion): A recursive call within a + conditional expression or a case expression should not generate an + infinite recursion warning. + + 2010-10-26 Javier Miranda + + * einfo.ads, einfo.adb (Is_Overriding_Operation): Removed. + (Set_Is_Overriding_Operation): Removed. + * sem_ch3.adb (Check_Abstract_Overriding): Remove redundant call to + Is_Overriding_Operation. + * exp_ch7.adb (Check_Visibly_Controlled): Remove redundant call to + Is_Overriding_Operation. + * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Remove redundant + call to Set_Is_Overriding_Operation. + * sem_util.adb (Collect_Primitive_Operations): Replace test on + Is_Overriding_Operation by test on the presence of attribute + Overridden_Operation. + (Original_Corresponding_Operation): Remove redundant call to attribute + Is_Overriding_Operation. + * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Remove + redundant call to Is_Overriding_Operation. + (Verify_Overriding_Indicator): Replace several occurrences of test on + Is_Overriding_Operation by test on the presence of attribute + Overridden_Operation. + (Check_Convention): Replace test on Is_Overriding_Operation by test on + the presence of Overridden_Operation. + (Check_Overriding_Indicator): Add missing decoration of attribute + Overridden_Operation. Minor code cleanup. + (New_Overloaded_Entity): Replace occurrence of test on + Is_Overriding_Operation by test on the presence of attribute + Overridden_Operation. Remove redundant setting of attribute + Is_Overriding_Operation plus minor code reorganization. + Add missing decoration of attribute Overridden_Operation. + * sem_elim.adb (Set_Eliminated): Replace test on + Is_Overriding_Operation by test on the presence of Overridden_Operation. + * sem_ch8.adb (Analyze_Subprogram_Renaming): Replace test on + Is_Overriding_Operation by test on the presence of + Overridden_Operation. Remove a redundant test on attribute + Is_Overriding_Operation. + * lib-xref.adb (Generate_Reference): Replace test on + Is_Overriding_Operation by test on the presence of Overridden_Operation. + (Output_References): Replace test on Is_Overriding_Operation by test on + the presence of Overridden_Operation. + * sem_disp.adb (Override_Dispatching_Operation): Replace test on + Is_Overriding_Operation by test on the presence of Overridden_Operation. + Add missing decoration of attribute Overridden_Operation. + + 2010-10-26 Robert Dewar + + * sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Properly check + RM 13.4.1(10). + + 2010-10-26 Bob Duff + + * sem_res.adb (Resolve_Actuals): In case of certain + internally-generated type conversions (created by OK_Convert_To, so the + Conversion_OK flag is set), avoid fetching the component type when it's + not really an array type, but a private type completed by an array type. + + 2010-10-26 Ed Schonberg + + * sem_ch5.adb: Adjust format of error message. + + 2010-10-26 Robert Dewar + + * einfo.ads, einfo.adb (OK_To_Reference): Removed, no longer used. + * exp_util.adb (Side_Effect_Free): Put in safety barrier in code to + detect renamings to avoid problems with invariants. + * sem_ch13.adb (Replace_Type_References_Generic): New procedure + (Build_Invariant_Procedure): Use Replace_Type_Reference_Generic + (Build_Predicate_Function): Use Replace_Type_Reference_Generic + * sem_res.adb, sem_ch8.adb, sem_ch4.adb (OK_To_Reference): Remove + references, flag is no longer set. + + 2010-10-26 Vincent Celier + + * prj.ads (Source_Data): New Boolean component Initialized, defaulted + to False, set to True when Source_Data is completely initialized. + * prj-env.adb: Minor comment fix. + + 2010-10-26 Robert Dewar + + * sem_case.adb, sem_ch6.adb, sem_util.adb: Minor reformatting. + + 2010-10-26 Ed Schonberg + + * sem_ch5.adb (Analyze_Iteration_Scheme): Diagnose attempt to use thew + form "for X in A" when A is an array object. This form is only intended + for containers. + * sem_eval.adb: Fix reference to non-existing field of type conversion + node. + * sem_case.adb (Check_Choices): Improve error reporting for overlapping + choices in case statements. + + 2010-10-26 Gary Dismukes + + * exp_disp.adb (Expand_Interface_Actuals): When expanding an actual for + a class-wide interface formal that involves applying a displacement + conversion to the actual, check for the case of calling a build-in-place + function and handle generation of the implicit BIP parameters (call + Make_Build_In_Place_Call_In_Anonymous_Context). + Add with and use of Exp_Ch6. + + 2010-10-26 Robert Dewar + + * sem_prag.adb, sem_cat.ads: Minor reformatting. + + 2010-10-26 Sergey Rybin + + * vms_data.ads: Define VMS qualifier for gnatelim '--ignore' option + + 2010-10-26 Thomas Quinot + + * sem_util.adb (Has_Preelaborable_Initialization.Check_Components): + For a discriminant, use Discriminant_Default_Value rather than + Expression (Declaration_Node (D)). + + 2010-10-26 Geert Bosch + + * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Parameterized + expressions don't need a spec, even when style checks require + subprograms to have one. + + 2010-10-26 Arnaud Charlet + + * gnatvsn.ads: Update comments. + + 2010-10-26 Matthew Heaney + + * Makefile.rtl, impunit.adb: Add bounded hashed set and bounded hashed + map containers. + * a-cohata.ads: Add declaration of generic package for bounded hash + table types. + * a-chtgbo.ads, a-chtgbo.adb, a-chtgbk.ads, a-chtgbk.adb, a-cbhase.ads, + a-cbhase.adb, a-cbhama.ads, a-cbhama.adb: New files. + + 2010-10-26 Ed Schonberg + + * sem_warn.adb: Improve warning message on overlapping actuals. + + 2010-10-26 Thomas Quinot + + * sem_ch4.adb, exp_dist.adb: Minor reformatting. + + 2010-10-26 Vincent Celier + + * makeusg.adb (Makeusg): Add lines for switches -vl, -vm and -vh. + + 2010-10-26 Robert Dewar + + * exp_ch3.adb (Expand_N_Object_Declaration): Move generation of + predicate check to analyzer, since too much rewriting occurs in the + analyzer. + * sem_ch13.adb (Build_Predicate_Function): Change calling sequence, and + change the order in which things are done to fix several errors in + dealing with qualification of the type name. + (Build_Static_Predicate): Built static predicate after full analysis + of the body. This is necessary to fix several problems. + * sem_ch3.adb (Analyze_Object_Declaration): Move predicate check here + from expander, since too much expansion occurs in the analyzer to leave + it that late. + (Analyze_Object_Declaration): Change parameter Include_Null to new name + Include_Implicit in Is_Partially_Initialized_Type call. + (Analyze_Subtype_Declaration): Make sure predicates are proapagated in + some strange cases of internal subtype generation. + * sem_util.ads, sem_util.adb (Is_Partially_Initialized_Type): Change + Include_Null to Include_Implicit, now includes the case of + discriminants. + + 2010-10-26 Sergey Rybin + + * gnat_rm.texi: Revise the documentation for pragma Eliminate. + + 2010-10-26 Matthew Heaney + + * Makefile.rtl, impunit.adb: Added bounded list container. + * a-cbdlli.ads, a-cbdlli.adb: New file. + + 2010-10-25 Eric Botcazou + + * gcc-interface/utils2.c: Include flags.h and remove prototypes. + (build_unary_op) : When not optimizing, fold the result + of the call to invert_truthvalue_loc. + * gcc-interface/Make-lang.in (utils2.o): Add $(FLAGS_H). + + 2010-10-25 Eric Botcazou + + * gcc-interface/utils.c (update_pointer_to): Clear TYPE_POINTER_TO and + TYPE_REFERENCE_TO of the old type after redirecting its pointer and + reference types. + + 2010-10-25 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Do not set + TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template. + + 2010-10-25 Jose Ruiz + + * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for powerpc-linux): + Reorganize target pairs so that it works on linux and ElinOS. + + 2010-10-25 Pascal Obry + + * adaint.c (__gnat_file_time_name_attr): Use GetFileAttributesEx to get + the timestamp. A bit faster than opening/closing the file. + (__gnat_stat_to_attr): Remove kludge for Windows. + (__gnat_file_exists_attr): Likewise. + The timestamp is now retreived using GetFileAttributesEx as faster. + + 2010-10-25 Javier Miranda + + * sem_ch3.adb (Derive_Interface_Subprogram): New subprogram. + (Derive_Subprograms): For abstract private types transfer to the full + view entities of uncovered interface primitives. Required because if + the interface primitives are left in the private part of the package + they will be decorated as hidden when the analysis of the enclosing + package completes (and hence the interface primitive is not visible + for dispatching calls). + + 2010-10-25 Matthew Heaney + + * Makefile.rtl, impunit.adb: Added bounded set and bounded map + containers. + * a-crbltr.ads: Added declaration of generic package for bounded tree + types. + * a-rbtgbo.ads, a-rbtgbo.adb, a-rbtgbk.ads, a-rbtgbk.adb, a-btgbso.ads, + a-btgbso.adb, a-cborse.ads, a-cborse.adb, a-cborma.ads, a-cborma.adb: + New. + + 2010-10-25 Thomas Quinot + + * sem_util.adb: Minor reformatting. + * usage.adb: Fix usage line for -gnatwh. + + 2010-10-25 Thomas Quinot + + * sem_ch12.adb (Analyze_Package_Instantiation): For an + instantiation in an RCI spec, omit package body if instantiation comes + from source, even as a nested + package. + * exp_dist.adb (Add_Calling_Stubs_To_Declarations, + *_Support.Add_Receiving_Stubs_To_Declarations): Handle the case of + nested packages, package instantiations and subprogram instantiations. + + 2010-10-25 Robert Dewar + + * exp_ch5.adb (Expand_Predicated_Loop): Remove code for loop through + non-static predicate, since we agree not to allow this. + (Expand_Predicated_Loop): Properlay handle false predicate (null + list in Static_Predicate field. + * sem_ch13.adb (Build_Static_Predicate): Extensive changes to clean up + handling of more general predicate forms. + + 2010-10-25 Robert Dewar + + * sem_ch4.adb, sem_util.adb: Minor reformatting. + * sem_ch8.adb (Find_Selected_Component): Allow selection from instance + of type in predicate or invariant expression. + + 2010-10-25 Pascal Obry + + * adaint.c (__gnat_stat_to_attr): Can set the timestamp on Windows now. + (f2t): New routine. + (__gnat_stat): Rewrite Win32 version. + + 2010-10-25 Robert Dewar + + * sem_warn.adb, einfo.ads, exp_ch4.adb: Minor comment fix + * sem_case.adb: Comment clarification for loops through false + predicates. + * sem_util.adb: Minor reformatting + (Check_Order_Dependence): Fix bad double blank in error message + + 2010-10-25 Ed Schonberg + + * sem_ch4.adb (Analyze_Membership_Op): in Ada_2012 a membership + operation can have a single alternative that is a value of the type. + Rewrite operation as an equality test. + + 2010-10-25 Matthew Heaney + + * Makefile.rtl, impunit.adb: Added a-cobove (bounded vector container) + to lists. + * a-contai.ads: Added declaration of Capacity_Error exception. + * a-cobove.ads, a-cobove.adb: New files. + + 2010-10-25 Thomas Quinot + + * uname.adb: Revert previous change, no longer needed after change + in par-ch10.adb. + + 2010-10-25 Thomas Quinot + + * scos.ads: Minor comment fix. + + 2010-10-25 Ed Schonberg + + * sem_ch5.adb (Analyze_Assignment_Statement): Check dangerous order + dependence. + * sem_ch6.adb (Analyze_Procedure_Call_Statement): Ditto. + * sem_res.adb (Analyze_Actuals): Add actual to list of actuals for + current construct, for subsequent order dependence checking. + (Resolve): Check order dependence on expressions that are not + subexpressions. + * sem_util.adb (Check_Order_Dependence): Code cleanup, to correspond + to latest version of AI05-144-2. + * sem_warn.adb (Warn_On_Overlapping_Actuals): Code cleanup. + + 2010-10-25 Robert Dewar + + * sem_ch13.adb (Build_Static_Predicate): Moved out of + Build_Predicate_Function. + (Build_Static_Predicate): Complet rewrite for more general predicates + + 2010-10-25 Richard Kenner + Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity, case E_Function): Allow + In Out/Out parameters for functions. + * gcc-interface/trans.c (gnu_return_var_stack): New variable. + (create_init_temporary): New static function. + (Subprogram_Body_to_gnu): Handle In Out/Out parameters for functions. + (call_to_gnu): Likewise. Use create_init_temporary in order to create + temporaries for unaligned parameters and return value. If there is an + unaligned In Out or Out parameter passed by reference, push a binding + level if not already done. If a binding level has been pushed and the + call is returning a value, create the call statement. + (gnat_to_gnu) : Handle In Out/Out parameters for + functions. + + 2010-10-22 Ben Brosgol + + * gnat_rm.texi: Add chapter on Ada 2012 support. + + 2010-10-22 Robert Dewar + + * sem_ch12.adb: Minor reformatting. + + 2010-10-22 Thomas Quinot + + * exp_dist.adb: Mark missing case of nested package when expanding + stubs. + + 2010-10-22 Ed Schonberg + + * par-ch10.adb: Discard incomplete with_clause. + + 2010-10-22 Robert Dewar + + * checks.adb (Enable_Range_Check): Remove code suppressing range check + if static predicate present, not needed. + * exp_attr.adb (Expand_Pred_Succ): Check Suppress_Assignment_Checks flag + * exp_ch3.adb (Expand_N_Object_Declaration): Check + Suppress_Assignment_Checks flag. + * exp_ch4.adb (Expand_N_In): Make some corrections for proper handling + of ranges when predicates are present. + * exp_ch5.adb (Expand_Predicated_Loop): New procedure + (Expand_N_Assignment_Statement): Check Suppress_Assignment_Checks flag + (Expand_N_Loop_Statement): Handle loops over predicated types + * sem_case.adb (Analyze_Choices): Remove extra blank in error message. + * sem_ch13.adb (Build_Predicate_Function.Add_Call): Suppress info + message for inheritance if within a generic instance, not useful there! + (Build_Static_Predicate): Optimize test in predicate function + based on static ranges determined. + * sem_ch5.adb (Analyze_Iteration_Scheme): Error for loop through + subtype with non-static predicate. + * sinfo.ads, sinfo.adb (Suppress_Assignment_Checks): New flag. + + 2010-10-22 Thomas Quinot + + * uname.adb (Get_Unit_Name.Add_Node_Name): If encountering an error + node in the unit name, propagate Program_Error to guard against + cascaded errors. + + 2010-10-22 Javier Miranda + + * sem_ch8.adb (Find_Selected_Component): Do not generate a subtype for + selected components of dispatch table wrappers. + + 2010-10-22 Ed Schonberg + + * exp_ch9.adb (Make_Initialize_Protection): A protected type that + implements an interface must be treated as if it has entries, to + support dispatching select statements. + + 2010-10-22 Robert Dewar + + * sem_aggr.adb, sem_ch3.adb: Minor reformatting. + + 2010-10-22 Javier Miranda + + * sem_aggr.adb (Resolve_Array_Aggregate.Add): If the type of the + aggregate has a non standard representation the attributes 'Val and + 'Pos expand into function calls and the resulting expression is + considered non-safe for reevaluation by the backend. Relocate it into + a constant temporary to indicate to the backend that it is side + effects free. + + 2010-10-22 Ed Schonberg + + * sem_ch3.adb (Build_Concurrent_Derived_Type): Create declaration for + derived corresponding record type only when expansion is enabled. + + 2010-10-22 Robert Dewar + + * sem_case.adb, sem_attr.adb (Bad_Predicated_Subtype_Use): Change order + of parameters. + * sem_ch13.adb (Build_Predicate_Function): Don't give inheritance + messages for generic actual subtypes. + * sem_ch9.adb, sem_res.adb, sem_util.adb, sem_util.ads, sem_ch3.adb + (Bad_Predicated_Subtype_Use): Use this procedure. + + 2010-10-22 Robert Dewar + + * sem_ch5.adb: Minor reformatting. + + 2010-10-22 Robert Dewar + + * a-except-2005.adb (Rmsg_18): New message text. + * a-except.adb (Rmsg_18): New message text. + * atree.adb (List25): New function + (Set_List25): New procedure + * atree.ads (List25): New function + (Set_List25): New procedure + * einfo.adb (Static_Predicate): Is now a list + (OK_To_Reference): Present in all entities + * einfo.ads (Static_Predicate): Is now a list + (OK_To_Reference): Applies to all entities + * exp_ch13.adb (Build_Predicate_Function): Moved to Sem_Ch13 + * sem_attr.adb (Bad_Attribute_For_Predicate): Call + Bad_Predicated_Subtype_Use. + * sem_case.ads, sem_case.adb: Major surgery to deal with predicated + subtype case. + * sem_ch13.adb (Build_Predicate_Function): Moved from Exp_Ch13 to + Sem_Ch13. + (Build_Static_Predicate): New procedure handles static predicates. + * sem_ch3.adb (Analyze_Subtype_Declaration): Delay freeze on subtype + with no constraint if ancestor subtype has predicates. + (Analyze_Variant_Part): New calling sequence for Analyze_Choices + * sem_ch4.adb (Junk_Operand): Don't complain about OK_To_Reference + entity. + (Analyze_Case_Expression): New calling sequence for Analyze_Choices + * sem_ch5.adb (Analyze_Case_Statement): New calling sequence for + Analyze_Choices. + * sem_util.ads, sem_util.adb (Bad_Predicated_Subtype_Use): New procedure + * types.ads (PE_Bad_Predicated_Generic_Type): Replaces + PE_Bad_Attribute_For_Predicate. + * atree.h: Add definition of List25. + + 2010-10-22 Jerome Lambourg + + * gnatlink.adb (Process_Binder_File): Remove CLI-specific code, now + moved to dotnet-ld. + (Gnatlink): Remove CLI-specific code, moved to dotnet-ld + * bindgen.adb (Gen_Object_Files_Options): Do not issue -L switches with + the .NET compiler, useless and unsupported. + + 2010-10-22 Robert Dewar + + * sem_util.ads (Get_Num_Lit_From_Pos): Fix errors in documentation, + this returns a Node_Id for a reference to the entity, not the entity + itself! + + 2010-10-22 Ed Schonberg + + * sem_ch5.adb (Analyze_Iteration_Scheme): use Insert_Actions when + bounds require a temporary. + + 2010-10-22 Robert Dewar + + * sem_ch4.adb: Minor reformatting. + * sinfo.ads: Minor comment fixes for Ada 2012 syntax. + + 2010-10-22 Robert Dewar + + * par-ch5.adb: Minor reformatting. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-22 Robert Dewar + + * a-except.adb, a-except-2005.adb: Add new Rcheck entry. + * exp_ch13.adb (Add_Call): Make sure subtype is marked with + Has_Predicates set to True if it inherits predicates. + * sem_attr.adb: Handle 'First/'Last/'Range for predicated types + * types.ads (PE_Bad_Attribute_For_Predicate): New reason code + * types.h: Add new Rcheck entry. + * einfo.ads, einfo.adb (Static_Predicate): New field. + Minor code reorganization (file float routines in proper section) + Fix bad field name in comments. + + 2010-10-22 Robert Dewar + + * sem_eval.adb (Subtypes_Statically_Compatible): Check null exclusion + case. + + 2010-10-22 Vincent Celier + + * prj-conf.adb (Get_Config_Switches): Detect if there is at least one + declaration of IDE'Compiler_Command for one of the language in the main + project. + (Do_Autoconf): If there were at least one Compiler_Command declared and + no target, invoke gprconfig with --target=all instead of the normalized + host name. + + 2010-10-22 Robert Dewar + + * par-ch4.adb: Update syntax in comments for Ada 2012. + * sinfo.ads: Update syntax in comments for Ada 2012 + * par-ch3.adb (Check_Restricted_Expression): Remove "in Ada 2012 mode" + from msg. + + 2010-10-22 Gary Dismukes + + * sem_ch3.adb (Check_Or_Process_Discriminants): In Ada 2012, allow + limited tagged types to have defaulted discriminants. Customize the + error message for the Ada 2012 case. + (Process_Discriminants): In Ada 2012, allow limited tagged types to have + defaulted discriminants. Customize the error message for the Ada 2012 + case. + * sem_ch6.adb (Create_Extra_Formals): Suppress creation of the extra + formal for out formals of discriminated types in the case where the + underlying type is a limited tagged type. + * exp_attr.adb (Expand_N_Attribute_Reference, case + Attribute_Constrained): Return True for 'Constrained when the + underlying type of the prefix is a limited tagged type. + + 2010-10-22 Thomas Quinot + + * sem_ch3.adb (Complete_Private_Subtype): The full view of the subtype + may already have a rep item chain inherited from the full view of the + base type, so do not overwrite it when propagating rep items from the + partial view of the subtype. + * sem_ch3.adb: Minor code reorganization. Minor reformatting. + + 2010-10-22 Sergey Rybin + + * gnat_ugn.texi (gnatmetric): Remove description of debug option. + + 2010-10-22 Tristan Gingold + + * adaint.c (__gnat_number_of_cpus): Add implementation for VMS. + + 2010-10-22 Ed Schonberg + + * par-ch5.adb: Set properly starting sloc of loop parameter. + + 2010-10-22 Ed Schonberg + + * sem_util.adb (May_Be_Lvalue): An actual in a function call can be an + lvalue in Ada2012, if the function has in-out parameters. + + 2010-10-22 Robert Dewar + + * cstand.adb, einfo.adb, exp_attr.adb, sem_prag.adb, sem_vfpt.adb, + sem_ch10.adb: Minor reformatting. + + 2010-10-22 Sergey Rybin + + * gnat_ugn.texi: Remove most of the content of gnatcheck chapter. + + 2010-10-22 Ed Schonberg + + * sem_attr.adb: Handle indexed P'old. + + 2010-10-22 Geert Bosch + + * cstand.adb (Build_Float_Type): Set Float_Rep according to platform. + * einfo.ads (Float_Rep): New attribute. + (Float_Rep_Kind): Move from body. Add comments. + * einfo.adb (Float_Rep_Kind): Move to spec + (Float_Rep): Now a real field instead of local function. + (Set_Float_Rep): New procedure to set floating point representation + (Set_Vax_Float): Remove. + (Write_Entity_Flags): Remove Vax_Float flag. + (Write_Field10_Name): Add E_Floating_Point_Type case for Float_Rep. + * exp_attr.adb (Attribute_Valid): Use case statement for representation + specific processing. + * sem_ch3.adb (Build_Derived_Numeric_Type, + Floating_Point_Type_Declaration): Set Float_Rep instead of Vax_Float + attribute. + * sem_util.ads, sem_util.adb (Is_AAMP_Float): Remove. + * sem_vfpt.adb (Set_D_Float, Set_F_Float, Set_G_Float, Set_IEEE_Long, + Set_IEEE_Short): Set Float_Rep instead of Vax_Float attribute. + + 2010-10-22 Robert Dewar + + * sprint.adb: Minor reformatting. + + 2010-10-22 Robert Dewar + + * exp_ch3.adb (Expand_N_Object_Declaration): Do required predicate + checks. + * sem_ch3.adb (Complete_Private_Subtype): Propagate predicates to full + view. + * sem_ch6.adb (Invariants_Or_Predicates_Present): New name for + Invariants_Present. + (Process_PPCs): Handle predicates generating post conditions + * sem_util.adb (Is_Partially_Initialized_Type): Add + Include_Null parameter. + * sem_util.ads (Is_Partially_Initialized_Type): Add + Include_Null parameter. + + 2010-10-22 Sergey Rybin + + * gnat_ugn.texi (gnatelim): Add description for '--ignore' option + + 2010-10-22 Thomas Quinot + + * sem_prag.adb (Check_First_Subtype): Specialize error messages for + case where argument is not a type. + + 2010-10-22 Robert Dewar + + * exp_ch5.adb, par-ch4.adb, par-ch5.adb, sem_ch5.adb, sinfo.ads: Minor + reformatting. + + 2010-10-22 Arnaud Charlet + + * a-locale.adb: Minor code clean up. + + 2010-10-22 Thomas Quinot + + * exp_ch4.adb: Minor code reorganization and factoring. + + 2010-10-22 Thomas Quinot + + * exp_ch5.adb, sem_ch5.adb, sinfo.ads, snames.ads-tmpl, par-ch5.adb: + Minor reformatting. + + 2010-10-22 Geert Bosch + + * stand.ads: Fix typo in comment. + + 2010-10-22 Ed Schonberg + + * sem_ch6.adb: Enable in-out parameter for functions. + + 2010-10-22 Ed Schonberg + + * sem_ch4.adb (Analyze_Quantified_Expression): Handle properly loop + iterators that are transformed into container iterators after analysis. + * exp_ch4.adb (Expand_N_Quantified_Expression): Handle properly both + iterator forms before rewriting as a loop. + + 2010-10-22 Brett Porter + + * a-locale.adb, a-locale.ads, locales.c: New files. + * Makefile.rtl: Add a-locale + * gcc-interface/Makefile.in: Add locales.c + + 2010-10-22 Robert Dewar + + * sem_util.ads, sem_util.adb, sem_aux.ads, sem_aux.adb + (Is_Generic_Formal): Moved from Sem_Util to Sem_Aux. + + 2010-10-22 Ed Schonberg + + * exp_ch5.adb (Expand_Iterator_Loop): New subprogram, implements new + iterator forms over arrays and containers, in loops and quantified + expressions. + * exp_util.adb (Insert_Actions): include N_Iterator_Specification. + * par-ch4.adb (P_Quantified_Expression): Handle iterator specifications. + * par-ch5.adb (P_Iterator_Specification): New subprogram. Modify + P_Iteration_Scheme to handle both loop forms. + * sem.adb: Handle N_Iterator_Specification. + * sem_ch5.adb, sem_ch5.ads (Analyze_Iterator_Specification): New + subprogram. + * sinfo.adb, sinfo.ads: New node N_Iterator_Specification. + N_Iteration_Scheme can now include an Iterator_Specification. Ditto + for N_Quantified_Expression. + * snames.ads-tmpl: Add names Cursor, Element, Element_Type, No_Element, + and Previous, to support iterators over predefined containers. + * sprint.adb: Handle N_Iterator_Specification. + + 2010-10-22 Thomas Quinot + + * sem_prag.adb, sem_ch12.adb, sem_util.adb, sem_util.ads + (Is_Generic_Formal): Move from body of Sem_Ch12 to Sem_Util. + (Check_Arg_Is_Local_Name): Fix check in the case of a pragma appearing + immediately after a library unit. + (Analyze_Pragma, case Preelaborable_Initialization): Pragma may apply to + a formal derived type. + + 2010-10-22 Geert Bosch + + * gcc-interface/Make-lang.in: Remove ttypef.ads + * checks.adb: Use Machine_Mantissa_Value and Machine_Radix_Value instead + of Machine_Mantissa and Machine_Radix. + * cstand.adb (P_Float_Range): Directly print the Type_Low_Bound and + Type_High_Bound of the type, instead of choosing constants from Ttypef. + (Set_Float_Bounds): Compute the bounds based on Machine_Radix_Value, + Machine_Emax_Value and Machine_Mantissa_Value instead of special-casing + each type. + * einfo.ads (Machine_Emax_Value, Machine_Emin_Value, + Machine_Mantissa_Value, Machine_Radix_Value, Model_Emin_Value, + Model_Epsilon_Value, Model_Mantissa_Value, Model_Small_Value, + Safe_Emax_Value, Safe_First_Value, Safe_Last_Value): Add new + synthesized floating point attributes. + * einfo.adb (Float_Rep): Determine the kind of floating point + representation used for a given type. + (Machine_Emax_Value, Machine_Emin_Value, Machine_Mantissa_Value, + Machine_Radix_Value): Implement based on Float_Rep_Kind of a type and + the number of digits in the type. + (Model_Emin_Value, Model_Epsilon_Value, Model_Mantissa_Value, + Model_Small_Value, Safe_Emax_Value, Safe_First_Value, Safe_Last_Value): + Implement new synthesized floating point attributes based on the various + machine attributes. + * eval_fat.ads: Remove Machine_Mantissa and Machine_Radix. + * eval_fat.adb (Machine_Mantissa, Machine_Radix): Remove. Use the + Machine_Mantissa_Value and Machine_Radix_Value functions instead. + * exp_vfpt.adb (VAXFF_Digits, VAXDF_Digits, VAXFG_Digits): Define local + constants, instead of using constants from Ttypef. + * gnat_rm.texi: Reword comments referencing Ttypef. + * sem_attr.ads: Reword comment referencing Ttypef. + * sem_attr.adb (Float_Attribute_Universal_Integer, + Float_Attribute_Universal_Real): Remove. + (Attribute_Machine_Emax, Attribute_Machine_Emin, + Attribute_Machine_Mantissa, Attribute_Model_Epsilon, + Attribute_Model_Mantissa, Attribute_Model_Small, Attribute_Safe_Emax, + Attribute_Safe_First, Attribute_Safe_Last, Model_Small_Value): Use + attributes in Einfo instead of Float_Attribute_Universal_Real and + Float_Attribute_Universal_Integer and all explicit constants. + * sem_util.ads, sem_util.adb (Real_Convert): Remove. + * sem_vfpt.adb (VAXDF_Digits, VAXFF_Digits, VAXGF_Digits, IEEEL_Digits, + IEEES_Digits): New local constants, in order to remove dependency on + Ttypef. + * tbuild.ads (Make_Float_Literal): New function. + * tbuild.adb (Make_Float_Literal): New function to create a new + N_Real_Literal, constructing it as simple as possible for best + output of constants in -gnatS. + * ttypef.ads: Remove. + + 2010-10-22 Robert Dewar + + * checks.adb (Apply_Predicate_Check): Remove attempt at optimization + when subtype is the same, caused legitimate checks to be missed. + * exp_ch13.adb (Build_Predicate_Function): Use Nearest_Ancestor to get + inheritance from right entity. + * freeze.adb (Freeze_Entity): Use Nearest_Ancestor to freeze in the + derived type case if the ancestor type has predicates. + * sem_aux.ads, sem_aux.adb (Nearest_Ancestor): New function. + * sem_prag.adb (Check_Enabled): Minor code reorganization. + + 2010-10-22 Arnaud Charlet + + * gcc-interface/utils.c, gcc-interface/gigi.h: Minor reformatting. + + 2010-10-22 Thomas Quinot + + * einfo.ads (Declaration_Node): Clarify documentation, in particular + regarding what is returned for subprogram entities. + + 2010-10-22 Arnaud Charlet + + * exp_attr.adb (Make_Range_Test): Generate a Range node instead of + explicit comparisons, generates simpler expanded code. + * a-except-2005.adb (Rcheck_06_Ext): New. + * gcc-interface/trans.c (gigi, gnat_to_gnu): Handle validity checks + like range checks. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-22 Robert Dewar + + * sem_ch3.adb (Array_Type_Declaration): Error for subtype wi predicate + for index type + (Constrain_Index): Error of subtype wi predicate in index constraint + * sem_ch9.adb (Analyze_Entry_Declaration): Error of subtype wi + predicate in entry family. + * sem_res.adb (Resolve_Slice): Error of type wi predicate in slice. + + 2010-10-22 Javier Miranda + + * sem_util.ads, sem_util.adb (Collect_Parents): New subprogram. + (Original_Corresponding_Operation): New subprogram. + (Visible_Ancestors): New subprogram. + * sem_ch6.adb (New_Overloaded_Entity): Handle new case of dispatching + operation that overrides a hidden inherited primitive. + * sem_disp.adb (Find_Hidden_Overridden_Primitive): New subprogram. + (Check_Dispatching_Operation): if the new dispatching operation + does not override a visible primtive then check if it overrides + some hidden inherited primitive. + + 2010-10-22 Ed Schonberg + + * sem_ch10.adb (Analyze_With_Clause): If the parent_unit_name in a with + clause is a child unit that denotes a renaming, replace the + parent_unit_name with a reference to the renamed unit, because the + prefix is irrelevant to subsequent visibility.. + + 2010-10-22 Robert Dewar + + * einfo.ads, einfo.adb (Has_Predicates): Flag is now on all entities + (simplifies code). + * exp_ch13.adb (Build_Predicate_Function): Output info msgs for + inheritance. + * sem_ch13.adb (Analyze_Aspect_Specifications): Make sure we have a + freeze node for entities for which a predicate is specified. + (Analyze_Aspect_Specifications): Avoid duplicate calls + * sem_ch3.adb (Analyze_Full_Type_Declaration): Remove attempt to avoid + duplicate calls to Analye_Aspect_Specifications. + + 2010-10-22 Thomas Quinot + + * a-exextr.adb, atree.ads, freeze.adb: Minor reformatting. + + 2010-10-21 Robert Dewar + + * sem_ch3.adb: Minor reformatting. + + 2010-10-21 Thomas Quinot + + * einfo.ads (Next_Girder_Discriminant): Remove obsolete description for + removed routine. + + 2010-10-21 Nicolas Roche + + * gnatmem.adb, memroot.adb, memroot.ads, gmem.c, + gcc-interface/Makefile.in: Remove gnatmem specific files. + + 2010-10-21 Thomas Quinot + + * sem_res.adb, exp_ch13.adb: Minor reformatting. + + 2010-10-21 Thomas Quinot + + * sem_ch3.adb (Check_Or_Process_Discriminant): Reject illegal attempt + to provide a tagged full view as the completion of an untagged partial + view if the partial view has a discriminant with default. + + 2010-10-21 Arnaud Charlet + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-21 Robert Dewar + + * checks.ads, checks.adb (Apply_Predicate_Check): New procedure + Minor code reorganization. + * einfo.adb (Has_Predicates): Fix assertion. + * exp_ch13.adb (Build_Predicate_Function): Move from Sem_Ch13 spec to + Exp_Ch13 body. + (Expand_N_Freeze_Entity): Call build predicate function. + * exp_ch4.adb (Expand_N_Type_Conversion): Add predicate check. + * exp_ch5.adb (Expand_N_Assignment_Statement): Add predicate check. + * exp_prag.adb (Expand_Pragma_Check): Use all lower case for name of + check. + * freeze.adb (Freeze_Entity): Move building of predicate function to + Exp_Ch13. + * sem_ch13.adb (Build_Predicate_Function): Move from Sem_Ch13 to + Exp_Ch13. + * sem_ch13.ads (Build_Predicate_Function): Move from Sem_Ch13 to + Exp_Ch13. + * sem_ch3.adb (Analyze_Declarations): Remove call to build predicate + function. + * sem_res.adb (Resolve_Actuals): Apply predicate check. + + 2010-10-21 Robert Dewar + + * einfo.ads, einfo.adb: Replace Predicate_Procedure by + Predicate_Functions. + * exp_ch4.adb (Expand_N_In): Handle predicates. + * exp_util.ads, exp_util.adb (Make_Predicate_Call): New function. + (Make_Predicate_Check): New function. + * freeze.adb (Freee_Entity): Build predicate function if needed. + * sem_ch13.adb (Build_Predicate_Function): New procedure. + (Analyze_Aspect_Specifications): No third argument for Predicate pragma + built from Predicate aspect. + * sem_ch13.ads (Build_Predicate_Function): New procedure. + * sem_ch3.adb: Add handling for predicates. + * sem_eval.adb (Eval_Membership_Op): Never static if predicate + functions around. + * sem_prag.adb (Analye_Pragma, case Predicate): Does not take a third + argument. + + 2010-10-21 Robert Dewar + + * einfo.ads, einfo.adb: Add handling of predicates. + Rework handling of invariants. + * exp_ch3.adb, exp_ch4.adb, exp_util.adb, sem_ch6.adb: Minor changes to + handing of invariants. + * par-prag.adb: Add dummy entry for pragma Predicate + * sem_ch13.adb (Analyze_Aspect_Specifications): Add processing for + Predicate aspects. + * sem_prag.adb: Add implementation of pragma Predicate. + * snames.ads-tmpl: Add entries for pragma Predicate. + + 2010-10-21 Robert Dewar + + * elists.adb: Minor reformatting. + + 2010-10-21 Geert Bosch + + * urealp.adb (UR_Write): Write hexadecimal constants with exponent 1 as + decimal constants, and write any others using the exponent notation. + Minor reformatting throughout + (Store_Ureal_Normalized): New function (minor code reorganization) + + 2010-10-21 Robert Dewar + + * einfo.ads, xeinfo.adb: Minor reformatting. + * s-stalib.ads: Minor comment fixes. + + 2010-10-21 Ed Schonberg + + * sem_ch6.adb (Enter_Overloaded_Entity): Refine warning message about + hiding, to remove noise warnings about hiding predefined operators. + + 2010-10-21 Emmanuel Briot + + * g-comlin.adb (Add_Switch): Fix handling of switches with no separator + when the parameter has length 1. + + 2010-10-21 Jose Ruiz + + * sem_prag.adb (Set_Ravenscar_Profile): Enforce the restrictions of no + dependence on Ada.Execution_Time.Timers, + Ada.Execution_Time.Group_Budget, and + System.Multiprocessors.Dispatching_Domains which are part of the + Ravenscar Profile. + * impunit.adb (Non_Imp_File_Names_05): Add the file "a-etgrbu" to the + list of Ada 2005 files for package Ada.Execution_Time.Group_Budgets. + (Non_Imp_File_Names_12): Add the file "s-mudido" to the list of Ada 2012 + files for package System.Mutiprocessors.Dispatching_Domains. + + 2010-10-21 Tristan Gingold + + * ug_words, vms_data.ads: Define the VMS qualifier for -gnateE. + + 2010-10-21 Thomas Quinot + + * sem_ch3.ads (Process_Discriminants): Clarify cases where this is + called for a completion. + + 2010-10-21 Geert Bosch + + * uintp.ads: Expand image buffer to have enough room for 128-bit values + * urealp.ads (UR_Write): Write constants in base 16 in hexadecimal + notation; either as fixed point literal or in canonical radix 16 + floating point form. + + 2010-10-21 Robert Dewar + + * a-cgaaso.ads, a-tags.ads, exp_ch3.adb, exp_attr.adb, exp_ch4.adb, + exp_ch3.ads, exp_ch7.adb, exp_ch9.adb, exp_disp.adb, exp_disp.ads, + exp_dist.adb, exp_util.adb, layout.adb, lib-xref.adb, lib.ads, + prep.adb, prj-strt.adb, s-ststop.adb, s-taskin.ads, s-tataat.ads, + sem_aggr.adb, sem_attr.adb, sem_ch12.adb, sem_ch3.adb, sem_ch4.adb, + sem_ch4.ads, sem_ch5.adb, sem_res.adb, sem_util.adb, einfo.adb, + g-sothco.ads, make.adb: Minor reformatting + + 2010-10-21 Vincent Celier + + * vms_data.ads: Add new qualifiers /SRC_INFO= and + /UNCHECKED_SHARED_LIB_IMPORTS for GNAT COMPILE. + Correct qualifier /SRC_INFO= for GNAT MAKE + + 2010-10-21 Ed Schonberg + + * exp_aggr.adb (Flatten): An association for a subtype may be an + expanded name. + (Safe_Left_Hand_Side): An unchecked conversion is part of a safe + left-hand side if the expression is. + (Is_Safe_Index): new predicate + * exp_ch3.adb (Expand_Freeze_Enumeration_Type): Indicate that the + generated Rep_To_Pos function is a Pure_Function. + + 2010-10-21 Robert Dewar + + * gnat_rm.texi: Document Invariant pragma. + + 2010-10-21 Javier Miranda + + * exp_ch5.adb: Update comment. + + 2010-10-21 Robert Dewar + + * sem_ch13.adb (Build_Invariant_Procedure): Remove commented out code + for interfaces, since invariants are not allowed on interfaces in any + case. + + 2010-10-21 Javier Miranda + + * sem_attr.adb (Resolve_Attribute): After replacing the range attribute + node with a range expression ensure that its evaluation will not have + side effects. + * exp_ch5.adb (Expand_Assign_Array): Propagate the Parent to the + unchecked conversion node generated to handle assignment of private + types. Required to allow climbing the subtree if Insert_Action is + invoked later. + + 2010-10-21 Robert Dewar + + * par-ch3.adb (P_Interface_Type_Definition): Allow for possibility of + aspect clause presence terminating the type definition. + + 2010-10-21 Robert Dewar + + * exp_ch4.adb, exp_intr.adb, par-ch4.adb, scn.adb, sem_ch4.adb, + sem_res.adb, sem_util.adb, sinfo.ads, a-except-2005.adb: Minor + reformatting. + * snames.ads-tmpl: Add note on Name_Some (not a reserved keyword). + + 2010-10-21 Geert Bosch + + * ttypef.ads: Further cleanup of Safe_XXX float attributes. + + 2010-10-19 Ed Schonberg + + * exp_ch4.adb, exp_ch4.ads (Expand_Quantified_Expression): New procedure + * exp_util.adb (Insert_Actions): Include Quantified_Expression. + * expander.adb: Call Expand_Qualified_Expression. + * par.adb: New procedure P_Quantified_Expression. Make + P_Loop_Parameter_Specification global for use in quantified expressions. + * par-ch3.adb (P_Subtype_Mark_Resync): Allow "some" as an identifier if + version < Ada2012. + * par-ch4.adb: New procedure P_Quantified_Expression. + * par-ch5.adb: P_Loop_Parameter_Specification is now global. + * scans.adb, scans.ads: Introduce token Some. For now leave as + unreserved. + * scn.adb (Scan_Reserved_Identifier): For earlier versions of Ada, + treat Some as a regular identifier. + * sem.adb: Call Analyze_Quantified_Expression. + * sem_ch4.adb, sem_ch4.ads: New procedure Analyze_Quantified_Expression. + * sem_ch5.adb, sem_ch5.ads: Analyze_Iteration_Scheme is public, for use + in quantified expressions. + * sem_res.adb: New procedure Resolve_Qualified_Expression. + * sinfo.adb, sinfo.ads: New node N_Quantified_Expression + * snames.ads-tmpl: New name Some. + * sprint.adb: Output quantified_expression. + + 2010-10-19 Robert Dewar + + * a-exexda.adb: Minor reformatting + Minor code reorganization. + + 2010-10-19 Robert Dewar + + * sem_eval.adb: Minor reformatting. + + 2010-10-19 Tristan Gingold + + * exp_ch4.adb (Expand_N_And_Op, Expand_N_Or_Op, Expand_N_Xor_Op): Call + Expand_Intrinsic_Call if the function is intrinsic. + * exp_intr_adb (Expand_Binary_Operator): Handle VMS case for logical + binary operator on the unsigned_quadword record. + * exp_intr.ads (Expand_Intrinsic_Call): Update comments. + + 2010-10-19 Geert Bosch + + * gnat_rm.texi (pragma Float_Representation): Fix typo. + + 2010-10-19 Arnaud Charlet + + * switch-c.adb (Scan_Front_End_Switches): Add handling of -gnateE. + * fe.h (Exception_Extra_Info): Declare. + * usage.adb (usage): Add -gnateE doc. + * checks.adb (Install_Null_Excluding_Check): Use better sloc. + * sem_util.adb (Insert_Explicit_Dereference): Ditto. + * gnat_ugn.texi: Document -gnateE switch. + * a-except.adb (Set_Exception_C_Msg): New parameter Column. + * a-except-2005.adb (Set_Exception_C_Msg): New parameter Column. + (Raise_Constraint_Error_Msg): Ditto. + (Image): New helper function. + (Rcheck_00_Ext, Rcheck_05_Ext, Rcheck_12_Ext): New procedure with more + detailed exception information. + Adjust calls to Set_Exception_C_Msg and Raise_Constraint_Error_Msg. + * a-exexda.adb (Set_Exception_C_Msg): New parameter Column. + * opt.ads (Exception_Extra_Info): New flag. + * gcc-interface/utils.c (gnat_raise_decls_ext): New. + * gcc-interface/utils2.c (build_call_raise_range, + build_call_raise_column): New functions. + * gcc-interface/gigi.h (exception_info_kind, gnat_raise_decls_ext, + build_call_raise_range, build_call_raise_column): Declare. + gcc-interface/trans.c (build_raise_check): New function. + (gigi): Initialize gnat_raise_decls_ext. + (gnat_to_gnu): Add initial support for -gnateE switch. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-19 Geert Bosch + + * ttypef.ads: Change VAXDF_Last to be -VAXDF_First, as type is + symmetric. + + 2010-10-19 Robert Dewar + + * atree.h (Field29): Fix incorrect definition. + * einfo.adb (Invariant_Procedure): New attribute + (Has_Invariants): New flag + (Has_Inheritable_Invariants): New flag + (OK_To_Reference): New flag + Minor code reorganization (use Next_Rep_Item function) + * einfo.ads (Invariant_Procedure): New attribute + (Has_Invariants): New flag + (Has_Inheritable_Invariants): New flag + (OK_To_Reference): New flag + * exp_ch3.adb (Expand_N_Object_Declaration): Add check for invariant + * exp_ch4.adb (Expand_N_Type_Conversion): Check invariant on type + conversion. Minor reformatting. + * exp_util.ads, exp_util.adb (Make_Invariant_Call): New procedure. + * opt.ads (List_Inherited_Aspects): New name for List_Inherited_Pre_Post + * par-prag.adb: Add dummy entry for pragma Invariant. + * sem_ch13.adb (Build_Invariant_Procedure): New procedure + (Analyze_Aspect_Specification): Add support for Invariant aspect + * sem_ch13.ads (Build_Invariant_Procedure): New procedure + * sem_ch3.adb (Build_Derived_Type): Propagate invariant information + (Process_Full_View): Deal with invariants, building invariant procedure + Minor reformatting + * sem_ch6.adb (Process_PPCs): Add processing of invariants + * sem_ch7.adb (Analyze_Package_Specification): Build invariant + procedures. + * sem_prag.adb: Implement pragma Invariant. + * sem_res.adb (Resolve_Entity_Name): Allow type reference if + OK_To_Reference set. + * sem_warn.adb (List_Inherited_Aspects): New name for + List_Inherited_Pre_Post. + * snames.ads-tmpl: Add entries for pragma Invariant. + * treepr.adb (Print_Entity_Information): Add handling of Field29. + * usage.adb: Warning .l/.L applies to invariant as well as pre/post. + + 2010-10-19 Javier Miranda + + * par-ch4.adb: Update documentation of Ada 2012 syntax rules for + membership test. + + 2010-10-19 Bob Duff + + * sem_attr.adb (Eval_Attribute): Implement Max_Alignment_For_Allocation + attribute. + * exp_attr.adb (Expand_N_Attribute_Reference): Add + Attribute_Max_Alignment_For_Allocation to the case statement. + * snames.ads-tmpl (Name_Max_Alignment_For_Allocation, + Attribute_Max_Alignment_For_Allocation): New attribute name. + + 2010-10-19 Ed Schonberg + + * sem_ch3.adb (OK_For_Limited_Init_In_05): a call to an access to + parameterless function appears syntactically as an explicit dereference. + + 2010-10-19 Thomas Quinot + + * sem_ch8.adb, sem_ch12.adb, opt.ads, sem_ch6.adb, sem_res.adb, + i-cexten.ads, exp_disp.adb, exp_ch4.adb, exp_ch9.adb: Minor reformatting + + 2010-10-19 Thomas Quinot + + * sem_util.adb (Collect_Primitive_Operations): A function with an + anonymous access result designating T is a primitive operation of T. + + 2010-10-19 Tristan Gingold + + * init.c: On Alpha/VMS, only adjust PC for HPARITH. + + 2010-10-19 Tristan Gingold + + * sem_attr.adb (Eval_Attribute): Handle Attribute_Ref, which can be + evaluated on VMS. + + 2010-10-19 Ed Schonberg + + * sem_ch12.adb (Check_Generic_Child_Unit): Handle properly the case of + an instantiation of a renaming of the implicit generic child that + appears within an instance of its parent. + + 2010-10-19 Thomas Quinot + + * exp_ch9.adb: Minor reformatting. + * einfo.adb, einfo.ads, atree.adb, atree.ads, exp_dist.adb, atree.h: + (Referenced_Object): Remove unused entity attribute. + (Direct_Primitive_Operations): Move to Elist10, this is set for all + tagged types, including synchronous ones, so can't use field15 which is + used as Storage_Size_Variable for task types and Entry_Bodies_Array for + protected types. + (Add_RACW_Primitive_Declarations_And_Bodies): Remove bogus guard + against Concurrent_Types (we must handle the case of a RACW designating + a class-wide private synchronous type). + Use Direct_Primitive_Operations, not Primitive_Operations, since we + really want the former. + + 2010-10-19 Bob Duff + + * sem_ch8.adb (Pop_Scope): Change "return;" to "raise Program_Error;". + + 2010-10-19 Javier Miranda + + * exp_ch4.adb (Expand_Set_Membership.Make_Cond): Add missing support + for N_Range nodes. + + 2010-10-19 Thomas Quinot + + * einfo.ads, atree.ads: Minor comment fixes. + + 2010-10-18 Bob Duff + + * sinfo.ads, sinfo.adb: Modify comment about adding fields to be more + correct, and to be in a more convenient order. + (Default_Storage_Pool): New field of N_Compilation_Unit_Aux, for + recording the Default_Storage_Pool for a parent library unit. + * einfo.ads (Etype): Document the case in which Etype can be Empty. + * sem_prag.adb (Pragma_Default_Storage_Pool): Analyze the new + Default_Storage_Pool pragma. + * sem.ads (Save_Default_Storage_Pool): Save area for push/pop scopes. + * gnat_ugn.texi: Document Default_Storage_Pool as a new configuration + pragma. + * freeze.adb (Freeze_Entity): When freezing an access type, take into + account any Default_Storage_Pool pragma that applies. We have to do + this at the freezing point, because up until that point, a Storage_Pool + or Storage_Size clause could occur, which should override the + Default_Storage_Pool. + * par-prag.adb: Add this pragma to the list of pragmas handled entirely + during semantics. + * sem_ch8.adb (Push_Scope, Pop_Scope): Save and restore the + Default_Storage_Pool information. + * opt.ads (Default_Pool, Default_Pool_Config): New globals for recording + currently-applicable Default_Storage_Pool pragmas. + * opt.adb: Save/restore the globals as appropriate. + * snames.ads-tmpl (Name_Default_Storage_Pool, + Pragma_Default_Storage_Pool): New pragma name. + + 2010-10-18 Vincent Celier + + * make.adb (Switches_Of): Put the spec and body suffix in canonical + case. + + 2010-10-18 Ed Schonberg + + * sem_ch13.adb (Analyze_Aspect_Specifications): If subprogram is at the + library level, the pre/postconditions must be treated as global + declarations, i.e. placed on the Aux_Decl nodes of the compilation unit. + * freeze.adb (Freeze_Expression): If the expression is at library level + there is no enclosing record to check. + + 2010-10-18 Javier Miranda + + * sem_ch3.ads (Find_Type_Name): Add documentation. + * sem_ch3.adb (Analyze_Full_Type_Declaration): Code cleanup because the + propagation of the class-wide entity is now done by routine + Find_Type_Name to factorize this code. + (Analyze_Private_Extension_Declaration): Handle private type that + completes an incomplete type. + (Tag_Mismatch): Add error message for tag mismatch in a private type + declaration that completes an incomplete type. + (Find_Type_Name): Handle completion of incomplete type by means of + a private declaration. Generate an error if a tagged incomplete type + is completed by an untagged private type. + * sem_ch7.adb (New_Private_Type): Handle private type that completes an + incomplete type. + * einfo.ads (Full_View): Add documentation. + + 2010-10-18 Ed Schonberg + + * sem_ch12.adb (Analyze_Formal_Package_Declaration): If the package is + a renaming, generate a reference for it before analyzing the renamed + entity, to prevent spurious warnings. + + 2010-10-18 Jose Ruiz + + * adaint.c (__gnat_pthread_setaffinity_np, + __gnat_pthread_attr_setaffinity_np): Remove wrappers, no longer needed. + * s-osinte-linux.ads (pthread_setaffinity_np, + pthread_attr_setaffinity_np): Remove use of wrappers. + * s-taprop-linux.adb (Create_Task, Initialize): Restore check to verify + whether the affinity functionality is available in the OS. + * gcc-interface/utils.c: Set TREE_STATIC on functions only when there + are defined. + + 2010-10-18 Robert Dewar + + * einfo.ads, einfo.adb: Minor reformatting. + * gnat_ugn.texi, ug_words: Add missing entries, fix typos. + + 2010-10-18 Emmanuel Briot + + * g-comlin.adb (Is_In_Config): When the switch accepts either a space + or equal, we output an equal every time. + + 2010-10-18 Ed Schonberg + + * sem_res.adb (Resolve_Entry_Call): Handle call to an entry family + member when pre/post conditions are present. + * exp_ch9.adb (Build_PPC_Wrapper): The PPC_Wrapper for an entry family + includes an index parameter, and the name of the enclosed entry call is + an indexed component. + + 2010-10-18 Robert Dewar + + * einfo.ads, einfo.adb: Minor reformatting. + + 2010-10-18 Jose Ruiz + + * adaint.c (__gnat_pthread_setaffinity_np, + __gnat_pthread_attr_setaffinity_np): Add these wrappers which check the + availability of the underlying OS functionality before calling. + * s-osinte-linux.ads (pthread_setaffinity_np, + pthread_attr_setaffinity_np): Call a wrapper instead of the OS function + to perform a check of its availability. + * s-taprop-linux.adb (Create_Task): Remove the check to verify whether + the affinity functionality is available in the OS. Now done in a wrapper + * gcc-interface/Makefile.in: Remove vmshandler.asm, unused. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-18 Robert Dewar + + * sinfo.ads, sinfo.adb: Change Has_Pragma_CPU to Flag14 (Flag10 is + standard field). + + 2010-10-18 Robert Dewar + + * s-stausa.adb, s-taprop-linux.adb, s-taprop-mingw.adb, s-tassta.ads: + Minor reformatting. + + 2010-10-18 Robert Dewar + + * exp_strm.adb (Build_Elementary_Input_Call): Check + No_Default_Stream_Attributes. + (Build_Elementary_Write_Call): Check No_Default_Stream_Attributes + * s-rident.ads: Add restriction No_Default_Stream_Attributes + Put restriction No_Allocators_After_Elaboration in alpha order + + 2010-10-18 Jose Ruiz + + * exp_ch9.adb (Expand_N_Task_Type_Declaration): Add field corresponding + to the affinity when expanding the task declaration. + (Make_Task_Create_Call): Add the affinity parameter to the call to + create task. + * sem_prag.adb (Analyze_Pragma): Add the analysis for pragma CPU, + taking into account the case when it applies to a subprogram (only for + main and with static expression) or to a task. + * par_prag.adb:(Prag): Make pragma CPU a valid one. + * snames.ads-tmpl (Name_uCPU, Name_CPU): Add these new name identifiers + used by the expander for handling the affinity parameter when creating + a task. + (Pragma_Id): Add Pragma_CPU as a valid one. + * rtsfind.ads (RTU_Id): Make System_Multiprocessors accesible. + (RE_Id, RE_Unit_Table): Make the entities RE_CPU_Range and + RE_Unspecified_CPU visible. + * sinfo.ads, sinfo.adb (Has_Pragma_CPU, Set_Has_Pragma_CPU): Add these + two subprograms to set/get the flag indicating whether there is a + pragma CPU which applies to the entity. + * lib.ads, lib.adb (Unit_Record, Default_Main_CPU, Main_CPU, + Set_Main_CPU): Add the field Main_CPU to Unit_Record to store the value + of the affinity associated to the main subprogram (if any). + Default_Main_CPU is used when no affinity is set. Subprograms + Set_Main_CPU and Main_CPU are added to set/get the affinity of the main + subprogram. + * ali.ads, ali.adb (ALIs_Record): Add field Main_CPU to contain the + value of the affinity of the main subprogram. + (Scan_ALI): Get the affinity of the main subprogram (encoded as C=XX in + the M line). + * lib-writ.ads, lib-writ.adb (M_Parameters): Encode the affinity of the + main subprogram in the M (main) line using C=XX. + * lib-load.adb (Create_Dummy_Package_Unit, Load_Main_Source, + Load_Unit): Add new field Main_CPU. + * bindgen.adb (Gen_Adainit_Ada, Gen_Adainit_C): Add the code to pass + the affinity of the main subprogram to the run time. + * s-taskin.ads (Common_ATCB): Add the field Base_CPU to store the + affinity. + (Unspecified_CPU): Add this constant to identify the case when no + affinity is set for tasks. + * s-taskin.adb (Initialize_ATCB): Store the value coming from pragma + CPU in the common part of the ATCB. + (Initialize): Store the value coming from pragma CPU (for the + environment task) in the common part of the ATCB. + * s-tassta.ads, s-tassta.adb (Create_Task): Add the affinity specified + by pragma CPU to the ATCB. + * s-tarest.ads, s-tarest.adb (Create_Restricted_Task): Add the affinity + specified by pragma CPU to the ATCB. + * s-tporft.adb (Register_Foreign_Thread): Add the new affinity + parameter to the call to Initialize_ATCB. + * s-taprop-linux.adb (Create_Task): Change the attributes of the thread + to include the task affinity before creation. Additionally, the + affinity selected with Task_Info is also enforced changing the + attributes at task creation time, instead of changing it after creation. + (Initialize): Change the affinity of the environment task if required + by a pragma CPU. + * s-osinte-linux.ads (pthread_setaffinity_np): Instead of using a + wrapper to check whether the function is available or not, use a weak + symbol. + (pthread_attr_setaffinity_np): Add the import of this function which is + used to change the affinity in the attributes used to create a thread. + * adaint.c (__gnat_pthread_attr_setaffinity_np): Remove this wrapper. + It was used to check whether the pthread function was available or not, + but the use of a weak symbol handles this situation in a cleaner way. + * s-taprop-mingw.adb (Create_Task, Initialize): Change the affinity of + tasks (including the environment task) if required by a pragma CPU. + * s-taprop-solaris.adb (Enter_Task): Change the affinity of tasks + (including the environment task) if required by a pragma CPU. + * s-taprop-vxworks.adb (Create_Task, Initialize): Change the affinity + of tasks (including the environment task) if required by a pragma CPU. + * init.c (__gl_main_cpu): Make this value visible to the run time. It + will pass the affinity of the environment task. + + 2010-10-18 Javier Miranda + + * einfo.adb (Direct_Primitive_Operations): Complete assertion. + + 2010-10-18 Vincent Celier + + * prj.ads (Source_Data): New Boolean flag In_The_Queue. + + 2010-10-18 Tristan Gingold + + * s-stausa.ads: Add the Top parameter to Initialize_Analyzer. + * s-stausa.adb: Use the top parameter. In Fill_Stack, use the + stack top if known. + * s-tassta.adb (Task_Wrapper): Call Initialize_Analyzer after Enter_Task + so that Pri_Stack_Info.Limit can be set and used. + + 2010-10-18 Robert Dewar + + * einfo.ads: Minor reformatting. + * sem_res.adb (Resolve_Allocator): Add test for violating + No_Anonymous_Allocators. + + 2010-10-18 Robert Dewar + + * prj-nmsc.adb, prj.adb, sem_res.adb: Minor reformatting. + + 2010-10-18 Ed Schonberg + + * sem_util.adb (Insert_Explicit_Dereference): If operand is a selected + component, we generate a reference to the ultimate prefix when it is an + entity name. We must place the reference on the identifier for that + prefix, and not on the operand itself, to prevent spurious extra + references in the ali file. + + 2010-10-18 Vincent Celier + + * projects.texi: Add documentation for attribute Ignore_Source_Sub_Dirs + + 2010-10-18 Ed Schonberg + + * einfo.ads, einfo.adb: New attribute PPC_Wrapper for entries and entry + families. Denotes a procedure that performs pre/postcondition checks + and then performs the entry call. + * sem_res.adb (Resolve_Entry_Call): If the entry has + pre/postconditions, replace call with a call to the PPC_Wrapper of the + entry. + * exp_ch9.adb (Build_PPC_Wrapper): new procedure. + (Expand_N_Entry_Declaration, Expand_N_Protected_Type_Declaration): call + Build_PPC_Wrapper for all entries in task and protected definitions. + + 2010-10-18 Tristan Gingold + + * init.c: Add __gnat_set_stack_guard_page and __gnat_set_stack_limit. + Implement stack limitation on VMS. + Minor reformatting. + + 2010-10-18 Vincent Celier + + * prj.adb (Is_Compilable): Do not modify Source.Compilable until the + source record has been initialized. + + 2010-10-18 Robert Dewar + + * einfo.adb: Minor code reorganization (Primitive_Operations is a + synthesized attribute routine and was in the wrong place). + + 2010-10-18 Tristan Gingold + + * init.c: Indentation, and minor changes to more closely follow GNU + style rules. Make more variable statics. + + 2010-10-18 Vincent Celier + + * prj.adb (Is_Compilable): On first call for a source, cache value in + component Compilable. + * prj.ads (Source_Data): New component Compilable, to cache the value + returned by function Is_Compilable. + + 2010-10-18 Vincent Celier + + * prj-attr.adb: New project level attribute Ignore_Source_Sub_Dirs. + * prj-nmsc.adb (Expand_Subdirectory_Pattern): New string list parameter + Ignore. + (Recursive_Find_Dirs): Do not consider subdirectories listed in Ignore. + (Get_Directories): Call Find_Source_Dirs with the string list + indicated by attribute Ignore_Source_Sub_Dirs. + * snames.ads-tmpl: New standard name Ignore_Source_Sub_Dirs. + + 2010-10-18 Javier Miranda + + * einfo.ads, einfo.adb (Primitive_Operations): New synthesized + attribute. + (Direct_Primitive_Operations): Renaming of old Primitive_Operations. + (Set_Direct_Primitive_Operations): Renaming of old + Set_Primitive_Operations. Update documentation + * sem_ch3.adb, exp_util.adb, sem_ch7.adb, sem_ch8.adb, exp_ch3.adb: + Replace occurrences of Set_Primitive_Operations by + Set_Direct_Primitive_Operations. + * sem_cat.adb (Validate_RACW_Primitives): No action needed for tagged + concurrent types. + * exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): Do not + process primitives of concurrent types. + * lib-xref.adb (Generate_Prim_Op_References): Minor code cleanup. + + 2010-10-18 Eric Botcazou + + * exp_ch6.adb (Expand_N_Subprogram_Declaration): Use Freeze_Before. + (Expand_Protected_Object_Reference): Likewise. + * sem_attr.adb (Resolve_Attribute): Likewise. + * sem_ch3.adb (Analyze_Subtype_Declaration): Likewise. + * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Likewise. + + 2010-10-18 Arnaud Charlet + + * g-comlin.adb (Get_Switches): Prevent dereferencing null Config. + + 2010-10-18 Robert Dewar + + * aspects.ads, aspects.adb: Add entries for aspects + Read/Write/Input/Output. + * sem_ch13.adb (Analyze_Aspect_Specifications): Add processing for + handling aspects Read/Write/Input/Output. + + 2010-10-18 Robert Dewar + + * sem_util.adb (Note_Possible_Modification): Do not give warning for + use of pragma Unmodified unless we are sure this is a modification. + + 2010-10-18 Tristan Gingold + + * sysdep.c: Add __gnat_get_stack_bounds. + * s-taprop-mingw.adb Call __gnat_get_stack_bounds to set Pri_Stack_Info. + + 2010-10-18 Robert Dewar + + * a-assert.ads: Fix bad name in header. + * sem_ch4.adb, sem_ch6.adb, sem_ch7.adb, sem_ch10.adb: Minor + reformatting. + * exp_aggr.adb: Fix typo in comment. + + 2010-10-18 Javier Miranda + + * exp_util.adb (Side_Effect_Free): Code clean up. + + 2010-10-18 Ed Schonberg + + * sem_ch8.adb (Is_Primitive_Operator_In_Use): Renamed from + Is_Primitive_Operator. When ending the scope of a use package scope, a + primitive operator remains in use if the base type has a current use + (type) clause. + + 2010-10-18 Javier Miranda + + * einfo.ads (Is_Dynamic_Support): Add missing support for limited + private types whose full-view is a task type. + * sem_util.adb (Enclosing_Subprogram): Add missing support for limited + private types whose full-view is a task type. + * exp_ch7.adb (Find_Final_List): Minor code cleanup replacing code by + function Nearest_Dynamic_Scope which provides the needed functionality. + + 2010-10-18 Arnaud Charlet + + * sem_prag.adb (Set_Exported): Do not generate error when exporting a + variable with an address clause in codepeer mode. + + 2010-10-18 Robert Dewar + + * g-trasym-vms-ia64.adb: Minor reformatting. + + 2010-10-18 Thomas Quinot + + * sem_type.adb (Covers): If either argument is Standard_Void_Type and + the other isn't, return False early. + + 2010-10-18 Ed Falis + + * s-vxwext-rtp.ads, s-vxext-rtp.adb: Adapt for missing APIs for RTPs in + VxWorks Cert. + + 2010-10-18 Robert Dewar + + * sem_disp.ads: Minor comment update. + + 2010-10-18 Robert Dewar + + * einfo.ads, einfo.adb (Spec_PPC_List): Is now present in Entries + * sem_ch3.adb (Analyze_Declarations): Add processing for delaying + visibility analysis of precondition and postcondition pragmas (and + Pre/Post aspects). + * sem_ch6.adb (Process_PPCs): Add handling of inherited Pre'Class + aspects. + * sem_ch7.adb (Analyze_Package_Specification): Remove special handling + of pre/post conditions (no longer needed). + * sem_disp.adb (Inherit_Subprograms): Deal with interface case. + * sem_prag.adb (Analyze_PPC_In_Decl_Part): Remove analysis of message + argument, since this is now done in the main processing for + pre/postcondition pragmas when they are first seen. + (Chain_PPC): Pre'Class and Post'Class now handled properly + (Chain_PPC): Handle Pre/Post aspects for entries + (Check_Precondition_Postcondition): Handle entry declaration case + (Check_Precondition_Postcondition): Handle delay of visibility analysis + (Check_Precondition_Postcondition): Preanalyze message argument if + present. + + 2010-10-18 Robert Dewar + + * g-trasym-vms-ia64.adb, prj-nmsc.adb, prj.ads: Minor reformatting. + + 2010-10-14 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Set + TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template. + * gcc-interface/trans.c (Identifier_to_gnu): Set TREE_THIS_NOTRAP on + the INDIRECT_REF node built for objects used by reference. + * gcc-interface/utils2.c (build_binary_op): Add short-circuit for + constant result. Set TREE_THIS_NOTRAP on ARRAY_REF and ARRAY_RANGE_REF. + (gnat_stabilize_reference_1): Propagate the TREE_THIS_NOTRAP flag. + + 2010-10-13 Richard Henderson + + * gcc-interface/misc.c (gnat_eh_personality): Update call to + build_personality_function. + * raise-gcc.c (PERSONALITY_FUNCTION): Change to match other languages; + use__gnat_personality_{v,sj}0. + + 2010-10-12 Vincent Celier + + * prj-nmsc.adb (Add_Source): Put source in hash table Source_Files_HT + (Process_Exceptions_File_Based): Use hash table Source_Files_HT instead + of iterating through all sources of the project. + * prj.adb (Free): Reset hash table Source_Files_HT + (Reset): Reset hash table Source_Files_HT + * prj.ads (Source_Data): New component Next_With_File_Name + (Source_Files_Htable): New hash table + (Project_Tree_Data): New component Source_Files_HT + + 2010-10-12 Tristan Gingold + + * g-trasym-vms-ia64.adb: Use the documented API. + * gcc-interface/Makefile.in: Always set NO_REORDER_ADAFLAGS. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-12 Thomas Quinot + + * rtsfind.ads, exp_dist.adb, exp_dist.ads (Build_General_Calling_Stubs, + PolyORB case): Request is now a controlled type: we can declare the + request on the stack, and we do not need explicit cleanup actions + anymore. + + 2010-10-12 Bob Duff + + * s-rident.ads (Profile_Info): This variable is now constant. + + 2010-10-12 Emmanuel Briot + + * g-comlin.adb, g-comlin.ads (Define_Switch): Put back (unused) + parameter Separator for backward compatibility. + + 2010-10-12 Robert Dewar + + * sem_ch9.adb, par-ch9.adb, impunit.adb: Minor reformatting. + + 2010-10-12 Vincent Celier + + * debug.adb: Put detailed documentation for gnatmake switch -dm. + + 2010-10-12 Vincent Celier + + * gnat1drv.adb: When the compiler is invoked for a spec that needs aw + body, do not generate an ALI file if neither -gnatc nor -gnatQ is used. + + 2010-10-12 Arnaud Charlet + + * g-comlin.adb (Foreach_Switch): Make this procedure generic to avoid + using 'Access. + + 2010-10-12 Robert Dewar + + * debug.adb: Add comment. + * gnatcmd.adb, sem_ch6.adb, switch-m.adb: Minor reformatting. + + 2010-10-12 Javier Miranda + + * exp_util.adb (Side_Effect_Free): Return true for object renaming + declarations that were previously generated by Remove_Side_Effects. + + 2010-10-12 Emmanuel Briot + + * xref_lib.adb (Get_Full_Type): Display "private variable" instead of + "???" when an entity is defined as "*" in the ALI file. + * g-comlin.ads, g-comlin.adb: Fix handling of null parameters. + Minor reformatting. + + 2010-10-12 Emmanuel Briot + + * g-comlin.adb, g-comlin.ads (Display_Help, Getopt, Current_Section, + Set_Usage): New subprograms. + (Define_Switch): Change profile to add support for help messages and + long switches. + + 2010-10-12 Javier Miranda + + * sem_ch6.adb (New_Overloaded_Entity): Add missing decoration of + attribute Overridden_Operation in predefined dispatching primitives. + + 2010-10-12 Emmanuel Briot + + * g-comlin.adb, g-comlin.ads (Add_Switch): Raise an exception when a + command line configuration exists and we specify an invalid section. + + 2010-10-12 Robert Dewar + + * sem_ch6.adb (Process_PPCs): Fix error in inheriting Pre'Class when no + exception messages are generated. + (Process_PPCs): Fix error in inheriting Pre'Class. + + 2010-10-12 Jose Ruiz + + * gnatcmd.adb: Use response file for GNATstack. + (Check_Files): Pass the list of ci files for GNATstack using a response + file to avoid problems with command line length. + Factor out the code handling response file into a new procedure named + Add_To_Response_File. + + 2010-10-12 Vincent Celier + + * debug.adb: For gnatmake, document the meaning of -dm + * make.adb (Gnatmake): If -dm is used, indicate the maximum number of + simultaneous compilations. + * switch-m.adb (Scan_Make_Switches): Allow -j0, meaning as many + simultaneous compilations as the number of processors. + + 2010-10-12 Joseph Myers + + * gcc-interface/Make-lang.in (ada/misc.o): Use $(OPTIONS_H) + instead of options.h. + + 2010-10-12 Robert Dewar + + * gnat_rm.texi: Clarify that 'Old can be used in preconditions and + postcondition pragmas. + + 2010-10-12 Robert Dewar + + * errout.ads, erroutc.adb: The # insertion now handles from in place of + at. + * exp_prag.adb (Expand_Pragma_Check): Suppress generated default + message if new switch Exception_Locations_Suppressed is set. + (Expand_Pragma_Check): Revised wording for default message for case + of precondition or postcondition. + * namet.ads, namet.adb (Build_Location_String): New procedure. + * opt.ads (List_Inherited_Pre_Post): New flag. + * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): Add call to + list inherited pre/post aspects. + * sem_ch13.adb (Analyze_Aspect_Specification): Improve generation of + messages for precondition/postcondition cases. + * sem_ch6.adb (Process_PPCs): General cleanup, and list inherited PPC's + if flag List_Inherited_Pre_Post is set True. + (Process_PPCs): Add initial handling for inherited preconditions + (List_Inherited_Pre_Post_Aspects): New procedure + * sem_ch6.ads (List_Inherited_Pre_Post_Aspects): New procedure + * sem_disp.adb (Inherited_Subprograms): New function + * sem_disp.ads (Inherited_Subprograms): New function + * sem_prag.adb (Check_Duplicate_Pragma): Clean up handling of + pre/postcondition. + (Check_Precondition_Postcondition): Check for inherited aspects + * sem_warn.adb: Process -gnatw.l/w.L setting List_Inherited_Pre_Post + * sinfo.ads, sinfo.adb (Split_PPC): New flag. + * sinput.ads, sinput.adb (Build_Location_String): New function. + * usage.adb: Add line for -gnatw.l/-gnatw.L + + 2010-10-12 Javier Miranda + + * exp_util.adb (Remove_Side_Effects): Remove wrong code. + + 2010-10-12 Arnaud Charlet + + * xref_lib.adb: Add handling of j/J letters. + + 2010-10-12 Pascal Obry + + * adaint.c (__gnat_number_of_cpus): Add implementation for Windows. + + 2010-10-12 Arnaud Charlet + + * make.adb (Globalize): New procedure. + (Compile): Set Do_Codepeer_Globalize_Step when -gnatC is used. + (Gnatmake): Call Globalize when needed. + (Process_Restrictions_Or_Restriction_Warnings): Ignore Restrictions + pragmas in CodePeer mode. + (Adjust_Global_Switches): Set No_Initialize_Scalars in CodePeer mode, + to generate simpler and consistent code. + + 2010-10-12 Bob Duff + + * exp_util.adb (Remove_Side_Effects): Disable previous change, + can cause side effects to be duplicated. + + 2010-10-12 Robert Dewar + + * sem_ch6.adb (Process_PPCs): Handle inherited postconditions. + + 2010-10-12 Arnaud Charlet + + * exp_disp.adb (Set_All_DT_Position): Disable emit error message on + abstract inherited private operation in CodePeer mode. + + 2010-10-12 Thomas Quinot + + * a-exetim.ads: Minor reformatting. + * g-socket.ads (Port_Type): Better definition corresponding to the + actual standard range. + * exp_ch5.adb: Add comment. + * sem_aux.adb: Minor reformatting. + + 2010-10-12 Ed Schonberg + + * sem_ch12.adb (Copy_Generic_Node): If node is a string literal, remove + string_literal_subtype so that a new one can be constructed in the + scope of the instance. + + 2010-10-12 Robert Dewar + + * exp_ch9.adb (Has_Pragma_Priority): New name for Has_Priority_Pragma + * gnat_rm.texi (pragma Suppress_All): Document new placement rules + * par-prag.adb (P_Pragma, case Suppress_All): Set + Has_Pragma_Suppress_All flag. + * sem_prag.adb (Has_Pragma_Priority): New name for Has_Priority_Pragma + (Analyze_Pragma, case Suppress_All): Remove placement check + (Process_Compilation_Unit_Pragmas): Use Has_Pragma_Suppress_All flag + * sem_prag.ads (Process_Compilation_Unit_Pragmas): Update documentation + * sinfo.adb (Has_Pragma_Suppress_All): New flag + (Has_Pragma_Priority): New name for Has_Priority_Pragma + * sinfo.ads (Has_Pragma_Suppress_All): New flag + (Has_Pragma_Priority): New name for Has_Priority_Pragma + + 2010-10-12 Arnaud Charlet + + * lib-xref.ads: Mark j/J as reserved for C++ classes. + + 2010-10-12 Jose Ruiz + + * a-exetim-default.ads, a-exetim-posix.adb: New. + * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for linux): Use the + POSIX Realtime support to implement CPU clocks. + (EXTRA_GNATRTL_TASKING_OBJS for linux): Add the a-exetim.o object + to the tasking library. + (THREADSLIB): Make the POSIX.1b Realtime Extensions library (librt) + available for shared libraries. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-12 Robert Dewar + + * sem_ch13.adb (Analyze_Aspect_Specifications): For Pre/Post, break + apart expressions with AND THEN clauses into separate pragmas. + * sinput.ads, sinput.adab (Get_Logical_Line_Number_Img): New function. + + 2010-10-12 Robert Dewar + + * par-ch13.adb (P_Aspect_Specifications): Fix handling of 'Class + aspects. + * sem_ch13.adb (Analyze_Aspect_Specifications): Fix bad Sloc on aspects + * sem_prag.adb (Fix_Error): Only change pragma names for pragmas from + aspects. + (Check_Optional_Identifier): Handle case of direct arguments + (Chain_PPC): Test for abstract case, giving appropriate messages + * sinfo.ads, sinfo.adb (Class_Present): Allowed on N_Pragma node + + 2010-10-12 Robert Dewar + + * par-endh.adb (Check_End): Don't swallow semicolon or aspects after + END RECORD. + * sem_attr.adb (Eval_Attribute): Code clean up. + + 2010-10-12 Robert Dewar + + * par-ch12.adb (P_Formal_Private_Type_Definition): Improve error + messages and recovery for case of out of order Abstract/Tagged/Private + keywords. + * par-ch3.adb (P_Type_Declaration): Improve error messages and recovery + for case of out of order Abstract/Tagged/Private keywords. + + 2010-10-12 Ed Schonberg + + * inline.adb (Analyze_Inlined_Bodies): Restrict previous change to case + where child unit is main unit of compilation. + + 2010-10-12 Robert Dewar + + * aspects.ads, aspects.adb (Move_Aspects): New procedure. + * atree.ads, atree.adb: (New_Copy): Does not copy aspect specifications + * sinfo.ads, par-ch3.adb, par-ch6.adb, par-ch7.adb, par-ch9.adb, + par-endh.adb, par-ch13.adb, par-ch12.adb: Modify grammar to include + aspect specifications. + Recognize aspect specifications for all cases + * par.adb: Recognize aspect specifications for all cases + * sem_ch12.ads, sem_ch12.adb (Copy_Generic_Node): Copies aspect + specifications. + * sem_ch3.adb (Analyze_Subtype_Declaration): Improve patch to freeze + generic actual types (was missing some guards before). + * sem_ch9.adb (Analyze_Single_Protected_Declaration): Copy aspects to + generated object + (Analyze_Single_Task_Declaration): Copy aspects to generated object + + 2010-10-12 Eric Botcazou + + * usage.adb (usage): Adjust line for -gnatn switch. + + 2010-10-12 Robert Dewar + + * sem_attr.adb (Eval_Attribute): Only leave change active for aspect + spec case. + + 2010-10-12 Ed Schonberg + + * sem_ch6.adb (Analyze_Subprogram_Declaration): If this is a + declaration of a null procedure resolve the types of the profile of the + generated null body now. + + 2010-10-11 Robert Dewar + + * debug.adb: Remove d.A flag to delay address clause (not needed any + more). Add d.A flag to enable tree read/write of aspect spec hash table + * sem_ch13.adb (Analyze_Aspect_Specifications): Properly delay address + clause. + (Rep_Item_Too_Late): No need for special processing for delayed rep + items (and it caused difficulties in the address case). + * tree_gen.adb: Only write aspect spec hash table if -gnatd.A is set + * tree_in.adb: Only write aspect spec hash table if -gnatd.A is set + + 2010-10-11 Pat Rogers + + * gnat_ugn.texi: Minor editing. + + 2010-10-11 Nathan Froyd + + * gcc-interface/utils2.c (gnat_build_constructor): Use VEC_qsort. + + 2010-10-11 Robert Dewar + + * g-htable.ads (Get_First): New procedural version for Simple_HTable + (Get_Next): New procedural version for Simple_HTable + * s-htable.adb (Get_First): New procedural version for Simple_HTable + (Get_Next): New procedural version for Simple_HTable + * s-htable.ads (Get_First): New procedural version for Simple_HTable + (Get_Next): New procedural version for Simple_HTable + + 2010-10-11 Ed Schonberg + + * sem_aggr.adb (Propagate_Discriminants): To gather the components of a + variant part, use the association list of the subaggregate, which + already includes the values of the needed discriminants. + + 2010-10-11 Robert Dewar + + * aspects.ads, aspects.adb: Changes to accomodate aspect delay + (Tree_Write): New procedure. + * atree.ads, atree.adb: Flag3 is now Has_Aspects and applies to all + nodes. + * atree.h: Flag3 is now Has_Aspects and applies to all nodes + * debug.adb: Add debug flag gnatd.A + * einfo.adb (Has_Delayed_Aspects): New flag + (Get_Rep_Item_For_Entity): New function + * einfo.ads (Has_Delayed_Aspects): New flag + (Get_Rep_Item_For_Entity): New function + * exp_ch13.adb (Expand_N_Freeze_Entity): Insert delayed aspects into + tree. + * exp_ch3.adb, exp_ch6.adb, exp_ch9.adb, exp_disp.adb: New calling + sequence for Freeze_Entity. + * freeze.ads, freeze.adb (Freeze_Entity): Takes node rather than source + ptr. All calls are changed to this new interface. + (Freeze_And_Append): Same change + (Freeze_Entity): Evaluate deferred aspects + * sem_attr.adb: New calling sequence for Freeze_Entity + (Eval_Attribute): Don't try to evaluate attributes of unfrozen types + when we are in spec expression preanalysis mode. + * sem_ch10.adb: New calling sequence for Freeze_Entity + * sem_ch11.adb: Simplify analysis of aspect specifications now that the + flag Has_Aspects applies to all nodes (no need to save aspects). + * sem_ch12.adb: Simplify analysis of aspect specifications now that the + flag Has_Aspects applies to all nodes (no need to save aspects). + * sem_ch13.adb (Analyze_Aspect_Specifications): Major rewrite to + accomodate delaying aspect evaluation to the freeze point. + (Duplicate_Clause): Simplify using Get_Rep_Item_For_Entity, and also + accomodate delayed aspects. + (Rep_Item_Too_Late): Deal with delayed aspects case + * sem_ch13.ads (Rep_Item_Too_Late): Document handling of delayed + aspects. + * sem_ch3.adb (Analyze_Subtype_Declaration): Make sure that generic + actual types are properly frozen (this is needed because of the new + check in Eval_Attribute that declines to evaluate attributes + for unfrozen types). + Simplify analysis of aspect specifications now that the flag + Has_Aspects applies to all nodes (no need to save aspects). + * sem_ch3.ads (Preanalyze_Spec_Expression): Note use for delayed + aspects. + * sem_ch5.adb: Simplify analysis of aspect specifications now that the + flag Has_Aspects applies to all nodes (no need to save aspects). + New calling sequence for Freeze_Entity. + * sem_ch9.adb, sem_ch7.adb, sem_ch6.adb: Simplify analysis of aspect + specifications now that the flag Has_Aspects applies to all nodes + (no need to save aspects). + New calling sequence for Freeze_Entity + * sem_prag.adb (Check_Duplicate_Pragma): Simplify using + Get_Rep_Item_For_Entity + (Get_Pragma_Arg): Moved to Sinfo + * sinfo.ads, sinfo.adb (Aspect_Rep_Item_: New field + (Is_Delayed_Aspect): New flag + (Next_Rep_Item): Document use for aspects + (Get_Pragma_Arg): Moved here from Sem_Prag + * sprint.adb (Sprint_Aspect_Specifications): Now called after semicolon + is output and removes semicolon (simplifies interface). + (Sprint_Node_Actual): Simplify handling of aspects now that Has_Aspects + applies to any node. + * tree_gen.adb: Write contents of Aspect_Specifications hash table + * tree_in.adb: Read and initialize Aspect_Specifications hash table + * treepr.adb (Print_Node): Print Has_Aspects flag + (Print_Node): Print Aspect_Specifications in Has_Aspects set + * xtreeprs.adb: Remove obsolete references to Flag1,2,3 + + 2010-10-11 Robert Dewar + + * aspects.ads, aspects.adb: Major revision of this package for 2nd + stage of aspects implementation. + * gcc-interface/Make-lang.in: Add entry for aspects.o + * gcc-interface/Makefile.in: Add aspects.o to GNATMAKE_OBJS + * par-ch13.adb (Aspect_Specifications_Present): New function + (P_Aspect_Specifications): New procedure + * par-ch3.adb (P_Type_Declaration): Handle aspect specifications + (P_Derived_Type_Def_Or_Private_Ext_Decl): Handle aspect specifications + (P_Identifier_Declarations): Handle aspect specifications + (P_Component_Items): Handle aspect specifications + (P_Subtype_Declaration): Handle aspect specifications + * par-ch6.adb (P_Subprogram): Handle aspect specifications + * par-ch9.adb (P_Entry_Declaration): Handle aspect specifications + * par.adb (Aspect_Specifications_Present): New function + (P_Aspect_Specifications): New procedure + * sem.adb (Analyze_Full_Type_Declaration): New name for + Analyze_Type_Declaration. + (Analyze_Formal_Package_Declaration): New name (add _Declaration) + (Analyze_Formal_Subprogram_Declaration): New name (add _Declaration) + (Analyze_Protected_Type_Declaration): New name (add _Declaration) + (Analyze_Single_Protected_Declaration): New name (add _Declaration) + (Analyze_Single_Task_Declaration): New name (add _Declaration) + (Analyze_Task_Type_Declaration): New name (add _Declaration) + * sem_cat.adb (Analyze_Full_Type_Declaration): New name for + Analyze_Type_Declaration. + * sem_ch11.adb (Analyze_Exception_Declaration): Analyze aspect + specifications. + * sem_ch12.adb (Analyze_Formal_Object_Declaration): Handle aspect + specifications. + (Analyze_Formal_Package_Declaration): New name (add _Declaration) + (Analyze_Formal_Package_Declaration): Handle aspect specifications + (Analyze_Formal_Subprogram_Declaration): New name (add _Declaration) + (Analyze_Formal_Subprogram_Declaration): Handle aspect specifications + (Analyze_Formal_Type_Declaration): Handle aspect specifications + (Analyze_Generic_Package_Declaration): Handle aspect specifications + (Analyze_Generic_Subprogram_Declaration): Handle aspect specifications + (Analyze_Package_Instantiation): Handle aspect specifications + (Analyze_Subprogram_Instantiation): Handle aspect specifications + * sem_ch12.ads (Analyze_Formal_Package_Declaration): New name (add + _Declaration). + (Analyze_Formal_Subprogram_Declaration): New name (add _Declaration) + * sem_ch13.adb (Analyze_Aspect_Specifications): New procedure + (Duplicate_Clause): New function, calls to this function are added to + processing for all aspects. + * sem_ch13.ads (Analyze_Aspect_Specifications): New procedure + * sem_ch3.adb (Analyze_Full_Type_Declaration): New name for + Analyze_Type_Declaration. + * sem_ch3.ads (Analyze_Full_Type_Declaration): New name for + Analyze_Type_Declaration. + * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Analyze aspect + specifications. + (Analyze_Subprogram_Declaration): Analyze aspect specifications + * sem_ch7.adb (Analyze_Package_Declaration): Analyze aspect + specifications. + (Analyze_Private_Type_Declaration): Analyze aspect specifications + * sem_ch9.adb (Analyze_Protected_Type_Declaration): Analyze aspect + specifications. + (Analyze_Protected_Type_Declaration): New name (add _Declaration) + (Analyze_Single_Protected_Declaration): Analyze aspect specifications + (Analyze_Single_Protected_Declaration): New name (add _Declaration) + (Analyze_Single_Task_Declaration): Analyze aspect specifications + (Analyze_Single_Task_Declaration): New name (add _Declaration) + (Analyze_Task_Type_Declaration): Analyze aspect specifications + (Analyze_Task_Type_Declaration): New name (add _Declaration) + * sem_ch9.ads (Analyze_Protected_Type_Declaration): New name (add + _Declaration). + (Analyze_Single_Protected_Declaration): New name (add _Declaration) + (Analyze_Single_Task_Declaration): New name (add _Declaration) + (Analyze_Task_Type_Declaration): New name (add _Declaration) + * sem_prag.adb: Use Get_Pragma_Arg systematically so that we do not + have to generate unnecessary pragma argument associations (this matches + the doc). + Throughout do changes to accomodate aspect specifications, including + specializing messages, handling the case of not going through all + homonyms, and allowing for cancellation. + * sinfo.ads, sinfo.adb: Clean up obsolete documentation for Flag1,2,3 + (Aspect_Cancel): New flag + (From_Aspect_Specification): New flag + (First_Aspect): Removed flag + (Last_Aspect): Removed flag + * sprint.adb (Sprint_Aspect_Specifications): New procedure + (Sprint_Node_Actual): Add calls to Sprint_Aspect_Specifications + + 2010-10-11 Bob Duff + + * sem_res.adb (Resolve_Actuals): Minor change to warning messages so + they match in Ada 95, 2005, and 2012 modes, in the case where the + language didn't change. Same thing for the run-time exception message. + + 2010-10-11 Javier Miranda + + * debug.adb Document that switch -gnatd.p enables the CIL verifier. + + 2010-10-11 Robert Dewar + + * s-htable.adb: Minor reformatting. + + 2010-10-11 Javier Miranda + + * debug.adb: Update comment. + + 2010-10-11 Vincent Celier + + * gnatcmd.adb (GNATCmd): Set Opt.Unchecked_Shared_Lib_Imports to True + unconditionally as for "gnat make" the projects are not processed in + the GNAT driver. + + 2010-10-11 Ed Schonberg + + * sem_ch10.ads, sem_ch10.adb (Load_Needed_Body): Add parameter to + suppress semantic analysis of the body when inlining, prior to + verifying that the body does not have a with_clause on a descendant + unit. + * inline.adb (Analyze_Inlined_Bodies): Do not inline a body if it has a + with_clause on a descendant. + (Scope_In_Main_Unit): Simplify. + + 2010-10-11 Robert Dewar + + * exp_ch6.adb, freeze.adb: Minor reformatting. + + 2010-10-11 Vincent Celier + + * gnatcmd.adb (GNATCmd): For all tools other than gnatmake, allow + shared library projects to import projects that are not shared library + projects. + + 2010-10-11 Javier Miranda + + * debug.adb: Document that switch -gnatd.o generates the CIL listing. + + 2010-10-11 Arnaud Charlet + + * sem_prag.adb (Process_Suppress_Unsuppress): Only ignore + Suppress/Unsuppress pragmas in codepeer mode on user code. + + 2010-10-11 Javier Miranda + + * exp_ch6.adb (Expand_Call): For VM platforms, add missing expansion of + tag check in case of dispatching call through "=". + + 2010-10-11 Ed Schonberg + + * sem_ch3.adb (Access_Subprogram_Declaration): In Ada2012 an incomplete + type is legal in the profile of any basic declaration. + * sem_ch6.adb (Analyze_Return_Type, Process_Formals): In Ada2012 an + incomplete type, including a limited view of a type, is legal in the + profile of any subprogram declaration. + If the type is tagged, its use is also legal in a body. + * sem_ch10.adb (Install_Limited_With_Clause): Do not process context + item if misplaced. + (Install_Limited_Withed_Unit): Refine legality checks when both the + limited and the non-limited view of a package are visible in the + context of a unit. + If this is not an error case, the limited view is ignored. + freeze.adb (Freeze_Entity): In Ada2012, an incomplete type is legal in + access to subprogram declarations + + 2010-10-11 Robert Dewar + + * exp_ch6.adb: Code clean up. + * exp_util.adb: Minor reformatting. + + 2010-10-11 Arnaud Charlet + + * sem_ch3.adb, exp_ch6.adb + (Make_Build_In_Place_Call_In_Anonymous_Context, + Make_Build_In_Place_Call_In_Assignment, + Make_Build_In_Place_Call_In_Object_Declaration): Fix calls to + Add_Task_Actuals_To_Build_In_Place_Call in case of No_Task_Hierarchy + restriction. + (Access_Definition): Add missing handling of No_Task_Hierarchy. + + 2010-10-11 Javier Miranda + + * exp_util.adb (Remove_Side_Effects): No action needed for renamings of + class-wide expressions. + + 2010-10-11 Arnaud Charlet + + * xr_tabls.adb, sem_res.adb: Minor reformatting + + 2010-10-11 Arnaud Charlet + + * gnat_rm.texi, exp_attr.adb, sem_attr.adb, sem_attr.ads, + snames.ads-tmpl (Analyze_Attribute, Expand_N_Attribute_Reference): Add + handling of Attribute_Ref. Add missing blanks in some error messages. + (Attribute_Ref, Name_Ref): Declare. + Document 'Ref attribute. + + 2010-10-11 Robert Dewar + + * sem_attr.adb: Minor reformatting. + + 2010-10-11 Javier Miranda + + * sem_ch8.adb (Attribute_Renaming): Add missing check to avoid loading + package System.Aux_Dec in VM platforms. + + 2010-10-11 Arnaud Charlet + + * sem_prag.adb (Process_Suppress_Unsuppress): Ignore + Suppress/Unsuppress pragmas in codepeer mode. + (Analyze_Pragma [Pragma_Suppress_All]): Do not generate error message + in codepeer mode. + * einfo.ads: Fix typo. + + 2010-10-11 Emmanuel Briot + + * sinfo.adb: Use GNAT.HTable rather than System.HTable. + * prj-nmsc.adb: Minor reformatting. + + 2010-10-11 Thomas Quinot + + * sem_attr.adb (Type_Key): Code simplification. + + 2010-10-11 Tristan Gingold + + * gcc-interface/utils2.c (maybe_wrap_malloc): Fix crash when allocating + very large object on VMS. + + 2010-10-11 Javier Miranda + + * sem_ch10.adb (Analyze_With_Clause): Add missing test to ensure + availability of attribute Instance_Spec. + + 2010-10-11 Arnaud Charlet + + * gnat1drv.adb (Adjust_Global_Switches): Disable codepeer mode if + checking syntax only or in ASIS mode. + + 2010-10-11 Ed Schonberg + + * sem_ch6.adb (Check_Delayed_Subprogram): Abstract subprograms may also + need a freeze node if some type in the profile has one. + * gcc-interface/trans.c (case N_Abstract_Subprogram_Declaration): If + entity has a freeze node, defer elaboration. + + 2010-10-11 Emmanuel Briot + + * prj-nmsc.adb (Check_Aggregate_Project): Add support for finding all + aggregated projects. + + 2010-10-11 Ed Schonberg + + * sem_res.adb (Resolve_Entry_Call): Generate 's' reference for entry + call. + * sem_ch6.adb: Diagnose additional error condition. + + 2010-10-11 Bob Duff + + * par.adb (Par): Clarify wording of certain error messages. + + 2010-10-11 Gary Dismukes + + * sem_disp.adb (Check_Dispatching_Operation): Revise test for warning + about nondispatching subprograms to use In_Same_List (reducing use of + Parent links). + + 2010-10-11 Ed Schonberg + + * xr_tabls.adb, sem_res.adb, lib-xref.adb, lib-xref.ads: Use s for + reference in a static call. + + 2010-10-11 Steve Baird + + * exp_attr.adb (Expand_N_Attribute_Reference, case Type_Key): Type_Key + attribute should always be transformed into a string literal in + Analyze_Attribute. + * par-ch4.adb: Type_Key attribute's type is String; update value of + Is_Parameterless_Attribute constant to reflect this. + * sem_attr.adb (Analyze_Attribute): Recognize Type_Key attribute and + rewrite it as a string literal (attribute value is always known + statically). + * snames.ads-tmpl: Add entries for Type_Key attribute. + + 2010-10-11 Ed Schonberg + + * lib-xref.adb (Output_References): Common handling for objects and + formals of an anonymous access type. + + 2010-10-11 Eric Botcazou + + * make.adb (Scan_Make_Arg): Also pass -O to both compiler and linker. + + 2010-10-11 Ed Schonberg + + * sem_ch6.adb: Fix check for illegal equality declaration in Ada2012 + + 2010-10-11 Gary Dismukes + + * sem_disp.adb (Check_Dispatching_Operation): When testing for issuing + a warning about subprograms of a tagged type not being dispatching, + limit this to cases where the tagged type and the subprogram are + declared within the same declaration list. + + 2010-10-11 Jerome Lambourg + + * projects.texi, prj-attr.adb: Add new attribute documentation_dir. + + 2010-10-11 Bob Duff + + * par-ch9.adb, sem_aggr.adb, exp_ch5.adb, sem_ch3.adb, impunit.adb, + impunit.ads, sem_ch5.adb, sem_type.adb, exp_imgv.adb, exp_util.adb, + switch-c.adb, exp_attr.adb, exp_ch9.adb, par-ch11.adb, usage.adb, + sem_ch9.adb, sem_ch10.adb, scng.adb, checks.adb, sem_prag.adb, + sem_ch12.adb, par-ch2.adb, freeze.adb, par-ch4.adb, sem_util.adb, + sem_res.adb, sem_attr.adb, par-ch6.adb, exp_ch4.adb, exp_ch6.adb, + sem_ch4.adb, exp_ch8.adb, par-ch10.adb, sem_ch6.adb, par-prag.adb, + exp_disp.adb, par-ch12.adb, sem_ch8.adb, snames.adb-tmpl, opt.ads, + exp_aggr.adb, sem_cat.adb, sem_ch13.adb, par-ch3.adb, exp_strm.adb, + exp_cg.adb, lib-xref.adb, sem_disp.adb, exp_ch3.adb: Use Ada_2005 + instead of Ada_05 (Ada_Version_Type). + + 2010-10-11 Bob Duff + + * sem_aggr.adb, impunit.adb, impunit.ads, switch-c.adb, usage.adb, + sem_ch10.adb, sem_prag.adb, sem_ch12.adb, par-ch4.adb, par-ch6.adb, + par-ch8.adb, exp_ch4.adb, sem_ch4.adb, sem_ch6.adb, par-prag.adb, + opt.ads, par-ch3.adb, lib-xref.adb: Use Ada_2012 instead of Ada_12 + (Ada_Version_Type). + + 2010-10-11 Javier Miranda + + * exp_util.adb (Safe_Prefixed_Reference): If the prefix is an explicit + dereference then do not exclude dereferences of access-to-constant + types to handle them as constant view of variables (and hence remove + side effects when required). + * sem_res.adb (Resolve_Slice): Ensure that side effects in the bounds + are properly handled. + + 2010-10-11 Robert Dewar + + * sem_prag.adb, sem_aggr.adb, sprint.adb: Minor reformatting. + + 2010-10-11 Javier Miranda + + * exp_ch5.ads, exp_ch6.ads (Expand_N_Extended_Return_Statement): Moved + to exp_ch6. + (Expand_N_Simple_Return_Statement): Moved to exp_ch6. + * exp_ch5.adb, exp_ch6.adb (Expand_Non_Function_Return): Moved to + exp_ch6. + (Expand_Simple_Function_Return): Move to exp_ch6. + (Expand_N_Extended_Return_Statement): Moved to exp_ch6. + (Expand_N_Simple_Return_Statement): Moved to exp_ch6. + + 2010-10-11 Robert Dewar + + * snames.ads-tmpl: Add names for aspects. + * aspects.ads, aspects.adb: New. + * gcc-interface/Make-lang.in: Update dependencies. + 2010-10-11 Ed Schonberg + + * exp_ch6.adb (Expand_Actuals): If an actual is the current instance of + a task type, it must be replaced with a reference to Self. + + 2010-10-11 Vincent Celier + + * adaint.h: Add prototype for function __gnat_create_output_file_new. + + 2010-10-11 Javier Miranda + + * sem_aggr.adb (Collect_Aggr_Bounds): Remove side effects of collected + aggregate bounds. + + 2010-10-11 Arnaud Charlet + + * sem_prag.adb (Check_Interrupt_Or_Attach_Handler): Do not emit error + for AI05-0033 in CodePeer mode. + + 2010-10-11 Robert Dewar + + * atree.h, atree.ads, atree.adb (Flag3): New flag (replaces Unused_1) + * csinfo.adb: Aspect_Specifications is a new special field + * einfo.adb (Flag3): New unused flag + * exp_util.adb (Insert_Actions): Add processing for + N_Aspect_Specification. + * sem.adb: Add entry for N_Aspect_Specification. + * sinfo.ads, sinfo.adb (N_Aspect_Specification): New node + (Has_Aspect_Specifications): New flag + (Permits_Aspect_Specifications): New function + (Aspect_Specifications): New function + (Set_Aspect_Specifications): New procedure + * sprint.adb (Sprint_Node): Put N_At_Clause in proper alpha order + (Sprint_Node): Add dummy entry for N_Aspect_Specification + * treepr.adb (Flag3): New flag to be listed + + 2010-10-11 Vincent Celier + + * adaint.c: Minor reformatting. + + 2010-10-11 Robert Dewar + + * sem_ch6.adb, s-htable.ads: Minor reformatting. + + 2010-10-11 Ed Schonberg + + * sem_ch4.adb (Analyze_Selected_Component): If the selector is + invisible in an instantiation, and both the formal and the actual are + private extensions of the same type, look for the desired component in + the proper view of the parent type. + + 2010-10-11 Vincent Celier + + * adaint.c (__gnat_number_of_cpus): Add implementation for Solaris, + AIX, Tru64, Darwin, IRIX and HP-UX. + + 2010-10-11 Robert Dewar + + * a-textio.adb: Minor reformatting + + 2010-10-11 Robert Dewar + + * a-suesen.ads, a-suenst.ads, + a-suesen.adb, a-suenst.adb, + a-suewse.adb, a-suewst.adb, + a-suewse.ads, a-suewst.ads, + a-suezse.ads, a-suezst.ads, + a-suezse.adb, a-suezst.adb: New name for string encoding packages. + * impunit.adb: New names for string encoding units + * Makefile.rtl: New names for string encoding units + * rtsfind.ads: Minor code reorganization. + + 2010-10-11 Ed Schonberg + + * exp_ch5.adb: Code clean up. + + 2010-10-11 Ed Schonberg + + * sem_ch6.adb (Check_Limited_Return): Specialize warning on limited + returns when in a generic context. + (Analyze_Function_Return): ditto. + + 2010-10-11 Robert Dewar + + * s-multip.ads: Fix header. + * sem_ch3.adb, s-multip.adb, a-tigeli.adb: Minor reformatting. + + 2010-10-11 Vincent Celier + + * Makefile.rtl: Add s-multip. + * adaint.c: New function __gnat_number_of_cpus, implemented for Linux, + defaulting to 1 for other platforms. + * adaint.h: New function __gnat_number_of_cpus. + * impunit.adb (Non_Imp_File_Names_12): New file list for Ada 2012, + with a single component "s-multip". + * impunit.ads (Kind_Of_Unit): New enumerated value Ada_12_Unit for Ada + 2012. + * rtsfind.ads (RTU_Id): New enumerated value System_Multiprocessors + * s-multip.ads, s-multip.adb: New Ada 2012 package. + * sem_ch10.adb (Analyze_With_Clause): Check also Ada 2012 units. + + 2010-10-11 Javier Miranda + + * a-textio.adb: Move new implementation of Get_Line to a subunit. + * a-tigeli.adb: New subunit containing the implementation of Get_Line. + + 2010-10-11 Ed Schonberg + + * sem_aux.adb: Code clean up. + + 2010-10-11 Robert Dewar + + * sem_ch3.adb, sem_aux.adb, sem_ch6.adb: Minor reformatting + + 2010-10-11 Robert Dewar + + * einfo.adb, atree.h, atree.ads, atree.adb: Define seven new flags + Flag248-Flag254. Define new field Field29. + + 2010-10-10 Olivier Hainque + Eric Botcazou + + * gcc-interface/lang.opt (gdwarf+): Remove. + * gcc-interface/gigi.h (get_parallel_type): Likewise + * gcc-interface/misc.c (gnat_dwarf_extensions): Likewise. + (gnat_handle_option): Remove OPT_gdwarfplus case. + (gnat_post_options): Remove setting of use_gnu_debug_info_extensions + from gnat_dwarf_extensions. + * gcc-interface/trans.c (gigi): Remove -gdwarf+ initializations. + * gcc-interface/utils.c (get_parallel_type): Remove. + + 2010-10-10 Eric Botcazou + + * gcc-interface/trans.c (gnat_to_gnu) : Use + invert_truthvalue_loc instead of invert_truthvalue. + * gcc-interface/utils2.c (build_binary_op) : Likewise. + (build_unary_op) : Likewise. + + 2010-10-10 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Add + assertion on the types of the parameters. Use KIND local variable. + : Likewise. + + 2010-10-10 Eric Botcazou + + * gcc-interface/ada-tree.h (DECL_BY_DOUBLE_REF_P): New macro. + * gcc-interface/gigi.h (annotate_object): Add BY_DOUBLE_REF parameter. + * gcc-interface/decl.c (annotate_object): Likewise and handle it. + (gnat_to_gnu_entity): Adjust calls to annotate_object. + (gnat_to_gnu_param): If fat pointer types are passed by reference on + the target, pass them by explicit reference. + * gcc-interface/misc.c (default_pass_by_ref): Fix type of constant. + * gcc-interface/trans.c (Identifier_to_gnu): Do DECL_BY_DOUBLE_REF_P. + (Subprogram_Body_to_gnu): Adjust call to annotate_object. + (call_to_gnu): Handle DECL_BY_DOUBLE_REF_P. + * gcc-interface/utils.c (convert_vms_descriptor): Add BY_REF parameter + and handle it. + (build_function_stub): Iterate on the parameters of the subprogram in + lieu of on the argument types. Adjust call to convert_vms_descriptor. + + 2010-10-09 Eric Botcazou + + * gcc-interface/misc.c: Delete prototypes. + (gnat_init_options): Use local variable. + (lang_hooks): Move to the end of the file. + + 2010-10-08 Joseph Myers + + * gcc-interface/misc.c (gnat_init_options_struct): New. Split out + from gnat_init_options. + (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define. + + 2010-10-08 Ed Schonberg + + * sem_aux.adb: Cleanup Is_Immutably_Limited_Type. + + 2010-10-08 Robert Dewar + + * exp_ch3.adb: Minor reformatting. + * exp_ch5.adb: Add comment. + + 2010-10-08 Robert Dewar + + * sem_prag.adb (Check_Duplicate_Pragma): Check for entity match + * gcc-interface/Make-lang.in: Update dependencies. + * einfo.ads: Minor reformatting. + + 2010-10-08 Ed Schonberg + + * exp_ch5.adb, sem_ch3.adb, exp_ch7.adb, exp_util.adb, sem_aux.adb, + sem_aux.ads, exp_ch4.adb, exp_ch6.adb, sem_ch6.adb, exp_aggr.adb, + exp_ch3.adb: Change Is_Inherently_Limited_Type to + Is_Immutably_Limited_Type to accord with new RM terminology. + * sem_aux.adb (Is_Immutably_Limited_Type): A type that is a descendant + of a formal limited private type is not immutably limited in a generic + body. + + 2010-10-08 Robert Dewar + + * sem_prag.adb (Check_Duplicate_Pragma): New procedure + Add calls to this new procedure where appropriate + + 2010-10-08 Vincent Celier + + * a-textio.adb (Get_Chunk): Code clean up. + + 2010-10-08 Robert Dewar + + * a-strbou.ads, a-strfix.adb, a-strfix.ads, a-strsea.adb, a-strsea.ads, + a-strsup.adb, a-strsup.ads, a-strunb-shared.adb, a-strunb-shared.ads, + a-strunb.adb, a-strunb.ads, a-stwibo.ads, a-stwifi.adb, a-stwifi.ads, + a-stwise.adb, a-stwise.ads, a-stwisu.adb, a-stwisu.ads, + a-stwiun-shared.adb, a-stwiun-shared.ads, a-stwiun.adb, a-stwiun.ads, + a-stzbou.ads, a-stzfix.adb, a-stzfix.ads, a-stzsea.adb, a-stzsea.ads, + a-stzsup.adb, a-stzsup.ads, a-stzunb-shared.adb, a-stzunb-shared.ads, + a-stzunb.adb, a-stzunb.ads (Find_Token): New version with From + parameter. + + 2010-10-08 Robert Dewar + + * sem_cat.adb (Check_Categorization_Dependencies): Remote types + packages can depend on preleborated packages. + + 2010-10-08 Robert Dewar + + * sem_prag.adb (Check_Interrupt_Or_Attach_Handler): Pragmas + Interrupt_Handler and Attach_Handler not allowed in generics. + + 2010-10-08 Robert Dewar + + * ali.adb: Set Allocator_In_Body if AB parameter present on M line + * ali.ads (Allocator_In_Body): New flag + * bcheck.adb (Check_Consistent_Restrictions): Handle case of main + program violating No_Allocators_After_Elaboration restriction. + * gnatbind.adb (No_Restriction_List): Add entries for + No_Anonymous_Allocators, and No_Allocators_After_Elaboration. + * lib-load.adb: Initialize Has_Allocator flag + * lib-writ.adb: Initialize Has_Allocator flag + (M_Parameters): Set AB switch if Has_Allocator flag set + * lib-writ.ads: Document AB flag on M line + * lib.adb (Has_Allocator): New function + (Set_Has_Allocator): New procedure + * lib.ads (Has_Allocator): New function + (Set_Has_Allocator): New procedure + (Has_Allocator): New flag in Unit_Record + * sem_ch4.adb (Analyze_Allocator): Add processing for + No_Allocators_After_Elaboration. + + 2010-10-08 Geert Bosch + + * a-textio.adb (Get_Line): Rewrite to use fgets instead of fgetc. + + 2010-10-08 Javier Miranda + + * sem_prag.adb (Analyze_Pragma): Relax semantic rule of + Java_Constructors because in the JRE library we generate occurrences + in which the "this" parameter is not the first formal. + + 2010-10-08 Robert Dewar + + * par-ch3.adb: Minor reformatting. + + 2010-10-08 Javier Miranda + + * exp_disp.adb (Make_DT): Do not generate dispatch tables for CIL/Java + types. + + 2010-10-08 Robert Dewar + + * par-ch8.adb (P_Use_Type_Clause): Recognize ALL keyword in Ada 2012 + mode. + * sinfo.adb (Use_Type_Clause): Add All_Present flag. + * sinfo.ads (Use_Type_Clause): Add All_Present flag. + * s-rident.ads: Add entry for No_Allocators_After_Elaboration, + No_Anonymous_Allocators. + + 2010-10-08 Vincent Celier + + * bindgen.adb (Gen_Restrictions_Ada): No new line after last + restriction, so that the last comma is always replaced with a left + parenthesis. + + 2010-10-08 Javier Miranda + + * sem_prag.adb (Analyze_Pragma): Add specific check on the type of the + first formal of delegates. + + 2010-10-08 Robert Dewar + + * sem_aggr.adb: Minor reformatting. + + 2010-10-08 Robert Dewar + + * exp_imgv.adb (Expand_Image_Attribute): Handle special calling + sequence for soft hyphen for Character'Image case. + * rtsfind.ads (Image_Character_05): New entry + * s-imgcha.adb (Image_Character_05): New procedurew + * s-imgcha.ads (Image_Character_05): New procedure + * s-imgwch.adb (Image_Wide_Character): Deal with Ada 2005 soft hyphen + case. + * s-valcha.adb (Value_Character): Recognize SOFT_HYPHEN for 16#AD# + * sem_attr.adb (Eval_Attribute, case Width): Handle soft_hyphen name + properly. + + 2010-10-08 Robert Dewar + + * sem_attr.adb (Eval_Attribute, case Width): Avoid ludicrous long loop + for case of Wide_[Wide_]Character. + + 2010-10-08 Robert Dewar + + * exp_ch3.adb: Minor reformating + Minor code reorganization. + + 2010-10-08 Javier Miranda + + * sem_prag.adb (Analyze_Pragma): Add missing checks on wrong use of + pragmas CIL_Constructor and Java_Constructor. + * exp_ch3.adb (Expand_Freeze_Record_Type): Do not generate the + predefined primitives for CIL/Java tagged types. + + 2010-10-08 Robert Dewar + + * sem_ch6.adb: Minor reformatting. + + 2010-10-08 Robert Dewar + + * gnat1drv.adb: Add call to Validate_Independence. + * par-prag.adb: Add dummy entries for Independent, + Independent_Componentsa. + * sem_ch13.adb (Validate_Independence): New procedure + (Initialize): Initialize address clause and independence check tables + * sem_ch13.ads (Independence_Checks): New table + (Validate_Independence): New procedure + * sem_prag.adb: Add processing for pragma Independent[_Components] + * snames.ads-tmpl: Add entries for pragma Independent[_Components] + + 2010-10-08 Ed Schonberg + + * sem_aggr.adb (Propagate_Discriminants): When expanding an aggregate + component with box initialization, if the component is a variant record + use the values of the discriminants to select the proper variant for + further box initialization. + + 2010-10-08 Thomas Quinot + + * xsnames.adb: Remove obsolete file. + * make.adb, sem_ch8.adb, einfo.ads: Minor reformatting. + + 2010-10-08 Ed Schonberg + + * exp_aggr.adb: Complete previous change. + + 2010-10-08 Ed Schonberg + + * sem_ch6.adb (Check_Return_Subtype): The subtype indication in an + extended return must match statically the return subtype of the + enclosing function if the type is an elementary type or if it is + constrained. + + 2010-10-08 Vincent Celier + + * prj-nmsc.adb (Add_Source): Report all duplicate units and source file + names. Do not report the same duplicate unit several times. + * prj.ads (Source_Data): New Boolean component Duplicate_Unit, + defaulted to False, to avoid reporting the same unit as duplicate + several times. + + 2010-10-08 Ed Schonberg + + * sem_aggr.adb (Resolve_Array_Aggregate): If the expression in an + others choice is a literal, analyze it to enable later optimizations. + * exp_aggr.adb (Expand_Record_Aggregate): An aggregate with static size + and components can be handled by the backend even if it is of a limited + type. + + 2010-10-08 Arnaud Charlet + + * a-rttiev.adb (task Timer): Since this package may be elaborated + before System.Interrupt, we need to call Setup_Interrupt_Mask + explicitly to ensure that this task has the proper signal mask. + + 2010-10-08 Robert Dewar + + * freeze.adb (Freeze_Entity): For array case, move some processing for + pragma Pack, Component_Size clause and atomic/volatile components here + instead of trying to do the job in Sem_Ch13 and Freeze. + * layout.adb: Use new Addressable function + * sem_ch13.adb (Analyze_Attribute_Representation_Clause, case + Component_Size): Move some handling to freeze point in + Freeze.Freeze_Entity. + * sem_prag.adb (Analyze_pragma, case Pack): Move some handling to + freeze point in Freese.Freeze_Entity. + * sem_util.ads, sem_util.adb (Addressable): New function. + + 2010-10-08 Robert Dewar + + * sprint.adb: Minor reformatting. + + 2010-10-08 Javier Miranda + + * exp_ch4.adb (Real_Range_Check): Declare temporary as constant. + + 2010-10-08 Robert Dewar + + * sem_ch3.adb: Minor reformatting. + + 2010-10-08 Vincent Celier + + * ali-util.adb (Get_File_Checksum): Make sure that external_as_list is + not a reserved word. + * prj-proc.adb (Expression): Process string list external references. + * prj-strt.adb (External_Reference): Parse external_as_list external + references. + * prj-tree.ads (Expression_Kind_Of): Allowed for N_External_Value nodes + (Set_Expression_Kind_Of): Ditto + * prj.adb (Initialize): Set external_as_list as a reserved word + * projects.texi: Document new string external reference + external_as_list. + * scans.ads (Token_Type): New token Tok_External_As_List + * snames.ads-tmpl: New standard name Name_External_As_List + + 2010-10-08 Thomas Quinot + + * sem_prag.adb: Minor reformatting. + + 2010-10-08 Ed Schonberg + + * sem_ch3.adb (Derived_Type_Declaration): In the private part of an + instance, it is legal to derive from a non-limited actual when the + formal type is untagged limited. + * sem_ch12.adb (Instantiate_Type): For a formal private type, use + analyzed formal as Generic_Parent_Type, to simplify later checks. + + 2010-10-08 Ed Schonberg + + * sem_res.adb (Insert_Default): If default value is already a + raise_constraint_error do not rewrite it as new raise node, to prevent + infinite loops in the warning removal machinery. + + 2010-10-08 Robert Dewar + + * sem_util.adb, sem_prag.adb: Minor reformatting + + 2010-10-08 Hristian Kirtchev + + * gnat_rm.texi: Remove the section on pragma Implemented_By_Entry. + Add section on pragma Implemented. + + 2010-10-08 Ed Schonberg + + * sem_ch3.adb (Derive_Subprogram): If an abstract extension has a + concrete parent with a concrete constructor, the inherited constructor + is abstract even if the derived type is a null extension. + + 2010-10-08 Thomas Quinot + + * sem_ch4.adb: Minor reformatting. + + 2010-10-08 Hristian Kirtchev + + * einfo.adb: Flag 232 (formerly Implemented_By_Entry) is now unused. + (Implemented_By_Entry): Removed. + (Set_Implemented_By_Entry): Removed. + (Write_Entity_Flags): Remove the output for Implemented_By_Entry. + * einfo.ads: Remove Implemented_By_Entry and its usage in entities. + (Implemented_By_Entry): Removed along with its associated pragma. + (Set_Implemented_By_Entry): Removed along with its associated pragma. + * exp_ch9.adb: Alphabetize with and use clauses of Exp_Ch9. + (Build_Dispatching_Call_Equivalent): New routine. + (Build_Dispatching_Requeue): New routine. + (Build_Dispatching_Requeue_To_Any): New routine. + (Build_Normal_Requeue): New routine. + (Build_Skip_Statement): New routine. + (Expand_N_Requeue_Statement): Rewritten. The logic has been split into + several subroutines. + * par-prag.adb: Replace Pragma_Implemented_By_Entry by + Pragma_Implemented. + * sem_ch3.adb (Check_Abstract_Overriding): Perform checks concerning + pragma Implemented. + (Check_Pragma_Implemented): New routines. + (Inherit_Pragma_Implemented): New routine. + * sem_ch9.adb (Analyze_Requeue): Update the predicate which detects a + dispatching requeue. + * sem_prag.adb: Update array Sig_Flags by removing Implemented_By_Entry + and adding Implemented. + (Ada_2012_Pragma): New routine. + (Analyze_Pragma, case Implemented): Perform all necessary checks + concerning pragma Implemented and register the pragma as a + representation item with the procedure_LOCAL_NAME. + (Analyze_Pragma, case Implemented_By_Entry): Removed. + * sem_util.adb (Implementation_Kind): New routine. + * sem_util.ads (Implementation_Kind): New routine. + * snames.ads-tmpl: Remove Name_Implemented_By_Entry and add + Name_Implemented. Remove pragma name Pragma_Implemented_By_Entry and + add Pragma_Implemented. Add special names By_Any, By_Entry and + By_Protected_Procedure. + + 2010-10-08 Javier Miranda + + * exp_ch3.adb (Expand_Freeeze_Record_Type): Code cleanup: remove local + variable Has_Static_DT by invocation of function Building_Static_DT. + + 2010-10-08 Vincent Celier + + * g-dirope.adb (Remove_Dir): Do not change the current directory when + doing a recursive remove of a subdirectory. + + 2010-10-08 Javier Miranda + + * exp_ch6.ad (Freeze_Subprogram): Factorize code. + * exp_disp.adb (Make_Secondary_DT): Factorize code. + (Make_DT): Factorize code. + + 2010-10-08 Robert Dewar + + * sem_ch4.adb: Minor reformatting. + + 2010-10-08 Robert Dewar + + * sem_ch6.adb (Check_Conformance): Check null exclusion match for full + conformance. + + 2010-10-08 Thomas Quinot + + * sem_ch12.adb (Instantiate_Object): Rename Formal_Id to Gen_Obj, for + consistency with Gen_T in Instantiate_Type. + Introduce constant A_Gen_Obj to avoid repeated queries for + Defining_Identifier (Analyzed_Formal). + + 2010-10-08 Vincent Celier + + * prj-nmsc.adb: Minor comment fix. + + 2010-10-07 Robert Dewar + + * sem_prag.adb, sem_ch13.adb: Implement AI05-0012-1/02. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-07 Ed Schonberg + + * sem_ch12.ad: (Instantiate_Object): For an in-out formal of a child + unit, if the type of the formal is declared in a parent unit and is not + a formal itself, the actual must be located from an enclosing parent + instance by normal visibility. + + 2010-10-07 Ed Schonberg + + * sem_ch4.adb (Analyze_Allocator): In Ada 2012, a null_exclusion + indicator is illegal for an uninitialized allocator. + + 2010-10-07 Robert Dewar + + * sem_prag.adb (Analyze_Attribute_Definition_Clause, case + Component_Size): Complete previous change. + + 2010-10-07 Vincent Celier + + * scng.adb (Scan): Call Accumulate_Token_Checksum for Tok_Identifier, + even for keywords, to avoid having the checksum to depend on the Ada + version. + + 2010-10-07 Gary Dismukes + + * sem_aggr.adb, sem_ch12.adb, sem_ch6.adb, par-ch5.adb, + exp_ch3.adb: Minor reformatting. + + 2010-10-07 Robert Dewar + + * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case + Component_Size): It is now illegal to give an incorrect component size + clause in the case of aliased or atomic components. + * sem_prag.adb (Analyze_Pragma, case Pack): It is now illegal to give + an effective pragma Pack in the case of aliased or atomic components. + + 2010-10-07 Steve Baird + + * exp_ch4.adb (Expand_N_Allocator): Do not bypass expansion + in the case of a violation of an active No_Task_Hierarchy restriction. + + 2010-10-07 Ed Schonberg + + * sem_ch12.adb (Validate_Derived_Type_Instance): If a formal derived + type is non-limited, an actual for it cannot be limited. + + 2010-10-07 Robert Dewar + + * einfo.ads (No_Pool_Assigned): Update documentation. + * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case + Storage_Size): We only set No_Pool_Assigned if the expression is a + static constant and zero. + * sem_res.adb (Resolve_Allocator): Allocation from empty storage pool + should be an error not a warning. + + 2010-10-07 Ed Schonberg + + * exp_aggr.adb (Expand_Array_Aggregate): Recognize additional cases + where an aggregate in an assignment can be built directly into the + target, and does not require the creation of a temporary that may + overflow the stack. + + 2010-10-07 Ed Schonberg + + * sem_aggr.adb (Analyze_Record_Aggregate): In Ada2012, a choice list + in a record aggregate can correspond to several components of + anonymous access types, as long as the designated subtypes match. + + 2010-10-07 Robert Dewar + + * gnat_rm.texi, exp_util.adb, sinfo.adb, sinfo.ads, sem_ch12.adb, + sem.adb, gnat_ugn.texi, sem_util.ads, par-ch6.adb, targparm.ads, + restrict.adb, sem_ch6.adb, sem_ch6.ads, sprint.adb, i-c.ads: Change + spelling parametrize(d) => parameterize(d). + + 2010-10-07 Robert Dewar + + * sem_ch12.adb: Add comment. + * sem_ch6.adb: Minor reformatting. + + 2010-10-07 Robert Dewar + + * par-ch3.adb, par-ch6.adb, par-ch7.adb, par-ch9.adb, par-ch10.adb: Add + Pexp to Pf_Rec constants + (P_Subprogram): Expression is always enclosed in parentheses + * par.adb (Pf_Rec): add Pexp flag for parametrized expression + * sinfo.ads (N_Parametrized_Expression): Expression must be in parens + + 2010-10-07 Ed Schonberg + + * sem_ch6.adb (Analyze_Subprogram_Specification): Implement Ada2012 + checks on functions that return an abstract type or have a controlling + result whose designated type is an abstract type. + (Check_Private_Overriding): Implement Ada2012 checks on functions + declared in the private part, if an abstract type is involved. + * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): In Ada2012, + reject a generic function that returns an abstract type. + * exp_ch5.adb (Expand_Simple_Function_Return): in Ada2012, if a + function has a controlling access result, check that the tag of the + return value matches the designated type of the return expression. + + 2010-10-07 Robert Dewar + + * par-ch6.adb: Fix error in handling of parametrized expressions. + * par-ch4.adb (P_Name): Allow qualified expression as name in Ada 2012 + mode. + (P_Simple_Expression): Better message for qualified expression prefix + * s-crc32.adb: Minor reformatting. + * exp_intr.adb (Expand_Unc_Deallocation): Remove test for empty + storage pool (this test is moved to Sem_Intr). + * sem_intr.adb (Check_Intrinsic_Call): Add check for deallocation from + empty storage pool, moved here from Exp_Intr and made into error. + (Check_Intrinsic_Call): Remove assumption in generating not-null free + warning that the name of the instantiation is Free. + * sinput.adb (Tree_Read): Document use of illegal free call allowed in + GNAT mode. + * types.ads: Remove storage size clauses from big types (since we may + need to do deallocations, which are now illegal for empty pools). + + 2010-10-07 Sergey Rybin + + * gnat_ugn.texi: Add missing word. + + 2010-10-07 Robert Dewar + + * exp_util.adb (Insert_Actions): Add handling of + N_Parametrized_Expression. + * par-ch6.adb (P_Subprogram): Add parsing of parametrized expression + * sem.adb: Add entry for N_Parametrized_Expression + * sem_ch6.adb (Analyze_Parametrized_Expression): New procedure + * sem_ch6.ads (Analyze_Parametrized_Expression): New procedure + * sinfo.ads, sinfo.adb: Add N_Parametrized_Expression + * sprint.adb (Sprint_Node): Add handling for N_Parametrized_Expression + * par-ch4.adb: Minor reformatting. + + 2010-10-07 Robert Dewar + + * scng.adb (Skip_Other_Format_Characters): New procedure + (Start_Of_Wide_Character): New procedure + (Scan): Use Start_Of_Wide_Character where appropriate + (Scan): Improve error message for other_format chars in identifier + (Scan): Allow other_format chars between tokens + + 2010-10-07 Javier Miranda + + * exp_util.adb (Safe_Prefixed_Reference): When removing side effects, + Add missing support for explicit dereferences. + + 2010-10-07 Robert Dewar + + * par-ch10.adb, par-ch3.adb, par.adb: Minor reformatting. + + 2010-10-07 Robert Dewar + + * exp_disp.adb, exp_dist.adb, exp_util.ads, exp_util.adb, + exp_ch11.adb: Rename Full_Qualified_Name to Fully_Qualified_Name_String + * sem_util.adb, sem_util.ads (Full_Qualified_Name): Moved to + Exp_Util.Fully_Qualified_Name_String. + + 2010-10-07 Robert Dewar + + * rtsfind.ads: Add entry for Ada.Real_Time.Timing_Events.Set_Handler + * sem_res.adb (Resolve_Call): A call to + Ada.Real_Time.Timing_Events.Set_Handler violates restriction + No_Relative_Delay (AI-0211). + + 2010-10-07 Ed Schonberg + + * sem_ch10.adb: Small change in error message. + + 2010-10-07 Robert Dewar + + * tbuild.ads: Minor reformatting. + + 2010-10-07 Robert Dewar + + * gnatcmd.adb, make.adb, prj-nmsc.adb, sem_elab.adb: Minor reformatting + + 2010-10-07 Arnaud Charlet + + * exp_ch11.adb (Expand_N_Exception_Declaration): Update comments. + + 2010-10-07 Robert Dewar + + * sem_res.adb: Minor reformatting + + 2010-10-07 Olivier Ramonat + + * gnat_ugn.texi: Minor editing. + * opt.ads: Document that scripts rely on specific formats in opt.ads + + 2010-10-07 Robert Dewar + + * a-wichun.ads, a-wichun.adb (To_Lower_Case): New function + (To_Upper_Case): Fix to be inverse of To_Lower_Case + * a-zchuni.ads, a-zchuni.adb (To_Lower_Case): New function + (To_Upper_Case): Fix to be inverse of To_Lower_Case + + 2010-10-07 Robert Dewar + + * a-wichha.adb, a-wichha.ads, a-zchhan.adb, a-zchhan.ads: New file. + * impunit.adb: Add entries for a-wichha/a-zchhan + * Makefile.rtl: Add entries for a-wichha/a-zchhan + + 2010-10-07 Vincent Celier + + * make.adb (Check): Call Check_Source_Info_In_ALI with Project_Tree + * makeutl.adb (Check_Source_Info_In_ALI): If there is at least one + replaced source, check that none of the replaced sources are in the + dependencies. + * makeutl.ads (Check_Source_Info_In_ALI): New parameter Tree + * prj-nmsc.adb (Remove_Source): New parameter Tree. If the source is + replaced with a source with a different file name, put it in the hash + table Replaced_Sources. + (Add_Source): Call Remove_Source with Data.Tree. If there is at least + one replaced source, check if it has the same file name as the current + source; if it has, remove it from the hash table Replaced_Sources. + * prj.adb (Reset): Reset hash table Tree.Replaced_Sources + * prj.ads (Replaced_Source_HTable): New hash table + (Project_Tree_Data): New components Replaced_Sources and + Replaced_Source_Number. + + 2010-10-07 Ed Schonberg + + * sem_elab.adb (Check_A_Call): After inserting elaboration check, set + proper flag to prevent a double elaboration check on the same call. + * exp_util.adb (Insert_Actions): If the enclosing node is an + Expression_With_Actions and it has been analyzed already, find + insertion point further up in the tree. + + 2010-10-07 Hristian Kirtchev + + * sem_ch13.adb (Analyze_Record_Representation_Clause): Alphabetize all + local variables. Remove the general restriction which prohibits the + application of record rep clauses to Unchecked_Union types. Add Ada + 2012 check to detect improper naming of an Unchecked_Union + discriminant in record rep clause. + * sem_prag.adb: Add with and use clause for Exp_Ch7. + (Analyze_Pragma): Unchecked_Union case: Propagate the Unchecked_Union + type to all invocations of Check_Component and Check_Variant. + (Check_Component): Add formal parameters UU_Typ and In_Variant_Part. + Rewritten. Add Ada 2012 check to detect improper use of formal + private types and private extensions as component types of an + Unchecked_Union declared inside a generic body. + (Check_Variant): Add formal parameter UU_Typ. Propagate the + Unchecked_Union type to all calls of Check_Component. Signal that the + current component comes from the variant part of an Unchecked_Union + type. + (Inside_Generic_Body): New routine. + + 2010-10-07 Ed Schonberg + + * exp_ch4.adb (Expand_Composite_Equality): When looking for a primitive + equality operation for a record component, verify that both formals + have the same type, and the result type is boolean. + + 2010-10-07 Vincent Celier + + * gnatcmd.adb (Check_Files): When looking for the .ci file for a + binder generated file, look for both b~xxx and b__xxx as gprbuild + always uses b__ as the prefix of such files. + + 2010-10-07 Thomas Quinot + + * sem_res.adb: Minor reformatting. + + 2010-10-07 Arnaud Charlet + + * debug.adb: Update -gnatd.J documentation. + + 2010-10-07 Robert Dewar + + * gnat_rm.texi: Document handling of invalid values + * s-utf_32.ads, s-utf_32.adb (UTF_To_Lower_Case): Fix implementation + to match new spec. + (UTF_To_Upper_Case): New function. + + 2010-10-07 Robert Dewar + + * sem_attr.adb: Minor reformatting. + * einfo.ads, einfo.adb (Is_Ada_2012_Only): New flag + * itypes.adb (Create_Null_Excluding_Itype): Set Is_Ada_2012_Only flag + properly. + * lib-xref.adb (Generate_Reference): Warn on use of Ada 2012 entity in + non-Ada 2012 mode. + * opt.ads (Warn_On_Ada_2012_Compatibility): New flag + * sem_ch3.adb (Analye_Subtype_Declaration): Inherit Is_Ada_2012_Only + * sem_ch7.adb (Preserve_Full_Attributes): Preserve Is_Ada_2012_Only + flag. + * sem_prag.adb (Analyze_Pragma, case Ada_12/Ada_2012): Allow form with + argument. + * sem_type.adb (Disambiguate): Deal with Is_Ada_2012_Only. + * sem_warn.adb (Warn_On_Ada_2012_Compatibility): New flag, treated + same as 2005 flag. + + 2010-10-07 Javier Miranda + + * a-tags.ads: Use new support for pragma Ada_2012 with function + Type_Is_Abstract. + + 2010-10-07 Ed Schonberg + + * par-ch5.adb (P_Sequence_Of_Statements): In Ada2012 a label can end a + sequence of statements. + + 2010-10-07 Vincent Celier + + * gnatcmd.adb (Check_Files): Only add a .ci files if it exists + + 2010-10-07 Javier Miranda + + * a-tags.ads, a-tags.adb (Type_Is_Abstract): New subprogram. + * rtsfind.ads (RE_Type_Is_Abstract): New entity. + * exp_disp.adb (Make_DT): Initialize TSD component Type_Is_Abstract. + + 2010-10-07 Arnaud Charlet + + * sem_ch12.adb (Mark_Context): Removed, no longer needed. + (Analyze_Package_Instantiation): No longer analyze systematically a + generic body in CodePeer mode. + * freeze.adb, sem_attr.adb: Update comments. + + 2010-10-05 Robert Dewar + + * par-ch5.adb (Test_Statement_Required): Allow all pragmas in Ada 2012 + mode. + + 2010-10-05 Pascal Obry + + * gnat_rm.texi: Fix typo. + + 2010-10-05 Arnaud Charlet + + * gnat_ugn.texi: Add note about identifiers with same name and + -fdump-ada-spec. + + 2010-10-05 Robert Dewar + + * sem_ch4.adb: Minor reformatting. + * a-direct.ads: Minor comment update. + + 2010-10-05 Javier Miranda + + * sem_ch3.adb (Add_Internal_Interface_Entities): Removing code that is + no longer required after change in New_Overloaded_Entity. + * sem_ch6.adb (New_Overloaded_Entity): Code reorganization to isolate + the fragment of code that handles derivations of interface primitives. + Add missing dependence on global variable Inside_Freezing_Actions to + ensure the correct management of internal interface entities. + * sem_ch13.adb (Analyze_Freeze_Entity): Add missing increase/decrease + of the global variable Inside_Freezing_Actions to ensure that internal + interface entities are well handled by New_Overloaded_Entity. + * sem_disp.adb (Find_Primitive_Covering_Interface): Add documentation + and complete the algorithm to catch hidden primitives derived of + private type that covers the interface. + * sem_disp.ads (Find_Primitive_Covering_Interface): Add missing + documentation. + + 2010-10-05 Robert Dewar + + * prj-util.adb, prj-util.ads, prj.ads, s-vxwext-rtp.adb, sem_ch4.adb, + sem_ch7.adb, sem_res.adb, sem_type.adb: Minor reformatting. + Minor code reorganization (use Nkind_In). + + 2010-10-05 Ed Schonberg + + * sem_ch10.adb (Analyze_Task_Body_Stub): Diagnose duplicate stub for + task. + + 2010-10-05 Vincent Celier + + * gnatbind.adb: If the main library file is not for a suitable main + program, change the error message. + + 2010-10-05 Vincent Celier + + * a-direct.ads: Minor spelling error fixes in comments. + * gnat_rm.texi: Add three entries in "Implementation Defined + Characteristics" for the interpretations of the Form parameters in + Ada.Directories. + + 2010-10-05 Robert Dewar + + * exp_ch3.adb, exp_ch5.adb, exp_disp.adb, exp_dist.adb, gnatlink.adb, + makeutl.adb, par-ch6.adb, prj-dect.adb, prj-env.adb, prj-env.ads, + prj-ext.adb, prj-nmsc.adb, prj-part.adb, prj-pp.ads: Minor code + reorganization. + Minor reformatting. + + 2010-10-05 Ed Schonberg + + * sem_res.adb (Check_Parameterless_Call): If the prefix of 'Address is + an explicit dereference of an access to function, the prefix is not + interpreted as a parameterless call. + + 2010-10-05 Ed Schonberg + + * exp_attr.adb: For 'Read and 'Write, use full view of base type if + private. + + 2010-10-05 Vincent Celier + + * make.adb (Switches_Of): Allow wild cards in index of attributes + Switches. + * prj-util.adb (Value_Of): When Allow_Wildcards is True, use the index + of the associative array as a glob regular expression. + * prj-util.ads (Value_Of (Index, In_Array)): New Boolean parameter + Allow_Wildcards, defaulted to False. + (Value_Of (Name, Attribute_Or_Array_Name)): Ditto + * projects.texi: Document that attribute Switches () may + use wild cards in the index. + + 2010-10-05 Robert Dewar + + * a-direct.adb, a-direct.ads, back_end.adb, checks.adb, + einfo.adb: Minor reformatting. + * debug.adb: Remove obsolete documentation for d.Z flag. + + 2010-10-05 Vincent Celier + + * vms_data.ads: Add VMS qualifier /SRC_INFO= corresponding to gnatmake + switch --create-info-file=. + * gnat_ugn.texi: Add documentation for new gnatmake switch + --source-info= + + 2010-10-05 Ed Schonberg + + * sem_ch3.adb: Do not elaborate type definition if syntax error. + + 2010-10-05 Javier Miranda + + * sprint.adb (Sprint_Node_Actual): Improve output of subprogram bodies + to generate the full-qualified names of its corresponding spec. + This facilitates locating the corresponing body when reading + the DG output. + + 2010-10-05 Thomas Quinot + + * exp_dist.adb (Make_Helper_Function_Name): For a tagged type, use + canonical name without serial number only if the helper is becoming a + primitive of the type. + + 2010-10-05 Javier Miranda + + * exp_disp.adb (Make_DT): Minor code reorganization. + + 2010-10-05 Ed Schonberg + + * par-ch6.adb: improve recovery with extra paren in function spec. + + 2010-10-05 Quentin Ochem + + * prj-tree.ads: Project_Path is now aliased. + + 2010-10-05 Thomas Quinot + + * checks.adb: Minor reformatting. + + 2010-10-05 Eric Botcazou + + * mlib-tgt-specific-mingw.adb (No_Argument_List): Delete. + (Shared_Libgcc): New aliased variable. + (Shared_Libgcc_Switch): New constant. + (Build_Dynamic_Library): Pass Shared_Libgcc_Switch to the compiler + * gcc-interface/Makefile.in (gnatlib-shared-win32): Pass -shared-libgcc + to the compiler. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-10-05 Vincent Celier + + * prj-part.adb (Parse_Simple_Project): When checking if a child project + imports its parent project, also look in projects being extended by + imported projects. + + 2010-10-05 Eric Botcazou + + * gnat_ugn.texi: Adjust instructions in G.10 Building DLLs with GNAT. + + 2010-10-05 Javier Miranda + + * exp_cg.adb (Slot_Number): Add support to handle aliased entities. + (Generate_CG_Output): Switch -gnatd.Z is no longer needed to + activate this output. + + 2010-10-05 Arnaud Charlet + + * back_end.adb (Call_Back_End): Generate an error message when scil + generation is enabled, and no scil back-end (by default) is available. + + 2010-10-05 Javier Miranda + + * debug.adb: Update documentation since -gnatd.Z is no longer required + to generate the call-graph information. + + 2010-10-05 Javier Miranda + + * exp_ch5.adb (Expand_Simple_Function_Return): Rewrite expansion of a + runtime access check by an equivalent expansion that causes + no problems in the VM backend. The original expansion was + not good for the VM backends because when Tagged_Type_Expansion + is disabled the attribute Access_Disp_Table is not available. + + 2010-10-05 Ed Schonberg + + * sem_type.adb (Covers): In a dispatching context, T1 covers T2 if T2 + is class-wide and T1 is its specific type. + + 2010-10-05 Ed Schonberg + + * einfo.adb: Add guard to Is_String_Type to prevent cascaded errors. + + 2010-10-05 Vincent Celier + + * back_end.ads: Minor spelling error correction. + + 2010-10-05 Arnaud Charlet + + * switch-c.adb, gnat1drv.adb (Scan_Front_End_Switches): Disable + warnings when -gnatC is specified here so that warnings can be + re-enabled explicitly. + (Adjust_Global_Switches): No longer suppress warnings. + + 2010-10-05 Vincent Celier + + * makeutl.adb: Minor reformatting. + + 2010-10-05 Ed Schonberg + + * sem_ch4.adb: add guard in Analyze_One_Call to prevent crash when a + non-discrete type appears as an actual in a call. + + 2010-10-05 Vincent Celier + + * make.adb (Scan_Make_Arg): Take into account new switch + --source-info=file. + * makeusg.adb: Add line for new switch --source-info=file. + * makeutl.ads (Source_Info_Option): New constant String for new builder + switch. + * prj-conf.adb: Put subprograms in alphabetical order + (Process_Project_And_Apply_Config): Read/write an eventual source info + file, if necessary. + * prj-nmsc.adb (Look_For_Sources.Get_Sources_From_Source_Info): New + procedure. + (Look_For_Sources): If a source info file was successfully read, get + the source data from the data read from the source info file. + * prj-util.adb (Source_Info_Table): New table + (Source_Info_Project_HTable): New hash table + (Create): New procedure + (Put (File), Put_Line): New procedures + (Write_Source_Info_File): New procedure + (Read_Source_Info_File): New procedure + (Initialize): New procedure + (Source_Info_Of): New procedure + (Next): New procedure + (Close): When file is an out file, fail if the buffer cannot be written + or if the file cannot be close successfully. + (Get_Line): Fail if file is an out file + * prj-util.ads (Create): New procedure + (Put (File), Put_Line): New procedures + (Write_Source_Info_File): New procedure + (Read_Source_Info_File): New procedure + (Source_Info_Data): New record type + (Source_Info_Iterator): New private type + (Initialize): New procedure + (Source_Info_Of): New procedure + (Next): New procedure + * prj.ads (Project_Tree_Data): New components Source_Info_File_Name and + Source_Info_File_Exists. + + 2010-10-05 Ed Schonberg + + * exp_ch4.adb: Fix typo. + + 2010-10-05 Thomas Quinot + + * lib-writ.adb: Minor reformatting. + + 2010-10-05 Javier Miranda + + * sem_ch3.adb (Access_Definition): Remove useless code. + + 2010-10-05 Emmanuel Briot + + * prj-env.adb, prj-env.ads (Set_Path): New subprogram. + (Deep_Copy): Removed, not used. + + 2010-10-05 Javier Miranda + + * sem_ch3.adb (Add_Internal_Interface_Entities): Code reorganization: + move code that searches in the list of primitives of a tagged type for + the entity that will be overridden by user-defined routines. + * sem_disp.adb (Find_Primitive_Covering_Interface): Move here code + previously located in routine Add_Internal_Interface_Entities. + * sem_disp.ads (Find_Primitive_Covering_Interface): Update docs. + * sem_ch6.adb (New_Overloaded_Entity): Add missing check on + availability of attribute Alias. + + 2010-10-05 Ed Falis + + * s-taprop-vxworks.adb, s-osinte-vxworks.adb, s-osinte-vxworks.ads, + s-vxwext.ads, s-vxwext-kernel.ads, s-vxwext-rtp.adb, s-vxwext-rtp.ads: + Move definition of intContext to System.OS_Interface. + Add necessary variants in System.VxWorks.Extensions. + + 2010-10-05 Doug Rupp + + * s-asthan-vms-alpha.adb: On VMS, a task using + pragma AST_Entry exhibits a memory leak when the task terminates + because the vector allocated for the AST interface is not freed. Fixed + by making the vector a controlled type. + + 2010-10-05 Emmanuel Briot + + * prj-nmsc.adb (Expand_Subdirectory_Pattern): Check that the prefix in + a "**" pattern properly exists, and report an error otherwise. + + 2010-10-05 Emmanuel Briot + + * prj-env.ads: Use GNAT.OS_Lib rather than System.OS_Lib. + + 2010-10-05 Emmanuel Briot + + * prj-nmsc.adb, prj-err.adb (Expand_Subdirectory_Pattern): New + subprogram. + Extract some code from Get_Directories, to share with the handling + of aggregate projects (for the Project_Files attributes) + + 2010-10-05 Emmanuel Briot + + * gnatcmd.adb, prj-proc.adb, prj-part.adb, prj-ext.adb, prj-ext.ads, + switch-m.adb, clean.adb, prj-nmsc.adb, prj-nmsc.ads, prj-env.adb, + prj-env.ads, prj-tree.adb, prj-tree.ads (Project_Search_Path): New + type. + + 2010-10-05 Eric Botcazou + + * exp_ch5.adb (Make_Field_Expr): Revert previous change (removed). + + 2010-10-05 Emmanuel Briot + + * prj-dect.adb, prj-nmsc.adb, prj-attr.adb, snames.ads-tmpl + (Aggregate projects): added support for parsing aggregate projects. + In particular, check the presence and value of the new attributes + related to aggregate projects, ie Project_Files, Project_Path + and External. + (Check_Attribute_Allowed, Check_Package_Allowed, + Rename_Obsolescent_Attributes): new subprogram, extracting code + from existing subprogram to keep their sizes smaller. + (Check_Aggregate_Project, Check_Abstract_Project, + Check_Missing_Sources): new subprograms + (Check): remove comments that duplicated either the name of the + following subprogram call, or the comment on that subprogram. + * prj-part.adb (Check_Extending_All_Imports): New subprogram, extracted + from Parse_Single_Project. + (Check_Aggregate_Imports): new subprogram. + + 2010-10-05 Vincent Celier + + * make.adb (Check): When compiling with -gnatc, recompile if the ALI + file has not been generated for the current source, for example if it + has been generated for the spec, but we are compiling the body. + + 2010-10-05 Bob Duff + + * xgnatugn.adb: Remove unused procedure. + + 2010-10-04 Vincent Celier + + * a-direct.adb (Copy_File): Interpret the Form parameter and call + System.OS_Lib.Copy_File to do the work accordingly. Raise Use_Error if + the Form parameter contains an incorrect value for field preserve= or + mode=. + * a-direct.ads (Create_Directory, Create_Path): Indicate that the Form + parameter is ignored. + (Copy_File): Indicate the interpretation of the Form parameter. + + 2010-10-04 Vincent Celier + + * make.adb (Gnatmake): When there are no foreign languages declared and + a main in attribute Main of the main project does not exist or is a + source of another project, fail immediately before attempting + compilation. + + 2010-10-04 Javier Miranda + + * exp_disp.ads (Convert_Tag_To_Interface): New function which must be + used to convert a node referencing a tag to a class-wide interface + type. + * exp_disp.adb (Convert_Tag_To_Interface): New function. + (Expand_Interface_Conversion): Replace invocation of + Unchecked_Conversion by new function Convert_Tag_To_Interface. + (Write_DT): Add support for null primitives. + * exp_ch3.adb (Expand_N_Object_Declaration): For tagged type objects, + cleanup code that handles interface conversions and avoid unchecked + conversion of referenced tag components. + * exp_ch5.adb (Expand_N_Assignment_Statement): Code cleanup. Avoid + unrequired conversions when generating a dispatching call to _assign. + * sprint.adb (Write_Itype): Fix wrong output of not null access itypes. + + 2010-10-04 Ed Schonberg + + * exp_ch4.adb (Expand_N_Op_Not): Handle properly both operands when the + parent is a binary boolean operation and the operand is an unpacked + array. + (Build_Boolean_Array_Proc_Call): If the operands are both negations, + the operands of the rewritten node are the operands of the negations, + not the negations themselves. + + 2010-10-04 Robert Dewar + + * sem_ch13.adb (Set_Biased): New procedure, now used throughout, adds + name of entity to biased warning msg. + (Analyze_Enumeration_Representation_Clause): Remove attempt to use + biased rep (wrong and never worked anyway). + + 2010-10-04 Arnaud Charlet + + * sem_elab.adb: Minor reformatting. + + 2010-10-04 Ed Schonberg + + * exp_ch4.adb (Expand_N_Null): Handle properly the case of a subtype of + an access_to_protected subprogram type, and convert null value into + corresponding aggregate. + + 2010-10-04 Eric Botcazou + + * gnat_ugn.texi: Clarify first point of 7.1.5 about pragma Inline. + + 2010-10-04 Eric Botcazou + + * make.adb (Scan_Make_Arg): Pass -Oxxx switches to the linker as well. + * gnatlink.adb (Gnatlink): Filter out -Oxxx switches for CLI, RTX and + AAMP. + + 2010-10-04 Eric Botcazou + + * sem_ch4.adb (Analyze_Indexed_Component_Form): Remove redundant test + for N_Operator_Symbol. + (Indicate_Name_And_Type): Likewise. + * sem_ch8.adb (Analyze_Subprogram_Renaming): Likewise. + * sem_res.adb (Resolve): Likewise. + * sem_type.adb (Add_One_Interp): Likewise. + (Disambiguate): Likewise. + + 2010-10-04 Vincent Celier + + * osint.adb (Read_Library_Info_From_Full): If object timestamp is less + than ALI file timestamp, return null. + + 2010-10-04 Vincent Celier + + * prj-makr.adb (Finalize): Invoke Pretty_Print with Max_Length of 79. + * prj-pp.adb (Pretty_Print): New parameter Max_Line_Length, that + replaces global constant with the same name. When a line is too long, + indent properly the next continuation line. + * prj-pp.ads (Pretty_Print): New parameter Max_Line_Length with a range + from 50 to 255, defaulted to 255, to indicate the maximum length of + lines in the project file. + + 2010-10-04 Eric Botcazou + + * sem_ch7.adb (Analyze_Package_Body_Helper) : New + Check_Subprogram_Ref function and Check_Subprogram_Refs instantiation + of Traverse_Func on it to look for subprogram references in a body. + Call Check_Subprogram_Refs on the body of inlined subprograms at the + outer level and keep clearing the Is_Public flag of subprograms as long + as it returns OK. Do not look at anything else than subprograms once + an inlined subprogram has been seen. + + 2010-10-04 Javier Miranda + + * exp_cg.adb (Expand_N_Assignment_Statement): Restore tag check when + the target object is an interface. + * sem_disp.adb (Propagate_Tag): If the controlling argument is an + interface type then we generate an implicit conversion to force + displacement of the pointer to the object to reference the secondary + dispatch table associated with the interface. + + 2010-10-04 Robert Dewar + + * sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Set + Enumeration_Rep_Expr to point to the literal, not the identifier. + (Analyze_Enumeration_Representation_Clause): Improve error message for + size too small for enum rep value + (Analyze_Enumeration_Representation_Clause): Fix size test to use + proper size (RM_Size, not Esize). + + 2010-10-04 Robert Dewar + + * s-taprop-vxworks.adb, sem_res.adb: Minor reformatting. + + 2010-10-04 Javier Miranda + + * exp_cg.adb (Write_Call_Info): Code clean up. + + 2010-10-04 Arnaud Charlet + + * s-taprop-mingw.adb (Create_Task): Initialize Thread_Id field to 0. + + 2010-10-04 Robert Dewar + + * exp_cg.adb: Minor code reorganization + Minor reformatting. + * exp_ch5.adb, prj-nmsc.adb: Minor reformatting. + + 2010-10-04 Bob Duff + + * sem_res.adb (Resolve_Type_Conversion): If a type conversion is needed + to make a qualified expression into a name (syntax-wise), then do not + consider it redundant. + + 2010-10-04 Thomas Quinot + + * sem_warn.ads: Fix typo. + + 2010-10-04 Javier Miranda + + * exp_cg.adb (Is_Predefined_Dispatching_Operation): Handle suffix in + TSS names. + (Write_Call_Info): Add missing support for renamed primitives. + + 2010-10-04 Thomas Quinot + + * exp_ch5.adb (Make_Field_Expr): New subprogram, to factor duplicated + code between Make_Component_List_Assign and Make_Field_Assign. + + 2010-10-04 Vincent Celier + + * prj-nmsc.adb (Get_Directories): For non extending projects that + declare that they have no sources, do not create a non existing object + or exec directory if builder switch -p is used. + + 2010-10-04 Sergey Rybin + + * gnat_ugn.texi (gnatcheck): Change the description of the report file + format. + + 2010-10-04 Ed Falis + + * s-taprop-vxworks.adb (Is_Task_Context): Import VxWorks intContext to + determine whether Set_True is called from a task or an ISR. + (Set_True): test for being in a task context before trying to + dereference Defer_Abort or Undefer_Abort. + + 2010-10-04 Robert Dewar + + * sem_res.adb, sinput-l.adb: Minor reformatting. + + 2010-10-04 Hristian Kirtchev + + * exp_ch5.adb (Expand_N_Assignment_Statement): Do not generate a tag + check when the target object is an interface since the expression of + the right hand side must only cover the interface. + + 2010-10-04 Vincent Celier + + * frontend.adb: Set Lib.Parsing_Main_Extended_Source to True before + loading the main source, so that if it is preprocessed and -gnateG is + used, the preprocessed file is written. + * lib.ads (Analysing_Subunit_Of_Main): New global variable to indicate + if a subunit is from the main unit when it is loaded. + * sem_ch10.adb (Analyze_Proper_Body): Set Lib.Analysing_Subunit_Of_Main + to True before loading a subunit. + * sem_ch12.adb (Copy_Generic_Node): Set Lib.Analysing_Subunit_Of_Main + to True when the main is a generic unit before loading one of its + subunits. + * sinput-l.adb (Load_File): If -gnateG is used, write the preprocessed + file only for the main unit (spec, body and subunits). + + 2010-10-04 Vincent Celier + + * sinput-l.adb (Load_File): Do not fail when switch -gnateG is + specified and the processed file cannot be written. Just issue a + warning and continue. + + 2010-10-04 Thomas Quinot + + * sem_res.adb: Minor reformatting. + + 2010-10-04 Ed Schonberg + + * sem_ch8.adb (Analyze_Subprogram_Renaming): If the renamed operation + is an overridden inherited operation, the desired operation is the + overriding one, which is the alias of the visible one. + + 2010-10-04 Ed Schonberg + + * sem_ch6.adb (Find_Corresponding_Spec): Check that the wrapper body is + present before deleting from the tree, when an inherited function with + a controlling result that returns a null extension is overridden by a + later declaration or body. + + 2010-10-04 Gary Dismukes + + * checks.adb: Update comment. + + 2010-09-30 Joseph Myers + + * gcc-interface/misc.c (optimize, optimize_size): Undefine as macros + and define as variables. + (gnat_post_options): Set optimize and optimize_size variables. + + 2010-09-29 Joel Sherrill + + * g-socket.adb: Move pragma to disable warnings in case multiple errnos + are not defined by target. + + 2010-09-29 Eric Botcazou + + * gcc-interface/utils.c (handle_leaf_attribute): Fix long line. + + 2010-09-28 Richard Henderson + + * gcc-interface/misc.c (gnat_eh_personality): Use + targetm.except_unwind_info. + + 2010-09-28 Jan Hubicka + + * gcc-interface/utils.c (handle_leaf_attribute): New function. + (gnat_internal_attribute_tables): Add leaf. + + 2010-09-22 Joseph Myers + + * gcc-interface/lang.opt (-all-warnings, -include-barrier, + -include-directory, -include-directory=, -no-standard-includes, + -no-standard-libraries): New. + + 2010-09-20 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity): Replace calls to + build_array_type with calls to build_nonshared_array_type. + (substitute_in_type): Likewise. + * gcc-interface/misc.c (LANG_HOOKS_HASH_TYPES): Delete. + (LANG_HOOKS_TYPE_HASH_EQ): Define. + (gnat_post_options): Add 'static' keyword. + (gnat_type_hash_eq): New static function. + * gcc-interface/utils.c (fntype_same_flags_p): New function. + (create_subprog_type): Call it. + (create_index_type): Call build_nonshared_range_type and tidy up. + (create_range_type): Likewise. + * gcc-interface/gigi.h (fntype_same_flags_p): Declare. + + 2010-09-19 Eric Botcazou + + * gcc-interface/trans.c (gnat_pushdecl): Do not do anything special + for PARM_DECLs. + (end_subprog_body): If the body is a BIND_EXPR, make its associated + block the top-level one. + (build_function_stub): Build a statement group for the whole function. + * gcc-interface/utils.c (Subprogram_Body_to_gnu): If copy-in/copy-out + is used, create the enclosing block early and process first the OUT + parameters. + + 2010-09-19 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Do + not generate debug info for individual enumerators. + + 2010-09-19 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Use record + type instead of enumeral type as the dummy type built for the template + type of fat pointers. + + 2010-09-19 Eric Botcazou + + * gcc-interface/gigi.h (get_elaboration_procedure): Declare. + (gnat_zaplevel): Likewise. + * gcc-interface/decl.c (gnat_to_gnu_entity): Do not force global + binding level for an external constant. + : Force the local context and create a fake scope before + translating the defining expression of an external constant. + : Treat external constants at the global level explicitly for + renaming declarations. + (elaborate_expression_1): Force the variable to be static if the + expression is global. + * gcc-interface/trans.c (get_elaboration_procedure): New function. + (call_to_gnu): Use it. + (gnat_to_gnu): Likewise. + : Do not test Is_Public to force the creation of + an initialization variable. + (add_decl_expr): Discard the statement if the declaration is external. + * gcc-interface/utils.c (gnat_pushdecl): Do not put the declaration in + the current block if it is external. + (create_var_decl_1): Do not test Is_Public to set TREE_STATIC. + (gnat_zaplevel): New global function. + + 2010-09-19 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity): Explicitly test _LEVEL + variables against zero in all cases. + (rest_of_type_decl_compilation): Likewise. + * gcc-interface/trans.c (gigi): Pass properly typed constants to + create_var_decl. + (call_to_gnu): Fix formatting. + (Handled_Sequence_Of_Statements_to_gnu): Likewise. + (Exception_Handler_to_gnu_zcx): Likewise. + (gnat_to_gnu) : Short-circuit handling of + constant + expressions in presence of a freeze node. + + 2010-09-19 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Look into + expressions for external constants that are aggregates. + * gcc-interface/utils2.c (build_simple_component_ref): If the field + is an inherited component in an extension, look through the extension. + + 2010-09-10 Vincent Celier + + * projects.texi: Add documentation for package extensions + Add some documentation for attributes Leading_Library_Options and + Linker'Leading_Switches. + + 2010-09-10 Ed Schonberg + + * exp_util.adb (Expand_Subtype_From_Expression): When expansion is + disabled, compute subtype for all string types. + + 2010-09-10 Robert Dewar + + * gnat_ugn.texi: Add documentation for -gnatw.s/S + * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case + Component_Size): Implement warning on overriden size clause. + (Analyze_Record_Representation_Clause): Implement warning on overriden + size clause. + * sem_warn.ads, sem_warn.adb (Warn_On_Overridden_Size): New flag + (-gnatw.s/S). + * ug_words: Add entries for -gnatw.s/S. + * vms_data.ads, usage.adb: Add line for -gnatw.s/-gnatw.S. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-09-10 Vincent Celier + + * prj-dect.adb (Parse_Package_Declaration): Allow a package to extend + a package with the same name from an imported or extended project. + * prj-proc.adb (Process_Declarative_Items): Process package extensions + + 2010-09-10 Bob Duff + + * exp_ch6.adb (Expand_Call): Do not perform a null_exclusion check on + 'out' parameters. + + 2010-09-10 Robert Dewar + + * sem.adb: Minor reformatting. + + 2010-09-10 Bob Duff + + * s-os_lib.ads, g-expect.ads: Add comments. + + 2010-09-10 Robert Dewar + + * exp_ch5.adb: Minor reformatting. + + 2010-09-10 Thomas Quinot + + * scos.ads: Add comments. + + 2010-09-10 Vincent Celier + + * gnatcmd.adb (Get_Closure): Remove useless invocation of Close. + + 2010-09-10 Hristian Kirtchev + + * exp_ch7.adb, exp_ch6.adb (Expand_Call): Establish a transient scope + for a controlled build-in-place function call which appears in an + anonymous context. The transient scope ensures that the intermediate + function result is cleaned up after the master is left. + (Make_Build_In_Place_Call_In_Anonymous_Context): Remove the creation + of the transient scope. This is now done in Exand_Call which covers + additional cases other than secondary stack release. + + 2010-09-10 Arnaud Charlet + + * sem.adb (Do_Unit_And_Dependents): Add guard. + + 2010-09-10 Robert Dewar + + * exp_ch5.adb: Update comments. + * exp_dist.adb: Minor reformatting. + + 2010-09-10 Robert Dewar + + * sem_ch13.adb (Check_Record_Representation_Clause): Implement record + gap warnings. + * sem_warn.ads, sem_warn.adb (Warn_On_Record_Holes): New warning flag. + * usage.adb: Add lines for -gnatw.h/H + * gnat_ugn.texi: Add documentation for J519-010 + Warn on record holes/gaps + * ug_words: Add entries for -gnatw.h/-gnatw.H + * vms_data.ads: Add entries for [NO]AVOIDGAPS + + 2010-09-10 Gary Dismukes + + * sem_ch6.adb: Update comment. + + 2010-09-10 Ed Schonberg + + * sem_ch3.adb (Build_Derived_Private_Type): Mark generated declaration + of full view analyzed after analyzing the corresponding record + declaration, to prevent spurious name conflicts with original + declaration. + + 2010-09-10 Jerome Lambourg + + * sem_ch13.adb (Analyze_Attribute_Definition_Clause): In the VM case, + just issue a warning, but continue with the normal processing. + + 2010-09-10 Robert Dewar + + * exp_attr.adb, prj-nmsc.adb, sem_ch4.adb, sem_res.adb: Minor + reformatting. + + 2010-09-10 Thomas Quinot + + * exp_dist.adb (Build_From_Any_Call, Build_To_Any_Call, + Build_TypeCode_Call): For a subtype inserted for the expansion of a + generic actual type, go to the underlying type of the original actual + type. + + 2010-09-10 Ed Schonberg + + * exp_ch5.adb (Expand_Assign_Array_Loop): In CodePeer mode, place a + guard around the increment statement, to prevent an off-by-one-value + on the last iteration. + + 2010-09-10 Vincent Celier + + * sem_aggr.adb, exp_prag.adb, sem_ch3.adb, exp_attr.adb, + sem_res.adb, sem_attr.adb, sem_elab.adb, sem_ch4.adb, exp_disp.adb, + exp_aggr.adb, exp_dist.adb: Change all mentions of "at run-time" to + "at run time" in comments and error/warning messages. + + 2010-09-10 Ed Schonberg + + * exp_cg.adb: Handle properly bodies without specs. + + 2010-09-10 Emmanuel Briot + + * prj-nmsc.adb (Find_Source_Dirs): When a source directory is not + present, and the user requested to either ignore this or display a + warning (as opposed to an error), we still need to register the + directory. + + 2010-09-10 Robert Dewar + + * errout.adb: Remove tests of Parsing_Main_Subunit, since this test is + now done in In_Extended_Main_Source_Unit. + * errout.ads (Compiler_State[_Type]): Moved from Errout to Lib + (Parsing_Main_Subunit): Moved from Errout to Lib and renamed + as Parsing_Main_Extended_Source. + * frontend.adb: Set Parsing_Main_Extended_Source True for parsing main + unit. + * lib-load.adb (Load_Unit): Add PMES parameter + Set PMES appropriately in all calls to Load_Unit + * lib-load.ads (Load_Unit): Add PMES parameter + * lib.adb (In_Extended_Main_Source_Unit): When called with + Compiler_State set to Parsing, test new flag + Compiling_Main_Extended_Source. + * lib.ads (Compiler_State[_Type]): Moved from Errout to Lib + (Parsing_Main_Subunit): Moved from Errout to Lib and renamed + as Parsing_Main_Extended_Source + * par-load.adb (Load): Set PMES properly in call to Load_Unit + + 2010-09-10 Ed Schonberg + + * exp_cg.adb: Use proper entity to handle overloads. + * sem_res.adb (Check_Parameterless_Call): An operator node without + actuals cannot be a call, and must be treated as a string. + + 2010-09-10 Robert Dewar + + * frontend.adb: Minor reformatting. + + 2010-09-10 Robert Dewar + + * par-ch4.adb (P_Conditional_Expression): Use P_Condition for condition + * par-ch5.adb (P_Condition): Move from body to spec + * par.adb (Ch5.P_Condition): Move from body to spec + + 2010-09-10 Ed Schonberg + + * exp_cg.adb (Write_Call_Info): If a type that has been registered in + the call table is private, use its full view to generate information + on its operations. + + 2010-09-10 Jose Ruiz + + * exp_cg.adb (Is_Predefined_Dispatching_Operation): When trying the + pattern matching to detect predefined primitive operations take into + account that there can be an extra suffix related to body-nested + package entities. + + 2010-09-10 Ed Schonberg + + * s-pooglo.ads: Add overriding indicators. + + 2010-09-10 Vincent Celier + + * vms_data.ads: Add new GNAT BIND qualifiers /32_MALLOC (for -H32) and + /64_MALLOC (for -H64). + + 2010-09-10 Robert Dewar + + * errout.adb (Error_Msg_Internal): Test Parsing_Main_Subunit flag + (Error_Msg_NW): Test Parsing_Main_Subunit flag + * errout.ads (Parsing_Main_Subunit): New flag + * lib-load.adb (Load_Unit): Set Parsing_Main_Subunit flag + * par-ch6.adb: Minor style fix (remove redandant parentheses) + * par-ch9.adb: Minor style fix (remove redundant parens) + * par-load.adb: (Load): Deal with setting Parsing_Main_Subunit + + 2010-09-10 Vincent Celier + + * make.adb (Create_Binder_Mapping_File): Remove procedure. Replaced by + function of the same name in Makeutl. + (Gnatmake): Call function Create_Binder_Mapping_File in Makeutl, instead + of removed procedure when creating a binder mapping file. + * makeutl.adb (Create_Binder_Mapping_File): New function. Was a + procedure in Make. + * makeutl.ads (Create_Binder_Mapping_File): New function + + 2010-09-10 Jose Ruiz + + * exp_cg.adb (Is_Predefined_Dispatching_Operation): Add the "__" scope + separator when trying the pattern matching to detect predefined + primitive operations. + + 2010-09-10 Robert Dewar + + * bindgen.adb, atree.adb: Minor reformatting. + + 2010-09-10 Ben Brosgol + + * ug_words, gnat_ugn.texi: Revised "Transitioning to 64-Bit GNAT for + OpenVMS" section. + + 2010-09-10 Doug Rupp + + * bindgen.adb: Minor comment fix for -H switch. + + 2010-09-10 Ed Schonberg + + * exp_cg.adb (Register_CG_Node): Determine enclosing subprogram or + library unit now, by traversing tree before context is expanded. + (Write_Call_Info): Use enclosing unit name directly. + * exp_ch9.adb (Expand_N_Accept_Statement): Attach generated block to + tree earlier, to ensure that subsequent declarations are analyzed in a + connected structure. + * exp_intr.adb (Expand_Unc_Deallocation): Ditto for generated statement + list. + + 2010-09-10 Robert Dewar + + * symbols-processing-vms-alpha.adb: Minor reformatting. + + 2010-09-10 Jerome Lambourg + + * bindgen.adb (Gen_Adainit_Ada): In .NET, don't call + __gnat_install_handler in case the binder is called with -n. + + 2010-09-10 Ed Schonberg + + * exp_ch6.adb (Make_Build_In_Place_In_Object_Declaration): Use proper + sloc for renaming declaration and set Comes_From_Source properly to + ensure that references are properly generated for an object declaration + that is built in place. + + 2010-09-10 Tristan Gingold + + * symbols-processing-vms-alpha.adb: Allow gnatsym to work as a cross + tool. + * gcc-interface/Make-lang.in: Install gnatsym when cross compiling. + * gcc-interface/Makefile.in: gnat.hlp is now generated by + Make-generated.in + + 2010-09-10 Bob Duff + + * exp_pakd.adb (Expand_Bit_Packed_Element_Set): For things like ""X(J) + := ...;", remove side effects from the right-hand side, because they + might affect the value of the left-hand side, but the left-hand side is + first READ (so we can do shifting and masking) and then written back, + which would cause the side effects to be incorrectly overwritten. + + 2010-09-10 Robert Dewar + + * sem_ch4.adb: Minor reformatting. + * exp_ch6.adb: Add comment on testing limited on full type + * gnat_rm.texi: Add documentation on Pure_Function. + + 2010-09-10 Vincent Celier + + * prj-nmsc.adb (Add_Source): Allow an Ada source to have the same name + as a source of another project and of another language. + + 2010-09-10 Robert Dewar + + * exp_ch3.adb (Expand_N_Object_Declaration): Defend against previous + errors. + * freeze.adb (Check_Unsigned_Type): Ditto. + * sem_aggr.adb (Resolve_Aggr_Expr): Ditto. + * sem_ch3.adb (Convert_Scalar_Bounds): Ditto. + (Set_Scalar_Range_For_Subtype): Ditto. + * sem_eval.adb (Subtypes_Statically_Match): Ditto. + + 2010-09-10 Robert Dewar + + * repinfo.adb (List_Type_Info): List Small and Range for fixed-point + types. + * sprint.adb (Write_Ureal_With_Col_Check_Sloc): Use square brackets + rather than parens for fixed constants. + * sprint.ads: Use square brackets rather than parens for fixed constants + * urealp.adb (UR_Write): Use square brackets rather than parens + (UR_Write): Add Brackets argument + (UR_Write): Add many more special cases to output literals + * urealp.ads (UR_Write): Use square brackets rather than parens + (UR_Write): Add Brackets argument + + 2010-09-10 Robert Dewar + + * sem_ch4.adb: Minor reformatting. + + 2010-09-10 Richard Guenther + + * gcc-interface/utils.c (create_index_type): Use build_range_type. + + 2010-09-10 Arnaud Charlet + + * vms_cmds.ads: New. + + 2010-09-10 Eric Botcazou + + * exp_dbug.ads: Mention enhanced encoding for array types. + + 2010-09-10 Jerome Lambourg + + * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Size clause are + unsupported in VM targets. Display a warning in this case. + + 2010-09-10 Ed Schonberg + + * sprint.adb (Sprint_Node_Actual, case N_Derived_Type_Definition): Do + not reset Sloc when printing keyword "new". + + 2010-09-10 Vincent Celier + + * gnatcmd.adb (GNATCmd): Put the command line in environment variable + GNAT_DRIVER_COMMAND_LINE. + + 2010-09-10 Ed Schonberg + + * sem.adb (Do_Unit_And_Dependents): if Withed_Body is set on a context + clause, process the body at once. + + 2010-09-10 Ed Schonberg + + * sem_res.adb (Resolve_Type_Conversion): Do not warn on a redundant + conversion is the expression is a qualified expression used to + disambiguate a function call. + + 2010-09-10 Vincent Celier + + * prj-nmsc.adb (Add_Source): Allow an Ada source to have the same name + as a source of another project and of another language. + + 2010-09-10 Robert Dewar + + * prj-util.adb: Minor reformatting. + + 2010-09-10 Eric Botcazou + + * exp_disp.adb: Minor reformatting. + + 2010-09-10 Arnaud Charlet + + * sem_prag.adb (Analyze_Pragma): Ignore Inline_Always pragma in + CodePeer mode. + + 2010-09-10 Thomas Quinot + + * sem_res.adb: Minor reformatting. + * exp_ch9.adb, rtsfind.ads, exp_ch4.adb, exp_ch3.adb: Do not hardcode + magic constants for task master levels (instead, reference + named numbers from System.Tasking). + + 2010-09-10 Eric Botcazou + + * gnatvsn.ads (Ver_Prefix): New constant string. + * bindgen.adb (Gen_Output_File_Ada): Use it in lieu of hardcoded value. + (Gen_Output_File_C): Likewise. + * g-comver.adb (Ver_Prefix): Add cross-reference to Gnatvsn.Ver_Prefix + in comment. + + 2010-09-10 Ed Schonberg + + * sem.adb (Walk_Library_Items): Do not traverse children of the main + unit, to prevent spurious circularities in the walk order. + (Depends_On_Main): Use elsewhere to prevent circularities when the body + of an ancestor of the main unit depends on a child of the main unit. + + 2010-09-10 Robert Dewar + + * gnatlink.adb, prj-ext.adb, prj-util.adb, s-tporft.adb, + sem_ch3.adb: Minor reformatting. + + 2010-09-10 Ed Schonberg + + * sem_ch3.adb (Derive_Subprograms): An interface primitive operation + that is a renaming must be derived like any other primitive operation, + the renamed operation is not relevant to the derivation. + + 2010-09-10 Robert Dewar + + * sem_aux.ads: Add comment for Is_Inherently_Limited_Type. + * checks.adb: Minor reformatting. + + 2010-09-10 Robert Dewar + + * gnat_ugn.texi: Add section on intent of style checking options. + + 2010-09-10 Arnaud Charlet + + * xref_lib.adb (Get_Full_Type): Fix handling of 'a' char. + + 2010-09-10 Ed Schonberg + + * sem_ch3.adb: Improve error message on derivation from class-wide type + + 2010-09-10 Steve Baird + + * gnat1drv.adb (Adjust_Global_Switches): Enable Expression_With_Actions + generation when Generate_SCIL is True. + + 2010-09-10 Geert Bosch + + * gnatlink.adb (Check_ Existing_Executable): New procedure for checking + validity of executable name and removing any existing executable + (Gnatlink): Call Check_Existing_Executable. + + 2010-09-10 Arnaud Charlet + + * s-tporft.adb, s-taskin.ads (Register_Foreign_Thread): Move + initialization of Task_Alternate_Stack here, cleaner since in case of + ranvescar, Restricted_Ada_Task_Control_Block is not initialized + implicitly. + + 2010-09-10 Thomas Quinot + + * s-fileio.adb, a-dirval.adb: Minor reformatting. + + 2010-09-10 Emmanuel Briot + + * prj-util.adb (Executable_Of): Fix CE when the project does not + contain a Builder package. + + 2010-09-10 Vincent Celier + + * prj-ext.adb (Initialize_Project_Path): Add /lib/gpr/ + to the project path, if Prefix and Target_Name are defined. + * prj-tree.ads (Project_Node_Tree_Data): New component Target_Name + + 2010-09-10 Ed Schonberg + + * checks.adb (Ensure_Valid): If the expression is a boolean expression + or short-circuit operation, do no emit a validity check: only the + elementary operands of the expression need checking. + + 2010-09-10 Ben Brosgol + + * gnat_rm.texi: Document Short_Descriptors. + + 2010-09-10 Arnaud Charlet + + * s-taprop-linux.adb, s-taskin.ads (Task_Alternate_Stack): Default + initialize to Null_Address. + (Enter_Task): Do not set up an alternate stack for foreign threads. + + 2010-09-10 Robert Dewar + + * opt.adb (Short_Descriptors): New flag + (Short_Descriptors_Config): New flag + * opt.ads (Short_Descriptors): New flag + (Short_Descriptors_Config): New flag + * par-prag.adb: Add dummy entry for Short_Descriptors pragma + * sem_prag.adb (Set_Mechanism_Value): Deal with Short_Descriptors. + (Analyze_Pragma): Implement Short_Descriptors pragma + * snames.ads-tmpl: Add entry for Short_Descriptors pragma + + 2010-09-10 Emmanuel Briot + + * prj-util.adb, prj-util.ads (Executable_Of): Take into account the + project's Executable_Suffix. + + 2010-09-10 Robert Dewar + + * g-pehage.ads: Minor reformatting + + * gnat_ugn.texi: Clarifying comment on -gnatyc + * exp_ch6.adb (Expand_N_Subprogram_Body): Reset Is_Pure if limited + arguments. + + 2010-09-10 Tristan Gingold + + * Make-generated.in (gnat.hlp): New rule. + + 2010-09-10 Emmanuel Briot + + * prj-util.adb, prj-util.ads (Executable_Of): New parameter + Include_Suffix. + + 2010-09-10 Robert Dewar + + * einfo.adb: Minor code cleanup: Add assertion to + Set_Corresponding_Protected_Entry. + + 2010-09-10 Bob Duff + + * g-pehage.ads, g-pehage.adb (Produce): Add a new flag to allow sending + the output to standard output. + + 2010-09-09 Vincent Celier + + * gnat_ugn.texi: Add documentation for new gnatmake switch + --create-map-file. + * make.adb (Map_File): New global variable to store the value of switch + --create-map-file. + (Gnatmake): Add switch -M to gnatlink if switch --create-map-file has + been specified. + (Scan_Make_Arg): Recognize switch --create-map-file + * makeutl.ads (Create_Map_File_Switch): New constant string for new + gnatmake and gprbuild switch --create-map-file. + + 2010-09-09 Robert Dewar + + * sinput-p.ads: Minor comment update. + + 2010-09-09 Arnaud Charlet + + * s-tpobop.adb, s-taenca.adb (Wait_For_Completion_With_Timeout): Reset + Entry_Call.State if needed so that the call is marked as cancelled by + Check_Pending_Actions_For_Entry_Call. + (Timed_Protected_Entry_Call): Adjust calls to Defer/Under_Abort, since + this procedure may be called from a controlled operation + (Initialize/Finalize). + + 2010-09-09 Vadim Godunko + + * impunit.adb: Correct spelling of package's name in the comment. + + 2010-09-09 Robert Dewar + + * gnatcmd.adb, gnatlink.adb, sem_ch12.adb, sem_eval.adb, sinput-p.adb: + Minor reformatting + + 2010-09-09 Robert Dewar + + * impunit.adb: Add entry for a-izteio. + * checks.adb: Add comment. + * debug.adb, exp_disp.adb: Minor reformatting. + * exp_dbug.ads: Minor reformatting throughout (pack block comments). + + 2010-09-09 Ed Schonberg + + * sem_eval.adb (Is_Same_Value): Two occurrences of the same + discriminant cannot be assumed to be the same value because they may + refer to bounds of a component of two different instances of a + discriminated type. + + 2010-09-09 Gary Dismukes + + * checks.adb (Apply_Arithmetic_Overflow_Check): When converting the + operands of an operator to the type of an enclosing conversion, rewrite + the operator so the conversion can't be flagged as redundant. + Remove useless assignments to Typ and Rtyp. + + 2010-09-09 Eric Botcazou + + * gnat_ugn.texi: Fix another long line. + + 2010-09-09 Bob Duff + + * sem_warn.adb (Output_Reference_Error): Don't warn for renames read + but never assigned. + + 2010-09-09 Matthew Heaney + + * a-convec.adb, a-coinve.adb (Clear, Delete, Delete_Last, Finalize, + Merge, Insert, Insert_Space, Move, Reserve_Capacity, Generic_Sorting, + Replace_Element, Reverse_Elements, Swap): Change exception message to + correctly indicate kind of tampering (cursor or element). + * a-cdlili.adb, a-cidlli.adb (Clear, Delete, Delete_First, Delete_Last, + Merge, Generic_Sorting, Insert, Move, Reverse_Elements, Splice, + Swap_Links, Replace_Element, Swap): Ditto. + * a-coorse.adb, a-ciorse.adb (Include, Replace, Replace_Element): Ditto + * a-coorma.adb, a-ciorma.adb (Include, Replace, Replace_Element): Ditto + * a-coormu.adb, a-ciormu.adb (Replace_Element): Ditto + * a-chtgke.adb (Delete_Key_Sans_Free, Generic_Conditional_Insert, + Generic_Replace_Element): Ditto + * a-chtgop.adb (Clear, Move, Reserve_Capacity): Ditto + * a-cohama.adb, a-cihama.adb (Delete, Include, Replace, + Replace_Element): Ditto. + * a-cohase.adb, a-cihase.adb (Delete, Difference, Intersection, + Symmetric_Difference, Union, Include, Replace): Ditto + + 2010-09-09 Ed Schonberg + + * sprint.adb (Write_Id): If the parent node is an expanded name, check + that its entity_or_associated_node is an entity before writing it out. + * exp_disp.adb (Make_Tags); if a type is declared in C++ and has no + constructors, there is no need for a dispatch table pointer because the + table is fully inherited from the C++ code. + + 2010-09-09 Thomas Quinot + + * projects.texi: Fix wrong identifiers on package end lines in project + files examples. + * exp_ch6.adb: Minor reformatting. + + 2010-09-09 Tristan Gingold + + * gnatcmd.adb, vms_conv.ads: Extract Command_Type. + + 2010-09-09 Eric Botcazou + + * gnat_ugn.texi: Fix description of -O3 optimization level. + + 2010-09-09 Yannick Moy + + * a-cihama.adb, a-cohama.adb: Fix comments. + + 2010-09-09 Arnaud Charlet + + * i-cexten.ads: Add comments. + (Signed_128): New type, used by some C bindings. + * debug.adb: Update comment. + + 2010-09-09 Sergey Rybin + + * gnat_ugn.texi: For ASIS tools (gnatpp, gnatcheck, gnatelim, + gnatmetric and gnatstub) add a note that '-gnat05' should be used if + the tool should process Ada 2005 sources. + + 2010-09-09 Ed Schonberg + + * sem_ch12.adb (Remove_Parent): If the scope containing the child + instance is a block, examine the enclosing scope to determine if it is + a parent instance. + + 2010-09-09 Doug Rupp + + * sem_prag.adb (pragma Ident): Pass --identification= vice + IDENTIFICATION= + * gnatlink.adb (Linker_Options): Look for --identification= vice + IDENTIFICATION= + + 2010-09-09 Gary Dismukes + + * exp_attr.adb (Expand_N_Attribute_Reference, case Attribute_Old): When + inserting and analyzing the object declaration for the temporary object + created to hold a 'Old value, push the scope for the subprogram where + the object is inserted, so that its Scope (and that of related objects) + will be set properly. + + 2010-09-09 Vincent Celier + + * prj.adb (Get_Object_Directory): Return object directory display name + * adaint.c (__gnat_get_file_names_case_sensitive): When environment + variable GNAT_FILE_NAME_CASE_SENSITIVE has a value of "0" or "1", + return this value, otherwise return the default for the platform. + + 2010-09-09 Arnaud Charlet + + * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update + dependencies. Remove handling of gnatlbr. + Do not remove s-stratt-xdr for the run-time when installing. + + 2010-09-09 Robert Dewar + + * sem_attr.adb: Minor reformatting. + + 2010-09-09 Thomas Quinot + + * socket.c (__gnat_socket_ioctl): On Darwin, the req parameter is an + unsigned long, not an int. + + 2010-09-09 Vincent Celier + + * make.adb, mlib-prj.adb, prj.adb, prj-nmsc.adb, mlib-tgt.adb, + prj-conf.adb, prj-env.adb: Use Display_Name instead of Name whenever + we are not checking for equality of path or file names. + + 2010-09-09 Ed Schonberg + + * exp_util.adb (Remove_Side_Effects): If the expression is a packed + array reference, reset the Analyzed flag so that it is properly + expanded when the resulting object declaration is analyzed. + + 2010-09-09 Vincent Celier + + * sinput-p.adb (Source_File_Is_Subunit): Return False if X is + No_Source_File. + + 2010-09-09 Ramon Fernandez + + * sysdep.c: The wrSbc8548 BSP in MILS doesn't know anything about the + VX_SPE_TASK option, so disable it. + + 2010-09-09 Ed Schonberg + + * sem.adb (Walk_Library_Items): Traverse context of subunits of the + main unit. + (Is_Subunit_Of_Main): Handle null nodes properly. + + 2010-09-09 Robert Dewar + + * par-ch2.adb: Update comments. + + 2010-09-09 Ben Brosgol + + * gnat_rm.texi: Minor wordsmithing of section on pragma Ordered. + + 2010-09-09 Arnaud Charlet + + * par-ch2.adb (Scan_Pragma_Argument_Association): In CodePeer mode, + do not generate an error for compatibility with legacy code. + ignored when generating SCIL. + * sem_attr.adb (Resolve_Attribute): Ignore AI-229 in CodePeer mode. + + 2010-09-09 Thomas Quinot + + * s-strxdr.adb, gnat_rm.texi, s-stratt-xdr.adb, s-stratt.ads: Rename + s-strxdr.adb to s-stratt-xdr.adb + + 2010-09-09 Robert Dewar + + * ali-util.adb (Obsolescent_Check): Removed. + * gprep.adb (Obsolescent_Check): Removed. + Remove Obsolescent_Check parameter in Scng instantiation + * prj-err.adb (Obsolescent_Check): Removed. + * prj-err.ads (Obsolescent_Check): Removed. + Remove Obsolescent_Check parameter in Scng instantiation + * scans.ads (Based_Literal_Uses_Colon): New flag + * scn.adb (Obsolscent_Check_Flag): Removed + (Obsolscent_Check): Removed + (Set_Obsolescent_Check): Removed + (Post_Scan): Add handling for obsolescent features + * scn.ads (Obsolscent_Check): Removed + (Set_Obsolescent_Check): Removed + (Post_Scan): Can no longer be inlined + Remove Obsolescent_Check from instantiation of Scng + * scng.adb (Nlit): Set Based_Literal_Uses_Colon + (Nlit): Remove handling of obsolescent check + (Scan, case '%'): Remove handling of obsolescent check + (Scan, case '|'): Call Post_Scan + (Scan, case '!'): Remove handling of obsolescent check, call Post_Scan + * scng.ads Remove Obsolescent_Check argument from Scng generic + (Post_Scan): Now called for Tok_Vertical_Bar + * sinput-l.adb: Remove calls to Set_Obsolescent_Check + + 2010-09-09 Doug Rupp + + * gnatlbr.adb: Removed. + * gnat_rm.texi, ug_words, gnat_ugn.texi: Remove mention of gnatlbr. + + 2010-09-09 Robert Dewar + + * sem_res.adb (Resolve_Type_Conversion): Catch more cases of redundant + conversions. + + 2010-09-09 Vincent Celier + + * gnatlbr.adb: Remove redundant conversions. + + 2010-09-09 Vincent Celier + + * prj-proc.adb: Minor comment spelling error fix. + * osint.ads (Env_Vars_Case_Sensitive): Use function + Get_Env_Vars_Case_Sensitive, not Get_File_Names_Case_Sensitive to + compute value. + + 2010-09-09 Ed Schonberg + + * sem_res.adb (Resolve_Equality_Op): Implement Ada2012 rule for + resolution of conditional expressions whose dependent expressions are + anonymous access types. + + 2010-09-09 Robert Dewar + + * a-ststio.adb: Minor code reorganization. + * s-direio.adb, prj.adb, prj-nmsc.adb, sem_type.adb: Remove redundant + conversion. + * types.ads: Minor reformatting. + * binde.adb, vms_conv.adb, gnatls.adb, s-strxdr.adb, uintp.adb: Remove + redundant conversions. + * output.adb: Minor reformatting. + * sem_ch8.adb (Find_Type): Test for redundant base applies to user + types. + * opt.ads: Add pragma Ordered for Verbosity_Level. + * prj.ads: Add pragma Ordered for type Verbosity. + + 2010-09-09 Vincent Celier + + * osint.adb (Canonical_Case_File_Name): Use procedure To_Lower in + System.Case_Util + (Canonical_Case_Env_Var_Name): Ditto + + 2010-09-09 Bob Duff + + * g-pehage.adb (Allocate): Initialize the allocated elements of IT. + + 2010-09-09 Robert Dewar + + * cstand.adb: Mark Boolean and Character types as Ordered + * einfo.adb (Has_Pragma_Ordered): New flag + * einfo.ads (Has_Pragma_Ordered): New flag + * g-calend.ads: Mark Day_Name as Ordered + * opt.ads: Mark Ada_Version_Type as Ordered + (Warn_On_Unordered_Enumeration_Type): New flag + * par-prag.adb: Add procdessing for pragma Ordered + * s-ficobl.ads (Read_File_Mode): New subtype + * s-fileio.adb: Use Read_File_Mode instead of explicit ranges + * s-taskin.ads: Mark Entry_Call_State as ordered + * sem_ch3.adb (Build_Derived_Enumeration_Type): Inherit + Has_Pragma_Ordered. + * sem_ch6.ads: Mark Conformance_Type as Ordered + * sem_prag.adb: Implement pragma Ordered + * sem_res.adb (Bad_Unordered_Enumeration_Reference): New function + (Resolve_Comparison_Op): Diagnose unordered comparison + (Resolve_Range): Diagnose unordered range + * sem_warn.adb (Warn_On_Unordered_Enumeration_Type): New flag (from + -gnatw.u/U) + * snames.ads-tmpl: Add entry for pragma Ordered + * style.ads (Check_Enumeration_Subrange): Removed + * styleg.adb (Check_Enumeration_Subrange): Removed + * styleg.ads (Check_Enumeration_Subrange): Removed + * stylesw.adb: Remove handling of -gnatyE switch + * stylesw.ads: (Style_Check_Enumeration_Subranges): Removed + * vms_data.ads: Remove -gnatyE entries + Add -gnatw.u entries + * ug_words: Entries for -gnatw.u and -gnatw.U + * gnat_ugn.texi: Document -gnatw.u/-gnatw.U switches + * gnat_rm.texi: Document pragma Ordered. + * s-tasren.adb: Avoid unnecessary comparison on unordered enumeration. + * s-tpobop.adb: Remove comparison on unordered enumeration type. + + 2010-09-09 Vincent Celier + + * adaint.c: New function __gnat_get_env_vars_case_sensitive, returns 0 + for VMS and Windows, and 1 for all other platforms. + * adaint.h: New function __gnat_get_env_vars_case_sensitive + * osint.ads, osint.adb (Canonical_Case_Env_Var_Name): New procedure. + * prj-ext.adb (Add): Call Canonical_Case_Env_Var_Name instead of + Canonical_Case_File_Name, as we are dealing with environment variables, + not files. + + 2010-09-09 Robert Dewar + + * sem_util.adb: Minor reformatting + + 2010-09-09 Vincent Celier + + * vms_data.ads: Add documentation for S_Make_Single. + + 2010-09-09 Ed Schonberg + + * sem_util.adb (Same_Object): include formal parameters. + + 2010-09-09 Vincent Celier + + * make.adb (Queue): New package implementing a new impementation of the + queue, taking into account the new switch --single-compile-per-obj-dir. + * makeutl.ads (Single_Compile_Per_Obj_Dir_Switch): New constant String + for gnatmake and gprbuild new switch --single-compile-per-obj-dir. + * opt.ads (One_Compilation_Per_Obj_Dir): New Boolean flag, defauted to + False. + * switch-m.adb (Scan_Make_Switches): Take into account new gnatmake + switch --single-compile-per-obj-dir. + * vms_data.ads: Add qualifier SINGLE_COMPILE_PER_OBJ_DIR for gnatmake + switch --single-compile-per-obj-dir. + * gnat_ugn.texi: Add documentation for new gnatmake switch + --single-compile-per-obj-dir. + + 2010-09-09 Ed Schonberg + + * einfo.adb, einfo.ads: Clarify use of Corresponding_Protected_Entry. + + 2010-09-09 Javier Miranda + + * sem_ch3.adb (Is_Progenitor): Relocated to sem_type. + (Replace_Type): Code cleanup. + * sem_type.ads, sem_type.adb (Is_Progenitor): Relocated from sem_ch3 + + 2010-09-09 Thomas Quinot + + * exp_ch8.adb: Minor reformatting. + + 2010-09-09 Ed Schonberg + + * exp_ch9.adb, einfo.adb, einfo.ads: New attribute + Corresponding_Protected_Entry. + + 2010-09-09 Ed Schonberg + + * exp_ch3.adb (Build_Untagged_Equality): Do not set alias of implicit + inequality, it is always rewritten as the negation of the corresponding + equality operation. + * exp_ch8.adb (Expand_N_Subprogram_Renaming): If the subprogram renames + the predefined equality of an untagged record, create a body at the + point of the renaming, to capture the current meaning of equality for + the type. + + 2010-09-09 Robert Dewar + + * sem.adb, sem_warn.adb: Minor reformatting. + + 2010-09-09 Ed Schonberg + + * sem_ch6.adb: Improve error message on untagged equality. + * sem.adb (Semantics): Include subprogram bodies that act as spec. + + 2010-09-09 Javier Miranda + + * sem_ch13.adb, exp_ch13.adb: Undo previous change, unneeded. + + 2010-09-09 Robert Dewar + + * sem_ch13.adb, sem_ch6.adb, exp_ch3.adb: Minor reformatting. + + 2010-09-09 Robert Dewar + + * einfo.adb (Is_Aggregate_Type): New function. + * einfo.ads (Aggregate_Kind): New enumeration subtype + (Is_Aggregate_Type): New function. + * sem_type.adb (Is_Array_Class_Record_Type): Removed, replaced by + Is_Aggregate_Typea. + + 2010-09-09 Robert Dewar + + * exp_ch11.adb, frontend.adb, sem_attr.adb, sem_ch10.adb, sem_ch3.adb, + sem_ch4.adb, sem_ch9.adb, sem_res.adb: Use Restriction_Check_Needed + where appropriate. + * restrict.ads, restrict.adb: Ditto. + (Restriction_Check_Needed): New function + + 2010-09-09 Ed Schonberg + + * exp_ch9.ads (Find_Master_Scope): New function, extracted from + Build_Master_Entity, to find the proper scope for the master entity of + a type that may contain tasks, in the presence of transient scopes. + * exp_ch9.adb (Build_Master_Entity) Use new function. + * exp_ch3.adb (Build_Class_Wide_Master): ditto. + + 2010-09-09 Vincent Celier + + * prj-attr.adb: Add new attributes Leading_Library_Options and + Linker'Leading_Switches. + * snames.ads-tmpl: Add new standard names Leading_Library_Options and + Leading_Switches. + + 2010-09-09 Javier Miranda + + * sem_ch3.adb (Derive_Subprogram): The code that checks if a + dispatching primitive covers some interface primitive is incomplete. + Replace such code by the invocation of a new subprogram that provides + this functionality. + * sem_ch6.ads (Is_Interface_Conformant): Add missing documentation. + * sem_ch6.adb (Check_Missing_Return): Minor reformating + (Check_Convention): Complete if-statement conditition when reporting + errors (to avoid assertion failure). + * sem_ch13.adb (Make_Null_Procedure_Specs): This routine was previously + located in exp_ch3. Relocated inside Analyze_Freeze_Entity. + (Analyze_Freeze_Entity): Invoke routine that adds the spec of non + overridden null interface primitives. + * sem_type.adb (Is_Ancestor): If the parent of the partial view of a + private type is an interface then use the parent of its full view to + climb to its ancestor type. + * sem_disp.ads, sem_disp.adb (Covers_Some_Interface): New subprogram. + (Check_Dispatching_Operation): Extend assertion to handle wrappers of + null interface primitives. + (Is_Null_Interface_Primitive): New subprogram. + * exp_ch3.adb (Make_Null_Procedure_Specs): Removed. + (Expand_Freeze_Record_Type): Do not generate specs of null interface + subprograms because they are now generated by Analyze_Freeze_Entity. + + 2010-09-09 Robert Dewar + + * a-calfor.adb, sem_ch3.adb: Minor reformatting. + + 2010-09-09 Robert Dewar + + * bindgen.adb (Gen_Restrictions_Ada): Avoid explicit enumeration ranges + (Gen_Restrictions_C): Avoid explicit enumeration ranges + (Set_String_Replace): New procedure + * casing.ads (Known_Casing): New subtype declaration + * prj-attr.ads (All_Case_Insensitive_Associative_Array): New subtype + declaration + * prj-dect.adb (Parse_Attribute_Declaration): Avoid enumeration range + * prj-nmsc.adb (Check_Naming): Avoid unnecessary enumeration range + * prj-strt.adb (Attribute_Reference): Avoid enumeration range test + * prj.adb (Known_Casing): Moved to Casing spec (avoid enum range) + * sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Avoid enumeration + ranges. + * sem_res.adb (Resolve_Range): Check for enumeration subrange style + rule. + * sem_type.adb (Is_Array_Class_Record_Type): New. + * style.ads (Check_Enumeration_Subrange): New procedure + * styleg.adb (Check_Enumeration_Subrange): New procedure + * styleg.ads (Check_Enumeration_Subrange): New procedure + * stylesw.adb Add handling for Style_Check_Enumeration_Subranges + * stylesw.ads (Style_Check_Enumeration_Subranges): New flag + * usage.adb: Add line for -gnatyE + * vms_data.ads: Add entries for [NO]ENUMERATION_RANGES + Add missing entry for NOBOOLEAN_OPERATORS + * gnat_ugn.texi: Add documentation for -gnatyE + + 2010-09-09 Robert Dewar + + * namet.adb (Initialize): Is now a dummy procedure + (Reinitialize): New procedure + Call Reinitialize from package initialization + * namet.ads (Initialize): Is now a dummy procedure + (Reinitialize): New procedure + * clean.adb, gnat1drv.adb, gnatbind.adb, gnatcmd.adb, gnatlink.adb, + gnatls.adb, gprep.adb, make.adb, prj-makr.adb: Remove obsolete call to + Namet.Initialize. + + 2010-09-09 Bob Duff + + * sem_elab.adb, s-os_lib.ads: Minor comment fixes. + + 2010-09-09 Robert Dewar + + * s-bitops.adb (Raise_Error): Add exception message + + 2010-09-09 Robert Dewar + + * par-ch5.adb (Test_Statement_Required): Deal with Ada 2012 allowing no + null statement after label. + * sinfo.ads: Minor comment updates. + + 2010-09-09 Robert Dewar + + * nlists.ads, nlists.adb (In_Same_List): New function. + Use Node_Or_Entity_Id where appropriate. + * par-labl.adb, sem_ch6.adb, sem_type.adb: Use In_Same_List. + + 2010-09-09 Robert Dewar + + * restrict.ads, restrict.adb (Check_Wide_Character_Restriction): New + procedure. + * sem_ch3.adb: Use Check_Wide_Character_Restriction + (Enumeration_Type_Declaration): Check violation of No_Wide_Characters + * sem_ch8.adb (Find_Direct_Name): Check violation of No_Wide_Characters + (Find_Expanded_Name): Check violation of No_Wide_Characters + + 2010-09-09 Robert Dewar + + * par-ch5.adb: Minor reformatting. + + 2010-09-09 Robert Dewar + + * prj-env.adb: Minor code reorganization. + * par-ch3.adb: Minor reformatting. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-09-09 Ed Schonberg + + * exp_ch9.adb (Build_Activation_Chain_Entity): The construct enclosing + a task declaration can be an entry body. + + 2010-09-09 Javier Miranda + + * exp_disp.adb (Make_DT): Decorate as "static" variables containing + tags of library level tagged types. + (Make_Tags): Disable backend optimizations about aliasing for + declarations of access to dispatch tables. + + 2010-09-09 Ed Schonberg + + * sem_ch12.adb (Reset_Entity): If the entity is an itype created as a + subtype for a null-excluding access type, recover the original + subtype_mark to get the proper visibility on the original name. + + 2010-09-09 Ed Schonberg + + * exp_ch3.adb (Build_Untagged_Equality): For Ada2012, new procedure to + create the primitive equality operation for an untagged record. The + operation is the predefined equality if no record component has a + user-defined equality, or if there is a user-defined equality for the + type as a whole, or when the type is derived and it has an inherited + equality. Otherwise the body of the operations is built as for tagged + types. + (Expand_Freeze_Record_Type): Call Build_Untagged_Equality when needed. + (Make_Eq_Body): New function to create the expanded body of the + equality operation for tagged and untagged records. In both cases the + operation composes, and the primitive operation of each record + component is used to generate the equality function for the type. + * exp_ch4.adb (Expand_Composite_Equality): In Ada2012, if a component + has an abstract equality defined, replace its call with a + Raise_Program_Error. + * sem_ch6.adb (New_Overloaded_Entity): if Ada2012, verify that a + user-defined equality operator for an untagged record type does not + happen after type is frozen, and appears in the visible part if partial + view of type is not limited. + + 2010-09-09 Tristan Gingold + + * gnatlbr.adb: Make Create_Directory more portable: use __gnat_mkdir. + + 2010-09-09 Bob Duff + + * gnat_ugn.texi: Remove incorrect statement about -E being the default. + + 2010-09-09 Pascal Obry + + * gnat_ugn.texi: Update doc on windows related topics. + + 2010-09-09 Geert Bosch + + * s-fatgen.adb: Update comments. + + 2010-09-09 Robert Dewar + + * par-ch4.adb (Box_Error): New procedure. + + 2010-09-09 Thomas Quinot + + * sem.adb: Minor reformatting. + + 2010-09-09 Pascal Obry + + * prj-env.adb: Style fix, use /and then/ and /or else/. + * gnat_ugn.texi: Fix typos. + + 2010-09-03 Joseph Myers + + PR ada/45499 + * gcc-interface/misc.c (gnat_init_options): Allow options with + empty canonical form. Generate a single save_argv element from -I + options. + + 2010-08-30 Eric Botcazou + + * gcc-interface/utils.c (gnat_pushdecl): Remove test for PARM_DECLs. + Attach fake PARM_DECLs to the topmost block of the function. + + 2010-08-30 Eric Botcazou + + * gcc-interface/trans.c (call_to_gnu): Also force the return slot opt + for the call to a function whose return type was unconstrained. + + 2010-08-30 Olivier Hainque + + * gcc-interface/decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro, + replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN. + (gnat_to_gnu_entity) : Use it. + + 2010-08-21 Eric Botcazou + + * tracebak.c: Fix typo in comment. + + 2010-08-20 Nathan Froyd + + * gcc-interface/decl.c: Use FOR_EACH_VEC_ELT. + * gcc-interface/trans.c: Likewise. + * gcc-interface/utils.c: Likewise. + + 2010-08-18 Eric Botcazou + + * tracebak.c (i386): Use GCC unwinder on Linux with GCC > 4.5. + + 2010-08-10 Robert Dewar + + * sem_ch8.adb, sem_ch8.ads: Change name Write_Scopes to ws. + * sem_util.adb: Minor reformatting. + + 2010-08-10 Javier Miranda + + * sem_aggr.adb (Resolve_Extension_Aggregate): Warn on the use of C++ + constructors that leave the object partially initialized. + * exp_atag.ads, exp_atags.adb (Build_Inherit_CPP_Prims): New subprogram + that copies from parent of Typ the dispatch table slots of inherited + C++ primitives. It handles primary and secondary dispatch tables. + * einfo.adb (Related_Type): Moved from Node26 to Node27. Required to + use this attribute with E_Variable entities. + (Set_Is_Tag): Relax assertion to allow its use with variables that + store tags. + (Set_Related_Type): Relax assertion to allow its use with variables + that store the tag of a C++ class. + (Write_26_Field_Name): Remove Related_Type. + (Write_27_Field_Name): Add Related_Type. + * einfo.ads (Related_Type): Moved from Node26 to Node27. Available also + with E_Variable entities. + * sem_prag.adb (CPP_Constructor): Warn on duplicated occurrence of this + pragma. + * sem_util.adb (Search_Tag): Add missing support for CPP types. + (Enclosing_CPP_Parent): New subprogram. + (Has_Suffix): New subprogram. + * sem_util.ads (Enclosing_CPP_Parent): New subprogram that returns the + closest ancestor of a type that is a C++ type. + (Has_Suffix): New subprogram. Used in assertions to check the suffix of + internal entities. + * sem_attr.adb (Analyze_Access_Attribute): Check wrong use of current + instance in derivations of C++ types. + * exp_tss.adb (CPP_Init_Proc): New subprogram. + (Is_CPP_Init_Proc): New subprogram. + (Set_TSS): Handle new C++ init routines. + * exp_tss.ads (TSS_CPP_Init): New TSS name. For initialization of C++ + dispatch tables. + (CPP_Init_Proc): New subprogram. + (Is_CPP_Init_Proc): New subprogram. + * exp_disp.adb (CPP_Num_Prims): New subprogram. + (Has_CPP_Constructors): New subprogram. + (Make_Secondary_DT, Make_DT): For derivations of CPP types, do not + initialize slots located in the C++ part of the dispatch table. + (Make_Tags): For CPP types declare variables used by the IP routine to + store the C++ tag values after the first invocation of the C++ + constructor. + (Build_CPP_Init_DT): New subprogram. + (Set_CPP_Constructors): New implementation that builds an IP for each + CPP constructor. These IP are wrappers of the C++ constructors that, + after the first invocation of the constructor, read the C++ tags from + the object and save them locally. These copies of the C++ tags are used + by the IC routines to initialize tables of Ada derivations of CPP + types. + (Write_DT): Indicate what primitives are imported from C++ + * exp_disp.ads (CPP_Num_Prims): New subprogram. + (Has_CPP_Constructors): New subprogram. + * exp_aggr.adb (Build_Record_Aggr_Code): For derivations of C++ types + invoke the IC routine to inherit the slots of the parents. + * sem_ch13.adb (Analyze_Freeze_Entity): Add new warnings on CPP types. + * exp_ch3.adb (Is_Variable_Size_Array): New subprogram. + (Is_Variable_Size_Record): Factorize code calling + Is_Variable_Size_Array. + (Build_CPP_Init_Procedure): New subprogram that builds the tree + corresponding to the procedure that initializes the C++ part of the + dispatch table of an Ada tagged type that is a derivation of a CPP + type. + (Build_Init_Procedure): Adding documentation plus code reorganization + to leave more clear the construction of the IP with C++ types. + (Expand_Freeze_Record_Type): Delay call to Set_CPP_Constructors because + it cannot be called after Make_Tags has been invoked. + (Inherit_CPP_Tag): Removed. + (Init_Secondary_Tags): For derivations of CPP types, warn on tags + located at variable offset. + * freeze.ads: Minor reformating. + * sem_ch8.adb (Write_Scopes): Add pragma export. Required to have it + available in gdb. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-08-10 Robert Dewar + + * a-chahan.ads: Add comments on handling of obsolescent entries. + * opt.ads: Add Ada_2005 and Ada_2012 renamings for versions. + * restrict.adb (Check_Obsolescent_2005_Entity): New procedure. + * restrict.ads (Check_Obsolescent_2005_Entity): New procedure. + * sem_attr.adb (Analyze_Access_Attribute): Call + Check_Obsolescent_2005_Entity to check for access to obsolescent + Ada.Characters.Handling subprogram. + (Analyze_Attribute, case Class): Applying Class to untagged incomplete + type is obsolescent in Ada 2005. + (Analyze_Attribute, case Constrained): Better placement of flag when + flagged as obsolescent feature. + (Analyze_Attribute, case Storage_Size): Use with tasks is obsolescent + * sem_ch10.adb (Analyze_With_Clause): With of renamings such as Text_IO + is an obsolescent feature. + * sem_ch11.adb (Analyze_Raise_Statement): Numeric_Error is obsolescent + feature. + * sem_ch8.adb (Analyze_Subprogram_Renaming): Call + Check_Obsolescent_2005_Entity to check for renaming obsolete + Ada.Characters.Handling subprogram. + * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Check + for obsolescent restrictions in Ada 2005. + (Analyze_Pragma, case Suppress): Entity arg is obsolescent in Ada 2005 + (Analyze_Pragma, case Interface): Interface is obsolescent in Ada 2005 + * sem_res.adb (Resolve_Call): Call Check_Obsolescent_2005_Entity to + check for obsolescent references to Ada.Characters.Handling subprograms + + 2010-08-10 Robert Dewar + + * einfo.adb, einfo.ads: Fix bad -gnatdt output for incomplete type. + + 2010-08-10 Robert Dewar + + * errout.ads: Add VMS table entries for 2005, 12, 2012 switches + * par-ch4.adb: Change wording of Ada 2012 messages + * vms_data.ads: Add VMS entries for /2005, /12, /2012 + + 2010-08-10 Robert Dewar + + * a-suenco.adb (Convert): Fix bug in UTF-16 to UTF-8 conversion for + codes in the range 16#80#..16#7FF#. + * sem_ch10.adb: Minor reformatting. + + 2010-08-10 Arnaud Charlet + + * gnat1drv.adb (Scan_Front_End_Switches): Always perform semantics and + generate ali files in CodePeer mode, so that a gnatmake -c -k will + proceed further when possible + * freeze.adb (Freeze_Static_Object): Fix thinko. Do not generate error + messages when ignoring representation clauses (-gnatI). + + 2010-08-10 Ed Schonberg + + * exp_ch4.adb (Expand_N_Selected_Component): Do not attempt to + constant-fold discriminant reference if the constraint is an object + with non-static expression. Expression may contain volatile references + in the presence of renamings. + + 2010-08-10 Vincent Celier + + * prj-proc.adb (Get_Attribute_Index): If Index is All_Other_Names, + returns Index. + * prj-strt.adb (Attribute_Reference): Recognize 'others' as a valid + index for an associative array where it is allowed. + + 2010-08-10 Thomas Quinot + + * exp_attr.adb: Add comments. + + 2010-08-10 Jerome Lambourg + + * adaint.c (__gnat_get_file_names_case_sensitive): return 0 on darwin. + + 2010-08-09 Nathan Froyd + + * gcc-interface/utils.c (gnat_poplevel): Use blocks_nreverse. + + 2010-08-09 Eric Botcazou + + * gcc-interface/utils.c (build_vms_descriptor32): Fix formatting. + (build_vms_descriptor): Likewise. + + 2010-08-08 Nathan Froyd + + * gcc-interface/utils.c (make_descriptor_field): Add tree parameter. + (build_vms_descriptor32): Adjust calls to it for new parameter. + (build_vms_descriptor): Likewise. + + 2010-08-08 Nathan Froyd + + * gcc-interface/decl.c (rec_variant): Declare. Declare a VEC of it. + (build_variant_list): Take and return a VEC instead of a tree. + (create_variant_part_from): Take a VEC instead of a tree for + variant_list. Adjust accordingly. + (gnat_to_gnu_entity): Adjust for changes to previous functions. + + 2010-08-07 Nathan Froyd + + * gcc-interface/decl.c (gnat_to_gnu_entity): Use XALLOCAVEC instead + of alloca. + (components_to_record): Likewise. + * gcc-interface/trans.c (gnat_to_gnu): Likewise. + * gcc-interface/utils.c (max_size): Likewise. + (build_vms_descriptor32): Likewise. + (build_vms_descriptor): Likewise. + + 2010-08-07 Nathan Froyd + + * gcc-interface/decl.c (subst_pair): Declare. Declare a VEC of it. + (build_subst_list): Return a VEC instead of a tree. + (build_variant_list): Take a VEC for subst_list. Adjust + accordingly. + (create_field_decl_from): Likewise. + (create_variant_part_from): Likewise. + (copy_and_substitute_in_size): Likewise. + (gnat_to_gnu_entity): Adjust for new interface to build_subst_list. + Free the built vector. + + 2010-08-06 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Do not build an + allocator for large imported objects. + + 2010-08-05 Robert Dewar + + * gnat1drv.adb: Minor reformatting. + + 2010-08-05 Ed Schonberg + + * sem.adb (Do_Unit_And_Dependents): If some parent unit is an + instantiation, process its body before the spec of the main unit, + because it may contain subprograms invoked in the spec of main. + * einfo.ads: Add documention of delayed freeze. + + 2010-08-05 Vincent Celier + + * prj-nmsc.adb (Process_Linker): Take into account new values for + attribute Response_File_Format. + * prj.ads (Response_File_Format): New enumeration values GCC_GNU, + GCC_Object_List and GCC_Option_List. + + 2010-08-05 Ed Schonberg + + * exp_ch4.adb (Expand_N_Selected_Component): Do not constant-fold a + selected component that denotes a discriminant if it is the + discriminant of a component of an unconstrained record type. + + 2010-08-05 Ed Schonberg + + * exp_util.adb (Insert_Actions): If the action appears within a + conditional expression that is already analyzed, insert action further + out. + + 2010-08-05 Robert Dewar + + * exp_ch4.adb: Minor reformatting. + + 2010-08-05 Thomas Quinot + + * exp_ch4.adb: Minor reformatting + * gnat1drv.adb: Minor reformatting. + Minor code reorganization (use Nkind_In). + + 2010-08-05 Ed Schonberg + + * exp_util.ads, exp_util.adb (Needs_Constant_Address): New predicate to + determine whether the expression in an address clause for an + initialized object must be constant. Code moved from freeze.adb. + (Remove_Side_Effects): When the temporary is initialized with a + reference, indicate that the temporary is a constant as done in all + other cases. + * freeze.adb (Check_Address_Clause): use Needs_Constant_Address. + * exp_ch13.adb (Expand_N_Attribute_Definition_Clause, case 'Address): + If object does not need a constant address, remove side effects from + address expression, so it is elaborated at the point of the address + clause and not at the freeze point of the object, so that elaboration + order is respected. + + 2010-08-05 Vincent Celier + + * prj.adb (Is_Compilable): Return False for header files of non Ada + languages. + + 2010-08-05 Emmanuel Briot + + * prj-nmsc.adb: The Missing_Source_Files flag also considers a missing + exec directory as a warning rather than an error. + + 2010-08-05 Thomas Quinot + + * sem_ch6.adb, gnat1drv.adb, exp_ch6.adb, sem_eval.adb: Minor + reformatting. + + 2010-08-05 Steve Baird + + * exp_util.adb (Remove_Side_Effects): An access value which designates + a volatile object of a nonvolatile type is prohibited. + Do not call Make_Reference to construct a reference to such an object. + + 2010-08-05 Robert Dewar + + * a-suezse.adb, a-suezse.ads, a-suezen.adb, a-suezen.ads: Removed. + * a-suewse.adb, a-suewse.ads, a-suesen.adb, a-suesen.ads, + a-suewen.adb, a-suewen.ads: New files. + * Makefile.rtl, impunit.adb: Update implementation of Ada 2012 string + encoding packages. + * sem_elab.adb: Minor reformatting. + + 2010-08-05 Arnaud Charlet + + * sem_ch8.adb (Use_One_Type): Protect against empty scopes. + * exp_util.adb (Component_May_Be_Bit_Aligned): Prevent assert failure + in case of null Comp. + + 2010-08-05 Robert Dewar + + * errout.adb, a-suewen.adb, a-suezen.adb: Minor reformatting. + + 2010-08-05 Gary Dismukes + + * sem_ch4.adb (Analyze_Allocator): Flag errors on allocators of a + nested access type whose designated type has tasks or is a protected + object when the restrictions No_Task_Hierarchy or + No_Local_Protected_Objects apply. Add ??? comment. + * sem_ch9.adb (Analyze_Protected_Type): Give a warning when a protected + type is not a library-level type and No_Local_Protected_Objects applies. + (Analyze_Task_Type): Give a warning when a task type is not a + library-level type and No_Task_Hierarchy applies. + + 2010-08-05 Arnaud Charlet + + * sem.adb: Minor reformatting + * sem_ch4.adb (Analyze_Reference): Disable error message in CodePeer + mode, not useful. + + 2010-08-04 Eric Botcazou + + * gcc-interface/decl.c: Do not undefine IN_GCC_FRONTEND and do not + include expr.h. + (gnat_to_gnu_entity) : Force address of -1 at the tree level + for the debug-only entity. + * gcc-interface/Make-lang.in (ada/decl.o): Adjust dependencies. + + 2010-08-03 Joseph Myers + + * gcc-interface/lang-specs.h: Don't pass -a options. + + 2010-07-28 Joseph Myers + + * gcc-interface/misc.c (gnat_init_options): Ignore erroneous + options. Check canonical_option_num_elements on options copied. + + 2010-07-27 Joseph Myers + + * gcc-interface/misc.c (gnat_handle_option): Update prototype and + return value type. Don't check for missing arguments here. + + 2010-07-27 Joseph Myers + + * gcc-interface/misc.c (gnat_option_lang_mask): New. + (gnat_init_options): Update prototype. Reconstruct argv array + from decoded options. + + 2010-07-23 Eric Botcazou + + * gcc-interface/utils.c (update_pointer_to): In the unconstrained array + case, merge the alias set of the old pointer type. + + 2010-07-23 Eric Botcazou + + * gcc-interface/utils.c (gnat_types_compatible_p): Revert latest change + and recurse only for multidimensional array types instead. + + 2010-07-22 Eric Botcazou + + PR ada/44892 + * gcc-interface/utils.c (convert): Fix thinko in test. + (unchecked_convert): When converting from a scalar type to a type with + a different size, pad to have the same size on both sides. + + 2010-07-22 Eric Botcazou + + * gcc-interface/utils.c (gnat_types_compatible_p): Don't require strict + equality for the component type of array types. + + 2010-07-15 Nathan Froyd + + * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. + * gcc-interface/trans.c: Likewise. + * gcc-interface/utils.c: Likewise. + * gcc-interface/utils2.c: Likewise. + + 2010-07-13 Laurent GUERBY + + PR bootstrap/44458 + * gcc-interface/targtyps.c: Include tm_p.h. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-07-09 Eric Botcazou + + * gcc-interface/trans.c (gnat_gimplify_expr) : Deal with + CALL_EXPR. + + 2010-07-08 Manuel López-Ibáñez + + * gcc-interface/utils.c: Include diagnostic-core.h in every file + that includes toplev.h. + + 2010-07-03 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : + Branch to common code handling the alignment of discrete types. + : Likewise. + : Likewise. + + 2010-07-02 Eric Botcazou + + * gcc-interface/misc.c (gnat_handle_option): Do not populate gnat_argv. + (gnat_handle_option): Allocate only one element for gnat_argv. + (gnat_init): Do not populate gnat_argv. + + 2010-06-30 Manuel López-Ibáñez + + * gcc-interface/trans.c: Do not include tree-flow.h. + * gcc-interface/Make-lang.in: Adjust dependencies. + + 2010-06-29 Nathan Froyd + + * gcc-interface/gigi.h (gnat_build_constructor): Take a VEC instead + of a TREE_LIST. Update comment. + * gcc-interface/trans.c (gigi): Build a VEC instead of a TREE_LIST. + Adjust call to gnat_build_constructor. + (Attribute_to_gnu): Likewise. + (gnat_to_gnu): Likewise. + (pos_to_constructor): Likewise. + (extract_values): Likewise. + * gcc-interface/utils.c (build_template): Likewise. + (convert_vms_descriptor64): Likewise. + (convert_vms_descriptor32): Likewise. + (convert_to_fat_pointer): Likewise. + (convert): Likewise. + (unchecked_convert): Likewise. + * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. + * gcc-interface/utils2.c (build_allocator): Likewise. + (fill_vms_descriptor): Likewise. + (gnat_build_constructor): Take a VEC instead of a TREE_LIST. + (compare_elmt_bitpos): Adjust for parameters being constructor_elts + instead of TREE_LISTs. + + 2010-06-28 Steven Bosscher + + * gcc-interface/misc.c: Do not include except.h. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-27 Eric Botcazou + + * gcc-interface/trans.c: Include tree-flow.h. + (gnu_switch_label_stack): Delete. + (Case_Statement_to_gnu): Do not emit the goto at the end of a case if + its associated block cannot fall through. Do not emit the final label + if no cases branch to it. + * gcc-interface/Make-lang.in (ada/trans.o): Add $(TREE_FLOW_H). + + 2010-06-23 Thomas Quinot + + * exp_attr.adb (Expand_Access_To_Protected_Op): When rewriting a + reference to a protected subprogram outside of the protected's scope, + ensure the corresponding external subprogram is frozen before the + reference. + + 2010-06-23 Ed Schonberg + + * sem_prag.adb: Fix typo in error message. + * sem.adb: Refine previous change. + + 2010-06-23 Robert Dewar + + * impunit.adb, a-suewen.adb, a-suewen.ads, a-suenco.adb, a-suenco.ads, + a-suezen.adb, a-suezen.ads, a-stuten.adb, a-stuten.ads, Makefile.rtl: + Implement Ada 2012 string encoding packages. + + 2010-06-23 Arnaud Charlet + + * a-stwiun-shared.adb, a-stwiun-shared.ads, a-stzunb-shared.adb, + a-stzunb-shared.ads, a-swunau-shared.adb, a-swuwti-shared.adb, + a-szunau-shared.adb, a-szuzti-shared.adb, a-strunb-shared.adb, + a-strunb-shared.ads, a-stunau-shared.adb, a-suteio-shared.adb: New + files. + * gcc-interface/Makefile.in: Enable use of above files. + + 2010-06-23 Ed Schonberg + + * sem_ch13.adb (Check_Constant_Address_Clauses): Do not check legality + of address clauses if if Ignore_Rep_Clauses is active. + * freeze.adb (Check_Address_Clause): If Ignore_Rep_Clauses is active, + remove address clause from tree so that it does not reach the backend. + + 2010-06-23 Arnaud Charlet + + * exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Valid]): Do not + expand 'Valid from user code in CodePeer mode, will be handled by the + back-end directly. + + 2010-06-23 Bob Duff + + * g-comlin.ads: Minor comment improvements. + + 2010-06-23 Ed Schonberg + + * sem_res.adb (Uses_SS): The expression that initializes a controlled + component of a record type may be a user-defined operator that is + rewritten as a function call. + + 2010-06-23 Bob Duff + + * g-comlin.ads, sem_ch13.adb: Minor comment fix. + + 2010-06-23 Eric Botcazou + + * exp_ch11.adb (Expand_Local_Exception_Handlers): Propagate the end + label to the new sequence of statements. Set the sloc of the raise + statement onto the new goto statements. + + 2010-06-23 Robert Dewar + + * a-stuten.ads, a-stuten.adb: New files. + * impunit.adb: Add engtry for Ada.Strings.UTF_Encoding (a-stuten.ads) + * Makefile.rtl: Add entry for a-stuten (Ada.Strings.UTF_Encoding) + + 2010-06-23 Robert Dewar + + * gnat_ugn.texi: Add documentation of -gnat12 switch + Add documentation of -gnatX switch. + + 2010-06-23 Ed Schonberg + + * inline.ads: Include the current Ada_Version in the info for pending + instance bodies, so that declaration and body are compiled with the + same Ada_Version. + * inline.adb: Move with_clause for Opt to spec. + * sem_ch12.adb (Analyze_Package_Instantiation, + Analyze_Subprogram_Instantiation): Save current Ada_Version in + Pending_Instantiation information. + (Instantiate_Package_Body, Instantiate_Subprogram_Body, + Inline_Package_Body): Use the Ada_Version present in the body + information. + + 2010-06-23 Robert Dewar + + * usage.adb: Add documentation for -gnat12 switch. + * errout.ads: Add VMS alias entry for -gnat12 switch + * gnat_rm.texi: Add documentation for pragma Ada_12 and Ada_2012 + Add documentation for pragma Extensions_Allowed. + * opt.ads: Add entry for Ada 2012 mode. + * sem_ch4.adb, par-ch3.adb, par-ch4.adb: Use new Ada 2012 mode for 2012 + features. + * sem_prag.adb, par-prag.adb: Add processing for pragma Ada_12 and + Ada_2012. + * sem_ch13.adb: Add handling for Ada 2012 mode. + * snames.ads-tmpl: Add entries for pragma Ada_2012 and Ada_12. + * switch-c.adb: Add handling for -gnat12 switch. + Implement -gnat2005 and -gnat2012. + * usage.adb: Add documentation for -gnat12 switch. + * vms_data.ads: Add /12 switch for Ada 2012 mode. + + 2010-06-23 Arnaud Charlet + + * exp_ch4.adb (Expand_N_Allocator): Fix potential crash when using + No_Task_Hierarchy restriction. Add comment. + * exp_ch9.adb, exp_ch3.adb: Update comments. + + 2010-06-23 Robert Dewar + + * sem_ch5.adb (Process_Bounds): Remove some junk initializations. + * sem_res.adb: Add comments. + * sem_util.adb: Minor reformatting. Add comments. + Change increment on Actuals_In_Call table. + * opt.ads: Minor: add 'constant'. + + 2010-06-23 Javier Miranda + + * exp_disp.adb (Make_DT): Initialize the Size_Func component of the + TSD to Null_Address if No_Dispatching_Calls is active. + + 2010-06-23 Vincent Celier + + * a-comlin.ads: Indicate that use of this package is not supported + during the elaboration of an auto-initialized Stand-Alone Library. + + 2010-06-23 Ed Schonberg + + * exp_util.adb (Is_Possibly_Misaligned_Object): Do not rely on an + alignment clause on a record type to determine if a component may be + misaligned. The decision must be taken in the back-end where target + alignment information is known. + + 2010-06-23 Arnaud Charlet + + * gnat1drv.adb (Adjust_Global_Switches): Enable some restrictions + systematically in CodePeer mode to simplify generated code. + * restrict.adb (Check_Restriction): Do nothing in CodePeer mode. + * exp_ch4.adb (Expand_N_Allocator): Generate proper code when + No_Task_Hierarchy is set instead of crasshing. + + 2010-06-23 Thomas Quinot + + * sem_util.adb: Minor code cleanup: test for proper entity instead of + testing just Chars attribute when checking whether a given scope is + System. + * exp_ch4.adb, einfo.adb: Minor reformatting. + + 2010-06-23 Vincent Celier + + PR ada/44633 + * switch-m.adb (Normalize_Compiler_Switches): Take into account + switches -gnatB, -gnatD=nn, -gnatG (incuding -gnatG=nn), -gnatI, + -gnatl=file, -gnatS, -gnatjnn, -gnateI=nn and -gnatWx. + + 2010-06-23 Ed Schonberg + + * sem_res.adb (Resolve_Membership_Op): If left operand is a mixed mode + operation with a universal real operand, and the right operand is a + range with universal bounds, find unique fixed point that may be + candidate, and warn appropriately. + + 2010-06-23 Ed Schonberg + + * sem_res.adb (Resolve_Intrinsic_Operator): Add guards to handle + properly the rare cases where VMS operators are visible through + Extend_System, but the default System is being used and Address is a + private type. + * sem_util.adb: Widen predicate Is_VMS_Operator. + + 2010-06-23 Vincent Celier + + * switch-m.adb (Normalize_Compiler_Switches): Take into account -gnatC + and -gnateS. + + 2010-06-23 Olivier Hainque + + * einfo.adb (Has_Foreign_Convention): Consider Intrinsic with + Interface_Name as foreign. These are GCC builtin imports for + which Ada specific processing doesn't apply. + + 2010-06-23 Thomas Quinot + + * sem_ch12.adb: Minor reformatting. + + 2010-06-23 Ed Schonberg + + * sem_util.adb (Is_VMS_Operator): Use scope of system extension to + determine whether an intrinsic subprogram is VMS specific. + + 2010-06-23 Hristian Kirtchev + + * treepr.adb (Print_Entity_Info): Output the contents of Field28 if it + is present in the entity. + + 2010-06-23 Arnaud Charlet + + * xr_tabls.adb, xref_lib.adb: Update to latest lib-xref.ads + Fix handling of parameters. + Add protection against unexpected cases. + * sem_ch6.adb (Create_Extra_Formals): Use suffix "L" instead of "A" for + access level, since "A" suffix is already used elsewhere. Similarly, + use suffix "O" instead of "C" for 'Constrained since "C" suffix is used + for xxx'Class. + + 2010-06-23 Thomas Quinot + + * sem_util.adb, sem_util.ads: Minor reformatting. + + 2010-06-23 Vincent Celier + + * prj.ads (Gprclean_Flags.Missing_Source_Files): Set to Error to keep + the previous behavior of gprclean when there are missing files. + + 2010-06-23 Ed Schonberg + + * sem_ch12.adb (Load_Body_Of_Generic): In CodePeer mode, a missing + generic body is not a fatal error. + (Mark_Context): Handle properly names of child units. + * sem.adb (Walk_Library_Items.Do_Action): Remove assertion on + instantiations. + + 2010-06-23 Vincent Celier + + * ali.adb (Scan_ALI): When ignoring R lines, do not skip the next + non-empty line. + + 2010-06-23 Bob Duff + + * g-pehage.ads, g-pehage.adb: Switch default optimization mode to + Memory_Space, because CPU_Time doesn't seem to provide any significant + speed advantage in practice. Cleanup: Get rid of constant + Default_Optimization; doesn't seem to add anything. Use case + statements instead of if statements; seems cleaner. + + 2010-06-23 Olivier Hainque + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Use + Wshadow instead of Wextra to guard warning on absence of internal + builtin decl for an import. Fix use of quote in warning text. + (intrin_arglists_compatible_p): Remove processing of integer trailing + args on the Ada side. Fix use of literal > in warning text. + (intrin_return_compatible_p): Never warn on "function imported as + procedure". Defer the void/void case to the common type compatibility + check. + (gnat_to_gnu_param): Use void_ptr GCC type for System.Address argument + of GCC builtin imports. + + 2010-06-23 Olivier Hainque + + * gcc-interface/decl.c (intrin_types_incompatible_p): New function, + helper for ... + (intrin_arglists_compatible_p, intrin_return_compatible_p): New + functions, helpers for ... + (intrin_profiles_compatible_p): New function, replacement for ... + (compatible_signatures_p): Removed. + (gnat_to_gnu_entity) : If -Wextra, warn on + attempt to bind an unregistered builtin function. When we have + one, use it and warn on profile incompatibilities. + + 2010-06-23 Arnaud Charlet + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-23 Ed Schonberg + + * sem_util.adb (Mark_Coextensions): If the expression in the allocator + for a coextension in an object declaration is a concatenation, treat + coextension as dynamic. + + 2010-06-23 Javier Miranda + + * sem_ch3.adb (Add_Internal_Interface_Entities): Ensure that the + internal entities are added to the scope of the tagged type. + (Derive_Subprograms): Do not stop derivation when we find the first + internal entity that has attribute Interface_Alias. After the change + done to Override_Dispatching_Operations it is no longer true that + these primirives are always located at the end of the list of + primitives. + * einfo.ads (Primitive_Operations): Add documentation. + * exp_disp.adb (Write_DT): Improve output adding to the name of the + primitive a prefix indicating its corresponding tagged type. + * sem_disp.adb (Override_Dispatching_Operations): If the overridden + entity covers the primitive of an interface that is not an ancestor of + this tagged type then the new primitive is added at the end of the list + of primitives. Required to fulfill the C++ ABI. + + 2010-06-23 Javier Miranda + + * atree.ads (Set_Reporting_Proc): New subprogram. + * atree.adb: Remove dependency on packages Opt and SCIL_LL. + (Allocate_Initialize_Node, Replace, Rewrite): Replace direct calls + to routines of package Scil_ll by indirect call to the registered + subprogram. + (Set_Reporting_Proc): New subprogram. Used to register a subprogram + that is invoked when a node is allocated, replaced or rewritten. + * scil_ll.adb (Copy_SCIL_Node): New routine that takes care of copying + the SCIL node. Used as argument for Set_Reporting_Proc. + (Initialize): Register Copy_SCIL_Node as the reporting routine that + is invoked by atree. + + 2010-06-23 Thomas Quinot + + * sem_ch3.ads: Minor reformatting. + + 2010-06-23 Ed Schonberg + + * sem_ch12.adb (Analyze_Package_Instantiation): In CodePeer mode, + always analyze the generic body and instance, because it may be needed + downstream. + (Mark_Context): Prepend the with clauses for needed generic units, so + they appear in a better order for CodePeer. + * sem_util.adb, sem_util.ads: Prototype code for AI05-0144. + + 2010-06-23 Emmanuel Briot + + * prj.ads, prj-nmsc.adb (Error_Or_Warning): New subprogram. + + 2010-06-23 Robert Dewar + + * g-pehage.adb, exp_ch13.adb: Minor reformatting. + + 2010-06-23 Thomas Quinot + + * a-tags.ads: Fix description of TSD structure. + + 2010-06-23 Ed Schonberg + + * sem_ch12.adb (Mark_Context): When indicating that the body of a + generic unit is needed prior to the unit containing an instantiation, + search recursively the context of the generic to add other generic + bodies that may be instantiated indirectly through the current instance. + + 2010-06-23 Robert Dewar + + * freeze.adb: Minor reformatting. + + 2010-06-23 Bob Duff + + * g-pehage.adb (Trim_Trailing_Nuls): Fix the code to match the comment. + + 2010-06-23 Vincent Celier + + * make.adb (Compile_Sources): Complete previous change. + + 2010-06-23 Ed Schonberg + + * sem_ch6.adb (Add_Extra_Formal): Use suffix "C" in the name of the + Constrained extra formal. + + 2010-06-23 Ed Schonberg + + * exp_ch13.adb (Expand_Freeze_Actions): If validity checks and + Initialize_Scalars are enabled, compile the generated equality function + for a composite type with full checks enabled, so that validity checks + are performed on individual components. + + 2010-06-23 Emmanuel Briot + + * prj.adb, prj.ads, prj-nmsc.adb (Processing_Flags): New flag + Missing_Source_Files. + + 2010-06-23 Robert Dewar + + * exp_ch3.adb, exp_util.adb: Minor reformatting. + + 2010-06-23 Jose Ruiz + + * a-reatim.adb, a-retide.adb: Move the initialization of the tasking + run time from Ada.Real_Time.Delays to Ada.Real_Time. This way, calls to + Clock (without delays) use a run time which is properly initialized. + + 2010-06-23 Vincent Celier + + * make.adb: Do not set Check_Readonly_Files when setting Must_Compile, + when -f -u and a main is specified on the command line. However, + attempt to compile even when the ALI file is read-only when + Must_Compile is True. + + 2010-06-23 Thomas Quinot + + * checks.adb, g-pehage.adb, cstand.adb: Minor code factorization. + + 2010-06-23 Javier Miranda + + * sem_ch3.adb (Add_Internal_Interface_Entities): Generate internal + entities for parent types that are interfaces. Needed in generics to + handle formals that implement interfaces. + (Derive_Subprograms): Add assertion for derivation of tagged types that + do not cover interfaces. For generics, complete code that handles + derivation of type that covers interfaces because the previous + condition was weak (it required only name consistency; arguments were + not checked). Add new code to locate primitives covering interfaces + defined in generic units or instantiatons. + * sem_util.adb (Has_Interfaces): Add missing support for derived types. + * sem_ch6.adb (Check_Overriding_Indicator): Minor code cleanups. + * exp_disp.adb (Make_Select_Specific_Data_Table): Skip primitives of + interfaces that are parents of the type because they share the primary + dispatch table. + (Register_Primitive): Do not register primitives of interfaces that + are parents of the type. + * sem_ch13.adb (Analyze_Freeze_Entity): Add documentation. + * exp_cg.adb (Write_Type_Info): When displaying overriding of interface + primitives skip primitives of interfaces that are parents of the type. + + 2010-06-23 Ed Schonberg + + * sem_attr.adb (Eval_Attribute): If the prefix is an array, the + attribute cannot be constant-folded if an index type is a formal type, + or is derived from one. + * checks.adb (Determine_Range): ditto. + + 2010-06-23 Arnaud Charlet + + * gnat_ugn.texi, gnatxref.adb: Add support for --ext switch. + + 2010-06-23 Bob Duff + + * g-pehage.ads, g-pehage.adb (Put): Fix off-by-one bug. + (Insert): Disallow nul characters. + (misc output routines): Assert no nul characters. + + 2010-06-23 Ed Schonberg + + * exp_ch4.adb: Use predefined unsigned type in all cases. + + 2010-06-23 Bob Duff + + * s-rannum.adb (Reset): Avoid overflow in calculation of Initiator. + * g-pehage.ads: Minor comment fixes. + * g-pehage.adb: Minor: Add some additional debugging printouts under + Verbose flag. + + 2010-06-23 Robert Dewar + + * binde.adb (Better_Choice): Always prefer Pure/Preelab. + (Worse_Choice): Always prefer Pure/Preelab. + + 2010-06-23 Vincent Celier + + * a-reatim.adb: Call System.OS_Primitives.Initialize during elaboration + + 2010-06-23 Robert Dewar + + * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Properly handle + checking returns in generic case. + (Check_Missing_Return): New procedure. + + 2010-06-23 Robert Dewar + + * bindgen.adb, switch-b.adb: Minor reformatting. + + 2010-06-23 Javier Miranda + + * frontend.adb (Frontend): Add call to initialize the new package + SCIL_LL. + * exp_ch7.adb (Wrap_Transient_Expression): Remove call to + Adjust_SCIL_Node. + (Wrap_Transient_Statement): Remove call to Adjust_SCIL_Node. + * sem_ch5.adb (Analyze_Iteration_Scheme.Process_Bounds): Remove call to + Adjust_SCIL_Node. + * exp_util.adb (Insert_Actions): Remove code for + N_SCIL_Dispatch_Table_Object_Init and N_SCIL_Tag_Init nodes. + (Remove_Side_Effects): Remove calls to Adjust_SCIL_Node. + * sinfo.adb (SCIL_Entity, SCIL_Tag_Value): Remove checks on + N_SCIL_Tag_Init and N_SCIL_Dispatch_Table_Object_Init in the assertion. + (SCIL_Related_Node, Set_SCIL_Related_Node): Removed. + * sinfo.ads (SCIL_Related_Node): Field removed. + (N_SCIL_Dispatch_Table_Object_Init): Node removed. + (N_SCIL_Tag_Init): Node removed. + * sem_scil.ads, sem_scil.adb (Adjust_SCIL_Node): Removed. + (Check_SCIL_Node): New implementation. + (Find_SCIL_Node): Removed. + * sem.adb (Analyze): Remove management of + N_SCIL_Dispatch_Table_Object_Init and N_SCIL_Tag_Init nodes. + * sem_util.adb (Insert_Explicit_Dereference): Remove call to + Adjust_SCIL_Node. + * exp_ch4.adb (Expand_N_In): Code cleanup: remove call to + Set_SCIL_Related_Node and avoid adding the SCIL node before the + referenced node using Insert_Action because this is not longer + required. + (Expand_Short_Circuit_Operator): Remove call to SCIL node. + * exp_ch6.adb (Expand_Call): Remove call to Adjust_SCIL_Node. + * sem_ch4.adb (Analyze_Type_Conversion): Remove call to + Adjust_SCIL_Node. + * exp_disp.adb (Expand_Dispatching_Call): Minor code reorganization + because we no longer require to generate the SCIL node before the call. + (Make_DT): Remove generation of SCI_Dispatch_Table_Object_Init node. + Remove calls to Set_SCIL_Related_Node and avoid adding the SCIL + nodes before the referenced node using Insert_Action because this + is not longer required. + * atree.adb (Allocate_Initialize_Node, Replace, Rewrite): Add call to + update the SCIL_Node field. + * sprint.adb (Sprint_Node_Actual): Remove code for + N_SCIL_Dispatch_Table_Object_Init and N_SCIL_Tag_Init nodes. + * treepr.adb (Print_Node): Print the SCIL node field (if available). + * exp_ch3.adb (Build_Init_Procedure): Remove generation of + SCIL_Tag_Init nodes. + * scil_ll.ads, scil_ll.adb: New files. + * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update + dependencies. + + 2010-06-23 Robert Dewar + + * sem_ch6.adb: Minor reformatting. + + 2010-06-23 Doug Rupp + + * bindusg.adb (Display): Write -Hnn line. + * bindgen.adb (Gen_Adainit_Ada): Write Heap_Size to binder file as + necessary. + * init.c (__gl_heap_size): Rename from __gl_no_malloc_64 and change + valid values to 32 and 64. + (GNAT$NO_MALLOC_64): Recognize TRUE, 1, FALSE, and 0 in addition to + ENABLE, DISABLE as valid settings. + * switch-b.adb (Scan_Binder_Switches): Process -Hnn switch. + * opt.ads (Heap_Size): New global variable. + * gcc-interface/utils2.c (maybe_wrap_malloc): Remove mostly redundant + TARGET_MALLOC64 check. Fix comment. + + 2010-06-23 Robert Dewar + + * sem_ch6.adb, exp_ch4.adb, s-rannum.ads, sem.adb, sem_ch12.adb: Minor + reformatting. Add comments. + * errout.adb (Finalize): Properly adjust warning count when deleting + continuations. + + 2010-06-22 Robert Dewar + + * errout.adb (Finalize): Set Prev pointers. + (Finalize): Delete continuations for deletion by warnings off(str). + * erroutc.ads: Add Prev pointer to error message structure. + + 2010-06-22 Ed Schonberg + + * sem.adb (Do_Unit_And_Dependents): If the spec of the main unit is a + child unit, examine context of parent units to locate instantiated + generics whose bodies may be needed. + * sem_ch12.adb: (Mark_Context): if the enclosing unit does not have a + with_clause for the instantiated generic, examine the context of its + parents, to set Withed_Body flag, so that it can be visited earlier. + * exp_ch4.adb (Expand_N_Op_Not): If this is a VMS operator applied to + an unsigned type, use a type of the proper size for the intermediate + value, to prevent alignment problems on unchecked conversion. + + 2010-06-22 Geert Bosch + + * s-rannum.ads Change Generator type to be self-referential to allow + Random to update its argument. Use "in" mode for the generator in the + Reset procedures to allow them to be called from the Ada.Numerics + packages without tricks. + * s-rannum.adb: Use the self-referencing argument to get write access + to the internal state of the random generator. + * a-nudira.ads: Make Generator a derived type of + System.Random_Numbers.Generator. + * a-nudira.adb: Remove use of 'Unrestricted_Access. + Put subprograms in alpha order and add headers. + * g-mbdira.ads: Change Generator type to be self-referential. + * g-mbdira.adb: Remove use of 'Unrestricted_Access. + + 2010-06-22 Robert Dewar + + * freeze.adb: Minor reformatting + Minor code reorganization (use Nkind_In and Ekind_In). + + 2010-06-22 Bob Duff + + * gnat1drv.adb (Gnat1drv): Remove the messages that recommend using + -gnatc when a file is compiled that we cannot generate code for, not + helpful and confusing. + + 2010-06-22 Vincent Celier + + * switch-m.adb (Normalize_Compiler_Switches): Process correctly + switches -gnatknn. + + 2010-06-22 Paul Hilfinger + + * s-rannum.adb: Replace constants with commented symbols. + * s-rannum.ads: Explain significance of the initial value of the data + structure. + + 2010-06-22 Ed Schonberg + + * a-ngcoty.adb: Clarify comment. + + 2010-06-22 Gary Dismukes + + * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Return without + expansion for indexing packed arrays with small power-of-2 component + sizes when the target is AAMP. + (Expand_Packed_Element_Reference): Return without expansion for + indexing packed arrays with small power-of-2 component sizes when the + target is AAMP. + + 2010-06-22 Geert Bosch + + * exp_ch4.adb (Expand_N_In): Do not substitute a valid check for X in + Float'Range. + + 2010-06-22 Robert Dewar + + * g-mbdira.adb, g-mbflra.adb, a-nuflra.adb, a-nudira.adb: Minor comment + updates. + + 2010-06-22 Doug Rupp + + * system-vms.ads, system-vms-zcx.ads: Remove old unused VMS system + packages. + * system-vms_64.ads, system-vms-ia64.ads: Minor reformatting. + (pragma Ident): Add a default ident string in the private part. + + 2010-06-22 Robert Dewar + + * cstand.adb: Minor reformatting. + + 2010-06-22 Ed Schonberg + + * freeze.adb (Build_And_Analyze_Renamed_Body): For expansion purposes, + recognize the Shift and Rotation intrinsics that are known to the + compiler but have no interface name. + + 2010-06-22 Geert Bosch + + * a-ngcoty.adb ("*"): Rewrite complex multiplication to use proper + scaling in case of overflow or NaN results. + + 2010-06-22 Robert Dewar + + * cstand.adb: Complete previous change. + * g-dirope.ads: Add comment. + * s-stchop.adb, sfn_scan.adb: Minor reformatting. + + 2010-06-22 Ed Schonberg + + * cstand.adb: Add tree nodes for pragma Pack on string types. + + 2010-06-22 Javier Miranda + + * einfo.ads, einfo.adb (Last_Formal): New synthesized attribute. + * exp_util.adb (Find_Prim_Op): Use new attribute to locate the last + formal of a primitive. + * exp_disp.adb (Is_Predefined_Dispatching_Operation, + Is_Predefined_Dispatching_Alias): Use new attribute to locate the last + formal of a primitive. + * exp_cg.adb (Is_Predefined_Dispatching_Operation): Use new attribute + to obtain the last formal of a primitive. + + 2010-06-22 Geert Bosch + + * sysdep.c, init.c, adaint.c, cstreams.c: Remove conditional code + depending on __EMX__ or MSDOS being defined. + * i-cstrea.ads, gnat_rm.texi: Remove mentions of OS/2, DOS and Xenix. + * a-excpol-abort.adb: Update comment indicating users of the file. + * xref_lib.adb, sfn_scan.adb: Remove mention of OS/2, replace NT by + Windows. + * env.c: Remove empty conditional for MSDOS. + * s-stchop.adb, g-dirope.ads, s-fileio.adb, osint.ads: Remove mention + of OS/2 in comment. + + 2010-06-22 Robert Dewar + + * s-rannum.adb: Minor reformatting. + + 2010-06-22 Javier Miranda + + * sem_aux.adb, sem_aux.ads, sem_util.adb, sem_util.ads, sem_elim.adb, + exp_cg.adb: Minor code reorganization: Move routine Ultimate_Alias from + package Sem_Util to package Sem_Aux. + + 2010-06-22 Javier Miranda + + * exp_disp.adb (Make_Secondary_DT, Make_DT): Minor code cleanup: + remove useless restriction on imported routines when building the + dispatch tables. + + 2010-06-22 Robert Dewar + + * cstand.adb (Create_Standard): Set Has_Pragma_Pack for standard string + types. + + 2010-06-22 Javier Miranda + + * sem_ch4.adb (Collect_Generic_Type_Ops): Protect code that handles + generic subprogram declarations to ensure proper context. Add missing + support for generic actuals. + (Try_Primitive_Operation): Add missing support for concurrent types + that have no Corresponding_Record_Type. Required to diagnose errors + compiling + generics or when compiling with no code generation (-gnatc). + * sem_ch9.adb (Analyze_Protected_Type, Analyze_Task_Type): Do not build + the corresponding record type. + * sem_disp.ads, sem_disp.adb (Check_Dispatching_Operation): Complete + documentation. Do minimum decoration when processing a primitive of a + concurrent tagged type that covers interfaces. Required to diagnose + errors in the Object.Operation notation compiling generics or under + -gnatc. + * exp_ch9.ads, exp_ch9.adb (Build_Corresponding_Record): Add missing + propagation of attribute Interface_List to the corresponding record. + (Expand_N_Task_Type_Declaration): Code cleanup. + (Expand_N_Protected_Type_Declaration): Code cleanup. + + 2010-06-22 Matthew Heaney + + * a-convec.adb, a-coinve.adb: Removed 64-bit types Int and UInt. + + 2010-06-22 Paul Hilfinger + + * s-rannum.adb (Random_Float_Template): Replace with unbiased version + that is able to produce all representable floating-point numbers in the + unit interval. Remove template parameter Shift_Right, no longer used. + * gnat_rm.texi: Document the period of the pseudo-random number + generator under the description of its algorithm. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-22 Thomas Quinot + + * exp_aggr.adb (Rewrite_Discriminant): Fix predicate used to identify + reference to discriminant (can be an expanded name as well as an + identifier). + + 2010-06-22 Ed Schonberg + + * exp_ch6.adb: Clarify comment. + + 2010-06-22 Geert Bosch + + * exp_imgv.adb (Expand_Image_Attribute): Treat ordinary fixed point + with decimal small as decimal types, avoiding FP arithmetic. + (Has_Decimal_Small): New function. + * einfo.ads, einfo.adb (Aft_Value): New synthesized attributed for + fixed point types. + * sem_attr.adb (Eval_Attribute): Remove Aft_Value function and update + callers to call the new function in Einfo that takes the entity as + parameter. + + 2010-06-22 Robert Dewar + + * sem_ch3.adb, sem_ch8.adb: Minor reformatting. + + 2010-06-22 Thomas Quinot + + * sem_elab.adb: Minor reformatting. + + 2010-06-22 Vincent Celier + + * gnatsym.adb: Put the object files in the table in increasing + aphabetical order of base names. + + 2010-06-22 Ed Schonberg + + * sem_ch8.adb (Set_Entity_Or_Discriminal): New procedure used by + Find_Direct_Name and Find_Expanded_Name, to replace a discriminant with + the corresponding discriminal within a record declaration. + + 2010-06-22 Thomas Quinot + + * exp_aggr.adb (Rewrite_Discriminant): Rewriting must occur only for an + expression referring to a discriminal of the type of the aggregate (not + a discriminal of some other unrelated type), and the prefix in the + generated selected component must come from Lhs, not Obj. + + 2010-06-22 Thomas Quinot + + * sem_ch3.adb (Build_Derived_Record_Type): Fix predicate determining + when to freeze the parent type. + + 2010-06-22 Robert Dewar + + * s-rannum.adb, a-nudira.adb, types.ads, freeze.adb, sem_aggr.adb, + exp_aggr.adb: Minor reformatting. + * gnat_rm.texi: Document GNAT.MBBS_Discrete_Random and + GNAT.MBSS_Float_Random. + * g-mbdira.adb, g-mbflra.adb, g-mbdira.ads, g-mbflra.ads: Fix header. + + 2010-06-22 Paul Hilfinger + + * a-nudira.adb, a-nudira.ads, a-nuflra.adb, a-nuflra.ads, + gnat_rm.texi, impunit.adb, Makefile.rtl, s-rannum.adb + (Random_Float_Template, Random): New method of creating + uniform floating-point variables that allow the creation of all machine + values in [0 .. 1). + + * g-mbdira.adb, g-mbflra.adb, g-mbdira.ads, g-mbflra.ads: New file. + + 2010-06-22 Gary Dismukes + + * sem_ch5.adb (Analyze_Assignment): Revise test for illegal assignment + to abstract targets to check that the type is tagged and comes from + source, rather than only testing for targets of interface types. Remove + premature return. + + 2010-06-22 Vincent Celier + + * vms_data.ads: Modify the declarations of qualifiers + /UNCHECKED_SHARED_LIB_IMPORTS to allow the generation of gnat.hlp + without error. + + 2010-06-22 Ed Schonberg + + * exp_ch6.adb (Is_Build_In_Place_Function): Predicate is false if + expansion is disabled. + + 2010-06-22 Robert Dewar + + * makeusg.adb: Minor reformatting. + + 2010-06-22 Robert Dewar + + * types.ads: (Dint): Removed, no longer used anywhere. + * uintp.adb (UI_From_CC): Use UI_From_Int, range is sufficient. + (UI_Mul): Avoid use of UI_From_Dint. + (UI_From_Dint): Removed, not used. + * uintp.ads (UI_From_Dint): Removed, not used. + (Uint_Min/Max_Simple_Mul): New constants. + + 2010-06-22 Vincent Celier + + * clean.adb (Parse_Cmd_Line): Recognize switch + --unchecked-shared-lib-imports. + (Usage): Add line for switch --unchecked-shared-lib-imports + * makeusg.adb: Add line for switch --unchecked-shared-lib-imports + * makeutl.ads: (Unchecked_Shared_Lib_Imports): New constant string + moved from GPR_Util. + * switch-m.adb (Scan_Make_Switches): Recognize switch + --unchecked-shared-lib-imports. + * vms_data.ads: Add VMS qualifiers /UNCHECKED_SHARED_LIB_IMPORTS. + * gnat_ugn.texi: Add documentation for new switch + --unchecked-shared-lib-imports. Add also documentation for --subdirs. + + 2010-06-22 Javier Miranda + + * sem_prag.adb, sem_util.adb, sem_util.ads, sem_attr.adb, exp_ch6.adb, + exp_disp.adb, sem_eval.adb, exp_dist.adb lib-xref.adb: Code cleanup, + this patch replaces duplication of code that traverses the chain of + aliased primitives by a call to routine Ultimate_Alias that + provides this functionality. + + 2010-06-22 Arnaud Charlet + + * fmap.adb, opt.ads, osint.adb, osint.ads, output.ads, scng.adb, + sinput-c.adb, switch-m.ads, tree_io.ads: Use simpler form of + Warnings Off/On. + + 2010-06-22 Thomas Quinot + + * einfo.ads: Minor reformatting. + + 2010-06-22 Javier Miranda + + * exp_disp.adb (Expand_Interface_Thunk): Do not generate thunk of + eliminated primitives. + (Make_DT): Avoid referencing eliminated primitives. + (Register_Primitive): Do not register eliminated primitives in the + dispatch table. Required to add this functionality when the program is + compiled without static dispatch tables (-gnatd.t) + + 2010-06-22 Emmanuel Briot + + * fmap.adb, scng.adb, switch-m.ads, sinput-c.adb, opt.ads, output.ads, + tree_io.ads, osint.adb, osint.ads: Use configuration pragmas to prevent + warnings on use of internal GNAT units. + + 2010-06-22 Jose Ruiz + + * s-taprop-vxworks.adb (Set_Priority): Update comments. + + 2010-06-22 Paul Hilfinger + + * s-rannum.adb: Make stylistic change to remove mystery constant in + Extract_Value. Image_Numeral_Length: new symbolic constant. + + 2010-06-22 Ed Schonberg + + * einfo.ads, einfo.adb: Make Is_Protected_Interface, + Is_Synchronized_Interface, Is_Task_Interface into computable + predicates, to free three flags in entity nodes. + * sem_ch3.adb: Remove setting of these flags. + + 2010-06-22 Robert Dewar + + * uintp.adb, osint.adb, prj-conf.adb, prj-part.adb, prj.adb: Minor + reformatting. + * s-taprop-vxworks.adb: Add comment for Set_Priority. + * impunit.adb (Map_Array): Add entries for s-htable.ads and s-crc32.ads + * projects.texi: Move @cindex to the left margin, since otherwise we + are missing entries in the index. + + 2010-06-22 Emmanuel Briot + + * prj-part.adb, prj.adb, tempdir.ads, makeutl.adb: Use + packages from the GNAT hierarchy instead of System when possible. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-22 Jose Ruiz + + * s-taprop-vxworks.adb (Set_Priority): Remove the code that was + previously in place to reorder the ready queue when a task drops its + priority due to the loss of inherited priority. + + 2010-06-22 Vincent Celier + + * projects.texi: Minor spelling error fixes. + Minor reformatting. + + 2010-06-22 Emmanuel Briot + + * prj-part.adb, prj-ext.adb, prj.adb, makeutl.adb, prj-conf.adb: Remove + warnings for some with clauses. + + 2010-06-22 Robert Dewar + + * errout.adb (Unwind_Internal_Type): Improve handling of First_Subtype + test to catch more cases where first subtype is the results we want. + * sem_res.adb (Make_Call_Into_Operator): Don't go to First_Subtype in + error case, since Errout will now handle this correctly. + * gcc-interface/Make-lang.in: Add Sem_Aux to list of GNATBIND objects. + Update dependencies. + + 2010-06-22 Arnaud Charlet + + * exp_ch4.adb (Expand_Allocator_Expression): Set Related_Node properly + when calling Make_Temporary. + + 2010-06-22 Ed Schonberg + + * sem_ch3.adb (Access_Subprogram_Declaration): An anonymous access to + subprogram can be associated with an entry body. + + 2010-06-22 Robert Dewar + + * scos.ads: Add note on membership test handling. + + 2010-06-22 Vincent Celier + + * projects.texi: Minor spelling fixes. + Minor reformatting. + + 2010-06-22 Paul Hilfinger + + * s-rannum.adb: Correct off-by-one error in Extract_Value. + + 2010-06-22 Vincent Celier + + * mlib-prj.adb (Display): In non verbose mode, truncate after fourth + argument. + * mlib-utl.adb (Gcc): In non verbose mode, truncate the display of the + gcc command if it is too long. + + 2010-06-22 Robert Dewar + + * errout.adb (Set_Msg_Node): Fix incorrect reference to node. + + 2010-06-22 Arnaud Charlet + + * exp_ch6.adb (Expand_Actuals): Use Actual as the related node when + calling Make_Temporary. + + 2010-06-22 Robert Dewar + + * sem_res.adb, sem_aux.adb, errout.adb: Minor reformatting. + + 2010-06-22 Ed Schonberg + + * sem_res.adb: Additional special-case for VMS. + + 2010-06-22 Vincent Celier + + * gnatsym.adb: Minor comment fix. + + 2010-06-22 Vincent Celier + + * prj-nmsc.adb (Process_Naming_Scheme): Initialize Lib_Data_Table. + + 2010-06-22 Robert Dewar + + * par-ch4.adb (P_Name): Recognize 'Mod attribute in Ada 95 mode + * sem_attr.adb (Attribute_05): Add Name_Mod so that 'Mod recognized in + Ada 95 mode as an implementation defined attribute. + + 2010-06-22 Vincent Celier + + * bindusg.adb (Display): Update line for -R + * switch-b.adb (Scan_Binder_Switches): Allow generation of the binder + generated files when -R is used. + + 2010-06-22 Vincent Celier + + * prj-nmsc.adb (Lib_Data_Table): New table. + (Check_Library_Attributes): Check if the same library name is used in + two different projects that do not extend each other. + + 2010-06-22 Robert Dewar + + * lib-writ.ads, errout.adb, einfo.adb, einfo.ads: Minor reformatting. + + 2010-06-22 Vincent Celier + + * adaint.c (__gnat_locate_regular_file): If a directory in the path is + empty, make it the current working directory. + + 2010-06-22 Thomas Quinot + + * sem_ch3.adb (Build_Derived_Record_Type): When deriving a tagged + private type with discriminants, make sure the parent type is frozen. + + 2010-06-22 Eric Botcazou + + * exp_attr.adb (Expand_N_Attribute_Reference) : Deal + with packed array references specially. + * exp_ch4.adb (Expand_N_Indexed_Component): Do not convert a reference + to a component of a bit packed array if it is the prefix of 'Bit. + * exp_pakd.ads (Expand_Packed_Bit_Reference): Declare. + * exp_pakd.adb (Expand_Packed_Bit_Reference): New procedure. Expand a + 'Bit reference, where the prefix involves a packed array reference. + (Get_Base_And_Bit_Offset): New helper, extracted from... + (Expand_Packed_Address_Reference): ...here. Call above procedure to + get the outer object and offset expression. + + 2010-06-22 Thomas Quinot + + * exp_attr.adb, lib-writ.ads, bindgen.adb: Minor reformatting. + * einfo.adb (Related_Expression, Set_Related_Expression): Add + assertions. + + 2010-06-22 Javier Miranda + + * sem_ch3.adb (Add_Internal_Interface_Entities): Minor code + reorganization to properly check if the operation has been inherited as + an abstract operation. + + 2010-06-22 Ed Falis + + * s-osinte-vxworks.ads: Complete previous change. + + 2010-06-22 Thomas Quinot + + * sem_res.adb: Add comment. + * projects.texi, gnat_ugn.texi: Remove macro. + + 2010-06-22 Vincent Celier + + * prj-attr.adb: Remove project level attribute Main_Language. + + 2010-06-22 Robert Dewar + + * switch-b.adb, osint-b.adb: Minor reformatting. + + 2010-06-22 Pascal Obry + + * g-socthi-mingw.adb (C_Sendmsg): Do not attempt to send data from a + vector if previous send was not fully successful. If only part of + the vector data was sent, we exit the loop. + + 2010-06-22 Thomas Quinot + + * sem_res.adb (Make_Call_Into_Operator): Use First_Subtype for better + error reporting with generic types. + + 2010-06-22 Thomas Quinot + + * bindgen.adb, bindusg.adb, gnatbind.adb, gnat_ugn.texi, opt.ads, + osint-b.adb, osint-b.ads, output.adb, output.ads, switch-b.adb, + vms_data.ads: Add a new command line switch -A to gnatbind to output + the list of all ALI files for the partition. + + 2010-06-22 Arnaud Charlet + + * s-osinte-vxworks.ads: Fix casing. + * s-vxwext-kernel.ads, s-vxwext-rtp.ads: Complete previous + change: Interfaces.C does not provide a long_long type. + + 2010-06-22 Emmanuel Briot + + * gnat_ugn.texi, projects.texi: Preprocess projects.texi for VMS and + native user's guide, since this document contains the two versions. + * gcc-interface/Make-lang.in: Update doc dependencies. + + 2010-06-22 Robert Dewar + + * sem_ch3.adb: Minor reformatting. Minor code reorganization. + + 2010-06-22 Emmanuel Briot + + * gnat_ugn.texi, projects.texi: Remove toplevel menu, since we should + not build this file on its own (only through gnat_ugn.texi). + Remove macro definitions and insert simpler version in gnat_ugn.texi. + + 2010-06-22 Robert Dewar + + * ali-util.ads: Minor comment update. + * g-socthi-mingw.adb: Minor reformatting. + + 2010-06-22 Ed Falis + + * s-osinte-vxworks.ads: Take sigset_t definition of System.VxWorks.Ext. + * s-vxwext.ads, s-vxwext-kernel.ads, s-vxwext-rtp.ads: Define sigset_t + for specific versions of VxWorks. + + 2010-06-22 Emmanuel Briot + + * gnat_rm.texi, gnat_ugn.texi, projects.texi: Remove all project files + related sections from user's guide and reference manual, since they + have now been merged together into a separate document (projects.texi). + This removes a lot of duplication where attributes where described + in several places. + The grammar for the project files is now in each of the sections + (packages,expressions,...) instead of being duplicates in two other + sections (one in the user's guide that contained the full grammar, + and various sections in the rm that contained extracts of the same + grammar). + Added the full list of all supported attributes, since existing lists + were incomplete + Rename "associative array" into "indexed attribute" + Remove sections that were duplicates ("External References in + Project Files" and "External Values", and "Project Extensions" + for instance). The list of valid packages in project files is now in + a single place. + + 2010-06-22 Ed Schonberg + + * sem_ch3.adb (Add_Internal_Interface_Entities): If + Find_Primitive_Covering_Interface does not find the operation, it may + be because of a name conflict between the inherited operation and a + local non-overloadable name. In that case look for the operation among + the primitive operations of the type. This search must succeed + regardless of visibility. + + 2010-06-22 Pascal Obry + + * g-socthi-mingw.adb: Properly honor MSG_WAITALL in recvmsg. + (C_Recvmsg): Propely honor the MSG_WAITALL flag in Windows + recvmsg emulation. + + 2010-06-22 Robert Dewar + + * sem_ch4.adb (Analyze_Conditional_Expression): Defend against + malformed tree. + * sprint.adb (Sprint_Node_Actual, case N_Conditional_Expression): + Ditto. + + 2010-06-22 Arnaud Charlet + + * s-intman-vxworks.ads: Code clean up. + + 2010-06-22 Thomas Quinot + + * sem_res.adb (Resolve_Slice): When the prefix is an explicit + dereference, construct actual subtype of designated object to generate + proper bounds checks. + + 2010-06-22 Thomas Quinot + + * ali-util.adb, ali-util.ads, gnatbind.adb (Read_ALI): Rename to + Read_Withed_ALIs, which is more descriptive. + + 2010-06-22 Pascal Obry + + * g-sothco.ads: Minor reformatting. + * g-socthi-mingw.adb: Remove part of work on the C_Recvmsg and + C_Sendmsg implementation. + (C_Sendmsg): Do not use lock (not needed). + (C_Recvmsg): Likewise and also do not wait for incoming data. + + 2010-06-22 Ed Schonberg + + * uintp.adb: Fix scope error in operator call. + + 2010-06-22 Vincent Celier + + * makeutl.adb (Executable_Prefix_Path): on VMS, return "/gnu/". + * prj-conf.adb (Get_Or_Create_Configuration_File): On VMS, if + autoconfiguration is needed, fail indicating that no config project + file can be found, as there is no autoconfiguration on VMS. + + 2010-06-22 Ed Schonberg + + * sem_res.adb (Make_Call_Into_Operator): Diagnose an incorrect scope + for an operator in a functional notation, when operands are universal. + + 2010-06-22 Arnaud Charlet + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-22 Robert Dewar + + * sem_aggr.adb (Resolve_Record_Aggregate): Do style check on component + name. + * sem_ch10.adb (Analyze_Subunit): Do style check on parent unit name. + * sem_ch8.adb (Find_Direct_Name): For non-overloadable entities, do + style check. + * sem_res.adb (Resolve_Entity_Name): Do style check for enumeration + literals. + + 2010-06-22 Vincent Celier + + * make.adb (Scan_Make_Arg): No longer pass -nostdlib to the compiler as + it has no effect. Always pass -nostdlib to gnatlink, even on VMS. + + 2010-06-22 Pascal Obry + + * g-socthi-mingw.adb: Fix implementation of the vectored sockets on + Windows. + (C_Recvmsg): Make sure the routine is atomic. Also fully + fill vectors in the proper order. + (C_Sendmsg): Make sure the routine is atomic. + + 2010-06-22 Robert Dewar + + * sem_ch8.adb: Update comment. + * sem_res.adb: Minor code reorganization (use Ekind_In). + + 2010-06-22 Ed Schonberg + + * sem_ch8.adb (Add_Implicit_Operator): If the context of the expanded + name is a call, use the number of actuals to determine whether this is + a binary or unary operator, rather than relying on later information + to resolve the overload. + + 2010-06-22 Robert Dewar + + * sem_ch10.adb, sem_aggr.adb: Minor reformatting. + + 2010-06-22 Robert Dewar + + * sem_ch3.adb, sem_disp.adb: Minor code fixes. + * sem_eval.adb: Minor reformatting. + + 2010-06-22 Vincent Celier + + * make.adb (Scan_Make_Arg): When invoked with -nostdlib, pass -nostdlib + to gnatlink, except on Open VMS. + * osint.adb (Add_Default_Search_Dirs): Do not suppress the default + object directories if -nostdlib is used. + + 2010-06-22 Robert Dewar + + * sem_util.adb (Is_Delegate): Put in proper alpha order. + * sem_eval.adb: Minor reformatting. + + 2010-06-22 Robert Dewar + + * g-expect-vms.adb, sem_res.adb: Minor reformatting. + * exp_aggr.adb: Minor comment changes and reformatting. + * sem_eval.adb (Find_Universal_Operator_Type): Put in proper alpha + order. + * sem_util.ads: Add some missing pragma Inline's. + + 2010-06-22 Thomas Quinot + + * sem_util.adb (Build_Actual_Subtype): Record original expression in + Related_Expression attribute of the constructed subtype. + * einfo.adb, einfo.ads (Underlying_View): Move to Node28 to free up + Node24 on types for... + (Related_Expression): Make attribute available on types as well. + + 2010-06-22 Gary Dismukes + + * exp_util.adb (Find_Interface_ADT): Retrieve Designated_Type instead + of Directly_Designated_Type when the type argument is an access type. + (Find_Interface_Tag): Retrieve Designated_Type instead of + Directly_Designated_Type when the type argument is an access type. + (Has_Controlled_Coextensions): Retrieve Designated_Type instead of + Directly_Designated_Type of each access discriminant. + * sem_res.adb (Resolve_Type_Conversion): Retrieve Designated_Type + instead of Directly_Designated_Type when the operand and target types + are access types. + + 2010-06-22 Thomas Quinot + + * exp_aggr.adb (Flatten): Return False if one choice is statically + known to be out of bounds. + + 2010-06-22 Ed Schonberg + + * sem_res.adb (Resolve_Call): If the call is rewritten as an indexed of + a parameterless function call, preserve parentheses of original + expression, for proper handling by pretty printer. + * sem_attr.adb (Analyze_Attribute, case 'Old): Add guard to Process + procedure, to handle quietly identifiers that have no entity names. + * exp_util.adb (Get_Current_Value_Condition): If the parent of an + elsif_part is missing, it has been rewritten as a nested if, and there + is no useful information on the current value of the variable. + + 2010-06-22 Gary Dismukes + + * sem_ch3.adb (Build_Discriminal): Set default scopes for newly created + discriminals to the current scope. + * sem_util.adb (Find_Body_Discriminal): Remove setting of discriminal's + scope, which could overwrite a different already set value. + + 2010-06-22 Ed Schonberg + + * sem_res.adb (Valid_Conversion): If expression is a predefined + operator, use sloc of type of interpretation to improve error message + when operand is of some derived type. + * sem_eval.adb (Is_Mixed_Mode_Operand): New function, use it. + + 2010-06-22 Emmanuel Briot + + * g-expect-vms.adb (Expect_Internal): No longer raises an exception, so + that it can set out parameters as well. When a process has died, reset + its Input_Fd to Invalid_Fd, so that when using multiple processes we + can find out which process has died. + + 2010-06-22 Thomas Quinot + + * sem_eval.adb (Find_Universal_Operator_Type): New + subprogram to identify the operand type of an operator on universal + operands, when an explicit scope indication is present. Diagnose the + case where such a call is ambiguous. + (Eval_Arithmetic_Op, Eval_Relational_Op, Eval_Unary_Op): + Use the above to identify the operand type so it can be properly + frozen. + * sem_res.adb (Make_Call_Into_Operator): Remove bogus freeze of operand + type, done in an arbitrary, possibly incorrect type (the presence of + some numeric type in the scope is checked for legality, but when more + than one such type is in the scope, we just pick a random one, not + necessarily the expected one). + * sem_utils.ads, sem_utils.adb (Is_Universal_Numeric_Type): New utility + subprogram. + + 2010-06-22 Robert Dewar + + * sem_eval.adb: Minor reformatting. + + 2010-06-22 Robert Dewar + + * exp_ch4.adb (Expand_N_Conditional_Expression): Use + Expression_With_Actions to clean up the code generated when folding + constant expressions. + + 2010-06-22 Vincent Celier + + * g-expect-vms.adb: Add new subprograms Free, First_Dead_Process and + Has_Process. + + 2010-06-22 Vincent Celier + + * prj-nmsc.adb (Find_Sources): When a source from a multi-unit file is + found, check if it's path has aready been found, whatever its index. + + 2010-06-22 Robert Dewar + + * atree.adb, gnatbind.adb: Minor reformatting. + Minor code reorganization. + + 2010-06-21 Robert Dewar + + * exp_ch4.adb (Expand_N_Conditional_Expression): Fold if condition + known at compile time. + + 2010-06-21 Gary Dismukes + + * atree.adb: Fix comment typo. + + 2010-06-21 Ed Schonberg + + * sem_eval.adb (Test_Ambiguous_Operator): New procedure to check + whether a universal arithmetic expression in a conversion, which is + rewritten from a function call with an expanded name, is ambiguous. + + 2010-06-21 Vincent Celier + + * prj-nmsc.adb (Name_Location): New Boolean component Listed, to record + source files in specified list of sources. + (Check_Package_Naming): Remove out parameters Bodies and Specs, as they + are never used. + (Add_Source): Set the Location of the new source + (Process_Exceptions_File_Based): Call Add_Source with the Location + (Get_Sources_From_File): If an exception is found, set its Listed to + True + (Find_Sources): When Source_Files is specified, if an exception is + found, set its Listed to True. Remove any exception that is not in a + specified list of sources. + * prj.ads (Source_Data): New component Location + + 2010-06-21 Vincent Celier + + * gnatbind.adb (Closure_Sources): Global table, moved from block. + + 2010-06-21 Thomas Quinot + + * sem_res.adb: Minor reformatting. + * atree.adb: New debugging hook "rr" for node rewrites. + + 2010-06-21 Robert Dewar + + * g-expect.ads, g-expect.adb: Minor reformatting. + + 2010-06-21 Emmanuel Briot + + * s-regpat.adb (Next_Pointer_Bytes): New named constant. Code clean up. + + 2010-06-21 Arnaud Charlet + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-21 Thomas Quinot + + * bindgen.ads: Update comments. + + 2010-06-21 Vincent Celier + + * gnatbind.adb: Suppress dupicates when listing the sources in the + closure (switch -R). + + 2010-06-21 Emmanuel Briot + + * s-regpat.adb (Link_Tail): Fix error when size of the pattern matcher + is too small. + + 2010-06-21 Emmanuel Briot + + * g-expect.adb, g-expect.ads (First_Dead_Process, Free, Has_Process): + New subprograms. + (Expect_Internal): No longer raises an exception, so that it can set + out parameters as well. When a process has died, reset its Input_Fd + to Invalid_Fd, so that when using multiple processes we can find out + which process has died. + + 2010-06-21 Robert Dewar + + * s-regpat.adb, s-tpoben.adb, sem_attr.adb, sem_util.adb, sem_util.ads, + checks.adb, sem_res.adb: Minor reformatting. Add comments. + + 2010-06-21 Ed Schonberg + + * sem_ch6.adb (New_Overloaded_Entity): If the new entity is a + rederivation associated with a full declaration in a private part, and + there is a partial view that derives the same parent subprogram, the + new entity does not become visible. This check must be applied to + interface operations as well. + + 2010-06-21 Thomas Quinot + + * checks.adb: Add comments. + * prj-nmsc.adb: Minor reformatting. + + 2010-06-21 Thomas Quinot + + * sem_ch9.adb, checks.adb, sem_util.adb, sem_util.ads, sem_res.adb, + sem_attr.adb (Get_E_First_Or_Last): Use attribute references on E to + extract bounds, to ensure that we get the proper captured values, + rather than an expression that may have changed value since the point + where the subtype was elaborated. + (Find_Body_Discriminal): New utility subprogram to share code + between... + (Eval_Attribute): For the case of a subtype bound that references a + discriminant of the current concurrent type, insert appropriate + discriminal reference. + (Resolve_Entry.Actual_Index_Type.Actual_Discriminant_Ref): For a + requeue to an entry in a family in the current task, use corresponding + body discriminal. + (Analyze_Accept_Statement): Rely on expansion of attribute references + to insert proper discriminal references in range check for entry in + family. + + 2010-06-21 Emmanuel Briot + + * s-regpat.adb (Compile): Fix handling of big patterns. + + 2010-06-21 Robert Dewar + + * a-tifiio.adb: Minor reformatting. + + 2010-06-21 Pascal Obry + + * prj-nmsc.adb (Search_Directories): Use the non-translated directory + path to open it. + + 2010-06-21 Javier Miranda + + * exp_cg.adb (Write_Call_Info): Fill the component sourcename using the + external name. + + 2010-06-21 Ed Schonberg + + * exp_ch4.adb (Expand_Concatenate): If an object declaration is created + to hold the result, indicate that the target of the declaration does + not need an initialization, to prevent spurious errors when + Initialize_Scalars is enabled. + + 2010-06-21 Ed Schonberg + + * a-tifiio.adb (Put): In the procedure that performs I/O on a String, + Fore is not bound by line length. The Fore parameter of the internal + procedure that performs the operation is an integer. + + 2010-06-21 Thomas Quinot + + * sem_res.adb, checks.adb: Minor reformatting. + + 2010-06-21 Emmanuel Briot + + * s-regpat.adb (Next_Instruction, Get_Next_Offset): Removed, merged + into Get_Next. + (Insert_Operator_Before): New subprogram, avoids duplicated code + (Compile): Avoid doing two compilations when the pattern matcher ends + up being small. + + 2010-06-21 Emmanuel Briot + + * s-regpat.adb: Improve debug traces + (Dump): Change output format to keep it smaller. + + 2010-06-21 Javier Miranda + + * exp_cg.adb (Generate_CG_Output): Disable redirection of standard + output to the output file when this routine completes its work. + + 2010-06-20 Eric Botcazou + + * gcc-interface/trans.c (Subprogram_Body_to_gnu): Use while instead of + for loop. Call build_constructor_from_list directly in the CICO case. + + 2010-06-18 Ed Schonberg + + * freeze.adb (Build_And_Analyze_Renamed_Body): If the renaming + declaration appears in the same unit and ealier than the renamed + entity, retain generated body to prevent order-of-elaboration issues in + gigi. + + 2010-06-18 Arnaud Charlet + + * s-tpoben.adb: Update comments. + + 2010-06-18 Robert Dewar + + * debug.adb: Minor comment change. + + 2010-06-18 Javier Miranda + + * exp_cg.adb: Code clean up. + * debug.adb: Complete documentation of switch -gnatd.Z. + * gcc-interface/misc.c (callgraph_info_file): Declare. + + 2010-06-18 Javier Miranda + + * exp_cg.adb (Homonym_Suffix_Length): Minor code reorganization. + + 2010-06-18 Thomas Quinot + + * sprint.ads: Minor reformatting. + * output.ads: Update obsolete comment. + + 2010-06-18 Ed Schonberg + + * freeze.adb (Build_And_Analyze_Renamed_Body): if the renamed entity is + an external intrinsic operation (e.g. a GCC numeric function) indicate + that the renaming entity has the same characteristics, so a call to it + is properly expanded. + + 2010-06-18 Javier Miranda + + * exp_cg.adb, exp_cg.ads, exp_disp.adb, gnat1drv.adb: Add initial + support for dispatch table/callgraph info generation. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-18 Robert Dewar + + * exp_ch6.adb: Minor reformatting. + * gnatname.adb: Add comment. + + 2010-06-18 Vincent Celier + + * gnatname.adb (Scan_Args): When --and is used, make sure that the + dynamic tables in the newly allocated Argument_Data are properly + initialized. + + 2010-06-18 Eric Botcazou + + * gnat1drv.adb: Fix comment. + + 2010-06-18 Ed Schonberg + + * exp_ch6.adb (Expand_Inlined_Call): If the inlined subprogram is a + renaming, re-expand the call with the renamed subprogram if that one + is marked inlined as well. + + 2010-06-18 Gary Dismukes + + * gnat1drv.adb (Adjust_Global_Switches): Enable + Use_Expression_With_Actions for AAMP and VM targets. + + 2010-06-18 Vincent Celier + + * prj-nmsc.adb (Process_Linker): Recognize response file format GCC. + + 2010-06-18 Thomas Quinot + + * exp_ch4.adb: Minor reformatting. + + 2010-06-18 Javier Miranda + + * debug.ads Add documentation on -gnatd.Z. + + 2010-06-18 Ed Schonberg + + * sem_elim.adb: Proper error message on improperly eliminated instances + + 2010-06-18 Vincent Celier + + * prj.ads (Response_File_Format): New value GCC. + + 2010-06-18 Thomas Quinot + + * gnat1drv.adb: Minor reformatting. + + 2010-06-18 Robert Dewar + + * make.adb, sem_cat.adb: Minor reformatting. + * sem_eval.adb: Fix typos. + + 2010-06-18 Pascal Obry + + * prj-nmsc.adb: Fix source filenames casing in debug output. + + 2010-06-18 Robert Dewar + + * gnatcmd.adb: Minor reformatting. + + 2010-06-18 Robert Dewar + + * sem_eval.adb (Eval_Conditional_Expression): Result is static if + condition and both sub-expressions are static (and result is selected + expression). + + 2010-06-18 Robert Dewar + + * g-pehage.adb: Minor reformatting + + 2010-06-18 Pascal Obry + + * prj-nmsc.adb (Search_Directories): Insert canonical filenames into + source hash table. + + 2010-06-18 Arnaud Charlet + + * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update + dependencies. Fix target pairs on darwin. + (gnatlib-sjlj, gnatlib-zcx): Pass THREAD_KIND. + + 2010-06-18 Pascal Obry + + * make.adb, prj-nmsc.adb: Fix source filenames casing in debug output. + + 2010-06-18 Vincent Celier + + * gnatcmd.adb: For gnatcheck, add -gnatec= switch for a global + configuration pragmas file and, if -U is not used, for a local one. + + 2010-06-18 Ed Schonberg + + * sem_elim.adb (Check_Eliminated): Use full information on entity name + when it is given in the pragma by a selected component. + (Check_For_Eliminated_Subprogram): Do no emit error if within a + instance body that is itself within a generic unit. + * sem_ch12.adb (Analyze_Subprogram_Instance): If the subprogram is + eliminated, mark as well the anonymous subprogram that is its alias + and appears within the wrapper package. + + 2010-06-18 Bob Duff + + * g-pehage.ads, g-pehage.adb (Produce): Clean up some of the code. + Raise an exception if the output file cannot be opened. Add comments. + + 2010-06-18 Thomas Quinot + + * sem_cat.adb (Validate_Object_Declaration): A variable declaration is + not illegal per E.2.2(7) if it occurs in the private part of a + Remote_Types unit. + + 2010-06-18 Arnaud Charlet + + * par-ch9.adb, sem_aggr.adb, sem_ch3.adb, layout.adb, sem_ch4.adb, + sem_ch5.adb, sem_mech.adb, exp_util.adb, par-ch10.adb, sem_ch6.adb, + par-ch11.adb, sem_ch7.adb, par-prag.adb, exp_disp.adb, par-ch12.adb, + sem_ch8.adb, style.adb, sem_ch9.adb, sem_ch10.adb, prep.adb, + sem_warn.adb, par-util.adb, scng.adb, sem_eval.adb, checks.adb, + sem_prag.adb, sem_ch12.adb, styleg.adb, sem_ch13.adb, par-ch3.adb, + par-tchk.adb, freeze.adb, sfn_scan.adb, par-ch4.adb, sem_util.adb, + sem_res.adb, par-ch5.adb, lib-xref.adb, sem_attr.adb, par-ch6.adb, + sem_disp.adb, prepcomp.adb, par-ch7.adb, sem_elab.adb, exp_ch4.adb, + errout.ads: Update comments. Minor reformatting. + + * g-spipat.adb, a-swunau.adb, a-swunau.ads, g-spitbo.adb, + a-szunau.adb, a-szunau.ads, a-stunau.adb, a-stunau.ads, + a-strunb.adb (Big_String. Big_String_Access): New type. + + * par-labl.adb, restrict.adb, s-osinte-hpux-dce.ads, sem_ch11.adb, + exp_pakd.adb, s-filofl.ads, par-endh.adb, exp_intr.adb, sem_cat.adb, + sem_case.adb, exp_ch11.adb, s-osinte-linux.ads: Fix copyright notices. + + 2010-06-18 Geert Bosch + + * i-forbla-darwin.adb: Include -lgnala and -lm in linker options for + Darwin. + + 2010-06-18 Robert Dewar + + * gnat1drv.adb (Adjust_Global_Switches): Set Use_Expression_With_Actions + true for gcc. + + 2010-06-18 Robert Dewar + + * sprint.adb: Minor format change for N_Expression_With_Actions. + * repinfo.adb: Minor reformatting. + + 2010-06-18 Ed Schonberg + + * sem_elim.adb (Check_Eliminated): If within a subunit, use + Defining_Entity to obtain the name of the entity in the proper body, to + properly handle both separate packages and subprograms. + + 2010-06-18 Emmanuel Briot + + * prj-nmsc.adb (Check_File): New parameter Display_Path. + + 2010-06-18 Thomas Quinot + + * g-socket.adb, g-socket.ads (Null_Selector): New object. + + 2010-06-18 Pascal Obry + + * gnat_ugn.texi: Minor clarification. + + 2010-06-18 Emmanuel Briot + + * prj-nmsc.adb (Find_Source_Dirs): Minor refactoring to avoid duplicate + code when using the project dir as the source dir. + (Search_Directories): use the normalized name for the source directory, + where symbolic names have potentially been resolved. + + 2010-06-18 Robert Dewar + + * exp_ch4.adb (Expand_N_Conditional_Expression): Clear Actions field + when we create N_Expression_With_Actions node. + (Expand_Short_Circuit): Ditto. + + 2010-06-18 Robert Dewar + + * exp_util.adb: Minor reformatting. + + 2010-06-18 Thomas Quinot + + * types.ads: Clean up obsolete comments + * tbuild.adb: Minor reformatting. + * exp_ch5.adb, sem_intr.adb, sem_ch10.adb, rtsfind.adb, s-shasto.adb, + exp_strm.adb, aa_drive.adb: Minor reformatting. + * sem_res.adb (Is_Predefined_Operator): An operator that is an imported + intrinsic with an Interface_Name denotes an imported back-end builtin, + and must be rewritten into a call, not left in the tree as an operator, + so return False in that case. + + 2010-06-18 Eric Botcazou + + * exp_util.adb (Remove_Side_Effects): Make a copy for an allocator. + + 2010-06-18 Robert Dewar + + * scos.ads: Add proposed output for case expression + + 2010-06-18 Jose Ruiz + + * gnat_ugn.texi: Document that, when using the RTX compiler to generate + RTSS modules, we need to use the Microsoft linker. + + 2010-06-18 Robert Dewar + + * checks.adb (Safe_To_Capture_In_Parameter_Value): Deal with case + expression (cannot count on a particular branch being executed). + * exp_ch4.adb (Expand_N_Case_Expression): New procedure. + * exp_ch4.ads (Expand_N_Case_Expression): New procedure. + * exp_util.adb (Insert_Actions): Deal with proper insertion of actions + within case expression. + * expander.adb (Expand): Add call to Expand_N_Case_Expression + * par-ch4.adb Add calls to P_Case_Expression at appropriate points + (P_Case_Expression): New procedure + (P_Case_Expression_Alternative): New procedure + * par.adb (P_Case_Expression): New procedure + * par_sco.adb (Process_Decisions): Add dummy place holder entry for + N_Case_Expression. + * sem.adb (Analyze): Add call to Analyze_Case_Expression + * sem_case.ads (Analyze_Choices): Also used for case expressions now, + this is a documentation change only. + * sem_ch4.ads, sem_ch4.adb (Analyze_Case_Expression): New procedure. + * sem_ch6.adb (Fully_Conformant_Expressions): Add handling of case + expressions. + * sem_eval.ads, sem_eval.adb (Eval_Case_Expression): New procedure. + * sem_res.adb (Resolve_Case_Expression): New procedure. + * sem_scil.adb (Find_SCIL_Node): Add processing for + N_Case_Expression_Alternative. + * sinfo.ads, sinfo.adb (N_Case_Expression): New node. + (N_Case_Expression_Alternative): New node. + * sprint.adb (Sprint_Node_Actual): Add processing for new nodes + N_Case_Expression and N_Case_Expression_Alternative. + + 2010-06-18 Robert Dewar + + * par-ch7.adb, sem_warn.adb, types.ads, par-ch3.adb: Minor + reformatting. + * gnat1drv.adb: Fix typo. + + 2010-06-18 Robert Dewar + + * par-prag.adb (Prag, case Style_Checks): All_Checks sets gnat style + for -gnatg. + * sem_prag.adb (Analyze_Pragma, case Style_Checks): All_Checks sets + gnat style for -gnatg. + * gnat_rm.texi: Add documentation for ALL_CHECKS in GNAT mode. + + 2010-06-18 Thomas Quinot + + * sem_eval.adb (Test_In_Range): New subprogram, factoring duplicated + code between... + (Is_In_Range, Is_Out_Of_Range): Reimplement in terms of call to + Test_In_Range. + + 2010-06-18 Robert Dewar + + * sprint.adb: Minor change in output format for expression wi actions. + * par-ch3.adb: Minor code reorganization. Minor reformatting. + * sem_ch5.adb: Minor comment fix. + + 2010-06-18 Robert Dewar + + * debug.adb: New debug flag -gnatd.L to control + Back_End_Handles_Limited_Types. + * exp_ch4.adb (Expand_N_Conditional_Expression): Let back end handle + limited case if Back_End_Handles_Limited_Types is True. + (Expand_N_Conditional_Expression): Use N_Expression_With_Actions to + simplify expansion if Use_Expression_With_Actions is True. + * gnat1drv.adb (Adjust_Global_Switches): Set + Back_End_Handles_Limited_Types. + * opt.ads (Back_End_Handles_Limited_Types): New flag. + + 2010-06-18 Ed Schonberg + + * sem_res.adb (Rewrite_Operator_As_Call): Do not rewrite user-defined + intrinsic operator if expansion is not enabled, because in an + instantiation the original operator must be present to verify the + legality of the operation. + + 2010-06-18 Robert Dewar + + * exp_disp.adb, sem_ch12.adb: Minor reformatting + + 2010-06-18 Ed Schonberg + + * exp_util.adb (Make_Subtype_From_Expr): If the unconstrained type is + the class-wide type for a private extension, and the completion is a + subtype, set the type of the class-wide type to the base type of the + full view. + + 2010-06-18 Robert Dewar + + * g-socket.ads, sem_aggr.adb, einfo.ads, sem_elim.adb, + sem_intr.adb, sem_eval.adb: Minor reformatting + + 2010-06-18 Ed Schonberg + + * sem_type.adb (Is_Ancestor): If either type is private, examine full + view. + + 2010-06-18 Thomas Quinot + + * g-socket.adb, g-socket.ads (Check_Selector): Make Selector an IN + parameter rather than IN OUT. + + 2010-06-18 Ed Schonberg + + * exp_ch6.adb: Add extra guard. + + 2010-06-18 Gary Dismukes + + * sem_util.adb (Object_Access_Level): For Ada 2005, determine the + accessibility level of a function call from the level of the innermost + enclosing dynamic scope. + (Innermost_Master_Scope_Depth): New function to find the depth of the + nearest dynamic scope enclosing a node. + + 2010-06-18 Tristan Gingold + + * adaint.c: Make ATTR_UNSET static as it is not used outside this file. + + 2010-06-18 Thomas Quinot + + * g-socket.ads: Minor reformatting. + + 2010-06-18 Vincent Celier + + * make.adb (Must_Compile): New Boolean global variable + (Main_On_Command_Line): New Boolean global variable + (Collect_Arguments_And_Compile): Do compile if Must_Compile is True, + even when the project is externally built. + (Start_Compile_If_Possible): Compile in -aL directories if + Check_Readonly_Files is True. Do compile if Must_Compile is True, even + when the project is externally built. + (Gnatmake): Set Must_Compile and Check_Readonly_Files to True when + invoked with -f -u and one or several mains on the command line. + (Scan_Make_Arg): Set Main_On_Command_Line to True when at least one + main is specified on the command line. + + 2010-06-18 Ed Schonberg + + * sem_ch6.adb (Build_Body_For_Inline): Handle + extended_return_statements. + * exp_ch6.adb (Expand_Inlined_Call): when possible, inline a body + containing extented_return statements. + * exp_util.adb (Make_CW_Equivalent_Type): If the root type is already + constrained, do not build subtype declaration. + + 2010-06-18 Robert Dewar + + * sem_res.adb (Analyze_Indexed_Component, Analyze_Selected_Component): + Warn on assigning to packed atomic component. + + 2010-06-18 Robert Dewar + + * sem_util.ads: Minor reformatting + * einfo.ads, einfo.adb: Minor doc clarification (scope of decls in + Expression_With_Actions). + * snames.ads-tmpl: Minor comment fix + + 2010-06-18 Robert Dewar + + * sem_prag.adb (Diagnose_Multiple_Pragmas): New procedure + (Set_Imported): Use Import_Interface_Present to control message output + * sinfo.ads, sinfo.adb (Import_Interface_Present): New flag + * gnat_rm.texi: Document that we can have pragma Import and pragma + Interface for the same subprogram. + + 2010-06-18 Robert Dewar + + * lib-xref.adb (Generate_Reference): Fix bad reference to + Has_Pragma_Unreferenced (clients should always use Has_Unreferenced). + + 2010-06-17 Eric Botcazou + + * gcc-interface/trans.c (set_gnu_expr_location_from_node): New static + function. + (gnat_to_gnu) : New case. + Use set_gnu_expr_location_from_node to set location information on the + result. + + 2010-06-17 Arnaud Charlet + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-17 Ed Schonberg + + * sem_util.adb (Is_Atomic_Object): Predicate does not apply to + subprograms. + + 2010-06-17 Robert Dewar + + * gnat_rm.texi, gnat_ugn.texi: Clean up documentation on warning and + style check messages. + * sem_res.adb (Resolve_Call): Don't call + Check_For_Eliminated_Subprogram if we are analyzing within a spec + expression. + + 2010-06-17 Robert Dewar + + * debug.adb: Add documentation for debug flags .X and .Y + * exp_ch4.adb (Expand_Short_Circuit_Operator): Use + Use_Expression_With_Actions. + * gnat1drv.adb (Adjust_Global_Switches): Set + Use_Expression_With_Actions. + * opt.ads (Use_Expression_With_Actions): New switch. + + 2010-06-17 Robert Dewar + + * exp_intr.adb: Minor code reorganization (use UI_Max) + * sem_intr.adb: use underlying type to check legality. + * einfo.adb (Known_Static_Esize): False for generic types + (Known_Static_RM_Size): False for generic types + * einfo.ads (Known_Static_Esize): False for generic types + (Known_Static_RM_Size): False for generic types + + 2010-06-17 Robert Dewar + + * exp_ch4.ads: Minor code reorganization (specs in alpha order). + + 2010-06-17 Robert Dewar + + * debug.adb: New debug flag -gnatd.X to use Expression_With_Actions + node when expanding short circuit form with actions present for right + opnd. + * exp_ch4.adb: Minor reformatting + (Expand_Short_Circuit_Operator): Use new Expression_With_Actions node + if right opeand has actions present, and debug flag -gnatd.X is set. + * exp_util.adb (Insert_Actions): Handle case of Expression_With_Actions + node. + * nlists.adb (Prepend_List): New procedure + (Prepend_List_To): New procedure + * nlists.ads (Prepend_List): New procedure + (Prepend_List_To): New procedure + * sem.adb: Add processing for Expression_With_Actions + * sem_ch4.adb (Analyze_Expression_With_Actions): New procedure + * sem_ch4.ads (Analyze_Expression_With_Actions): New procedure + * sem_res.adb: Add processing for Expression_With_Actions. + * sem_scil.adb: Add processing for Expression_With_Actions + * sinfo.ads, sinfo.adb (N_Expression_With_Actions): New node. + * sprint.ads, sprint.adb: Add processing for Expression_With_Actions + + 2010-06-17 Doug Rupp + + * sem_intr.adb (Check_Intrinsic_Operator): Check that the types + involved both have underlying integer types. + * exp_intr.adb (Expand_Binary_Operator) New subprogram to expand a call + to an intrinsic operator when the operand types or sizes are not + identical. + * s-auxdec-vms_64.ads: Revert "+" "-" ops back to Address now that + 64/32 Address/Integer works. + + 2010-06-17 Ed Schonberg + + * sem_ch12.adb (Mark_Context): Refine placement of Withed_Body flag, so + that it marks a unit as needed by a spec only if the corresponding + instantiation appears in that spec (and not in the corresponding body). + * sem_elim.adb (Check_Eliminated): If we are within a subunit, the name + in the pragma Eliminate has been parsed as a child unit, but the + current compilation unit is in fact the parent in which the subunit is + embedded. + + 2010-06-17 Vincent Celier + + * gnat_rm.texi: Fix typo + + 2010-06-17 Robert Dewar + + * sem_util.adb: Minor reformatting + + 2010-06-17 Ed Schonberg + + * sem.adb (Do_Withed_Unit): if the unit in the with_clause is a generic + instance, the clause now denotes the instance body. Traverse the + corresponding spec because there may be no other dependence that will + force the traversal of its own context. + + 2010-06-17 Ed Schonberg + + * sem_ch10.adb (Is_Ancestor_Unit): Subsidiary to + Install_Limited_Context_Clauses, to determine whether a limited_with in + some parent of the current unit designates some other parent, in which + case the limited_with clause must not be installed. + (In_Context): Refine test. + + 2010-06-17 Gary Dismukes + + * sem_util.adb (Collect_Primitive_Operations): In the of an untagged + type with a dispatching equality operator that is overridden (for a + tagged full type), don't include the overridden equality in the list of + primitives. The overridden equality is detected by testing for an + Aliased field that references the overriding equality. + + 2010-06-17 Robert Dewar + + * freeze.adb: Minor reformatting. + + 2010-06-17 Joel Brobecker + + * gnat_ugn.texi: Add a section introducing gdbserver. + + 2010-06-17 Thomas Quinot + + * sem_res.adb, sem_ch4.adb, s-stoele.adb, par-labl.adb: Minor + reformatting. + + 2010-06-17 Ed Schonberg + + * sem_aggr.adb (Valid_Ancestor_Type): handle properly the case of a + constrained discriminated parent that is a private type. + (Analyze_Record_Aggregate): when collecting inherited discriminants, + handle properly an ancestor type that is a constrained private type. + + 2010-06-17 Ed Schonberg + + * sem_util.adb (Enclosing_Subprogram): If the called subprogram is + protected, use the protected_subprogram_body only if the original + subprogram has not been eliminated. + + 2010-06-17 Ed Schonberg + + * freeze.adb (Freeze_Expression): The designated type of an + access_to_suprogram type can only be frozen if all types in its profile + are fully defined. + + 2010-06-17 Robert Dewar + + * par.adb: Minor comment fix + * sem_aggr.adb, sem_ch3.adb: Minor reformatting + + 2010-06-17 Doug Rupp + + * s-auxdec-vms_64.ads: Revert Integer to Long_Integer change, instead + change Address to Short_Address in functions where both must be the + same size for intrinsics to work. + + 2010-06-17 Thomas Quinot + + * sem_ch4.adb (Analyze_Selected_Component): A selected component may + not denote a (private) component of a protected object. + + 2010-06-17 Bob Duff + + * par-labl.adb (Try_Loop): Test whether the label and the goto are in + the same list. + + 2010-06-17 Joel Brobecker + + * gnat_ugn.texi: Update the documentation about GDB re: exception + catchpoints. + + 2010-06-17 Arnaud Charlet + + * gnatvsn.ads: Bump to 4.6 version. + + 2010-06-17 Ed Schonberg + + * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): The + designated type of the generated pointer is the type of the original + expression, not that of the function call itself, because the return + type may be an untagged derived type and the function may be an + inherited operation. + + 2010-06-17 Robert Dewar + + * exp_ch4.adb: Minor reformatting. + + 2010-06-17 Ed Schonberg + + * sinfo.ads, sinfo.adb (Inherited_Discriminant): New flag on + N_Component_Association nodes, to indicate that a component association + of an extension aggregate denotes the value of a discriminant of an + ancestor type that has been constrained by the derivation. + * sem_aggr.adb (Discr_Present): use Inherited_Discriminant to prevent a + double expansion of the aggregate appearing in a context that delays + expansion, to prevent double insertion of discriminant values when the + aggregate is reanalyzed. + + 2010-06-17 Arnaud Charlet + + * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Do not use + Allocator as the Related_Node of Return_Obj_Access in call to + Make_Temporary below as this would create a sort of infinite + "recursion". + + 2010-06-17 Ben Brosgol + + * gnat_ugn.texi: Update gnatcheck doc. + + 2010-06-17 Ed Schonberg + + * sem_ch3.adb (Build_Incomplete_Type_Declaration): If there is an + incomplete view of the type that is not tagged, and the full type is a + tagged extension, create class_wide type now, and warn that the + incomplete view should be tagged as well. + + 2010-06-17 Vincent Celier + + * gnatcmd.adb (Non_VMS_Usage): Do not issue usage for gnat sync. + Update the last line of the usage, indicating what commands do not + accept project file switches. + * vms_conv.adb: Do not issue usage line for GNAT SYNC + * vms_data.ads: Fix errors in the qualifiers /LOGFILE and /MAIN of + GNAT ELIM. + * gnat_ugn.texi: Document the relaxed rules for library directories in + externally built library projects. + + 2010-06-17 Doug Rupp + + * s-auxdec-vms_64.ads: Make boolean and arithmetic operations intrinsic + where possible. + * s-auxdec-vms-alpha.adb: Remove kludges for aforemention. + * gcc-interface/Makefile.in: Update VMS target pairs. + + 2010-06-17 Vasiliy Fofanov + + * adaint.c: Reorganized in order to avoid use of GetProcessId to stay + compatible with Windows NT 4.0 which doesn't provide this function. + + 2010-06-17 Vincent Celier + + * ali-util.adb (Time_Stamp_Mismatch): In Verbose mode, if there is + different timestamps but the checksum is the same, issue a short + message saying so. + + 2010-06-17 Arnaud Charlet + + * s-interr.adb (Finalize): If the Abort_Task signal is set to system, + it means that we cannot reset interrupt handlers since this would + require potentially sending the abort signal to the Server_Task. + + 2010-06-17 Ed Schonberg + + * exp_ch4.adb: expand NOT for VMS types. + * sem_util.adb: Use OpenVMS_On_Target for IS_VMS_Operator. + + 2010-06-17 Sergey Rybin + + * vms_data.ads: Add qualifier for '--no-elim-dispatch' gnatelim option. + * gnat_ugn.texi (gnatelim): add description for --no-elim-dispatch + option. + + 2010-06-17 Ed Schonberg + + * exp_ch6.adb (Expand_Call): Do not expand a call to an internal + protected operation if the subprogram has been eliminated. + + 2010-06-17 Vincent Celier + + * prj-nmsc.adb (Check_Library_Attributes): Allow the different + directories associated with a library to be any directory when the + library project is externally built. + + 2010-06-17 Vincent Celier + + * make.adb (Check): If switch -m is used, deallocate the memory that + may be allocated when computing the checksum. + + 2010-06-17 Eric Botcazou + + * g-socthi-mingw.adb (C_Recvmsg): Add 'use type' clause for C.size_t; + (C_Sendmsg): Likewise. + + 2010-06-17 Thomas Quinot + + * sem_res.adb: Update comments. + + 2010-06-17 Vincent Celier + + * back_end.adb (Scan_Compiler_Arguments): Process last argument + + 2010-06-17 Robert Dewar + + * exp_ch3.adb, exp_ch6.adb, exp_smem.adb, exp_util.adb: Use Ekind_In. + * layout.adb, freeze.adb: Use Make_Temporary. + + 2010-06-17 Jerome Lambourg + + * exp_ch11.adb (Expand_N_Raise_Statement): Expand raise statements in + .NET/JVM normally as this is now perfectly supported by the backend. + + 2010-06-17 Pascal Obry + + * gnat_rm.texi: Fix minor typo, remove duplicate blank lines. + + 2010-06-17 Vincent Celier + + * make.adb (Collect_Arguments_And_Compile): Create include path file + only when -x is specified. + (Gnatmake): Ditto + * opt.ads (Use_Include_Path_File): New Boolean flag, initialized to + False. + * prj-env.adb (Set_Ada_Paths): New Boolean parameters Include_Path and + Objects_Path, defaulted to True. Only create include path file if + Include_Path is True, only create objects path file if Objects_Path is + True. + * prj-env.ads (Set_Ada_Paths): New Boolean parameters Include_Path and + Objects_Path, defaulted to True. + * switch-m.adb (Scan_Make_Switches): Set Use_Include_Path_File to True + when -x is used. + + 2010-06-17 Ed Schonberg + + * exp_disp.adb (Build_Interface_Thunk): Use base type of formal to + determine whether it has the controlling type, when the formal is an + access parameter. + + 2010-06-17 Eric Botcazou + + * s-crtl.ads (ssize_t): New type. + (read): Fix signature. + (write): Likewise. + * g-socthi.ads: Add 'with System.CRTL' clause. Remove ssize_t and + 'use type' directive for C.size_t, add one for System.CRTL.ssize_t. + (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t. + (C_Sendmsg): Likewise. + * g-socthi.adb (Syscall_Recvmsg): Likewise. + (Syscall_Sendmsg): Likewise. + (C_Recvmsg): Likewise. + (C_Sendmsg): Likewise. + * g-socthi-mingw.ads: Add 'with System.CRTL' clause. Remove ssize_t + and 'use type' directive for C.size_t, add one for System.CRTL.ssize_t. + (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t. + (C_Sendmsg): Likewise. + * g-socthi-mingw.adb (C_Recvmsg): Likewise. + (C_Sendmsg): Likewise. + * g-socthi-vms.ads: Add 'with System.CRTL' clause. Remove ssize_t and + 'use type' directive for C.size_t, add one for System.CRTL.ssize_t. + (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t. + (C_Sendmsg): Likewise. + * g-socthi-vms.adb (C_Recvmsg): Likewise. + (C_Sendmsg): Likewise. + * g-socthi-vxworks.ads Add 'with System.CRTL' clause. Remove ssize_t + and 'use type' directive for C.size_t, add one for System.CRTL.ssize_t. + (C_Recvmsg): Replace ssize_t with System.CRTL.ssize_t. + (C_Sendmsg): Likewise. + * g-socthi-vxworks.adb (C_Recvmsg): Likewise. + (C_Sendmsg): Likewise. + * g-sercom-linux.adb (Read): Use correct types to call 'read'. + (Write): Likewise to call 'write'. + * s-os_lib.adb (Read): Use correct type to call System.CRTL.read. + (Write): Use correct type to call System.CRTL.write. + * s-tasdeb.adb (Write): Likewise. + + 2010-06-17 Vincent Celier + + * prj-proc.adb (Copy_Package_Declarations): Change argument name + Naming_Restricted to Restricted. If Restricted is True, do not copy the + value of attribute Linker_Options. + + 2010-06-17 Eric Botcazou + + * gcc-interface/trans.c (push_stack, pop_stack): Delete. + (Case_Statement_to_gnu): Adjust. + (Loop_Statement_to_gnu): Likewise. + (Subprogram_Body_to_gnu): Likewise. + (Handled_Sequence_Of_Statements_to_gnu): Likewise. + (Compilation_Unit_to_gnu): Likewise. + + 2010-06-17 Robert Dewar + + * exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_pakd.adb, exp_prag.adb, + exp_sel.adb, exp_util.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, + sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch8.adb, sem_ch9.adb, + sem_dist.adb, sem_util.adb: Use Make_Temporary + * itypes.ads, tbuild.ads: Minor comment update + * exp_ch9.adb, exp_dist.adb: Minor reformatting + + 2010-06-17 Thomas Quinot + + * exp_imgv.adb, exp_ch7.ads: Minor reformatting. + + 2010-06-17 Robert Dewar + + * exp_ch9.adb, exp_disp.adb, exp_dist.adb: Use Make_Temporary. + + 2010-06-17 Thomas Quinot + + * sprint.adb (pg): Set Dump_Freeze_Null, to be consistent with -gnatdg. + + 2010-06-17 Robert Dewar + + * exp_ch6.adb, exp_ch7.adb, exp_ch5.adb: Use Make_Temporary + * tbuild.ads (Make_Temporary): More comment updates + * tbuild.adb: Minor reformatting + + 2010-06-17 Robert Dewar + + * checks.adb, exp_aggr.adb, exp_atag.adb, exp_attr.adb, exp_ch11.adb, + exp_ch3.adb, exp_ch4.adb: Minor code reorganization. + Use Make_Temporary. + * tbuild.ads, tbuild.adb (Make_Temporary): Clean up, use Entity_Id + instead of Node_Id. + (Make_Temporary): Add more extensive documentation + + 2010-06-17 Robert Dewar + + * sem_intr.adb, sem_prag.adb, sem_res.adb, sem_type.adb, sem_util.adb, + sem_warn.adb, sem_eval.adb: Minor reformatting. Use Ekind_In. + (Set_Slice_Subtype): Explicitly freeze the slice's itype at the point + where the slice's actions are inserted. + (Decompose_Expr): Account for possible rewriting of slice bounds + resulting from side effects suppression caused by the above freezing, + so that folding of bounds is preserved by such rewriting. + + 2010-06-17 Robert Dewar + + * einfo.ads, einfo.adb (Get_Record_Representation_Clause): New + function. + * freeze.adb (Freeze_Record_Type): Add call to + Check_Record_Representation_Clause. + * sem_ch13.adb (Check_Record_Representation_Clause): New function + (Analyze_Record_Representation_Clause): Split out overlap code into + this new function. + (Check_Component_Overlap): Moved inside + Check_Record_Representation_Clause. + * sem_ch13.ads (Check_Record_Representation_Clause): New function. + + 2010-06-17 Robert Dewar + + * back_end.adb, sem_res.adb, switch-c.adb, sem_scil.adb: Minor + reformatting. + * sem_attr.adb, sem_cat.adb, sem_disp.adb, sem_elab.adb, sem_elim.adb, + sem_eval.adb: Use Ekind_In + + 2010-06-17 Ed Schonberg + + * sem_ch8.adb: better error message for illegal inherited discriminant + + 2010-06-17 Vincent Celier + + * bindusg.adb: Remove lines for -A and -C + * gnat_ugn.texi: Remove all documentation and examples of switches -A + and -C for gnatbind and gnatlink. + * gnatlink.adb (Usage): Remove lines for -A and -C + * switch-b.adb (Scan_Binder_Switches): Issue warning when switch -C is + specified. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-17 Vincent Celier + + * back_end.adb (Scan_Compiler_Arguments): Put all arguments in new + local Argument_List variable Args. + * switch-c.adb (Scan_Front_End_Switches): New Argument_List argument + Args. + (Switch_Subsequently_Cancelled): New Argument_List argument Args. Look + for subsequent switches in Args. + * switch-c.ads (Scan_Front_End_Switches): New Argument_List argument + Args. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-17 Robert Dewar + + * einfo.adb: Minor code fix, allow E_Class_Wide_Type for + Equivalent_Type to match documentation. + + 2010-06-17 Robert Dewar + + * sem_ch6.adb, sem_ch7.adb: Minor reformatting. + * sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_ch10.adb, sem_ch12.adb, + sem_ch4.adb, sem_ch8.adb, sem_ch13.adb: Make use of Ekind_In. + + 2010-06-17 Thomas Quinot + + * sem_res.adb (Set_Slice_Subtype): Always freeze the slice's itype. + + 2010-06-17 Thomas Quinot + + * freeze.adb (Freeze_Expression): Short circuit operators are valid + freeze node insertion points. + + 2010-06-17 Robert Dewar + + * switch-c.ads, switch-c.adb, sem_ch13.adb: Minor reformatting. + * sem_ch12.adb: Add pragmas Assert and Check to previous change. + + 2010-06-17 Gary Dismukes + + * layout.adb (Layout_Type): Broaden test for setting an array type's + Component_Size to include all scalar types, not just discrete types + (components of real types were missed). + * sem_ch3.adb (Constrain_Index): Add missing setting of First_Literal + on the itype created for an index (consistent with Make_Index and + avoids possible Assert_Failures). + + 2010-06-17 Robert Dewar + + * atree.ads, atree.adb: Add 6-parameter version of Ekind_In + * einfo.adb: Minor code reformatting (use Ekind_In) + + 2010-06-17 Robert Dewar + + * sem_warn.adb (Test_Ref): Abandon scan if access subprogram parameter + found. + + 2010-06-17 Vincent Celier + + * back_end.adb: Minor comment updates + * switch-c.adb: Remove dependencies on gcc C sources + * gcc-interface/Make-lang.in: Add a-comlin.o to the object file list + for the compiler. + + 2010-06-17 Ed Schonberg + + * sem_ch12.adb: propagate Pragma_Enabled flag to generic. + * get_scos.adb: Set C2 flag in decision entry of pragma to 'e'. + * par_sco.ads, par_sco.adb (Set_SCO_Pragma_Enabled): New procedure + Remove use of Node field in SCOs table + (Output_Header): Set 'd' to initially disable pragma entry + * put_scos.adb (Put_SCOs): New flag indicating if pragma is enabled + * scos.ads, scos.adb: Remove Node field from internal SCOs table. + Use C2 field of pragma decision header to indicate enabled. + * sem_prag.adb: Add calls to Set_SCO_Pragma_Enabled. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-17 Vincent Celier + + * back_end.adb (Next_Arg): Moved to procedure Scan_Compiler_Arguments + (Scan_Compiler_Arguments): Call Scan_Front_End_Switches with Next_Arg + (Switch_Subsequently_Cancelled): Function moved to the body of Switch.C + * back_end.ads (Scan_Front_End_Switches): Function moved to the body of + Switch.C. + * switch-c.adb: Copied a number of global declarations from + back_end.adb. + (Len_Arg): New function copied from back_end.adb + (Switch_Subsequently_Cancelled): New function moved from back_end.adb + (Scan_Front_End_Switches): New parameter Arg_Rank used to call + Switch_Subsequently_Cancelled. + * switch-c.ads (Scan_Front_End_Switches): New parameter Arg_Rank. + * gcc-interface/Makefile.in: Add line so that shared libgnat is linked + with -lexc on Tru64. + + 2010-06-17 Robert Dewar + + * prj.ads, prj.adb: Minor reformatting + + 2010-06-17 Thomas Quinot + + * put_scos.adb: Do not generate a blank line in SCOs when omitting the + CP line for a disabled pragma. + + 2010-06-17 Emmanuel Briot + + * prj-proc.adb, prj.adb, prj.ads (Check_Or_Set_Typed_Variable): New + subprogram. + (Process_Declarative_Item): An invalid value in an typed variable + declaration is no longer always fatal. + + 2010-06-16 Arnaud Charlet + + * get_scos.adb, par_sco.adb, par_sco.ads, put_scos.adb, scos.adb, + scos.ads, exp_ch4.adb, sem_warn.adb: Code clean up, update + documentation. + + 2010-06-16 Javier Miranda + + * exp_disp.adb (Expand_Dispatching_Call): Adjust the decoration of the + node referenced by the SCIL node of dispatching "=" to skip the tags + comparison. + + 2010-06-16 Ed Schonberg + + * sem_ch5.adb (Analyze_Exit_Statement): Return if no enclosing loop, + to prevent cascaded errors and compilation aborts. + + 2010-06-16 Robert Dewar + + * back_end.adb (Switch_Subsequently_Cancelled): New function + Move declarations to package body level to support this change + * back_end.ads (Switch_Subsequently_Cancelled): New function + * gnat_ugn.texi: Document -gnat-p switch + * switch-c.adb (Scan_Front_End_Switches): Implement -gnat-p switch + * ug_words: Add entry for -gnat-p (UNSUPPRESS_ALL) + * usage.adb: Add line for -gnat-p switch + * vms_data.ads: Add entry for UNSUPPRESS_ALL (-gnat-p) + + 2010-06-16 Robert Dewar + + * sem_warn.adb (Check_Infinite_Loop_Warning): Declaration counts as + modification. + + 2010-06-16 Robert Dewar + + * exp_disp.adb: Minor reformatting + + 2010-06-16 Ed Schonberg + + * sem_ch3.adb (Complete_Private_Subtype): Inherit class_wide type from + base type only if it was not previously created for the partial view. + + 2010-06-16 Thomas Quinot + + * tbuild.ads: Minor comment fix + + 2010-06-15 Nathan Froyd + + * gcc-interface/trans.c (gnu_stack_free_list): Delete. + (gnu_except_ptr_stack): Change type to VEC. Update comment. + (gnu_elab_proc_stack): Likewise. + (gnu_return_label_stack): Likewise. + (gnu_loop_label_stack): Likewise. + (gnu_switch_label_stack): Likewise. + (gnu_constraint_label_stack): Likewise. + (gnu_storage_error_label_stack): Likewise. + (gnu_program_error_label_stack): Likewise. + (push_exception_label_stack): Take a VEC ** instead of a tree *. + (push_stack): Likewise. Remove unused second parameter. Update + callers. + (pop_stack): Take a VEC * instead of a tree *. Update callers. + (gigi): Initialize stacks as VECs. + (Identifier_to_gnu): Use VEC_last instead of TREE_VALUE. + (Case_Statement_to_gnu): Likewise. + (Subprogram_Body_to_gnu): Likewise. + (call_to_gnu): Likewise. + (Exception_Handler_to_gnu_sjlj): Likewise. + (gnat_to_gnu): Likewise. + (get_exception_label): Likewise. + + 2010-06-14 Ed Schonberg + + * sem_ch3.adb (Build_Derived_Record_Type): if derived type is an + anonymous base generated when the parent is a constrained discriminated + type, propagate interface list to first subtype because it may appear + in a current instance within the extension part of the derived type + declaration, and its own subtype declaration has not been elaborated + yet. + * exp_disp.adb (Build_Interface_Thunk): Use base type of formal to + determine whether it has the controlling type. + + 2010-06-14 Jerome Lambourg + + * exp_ch11.adb (Expand_N_Raise_Statement): Make sure that the explicit + raise of CE, SE and PE have the reason correctly set and are properly + expanded before stopping the expansions of .NET/JVM exceptions. + + 2010-06-14 Robert Dewar + + * opt.ads (Check_Policy_List): Add some clarifying comments + * sem_prag.adb (Analyze_Pragma, case Check): Set Pragma_Enabled flag + on rewritten Assert pragma. + + 2010-06-14 Gary Dismukes + + * sem_ch6.adb (Check_Overriding_Indicator): Add a special check for + controlled operations, so that they will be treated as overriding even + if the overridden subprogram is marked Is_Hidden, as long as the + overridden subprogram's parent subprogram is not hidden. + + 2010-06-14 Robert Dewar + + * debug.adb: Entry for gnatw.d no longer specific for while loops + * einfo.adb (First_Exit_Statement): New attribute for E_Loop + * einfo.ads (First_Exit_Statement): New attribute for E_Loop + * sem_ch5.adb (Analyze_Loop_Statement): Check_Infinite_Loop_Warning has + new calling sequence to include test for EXIT WHEN. + (Analyze_Exit_Statement): Chain EXIT statement into exit statement + chain + * sem_warn.ads, sem_warn.adb (Check_Infinite_Loop_Warning): Now handles + EXIT WHEN case. + * sinfo.adb (Next_Exit_Statement): New attribute of N_Exit_Statement + node. + * sinfo.ads (N_Pragma): Correct comment on Sloc field (points to + PRAGMA, not to pragma identifier). + (Next_Exit_Statement): New attribute of N_Exit_Statement node + + 2010-06-14 Robert Dewar + + * sem_res.adb (Resolve_Short_Circuit): Fix sloc of "assertion/check + would fail" msg. + + 2010-06-14 Robert Dewar + + * par-ch2.adb (Scan_Pragma_Argument_Association): Clarify message for + missing pragma argument identifier. + + 2010-06-14 Robert Dewar + + * atree.ads, atree.adb (Ekind_In): New functions. + + 2010-06-14 Robert Dewar + + * exp_ch4.adb (Expand_N_Op_Expon): Optimize 2**N in stand alone context + + 2010-06-14 Robert Dewar + + * usage.adb (Usage): Redo documentation of -gnatwa. + + 2010-06-14 Ed Schonberg + + * sem_ch8.adb (Find_Type): The attribute 'class cannot be applied to + an untagged incomplete type that is a limited view. + + 2010-06-14 Sergey Rybin + + * gnat_ugn.texi: Add description of '-cargs gcc_switches' to gnatstub + and gnatppa. + + 2010-06-14 Thomas Quinot + + * exp_ch4.adb (Expand_Short_Circuit_Operator): New subprogram, + factoring duplicated code between... + (Expand_N_And_Than, Expand_N_Or_Else): Remove duplicated code. + * a-envvar.ads: Minor reformatting + + 2010-06-14 Arnaud Charlet + + * ali.adb, ali.ads, lib-xref.ads: Document new '+' letter for C/C++ + static entities. + (Scan_ALI): Take into account new Visibility field. + (Visibility_Kind): New type. + (Xref_Entity_Record): Replace Lib field by Visibility. + + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-14 Pascal Obry + + * raise.h: Remove unused defintions. + + 2010-06-14 Bob Duff + + * par-ch10.adb (P_Subunit): If the next token after "separate(X)" is + Tok_Not or Tok_Overriding, call P_Subprogram. We had previously given + the incorrect error "proper body expected". + * par-ch6.adb (P_Subprogram): Suppress "overriding indicator not + allowed here" error in case of subunits, which was triggered by the + above change to P_Subunit. + + 2010-06-14 Sergey Rybin + + * gnat_ugn.texi, vms_data.ads: Update gnatelim doc. + + 2010-06-14 Thomas Quinot + + * lib-util.adb: Minor code reorganization. + + 2010-06-14 Robert Dewar + + * ali.adb (Scan_ALI): Implement reading and storing of N lines + (Known_ALI_Lines): Add entry for 'N' (notes) + * ali.ads (Notes): New table to store Notes information + * alloc.ads: Add entries for Notes table + * lib-util.adb (Write_Info_Int): New procedure + (Write_Info_Slit): New procedure + (Write_Info_Uint): New procedure + * lib-util.ads (Write_Info_Int): New procedure + (Write_Info_Slit): New procedure + (Write_Info_Uint): New procedure + * lib-writ.adb (Write_Unit_Information): Output N (notes) lines + * lib-writ.ads: Update documentation for N (Notes) lines + * lib.adb (Store_Note): New procedure + * lib.ads (Notes): New table + (Store_Note): New procedure + * sem_prag.adb: Call Store_Note for affected pragmas + + 2010-06-14 Thomas Quinot + + * socket.c: Fix wrong condition in #ifdef + * g-socket.adb, g-sothco.ads: Functions imported from socket.c that + take or return char* values can't use Interfaces.C.Strings.chars_ptr, + because on VMS this type is a 32-bit pointer which is not compatible + with the default for C pointers for code compiled with gcc on that + platform. + + 2010-06-14 Ed Schonberg + + * sem_util (Is_VMS_Operator): New predicate to determine whether an + operator is an intrinsic operator declared in the DEC system extension. + * sem_res.adb (Resolve_Logical_Op): operation is legal on signed types + if the operator is a VMS intrinsic. + * sem_eval.adb (Eval_Logical_Op): Operation is legal and be + constant-folded if the operands are signed and the operator is a VMS + intrinsic. + + 2010-06-14 Robert Dewar + + * g-socket.adb, gnatcmd.adb: Minor reformatting. + + 2010-06-14 Pascal Obry + + * s-finimp.adb: Fix typo. + * raise.h: Remove duplicate blank line. + + 2010-06-14 Vincent Celier + + * prj-nmsc.adb (Add_Sources): Always set the object file and the + switches file names, as the configuration of the language may change + in an extending project. + (Process_Naming_Scheme): For sources of projects that are extended, set + the configuration of the language from the highest extending project + where the language is declared. + + 2010-06-14 Gary Dismukes + + * sem_res.adb (Resolve_Call): For infinite recursion check, test + whether the called subprogram is inherited from a containing + subprogram. + (Same_Or_Aliased_Subprograms): New function + + 2010-06-14 Ed Schonberg + + * sem_ch8.adb (End_Use_Type): Before indicating that an operator is not + use-visible, check whether it is a primitive for more than one type. + + 2010-06-14 Robert Dewar + + * sem_ch3.adb (Copy_And_Swap): Copy Has_Pragma_Unmodified flag. + + * sem_ch7.adb (Preserve_Full_Attributes): Preserve + Has_Pragma_Unmodified flag. + + 2010-06-14 Thomas Quinot + + * g-sttsne-locking.adb, g-sttsne-locking.ads, g-sttsne.ads, + g-sttsne-vxworks.adb, g-sttsne-dummy.ads: Removed. Mutual exclusion is + now done in GNAT.Sockets if necessary. + * gsocket.h, g-socket.adb, g-sothco.ads (GNAT.Sockets.Get_XXX_By_YYY): + Ensure mutual exclusion for netdb operations if the target platform + requires it. + (GNAT.Sockets.Thin_Common): New binding for getXXXbyYYY, treating + struct hostent as an opaque type to improve portability. + * s-oscons-tmplt.c, socket.c: For the case of Vxworks, emulate + gethostbyYYY using proprietary VxWorks API so that a uniform interface + is available for the Ada side. + * gcc-interface/Makefile.in: Remove g-sttsne-* + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-14 Vincent Celier + + * gnatcmd.adb (Mapping_File): New function. + + 2010-06-14 Javier Miranda + + * sem_ch3.adb (Derive_Subprograms): Remove over-restrictive assertion. + + 2010-06-14 Arnaud Charlet + + * ali.adb: Fix typo. + * s-auxdec-vms-alpha.adb, scng.ads: Minor reformatting. + + 2010-06-14 Ed Schonberg + + * sem_ch12.adb: Make Mark_Context transitive, and apply to subprogram + instances. + + * sem_ch8.adb (Find_Expanded_Name): If a candidate compilation unit in + the context does not have a homonym of the selector, emit default + error message. + + 2010-06-14 Robert Dewar + + * sem.adb, sem_ch12.adb, sem_util.adb: Minor reformatting and + comment addition. + + 2010-06-14 Arnaud Charlet + + * lib-xref.ads: Doc updates: + - Allocate 'Q' for #include entity kind + - Free 'Z' + - Allocate 'g' for regular macros + - Allocate 'G' for function-like macros + + 2010-06-14 Ed Schonberg + + * sinfo.ads, sinfo.adb (Withed_Body): New attribute of a with_clause. + Indicates that there is an instantiation in the current unit that + loaded the body of the unit denoted by the with_clause. + * sem_ch12.adb (Mark_Context): When instanting a generic body, check + whether a with_clause in the current context denotes the unit that + holds the generic declaration, and mark the with_clause accordingly. + (Instantiate_Package_Body): call Mark_Context. + * sem.adb (Process_Bodies_In_Context): Use Withed_Body to determine + whether a given body should be traversed before the spec of the main + unit. + + 2010-06-14 Ed Falis + + * sysdep.c: Fix 653 build against vThreads headers. + + 2010-06-14 Robert Dewar + + * sinfo.ads: Minor reformatting. + + 2010-06-14 Ed Schonberg + + * sem_ch6.adb (Analyze_Subprogram_Body): Do not check conformance when + the spec has been generated for a body without spec that carries an + Inline_Always pragma. + + 2010-06-14 Arnaud Charlet + + * lib-xref.ads: Documentation change: allocate 'Z' letter to C/C++ + macro. + + 2010-06-14 Jerome Lambourg + + * exp_dbug.adb (Debug_Renaming_Declaration): Do not output any debug + declaration for VMs, as those are useless and might lead to duplicated + local variable names in the generated code. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-06-14 Robert Dewar + + * opt.ads, sem.adb, sem_elab.adb: Minor reformatting + + 2010-06-14 Robert Dewar + + * exp_aggr.adb (Has_Address_Clause): Moved to Exp_Util, and there it + is renamed as Has_Following_Address_Clause. + * exp_ch3.adb (Needs_Simple_Initialization): Add Consider_IS argument + to allow the caller to avoid Initialize_Scalars having an effect. + (Expand_N_Object_Declaration): Do not do Initialize_Scalars stuff for + scalars with an address clause specified. + * exp_ch3.ads (Needs_Simple_Initialization): Add Consider_IS argument + to allow the caller to avoid Initialize_Scalars having an effect. + * exp_util.adb (Has_Following_Address_Clause): Moved here from Exp_Aggr + (where it was called Has_Address_Clause). + * exp_util.ads (Has_Following_Address_Clause): Moved here from Exp_Aggr + (where it was called Has_Address_Clause). + * freeze.adb (Warn_Overlay): Suppress message about overlaying causing + problems for Initialize_Scalars (since we no longer initialize objects + with an address clause. + + 2010-06-14 Robert Dewar + + * exp_prag.adb (Expand_Pragma_Check): Set Loc of generated code from + condition. + + 2010-06-14 Gary Dismukes + + * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Set Debug_Info_Needed + on the entity of an implicitly generated postcondition procedure. + + 2010-06-14 Thomas Quinot + + * sem_ch7.adb (Preserve_Full_Attributes): Propagate + Discriminant_Constraint elist from full view to private view. + + 2010-06-14 Robert Dewar + + * sem_res.adb: Minor reformatting. + + 2010-06-14 Ed Schonberg + + * sem.adb: New version of unit traversal. + + * sem_elab.adb (Check_Internal_Call): Do not place a call appearing + within a generic unit in the table of delayed calls. + + 2010-06-14 Robert Dewar + + * gnatcmd.adb, sem_util.adb, exp_ch3.adb: Minor reformatting + + 2010-06-14 Ed Schonberg + + * sem_ch12.adb (Save_References): If an identifier has been rewritten + during analysis as an explicit dereference, keep the reference implicit + in the generic, but preserve the entity if global. This prevents + malformed generic trees in the presence of some nested generics. + + 2010-06-14 Sergey Rybin + + * gnat_ugn.texi: For the GNAT driver, clarify the effect of calling the + tool with '-files=' option. Also fix some small errors (wrong brackets) + + 2010-06-14 Vincent Celier + + * gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all + the ALI files on the command line. + + * ali.adb (Scan_ALI): Set component Directly_Scanned of the unit(s) to + the same value as the parameter of the same name. + * ali.ads (Scan_ALI): New Boolean parameter Directly_Scanned, defaulted + to False. + * bindgen.adb (Gen_Versions_Ada): Never emit version symbols for + Stand-Alone Library interfaces. When binding Stand-Alone Libraries, + emit version symbols only for the units of the library. + (Gen_Versions_C): Ditto. + + 2010-06-14 Gary Dismukes + + * sem_ch4.adb: Fix typo. + + 2010-06-14 Vasiliy Fofanov + + * s-oscons-tmplt.c (IOV_MAX): redefine on Tru64 and VMS since the + vector IO doesn't work at default value properly. + + 2010-06-14 Doug Rupp + + * s-stoele.adb: Remove unnecessary qualification of To_Address for VMS. + + 2010-06-14 Vincent Celier + + * gnatcmd.adb (Check_Files): Do not invoke the tool with all the + sources of the project if a switch -files= is used. + + 2010-06-14 Thomas Quinot + + * exp_attr.adb: Minor reformatting. + + 2010-06-14 Gary Dismukes + + * gnat_ugn.texi: Minor typo fixes and wording changes. + + 2010-06-14 Ed Schonberg + + * sem_ch4.adb (Analyze_One_Call): If the call has been rewritten from a + prefixed form, do not re-analyze first actual, which may need an + implicit dereference. + * sem_ch6.adb (Analyze_Procedure_Call): If the call is given in + prefixed notation, the analysis will rewrite the node, and possible + errors appear in the rewritten name of the node. + * sem_res.adb: If a call is ambiguous because its first parameter is + an overloaded call, report list of candidates, to clarify ambiguity of + enclosing call. + + 2010-06-14 Doug Rupp + + * s-auxdec-vms-alpha.adb: New package body implementing legacy + VAX instructions with Asm insertions. + * s-auxdec-vms_64.ads: Inline VAX queue functions + * s-stoele.adb: Resolve some ambiguities in To_Addresss with s-suxdec + that show up only on VMS. + * gcc-interface/Makefile.in: Provide translation for + s-auxdec-vms-alpha.adb. + + 2010-06-14 Olivier Hainque + + * initialize.c (VxWorks section): Update comments. + + 2010-06-14 Robert Dewar + + * a-convec.adb, sem_prag.adb, checks.adb: Minor reformatting. + + 2010-06-14 Eric Botcazou + + * init.c: Code clean up. + + 2010-06-14 Ed Schonberg + + * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case Address): Do + not insert address clause in table for later validation if type of + entity is generic, to prevent possible spurious errors. + + * sem_ch8.adb: Code clean up. + + 2010-06-14 Ben Brosgol + + * gnat_ugn.texi: Expanded @ovar macro inline to solve problem with + texi2pdf and texi2html. + Document how to change scheduling properties on HP-UX. + + 2010-06-14 Thomas Quinot + + * g-socket.ads: Remove misleading comments. + + 2010-06-14 Jerome Lambourg + + * sem_prag.adb (Check_Duplicated_Export_Name): Remove check for + CLI_Target as this prevents proper detection of exported names + duplicates when the exported language is different to CIL. + (Process_Interface_Name): Add check for CIL convention exports, + replacing the old one from Check_Duplicated_Export_Name. + + 2010-06-14 Matthew Heaney + + * a-coinve.adb, a-convec.adb (operator "&"): Check both that new length + and new last satisfy constraints. + (Delete_Last): prevent overflow for subtraction of index values + (To_Vector): prevent overflow for addition of index values + + 2010-06-14 Ed Schonberg + + * sem_ch4.adb (Complete_Object_Operation): After analyzing the + rewritten call, preserve the resulting type to prevent spurious errors, + when the call is implicitly dereferenced in the context of an in-out + actual. + + * checks.adb (Apply_Discriminant_Check): If the target of the + assignment is a renaming of a heap object, create constrained type for + it to apply check. + + 2010-06-14 Pascal Obry + + * prj-proc.adb: Fix copy of object directory for extending projects. + + 2010-06-14 Jose Ruiz + + * init.c (__gnat_alternate_stack): Define this space for PowerPC linux + (__gnat_install_handler, PowerPC linux): Activate the alternative + signal stack. + + 2010-06-13 Gerald Pfeifer + + * gnat_rm.texi: Move to GFDL version 1.3. + * gnat-style.texi: Ditto. + * gnat_ugn.texi: Ditto. + + 2010-06-12 Kai Tietz + + PR ada/43731 + * gcc-interface/Makefile.in: Add rules for multilib x86/x64 + mingw targets. + + 2010-06-11 Alexandre Oliva + + * gcc-interface/utils.c (update_pointer_to): Initialize last. + + 2010-06-09 Eric Botcazou + + * gcc-interface/ada-tree.h: Fix formatting nits. + + 2010-06-08 Laurynas Biveinis + + * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC + allocation. + (init_dummy_type): Likewise. + (gnat_pushlevel): Likewise. + + * gcc-interface/trans.c (Attribute_to_gnu): Likewise. + (Subprogram_Body_to_gnu): Likewise. + (Compilation_Unit_to_gnu): Likewise. + (start_stmt_group): Likewise. + (extract_encoding): Likewise. + (decode_name): Likewise. + + * gcc-interface/misc.c (gnat_printable_name): Likewise. + + * gcc-interface/decl.c (annotate_value): Likewise. + + * gcc-interface/ada-tree.h (struct lang_type): Add variable_size + GTY option. + (struct lang_decl): Likewise. + (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation. + (SET_DECL_LANG_SPECIFIC): Likewise. + + 2010-06-04 Eric Botcazou + + * gnatlink.adb (gnatlink): Remove support for -fsjlj switch. + * gcc-interface/lang-specs.h: Likewise. + + 2010-06-03 H.J. Lu + + PR c++/44294 + * gcc-interface/decl.c (MAX_FIXED_MODE_SIZE): Removed. + + 2010-06-01 Arnaud Charlet + + * gnat_ugn.texi: Improve doc on -fdump-ada-spec, mention limitations. + + 2010-05-30 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Reuse the + TYPE_DECL of the equivalent type instead of building a new one. + + 2010-05-30 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust warning message. + Fix nits in comments. + * gcc-interface/misc.c (gnat_init_gcc_eh): Likewise. + * gcc-interface/trans.c (gigi): Likewise. + (Attribute_to_gnu): Likewise. + (Case_Statement_to_gnu): Likewise. + (gnat_to_gnu): Adjust warning message. + * gcc-interface/utils.c (create_var_decl_1): Fix nits in comments. + (build_vms_descriptor32): Likewise. + + 2010-05-27 Steven Bosscher + + * gcc-interface/decl.c: Pretend to be a backend file by undefining + IN_GCC_FRONTEND (still need rtl.h here). + + 2010-05-26 Steven Bosscher + + * gcc-interface/trans.c: Do not include rtl.h, insclude libfuncs.h. + (gigi): Adjust call to set_stack_check_libfunc. + + 2010-05-26 Steven Bosscher + + * gcc-interface/utils.c: Do not include rtl.h. + + 2010-05-25 Steven Bosscher + + * gcc-interface/utils.c: Do not include function.h, pointer-set.h, + and gimple.h. Explain why rtl.h has to be included. + (handle_vector_size_attribute): Call reconstruct_complex_type directly. + * gcc-interface/targtyps.c: Do not include tm_p.h + * gcc-interface/utils2.c: Do not include flags.h. + * gcc-interface/trans.c: Do not include expr.h. Include rtl.h instead, + and explain why it has to be included. + * gcc-interface/misc.c: Do not include expr.h, libfuncs.h, cgraph.h, + and optabs.h. + Include function.h and explain why. Explain why except.h is included. + (enumerate_modes): Remove unused function. + * gcc-interface/gigi.h (enumerate_modes): Remove prototype. + * gcc-interface/Make-lang.in: Update dependencies. + + 2010-05-25 Joseph Myers + + * gcc-interface/misc.c (internal_error_function): Add context + parameter. Use it to access show_column flag and instead of using + global_dc. Call warn_if_plugins. + * gcc-interface/Make-lang.in (ada/misc.o): Update dependencies. + + 2010-05-19 Eric Botcazou + + * gcc-interface/misc.c (LANG_HOOKS_DEEP_UNSHARING): Redefine. + * gcc-interface/trans.c (unshare_save_expr): Delete. + (gigi): Do not unshare trees under SAVE_EXPRs here. + + 2010-05-18 Nathan Froyd + + * gcc-interface/trans.c (call_to_gnu): Use build_call_vec instead of + build_call_list. + * gcc-interface/utils.c (build_function_stub): Likewise. + + 2010-05-16 Manuel López-Ibáñez + + * gcc-interface/misc.c (gnat_handle_option): Remove special logic + for Wuninitialized without -O. + + 2010-05-16 Eric Botcazou + + * gcc-interface/gigi.h (enum standard_datatypes): Add new value + ADT_exception_data_name_id. + (exception_data_name_id): New define. + * gcc-interface/trans.c (gigi): Initialize it. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Use the standard + exception type for standard exception definitions. Do not make them + volatile. + : Equate fields of types associated with an exception + definition to those of the standard exception type. + + 2010-05-13 Andreas Schwab + + * tracebak.c (__gnat_backtrace): Mark top_stack with ATTRIBUTE_UNUSED. + + 2010-05-12 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Tidy up + code, improve comments and fix formatting nits. + + 2010-05-12 Eric Botcazou + + * gcc-interface/utils.c (update_pointer_to): Return early if the old + pointer already points to the new type. Chain the old pointer and its + variants at the end of new pointer's chain after updating them. + + 2010-05-10 Eric Botcazou + + * exp_disp.adb (Make_Tags): Mark the imported view of dispatch tables + built for interfaces. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Use + imported_p instead of Is_Imported when considering constants. + Do not promote alignment of exported objects. + : Strip all suffixes for dispatch table entities. + + 2010-05-08 Eric Botcazou + + * exp_disp.adb (Make_Tags): Mark the imported view of dispatch tables. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Make imported + constants really constant. + : Strip the suffix for dispatch table entities. + + 2010-05-08 Eric Botcazou + + * gcc-interface/decl.c (make_aligning_type): Declare the type. + + 2010-05-08 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity): Create variables for size + expressions of variant part of record types declared at library level. + + 2010-05-08 Eric Botcazou + + * gcc-interface/gigi.h (create_field_decl): Move PACKED parameter. + * gcc-interface/utils.c (create_field_decl): Move PACKED parameter. + (rest_of_record_type_compilation): Adjust call to create_field_decl. + (make_descriptor_field): Likewise and pass correctly typed constants. + (build_unc_object_type): Likewise. + (unchecked_convert): Likewise. + * gcc-interface/decl.c (elaborate_expression_2): New static function. + (gnat_to_gnu_entity): Use it to make alignment factors explicit. + Adjust call to create_field_decl. + (make_aligning_type): Likewise. + (make_packable_type): Likewise. + (maybe_pad_type): Likewise. + (gnat_to_gnu_field): Likewise. + (components_to_record): Likewise. + (create_field_decl_from): Likewise. + (create_variant_part_from): Remove superfluous test. + * gcc-interface/trans.c (gigi): Adjust call to create_field_decl. + + 2010-05-08 Eric Botcazou + + * gcc-interface/gigi.h (build_unc_object_type): Add DEBUG_INFO_P param. + (build_unc_object_type_from_ptr): Likewise. + * gcc-interface/utils.c (build_unc_object_type): Add DEBUG_INFO_P param + and pass it to create_type_decl. Declare the type. Simplify. + (build_unc_object_type_from_ptr): Add DEBUG_INFO_P parameter and pass + it to build_unc_object_type. + * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust to above change. + * gcc-interface/trans.c (Attribute_to_gnu): Likewise. + (gnat_to_gnu): Likewise. + * gcc-interface/utils2.c (build_allocator): Likewise. + + 2010-05-07 Eric Botcazou + + PR 40989 + * gcc-interface/misc.c (gnat_handle_option): Fix long line. + + 2010-05-06 Rainer Orth + + * gcc-interface/Makefile.in: Removed mips-sgi-irix5* support. + + 2010-05-06 Manuel López-Ibáñez + + PR 40989 + * gcc-interface/misc.c (gnat_handle_option): Add argument kind. + + 2010-05-02 Giuseppe Scrivano + + * gnathtml.pl: Use 755 as mask for new directories. + + 2010-04-28 Eric Botcazou + + * gcc-interface/trans.c (gnat_gimplify_expr) : Uniquize + constant constructors before taking their address. + + 2010-04-25 Eric Botcazou + + * exp_dbug.ads: Fix outdated description. Mention link between XVS + and XVZ objects. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Set + XVZ variable as unit size of XVS type. + (maybe_pad_type): Likewise. + + 2010-04-25 Eric Botcazou + + * gcc-interface/trans.c (gnat_to_gnu) : Do not + use memmove if the array type is bit-packed. + + 2010-04-18 Eric Botcazou + + * gcc-interface/misc.c (gnat_init): Remove second argument in call to + build_common_tree_nodes. + + 2010-04-18 Ozkan Sezer + + * gsocket.h: Make sure that winsock2.h is included before windows.h. + + 2010-04-17 Eric Botcazou + + * gcc-interface/utils2.c (build_unary_op) : Do not + issue warning. + + 2010-04-17 Eric Botcazou + + * uintp.h (UI_Lt): Declare. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Do the size + computation in sizetype. + : Use unified handling for all index types. Do not + generate MAX_EXPR-based expressions, only COND_EXPR-based ones. Add + bypass for PATs. + (annotate_value): Change test for negative values. + (validate_size): Apply test for negative values on GNAT nodes. + (set_rm_size): Likewise. + * gcc-interface/misc.c (gnat_init): Set unsigned types for sizetypes. + * gcc-interface/utils.c (rest_of_record_type_compilation): Change test + for negative values. + (max_size) : Do not reassociate a COND_EXPR on the LHS. + (builtin_type_for_size): Adjust definition of signed_size_type_node. + * gcc-interface/utils2.c (compare_arrays): Optimize comparison of + lengths against zero. + + 2010-04-17 Eric Botcazou + + * back-end.adb (Call_Back_End): Pass Standard_Character to gigi. + * gcc-interface/gigi.h (gigi): Add standard_character parameter. + (CHAR_TYPE_SIZE, SHORT_TYPE_SIZE, INT_TYPE_SIZE, LONG_TYPE_SIZE, + LONG_LONG_TYPE_SIZE, FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE, + LONG_DOUBLE_TYPE_SIZE, SIZE_TYPE): Delete. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Call + rm_size. + * gcc-interface/misc.c (gnat_init): Set signedness of char as per + flag_signed_char. Tag sizetype with "size_type" moniker. + * gcc-interface/trans.c (gigi): Add standard_character parameter. + Remove useless built-in types. Equate unsigned_char_type_node to + Standard.Character. Use it instead of char_type_node throughout. + (Attribute_to_gnu): Likewise. + (gnat_to_gnu): Likewise. + * gcc-interface/utils2.c (build_call_raise): Likewise. + + 2010-04-17 Eric Botcazou + + * gcc-interface/gigi.h (enum standard_datatypes): Add new values + ADT_sbitsize_one_node and ADT_sbitsize_unit_node. + (sbitsize_one_node): New macro. + (sbitsize_unit_node): Likewise. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Fix + latent bug in the computation of subrange_p. Fold wider_p predicate. + (cannot_be_superflat_p): Use an explicitly signed 64-bit type to do + the final comparison. + (make_aligning_type): Build real negation and use sizetype throughout + the offset computation. + (maybe_pad_type): Do not issue the warning when the new size expression + is too complex. + (annotate_value) : Simplify code handling negative values. + * gcc-interface/misc.c (gnat_init): Initialize sbitsize_one_node and + sbitsize_unit_node. + * gcc-interface/trans.c (Attribute_to_gnu) : Fold + double negation. + (gnat_to_gnu) : Likewise. + * gcc-interface/utils.c (convert): Use sbitsize_unit_node. + * gcc-interface/utils2.c (compare_arrays): Compute real lengths and use + constants in sizetype. Remove dead code and tweak comments. Generate + equality instead of inequality comparisons for zero length tests. + + 2010-04-16 Eric Botcazou + + * gcc-interface/gigi.h (gnat_init_decl_processing): Delete. + * gcc-interface/decl.c (gnat_to_gnu_entity): Constify a few variables. + : Do not create the fake PARM_DECL if no debug info is needed. + Do not create the corresponding VAR_DECL of a CONST_DECL for debugging + purposes if no debug info is needed. + Fix formatting. Reorder and add comments. + * gcc-interface/trans.c (gnat_to_gnu) : Constify + variable and remove obsolete comment. + * gcc-interface/utils.c (convert_vms_descriptor64): Tweak comment. + (convert_vms_descriptor32): Likewise. + (convert): Remove dead code. + : Pass the field instead of its name to build + the reference to the P_ARRAY pointer. + : Likewise. + (maybe_unconstrained_array) : Likewise. + (gnat_init_decl_processing): Delete, move contents to... + * gcc-interface/misc.c (gnat_init): ...here. + + 2010-04-16 Eric Botcazou + + * gcc-interface/trans.c (unchecked_conversion_nop): Handle function + calls. Return true for conversion from a record subtype to its type. + + 2010-04-16 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity): Use boolean_type_node in + lieu of integer_type_node for boolean operations. + (choices_to_gnu): Likewise. + * gcc-interface/trans.c (Attribute_to_gnu): Likewise. + (Loop_Statement_to_gnu): Likewise. + (establish_gnat_vms_condition_handler): Likewise. + (Exception_Handler_to_gnu_sjlj): Likewise. + (gnat_to_gnu): Likewise. + (build_unary_op_trapv): Likewise. + (build_binary_op_trapv): Likewise. + (emit_range_check): Likewise. + (emit_index_check): Likewise. + (convert_with_check): Likewise. + * gcc-interface/utils.c (convert_vms_descriptor64): Likewise. + (convert_vms_descriptor32): Likewise. + (convert_vms_descriptor): Likewise. + * gcc-interface/utils2.c (nonbinary_modular_operation): Likewise. + (compare_arrays): Use boolean instead of integer constants. + (build_binary_op) : New case. Check that the result type + is a boolean type. + : Remove obsolete assertion. + : Check that the result type is a boolean type. + : Delete. + : Check that the result type is a boolean type. + (build_unary_op): Use boolean_type_node in lieu of integer_type_node + for boolean operations. + (fill_vms_descriptor): Likewise. Fix formatting nits. + + 2010-04-16 Eric Botcazou + + * gcc-interface/ada-tree.def (LOOP_STMT): Change to 4-operand nodes. + * gcc-interface/ada-tree.h (LOOP_STMT_TOP_COND, LOOP_STMT_BOT_COND): + Merge into... + (LOOP_STMT_COND): ...this. + (LOOP_STMT_BOTTOM_COND_P): New flag. + (LOOP_STMT_TOP_UPDATE_P): Likewise. + * gcc-interface/trans.c (can_equal_min_or_max_val_p): New function. + (can_equal_min_val_p): New static inline function. + (can_equal_max_val_p): Likewise. + (Loop_Statement_to_gnu): Use build4 in lieu of build5 and adjust to + new LOOP_STMT semantics. Use two different strategies depending on + whether optimization is enabled to translate the loop. + (gnat_gimplify_stmt) : Adjust to new LOOP_STMT semantics. + + 2010-04-16 Eric Botcazou + + * uintp.adb (UI_From_Dint): Remove useless code. + (UI_From_Int): Likewise. + * uintp.h: Reorder declarations. + (UI_From_gnu): Declare. + (UI_Base): Likewise. + (Vector_Template): Likewise. + (Vector_To_Uint): Likewise. + (Uint_0): Remove. + (Uint_1): Likewise. + * gcc-interface/gigi.h: Tweak comments. + * gcc-interface/cuintp.c (UI_From_gnu): New global function. + * gcc-interface/decl.c (maybe_pad_type): Do not warn if either size + overflows. + (annotate_value) : Call UI_From_gnu. + * gcc-interface/trans.c (post_error_ne_num): Call post_error_ne. + (post_error_ne_tree): Call UI_From_gnu and post_error_ne. + * gcc-interface/utils.c (max_size) : Do not special-case + TYPE_MAX_VALUE. + + 2010-04-16 Eric Botcazou + + * gcc-interface/decl.c (make_type_from_size) : Just copy + TYPE_NAME. + * gcc-interface/trans.c (smaller_packable_type_p): Rename into... + (smaller_form_type_p): ...this. Change parameter and variable names. + (call_to_gnu): Use the nominal type of the parameter to create the + temporary if it's a smaller form of the actual type. + (addressable_p): Return false if the actual type is integral and its + size is greater than that of the expected type. + + 2010-04-15 Eric Botcazou + + * gcc-interface/cuintp.c (UI_To_gnu): Fix long line. + * gcc-interface/gigi.h (MARK_VISITED): Skip objects of constant class. + (process_attributes): Delete. + (post_error_ne_num): Change parameter name. + * gcc-interface/decl.c (gnat_to_gnu_entity): Do not force debug info + with -g3. Remove a couple of obsolete lines. Minor tweaks. + If type annotating mode, operate on trees to compute the adjustment to + the sizes of tagged types. Fix long line. + (cannot_be_superflat_p): Tweak head comment. + (annotate_value): Fold local constant. + (set_rm_size): Fix long line. + * gcc-interface/trans.c (Identifier_to_gnu): Rework comments. + (Attribute_to_gnu): Fix long line. + : Remove useless assertion. + Reorder statements. Use size_binop routine. + (Loop_Statement_to_gnu): Use build5 in lieu of build_nt. + Create local variables for the label and the test. Tweak comments. + (Subprogram_Body_to_gnu): Reset cfun to NULL. + (Compilation_Unit_to_gnu): Use the Sloc of the Unit node. + (process_inlined_subprograms): Integrate into... + (Compilation_Unit_to_gnu): ...this. + (gnat_to_gnu): Fix long line. + (post_error_ne_num): Change parameter name. + * gcc-interface/utils.c (process_attributes): Static-ify. + : Set input_location before proceeding. + (create_type_decl): Add comment. + (create_var_decl_1): Process the attributes after adding the VAR_DECL + to the current binding level. + (create_subprog_decl): Likewise for the FUNCTION_DECL. + (end_subprog_body): Do not reset cfun to NULL. + (build_vms_descriptor32): Fix long line. + (build_vms_descriptor): Likewise. + (handle_nonnull_attribute): Likewise. + (convert_vms_descriptor64): Likewise. + * gcc-interface/utils2.c (fill_vms_descriptor): Fix long line. + (gnat_protect_expr): Fix thinko. + + 2010-04-15 Eric Botcazou + + * gcc-interface/trans.c (gigi): Set DECL_IGNORED_P on EH functions. + (gnat_to_gnu) : Restore the value of input_location + before translating the top-level node. + (lvalue_required_p) : Return 1 if !constant. + : Likewise. + : Likewise. + : Likewise. + (call_to_gnu): Remove kludge. + (gnat_to_gnu) : When not optimizing, force labels + associated with user returns to be preserved. + (gnat_to_gnu): Add special code to deal with boolean rvalues. + * gcc-interface/utils2.c (compare_arrays): Set input_location on all + comparisons. + (build_unary_op) : Call build_fold_addr_expr. + : Call build_fold_indirect_ref. + + 2010-04-15 Joel Sherrill + + * g-socket.adb: A target can have multiple missing errno's. This + will result in multiple errno's being defined as -1. Because of this + we can not use a case but must use a series of if's to avoid + a duplicate case error in GNAT.Sockets.Resolve_Error. + + 2010-04-15 Eric Botcazou + + * gcc-interface/trans.c (call_to_gnu): Open a nesting level if this is + a statement. Otherwise, if at top-level, push the processing of the + elaboration routine. In the misaligned case, issue the error messages + again on entry and create the temporary explicitly. Do not issue them + for CONSTRUCTORs. + For a function call, emit the range check if necessary. + In the copy-in copy-out case, create the temporary for the return + value explicitly. + Do not unnecessarily convert by-ref parameters to the formal's type. + Remove obsolete guards in conditions. + (gnat_to_gnu) : For a function call, pass the + target to call_to_gnu in all cases. + (gnat_gimplify_expr) : Remove handling of SAVE_EXPR. + (addressable_p) : Return false if not static. + : New case. + * gcc-interface/utils2.c (build_unary_op) : Fold a compound + expression if it has unconstrained array type. + (gnat_mark_addressable) : New case. + (gnat_stabilize_reference) : Stabilize operands on an + individual basis. + + 2010-04-15 Eric Botcazou + + * gcc-interface/trans.c (gigi): Do not start statement group. + (Compilation_Unit_to_gnu): Set current_function_decl to NULL. + Start statement group and push binding level here... + (gnat_to_gnu) : ...and not here. + Do not push fake contexts at top level. Remove redundant code. + (call_to_gnu): Rename a local variable and constify another. + * gcc-interface/utils.c (gnat_pushlevel): Fix formatting nits. + (set_current_block_context): Set it as the group's block. + (gnat_init_decl_processing): Delete unrelated init code. + (end_subprog_body): Use NULL_TREE. + + 2010-04-15 Eric Botcazou + + * gcc-interface/trans.c (call_to_gnu): Do not unnecessarily force + side-effects of actual parameters before the call. + + 2010-04-15 Eric Botcazou + + * gcc-interface/decl.c (validate_size): Reorder, remove obsolete test + and warning. + (set_rm_size): Reorder and remove obsolete test. + + 2010-04-14 Eric Botcazou + + * gcc-interface/gigi.h: Reorder declarations and tweak comments. + (gigi): Adjust ATTRIBUTE_UNUSED markers. + * gcc-interface/gadaint.h: New file. + * gcc-interface/trans.c: Include it in lieu of adaint.h. Reorder. + (__gnat_to_canonical_file_spec): Remove declaration. + (number_names): Delete. + (number_files): Likewise. + (gigi): Adjust. + * gcc-interface/Make-lang.in (ada/trans.o): Adjust dependencies to + above change. + + 2010-04-14 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Fix + comment. + * gcc-interface/trans.c (process_freeze_entity): Use local copy of + Ekind. Return early for class-wide types. Do not compute initializer + unless necessary. Reuse the tree for an associated class-wide type + only if processing its root type. + + 2010-04-13 Joel Sherrill + + * gsocket.h: Run-time can no longer be built without network + OS headers available. Changing RTEMS GNAT build procedure to + reflect this and letting run-time build use network .h files. + + 2010-04-13 Duncan Sands + + * gcc-interface/misc.c (gnat_eh_type_covers): Remove. + * gcc-interface/trans.c (Exception_Handler_to_gnu_zcx): Update comment. + + 2010-04-13 Eric Botcazou + + * gcc-interface/gigi.h (standard_datatypes): Add ADT_parent_name_id. + (parent_name_id): New macro. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Use it. + * gcc-interface/trans.c (gigi): Initialize it. + (lvalue_required_p) : New case. + : Likewise. + : Likewise. + * gcc-interface/utils.c (convert): Try to properly upcast tagged types. + + 2010-04-13 Eric Botcazou + + * gcc-interface/ada-tree.h (TYPE_BY_REFERENCE_P): Delete. + (DECL_CONST_ADDRESS_P): New macro. + (SET_DECL_ORIGINAL_FIELD_TO_FIELD): Likewise. + (SAME_FIELD_P): Likewise. + * gcc-interface/decl.c (constructor_address_p): New static function. + (gnat_to_gnu_entity) : Set DECL_CONST_ADDRESS_P according to + the return value of above function. + (gnat_to_gnu_entity) : Force BLKmode for all types + passed by reference. + : Likewise. + Set TREE_ADDRESSABLE on the type if it passed by reference. + (make_packable_type): Use SET_DECL_ORIGINAL_FIELD_TO_FIELD. + (create_field_decl_from): Likewise. + (substitute_in_type): Likewise. + (purpose_member_field): Use SAME_FIELD_P. + * gcc-interface/misc.c (must_pass_by_ref): Test TREE_ADDRESSABLE. + * gcc-interface/trans.c (lvalue_required_p): Add ADDRESS_OF_CONSTANT + parameter and adjust recursive calls. + : New case. + : Return 1 if the object is of a class-wide type. + Adjust calls to lvalue_required_p. Do not return the initializer of a + DECL_CONST_ADDRESS_P constant if an lvalue is required for it. + (call_to_gnu): Delay issuing error message for a misaligned actual and + avoid the associated back-end assertion. Test TREE_ADDRESSABLE. + (gnat_gimplify_expr) : Handle non-static constructors. + * gcc-interface/utils.c (make_dummy_type): Set TREE_ADDRESSABLE if the + type is passed by reference. + (convert) : Convert in-place in more cases. + * gcc-interface/utils2.c (build_cond_expr): Drop TYPE_BY_REFERENCE_P. + (build_simple_component_ref): Use SAME_FIELD_P. + + 2010-04-12 Eric Botcazou + + * gcc-interface/trans.c (Identifier_to_gnu): Use boolean variable. + (call_to_gnu): Test gigi's flag TYPE_BY_REFERENCE_P instead of calling + front-end's predicate Is_By_Reference_Type. Use consistent order and + remove ??? comment. Use original conversion in all cases, if any. + * gcc-interface/utils.c (make_dummy_type): Minor tweak. + (convert): Use local copy in more cases. + : Remove deactivated code. + (unchecked_convert): Use a couple of local copies. + + 2010-04-11 Eric Botcazou + + * gcc-interface/trans.c (lvalue_required_for_attribute_p): New static + function. + (lvalue_required_p) : Call it. + (gnat_to_gnu) : Prevent build_component_ref from + folding the result only if lvalue_required_for_attribute_p is true. + * gcc-interface/utils.c (maybe_unconstrained_array): Pass correctly + typed constant to build_component_ref. + (unchecked_convert): Likewise. + * gcc-interface/utils2.c (maybe_wrap_malloc): Likewise. + (build_allocator): Likewise. + + 2010-04-11 Eric Botcazou + + * gcc-interface/utils2.c (build_cond_expr): Take the address and + dereference if the result type is passed by reference. + + 2010-04-11 Eric Botcazou + + * gcc-interface/trans.c (Case_Statement_to_gnu): Bool-ify variable. + (gnat_to_gnu) : When not optimizing, generate a + goto to the next statement. + + 2010-04-09 Eric Botcazou + + * gcc-interface/gigi.h (maybe_variable): Delete. + (protect_multiple_eval): Likewise. + (maybe_stabilize_reference): Likewise. + (gnat_save_expr): Declare. + (gnat_protect_expr): Likewise. + (gnat_stabilize_reference): Likewise. + * gcc-interface/decl.c (gnat_to_gnu_entity) : Use + gnat_stabilize_reference. + (maybe_variable): Delete. + (elaborate_expression_1): Use gnat_save_expr. + * gcc-interface/trans.c (Attribute_to_gnu): Use gnat_protect_expr. + (call_to_gnu): Pass NULL to gnat_stabilize_reference. + (gnat_to_gnu) : Use gnat_save_expr. + : Use gnat_protect_exp. + : Pass NULL to gnat_stabilize_reference. + : Use gnat_protect_expr. + Pass NULL to gnat_stabilize_reference. + (build_unary_op_trapv): Use gnat_protect_expr. + (build_binary_op_trapv): Likewise. + (emit_range_check): Likewise. + (emit_index_check): Likewise. + (convert_with_check): Likewise. + (protect_multiple_eval): Move to utils2.c file. + (maybe_stabilize_reference): Merge into... + (gnat_stabilize_reference): ...this. Move to utils2.c file. + (gnat_stabilize_reference_1): Likewise. + * gcc-interface/utils.c (convert_to_fat_pointer): Use gnat_protect_expr + instead of protect_multiple_eval. + * gcc-interface/utils2.c (compare_arrays): Likewise. + (nonbinary_modular_operation): Likewise. + (maybe_wrap_malloc): Likewise. + (build_allocator): Likewise. + (gnat_save_expr): New function. + (gnat_protect_expr): Rename from protect_multiple_eval. Early return + in common cases. Propagate TREE_READONLY onto dereferences. + (gnat_stabilize_reference_1): Move from trans.c file. + (gnat_stabilize_reference): Likewise. + + 2010-04-09 Eric Botcazou + + * gcc-interface/gigi.h (gnat_mark_addressable): Rename parameter. + * gcc-interface/decl.c (maybe_variable): Do not set TREE_STATIC on _REF + node. Use the type of the operand to set TREE_READONLY. + * gcc-interface/trans.c (Identifier_to_gnu): Do not set TREE_STATIC on + _REF node. Do not overwrite TREE_READONLY. + (call_to_gnu): Rename local variable and fix various nits. In the + copy-in/copy-out case, build the SAVE_EXPR manually. + (convert_with_check): Call protect_multiple_eval in lieu of save_expr + and fold the computations. + (protect_multiple_eval): Always save entire fat pointers. + (maybe_stabilize_reference): Minor tweaks. + (gnat_stabilize_reference_1): Likewise. Do not deal with tcc_constant, + tcc_type and tcc_statement. + * gcc-interface/utils.c (convert_to_fat_pointer): Call + protect_multiple_eval in lieu of save_expr. + (convert): Minor tweaks. + (maybe_unconstrained_array): Do not set TREE_STATIC on _REF node. + (builtin_type_for_size): Call gnat_type_for_size directly. + * gcc-interface/utils2.c (contains_save_expr_p): Delete. + (contains_null_expr): Likewise + (gnat_build_constructor): Do not call it. + (compare_arrays): Deal with all side-effects, use protect_multiple_eval + instead of gnat_stabilize_reference to protect the operands. + (nonbinary_modular_operation): Call protect_multiple_eval in lieu of + save_expr. + (maybe_wrap_malloc): Likewise. + (build_allocator): Likewise. + (build_unary_op) : Do not set TREE_STATIC on _REF node. + (gnat_mark_addressable): Rename parameter. + + 2010-04-08 Eric Botcazou + + * gcc-interface/ada-tree.h (TYPE_RETURNS_UNCONSTRAINED_P): Rename into. + (TYPE_RETURN_UNCONSTRAINED_P): ...this. + (TYPE_RETURNS_BY_REF_P): Rename into. + (TYPE_RETURN_BY_DIRECT_REF_P): ...this. + (TYPE_RETURNS_BY_TARGET_PTR_P): Delete. + * gcc-interface/gigi.h (create_subprog_type): Adjust parameter names. + (build_return_expr): Likewise. + * gcc-interface/decl.c (gnat_to_gnu_entity) : + Rename local variables. If the return Mechanism is By_Reference, pass + return_by_invisible_ref_p to create_subprog_type instead of toggling + TREE_ADDRESSABLE. Test return_by_invisible_ref_p in order to annotate + the mechanism. Use regular return for contrained types with non-static + size and return by invisible reference for unconstrained return types + with default discriminants. Update comment. + * gcc-interface/trans.c (Subprogram_Body_to_gnu): If the function + returns by invisible reference, turn the RESULT_DECL into a pointer. + Do not handle DECL_BY_REF_P in the CICO case here. + (call_to_gnu): Remove code handling return by target pointer. For a + function call, if the return type has non-constant size, generate the + assignment with an INIT_EXPR. + (gnat_to_gnu) : Remove dead code in the CICO case. + If the function returns by invisible reference, build the copy return + operation manually. + (add_decl_expr): Initialize the variable with an INIT_EXPR. + * gcc-interface/utils.c (create_subprog_type): Adjust parameter names. + Adjust for renaming of macros. Copy the node only when necessary. + (create_subprog_decl): Do not toggle TREE_ADDRESSABLE on the return + type, only change DECL_BY_REFERENCE on the RETURN_DECL. + (convert_from_reference): Delete. + (is_byref_result): Likewise. + (gnat_genericize_r): Likewise. + (gnat_genericize): Likewise. + (end_subprog_body): Do not call gnat_genericize. + * gcc-interface/utils2.c (build_binary_op) : New case. + (build_return_expr): Adjust parameter names, logic and comment. + + 2010-04-07 Eric Botcazou + + * exp_pakd.adb (Create_Packed_Array_Type): Always use a modular type + if the size is small enough. Propagate the alignment if there is an + alignment clause on the original array type. + * gcc-interface/decl.c (gnat_to_gnu_entity) + Deal with under-aligned packed array types. Copy the size onto the + justified modular type and don't lay it out again. Likewise for the + padding type built for other under-aligned subtypes. + * gcc-interface/utils.c (finish_record_type): Do not set a default mode + on the type. + + 2010-04-07 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Set default + alignment on the RETURN type built for the Copy-In Copy-Out mechanism. + + 2010-04-07 Eric Botcazou + + * gcc-interface/trans.c (call_to_gnu): In the return-by-target-ptr case + do not set the result type if there is a specified target and do not + convert the result in any cases. + (protect_multiple_eval): Make direct SAVE_EXPR for CALL_EXPR. + (maybe_stabilize_reference) : Merge with CALL_EXPR. + + 2010-03-10 Eric Botcazou + + * gcc-interface/Makefile.in (SPARC/Solaris): Use sparcv8plus. + + 2010-02-27 Eric Botcazou + + PR ada/42253 + * gcc-interface/utils2.c (build_binary_op) : Assert that fat + pointer base types are variant of each other. Apply special treatment + for null to fat pointer types in all cases. + + 2010-01-28 Pascal Obry + + * s-win32.ads: Add some missing constants. + + 2010-01-28 Vincent Celier + + * prj-attr-pm.adb (Add_Attribute): Do nothing if To_Package is + Unknown_Package. + + 2010-01-28 Robert Dewar + + * gnat_rm.texi: Minor correction + + 2010-01-27 Pascal Obry + + * g-awk.adb: ensure that an AWK session is reusable. + + 2010-01-27 Vasiliy Fofanov + + * g-regist.adb (For_Every_Key): Fix previous change. + Minor reformatting. + + 2010-01-27 Thomas Quinot + + * lib-writ.ads: Current version of spec for new N (note) ALI lines + + 2010-01-27 Yannick Moy + + * a-cdlili.adb (Insert): Correct exception message when cursor + designates wrong list. + + 2010-01-27 Vincent Celier + + * gnatcmd.adb: When there is only one main specified, the package + support Switches (
) and attribute Switches is specified for the + main, use these switches, instead of Default_Switches ("Ada"). + + 2010-01-27 Robert Dewar + + * sem_prag.adb, par-prag.adb, snames.ads-tmpl: pragma Dimension initial + implementation. + * exp_disp.adb: Minor reformatting + + 2010-01-27 Tristan Gingold + + * seh_init.c: Use __ImageBase instead of _ImageBase. + + 2010-01-27 Javier Miranda + + * exp_disp.ads, exp_disp.adb (Expand_Interface_Thunk): Modify the + profile of interface thunks. The type of the controlling formal is now + the covered interface type (instead of the target tagged type). + + 2010-01-27 Sergey Rybin + + * gnat_rm.texi, gnat_ugn.texi: Update gnatcheck doc. + + 2010-01-27 Robert Dewar + + * sinput.ads, sinput.adb (Sloc_Range): Applies to all nodes, formal + changed from Expr to N. + + 2010-01-26 Thomas Quinot + + * gnat_ugn.texi: Adjust documentation of -gnatz switches. + * usage.adb: Replace line for -gnatz with two lines for -gnatzc and + -gnatzr. + + 2010-01-26 Vincent Celier + + * prj-attr.adb: Add new attribute Library_Install_Name_Option + Replace attribute Run_Path_Origin_Supported with Run_Path_Origin + * prj-nmsc.adb (Process_Project_Level_Simple_Attributes): Process + attributes Run_Path_Option and Library_Install_Name_Option. + * prj.ads (Project_Configuration): Replace component + Run_Path_Origin_Supported with component Run_Path_Origin. Add new + component Library_Install_Name_Option. + * snames.ads-tmpl: Add new standard name Library_Install_Name_Option + Replace Run_Path_Origin_Supported with Run_Path_Origin + + 2010-01-26 Ed Schonberg + + * sem_ch8.adb (Use_One_Package): Within an instance, an actual package + is not hidden by a homograph declared in another actual package. + + 2010-01-26 Robert Dewar + + * par_sco.adb (Traverse_Declarations_Or_Statements): Only generate + decisions for pragmas Assert, Check, Precondition, Postcondition if + -gnata set. + * scos.ads: Update comments. + * get_scos.adb, put_scos.adb: Minor fix to code reading statement SCOs. + Also remove obsolete code for CT (exit point) SCOs. + + 2010-01-26 Thomas Quinot + + * switch-c.adb: Fix handling of -gnatz* + + 2010-01-26 Robert Dewar + + * par_sco.adb (Traverse_Declarations_Or_Statements): Separate F/W + qualifiers for FOR/WHILE loops + * scos.ads: Use separate type letters F/W for for/while loops + + 2010-01-26 Robert Dewar + + * get_scos.adb (Get_SCOs): Implement new form of CS entries (multiple + entries per line, one for each statement in the sequence). + * par_sco.adb (Traverse_Declarations_Or_Statements): Increase array + size from 100 to 10_000 for SC_Array to avoid any real possibility of + overflow. Output decisions in for loops. + Exclude labels from CS lines. + * scos.ads: Clarify that label is not included in the entry point + + 2010-01-26 Robert Dewar + + * par_sco.adb (Traverse_Declarations_Or_Statments): Implement new + format of statement sequence SCO entries (one location/statement). + * put_scos.adb (Put_SCOs): Implement new format of CS lines + * scos.ads: Update comments. + * sem_eval.adb: Minor reformatting. + + 2010-01-26 Robert Dewar + + * par_sco.ads, par_sco.adb (Set_Statement_Entry): New handling of exits + (Extend_Statement_Sequence): New procedures + (Traverse_Declarations_Or_Statements): New handling for exits. + + 2010-01-26 Robert Dewar + + * par_sco.adb (Traverse_Declarations_Or_Statements): Add processing for + Case. + + 2010-01-26 Robert Dewar + + * par_sco.adb (Is_Logical_Operator): Exclude AND/OR/XOR + * scos.ads: Clarify handling of logical operators + + 2010-01-26 Arnaud Charlet + + * s-tpoben.adb: Update comments. + + 2010-01-26 Robert Dewar + + * freeze.adb (Set_Small_Size): Don't set size if alignment clause + present. + + 2010-01-26 Robert Dewar + + * scos.ads: Clean up documentation, remove obsolete XOR references + 2010-01-26 Vincent Celier + + * gnat_ugn.texi: Complete documentation on the restrictions for + combined options in -gnatxxx switches. + Fix typo. + + 2010-01-26 Arnaud Charlet + + * s-tpoben.adb (Initialize_Protection_Entries): If a PO is created from + a controlled operation, abort is already deferred at this point, so we + need to use Defer_Abort_Nestable. + + 2010-01-26 Vincent Celier + + * prj-conf.adb (Get_Config_Switches): Check for a default language for + a project extending a project with no languages. + + 2010-01-26 Vincent Celier + + * switch-c.adb (Scan_Front_End_Switches): Take into account options + that follow -gnatef. + Allow -gnateG to be followed by other options. + + 2010-01-26 Robert Dewar + + * s-commun.ads, s-osprim-mingw.adb, s-stchop-vxworks.adb, sem_aggr.adb, + s-vxwext.adb, sem_ch10.adb, sem_eval.adb, sem_prag.adb: Minor + reformatting. + + 2010-01-26 Vasiliy Fofanov + + * g-regist.adb, g-regist.ads (For_Every_Key): New generic procedure + that allows to iterate over all subkeys of a key. + + 2010-01-26 Ed Falis + + * sysdep.c: enable NFS for VxWorks MILS + * env.c: enable __gnat_environ for VxWorks MILS + * gcc-interface/Makefile.in: Add VxWorks MILS target pairs. + + 2010-01-25 Bob Duff + + * sem_aggr.adb (Resolve_Array_Aggregate): Check for the case where this + is an internally-generated positional aggregate, and the bounds are + already correctly set. We don't want to overwrite those bounds with + bounds determined by context. + + 2010-01-25 Robert Dewar + + * g-sercom.ads, gnatcmd.adb, gnatlink.adb, a-ststio.adb, exp_ch6.adb, + exp_ch9.adb, g-sechas.ads: Minor reformatting. + + 2010-01-25 Thomas Quinot + + * s-commun.adb (Last_Index): Count must be converted to SEO (a signed + integer type) before subtracting 1, otherwise the computation may wrap + (because size_t is modular) and cause the conversion to fail. + + 2010-01-25 Ed Falis + + * sysdep.c, init.c: Adapt to support full run-time on VxWorks MILS. + + 2010-01-25 Vincent Celier + + * prj-attr.adb: New attribute Run_Path_Origin_Required + * prj-nmsc.adb (Process_Project_Level_Simple_Attributes): Process new + attribute Run_Path_Origin_Required. + * prj.ads (Project_Configuration): New component + Run_Path_Origin_Supported. + * snames.ads-tmpl: New standard name Run_Path_Origin_Required + + 2010-01-25 Ed Schonberg + + * sem_aggr.adb (Resolve_Array_Aggregate): If the bounds in a choice + have errors, do not continue resolution of the aggregate. + * sem_eval.adb (Eval_Indexed_Component): Do not attempt to evaluate if + the array type indicates an error. + + 2010-01-25 Bob Duff + + * sinfo.ads: Minor comment fixes. + + 2010-01-25 Bob Duff + + * exp_ch4.adb, exp_aggr.adb: Minor comment fixes and code clean up. + + 2010-01-25 Arnaud Charlet + + * gnatvsn.ads (Current_Year): Update. + + 2010-01-25 Florian Villoing + + * gnat_ugn.texi: Fix typo. + + 2010-01-25 Thomas Quinot + + * scos.ads: Update specification. + + 2010-01-25 Ed Schonberg + + * sem_ch6.adb (Process_PPCs): If a postcondition is present and the + enclosing subprogram has no previous spec, attach postcondition + procedure to the defining entity for the body. + + 2010-01-25 Ed Schonberg + + * exp_aggr.adb (Build_Record_Aggr_Code); Do not generate call to + initialization procedure of the ancestor part of an extension aggregate + if it is an interface type. + + 2010-01-25 Vincent Celier + + * gnatlink.adb (Process_Binder_File): The directory for the shared + version of libgcc in the run path options is found in the subdirectory + indicated by __gnat_default_libgcc_subdir. + * link.c: Declare new const char * __gnat_default_libgcc_subdir for + each platform. + + 2010-01-25 Ed Schonberg + + * sem_prag.adb: More flexible pragma Annotate. + + 2010-01-22 Eric Botcazou + + * system-linux-armel.ads (Stack_Check_Probes): Set to True. + * system-linux-armeb.ads (Stack_Check_Probes): Likewise. + + 2010-01-18 Eric Botcazou + + * gcc-interface/utils.c (create_var_decl_1): Fix formatting nits. + + 2010-01-18 Jan Hubicka + + PR middle-end/42068 + * gcc-interface/utils.c (create_var_decl_1): Do not set COMMON flag for + unit local variables. + + 2010-01-17 Laurent GUERBY + + * gcc-interface/Makefile.in: Fix typo in arm*-*-linux-gnueabi. + + 2010-01-11 Mikael Pettersson + + * gcc-interface/Makefile.in: Add arm*-*-linux-gnueabi. + * system-linux-armeb.ads, system-linux-armel.ads: New files. + + 2010-01-09 Simon Wright + + PR ada/42626 + * gcc-interface/Makefile.in (gnatlib-shared-darwin): Add missing + end-quote. + + + + Copyright (C) 2010 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. diff -Nrcpad gcc-4.5.2/gcc/ada/Make-generated.in gcc-4.6.0/gcc/ada/Make-generated.in *** gcc-4.5.2/gcc/ada/Make-generated.in Mon Jul 20 13:48:01 2009 --- gcc-4.6.0/gcc/ada/Make-generated.in Tue Oct 26 12:19:56 2010 *************** $(ADA_GEN_SUBDIR)/treeprs.ads : $(ADA_GE *** 29,41 **** $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/treeprs (cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs ../../treeprs.ads ) ! $(ADA_GEN_SUBDIR)/einfo.h : $(ADA_GEN_SUBDIR)/einfo.ads $(ADA_GEN_SUBDIR)/einfo.adb $(ADA_GEN_SUBDIR)/xeinfo.adb -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/einfo $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/einfo/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/einfo (cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo ../../einfo.h ) ! $(ADA_GEN_SUBDIR)/sinfo.h : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/xsinfo.adb -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/sinfo $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/sinfo/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/sinfo --- 29,41 ---- $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/treeprs (cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs ../../treeprs.ads ) ! $(ADA_GEN_SUBDIR)/einfo.h : $(ADA_GEN_SUBDIR)/einfo.ads $(ADA_GEN_SUBDIR)/einfo.adb $(ADA_GEN_SUBDIR)/xeinfo.adb $(ADA_GEN_SUBDIR)/ceinfo.adb -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/einfo $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/einfo/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/einfo (cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo ../../einfo.h ) ! $(ADA_GEN_SUBDIR)/sinfo.h : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/sinfo.adb $(ADA_GEN_SUBDIR)/xsinfo.adb $(ADA_GEN_SUBDIR)/csinfo.adb -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/sinfo $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/sinfo/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/sinfo *************** $(ADA_GEN_SUBDIR)/stamp-sdefault : $(src *** 124,126 **** --- 124,134 ---- $(ECHO) "end Sdefault;" >> tmp-sdefault.adb $(MOVE_IF_CHANGE) tmp-sdefault.adb $(ADA_GEN_SUBDIR)/sdefault.adb touch $(ADA_GEN_SUBDIR)/stamp-sdefault + + $(ADA_GEN_SUBDIR)/gnat.hlp : $(ADA_GEN_SUBDIR)/vms_help.adb $(ADA_GEN_SUBDIR)/vms_cmds.ads $(ADA_GEN_SUBDIR)/gnat.help_in $(ADA_GEN_SUBDIR)/vms_data.ads + -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp + $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp/,$(notdir $^)) + $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp + (cd $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp; \ + gnatmake -q vms_help; \ + ./vms_help$(build_exeext) gnat.help_in vms_data.ads ../../gnat.hlp) diff -Nrcpad gcc-4.5.2/gcc/ada/Makefile.rtl gcc-4.6.0/gcc/ada/Makefile.rtl *** gcc-4.5.2/gcc/ada/Makefile.rtl Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/Makefile.rtl Tue Oct 26 10:42:02 2010 *************** *** 1,5 **** # Makefile.rtl for GNU Ada Compiler (GNAT). ! # Copyright (C) 2003-2008, Free Software Foundation, Inc. #This file is part of GCC. --- 1,5 ---- # Makefile.rtl for GNU Ada Compiler (GNAT). ! # Copyright (C) 2003-2010, Free Software Foundation, Inc. #This file is part of GCC. *************** GNATRTL_TASKING_OBJS= \ *** 79,90 **** --- 79,96 ---- # Objects needed for non-tasking. GNATRTL_NONTASKING_OBJS= \ a-assert$(objext) \ + a-btgbso$(objext) \ a-calari$(objext) \ a-calcon$(objext) \ a-caldel$(objext) \ a-calend$(objext) \ a-calfor$(objext) \ a-catizo$(objext) \ + a-cbhama$(objext) \ + a-cbhase$(objext) \ + a-cborse$(objext) \ + a-cbdlli$(objext) \ + a-cborma$(objext) \ a-cdlili$(objext) \ a-cgaaso$(objext) \ a-cgarso$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 94,99 **** --- 100,107 ---- a-charac$(objext) \ a-chlat1$(objext) \ a-chlat9$(objext) \ + a-chtgbo$(objext) \ + a-chtgbk$(objext) \ a-chtgke$(objext) \ a-chtgop$(objext) \ a-chzla1$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 114,119 **** --- 122,128 ---- a-comlin$(objext) \ a-contai$(objext) \ a-convec$(objext) \ + a-cobove$(objext) \ a-coorma$(objext) \ a-coormu$(objext) \ a-coorse$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 158,163 **** --- 167,173 ---- a-llitio$(objext) \ a-lliwti$(objext) \ a-llizti$(objext) \ + a-locale$(objext) \ a-ncelfu$(objext) \ a-ngcefu$(objext) \ a-ngcoty$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 178,183 **** --- 188,195 ---- a-nuflra$(objext) \ a-numaux$(objext) \ a-numeri$(objext) \ + a-rbtgbo$(objext) \ + a-rbtgbk$(objext) \ a-rbtgso$(objext) \ a-scteio$(objext) \ a-secain$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 211,216 **** --- 223,229 ---- a-ststio$(objext) \ a-stunau$(objext) \ a-stunha$(objext) \ + a-stuten$(objext) \ a-stwibo$(objext) \ a-stwifi$(objext) \ a-stwiha$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 225,230 **** --- 238,247 ---- a-stzsea$(objext) \ a-stzsup$(objext) \ a-stzunb$(objext) \ + a-suenco$(objext) \ + a-suenst$(objext) \ + a-suewst$(objext) \ + a-suezst$(objext) \ a-suteio$(objext) \ a-swbwha$(objext) \ a-swfwha$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 263,268 **** --- 280,286 ---- a-tiunio$(objext) \ a-unccon$(objext) \ a-uncdea$(objext) \ + a-wichha$(objext) \ a-wichun$(objext) \ a-widcha$(objext) \ a-witeio$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 287,292 **** --- 305,311 ---- a-wwboio$(objext) \ a-wwunio$(objext) \ a-zchara$(objext) \ + a-zchhan$(objext) \ a-zchuni$(objext) \ a-zrstfi$(objext) \ a-ztcoau$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 359,364 **** --- 378,385 ---- g-io$(objext) \ g-io_aux$(objext) \ g-locfil$(objext) \ + g-mbdira$(objext) \ + g-mbflra$(objext) \ g-md5$(objext) \ g-memdum$(objext) \ g-moreex$(objext) \ *************** GNATRTL_NONTASKING_OBJS= \ *** 495,500 **** --- 516,522 ---- s-mastop$(objext) \ s-memcop$(objext) \ s-memory$(objext) \ + s-multip$(objext) \ s-os_lib$(objext) \ s-osprim$(objext) \ s-pack03$(objext) \ diff -Nrcpad gcc-4.5.2/gcc/ada/a-assert.ads gcc-4.6.0/gcc/ada/a-assert.ads *** gcc-4.5.2/gcc/ada/a-assert.ads Tue Apr 8 06:57:39 2008 --- gcc-4.6.0/gcc/ada/a-assert.ads Mon Oct 18 09:53:00 2010 *************** *** 2,8 **** -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- ! -- A D A . A S S E R T -- -- -- -- S p e c -- -- -- --- 2,8 ---- -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- ! -- A D A . A S S E R T I O N S -- -- -- -- S p e c -- -- -- diff -Nrcpad gcc-4.5.2/gcc/ada/a-btgbso.adb gcc-4.6.0/gcc/ada/a-btgbso.adb *** gcc-4.5.2/gcc/ada/a-btgbso.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-btgbso.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,605 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_SET_OPERATIONS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with System; use type System.Address; + + package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Copy (Source : Set_Type) return Set_Type; + + ---------- + -- Copy -- + ---------- + + function Copy (Source : Set_Type) return Set_Type is + begin + return Target : Set_Type (Source.Length) do + Assign (Target => Target, Source => Source); + end return; + end Copy; + + ---------------- + -- Difference -- + ---------------- + + procedure Set_Difference (Target : in out Set_Type; Source : Set_Type) is + Tgt, Src : Count_Type; + + TN : Nodes_Type renames Target.Nodes; + SN : Nodes_Type renames Source.Nodes; + + begin + if Target'Address = Source'Address then + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Tree_Operations.Clear_Tree (Target); + return; + end if; + + if Source.Length = 0 then + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Tgt := Target.First; + Src := Source.First; + loop + if Tgt = 0 then + return; + end if; + + if Src = 0 then + return; + end if; + + if Is_Less (TN (Tgt), SN (Src)) then + Tgt := Tree_Operations.Next (Target, Tgt); + + elsif Is_Less (SN (Src), TN (Tgt)) then + Src := Tree_Operations.Next (Source, Src); + + else + declare + X : constant Count_Type := Tgt; + begin + Tgt := Tree_Operations.Next (Target, Tgt); + + Tree_Operations.Delete_Node_Sans_Free (Target, X); + Tree_Operations.Free (Target, X); + end; + + Src := Tree_Operations.Next (Source, Src); + end if; + end loop; + end Set_Difference; + + function Set_Difference (Left, Right : Set_Type) return Set_Type is + L_Node : Count_Type; + R_Node : Count_Type; + + Dst_Node : Count_Type; + pragma Warnings (Off, Dst_Node); + + begin + if Left'Address = Right'Address then + return S : Set_Type (0); -- Empty set + end if; + + if Left.Length = 0 then + return S : Set_Type (0); -- Empty set + end if; + + if Right.Length = 0 then + return Copy (Left); + end if; + + return Result : Set_Type (Left.Length) do + L_Node := Left.First; + R_Node := Right.First; + loop + if L_Node = 0 then + return; + end if; + + if R_Node = 0 then + while L_Node /= 0 loop + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Left.Nodes (L_Node), + Dst_Node => Dst_Node); + + L_Node := Tree_Operations.Next (Left, L_Node); + end loop; + + return; + end if; + + if Is_Less (Left.Nodes (L_Node), Right.Nodes (R_Node)) then + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Left.Nodes (L_Node), + Dst_Node => Dst_Node); + + L_Node := Tree_Operations.Next (Left, L_Node); + + elsif Is_Less (Right.Nodes (R_Node), Left.Nodes (L_Node)) then + R_Node := Tree_Operations.Next (Right, R_Node); + + else + L_Node := Tree_Operations.Next (Left, L_Node); + R_Node := Tree_Operations.Next (Right, R_Node); + end if; + end loop; + end return; + end Set_Difference; + + ------------------ + -- Intersection -- + ------------------ + + procedure Set_Intersection + (Target : in out Set_Type; + Source : Set_Type) + is + Tgt : Count_Type; + Src : Count_Type; + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + if Source.Length = 0 then + Tree_Operations.Clear_Tree (Target); + return; + end if; + + Tgt := Target.First; + Src := Source.First; + while Tgt /= 0 + and then Src /= 0 + loop + if Is_Less (Target.Nodes (Tgt), Source.Nodes (Src)) then + declare + X : constant Count_Type := Tgt; + begin + Tgt := Tree_Operations.Next (Target, Tgt); + + Tree_Operations.Delete_Node_Sans_Free (Target, X); + Tree_Operations.Free (Target, X); + end; + + elsif Is_Less (Source.Nodes (Src), Target.Nodes (Tgt)) then + Src := Tree_Operations.Next (Source, Src); + + else + Tgt := Tree_Operations.Next (Target, Tgt); + Src := Tree_Operations.Next (Source, Src); + end if; + end loop; + + while Tgt /= 0 loop + declare + X : constant Count_Type := Tgt; + begin + Tgt := Tree_Operations.Next (Target, Tgt); + + Tree_Operations.Delete_Node_Sans_Free (Target, X); + Tree_Operations.Free (Target, X); + end; + end loop; + end Set_Intersection; + + function Set_Intersection (Left, Right : Set_Type) return Set_Type is + L_Node : Count_Type; + R_Node : Count_Type; + + Dst_Node : Count_Type; + pragma Warnings (Off, Dst_Node); + + begin + if Left'Address = Right'Address then + return Copy (Left); + end if; + + return Result : Set_Type (Count_Type'Min (Left.Length, Right.Length)) do + L_Node := Left.First; + R_Node := Right.First; + loop + if L_Node = 0 then + return; + end if; + + if R_Node = 0 then + return; + end if; + + if Is_Less (Left.Nodes (L_Node), Right.Nodes (R_Node)) then + L_Node := Tree_Operations.Next (Left, L_Node); + + elsif Is_Less (Right.Nodes (R_Node), Left.Nodes (L_Node)) then + R_Node := Tree_Operations.Next (Right, R_Node); + + else + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Left.Nodes (L_Node), + Dst_Node => Dst_Node); + + L_Node := Tree_Operations.Next (Left, L_Node); + R_Node := Tree_Operations.Next (Right, R_Node); + end if; + end loop; + end return; + end Set_Intersection; + + --------------- + -- Is_Subset -- + --------------- + + function Set_Subset + (Subset : Set_Type; + Of_Set : Set_Type) return Boolean + is + Subset_Node : Count_Type; + Set_Node : Count_Type; + + begin + if Subset'Address = Of_Set'Address then + return True; + end if; + + if Subset.Length > Of_Set.Length then + return False; + end if; + + Subset_Node := Subset.First; + Set_Node := Of_Set.First; + loop + if Set_Node = 0 then + return Subset_Node = 0; + end if; + + if Subset_Node = 0 then + return True; + end if; + + if Is_Less (Subset.Nodes (Subset_Node), Of_Set.Nodes (Set_Node)) then + return False; + end if; + + if Is_Less (Of_Set.Nodes (Set_Node), Subset.Nodes (Subset_Node)) then + Set_Node := Tree_Operations.Next (Of_Set, Set_Node); + else + Set_Node := Tree_Operations.Next (Of_Set, Set_Node); + Subset_Node := Tree_Operations.Next (Subset, Subset_Node); + end if; + end loop; + end Set_Subset; + + ------------- + -- Overlap -- + ------------- + + function Set_Overlap (Left, Right : Set_Type) return Boolean is + L_Node : Count_Type; + R_Node : Count_Type; + + begin + if Left'Address = Right'Address then + return Left.Length /= 0; + end if; + + L_Node := Left.First; + R_Node := Right.First; + loop + if L_Node = 0 + or else R_Node = 0 + then + return False; + end if; + + if Is_Less (Left.Nodes (L_Node), Right.Nodes (R_Node)) then + L_Node := Tree_Operations.Next (Left, L_Node); + + elsif Is_Less (Right.Nodes (R_Node), Left.Nodes (L_Node)) then + R_Node := Tree_Operations.Next (Right, R_Node); + + else + return True; + end if; + end loop; + end Set_Overlap; + + -------------------------- + -- Symmetric_Difference -- + -------------------------- + + procedure Set_Symmetric_Difference + (Target : in out Set_Type; + Source : Set_Type) + is + Tgt : Count_Type; + Src : Count_Type; + + New_Tgt_Node : Count_Type; + pragma Warnings (Off, New_Tgt_Node); + + begin + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + if Target'Address = Source'Address then + Tree_Operations.Clear_Tree (Target); + return; + end if; + + Tgt := Target.First; + Src := Source.First; + loop + if Tgt = 0 then + while Src /= 0 loop + Insert_With_Hint + (Dst_Set => Target, + Dst_Hint => 0, + Src_Node => Source.Nodes (Src), + Dst_Node => New_Tgt_Node); + + Src := Tree_Operations.Next (Source, Src); + end loop; + + return; + end if; + + if Src = 0 then + return; + end if; + + if Is_Less (Target.Nodes (Tgt), Source.Nodes (Src)) then + Tgt := Tree_Operations.Next (Target, Tgt); + + elsif Is_Less (Source.Nodes (Src), Target.Nodes (Tgt)) then + Insert_With_Hint + (Dst_Set => Target, + Dst_Hint => Tgt, + Src_Node => Source.Nodes (Src), + Dst_Node => New_Tgt_Node); + + Src := Tree_Operations.Next (Source, Src); + + else + declare + X : constant Count_Type := Tgt; + begin + Tgt := Tree_Operations.Next (Target, Tgt); + + Tree_Operations.Delete_Node_Sans_Free (Target, X); + Tree_Operations.Free (Target, X); + end; + + Src := Tree_Operations.Next (Source, Src); + end if; + end loop; + end Set_Symmetric_Difference; + + function Set_Symmetric_Difference + (Left, Right : Set_Type) return Set_Type + is + L_Node : Count_Type; + R_Node : Count_Type; + + Dst_Node : Count_Type; + pragma Warnings (Off, Dst_Node); + + begin + if Left'Address = Right'Address then + return S : Set_Type (0); -- Empty set + end if; + + if Right.Length = 0 then + return Copy (Left); + end if; + + if Left.Length = 0 then + return Copy (Right); + end if; + + return Result : Set_Type (Left.Length + Right.Length) do + L_Node := Left.First; + R_Node := Right.First; + loop + if L_Node = 0 then + while R_Node /= 0 loop + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Right.Nodes (R_Node), + Dst_Node => Dst_Node); + + R_Node := Tree_Operations.Next (Right, R_Node); + end loop; + + return; + end if; + + if R_Node = 0 then + while L_Node /= 0 loop + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Left.Nodes (L_Node), + Dst_Node => Dst_Node); + + L_Node := Tree_Operations.Next (Left, L_Node); + end loop; + + return; + end if; + + if Is_Less (Left.Nodes (L_Node), Right.Nodes (R_Node)) then + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Left.Nodes (L_Node), + Dst_Node => Dst_Node); + + L_Node := Tree_Operations.Next (Left, L_Node); + + elsif Is_Less (Right.Nodes (R_Node), Left.Nodes (L_Node)) then + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => 0, + Src_Node => Right.Nodes (R_Node), + Dst_Node => Dst_Node); + + R_Node := Tree_Operations.Next (Right, R_Node); + + else + L_Node := Tree_Operations.Next (Left, L_Node); + R_Node := Tree_Operations.Next (Right, R_Node); + end if; + end loop; + end return; + end Set_Symmetric_Difference; + + ----------- + -- Union -- + ----------- + + procedure Set_Union (Target : in out Set_Type; Source : Set_Type) is + Hint : Count_Type := 0; + + procedure Process (Node : Count_Type); + pragma Inline (Process); + + procedure Iterate is new Tree_Operations.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (Node : Count_Type) is + begin + Insert_With_Hint + (Dst_Set => Target, + Dst_Hint => Hint, + Src_Node => Source.Nodes (Node), + Dst_Node => Hint); + end Process; + + -- Start of processing for Union + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + -- Note that there's no way to decide a priori whether the + -- target has enough capacity for the union with source. + -- We cannot simply compare the sum of the existing lengths + -- to the capacity of the target, because equivalent items + -- from source are not included in the union. + + Iterate (Source); + end Set_Union; + + function Set_Union (Left, Right : Set_Type) return Set_Type is + begin + if Left'Address = Right'Address then + return Copy (Left); + end if; + + if Left.Length = 0 then + return Copy (Right); + end if; + + if Right.Length = 0 then + return Copy (Left); + end if; + + return Result : Set_Type (Left.Length + Right.Length) do + Assign (Target => Result, Source => Left); + + Insert_Right : declare + Hint : Count_Type := 0; + + procedure Process (Node : Count_Type); + pragma Inline (Process); + + procedure Iterate is + new Tree_Operations.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (Node : Count_Type) is + begin + Insert_With_Hint + (Dst_Set => Result, + Dst_Hint => Hint, + Src_Node => Right.Nodes (Node), + Dst_Node => Hint); + end Process; + + -- Start of processing for Insert_Right + + begin + Iterate (Right); + end Insert_Right; + end return; + end Set_Union; + + end Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/a-btgbso.ads gcc-4.6.0/gcc/ada/a-btgbso.ads *** gcc-4.5.2/gcc/ada/a-btgbso.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-btgbso.ads Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,103 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_SET_OPERATIONS -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + -- Tree_Type is used to implement ordered containers. This package declares + -- set-based tree operations. + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; + + generic + with package Tree_Operations is new Generic_Bounded_Operations (<>); + + type Set_Type is new Tree_Operations.Tree_Types.Tree_Type with private; + + use Tree_Operations.Tree_Types; + + with procedure Assign (Target : in out Set_Type; Source : Set_Type); + + with procedure Insert_With_Hint + (Dst_Set : in out Set_Type; + Dst_Hint : Count_Type; + Src_Node : Node_Type; + Dst_Node : out Count_Type); + + with function Is_Less (Left, Right : Node_Type) return Boolean; + + package Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations is + pragma Pure; + + procedure Set_Union (Target : in out Set_Type; Source : Set_Type); + -- Attempts to insert each element of Source in Target. If Target is + -- busy then Program_Error is raised. We say "attempts" here because + -- if these are unique-element sets, then the insertion should fail + -- (not insert a new item) when the insertion item from Source is + -- equivalent to an item already in Target. If these are multisets + -- then of course the attempt should always succeed. + + function Set_Union (Left, Right : Set_Type) return Set_Type; + -- Makes a copy of Left, and attempts to insert each element of + -- Right into the copy, then returns the copy. + + procedure Set_Intersection (Target : in out Set_Type; Source : Set_Type); + -- Removes elements from Target that are not equivalent to items in + -- Source. If Target is busy then Program_Error is raised. + + function Set_Intersection (Left, Right : Set_Type) return Set_Type; + -- Returns a set comprising all the items in Left equivalent to items in + -- Right. + + procedure Set_Difference (Target : in out Set_Type; Source : Set_Type); + -- Removes elements from Target that are equivalent to items in Source. If + -- Target is busy then Program_Error is raised. + + function Set_Difference (Left, Right : Set_Type) return Set_Type; + -- Returns a set comprising all the items in Left not equivalent to items + -- in Right. + + procedure Set_Symmetric_Difference + (Target : in out Set_Type; + Source : Set_Type); + -- Removes from Target elements that are equivalent to items in Source, + -- and inserts into Target items from Source not equivalent elements in + -- Target. If Target is busy then Program_Error is raised. + + function Set_Symmetric_Difference (Left, Right : Set_Type) return Set_Type; + -- Returns a set comprising the union of the elements in Left not + -- equivalent to items in Right, and the elements in Right not equivalent + -- to items in Left. + + function Set_Subset (Subset : Set_Type; Of_Set : Set_Type) return Boolean; + -- Returns False if Subset contains at least one element not equivalent to + -- any item in Of_Set; returns True otherwise. + + function Set_Overlap (Left, Right : Set_Type) return Boolean; + -- Returns True if at least one element of Left is equivalent to an item in + -- Right; returns False otherwise. + + end Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/a-calfor.adb gcc-4.6.0/gcc/ada/a-calfor.adb *** gcc-4.5.2/gcc/ada/a-calfor.adb Mon Aug 17 10:09:55 2009 --- gcc-4.6.0/gcc/ada/a-calfor.adb Thu Sep 9 09:44:34 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2006-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2006-2010, 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- -- *************** package body Ada.Calendar.Formatting is *** 42,56 **** -- independent, thus only one source file is needed for multiple targets. procedure Check_Char (S : String; C : Character; Index : Integer); ! -- Subsidiary to the two versions of Value. Determine whether the ! -- input string S has character C at position Index. Raise ! -- Constraint_Error if there is a mismatch. procedure Check_Digit (S : String; Index : Integer); ! -- Subsidiary to the two versions of Value. Determine whether the ! -- character of string S at position Index is a digit. This catches ! -- invalid input such as 1983-*1-j3 u5:n7:k9 which should be ! -- 1983-01-03 05:07:09. Raise Constraint_Error if there is a mismatch. ---------------- -- Check_Char -- --- 42,56 ---- -- independent, thus only one source file is needed for multiple targets. procedure Check_Char (S : String; C : Character; Index : Integer); ! -- Subsidiary to the two versions of Value. Determine whether the input ! -- string S has character C at position Index. Raise Constraint_Error if ! -- there is a mismatch. procedure Check_Digit (S : String; Index : Integer); ! -- Subsidiary to the two versions of Value. Determine whether the character ! -- of string S at position Index is a digit. This catches invalid input ! -- such as 1983-*1-j3 u5:n7:k9 which should be 1983-01-03 05:07:09. Raise ! -- Constraint_Error if there is a mismatch. ---------------- -- Check_Char -- *************** package body Ada.Calendar.Formatting is *** 781,788 **** raise Constraint_Error; end if; ! -- After the correct length has been determined, it is safe to ! -- copy the Date in order to avoid Date'First + N indexing. D (1 .. Date'Length) := Date; --- 781,788 ---- raise Constraint_Error; end if; ! -- After the correct length has been determined, it is safe to copy the ! -- Date in order to avoid Date'First + N indexing. D (1 .. Date'Length) := Date; *************** package body Ada.Calendar.Formatting is *** 865,872 **** raise Constraint_Error; end if; ! -- After the correct length has been determined, it is safe to ! -- copy the Elapsed_Time in order to avoid Date'First + N indexing. D (1 .. Elapsed_Time'Length) := Elapsed_Time; --- 865,872 ---- raise Constraint_Error; end if; ! -- After the correct length has been determined, it is safe to copy the ! -- Elapsed_Time in order to avoid Date'First + N indexing. D (1 .. Elapsed_Time'Length) := Elapsed_Time; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cbdlli.adb gcc-4.6.0/gcc/ada/a-cbdlli.adb *** gcc-4.5.2/gcc/ada/a-cbdlli.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cbdlli.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,2005 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.BOUNDED_DOUBLY_LINKED_LISTS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with System; use type System.Address; + + package body Ada.Containers.Bounded_Doubly_Linked_Lists is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + procedure Allocate + (Container : in out List; + New_Item : Element_Type; + New_Node : out Count_Type); + + procedure Allocate + (Container : in out List; + New_Node : out Count_Type); + + procedure Allocate + (Container : in out List; + Stream : not null access Root_Stream_Type'Class; + New_Node : out Count_Type); + + procedure Free + (Container : in out List; + X : Count_Type); + + procedure Insert_Internal + (Container : in out List; + Before : Count_Type; + New_Node : Count_Type); + + function Vet (Position : Cursor) return Boolean; + + --------- + -- "=" -- + --------- + + function "=" (Left, Right : List) return Boolean is + LN : Node_Array renames Left.Nodes; + RN : Node_Array renames Right.Nodes; + + LI, RI : Count_Type; + + begin + if Left'Address = Right'Address then + return True; + end if; + + if Left.Length /= Right.Length then + return False; + end if; + + LI := Left.First; + RI := Right.First; + for J in 1 .. Left.Length loop + if LN (LI).Element /= RN (RI).Element then + return False; + end if; + + LI := LN (LI).Next; + RI := RN (RI).Next; + end loop; + + return True; + end "="; + + -------------- + -- Allocate -- + -------------- + + procedure Allocate + (Container : in out List; + New_Item : Element_Type; + New_Node : out Count_Type) + is + N : Node_Array renames Container.Nodes; + + begin + if Container.Free >= 0 then + New_Node := Container.Free; + + -- We always perform the assignment first, before we + -- change container state, in order to defend against + -- exceptions duration assignment. + + N (New_Node).Element := New_Item; + Container.Free := N (New_Node).Next; + + else + -- A negative free store value means that the links of the nodes + -- in the free store have not been initialized. In this case, the + -- nodes are physically contiguous in the array, starting at the + -- index that is the absolute value of the Container.Free, and + -- continuing until the end of the array (Nodes'Last). + + New_Node := abs Container.Free; + + -- As above, we perform this assignment first, before modifying + -- any container state. + + N (New_Node).Element := New_Item; + Container.Free := Container.Free - 1; + end if; + end Allocate; + + procedure Allocate + (Container : in out List; + Stream : not null access Root_Stream_Type'Class; + New_Node : out Count_Type) + is + N : Node_Array renames Container.Nodes; + + begin + if Container.Free >= 0 then + New_Node := Container.Free; + + -- We always perform the assignment first, before we + -- change container state, in order to defend against + -- exceptions duration assignment. + + Element_Type'Read (Stream, N (New_Node).Element); + Container.Free := N (New_Node).Next; + + else + -- A negative free store value means that the links of the nodes + -- in the free store have not been initialized. In this case, the + -- nodes are physically contiguous in the array, starting at the + -- index that is the absolute value of the Container.Free, and + -- continuing until the end of the array (Nodes'Last). + + New_Node := abs Container.Free; + + -- As above, we perform this assignment first, before modifying + -- any container state. + + Element_Type'Read (Stream, N (New_Node).Element); + Container.Free := Container.Free - 1; + end if; + end Allocate; + + procedure Allocate + (Container : in out List; + New_Node : out Count_Type) + is + N : Node_Array renames Container.Nodes; + + begin + if Container.Free >= 0 then + New_Node := Container.Free; + Container.Free := N (New_Node).Next; + + else + -- As explained above, a negative free store value means that the + -- links for the nodes in the free store have not been initialized. + + New_Node := abs Container.Free; + Container.Free := Container.Free - 1; + end if; + end Allocate; + + ------------ + -- Append -- + ------------ + + procedure Append + (Container : in out List; + New_Item : Element_Type; + Count : Count_Type := 1) + is + begin + Insert (Container, No_Element, New_Item, Count); + end Append; + + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out List; Source : List) is + SN : Node_Array renames Source.Nodes; + J : Count_Type; + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error -- ??? + with "Target capacity is less than Source length"; + end if; + + Target.Clear; + + J := Source.First; + while J /= 0 loop + Target.Append (SN (J).Element); + J := SN (J).Next; + end loop; + end Assign; + + ----------- + -- Clear -- + ----------- + + procedure Clear (Container : in out List) is + N : Node_Array renames Container.Nodes; + X : Count_Type; + + begin + if Container.Length = 0 then + pragma Assert (Container.First = 0); + pragma Assert (Container.Last = 0); + pragma Assert (Container.Busy = 0); + pragma Assert (Container.Lock = 0); + return; + end if; + + pragma Assert (Container.First >= 1); + pragma Assert (Container.Last >= 1); + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + while Container.Length > 1 loop + X := Container.First; + pragma Assert (N (N (X).Next).Prev = Container.First); + + Container.First := N (X).Next; + N (Container.First).Prev := 0; + + Container.Length := Container.Length - 1; + + Free (Container, X); + end loop; + + X := Container.First; + pragma Assert (X = Container.Last); + + Container.First := 0; + Container.Last := 0; + Container.Length := 0; + + Free (Container, X); + end Clear; + + -------------- + -- Contains -- + -------------- + + function Contains + (Container : List; + Item : Element_Type) return Boolean + is + begin + return Find (Container, Item) /= No_Element; + end Contains; + + ---------- + -- Copy -- + ---------- + + function Copy (Source : List; Capacity : Count_Type := 0) return List is + C : Count_Type; + + begin + if Capacity = 0 then + C := Source.Length; + + elsif Capacity >= Source.Length then + C := Capacity; + + else + raise Capacity_Error with "Capacity value too small"; + end if; + + return Target : List (Capacity => C) do + Assign (Target => Target, Source => Source); + end return; + end Copy; + + ------------ + -- Delete -- + ------------ + + procedure Delete + (Container : in out List; + Position : in out Cursor; + Count : Count_Type := 1) + is + N : Node_Array renames Container.Nodes; + X : Count_Type; + + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Delete"); + pragma Assert (Container.First >= 1); + pragma Assert (Container.Last >= 1); + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + + if Position.Node = Container.First then + Delete_First (Container, Count); + Position := No_Element; + return; + end if; + + if Count = 0 then + Position := No_Element; + return; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + for Index in 1 .. Count loop + pragma Assert (Container.Length >= 2); + + X := Position.Node; + Container.Length := Container.Length - 1; + + if X = Container.Last then + Position := No_Element; + + Container.Last := N (X).Prev; + N (Container.Last).Next := 0; + + Free (Container, X); + return; + end if; + + Position.Node := N (X).Next; + + N (N (X).Next).Prev := N (X).Prev; + N (N (X).Prev).Next := N (X).Next; + + Free (Container, X); + end loop; + + Position := No_Element; + end Delete; + + ------------------ + -- Delete_First -- + ------------------ + + procedure Delete_First + (Container : in out List; + Count : Count_Type := 1) + is + N : Node_Array renames Container.Nodes; + X : Count_Type; + + begin + if Count >= Container.Length then + Clear (Container); + return; + end if; + + if Count = 0 then + return; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + for I in 1 .. Count loop + X := Container.First; + pragma Assert (N (N (X).Next).Prev = Container.First); + + Container.First := N (X).Next; + N (Container.First).Prev := 0; + + Container.Length := Container.Length - 1; + + Free (Container, X); + end loop; + end Delete_First; + + ----------------- + -- Delete_Last -- + ----------------- + + procedure Delete_Last + (Container : in out List; + Count : Count_Type := 1) + is + N : Node_Array renames Container.Nodes; + X : Count_Type; + + begin + if Count >= Container.Length then + Clear (Container); + return; + end if; + + if Count = 0 then + return; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + for I in 1 .. Count loop + X := Container.Last; + pragma Assert (N (N (X).Prev).Next = Container.Last); + + Container.Last := N (X).Prev; + N (Container.Last).Next := 0; + + Container.Length := Container.Length - 1; + + Free (Container, X); + end loop; + end Delete_Last; + + ------------- + -- Element -- + ------------- + + function Element (Position : Cursor) return Element_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor has no element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Element"); + + return Position.Container.Nodes (Position.Node).Element; + end Element; + + ---------- + -- Find -- + ---------- + + function Find + (Container : List; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor + is + Nodes : Node_Array renames Container.Nodes; + Node : Count_Type := Position.Node; + + begin + if Node = 0 then + Node := Container.First; + + else + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Find"); + end if; + + while Node /= 0 loop + if Nodes (Node).Element = Item then + return Cursor'(Container'Unrestricted_Access, Node); + end if; + + Node := Nodes (Node).Next; + end loop; + + return No_Element; + end Find; + + ----------- + -- First -- + ----------- + + function First (Container : List) return Cursor is + begin + if Container.First = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Container.First); + end First; + + ------------------- + -- First_Element -- + ------------------- + + function First_Element (Container : List) return Element_Type is + begin + if Container.First = 0 then + raise Constraint_Error with "list is empty"; + end if; + + return Container.Nodes (Container.First).Element; + end First_Element; + + ---------- + -- Free -- + ---------- + + procedure Free + (Container : in out List; + X : Count_Type) + is + pragma Assert (X > 0); + pragma Assert (X <= Container.Capacity); + + N : Node_Array renames Container.Nodes; + pragma Assert (N (X).Prev >= 0); -- node is active + + begin + -- The list container actually contains two lists: one for the "active" + -- nodes that contain elements that have been inserted onto the list, + -- and another for the "inactive" nodes for the free store. + -- + -- We desire that merely declaring an object should have only minimal + -- cost; specially, we want to avoid having to initialize the free + -- store (to fill in the links), especially if the capacity is large. + -- + -- The head of the free list is indicated by Container.Free. If its + -- value is non-negative, then the free store has been initialized + -- in the "normal" way: Container.Free points to the head of the list + -- of free (inactive) nodes, and the value 0 means the free list is + -- empty. Each node on the free list has been initialized to point + -- to the next free node (via its Next component), and the value 0 + -- means that this is the last free node. + -- + -- If Container.Free is negative, then the links on the free store + -- have not been initialized. In this case the link values are + -- implied: the free store comprises the components of the node array + -- started with the absolute value of Container.Free, and continuing + -- until the end of the array (Nodes'Last). + -- + -- If the list container is manipulated on one end only (for example + -- if the container were being used as a stack), then there is no + -- need to initialize the free store, since the inactive nodes are + -- physically contiguous (in fact, they lie immediately beyond the + -- logical end being manipulated). The only time we need to actually + -- initialize the nodes in the free store is if the node that becomes + -- inactive is not at the end of the list. The free store would then + -- be discontiguous and so its nodes would need to be linked in the + -- traditional way. + -- + -- ??? + -- It might be possible to perform an optimization here. Suppose that + -- the free store can be represented as having two parts: one + -- comprising the non-contiguous inactive nodes linked together + -- in the normal way, and the other comprising the contiguous + -- inactive nodes (that are not linked together, at the end of the + -- nodes array). This would allow us to never have to initialize + -- the free store, except in a lazy way as nodes become inactive. + + -- When an element is deleted from the list container, its node + -- becomes inactive, and so we set its Prev component to a negative + -- value, to indicate that it is now inactive. This provides a useful + -- way to detect a dangling cursor reference. + + N (X).Prev := -1; -- Node is deallocated (not on active list) + + if Container.Free >= 0 then + -- The free store has previously been initialized. All we need to + -- do here is link the newly-free'd node onto the free list. + + N (X).Next := Container.Free; + Container.Free := X; + + elsif X + 1 = abs Container.Free then + -- The free store has not been initialized, and the node becoming + -- inactive immediately precedes the start of the free store. All + -- we need to do is move the start of the free store back by one. + + N (X).Next := 0; -- Not strictly necessary, but marginally safer + Container.Free := Container.Free + 1; + + else + -- The free store has not been initialized, and the node becoming + -- inactive does not immediately precede the free store. Here we + -- first initialize the free store (meaning the links are given + -- values in the traditional way), and then link the newly-free'd + -- node onto the head of the free store. + + -- ??? + -- See the comments above for an optimization opportunity. If + -- the next link for a node on the free store is negative, then + -- this means the remaining nodes on the free store are + -- physically contiguous, starting as the absolute value of + -- that index value. + + Container.Free := abs Container.Free; + + if Container.Free > Container.Capacity then + Container.Free := 0; + + else + for I in Container.Free .. Container.Capacity - 1 loop + N (I).Next := I + 1; + end loop; + + N (Container.Capacity).Next := 0; + end if; + + N (X).Next := Container.Free; + Container.Free := X; + end if; + end Free; + + --------------------- + -- Generic_Sorting -- + --------------------- + + package body Generic_Sorting is + + --------------- + -- Is_Sorted -- + --------------- + + function Is_Sorted (Container : List) return Boolean is + Nodes : Node_Array renames Container.Nodes; + Node : Count_Type := Container.First; + + begin + for I in 2 .. Container.Length loop + if Nodes (Nodes (Node).Next).Element < Nodes (Node).Element then + return False; + end if; + + Node := Nodes (Node).Next; + end loop; + + return True; + end Is_Sorted; + + ----------- + -- Merge -- + ----------- + + procedure Merge + (Target : in out List; + Source : in out List) + is + LN : Node_Array renames Target.Nodes; + RN : Node_Array renames Source.Nodes; + LI, RI : Cursor; + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Target (list is busy)"; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Source (list is busy)"; + end if; + + LI := First (Target); + RI := First (Source); + while RI.Node /= 0 loop + pragma Assert (RN (RI.Node).Next = 0 + or else not (RN (RN (RI.Node).Next).Element < + RN (RI.Node).Element)); + + if LI.Node = 0 then + Splice (Target, No_Element, Source); + return; + end if; + + pragma Assert (LN (LI.Node).Next = 0 + or else not (LN (LN (LI.Node).Next).Element < + LN (LI.Node).Element)); + + if RN (RI.Node).Element < LN (LI.Node).Element then + declare + RJ : Cursor := RI; + pragma Warnings (Off, RJ); + begin + RI.Node := RN (RI.Node).Next; + Splice (Target, LI, Source, RJ); + end; + + else + LI.Node := LN (LI.Node).Next; + end if; + end loop; + end Merge; + + ---------- + -- Sort -- + ---------- + + procedure Sort (Container : in out List) is + N : Node_Array renames Container.Nodes; + + procedure Partition (Pivot, Back : Count_Type); + + procedure Sort (Front, Back : Count_Type); + + --------------- + -- Partition -- + --------------- + + procedure Partition (Pivot, Back : Count_Type) is + Node : Count_Type := N (Pivot).Next; + + begin + while Node /= Back loop + if N (Node).Element < N (Pivot).Element then + declare + Prev : constant Count_Type := N (Node).Prev; + Next : constant Count_Type := N (Node).Next; + + begin + N (Prev).Next := Next; + + if Next = 0 then + Container.Last := Prev; + else + N (Next).Prev := Prev; + end if; + + N (Node).Next := Pivot; + N (Node).Prev := N (Pivot).Prev; + + N (Pivot).Prev := Node; + + if N (Node).Prev = 0 then + Container.First := Node; + else + N (N (Node).Prev).Next := Node; + end if; + + Node := Next; + end; + + else + Node := N (Node).Next; + end if; + end loop; + end Partition; + + ---------- + -- Sort -- + ---------- + + procedure Sort (Front, Back : Count_Type) is + Pivot : constant Count_Type := + (if Front = 0 then Container.First else N (Front).Next); + begin + if Pivot /= Back then + Partition (Pivot, Back); + Sort (Front, Pivot); + Sort (Pivot, Back); + end if; + end Sort; + + -- Start of processing for Sort + + begin + if Container.Length <= 1 then + return; + end if; + + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + Sort (Front => 0, Back => 0); + + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + end Sort; + + end Generic_Sorting; + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element (Position : Cursor) return Boolean is + begin + pragma Assert (Vet (Position), "bad cursor in Has_Element"); + return Position.Node /= 0; + end Has_Element; + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out List; + Before : Cursor; + New_Item : Element_Type; + Position : out Cursor; + Count : Count_Type := 1) + is + New_Node : Count_Type; + + begin + if Before.Container /= null then + if Before.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Before cursor designates wrong list"; + end if; + + pragma Assert (Vet (Before), "bad cursor in Insert"); + end if; + + if Count = 0 then + Position := Before; + return; + end if; + + if Container.Length > Container.Capacity - Count then + raise Constraint_Error with "new length exceeds capacity"; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + Allocate (Container, New_Item, New_Node); + Insert_Internal (Container, Before.Node, New_Node => New_Node); + Position := Cursor'(Container'Unchecked_Access, Node => New_Node); + + for Index in Count_Type'(2) .. Count loop + Allocate (Container, New_Item, New_Node => New_Node); + Insert_Internal (Container, Before.Node, New_Node => New_Node); + end loop; + end Insert; + + procedure Insert + (Container : in out List; + Before : Cursor; + New_Item : Element_Type; + Count : Count_Type := 1) + is + Position : Cursor; + pragma Unreferenced (Position); + begin + Insert (Container, Before, New_Item, Position, Count); + end Insert; + + procedure Insert + (Container : in out List; + Before : Cursor; + Position : out Cursor; + Count : Count_Type := 1) + is + New_Node : Count_Type; + + begin + if Before.Container /= null then + if Before.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Before cursor designates wrong list"; + end if; + + pragma Assert (Vet (Before), "bad cursor in Insert"); + end if; + + if Count = 0 then + Position := Before; + return; + end if; + + if Container.Length > Container.Capacity - Count then + raise Constraint_Error with "new length exceeds capacity"; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + Allocate (Container, New_Node => New_Node); + Insert_Internal (Container, Before.Node, New_Node); + Position := Cursor'(Container'Unchecked_Access, New_Node); + + for Index in Count_Type'(2) .. Count loop + Allocate (Container, New_Node => New_Node); + Insert_Internal (Container, Before.Node, New_Node); + end loop; + end Insert; + + --------------------- + -- Insert_Internal -- + --------------------- + + procedure Insert_Internal + (Container : in out List; + Before : Count_Type; + New_Node : Count_Type) + is + N : Node_Array renames Container.Nodes; + + begin + if Container.Length = 0 then + pragma Assert (Before = 0); + pragma Assert (Container.First = 0); + pragma Assert (Container.Last = 0); + + Container.First := New_Node; + N (Container.First).Prev := 0; + + Container.Last := New_Node; + N (Container.Last).Next := 0; + + elsif Before = 0 then -- means append + pragma Assert (N (Container.Last).Next = 0); + + N (Container.Last).Next := New_Node; + N (New_Node).Prev := Container.Last; + + Container.Last := New_Node; + N (Container.Last).Next := 0; + + elsif Before = Container.First then -- means prepend + pragma Assert (N (Container.First).Prev = 0); + + N (Container.First).Prev := New_Node; + N (New_Node).Next := Container.First; + + Container.First := New_Node; + N (Container.First).Prev := 0; + + else + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + + N (New_Node).Next := Before; + N (New_Node).Prev := N (Before).Prev; + + N (N (Before).Prev).Next := New_Node; + N (Before).Prev := New_Node; + end if; + + Container.Length := Container.Length + 1; + end Insert_Internal; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty (Container : List) return Boolean is + begin + return Container.Length = 0; + end Is_Empty; + + ------------- + -- Iterate -- + ------------- + + procedure Iterate + (Container : List; + Process : not null access procedure (Position : Cursor)) + is + C : List renames Container'Unrestricted_Access.all; + B : Natural renames C.Busy; + + Node : Count_Type := Container.First; + + begin + B := B + 1; + + begin + while Node /= 0 loop + Process (Cursor'(Container'Unrestricted_Access, Node)); + Node := Container.Nodes (Node).Next; + end loop; + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Iterate; + + ---------- + -- Last -- + ---------- + + function Last (Container : List) return Cursor is + begin + if Container.Last = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Container.Last); + end Last; + + ------------------ + -- Last_Element -- + ------------------ + + function Last_Element (Container : List) return Element_Type is + begin + if Container.Last = 0 then + raise Constraint_Error with "list is empty"; + end if; + + return Container.Nodes (Container.Last).Element; + end Last_Element; + + ------------ + -- Length -- + ------------ + + function Length (Container : List) return Count_Type is + begin + return Container.Length; + end Length; + + ---------- + -- Move -- + ---------- + + procedure Move + (Target : in out List; + Source : in out List) + is + N : Node_Array renames Source.Nodes; + X : Count_Type; + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error with "Source length exceeds Target capacity"; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Source (list is busy)"; + end if; + + Clear (Target); + + while Source.Length > 0 loop + X := Source.First; + Append (Target, N (X).Element); + + Source.First := N (X).Next; + N (Source.First).Prev := 0; + + Source.Length := Source.Length - 1; + Free (Source, X); + end loop; + end Move; + + ---------- + -- Next -- + ---------- + + procedure Next (Position : in out Cursor) is + begin + Position := Next (Position); + end Next; + + function Next (Position : Cursor) return Cursor is + begin + if Position.Node = 0 then + return No_Element; + end if; + + pragma Assert (Vet (Position), "bad cursor in Next"); + + declare + Nodes : Node_Array renames Position.Container.Nodes; + Node : constant Count_Type := Nodes (Position.Node).Next; + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Next; + + ------------- + -- Prepend -- + ------------- + + procedure Prepend + (Container : in out List; + New_Item : Element_Type; + Count : Count_Type := 1) + is + begin + Insert (Container, First (Container), New_Item, Count); + end Prepend; + + -------------- + -- Previous -- + -------------- + + procedure Previous (Position : in out Cursor) is + begin + Position := Previous (Position); + end Previous; + + function Previous (Position : Cursor) return Cursor is + begin + if Position.Node = 0 then + return No_Element; + end if; + + pragma Assert (Vet (Position), "bad cursor in Previous"); + + declare + Nodes : Node_Array renames Position.Container.Nodes; + Node : constant Count_Type := Nodes (Position.Node).Prev; + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Previous; + + ------------------- + -- Query_Element -- + ------------------- + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor has no element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Query_Element"); + + declare + C : List renames Position.Container.all'Unrestricted_Access.all; + B : Natural renames C.Busy; + L : Natural renames C.Lock; + + begin + B := B + 1; + L := L + 1; + + declare + N : Node_Type renames C.Nodes (Position.Node); + begin + Process (N.Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Query_Element; + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out List) + is + N : Count_Type'Base; + X : Count_Type; + + begin + Clear (Item); + Count_Type'Base'Read (Stream, N); + + if N < 0 then + raise Program_Error with "bad list length (corrupt stream)"; + end if; + + if N = 0 then + return; + end if; + + if N > Item.Capacity then + raise Constraint_Error with "length exceeds capacity"; + end if; + + for Idx in 1 .. N loop + Allocate (Item, Stream, New_Node => X); + Insert_Internal (Item, Before => 0, New_Node => X); + end loop; + end Read; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor) + is + begin + raise Program_Error with "attempt to stream list cursor"; + end Read; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Container : in out List; + Position : Cursor; + New_Item : Element_Type) + is + begin + if Position.Container = null then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unchecked_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (list is locked)"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Replace_Element"); + + Container.Nodes (Position.Node).Element := New_Item; + end Replace_Element; + + ---------------------- + -- Reverse_Elements -- + ---------------------- + + procedure Reverse_Elements (Container : in out List) is + N : Node_Array renames Container.Nodes; + I : Count_Type := Container.First; + J : Count_Type := Container.Last; + + procedure Swap (L, R : Count_Type); + + ---------- + -- Swap -- + ---------- + + procedure Swap (L, R : Count_Type) is + LN : constant Count_Type := N (L).Next; + LP : constant Count_Type := N (L).Prev; + + RN : constant Count_Type := N (R).Next; + RP : constant Count_Type := N (R).Prev; + + begin + if LP /= 0 then + N (LP).Next := R; + end if; + + if RN /= 0 then + N (RN).Prev := L; + end if; + + N (L).Next := RN; + N (R).Prev := LP; + + if LN = R then + pragma Assert (RP = L); + + N (L).Prev := R; + N (R).Next := L; + + else + N (L).Prev := RP; + N (RP).Next := L; + + N (R).Next := LN; + N (LN).Prev := R; + end if; + end Swap; + + -- Start of processing for Reverse_Elements + + begin + if Container.Length <= 1 then + return; + end if; + + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + Container.First := J; + Container.Last := I; + loop + Swap (L => I, R => J); + + J := N (J).Next; + exit when I = J; + + I := N (I).Prev; + exit when I = J; + + Swap (L => J, R => I); + + I := N (I).Next; + exit when I = J; + + J := N (J).Prev; + exit when I = J; + end loop; + + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + end Reverse_Elements; + + ------------------ + -- Reverse_Find -- + ------------------ + + function Reverse_Find + (Container : List; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor + is + Node : Count_Type := Position.Node; + + begin + if Node = 0 then + Node := Container.Last; + + else + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Reverse_Find"); + end if; + + while Node /= 0 loop + if Container.Nodes (Node).Element = Item then + return Cursor'(Container'Unrestricted_Access, Node); + end if; + + Node := Container.Nodes (Node).Prev; + end loop; + + return No_Element; + end Reverse_Find; + + --------------------- + -- Reverse_Iterate -- + --------------------- + + procedure Reverse_Iterate + (Container : List; + Process : not null access procedure (Position : Cursor)) + is + C : List renames Container'Unrestricted_Access.all; + B : Natural renames C.Busy; + + Node : Count_Type := Container.Last; + + begin + B := B + 1; + + begin + while Node /= 0 loop + Process (Cursor'(Container'Unrestricted_Access, Node)); + Node := Container.Nodes (Node).Prev; + end loop; + + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Reverse_Iterate; + + ------------ + -- Splice -- + ------------ + + procedure Splice + (Target : in out List; + Before : Cursor; + Source : in out List) + is + begin + if Before.Container /= null then + if Before.Container /= Target'Unrestricted_Access then + raise Program_Error with + "Before cursor designates wrong container"; + end if; + + pragma Assert (Vet (Before), "bad cursor in Splice"); + end if; + + if Target'Address = Source'Address + or else Source.Length = 0 + then + return; + end if; + + pragma Assert (Source.Nodes (Source.First).Prev = 0); + pragma Assert (Source.Nodes (Source.Last).Next = 0); + + if Target.Length > Count_Type'Last - Source.Length then + raise Constraint_Error with "new length exceeds maximum"; + end if; + + if Target.Length + Source.Length > Target.Capacity then + raise Capacity_Error with "new length exceeds target capacity"; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Target (list is busy)"; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Source (list is busy)"; + end if; + + loop + Insert (Target, Before, Source.Nodes (Source.Last).Element); + Delete_Last (Source); + exit when Is_Empty (Source); + end loop; + end Splice; + + procedure Splice + (Container : in out List; + Before : Cursor; + Position : Cursor) + is + N : Node_Array renames Container.Nodes; + + begin + if Before.Container /= null then + if Before.Container /= Container'Unchecked_Access then + raise Program_Error with + "Before cursor designates wrong container"; + end if; + + pragma Assert (Vet (Before), "bad Before cursor in Splice"); + end if; + + if Position.Node = 0 then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + pragma Assert (Vet (Position), "bad Position cursor in Splice"); + + if Position.Node = Before.Node + or else N (Position.Node).Next = Before.Node + then + return; + end if; + + pragma Assert (Container.Length >= 2); + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + if Before.Node = 0 then + pragma Assert (Position.Node /= Container.Last); + + if Position.Node = Container.First then + Container.First := N (Position.Node).Next; + N (Container.First).Prev := 0; + else + N (N (Position.Node).Prev).Next := N (Position.Node).Next; + N (N (Position.Node).Next).Prev := N (Position.Node).Prev; + end if; + + N (Container.Last).Next := Position.Node; + N (Position.Node).Prev := Container.Last; + + Container.Last := Position.Node; + N (Container.Last).Next := 0; + + return; + end if; + + if Before.Node = Container.First then + pragma Assert (Position.Node /= Container.First); + + if Position.Node = Container.Last then + Container.Last := N (Position.Node).Prev; + N (Container.Last).Next := 0; + else + N (N (Position.Node).Prev).Next := N (Position.Node).Next; + N (N (Position.Node).Next).Prev := N (Position.Node).Prev; + end if; + + N (Container.First).Prev := Position.Node; + N (Position.Node).Next := Container.First; + + Container.First := Position.Node; + N (Container.First).Prev := 0; + + return; + end if; + + if Position.Node = Container.First then + Container.First := N (Position.Node).Next; + N (Container.First).Prev := 0; + + elsif Position.Node = Container.Last then + Container.Last := N (Position.Node).Prev; + N (Container.Last).Next := 0; + + else + N (N (Position.Node).Prev).Next := N (Position.Node).Next; + N (N (Position.Node).Next).Prev := N (Position.Node).Prev; + end if; + + N (N (Before.Node).Prev).Next := Position.Node; + N (Position.Node).Prev := N (Before.Node).Prev; + + N (Before.Node).Prev := Position.Node; + N (Position.Node).Next := Before.Node; + + pragma Assert (N (Container.First).Prev = 0); + pragma Assert (N (Container.Last).Next = 0); + end Splice; + + procedure Splice + (Target : in out List; + Before : Cursor; + Source : in out List; + Position : in out Cursor) + is + Target_Position : Cursor; + + begin + if Target'Address = Source'Address then + Splice (Target, Before, Position); + return; + end if; + + if Before.Container /= null then + if Before.Container /= Target'Unrestricted_Access then + raise Program_Error with + "Before cursor designates wrong container"; + end if; + + pragma Assert (Vet (Before), "bad Before cursor in Splice"); + end if; + + if Position.Node = 0 then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Source'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + pragma Assert (Vet (Position), "bad Position cursor in Splice"); + + if Target.Length >= Target.Capacity then + raise Capacity_Error with "Target is full"; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Target (list is busy)"; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors of Source (list is busy)"; + end if; + + Insert + (Container => Target, + Before => Before, + New_Item => Source.Nodes (Position.Node).Element, + Position => Target_Position); + + Delete (Source, Position); + Position := Target_Position; + end Splice; + + ---------- + -- Swap -- + ---------- + + procedure Swap + (Container : in out List; + I, J : Cursor) + is + begin + if I.Node = 0 then + raise Constraint_Error with "I cursor has no element"; + end if; + + if J.Node = 0 then + raise Constraint_Error with "J cursor has no element"; + end if; + + if I.Container /= Container'Unchecked_Access then + raise Program_Error with "I cursor designates wrong container"; + end if; + + if J.Container /= Container'Unchecked_Access then + raise Program_Error with "J cursor designates wrong container"; + end if; + + if I.Node = J.Node then + return; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (list is locked)"; + end if; + + pragma Assert (Vet (I), "bad I cursor in Swap"); + pragma Assert (Vet (J), "bad J cursor in Swap"); + + declare + EI : Element_Type renames Container.Nodes (I.Node).Element; + EJ : Element_Type renames Container.Nodes (J.Node).Element; + + EI_Copy : constant Element_Type := EI; + + begin + EI := EJ; + EJ := EI_Copy; + end; + end Swap; + + ---------------- + -- Swap_Links -- + ---------------- + + procedure Swap_Links + (Container : in out List; + I, J : Cursor) + is + begin + if I.Node = 0 then + raise Constraint_Error with "I cursor has no element"; + end if; + + if J.Node = 0 then + raise Constraint_Error with "J cursor has no element"; + end if; + + if I.Container /= Container'Unrestricted_Access then + raise Program_Error with "I cursor designates wrong container"; + end if; + + if J.Container /= Container'Unrestricted_Access then + raise Program_Error with "J cursor designates wrong container"; + end if; + + if I.Node = J.Node then + return; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (list is busy)"; + end if; + + pragma Assert (Vet (I), "bad I cursor in Swap_Links"); + pragma Assert (Vet (J), "bad J cursor in Swap_Links"); + + declare + I_Next : constant Cursor := Next (I); + + begin + if I_Next = J then + Splice (Container, Before => I, Position => J); + + else + declare + J_Next : constant Cursor := Next (J); + + begin + if J_Next = I then + Splice (Container, Before => J, Position => I); + + else + pragma Assert (Container.Length >= 3); + + Splice (Container, Before => I_Next, Position => J); + Splice (Container, Before => J_Next, Position => I); + end if; + end; + end if; + end; + end Swap_Links; + + -------------------- + -- Update_Element -- + -------------------- + + procedure Update_Element + (Container : in out List; + Position : Cursor; + Process : not null access procedure (Element : in out Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unchecked_Access then + raise Program_Error with + "Position cursor designates wrong container"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Update_Element"); + + declare + B : Natural renames Container.Busy; + L : Natural renames Container.Lock; + + begin + B := B + 1; + L := L + 1; + + declare + N : Node_Type renames Container.Nodes (Position.Node); + begin + Process (N.Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Update_Element; + + --------- + -- Vet -- + --------- + + function Vet (Position : Cursor) return Boolean is + begin + if Position.Node = 0 then + return Position.Container = null; + end if; + + if Position.Container = null then + return False; + end if; + + declare + L : List renames Position.Container.all; + N : Node_Array renames L.Nodes; + begin + if L.Length = 0 then + return False; + end if; + + if L.First = 0 + or L.First > L.Capacity + then + return False; + end if; + + if L.Last = 0 + or L.Last > L.Capacity + then + return False; + end if; + + if N (L.First).Prev /= 0 then + return False; + end if; + + if N (L.Last).Next /= 0 then + return False; + end if; + + if Position.Node > L.Capacity then + return False; + end if; + + if N (Position.Node).Prev < 0 then -- see Free + return False; + end if; + + if N (Position.Node).Prev > L.Capacity then + return False; + end if; + + if N (Position.Node).Next = Position.Node then + return False; + end if; + + if N (Position.Node).Prev = Position.Node then + return False; + end if; + + if N (Position.Node).Prev = 0 + and then Position.Node /= L.First + then + return False; + end if; + + -- If we get here, we know that this disjunction is true: + -- N (Position.Node).Prev /= 0 or else Position.Node = L.First + + if N (Position.Node).Next = 0 + and then Position.Node /= L.Last + then + return False; + end if; + + -- If we get here, we know that this disjunction is true: + -- N (Position.Node).Next /= 0 or else Position.Node = L.Last + + if L.Length = 1 then + return L.First = L.Last; + end if; + + if L.First = L.Last then + return False; + end if; + + if N (L.First).Next = 0 then + return False; + end if; + + if N (L.Last).Prev = 0 then + return False; + end if; + + if N (N (L.First).Next).Prev /= L.First then + return False; + end if; + + if N (N (L.Last).Prev).Next /= L.Last then + return False; + end if; + + if L.Length = 2 then + if N (L.First).Next /= L.Last then + return False; + end if; + + if N (L.Last).Prev /= L.First then + return False; + end if; + + return True; + end if; + + if N (L.First).Next = L.Last then + return False; + end if; + + if N (L.Last).Prev = L.First then + return False; + end if; + + if Position.Node = L.First then -- eliminates earlier disjunct + return True; + end if; + + -- If we get here, we know, per disjunctive syllogism (modus + -- tollendo ponens), that this predicate is true: + -- N (Position.Node).Prev /= 0 + + if Position.Node = L.Last then -- eliminates earlier disjunct + return True; + end if; + + -- If we get here, we know, per disjunctive syllogism (modus + -- tollendo ponens), that this predicate is true: + -- N (Position.Node).Next /= 0 + + if N (N (Position.Node).Next).Prev /= Position.Node then + return False; + end if; + + if N (N (Position.Node).Prev).Next /= Position.Node then + return False; + end if; + + if L.Length = 3 then + if N (L.First).Next /= Position.Node then + return False; + end if; + + if N (L.Last).Prev /= Position.Node then + return False; + end if; + end if; + + return True; + end; + end Vet; + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : List) + is + Node : Count_Type; + + begin + Count_Type'Base'Write (Stream, Item.Length); + + Node := Item.First; + while Node /= 0 loop + Element_Type'Write (Stream, Item.Nodes (Node).Element); + Node := Item.Nodes (Node).Next; + end loop; + end Write; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor) + is + begin + raise Program_Error with "attempt to stream list cursor"; + end Write; + + end Ada.Containers.Bounded_Doubly_Linked_Lists; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cbdlli.ads gcc-4.6.0/gcc/ada/a-cbdlli.ads *** gcc-4.5.2/gcc/ada/a-cbdlli.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cbdlli.ads Tue Oct 26 10:31:39 2010 *************** *** 0 **** --- 1,270 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.BOUNDED_DOUBLY_LINKED_LISTS -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + private with Ada.Streams; + + generic + type Element_Type is private; + + with function "=" (Left, Right : Element_Type) + return Boolean is <>; + + package Ada.Containers.Bounded_Doubly_Linked_Lists is + pragma Pure; + pragma Remote_Types; + + type List (Capacity : Count_Type) is tagged private; + pragma Preelaborable_Initialization (List); + + type Cursor is private; + pragma Preelaborable_Initialization (Cursor); + + Empty_List : constant List; + + No_Element : constant Cursor; + + function "=" (Left, Right : List) return Boolean; + + function Length (Container : List) return Count_Type; + + function Is_Empty (Container : List) return Boolean; + + procedure Clear (Container : in out List); + + function Element (Position : Cursor) return Element_Type; + + procedure Replace_Element + (Container : in out List; + Position : Cursor; + New_Item : Element_Type); + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)); + + procedure Update_Element + (Container : in out List; + Position : Cursor; + Process : not null access procedure (Element : in out Element_Type)); + + procedure Assign (Target : in out List; Source : List); + + function Copy (Source : List; Capacity : Count_Type := 0) return List; + + procedure Move + (Target : in out List; + Source : in out List); + + procedure Insert + (Container : in out List; + Before : Cursor; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Insert + (Container : in out List; + Before : Cursor; + New_Item : Element_Type; + Position : out Cursor; + Count : Count_Type := 1); + + procedure Insert + (Container : in out List; + Before : Cursor; + Position : out Cursor; + Count : Count_Type := 1); + + procedure Prepend + (Container : in out List; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Append + (Container : in out List; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Delete + (Container : in out List; + Position : in out Cursor; + Count : Count_Type := 1); + + procedure Delete_First + (Container : in out List; + Count : Count_Type := 1); + + procedure Delete_Last + (Container : in out List; + Count : Count_Type := 1); + + procedure Reverse_Elements (Container : in out List); + + procedure Swap + (Container : in out List; + I, J : Cursor); + + procedure Swap_Links + (Container : in out List; + I, J : Cursor); + + procedure Splice + (Target : in out List; + Before : Cursor; + Source : in out List); + + procedure Splice + (Target : in out List; + Before : Cursor; + Source : in out List; + Position : in out Cursor); + + procedure Splice + (Container : in out List; + Before : Cursor; + Position : Cursor); + + function First (Container : List) return Cursor; + + function First_Element (Container : List) return Element_Type; + + function Last (Container : List) return Cursor; + + function Last_Element (Container : List) return Element_Type; + + function Next (Position : Cursor) return Cursor; + + procedure Next (Position : in out Cursor); + + function Previous (Position : Cursor) return Cursor; + + procedure Previous (Position : in out Cursor); + + function Find + (Container : List; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor; + + function Reverse_Find + (Container : List; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor; + + function Contains + (Container : List; + Item : Element_Type) return Boolean; + + function Has_Element (Position : Cursor) return Boolean; + + procedure Iterate + (Container : List; + Process : not null access procedure (Position : Cursor)); + + procedure Reverse_Iterate + (Container : List; + Process : not null access procedure (Position : Cursor)); + + generic + with function "<" (Left, Right : Element_Type) return Boolean is <>; + package Generic_Sorting is + + function Is_Sorted (Container : List) return Boolean; + + procedure Sort (Container : in out List); + + procedure Merge (Target, Source : in out List); + + end Generic_Sorting; + + private + + pragma Inline (Next); + pragma Inline (Previous); + + type Node_Type is record + Prev : Count_Type'Base; + Next : Count_Type; + Element : Element_Type; + end record; + + type Node_Array is array (Count_Type range <>) of Node_Type; + + type List (Capacity : Count_Type) is tagged record + Nodes : Node_Array (1 .. Capacity) := (others => <>); + Free : Count_Type'Base := -1; + First : Count_Type := 0; + Last : Count_Type := 0; + Length : Count_Type := 0; + Busy : Natural := 0; + Lock : Natural := 0; + end record; + + use Ada.Streams; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out List); + + for List'Read use Read; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : List); + + for List'Write use Write; + + type List_Access is access all List; + for List_Access'Storage_Size use 0; + + type Cursor is + record + Container : List_Access; + Node : Count_Type := 0; + end record; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor); + + for Cursor'Read use Read; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor); + + for Cursor'Write use Write; + + Empty_List : constant List := (Capacity => 0, others => <>); + + No_Element : constant Cursor := Cursor'(null, 0); + + end Ada.Containers.Bounded_Doubly_Linked_Lists; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cbhama.adb gcc-4.6.0/gcc/ada/a-cbhama.adb *** gcc-4.5.2/gcc/ada/a-cbhama.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cbhama.adb Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,1068 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ M A P S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with Ada.Containers.Hash_Tables.Generic_Bounded_Operations; + pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Operations); + + with Ada.Containers.Hash_Tables.Generic_Bounded_Keys; + pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Keys); + + with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers; + with System; use type System.Address; + + package body Ada.Containers.Bounded_Hashed_Maps is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Equivalent_Key_Node + (Key : Key_Type; + Node : Node_Type) return Boolean; + pragma Inline (Equivalent_Key_Node); + + function Hash_Node (Node : Node_Type) return Hash_Type; + pragma Inline (Hash_Node); + + function Next (Node : Node_Type) return Count_Type; + pragma Inline (Next); + + procedure Set_Next (Node : in out Node_Type; Next : Count_Type); + pragma Inline (Set_Next); + + function Vet (Position : Cursor) return Boolean; + + -------------------------- + -- Local Instantiations -- + -------------------------- + + package HT_Ops is new Hash_Tables.Generic_Bounded_Operations + (HT_Types => HT_Types, + Hash_Node => Hash_Node, + Next => Next, + Set_Next => Set_Next); + + package Key_Ops is new Hash_Tables.Generic_Bounded_Keys + (HT_Types => HT_Types, + Next => Next, + Set_Next => Set_Next, + Key_Type => Key_Type, + Hash => Hash, + Equivalent_Keys => Equivalent_Key_Node); + + --------- + -- "=" -- + --------- + + function "=" (Left, Right : Map) return Boolean is + function Find_Equal_Key + (R_HT : Hash_Table_Type'Class; + L_Node : Node_Type) return Boolean; + + function Is_Equal is new HT_Ops.Generic_Equal (Find_Equal_Key); + + -------------------- + -- Find_Equal_Key -- + -------------------- + + function Find_Equal_Key + (R_HT : Hash_Table_Type'Class; + L_Node : Node_Type) return Boolean + is + R_Index : constant Hash_Type := Key_Ops.Index (R_HT, L_Node.Key); + R_Node : Count_Type := R_HT.Buckets (R_Index); + + begin + while R_Node /= 0 loop + if Equivalent_Keys (L_Node.Key, R_HT.Nodes (R_Node).Key) then + return L_Node.Element = R_HT.Nodes (R_Node).Element; + end if; + + R_Node := R_HT.Nodes (R_Node).Next; + end loop; + + return False; + end Find_Equal_Key; + + -- Start of processing for "=" + + begin + return Is_Equal (Left, Right); + end "="; + + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out Map; Source : Map) is + procedure Insert_Element (Source_Node : Count_Type); + + procedure Insert_Elements is + new HT_Ops.Generic_Iteration (Insert_Element); + + -------------------- + -- Insert_Element -- + -------------------- + + procedure Insert_Element (Source_Node : Count_Type) is + N : Node_Type renames Source.Nodes (Source_Node); + C : Cursor; + B : Boolean; + + begin + Insert (Target, N.Key, N.Element, C, B); + pragma Assert (B); + end Insert_Element; + + -- Start of processing for Assign + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error + with "Target capacity is less than Source length"; + end if; + + HT_Ops.Clear (Target); + Insert_Elements (Source); + end Assign; + + -------------- + -- Capacity -- + -------------- + + function Capacity (Container : Map) return Count_Type is + begin + return Container.Capacity; + end Capacity; + + ----------- + -- Clear -- + ----------- + + procedure Clear (Container : in out Map) is + begin + HT_Ops.Clear (Container); + end Clear; + + -------------- + -- Contains -- + -------------- + + function Contains (Container : Map; Key : Key_Type) return Boolean is + begin + return Find (Container, Key) /= No_Element; + end Contains; + + ---------- + -- Copy -- + ---------- + + function Copy + (Source : Map; + Capacity : Count_Type := 0; + Modulus : Hash_Type := 0) return Map + is + C : Count_Type; + M : Hash_Type; + + begin + if Capacity = 0 then + C := Source.Length; + + elsif Capacity >= Source.Length then + C := Capacity; + + else + raise Capacity_Error with "Capacity value too small"; + end if; + + if Modulus = 0 then + M := Default_Modulus (C); + else + M := Modulus; + end if; + + return Target : Map (Capacity => C, Modulus => M) do + Assign (Target => Target, Source => Source); + end return; + end Copy; + + --------------------- + -- Default_Modulus -- + --------------------- + + function Default_Modulus (Capacity : Count_Type) return Hash_Type is + begin + return To_Prime (Capacity); + end Default_Modulus; + + ------------ + -- Delete -- + ------------ + + procedure Delete (Container : in out Map; Key : Key_Type) is + X : Count_Type; + + begin + Key_Ops.Delete_Key_Sans_Free (Container, Key, X); + + if X = 0 then + raise Constraint_Error with "attempt to delete key not in map"; + end if; + + HT_Ops.Free (Container, X); + end Delete; + + procedure Delete (Container : in out Map; Position : in out Cursor) is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Delete equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor of Delete designates wrong map"; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "Delete attempted to tamper with cursors (map is busy)"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Delete"); + + HT_Ops.Delete_Node_Sans_Free (Container, Position.Node); + HT_Ops.Free (Container, Position.Node); + + Position := No_Element; + end Delete; + + ------------- + -- Element -- + ------------- + + function Element (Container : Map; Key : Key_Type) return Element_Type is + Node : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with + "no element available because key not in map"; + end if; + + return Container.Nodes (Node).Element; + end Element; + + function Element (Position : Cursor) return Element_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of function Element equals No_Element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in function Element"); + + return Position.Container.Nodes (Position.Node).Element; + end Element; + + ------------------------- + -- Equivalent_Key_Node -- + ------------------------- + + function Equivalent_Key_Node + (Key : Key_Type; + Node : Node_Type) return Boolean is + begin + return Equivalent_Keys (Key, Node.Key); + end Equivalent_Key_Node; + + --------------------- + -- Equivalent_Keys -- + --------------------- + + function Equivalent_Keys (Left, Right : Cursor) + return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with + "Left cursor of Equivalent_Keys equals No_Element"; + end if; + + if Right.Node = 0 then + raise Constraint_Error with + "Right cursor of Equivalent_Keys equals No_Element"; + end if; + + pragma Assert (Vet (Left), "Left cursor of Equivalent_Keys is bad"); + pragma Assert (Vet (Right), "Right cursor of Equivalent_Keys is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return Equivalent_Keys (LN.Key, RN.Key); + end; + end Equivalent_Keys; + + function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with + "Left cursor of Equivalent_Keys equals No_Element"; + end if; + + pragma Assert (Vet (Left), "Left cursor in Equivalent_Keys is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + + begin + return Equivalent_Keys (LN.Key, Right); + end; + end Equivalent_Keys; + + function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean is + begin + if Right.Node = 0 then + raise Constraint_Error with + "Right cursor of Equivalent_Keys equals No_Element"; + end if; + + pragma Assert (Vet (Right), "Right cursor of Equivalent_Keys is bad"); + + declare + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return Equivalent_Keys (Left, RN.Key); + end; + end Equivalent_Keys; + + ------------- + -- Exclude -- + ------------- + + procedure Exclude (Container : in out Map; Key : Key_Type) is + X : Count_Type; + begin + Key_Ops.Delete_Key_Sans_Free (Container, Key, X); + HT_Ops.Free (Container, X); + end Exclude; + + ---------- + -- Find -- + ---------- + + function Find (Container : Map; Key : Key_Type) return Cursor is + Node : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Find; + + ----------- + -- First -- + ----------- + + function First (Container : Map) return Cursor is + Node : constant Count_Type := HT_Ops.First (Container); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end First; + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element (Position : Cursor) return Boolean is + begin + pragma Assert (Vet (Position), "bad cursor in Has_Element"); + return Position.Node /= 0; + end Has_Element; + + --------------- + -- Hash_Node -- + --------------- + + function Hash_Node (Node : Node_Type) return Hash_Type is + begin + return Hash (Node.Key); + end Hash_Node; + + ------------- + -- Include -- + ------------- + + procedure Include + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type) + is + Position : Cursor; + Inserted : Boolean; + + begin + Insert (Container, Key, New_Item, Position, Inserted); + + if not Inserted then + if Container.Lock > 0 then + raise Program_Error with + "Include attempted to tamper with elements (map is locked)"; + end if; + + declare + N : Node_Type renames Container.Nodes (Position.Node); + + begin + N.Key := Key; + N.Element := New_Item; + end; + end if; + end Include; + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out Map; + Key : Key_Type; + Position : out Cursor; + Inserted : out Boolean) + is + procedure Assign_Key (Node : in out Node_Type); + pragma Inline (Assign_Key); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Local_Insert is + new Key_Ops.Generic_Conditional_Insert (New_Node); + + procedure Allocate is + new HT_Ops.Generic_Allocate (Assign_Key); + + ----------------- + -- Assign_Key -- + ----------------- + + procedure Assign_Key (Node : in out Node_Type) is + begin + Node.Key := Key; + -- Node.Element := New_Item; + end Assign_Key; + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + begin + Allocate (Container, Result); + return Result; + end New_Node; + + -- Start of processing for Insert + + begin + -- ??? + -- if HT_Ops.Capacity (HT) = 0 then + -- HT_Ops.Reserve_Capacity (HT, 1); + -- end if; + + Local_Insert (Container, Key, Position.Node, Inserted); + + -- ??? + -- if Inserted + -- and then HT.Length > HT_Ops.Capacity (HT) + -- then + -- HT_Ops.Reserve_Capacity (HT, HT.Length); + -- end if; + + Position.Container := Container'Unchecked_Access; + end Insert; + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean) + is + procedure Assign_Key (Node : in out Node_Type); + pragma Inline (Assign_Key); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Local_Insert is + new Key_Ops.Generic_Conditional_Insert (New_Node); + + procedure Allocate is + new HT_Ops.Generic_Allocate (Assign_Key); + + ----------------- + -- Assign_Key -- + ----------------- + + procedure Assign_Key (Node : in out Node_Type) is + begin + Node.Key := Key; + Node.Element := New_Item; + end Assign_Key; + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + begin + Allocate (Container, Result); + return Result; + end New_Node; + + -- Start of processing for Insert + + begin + -- ?? + -- if HT_Ops.Capacity (HT) = 0 then + -- HT_Ops.Reserve_Capacity (HT, 1); + -- end if; + + Local_Insert (Container, Key, Position.Node, Inserted); + + -- ??? + -- if Inserted + -- and then HT.Length > HT_Ops.Capacity (HT) + -- then + -- HT_Ops.Reserve_Capacity (HT, HT.Length); + -- end if; + + Position.Container := Container'Unchecked_Access; + end Insert; + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type) + is + Position : Cursor; + pragma Unreferenced (Position); + + Inserted : Boolean; + + begin + Insert (Container, Key, New_Item, Position, Inserted); + + if not Inserted then + raise Constraint_Error with + "attempt to insert key already in map"; + end if; + end Insert; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty (Container : Map) return Boolean is + begin + return Container.Length = 0; + end Is_Empty; + + ------------- + -- Iterate -- + ------------- + + procedure Iterate + (Container : Map; + Process : not null access procedure (Position : Cursor)) + is + procedure Process_Node (Node : Count_Type); + pragma Inline (Process_Node); + + procedure Local_Iterate is new HT_Ops.Generic_Iteration (Process_Node); + + ------------------ + -- Process_Node -- + ------------------ + + procedure Process_Node (Node : Count_Type) is + begin + Process (Cursor'(Container'Unrestricted_Access, Node)); + end Process_Node; + + B : Natural renames Container'Unrestricted_Access.Busy; + + -- Start of processing for Iterate + + begin + B := B + 1; + + begin + Local_Iterate (Container); + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Iterate; + + --------- + -- Key -- + --------- + + function Key (Position : Cursor) return Key_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of function Key equals No_Element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in function Key"); + + return Position.Container.Nodes (Position.Node).Key; + end Key; + + ------------ + -- Length -- + ------------ + + function Length (Container : Map) return Count_Type is + begin + return Container.Length; + end Length; + + ---------- + -- Move -- + ---------- + + procedure Move + (Target : in out Map; + Source : in out Map) + is + begin + if Target'Address = Source'Address then + return; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Assign (Target => Target, Source => Source); + end Move; + + ---------- + -- Next -- + ---------- + + function Next (Node : Node_Type) return Count_Type is + begin + return Node.Next; + end Next; + + function Next (Position : Cursor) return Cursor is + begin + if Position.Node = 0 then + return No_Element; + end if; + + pragma Assert (Vet (Position), "bad cursor in function Next"); + + declare + M : Map renames Position.Container.all; + Node : constant Count_Type := HT_Ops.Next (M, Position.Node); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Next; + + procedure Next (Position : in out Cursor) is + begin + Position := Next (Position); + end Next; + + ------------------- + -- Query_Element -- + ------------------- + + procedure Query_Element + (Position : Cursor; + Process : not null access + procedure (Key : Key_Type; Element : Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Query_Element equals No_Element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Query_Element"); + + declare + M : Map renames Position.Container.all; + N : Node_Type renames M.Nodes (Position.Node); + B : Natural renames M.Busy; + L : Natural renames M.Lock; + + begin + B := B + 1; + L := L + 1; + + declare + + begin + Process (N.Key, N.Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Query_Element; + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Map) + is + function Read_Node + (Stream : not null access Root_Stream_Type'Class) return Count_Type; + -- pragma Inline (Read_Node); ??? + + procedure Read_Nodes is new HT_Ops.Generic_Read (Read_Node); + + --------------- + -- Read_Node -- + --------------- + + function Read_Node + (Stream : not null access Root_Stream_Type'Class) return Count_Type + is + procedure Read_Element (Node : in out Node_Type); + -- pragma Inline (Read_Element); ??? + + procedure Allocate is + new HT_Ops.Generic_Allocate (Read_Element); + + procedure Read_Element (Node : in out Node_Type) is + begin + Key_Type'Read (Stream, Node.Key); + Element_Type'Read (Stream, Node.Element); + end Read_Element; + + Node : Count_Type; + + -- Start of processing for Read_Node + + begin + Allocate (Container, Node); + return Node; + end Read_Node; + + -- Start of processing for Read + + begin + Read_Nodes (Stream, Container); + end Read; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor) + is + begin + raise Program_Error with "attempt to stream map cursor"; + end Read; + + ------------- + -- Replace -- + ------------- + + procedure Replace + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type) + is + Node : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with + "attempt to replace key not in map"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "Replace attempted to tamper with elements (map is locked)"; + end if; + + declare + N : Node_Type renames Container.Nodes (Node); + + begin + N.Key := Key; + N.Element := New_Item; + end; + end Replace; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Container : in out Map; + Position : Cursor; + New_Item : Element_Type) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Replace_Element equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor of Replace_Element designates wrong map"; + end if; + + if Position.Container.Lock > 0 then + raise Program_Error with + "Replace_Element attempted to tamper with elements (map is locked)"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Replace_Element"); + + Container.Nodes (Position.Node).Element := New_Item; + end Replace_Element; + + ---------------------- + -- Reserve_Capacity -- + ---------------------- + + procedure Reserve_Capacity + (Container : in out Map; + Capacity : Count_Type) + is + begin + if Capacity > Container.Capacity then + raise Capacity_Error with "requested capacity is too large"; + end if; + end Reserve_Capacity; + + -------------- + -- Set_Next -- + -------------- + + procedure Set_Next (Node : in out Node_Type; Next : Count_Type) is + begin + Node.Next := Next; + end Set_Next; + + -------------------- + -- Update_Element -- + -------------------- + + procedure Update_Element + (Container : in out Map; + Position : Cursor; + Process : not null access procedure (Key : Key_Type; + Element : in out Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Update_Element equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor of Update_Element designates wrong map"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Update_Element"); + + declare + N : Node_Type renames Container.Nodes (Position.Node); + B : Natural renames Container.Busy; + L : Natural renames Container.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (N.Key, N.Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Update_Element; + + --------- + -- Vet -- + --------- + + function Vet (Position : Cursor) return Boolean is + begin + if Position.Node = 0 then + return Position.Container = null; + end if; + + if Position.Container = null then + return False; + end if; + + declare + M : Map renames Position.Container.all; + X : Count_Type; + + begin + if M.Length = 0 then + return False; + end if; + + if M.Capacity = 0 then + return False; + end if; + + if M.Buckets'Length = 0 then + return False; + end if; + + if Position.Node > M.Capacity then + return False; + end if; + + if M.Nodes (Position.Node).Next = Position.Node then + return False; + end if; + + X := M.Buckets (Key_Ops.Index (M, M.Nodes (Position.Node).Key)); + + for J in 1 .. M.Length loop + if X = Position.Node then + return True; + end if; + + if X = 0 then + return False; + end if; + + if X = M.Nodes (X).Next then -- to prevent unnecessary looping + return False; + end if; + + X := M.Nodes (X).Next; + end loop; + + return False; + end; + end Vet; + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Map) + is + procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type); + pragma Inline (Write_Node); + + procedure Write_Nodes is new HT_Ops.Generic_Write (Write_Node); + + ---------------- + -- Write_Node -- + ---------------- + + procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type) + is + begin + Key_Type'Write (Stream, Node.Key); + Element_Type'Write (Stream, Node.Element); + end Write_Node; + + -- Start of processing for Write + + begin + Write_Nodes (Stream, Container); + end Write; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor) + is + begin + raise Program_Error with "attempt to stream map cursor"; + end Write; + + end Ada.Containers.Bounded_Hashed_Maps; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cbhama.ads gcc-4.6.0/gcc/ada/a-cbhama.ads *** gcc-4.5.2/gcc/ada/a-cbhama.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cbhama.ads Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,343 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ M A P S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + private with Ada.Containers.Hash_Tables; + private with Ada.Streams; + + generic + type Key_Type is private; + type Element_Type is private; + + with function Hash (Key : Key_Type) return Hash_Type; + with function Equivalent_Keys (Left, Right : Key_Type) return Boolean; + with function "=" (Left, Right : Element_Type) return Boolean is <>; + + package Ada.Containers.Bounded_Hashed_Maps is + pragma Pure; + pragma Remote_Types; + + type Map (Capacity : Count_Type; Modulus : Hash_Type) is tagged private; + pragma Preelaborable_Initialization (Map); + + type Cursor is private; + pragma Preelaborable_Initialization (Cursor); + + Empty_Map : constant Map; + -- Map objects declared without an initialization expression are + -- initialized to the value Empty_Map. + + No_Element : constant Cursor; + -- Cursor objects declared without an initialization expression are + -- initialized to the value No_Element. + + function "=" (Left, Right : Map) return Boolean; + -- For each key/element pair in Left, equality attempts to find the key in + -- Right; if a search fails the equality returns False. The search works by + -- calling Hash to find the bucket in the Right map that corresponds to the + -- Left key. If bucket is non-empty, then equality calls Equivalent_Keys + -- to compare the key (in Left) to the key of each node in the bucket (in + -- Right); if the keys are equivalent, then the equality test for this + -- key/element pair (in Left) completes by calling the element equality + -- operator to compare the element (in Left) to the element of the node + -- (in Right) whose key matched. + + function Capacity (Container : Map) return Count_Type; + -- Returns the current capacity of the map. Capacity is the maximum length + -- before which rehashing in guaranteed not to occur. + + procedure Reserve_Capacity (Container : in out Map; Capacity : Count_Type); + -- If the value of the Capacity actual parameter is less or equal to + -- Container.Capacity, then the operation has no effect. Otherwise it + -- raises Capacity_Error (as no expansion of capacity is possible for a + -- bounded form). + + function Default_Modulus (Capacity : Count_Type) return Hash_Type; + -- Returns a modulus value (hash table size) which is optimal for the + -- specified capacity (which corresponds to the maximum number of items). + + function Length (Container : Map) return Count_Type; + -- Returns the number of items in the map + + function Is_Empty (Container : Map) return Boolean; + -- Equivalent to Length (Container) = 0 + + procedure Clear (Container : in out Map); + -- Removes all of the items from the map + + function Key (Position : Cursor) return Key_Type; + -- Returns the key of the node designated by the cursor + + function Element (Position : Cursor) return Element_Type; + -- Returns the element of the node designated by the cursor + + procedure Replace_Element + (Container : in out Map; + Position : Cursor; + New_Item : Element_Type); + -- Assigns the value New_Item to the element designated by the cursor + + procedure Query_Element + (Position : Cursor; + Process : not null access + procedure (Key : Key_Type; Element : Element_Type)); + -- Calls Process with the key and element (both having only a constant + -- view) of the node designed by the cursor. + + procedure Update_Element + (Container : in out Map; + Position : Cursor; + Process : not null access + procedure (Key : Key_Type; Element : in out Element_Type)); + -- Calls Process with the key (with only a constant view) and element (with + -- a variable view) of the node designed by the cursor. + + procedure Assign (Target : in out Map; Source : Map); + -- If Target denotes the same object as Source, then the operation has no + -- effect. If the Target capacity is less then the Source length, then + -- Assign raises Capacity_Error. Otherwise, Assign clears Target and then + -- copies the (active) elements from Source to Target. + + function Copy + (Source : Map; + Capacity : Count_Type := 0; + Modulus : Hash_Type := 0) return Map; + -- Constructs a new set object whose elements correspond to Source. If the + -- Capacity parameter is 0, then the capacity of the result is the same as + -- the length of Source. If the Capacity parameter is equal or greater than + -- the length of Source, then the capacity of the result is the specified + -- value. Otherwise, Copy raises Capacity_Error. If the Modulus parameter + -- is 0, then the modulus of the result is the value returned by a call to + -- Default_Modulus with the capacity parameter determined as above; + -- otherwise the modulus of the result is the specified value. + + procedure Move (Target : in out Map; Source : in out Map); + -- Clears Target (if it's not empty), and then moves (not copies) the + -- buckets array and nodes from Source to Target. + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean); + -- Conditionally inserts New_Item into the map. If Key is already in the + -- map, then Inserted returns False and Position designates the node + -- containing the existing key/element pair (neither of which is modified). + -- If Key is not already in the map, the Inserted returns True and Position + -- designates the newly-inserted node container Key and New_Item. The + -- search for the key works as follows. Hash is called to determine Key's + -- bucket; if the bucket is non-empty, then Equivalent_Keys is called to + -- compare Key to each node in that bucket. If the bucket is empty, or + -- there were no matching keys in the bucket, the search "fails" and the + -- key/item pair is inserted in the map (and Inserted returns True); + -- otherwise, the search "succeeds" (and Inserted returns False). + + procedure Insert + (Container : in out Map; + Key : Key_Type; + Position : out Cursor; + Inserted : out Boolean); + -- The same as the (conditional) Insert that accepts an element parameter, + -- with the difference that if Inserted returns True, then the element of + -- the newly-inserted node is initialized to its default value. + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type); + -- Attempts to insert Key into the map, performing the usual search (which + -- involves calling both Hash and Equivalent_Keys); if the search succeeds + -- (because Key is already in the map), then it raises Constraint_Error. + -- (This version of Insert is similar to Replace, but having the opposite + -- exception behavior. It is intended for use when you want to assert that + -- Key is not already in the map.) + + procedure Include + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type); + -- Attempts to insert Key into the map. If Key is already in the map, then + -- both the existing key and element are assigned the values of Key and + -- New_Item, respectively. (This version of Insert only raises an exception + -- if cursor tampering occurs. It is intended for use when you want to + -- insert the key/element pair in the map, and you don't care whether Key + -- is already present.) + + procedure Replace + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type); + -- Searches for Key in the map; if the search fails (because Key was not in + -- the map), then it raises Constraint_Error. Otherwise, both the existing + -- key and element are assigned the values of Key and New_Item rsp. (This + -- is similar to Insert, but with the opposite exception behavior. It is to + -- be used when you want to assert that Key is already in the map.) + + procedure Exclude (Container : in out Map; Key : Key_Type); + -- Searches for Key in the map, and if found, removes its node from the map + -- and then deallocates it. The search works as follows. The operation + -- calls Hash to determine the key's bucket; if the bucket is not empty, it + -- calls Equivalent_Keys to compare Key to each key in the bucket. (This is + -- the deletion analog of Include. It is intended for use when you want to + -- remove the item from the map, but don't care whether the key is already + -- in the map.) + + procedure Delete (Container : in out Map; Key : Key_Type); + -- Searches for Key in the map (which involves calling both Hash and + -- Equivalent_Keys). If the search fails, then the operation raises + -- Constraint_Error. Otherwise it removes the node from the map and then + -- deallocates it. (This is the deletion analog of non-conditional + -- Insert. It is intended for use when you want to assert that the item is + -- already in the map.) + + procedure Delete (Container : in out Map; Position : in out Cursor); + -- Removes the node designated by Position from the map, and then + -- deallocates the node. The operation calls Hash to determine the bucket, + -- and then compares Position to each node in the bucket until there's a + -- match (it does not call Equivalent_Keys). + + function First (Container : Map) return Cursor; + -- Returns a cursor that designates the first non-empty bucket, by + -- searching from the beginning of the buckets array. + + function Next (Position : Cursor) return Cursor; + -- Returns a cursor that designates the node that follows the current one + -- designated by Position. If Position designates the last node in its + -- bucket, the operation calls Hash to compute the index of this bucket, + -- and searches the buckets array for the first non-empty bucket, starting + -- from that index; otherwise, it simply follows the link to the next node + -- in the same bucket. + + procedure Next (Position : in out Cursor); + -- Equivalent to Position := Next (Position) + + function Find (Container : Map; Key : Key_Type) return Cursor; + -- Searches for Key in the map. Find calls Hash to determine the key's + -- bucket; if the bucket is not empty, it calls Equivalent_Keys to compare + -- Key to each key in the bucket. If the search succeeds, Find returns a + -- cursor designating the matching node; otherwise, it returns No_Element. + + function Contains (Container : Map; Key : Key_Type) return Boolean; + -- Equivalent to Find (Container, Key) /= No_Element + + function Element (Container : Map; Key : Key_Type) return Element_Type; + -- Equivalent to Element (Find (Container, Key)) + + function Has_Element (Position : Cursor) return Boolean; + -- Equivalent to Position /= No_Element + + function Equivalent_Keys (Left, Right : Cursor) return Boolean; + -- Returns the result of calling Equivalent_Keys with the keys of the nodes + -- designated by cursors Left and Right. + + function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean; + -- Returns the result of calling Equivalent_Keys with key of the node + -- designated by Left and key Right. + + function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean; + -- Returns the result of calling Equivalent_Keys with key Left and the node + -- designated by Right. + + procedure Iterate + (Container : Map; + Process : not null access procedure (Position : Cursor)); + -- Calls Process for each node in the map + + private + -- pragma Inline ("="); + pragma Inline (Length); + pragma Inline (Is_Empty); + pragma Inline (Clear); + pragma Inline (Key); + pragma Inline (Element); + pragma Inline (Move); + pragma Inline (Contains); + pragma Inline (Capacity); + pragma Inline (Reserve_Capacity); + pragma Inline (Has_Element); + pragma Inline (Equivalent_Keys); + pragma Inline (Next); + + type Node_Type is record + Key : Key_Type; + Element : Element_Type; + Next : Count_Type; + end record; + + package HT_Types is + new Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type); + + type Map (Capacity : Count_Type; Modulus : Hash_Type) is + new HT_Types.Hash_Table_Type (Capacity, Modulus) with null record; + + use HT_Types; + use Ada.Streams; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Map); + + for Map'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Map); + + for Map'Read use Read; + + type Map_Access is access all Map; + for Map_Access'Storage_Size use 0; + + type Cursor is record + Container : Map_Access; + Node : Count_Type; + end record; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor); + + for Cursor'Read use Read; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor); + + for Cursor'Write use Write; + + No_Element : constant Cursor := (Container => null, Node => 0); + + Empty_Map : constant Map := + (Hash_Table_Type with Capacity => 0, Modulus => 0); + + end Ada.Containers.Bounded_Hashed_Maps; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cbhase.adb gcc-4.6.0/gcc/ada/a-cbhase.adb *** gcc-4.5.2/gcc/ada/a-cbhase.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cbhase.adb Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,1737 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ S E T S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with Ada.Containers.Hash_Tables.Generic_Bounded_Operations; + pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Operations); + + with Ada.Containers.Hash_Tables.Generic_Bounded_Keys; + pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Keys); + + with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers; + + with System; use type System.Address; + + package body Ada.Containers.Bounded_Hashed_Sets is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Equivalent_Keys + (Key : Element_Type; + Node : Node_Type) return Boolean; + pragma Inline (Equivalent_Keys); + + function Hash_Node (Node : Node_Type) return Hash_Type; + pragma Inline (Hash_Node); + + procedure Insert + (Container : in out Set; + New_Item : Element_Type; + Node : out Count_Type; + Inserted : out Boolean); + + function Is_In + (HT : Set; + Key : Node_Type) return Boolean; + pragma Inline (Is_In); + + procedure Set_Element (Node : in out Node_Type; Item : Element_Type); + pragma Inline (Set_Element); + + function Next (Node : Node_Type) return Count_Type; + pragma Inline (Next); + + procedure Set_Next (Node : in out Node_Type; Next : Count_Type); + pragma Inline (Set_Next); + + function Vet (Position : Cursor) return Boolean; + + -------------------------- + -- Local Instantiations -- + -------------------------- + + package HT_Ops is new Hash_Tables.Generic_Bounded_Operations + (HT_Types => HT_Types, + Hash_Node => Hash_Node, + Next => Next, + Set_Next => Set_Next); + + package Element_Keys is new Hash_Tables.Generic_Bounded_Keys + (HT_Types => HT_Types, + Next => Next, + Set_Next => Set_Next, + Key_Type => Element_Type, + Hash => Hash, + Equivalent_Keys => Equivalent_Keys); + + procedure Replace_Element is + new Element_Keys.Generic_Replace_Element (Hash_Node, Set_Element); + + --------- + -- "=" -- + --------- + + function "=" (Left, Right : Set) return Boolean is + function Find_Equal_Key + (R_HT : Hash_Table_Type'Class; + L_Node : Node_Type) return Boolean; + pragma Inline (Find_Equal_Key); + + function Is_Equal is + new HT_Ops.Generic_Equal (Find_Equal_Key); + + -------------------- + -- Find_Equal_Key -- + -------------------- + + function Find_Equal_Key + (R_HT : Hash_Table_Type'Class; + L_Node : Node_Type) return Boolean + is + R_Index : constant Hash_Type := + Element_Keys.Index (R_HT, L_Node.Element); + + R_Node : Count_Type := R_HT.Buckets (R_Index); + + begin + loop + if R_Node = 0 then + return False; + end if; + + if L_Node.Element = R_HT.Nodes (R_Node).Element then + return True; + end if; + + R_Node := Next (R_HT.Nodes (R_Node)); + end loop; + end Find_Equal_Key; + + -- Start of processing for "=" + + begin + return Is_Equal (Left, Right); + end "="; + + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out Set; Source : Set) is + procedure Insert_Element (Source_Node : Count_Type); + + procedure Insert_Elements is + new HT_Ops.Generic_Iteration (Insert_Element); + + -------------------- + -- Insert_Element -- + -------------------- + + procedure Insert_Element (Source_Node : Count_Type) is + N : Node_Type renames Source.Nodes (Source_Node); + X : Count_Type; + B : Boolean; + + begin + Insert (Target, N.Element, X, B); + pragma Assert (B); + end Insert_Element; + + -- Start of processing for Assign + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error + with "Target capacity is less than Source length"; + end if; + + HT_Ops.Clear (Target); + Insert_Elements (Source); + end Assign; + + -------------- + -- Capacity -- + -------------- + + function Capacity (Container : Set) return Count_Type is + begin + return Container.Capacity; + end Capacity; + + ----------- + -- Clear -- + ----------- + + procedure Clear (Container : in out Set) is + begin + HT_Ops.Clear (Container); + end Clear; + + -------------- + -- Contains -- + -------------- + + function Contains (Container : Set; Item : Element_Type) return Boolean is + begin + return Find (Container, Item) /= No_Element; + end Contains; + + ---------- + -- Copy -- + ---------- + + function Copy + (Source : Set; + Capacity : Count_Type := 0; + Modulus : Hash_Type := 0) return Set + is + C : Count_Type; + M : Hash_Type; + + begin + if Capacity = 0 then + C := Source.Length; + + elsif Capacity >= Source.Length then + C := Capacity; + + else + raise Capacity_Error with "Capacity value too small"; + end if; + + if Modulus = 0 then + M := Default_Modulus (C); + else + M := Modulus; + end if; + + return Target : Set (Capacity => C, Modulus => M) do + Assign (Target => Target, Source => Source); + end return; + end Copy; + + --------------------- + -- Default_Modulus -- + --------------------- + + function Default_Modulus (Capacity : Count_Type) return Hash_Type is + begin + return To_Prime (Capacity); + end Default_Modulus; + + ------------ + -- Delete -- + ------------ + + procedure Delete + (Container : in out Set; + Item : Element_Type) + is + X : Count_Type; + + begin + Element_Keys.Delete_Key_Sans_Free (Container, Item, X); + + if X = 0 then + raise Constraint_Error with "attempt to delete element not in set"; + end if; + + HT_Ops.Free (Container, X); + end Delete; + + procedure Delete + (Container : in out Set; + Position : in out Cursor) + is + begin + if Position.Node = 0 then + raise Constraint_Error with "Position cursor equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with "Position cursor designates wrong set"; + end if; + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (set is busy)"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Delete"); + + HT_Ops.Delete_Node_Sans_Free (Container, Position.Node); + HT_Ops.Free (Container, Position.Node); + + Position := No_Element; + end Delete; + + ---------------- + -- Difference -- + ---------------- + + procedure Difference + (Target : in out Set; + Source : Set) + is + Tgt_Node, Src_Node : Count_Type; + + TN : Nodes_Type renames Target.Nodes; + SN : Nodes_Type renames Source.Nodes; + + begin + if Target'Address = Source'Address then + HT_Ops.Clear (Target); + return; + end if; + + if Source.Length = 0 then + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (set is busy)"; + end if; + + if Source.Length < Target.Length then + Src_Node := HT_Ops.First (Source); + while Src_Node /= 0 loop + Tgt_Node := Element_Keys.Find (Target, SN (Src_Node).Element); + + if Tgt_Node /= 0 then + HT_Ops.Delete_Node_Sans_Free (Target, Tgt_Node); + HT_Ops.Free (Target, Tgt_Node); + end if; + + Src_Node := HT_Ops.Next (Source, Src_Node); + end loop; + + else + Tgt_Node := HT_Ops.First (Target); + while Tgt_Node /= 0 loop + if Is_In (Source, TN (Tgt_Node)) then + declare + X : constant Count_Type := Tgt_Node; + begin + Tgt_Node := HT_Ops.Next (Target, Tgt_Node); + HT_Ops.Delete_Node_Sans_Free (Target, X); + HT_Ops.Free (Target, X); + end; + + else + Tgt_Node := HT_Ops.Next (Target, Tgt_Node); + end if; + end loop; + end if; + end Difference; + + function Difference (Left, Right : Set) return Set is + begin + if Left'Address = Right'Address then + return Empty_Set; + end if; + + if Left.Length = 0 then + return Empty_Set; + end if; + + if Right.Length = 0 then + return Left; + end if; + + return Result : Set (Left.Length, To_Prime (Left.Length)) do + Iterate_Left : declare + procedure Process (L_Node : Count_Type); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (L_Node : Count_Type) is + N : Node_Type renames Left.Nodes (L_Node); + X : Count_Type; + B : Boolean; + + begin + if not Is_In (Right, N) then + Insert (Result, N.Element, X, B); -- optimize this ??? + pragma Assert (B); + pragma Assert (X > 0); + end if; + end Process; + + -- Start of processing for Iterate_Left + + begin + Iterate (Left); + end Iterate_Left; + end return; + end Difference; + + ------------- + -- Element -- + ------------- + + function Element (Position : Cursor) return Element_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with "Position cursor equals No_Element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in function Element"); + + declare + S : Set renames Position.Container.all; + N : Node_Type renames S.Nodes (Position.Node); + + begin + return N.Element; + end; + end Element; + + --------------------- + -- Equivalent_Sets -- + --------------------- + + function Equivalent_Sets (Left, Right : Set) return Boolean is + function Find_Equivalent_Key + (R_HT : Hash_Table_Type'Class; + L_Node : Node_Type) return Boolean; + pragma Inline (Find_Equivalent_Key); + + function Is_Equivalent is + new HT_Ops.Generic_Equal (Find_Equivalent_Key); + + ------------------------- + -- Find_Equivalent_Key -- + ------------------------- + + function Find_Equivalent_Key + (R_HT : Hash_Table_Type'Class; + L_Node : Node_Type) return Boolean + is + R_Index : constant Hash_Type := + Element_Keys.Index (R_HT, L_Node.Element); + + R_Node : Count_Type := R_HT.Buckets (R_Index); + + RN : Nodes_Type renames R_HT.Nodes; + + begin + loop + if R_Node = 0 then + return False; + end if; + + if Equivalent_Elements (L_Node.Element, RN (R_Node).Element) then + return True; + end if; + + R_Node := HT_Ops.Next (R_HT, R_Node); + end loop; + end Find_Equivalent_Key; + + -- Start of processing for Equivalent_Sets + + begin + return Is_Equivalent (Left, Right); + end Equivalent_Sets; + + ------------------------- + -- Equivalent_Elements -- + ------------------------- + + function Equivalent_Elements (Left, Right : Cursor) + return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with + "Left cursor of Equivalent_Elements equals No_Element"; + end if; + + if Right.Node = 0 then + raise Constraint_Error with + "Right cursor of Equivalent_Elements equals No_Element"; + end if; + + pragma Assert (Vet (Left), "bad Left cursor in Equivalent_Elements"); + pragma Assert (Vet (Right), "bad Right cursor in Equivalent_Elements"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return Equivalent_Elements (LN.Element, RN.Element); + end; + end Equivalent_Elements; + + function Equivalent_Elements (Left : Cursor; Right : Element_Type) + return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with + "Left cursor of Equivalent_Elements equals No_Element"; + end if; + + pragma Assert (Vet (Left), "Left cursor in Equivalent_Elements is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + begin + return Equivalent_Elements (LN.Element, Right); + end; + end Equivalent_Elements; + + function Equivalent_Elements (Left : Element_Type; Right : Cursor) + return Boolean is + begin + if Right.Node = 0 then + raise Constraint_Error with + "Right cursor of Equivalent_Elements equals No_Element"; + end if; + + pragma Assert + (Vet (Right), + "Right cursor of Equivalent_Elements is bad"); + + declare + RN : Node_Type renames Right.Container.Nodes (Right.Node); + begin + return Equivalent_Elements (Left, RN.Element); + end; + end Equivalent_Elements; + + --------------------- + -- Equivalent_Keys -- + --------------------- + + function Equivalent_Keys (Key : Element_Type; Node : Node_Type) + return Boolean is + begin + return Equivalent_Elements (Key, Node.Element); + end Equivalent_Keys; + + ------------- + -- Exclude -- + ------------- + + procedure Exclude + (Container : in out Set; + Item : Element_Type) + is + X : Count_Type; + begin + Element_Keys.Delete_Key_Sans_Free (Container, Item, X); + HT_Ops.Free (Container, X); + end Exclude; + + ---------- + -- Find -- + ---------- + + function Find + (Container : Set; + Item : Element_Type) return Cursor + is + Node : constant Count_Type := Element_Keys.Find (Container, Item); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Find; + + ----------- + -- First -- + ----------- + + function First (Container : Set) return Cursor is + Node : constant Count_Type := HT_Ops.First (Container); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end First; + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element (Position : Cursor) return Boolean is + begin + pragma Assert (Vet (Position), "bad cursor in Has_Element"); + return Position.Node /= 0; + end Has_Element; + + --------------- + -- Hash_Node -- + --------------- + + function Hash_Node (Node : Node_Type) return Hash_Type is + begin + return Hash (Node.Element); + end Hash_Node; + + ------------- + -- Include -- + ------------- + + procedure Include + (Container : in out Set; + New_Item : Element_Type) + is + Position : Cursor; + Inserted : Boolean; + + begin + Insert (Container, New_Item, Position, Inserted); + + if not Inserted then + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (set is locked)"; + end if; + + Container.Nodes (Position.Node).Element := New_Item; + end if; + end Include; + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out Set; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean) + is + begin + Insert (Container, New_Item, Position.Node, Inserted); + Position.Container := Container'Unchecked_Access; + end Insert; + + procedure Insert + (Container : in out Set; + New_Item : Element_Type) + is + Position : Cursor; + pragma Unreferenced (Position); + + Inserted : Boolean; + + begin + Insert (Container, New_Item, Position, Inserted); + + if not Inserted then + raise Constraint_Error with + "attempt to insert element already in set"; + end if; + end Insert; + + procedure Insert + (Container : in out Set; + New_Item : Element_Type; + Node : out Count_Type; + Inserted : out Boolean) + is + procedure Allocate_Set_Element (Node : in out Node_Type); + pragma Inline (Allocate_Set_Element); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Local_Insert is + new Element_Keys.Generic_Conditional_Insert (New_Node); + + procedure Allocate is + new HT_Ops.Generic_Allocate (Allocate_Set_Element); + + --------------------------- + -- Allocate_Set_Element -- + --------------------------- + + procedure Allocate_Set_Element (Node : in out Node_Type) is + begin + Node.Element := New_Item; + end Allocate_Set_Element; + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + begin + Allocate (Container, Result); + return Result; + end New_Node; + + -- Start of processing for Insert + + begin + -- ??? + -- if HT_Ops.Capacity (HT) = 0 then + -- HT_Ops.Reserve_Capacity (HT, 1); + -- end if; + + Local_Insert (Container, New_Item, Node, Inserted); + + -- ??? + -- if Inserted + -- and then HT.Length > HT_Ops.Capacity (HT) + -- then + -- HT_Ops.Reserve_Capacity (HT, HT.Length); + -- end if; + end Insert; + + ------------------ + -- Intersection -- + ------------------ + + procedure Intersection + (Target : in out Set; + Source : Set) + is + Tgt_Node : Count_Type; + TN : Nodes_Type renames Target.Nodes; + + begin + if Target'Address = Source'Address then + return; + end if; + + if Source.Length = 0 then + HT_Ops.Clear (Target); + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (set is busy)"; + end if; + + Tgt_Node := HT_Ops.First (Target); + while Tgt_Node /= 0 loop + if Is_In (Source, TN (Tgt_Node)) then + Tgt_Node := HT_Ops.Next (Target, Tgt_Node); + + else + declare + X : constant Count_Type := Tgt_Node; + begin + Tgt_Node := HT_Ops.Next (Target, Tgt_Node); + HT_Ops.Delete_Node_Sans_Free (Target, X); + HT_Ops.Free (Target, X); + end; + end if; + end loop; + end Intersection; + + function Intersection (Left, Right : Set) return Set is + C : Count_Type; + + begin + if Left'Address = Right'Address then + return Left; + end if; + + C := Count_Type'Min (Left.Length, Right.Length); + + if C = 0 then + return Empty_Set; + end if; + + return Result : Set (C, To_Prime (C)) do + Iterate_Left : declare + procedure Process (L_Node : Count_Type); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (L_Node : Count_Type) is + N : Node_Type renames Left.Nodes (L_Node); + X : Count_Type; + B : Boolean; + + begin + if Is_In (Right, N) then + Insert (Result, N.Element, X, B); -- optimize ??? + pragma Assert (B); + pragma Assert (X > 0); + end if; + end Process; + + -- Start of processing for Iterate_Left + + begin + Iterate (Left); + end Iterate_Left; + end return; + end Intersection; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty (Container : Set) return Boolean is + begin + return Container.Length = 0; + end Is_Empty; + + ----------- + -- Is_In -- + ----------- + + function Is_In (HT : Set; Key : Node_Type) return Boolean is + begin + return Element_Keys.Find (HT, Key.Element) /= 0; + end Is_In; + + --------------- + -- Is_Subset -- + --------------- + + function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is + Subset_Node : Count_Type; + SN : Nodes_Type renames Subset.Nodes; + + begin + if Subset'Address = Of_Set'Address then + return True; + end if; + + if Subset.Length > Of_Set.Length then + return False; + end if; + + Subset_Node := HT_Ops.First (Subset); + while Subset_Node /= 0 loop + if not Is_In (Of_Set, SN (Subset_Node)) then + return False; + end if; + Subset_Node := HT_Ops.Next (Subset, Subset_Node); + end loop; + + return True; + end Is_Subset; + + ------------- + -- Iterate -- + ------------- + + procedure Iterate + (Container : Set; + Process : not null access procedure (Position : Cursor)) + is + procedure Process_Node (Node : Count_Type); + pragma Inline (Process_Node); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process_Node); + + ------------------ + -- Process_Node -- + ------------------ + + procedure Process_Node (Node : Count_Type) is + begin + Process (Cursor'(Container'Unrestricted_Access, Node)); + end Process_Node; + + B : Natural renames Container'Unrestricted_Access.Busy; + + -- Start of processing for Iterate + + begin + B := B + 1; + + begin + Iterate (Container); + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Iterate; + + ------------ + -- Length -- + ------------ + + function Length (Container : Set) return Count_Type is + begin + return Container.Length; + end Length; + + ---------- + -- Move -- + ---------- + + procedure Move (Target : in out Set; Source : in out Set) is + begin + if Target'Address = Source'Address then + return; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Assign (Target => Target, Source => Source); + end Move; + + ---------- + -- Next -- + ---------- + + function Next (Node : Node_Type) return Count_Type is + begin + return Node.Next; + end Next; + + function Next (Position : Cursor) return Cursor is + begin + if Position.Node = 0 then + return No_Element; + end if; + + pragma Assert (Vet (Position), "bad cursor in Next"); + + declare + HT : Set renames Position.Container.all; + Node : constant Count_Type := HT_Ops.Next (HT, Position.Node); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Next; + + procedure Next (Position : in out Cursor) is + begin + Position := Next (Position); + end Next; + + ------------- + -- Overlap -- + ------------- + + function Overlap (Left, Right : Set) return Boolean is + Left_Node : Count_Type; + + begin + if Right.Length = 0 then + return False; + end if; + + if Left'Address = Right'Address then + return True; + end if; + + Left_Node := HT_Ops.First (Left); + while Left_Node /= 0 loop + if Is_In (Right, Left.Nodes (Left_Node)) then + return True; + end if; + Left_Node := HT_Ops.Next (Left, Left_Node); + end loop; + + return False; + end Overlap; + + ------------------- + -- Query_Element -- + ------------------- + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Query_Element equals No_Element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Query_Element"); + + declare + S : Set renames Position.Container.all; + B : Natural renames S.Busy; + L : Natural renames S.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (S.Nodes (Position.Node).Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Query_Element; + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Set) + is + function Read_Node (Stream : not null access Root_Stream_Type'Class) + return Count_Type; + + procedure Read_Nodes is + new HT_Ops.Generic_Read (Read_Node); + + --------------- + -- Read_Node -- + --------------- + + function Read_Node (Stream : not null access Root_Stream_Type'Class) + return Count_Type + is + procedure Read_Element (Node : in out Node_Type); + pragma Inline (Read_Element); + + procedure Allocate is + new HT_Ops.Generic_Allocate (Read_Element); + + procedure Read_Element (Node : in out Node_Type) is + begin + Element_Type'Read (Stream, Node.Element); + end Read_Element; + + Node : Count_Type; + + -- Start of processing for Read_Node + + begin + Allocate (Container, Node); + return Node; + end Read_Node; + + -- Start of processing for Read + + begin + Read_Nodes (Stream, Container); + end Read; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor) + is + begin + raise Program_Error with "attempt to stream set cursor"; + end Read; + + ------------- + -- Replace -- + ------------- + + procedure Replace + (Container : in out Set; + New_Item : Element_Type) + is + Node : constant Count_Type := + Element_Keys.Find (Container, New_Item); + + begin + if Node = 0 then + raise Constraint_Error with + "attempt to replace element not in set"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (set is locked)"; + end if; + + Container.Nodes (Node).Element := New_Item; + end Replace; + + procedure Replace_Element + (Container : in out Set; + Position : Cursor; + New_Item : Element_Type) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong set"; + end if; + + pragma Assert (Vet (Position), "bad cursor in Replace_Element"); + + Replace_Element (Container, Position.Node, New_Item); + end Replace_Element; + + ---------------------- + -- Reserve_Capacity -- + ---------------------- + + procedure Reserve_Capacity + (Container : in out Set; + Capacity : Count_Type) + is + begin + if Capacity > Container.Capacity then + raise Capacity_Error with "requested capacity is too large"; + end if; + end Reserve_Capacity; + + ------------------ + -- Set_Element -- + ------------------ + + procedure Set_Element (Node : in out Node_Type; Item : Element_Type) is + begin + Node.Element := Item; + end Set_Element; + + -------------- + -- Set_Next -- + -------------- + + procedure Set_Next (Node : in out Node_Type; Next : Count_Type) is + begin + Node.Next := Next; + end Set_Next; + + -------------------------- + -- Symmetric_Difference -- + -------------------------- + + procedure Symmetric_Difference + (Target : in out Set; + Source : Set) + is + procedure Process (Source_Node : Count_Type); + pragma Inline (Process); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (Source_Node : Count_Type) is + N : Node_Type renames Source.Nodes (Source_Node); + X : Count_Type; + B : Boolean; + + begin + if Is_In (Target, N) then + Delete (Target, N.Element); + else + Insert (Target, N.Element, X, B); + pragma Assert (B); + end if; + end Process; + + -- Start of processing for Symmetric_Difference + + begin + if Target'Address = Source'Address then + HT_Ops.Clear (Target); + return; + end if; + + if Target.Length = 0 then + Assign (Target => Target, Source => Source); + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (set is busy)"; + end if; + + Iterate (Source); + end Symmetric_Difference; + + function Symmetric_Difference (Left, Right : Set) return Set is + C : Count_Type; + + begin + if Left'Address = Right'Address then + return Empty_Set; + end if; + + if Right.Length = 0 then + return Left; + end if; + + if Left.Length = 0 then + return Right; + end if; + + C := Left.Length + Right.Length; + + return Result : Set (C, To_Prime (C)) do + Iterate_Left : declare + procedure Process (L_Node : Count_Type); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (L_Node : Count_Type) is + N : Node_Type renames Left.Nodes (L_Node); + X : Count_Type; + B : Boolean; + + begin + if not Is_In (Right, N) then + Insert (Result, N.Element, X, B); + pragma Assert (B); + end if; + end Process; + + -- Start of processing for Iterate_Left + + begin + Iterate (Left); + end Iterate_Left; + + Iterate_Right : declare + procedure Process (R_Node : Count_Type); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (R_Node : Count_Type) is + N : Node_Type renames Left.Nodes (R_Node); + X : Count_Type; + B : Boolean; + + begin + if not Is_In (Left, N) then + Insert (Result, N.Element, X, B); + pragma Assert (B); + end if; + end Process; + + -- Start of processing for Iterate_Right + + begin + Iterate (Right); + end Iterate_Right; + end return; + end Symmetric_Difference; + + ------------ + -- To_Set -- + ------------ + + function To_Set (New_Item : Element_Type) return Set is + X : Count_Type; + B : Boolean; + + begin + return Result : Set (1, 1) do + Insert (Result, New_Item, X, B); + pragma Assert (B); + end return; + end To_Set; + + ----------- + -- Union -- + ----------- + + procedure Union + (Target : in out Set; + Source : Set) + is + procedure Process (Src_Node : Count_Type); + + procedure Iterate is + new HT_Ops.Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (Src_Node : Count_Type) is + N : Node_Type renames Source.Nodes (Src_Node); + X : Count_Type; + B : Boolean; + + begin + Insert (Target, N.Element, X, B); + end Process; + + -- Start of processing for Union + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (set is busy)"; + end if; + + -- ??? + -- declare + -- N : constant Count_Type := Target.Length + Source.Length; + -- begin + -- if N > HT_Ops.Capacity (Target.HT) then + -- HT_Ops.Reserve_Capacity (Target.HT, N); + -- end if; + -- end; + + Iterate (Source); + end Union; + + function Union (Left, Right : Set) return Set is + C : Count_Type; + + begin + if Left'Address = Right'Address then + return Left; + end if; + + if Right.Length = 0 then + return Left; + end if; + + if Left.Length = 0 then + return Right; + end if; + + C := Left.Length + Right.Length; + + return Result : Set (C, To_Prime (C)) do + Assign (Target => Result, Source => Left); + Union (Target => Result, Source => Right); + end return; + end Union; + + --------- + -- Vet -- + --------- + + function Vet (Position : Cursor) return Boolean is + begin + if Position.Node = 0 then + return Position.Container = null; + end if; + + if Position.Container = null then + return False; + end if; + + declare + S : Set renames Position.Container.all; + N : Nodes_Type renames S.Nodes; + X : Count_Type; + + begin + if S.Length = 0 then + return False; + end if; + + if Position.Node > N'Last then + return False; + end if; + + if N (Position.Node).Next = Position.Node then + return False; + end if; + + X := S.Buckets (Element_Keys.Index (S, N (Position.Node).Element)); + + for J in 1 .. S.Length loop + if X = Position.Node then + return True; + end if; + + if X = 0 then + return False; + end if; + + if X = N (X).Next then -- to prevent unnecessary looping + return False; + end if; + + X := N (X).Next; + end loop; + + return False; + end; + end Vet; + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Set) + is + procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type); + pragma Inline (Write_Node); + + procedure Write_Nodes is + new HT_Ops.Generic_Write (Write_Node); + + ---------------- + -- Write_Node -- + ---------------- + + procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type) + is + begin + Element_Type'Write (Stream, Node.Element); + end Write_Node; + + -- Start of processing for Write + + begin + Write_Nodes (Stream, Container); + end Write; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor) + is + begin + raise Program_Error with "attempt to stream set cursor"; + end Write; + + package body Generic_Keys is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Equivalent_Key_Node + (Key : Key_Type; + Node : Node_Type) return Boolean; + pragma Inline (Equivalent_Key_Node); + + -------------------------- + -- Local Instantiations -- + -------------------------- + + package Key_Keys is + new Hash_Tables.Generic_Bounded_Keys + (HT_Types => HT_Types, + Next => Next, + Set_Next => Set_Next, + Key_Type => Key_Type, + Hash => Hash, + Equivalent_Keys => Equivalent_Key_Node); + + -------------- + -- Contains -- + -------------- + + function Contains + (Container : Set; + Key : Key_Type) return Boolean + is + begin + return Find (Container, Key) /= No_Element; + end Contains; + + ------------ + -- Delete -- + ------------ + + procedure Delete + (Container : in out Set; + Key : Key_Type) + is + X : Count_Type; + + begin + Key_Keys.Delete_Key_Sans_Free (Container, Key, X); + + if X = 0 then + raise Constraint_Error with "attempt to delete key not in set"; + end if; + + HT_Ops.Free (Container, X); + end Delete; + + ------------- + -- Element -- + ------------- + + function Element + (Container : Set; + Key : Key_Type) return Element_Type + is + Node : constant Count_Type := Key_Keys.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with "key not in map"; + end if; + + return Container.Nodes (Node).Element; + end Element; + + ------------------------- + -- Equivalent_Key_Node -- + ------------------------- + + function Equivalent_Key_Node + (Key : Key_Type; + Node : Node_Type) return Boolean + is + begin + return Equivalent_Keys (Key, Generic_Keys.Key (Node.Element)); + end Equivalent_Key_Node; + + ------------- + -- Exclude -- + ------------- + + procedure Exclude + (Container : in out Set; + Key : Key_Type) + is + X : Count_Type; + begin + Key_Keys.Delete_Key_Sans_Free (Container, Key, X); + HT_Ops.Free (Container, X); + end Exclude; + + ---------- + -- Find -- + ---------- + + function Find + (Container : Set; + Key : Key_Type) return Cursor + is + Node : constant Count_Type := + Key_Keys.Find (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Find; + + --------- + -- Key -- + --------- + + function Key (Position : Cursor) return Key_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor equals No_Element"; + end if; + + pragma Assert (Vet (Position), "bad cursor in function Key"); + + return Key (Position.Container.Nodes (Position.Node).Element); + end Key; + + ------------- + -- Replace -- + ------------- + + procedure Replace + (Container : in out Set; + Key : Key_Type; + New_Item : Element_Type) + is + Node : constant Count_Type := + Key_Keys.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with + "attempt to replace key not in set"; + end if; + + Replace_Element (Container, Node, New_Item); + end Replace; + + ----------------------------------- + -- Update_Element_Preserving_Key -- + ----------------------------------- + + procedure Update_Element_Preserving_Key + (Container : in out Set; + Position : Cursor; + Process : not null access + procedure (Element : in out Element_Type)) + is + Indx : Hash_Type; + N : Nodes_Type renames Container.Nodes; + + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong set"; + end if; + + -- ??? + -- if HT.Buckets = null + -- or else HT.Buckets'Length = 0 + -- or else HT.Length = 0 + -- or else Position.Node.Next = Position.Node + -- then + -- raise Program_Error with + -- "Position cursor is bad (set is empty)"; + -- end if; + + pragma Assert + (Vet (Position), + "bad cursor in Update_Element_Preserving_Key"); + + -- Record bucket now, in case key is changed. + Indx := HT_Ops.Index (Container.Buckets, N (Position.Node)); + + declare + E : Element_Type renames N (Position.Node).Element; + K : constant Key_Type := Key (E); + + B : Natural renames Container.Busy; + L : Natural renames Container.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (E); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + + if Equivalent_Keys (K, Key (E)) then + pragma Assert (Hash (K) = Hash (E)); + return; + end if; + end; + + -- Key was modified, so remove this node from set. + + if Container.Buckets (Indx) = Position.Node then + Container.Buckets (Indx) := N (Position.Node).Next; + + else + declare + Prev : Count_Type := Container.Buckets (Indx); + + begin + while N (Prev).Next /= Position.Node loop + Prev := N (Prev).Next; + + if Prev = 0 then + raise Program_Error with + "Position cursor is bad (node not found)"; + end if; + end loop; + + N (Prev).Next := N (Position.Node).Next; + end; + end if; + + Container.Length := Container.Length - 1; + HT_Ops.Free (Container, Position.Node); + + raise Program_Error with "key was modified"; + end Update_Element_Preserving_Key; + + end Generic_Keys; + + end Ada.Containers.Bounded_Hashed_Sets; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cbhase.ads gcc-4.6.0/gcc/ada/a-cbhase.ads *** gcc-4.5.2/gcc/ada/a-cbhase.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cbhase.ads Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,466 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ S E T S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + private with Ada.Containers.Hash_Tables; + private with Ada.Streams; + + generic + type Element_Type is private; + + with function Hash (Element : Element_Type) return Hash_Type; + + with function Equivalent_Elements + (Left, Right : Element_Type) return Boolean; + + with function "=" (Left, Right : Element_Type) return Boolean is <>; + + package Ada.Containers.Bounded_Hashed_Sets is + pragma Pure; + pragma Remote_Types; + + type Set (Capacity : Count_Type; Modulus : Hash_Type) is tagged private; + pragma Preelaborable_Initialization (Set); + + type Cursor is private; + pragma Preelaborable_Initialization (Cursor); + + Empty_Set : constant Set; + -- Set objects declared without an initialization expression are + -- initialized to the value Empty_Set. + + No_Element : constant Cursor; + -- Cursor objects declared without an initialization expression are + -- initialized to the value No_Element. + + function "=" (Left, Right : Set) return Boolean; + -- For each element in Left, set equality attempts to find the equal + -- element in Right; if a search fails, then set equality immediately + -- returns False. The search works by calling Hash to find the bucket in + -- the Right set that corresponds to the Left element. If the bucket is + -- non-empty, the search calls the generic formal element equality operator + -- to compare the element (in Left) to the element of each node in the + -- bucket (in Right); the search terminates when a matching node in the + -- bucket is found, or the nodes in the bucket are exhausted. (Note that + -- element equality is called here, not Equivalent_Elements. Set equality + -- is the only operation in which element equality is used. Compare set + -- equality to Equivalent_Sets, which does call Equivalent_Elements.) + + function Equivalent_Sets (Left, Right : Set) return Boolean; + -- Similar to set equality, with the difference that the element in Left is + -- compared to the elements in Right using the generic formal + -- Equivalent_Elements operation instead of element equality. + + function To_Set (New_Item : Element_Type) return Set; + -- Constructs a singleton set comprising New_Element. To_Set calls Hash to + -- determine the bucket for New_Item. + + function Capacity (Container : Set) return Count_Type; + -- Returns the current capacity of the set. Capacity is the maximum length + -- before which rehashing in guaranteed not to occur. + + procedure Reserve_Capacity (Container : in out Set; Capacity : Count_Type); + -- If the value of the Capacity actual parameter is less or equal to + -- Container.Capacity, then the operation has no effect. Otherwise it + -- raises Capacity_Error (as no expansion of capacity is possible for a + -- bounded form). + + function Default_Modulus (Capacity : Count_Type) return Hash_Type; + -- Returns a modulus value (hash table size) which is optimal for the + -- specified capacity (which corresponds to the maximum number of items). + + function Length (Container : Set) return Count_Type; + -- Returns the number of items in the set + + function Is_Empty (Container : Set) return Boolean; + -- Equivalent to Length (Container) = 0 + + procedure Clear (Container : in out Set); + -- Removes all of the items from the set + + function Element (Position : Cursor) return Element_Type; + -- Returns the element of the node designated by the cursor + + procedure Replace_Element + (Container : in out Set; + Position : Cursor; + New_Item : Element_Type); + -- If New_Item is equivalent (as determined by calling Equivalent_Elements) + -- to the element of the node designated by Position, then New_Element is + -- assigned to that element. Otherwise, it calls Hash to determine the + -- bucket for New_Item. If the bucket is not empty, then it calls + -- Equivalent_Elements for each node in that bucket to determine whether + -- New_Item is equivalent to an element in that bucket. If + -- Equivalent_Elements returns True then Program_Error is raised (because + -- an element may appear only once in the set); otherwise, New_Item is + -- assigned to the node designated by Position, and the node is moved to + -- its new bucket. + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)); + -- Calls Process with the element (having only a constant view) of the node + -- designed by the cursor. + + procedure Assign (Target : in out Set; Source : Set); + -- If Target denotes the same object as Source, then the operation has no + -- effect. If the Target capacity is less then the Source length, then + -- Assign raises Capacity_Error. Otherwise, Assign clears Target and then + -- copies the (active) elements from Source to Target. + + function Copy + (Source : Set; + Capacity : Count_Type := 0; + Modulus : Hash_Type := 0) return Set; + -- Constructs a new set object whose elements correspond to Source. If the + -- Capacity parameter is 0, then the capacity of the result is the same as + -- the length of Source. If the Capacity parameter is equal or greater than + -- the length of Source, then the capacity of the result is the specified + -- value. Otherwise, Copy raises Capacity_Error. If the Modulus parameter + -- is 0, then the modulus of the result is the value returned by a call to + -- Default_Modulus with the capacity parameter determined as above; + -- otherwise the modulus of the result is the specified value. + + procedure Move (Target : in out Set; Source : in out Set); + -- Clears Target (if it's not empty), and then moves (not copies) the + -- buckets array and nodes from Source to Target. + + procedure Insert + (Container : in out Set; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean); + -- Conditionally inserts New_Item into the set. If New_Item is already in + -- the set, then Inserted returns False and Position designates the node + -- containing the existing element (which is not modified). If New_Item is + -- not already in the set, then Inserted returns True and Position + -- designates the newly-inserted node containing New_Item. The search for + -- an existing element works as follows. Hash is called to determine + -- New_Item's bucket; if the bucket is non-empty, then Equivalent_Elements + -- is called to compare New_Item to the element of each node in that + -- bucket. If the bucket is empty, or there were no equivalent elements in + -- the bucket, the search "fails" and the New_Item is inserted in the set + -- (and Inserted returns True); otherwise, the search "succeeds" (and + -- Inserted returns False). + + procedure Insert (Container : in out Set; New_Item : Element_Type); + -- Attempts to insert New_Item into the set, performing the usual insertion + -- search (which involves calling both Hash and Equivalent_Elements); if + -- the search succeeds (New_Item is equivalent to an element already in the + -- set, and so was not inserted), then this operation raises + -- Constraint_Error. (This version of Insert is similar to Replace, but + -- having the opposite exception behavior. It is intended for use when you + -- want to assert that the item is not already in the set.) + + procedure Include (Container : in out Set; New_Item : Element_Type); + -- Attempts to insert New_Item into the set. If an element equivalent to + -- New_Item is already in the set (the insertion search succeeded, and + -- hence New_Item was not inserted), then the value of New_Item is assigned + -- to the existing element. (This insertion operation only raises an + -- exception if cursor tampering occurs. It is intended for use when you + -- want to insert the item in the set, and you don't care whether an + -- equivalent element is already present.) + + procedure Replace (Container : in out Set; New_Item : Element_Type); + -- Searches for New_Item in the set; if the search fails (because an + -- equivalent element was not in the set), then it raises + -- Constraint_Error. Otherwise, the existing element is assigned the value + -- New_Item. (This is similar to Insert, but with the opposite exception + -- behavior. It is intended for use when you want to assert that the item + -- is already in the set.) + + procedure Exclude (Container : in out Set; Item : Element_Type); + -- Searches for Item in the set, and if found, removes its node from the + -- set and then deallocates it. The search works as follows. The operation + -- calls Hash to determine the item's bucket; if the bucket is not empty, + -- it calls Equivalent_Elements to compare Item to the element of each node + -- in the bucket. (This is the deletion analog of Include. It is intended + -- for use when you want to remove the item from the set, but don't care + -- whether the item is already in the set.) + + procedure Delete (Container : in out Set; Item : Element_Type); + -- Searches for Item in the set (which involves calling both Hash and + -- Equivalent_Elements). If the search fails, then the operation raises + -- Constraint_Error. Otherwise it removes the node from the set and then + -- deallocates it. (This is the deletion analog of non-conditional + -- Insert. It is intended for use when you want to assert that the item is + -- already in the set.) + + procedure Delete (Container : in out Set; Position : in out Cursor); + -- Removes the node designated by Position from the set, and then + -- deallocates the node. The operation calls Hash to determine the bucket, + -- and then compares Position to each node in the bucket until there's a + -- match (it does not call Equivalent_Elements). + + procedure Union (Target : in out Set; Source : Set); + -- Iterates over the Source set, and conditionally inserts each element + -- into Target. + + function Union (Left, Right : Set) return Set; + -- The operation first copies the Left set to the result, and then iterates + -- over the Right set to conditionally insert each element into the result. + + function "or" (Left, Right : Set) return Set renames Union; + + procedure Intersection (Target : in out Set; Source : Set); + -- Iterates over the Target set (calling First and Next), calling Find to + -- determine whether the element is in Source. If an equivalent element is + -- not found in Source, the element is deleted from Target. + + function Intersection (Left, Right : Set) return Set; + -- Iterates over the Left set, calling Find to determine whether the + -- element is in Right. If an equivalent element is found, it is inserted + -- into the result set. + + function "and" (Left, Right : Set) return Set renames Intersection; + + procedure Difference (Target : in out Set; Source : Set); + -- Iterates over the Source (calling First and Next), calling Find to + -- determine whether the element is in Target. If an equivalent element is + -- found, it is deleted from Target. + + function Difference (Left, Right : Set) return Set; + -- Iterates over the Left set, calling Find to determine whether the + -- element is in the Right set. If an equivalent element is not found, the + -- element is inserted into the result set. + + function "-" (Left, Right : Set) return Set renames Difference; + + procedure Symmetric_Difference (Target : in out Set; Source : Set); + -- The operation iterates over the Source set, searching for the element + -- in Target (calling Hash and Equivalent_Elements). If an equivalent + -- element is found, it is removed from Target; otherwise it is inserted + -- into Target. + + function Symmetric_Difference (Left, Right : Set) return Set; + -- The operation first iterates over the Left set. It calls Find to + -- determine whether the element is in the Right set. If no equivalent + -- element is found, the element from Left is inserted into the result. The + -- operation then iterates over the Right set, to determine whether the + -- element is in the Left set. If no equivalent element is found, the Right + -- element is inserted into the result. + + function "xor" (Left, Right : Set) return Set + renames Symmetric_Difference; + + function Overlap (Left, Right : Set) return Boolean; + -- Iterates over the Left set (calling First and Next), calling Find to + -- determine whether the element is in the Right set. If an equivalent + -- element is found, the operation immediately returns True. The operation + -- returns False if the iteration over Left terminates without finding any + -- equivalent element in Right. + + function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; + -- Iterates over Subset (calling First and Next), calling Find to determine + -- whether the element is in Of_Set. If no equivalent element is found in + -- Of_Set, the operation immediately returns False. The operation returns + -- True if the iteration over Subset terminates without finding an element + -- not in Of_Set (that is, every element in Subset is equivalent to an + -- element in Of_Set). + + function First (Container : Set) return Cursor; + -- Returns a cursor that designates the first non-empty bucket, by + -- searching from the beginning of the buckets array. + + function Next (Position : Cursor) return Cursor; + -- Returns a cursor that designates the node that follows the current one + -- designated by Position. If Position designates the last node in its + -- bucket, the operation calls Hash to compute the index of this bucket, + -- and searches the buckets array for the first non-empty bucket, starting + -- from that index; otherwise, it simply follows the link to the next node + -- in the same bucket. + + procedure Next (Position : in out Cursor); + -- Equivalent to Position := Next (Position) + + function Find + (Container : Set; + Item : Element_Type) return Cursor; + -- Searches for Item in the set. Find calls Hash to determine the item's + -- bucket; if the bucket is not empty, it calls Equivalent_Elements to + -- compare Item to each element in the bucket. If the search succeeds, Find + -- returns a cursor designating the node containing the equivalent element; + -- otherwise, it returns No_Element. + + function Contains (Container : Set; Item : Element_Type) return Boolean; + -- Equivalent to Find (Container, Item) /= No_Element + + function Has_Element (Position : Cursor) return Boolean; + -- Equivalent to Position /= No_Element + + function Equivalent_Elements (Left, Right : Cursor) return Boolean; + -- Returns the result of calling Equivalent_Elements with the elements of + -- the nodes designated by cursors Left and Right. + + function Equivalent_Elements + (Left : Cursor; + Right : Element_Type) return Boolean; + -- Returns the result of calling Equivalent_Elements with element of the + -- node designated by Left and element Right. + + function Equivalent_Elements + (Left : Element_Type; + Right : Cursor) return Boolean; + -- Returns the result of calling Equivalent_Elements with element Left and + -- the element of the node designated by Right. + + procedure Iterate + (Container : Set; + Process : not null access procedure (Position : Cursor)); + -- Calls Process for each node in the set + + generic + type Key_Type (<>) is private; + + with function Key (Element : Element_Type) return Key_Type; + + with function Hash (Key : Key_Type) return Hash_Type; + + with function Equivalent_Keys (Left, Right : Key_Type) return Boolean; + + package Generic_Keys is + + function Key (Position : Cursor) return Key_Type; + -- Applies generic formal operation Key to the element of the node + -- designated by Position. + + function Element (Container : Set; Key : Key_Type) return Element_Type; + -- Searches (as per the key-based Find) for the node containing Key, and + -- returns the associated element. + + procedure Replace + (Container : in out Set; + Key : Key_Type; + New_Item : Element_Type); + -- Searches (as per the key-based Find) for the node containing Key, and + -- then replaces the element of that node (as per the element-based + -- Replace_Element). + + procedure Exclude (Container : in out Set; Key : Key_Type); + -- Searches for Key in the set, and if found, removes its node from the + -- set and then deallocates it. The search works by first calling Hash + -- (on Key) to determine the bucket; if the bucket is not empty, it + -- calls Equivalent_Keys to compare parameter Key to the value of + -- generic formal operation Key applied to element of each node in the + -- bucket. + + procedure Delete (Container : in out Set; Key : Key_Type); + -- Deletes the node containing Key as per Exclude, with the difference + -- that Constraint_Error is raised if Key is not found. + + function Find (Container : Set; Key : Key_Type) return Cursor; + -- Searches for the node containing Key, and returns a cursor + -- designating the node. The search works by first calling Hash (on Key) + -- to determine the bucket. If the bucket is not empty, the search + -- compares Key to the element of each node in the bucket, and returns + -- the matching node. The comparison itself works by applying the + -- generic formal Key operation to the element of the node, and then + -- calling generic formal operation Equivalent_Keys. + + function Contains (Container : Set; Key : Key_Type) return Boolean; + -- Equivalent to Find (Container, Key) /= No_Element + + procedure Update_Element_Preserving_Key + (Container : in out Set; + Position : Cursor; + Process : not null access + procedure (Element : in out Element_Type)); + -- Calls Process with the element of the node designated by Position, + -- but with the restriction that the key-value of the element is not + -- modified. The operation first makes a copy of the value returned by + -- applying generic formal operation Key on the element of the node, and + -- then calls Process with the element. The operation verifies that the + -- key-part has not been modified by calling generic formal operation + -- Equivalent_Keys to compare the saved key-value to the value returned + -- by applying generic formal operation Key to the post-Process value of + -- element. If the key values compare equal then the operation + -- completes. Otherwise, the node is removed from the map and + -- Program_Error is raised. + + end Generic_Keys; + + private + + pragma Inline (Next); + + type Node_Type is record + Element : Element_Type; + Next : Count_Type; + end record; + + package HT_Types is + new Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type); + + type Set (Capacity : Count_Type; Modulus : Hash_Type) is + new HT_Types.Hash_Table_Type (Capacity, Modulus) with null record; + + use HT_Types; + use Ada.Streams; + + type Set_Access is access all Set; + for Set_Access'Storage_Size use 0; + + type Cursor is record + Container : Set_Access; + Node : Count_Type; + end record; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor); + + for Cursor'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor); + + for Cursor'Read use Read; + + No_Element : constant Cursor := (Container => null, Node => 0); + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Set); + + for Set'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Set); + + for Set'Read use Read; + + Empty_Set : constant Set := + (Hash_Table_Type with Capacity => 0, Modulus => 0); + + end Ada.Containers.Bounded_Hashed_Sets; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cborma.adb gcc-4.6.0/gcc/ada/a-cborma.adb *** gcc-4.5.2/gcc/ada/a-cborma.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cborma.adb Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,1348 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ O R D E R E D _ M A P S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; + pragma Elaborate_All + (Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations); + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys; + pragma Elaborate_All + (Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys); + + with System; use type System.Address; + + package body Ada.Containers.Bounded_Ordered_Maps is + + ----------------------------- + -- Node Access Subprograms -- + ----------------------------- + + -- These subprograms provide a functional interface to access fields + -- of a node, and a procedural interface for modifying these values. + + function Color (Node : Node_Type) return Color_Type; + pragma Inline (Color); + + function Left (Node : Node_Type) return Count_Type; + pragma Inline (Left); + + function Parent (Node : Node_Type) return Count_Type; + pragma Inline (Parent); + + function Right (Node : Node_Type) return Count_Type; + pragma Inline (Right); + + procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type); + pragma Inline (Set_Parent); + + procedure Set_Left (Node : in out Node_Type; Left : Count_Type); + pragma Inline (Set_Left); + + procedure Set_Right (Node : in out Node_Type; Right : Count_Type); + pragma Inline (Set_Right); + + procedure Set_Color (Node : in out Node_Type; Color : Color_Type); + pragma Inline (Set_Color); + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Is_Greater_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean; + pragma Inline (Is_Greater_Key_Node); + + function Is_Less_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean; + pragma Inline (Is_Less_Key_Node); + + -------------------------- + -- Local Instantiations -- + -------------------------- + + package Tree_Operations is + new Red_Black_Trees.Generic_Bounded_Operations (Tree_Types); + + use Tree_Operations; + + package Key_Ops is + new Red_Black_Trees.Generic_Bounded_Keys + (Tree_Operations => Tree_Operations, + Key_Type => Key_Type, + Is_Less_Key_Node => Is_Less_Key_Node, + Is_Greater_Key_Node => Is_Greater_Key_Node); + + --------- + -- "<" -- + --------- + + function "<" (Left, Right : Cursor) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor of ""<"" equals No_Element"; + end if; + + if Right.Node = 0 then + raise Constraint_Error with "Right cursor of ""<"" equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "Left cursor of ""<"" is bad"); + + pragma Assert (Vet (Right.Container.all, Right.Node), + "Right cursor of ""<"" is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return LN.Key < RN.Key; + end; + end "<"; + + function "<" (Left : Cursor; Right : Key_Type) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor of ""<"" equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "Left cursor of ""<"" is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + + begin + return LN.Key < Right; + end; + end "<"; + + function "<" (Left : Key_Type; Right : Cursor) return Boolean is + begin + if Right.Node = 0 then + raise Constraint_Error with "Right cursor of ""<"" equals No_Element"; + end if; + + pragma Assert (Vet (Right.Container.all, Right.Node), + "Right cursor of ""<"" is bad"); + + declare + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return Left < RN.Key; + end; + end "<"; + + --------- + -- "=" -- + --------- + + function "=" (Left, Right : Map) return Boolean is + function Is_Equal_Node_Node (L, R : Node_Type) return Boolean; + pragma Inline (Is_Equal_Node_Node); + + function Is_Equal is + new Tree_Operations.Generic_Equal (Is_Equal_Node_Node); + + ------------------------ + -- Is_Equal_Node_Node -- + ------------------------ + + function Is_Equal_Node_Node + (L, R : Node_Type) return Boolean is + begin + if L.Key < R.Key then + return False; + + elsif R.Key < L.Key then + return False; + + else + return L.Element = R.Element; + end if; + end Is_Equal_Node_Node; + + -- Start of processing for "=" + + begin + return Is_Equal (Left, Right); + end "="; + + --------- + -- ">" -- + --------- + + function ">" (Left, Right : Cursor) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor of "">"" equals No_Element"; + end if; + + if Right.Node = 0 then + raise Constraint_Error with "Right cursor of "">"" equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "Left cursor of "">"" is bad"); + + pragma Assert (Vet (Right.Container.all, Right.Node), + "Right cursor of "">"" is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return RN.Key < LN.Key; + end; + end ">"; + + function ">" (Left : Cursor; Right : Key_Type) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor of "">"" equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "Left cursor of "">"" is bad"); + + declare + LN : Node_Type renames Left.Container.Nodes (Left.Node); + + begin + return Right < LN.Key; + end; + end ">"; + + function ">" (Left : Key_Type; Right : Cursor) return Boolean is + begin + if Right.Node = 0 then + raise Constraint_Error with "Right cursor of "">"" equals No_Element"; + end if; + + pragma Assert (Vet (Right.Container.all, Right.Node), + "Right cursor of "">"" is bad"); + + declare + RN : Node_Type renames Right.Container.Nodes (Right.Node); + + begin + return RN.Key < Left; + end; + end ">"; + + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out Map; Source : Map) is + procedure Append_Element (Source_Node : Count_Type); + + procedure Append_Elements is + new Tree_Operations.Generic_Iteration (Append_Element); + + -------------------- + -- Append_Element -- + -------------------- + + procedure Append_Element (Source_Node : Count_Type) is + SN : Node_Type renames Source.Nodes (Source_Node); + + procedure Set_Element (Node : in out Node_Type); + pragma Inline (Set_Element); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Insert_Post is + new Key_Ops.Generic_Insert_Post (New_Node); + + procedure Unconditional_Insert_Sans_Hint is + new Key_Ops.Generic_Unconditional_Insert (Insert_Post); + + procedure Unconditional_Insert_Avec_Hint is + new Key_Ops.Generic_Unconditional_Insert_With_Hint + (Insert_Post, + Unconditional_Insert_Sans_Hint); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Set_Element); + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + + begin + Allocate (Target, Result); + return Result; + end New_Node; + + ----------------- + -- Set_Element -- + ----------------- + + procedure Set_Element (Node : in out Node_Type) is + begin + Node.Key := SN.Key; + Node.Element := SN.Element; + end Set_Element; + + Target_Node : Count_Type; + + -- Start of processing for Append_Element + + begin + Unconditional_Insert_Avec_Hint + (Tree => Target, + Hint => 0, + Key => SN.Key, + Node => Target_Node); + end Append_Element; + + -- Start of processing for Assign + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error + with "Target capacity is less than Source length"; + end if; + + Tree_Operations.Clear_Tree (Target); + Append_Elements (Source); + end Assign; + + ------------- + -- Ceiling -- + ------------- + + function Ceiling (Container : Map; Key : Key_Type) return Cursor is + Node : constant Count_Type := Key_Ops.Ceiling (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Ceiling; + + ----------- + -- Clear -- + ----------- + + procedure Clear (Container : in out Map) is + begin + Tree_Operations.Clear_Tree (Container); + end Clear; + + ----------- + -- Color -- + ----------- + + function Color (Node : Node_Type) return Color_Type is + begin + return Node.Color; + end Color; + + -------------- + -- Contains -- + -------------- + + function Contains (Container : Map; Key : Key_Type) return Boolean is + begin + return Find (Container, Key) /= No_Element; + end Contains; + + ---------- + -- Copy -- + ---------- + + function Copy (Source : Map; Capacity : Count_Type := 0) return Map is + C : Count_Type; + + begin + if Capacity = 0 then + C := Source.Length; + + elsif Capacity >= Source.Length then + C := Capacity; + + else + raise Capacity_Error with "Capacity value too small"; + end if; + + return Target : Map (Capacity => C) do + Assign (Target => Target, Source => Source); + end return; + end Copy; + + ------------ + -- Delete -- + ------------ + + procedure Delete (Container : in out Map; Position : in out Cursor) is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Delete equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor of Delete designates wrong map"; + end if; + + pragma Assert (Vet (Container, Position.Node), + "Position cursor of Delete is bad"); + + Tree_Operations.Delete_Node_Sans_Free (Container, Position.Node); + Tree_Operations.Free (Container, Position.Node); + + Position := No_Element; + end Delete; + + procedure Delete (Container : in out Map; Key : Key_Type) is + X : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if X = 0 then + raise Constraint_Error with "key not in map"; + end if; + + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end Delete; + + ------------------ + -- Delete_First -- + ------------------ + + procedure Delete_First (Container : in out Map) is + X : constant Count_Type := Container.First; + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Delete_First; + + ----------------- + -- Delete_Last -- + ----------------- + + procedure Delete_Last (Container : in out Map) is + X : constant Count_Type := Container.Last; + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Delete_Last; + + ------------- + -- Element -- + ------------- + + function Element (Position : Cursor) return Element_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of function Element equals No_Element"; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "Position cursor of function Element is bad"); + + return Position.Container.Nodes (Position.Node).Element; + end Element; + + function Element (Container : Map; Key : Key_Type) return Element_Type is + Node : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with "key not in map"; + end if; + + return Container.Nodes (Node).Element; + end Element; + + --------------------- + -- Equivalent_Keys -- + --------------------- + + function Equivalent_Keys (Left, Right : Key_Type) return Boolean is + begin + if Left < Right + or else Right < Left + then + return False; + else + return True; + end if; + end Equivalent_Keys; + + ------------- + -- Exclude -- + ------------- + + procedure Exclude (Container : in out Map; Key : Key_Type) is + X : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Exclude; + + ---------- + -- Find -- + ---------- + + function Find (Container : Map; Key : Key_Type) return Cursor is + Node : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Find; + + ----------- + -- First -- + ----------- + + function First (Container : Map) return Cursor is + begin + if Container.First = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Container.First); + end First; + + ------------------- + -- First_Element -- + ------------------- + + function First_Element (Container : Map) return Element_Type is + begin + if Container.First = 0 then + raise Constraint_Error with "map is empty"; + end if; + + return Container.Nodes (Container.First).Element; + end First_Element; + + --------------- + -- First_Key -- + --------------- + + function First_Key (Container : Map) return Key_Type is + begin + if Container.First = 0 then + raise Constraint_Error with "map is empty"; + end if; + + return Container.Nodes (Container.First).Key; + end First_Key; + + ----------- + -- Floor -- + ----------- + + function Floor (Container : Map; Key : Key_Type) return Cursor is + Node : constant Count_Type := Key_Ops.Floor (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Floor; + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element (Position : Cursor) return Boolean is + begin + return Position /= No_Element; + end Has_Element; + + ------------- + -- Include -- + ------------- + + procedure Include + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type) + is + Position : Cursor; + Inserted : Boolean; + + begin + Insert (Container, Key, New_Item, Position, Inserted); + + if not Inserted then + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (map is locked)"; + end if; + + declare + N : Node_Type renames Container.Nodes (Position.Node); + + begin + N.Key := Key; + N.Element := New_Item; + end; + end if; + end Include; + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean) + is + procedure Assign (Node : in out Node_Type); + pragma Inline (Assign); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Insert_Post is + new Key_Ops.Generic_Insert_Post (New_Node); + + procedure Insert_Sans_Hint is + new Key_Ops.Generic_Conditional_Insert (Insert_Post); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Assign); + + ------------ + -- Assign -- + ------------ + + procedure Assign (Node : in out Node_Type) is + begin + Node.Key := Key; + Node.Element := New_Item; + end Assign; + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + + begin + Allocate (Container, Result); + return Result; + end New_Node; + + -- Start of processing for Insert + + begin + Insert_Sans_Hint + (Container, + Key, + Position.Node, + Inserted); + + Position.Container := Container'Unrestricted_Access; + end Insert; + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type) + is + Position : Cursor; + pragma Unreferenced (Position); + + Inserted : Boolean; + + begin + Insert (Container, Key, New_Item, Position, Inserted); + + if not Inserted then + raise Constraint_Error with "key already in map"; + end if; + end Insert; + + procedure Insert + (Container : in out Map; + Key : Key_Type; + Position : out Cursor; + Inserted : out Boolean) + is + procedure Assign (Node : in out Node_Type); + pragma Inline (Assign); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Insert_Post is + new Key_Ops.Generic_Insert_Post (New_Node); + + procedure Insert_Sans_Hint is + new Key_Ops.Generic_Conditional_Insert (Insert_Post); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Assign); + + ------------ + -- Assign -- + ------------ + + procedure Assign (Node : in out Node_Type) is + begin + Node.Key := Key; + -- Node.Element := New_Item; + end Assign; + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + + begin + Allocate (Container, Result); + return Result; + end New_Node; + + -- Start of processing for Insert + + begin + Insert_Sans_Hint + (Container, + Key, + Position.Node, + Inserted); + + Position.Container := Container'Unrestricted_Access; + end Insert; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty (Container : Map) return Boolean is + begin + return Container.Length = 0; + end Is_Empty; + + ------------------------- + -- Is_Greater_Key_Node -- + ------------------------- + + function Is_Greater_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean + is + begin + -- k > node same as node < k + + return Right.Key < Left; + end Is_Greater_Key_Node; + + ---------------------- + -- Is_Less_Key_Node -- + ---------------------- + + function Is_Less_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean + is + begin + return Left < Right.Key; + end Is_Less_Key_Node; + + ------------- + -- Iterate -- + ------------- + + procedure Iterate + (Container : Map; + Process : not null access procedure (Position : Cursor)) + is + procedure Process_Node (Node : Count_Type); + pragma Inline (Process_Node); + + procedure Local_Iterate is + new Tree_Operations.Generic_Iteration (Process_Node); + + ------------------ + -- Process_Node -- + ------------------ + + procedure Process_Node (Node : Count_Type) is + begin + Process (Cursor'(Container'Unrestricted_Access, Node)); + end Process_Node; + + B : Natural renames Container'Unrestricted_Access.all.Busy; + + -- Start of processing for Iterate + + begin + B := B + 1; + + begin + Local_Iterate (Container); + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Iterate; + + --------- + -- Key -- + --------- + + function Key (Position : Cursor) return Key_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of function Key equals No_Element"; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "Position cursor of function Key is bad"); + + return Position.Container.Nodes (Position.Node).Key; + end Key; + + ---------- + -- Last -- + ---------- + + function Last (Container : Map) return Cursor is + begin + if Container.Last = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Container.Last); + end Last; + + ------------------ + -- Last_Element -- + ------------------ + + function Last_Element (Container : Map) return Element_Type is + begin + if Container.Last = 0 then + raise Constraint_Error with "map is empty"; + end if; + + return Container.Nodes (Container.Last).Element; + end Last_Element; + + -------------- + -- Last_Key -- + -------------- + + function Last_Key (Container : Map) return Key_Type is + begin + if Container.Last = 0 then + raise Constraint_Error with "map is empty"; + end if; + + return Container.Nodes (Container.Last).Key; + end Last_Key; + + ---------- + -- Left -- + ---------- + + function Left (Node : Node_Type) return Count_Type is + begin + return Node.Left; + end Left; + + ------------ + -- Length -- + ------------ + + function Length (Container : Map) return Count_Type is + begin + return Container.Length; + end Length; + + ---------- + -- Move -- + ---------- + + procedure Move (Target : in out Map; Source : in out Map) is + begin + if Target'Address = Source'Address then + return; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Assign (Target => Target, Source => Source); + end Move; + + ---------- + -- Next -- + ---------- + + procedure Next (Position : in out Cursor) is + begin + Position := Next (Position); + end Next; + + function Next (Position : Cursor) return Cursor is + begin + if Position = No_Element then + return No_Element; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "Position cursor of Next is bad"); + + declare + M : Map renames Position.Container.all; + + Node : constant Count_Type := + Tree_Operations.Next (M, Position.Node); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Next; + + ------------ + -- Parent -- + ------------ + + function Parent (Node : Node_Type) return Count_Type is + begin + return Node.Parent; + end Parent; + + -------------- + -- Previous -- + -------------- + + procedure Previous (Position : in out Cursor) is + begin + Position := Previous (Position); + end Previous; + + function Previous (Position : Cursor) return Cursor is + begin + if Position = No_Element then + return No_Element; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "Position cursor of Previous is bad"); + + declare + M : Map renames Position.Container.all; + + Node : constant Count_Type := + Tree_Operations.Previous (M, Position.Node); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Previous; + + ------------------- + -- Query_Element -- + ------------------- + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Key : Key_Type; + Element : Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Query_Element equals No_Element"; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "Position cursor of Query_Element is bad"); + + declare + M : Map renames Position.Container.all; + N : Node_Type renames M.Nodes (Position.Node); + + B : Natural renames M.Busy; + L : Natural renames M.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (N.Key, N.Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Query_Element; + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Map) + is + procedure Read_Element (Node : in out Node_Type); + pragma Inline (Read_Element); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Read_Element); + + procedure Read_Elements is + new Tree_Operations.Generic_Read (Allocate); + + ------------------ + -- Read_Element -- + ------------------ + + procedure Read_Element (Node : in out Node_Type) is + begin + Key_Type'Read (Stream, Node.Key); + Element_Type'Read (Stream, Node.Element); + end Read_Element; + + -- Start of processing for Read + + begin + Read_Elements (Stream, Container); + end Read; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor) + is + begin + raise Program_Error with "attempt to stream map cursor"; + end Read; + + ------------- + -- Replace -- + ------------- + + procedure Replace + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type) + is + Node : constant Count_Type := Key_Ops.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with "key not in map"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (map is locked)"; + end if; + + declare + N : Node_Type renames Container.Nodes (Node); + + begin + N.Key := Key; + N.Element := New_Item; + end; + end Replace; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Container : in out Map; + Position : Cursor; + New_Item : Element_Type) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Replace_Element equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor of Replace_Element designates wrong map"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (map is locked)"; + end if; + + pragma Assert (Vet (Container, Position.Node), + "Position cursor of Replace_Element is bad"); + + Container.Nodes (Position.Node).Element := New_Item; + end Replace_Element; + + --------------------- + -- Reverse_Iterate -- + --------------------- + + procedure Reverse_Iterate + (Container : Map; + Process : not null access procedure (Position : Cursor)) + is + procedure Process_Node (Node : Count_Type); + pragma Inline (Process_Node); + + procedure Local_Reverse_Iterate is + new Tree_Operations.Generic_Reverse_Iteration (Process_Node); + + ------------------ + -- Process_Node -- + ------------------ + + procedure Process_Node (Node : Count_Type) is + begin + Process (Cursor'(Container'Unrestricted_Access, Node)); + end Process_Node; + + B : Natural renames Container'Unrestricted_Access.all.Busy; + + -- Start of processing for Reverse_Iterate + + begin + B := B + 1; + + begin + Local_Reverse_Iterate (Container); + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Reverse_Iterate; + + ----------- + -- Right -- + ----------- + + function Right (Node : Node_Type) return Count_Type is + begin + return Node.Right; + end Right; + + --------------- + -- Set_Color -- + --------------- + + procedure Set_Color + (Node : in out Node_Type; + Color : Color_Type) + is + begin + Node.Color := Color; + end Set_Color; + + -------------- + -- Set_Left -- + -------------- + + procedure Set_Left (Node : in out Node_Type; Left : Count_Type) is + begin + Node.Left := Left; + end Set_Left; + + ---------------- + -- Set_Parent -- + ---------------- + + procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type) is + begin + Node.Parent := Parent; + end Set_Parent; + + --------------- + -- Set_Right -- + --------------- + + procedure Set_Right (Node : in out Node_Type; Right : Count_Type) is + begin + Node.Right := Right; + end Set_Right; + + -------------------- + -- Update_Element -- + -------------------- + + procedure Update_Element + (Container : in out Map; + Position : Cursor; + Process : not null access procedure (Key : Key_Type; + Element : in out Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor of Update_Element equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor of Update_Element designates wrong map"; + end if; + + pragma Assert (Vet (Container, Position.Node), + "Position cursor of Update_Element is bad"); + + declare + N : Node_Type renames Container.Nodes (Position.Node); + B : Natural renames Container.Busy; + L : Natural renames Container.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (N.Key, N.Element); + + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Update_Element; + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Map) + is + procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type); + pragma Inline (Write_Node); + + procedure Write_Nodes is + new Tree_Operations.Generic_Write (Write_Node); + + ---------------- + -- Write_Node -- + ---------------- + + procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type) + is + begin + Key_Type'Write (Stream, Node.Key); + Element_Type'Write (Stream, Node.Element); + end Write_Node; + + -- Start of processing for Write + + begin + Write_Nodes (Stream, Container); + end Write; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor) + is + begin + raise Program_Error with "attempt to stream map cursor"; + end Write; + + end Ada.Containers.Bounded_Ordered_Maps; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cborma.ads gcc-4.6.0/gcc/ada/a-cborma.ads *** gcc-4.5.2/gcc/ada/a-cborma.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cborma.ads Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,244 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ O R D E R E D _ M A P S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + private with Ada.Containers.Red_Black_Trees; + private with Ada.Streams; + + generic + type Key_Type is private; + type Element_Type is private; + + with function "<" (Left, Right : Key_Type) return Boolean is <>; + with function "=" (Left, Right : Element_Type) return Boolean is <>; + + package Ada.Containers.Bounded_Ordered_Maps is + pragma Pure; + pragma Remote_Types; + + function Equivalent_Keys (Left, Right : Key_Type) return Boolean; + + type Map (Capacity : Count_Type) is tagged private; + pragma Preelaborable_Initialization (Map); + + type Cursor is private; + pragma Preelaborable_Initialization (Cursor); + + Empty_Map : constant Map; + + No_Element : constant Cursor; + + function "=" (Left, Right : Map) return Boolean; + + function Length (Container : Map) return Count_Type; + + function Is_Empty (Container : Map) return Boolean; + + procedure Clear (Container : in out Map); + + function Key (Position : Cursor) return Key_Type; + + function Element (Position : Cursor) return Element_Type; + + procedure Replace_Element + (Container : in out Map; + Position : Cursor; + New_Item : Element_Type); + + procedure Query_Element + (Position : Cursor; + Process : not null access + procedure (Key : Key_Type; Element : Element_Type)); + + procedure Update_Element + (Container : in out Map; + Position : Cursor; + Process : not null access + procedure (Key : Key_Type; Element : in out Element_Type)); + + procedure Assign (Target : in out Map; Source : Map); + + function Copy (Source : Map; Capacity : Count_Type := 0) return Map; + + procedure Move (Target : in out Map; Source : in out Map); + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean); + + procedure Insert + (Container : in out Map; + Key : Key_Type; + Position : out Cursor; + Inserted : out Boolean); + + procedure Insert + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type); + + procedure Include + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type); + + procedure Replace + (Container : in out Map; + Key : Key_Type; + New_Item : Element_Type); + + procedure Exclude (Container : in out Map; Key : Key_Type); + + procedure Delete (Container : in out Map; Key : Key_Type); + + procedure Delete (Container : in out Map; Position : in out Cursor); + + procedure Delete_First (Container : in out Map); + + procedure Delete_Last (Container : in out Map); + + function First (Container : Map) return Cursor; + + function First_Element (Container : Map) return Element_Type; + + function First_Key (Container : Map) return Key_Type; + + function Last (Container : Map) return Cursor; + + function Last_Element (Container : Map) return Element_Type; + + function Last_Key (Container : Map) return Key_Type; + + function Next (Position : Cursor) return Cursor; + + procedure Next (Position : in out Cursor); + + function Previous (Position : Cursor) return Cursor; + + procedure Previous (Position : in out Cursor); + + function Find (Container : Map; Key : Key_Type) return Cursor; + + function Element (Container : Map; Key : Key_Type) return Element_Type; + + function Floor (Container : Map; Key : Key_Type) return Cursor; + + function Ceiling (Container : Map; Key : Key_Type) return Cursor; + + function Contains (Container : Map; Key : Key_Type) return Boolean; + + function Has_Element (Position : Cursor) return Boolean; + + function "<" (Left, Right : Cursor) return Boolean; + + function ">" (Left, Right : Cursor) return Boolean; + + function "<" (Left : Cursor; Right : Key_Type) return Boolean; + + function ">" (Left : Cursor; Right : Key_Type) return Boolean; + + function "<" (Left : Key_Type; Right : Cursor) return Boolean; + + function ">" (Left : Key_Type; Right : Cursor) return Boolean; + + procedure Iterate + (Container : Map; + Process : not null access procedure (Position : Cursor)); + + procedure Reverse_Iterate + (Container : Map; + Process : not null access procedure (Position : Cursor)); + + private + + pragma Inline (Next); + pragma Inline (Previous); + + type Node_Type is record + Parent : Count_Type; + Left : Count_Type; + Right : Count_Type; + Color : Red_Black_Trees.Color_Type := Red_Black_Trees.Red; + Key : Key_Type; + Element : Element_Type; + end record; + + package Tree_Types is + new Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type); + + type Map (Capacity : Count_Type) is + new Tree_Types.Tree_Type (Capacity) with null record; + + type Map_Access is access all Map; + for Map_Access'Storage_Size use 0; + + use Red_Black_Trees; + use Tree_Types; + use Ada.Streams; + + type Cursor is record + Container : Map_Access; + Node : Count_Type; + end record; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor); + + for Cursor'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor); + + for Cursor'Read use Read; + + No_Element : constant Cursor := Cursor'(null, 0); + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Map); + + for Map'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Map); + + for Map'Read use Read; + + Empty_Map : constant Map := Map'(Tree_Type with Capacity => 0); + + end Ada.Containers.Bounded_Ordered_Maps; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cborse.adb gcc-4.6.0/gcc/ada/a-cborse.adb *** gcc-4.5.2/gcc/ada/a-cborse.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cborse.adb Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,1718 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ O R D E R E D _ S E T S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; + pragma Elaborate_All + (Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations); + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys; + pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys); + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations; + pragma Elaborate_All + (Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations); + + with System; use type System.Address; + + package body Ada.Containers.Bounded_Ordered_Sets is + + ------------------------------ + -- Access to Fields of Node -- + ------------------------------ + + -- These subprograms provide functional notation for access to fields + -- of a node, and procedural notation for modifying these fields. + + function Color (Node : Node_Type) return Red_Black_Trees.Color_Type; + pragma Inline (Color); + + function Left (Node : Node_Type) return Count_Type; + pragma Inline (Left); + + function Parent (Node : Node_Type) return Count_Type; + pragma Inline (Parent); + + function Right (Node : Node_Type) return Count_Type; + pragma Inline (Right); + + procedure Set_Color + (Node : in out Node_Type; + Color : Red_Black_Trees.Color_Type); + pragma Inline (Set_Color); + + procedure Set_Left (Node : in out Node_Type; Left : Count_Type); + pragma Inline (Set_Left); + + procedure Set_Right (Node : in out Node_Type; Right : Count_Type); + pragma Inline (Set_Right); + + procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type); + pragma Inline (Set_Parent); + + ----------------------- + -- Local Subprograms -- + ----------------------- + + procedure Insert_Sans_Hint + (Container : in out Set; + New_Item : Element_Type; + Node : out Count_Type; + Inserted : out Boolean); + + procedure Insert_With_Hint + (Dst_Set : in out Set; + Dst_Hint : Count_Type; + Src_Node : Node_Type; + Dst_Node : out Count_Type); + + function Is_Greater_Element_Node + (Left : Element_Type; + Right : Node_Type) return Boolean; + pragma Inline (Is_Greater_Element_Node); + + function Is_Less_Element_Node + (Left : Element_Type; + Right : Node_Type) return Boolean; + pragma Inline (Is_Less_Element_Node); + + function Is_Less_Node_Node (L, R : Node_Type) return Boolean; + pragma Inline (Is_Less_Node_Node); + + procedure Replace_Element + (Container : in out Set; + Index : Count_Type; + Item : Element_Type); + + -------------------------- + -- Local Instantiations -- + -------------------------- + + package Tree_Operations is + new Red_Black_Trees.Generic_Bounded_Operations (Tree_Types); + + use Tree_Operations; + + package Element_Keys is + new Red_Black_Trees.Generic_Bounded_Keys + (Tree_Operations => Tree_Operations, + Key_Type => Element_Type, + Is_Less_Key_Node => Is_Less_Element_Node, + Is_Greater_Key_Node => Is_Greater_Element_Node); + + package Set_Ops is + new Red_Black_Trees.Generic_Bounded_Set_Operations + (Tree_Operations => Tree_Operations, + Set_Type => Set, + Assign => Assign, + Insert_With_Hint => Insert_With_Hint, + Is_Less => Is_Less_Node_Node); + + --------- + -- "<" -- + --------- + + function "<" (Left, Right : Cursor) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor equals No_Element"; + end if; + + if Right.Node = 0 then + raise Constraint_Error with "Right cursor equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "bad Left cursor in ""<"""); + + pragma Assert (Vet (Right.Container.all, Right.Node), + "bad Right cursor in ""<"""); + + declare + LN : Nodes_Type renames Left.Container.Nodes; + RN : Nodes_Type renames Right.Container.Nodes; + begin + return LN (Left.Node).Element < RN (Right.Node).Element; + end; + end "<"; + + function "<" (Left : Cursor; Right : Element_Type) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "bad Left cursor in ""<"""); + + return Left.Container.Nodes (Left.Node).Element < Right; + end "<"; + + function "<" (Left : Element_Type; Right : Cursor) return Boolean is + begin + if Right.Node = 0 then + raise Constraint_Error with "Right cursor equals No_Element"; + end if; + + pragma Assert (Vet (Right.Container.all, Right.Node), + "bad Right cursor in ""<"""); + + return Left < Right.Container.Nodes (Right.Node).Element; + end "<"; + + --------- + -- "=" -- + --------- + + function "=" (Left, Right : Set) return Boolean is + function Is_Equal_Node_Node (L, R : Node_Type) return Boolean; + pragma Inline (Is_Equal_Node_Node); + + function Is_Equal is + new Tree_Operations.Generic_Equal (Is_Equal_Node_Node); + + ------------------------ + -- Is_Equal_Node_Node -- + ------------------------ + + function Is_Equal_Node_Node (L, R : Node_Type) return Boolean is + begin + return L.Element = R.Element; + end Is_Equal_Node_Node; + + -- Start of processing for Is_Equal + + begin + return Is_Equal (Left, Right); + end "="; + + --------- + -- ">" -- + --------- + + function ">" (Left, Right : Cursor) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor equals No_Element"; + end if; + + if Right.Node = 0 then + raise Constraint_Error with "Right cursor equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "bad Left cursor in "">"""); + + pragma Assert (Vet (Right.Container.all, Right.Node), + "bad Right cursor in "">"""); + + -- L > R same as R < L + + declare + LN : Nodes_Type renames Left.Container.Nodes; + RN : Nodes_Type renames Right.Container.Nodes; + begin + return RN (Right.Node).Element < LN (Left.Node).Element; + end; + end ">"; + + function ">" (Left : Element_Type; Right : Cursor) return Boolean is + begin + if Right.Node = 0 then + raise Constraint_Error with "Right cursor equals No_Element"; + end if; + + pragma Assert (Vet (Right.Container.all, Right.Node), + "bad Right cursor in "">"""); + + return Right.Container.Nodes (Right.Node).Element < Left; + end ">"; + + function ">" (Left : Cursor; Right : Element_Type) return Boolean is + begin + if Left.Node = 0 then + raise Constraint_Error with "Left cursor equals No_Element"; + end if; + + pragma Assert (Vet (Left.Container.all, Left.Node), + "bad Left cursor in "">"""); + + return Right < Left.Container.Nodes (Left.Node).Element; + end ">"; + + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out Set; Source : Set) is + procedure Append_Element (Source_Node : Count_Type); + + procedure Append_Elements is + new Tree_Operations.Generic_Iteration (Append_Element); + + -------------------- + -- Append_Element -- + -------------------- + + procedure Append_Element (Source_Node : Count_Type) is + SN : Node_Type renames Source.Nodes (Source_Node); + + procedure Set_Element (Node : in out Node_Type); + pragma Inline (Set_Element); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Insert_Post is + new Element_Keys.Generic_Insert_Post (New_Node); + + procedure Unconditional_Insert_Sans_Hint is + new Element_Keys.Generic_Unconditional_Insert (Insert_Post); + + procedure Unconditional_Insert_Avec_Hint is + new Element_Keys.Generic_Unconditional_Insert_With_Hint + (Insert_Post, + Unconditional_Insert_Sans_Hint); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Set_Element); + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + + begin + Allocate (Target, Result); + return Result; + end New_Node; + + ----------------- + -- Set_Element -- + ----------------- + + procedure Set_Element (Node : in out Node_Type) is + begin + Node.Element := SN.Element; + end Set_Element; + + Target_Node : Count_Type; + + -- Start of processing for Append_Element + + begin + Unconditional_Insert_Avec_Hint + (Tree => Target, + Hint => 0, + Key => SN.Element, + Node => Target_Node); + end Append_Element; + + -- Start of processing for Assign + + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error + with "Target capacity is less than Source length"; + end if; + + Target.Clear; + Append_Elements (Source); + end Assign; + + ------------- + -- Ceiling -- + ------------- + + function Ceiling (Container : Set; Item : Element_Type) return Cursor is + Node : constant Count_Type := + Element_Keys.Ceiling (Container, Item); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Ceiling; + + ----------- + -- Clear -- + ----------- + + procedure Clear (Container : in out Set) is + begin + Tree_Operations.Clear_Tree (Container); + end Clear; + + ----------- + -- Color -- + ----------- + + function Color (Node : Node_Type) return Red_Black_Trees.Color_Type is + begin + return Node.Color; + end Color; + + -------------- + -- Contains -- + -------------- + + function Contains + (Container : Set; + Item : Element_Type) return Boolean + is + begin + return Find (Container, Item) /= No_Element; + end Contains; + + ---------- + -- Copy -- + ---------- + + function Copy (Source : Set; Capacity : Count_Type := 0) return Set is + C : Count_Type; + + begin + if Capacity = 0 then + C := Source.Length; + + elsif Capacity >= Source.Length then + C := Capacity; + + else + raise Capacity_Error with "Capacity value too small"; + end if; + + return Target : Set (Capacity => C) do + Assign (Target => Target, Source => Source); + end return; + end Copy; + + ------------ + -- Delete -- + ------------ + + procedure Delete (Container : in out Set; Position : in out Cursor) is + begin + if Position.Node = 0 then + raise Constraint_Error with "Position cursor equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with "Position cursor designates wrong set"; + end if; + + pragma Assert (Vet (Container, Position.Node), + "bad cursor in Delete"); + + Tree_Operations.Delete_Node_Sans_Free (Container, Position.Node); + Tree_Operations.Free (Container, Position.Node); + + Position := No_Element; + end Delete; + + procedure Delete (Container : in out Set; Item : Element_Type) is + X : constant Count_Type := Element_Keys.Find (Container, Item); + + begin + if X = 0 then + raise Constraint_Error with "attempt to delete element not in set"; + end if; + + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end Delete; + + ------------------ + -- Delete_First -- + ------------------ + + procedure Delete_First (Container : in out Set) is + X : constant Count_Type := Container.First; + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Delete_First; + + ----------------- + -- Delete_Last -- + ----------------- + + procedure Delete_Last (Container : in out Set) is + X : constant Count_Type := Container.Last; + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Delete_Last; + + ---------------- + -- Difference -- + ---------------- + + procedure Difference (Target : in out Set; Source : Set) + renames Set_Ops.Set_Difference; + + function Difference (Left, Right : Set) return Set + renames Set_Ops.Set_Difference; + + ------------- + -- Element -- + ------------- + + function Element (Position : Cursor) return Element_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with "Position cursor equals No_Element"; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "bad cursor in Element"); + + return Position.Container.Nodes (Position.Node).Element; + end Element; + + ------------------------- + -- Equivalent_Elements -- + ------------------------- + + function Equivalent_Elements (Left, Right : Element_Type) return Boolean is + begin + if Left < Right + or else Right < Left + then + return False; + else + return True; + end if; + end Equivalent_Elements; + + --------------------- + -- Equivalent_Sets -- + --------------------- + + function Equivalent_Sets (Left, Right : Set) return Boolean is + function Is_Equivalent_Node_Node (L, R : Node_Type) return Boolean; + pragma Inline (Is_Equivalent_Node_Node); + + function Is_Equivalent is + new Tree_Operations.Generic_Equal (Is_Equivalent_Node_Node); + + ----------------------------- + -- Is_Equivalent_Node_Node -- + ----------------------------- + + function Is_Equivalent_Node_Node (L, R : Node_Type) return Boolean is + begin + if L.Element < R.Element then + return False; + elsif R.Element < L.Element then + return False; + else + return True; + end if; + end Is_Equivalent_Node_Node; + + -- Start of processing for Equivalent_Sets + + begin + return Is_Equivalent (Left, Right); + end Equivalent_Sets; + + ------------- + -- Exclude -- + ------------- + + procedure Exclude (Container : in out Set; Item : Element_Type) is + X : constant Count_Type := Element_Keys.Find (Container, Item); + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Exclude; + + ---------- + -- Find -- + ---------- + + function Find (Container : Set; Item : Element_Type) return Cursor is + Node : constant Count_Type := Element_Keys.Find (Container, Item); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Find; + + ----------- + -- First -- + ----------- + + function First (Container : Set) return Cursor is + begin + if Container.First = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Container.First); + end First; + + ------------------- + -- First_Element -- + ------------------- + + function First_Element (Container : Set) return Element_Type is + begin + if Container.First = 0 then + raise Constraint_Error with "set is empty"; + end if; + + return Container.Nodes (Container.First).Element; + end First_Element; + + ----------- + -- Floor -- + ----------- + + function Floor (Container : Set; Item : Element_Type) return Cursor is + Node : constant Count_Type := Element_Keys.Floor (Container, Item); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Floor; + + ------------------ + -- Generic_Keys -- + ------------------ + + package body Generic_Keys is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Is_Greater_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean; + pragma Inline (Is_Greater_Key_Node); + + function Is_Less_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean; + pragma Inline (Is_Less_Key_Node); + + -------------------------- + -- Local Instantiations -- + -------------------------- + + package Key_Keys is + new Red_Black_Trees.Generic_Bounded_Keys + (Tree_Operations => Tree_Operations, + Key_Type => Key_Type, + Is_Less_Key_Node => Is_Less_Key_Node, + Is_Greater_Key_Node => Is_Greater_Key_Node); + + ------------- + -- Ceiling -- + ------------- + + function Ceiling (Container : Set; Key : Key_Type) return Cursor is + Node : constant Count_Type := + Key_Keys.Ceiling (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Ceiling; + + -------------- + -- Contains -- + -------------- + + function Contains (Container : Set; Key : Key_Type) return Boolean is + begin + return Find (Container, Key) /= No_Element; + end Contains; + + ------------ + -- Delete -- + ------------ + + procedure Delete (Container : in out Set; Key : Key_Type) is + X : constant Count_Type := Key_Keys.Find (Container, Key); + + begin + if X = 0 then + raise Constraint_Error with "attempt to delete key not in set"; + end if; + + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end Delete; + + ------------- + -- Element -- + ------------- + + function Element (Container : Set; Key : Key_Type) return Element_Type is + Node : constant Count_Type := Key_Keys.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with "key not in set"; + end if; + + return Container.Nodes (Node).Element; + end Element; + + --------------------- + -- Equivalent_Keys -- + --------------------- + + function Equivalent_Keys (Left, Right : Key_Type) return Boolean is + begin + if Left < Right + or else Right < Left + then + return False; + else + return True; + end if; + end Equivalent_Keys; + + ------------- + -- Exclude -- + ------------- + + procedure Exclude (Container : in out Set; Key : Key_Type) is + X : constant Count_Type := Key_Keys.Find (Container, Key); + + begin + if X /= 0 then + Tree_Operations.Delete_Node_Sans_Free (Container, X); + Tree_Operations.Free (Container, X); + end if; + end Exclude; + + ---------- + -- Find -- + ---------- + + function Find (Container : Set; Key : Key_Type) return Cursor is + Node : constant Count_Type := Key_Keys.Find (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Find; + + ----------- + -- Floor -- + ----------- + + function Floor (Container : Set; Key : Key_Type) return Cursor is + Node : constant Count_Type := Key_Keys.Floor (Container, Key); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Node); + end Floor; + + ------------------------- + -- Is_Greater_Key_Node -- + ------------------------- + + function Is_Greater_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean + is + begin + return Key (Right.Element) < Left; + end Is_Greater_Key_Node; + + ---------------------- + -- Is_Less_Key_Node -- + ---------------------- + + function Is_Less_Key_Node + (Left : Key_Type; + Right : Node_Type) return Boolean + is + begin + return Left < Key (Right.Element); + end Is_Less_Key_Node; + + --------- + -- Key -- + --------- + + function Key (Position : Cursor) return Key_Type is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor equals No_Element"; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "bad cursor in Key"); + + return Key (Position.Container.Nodes (Position.Node).Element); + end Key; + + ------------- + -- Replace -- + ------------- + + procedure Replace + (Container : in out Set; + Key : Key_Type; + New_Item : Element_Type) + is + Node : constant Count_Type := Key_Keys.Find (Container, Key); + + begin + if Node = 0 then + raise Constraint_Error with + "attempt to replace key not in set"; + end if; + + Replace_Element (Container, Node, New_Item); + end Replace; + + ----------------------------------- + -- Update_Element_Preserving_Key -- + ----------------------------------- + + procedure Update_Element_Preserving_Key + (Container : in out Set; + Position : Cursor; + Process : not null access procedure (Element : in out Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong set"; + end if; + + pragma Assert (Vet (Container, Position.Node), + "bad cursor in Update_Element_Preserving_Key"); + + declare + N : Node_Type renames Container.Nodes (Position.Node); + E : Element_Type renames N.Element; + K : constant Key_Type := Key (E); + + B : Natural renames Container.Busy; + L : Natural renames Container.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (E); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + + if Equivalent_Keys (K, Key (E)) then + return; + end if; + end; + + Tree_Operations.Delete_Node_Sans_Free (Container, Position.Node); + Tree_Operations.Free (Container, Position.Node); + + raise Program_Error with "key was modified"; + end Update_Element_Preserving_Key; + + end Generic_Keys; + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element (Position : Cursor) return Boolean is + begin + return Position /= No_Element; + end Has_Element; + + ------------- + -- Include -- + ------------- + + procedure Include (Container : in out Set; New_Item : Element_Type) is + Position : Cursor; + Inserted : Boolean; + + begin + Insert (Container, New_Item, Position, Inserted); + + if not Inserted then + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (set is locked)"; + end if; + + Container.Nodes (Position.Node).Element := New_Item; + end if; + end Include; + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out Set; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean) + is + begin + Insert_Sans_Hint + (Container, + New_Item, + Position.Node, + Inserted); + + Position.Container := Container'Unrestricted_Access; + end Insert; + + procedure Insert + (Container : in out Set; + New_Item : Element_Type) + is + Position : Cursor; + pragma Unreferenced (Position); + + Inserted : Boolean; + + begin + Insert (Container, New_Item, Position, Inserted); + + if not Inserted then + raise Constraint_Error with + "attempt to insert element already in set"; + end if; + end Insert; + + ---------------------- + -- Insert_Sans_Hint -- + ---------------------- + + procedure Insert_Sans_Hint + (Container : in out Set; + New_Item : Element_Type; + Node : out Count_Type; + Inserted : out Boolean) + is + procedure Set_Element (Node : in out Node_Type); + pragma Inline (Set_Element); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Insert_Post is + new Element_Keys.Generic_Insert_Post (New_Node); + + procedure Conditional_Insert_Sans_Hint is + new Element_Keys.Generic_Conditional_Insert (Insert_Post); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Set_Element); + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + + begin + Allocate (Container, Result); + return Result; + end New_Node; + + ----------------- + -- Set_Element -- + ----------------- + + procedure Set_Element (Node : in out Node_Type) is + begin + Node.Element := New_Item; + end Set_Element; + + -- Start of processing for Insert_Sans_Hint + + begin + Conditional_Insert_Sans_Hint + (Container, + New_Item, + Node, + Inserted); + end Insert_Sans_Hint; + + ---------------------- + -- Insert_With_Hint -- + ---------------------- + + procedure Insert_With_Hint + (Dst_Set : in out Set; + Dst_Hint : Count_Type; + Src_Node : Node_Type; + Dst_Node : out Count_Type) + is + Success : Boolean; + pragma Unreferenced (Success); + + procedure Set_Element (Node : in out Node_Type); + pragma Inline (Set_Element); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Insert_Post is + new Element_Keys.Generic_Insert_Post (New_Node); + + procedure Insert_Sans_Hint is + new Element_Keys.Generic_Conditional_Insert (Insert_Post); + + procedure Local_Insert_With_Hint is + new Element_Keys.Generic_Conditional_Insert_With_Hint + (Insert_Post, + Insert_Sans_Hint); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Set_Element); + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + Result : Count_Type; + + begin + Allocate (Dst_Set, Result); + return Result; + end New_Node; + + ----------------- + -- Set_Element -- + ----------------- + + procedure Set_Element (Node : in out Node_Type) is + begin + Node.Element := Src_Node.Element; + end Set_Element; + + -- Start of processing for Insert_With_Hint + + begin + Local_Insert_With_Hint + (Dst_Set, + Dst_Hint, + Src_Node.Element, + Dst_Node, + Success); + end Insert_With_Hint; + + ------------------ + -- Intersection -- + ------------------ + + procedure Intersection (Target : in out Set; Source : Set) + renames Set_Ops.Set_Intersection; + + function Intersection (Left, Right : Set) return Set + renames Set_Ops.Set_Intersection; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty (Container : Set) return Boolean is + begin + return Container.Length = 0; + end Is_Empty; + + ----------------------------- + -- Is_Greater_Element_Node -- + ----------------------------- + + function Is_Greater_Element_Node + (Left : Element_Type; + Right : Node_Type) return Boolean + is + begin + -- Compute e > node same as node < e + + return Right.Element < Left; + end Is_Greater_Element_Node; + + -------------------------- + -- Is_Less_Element_Node -- + -------------------------- + + function Is_Less_Element_Node + (Left : Element_Type; + Right : Node_Type) return Boolean + is + begin + return Left < Right.Element; + end Is_Less_Element_Node; + + ----------------------- + -- Is_Less_Node_Node -- + ----------------------- + + function Is_Less_Node_Node (L, R : Node_Type) return Boolean is + begin + return L.Element < R.Element; + end Is_Less_Node_Node; + + --------------- + -- Is_Subset -- + --------------- + + function Is_Subset (Subset : Set; Of_Set : Set) return Boolean + renames Set_Ops.Set_Subset; + + ------------- + -- Iterate -- + ------------- + + procedure Iterate + (Container : Set; + Process : not null access procedure (Position : Cursor)) + is + procedure Process_Node (Node : Count_Type); + pragma Inline (Process_Node); + + procedure Local_Iterate is + new Tree_Operations.Generic_Iteration (Process_Node); + + ------------------ + -- Process_Node -- + ------------------ + + procedure Process_Node (Node : Count_Type) is + begin + Process (Cursor'(Container'Unrestricted_Access, Node)); + end Process_Node; + + S : Set renames Container'Unrestricted_Access.all; + B : Natural renames S.Busy; + + -- Start of processing for Iterate + + begin + B := B + 1; + + begin + Local_Iterate (S); + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Iterate; + + ---------- + -- Last -- + ---------- + + function Last (Container : Set) return Cursor is + begin + if Container.Last = 0 then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Container.Last); + end Last; + + ------------------ + -- Last_Element -- + ------------------ + + function Last_Element (Container : Set) return Element_Type is + begin + if Container.Last = 0 then + raise Constraint_Error with "set is empty"; + end if; + + return Container.Nodes (Container.Last).Element; + end Last_Element; + + ---------- + -- Left -- + ---------- + + function Left (Node : Node_Type) return Count_Type is + begin + return Node.Left; + end Left; + + ------------ + -- Length -- + ------------ + + function Length (Container : Set) return Count_Type is + begin + return Container.Length; + end Length; + + ---------- + -- Move -- + ---------- + + procedure Move (Target : in out Set; Source : in out Set) is + begin + if Target'Address = Source'Address then + return; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Assign (Target => Target, Source => Source); + end Move; + + ---------- + -- Next -- + ---------- + + function Next (Position : Cursor) return Cursor is + begin + if Position = No_Element then + return No_Element; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "bad cursor in Next"); + + declare + Node : constant Count_Type := + Tree_Operations.Next (Position.Container.all, Position.Node); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Next; + + procedure Next (Position : in out Cursor) is + begin + Position := Next (Position); + end Next; + + ------------- + -- Overlap -- + ------------- + + function Overlap (Left, Right : Set) return Boolean + renames Set_Ops.Set_Overlap; + + ------------ + -- Parent -- + ------------ + + function Parent (Node : Node_Type) return Count_Type is + begin + return Node.Parent; + end Parent; + + -------------- + -- Previous -- + -------------- + + function Previous (Position : Cursor) return Cursor is + begin + if Position = No_Element then + return No_Element; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "bad cursor in Previous"); + + declare + Node : constant Count_Type := + Tree_Operations.Previous + (Position.Container.all, + Position.Node); + + begin + if Node = 0 then + return No_Element; + end if; + + return Cursor'(Position.Container, Node); + end; + end Previous; + + procedure Previous (Position : in out Cursor) is + begin + Position := Previous (Position); + end Previous; + + ------------------- + -- Query_Element -- + ------------------- + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)) + is + begin + if Position.Node = 0 then + raise Constraint_Error with "Position cursor equals No_Element"; + end if; + + pragma Assert (Vet (Position.Container.all, Position.Node), + "bad cursor in Query_Element"); + + declare + S : Set renames Position.Container.all; + + B : Natural renames S.Busy; + L : Natural renames S.Lock; + + begin + B := B + 1; + L := L + 1; + + begin + Process (S.Nodes (Position.Node).Element); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end; + end Query_Element; + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Set) + is + procedure Read_Element (Node : in out Node_Type); + pragma Inline (Read_Element); + + procedure Allocate is + new Tree_Operations.Generic_Allocate (Read_Element); + + procedure Read_Elements is + new Tree_Operations.Generic_Read (Allocate); + + ------------------ + -- Read_Element -- + ------------------ + + procedure Read_Element (Node : in out Node_Type) is + begin + Element_Type'Read (Stream, Node.Element); + end Read_Element; + + -- Start of processing for Read + + begin + Read_Elements (Stream, Container); + end Read; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor) + is + begin + raise Program_Error with "attempt to stream set cursor"; + end Read; + + ------------- + -- Replace -- + ------------- + + procedure Replace (Container : in out Set; New_Item : Element_Type) is + Node : constant Count_Type := Element_Keys.Find (Container, New_Item); + + begin + if Node = 0 then + raise Constraint_Error with + "attempt to replace element not in set"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (set is locked)"; + end if; + + Container.Nodes (Node).Element := New_Item; + end Replace; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Container : in out Set; + Index : Count_Type; + Item : Element_Type) + is + pragma Assert (Index /= 0); + + function New_Node return Count_Type; + pragma Inline (New_Node); + + procedure Local_Insert_Post is + new Element_Keys.Generic_Insert_Post (New_Node); + + procedure Local_Insert_Sans_Hint is + new Element_Keys.Generic_Conditional_Insert (Local_Insert_Post); + + procedure Local_Insert_With_Hint is + new Element_Keys.Generic_Conditional_Insert_With_Hint + (Local_Insert_Post, + Local_Insert_Sans_Hint); + + Nodes : Nodes_Type renames Container.Nodes; + Node : Node_Type renames Nodes (Index); + + -------------- + -- New_Node -- + -------------- + + function New_Node return Count_Type is + begin + Node.Element := Item; + Node.Color := Red_Black_Trees.Red; + Node.Parent := 0; + Node.Right := 0; + Node.Left := 0; + + return Index; + end New_Node; + + Hint : Count_Type; + Result : Count_Type; + Inserted : Boolean; + + -- Start of processing for Replace_Element + + begin + if Item < Node.Element + or else Node.Element < Item + then + null; + + else + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (set is locked)"; + end if; + + Node.Element := Item; + return; + end if; + + Hint := Element_Keys.Ceiling (Container, Item); + + if Hint = 0 then + null; + + elsif Item < Nodes (Hint).Element then + if Hint = Index then + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (set is locked)"; + end if; + + Node.Element := Item; + return; + end if; + + else + pragma Assert (not (Nodes (Hint).Element < Item)); + raise Program_Error with "attempt to replace existing element"; + end if; + + Tree_Operations.Delete_Node_Sans_Free (Container, Index); + + Local_Insert_With_Hint + (Tree => Container, + Position => Hint, + Key => Item, + Node => Result, + Inserted => Inserted); + + pragma Assert (Inserted); + pragma Assert (Result = Index); + end Replace_Element; + + procedure Replace_Element + (Container : in out Set; + Position : Cursor; + New_Item : Element_Type) + is + begin + if Position.Node = 0 then + raise Constraint_Error with + "Position cursor equals No_Element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with + "Position cursor designates wrong set"; + end if; + + pragma Assert (Vet (Container, Position.Node), + "bad cursor in Replace_Element"); + + Replace_Element (Container, Position.Node, New_Item); + end Replace_Element; + + --------------------- + -- Reverse_Iterate -- + --------------------- + + procedure Reverse_Iterate + (Container : Set; + Process : not null access procedure (Position : Cursor)) + is + procedure Process_Node (Node : Count_Type); + pragma Inline (Process_Node); + + procedure Local_Reverse_Iterate is + new Tree_Operations.Generic_Reverse_Iteration (Process_Node); + + ------------------ + -- Process_Node -- + ------------------ + + procedure Process_Node (Node : Count_Type) is + begin + Process (Cursor'(Container'Unrestricted_Access, Node)); + end Process_Node; + + S : Set renames Container'Unrestricted_Access.all; + B : Natural renames S.Busy; + + -- Start of processing for Reverse_Iterate + + begin + B := B + 1; + + begin + Local_Reverse_Iterate (S); + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Reverse_Iterate; + + ----------- + -- Right -- + ----------- + + function Right (Node : Node_Type) return Count_Type is + begin + return Node.Right; + end Right; + + --------------- + -- Set_Color -- + --------------- + + procedure Set_Color + (Node : in out Node_Type; + Color : Red_Black_Trees.Color_Type) + is + begin + Node.Color := Color; + end Set_Color; + + -------------- + -- Set_Left -- + -------------- + + procedure Set_Left (Node : in out Node_Type; Left : Count_Type) is + begin + Node.Left := Left; + end Set_Left; + + ---------------- + -- Set_Parent -- + ---------------- + + procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type) is + begin + Node.Parent := Parent; + end Set_Parent; + + --------------- + -- Set_Right -- + --------------- + + procedure Set_Right (Node : in out Node_Type; Right : Count_Type) is + begin + Node.Right := Right; + end Set_Right; + + -------------------------- + -- Symmetric_Difference -- + -------------------------- + + procedure Symmetric_Difference (Target : in out Set; Source : Set) + renames Set_Ops.Set_Symmetric_Difference; + + function Symmetric_Difference (Left, Right : Set) return Set + renames Set_Ops.Set_Symmetric_Difference; + + ------------ + -- To_Set -- + ------------ + + function To_Set (New_Item : Element_Type) return Set is + Node : Count_Type; + Inserted : Boolean; + begin + return S : Set (1) do + Insert_Sans_Hint (S, New_Item, Node, Inserted); + pragma Assert (Inserted); + end return; + end To_Set; + + ----------- + -- Union -- + ----------- + + procedure Union (Target : in out Set; Source : Set) + renames Set_Ops.Set_Union; + + function Union (Left, Right : Set) return Set + renames Set_Ops.Set_Union; + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Set) + is + procedure Write_Element + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type); + pragma Inline (Write_Element); + + procedure Write_Elements is + new Tree_Operations.Generic_Write (Write_Element); + + ------------------- + -- Write_Element -- + ------------------- + + procedure Write_Element + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type) + is + begin + Element_Type'Write (Stream, Node.Element); + end Write_Element; + + -- Start of processing for Write + + begin + Write_Elements (Stream, Container); + end Write; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor) + is + begin + raise Program_Error with "attempt to stream set cursor"; + end Write; + + end Ada.Containers.Bounded_Ordered_Sets; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cborse.ads gcc-4.6.0/gcc/ada/a-cborse.ads *** gcc-4.5.2/gcc/ada/a-cborse.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cborse.ads Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,294 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ O R D E R E D _ S E T S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + private with Ada.Containers.Red_Black_Trees; + private with Ada.Streams; + + generic + type Element_Type is private; + + with function "<" (Left, Right : Element_Type) return Boolean is <>; + with function "=" (Left, Right : Element_Type) return Boolean is <>; + + package Ada.Containers.Bounded_Ordered_Sets is + pragma Pure; + pragma Remote_Types; + + function Equivalent_Elements (Left, Right : Element_Type) return Boolean; + + type Set (Capacity : Count_Type) is tagged private; + pragma Preelaborable_Initialization (Set); + + type Cursor is private; + pragma Preelaborable_Initialization (Cursor); + + Empty_Set : constant Set; + + No_Element : constant Cursor; + + function "=" (Left, Right : Set) return Boolean; + + function Equivalent_Sets (Left, Right : Set) return Boolean; + + function To_Set (New_Item : Element_Type) return Set; + + function Length (Container : Set) return Count_Type; + + function Is_Empty (Container : Set) return Boolean; + + procedure Clear (Container : in out Set); + + function Element (Position : Cursor) return Element_Type; + + procedure Replace_Element + (Container : in out Set; + Position : Cursor; + New_Item : Element_Type); + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)); + + procedure Assign (Target : in out Set; Source : Set); + + function Copy (Source : Set; Capacity : Count_Type := 0) return Set; + + procedure Move (Target : in out Set; Source : in out Set); + + procedure Insert + (Container : in out Set; + New_Item : Element_Type; + Position : out Cursor; + Inserted : out Boolean); + + procedure Insert + (Container : in out Set; + New_Item : Element_Type); + + procedure Include + (Container : in out Set; + New_Item : Element_Type); + + procedure Replace + (Container : in out Set; + New_Item : Element_Type); + + procedure Exclude + (Container : in out Set; + Item : Element_Type); + + procedure Delete + (Container : in out Set; + Item : Element_Type); + + procedure Delete + (Container : in out Set; + Position : in out Cursor); + + procedure Delete_First (Container : in out Set); + + procedure Delete_Last (Container : in out Set); + + procedure Union (Target : in out Set; Source : Set); + + function Union (Left, Right : Set) return Set; + + function "or" (Left, Right : Set) return Set renames Union; + + procedure Intersection (Target : in out Set; Source : Set); + + function Intersection (Left, Right : Set) return Set; + + function "and" (Left, Right : Set) return Set renames Intersection; + + procedure Difference (Target : in out Set; Source : Set); + + function Difference (Left, Right : Set) return Set; + + function "-" (Left, Right : Set) return Set renames Difference; + + procedure Symmetric_Difference (Target : in out Set; Source : Set); + + function Symmetric_Difference (Left, Right : Set) return Set; + + function "xor" (Left, Right : Set) return Set renames Symmetric_Difference; + + function Overlap (Left, Right : Set) return Boolean; + + function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; + + function First (Container : Set) return Cursor; + + function First_Element (Container : Set) return Element_Type; + + function Last (Container : Set) return Cursor; + + function Last_Element (Container : Set) return Element_Type; + + function Next (Position : Cursor) return Cursor; + + procedure Next (Position : in out Cursor); + + function Previous (Position : Cursor) return Cursor; + + procedure Previous (Position : in out Cursor); + + function Find (Container : Set; Item : Element_Type) return Cursor; + + function Floor (Container : Set; Item : Element_Type) return Cursor; + + function Ceiling (Container : Set; Item : Element_Type) return Cursor; + + function Contains (Container : Set; Item : Element_Type) return Boolean; + + function Has_Element (Position : Cursor) return Boolean; + + function "<" (Left, Right : Cursor) return Boolean; + + function ">" (Left, Right : Cursor) return Boolean; + + function "<" (Left : Cursor; Right : Element_Type) return Boolean; + + function ">" (Left : Cursor; Right : Element_Type) return Boolean; + + function "<" (Left : Element_Type; Right : Cursor) return Boolean; + + function ">" (Left : Element_Type; Right : Cursor) return Boolean; + + procedure Iterate + (Container : Set; + Process : not null access procedure (Position : Cursor)); + + procedure Reverse_Iterate + (Container : Set; + Process : not null access procedure (Position : Cursor)); + + generic + type Key_Type (<>) is private; + + with function Key (Element : Element_Type) return Key_Type; + + with function "<" (Left, Right : Key_Type) return Boolean is <>; + + package Generic_Keys is + + function Equivalent_Keys (Left, Right : Key_Type) return Boolean; + + function Key (Position : Cursor) return Key_Type; + + function Element (Container : Set; Key : Key_Type) return Element_Type; + + procedure Replace + (Container : in out Set; + Key : Key_Type; + New_Item : Element_Type); + + procedure Exclude (Container : in out Set; Key : Key_Type); + + procedure Delete (Container : in out Set; Key : Key_Type); + + function Find (Container : Set; Key : Key_Type) return Cursor; + + function Floor (Container : Set; Key : Key_Type) return Cursor; + + function Ceiling (Container : Set; Key : Key_Type) return Cursor; + + function Contains (Container : Set; Key : Key_Type) return Boolean; + + procedure Update_Element_Preserving_Key + (Container : in out Set; + Position : Cursor; + Process : not null access + procedure (Element : in out Element_Type)); + + end Generic_Keys; + + private + + pragma Inline (Next); + pragma Inline (Previous); + + type Node_Type is record + Parent : Count_Type; + Left : Count_Type; + Right : Count_Type; + Color : Red_Black_Trees.Color_Type := Red_Black_Trees.Red; + Element : Element_Type; + end record; + + package Tree_Types is + new Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type); + + type Set (Capacity : Count_Type) is + new Tree_Types.Tree_Type (Capacity) with null record; + + type Set_Access is access all Set; + for Set_Access'Storage_Size use 0; + + type Cursor is record + Container : Set_Access; + Node : Count_Type; + end record; + + use Tree_Types; + use Ada.Streams; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Cursor); + + for Cursor'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Cursor); + + for Cursor'Read use Read; + + No_Element : constant Cursor := Cursor'(null, 0); + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Set); + + for Set'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Set); + + for Set'Read use Read; + + Empty_Set : constant Set := Set'(Tree_Type with Capacity => 0); + + end Ada.Containers.Bounded_Ordered_Sets; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cdlili.adb gcc-4.6.0/gcc/ada/a-cdlili.adb *** gcc-4.5.2/gcc/ada/a-cdlili.adb Wed Jan 27 13:39:30 2010 --- gcc-4.6.0/gcc/ada/a-cdlili.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Doubly_Linke *** 151,157 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; while Container.Length > 1 loop --- 151,157 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; while Container.Length > 1 loop *************** package body Ada.Containers.Doubly_Linke *** 227,233 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; for Index in 1 .. Count loop --- 227,233 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; for Index in 1 .. Count loop *************** package body Ada.Containers.Doubly_Linke *** 277,283 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; for I in 1 .. Count loop --- 277,283 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; for I in 1 .. Count loop *************** package body Ada.Containers.Doubly_Linke *** 315,321 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; for I in 1 .. Count loop --- 315,321 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; for I in 1 .. Count loop *************** package body Ada.Containers.Doubly_Linke *** 464,475 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; LI := First (Target); --- 464,475 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; LI := First (Target); *************** package body Ada.Containers.Doubly_Linke *** 583,589 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; Sort (Front => null, Back => null); --- 583,589 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; Sort (Front => null, Back => null); *************** package body Ada.Containers.Doubly_Linke *** 638,644 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; New_Node := new Node_Type'(New_Item, null, null); --- 638,644 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; New_Node := new Node_Type'(New_Item, null, null); *************** package body Ada.Containers.Doubly_Linke *** 693,699 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; New_Node := new Node_Type; --- 693,699 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; New_Node := new Node_Type; *************** package body Ada.Containers.Doubly_Linke *** 844,850 **** if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; Clear (Target); --- 844,850 ---- if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; Clear (Target); *************** package body Ada.Containers.Doubly_Linke *** 1048,1054 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is locked)"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); --- 1048,1054 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (list is locked)"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); *************** package body Ada.Containers.Doubly_Linke *** 1116,1122 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; Container.First := J; --- 1116,1122 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; Container.First := J; *************** package body Ada.Containers.Doubly_Linke *** 1243,1254 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; if Target.Length = 0 then --- 1243,1254 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; if Target.Length = 0 then *************** package body Ada.Containers.Doubly_Linke *** 1328,1334 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; if Before.Node = null then --- 1328,1334 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; if Before.Node = null then *************** package body Ada.Containers.Doubly_Linke *** 1432,1443 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; if Position.Node = Source.First then --- 1432,1443 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; if Position.Node = Source.First then *************** package body Ada.Containers.Doubly_Linke *** 1536,1542 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is locked)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap"); --- 1536,1542 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (list is locked)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap"); *************** package body Ada.Containers.Doubly_Linke *** 1585,1591 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); --- 1585,1591 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); *************** package body Ada.Containers.Doubly_Linke *** 1767,1773 **** return False; end if; ! if Position.Node = L.First then -- eliminates ealier disjunct return True; end if; --- 1767,1773 ---- return False; end if; ! if Position.Node = L.First then -- eliminates earlier disjunct return True; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cgaaso.ads gcc-4.6.0/gcc/ada/a-cgaaso.ads *** gcc-4.5.2/gcc/ada/a-cgaaso.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-cgaaso.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2010, 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,35 **** -- 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 (<>); --- 29,35 ---- -- Allows an anonymous array (or array-like container) to be sorted. Generic -- formal Less returns the result of comparing the elements designated by the ! -- indexes, and generic formal Swap exchanges the designated elements. generic type Index_Type is (<>); diff -Nrcpad gcc-4.5.2/gcc/ada/a-chahan.ads gcc-4.6.0/gcc/ada/a-chahan.ads *** gcc-4.5.2/gcc/ada/a-chahan.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-chahan.ads Tue Aug 10 13:50:53 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Characters.Handling is *** 95,100 **** --- 95,103 ---- -- to use these routines when creating code that is intended to run in -- either Ada 95 or Ada 2005 mode. + -- We do however have to flag these if the pragma No_Obsolescent_Features + -- restriction is active (see Restrict.Check_Obsolescent_2005_Entity). + function Is_Character (Item : Wide_Character) return Boolean; function Is_String (Item : Wide_String) return Boolean; *************** package Ada.Characters.Handling is *** 108,113 **** --- 111,119 ---- -- to use these routines when creating code that is intended to run in -- either Ada 95 or Ada 2005 mode. + -- We do however have to flag these if the pragma No_Obsolescent_Features + -- restriction is active (see Restrict.Check_Obsolescent_2005_Entity). + function To_Character (Item : Wide_Character; Substitute : Character := ' ') return Character; diff -Nrcpad gcc-4.5.2/gcc/ada/a-chtgbk.adb gcc-4.6.0/gcc/ada/a-chtgbk.adb *** gcc-4.5.2/gcc/ada/a-chtgbk.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-chtgbk.adb Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,322 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.HASH_TABLES.GENERIC_BOUNDED_KEYS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + package body Ada.Containers.Hash_Tables.Generic_Bounded_Keys is + + -------------------------- + -- Delete_Key_Sans_Free -- + -------------------------- + + procedure Delete_Key_Sans_Free + (HT : in out Hash_Table_Type'Class; + Key : Key_Type; + X : out Count_Type) + is + Indx : Hash_Type; + Prev : Count_Type; + + begin + if HT.Length = 0 then + X := 0; + return; + end if; + + Indx := Index (HT, Key); + X := HT.Buckets (Indx); + + if X = 0 then + return; + end if; + + if Equivalent_Keys (Key, HT.Nodes (X)) then + if HT.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + HT.Buckets (Indx) := Next (HT.Nodes (X)); + HT.Length := HT.Length - 1; + return; + end if; + + loop + Prev := X; + X := Next (HT.Nodes (Prev)); + + if X = 0 then + return; + end if; + + if Equivalent_Keys (Key, HT.Nodes (X)) then + if HT.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + Set_Next (HT.Nodes (Prev), Next => Next (HT.Nodes (X))); + HT.Length := HT.Length - 1; + return; + end if; + end loop; + end Delete_Key_Sans_Free; + + ---------- + -- Find -- + ---------- + + function Find + (HT : Hash_Table_Type'Class; + Key : Key_Type) return Count_Type + is + Indx : Hash_Type; + Node : Count_Type; + + begin + if HT.Length = 0 then + return 0; + end if; + + Indx := Index (HT, Key); + + Node := HT.Buckets (Indx); + while Node /= 0 loop + if Equivalent_Keys (Key, HT.Nodes (Node)) then + return Node; + end if; + Node := Next (HT.Nodes (Node)); + end loop; + + return 0; + end Find; + + -------------------------------- + -- Generic_Conditional_Insert -- + -------------------------------- + + procedure Generic_Conditional_Insert + (HT : in out Hash_Table_Type'Class; + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean) + is + Indx : constant Hash_Type := Index (HT, Key); + B : Count_Type renames HT.Buckets (Indx); + + begin + if B = 0 then + if HT.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + if HT.Length = HT.Capacity then + raise Capacity_Error with "no more capacity for insertion"; + end if; + + Node := New_Node; + Set_Next (HT.Nodes (Node), Next => 0); + + Inserted := True; + + B := Node; + HT.Length := HT.Length + 1; + + return; + end if; + + Node := B; + loop + if Equivalent_Keys (Key, HT.Nodes (Node)) then + Inserted := False; + return; + end if; + + Node := Next (HT.Nodes (Node)); + + exit when Node = 0; + end loop; + + if HT.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + if HT.Length = HT.Capacity then + raise Capacity_Error with "no more capacity for insertion"; + end if; + + Node := New_Node; + Set_Next (HT.Nodes (Node), Next => B); + + Inserted := True; + + B := Node; + HT.Length := HT.Length + 1; + end Generic_Conditional_Insert; + + ----------- + -- Index -- + ----------- + + function Index + (HT : Hash_Table_Type'Class; + Key : Key_Type) return Hash_Type is + begin + return HT.Buckets'First + Hash (Key) mod HT.Buckets'Length; + end Index; + + ----------------------------- + -- Generic_Replace_Element -- + ----------------------------- + + procedure Generic_Replace_Element + (HT : in out Hash_Table_Type'Class; + Node : Count_Type; + Key : Key_Type) + is + pragma Assert (HT.Length > 0); + pragma Assert (Node /= 0); + + BB : Buckets_Type renames HT.Buckets; + NN : Nodes_Type renames HT.Nodes; + + Old_Hash : constant Hash_Type := Hash (NN (Node)); + Old_Indx : constant Hash_Type := BB'First + Old_Hash mod BB'Length; + + New_Hash : constant Hash_Type := Hash (Key); + New_Indx : constant Hash_Type := BB'First + New_Hash mod BB'Length; + + New_Bucket : Count_Type renames BB (New_Indx); + N, M : Count_Type; + + begin + -- Replace_Element is allowed to change a node's key to Key + -- (generic formal operation Assign provides the mechanism), but + -- only if Key is not already in the hash table. (In a unique-key + -- hash table as this one, a key is mapped to exactly one node.) + + if Equivalent_Keys (Key, NN (Node)) then + pragma Assert (New_Hash = Old_Hash); + + if HT.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (container is locked)"; + end if; + + -- The new Key value is mapped to this same Node, so Node + -- stays in the same bucket. + + Assign (NN (Node), Key); + pragma Assert (Hash (NN (Node)) = New_Hash); + pragma Assert (Equivalent_Keys (Key, NN (Node))); + return; + end if; + + -- Key is not equivalent to Node, so we now have to determine if it's + -- equivalent to some other node in the hash table. This is the case + -- irrespective of whether Key is in the same or a different bucket from + -- Node. + + N := New_Bucket; + while N /= 0 loop + if Equivalent_Keys (Key, NN (N)) then + pragma Assert (N /= Node); + raise Program_Error with + "attempt to replace existing element"; + end if; + + N := Next (NN (N)); + end loop; + + -- We have determined that Key is not already in the hash table, so + -- the change is tentatively allowed. We now perform the standard + -- checks to determine whether the hash table is locked (because you + -- cannot change an element while it's in use by Query_Element or + -- Update_Element), or if the container is busy (because moving a + -- node to a different bucket would interfere with iteration). + + if Old_Indx = New_Indx then + -- The node is already in the bucket implied by Key. In this case + -- we merely change its value without moving it. + + if HT.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (container is locked)"; + end if; + + Assign (NN (Node), Key); + pragma Assert (Hash (NN (Node)) = New_Hash); + pragma Assert (Equivalent_Keys (Key, NN (Node))); + return; + end if; + + -- The node is a bucket different from the bucket implied by Key + + if HT.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + -- Do the assignment first, before moving the node, so that if Assign + -- propagates an exception, then the hash table will not have been + -- modified (except for any possible side-effect Assign had on Node). + + Assign (NN (Node), Key); + pragma Assert (Hash (NN (Node)) = New_Hash); + pragma Assert (Equivalent_Keys (Key, NN (Node))); + + -- Now we can safely remove the node from its current bucket + + N := BB (Old_Indx); -- get value of first node in old bucket + pragma Assert (N /= 0); + + if N = Node then -- node is first node in its bucket + BB (Old_Indx) := Next (NN (Node)); + + else + pragma Assert (HT.Length > 1); + + loop + M := Next (NN (N)); + pragma Assert (M /= 0); + + if M = Node then + Set_Next (NN (N), Next => Next (NN (Node))); + exit; + end if; + + N := M; + end loop; + end if; + + -- Now we link the node into its new bucket (corresponding to Key) + + Set_Next (NN (Node), Next => New_Bucket); + New_Bucket := Node; + end Generic_Replace_Element; + + end Ada.Containers.Hash_Tables.Generic_Bounded_Keys; diff -Nrcpad gcc-4.5.2/gcc/ada/a-chtgbk.ads gcc-4.6.0/gcc/ada/a-chtgbk.ads *** gcc-4.5.2/gcc/ada/a-chtgbk.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-chtgbk.ads Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,106 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.HASH_TABLES.GENERIC_BOUNDED_KEYS -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + -- Hash_Table_Type is used to implement hashed containers. This package + -- declares hash-table operations that depend on keys. + + generic + with package HT_Types is + new Generic_Bounded_Hash_Table_Types (<>); + + use HT_Types; + + with function Next (Node : Node_Type) return Count_Type; + + with procedure Set_Next + (Node : in out Node_Type; + Next : Count_Type); + + type Key_Type (<>) is limited private; + + with function Hash (Key : Key_Type) return Hash_Type; + + with function Equivalent_Keys + (Key : Key_Type; + Node : Node_Type) return Boolean; + + package Ada.Containers.Hash_Tables.Generic_Bounded_Keys is + pragma Pure; + + function Index + (HT : Hash_Table_Type'Class; + Key : Key_Type) return Hash_Type; + pragma Inline (Index); + -- Returns the bucket number (array index value) for the given key + + procedure Delete_Key_Sans_Free + (HT : in out Hash_Table_Type'Class; + Key : Key_Type; + X : out Count_Type); + -- Removes the node (if any) with the given key from the hash table, + -- without deallocating it. Program_Error is raised if the hash + -- table is busy. + + function Find + (HT : Hash_Table_Type'Class; + Key : Key_Type) return Count_Type; + -- Returns the node (if any) corresponding to the given key + + generic + with function New_Node return Count_Type; + procedure Generic_Conditional_Insert + (HT : in out Hash_Table_Type'Class; + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean); + -- Attempts to insert a new node with the given key into the hash table. + -- If a node with that key already exists in the table, then that node + -- is returned and Inserted returns False. Otherwise New_Node is called + -- to allocate a new node, and Inserted returns True. Program_Error is + -- raised if the hash table is busy. + + generic + with function Hash (Node : Node_Type) return Hash_Type; + with procedure Assign (Node : in out Node_Type; Key : Key_Type); + procedure Generic_Replace_Element + (HT : in out Hash_Table_Type'Class; + Node : Count_Type; + Key : Key_Type); + -- Assigns Key to Node, possibly changing its equivalence class. If Node + -- is in the same equivalence class as Key (that is, it's already in the + -- bucket implied by Key), then if the hash table is locked then + -- Program_Error is raised; otherwise Assign is called to assign Key to + -- Node. If Node is in a different bucket from Key, then Program_Error is + -- raised if the hash table is busy. Otherwise it Assigns Key to Node and + -- moves the Node from its current bucket to the bucket implied by Key. + -- Note that it is never proper to assign to Node a key value already + -- in the map, and so if Key is equivalent to some other node then + -- Program_Error is raised. + + end Ada.Containers.Hash_Tables.Generic_Bounded_Keys; diff -Nrcpad gcc-4.5.2/gcc/ada/a-chtgbo.adb gcc-4.6.0/gcc/ada/a-chtgbo.adb *** gcc-4.5.2/gcc/ada/a-chtgbo.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-chtgbo.adb Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,473 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.HASH_TABLES.GENERIC_BOUNDED_OPERATIONS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with System; use type System.Address; + + package body Ada.Containers.Hash_Tables.Generic_Bounded_Operations is + + ----------- + -- Clear -- + ----------- + + procedure Clear (HT : in out Hash_Table_Type'Class) is + begin + if HT.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + HT.Length := 0; + -- HT.Busy := 0; + -- HT.Lock := 0; + HT.Free := -1; + HT.Buckets := (others => 0); -- optimize this somehow ??? + end Clear; + + --------------------------- + -- Delete_Node_Sans_Free -- + --------------------------- + + procedure Delete_Node_Sans_Free + (HT : in out Hash_Table_Type'Class; + X : Count_Type) + is + pragma Assert (X /= 0); + + Indx : Hash_Type; + Prev : Count_Type; + Curr : Count_Type; + + begin + if HT.Length = 0 then + raise Program_Error with + "attempt to delete node from empty hashed container"; + end if; + + Indx := Index (HT, HT.Nodes (X)); + Prev := HT.Buckets (Indx); + + if Prev = 0 then + raise Program_Error with + "attempt to delete node from empty hash bucket"; + end if; + + if Prev = X then + HT.Buckets (Indx) := Next (HT, Prev); + HT.Length := HT.Length - 1; + return; + end if; + + if HT.Length = 1 then + raise Program_Error with + "attempt to delete node not in its proper hash bucket"; + end if; + + loop + Curr := Next (HT, Prev); + + if Curr = 0 then + raise Program_Error with + "attempt to delete node not in its proper hash bucket"; + end if; + + if Curr = X then + Set_Next (HT.Nodes (Prev), Next => Next (HT, Curr)); + HT.Length := HT.Length - 1; + return; + end if; + + Prev := Curr; + end loop; + end Delete_Node_Sans_Free; + + ----------- + -- First -- + ----------- + + function First (HT : Hash_Table_Type'Class) return Count_Type is + Indx : Hash_Type; + + begin + if HT.Length = 0 then + return 0; + end if; + + Indx := HT.Buckets'First; + loop + if HT.Buckets (Indx) /= 0 then + return HT.Buckets (Indx); + end if; + + Indx := Indx + 1; + end loop; + end First; + + ---------- + -- Free -- + ---------- + + procedure Free + (HT : in out Hash_Table_Type'Class; + X : Count_Type) + is + pragma Assert (X > 0); + pragma Assert (X <= HT.Capacity); + + N : Nodes_Type renames HT.Nodes; + -- pragma Assert (N (X).Prev >= 0); -- node is active + -- Find a way to mark a node as active vs. inactive; we could + -- use a special value in Color_Type for this. ??? + + begin + -- The hash table actually contains two data structures: a list for + -- the "active" nodes that contain elements that have been inserted + -- onto the container, and another for the "inactive" nodes of the free + -- store. + -- + -- We desire that merely declaring an object should have only minimal + -- cost; specially, we want to avoid having to initialize the free + -- store (to fill in the links), especially if the capacity is large. + -- + -- The head of the free list is indicated by Container.Free. If its + -- value is non-negative, then the free store has been initialized + -- in the "normal" way: Container.Free points to the head of the list + -- of free (inactive) nodes, and the value 0 means the free list is + -- empty. Each node on the free list has been initialized to point + -- to the next free node (via its Parent component), and the value 0 + -- means that this is the last free node. + -- + -- If Container.Free is negative, then the links on the free store + -- have not been initialized. In this case the link values are + -- implied: the free store comprises the components of the node array + -- started with the absolute value of Container.Free, and continuing + -- until the end of the array (Nodes'Last). + -- + -- ??? + -- It might be possible to perform an optimization here. Suppose that + -- the free store can be represented as having two parts: one + -- comprising the non-contiguous inactive nodes linked together + -- in the normal way, and the other comprising the contiguous + -- inactive nodes (that are not linked together, at the end of the + -- nodes array). This would allow us to never have to initialize + -- the free store, except in a lazy way as nodes become inactive. + + -- When an element is deleted from the list container, its node + -- becomes inactive, and so we set its Next component to value of + -- the node's index (in the nodes array), to indicate that it is + -- now inactive. This provides a useful way to detect a dangling + -- cursor reference. ??? + + Set_Next (N (X), Next => X); -- Node is deallocated (not on active list) + + if HT.Free >= 0 then + -- The free store has previously been initialized. All we need to + -- do here is link the newly-free'd node onto the free list. + + Set_Next (N (X), HT.Free); + HT.Free := X; + + elsif X + 1 = abs HT.Free then + -- The free store has not been initialized, and the node becoming + -- inactive immediately precedes the start of the free store. All + -- we need to do is move the start of the free store back by one. + + HT.Free := HT.Free + 1; + + else + -- The free store has not been initialized, and the node becoming + -- inactive does not immediately precede the free store. Here we + -- first initialize the free store (meaning the links are given + -- values in the traditional way), and then link the newly-free'd + -- node onto the head of the free store. + + -- ??? + -- See the comments above for an optimization opportunity. If + -- the next link for a node on the free store is negative, then + -- this means the remaining nodes on the free store are + -- physically contiguous, starting as the absolute value of + -- that index value. + + HT.Free := abs HT.Free; + + if HT.Free > HT.Capacity then + HT.Free := 0; + + else + for I in HT.Free .. HT.Capacity - 1 loop + Set_Next (Node => N (I), Next => I + 1); + end loop; + + Set_Next (Node => N (HT.Capacity), Next => 0); + end if; + + Set_Next (Node => N (X), Next => HT.Free); + HT.Free := X; + end if; + end Free; + + ---------------------- + -- Generic_Allocate -- + ---------------------- + + procedure Generic_Allocate + (HT : in out Hash_Table_Type'Class; + Node : out Count_Type) + is + N : Nodes_Type renames HT.Nodes; + + begin + if HT.Free >= 0 then + Node := HT.Free; + + -- We always perform the assignment first, before we + -- change container state, in order to defend against + -- exceptions duration assignment. + + Set_Element (N (Node)); + HT.Free := Next (N (Node)); + + else + -- A negative free store value means that the links of the nodes + -- in the free store have not been initialized. In this case, the + -- nodes are physically contiguous in the array, starting at the + -- index that is the absolute value of the Container.Free, and + -- continuing until the end of the array (Nodes'Last). + + Node := abs HT.Free; + + -- As above, we perform this assignment first, before modifying + -- any container state. + + Set_Element (N (Node)); + HT.Free := HT.Free - 1; + end if; + end Generic_Allocate; + + ------------------- + -- Generic_Equal -- + ------------------- + + function Generic_Equal + (L, R : Hash_Table_Type'Class) return Boolean + is + L_Index : Hash_Type; + L_Node : Count_Type; + + N : Count_Type; + + begin + if L'Address = R'Address then + return True; + end if; + + if L.Length /= R.Length then + return False; + end if; + + if L.Length = 0 then + return True; + end if; + + -- Find the first node of hash table L + + L_Index := 0; + loop + L_Node := L.Buckets (L_Index); + exit when L_Node /= 0; + L_Index := L_Index + 1; + end loop; + + -- For each node of hash table L, search for an equivalent node in hash + -- table R. + + N := L.Length; + loop + if not Find (HT => R, Key => L.Nodes (L_Node)) then + return False; + end if; + + N := N - 1; + + L_Node := Next (L, L_Node); + + if L_Node = 0 then + -- We have exhausted the nodes in this bucket + + if N = 0 then + return True; + end if; + + -- Find the next bucket + + loop + L_Index := L_Index + 1; + L_Node := L.Buckets (L_Index); + exit when L_Node /= 0; + end loop; + end if; + end loop; + end Generic_Equal; + + ----------------------- + -- Generic_Iteration -- + ----------------------- + + procedure Generic_Iteration (HT : Hash_Table_Type'Class) is + Node : Count_Type; + + begin + if HT.Length = 0 then + return; + end if; + + for Indx in HT.Buckets'Range loop + Node := HT.Buckets (Indx); + while Node /= 0 loop + Process (Node); + Node := Next (HT, Node); + end loop; + end loop; + end Generic_Iteration; + + ------------------ + -- Generic_Read -- + ------------------ + + procedure Generic_Read + (Stream : not null access Root_Stream_Type'Class; + HT : out Hash_Table_Type'Class) + is + N : Count_Type'Base; + + begin + Clear (HT); + + Count_Type'Base'Read (Stream, N); + + if N < 0 then + raise Program_Error with "stream appears to be corrupt"; + end if; + + if N = 0 then + return; + end if; + + if N > HT.Capacity then + raise Capacity_Error with "too many elements in stream"; + end if; + + for J in 1 .. N loop + declare + Node : constant Count_Type := New_Node (Stream); + Indx : constant Hash_Type := Index (HT, HT.Nodes (Node)); + B : Count_Type renames HT.Buckets (Indx); + begin + Set_Next (HT.Nodes (Node), Next => B); + B := Node; + end; + + HT.Length := HT.Length + 1; + end loop; + end Generic_Read; + + ------------------- + -- Generic_Write -- + ------------------- + + procedure Generic_Write + (Stream : not null access Root_Stream_Type'Class; + HT : Hash_Table_Type'Class) + is + procedure Write (Node : Count_Type); + pragma Inline (Write); + + procedure Write is new Generic_Iteration (Write); + + ----------- + -- Write -- + ----------- + + procedure Write (Node : Count_Type) is + begin + Write (Stream, HT.Nodes (Node)); + end Write; + + begin + Count_Type'Base'Write (Stream, HT.Length); + Write (HT); + end Generic_Write; + + ----------- + -- Index -- + ----------- + + function Index + (Buckets : Buckets_Type; + Node : Node_Type) return Hash_Type is + begin + return Buckets'First + Hash_Node (Node) mod Buckets'Length; + end Index; + + function Index + (HT : Hash_Table_Type'Class; + Node : Node_Type) return Hash_Type is + begin + return Index (HT.Buckets, Node); + end Index; + + ---------- + -- Next -- + ---------- + + function Next + (HT : Hash_Table_Type'Class; + Node : Count_Type) return Count_Type + is + Result : Count_Type := Next (HT.Nodes (Node)); + + begin + if Result /= 0 then -- another node in same bucket + return Result; + end if; + + -- This was the last node in the bucket, so move to the next + -- bucket, and start searching for next node from there. + + for Indx in Index (HT, HT.Nodes (Node)) + 1 .. HT.Buckets'Last loop + Result := HT.Buckets (Indx); + + if Result /= 0 then -- bucket is not empty + return Result; + end if; + end loop; + + return 0; + end Next; + + end Ada.Containers.Hash_Tables.Generic_Bounded_Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/a-chtgbo.ads gcc-4.6.0/gcc/ada/a-chtgbo.ads *** gcc-4.5.2/gcc/ada/a-chtgbo.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-chtgbo.ads Tue Oct 26 10:42:02 2010 *************** *** 0 **** --- 1,140 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.HASH_TABLES.GENERIC_BOUNDED_OPERATIONS -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + -- Hash_Table_Type is used to implement hashed containers. This package + -- declares hash-table operations that do not depend on keys. + + with Ada.Streams; + + generic + with package HT_Types is + new Generic_Bounded_Hash_Table_Types (<>); + + use HT_Types; + + with function Hash_Node (Node : Node_Type) return Hash_Type; + + with function Next (Node : Node_Type) return Count_Type; + + with procedure Set_Next + (Node : in out Node_Type; + Next : Count_Type); + + package Ada.Containers.Hash_Tables.Generic_Bounded_Operations is + pragma Pure; + + function Index + (Buckets : Buckets_Type; + Node : Node_Type) return Hash_Type; + pragma Inline (Index); + -- Uses the hash value of Node to compute its Buckets array index + + function Index + (HT : Hash_Table_Type'Class; + Node : Node_Type) return Hash_Type; + pragma Inline (Index); + -- Uses the hash value of Node to compute its Hash_Table buckets array + -- index. + + generic + with function Find + (HT : Hash_Table_Type'Class; + Key : Node_Type) return Boolean; + function Generic_Equal (L, R : Hash_Table_Type'Class) return Boolean; + -- Used to implement hashed container equality. For each node in hash table + -- L, it calls Find to search for an equivalent item in hash table R. If + -- Find returns False for any node then Generic_Equal terminates + -- immediately and returns False. Otherwise if Find returns True for every + -- node then Generic_Equal returns True. + + procedure Clear (HT : in out Hash_Table_Type'Class); + -- Deallocates each node in hash table HT. (Note that it only deallocates + -- the nodes, not the buckets array.) Program_Error is raised if the hash + -- table is busy. + + procedure Delete_Node_Sans_Free + (HT : in out Hash_Table_Type'Class; + X : Count_Type); + -- Removes node X from the hash table without deallocating the node + + generic + with procedure Set_Element (Node : in out Node_Type); + procedure Generic_Allocate + (HT : in out Hash_Table_Type'Class; + Node : out Count_Type); + -- Claim a node from the free store. Generic_Allocate first + -- calls Set_Element on the potential node, and then returns + -- the node's index as the value of the Node parameter. + + procedure Free + (HT : in out Hash_Table_Type'Class; + X : Count_Type); + -- Return a node back to the free store, from where it had + -- been previously claimed via Generic_Allocate. + + function First (HT : Hash_Table_Type'Class) return Count_Type; + -- Returns the head of the list in the first (lowest-index) non-empty + -- bucket. + + function Next + (HT : Hash_Table_Type'Class; + Node : Count_Type) return Count_Type; + -- Returns the node that immediately follows Node. This corresponds to + -- either the next node in the same bucket, or (if Node is the last node in + -- its bucket) the head of the list in the first non-empty bucket that + -- follows. + + generic + with procedure Process (Node : Count_Type); + procedure Generic_Iteration (HT : Hash_Table_Type'Class); + -- Calls Process for each node in hash table HT + + generic + use Ada.Streams; + with procedure Write + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type); + procedure Generic_Write + (Stream : not null access Root_Stream_Type'Class; + HT : Hash_Table_Type'Class); + -- Used to implement the streaming attribute for hashed containers. It + -- calls Write for each node to write its value into Stream. + + generic + use Ada.Streams; + with function New_Node (Stream : not null access Root_Stream_Type'Class) + return Count_Type; + procedure Generic_Read + (Stream : not null access Root_Stream_Type'Class; + HT : out Hash_Table_Type'Class); + -- Used to implement the streaming attribute for hashed containers. It + -- first clears hash table HT, then populates the hash table by calling + -- New_Node for each item in Stream. + + end Ada.Containers.Hash_Tables.Generic_Bounded_Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/a-chtgke.adb gcc-4.6.0/gcc/ada/a-chtgke.adb *** gcc-4.5.2/gcc/ada/a-chtgke.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-chtgke.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Hash_Tables. *** 57,63 **** if Equivalent_Keys (Key, X) then if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; HT.Buckets (Indx) := Next (X); HT.Length := HT.Length - 1; --- 57,63 ---- if Equivalent_Keys (Key, X) then if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; HT.Buckets (Indx) := Next (X); HT.Length := HT.Length - 1; *************** package body Ada.Containers.Hash_Tables. *** 75,81 **** if Equivalent_Keys (Key, X) then if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; Set_Next (Node => Prev, Next => Next (X)); HT.Length := HT.Length - 1; --- 75,81 ---- if Equivalent_Keys (Key, X) then if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; Set_Next (Node => Prev, Next => Next (X)); HT.Length := HT.Length - 1; *************** package body Ada.Containers.Hash_Tables. *** 130,136 **** if B = null then if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; if HT.Length = Count_Type'Last then --- 130,136 ---- if B = null then if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; if HT.Length = Count_Type'Last then *************** package body Ada.Containers.Hash_Tables. *** 160,166 **** if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; if HT.Length = Count_Type'Last then --- 160,166 ---- if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; if HT.Length = Count_Type'Last then *************** package body Ada.Containers.Hash_Tables. *** 212,218 **** if HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is locked)"; end if; -- We can change a node's key to Key (that's what Assign is for), but --- 212,218 ---- if HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (container is locked)"; end if; -- We can change a node's key to Key (that's what Assign is for), but *************** package body Ada.Containers.Hash_Tables. *** 256,262 **** if HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is locked)"; end if; Assign (Node, Key); --- 256,262 ---- if HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (container is locked)"; end if; Assign (Node, Key); *************** package body Ada.Containers.Hash_Tables. *** 269,275 **** if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; -- Do the assignment first, before moving the node, so that if Assign --- 269,275 ---- if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; -- Do the assignment first, before moving the node, so that if Assign diff -Nrcpad gcc-4.5.2/gcc/ada/a-chtgop.adb gcc-4.6.0/gcc/ada/a-chtgop.adb *** gcc-4.5.2/gcc/ada/a-chtgop.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-chtgop.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Hash_Tables. *** 132,138 **** begin if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; while HT.Length > 0 loop --- 132,138 ---- begin if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; while HT.Length > 0 loop *************** package body Ada.Containers.Hash_Tables. *** 478,484 **** if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; Clear (Target); --- 478,484 ---- if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; Clear (Target); *************** package body Ada.Containers.Hash_Tables. *** 619,625 **** if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (container is busy)"; end if; Rehash : declare --- 619,625 ---- if HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (container is busy)"; end if; Rehash : declare diff -Nrcpad gcc-4.5.2/gcc/ada/a-cidlli.adb gcc-4.6.0/gcc/ada/a-cidlli.adb *** gcc-4.5.2/gcc/ada/a-cidlli.adb Mon Aug 17 10:09:55 2009 --- gcc-4.6.0/gcc/ada/a-cidlli.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Indefinite_D *** 175,181 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; while Container.Length > 1 loop --- 175,181 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; while Container.Length > 1 loop *************** package body Ada.Containers.Indefinite_D *** 254,260 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; for Index in 1 .. Count loop --- 254,260 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; for Index in 1 .. Count loop *************** package body Ada.Containers.Indefinite_D *** 304,310 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; for I in 1 .. Count loop --- 304,310 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; for I in 1 .. Count loop *************** package body Ada.Containers.Indefinite_D *** 342,348 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; for I in 1 .. Count loop --- 342,348 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; for I in 1 .. Count loop *************** package body Ada.Containers.Indefinite_D *** 510,521 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; LI := First (Target); --- 510,521 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; LI := First (Target); *************** package body Ada.Containers.Indefinite_D *** 627,633 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; Sort (Front => null, Back => null); --- 627,633 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; Sort (Front => null, Back => null); *************** package body Ada.Containers.Indefinite_D *** 665,671 **** if Before.Container /= null then if Before.Container /= Container'Unrestricted_Access then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; if Before.Node = null --- 665,671 ---- if Before.Container /= null then if Before.Container /= Container'Unrestricted_Access then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; if Before.Node = null *************** package body Ada.Containers.Indefinite_D *** 689,695 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; declare --- 689,695 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; declare *************** package body Ada.Containers.Indefinite_D *** 867,873 **** if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; Clear (Target); --- 867,873 ---- if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; Clear (Target); *************** package body Ada.Containers.Indefinite_D *** 1077,1083 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is locked)"; end if; if Position.Node.Element = null then --- 1077,1083 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (list is locked)"; end if; if Position.Node.Element = null then *************** package body Ada.Containers.Indefinite_D *** 1156,1162 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; Container.First := J; --- 1156,1162 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; Container.First := J; *************** package body Ada.Containers.Indefinite_D *** 1293,1304 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; if Target.Length = 0 then --- 1293,1304 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; if Target.Length = 0 then *************** package body Ada.Containers.Indefinite_D *** 1388,1394 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; if Before.Node = null then --- 1388,1394 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; if Before.Node = null then *************** package body Ada.Containers.Indefinite_D *** 1504,1515 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements of Source (list is busy)"; end if; if Position.Node = Source.First then --- 1504,1515 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Target (list is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors of Source (list is busy)"; end if; if Position.Node = Source.First then *************** package body Ada.Containers.Indefinite_D *** 1608,1614 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is locked)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap"); --- 1608,1614 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (list is locked)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap"); *************** package body Ada.Containers.Indefinite_D *** 1654,1660 **** if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (list is busy)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); --- 1654,1660 ---- if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (list is busy)"; end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); diff -Nrcpad gcc-4.5.2/gcc/ada/a-cihama.adb gcc-4.6.0/gcc/ada/a-cihama.adb *** gcc-4.5.2/gcc/ada/a-cihama.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-cihama.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Indefinite_H *** 197,203 **** if Container.HT.Busy > 0 then raise Program_Error with ! "Delete attempted to tamper with elements (map is busy)"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); --- 197,203 ---- if Container.HT.Busy > 0 then raise Program_Error with ! "Delete attempted to tamper with cursors (map is busy)"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); *************** package body Ada.Containers.Indefinite_H *** 482,488 **** if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "Include attempted to tamper with cursors (map is locked)"; end if; K := Position.Node.Key; --- 482,488 ---- if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "Include attempted to tamper with elements (map is locked)"; end if; K := Position.Node.Key; *************** package body Ada.Containers.Indefinite_H *** 836,842 **** if Container.HT.Lock > 0 then raise Program_Error with ! "Replace attempted to tamper with cursors (map is locked)"; end if; K := Node.Key; --- 836,842 ---- if Container.HT.Lock > 0 then raise Program_Error with ! "Replace attempted to tamper with elements (map is locked)"; end if; K := Node.Key; *************** package body Ada.Containers.Indefinite_H *** 885,891 **** if Position.Container.HT.Lock > 0 then raise Program_Error with ! "Replace_Element attempted to tamper with cursors (map is locked)"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); --- 885,891 ---- if Position.Container.HT.Lock > 0 then raise Program_Error with ! "Replace_Element attempted to tamper with elements (map is locked)"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); *************** package body Ada.Containers.Indefinite_H *** 1031,1037 **** return False; end if; ! if X = X.Next then -- to prevent endless loop return False; end if; --- 1031,1037 ---- return False; end if; ! if X = X.Next then -- to prevent unnecessary looping return False; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cihase.adb gcc-4.6.0/gcc/ada/a-cihase.adb *** gcc-4.5.2/gcc/ada/a-cihase.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-cihase.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Indefinite_H *** 242,248 **** if Container.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; pragma Assert (Vet (Position), "Position cursor is bad"); --- 242,248 ---- if Container.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; pragma Assert (Vet (Position), "Position cursor is bad"); *************** package body Ada.Containers.Indefinite_H *** 275,281 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; if Source.HT.Length < Target.HT.Length then --- 275,281 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; if Source.HT.Length < Target.HT.Length then *************** package body Ada.Containers.Indefinite_H *** 667,673 **** if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; X := Position.Node.Element; --- 667,673 ---- if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; X := Position.Node.Element; *************** package body Ada.Containers.Indefinite_H *** 776,782 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; Tgt_Node := HT_Ops.First (Target.HT); --- 776,782 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; Tgt_Node := HT_Ops.First (Target.HT); *************** package body Ada.Containers.Indefinite_H *** 1145,1151 **** if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; X := Node.Element; --- 1145,1151 ---- if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; X := Node.Element; *************** package body Ada.Containers.Indefinite_H *** 1220,1226 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; declare --- 1220,1226 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; declare *************** package body Ada.Containers.Indefinite_H *** 1540,1546 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; declare --- 1540,1546 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; declare diff -Nrcpad gcc-4.5.2/gcc/ada/a-ciorma.adb gcc-4.6.0/gcc/ada/a-ciorma.adb *** gcc-4.5.2/gcc/ada/a-ciorma.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-ciorma.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Indefinite_O *** 625,631 **** if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (map is locked)"; end if; K := Position.Node.Key; --- 625,631 ---- if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (map is locked)"; end if; K := Position.Node.Key; *************** package body Ada.Containers.Indefinite_O *** 1106,1112 **** if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (map is locked)"; end if; K := Node.Key; --- 1106,1112 ---- if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (map is locked)"; end if; K := Node.Key; *************** package body Ada.Containers.Indefinite_O *** 1155,1161 **** if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (map is locked)"; end if; pragma Assert (Vet (Container.Tree, Position.Node), --- 1155,1161 ---- if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (map is locked)"; end if; pragma Assert (Vet (Container.Tree, Position.Node), diff -Nrcpad gcc-4.5.2/gcc/ada/a-ciormu.adb gcc-4.6.0/gcc/ada/a-ciormu.adb *** gcc-4.5.2/gcc/ada/a-ciormu.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-ciormu.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Indefinite_O *** 1564,1570 **** else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; declare --- 1564,1570 ---- else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; declare diff -Nrcpad gcc-4.5.2/gcc/ada/a-ciorse.adb gcc-4.6.0/gcc/ada/a-ciorse.adb *** gcc-4.5.2/gcc/ada/a-ciorse.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-ciorse.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Indefinite_O *** 930,936 **** if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; X := Position.Node.Element; --- 930,936 ---- if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; X := Position.Node.Element; *************** package body Ada.Containers.Indefinite_O *** 1444,1450 **** if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; X := Node.Element; --- 1444,1450 ---- if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; X := Node.Element; *************** package body Ada.Containers.Indefinite_O *** 1499,1505 **** X : Element_Access := Node.Element; ! -- Start of processing for Insert begin if Item < Node.Element.all --- 1499,1505 ---- X : Element_Access := Node.Element; ! -- Start of processing for Replace_Element begin if Item < Node.Element.all *************** package body Ada.Containers.Indefinite_O *** 1510,1516 **** else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := new Element_Type'(Item); --- 1510,1516 ---- else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := new Element_Type'(Item); *************** package body Ada.Containers.Indefinite_O *** 1528,1534 **** if Hint = Node then if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := new Element_Type'(Item); --- 1528,1534 ---- if Hint = Node then if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := new Element_Type'(Item); diff -Nrcpad gcc-4.5.2/gcc/ada/a-cobove.adb gcc-4.6.0/gcc/ada/a-cobove.adb *** gcc-4.5.2/gcc/ada/a-cobove.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cobove.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,2439 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ V E C T O R S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + with Ada.Containers.Generic_Array_Sort; + with System; use type System.Address; + + package body Ada.Containers.Bounded_Vectors is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function To_Array_Index (Index : Index_Type'Base) return Count_Type'Base; + + --------- + -- "&" -- + --------- + + function "&" (Left, Right : Vector) return Vector is + LN : constant Count_Type := Length (Left); + RN : constant Count_Type := Length (Right); + N : Count_Type'Base; -- length of result + J : Count_Type'Base; -- for computing intermediate index values + Last : Index_Type'Base; -- Last index of result + + begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the vector parameters. We could decide to make it larger, but we + -- have no basis for knowing how much larger, so we just allocate the + -- minimum amount of storage. + + -- Here we handle the easy cases first, when one of the vector + -- parameters is empty. (We say "easy" because there's nothing to + -- compute, that can potentially overflow.) + + if LN = 0 then + if RN = 0 then + return Empty_Vector; + end if; + + return Vector'(Capacity => RN, + Elements => Right.Elements (1 .. RN), + Last => Right.Last, + others => <>); + end if; + + if RN = 0 then + return Vector'(Capacity => LN, + Elements => Left.Elements (1 .. LN), + Last => Left.Last, + others => <>); + end if; + + -- Neither of the vector parameters is empty, so must compute the length + -- of the result vector and its last index. (This is the harder case, + -- because our computations must avoid overflow.) + + -- There are two constraints we need to satisfy. The first constraint is + -- that a container cannot have more than Count_Type'Last elements, so + -- we must check the sum of the combined lengths. Note that we cannot + -- simply add the lengths, because of the possibility of overflow. + + if LN > Count_Type'Last - RN then + raise Constraint_Error with "new length is out of range"; + end if; + + -- It is now safe compute the length of the new vector, without fear of + -- overflow. + + N := LN + RN; + + -- The second constraint is that the new Last index value cannot + -- exceed Index_Type'Last. We use the wider of Index_Type'Base and + -- Count_Type'Base as the type for intermediate values. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + -- We perform a two-part test. First we determine whether the + -- computed Last value lies in the base range of the type, and then + -- determine whether it lies in the range of the index (sub)type. + + -- Last must satisfy this relation: + -- First + Length - 1 <= Last + -- We regroup terms: + -- First - 1 <= Last - Length + -- Which can rewrite as: + -- No_Index <= Last - Length + + if Index_Type'Base'Last - Index_Type'Base (N) < No_Index then + raise Constraint_Error with "new length is out of range"; + end if; + + -- We now know that the computed value of Last is within the base + -- range of the type, so it is safe to compute its value: + + Last := No_Index + Index_Type'Base (N); + + -- Finally we test whether the value is within the range of the + -- generic actual index subtype: + + if Last > Index_Type'Last then + raise Constraint_Error with "new length is out of range"; + end if; + + elsif Index_Type'First <= 0 then + -- Here we can compute Last directly, in the normal way. We know that + -- No_Index is less than 0, so there is no danger of overflow when + -- adding the (positive) value of length. + + J := Count_Type'Base (No_Index) + N; -- Last + + if J > Count_Type'Base (Index_Type'Last) then + raise Constraint_Error with "new length is out of range"; + end if; + + -- We know that the computed value (having type Count_Type) of Last + -- is within the range of the generic actual index subtype, so it is + -- safe to convert to Index_Type: + + Last := Index_Type'Base (J); + + else + -- Here Index_Type'First (and Index_Type'Last) is positive, so we + -- must test the length indirectly (by working backwards from the + -- largest possible value of Last), in order to prevent overflow. + + J := Count_Type'Base (Index_Type'Last) - N; -- No_Index + + if J < Count_Type'Base (No_Index) then + raise Constraint_Error with "new length is out of range"; + end if; + + -- We have determined that the result length would not create a Last + -- index value outside of the range of Index_Type, so we can now + -- safely compute its value. + + Last := Index_Type'Base (Count_Type'Base (No_Index) + N); + end if; + + declare + LE : Elements_Array renames Left.Elements (1 .. LN); + RE : Elements_Array renames Right.Elements (1 .. RN); + + begin + return Vector'(Capacity => N, + Elements => LE & RE, + Last => Last, + others => <>); + end; + end "&"; + + function "&" (Left : Vector; Right : Element_Type) return Vector is + LN : constant Count_Type := Length (Left); + + begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the parameters. We could decide to make it larger, but we have no + -- basis for knowing how much larger, so we just allocate the minimum + -- amount of storage. + + -- We must compute the length of the result vector and its last index, + -- but in such a way that overflow is avoided. We must satisfy two + -- constraints: the new length cannot exceed Count_Type'Last, and the + -- new Last index cannot exceed Index_Type'Last. + + if LN = Count_Type'Last then + raise Constraint_Error with "new length is out of range"; + end if; + + if Left.Last >= Index_Type'Last then + raise Constraint_Error with "new length is out of range"; + end if; + + return Vector'(Capacity => LN + 1, + Elements => Left.Elements (1 .. LN) & Right, + Last => Left.Last + 1, + others => <>); + end "&"; + + function "&" (Left : Element_Type; Right : Vector) return Vector is + RN : constant Count_Type := Length (Right); + + begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the parameters. We could decide to make it larger, but we have no + -- basis for knowing how much larger, so we just allocate the minimum + -- amount of storage. + + -- We compute the length of the result vector and its last index, but in + -- such a way that overflow is avoided. We must satisfy two constraints: + -- the new length cannot exceed Count_Type'Last, and the new Last index + -- cannot exceed Index_Type'Last. + + if RN = Count_Type'Last then + raise Constraint_Error with "new length is out of range"; + end if; + + if Right.Last >= Index_Type'Last then + raise Constraint_Error with "new length is out of range"; + end if; + + return Vector'(Capacity => 1 + RN, + Elements => Left & Right.Elements (1 .. RN), + Last => Right.Last + 1, + others => <>); + end "&"; + + function "&" (Left, Right : Element_Type) return Vector is + begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the parameters. We could decide to make it larger, but we have no + -- basis for knowing how much larger, so we just allocate the minimum + -- amount of storage. + + -- We must compute the length of the result vector and its last index, + -- but in such a way that overflow is avoided. We must satisfy two + -- constraints: the new length cannot exceed Count_Type'Last (here, we + -- know that that condition is satisfied), and the new Last index cannot + -- exceed Index_Type'Last. + + if Index_Type'First >= Index_Type'Last then + raise Constraint_Error with "new length is out of range"; + end if; + + return Vector'(Capacity => 2, + Elements => (Left, Right), + Last => Index_Type'First + 1, + others => <>); + end "&"; + + --------- + -- "=" -- + --------- + + overriding function "=" (Left, Right : Vector) return Boolean is + begin + if Left'Address = Right'Address then + return True; + end if; + + if Left.Last /= Right.Last then + return False; + end if; + + for J in Count_Type range 1 .. Left.Length loop + if Left.Elements (J) /= Right.Elements (J) then + return False; + end if; + end loop; + + return True; + end "="; + + ------------ + -- Assign -- + ------------ + + procedure Assign (Target : in out Vector; Source : Vector) is + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error -- ??? + with "Target capacity is less than Source length"; + end if; + + Target.Clear; + + Target.Elements (1 .. Source.Length) := + Source.Elements (1 .. Source.Length); + + Target.Last := Source.Last; + end Assign; + + ------------ + -- Append -- + ------------ + + procedure Append (Container : in out Vector; New_Item : Vector) is + begin + if New_Item.Is_Empty then + return; + end if; + + if Container.Last >= Index_Type'Last then + raise Constraint_Error with "vector is already at its maximum length"; + end if; + + Container.Insert (Container.Last + 1, New_Item); + end Append; + + procedure Append + (Container : in out Vector; + New_Item : Element_Type; + Count : Count_Type := 1) + is + begin + if Count = 0 then + return; + end if; + + if Container.Last >= Index_Type'Last then + raise Constraint_Error with "vector is already at its maximum length"; + end if; + + Container.Insert (Container.Last + 1, New_Item, Count); + end Append; + + -------------- + -- Capacity -- + -------------- + + function Capacity (Container : Vector) return Count_Type is + begin + return Container.Elements'Length; + end Capacity; + + ----------- + -- Clear -- + ----------- + + procedure Clear (Container : in out Vector) is + begin + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + Container.Last := No_Index; + end Clear; + + -------------- + -- Contains -- + -------------- + + function Contains + (Container : Vector; + Item : Element_Type) return Boolean + is + begin + return Find_Index (Container, Item) /= No_Index; + end Contains; + + ---------- + -- Copy -- + ---------- + + function Copy + (Source : Vector; + Capacity : Count_Type := 0) return Vector + is + C : Count_Type; + + begin + if Capacity = 0 then + C := Source.Length; + + elsif Capacity >= Source.Length then + C := Capacity; + + else + raise Capacity_Error + with "Requested capacity is less than Source length"; + end if; + + return Target : Vector (C) do + Target.Elements (1 .. Source.Length) := + Source.Elements (1 .. Source.Length); + + Target.Last := Source.Last; + end return; + end Copy; + + ------------ + -- Delete -- + ------------ + + procedure Delete + (Container : in out Vector; + Index : Extended_Index; + Count : Count_Type := 1) + is + Old_Last : constant Index_Type'Base := Container.Last; + Old_Len : constant Count_Type := Container.Length; + New_Last : Index_Type'Base; + Count2 : Count_Type'Base; -- count of items from Index to Old_Last + Off : Count_Type'Base; -- Index expressed as offset from IT'First + + begin + -- Delete removes items from the vector, the number of which is the + -- minimum of the specified Count and the items (if any) that exist from + -- Index to Container.Last. There are no constraints on the specified + -- value of Count (it can be larger than what's available at this + -- position in the vector, for example), but there are constraints on + -- the allowed values of the Index. + + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying which items + -- should be deleted, so we must manually check. (That the user is + -- allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + + if Index < Index_Type'First then + raise Constraint_Error with "Index is out of range (too small)"; + end if; + + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows the + -- corner case of deleting no items from the back end of the vector to + -- be treated as a no-op. (It is assumed that specifying an index value + -- greater than Last + 1 indicates some deeper flaw in the caller's + -- algorithm, so that case is treated as a proper error.) + + if Index > Old_Last then + if Index > Old_Last + 1 then + raise Constraint_Error with "Index is out of range (too large)"; + end if; + + return; + end if; + + -- Here and elsewhere we treat deleting 0 items from the container as a + -- no-op, even when the container is busy, so we simply return. + + if Count = 0 then + return; + end if; + + -- The tampering bits exist to prevent an item from being deleted (or + -- otherwise harmfully manipulated) while it is being visited. Query, + -- Update, and Iterate increment the busy count on entry, and decrement + -- the count on exit. Delete checks the count to determine whether it is + -- being called while the associated callback procedure is executing. + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + -- We first calculate what's available for deletion starting at + -- Index. Here and elsewhere we use the wider of Index_Type'Base and + -- Count_Type'Base as the type for intermediate values. (See function + -- Length for more information.) + + if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then + Count2 := Count_Type'Base (Old_Last) - Count_Type'Base (Index) + 1; + + else + Count2 := Count_Type'Base (Old_Last - Index + 1); + end if; + + -- If more elements are requested (Count) for deletion than are + -- available (Count2) for deletion beginning at Index, then everything + -- from Index is deleted. There are no elements to slide down, and so + -- all we need to do is set the value of Container.Last. + + if Count >= Count2 then + Container.Last := Index - 1; + return; + end if; + + -- There are some elements aren't being deleted (the requested count was + -- less than the available count), so we must slide them down to + -- Index. We first calculate the index values of the respective array + -- slices, using the wider of Index_Type'Base and Count_Type'Base as the + -- type for intermediate calculations. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + Off := Count_Type'Base (Index - Index_Type'First); + New_Last := Old_Last - Index_Type'Base (Count); + + else + Off := Count_Type'Base (Index) - Count_Type'Base (Index_Type'First); + New_Last := Index_Type'Base (Count_Type'Base (Old_Last) - Count); + end if; + + -- The array index values for each slice have already been determined, + -- so we just slide down to Index the elements that weren't deleted. + + declare + EA : Elements_Array renames Container.Elements; + Idx : constant Count_Type := EA'First + Off; + + begin + EA (Idx .. Old_Len - Count) := EA (Idx + Count .. Old_Len); + Container.Last := New_Last; + end; + end Delete; + + procedure Delete + (Container : in out Vector; + Position : in out Cursor; + Count : Count_Type := 1) + is + pragma Warnings (Off, Position); + + begin + if Position.Container = null then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with "Position cursor denotes wrong container"; + end if; + + if Position.Index > Container.Last then + raise Program_Error with "Position index is out of range"; + end if; + + Delete (Container, Position.Index, Count); + Position := No_Element; + end Delete; + + ------------------ + -- Delete_First -- + ------------------ + + procedure Delete_First + (Container : in out Vector; + Count : Count_Type := 1) + is + begin + if Count = 0 then + return; + end if; + + if Count >= Length (Container) then + Clear (Container); + return; + end if; + + Delete (Container, Index_Type'First, Count); + end Delete_First; + + ----------------- + -- Delete_Last -- + ----------------- + + procedure Delete_Last + (Container : in out Vector; + Count : Count_Type := 1) + is + begin + -- It is not permitted to delete items while the container is busy (for + -- example, we're in the middle of a passive iteration). However, we + -- always treat deleting 0 items as a no-op, even when we're busy, so we + -- simply return without checking. + + if Count = 0 then + return; + end if; + + -- The tampering bits exist to prevent an item from being deleted (or + -- otherwise harmfully manipulated) while it is being visited. Query, + -- Update, and Iterate increment the busy count on entry, and decrement + -- the count on exit. Delete_Last checks the count to determine whether + -- it is being called while the associated callback procedure is + -- executing. + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + -- There is no restriction on how large Count can be when deleting + -- items. If it is equal or greater than the current length, then this + -- is equivalent to clearing the vector. (In particular, there's no need + -- for us to actually calculate the new value for Last.) + + -- If the requested count is less than the current length, then we must + -- calculate the new value for Last. For the type we use the widest of + -- Index_Type'Base and Count_Type'Base for the intermediate values of + -- our calculation. (See the comments in Length for more information.) + + if Count >= Container.Length then + Container.Last := No_Index; + + elsif Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + Container.Last := Container.Last - Index_Type'Base (Count); + + else + Container.Last := + Index_Type'Base (Count_Type'Base (Container.Last) - Count); + end if; + end Delete_Last; + + ------------- + -- Element -- + ------------- + + function Element + (Container : Vector; + Index : Index_Type) return Element_Type + is + begin + if Index > Container.Last then + raise Constraint_Error with "Index is out of range"; + end if; + + return Container.Elements (To_Array_Index (Index)); + end Element; + + function Element (Position : Cursor) return Element_Type is + begin + if Position.Container = null then + raise Constraint_Error with "Position cursor has no element"; + end if; + + return Position.Container.Element (Position.Index); + end Element; + + ---------- + -- Find -- + ---------- + + function Find + (Container : Vector; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor + is + begin + if Position.Container /= null then + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with "Position cursor denotes wrong container"; + end if; + + if Position.Index > Container.Last then + raise Program_Error with "Position index is out of range"; + end if; + end if; + + for J in Position.Index .. Container.Last loop + if Container.Elements (To_Array_Index (J)) = Item then + return (Container'Unrestricted_Access, J); + end if; + end loop; + + return No_Element; + end Find; + + ---------------- + -- Find_Index -- + ---------------- + + function Find_Index + (Container : Vector; + Item : Element_Type; + Index : Index_Type := Index_Type'First) return Extended_Index + is + begin + for Indx in Index .. Container.Last loop + if Container.Elements (To_Array_Index (Indx)) = Item then + return Indx; + end if; + end loop; + + return No_Index; + end Find_Index; + + ----------- + -- First -- + ----------- + + function First (Container : Vector) return Cursor is + begin + if Is_Empty (Container) then + return No_Element; + end if; + + return (Container'Unrestricted_Access, Index_Type'First); + end First; + + ------------------- + -- First_Element -- + ------------------- + + function First_Element (Container : Vector) return Element_Type is + begin + if Container.Last = No_Index then + raise Constraint_Error with "Container is empty"; + end if; + + return Container.Elements (To_Array_Index (Index_Type'First)); + end First_Element; + + ----------------- + -- First_Index -- + ----------------- + + function First_Index (Container : Vector) return Index_Type is + pragma Unreferenced (Container); + begin + return Index_Type'First; + end First_Index; + + --------------------- + -- Generic_Sorting -- + --------------------- + + package body Generic_Sorting is + + --------------- + -- Is_Sorted -- + --------------- + + function Is_Sorted (Container : Vector) return Boolean is + begin + if Container.Last <= Index_Type'First then + return True; + end if; + + declare + EA : Elements_Array renames Container.Elements; + begin + for J in 1 .. Container.Length - 1 loop + if EA (J + 1) < EA (J) then + return False; + end if; + end loop; + end; + + return True; + end Is_Sorted; + + ----------- + -- Merge -- + ----------- + + procedure Merge (Target, Source : in out Vector) is + I, J : Count_Type; + + begin + if Target.Is_Empty then + Target.Assign (Source); + return; + end if; + + if Target'Address = Source'Address then + return; + end if; + + if Source.Is_Empty then + return; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + I := Target.Length; + Target.Set_Length (I + Source.Length); + + declare + TA : Elements_Array renames Target.Elements; + SA : Elements_Array renames Source.Elements; + + begin + J := Target.Length; + while not Source.Is_Empty loop + pragma Assert (Source.Length <= 1 + or else not (SA (Source.Length) < + SA (Source.Length - 1))); + + if I = 0 then + TA (1 .. J) := SA (1 .. Source.Length); + Source.Last := No_Index; + return; + end if; + + pragma Assert (I <= 1 + or else not (TA (I) < TA (I - 1))); + + if SA (Source.Length) < TA (I) then + TA (J) := TA (I); + I := I - 1; + + else + TA (J) := SA (Source.Length); + Source.Last := Source.Last - 1; + end if; + + J := J - 1; + end loop; + end; + end Merge; + + ---------- + -- Sort -- + ---------- + + procedure Sort (Container : in out Vector) + is + procedure Sort is + new Generic_Array_Sort + (Index_Type => Count_Type, + Element_Type => Element_Type, + Array_Type => Elements_Array, + "<" => "<"); + + begin + if Container.Last <= Index_Type'First then + return; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (vector is locked)"; + end if; + + Sort (Container.Elements (1 .. Container.Length)); + end Sort; + + end Generic_Sorting; + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element (Position : Cursor) return Boolean is + begin + if Position.Container = null then + return False; + end if; + + return Position.Index <= Position.Container.Last; + end Has_Element; + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Element_Type; + Count : Count_Type := 1) + is + EA : Elements_Array renames Container.Elements; + Old_Length : constant Count_Type := Container.Length; + + Max_Length : Count_Type'Base; -- determined from range of Index_Type + New_Length : Count_Type'Base; -- sum of current length and Count + + Index : Index_Type'Base; -- scratch for intermediate values + J : Count_Type'Base; -- scratch + + begin + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying where the new + -- items should be inserted, so we must manually check. (That the user + -- is allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + + if Before < Index_Type'First then + raise Constraint_Error with + "Before index is out of range (too small)"; + end if; + + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows for the + -- case of appending items to the back end of the vector. (It is assumed + -- that specifying an index value greater than Last + 1 indicates some + -- deeper flaw in the caller's algorithm, so that case is treated as a + -- proper error.) + + if Before > Container.Last + and then Before > Container.Last + 1 + then + raise Constraint_Error with + "Before index is out of range (too large)"; + end if; + + -- We treat inserting 0 items into the container as a no-op, even when + -- the container is busy, so we simply return. + + if Count = 0 then + return; + end if; + + -- There are two constraints we need to satisfy. The first constraint is + -- that a container cannot have more than Count_Type'Last elements, so + -- we must check the sum of the current length and the insertion + -- count. Note that we cannot simply add these values, because of the + -- possibility of overflow. + + if Old_Length > Count_Type'Last - Count then + raise Constraint_Error with "Count is out of range"; + end if; + + -- It is now safe compute the length of the new vector, without fear of + -- overflow. + + New_Length := Old_Length + Count; + + -- The second constraint is that the new Last index value cannot exceed + -- Index_Type'Last. In each branch below, we calculate the maximum + -- length (computed from the range of values in Index_Type), and then + -- compare the new length to the maximum length. If the new length is + -- acceptable, then we compute the new last index from that. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + -- We have to handle the case when there might be more values in the + -- range of Index_Type than in the range of Count_Type. + + if Index_Type'First <= 0 then + -- We know that No_Index (the same as Index_Type'First - 1) is + -- less than 0, so it is safe to compute the following sum without + -- fear of overflow. + + Index := No_Index + Index_Type'Base (Count_Type'Last); + + if Index <= Index_Type'Last then + -- We have determined that range of Index_Type has at least as + -- many values as in Count_Type, so Count_Type'Last is the + -- maximum number of items that are allowed. + + Max_Length := Count_Type'Last; + + else + -- The range of Index_Type has fewer values than in Count_Type, + -- so the maximum number of items is computed from the range of + -- the Index_Type. + + Max_Length := Count_Type'Base (Index_Type'Last - No_Index); + end if; + + else + -- No_Index is equal or greater than 0, so we can safely compute + -- the difference without fear of overflow (which we would have to + -- worry about if No_Index were less than 0, but that case is + -- handled above). + + Max_Length := Count_Type'Base (Index_Type'Last - No_Index); + end if; + + elsif Index_Type'First <= 0 then + -- We know that No_Index (the same as Index_Type'First - 1) is less + -- than 0, so it is safe to compute the following sum without fear of + -- overflow. + + J := Count_Type'Base (No_Index) + Count_Type'Last; + + if J <= Count_Type'Base (Index_Type'Last) then + -- We have determined that range of Index_Type has at least as + -- many values as in Count_Type, so Count_Type'Last is the maximum + -- number of items that are allowed. + + Max_Length := Count_Type'Last; + + else + -- The range of Index_Type has fewer values than Count_Type does, + -- so the maximum number of items is computed from the range of + -- the Index_Type. + + Max_Length := + Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); + end if; + + else + -- No_Index is equal or greater than 0, so we can safely compute the + -- difference without fear of overflow (which we would have to worry + -- about if No_Index were less than 0, but that case is handled + -- above). + + Max_Length := + Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); + end if; + + -- We have just computed the maximum length (number of items). We must + -- now compare the requested length to the maximum length, as we do not + -- allow a vector expand beyond the maximum (because that would create + -- an internal array with a last index value greater than + -- Index_Type'Last, with no way to index those elements). + + if New_Length > Max_Length then + raise Constraint_Error with "Count is out of range"; + end if; + + -- The tampering bits exist to prevent an item from being harmfully + -- manipulated while it is being visited. Query, Update, and Iterate + -- increment the busy count on entry, and decrement the count on + -- exit. Insert checks the count to determine whether it is being called + -- while the associated callback procedure is executing. + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + if New_Length > Container.Capacity then + raise Capacity_Error with "New length is larger than capacity"; + end if; + + J := To_Array_Index (Before); + + if Before > Container.Last then + -- The new items are being appended to the vector, so no + -- sliding of existing elements is required. + + EA (J .. New_Length) := (others => New_Item); + + else + -- The new items are being inserted before some existing + -- elements, so we must slide the existing elements up to their + -- new home. + + EA (J + Count .. New_Length) := EA (J .. Old_Length); + EA (J .. J + Count - 1) := (others => New_Item); + end if; + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + Container.Last := No_Index + Index_Type'Base (New_Length); + + else + Container.Last := + Index_Type'Base (Count_Type'Base (No_Index) + New_Length); + end if; + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Vector) + is + N : constant Count_Type := Length (New_Item); + B : Count_Type; -- index Before converted to Count_Type + + begin + -- Use Insert_Space to create the "hole" (the destination slice) into + -- which we copy the source items. + + Insert_Space (Container, Before, Count => N); + + if N = 0 then + -- There's nothing else to do here (vetting of parameters was + -- performed already in Insert_Space), so we simply return. + + return; + end if; + + B := To_Array_Index (Before); + + if Container'Address /= New_Item'Address then + -- This is the simple case. New_Item denotes an object different + -- from Container, so there's nothing special we need to do to copy + -- the source items to their destination, because all of the source + -- items are contiguous. + + Container.Elements (B .. B + N - 1) := New_Item.Elements (1 .. N); + return; + end if; + + -- We refer to array index value Before + N - 1 as J. This is the last + -- index value of the destination slice. + + -- New_Item denotes the same object as Container, so an insertion has + -- potentially split the source items. The destination is always the + -- range [Before, J], but the source is [Index_Type'First, Before) and + -- (J, Container.Last]. We perform the copy in two steps, using each of + -- the two slices of the source items. + + declare + subtype Src_Index_Subtype is Count_Type'Base range 1 .. B - 1; + + Src : Elements_Array renames Container.Elements (Src_Index_Subtype); + + begin + -- We first copy the source items that precede the space we + -- inserted. (If Before equals Index_Type'First, then this first + -- source slice will be empty, which is harmless.) + + Container.Elements (B .. B + Src'Length - 1) := Src; + end; + + declare + subtype Src_Index_Subtype is Count_Type'Base range + B + N .. Container.Length; + + Src : Elements_Array renames Container.Elements (Src_Index_Subtype); + + begin + -- We next copy the source items that follow the space we inserted. + + Container.Elements (B + N - Src'Length .. B + N - 1) := Src; + end; + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector) + is + Index : Index_Type'Base; + + begin + if Before.Container /= null + and then Before.Container /= Container'Unchecked_Access + then + raise Program_Error with "Before cursor denotes wrong container"; + end if; + + if Is_Empty (New_Item) then + return; + end if; + + if Before.Container = null + or else Before.Index > Container.Last + then + if Container.Last = Index_Type'Last then + raise Constraint_Error with + "vector is already at its maximum length"; + end if; + + Index := Container.Last + 1; + + else + Index := Before.Index; + end if; + + Insert (Container, Index, New_Item); + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector; + Position : out Cursor) + is + Index : Index_Type'Base; + + begin + if Before.Container /= null + and then Before.Container /= Container'Unchecked_Access + then + raise Program_Error with "Before cursor denotes wrong container"; + end if; + + if Is_Empty (New_Item) then + if Before.Container = null + or else Before.Index > Container.Last + then + Position := No_Element; + else + Position := (Container'Unchecked_Access, Before.Index); + end if; + + return; + end if; + + if Before.Container = null + or else Before.Index > Container.Last + then + if Container.Last = Index_Type'Last then + raise Constraint_Error with + "vector is already at its maximum length"; + end if; + + Index := Container.Last + 1; + + else + Index := Before.Index; + end if; + + Insert (Container, Index, New_Item); + + Position := Cursor'(Container'Unchecked_Access, Index); + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Element_Type; + Count : Count_Type := 1) + is + Index : Index_Type'Base; + + begin + if Before.Container /= null + and then Before.Container /= Container'Unchecked_Access + then + raise Program_Error with "Before cursor denotes wrong container"; + end if; + + if Count = 0 then + return; + end if; + + if Before.Container = null + or else Before.Index > Container.Last + then + if Container.Last = Index_Type'Last then + raise Constraint_Error with + "vector is already at its maximum length"; + end if; + + Index := Container.Last + 1; + + else + Index := Before.Index; + end if; + + Insert (Container, Index, New_Item, Count); + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Element_Type; + Position : out Cursor; + Count : Count_Type := 1) + is + Index : Index_Type'Base; + + begin + if Before.Container /= null + and then Before.Container /= Container'Unchecked_Access + then + raise Program_Error with "Before cursor denotes wrong container"; + end if; + + if Count = 0 then + if Before.Container = null + or else Before.Index > Container.Last + then + Position := No_Element; + else + Position := (Container'Unchecked_Access, Before.Index); + end if; + + return; + end if; + + if Before.Container = null + or else Before.Index > Container.Last + then + if Container.Last = Index_Type'Last then + raise Constraint_Error with + "vector is already at its maximum length"; + end if; + + Index := Container.Last + 1; + + else + Index := Before.Index; + end if; + + Insert (Container, Index, New_Item, Count); + + Position := Cursor'(Container'Unchecked_Access, Index); + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Extended_Index; + Count : Count_Type := 1) + is + New_Item : Element_Type; -- Default-initialized value + pragma Warnings (Off, New_Item); + + begin + Insert (Container, Before, New_Item, Count); + end Insert; + + procedure Insert + (Container : in out Vector; + Before : Cursor; + Position : out Cursor; + Count : Count_Type := 1) + is + New_Item : Element_Type; -- Default-initialized value + pragma Warnings (Off, New_Item); + + begin + Insert (Container, Before, New_Item, Position, Count); + end Insert; + + ------------------ + -- Insert_Space -- + ------------------ + + procedure Insert_Space + (Container : in out Vector; + Before : Extended_Index; + Count : Count_Type := 1) + is + EA : Elements_Array renames Container.Elements; + Old_Length : constant Count_Type := Container.Length; + + Max_Length : Count_Type'Base; -- determined from range of Index_Type + New_Length : Count_Type'Base; -- sum of current length and Count + + Index : Index_Type'Base; -- scratch for intermediate values + J : Count_Type'Base; -- scratch + + begin + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying where the new + -- items should be inserted, so we must manually check. (That the user + -- is allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + + if Before < Index_Type'First then + raise Constraint_Error with + "Before index is out of range (too small)"; + end if; + + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows for the + -- case of appending items to the back end of the vector. (It is assumed + -- that specifying an index value greater than Last + 1 indicates some + -- deeper flaw in the caller's algorithm, so that case is treated as a + -- proper error.) + + if Before > Container.Last + and then Before > Container.Last + 1 + then + raise Constraint_Error with + "Before index is out of range (too large)"; + end if; + + -- We treat inserting 0 items into the container as a no-op, even when + -- the container is busy, so we simply return. + + if Count = 0 then + return; + end if; + + -- There are two constraints we need to satisfy. The first constraint is + -- that a container cannot have more than Count_Type'Last elements, so + -- we must check the sum of the current length and the insertion + -- count. Note that we cannot simply add these values, because of the + -- possibility of overflow. + + if Old_Length > Count_Type'Last - Count then + raise Constraint_Error with "Count is out of range"; + end if; + + -- It is now safe compute the length of the new vector, without fear of + -- overflow. + + New_Length := Old_Length + Count; + + -- The second constraint is that the new Last index value cannot exceed + -- Index_Type'Last. In each branch below, we calculate the maximum + -- length (computed from the range of values in Index_Type), and then + -- compare the new length to the maximum length. If the new length is + -- acceptable, then we compute the new last index from that. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + -- We have to handle the case when there might be more values in the + -- range of Index_Type than in the range of Count_Type. + + if Index_Type'First <= 0 then + -- We know that No_Index (the same as Index_Type'First - 1) is + -- less than 0, so it is safe to compute the following sum without + -- fear of overflow. + + Index := No_Index + Index_Type'Base (Count_Type'Last); + + if Index <= Index_Type'Last then + -- We have determined that range of Index_Type has at least as + -- many values as in Count_Type, so Count_Type'Last is the + -- maximum number of items that are allowed. + + Max_Length := Count_Type'Last; + + else + -- The range of Index_Type has fewer values than in Count_Type, + -- so the maximum number of items is computed from the range of + -- the Index_Type. + + Max_Length := Count_Type'Base (Index_Type'Last - No_Index); + end if; + + else + -- No_Index is equal or greater than 0, so we can safely compute + -- the difference without fear of overflow (which we would have to + -- worry about if No_Index were less than 0, but that case is + -- handled above). + + Max_Length := Count_Type'Base (Index_Type'Last - No_Index); + end if; + + elsif Index_Type'First <= 0 then + -- We know that No_Index (the same as Index_Type'First - 1) is less + -- than 0, so it is safe to compute the following sum without fear of + -- overflow. + + J := Count_Type'Base (No_Index) + Count_Type'Last; + + if J <= Count_Type'Base (Index_Type'Last) then + -- We have determined that range of Index_Type has at least as + -- many values as in Count_Type, so Count_Type'Last is the maximum + -- number of items that are allowed. + + Max_Length := Count_Type'Last; + + else + -- The range of Index_Type has fewer values than Count_Type does, + -- so the maximum number of items is computed from the range of + -- the Index_Type. + + Max_Length := + Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); + end if; + + else + -- No_Index is equal or greater than 0, so we can safely compute the + -- difference without fear of overflow (which we would have to worry + -- about if No_Index were less than 0, but that case is handled + -- above). + + Max_Length := + Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); + end if; + + -- We have just computed the maximum length (number of items). We must + -- now compare the requested length to the maximum length, as we do not + -- allow a vector expand beyond the maximum (because that would create + -- an internal array with a last index value greater than + -- Index_Type'Last, with no way to index those elements). + + if New_Length > Max_Length then + raise Constraint_Error with "Count is out of range"; + end if; + + -- The tampering bits exist to prevent an item from being harmfully + -- manipulated while it is being visited. Query, Update, and Iterate + -- increment the busy count on entry, and decrement the count on + -- exit. Insert checks the count to determine whether it is being called + -- while the associated callback procedure is executing. + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + -- An internal array has already been allocated, so we need to check + -- whether there is enough unused storage for the new items. + + if New_Length > Container.Capacity then + raise Capacity_Error with "New length is larger than capacity"; + end if; + + -- In this case, we're inserting space into a vector that has already + -- allocated an internal array, and the existing array has enough + -- unused storage for the new items. + + if Before <= Container.Last then + -- The space is being inserted before some existing elements, + -- so we must slide the existing elements up to their new home. + + J := To_Array_Index (Before); + EA (J + Count .. New_Length) := EA (J .. Old_Length); + end if; + + -- New_Last is the last index value of the items in the container after + -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to + -- compute its value from the New_Length. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + Container.Last := No_Index + Index_Type'Base (New_Length); + + else + Container.Last := + Index_Type'Base (Count_Type'Base (No_Index) + New_Length); + end if; + end Insert_Space; + + procedure Insert_Space + (Container : in out Vector; + Before : Cursor; + Position : out Cursor; + Count : Count_Type := 1) + is + Index : Index_Type'Base; + + begin + if Before.Container /= null + and then Before.Container /= Container'Unchecked_Access + then + raise Program_Error with "Before cursor denotes wrong container"; + end if; + + if Count = 0 then + if Before.Container = null + or else Before.Index > Container.Last + then + Position := No_Element; + else + Position := (Container'Unchecked_Access, Before.Index); + end if; + + return; + end if; + + if Before.Container = null + or else Before.Index > Container.Last + then + if Container.Last = Index_Type'Last then + raise Constraint_Error with + "vector is already at its maximum length"; + end if; + + Index := Container.Last + 1; + + else + Index := Before.Index; + end if; + + Insert_Space (Container, Index, Count => Count); + + Position := Cursor'(Container'Unchecked_Access, Index); + end Insert_Space; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty (Container : Vector) return Boolean is + begin + return Container.Last < Index_Type'First; + end Is_Empty; + + ------------- + -- Iterate -- + ------------- + + procedure Iterate + (Container : Vector; + Process : not null access procedure (Position : Cursor)) + is + V : Vector renames Container'Unrestricted_Access.all; + B : Natural renames V.Busy; + + begin + B := B + 1; + + begin + for Indx in Index_Type'First .. Container.Last loop + Process (Cursor'(Container'Unrestricted_Access, Indx)); + end loop; + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Iterate; + + ---------- + -- Last -- + ---------- + + function Last (Container : Vector) return Cursor is + begin + if Is_Empty (Container) then + return No_Element; + end if; + + return (Container'Unrestricted_Access, Container.Last); + end Last; + + ------------------ + -- Last_Element -- + ------------------ + + function Last_Element (Container : Vector) return Element_Type is + begin + if Container.Last = No_Index then + raise Constraint_Error with "Container is empty"; + end if; + + return Container.Elements (Container.Length); + end Last_Element; + + ---------------- + -- Last_Index -- + ---------------- + + function Last_Index (Container : Vector) return Extended_Index is + begin + return Container.Last; + end Last_Index; + + ------------ + -- Length -- + ------------ + + function Length (Container : Vector) return Count_Type is + L : constant Index_Type'Base := Container.Last; + F : constant Index_Type := Index_Type'First; + + begin + -- The base range of the index type (Index_Type'Base) might not include + -- all values for length (Count_Type). Contrariwise, the index type + -- might include values outside the range of length. Hence we use + -- whatever type is wider for intermediate values when calculating + -- length. Note that no matter what the index type is, the maximum + -- length to which a vector is allowed to grow is always the minimum + -- of Count_Type'Last and (IT'Last - IT'First + 1). + + -- For example, an Index_Type with range -127 .. 127 is only guaranteed + -- to have a base range of -128 .. 127, but the corresponding vector + -- would have lengths in the range 0 .. 255. In this case we would need + -- to use Count_Type'Base for intermediate values. + + -- Another case would be the index range -2**63 + 1 .. -2**63 + 10. The + -- vector would have a maximum length of 10, but the index values lie + -- outside the range of Count_Type (which is only 32 bits). In this + -- case we would need to use Index_Type'Base for intermediate values. + + if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then + return Count_Type'Base (L) - Count_Type'Base (F) + 1; + else + return Count_Type (L - F + 1); + end if; + end Length; + + ---------- + -- Move -- + ---------- + + procedure Move + (Target : in out Vector; + Source : in out Vector) + is + begin + if Target'Address = Source'Address then + return; + end if; + + if Target.Capacity < Source.Length then + raise Capacity_Error -- ??? + with "Target capacity is less than Source length"; + end if; + + if Target.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (Target is busy)"; + end if; + + if Source.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (Source is busy)"; + end if; + + -- Clear Target now, in case element assignment fails. + Target.Last := No_Index; + + Target.Elements (1 .. Source.Length) := + Source.Elements (1 .. Source.Length); + + Target.Last := Source.Last; + Source.Last := No_Index; + end Move; + + ---------- + -- Next -- + ---------- + + function Next (Position : Cursor) return Cursor is + begin + if Position.Container = null then + return No_Element; + end if; + + if Position.Index < Position.Container.Last then + return (Position.Container, Position.Index + 1); + end if; + + return No_Element; + end Next; + + ---------- + -- Next -- + ---------- + + procedure Next (Position : in out Cursor) is + begin + if Position.Container = null then + return; + end if; + + if Position.Index < Position.Container.Last then + Position.Index := Position.Index + 1; + else + Position := No_Element; + end if; + end Next; + + ------------- + -- Prepend -- + ------------- + + procedure Prepend (Container : in out Vector; New_Item : Vector) is + begin + Insert (Container, Index_Type'First, New_Item); + end Prepend; + + procedure Prepend + (Container : in out Vector; + New_Item : Element_Type; + Count : Count_Type := 1) + is + begin + Insert (Container, + Index_Type'First, + New_Item, + Count); + end Prepend; + + -------------- + -- Previous -- + -------------- + + procedure Previous (Position : in out Cursor) is + begin + if Position.Container = null then + return; + end if; + + if Position.Index > Index_Type'First then + Position.Index := Position.Index - 1; + else + Position := No_Element; + end if; + end Previous; + + function Previous (Position : Cursor) return Cursor is + begin + if Position.Container = null then + return No_Element; + end if; + + if Position.Index > Index_Type'First then + return (Position.Container, Position.Index - 1); + end if; + + return No_Element; + end Previous; + + ------------------- + -- Query_Element -- + ------------------- + + procedure Query_Element + (Container : Vector; + Index : Index_Type; + Process : not null access procedure (Element : Element_Type)) + is + V : Vector renames Container'Unrestricted_Access.all; + B : Natural renames V.Busy; + L : Natural renames V.Lock; + + begin + if Index > Container.Last then + raise Constraint_Error with "Index is out of range"; + end if; + + B := B + 1; + L := L + 1; + + begin + Process (V.Elements (To_Array_Index (Index))); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end Query_Element; + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)) + is + begin + if Position.Container = null then + raise Constraint_Error with "Position cursor has no element"; + end if; + + Query_Element (Position.Container.all, Position.Index, Process); + end Query_Element; + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Vector) + is + Length : Count_Type'Base; + Last : Index_Type'Base := No_Index; + + begin + Clear (Container); + + Count_Type'Base'Read (Stream, Length); + + Reserve_Capacity (Container, Capacity => Length); + + for Idx in Count_Type range 1 .. Length loop + Last := Last + 1; + Element_Type'Read (Stream, Container.Elements (Idx)); + Container.Last := Last; + end loop; + end Read; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Position : out Cursor) + is + begin + raise Program_Error with "attempt to stream vector cursor"; + end Read; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Container : in out Vector; + Index : Index_Type; + New_Item : Element_Type) + is + begin + if Index > Container.Last then + raise Constraint_Error with "Index is out of range"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (vector is locked)"; + end if; + + Container.Elements (To_Array_Index (Index)) := New_Item; + end Replace_Element; + + procedure Replace_Element + (Container : in out Vector; + Position : Cursor; + New_Item : Element_Type) + is + begin + if Position.Container = null then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with "Position cursor denotes wrong container"; + end if; + + if Position.Index > Container.Last then + raise Constraint_Error with "Position cursor is out of range"; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (vector is locked)"; + end if; + + Container.Elements (To_Array_Index (Position.Index)) := New_Item; + end Replace_Element; + + ---------------------- + -- Reserve_Capacity -- + ---------------------- + + procedure Reserve_Capacity + (Container : in out Vector; + Capacity : Count_Type) + is + begin + if Capacity > Container.Capacity then + raise Constraint_Error with "Capacity is out of range"; + end if; + end Reserve_Capacity; + + ---------------------- + -- Reverse_Elements -- + ---------------------- + + procedure Reverse_Elements (Container : in out Vector) is + E : Elements_Array renames Container.Elements; + Idx, Jdx : Count_Type; + + begin + if Container.Length <= 1 then + return; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (vector is locked)"; + end if; + + Idx := 1; + Jdx := Container.Length; + while Idx < Jdx loop + declare + EI : constant Element_Type := E (Idx); + + begin + E (Idx) := E (Jdx); + E (Jdx) := EI; + end; + + Idx := Idx + 1; + Jdx := Jdx - 1; + end loop; + end Reverse_Elements; + + ------------------ + -- Reverse_Find -- + ------------------ + + function Reverse_Find + (Container : Vector; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor + is + Last : Index_Type'Base; + + begin + if Position.Container /= null + and then Position.Container /= Container'Unrestricted_Access + then + raise Program_Error with "Position cursor denotes wrong container"; + end if; + + Last := + (if Position.Container = null or else Position.Index > Container.Last + then Container.Last + else Position.Index); + + for Indx in reverse Index_Type'First .. Last loop + if Container.Elements (To_Array_Index (Indx)) = Item then + return (Container'Unrestricted_Access, Indx); + end if; + end loop; + + return No_Element; + end Reverse_Find; + + ------------------------ + -- Reverse_Find_Index -- + ------------------------ + + function Reverse_Find_Index + (Container : Vector; + Item : Element_Type; + Index : Index_Type := Index_Type'Last) return Extended_Index + is + Last : constant Index_Type'Base := + Index_Type'Min (Container.Last, Index); + + begin + for Indx in reverse Index_Type'First .. Last loop + if Container.Elements (To_Array_Index (Indx)) = Item then + return Indx; + end if; + end loop; + + return No_Index; + end Reverse_Find_Index; + + --------------------- + -- Reverse_Iterate -- + --------------------- + + procedure Reverse_Iterate + (Container : Vector; + Process : not null access procedure (Position : Cursor)) + is + V : Vector renames Container'Unrestricted_Access.all; + B : Natural renames V.Busy; + + begin + B := B + 1; + + begin + for Indx in reverse Index_Type'First .. Container.Last loop + Process (Cursor'(Container'Unrestricted_Access, Indx)); + end loop; + exception + when others => + B := B - 1; + raise; + end; + + B := B - 1; + end Reverse_Iterate; + + ---------------- + -- Set_Length -- + ---------------- + + procedure Set_Length (Container : in out Vector; Length : Count_Type) is + Count : constant Count_Type'Base := Container.Length - Length; + + begin + -- Set_Length allows the user to set the length explicitly, instead of + -- implicitly as a side-effect of deletion or insertion. If the + -- requested length is less then the current length, this is equivalent + -- to deleting items from the back end of the vector. If the requested + -- length is greater than the current length, then this is equivalent to + -- inserting "space" (nonce items) at the end. + + if Count >= 0 then + Container.Delete_Last (Count); + + elsif Container.Last >= Index_Type'Last then + raise Constraint_Error with "vector is already at its maximum length"; + + else + Container.Insert_Space (Container.Last + 1, -Count); + end if; + end Set_Length; + + ---------- + -- Swap -- + ---------- + + procedure Swap (Container : in out Vector; I, J : Index_Type) is + E : Elements_Array renames Container.Elements; + + begin + if I > Container.Last then + raise Constraint_Error with "I index is out of range"; + end if; + + if J > Container.Last then + raise Constraint_Error with "J index is out of range"; + end if; + + if I = J then + return; + end if; + + if Container.Lock > 0 then + raise Program_Error with + "attempt to tamper with elements (vector is locked)"; + end if; + + declare + EI_Copy : constant Element_Type := E (To_Array_Index (I)); + begin + E (To_Array_Index (I)) := E (To_Array_Index (J)); + E (To_Array_Index (J)) := EI_Copy; + end; + end Swap; + + procedure Swap (Container : in out Vector; I, J : Cursor) is + begin + if I.Container = null then + raise Constraint_Error with "I cursor has no element"; + end if; + + if J.Container = null then + raise Constraint_Error with "J cursor has no element"; + end if; + + if I.Container /= Container'Unrestricted_Access then + raise Program_Error with "I cursor denotes wrong container"; + end if; + + if J.Container /= Container'Unrestricted_Access then + raise Program_Error with "J cursor denotes wrong container"; + end if; + + Swap (Container, I.Index, J.Index); + end Swap; + + -------------------- + -- To_Array_Index -- + -------------------- + + function To_Array_Index (Index : Index_Type'Base) return Count_Type'Base is + Offset : Count_Type'Base; + + begin + -- We know that + -- Index >= Index_Type'First + -- hence we also know that + -- Index - Index_Type'First >= 0 + -- + -- The issue is that even though 0 is guaranteed to be a value + -- in the type Index_Type'Base, there's no guarantee that the + -- difference is a value in that type. To prevent overflow we + -- use the wider of Count_Type'Base and Index_Type'Base to + -- perform intermediate calculations. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + Offset := Count_Type'Base (Index - Index_Type'First); + + else + Offset := Count_Type'Base (Index) - + Count_Type'Base (Index_Type'First); + end if; + + -- The array index subtype for all container element arrays + -- always starts with 1. + + return 1 + Offset; + end To_Array_Index; + + --------------- + -- To_Cursor -- + --------------- + + function To_Cursor + (Container : Vector; + Index : Extended_Index) return Cursor + is + begin + if Index not in Index_Type'First .. Container.Last then + return No_Element; + end if; + + return Cursor'(Container'Unrestricted_Access, Index); + end To_Cursor; + + -------------- + -- To_Index -- + -------------- + + function To_Index (Position : Cursor) return Extended_Index is + begin + if Position.Container = null then + return No_Index; + end if; + + if Position.Index <= Position.Container.Last then + return Position.Index; + end if; + + return No_Index; + end To_Index; + + --------------- + -- To_Vector -- + --------------- + + function To_Vector (Length : Count_Type) return Vector is + Index : Count_Type'Base; + Last : Index_Type'Base; + + begin + if Length = 0 then + return Empty_Vector; + end if; + + -- We create a vector object with a capacity that matches the specified + -- Length, but we do not allow the vector capacity (the length of the + -- internal array) to exceed the number of values in Index_Type'Range + -- (otherwise, there would be no way to refer to those components via an + -- index). We must therefore check whether the specified Length would + -- create a Last index value greater than Index_Type'Last. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + -- We perform a two-part test. First we determine whether the + -- computed Last value lies in the base range of the type, and then + -- determine whether it lies in the range of the index (sub)type. + + -- Last must satisfy this relation: + -- First + Length - 1 <= Last + -- We regroup terms: + -- First - 1 <= Last - Length + -- Which can rewrite as: + -- No_Index <= Last - Length + + if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then + raise Constraint_Error with "Length is out of range"; + end if; + + -- We now know that the computed value of Last is within the base + -- range of the type, so it is safe to compute its value: + + Last := No_Index + Index_Type'Base (Length); + + -- Finally we test whether the value is within the range of the + -- generic actual index subtype: + + if Last > Index_Type'Last then + raise Constraint_Error with "Length is out of range"; + end if; + + elsif Index_Type'First <= 0 then + -- Here we can compute Last directly, in the normal way. We know that + -- No_Index is less than 0, so there is no danger of overflow when + -- adding the (positive) value of Length. + + Index := Count_Type'Base (No_Index) + Length; -- Last + + if Index > Count_Type'Base (Index_Type'Last) then + raise Constraint_Error with "Length is out of range"; + end if; + + -- We know that the computed value (having type Count_Type) of Last + -- is within the range of the generic actual index subtype, so it is + -- safe to convert to Index_Type: + + Last := Index_Type'Base (Index); + + else + -- Here Index_Type'First (and Index_Type'Last) is positive, so we + -- must test the length indirectly (by working backwards from the + -- largest possible value of Last), in order to prevent overflow. + + Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index + + if Index < Count_Type'Base (No_Index) then + raise Constraint_Error with "Length is out of range"; + end if; + + -- We have determined that the value of Length would not create a + -- Last index value outside of the range of Index_Type, so we can now + -- safely compute its value. + + Last := Index_Type'Base (Count_Type'Base (No_Index) + Length); + end if; + + return V : Vector (Capacity => Length) do + V.Last := Last; + end return; + end To_Vector; + + function To_Vector + (New_Item : Element_Type; + Length : Count_Type) return Vector + is + Index : Count_Type'Base; + Last : Index_Type'Base; + + begin + if Length = 0 then + return Empty_Vector; + end if; + + -- We create a vector object with a capacity that matches the specified + -- Length, but we do not allow the vector capacity (the length of the + -- internal array) to exceed the number of values in Index_Type'Range + -- (otherwise, there would be no way to refer to those components via an + -- index). We must therefore check whether the specified Length would + -- create a Last index value greater than Index_Type'Last. + + if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then + -- We perform a two-part test. First we determine whether the + -- computed Last value lies in the base range of the type, and then + -- determine whether it lies in the range of the index (sub)type. + + -- Last must satisfy this relation: + -- First + Length - 1 <= Last + -- We regroup terms: + -- First - 1 <= Last - Length + -- Which can rewrite as: + -- No_Index <= Last - Length + + if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then + raise Constraint_Error with "Length is out of range"; + end if; + + -- We now know that the computed value of Last is within the base + -- range of the type, so it is safe to compute its value: + + Last := No_Index + Index_Type'Base (Length); + + -- Finally we test whether the value is within the range of the + -- generic actual index subtype: + + if Last > Index_Type'Last then + raise Constraint_Error with "Length is out of range"; + end if; + + elsif Index_Type'First <= 0 then + -- Here we can compute Last directly, in the normal way. We know that + -- No_Index is less than 0, so there is no danger of overflow when + -- adding the (positive) value of Length. + + Index := Count_Type'Base (No_Index) + Length; -- same value as V.Last + + if Index > Count_Type'Base (Index_Type'Last) then + raise Constraint_Error with "Length is out of range"; + end if; + + -- We know that the computed value (having type Count_Type) of Last + -- is within the range of the generic actual index subtype, so it is + -- safe to convert to Index_Type: + + Last := Index_Type'Base (Index); + + else + -- Here Index_Type'First (and Index_Type'Last) is positive, so we + -- must test the length indirectly (by working backwards from the + -- largest possible value of Last), in order to prevent overflow. + + Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index + + if Index < Count_Type'Base (No_Index) then + raise Constraint_Error with "Length is out of range"; + end if; + + -- We have determined that the value of Length would not create a + -- Last index value outside of the range of Index_Type, so we can now + -- safely compute its value. + + Last := Index_Type'Base (Count_Type'Base (No_Index) + Length); + end if; + + return V : Vector (Capacity => Length) do + V.Elements := (others => New_Item); + V.Last := Last; + end return; + end To_Vector; + + -------------------- + -- Update_Element -- + -------------------- + + procedure Update_Element + (Container : in out Vector; + Index : Index_Type; + Process : not null access procedure (Element : in out Element_Type)) + is + B : Natural renames Container.Busy; + L : Natural renames Container.Lock; + + begin + if Index > Container.Last then + raise Constraint_Error with "Index is out of range"; + end if; + + B := B + 1; + L := L + 1; + + begin + Process (Container.Elements (To_Array_Index (Index))); + exception + when others => + L := L - 1; + B := B - 1; + raise; + end; + + L := L - 1; + B := B - 1; + end Update_Element; + + procedure Update_Element + (Container : in out Vector; + Position : Cursor; + Process : not null access procedure (Element : in out Element_Type)) + is + begin + if Position.Container = null then + raise Constraint_Error with "Position cursor has no element"; + end if; + + if Position.Container /= Container'Unrestricted_Access then + raise Program_Error with "Position cursor denotes wrong container"; + end if; + + Update_Element (Container, Position.Index, Process); + end Update_Element; + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Vector) + is + N : Count_Type; + + begin + N := Container.Length; + Count_Type'Base'Write (Stream, N); + + for J in 1 .. N loop + Element_Type'Write (Stream, Container.Elements (J)); + end loop; + end Write; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Position : Cursor) + is + begin + raise Program_Error with "attempt to stream vector cursor"; + end Write; + + end Ada.Containers.Bounded_Vectors; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cobove.ads gcc-4.6.0/gcc/ada/a-cobove.ads *** gcc-4.5.2/gcc/ada/a-cobove.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-cobove.ads Mon Oct 25 13:50:29 2010 *************** *** 0 **** --- 1,369 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- A D A . C O N T A I N E R S . B O U N D E D _ V E C T O R S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + private with Ada.Streams; + + generic + type Index_Type is range <>; + type Element_Type is private; + + with function "=" (Left, Right : Element_Type) return Boolean is <>; + + package Ada.Containers.Bounded_Vectors is + pragma Pure; + pragma Remote_Types; + + subtype Extended_Index is Index_Type'Base + range Index_Type'First - 1 .. + Index_Type'Min (Index_Type'Base'Last - 1, Index_Type'Last) + 1; + + No_Index : constant Extended_Index := Extended_Index'First; + + type Vector (Capacity : Count_Type) is tagged private; + pragma Preelaborable_Initialization (Vector); + + type Cursor is private; + pragma Preelaborable_Initialization (Cursor); + + Empty_Vector : constant Vector; + + No_Element : constant Cursor; + + overriding function "=" (Left, Right : Vector) return Boolean; + + function To_Vector (Length : Count_Type) return Vector; + + function To_Vector + (New_Item : Element_Type; + Length : Count_Type) return Vector; + + function "&" (Left, Right : Vector) return Vector; + + function "&" (Left : Vector; Right : Element_Type) return Vector; + + function "&" (Left : Element_Type; Right : Vector) return Vector; + + function "&" (Left, Right : Element_Type) return Vector; + + function Capacity (Container : Vector) return Count_Type; + + procedure Reserve_Capacity + (Container : in out Vector; + Capacity : Count_Type); + + function Length (Container : Vector) return Count_Type; + + procedure Set_Length + (Container : in out Vector; + Length : Count_Type); + + function Is_Empty (Container : Vector) return Boolean; + + procedure Clear (Container : in out Vector); + + function To_Cursor + (Container : Vector; + Index : Extended_Index) return Cursor; + + function To_Index (Position : Cursor) return Extended_Index; + + function Element + (Container : Vector; + Index : Index_Type) return Element_Type; + + function Element (Position : Cursor) return Element_Type; + + procedure Replace_Element + (Container : in out Vector; + Index : Index_Type; + New_Item : Element_Type); + + procedure Replace_Element + (Container : in out Vector; + Position : Cursor; + New_Item : Element_Type); + + procedure Query_Element + (Container : Vector; + Index : Index_Type; + Process : not null access procedure (Element : Element_Type)); + + procedure Query_Element + (Position : Cursor; + Process : not null access procedure (Element : Element_Type)); + + procedure Update_Element + (Container : in out Vector; + Index : Index_Type; + Process : not null access procedure (Element : in out Element_Type)); + + procedure Update_Element + (Container : in out Vector; + Position : Cursor; + Process : not null access procedure (Element : in out Element_Type)); + + procedure Assign (Target : in out Vector; Source : Vector); + + function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector; + + procedure Move (Target : in out Vector; Source : in out Vector); + + procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Vector); + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector); + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector; + Position : out Cursor); + + procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Element_Type; + Position : out Cursor; + Count : Count_Type := 1); + + procedure Insert + (Container : in out Vector; + Before : Extended_Index; + Count : Count_Type := 1); + + procedure Insert + (Container : in out Vector; + Before : Cursor; + Position : out Cursor; + Count : Count_Type := 1); + + procedure Prepend + (Container : in out Vector; + New_Item : Vector); + + procedure Prepend + (Container : in out Vector; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Append + (Container : in out Vector; + New_Item : Vector); + + procedure Append + (Container : in out Vector; + New_Item : Element_Type; + Count : Count_Type := 1); + + procedure Insert_Space + (Container : in out Vector; + Before : Extended_Index; + Count : Count_Type := 1); + + procedure Insert_Space + (Container : in out Vector; + Before : Cursor; + Position : out Cursor; + Count : Count_Type := 1); + + procedure Delete + (Container : in out Vector; + Index : Extended_Index; + Count : Count_Type := 1); + + procedure Delete + (Container : in out Vector; + Position : in out Cursor; + Count : Count_Type := 1); + + procedure Delete_First + (Container : in out Vector; + Count : Count_Type := 1); + + procedure Delete_Last + (Container : in out Vector; + Count : Count_Type := 1); + + procedure Reverse_Elements (Container : in out Vector); + + procedure Swap (Container : in out Vector; I, J : Index_Type); + + procedure Swap (Container : in out Vector; I, J : Cursor); + + function First_Index (Container : Vector) return Index_Type; + + function First (Container : Vector) return Cursor; + + function First_Element (Container : Vector) return Element_Type; + + function Last_Index (Container : Vector) return Extended_Index; + + function Last (Container : Vector) return Cursor; + + function Last_Element (Container : Vector) return Element_Type; + + function Next (Position : Cursor) return Cursor; + + procedure Next (Position : in out Cursor); + + function Previous (Position : Cursor) return Cursor; + + procedure Previous (Position : in out Cursor); + + function Find_Index + (Container : Vector; + Item : Element_Type; + Index : Index_Type := Index_Type'First) return Extended_Index; + + function Find + (Container : Vector; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor; + + function Reverse_Find_Index + (Container : Vector; + Item : Element_Type; + Index : Index_Type := Index_Type'Last) return Extended_Index; + + function Reverse_Find + (Container : Vector; + Item : Element_Type; + Position : Cursor := No_Element) return Cursor; + + function Contains + (Container : Vector; + Item : Element_Type) return Boolean; + + function Has_Element (Position : Cursor) return Boolean; + + procedure Iterate + (Container : Vector; + Process : not null access procedure (Position : Cursor)); + + procedure Reverse_Iterate + (Container : Vector; + Process : not null access procedure (Position : Cursor)); + + generic + with function "<" (Left, Right : Element_Type) return Boolean is <>; + package Generic_Sorting is + + function Is_Sorted (Container : Vector) return Boolean; + + procedure Sort (Container : in out Vector); + + procedure Merge (Target : in out Vector; Source : in out Vector); + + end Generic_Sorting; + + private + + pragma Inline (First_Index); + pragma Inline (Last_Index); + pragma Inline (Element); + pragma Inline (First_Element); + pragma Inline (Last_Element); + pragma Inline (Query_Element); + pragma Inline (Update_Element); + pragma Inline (Replace_Element); + pragma Inline (Is_Empty); + pragma Inline (Contains); + pragma Inline (Next); + pragma Inline (Previous); + + type Elements_Array is array (Count_Type range <>) of Element_Type; + function "=" (L, R : Elements_Array) return Boolean is abstract; + + type Vector (Capacity : Count_Type) is tagged record + Elements : Elements_Array (1 .. Capacity); + Last : Extended_Index := No_Index; + Busy : Natural := 0; + Lock : Natural := 0; + end record; + + use Ada.Streams; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Container : Vector); + + for Vector'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Container : out Vector); + + for Vector'Read use Read; + + type Vector_Access is access all Vector; + for Vector_Access'Storage_Size use 0; + + type Cursor is record + Container : Vector_Access; + Index : Index_Type := Index_Type'First; + end record; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Position : Cursor); + + for Cursor'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Position : out Cursor); + + for Cursor'Read use Read; + + Empty_Vector : constant Vector := (Capacity => 0, others => <>); + + No_Element : constant Cursor := Cursor'(null, Index_Type'First); + + end Ada.Containers.Bounded_Vectors; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cohama.adb gcc-4.6.0/gcc/ada/a-cohama.adb *** gcc-4.5.2/gcc/ada/a-cohama.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-cohama.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Hashed_Maps *** 192,198 **** if Container.HT.Busy > 0 then raise Program_Error with ! "Delete attempted to tamper with elements (map is busy)"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); --- 192,198 ---- if Container.HT.Busy > 0 then raise Program_Error with ! "Delete attempted to tamper with cursors (map is busy)"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); *************** package body Ada.Containers.Hashed_Maps *** 413,419 **** if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "Include attempted to tamper with cursors (map is locked)"; end if; Position.Node.Key := Key; --- 413,419 ---- if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "Include attempted to tamper with elements (map is locked)"; end if; Position.Node.Key := Key; *************** package body Ada.Containers.Hashed_Maps *** 755,761 **** if Container.HT.Lock > 0 then raise Program_Error with ! "Replace attempted to tamper with cursors (map is locked)"; end if; Node.Key := Key; --- 755,761 ---- if Container.HT.Lock > 0 then raise Program_Error with ! "Replace attempted to tamper with elements (map is locked)"; end if; Node.Key := Key; *************** package body Ada.Containers.Hashed_Maps *** 784,790 **** if Position.Container.HT.Lock > 0 then raise Program_Error with ! "Replace_Element attempted to tamper with cursors (map is locked)"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); --- 784,790 ---- if Position.Container.HT.Lock > 0 then raise Program_Error with ! "Replace_Element attempted to tamper with elements (map is locked)"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); *************** package body Ada.Containers.Hashed_Maps *** 908,914 **** return False; end if; ! if X = X.Next then -- to prevent endless loop return False; end if; --- 908,914 ---- return False; end if; ! if X = X.Next then -- to prevent unnecessary looping return False; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/a-cohase.adb gcc-4.6.0/gcc/ada/a-cohase.adb *** gcc-4.5.2/gcc/ada/a-cohase.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-cohase.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Hashed_Sets *** 230,236 **** if Container.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); --- 230,236 ---- if Container.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); *************** package body Ada.Containers.Hashed_Sets *** 263,269 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; if Source.HT.Length < Target.HT.Length then --- 263,269 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; if Source.HT.Length < Target.HT.Length then *************** package body Ada.Containers.Hashed_Sets *** 614,620 **** if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Position.Node.Element := New_Item; --- 614,620 ---- if not Inserted then if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Position.Node.Element := New_Item; *************** package body Ada.Containers.Hashed_Sets *** 713,719 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; Tgt_Node := HT_Ops.First (Target.HT); --- 713,719 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; Tgt_Node := HT_Ops.First (Target.HT); *************** package body Ada.Containers.Hashed_Sets *** 1059,1065 **** if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := New_Item; --- 1059,1065 ---- if Container.HT.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := New_Item; *************** package body Ada.Containers.Hashed_Sets *** 1123,1129 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; declare --- 1123,1129 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; declare *************** package body Ada.Containers.Hashed_Sets *** 1392,1398 **** if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (set is busy)"; end if; declare --- 1392,1398 ---- if Target.HT.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is busy)"; end if; declare diff -Nrcpad gcc-4.5.2/gcc/ada/a-cohata.ads gcc-4.6.0/gcc/ada/a-cohata.ads *** gcc-4.5.2/gcc/ada/a-cohata.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-cohata.ads Tue Oct 26 10:42:02 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package Ada.Containers.Hash_Tables is *** 52,55 **** --- 52,74 ---- end record; end Generic_Hash_Table_Types; + generic + type Node_Type is private; + package Generic_Bounded_Hash_Table_Types is + type Nodes_Type is array (Count_Type range <>) of Node_Type; + type Buckets_Type is array (Hash_Type range <>) of Count_Type; + + type Hash_Table_Type + (Capacity : Count_Type; + Modulus : Hash_Type) is + tagged record + Length : Count_Type := 0; + Busy : Natural := 0; + Lock : Natural := 0; + Free : Count_Type'Base := -1; + Nodes : Nodes_Type (1 .. Capacity); + Buckets : Buckets_Type (1 .. Modulus) := (others => 0); + end record; + end Generic_Bounded_Hash_Table_Types; + end Ada.Containers.Hash_Tables; diff -Nrcpad gcc-4.5.2/gcc/ada/a-coinve.adb gcc-4.6.0/gcc/ada/a-coinve.adb *** gcc-4.5.2/gcc/ada/a-coinve.adb Mon Nov 30 16:08:37 2009 --- gcc-4.6.0/gcc/ada/a-coinve.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** with System; use type System.Address; *** 33,41 **** package body Ada.Containers.Indefinite_Vectors is - type Int is range System.Min_Int .. System.Max_Int; - type UInt is mod System.Max_Binary_Modulus; - procedure Free is new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access); --- 33,38 ---- *************** package body Ada.Containers.Indefinite_V *** 47,56 **** --------- function "&" (Left, Right : Vector) return Vector is ! LN : constant Count_Type := Length (Left); ! RN : constant Count_Type := Length (Right); begin if LN = 0 then if RN = 0 then return Empty_Vector; --- 44,65 ---- --------- function "&" (Left, Right : Vector) return Vector is ! LN : constant Count_Type := Length (Left); ! RN : constant Count_Type := Length (Right); ! N : Count_Type'Base; -- length of result ! J : Count_Type'Base; -- for computing intermediate values ! Last : Index_Type'Base; -- Last index of result begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the vector parameters. We could decide to make it larger, but we + -- have no basis for knowing how much larger, so we just allocate the + -- minimum amount of storage. + + -- Here we handle the easy cases first, when one of the vector + -- parameters is empty. (We say "easy" because there's nothing to + -- compute, that can potentially overflow.) + if LN = 0 then if RN = 0 then return Empty_Vector; *************** package body Ada.Containers.Indefinite_V *** 64,69 **** --- 73,83 ---- new Elements_Type (Right.Last); begin + -- Elements of an indefinite vector are allocated, so we cannot + -- use simple slice assignment to give a value to our result. + -- Hence we must walk the array of the Right vector, and copy + -- each source element individually. + for I in Elements.EA'Range loop begin if RE (I) /= null then *************** package body Ada.Containers.Indefinite_V *** 95,100 **** --- 109,119 ---- new Elements_Type (Left.Last); begin + -- Elements of an indefinite vector are allocated, so we cannot + -- use simple slice assignment to give a value to our result. + -- Hence we must walk the array of the Left vector, and copy + -- each source element individually. + for I in Elements.EA'Range loop begin if LE (I) /= null then *************** package body Ada.Containers.Indefinite_V *** 116,198 **** end; end if; ! declare ! N : constant Int'Base := Int (LN) + Int (RN); ! Last_As_Int : Int'Base; ! begin ! if Int (No_Index) > Int'Last - N then raise Constraint_Error with "new length is out of range"; end if; ! Last_As_Int := Int (No_Index) + N; ! if Last_As_Int > Int (Index_Type'Last) then raise Constraint_Error with "new length is out of range"; end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : Elements_Access := new Elements_Type (Last); ! I : Index_Type'Base := No_Index; ! begin ! for LI in LE'Range loop ! I := I + 1; ! begin ! if LE (LI) /= null then ! Elements.EA (I) := new Element_Type'(LE (LI).all); ! end if; ! exception ! when others => ! for J in Index_Type'First .. I - 1 loop ! Free (Elements.EA (J)); ! end loop; ! Free (Elements); ! raise; ! end; ! end loop; ! for RI in RE'Range loop ! I := I + 1; ! begin ! if RE (RI) /= null then ! Elements.EA (I) := new Element_Type'(RE (RI).all); ! end if; ! exception ! when others => ! for J in Index_Type'First .. I - 1 loop ! Free (Elements.EA (J)); ! end loop; ! Free (Elements); ! raise; ! end; ! end loop; ! return (Controlled with Elements, Last, 0, 0); ! end; end; end "&"; function "&" (Left : Vector; Right : Element_Type) return Vector is - LN : constant Count_Type := Length (Left); - begin ! if LN = 0 then declare Elements : Elements_Access := new Elements_Type (Index_Type'First); --- 135,296 ---- end; end if; ! -- Neither of the vector parameters is empty, so we must compute the ! -- length of the result vector and its last index. (This is the harder ! -- case, because our computations must avoid overflow.) ! -- There are two constraints we need to satisfy. The first constraint is ! -- that a container cannot have more than Count_Type'Last elements, so ! -- we must check the sum of the combined lengths. Note that we cannot ! -- simply add the lengths, because of the possibility of overflow. ! ! if LN > Count_Type'Last - RN then ! raise Constraint_Error with "new length is out of range"; ! end if; ! ! -- It is now safe compute the length of the new vector. ! ! N := LN + RN; ! ! -- The second constraint is that the new Last index value cannot ! -- exceed Index_Type'Last. We use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate values. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! ! if Index_Type'Base'Last - Index_Type'Base (N) < No_Index then raise Constraint_Error with "new length is out of range"; end if; ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! Last := No_Index + Index_Type'Base (N); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then raise Constraint_Error with "new length is out of range"; end if; ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of length. ! J := Count_Type'Base (No_Index) + N; -- Last ! if J > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! Last := Index_Type'Base (J); ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! J := Count_Type'Base (Index_Type'Last) - N; -- No_Index ! if J < Count_Type'Base (No_Index) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! -- We have determined that the result length would not create a Last ! -- index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! Last := Index_Type'Base (Count_Type'Base (No_Index) + N); ! end if; ! declare ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : Elements_Access := new Elements_Type (Last); ! ! I : Index_Type'Base := No_Index; ! ! begin ! -- Elements of an indefinite vector are allocated, so we cannot use ! -- simple slice assignment to give a value to our result. Hence we ! -- must walk the array of each vector parameter, and copy each source ! -- element individually. ! ! for LI in LE'Range loop ! I := I + 1; ! ! begin ! if LE (LI) /= null then ! Elements.EA (I) := new Element_Type'(LE (LI).all); ! end if; ! ! exception ! when others => ! for J in Index_Type'First .. I - 1 loop ! Free (Elements.EA (J)); ! end loop; ! ! Free (Elements); ! raise; ! end; ! end loop; ! ! for RI in RE'Range loop ! I := I + 1; ! ! begin ! if RE (RI) /= null then ! Elements.EA (I) := new Element_Type'(RE (RI).all); ! end if; ! ! exception ! when others => ! for J in Index_Type'First .. I - 1 loop ! Free (Elements.EA (J)); ! end loop; ! ! Free (Elements); ! raise; ! end; ! end loop; ! ! return (Controlled with Elements, Last, 0, 0); end; end "&"; function "&" (Left : Vector; Right : Element_Type) return Vector is begin ! -- We decide that the capacity of the result is the sum of the lengths ! -- of the parameters. We could decide to make it larger, but we have no ! -- basis for knowing how much larger, so we just allocate the minimum ! -- amount of storage. ! ! -- Here we handle the easy case first, when the vector parameter (Left) ! -- is empty. ! ! if Left.Is_Empty then declare Elements : Elements_Access := new Elements_Type (Index_Type'First); *************** package body Ada.Containers.Indefinite_V *** 209,278 **** end; end if; ! declare ! Last_As_Int : Int'Base; ! ! begin ! if Int (Index_Type'First) > Int'Last - Int (LN) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! ! Last_As_Int := Int (Index_Type'First) + Int (LN); ! ! if Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! Elements : Elements_Access := ! new Elements_Type (Last); ! begin ! for I in LE'Range loop ! begin ! if LE (I) /= null then ! Elements.EA (I) := new Element_Type'(LE (I).all); ! end if; ! exception ! when others => ! for J in Index_Type'First .. I - 1 loop ! Free (Elements.EA (J)); ! end loop; ! Free (Elements); ! raise; ! end; ! end loop; begin ! Elements.EA (Last) := new Element_Type'(Right); exception when others => ! for J in Index_Type'First .. Last - 1 loop Free (Elements.EA (J)); end loop; Free (Elements); raise; end; ! return (Controlled with Elements, Last, 0, 0); end; end; end "&"; function "&" (Left : Element_Type; Right : Vector) return Vector is - RN : constant Count_Type := Length (Right); - begin ! if RN = 0 then declare Elements : Elements_Access := new Elements_Type (Index_Type'First); --- 307,381 ---- end; end if; ! -- The vector parameter is not empty, so we must compute the length of ! -- the result vector and its last index, but in such a way that overflow ! -- is avoided. We must satisfy two constraints: the new length cannot ! -- exceed Count_Type'Last, and the new Last index cannot exceed ! -- Index_Type'Last. ! if Left.Length = Count_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! if Left.Last >= Index_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Left.Last + 1; ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! Elements : Elements_Access := ! new Elements_Type (Last); + begin + for I in LE'Range loop begin ! if LE (I) /= null then ! Elements.EA (I) := new Element_Type'(LE (I).all); ! end if; exception when others => ! for J in Index_Type'First .. I - 1 loop Free (Elements.EA (J)); end loop; Free (Elements); raise; end; + end loop; ! begin ! Elements.EA (Last) := new Element_Type'(Right); ! ! exception ! when others => ! for J in Index_Type'First .. Last - 1 loop ! Free (Elements.EA (J)); ! end loop; ! ! Free (Elements); ! raise; end; + + return (Controlled with Elements, Last, 0, 0); end; end "&"; function "&" (Left : Element_Type; Right : Vector) return Vector is begin ! -- We decide that the capacity of the result is the sum of the lengths ! -- of the parameters. We could decide to make it larger, but we have no ! -- basis for knowing how much larger, so we just allocate the minimum ! -- amount of storage. ! ! -- Here we handle the easy case first, when the vector parameter (Right) ! -- is empty. ! ! if Right.Is_Empty then declare Elements : Elements_Access := new Elements_Type (Index_Type'First); *************** package body Ada.Containers.Indefinite_V *** 289,354 **** end; end if; ! declare ! Last_As_Int : Int'Base; ! ! begin ! if Int (Index_Type'First) > Int'Last - Int (RN) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! Last_As_Int := Int (Index_Type'First) + Int (RN); ! if Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : Elements_Access := ! new Elements_Type (Last); ! I : Index_Type'Base := Index_Type'First; begin begin ! Elements.EA (I) := new Element_Type'(Left); exception when others => Free (Elements); raise; end; ! for RI in RE'Range loop ! I := I + 1; ! ! begin ! if RE (RI) /= null then ! Elements.EA (I) := new Element_Type'(RE (RI).all); ! end if; ! ! exception ! when others => ! for J in Index_Type'First .. I - 1 loop ! Free (Elements.EA (J)); ! end loop; ! ! Free (Elements); ! raise; ! end; ! end loop; ! ! return (Controlled with Elements, Last, 0, 0); ! end; end; end "&"; function "&" (Left, Right : Element_Type) return Vector is begin if Index_Type'First >= Index_Type'Last then raise Constraint_Error with "new length is out of range"; end if; --- 392,467 ---- end; end if; ! -- The vector parameter is not empty, so we must compute the length of ! -- the result vector and its last index, but in such a way that overflow ! -- is avoided. We must satisfy two constraints: the new length cannot ! -- exceed Count_Type'Last, and the new Last index cannot exceed ! -- Index_Type'Last. ! if Right.Length = Count_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! if Right.Last >= Index_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Right.Last + 1; ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : Elements_Access := ! new Elements_Type (Last); ! I : Index_Type'Base := Index_Type'First; + begin begin + Elements.EA (I) := new Element_Type'(Left); + exception + when others => + Free (Elements); + raise; + end; + + for RI in RE'Range loop + I := I + 1; + begin ! if RE (RI) /= null then ! Elements.EA (I) := new Element_Type'(RE (RI).all); ! end if; ! exception when others => + for J in Index_Type'First .. I - 1 loop + Free (Elements.EA (J)); + end loop; + Free (Elements); raise; end; + end loop; ! return (Controlled with Elements, Last, 0, 0); end; end "&"; function "&" (Left, Right : Element_Type) return Vector is begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the parameters. We could decide to make it larger, but we have no + -- basis for knowing how much larger, so we just allocate the minimum + -- amount of storage. + + -- We must compute the length of the result vector and its last index, + -- but in such a way that overflow is avoided. We must satisfy two + -- constraints: the new length cannot exceed Count_Type'Last (here, we + -- know that that condition is satisfied), and the new Last index cannot + -- exceed Index_Type'Last. + if Index_Type'First >= Index_Type'Last then raise Constraint_Error with "new length is out of range"; end if; *************** package body Ada.Containers.Indefinite_V *** 506,512 **** begin if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; while Container.Last >= Index_Type'First loop --- 619,625 ---- begin if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; while Container.Last >= Index_Type'First loop *************** package body Ada.Containers.Indefinite_V *** 541,615 **** Index : Extended_Index; Count : Count_Type := 1) is begin if Index < Index_Type'First then raise Constraint_Error with "Index is out of range (too small)"; end if; ! if Index > Container.Last then ! if Index > Container.Last + 1 then raise Constraint_Error with "Index is out of range (too large)"; end if; return; end if; if Count = 0 then return; end if; if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; ! declare ! Index_As_Int : constant Int := Int (Index); ! Old_Last_As_Int : constant Int := Int (Container.Last); ! Count1 : constant Int'Base := Int (Count); ! Count2 : constant Int'Base := Old_Last_As_Int - Index_As_Int + 1; ! N : constant Int'Base := Int'Min (Count1, Count2); ! J_As_Int : constant Int'Base := Index_As_Int + N; ! E : Elements_Array renames Container.Elements.EA; ! begin ! if J_As_Int > Old_Last_As_Int then while Container.Last >= Index loop declare K : constant Index_Type := Container.Last; ! X : Element_Access := E (K); begin ! E (K) := null; Container.Last := K - 1; Free (X); end; end loop; ! else ! declare ! J : constant Index_Type := Index_Type (J_As_Int); ! New_Last_As_Int : constant Int'Base := Old_Last_As_Int - N; ! New_Last : constant Index_Type := ! Index_Type (New_Last_As_Int); begin ! for K in Index .. J - 1 loop ! declare ! X : Element_Access := E (K); ! begin ! E (K) := null; ! Free (X); ! end; ! end loop; ! E (Index .. New_Last) := E (J .. Container.Last); ! Container.Last := New_Last; end; ! end if; end; end Delete; --- 654,830 ---- Index : Extended_Index; Count : Count_Type := 1) is + Old_Last : constant Index_Type'Base := Container.Last; + New_Last : Index_Type'Base; + Count2 : Count_Type'Base; -- count of items from Index to Old_Last + J : Index_Type'Base; -- first index of items that slide down + begin + -- Delete removes items from the vector, the number of which is the + -- minimum of the specified Count and the items (if any) that exist from + -- Index to Container.Last. There are no constraints on the specified + -- value of Count (it can be larger than what's available at this + -- position in the vector, for example), but there are constraints on + -- the allowed values of the Index. + + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying which items + -- should be deleted, so we must manually check. (That the user is + -- allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + if Index < Index_Type'First then raise Constraint_Error with "Index is out of range (too small)"; end if; ! -- We do allow a value greater than Container.Last to be specified as ! -- the Index, but only if it's immediately greater. This allows the ! -- corner case of deleting no items from the back end of the vector to ! -- be treated as a no-op. (It is assumed that specifying an index value ! -- greater than Last + 1 indicates some deeper flaw in the caller's ! -- algorithm, so that case is treated as a proper error.) ! ! if Index > Old_Last then ! if Index > Old_Last + 1 then raise Constraint_Error with "Index is out of range (too large)"; end if; return; end if; + -- Here and elsewhere we treat deleting 0 items from the container as a + -- no-op, even when the container is busy, so we simply return. + if Count = 0 then return; end if; + -- The internal elements array isn't guaranteed to exist unless we have + -- elements, so we handle that case here in order to avoid having to + -- check it later. (Note that an empty vector can never be busy, so + -- there's no semantic harm in returning early.) + + if Container.Is_Empty then + return; + end if; + + -- The tampering bits exist to prevent an item from being deleted (or + -- otherwise harmfully manipulated) while it is being visited. Query, + -- Update, and Iterate increment the busy count on entry, and decrement + -- the count on exit. Delete checks the count to determine whether it is + -- being called while the associated callback procedure is executing. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; ! -- We first calculate what's available for deletion starting at ! -- Index. Here and elsewhere we use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate values. (See function ! -- Length for more information.) ! if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then ! Count2 := Count_Type'Base (Old_Last) - Count_Type'Base (Index) + 1; ! else ! Count2 := Count_Type'Base (Old_Last - Index + 1); ! end if; ! -- If the number of elements requested (Count) for deletion is equal to ! -- (or greater than) the number of elements available (Count2) for ! -- deletion beginning at Index, then everything from Index to ! -- Container.Last is deleted (this is equivalent to Delete_Last). ! ! if Count >= Count2 then ! -- Elements in an indefinite vector are allocated, so we must iterate ! -- over the loop and deallocate elements one-at-a-time. We work from ! -- back to front, deleting the last element during each pass, in ! -- order to gracefully handle deallocation failures. ! ! declare ! EA : Elements_Array renames Container.Elements.EA; ! ! begin while Container.Last >= Index loop declare K : constant Index_Type := Container.Last; ! X : Element_Access := EA (K); begin ! -- We first isolate the element we're deleting, removing it ! -- from the vector before we attempt to deallocate it, in ! -- case the deallocation fails. ! ! EA (K) := null; Container.Last := K - 1; + + -- Container invariants have been restored, so it is now + -- safe to attempt to deallocate the element. + Free (X); end; end loop; + end; ! return; ! end if; ! -- There are some elements that aren't being deleted (the requested ! -- count was less than the available count), so we must slide them down ! -- to Index. We first calculate the index values of the respective array ! -- slices, using the wider of Index_Type'Base and Count_Type'Base as the ! -- type for intermediate calculations. For the elements that slide down, ! -- index value New_Last is the last index value of their new home, and ! -- index value J is the first index of their old home. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! New_Last := Old_Last - Index_Type'Base (Count); ! J := Index + Index_Type'Base (Count); ! ! else ! New_Last := Index_Type'Base (Count_Type'Base (Old_Last) - Count); ! J := Index_Type'Base (Count_Type'Base (Index) + Count); ! end if; ! ! -- The internal elements array isn't guaranteed to exist unless we have ! -- elements, but we have that guarantee here because we know we have ! -- elements to slide. The array index values for each slice have ! -- already been determined, so what remains to be done is to first ! -- deallocate the elements that are being deleted, and then slide down ! -- to Index the elements that aren't being deleted. ! ! declare ! EA : Elements_Array renames Container.Elements.EA; ! ! begin ! -- Before we can slide down the elements that aren't being deleted, ! -- we need to deallocate the elements that are being deleted. ! ! for K in Index .. J - 1 loop ! declare ! X : Element_Access := EA (K); begin ! -- First we remove the element we're about to deallocate from ! -- the vector, in case the deallocation fails, in order to ! -- preserve representation invariants. ! EA (K) := null; ! ! -- The element has been removed from the vector, so it is now ! -- safe to attempt to deallocate it. ! ! Free (X); end; ! end loop; ! ! EA (Index .. New_Last) := EA (J .. Old_Last); ! Container.Last := New_Last; end; end Delete; *************** package body Ada.Containers.Indefinite_V *** 667,698 **** (Container : in out Vector; Count : Count_Type := 1) is - N : constant Count_Type := Length (Container); - begin ! if Count = 0 ! or else N = 0 ! then return; end if; if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; declare E : Elements_Array renames Container.Elements.EA; begin ! for Indx in 1 .. Count_Type'Min (Count, N) loop declare J : constant Index_Type := Container.Last; X : Element_Access := E (J); begin E (J) := null; Container.Last := J - 1; Free (X); end; end loop; --- 882,945 ---- (Container : in out Vector; Count : Count_Type := 1) is begin ! -- It is not permitted to delete items while the container is busy (for ! -- example, we're in the middle of a passive iteration). However, we ! -- always treat deleting 0 items as a no-op, even when we're busy, so we ! -- simply return without checking. ! ! if Count = 0 then ! return; ! end if; ! ! -- We cannot simply subsume the empty case into the loop below (the loop ! -- would iterate 0 times), because we rename the internal array object ! -- (which is allocated), but an empty vector isn't guaranteed to have ! -- actually allocated an array. (Note that an empty vector can never be ! -- busy, so there's no semantic harm in returning early here.) ! ! if Container.Is_Empty then return; end if; + -- The tampering bits exist to prevent an item from being deleted (or + -- otherwise harmfully manipulated) while it is being visited. Query, + -- Update, and Iterate increment the busy count on entry, and decrement + -- the count on exit. Delete_Last checks the count to determine whether + -- it is being called while the associated callback procedure is + -- executing. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; + -- Elements in an indefinite vector are allocated, so we must iterate + -- over the loop and deallocate elements one-at-a-time. We work from + -- back to front, deleting the last element during each pass, in order + -- to gracefully handle deallocation failures. + declare E : Elements_Array renames Container.Elements.EA; begin ! for Indx in 1 .. Count_Type'Min (Count, Container.Length) loop declare J : constant Index_Type := Container.Last; X : Element_Access := E (J); begin + -- Note that we first isolate the element we're deleting, + -- removing it from the vector, before we actually deallocate + -- it, in order to preserve representation invariants even if + -- the deallocation fails. + E (J) := null; Container.Last := J - 1; + + -- Container invariants have been restored, so it is now safe + -- to deallocate the element. + Free (X); end; end loop; *************** package body Ada.Containers.Indefinite_V *** 935,941 **** if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; I := Target.Last; -- original value (before Set_Length) --- 1182,1188 ---- if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; I := Target.Last; -- original value (before Set_Length) *************** package body Ada.Containers.Indefinite_V *** 1011,1017 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; Sort (Container.Elements.EA (Index_Type'First .. Container.Last)); --- 1258,1264 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; Sort (Container.Elements.EA (Index_Type'First .. Container.Last)); *************** package body Ada.Containers.Indefinite_V *** 1042,1063 **** New_Item : Element_Type; Count : Count_Type := 1) is ! N : constant Int := Int (Count); ! First : constant Int := Int (Index_Type'First); ! New_Last_As_Int : Int'Base; ! New_Last : Index_Type; ! New_Length : UInt; ! Max_Length : constant UInt := UInt (Count_Type'Last); ! Dst : Elements_Access; begin if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; if Before > Container.Last and then Before > Container.Last + 1 then --- 1289,1330 ---- New_Item : Element_Type; Count : Count_Type := 1) is ! Old_Length : constant Count_Type := Container.Length; ! Max_Length : Count_Type'Base; -- determined from range of Index_Type ! New_Length : Count_Type'Base; -- sum of current length and Count ! New_Last : Index_Type'Base; -- last index of vector after insertion ! Index : Index_Type'Base; -- scratch for intermediate values ! J : Count_Type'Base; -- scratch ! ! New_Capacity : Count_Type'Base; -- length of new, expanded array ! Dst_Last : Index_Type'Base; -- last index of new, expanded array ! Dst : Elements_Access; -- new, expanded internal array begin + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying where the new + -- items should be inserted, so we must manually check. (That the user + -- is allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows for the + -- case of appending items to the back end of the vector. (It is assumed + -- that specifying an index value greater than Last + 1 indicates some + -- deeper flaw in the caller's algorithm, so that case is treated as a + -- proper error.) + if Before > Container.Last and then Before > Container.Last + 1 then *************** package body Ada.Containers.Indefinite_V *** 1065,1261 **** "Before index is out of range (too large)"; end if; if Count = 0 then return; end if; ! declare ! Old_Last_As_Int : constant Int := Int (Container.Last); ! begin ! if Old_Last_As_Int > Int'Last - N then ! raise Constraint_Error with "new length is out of range"; ! end if; ! New_Last_As_Int := Old_Last_As_Int + N; ! if New_Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Length := UInt (New_Last_As_Int - First + 1); ! if New_Length > Max_Length then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Last := Index_Type (New_Last_As_Int); ! end; ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; if Container.Elements = null then Container.Elements := new Elements_Type (New_Last); - Container.Last := No_Index; ! for J in Container.Elements.EA'Range loop ! Container.Elements.EA (J) := new Element_Type'(New_Item); ! Container.Last := J; end loop; return; end if; ! if New_Last <= Container.Elements.Last then declare E : Elements_Array renames Container.Elements.EA; begin ! if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! J : Index_Type'Base; ! begin ! -- The new items are being inserted in the middle of the ! -- array, in the range [Before, Index). Copy the existing ! -- elements to the end of the array, to make room for the ! -- new items. ! E (Index .. New_Last) := E (Before .. Container.Last); ! Container.Last := New_Last; ! -- We have copied the existing items up to the end of the ! -- array, to make room for the new items in the middle of ! -- the array. Now we actually allocate the new items. ! -- Note: initialize J outside loop to make it clear that ! -- J always has a value if the exception handler triggers. ! J := Before; ! begin ! while J < Index loop ! E (J) := new Element_Type'(New_Item); ! J := J + 1; ! end loop; ! exception ! when others => ! -- Values in the range [Before, J) were successfully ! -- allocated, but values in the range [J, Index) are ! -- stale (these array positions contain copies of the ! -- old items, that did not get assigned a new item, ! -- because the allocation failed). We must finish what ! -- we started by clearing out all of the stale values, ! -- leaving a "hole" in the middle of the array. ! E (J .. Index - 1) := (others => null); ! raise; ! end; ! end; ! else ! for J in Before .. New_Last loop ! E (J) := new Element_Type'(New_Item); ! Container.Last := J; ! end loop; end if; end; return; end if; ! -- There follows LOTS of code completely devoid of comments ??? ! -- This is not our general style ??? ! declare ! C, CC : UInt; ! begin ! C := UInt'Max (1, Container.Elements.EA'Length); -- ??? ! while C < New_Length loop ! if C > UInt'Last / 2 then ! C := UInt'Last; ! exit; ! end if; ! C := 2 * C; ! end loop; ! if C > Max_Length then ! C := Max_Length; ! end if; ! if Index_Type'First <= 0 ! and then Index_Type'Last >= 0 ! then ! CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1; ! else ! CC := UInt (Int (Index_Type'Last) - First + 1); ! end if; ! if C > CC then ! C := CC; ! end if; ! declare ! Dst_Last : constant Index_Type := ! Index_Type (First + UInt'Pos (C) - Int'(1)); ! begin ! Dst := new Elements_Type (Dst_Last); ! end; ! end; ! if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! Src : Elements_Access := Container.Elements; ! begin ! Dst.EA (Index_Type'First .. Before - 1) := ! Src.EA (Index_Type'First .. Before - 1); ! Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last); Container.Elements := Dst; - Container.Last := New_Last; Free (Src); ! for J in Before .. Index - 1 loop ! Dst.EA (J) := new Element_Type'(New_Item); end loop; - end; ! else ! declare ! Src : Elements_Access := Container.Elements; ! begin ! Dst.EA (Index_Type'First .. Container.Last) := ! Src.EA (Index_Type'First .. Container.Last); Container.Elements := Dst; Free (Src); ! for J in Before .. New_Last loop ! Dst.EA (J) := new Element_Type'(New_Item); ! Container.Last := J; end loop; ! end; ! end if; end Insert; procedure Insert --- 1332,1702 ---- "Before index is out of range (too large)"; end if; + -- We treat inserting 0 items into the container as a no-op, even when + -- the container is busy, so we simply return. + if Count = 0 then return; end if; ! -- There are two constraints we need to satisfy. The first constraint is ! -- that a container cannot have more than Count_Type'Last elements, so ! -- we must check the sum of the current length and the insertion ! -- count. Note that we cannot simply add these values, because of the ! -- possibility of overflow. ! if Old_Length > Count_Type'Last - Count then ! raise Constraint_Error with "Count is out of range"; ! end if; ! -- It is now safe compute the length of the new vector, without fear of ! -- overflow. ! New_Length := Old_Length + Count; ! ! -- The second constraint is that the new Last index value cannot exceed ! -- Index_Type'Last. In each branch below, we calculate the maximum ! -- length (computed from the range of values in Index_Type), and then ! -- compare the new length to the maximum length. If the new length is ! -- acceptable, then we compute the new last index from that. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We have to handle the case when there might be more values in the ! -- range of Index_Type than in the range of Count_Type. ! ! if Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is ! -- less than 0, so it is safe to compute the following sum without ! -- fear of overflow. ! ! Index := No_Index + Index_Type'Base (Count_Type'Last); ! ! if Index <= Index_Type'Last then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the ! -- maximum number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than in Count_Type, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); ! end if; ! ! else ! -- No_Index is equal or greater than 0, so we can safely compute ! -- the difference without fear of overflow (which we would have to ! -- worry about if No_Index were less than 0, but that case is ! -- handled above). ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); end if; ! elsif Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is less ! -- than 0, so it is safe to compute the following sum without fear of ! -- overflow. ! J := Count_Type'Base (No_Index) + Count_Type'Last; ! ! if J <= Count_Type'Base (Index_Type'Last) then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the maximum ! -- number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than Count_Type does, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); end if; ! else ! -- No_Index is equal or greater than 0, so we can safely compute the ! -- difference without fear of overflow (which we would have to worry ! -- about if No_Index were less than 0, but that case is handled ! -- above). ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); ! end if; ! ! -- We have just computed the maximum length (number of items). We must ! -- now compare the requested length to the maximum length, as we do not ! -- allow a vector expand beyond the maximum (because that would create ! -- an internal array with a last index value greater than ! -- Index_Type'Last, with no way to index those elements). ! ! if New_Length > Max_Length then ! raise Constraint_Error with "Count is out of range"; ! end if; ! ! -- New_Last is the last index value of the items in the container after ! -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to ! -- compute its value from the New_Length. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! New_Last := No_Index + Index_Type'Base (New_Length); ! ! else ! New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length); end if; if Container.Elements = null then + pragma Assert (Container.Last = No_Index); + + -- This is the simplest case, with which we must always begin: we're + -- inserting items into an empty vector that hasn't allocated an + -- internal array yet. Note that we don't need to check the busy bit + -- here, because an empty container cannot be busy. + + -- In an indefinite vector, elements are allocated individually, and + -- stored as access values on the internal array (the length of which + -- represents the vector "capacity"), which is separately allocated. + Container.Elements := new Elements_Type (New_Last); ! -- The element backbone has been successfully allocated, so now we ! -- allocate the elements. ! ! for Idx in Container.Elements.EA'Range loop ! -- In order to preserve container invariants, we always attempt ! -- the element allocation first, before setting the Last index ! -- value, in case the allocation fails (either because there is no ! -- storage available, or because element initialization fails). ! ! Container.Elements.EA (Idx) := new Element_Type'(New_Item); ! ! -- The allocation of the element succeeded, so it is now safe to ! -- update the Last index, restoring container invariants. ! ! Container.Last := Idx; end loop; return; end if; ! -- The tampering bits exist to prevent an item from being harmfully ! -- manipulated while it is being visited. Query, Update, and Iterate ! -- increment the busy count on entry, and decrement the count on ! -- exit. Insert checks the count to determine whether it is being called ! -- while the associated callback procedure is executing. ! ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; ! end if; ! ! if New_Length <= Container.Elements.EA'Length then ! -- In this case, we're inserting elements into a vector that has ! -- already allocated an internal array, and the existing array has ! -- enough unused storage for the new items. ! declare E : Elements_Array renames Container.Elements.EA; + K : Index_Type'Base; begin ! if Before > Container.Last then ! -- The new items are being appended to the vector, so no ! -- sliding of existing elements is required. ! for Idx in Before .. New_Last loop ! -- In order to preserve container invariants, we always ! -- attempt the element allocation first, before setting the ! -- Last index value, in case the allocation fails (either ! -- because there is no storage available, or because element ! -- initialization fails). ! E (Idx) := new Element_Type'(New_Item); ! -- The allocation of the element succeeded, so it is now ! -- safe to update the Last index, restoring container ! -- invariants. ! Container.Last := Idx; ! end loop; ! else ! -- The new items are being inserted before some existing ! -- elements, so we must slide the existing elements up to their ! -- new home. We use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate index values. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! -- The new items are being inserted in the middle of the array, ! -- in the range [Before, Index). Copy the existing elements to ! -- the end of the array, to make room for the new items. ! E (Index .. New_Last) := E (Before .. Container.Last); ! Container.Last := New_Last; ! -- We have copied the existing items up to the end of the ! -- array, to make room for the new items in the middle of ! -- the array. Now we actually allocate the new items. ! -- Note: initialize K outside loop to make it clear that ! -- K always has a value if the exception handler triggers. ! ! K := Before; ! begin ! while K < Index loop ! E (K) := new Element_Type'(New_Item); ! K := K + 1; ! end loop; ! ! exception ! when others => ! ! -- Values in the range [Before, K) were successfully ! -- allocated, but values in the range [K, Index) are ! -- stale (these array positions contain copies of the ! -- old items, that did not get assigned a new item, ! -- because the allocation failed). We must finish what ! -- we started by clearing out all of the stale values, ! -- leaving a "hole" in the middle of the array. ! ! E (K .. Index - 1) := (others => null); ! raise; ! end; end if; end; return; end if; ! -- In this case, we're inserting elements into a vector that has already ! -- allocated an internal array, but the existing array does not have ! -- enough storage, so we must allocate a new, longer array. In order to ! -- guarantee that the amortized insertion cost is O(1), we always ! -- allocate an array whose length is some power-of-two factor of the ! -- current array length. (The new array cannot have a length less than ! -- the New_Length of the container, but its last index value cannot be ! -- greater than Index_Type'Last.) ! New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length); ! while New_Capacity < New_Length loop ! if New_Capacity > Count_Type'Last / 2 then ! New_Capacity := Count_Type'Last; ! exit; ! end if; ! New_Capacity := 2 * New_Capacity; ! end loop; ! if New_Capacity > Max_Length then ! -- We have reached the limit of capacity, so no further expansion ! -- will occur. (This is not a problem, as there is never a need to ! -- have more capacity than the maximum container length.) ! New_Capacity := Max_Length; ! end if; ! -- We have computed the length of the new internal array (and this is ! -- what "vector capacity" means), so use that to compute its last index. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Dst_Last := No_Index + Index_Type'Base (New_Capacity); ! else ! Dst_Last := ! Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity); ! end if; ! -- Now we allocate the new, longer internal array. If the allocation ! -- fails, we have not changed any container state, so no side-effect ! -- will occur as a result of propagating the exception. ! Dst := new Elements_Type (Dst_Last); ! -- We have our new internal array. All that needs to be done now is to ! -- copy the existing items (if any) from the old array (the "source" ! -- array) to the new array (the "destination" array), and then ! -- deallocate the old array. ! declare ! Src : Elements_Access := Container.Elements; ! begin ! Dst.EA (Index_Type'First .. Before - 1) := ! Src.EA (Index_Type'First .. Before - 1); ! if Before > Container.Last then ! -- The new items are being appended to the vector, so no ! -- sliding of existing elements is required. ! ! -- We have copied the elements from to the old, source array to ! -- the new, destination array, so we can now deallocate the old ! -- array. Container.Elements := Dst; Free (Src); ! -- Now we append the new items. ! ! for Idx in Before .. New_Last loop ! -- In order to preserve container invariants, we always ! -- attempt the element allocation first, before setting the ! -- Last index value, in case the allocation fails (either ! -- because there is no storage available, or because element ! -- initialization fails). ! ! Dst.EA (Idx) := new Element_Type'(New_Item); ! ! -- The allocation of the element succeeded, so it is now safe ! -- to update the Last index, restoring container invariants. ! ! Container.Last := Idx; end loop; ! else ! -- The new items are being inserted before some existing elements, ! -- so we must slide the existing elements up to their new home. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! ! Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last); ! ! -- We have copied the elements from to the old, source array to ! -- the new, destination array, so we can now deallocate the old ! -- array. Container.Elements := Dst; + Container.Last := New_Last; Free (Src); ! -- The new array has a range in the middle containing null access ! -- values. We now fill in that partition of the array with the new ! -- items. ! ! for Idx in Before .. Index - 1 loop ! -- Note that container invariants have already been satisfied ! -- (in particular, the Last index value of the vector has ! -- already been updated), so if this allocation fails we simply ! -- let it propagate. ! ! Dst.EA (Idx) := new Element_Type'(New_Item); end loop; ! end if; ! end; end Insert; procedure Insert *************** package body Ada.Containers.Indefinite_V *** 1264,1330 **** New_Item : Vector) is N : constant Count_Type := Length (New_Item); begin ! if Before < Index_Type'First then ! raise Constraint_Error with ! "Before index is out of range (too small)"; ! end if; ! if Before > Container.Last ! and then Before > Container.Last + 1 ! then ! raise Constraint_Error with ! "Before index is out of range (too large)"; ! end if; if N = 0 then return; end if; ! Insert_Space (Container, Before, Count => N); ! ! declare ! Dst_Last_As_Int : constant Int'Base := ! Int'Base (Before) + Int'Base (N) - 1; ! ! Dst_Last : constant Index_Type := Index_Type (Dst_Last_As_Int); ! ! Dst : Elements_Array renames ! Container.Elements.EA (Before .. Dst_Last); ! ! Dst_Index : Index_Type'Base := Before - 1; ! ! begin ! if Container'Address /= New_Item'Address then ! declare ! subtype Src_Index_Subtype is Index_Type'Base range ! Index_Type'First .. New_Item.Last; ! ! Src : Elements_Array renames ! New_Item.Elements.EA (Src_Index_Subtype); ! ! begin ! for Src_Index in Src'Range loop ! Dst_Index := Dst_Index + 1; ! ! if Src (Src_Index) /= null then ! Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all); ! end if; ! end loop; ! end; ! ! return; ! end if; declare subtype Src_Index_Subtype is Index_Type'Base range ! Index_Type'First .. Before - 1; Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); begin for Src_Index in Src'Range loop Dst_Index := Dst_Index + 1; --- 1705,1744 ---- New_Item : Vector) is N : constant Count_Type := Length (New_Item); + J : Index_Type'Base; begin ! -- Use Insert_Space to create the "hole" (the destination slice) into ! -- which we copy the source items. ! Insert_Space (Container, Before, Count => N); if N = 0 then + -- There's nothing else to do here (vetting of parameters was + -- performed already in Insert_Space), so we simply return. + return; end if; ! if Container'Address /= New_Item'Address then ! -- This is the simple case. New_Item denotes an object different ! -- from Container, so there's nothing special we need to do to copy ! -- the source items to their destination, because all of the source ! -- items are contiguous. declare subtype Src_Index_Subtype is Index_Type'Base range ! Index_Type'First .. New_Item.Last; Src : Elements_Array renames ! New_Item.Elements.EA (Src_Index_Subtype); ! ! Dst : Elements_Array renames Container.Elements.EA; ! ! Dst_Index : Index_Type'Base; begin + Dst_Index := Before - 1; for Src_Index in Src'Range loop Dst_Index := Dst_Index + 1; *************** package body Ada.Containers.Indefinite_V *** 1334,1359 **** end loop; end; ! if Dst_Last = Container.Last then return; end if; ! declare ! subtype Src_Index_Subtype is Index_Type'Base range ! Dst_Last + 1 .. Container.Last; ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! begin ! for Src_Index in Src'Range loop ! Dst_Index := Dst_Index + 1; ! if Src (Src_Index) /= null then ! Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all); ! end if; ! end loop; ! end; end; end Insert; --- 1748,1851 ---- end loop; end; ! return; ! end if; ! ! -- New_Item denotes the same object as Container, so an insertion has ! -- potentially split the source items. The first source slice is ! -- [Index_Type'First, Before), and the second source slice is ! -- [J, Container.Last], where index value J is the first index of the ! -- second slice. (J gets computed below, but only after we have ! -- determined that the second source slice is non-empty.) The ! -- destination slice is always the range [Before, J). We perform the ! -- copy in two steps, using each of the two slices of the source items. ! ! declare ! L : constant Index_Type'Base := Before - 1; ! ! subtype Src_Index_Subtype is Index_Type'Base range ! Index_Type'First .. L; ! ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! ! Dst : Elements_Array renames Container.Elements.EA; ! ! Dst_Index : Index_Type'Base; ! ! begin ! -- We first copy the source items that precede the space we ! -- inserted. (If Before equals Index_Type'First, then this first ! -- source slice will be empty, which is harmless.) ! ! Dst_Index := Before - 1; ! for Src_Index in Src'Range loop ! Dst_Index := Dst_Index + 1; ! ! if Src (Src_Index) /= null then ! Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all); ! end if; ! end loop; ! ! if Src'Length = N then ! -- The new items were effectively appended to the container, so we ! -- have already copied all of the items that need to be copied. ! -- We return early here, even though the source slice below is ! -- empty (so the assignment would be harmless), because we want to ! -- avoid computing J, which will overflow if J is greater than ! -- Index_Type'Base'Last. ! return; end if; + end; ! -- Index value J is the first index of the second source slice. (It is ! -- also 1 greater than the last index of the destination slice.) Note ! -- that we want to avoid computing J, if J is greater than ! -- Index_Type'Base'Last, in order to avoid overflow. We prevent that by ! -- returning early above, immediately after copying the first slice of ! -- the source, and determining that this second slice of the source is ! -- empty. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! J := Before + Index_Type'Base (N); ! else ! J := Index_Type'Base (Count_Type'Base (Before) + N); ! end if; ! declare ! subtype Src_Index_Subtype is Index_Type'Base range ! J .. Container.Last; ! ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! ! Dst : Elements_Array renames Container.Elements.EA; ! ! Dst_Index : Index_Type'Base; ! ! begin ! -- We next copy the source items that follow the space we ! -- inserted. Index value Dst_Index is the first index of that portion ! -- of the destination that receives this slice of the source. (For ! -- the reasons given above, this slice is guaranteed to be ! -- non-empty.) ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Dst_Index := J - Index_Type'Base (Src'Length); ! ! else ! Dst_Index := Index_Type'Base (Count_Type'Base (J) - Src'Length); ! end if; ! ! for Src_Index in Src'Range loop ! if Src (Src_Index) /= null then ! Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all); ! end if; ! ! Dst_Index := Dst_Index + 1; ! end loop; end; end Insert; *************** package body Ada.Containers.Indefinite_V *** 1530,1551 **** Before : Extended_Index; Count : Count_Type := 1) is ! N : constant Int := Int (Count); ! First : constant Int := Int (Index_Type'First); ! New_Last_As_Int : Int'Base; ! New_Last : Index_Type; ! New_Length : UInt; ! Max_Length : constant UInt := UInt (Count_Type'Last); ! Dst : Elements_Access; begin if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; if Before > Container.Last and then Before > Container.Last + 1 then --- 2022,2063 ---- Before : Extended_Index; Count : Count_Type := 1) is ! Old_Length : constant Count_Type := Container.Length; ! Max_Length : Count_Type'Base; -- determined from range of Index_Type ! New_Length : Count_Type'Base; -- sum of current length and Count ! New_Last : Index_Type'Base; -- last index of vector after insertion ! Index : Index_Type'Base; -- scratch for intermediate values ! J : Count_Type'Base; -- scratch ! ! New_Capacity : Count_Type'Base; -- length of new, expanded array ! Dst_Last : Index_Type'Base; -- last index of new, expanded array ! Dst : Elements_Access; -- new, expanded internal array begin + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying where the new + -- items should be inserted, so we must manually check. (That the user + -- is allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows for the + -- case of appending items to the back end of the vector. (It is assumed + -- that specifying an index value greater than Last + 1 indicates some + -- deeper flaw in the caller's algorithm, so that case is treated as a + -- proper error.) + if Before > Container.Last and then Before > Container.Last + 1 then *************** package body Ada.Containers.Indefinite_V *** 1553,1612 **** "Before index is out of range (too large)"; end if; if Count = 0 then return; end if; ! declare ! Old_Last_As_Int : constant Int := Int (Container.Last); ! begin ! if Old_Last_As_Int > Int'Last - N then ! raise Constraint_Error with "new length is out of range"; ! end if; ! New_Last_As_Int := Old_Last_As_Int + N; ! if New_Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Length := UInt (New_Last_As_Int - First + 1); ! if New_Length > Max_Length then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Last := Index_Type (New_Last_As_Int); ! end; ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; if Container.Elements = null then Container.Elements := new Elements_Type (New_Last); Container.Last := New_Last; return; end if; ! if New_Last <= Container.Elements.Last then declare E : Elements_Array renames Container.Elements.EA; begin if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! begin ! E (Index .. New_Last) := E (Before .. Container.Last); ! E (Before .. Index - 1) := (others => null); ! end; end if; end; --- 2065,2242 ---- "Before index is out of range (too large)"; end if; + -- We treat inserting 0 items into the container as a no-op, even when + -- the container is busy, so we simply return. + if Count = 0 then return; end if; ! -- There are two constraints we need to satisfy. The first constraint is ! -- that a container cannot have more than Count_Type'Last elements, so ! -- we must check the sum of the current length and the insertion ! -- count. Note that we cannot simply add these values, because of the ! -- possibility of overflow. ! if Old_Length > Count_Type'Last - Count then ! raise Constraint_Error with "Count is out of range"; ! end if; ! -- It is now safe compute the length of the new vector, without fear of ! -- overflow. ! New_Length := Old_Length + Count; ! ! -- The second constraint is that the new Last index value cannot exceed ! -- Index_Type'Last. In each branch below, we calculate the maximum ! -- length (computed from the range of values in Index_Type), and then ! -- compare the new length to the maximum length. If the new length is ! -- acceptable, then we compute the new last index from that. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We have to handle the case when there might be more values in the ! -- range of Index_Type than in the range of Count_Type. ! ! if Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is ! -- less than 0, so it is safe to compute the following sum without ! -- fear of overflow. ! ! Index := No_Index + Index_Type'Base (Count_Type'Last); ! ! if Index <= Index_Type'Last then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the ! -- maximum number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than in Count_Type, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); ! end if; ! ! else ! -- No_Index is equal or greater than 0, so we can safely compute ! -- the difference without fear of overflow (which we would have to ! -- worry about if No_Index were less than 0, but that case is ! -- handled above). ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); end if; ! elsif Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is less ! -- than 0, so it is safe to compute the following sum without fear of ! -- overflow. ! J := Count_Type'Base (No_Index) + Count_Type'Last; ! ! if J <= Count_Type'Base (Index_Type'Last) then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the maximum ! -- number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than Count_Type does, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); end if; ! else ! -- No_Index is equal or greater than 0, so we can safely compute the ! -- difference without fear of overflow (which we would have to worry ! -- about if No_Index were less than 0, but that case is handled ! -- above). ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); ! end if; ! ! -- We have just computed the maximum length (number of items). We must ! -- now compare the requested length to the maximum length, as we do not ! -- allow a vector expand beyond the maximum (because that would create ! -- an internal array with a last index value greater than ! -- Index_Type'Last, with no way to index those elements). ! ! if New_Length > Max_Length then ! raise Constraint_Error with "Count is out of range"; ! end if; ! ! -- New_Last is the last index value of the items in the container after ! -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to ! -- compute its value from the New_Length. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! New_Last := No_Index + Index_Type'Base (New_Length); ! ! else ! New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length); end if; if Container.Elements = null then + pragma Assert (Container.Last = No_Index); + + -- This is the simplest case, with which we must always begin: we're + -- inserting items into an empty vector that hasn't allocated an + -- internal array yet. Note that we don't need to check the busy bit + -- here, because an empty container cannot be busy. + + -- In an indefinite vector, elements are allocated individually, and + -- stored as access values on the internal array (the length of which + -- represents the vector "capacity"), which is separately + -- allocated. We have no elements here (because we're inserting + -- "space"), so all we need to do is allocate the backbone. + Container.Elements := new Elements_Type (New_Last); Container.Last := New_Last; + return; end if; ! -- The tampering bits exist to prevent an item from being harmfully ! -- manipulated while it is being visited. Query, Update, and Iterate ! -- increment the busy count on entry, and decrement the count on ! -- exit. Insert checks the count to determine whether it is being called ! -- while the associated callback procedure is executing. ! ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; ! end if; ! ! if New_Length <= Container.Elements.EA'Length then ! -- In this case, we're inserting elements into a vector that has ! -- already allocated an internal array, and the existing array has ! -- enough unused storage for the new items. ! declare E : Elements_Array renames Container.Elements.EA; begin if Before <= Container.Last then ! -- The new space is being inserted before some existing ! -- elements, so we must slide the existing elements up to their ! -- new home. We use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate index values. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! ! E (Index .. New_Last) := E (Before .. Container.Last); ! E (Before .. Index - 1) := (others => null); end if; end; *************** package body Ada.Containers.Indefinite_V *** 1614,1681 **** return; end if; ! declare ! C, CC : UInt; ! begin ! C := UInt'Max (1, Container.Elements.EA'Length); -- ??? ! while C < New_Length loop ! if C > UInt'Last / 2 then ! C := UInt'Last; ! exit; ! end if; ! C := 2 * C; ! end loop; ! if C > Max_Length then ! C := Max_Length; ! end if; ! if Index_Type'First <= 0 ! and then Index_Type'Last >= 0 ! then ! CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1; ! else ! CC := UInt (Int (Index_Type'Last) - First + 1); ! end if; ! if C > CC then ! C := CC; ! end if; ! declare ! Dst_Last : constant Index_Type := ! Index_Type (First + UInt'Pos (C) - 1); ! begin ! Dst := new Elements_Type (Dst_Last); ! end; ! end; declare Src : Elements_Access := Container.Elements; begin ! if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! begin ! Dst.EA (Index_Type'First .. Before - 1) := ! Src.EA (Index_Type'First .. Before - 1); ! Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last); ! end; ! else ! Dst.EA (Index_Type'First .. Container.Last) := ! Src.EA (Index_Type'First .. Container.Last); end if; Container.Elements := Dst; Container.Last := New_Last; Free (Src); --- 2244,2323 ---- return; end if; ! -- In this case, we're inserting elements into a vector that has already ! -- allocated an internal array, but the existing array does not have ! -- enough storage, so we must allocate a new, longer array. In order to ! -- guarantee that the amortized insertion cost is O(1), we always ! -- allocate an array whose length is some power-of-two factor of the ! -- current array length. (The new array cannot have a length less than ! -- the New_Length of the container, but its last index value cannot be ! -- greater than Index_Type'Last.) ! New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length); ! while New_Capacity < New_Length loop ! if New_Capacity > Count_Type'Last / 2 then ! New_Capacity := Count_Type'Last; ! exit; ! end if; ! New_Capacity := 2 * New_Capacity; ! end loop; ! if New_Capacity > Max_Length then ! -- We have reached the limit of capacity, so no further expansion ! -- will occur. (This is not a problem, as there is never a need to ! -- have more capacity than the maximum container length.) ! New_Capacity := Max_Length; ! end if; ! -- We have computed the length of the new internal array (and this is ! -- what "vector capacity" means), so use that to compute its last index. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Dst_Last := No_Index + Index_Type'Base (New_Capacity); ! else ! Dst_Last := ! Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity); ! end if; ! ! -- Now we allocate the new, longer internal array. If the allocation ! -- fails, we have not changed any container state, so no side-effect ! -- will occur as a result of propagating the exception. ! ! Dst := new Elements_Type (Dst_Last); ! ! -- We have our new internal array. All that needs to be done now is to ! -- copy the existing items (if any) from the old array (the "source" ! -- array) to the new array (the "destination" array), and then ! -- deallocate the old array. declare Src : Elements_Access := Container.Elements; begin ! Dst.EA (Index_Type'First .. Before - 1) := ! Src.EA (Index_Type'First .. Before - 1); ! if Before <= Container.Last then ! -- The new items are being inserted before some existing elements, ! -- so we must slide the existing elements up to their new home. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last); end if; + -- We have copied the elements from to the old, source array to the + -- new, destination array, so we can now restore invariants, and + -- deallocate the old array. + Container.Elements := Dst; Container.Last := New_Last; Free (Src); *************** package body Ada.Containers.Indefinite_V *** 1777,1783 **** return (Container'Unchecked_Access, Container.Last); end Last; ! ------------------ -- Last_Element -- ------------------ --- 2419,2425 ---- return (Container'Unchecked_Access, Container.Last); end Last; ! ----------------- -- Last_Element -- ------------------ *************** package body Ada.Containers.Indefinite_V *** 1814,1825 **** ------------ function Length (Container : Vector) return Count_Type is ! L : constant Int := Int (Container.Last); ! F : constant Int := Int (Index_Type'First); ! N : constant Int'Base := L - F + 1; begin ! return Count_Type (N); end Length; ---------- --- 2456,2488 ---- ------------ function Length (Container : Vector) return Count_Type is ! L : constant Index_Type'Base := Container.Last; ! F : constant Index_Type := Index_Type'First; begin ! -- The base range of the index type (Index_Type'Base) might not include ! -- all values for length (Count_Type). Contrariwise, the index type ! -- might include values outside the range of length. Hence we use ! -- whatever type is wider for intermediate values when calculating ! -- length. Note that no matter what the index type is, the maximum ! -- length to which a vector is allowed to grow is always the minimum ! -- of Count_Type'Last and (IT'Last - IT'First + 1). ! ! -- For example, an Index_Type with range -127 .. 127 is only guaranteed ! -- to have a base range of -128 .. 127, but the corresponding vector ! -- would have lengths in the range 0 .. 255. In this case we would need ! -- to use Count_Type'Base for intermediate values. ! ! -- Another case would be the index range -2**63 + 1 .. -2**63 + 10. The ! -- vector would have a maximum length of 10, but the index values lie ! -- outside the range of Count_Type (which is only 32 bits). In this ! -- case we would need to use Index_Type'Base for intermediate values. ! ! if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then ! return Count_Type'Base (L) - Count_Type'Base (F) + 1; ! else ! return Count_Type (L - F + 1); ! end if; end Length; ---------- *************** package body Ada.Containers.Indefinite_V *** 1837,1843 **** if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (Source is busy)"; end if; Clear (Target); -- Checks busy-bit --- 2500,2506 ---- if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (Source is busy)"; end if; Clear (Target); -- Checks busy-bit *************** package body Ada.Containers.Indefinite_V *** 2048,2054 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; declare --- 2711,2717 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; declare *************** package body Ada.Containers.Indefinite_V *** 2079,2085 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; declare --- 2742,2748 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; declare *************** package body Ada.Containers.Indefinite_V *** 2100,2119 **** is N : constant Count_Type := Length (Container); begin if Capacity = 0 then if N = 0 then declare X : Elements_Access := Container.Elements; begin Container.Elements := null; Free (X); end; elsif N < Container.Elements.EA'Length then if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; declare --- 2763,2818 ---- is N : constant Count_Type := Length (Container); + Index : Count_Type'Base; + Last : Index_Type'Base; + begin + -- Reserve_Capacity can be used to either expand the storage available + -- for elements (this would be its typical use, in anticipation of + -- future insertion), or to trim back storage. In the latter case, + -- storage can only be trimmed back to the limit of the container + -- length. Note that Reserve_Capacity neither deletes (active) elements + -- nor inserts elements; it only affects container capacity, never + -- container length. + if Capacity = 0 then + -- This is a request to trim back storage, to the minimum amount + -- possible given the current state of the container. + if N = 0 then + -- The container is empty, so in this unique case we can + -- deallocate the entire internal array. Note that an empty + -- container can never be busy, so there's no need to check the + -- tampering bits. + declare X : Elements_Access := Container.Elements; begin + -- First we remove the internal array from the container, to + -- handle the case when the deallocation raises an exception + -- (although that's unlikely, since this is simply an array of + -- access values, all of which are null). + Container.Elements := null; + + -- Container invariants have been restored, so it is now safe + -- to attempt to deallocate the internal array. + Free (X); end; elsif N < Container.Elements.EA'Length then + -- The container is not empty, and the current length is less than + -- the current capacity, so there's storage available to trim. In + -- this case, we allocate a new internal array having a length + -- that exactly matches the number of items in the + -- container. (Reserve_Capacity does not delete active elements, + -- so this is the best we can do with respect to minimizing + -- storage). + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; declare *************** package body Ada.Containers.Indefinite_V *** 2126,2132 **** --- 2825,2843 ---- X : Elements_Access := Container.Elements; begin + -- Although we have isolated the old internal array that we're + -- going to deallocate, we don't deallocate it until we have + -- successfully allocated a new one. If there is an exception + -- during allocation (because there is not enough storage), we + -- let it propagate without causing any side-effect. + Container.Elements := new Elements_Type'(Container.Last, Src); + + -- We have successfully allocated a new internal array (with a + -- smaller length than the old one, and containing a copy of + -- just the active elements in the container), so we can + -- deallocate the old array. + Free (X); end; end if; *************** package body Ada.Containers.Indefinite_V *** 2134,2165 **** return; end if; ! if Container.Elements = null then ! declare ! Last_As_Int : constant Int'Base := ! Int (Index_Type'First) + Int (Capacity) - 1; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! begin ! Container.Elements := new Elements_Type (Last); ! end; ! end; return; end if; if Capacity <= N then if N < Container.Elements.EA'Length then if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; declare --- 2845,2949 ---- return; end if; ! -- Reserve_Capacity can be used to expand the storage available for ! -- elements, but we do not let the capacity grow beyond the number of ! -- values in Index_Type'Range. (Were it otherwise, there would be no way ! -- to refer to the elements with index values greater than ! -- Index_Type'Last, so that storage would be wasted.) Here we compute ! -- the Last index value of the new internal array, in a way that avoids ! -- any possibility of overflow. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! if Index_Type'Base'Last - Index_Type'Base (Capacity) < No_Index then ! raise Constraint_Error with "Capacity is out of range"; ! end if; ! ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! ! Last := No_Index + Index_Type'Base (Capacity); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then ! raise Constraint_Error with "Capacity is out of range"; ! end if; ! ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of Capacity. ! ! Index := Count_Type'Base (No_Index) + Capacity; -- Last ! ! if Index > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "Capacity is out of range"; ! end if; ! ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! ! Last := Index_Type'Base (Index); ! ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! ! Index := Count_Type'Base (Index_Type'Last) - Capacity; -- No_Index ! ! if Index < Count_Type'Base (No_Index) then ! raise Constraint_Error with "Capacity is out of range"; ! end if; ! ! -- We have determined that the value of Capacity would not create a ! -- Last index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! ! Last := Index_Type'Base (Count_Type'Base (No_Index) + Capacity); ! end if; ! ! -- The requested capacity is non-zero, but we don't know yet whether ! -- this is a request for expansion or contraction of storage. ! ! if Container.Elements = null then ! -- The container is empty (it doesn't even have an internal array), ! -- so this represents a request to allocate storage having the given ! -- capacity. + Container.Elements := new Elements_Type (Last); return; end if; if Capacity <= N then + -- This is a request to trim back storage, but only to the limit of + -- what's already in the container. (Reserve_Capacity never deletes + -- active elements, it only reclaims excess storage.) + if N < Container.Elements.EA'Length then + -- The container is not empty (because the requested capacity is + -- positive, and less than or equal to the container length), and + -- the current length is less than the current capacity, so + -- there's storage available to trim. In this case, we allocate a + -- new internal array having a length that exactly matches the + -- number of items in the container. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; declare *************** package body Ada.Containers.Indefinite_V *** 2172,2178 **** --- 2956,2974 ---- X : Elements_Access := Container.Elements; begin + -- Although we have isolated the old internal array that we're + -- going to deallocate, we don't deallocate it until we have + -- successfully allocated a new one. If there is an exception + -- during allocation (because there is not enough storage), we + -- let it propagate without causing any side-effect. + Container.Elements := new Elements_Type'(Container.Last, Src); + + -- We have successfully allocated a new internal array (with a + -- smaller length than the old one, and containing a copy of + -- just the active elements in the container), so it is now + -- safe to deallocate the old array. + Free (X); end; end if; *************** package body Ada.Containers.Indefinite_V *** 2180,2226 **** return; end if; if Capacity = Container.Elements.EA'Length then return; end if; if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; ! declare ! Last_As_Int : constant Int'Base := ! Int (Index_Type'First) + Int (Capacity) - 1; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! X : Elements_Access := Container.Elements; ! subtype Index_Subtype is Index_Type'Base range ! Index_Type'First .. Container.Last; ! begin ! Container.Elements := new Elements_Type (Last); ! declare ! Src : Elements_Array renames ! X.EA (Index_Subtype); ! Tgt : Elements_Array renames ! Container.Elements.EA (Index_Subtype); ! begin ! Tgt := Src; ! end; ! Free (X); ! end; end; end Reserve_Capacity; --- 2976,3032 ---- return; end if; + -- The requested capacity is larger than the container length (the + -- number of active elements). Whether this represents a request for + -- expansion or contraction of the current capacity depends on what the + -- current capacity is. + if Capacity = Container.Elements.EA'Length then + -- The requested capacity matches the existing capacity, so there's + -- nothing to do here. We treat this case as a no-op, and simply + -- return without checking the busy bit. + return; end if; + -- There is a change in the capacity of a non-empty container, so a new + -- internal array will be allocated. (The length of the new internal + -- array could be less or greater than the old internal array. We know + -- only that the length of the new internal array is greater than the + -- number of active elements in the container.) We must check whether + -- the container is busy before doing anything else. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; ! -- We now allocate a new internal array, having a length different from ! -- its current value. ! declare ! X : Elements_Access := Container.Elements; ! subtype Index_Subtype is Index_Type'Base range ! Index_Type'First .. Container.Last; ! begin ! -- We now allocate a new internal array, having a length different ! -- from its current value. ! Container.Elements := new Elements_Type (Last); ! -- We have successfully allocated the new internal array, so now we ! -- move the existing elements from the existing the old internal ! -- array onto the new one. Note that we're just copying access ! -- values, to this should not raise any exceptions. ! Container.Elements.EA (Index_Subtype) := X.EA (Index_Subtype); ! -- We have moved the elements from the old internal array, so now we ! -- can deallocate it. ! Free (X); end; end Reserve_Capacity; *************** package body Ada.Containers.Indefinite_V *** 2236,2242 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; declare --- 3042,3048 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; declare *************** package body Ada.Containers.Indefinite_V *** 2357,2401 **** (Container : in out Vector; Length : Count_Type) is ! N : constant Count_Type := Indefinite_Vectors.Length (Container); begin ! if Length = N then ! return; ! end if; ! ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; ! end if; ! ! if Length < N then ! for Index in 1 .. N - Length loop ! declare ! J : constant Index_Type := Container.Last; ! X : Element_Access := Container.Elements.EA (J); ! begin ! Container.Elements.EA (J) := null; ! Container.Last := J - 1; ! Free (X); ! end; ! end loop; ! return; ! end if; ! if Length > Capacity (Container) then ! Reserve_Capacity (Container, Capacity => Length); end if; - - declare - Last_As_Int : constant Int'Base := - Int (Index_Type'First) + Int (Length) - 1; - - begin - Container.Last := Index_Type (Last_As_Int); - end; end Set_Length; ---------- --- 3163,3187 ---- (Container : in out Vector; Length : Count_Type) is ! Count : constant Count_Type'Base := Container.Length - Length; begin ! -- Set_Length allows the user to set the length explicitly, instead of ! -- implicitly as a side-effect of deletion or insertion. If the ! -- requested length is less than the current length, this is equivalent ! -- to deleting items from the back end of the vector. If the requested ! -- length is greater than the current length, then this is equivalent to ! -- inserting "space" (nonce items) at the end. ! if Count >= 0 then ! Container.Delete_Last (Count); ! elsif Container.Last >= Index_Type'Last then ! raise Constraint_Error with "vector is already at its maximum length"; ! else ! Container.Insert_Space (Container.Last + 1, -Count); end if; end Set_Length; ---------- *************** package body Ada.Containers.Indefinite_V *** 2421,2427 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; declare --- 3207,3213 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; declare *************** package body Ada.Containers.Indefinite_V *** 2498,2570 **** --------------- function To_Vector (Length : Count_Type) return Vector is begin if Length = 0 then return Empty_Vector; end if; ! declare ! First : constant Int := Int (Index_Type'First); ! Last_As_Int : constant Int'Base := First + Int (Length) - 1; ! Last : Index_Type; ! Elements : Elements_Access; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then raise Constraint_Error with "Length is out of range"; end if; ! Last := Index_Type (Last_As_Int); ! Elements := new Elements_Type (Last); ! return (Controlled with Elements, Last, 0, 0); ! end; end To_Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector is begin if Length = 0 then return Empty_Vector; end if; ! declare ! First : constant Int := Int (Index_Type'First); ! Last_As_Int : constant Int'Base := First + Int (Length) - 1; ! Last : Index_Type'Base; ! Elements : Elements_Access; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then raise Constraint_Error with "Length is out of range"; end if; ! Last := Index_Type (Last_As_Int); ! Elements := new Elements_Type (Last); ! Last := Index_Type'First; ! begin ! loop ! Elements.EA (Last) := new Element_Type'(New_Item); ! exit when Last = Elements.Last; ! Last := Last + 1; ! end loop; ! exception ! when others => ! for J in Index_Type'First .. Last - 1 loop ! Free (Elements.EA (J)); ! end loop; ! Free (Elements); ! raise; ! end; ! return (Controlled with Elements, Last, 0, 0); end; end To_Vector; -------------------- --- 3284,3488 ---- --------------- function To_Vector (Length : Count_Type) return Vector is + Index : Count_Type'Base; + Last : Index_Type'Base; + Elements : Elements_Access; + begin if Length = 0 then return Empty_Vector; end if; ! -- We create a vector object with a capacity that matches the specified ! -- Length, but we do not allow the vector capacity (the length of the ! -- internal array) to exceed the number of values in Index_Type'Range ! -- (otherwise, there would be no way to refer to those components via an ! -- index). We must therefore check whether the specified Length would ! -- create a Last index value greater than Index_Type'Last. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! ! if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then raise Constraint_Error with "Length is out of range"; end if; ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! Last := No_Index + Index_Type'Base (Length); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of Length. ! ! Index := Count_Type'Base (No_Index) + Length; -- Last ! ! if Index > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! ! Last := Index_Type'Base (Index); ! ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! ! Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index ! ! if Index < Count_Type'Base (No_Index) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We have determined that the value of Length would not create a ! -- Last index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! ! Last := Index_Type'Base (Count_Type'Base (No_Index) + Length); ! end if; ! ! Elements := new Elements_Type (Last); ! ! return Vector'(Controlled with Elements, Last, 0, 0); end To_Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector is + Index : Count_Type'Base; + Last : Index_Type'Base; + Elements : Elements_Access; + begin if Length = 0 then return Empty_Vector; end if; ! -- We create a vector object with a capacity that matches the specified ! -- Length, but we do not allow the vector capacity (the length of the ! -- internal array) to exceed the number of values in Index_Type'Range ! -- (otherwise, there would be no way to refer to those components via an ! -- index). We must therefore check whether the specified Length would ! -- create a Last index value greater than Index_Type'Last. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! ! if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then raise Constraint_Error with "Length is out of range"; end if; ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! Last := No_Index + Index_Type'Base (Length); ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! if Last > Index_Type'Last then ! raise Constraint_Error with "Length is out of range"; ! end if; ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of Length. ! Index := Count_Type'Base (No_Index) + Length; -- Last ! ! if Index > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! ! Last := Index_Type'Base (Index); ! ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! ! Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index ! ! if Index < Count_Type'Base (No_Index) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We have determined that the value of Length would not create a ! -- Last index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! ! Last := Index_Type'Base (Count_Type'Base (No_Index) + Length); ! end if; ! ! Elements := new Elements_Type (Last); ! ! -- We use Last as the index of the loop used to populate the internal ! -- array with items. In general, we prefer to initialize the loop index ! -- immediately prior to entering the loop. However, Last is also used in ! -- the exception handler (to reclaim elements that have been allocated, ! -- before propagating the exception), and the initialization of Last ! -- after entering the block containing the handler confuses some static ! -- analysis tools, with respect to whether Last has been properly ! -- initialized when the handler executes. So here we initialize our loop ! -- variable earlier than we prefer, before entering the block, so there ! -- is no ambiguity. ! Last := Index_Type'First; ! ! begin ! loop ! Elements.EA (Last) := new Element_Type'(New_Item); ! exit when Last = Elements.Last; ! Last := Last + 1; ! end loop; ! ! exception ! when others => ! for J in Index_Type'First .. Last - 1 loop ! Free (Elements.EA (J)); ! end loop; ! ! Free (Elements); ! raise; end; + + return (Controlled with Elements, Last, 0, 0); end To_Vector; -------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/a-comlin.ads gcc-4.6.0/gcc/ada/a-comlin.ads *** gcc-4.5.2/gcc/ada/a-comlin.ads Mon Nov 30 11:08:56 2009 --- gcc-4.6.0/gcc/ada/a-comlin.ads Wed Jun 23 09:23:47 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Command_Line is *** 73,78 **** --- 73,81 ---- -- Note on Interface Requirements -- ------------------------------------ + -- Services in this package are not supported during the elaboration of an + -- auto-initialized Stand-Alone Library. + -- If the main program is in Ada, this package works as specified without -- any other work than the normal steps of WITH'ing the package and then -- calling the desired routines. diff -Nrcpad gcc-4.5.2/gcc/ada/a-contai.ads gcc-4.6.0/gcc/ada/a-contai.ads *** gcc-4.5.2/gcc/ada/a-contai.ads Fri Apr 6 09:13:42 2007 --- gcc-4.6.0/gcc/ada/a-contai.ads Mon Oct 25 13:50:29 2010 *************** package Ada.Containers is *** 19,22 **** --- 19,24 ---- type Hash_Type is mod 2**32; type Count_Type is range 0 .. 2**31 - 1; + Capacity_Error : exception; + end Ada.Containers; diff -Nrcpad gcc-4.5.2/gcc/ada/a-convec.adb gcc-4.6.0/gcc/ada/a-convec.adb *** gcc-4.5.2/gcc/ada/a-convec.adb Thu Jul 23 10:03:21 2009 --- gcc-4.6.0/gcc/ada/a-convec.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** with System; use type System.Address; *** 34,42 **** package body Ada.Containers.Vectors is - type Int is range System.Min_Int .. System.Max_Int; - type UInt is mod System.Max_Binary_Modulus; - procedure Free is new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access); --- 34,39 ---- *************** package body Ada.Containers.Vectors is *** 45,54 **** --------- function "&" (Left, Right : Vector) return Vector is ! LN : constant Count_Type := Length (Left); ! RN : constant Count_Type := Length (Right); begin if LN = 0 then if RN = 0 then return Empty_Vector; --- 42,63 ---- --------- function "&" (Left, Right : Vector) return Vector is ! LN : constant Count_Type := Length (Left); ! RN : constant Count_Type := Length (Right); ! N : Count_Type'Base; -- length of result ! J : Count_Type'Base; -- for computing intermediate index values ! Last : Index_Type'Base; -- Last index of result begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the vector parameters. We could decide to make it larger, but we + -- have no basis for knowing how much larger, so we just allocate the + -- minimum amount of storage. + + -- Here we handle the easy cases first, when one of the vector + -- parameters is empty. (We say "easy" because there's nothing to + -- compute, that can potentially overflow.) + if LN = 0 then if RN = 0 then return Empty_Vector; *************** package body Ada.Containers.Vectors is *** 80,123 **** end if; ! declare ! N : constant Int'Base := Int (LN) + Int (RN); ! Last_As_Int : Int'Base; ! begin ! if Int (No_Index) > Int'Last - N then raise Constraint_Error with "new length is out of range"; end if; ! Last_As_Int := Int (No_Index) + N; ! if Last_As_Int > Int (Index_Type'Last) then raise Constraint_Error with "new length is out of range"; end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : constant Elements_Access := ! new Elements_Type'(Last, LE & RE); ! begin ! return (Controlled with Elements, Last, 0, 0); ! end; end; end "&"; function "&" (Left : Vector; Right : Element_Type) return Vector is - LN : constant Count_Type := Length (Left); - begin ! if LN = 0 then declare Elements : constant Elements_Access := new Elements_Type' --- 89,205 ---- end if; ! -- Neither of the vector parameters is empty, so must compute the length ! -- of the result vector and its last index. (This is the harder case, ! -- because our computations must avoid overflow.) ! -- There are two constraints we need to satisfy. The first constraint is ! -- that a container cannot have more than Count_Type'Last elements, so ! -- we must check the sum of the combined lengths. Note that we cannot ! -- simply add the lengths, because of the possibility of overflow. ! ! if LN > Count_Type'Last - RN then ! raise Constraint_Error with "new length is out of range"; ! end if; ! ! -- It is now safe compute the length of the new vector, without fear of ! -- overflow. ! ! N := LN + RN; ! ! -- The second constraint is that the new Last index value cannot ! -- exceed Index_Type'Last. We use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate values. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! ! if Index_Type'Base'Last - Index_Type'Base (N) < No_Index then raise Constraint_Error with "new length is out of range"; end if; ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! Last := No_Index + Index_Type'Base (N); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then raise Constraint_Error with "new length is out of range"; end if; ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of length. ! J := Count_Type'Base (No_Index) + N; -- Last ! if J > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! Last := Index_Type'Base (J); ! ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! ! J := Count_Type'Base (Index_Type'Last) - N; -- No_Index ! ! if J < Count_Type'Base (No_Index) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! ! -- We have determined that the result length would not create a Last ! -- index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! ! Last := Index_Type'Base (Count_Type'Base (No_Index) + N); ! end if; ! ! declare ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! ! Elements : constant Elements_Access := ! new Elements_Type'(Last, LE & RE); ! ! begin ! return (Controlled with Elements, Last, 0, 0); end; end "&"; function "&" (Left : Vector; Right : Element_Type) return Vector is begin ! -- We decide that the capacity of the result is the sum of the lengths ! -- of the parameters. We could decide to make it larger, but we have no ! -- basis for knowing how much larger, so we just allocate the minimum ! -- amount of storage. ! ! -- Here we handle the easy case first, when the vector parameter (Left) ! -- is empty. ! ! if Left.Is_Empty then declare Elements : constant Elements_Access := new Elements_Type' *************** package body Ada.Containers.Vectors is *** 129,170 **** end; end if; ! declare ! Last_As_Int : Int'Base; ! ! begin ! if Int (Index_Type'First) > Int'Last - Int (LN) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! Last_As_Int := Int (Index_Type'First) + Int (LN); ! if Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! Elements : constant Elements_Access := ! new Elements_Type' ! (Last => Last, ! EA => LE & Right); ! begin ! return (Controlled with Elements, Last, 0, 0); ! end; end; end "&"; function "&" (Left : Element_Type; Right : Vector) return Vector is - RN : constant Count_Type := Length (Right); - begin ! if RN = 0 then declare Elements : constant Elements_Access := new Elements_Type' --- 211,257 ---- end; end if; ! -- The vector parameter is not empty, so we must compute the length of ! -- the result vector and its last index, but in such a way that overflow ! -- is avoided. We must satisfy two constraints: the new length cannot ! -- exceed Count_Type'Last, and the new Last index cannot exceed ! -- Index_Type'Last. ! if Left.Length = Count_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! if Left.Last >= Index_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Left.Last + 1; ! LE : Elements_Array renames ! Left.Elements.EA (Index_Type'First .. Left.Last); ! Elements : constant Elements_Access := ! new Elements_Type' ! (Last => Last, ! EA => LE & Right); ! begin ! return (Controlled with Elements, Last, 0, 0); end; end "&"; function "&" (Left : Element_Type; Right : Vector) return Vector is begin ! -- We decide that the capacity of the result is the sum of the lengths ! -- of the parameters. We could decide to make it larger, but we have no ! -- basis for knowing how much larger, so we just allocate the minimum ! -- amount of storage. ! ! -- Here we handle the easy case first, when the vector parameter (Right) ! -- is empty. ! ! if Right.Is_Empty then declare Elements : constant Elements_Access := new Elements_Type' *************** package body Ada.Containers.Vectors is *** 176,214 **** end; end if; ! declare ! Last_As_Int : Int'Base; ! ! begin ! if Int (Index_Type'First) > Int'Last - Int (RN) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! Last_As_Int := Int (Index_Type'First) + Int (RN); ! if Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : constant Elements_Access := ! new Elements_Type' ! (Last => Last, ! EA => Left & RE); ! begin ! return (Controlled with Elements, Last, 0, 0); ! end; end; end "&"; function "&" (Left, Right : Element_Type) return Vector is begin if Index_Type'First >= Index_Type'Last then raise Constraint_Error with "new length is out of range"; end if; --- 263,311 ---- end; end if; ! -- The vector parameter is not empty, so we must compute the length of ! -- the result vector and its last index, but in such a way that overflow ! -- is avoided. We must satisfy two constraints: the new length cannot ! -- exceed Count_Type'Last, and the new Last index cannot exceed ! -- Index_Type'Last. ! if Right.Length = Count_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! if Right.Last >= Index_Type'Last then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Right.Last + 1; ! RE : Elements_Array renames ! Right.Elements.EA (Index_Type'First .. Right.Last); ! Elements : constant Elements_Access := ! new Elements_Type' ! (Last => Last, ! EA => Left & RE); ! begin ! return (Controlled with Elements, Last, 0, 0); end; end "&"; function "&" (Left, Right : Element_Type) return Vector is begin + -- We decide that the capacity of the result is the sum of the lengths + -- of the parameters. We could decide to make it larger, but we have no + -- basis for knowing how much larger, so we just allocate the minimum + -- amount of storage. + + -- We must compute the length of the result vector and its last index, + -- but in such a way that overflow is avoided. We must satisfy two + -- constraints: the new length cannot exceed Count_Type'Last (here, we + -- know that that condition is satisfied), and the new Last index cannot + -- exceed Index_Type'Last. + if Index_Type'First >= Index_Type'Last then raise Constraint_Error with "new length is out of range"; end if; *************** package body Ada.Containers.Vectors is *** 343,349 **** begin if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; Container.Last := No_Index; --- 440,446 ---- begin if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; Container.Last := No_Index; *************** package body Ada.Containers.Vectors is *** 370,425 **** Index : Extended_Index; Count : Count_Type := 1) is begin if Index < Index_Type'First then raise Constraint_Error with "Index is out of range (too small)"; end if; ! if Index > Container.Last then ! if Index > Container.Last + 1 then raise Constraint_Error with "Index is out of range (too large)"; end if; return; end if; if Count = 0 then return; end if; if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; ! declare ! I_As_Int : constant Int := Int (Index); ! Old_Last_As_Int : constant Int := Index_Type'Pos (Container.Last); ! Count1 : constant Int'Base := Count_Type'Pos (Count); ! Count2 : constant Int'Base := Old_Last_As_Int - I_As_Int + 1; ! N : constant Int'Base := Int'Min (Count1, Count2); ! J_As_Int : constant Int'Base := I_As_Int + N; ! begin ! if J_As_Int > Old_Last_As_Int then ! Container.Last := Index - 1; ! else ! declare ! J : constant Index_Type := Index_Type (J_As_Int); ! EA : Elements_Array renames Container.Elements.EA; ! New_Last_As_Int : constant Int'Base := Old_Last_As_Int - N; ! New_Last : constant Index_Type := ! Index_Type (New_Last_As_Int); ! begin ! EA (Index .. New_Last) := EA (J .. Container.Last); ! Container.Last := New_Last; ! end; ! end if; end; end Delete; --- 467,583 ---- Index : Extended_Index; Count : Count_Type := 1) is + Old_Last : constant Index_Type'Base := Container.Last; + New_Last : Index_Type'Base; + Count2 : Count_Type'Base; -- count of items from Index to Old_Last + J : Index_Type'Base; -- first index of items that slide down + begin + -- Delete removes items from the vector, the number of which is the + -- minimum of the specified Count and the items (if any) that exist from + -- Index to Container.Last. There are no constraints on the specified + -- value of Count (it can be larger than what's available at this + -- position in the vector, for example), but there are constraints on + -- the allowed values of the Index. + + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying which items + -- should be deleted, so we must manually check. (That the user is + -- allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + if Index < Index_Type'First then raise Constraint_Error with "Index is out of range (too small)"; end if; ! -- We do allow a value greater than Container.Last to be specified as ! -- the Index, but only if it's immediately greater. This allows the ! -- corner case of deleting no items from the back end of the vector to ! -- be treated as a no-op. (It is assumed that specifying an index value ! -- greater than Last + 1 indicates some deeper flaw in the caller's ! -- algorithm, so that case is treated as a proper error.) ! ! if Index > Old_Last then ! if Index > Old_Last + 1 then raise Constraint_Error with "Index is out of range (too large)"; end if; return; end if; + -- Here and elsewhere we treat deleting 0 items from the container as a + -- no-op, even when the container is busy, so we simply return. + if Count = 0 then return; end if; + -- The tampering bits exist to prevent an item from being deleted (or + -- otherwise harmfully manipulated) while it is being visited. Query, + -- Update, and Iterate increment the busy count on entry, and decrement + -- the count on exit. Delete checks the count to determine whether it is + -- being called while the associated callback procedure is executing. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; ! -- We first calculate what's available for deletion starting at ! -- Index. Here and elsewhere we use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate values. (See function ! -- Length for more information.) ! if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then ! Count2 := Count_Type'Base (Old_Last) - Count_Type'Base (Index) + 1; ! else ! Count2 := Count_Type'Base (Old_Last - Index + 1); ! end if; ! -- If more elements are requested (Count) for deletion than are ! -- available (Count2) for deletion beginning at Index, then everything ! -- from Index is deleted. There are no elements to slide down, and so ! -- all we need to do is set the value of Container.Last. ! if Count >= Count2 then ! Container.Last := Index - 1; ! return; ! end if; ! -- There are some elements aren't being deleted (the requested count was ! -- less than the available count), so we must slide them down to ! -- Index. We first calculate the index values of the respective array ! -- slices, using the wider of Index_Type'Base and Count_Type'Base as the ! -- type for intermediate calculations. For the elements that slide down, ! -- index value New_Last is the last index value of their new home, and ! -- index value J is the first index of their old home. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! New_Last := Old_Last - Index_Type'Base (Count); ! J := Index + Index_Type'Base (Count); ! ! else ! New_Last := Index_Type'Base (Count_Type'Base (Old_Last) - Count); ! J := Index_Type'Base (Count_Type'Base (Index) + Count); ! end if; ! ! -- The internal elements array isn't guaranteed to exist unless we have ! -- elements, but we have that guarantee here because we know we have ! -- elements to slide. The array index values for each slice have ! -- already been determined, so we just slide down to Index the elements ! -- that weren't deleted. ! ! declare ! EA : Elements_Array renames Container.Elements.EA; ! ! begin ! EA (Index .. New_Last) := EA (J .. Old_Last); ! Container.Last := New_Last; end; end Delete; *************** package body Ada.Containers.Vectors is *** 476,499 **** (Container : in out Vector; Count : Count_Type := 1) is - Index : Int'Base; - begin if Count = 0 then return; end if; if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; ! Index := Int'Base (Container.Last) - Int'Base (Count); ! Container.Last := ! (if Index < Index_Type'Pos (Index_Type'First) ! then No_Index ! else Index_Type (Index)); end Delete_Last; ------------- --- 634,681 ---- (Container : in out Vector; Count : Count_Type := 1) is begin + -- It is not permitted to delete items while the container is busy (for + -- example, we're in the middle of a passive iteration). However, we + -- always treat deleting 0 items as a no-op, even when we're busy, so we + -- simply return without checking. + if Count = 0 then return; end if; + -- The tampering bits exist to prevent an item from being deleted (or + -- otherwise harmfully manipulated) while it is being visited. Query, + -- Update, and Iterate increment the busy count on entry, and decrement + -- the count on exit. Delete_Last checks the count to determine whether + -- it is being called while the associated callback procedure is + -- executing. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; ! -- There is no restriction on how large Count can be when deleting ! -- items. If it is equal or greater than the current length, then this ! -- is equivalent to clearing the vector. (In particular, there's no need ! -- for us to actually calculate the new value for Last.) ! -- If the requested count is less than the current length, then we must ! -- calculate the new value for Last. For the type we use the widest of ! -- Index_Type'Base and Count_Type'Base for the intermediate values of ! -- our calculation. (See the comments in Length for more information.) ! ! if Count >= Container.Length then ! Container.Last := No_Index; ! ! elsif Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Container.Last := Container.Last - Index_Type'Base (Count); ! ! else ! Container.Last := ! Index_Type'Base (Count_Type'Base (Container.Last) - Count); ! end if; end Delete_Last; ------------- *************** package body Ada.Containers.Vectors is *** 535,541 **** begin if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; Container.Elements := null; --- 717,723 ---- begin if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; Container.Elements := null; *************** package body Ada.Containers.Vectors is *** 680,686 **** if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; Target.Set_Length (Length (Target) + Length (Source)); --- 862,868 ---- if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; Target.Set_Length (Length (Target) + Length (Source)); *************** package body Ada.Containers.Vectors is *** 741,747 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; Sort (Container.Elements.EA (Index_Type'First .. Container.Last)); --- 923,929 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; Sort (Container.Elements.EA (Index_Type'First .. Container.Last)); *************** package body Ada.Containers.Vectors is *** 772,793 **** New_Item : Element_Type; Count : Count_Type := 1) is ! N : constant Int := Count_Type'Pos (Count); ! First : constant Int := Int (Index_Type'First); ! New_Last_As_Int : Int'Base; ! New_Last : Index_Type; ! New_Length : UInt; ! Max_Length : constant UInt := UInt (Count_Type'Last); ! Dst : Elements_Access; begin if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; if Before > Container.Last and then Before > Container.Last + 1 then --- 954,995 ---- New_Item : Element_Type; Count : Count_Type := 1) is ! Old_Length : constant Count_Type := Container.Length; ! Max_Length : Count_Type'Base; -- determined from range of Index_Type ! New_Length : Count_Type'Base; -- sum of current length and Count ! New_Last : Index_Type'Base; -- last index of vector after insertion ! Index : Index_Type'Base; -- scratch for intermediate values ! J : Count_Type'Base; -- scratch ! ! New_Capacity : Count_Type'Base; -- length of new, expanded array ! Dst_Last : Index_Type'Base; -- last index of new, expanded array ! Dst : Elements_Access; -- new, expanded internal array begin + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying where the new + -- items should be inserted, so we must manually check. (That the user + -- is allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows for the + -- case of appending items to the back end of the vector. (It is assumed + -- that specifying an index value greater than Last + 1 indicates some + -- deeper flaw in the caller's algorithm, so that case is treated as a + -- proper error.) + if Before > Container.Last and then Before > Container.Last + 1 then *************** package body Ada.Containers.Vectors is *** 795,861 **** "Before index is out of range (too large)"; end if; if Count = 0 then return; end if; ! declare ! Old_Last_As_Int : constant Int := Int (Container.Last); ! begin ! if Old_Last_As_Int > Int'Last - N then ! raise Constraint_Error with "new length is out of range"; ! end if; ! New_Last_As_Int := Old_Last_As_Int + N; ! if New_Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Length := UInt (New_Last_As_Int - First + Int'(1)); ! if New_Length > Max_Length then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Last := Index_Type (New_Last_As_Int); ! end; ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; if Container.Elements = null then Container.Elements := new Elements_Type' (Last => New_Last, EA => (others => New_Item)); Container.Last := New_Last; return; end if; ! if New_Last <= Container.Elements.Last then declare EA : Elements_Array renames Container.Elements.EA; begin ! if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! begin ! EA (Index .. New_Last) := EA (Before .. Container.Last); ! EA (Before .. Index_Type'Pred (Index)) := ! (others => New_Item); ! end; ! else ! EA (Before .. New_Last) := (others => New_Item); end if; end; --- 997,1188 ---- "Before index is out of range (too large)"; end if; + -- We treat inserting 0 items into the container as a no-op, even when + -- the container is busy, so we simply return. + if Count = 0 then return; end if; ! -- There are two constraints we need to satisfy. The first constraint is ! -- that a container cannot have more than Count_Type'Last elements, so ! -- we must check the sum of the current length and the insertion ! -- count. Note that we cannot simply add these values, because of the ! -- possibility of overflow. ! if Old_Length > Count_Type'Last - Count then ! raise Constraint_Error with "Count is out of range"; ! end if; ! -- It is now safe compute the length of the new vector, without fear of ! -- overflow. ! New_Length := Old_Length + Count; ! ! -- The second constraint is that the new Last index value cannot exceed ! -- Index_Type'Last. In each branch below, we calculate the maximum ! -- length (computed from the range of values in Index_Type), and then ! -- compare the new length to the maximum length. If the new length is ! -- acceptable, then we compute the new last index from that. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We have to handle the case when there might be more values in the ! -- range of Index_Type than in the range of Count_Type. ! ! if Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is ! -- less than 0, so it is safe to compute the following sum without ! -- fear of overflow. ! ! Index := No_Index + Index_Type'Base (Count_Type'Last); ! ! if Index <= Index_Type'Last then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the ! -- maximum number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than in Count_Type, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); ! end if; ! ! else ! -- No_Index is equal or greater than 0, so we can safely compute ! -- the difference without fear of overflow (which we would have to ! -- worry about if No_Index were less than 0, but that case is ! -- handled above). ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); end if; ! elsif Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is less ! -- than 0, so it is safe to compute the following sum without fear of ! -- overflow. ! J := Count_Type'Base (No_Index) + Count_Type'Last; ! ! if J <= Count_Type'Base (Index_Type'Last) then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the maximum ! -- number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than Count_Type does, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); end if; ! else ! -- No_Index is equal or greater than 0, so we can safely compute the ! -- difference without fear of overflow (which we would have to worry ! -- about if No_Index were less than 0, but that case is handled ! -- above). ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); ! end if; ! ! -- We have just computed the maximum length (number of items). We must ! -- now compare the requested length to the maximum length, as we do not ! -- allow a vector expand beyond the maximum (because that would create ! -- an internal array with a last index value greater than ! -- Index_Type'Last, with no way to index those elements). ! ! if New_Length > Max_Length then ! raise Constraint_Error with "Count is out of range"; ! end if; ! ! -- New_Last is the last index value of the items in the container after ! -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to ! -- compute its value from the New_Length. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! New_Last := No_Index + Index_Type'Base (New_Length); ! ! else ! New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length); end if; if Container.Elements = null then + pragma Assert (Container.Last = No_Index); + + -- This is the simplest case, with which we must always begin: we're + -- inserting items into an empty vector that hasn't allocated an + -- internal array yet. Note that we don't need to check the busy bit + -- here, because an empty container cannot be busy. + + -- In order to preserve container invariants, we allocate the new + -- internal array first, before setting the Last index value, in case + -- the allocation fails (which can happen either because there is no + -- storage available, or because element initialization fails). + Container.Elements := new Elements_Type' (Last => New_Last, EA => (others => New_Item)); + + -- The allocation of the new, internal array succeeded, so it is now + -- safe to update the Last index, restoring container invariants. + Container.Last := New_Last; + return; end if; ! -- The tampering bits exist to prevent an item from being harmfully ! -- manipulated while it is being visited. Query, Update, and Iterate ! -- increment the busy count on entry, and decrement the count on ! -- exit. Insert checks the count to determine whether it is being called ! -- while the associated callback procedure is executing. ! ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; ! end if; ! ! -- An internal array has already been allocated, so we must determine ! -- whether there is enough unused storage for the new items. ! ! if New_Length <= Container.Elements.EA'Length then ! -- In this case, we're inserting elements into a vector that has ! -- already allocated an internal array, and the existing array has ! -- enough unused storage for the new items. ! declare EA : Elements_Array renames Container.Elements.EA; begin ! if Before > Container.Last then ! -- The new items are being appended to the vector, so no ! -- sliding of existing elements is required. ! EA (Before .. New_Last) := (others => New_Item); ! else ! -- The new items are being inserted before some existing ! -- elements, so we must slide the existing elements up to their ! -- new home. We use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate index values. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! ! EA (Index .. New_Last) := EA (Before .. Container.Last); ! EA (Before .. Index - 1) := (others => New_Item); end if; end; *************** package body Ada.Containers.Vectors is *** 863,929 **** return; end if; ! declare ! C, CC : UInt; ! begin ! C := UInt'Max (1, Container.Elements.EA'Length); -- ??? ! while C < New_Length loop ! if C > UInt'Last / 2 then ! C := UInt'Last; ! exit; ! end if; ! C := 2 * C; ! end loop; ! if C > Max_Length then ! C := Max_Length; ! end if; ! if Index_Type'First <= 0 ! and then Index_Type'Last >= 0 ! then ! CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1; ! else ! CC := UInt (Int (Index_Type'Last) - First + 1); ! end if; ! if C > CC then ! C := CC; ! end if; ! declare ! Dst_Last : constant Index_Type := ! Index_Type (First + UInt'Pos (C) - 1); ! begin ! Dst := new Elements_Type (Dst_Last); ! end; ! end; declare ! SA : Elements_Array renames Container.Elements.EA; ! DA : Elements_Array renames Dst.EA; begin ! DA (Index_Type'First .. Index_Type'Pred (Before)) := ! SA (Index_Type'First .. Index_Type'Pred (Before)); ! if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! begin ! DA (Before .. Index_Type'Pred (Index)) := (others => New_Item); ! DA (Index .. New_Last) := SA (Before .. Container.Last); ! end; ! else ! DA (Before .. New_Last) := (others => New_Item); end if; exception when others => --- 1190,1268 ---- return; end if; ! -- In this case, we're inserting elements into a vector that has already ! -- allocated an internal array, but the existing array does not have ! -- enough storage, so we must allocate a new, longer array. In order to ! -- guarantee that the amortized insertion cost is O(1), we always ! -- allocate an array whose length is some power-of-two factor of the ! -- current array length. (The new array cannot have a length less than ! -- the New_Length of the container, but its last index value cannot be ! -- greater than Index_Type'Last.) ! New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length); ! while New_Capacity < New_Length loop ! if New_Capacity > Count_Type'Last / 2 then ! New_Capacity := Count_Type'Last; ! exit; ! end if; ! New_Capacity := 2 * New_Capacity; ! end loop; ! if New_Capacity > Max_Length then ! -- We have reached the limit of capacity, so no further expansion ! -- will occur. (This is not a problem, as there is never a need to ! -- have more capacity than the maximum container length.) ! New_Capacity := Max_Length; ! end if; ! -- We have computed the length of the new internal array (and this is ! -- what "vector capacity" means), so use that to compute its last index. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Dst_Last := No_Index + Index_Type'Base (New_Capacity); ! else ! Dst_Last := ! Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity); ! end if; ! ! -- Now we allocate the new, longer internal array. If the allocation ! -- fails, we have not changed any container state, so no side-effect ! -- will occur as a result of propagating the exception. ! ! Dst := new Elements_Type (Dst_Last); ! ! -- We have our new internal array. All that needs to be done now is to ! -- copy the existing items (if any) from the old array (the "source" ! -- array, object SA below) to the new array (the "destination" array, ! -- object DA below), and then deallocate the old array. declare ! SA : Elements_Array renames Container.Elements.EA; -- source ! DA : Elements_Array renames Dst.EA; -- destination begin ! DA (Index_Type'First .. Before - 1) := ! SA (Index_Type'First .. Before - 1); ! if Before > Container.Last then ! DA (Before .. New_Last) := (others => New_Item); ! else ! -- The new items are being inserted before some existing elements, ! -- so we must slide the existing elements up to their new home. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! ! DA (Before .. Index - 1) := (others => New_Item); ! DA (Index .. New_Last) := SA (Before .. Container.Last); end if; exception when others => *************** package body Ada.Containers.Vectors is *** 931,941 **** --- 1270,1292 ---- raise; end; + -- We have successfully copied the items onto the new array, so the + -- final thing to do is deallocate the old array. + declare X : Elements_Access := Container.Elements; begin + -- We first isolate the old internal array, removing it from the + -- container and replacing it with the new internal array, before we + -- deallocate the old array (which can fail if finalization of + -- elements propagates an exception). + Container.Elements := Dst; Container.Last := New_Last; + + -- The container invariants have been restored, so it is now safe to + -- attempt to deallocate the old array. + Free (X); end; end Insert; *************** package body Ada.Containers.Vectors is *** 946,1028 **** New_Item : Vector) is N : constant Count_Type := Length (New_Item); begin ! if Before < Index_Type'First then ! raise Constraint_Error with ! "Before index is out of range (too small)"; end if; ! if Before > Container.Last ! and then Before > Container.Last + 1 ! then ! raise Constraint_Error with ! "Before index is out of range (too large)"; end if; ! if N = 0 then return; end if; ! Insert_Space (Container, Before, Count => N); declare ! Dst_Last_As_Int : constant Int'Base := ! Int'Base (Before) + Int'Base (N) - 1; ! ! Dst_Last : constant Index_Type := Index_Type (Dst_Last_As_Int); ! begin ! if Container'Address /= New_Item'Address then ! Container.Elements.EA (Before .. Dst_Last) := ! New_Item.Elements.EA (Index_Type'First .. New_Item.Last); ! return; ! end if; ! declare ! subtype Src_Index_Subtype is Index_Type'Base range ! Index_Type'First .. Before - 1; ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! Index_As_Int : constant Int'Base := ! Int (Before) + Src'Length - 1; ! Index : constant Index_Type'Base := ! Index_Type'Base (Index_As_Int); ! Dst : Elements_Array renames ! Container.Elements.EA (Before .. Index); ! begin ! Dst := Src; ! end; - if Dst_Last = Container.Last then return; end if; ! declare ! subtype Src_Index_Subtype is Index_Type'Base range ! Dst_Last + 1 .. Container.Last; ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! Index_As_Int : constant Int'Base := ! Dst_Last_As_Int - Src'Length + 1; ! Index : constant Index_Type := ! Index_Type (Index_As_Int); ! Dst : Elements_Array renames ! Container.Elements.EA (Index .. Dst_Last); ! begin ! Dst := Src; ! end; end; end Insert; --- 1297,1414 ---- New_Item : Vector) is N : constant Count_Type := Length (New_Item); + J : Index_Type'Base; begin ! -- Use Insert_Space to create the "hole" (the destination slice) into ! -- which we copy the source items. ! ! Insert_Space (Container, Before, Count => N); ! ! if N = 0 then ! -- There's nothing else to do here (vetting of parameters was ! -- performed already in Insert_Space), so we simply return. ! ! return; end if; ! -- We calculate the last index value of the destination slice using the ! -- wider of Index_Type'Base and count_Type'Base. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! J := (Before - 1) + Index_Type'Base (N); ! ! else ! J := Index_Type'Base (Count_Type'Base (Before - 1) + N); end if; ! if Container'Address /= New_Item'Address then ! -- This is the simple case. New_Item denotes an object different ! -- from Container, so there's nothing special we need to do to copy ! -- the source items to their destination, because all of the source ! -- items are contiguous. ! ! Container.Elements.EA (Before .. J) := ! New_Item.Elements.EA (Index_Type'First .. New_Item.Last); ! return; end if; ! -- New_Item denotes the same object as Container, so an insertion has ! -- potentially split the source items. The destination is always the ! -- range [Before, J], but the source is [Index_Type'First, Before) and ! -- (J, Container.Last]. We perform the copy in two steps, using each of ! -- the two slices of the source items. declare ! L : constant Index_Type'Base := Before - 1; ! subtype Src_Index_Subtype is Index_Type'Base range ! Index_Type'First .. L; ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! K : Index_Type'Base; ! begin ! -- We first copy the source items that precede the space we ! -- inserted. Index value K is the last index of that portion ! -- destination that receives this slice of the source. (If Before ! -- equals Index_Type'First, then this first source slice will be ! -- empty, which is harmless.) ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! K := L + Index_Type'Base (Src'Length); ! else ! K := Index_Type'Base (Count_Type'Base (L) + Src'Length); ! end if; ! Container.Elements.EA (Before .. K) := Src; ! if Src'Length = N then ! -- The new items were effectively appended to the container, so we ! -- have already copied all of the items that need to be copied. ! -- We return early here, even though the source slice below is ! -- empty (so the assignment would be harmless), because we want to ! -- avoid computing J + 1, which will overflow if J equals ! -- Index_Type'Base'Last. return; end if; + end; ! declare ! -- Note that we want to avoid computing J + 1 here, in case J equals ! -- Index_Type'Base'Last. We prevent that by returning early above, ! -- immediately after copying the first slice of the source, and ! -- determining that this second slice of the source is empty. ! F : constant Index_Type'Base := J + 1; ! subtype Src_Index_Subtype is Index_Type'Base range ! F .. Container.Last; ! Src : Elements_Array renames ! Container.Elements.EA (Src_Index_Subtype); ! K : Index_Type'Base; ! begin ! -- We next copy the source items that follow the space we ! -- inserted. Index value K is the first index of that portion of the ! -- destination that receives this slice of the source. (For the ! -- reasons given above, this slice is guaranteed to be non-empty.) ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! K := F - Index_Type'Base (Src'Length); ! ! else ! K := Index_Type'Base (Count_Type'Base (F) - Src'Length); ! end if; ! ! Container.Elements.EA (K .. J) := Src; end; end Insert; *************** package body Ada.Containers.Vectors is *** 1224,1245 **** Before : Extended_Index; Count : Count_Type := 1) is ! N : constant Int := Count_Type'Pos (Count); ! First : constant Int := Int (Index_Type'First); ! New_Last_As_Int : Int'Base; ! New_Last : Index_Type; ! New_Length : UInt; ! Max_Length : constant UInt := UInt (Count_Type'Last); ! Dst : Elements_Access; begin if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; if Before > Container.Last and then Before > Container.Last + 1 then --- 1610,1651 ---- Before : Extended_Index; Count : Count_Type := 1) is ! Old_Length : constant Count_Type := Container.Length; ! Max_Length : Count_Type'Base; -- determined from range of Index_Type ! New_Length : Count_Type'Base; -- sum of current length and Count ! New_Last : Index_Type'Base; -- last index of vector after insertion ! Index : Index_Type'Base; -- scratch for intermediate values ! J : Count_Type'Base; -- scratch ! ! New_Capacity : Count_Type'Base; -- length of new, expanded array ! Dst_Last : Index_Type'Base; -- last index of new, expanded array ! Dst : Elements_Access; -- new, expanded internal array begin + -- As a precondition on the generic actual Index_Type, the base type + -- must include Index_Type'Pred (Index_Type'First); this is the value + -- that Container.Last assumes when the vector is empty. However, we do + -- not allow that as the value for Index when specifying where the new + -- items should be inserted, so we must manually check. (That the user + -- is allowed to specify the value at all here is a consequence of the + -- declaration of the Extended_Index subtype, which includes the values + -- in the base range that immediately precede and immediately follow the + -- values in the Index_Type.) + if Before < Index_Type'First then raise Constraint_Error with "Before index is out of range (too small)"; end if; + -- We do allow a value greater than Container.Last to be specified as + -- the Index, but only if it's immediately greater. This allows for the + -- case of appending items to the back end of the vector. (It is assumed + -- that specifying an index value greater than Last + 1 indicates some + -- deeper flaw in the caller's algorithm, so that case is treated as a + -- proper error.) + if Before > Container.Last and then Before > Container.Last + 1 then *************** package body Ada.Containers.Vectors is *** 1247,1304 **** "Before index is out of range (too large)"; end if; if Count = 0 then return; end if; ! declare ! Old_Last_As_Int : constant Int := Int (Container.Last); ! begin ! if Old_Last_As_Int > Int'Last - N then ! raise Constraint_Error with "new length is out of range"; ! end if; ! New_Last_As_Int := Old_Last_As_Int + N; ! if New_Last_As_Int > Int (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Length := UInt (New_Last_As_Int - First + Int'(1)); ! if New_Length > Max_Length then ! raise Constraint_Error with "new length is out of range"; end if; ! New_Last := Index_Type (New_Last_As_Int); ! end; ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; if Container.Elements = null then Container.Elements := new Elements_Type (New_Last); Container.Last := New_Last; return; end if; if New_Last <= Container.Elements.Last then declare EA : Elements_Array renames Container.Elements.EA; begin if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! begin ! EA (Index .. New_Last) := EA (Before .. Container.Last); ! end; end if; end; --- 1653,1836 ---- "Before index is out of range (too large)"; end if; + -- We treat inserting 0 items into the container as a no-op, even when + -- the container is busy, so we simply return. + if Count = 0 then return; end if; ! -- There are two constraints we need to satisfy. The first constraint is ! -- that a container cannot have more than Count_Type'Last elements, so ! -- we must check the sum of the current length and the insertion ! -- count. Note that we cannot simply add these values, because of the ! -- possibility of overflow. ! if Old_Length > Count_Type'Last - Count then ! raise Constraint_Error with "Count is out of range"; ! end if; ! -- It is now safe compute the length of the new vector, without fear of ! -- overflow. ! New_Length := Old_Length + Count; ! ! -- The second constraint is that the new Last index value cannot exceed ! -- Index_Type'Last. In each branch below, we calculate the maximum ! -- length (computed from the range of values in Index_Type), and then ! -- compare the new length to the maximum length. If the new length is ! -- acceptable, then we compute the new last index from that. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We have to handle the case when there might be more values in the ! -- range of Index_Type than in the range of Count_Type. ! ! if Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is ! -- less than 0, so it is safe to compute the following sum without ! -- fear of overflow. ! ! Index := No_Index + Index_Type'Base (Count_Type'Last); ! ! if Index <= Index_Type'Last then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the ! -- maximum number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than in Count_Type, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); ! end if; ! ! else ! -- No_Index is equal or greater than 0, so we can safely compute ! -- the difference without fear of overflow (which we would have to ! -- worry about if No_Index were less than 0, but that case is ! -- handled above). ! ! Max_Length := Count_Type'Base (Index_Type'Last - No_Index); end if; ! elsif Index_Type'First <= 0 then ! -- We know that No_Index (the same as Index_Type'First - 1) is less ! -- than 0, so it is safe to compute the following sum without fear of ! -- overflow. ! J := Count_Type'Base (No_Index) + Count_Type'Last; ! ! if J <= Count_Type'Base (Index_Type'Last) then ! -- We have determined that range of Index_Type has at least as ! -- many values as in Count_Type, so Count_Type'Last is the maximum ! -- number of items that are allowed. ! ! Max_Length := Count_Type'Last; ! ! else ! -- The range of Index_Type has fewer values than Count_Type does, ! -- so the maximum number of items is computed from the range of ! -- the Index_Type. ! ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); end if; ! else ! -- No_Index is equal or greater than 0, so we can safely compute the ! -- difference without fear of overflow (which we would have to worry ! -- about if No_Index were less than 0, but that case is handled ! -- above). ! Max_Length := ! Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index); ! end if; ! ! -- We have just computed the maximum length (number of items). We must ! -- now compare the requested length to the maximum length, as we do not ! -- allow a vector expand beyond the maximum (because that would create ! -- an internal array with a last index value greater than ! -- Index_Type'Last, with no way to index those elements). ! ! if New_Length > Max_Length then ! raise Constraint_Error with "Count is out of range"; ! end if; ! ! -- New_Last is the last index value of the items in the container after ! -- insertion. Use the wider of Index_Type'Base and Count_Type'Base to ! -- compute its value from the New_Length. ! ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! New_Last := No_Index + Index_Type'Base (New_Length); ! ! else ! New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length); end if; if Container.Elements = null then + pragma Assert (Container.Last = No_Index); + + -- This is the simplest case, with which we must always begin: we're + -- inserting items into an empty vector that hasn't allocated an + -- internal array yet. Note that we don't need to check the busy bit + -- here, because an empty container cannot be busy. + + -- In order to preserve container invariants, we allocate the new + -- internal array first, before setting the Last index value, in case + -- the allocation fails (which can happen either because there is no + -- storage available, or because default-valued element + -- initialization fails). + Container.Elements := new Elements_Type (New_Last); + + -- The allocation of the new, internal array succeeded, so it is now + -- safe to update the Last index, restoring container invariants. + Container.Last := New_Last; + return; end if; + -- The tampering bits exist to prevent an item from being harmfully + -- manipulated while it is being visited. Query, Update, and Iterate + -- increment the busy count on entry, and decrement the count on + -- exit. Insert checks the count to determine whether it is being called + -- while the associated callback procedure is executing. + + if Container.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (vector is busy)"; + end if; + + -- An internal array has already been allocated, so we must determine + -- whether there is enough unused storage for the new items. + if New_Last <= Container.Elements.Last then + -- In this case, we're inserting space into a vector that has already + -- allocated an internal array, and the existing array has enough + -- unused storage for the new items. + declare EA : Elements_Array renames Container.Elements.EA; + begin if Before <= Container.Last then ! -- The space is being inserted before some existing elements, ! -- so we must slide the existing elements up to their new ! -- home. We use the wider of Index_Type'Base and ! -- Count_Type'Base as the type for intermediate index values. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! ! EA (Index .. New_Last) := EA (Before .. Container.Last); end if; end; *************** package body Ada.Containers.Vectors is *** 1306,1368 **** return; end if; ! declare ! C, CC : UInt; ! begin ! C := UInt'Max (1, Container.Elements.EA'Length); -- ??? ! while C < New_Length loop ! if C > UInt'Last / 2 then ! C := UInt'Last; ! exit; ! end if; ! C := 2 * C; ! end loop; ! if C > Max_Length then ! C := Max_Length; ! end if; ! if Index_Type'First <= 0 ! and then Index_Type'Last >= 0 ! then ! CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1; ! else ! CC := UInt (Int (Index_Type'Last) - First + 1); ! end if; ! if C > CC then ! C := CC; ! end if; ! declare ! Dst_Last : constant Index_Type := ! Index_Type (First + UInt'Pos (C) - 1); ! begin ! Dst := new Elements_Type (Dst_Last); ! end; ! end; declare ! SA : Elements_Array renames Container.Elements.EA; ! DA : Elements_Array renames Dst.EA; begin ! DA (Index_Type'First .. Index_Type'Pred (Before)) := ! SA (Index_Type'First .. Index_Type'Pred (Before)); if Before <= Container.Last then ! declare ! Index_As_Int : constant Int'Base := ! Index_Type'Pos (Before) + N; ! Index : constant Index_Type := Index_Type (Index_As_Int); ! begin ! DA (Index .. New_Last) := SA (Before .. Container.Last); ! end; end if; exception when others => --- 1838,1912 ---- return; end if; ! -- In this case, we're inserting space into a vector that has already ! -- allocated an internal array, but the existing array does not have ! -- enough storage, so we must allocate a new, longer array. In order to ! -- guarantee that the amortized insertion cost is O(1), we always ! -- allocate an array whose length is some power-of-two factor of the ! -- current array length. (The new array cannot have a length less than ! -- the New_Length of the container, but its last index value cannot be ! -- greater than Index_Type'Last.) ! New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length); ! while New_Capacity < New_Length loop ! if New_Capacity > Count_Type'Last / 2 then ! New_Capacity := Count_Type'Last; ! exit; ! end if; ! New_Capacity := 2 * New_Capacity; ! end loop; ! if New_Capacity > Max_Length then ! -- We have reached the limit of capacity, so no further expansion ! -- will occur. (This is not a problem, as there is never a need to ! -- have more capacity than the maximum container length.) ! New_Capacity := Max_Length; ! end if; ! -- We have computed the length of the new internal array (and this is ! -- what "vector capacity" means), so use that to compute its last index. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Dst_Last := No_Index + Index_Type'Base (New_Capacity); ! else ! Dst_Last := ! Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity); ! end if; ! ! -- Now we allocate the new, longer internal array. If the allocation ! -- fails, we have not changed any container state, so no side-effect ! -- will occur as a result of propagating the exception. ! ! Dst := new Elements_Type (Dst_Last); ! ! -- We have our new internal array. All that needs to be done now is to ! -- copy the existing items (if any) from the old array (the "source" ! -- array, object SA below) to the new array (the "destination" array, ! -- object DA below), and then deallocate the old array. declare ! SA : Elements_Array renames Container.Elements.EA; -- source ! DA : Elements_Array renames Dst.EA; -- destination begin ! DA (Index_Type'First .. Before - 1) := ! SA (Index_Type'First .. Before - 1); if Before <= Container.Last then ! -- The space is being inserted before some existing elements, so ! -- we must slide the existing elements up to their new home. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! Index := Before + Index_Type'Base (Count); ! else ! Index := Index_Type'Base (Count_Type'Base (Before) + Count); ! end if; ! ! DA (Index .. New_Last) := SA (Before .. Container.Last); end if; exception when others => *************** package body Ada.Containers.Vectors is *** 1370,1380 **** --- 1914,1937 ---- raise; end; + -- We have successfully copied the items onto the new array, so the + -- final thing to do is restore invariants, and deallocate the old + -- array. + declare X : Elements_Access := Container.Elements; begin + -- We first isolate the old internal array, removing it from the + -- container and replacing it with the new internal array, before we + -- deallocate the old array (which can fail if finalization of + -- elements propagates an exception). + Container.Elements := Dst; Container.Last := New_Last; + + -- The container invariants have been restored, so it is now safe to + -- attempt to deallocate the old array. + Free (X); end; end Insert_Space; *************** package body Ada.Containers.Vectors is *** 1501,1512 **** ------------ function Length (Container : Vector) return Count_Type is ! L : constant Int := Int (Container.Last); ! F : constant Int := Int (Index_Type'First); ! N : constant Int'Base := L - F + 1; begin ! return Count_Type (N); end Length; ---------- --- 2058,2090 ---- ------------ function Length (Container : Vector) return Count_Type is ! L : constant Index_Type'Base := Container.Last; ! F : constant Index_Type := Index_Type'First; begin ! -- The base range of the index type (Index_Type'Base) might not include ! -- all values for length (Count_Type). Contrariwise, the index type ! -- might include values outside the range of length. Hence we use ! -- whatever type is wider for intermediate values when calculating ! -- length. Note that no matter what the index type is, the maximum ! -- length to which a vector is allowed to grow is always the minimum ! -- of Count_Type'Last and (IT'Last - IT'First + 1). ! ! -- For example, an Index_Type with range -127 .. 127 is only guaranteed ! -- to have a base range of -128 .. 127, but the corresponding vector ! -- would have lengths in the range 0 .. 255. In this case we would need ! -- to use Count_Type'Base for intermediate values. ! ! -- Another case would be the index range -2**63 + 1 .. -2**63 + 10. The ! -- vector would have a maximum length of 10, but the index values lie ! -- outside the range of Count_Type (which is only 32 bits). In this ! -- case we would need to use Index_Type'Base for intermediate values. ! ! if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then ! return Count_Type'Base (L) - Count_Type'Base (F) + 1; ! else ! return Count_Type (L - F + 1); ! end if; end Length; ---------- *************** package body Ada.Containers.Vectors is *** 1524,1535 **** if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (Target is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (Source is busy)"; end if; declare --- 2102,2113 ---- if Target.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (Target is busy)"; end if; if Source.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (Source is busy)"; end if; declare *************** package body Ada.Containers.Vectors is *** 1725,1731 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; Container.Elements.EA (Index) := New_Item; --- 2303,2309 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; Container.Elements.EA (Index) := New_Item; *************** package body Ada.Containers.Vectors is *** 1751,1757 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; Container.Elements.EA (Position.Index) := New_Item; --- 2329,2335 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; Container.Elements.EA (Position.Index) := New_Item; *************** package body Ada.Containers.Vectors is *** 1767,1786 **** is N : constant Count_Type := Length (Container); begin if Capacity = 0 then if N = 0 then declare X : Elements_Access := Container.Elements; begin Container.Elements := null; Free (X); end; elsif N < Container.Elements.EA'Length then if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; declare --- 2345,2398 ---- is N : constant Count_Type := Length (Container); + Index : Count_Type'Base; + Last : Index_Type'Base; + begin + -- Reserve_Capacity can be used to either expand the storage available + -- for elements (this would be its typical use, in anticipation of + -- future insertion), or to trim back storage. In the latter case, + -- storage can only be trimmed back to the limit of the container + -- length. Note that Reserve_Capacity neither deletes (active) elements + -- nor inserts elements; it only affects container capacity, never + -- container length. + if Capacity = 0 then + -- This is a request to trim back storage, to the minimum amount + -- possible given the current state of the container. + if N = 0 then + -- The container is empty, so in this unique case we can + -- deallocate the entire internal array. Note that an empty + -- container can never be busy, so there's no need to check the + -- tampering bits. + declare X : Elements_Access := Container.Elements; begin + -- First we remove the internal array from the container, to + -- handle the case when the deallocation raises an exception. + Container.Elements := null; + + -- Container invariants have been restored, so it is now safe + -- to attempt to deallocate the internal array. + Free (X); end; elsif N < Container.Elements.EA'Length then + -- The container is not empty, and the current length is less than + -- the current capacity, so there's storage available to trim. In + -- this case, we allocate a new internal array having a length + -- that exactly matches the number of items in the + -- container. (Reserve_Capacity does not delete active elements, + -- so this is the best we can do with respect to minimizing + -- storage). + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; declare *************** package body Ada.Containers.Vectors is *** 1793,1799 **** --- 2405,2427 ---- X : Elements_Access := Container.Elements; begin + -- Although we have isolated the old internal array that we're + -- going to deallocate, we don't deallocate it until we have + -- successfully allocated a new one. If there is an exception + -- during allocation (either because there is not enough + -- storage, or because initialization of the elements fails), + -- we let it propagate without causing any side-effect. + Container.Elements := new Elements_Type'(Container.Last, Src); + + -- We have successfully allocated a new internal array (with a + -- smaller length than the old one, and containing a copy of + -- just the active elements in the container), so it is now + -- safe to attempt to deallocate the old array. The old array + -- has been isolated, and container invariants have been + -- restored, so if the deallocation fails (because finalization + -- of the elements fails), we simply let it propagate. + Free (X); end; end if; *************** package body Ada.Containers.Vectors is *** 1801,1832 **** return; end if; ! if Container.Elements = null then ! declare ! Last_As_Int : constant Int'Base := ! Int (Index_Type'First) + Int (Capacity) - 1; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; ! declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! begin ! Container.Elements := new Elements_Type (Last); ! end; ! end; return; end if; if Capacity <= N then if N < Container.Elements.EA'Length then if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; declare --- 2429,2533 ---- return; end if; ! -- Reserve_Capacity can be used to expand the storage available for ! -- elements, but we do not let the capacity grow beyond the number of ! -- values in Index_Type'Range. (Were it otherwise, there would be no way ! -- to refer to the elements with an index value greater than ! -- Index_Type'Last, so that storage would be wasted.) Here we compute ! -- the Last index value of the new internal array, in a way that avoids ! -- any possibility of overflow. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! if Index_Type'Base'Last - Index_Type'Base (Capacity) < No_Index then ! raise Constraint_Error with "Capacity is out of range"; ! end if; ! ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! ! Last := No_Index + Index_Type'Base (Capacity); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then ! raise Constraint_Error with "Capacity is out of range"; ! end if; ! ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of Capacity. ! ! Index := Count_Type'Base (No_Index) + Capacity; -- Last ! ! if Index > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "Capacity is out of range"; ! end if; + -- We know that the computed value (having type Count_Type) of Last + -- is within the range of the generic actual index subtype, so it is + -- safe to convert to Index_Type: + + Last := Index_Type'Base (Index); + + else + -- Here Index_Type'First (and Index_Type'Last) is positive, so we + -- must test the length indirectly (by working backwards from the + -- largest possible value of Last), in order to prevent overflow. + + Index := Count_Type'Base (Index_Type'Last) - Capacity; -- No_Index + + if Index < Count_Type'Base (No_Index) then + raise Constraint_Error with "Capacity is out of range"; + end if; + + -- We have determined that the value of Capacity would not create a + -- Last index value outside of the range of Index_Type, so we can now + -- safely compute its value. + + Last := Index_Type'Base (Count_Type'Base (No_Index) + Capacity); + end if; + + -- The requested capacity is non-zero, but we don't know yet whether + -- this is a request for expansion or contraction of storage. + + if Container.Elements = null then + -- The container is empty (it doesn't even have an internal array), + -- so this represents a request to allocate (expand) storage having + -- the given capacity. + + Container.Elements := new Elements_Type (Last); return; end if; if Capacity <= N then + -- This is a request to trim back storage, but only to the limit of + -- what's already in the container. (Reserve_Capacity never deletes + -- active elements, it only reclaims excess storage.) + if N < Container.Elements.EA'Length then + -- The container is not empty (because the requested capacity is + -- positive, and less than or equal to the container length), and + -- the current length is less than the current capacity, so + -- there's storage available to trim. In this case, we allocate a + -- new internal array having a length that exactly matches the + -- number of items in the container. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; declare *************** package body Ada.Containers.Vectors is *** 1839,1901 **** X : Elements_Access := Container.Elements; begin Container.Elements := new Elements_Type'(Container.Last, Src); Free (X); end; - end if; return; end if; if Capacity = Container.Elements.EA'Length then return; end if; if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; end if; declare ! Last_As_Int : constant Int'Base := ! Int (Index_Type'First) + Int (Capacity) - 1; begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then ! raise Constraint_Error with "new length is out of range"; ! end if; declare ! Last : constant Index_Type := Index_Type (Last_As_Int); ! E : Elements_Access := new Elements_Type (Last); begin ! declare ! subtype Index_Subtype is Index_Type'Base range ! Index_Type'First .. Container.Last; ! Src : Elements_Array renames ! Container.Elements.EA (Index_Subtype); ! Tgt : Elements_Array renames E.EA (Index_Subtype); ! begin ! Tgt := Src; ! exception ! when others => ! Free (E); ! raise; ! end; ! declare ! X : Elements_Access := Container.Elements; ! begin ! Container.Elements := E; ! Free (X); ! end; end; end; end Reserve_Capacity; --- 2540,2638 ---- X : Elements_Access := Container.Elements; begin + -- Although we have isolated the old internal array that we're + -- going to deallocate, we don't deallocate it until we have + -- successfully allocated a new one. If there is an exception + -- during allocation (either because there is not enough + -- storage, or because initialization of the elements fails), + -- we let it propagate without causing any side-effect. + Container.Elements := new Elements_Type'(Container.Last, Src); + + -- We have successfully allocated a new internal array (with a + -- smaller length than the old one, and containing a copy of + -- just the active elements in the container), so it is now + -- safe to attempt to deallocate the old array. The old array + -- has been isolated, and container invariants have been + -- restored, so if the deallocation fails (because finalization + -- of the elements fails), we simply let it propagate. + Free (X); end; end if; return; end if; + -- The requested capacity is larger than the container length (the + -- number of active elements). Whether this represents a request for + -- expansion or contraction of the current capacity depends on what the + -- current capacity is. + if Capacity = Container.Elements.EA'Length then + -- The requested capacity matches the existing capacity, so there's + -- nothing to do here. We treat this case as a no-op, and simply + -- return without checking the busy bit. + return; end if; + -- There is a change in the capacity of a non-empty container, so a new + -- internal array will be allocated. (The length of the new internal + -- array could be less or greater than the old internal array. We know + -- only that the length of the new internal array is greater than the + -- number of active elements in the container.) We must check whether + -- the container is busy before doing anything else. + if Container.Busy > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is busy)"; end if; + -- We now allocate a new internal array, having a length different from + -- its current value. + declare ! E : Elements_Access := new Elements_Type (Last); begin ! -- We have successfully allocated the new internal array. We first ! -- attempt to copy the existing elements from the old internal array ! -- ("src" elements) onto the new internal array ("tgt" elements). declare ! subtype Index_Subtype is Index_Type'Base range ! Index_Type'First .. Container.Last; ! Src : Elements_Array renames ! Container.Elements.EA (Index_Subtype); ! ! Tgt : Elements_Array renames E.EA (Index_Subtype); begin ! Tgt := Src; ! exception ! when others => ! Free (E); ! raise; ! end; ! -- We have successfully copied the existing elements onto the new ! -- internal array, so now we can attempt to deallocate the old one. ! declare ! X : Elements_Access := Container.Elements; ! begin ! -- First we isolate the old internal array, and replace it in the ! -- container with the new internal array. ! Container.Elements := E; ! -- Container invariants have been restored, so it is now safe to ! -- attempt to deallocate the old internal array. ! ! Free (X); end; end; end Reserve_Capacity; *************** package body Ada.Containers.Vectors is *** 1912,1918 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; declare --- 2649,2655 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; declare *************** package body Ada.Containers.Vectors is *** 2023,2048 **** ---------------- procedure Set_Length (Container : in out Vector; Length : Count_Type) is begin ! if Length = Vectors.Length (Container) then ! return; ! end if; ! if Container.Busy > 0 then ! raise Program_Error with ! "attempt to tamper with elements (vector is busy)"; ! end if; ! if Length > Capacity (Container) then ! Reserve_Capacity (Container, Capacity => Length); ! end if; ! declare ! Last_As_Int : constant Int'Base := ! Int (Index_Type'First) + Int (Length) - 1; ! begin ! Container.Last := Index_Type'Base (Last_As_Int); ! end; end Set_Length; ---------- --- 2760,2784 ---- ---------------- procedure Set_Length (Container : in out Vector; Length : Count_Type) is + Count : constant Count_Type'Base := Container.Length - Length; + begin ! -- Set_Length allows the user to set the length explicitly, instead of ! -- implicitly as a side-effect of deletion or insertion. If the ! -- requested length is less then the current length, this is equivalent ! -- to deleting items from the back end of the vector. If the requested ! -- length is greater than the current length, then this is equivalent to ! -- inserting "space" (nonce items) at the end. ! if Count >= 0 then ! Container.Delete_Last (Count); ! elsif Container.Last >= Index_Type'Last then ! raise Constraint_Error with "vector is already at its maximum length"; ! else ! Container.Insert_Space (Container.Last + 1, -Count); ! end if; end Set_Length; ---------- *************** package body Ada.Containers.Vectors is *** 2065,2071 **** if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (vector is locked)"; end if; declare --- 2801,2807 ---- if Container.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (vector is locked)"; end if; declare *************** package body Ada.Containers.Vectors is *** 2135,2188 **** --------------- function To_Vector (Length : Count_Type) return Vector is begin if Length = 0 then return Empty_Vector; end if; ! declare ! First : constant Int := Int (Index_Type'First); ! Last_As_Int : constant Int'Base := First + Int (Length) - 1; ! Last : Index_Type; ! Elements : Elements_Access; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then raise Constraint_Error with "Length is out of range"; end if; ! Last := Index_Type (Last_As_Int); ! Elements := new Elements_Type (Last); ! return Vector'(Controlled with Elements, Last, 0, 0); ! end; end To_Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector is begin if Length = 0 then return Empty_Vector; end if; ! declare ! First : constant Int := Int (Index_Type'First); ! Last_As_Int : constant Int'Base := First + Int (Length) - 1; ! Last : Index_Type; ! Elements : Elements_Access; ! begin ! if Last_As_Int > Index_Type'Pos (Index_Type'Last) then raise Constraint_Error with "Length is out of range"; end if; ! Last := Index_Type (Last_As_Int); ! Elements := new Elements_Type'(Last, EA => (others => New_Item)); ! return Vector'(Controlled with Elements, Last, 0, 0); ! end; end To_Vector; -------------------- --- 2871,3046 ---- --------------- function To_Vector (Length : Count_Type) return Vector is + Index : Count_Type'Base; + Last : Index_Type'Base; + Elements : Elements_Access; + begin if Length = 0 then return Empty_Vector; end if; ! -- We create a vector object with a capacity that matches the specified ! -- Length, but we do not allow the vector capacity (the length of the ! -- internal array) to exceed the number of values in Index_Type'Range ! -- (otherwise, there would be no way to refer to those components via an ! -- index). We must therefore check whether the specified Length would ! -- create a Last index value greater than Index_Type'Last. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! ! if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then raise Constraint_Error with "Length is out of range"; end if; ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! Last := No_Index + Index_Type'Base (Length); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of Length. ! ! Index := Count_Type'Base (No_Index) + Length; -- Last ! ! if Index > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! ! Last := Index_Type'Base (Index); ! ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! ! Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index ! ! if Index < Count_Type'Base (No_Index) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We have determined that the value of Length would not create a ! -- Last index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! ! Last := Index_Type'Base (Count_Type'Base (No_Index) + Length); ! end if; ! ! Elements := new Elements_Type (Last); ! ! return Vector'(Controlled with Elements, Last, 0, 0); end To_Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector is + Index : Count_Type'Base; + Last : Index_Type'Base; + Elements : Elements_Access; + begin if Length = 0 then return Empty_Vector; end if; ! -- We create a vector object with a capacity that matches the specified ! -- Length, but we do not allow the vector capacity (the length of the ! -- internal array) to exceed the number of values in Index_Type'Range ! -- (otherwise, there would be no way to refer to those components via an ! -- index). We must therefore check whether the specified Length would ! -- create a Last index value greater than Index_Type'Last. ! if Index_Type'Base'Last >= Count_Type'Pos (Count_Type'Last) then ! -- We perform a two-part test. First we determine whether the ! -- computed Last value lies in the base range of the type, and then ! -- determine whether it lies in the range of the index (sub)type. ! ! -- Last must satisfy this relation: ! -- First + Length - 1 <= Last ! -- We regroup terms: ! -- First - 1 <= Last - Length ! -- Which can rewrite as: ! -- No_Index <= Last - Length ! ! if Index_Type'Base'Last - Index_Type'Base (Length) < No_Index then raise Constraint_Error with "Length is out of range"; end if; ! -- We now know that the computed value of Last is within the base ! -- range of the type, so it is safe to compute its value: ! Last := No_Index + Index_Type'Base (Length); ! ! -- Finally we test whether the value is within the range of the ! -- generic actual index subtype: ! ! if Last > Index_Type'Last then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! elsif Index_Type'First <= 0 then ! -- Here we can compute Last directly, in the normal way. We know that ! -- No_Index is less than 0, so there is no danger of overflow when ! -- adding the (positive) value of Length. ! ! Index := Count_Type'Base (No_Index) + Length; -- same value as V.Last ! ! if Index > Count_Type'Base (Index_Type'Last) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We know that the computed value (having type Count_Type) of Last ! -- is within the range of the generic actual index subtype, so it is ! -- safe to convert to Index_Type: ! ! Last := Index_Type'Base (Index); ! ! else ! -- Here Index_Type'First (and Index_Type'Last) is positive, so we ! -- must test the length indirectly (by working backwards from the ! -- largest possible value of Last), in order to prevent overflow. ! ! Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index ! ! if Index < Count_Type'Base (No_Index) then ! raise Constraint_Error with "Length is out of range"; ! end if; ! ! -- We have determined that the value of Length would not create a ! -- Last index value outside of the range of Index_Type, so we can now ! -- safely compute its value. ! ! Last := Index_Type'Base (Count_Type'Base (No_Index) + Length); ! end if; ! ! Elements := new Elements_Type'(Last, EA => (others => New_Item)); ! ! return Vector'(Controlled with Elements, Last, 0, 0); end To_Vector; -------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/a-coorma.adb gcc-4.6.0/gcc/ada/a-coorma.adb *** gcc-4.5.2/gcc/ada/a-coorma.adb Mon Jul 20 13:18:34 2009 --- gcc-4.6.0/gcc/ada/a-coorma.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Ordered_Maps *** 537,543 **** if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (map is locked)"; end if; Position.Node.Key := Key; --- 537,543 ---- if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (map is locked)"; end if; Position.Node.Key := Key; *************** package body Ada.Containers.Ordered_Maps *** 1018,1024 **** if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (map is locked)"; end if; Node.Key := Key; --- 1018,1024 ---- if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (map is locked)"; end if; Node.Key := Key; *************** package body Ada.Containers.Ordered_Maps *** 1047,1053 **** if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (map is locked)"; end if; pragma Assert (Vet (Container.Tree, Position.Node), --- 1047,1053 ---- if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (map is locked)"; end if; pragma Assert (Vet (Container.Tree, Position.Node), diff -Nrcpad gcc-4.5.2/gcc/ada/a-coormu.adb gcc-4.6.0/gcc/ada/a-coormu.adb *** gcc-4.5.2/gcc/ada/a-coormu.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-coormu.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Ordered_Mult *** 1481,1487 **** else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := Item; --- 1481,1487 ---- else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := Item; diff -Nrcpad gcc-4.5.2/gcc/ada/a-coorse.adb gcc-4.6.0/gcc/ada/a-coorse.adb *** gcc-4.5.2/gcc/ada/a-coorse.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-coorse.adb Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Containers.Ordered_Sets *** 855,861 **** if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Position.Node.Element := New_Item; --- 855,861 ---- if not Inserted then if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Position.Node.Element := New_Item; *************** package body Ada.Containers.Ordered_Sets *** 1355,1361 **** if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := New_Item; --- 1355,1361 ---- if Container.Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := New_Item; *************** package body Ada.Containers.Ordered_Sets *** 1405,1411 **** Result : Node_Access; Inserted : Boolean; ! -- Start of processing for Insert begin if Item < Node.Element --- 1405,1411 ---- Result : Node_Access; Inserted : Boolean; ! -- Start of processing for Replace_Element begin if Item < Node.Element *************** package body Ada.Containers.Ordered_Sets *** 1416,1422 **** else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := Item; --- 1416,1422 ---- else if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := Item; *************** package body Ada.Containers.Ordered_Sets *** 1432,1438 **** if Hint = Node then if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with cursors (set is locked)"; end if; Node.Element := Item; --- 1432,1438 ---- if Hint = Node then if Tree.Lock > 0 then raise Program_Error with ! "attempt to tamper with elements (set is locked)"; end if; Node.Element := Item; diff -Nrcpad gcc-4.5.2/gcc/ada/a-crbltr.ads gcc-4.6.0/gcc/ada/a-crbltr.ads *** gcc-4.5.2/gcc/ada/a-crbltr.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-crbltr.ads Mon Oct 25 15:26:02 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package Ada.Containers.Red_Black_Trees i *** 48,51 **** --- 48,68 ---- end record; end Generic_Tree_Types; + generic + type Node_Type is private; + package Generic_Bounded_Tree_Types is + type Nodes_Type is array (Count_Type range <>) of Node_Type; + + type Tree_Type (Capacity : Count_Type) is tagged record + First : Count_Type := 0; + Last : Count_Type := 0; + Root : Count_Type := 0; + Length : Count_Type := 0; + Busy : Natural := 0; + Lock : Natural := 0; + Free : Count_Type'Base := -1; + Nodes : Nodes_Type (1 .. Capacity); + end record; + end Generic_Bounded_Tree_Types; + end Ada.Containers.Red_Black_Trees; diff -Nrcpad gcc-4.5.2/gcc/ada/a-direct.adb gcc-4.6.0/gcc/ada/a-direct.adb *** gcc-4.5.2/gcc/ada/a-direct.adb Fri Oct 30 13:49:17 2009 --- gcc-4.6.0/gcc/ada/a-direct.adb Tue Oct 5 10:07:35 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** with Ada.Unchecked_Conversion; *** 39,48 **** with Ada.Unchecked_Deallocation; with Ada.Characters.Handling; use Ada.Characters.Handling; ! with System.CRTL; use System.CRTL; ! with System.OS_Lib; use System.OS_Lib; ! with System.Regexp; use System.Regexp; ! with System; package body Ada.Directories is --- 39,48 ---- with Ada.Unchecked_Deallocation; with Ada.Characters.Handling; use Ada.Characters.Handling; ! with System.CRTL; use System.CRTL; ! with System.OS_Lib; use System.OS_Lib; ! with System.Regexp; use System.Regexp; ! with System.File_IO; use System.File_IO; with System; package body Ada.Directories is *************** package body Ada.Directories is *** 301,308 **** Target_Name : String; Form : String := "") is ! pragma Unreferenced (Form); ! Success : Boolean; begin -- First, the invalid cases --- 301,309 ---- Target_Name : String; Form : String := "") is ! Success : Boolean; ! Mode : Copy_Mode := Overwrite; ! Preserve : Attribute := None; begin -- First, the invalid cases *************** package body Ada.Directories is *** 322,331 **** raise Use_Error with "target """ & Target_Name & """ is a directory"; else ! -- The implementation uses System.OS_Lib.Copy_File, with parameters ! -- suitable for all platforms. ! Copy_File (Source_Name, Target_Name, Success, Overwrite, None); if not Success then raise Use_Error with "copy of """ & Source_Name & """ failed"; --- 323,391 ---- raise Use_Error with "target """ & Target_Name & """ is a directory"; else ! if Form'Length > 0 then ! declare ! Formstr : String (1 .. Form'Length + 1); ! V1, V2 : Natural; ! begin ! -- Acquire form string, setting required NUL terminator ! ! Formstr (1 .. Form'Length) := Form; ! Formstr (Formstr'Last) := ASCII.NUL; ! ! -- Convert form string to lower case ! ! for J in Formstr'Range loop ! if Formstr (J) in 'A' .. 'Z' then ! Formstr (J) := ! Character'Val (Character'Pos (Formstr (J)) + 32); ! end if; ! end loop; ! ! -- Check Form ! ! Form_Parameter (Formstr, "mode", V1, V2); ! ! if V1 = 0 then ! Mode := Overwrite; ! ! elsif Formstr (V1 .. V2) = "copy" then ! Mode := Copy; ! ! elsif Formstr (V1 .. V2) = "overwrite" then ! Mode := Overwrite; ! ! elsif Formstr (V1 .. V2) = "append" then ! Mode := Append; ! ! else ! raise Use_Error with "invalid Form"; ! end if; ! ! Form_Parameter (Formstr, "preserve", V1, V2); ! ! if V1 = 0 then ! Preserve := None; ! ! elsif Formstr (V1 .. V2) = "timestamps" then ! Preserve := Time_Stamps; ! ! elsif Formstr (V1 .. V2) = "all_attributes" then ! Preserve := Full; ! ! elsif Formstr (V1 .. V2) = "no_attributes" then ! Preserve := None; ! ! else ! raise Use_Error with "invalid Form"; ! end if; ! end; ! end if; ! ! -- The implementation uses System.OS_Lib.Copy_File ! ! Copy_File (Source_Name, Target_Name, Success, Mode, Preserve); if not Success then raise Use_Error with "copy of """ & Source_Name & """ failed"; diff -Nrcpad gcc-4.5.2/gcc/ada/a-direct.ads gcc-4.6.0/gcc/ada/a-direct.ads *** gcc-4.5.2/gcc/ada/a-direct.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-direct.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2009, Free Software Foundation, Inc. -- -- -- -- This specification is derived for use with GNAT from AI-00248, which is -- -- expected to be a part of a future expected revised Ada Reference Manual. -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- -- -- -- This specification is derived for use with GNAT from AI-00248, which is -- -- expected to be a part of a future expected revised Ada Reference Manual. -- *************** package Ada.Directories is *** 104,109 **** --- 104,111 ---- -- identification of a directory. The exception Use_Error is propagated if -- the external environment does not support the creation of a directory -- with the given name (in the absence of Name_Error) and form. + -- + -- The Form parameter is ignored procedure Delete_Directory (Directory : String); -- Deletes an existing empty directory with name Directory. The exception *************** package Ada.Directories is *** 129,134 **** --- 131,138 ---- -- The exception Use_Error is propagated if the external environment does -- not support the creation of any directories with the given name (in the -- absence of Name_Error) and form. + -- + -- The Form parameter is ignored procedure Delete_Tree (Directory : String); -- Deletes an existing directory with name Directory. The directory and *************** package Ada.Directories is *** 160,177 **** (Source_Name : String; Target_Name : String; Form : String := ""); ! -- Copies the contents of the existing external file with Source_Name ! -- to Target_Name. The resulting external file is a duplicate of the source ! -- external file. The Form can be used to give system-dependent -- characteristics of the resulting external file; the interpretation of -- the Form parameter is implementation-defined. Exception Name_Error is -- propagated if the string given as Source_Name does not identify an -- existing external ordinary or special file or if the string given as ! -- Target_Name does not allow the identification of an external file. ! -- The exception Use_Error is propagated if the external environment does ! -- not support the creating of the file with the name given by Target_Name ! -- and form given by Form, or copying of the file with the name given by -- Source_Name (in the absence of Name_Error). ---------------------------------------- -- File and directory name operations -- --- 164,231 ---- (Source_Name : String; Target_Name : String; Form : String := ""); ! -- Copies the contents of the existing external file with Source_Name to ! -- Target_Name. The resulting external file is a duplicate of the source ! -- external file. The Form argument can be used to give system-dependent -- characteristics of the resulting external file; the interpretation of -- the Form parameter is implementation-defined. Exception Name_Error is -- propagated if the string given as Source_Name does not identify an -- existing external ordinary or special file or if the string given as ! -- Target_Name does not allow the identification of an external file. The ! -- exception Use_Error is propagated if the external environment does not ! -- support the creating of the file with the name given by Target_Name and ! -- form given by Form, or copying of the file with the name given by -- Source_Name (in the absence of Name_Error). + -- + -- Interpretation of the Form parameter: + -- + -- The Form parameter is case-insensitive + -- + -- Two fields are recognized in the Form parameter: + -- preserve= + -- mode= + -- + -- starts immediately after the character '=' and ends with the + -- character immediately preceding the next comma (',') or with the + -- last character of the parameter. + -- + -- The allowed values for preserve= are: + -- + -- no_attributes: Do not try to preserve any file attributes. This + -- is the default if no preserve= is found in Form. + -- + -- all_attributes: Try to preserve all file attributes (timestamps, + -- access rights). + -- + -- timestamps: Preserve the timestamp of the copied file, but not + -- the other file attributes. + -- + -- The allowed values for mode= are: + -- + -- copy: Only copy if the destination file does not already + -- exist. If it already exists, Copy_File will fail. + -- + -- overwrite: Copy the file in all cases. Overwrite an already + -- existing destination file. This is the default if + -- no mode= is found in Form. + -- + -- append: Append the original file to the destination file. + -- If the destination file does not exist, the + -- destination file is a copy of the source file. + -- When mode=append, the field preserve=, if it + -- exists, is not taken into account. + -- + -- If the Form parameter includes one or both of the fields and the value + -- or values are incorrect, Copy_File fails with Use_Error. + -- + -- Examples of correct Forms: + -- Form => "preserve=no_attributes,mode=overwrite" (the default) + -- Form => "mode=append" + -- Form => "mode=copy,preserve=all_attributes" + -- + -- Examples of incorrect Forms: + -- Form => "preserve=junk" + -- Form => "mode=internal,preserve=timestamps" ---------------------------------------- -- File and directory name operations -- diff -Nrcpad gcc-4.5.2/gcc/ada/a-dirval.adb gcc-4.6.0/gcc/ada/a-dirval.adb *** gcc-4.5.2/gcc/ada/a-dirval.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-dirval.adb Fri Sep 10 09:54:24 2010 *************** *** 7,13 **** -- B o d y -- -- (POSIX Version) -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 7,13 ---- -- B o d y -- -- (POSIX Version) -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body Ada.Directories.Validity is *** 47,53 **** -- Is_Valid_Path_Name -- ------------------------ ! function Is_Valid_Path_Name (Name : String) return Boolean is begin -- A path name cannot be empty and cannot contain any NUL character --- 47,53 ---- -- Is_Valid_Path_Name -- ------------------------ ! function Is_Valid_Path_Name (Name : String) return Boolean is begin -- A path name cannot be empty and cannot contain any NUL character diff -Nrcpad gcc-4.5.2/gcc/ada/a-envvar.ads gcc-4.6.0/gcc/ada/a-envvar.ads *** gcc-4.5.2/gcc/ada/a-envvar.ads Fri Apr 6 09:13:42 2007 --- gcc-4.6.0/gcc/ada/a-envvar.ads Mon Jun 14 13:32:14 2010 *************** package Ada.Environment_Variables is *** 37,43 **** -- environment variable with the given name and value, then -- Constraint_Error is propagated. -- It is implementation defined whether there exist values for which the ! -- call Set(Name, Value) has the same effect as Clear (Name). procedure Clear (Name : String); -- If the external execution environment supports environment variables, --- 37,43 ---- -- environment variable with the given name and value, then -- Constraint_Error is propagated. -- It is implementation defined whether there exist values for which the ! -- call Set (Name, Value) has the same effect as Clear (Name). procedure Clear (Name : String); -- If the external execution environment supports environment variables, diff -Nrcpad gcc-4.5.2/gcc/ada/a-except-2005.adb gcc-4.6.0/gcc/ada/a-except-2005.adb *** gcc-4.5.2/gcc/ada/a-except-2005.adb Fri Apr 17 09:06:20 2009 --- gcc-4.6.0/gcc/ada/a-except-2005.adb Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Exceptions is *** 94,99 **** --- 94,102 ---- -- Store up to Max_Tracebacks in Excep, corresponding to the current -- call chain. + function Image (Index : Integer) return String; + -- Return string image corresponding to Index + procedure To_Stderr (S : String); pragma Export (Ada, To_Stderr, "__gnat_to_stderr"); -- Little routine to output string to stderr that is also used *************** package body Ada.Exceptions is *** 112,128 **** --------------------------------- procedure Set_Exception_C_Msg ! (Id : Exception_Id; ! Msg1 : System.Address; ! Line : Integer := 0; ! Msg2 : System.Address := System.Null_Address); -- This routine is called to setup the exception referenced by the -- Current_Excep field in the TSD to contain the indicated Id value -- and message. Msg1 is a null terminated string which is generated -- as the exception message. If line is non-zero, then a colon and -- the decimal representation of this integer is appended to the ! -- message. When Msg2 is non-null, a space and this additional null ! -- terminated string is added to the message. procedure Set_Exception_Msg (Id : Exception_Id; --- 115,132 ---- --------------------------------- procedure Set_Exception_C_Msg ! (Id : Exception_Id; ! Msg1 : System.Address; ! Line : Integer := 0; ! Column : Integer := 0; ! Msg2 : System.Address := System.Null_Address); -- This routine is called to setup the exception referenced by the -- Current_Excep field in the TSD to contain the indicated Id value -- and message. Msg1 is a null terminated string which is generated -- as the exception message. If line is non-zero, then a colon and -- the decimal representation of this integer is appended to the ! -- message. Ditto for Column. When Msg2 is non-null, a space and this ! -- additional null terminated string is added to the message. procedure Set_Exception_Msg (Id : Exception_Id; *************** package body Ada.Exceptions is *** 307,318 **** (E : Exception_Id; F : System.Address; L : Integer; M : System.Address := System.Null_Address); pragma No_Return (Raise_With_Location_And_Msg); -- Raise an exception with given exception id value. A filename and line -- number is associated with the raise and is stored in the exception ! -- occurrence and in addition a string message M is appended to ! -- this (if M is not null). procedure Raise_Constraint_Error (File : System.Address; --- 311,323 ---- (E : Exception_Id; F : System.Address; L : Integer; + C : Integer := 0; M : System.Address := System.Null_Address); pragma No_Return (Raise_With_Location_And_Msg); -- Raise an exception with given exception id value. A filename and line -- number is associated with the raise and is stored in the exception ! -- occurrence and in addition a column and a string message M may be ! -- appended to this (if not null/0). procedure Raise_Constraint_Error (File : System.Address; *************** package body Ada.Exceptions is *** 323,335 **** -- Raise constraint error with file:line information procedure Raise_Constraint_Error_Msg ! (File : System.Address; ! Line : Integer; ! Msg : System.Address); pragma No_Return (Raise_Constraint_Error_Msg); pragma Export (C, Raise_Constraint_Error_Msg, "__gnat_raise_constraint_error_msg"); ! -- Raise constraint error with file:line + msg information procedure Raise_Program_Error (File : System.Address; --- 328,341 ---- -- Raise constraint error with file:line information procedure Raise_Constraint_Error_Msg ! (File : System.Address; ! Line : Integer; ! Column : Integer; ! Msg : System.Address); pragma No_Return (Raise_Constraint_Error_Msg); pragma Export (C, Raise_Constraint_Error_Msg, "__gnat_raise_constraint_error_msg"); ! -- Raise constraint error with file:line:col + msg information procedure Raise_Program_Error (File : System.Address; *************** package body Ada.Exceptions is *** 458,463 **** --- 464,479 ---- procedure Rcheck_31 (File : System.Address; Line : Integer); procedure Rcheck_32 (File : System.Address; Line : Integer); procedure Rcheck_33 (File : System.Address; Line : Integer); + procedure Rcheck_34 (File : System.Address; Line : Integer); + + procedure Rcheck_00_Ext + (File : System.Address; Line, Column : Integer); + procedure Rcheck_05_Ext + (File : System.Address; Line, Column, Index, First, Last : Integer); + procedure Rcheck_06_Ext + (File : System.Address; Line, Column, Index, First, Last : Integer); + procedure Rcheck_12_Ext + (File : System.Address; Line, Column, Index, First, Last : Integer); pragma Export (C, Rcheck_00, "__gnat_rcheck_00"); pragma Export (C, Rcheck_01, "__gnat_rcheck_01"); *************** package body Ada.Exceptions is *** 493,498 **** --- 509,520 ---- pragma Export (C, Rcheck_31, "__gnat_rcheck_31"); pragma Export (C, Rcheck_32, "__gnat_rcheck_32"); pragma Export (C, Rcheck_33, "__gnat_rcheck_33"); + pragma Export (C, Rcheck_34, "__gnat_rcheck_34"); + + pragma Export (C, Rcheck_00_Ext, "__gnat_rcheck_00_ext"); + pragma Export (C, Rcheck_05_Ext, "__gnat_rcheck_05_ext"); + pragma Export (C, Rcheck_06_Ext, "__gnat_rcheck_06_ext"); + pragma Export (C, Rcheck_12_Ext, "__gnat_rcheck_12_ext"); -- None of these procedures ever returns (they raise an exception!). By -- using pragma No_Return, we ensure that any junk code after the call, *************** package body Ada.Exceptions is *** 531,536 **** --- 553,564 ---- pragma No_Return (Rcheck_30); pragma No_Return (Rcheck_32); pragma No_Return (Rcheck_33); + pragma No_Return (Rcheck_34); + + pragma No_Return (Rcheck_00_Ext); + pragma No_Return (Rcheck_05_Ext); + pragma No_Return (Rcheck_06_Ext); + pragma No_Return (Rcheck_12_Ext); --------------------------------------------- -- Reason Strings for Run-Time Check Calls -- *************** package body Ada.Exceptions is *** 560,583 **** Rmsg_16 : constant String := "attempt to take address of" & " intrinsic subprogram" & NUL; Rmsg_17 : constant String := "all guards closed" & NUL; ! Rmsg_18 : constant String := "Current_Task referenced in entry" & " body" & NUL; ! Rmsg_19 : constant String := "duplicated entry address" & NUL; ! Rmsg_20 : constant String := "explicit raise" & NUL; ! Rmsg_21 : constant String := "finalize/adjust raised exception" & NUL; ! Rmsg_22 : constant String := "implicit return with No_Return" & NUL; ! Rmsg_23 : constant String := "misaligned address value" & NUL; ! Rmsg_24 : constant String := "missing return" & NUL; ! Rmsg_25 : constant String := "overlaid controlled object" & NUL; ! Rmsg_26 : constant String := "potentially blocking operation" & NUL; ! Rmsg_27 : constant String := "stubbed subprogram called" & NUL; ! Rmsg_28 : constant String := "unchecked union restriction" & NUL; ! Rmsg_29 : constant String := "actual/returned class-wide" & " value not transportable" & NUL; ! Rmsg_30 : constant String := "empty storage pool" & NUL; ! Rmsg_31 : constant String := "explicit raise" & NUL; ! Rmsg_32 : constant String := "infinite recursion" & NUL; ! Rmsg_33 : constant String := "object too large" & NUL; ----------------------- -- Polling Interface -- --- 588,613 ---- Rmsg_16 : constant String := "attempt to take address of" & " intrinsic subprogram" & NUL; Rmsg_17 : constant String := "all guards closed" & NUL; ! Rmsg_18 : constant String := "improper use of generic subtype" & ! " with predicate" & NUL; ! Rmsg_19 : constant String := "Current_Task referenced in entry" & " body" & NUL; ! Rmsg_20 : constant String := "duplicated entry address" & NUL; ! Rmsg_21 : constant String := "explicit raise" & NUL; ! Rmsg_22 : constant String := "finalize/adjust raised exception" & NUL; ! Rmsg_23 : constant String := "implicit return with No_Return" & NUL; ! Rmsg_24 : constant String := "misaligned address value" & NUL; ! Rmsg_25 : constant String := "missing return" & NUL; ! Rmsg_26 : constant String := "overlaid controlled object" & NUL; ! Rmsg_27 : constant String := "potentially blocking operation" & NUL; ! Rmsg_28 : constant String := "stubbed subprogram called" & NUL; ! Rmsg_29 : constant String := "unchecked union restriction" & NUL; ! Rmsg_30 : constant String := "actual/returned class-wide" & " value not transportable" & NUL; ! Rmsg_31 : constant String := "empty storage pool" & NUL; ! Rmsg_32 : constant String := "explicit raise" & NUL; ! Rmsg_33 : constant String := "infinite recursion" & NUL; ! Rmsg_34 : constant String := "object too large" & NUL; ----------------------- -- Polling Interface -- *************** package body Ada.Exceptions is *** 774,786 **** -- Raise_Constraint_Error -- ---------------------------- ! procedure Raise_Constraint_Error ! (File : System.Address; ! Line : Integer) ! is begin ! Raise_With_Location_And_Msg ! (Constraint_Error_Def'Access, File, Line); end Raise_Constraint_Error; -------------------------------- --- 804,812 ---- -- Raise_Constraint_Error -- ---------------------------- ! procedure Raise_Constraint_Error (File : System.Address; Line : Integer) is begin ! Raise_With_Location_And_Msg (Constraint_Error_Def'Access, File, Line); end Raise_Constraint_Error; -------------------------------- *************** package body Ada.Exceptions is *** 788,800 **** -------------------------------- procedure Raise_Constraint_Error_Msg ! (File : System.Address; ! Line : Integer; ! Msg : System.Address) is begin Raise_With_Location_And_Msg ! (Constraint_Error_Def'Access, File, Line, Msg); end Raise_Constraint_Error_Msg; ------------------------- --- 814,827 ---- -------------------------------- procedure Raise_Constraint_Error_Msg ! (File : System.Address; ! Line : Integer; ! Column : Integer; ! Msg : System.Address) is begin Raise_With_Location_And_Msg ! (Constraint_Error_Def'Access, File, Line, Column, Msg); end Raise_Constraint_Error_Msg; ------------------------- *************** package body Ada.Exceptions is *** 935,942 **** Line : Integer) is begin ! Raise_With_Location_And_Msg ! (Program_Error_Def'Access, File, Line); end Raise_Program_Error; ----------------------------- --- 962,968 ---- Line : Integer) is begin ! Raise_With_Location_And_Msg (Program_Error_Def'Access, File, Line); end Raise_Program_Error; ----------------------------- *************** package body Ada.Exceptions is *** 950,956 **** is begin Raise_With_Location_And_Msg ! (Program_Error_Def'Access, File, Line, Msg); end Raise_Program_Error_Msg; ------------------------- --- 976,982 ---- is begin Raise_With_Location_And_Msg ! (Program_Error_Def'Access, File, Line, M => Msg); end Raise_Program_Error_Msg; ------------------------- *************** package body Ada.Exceptions is *** 962,969 **** Line : Integer) is begin ! Raise_With_Location_And_Msg ! (Storage_Error_Def'Access, File, Line); end Raise_Storage_Error; ----------------------------- --- 988,994 ---- Line : Integer) is begin ! Raise_With_Location_And_Msg (Storage_Error_Def'Access, File, Line); end Raise_Storage_Error; ----------------------------- *************** package body Ada.Exceptions is *** 977,983 **** is begin Raise_With_Location_And_Msg ! (Storage_Error_Def'Access, File, Line, Msg); end Raise_Storage_Error_Msg; --------------------------------- --- 1002,1008 ---- is begin Raise_With_Location_And_Msg ! (Storage_Error_Def'Access, File, Line, M => Msg); end Raise_Storage_Error_Msg; --------------------------------- *************** package body Ada.Exceptions is *** 988,997 **** (E : Exception_Id; F : System.Address; L : Integer; M : System.Address := System.Null_Address) is begin ! Exception_Data.Set_Exception_C_Msg (E, F, L, M); Abort_Defer.all; Raise_Current_Excep (E); end Raise_With_Location_And_Msg; --- 1013,1023 ---- (E : Exception_Id; F : System.Address; L : Integer; + C : Integer := 0; M : System.Address := System.Null_Address) is begin ! Exception_Data.Set_Exception_C_Msg (E, F, L, C, M); Abort_Defer.all; Raise_Current_Excep (E); end Raise_With_Location_And_Msg; *************** package body Ada.Exceptions is *** 1015,1092 **** Raise_Current_Excep (E); end Raise_With_Msg; -------------------------------------- -- Calls to Run-Time Check Routines -- -------------------------------------- procedure Rcheck_00 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_00'Address); end Rcheck_00; procedure Rcheck_01 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_01'Address); end Rcheck_01; procedure Rcheck_02 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_02'Address); end Rcheck_02; procedure Rcheck_03 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_03'Address); end Rcheck_03; procedure Rcheck_04 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_04'Address); end Rcheck_04; procedure Rcheck_05 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_05'Address); end Rcheck_05; procedure Rcheck_06 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_06'Address); end Rcheck_06; procedure Rcheck_07 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_07'Address); end Rcheck_07; procedure Rcheck_08 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_08'Address); end Rcheck_08; procedure Rcheck_09 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_09'Address); end Rcheck_09; procedure Rcheck_10 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_10'Address); end Rcheck_10; procedure Rcheck_11 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_11'Address); end Rcheck_11; procedure Rcheck_12 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_12'Address); end Rcheck_12; procedure Rcheck_13 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, Rmsg_13'Address); end Rcheck_13; procedure Rcheck_14 (File : System.Address; Line : Integer) is --- 1041,1132 ---- Raise_Current_Excep (E); end Raise_With_Msg; + ----------- + -- Image -- + ----------- + + function Image (Index : Integer) return String is + Result : constant String := Integer'Image (Index); + begin + if Result (1) = ' ' then + return Result (2 .. Result'Last); + else + return Result; + end if; + end Image; + -------------------------------------- -- Calls to Run-Time Check Routines -- -------------------------------------- procedure Rcheck_00 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_00'Address); end Rcheck_00; procedure Rcheck_01 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_01'Address); end Rcheck_01; procedure Rcheck_02 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_02'Address); end Rcheck_02; procedure Rcheck_03 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_03'Address); end Rcheck_03; procedure Rcheck_04 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_04'Address); end Rcheck_04; procedure Rcheck_05 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_05'Address); end Rcheck_05; procedure Rcheck_06 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_06'Address); end Rcheck_06; procedure Rcheck_07 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_07'Address); end Rcheck_07; procedure Rcheck_08 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_08'Address); end Rcheck_08; procedure Rcheck_09 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_09'Address); end Rcheck_09; procedure Rcheck_10 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_10'Address); end Rcheck_10; procedure Rcheck_11 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_11'Address); end Rcheck_11; procedure Rcheck_12 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_12'Address); end Rcheck_12; procedure Rcheck_13 (File : System.Address; Line : Integer) is begin ! Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_13'Address); end Rcheck_13; procedure Rcheck_14 (File : System.Address; Line : Integer) is *************** package body Ada.Exceptions is *** 1171,1177 **** procedure Rcheck_30 (File : System.Address; Line : Integer) is begin ! Raise_Storage_Error_Msg (File, Line, Rmsg_30'Address); end Rcheck_30; procedure Rcheck_31 (File : System.Address; Line : Integer) is --- 1211,1217 ---- procedure Rcheck_30 (File : System.Address; Line : Integer) is begin ! Raise_Program_Error_Msg (File, Line, Rmsg_30'Address); end Rcheck_30; procedure Rcheck_31 (File : System.Address; Line : Integer) is *************** package body Ada.Exceptions is *** 1189,1201 **** Raise_Storage_Error_Msg (File, Line, Rmsg_33'Address); end Rcheck_33; ------------- -- Reraise -- ------------- procedure Reraise is Excep : constant EOA := Get_Current_Excep.all; - begin Abort_Defer.all; Exception_Propagation.Setup_Exception (Excep, Excep, Reraised => True); --- 1229,1283 ---- Raise_Storage_Error_Msg (File, Line, Rmsg_33'Address); end Rcheck_33; + procedure Rcheck_34 (File : System.Address; Line : Integer) is + begin + Raise_Storage_Error_Msg (File, Line, Rmsg_34'Address); + end Rcheck_34; + + procedure Rcheck_00_Ext (File : System.Address; Line, Column : Integer) is + begin + Raise_Constraint_Error_Msg (File, Line, Column, Rmsg_00'Address); + end Rcheck_00_Ext; + + procedure Rcheck_05_Ext + (File : System.Address; Line, Column, Index, First, Last : Integer) + is + Msg : constant String := + Rmsg_05 (Rmsg_05'First .. Rmsg_05'Last - 1) & ASCII.LF & + "index " & Image (Index) & " not in " & Image (First) & + ".." & Image (Last) & ASCII.NUL; + begin + Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address); + end Rcheck_05_Ext; + + procedure Rcheck_06_Ext + (File : System.Address; Line, Column, Index, First, Last : Integer) + is + Msg : constant String := + Rmsg_06 (Rmsg_06'First .. Rmsg_06'Last - 1) & ASCII.LF & + "value " & Image (Index) & " not in " & Image (First) & + ".." & Image (Last) & ASCII.NUL; + begin + Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address); + end Rcheck_06_Ext; + + procedure Rcheck_12_Ext + (File : System.Address; Line, Column, Index, First, Last : Integer) + is + Msg : constant String := + Rmsg_12 (Rmsg_12'First .. Rmsg_12'Last - 1) & ASCII.LF & + "value " & Image (Index) & " not in " & Image (First) & + ".." & Image (Last) & ASCII.NUL; + begin + Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address); + end Rcheck_12_Ext; + ------------- -- Reraise -- ------------- procedure Reraise is Excep : constant EOA := Get_Current_Excep.all; begin Abort_Defer.all; Exception_Propagation.Setup_Exception (Excep, Excep, Reraised => True); *************** package body Ada.Exceptions is *** 1337,1343 **** --------------- procedure To_Stderr (C : Character) is - type int is new Integer; procedure put_char_stderr (C : int); --- 1419,1424 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/a-except.adb gcc-4.6.0/gcc/ada/a-except.adb *** gcc-4.5.2/gcc/ada/a-except.adb Mon Jul 27 14:01:00 2009 --- gcc-4.6.0/gcc/ada/a-except.adb Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Exceptions is *** 93,109 **** --------------------------------- procedure Set_Exception_C_Msg ! (Id : Exception_Id; ! Msg1 : System.Address; ! Line : Integer := 0; ! Msg2 : System.Address := System.Null_Address); -- This routine is called to setup the exception referenced by the -- Current_Excep field in the TSD to contain the indicated Id value -- and message. Msg1 is a null terminated string which is generated -- as the exception message. If line is non-zero, then a colon and -- the decimal representation of this integer is appended to the ! -- message. When Msg2 is non-null, a space and this additional null ! -- terminated string is added to the message. procedure Set_Exception_Msg (Id : Exception_Id; --- 93,110 ---- --------------------------------- procedure Set_Exception_C_Msg ! (Id : Exception_Id; ! Msg1 : System.Address; ! Line : Integer := 0; ! Column : Integer := 0; ! Msg2 : System.Address := System.Null_Address); -- This routine is called to setup the exception referenced by the -- Current_Excep field in the TSD to contain the indicated Id value -- and message. Msg1 is a null terminated string which is generated -- as the exception message. If line is non-zero, then a colon and -- the decimal representation of this integer is appended to the ! -- message. Ditto for Column. When Msg2 is non-null, a space and this ! -- additional null terminated string is added to the message. procedure Set_Exception_Msg (Id : Exception_Id; *************** package body Ada.Exceptions is *** 414,419 **** --- 415,421 ---- procedure Rcheck_31 (File : System.Address; Line : Integer); procedure Rcheck_32 (File : System.Address; Line : Integer); procedure Rcheck_33 (File : System.Address; Line : Integer); + procedure Rcheck_34 (File : System.Address; Line : Integer); pragma Export (C, Rcheck_00, "__gnat_rcheck_00"); pragma Export (C, Rcheck_01, "__gnat_rcheck_01"); *************** package body Ada.Exceptions is *** 449,454 **** --- 451,457 ---- pragma Export (C, Rcheck_31, "__gnat_rcheck_31"); pragma Export (C, Rcheck_32, "__gnat_rcheck_32"); pragma Export (C, Rcheck_33, "__gnat_rcheck_33"); + pragma Export (C, Rcheck_34, "__gnat_rcheck_34"); -- None of these procedures ever returns (they raise an exception!). By -- using pragma No_Return, we ensure that any junk code after the call, *************** package body Ada.Exceptions is *** 487,492 **** --- 490,496 ---- pragma No_Return (Rcheck_30); pragma No_Return (Rcheck_32); pragma No_Return (Rcheck_33); + pragma No_Return (Rcheck_34); --------------------------------------------- -- Reason Strings for Run-Time Check Calls -- *************** package body Ada.Exceptions is *** 516,539 **** Rmsg_16 : constant String := "attempt to take address of" & " intrinsic subprogram" & NUL; Rmsg_17 : constant String := "all guards closed" & NUL; ! Rmsg_18 : constant String := "Current_Task referenced in entry" & " body" & NUL; ! Rmsg_19 : constant String := "duplicated entry address" & NUL; ! Rmsg_20 : constant String := "explicit raise" & NUL; ! Rmsg_21 : constant String := "finalize/adjust raised exception" & NUL; ! Rmsg_22 : constant String := "implicit return with No_Return" & NUL; ! Rmsg_23 : constant String := "misaligned address value" & NUL; ! Rmsg_24 : constant String := "missing return" & NUL; ! Rmsg_25 : constant String := "overlaid controlled object" & NUL; ! Rmsg_26 : constant String := "potentially blocking operation" & NUL; ! Rmsg_27 : constant String := "stubbed subprogram called" & NUL; ! Rmsg_28 : constant String := "unchecked union restriction" & NUL; ! Rmsg_29 : constant String := "actual/returned class-wide" & " value not transportable" & NUL; ! Rmsg_30 : constant String := "empty storage pool" & NUL; ! Rmsg_31 : constant String := "explicit raise" & NUL; ! Rmsg_32 : constant String := "infinite recursion" & NUL; ! Rmsg_33 : constant String := "object too large" & NUL; ----------------------- -- Polling Interface -- --- 520,545 ---- Rmsg_16 : constant String := "attempt to take address of" & " intrinsic subprogram" & NUL; Rmsg_17 : constant String := "all guards closed" & NUL; ! Rmsg_18 : constant String := "improper use of generic subtype" & ! " with predicate" & NUL; ! Rmsg_19 : constant String := "Current_Task referenced in entry" & " body" & NUL; ! Rmsg_20 : constant String := "duplicated entry address" & NUL; ! Rmsg_21 : constant String := "explicit raise" & NUL; ! Rmsg_22 : constant String := "finalize/adjust raised exception" & NUL; ! Rmsg_23 : constant String := "implicit return with No_Return" & NUL; ! Rmsg_24 : constant String := "misaligned address value" & NUL; ! Rmsg_25 : constant String := "missing return" & NUL; ! Rmsg_26 : constant String := "overlaid controlled object" & NUL; ! Rmsg_27 : constant String := "potentially blocking operation" & NUL; ! Rmsg_28 : constant String := "stubbed subprogram called" & NUL; ! Rmsg_29 : constant String := "unchecked union restriction" & NUL; ! Rmsg_30 : constant String := "actual/returned class-wide" & " value not transportable" & NUL; ! Rmsg_31 : constant String := "empty storage pool" & NUL; ! Rmsg_32 : constant String := "explicit raise" & NUL; ! Rmsg_33 : constant String := "infinite recursion" & NUL; ! Rmsg_34 : constant String := "object too large" & NUL; ----------------------- -- Polling Interface -- *************** package body Ada.Exceptions is *** 958,964 **** M : System.Address := System.Null_Address) is begin ! Exception_Data.Set_Exception_C_Msg (E, F, L, M); Abort_Defer.all; Raise_Current_Excep (E); end Raise_With_Location_And_Msg; --- 964,970 ---- M : System.Address := System.Null_Address) is begin ! Exception_Data.Set_Exception_C_Msg (E, F, L, Msg2 => M); Abort_Defer.all; Raise_Current_Excep (E); end Raise_With_Location_And_Msg; *************** package body Ada.Exceptions is *** 1136,1142 **** procedure Rcheck_30 (File : System.Address; Line : Integer) is begin ! Raise_Storage_Error_Msg (File, Line, Rmsg_30'Address); end Rcheck_30; procedure Rcheck_31 (File : System.Address; Line : Integer) is --- 1142,1148 ---- procedure Rcheck_30 (File : System.Address; Line : Integer) is begin ! Raise_Program_Error_Msg (File, Line, Rmsg_30'Address); end Rcheck_30; procedure Rcheck_31 (File : System.Address; Line : Integer) is *************** package body Ada.Exceptions is *** 1154,1159 **** --- 1160,1170 ---- Raise_Storage_Error_Msg (File, Line, Rmsg_33'Address); end Rcheck_33; + procedure Rcheck_34 (File : System.Address; Line : Integer) is + begin + Raise_Storage_Error_Msg (File, Line, Rmsg_34'Address); + end Rcheck_34; + ------------- -- Reraise -- ------------- diff -Nrcpad gcc-4.5.2/gcc/ada/a-excpol-abort.adb gcc-4.6.0/gcc/ada/a-excpol-abort.adb *** gcc-4.5.2/gcc/ada/a-excpol-abort.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-excpol-abort.adb Tue Jun 22 16:57:01 2010 *************** *** 7,13 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 7,13 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,41 **** -- that activates periodic polling. Then in the body of the polling routine -- we test for asynchronous abort. ! -- NT, OS/2, HPUX/DCE and SCO currently use this file pragma Warnings (Off); -- Allow withing of non-Preelaborated units in Ada 2005 mode where this --- 35,41 ---- -- that activates periodic polling. Then in the body of the polling routine -- we test for asynchronous abort. ! -- Windows, HPUX 10 and VMS currently use this file pragma Warnings (Off); -- Allow withing of non-Preelaborated units in Ada 2005 mode where this diff -Nrcpad gcc-4.5.2/gcc/ada/a-exetim-default.ads gcc-4.6.0/gcc/ada/a-exetim-default.ads *** gcc-4.5.2/gcc/ada/a-exetim-default.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-exetim-default.ads Tue Oct 12 10:32:58 2010 *************** *** 0 **** --- 1,98 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . E X E C U T I O N _ T I M E -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2007-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Task_Identification; + with Ada.Real_Time; + + package Ada.Execution_Time is + + type CPU_Time is private; + + CPU_Time_First : constant CPU_Time; + CPU_Time_Last : constant CPU_Time; + CPU_Time_Unit : constant := Ada.Real_Time.Time_Unit; + CPU_Tick : constant Ada.Real_Time.Time_Span; + + function Clock + (T : Ada.Task_Identification.Task_Id + := Ada.Task_Identification.Current_Task) + return CPU_Time; + + function "+" + (Left : CPU_Time; + Right : Ada.Real_Time.Time_Span) return CPU_Time; + + function "+" + (Left : Ada.Real_Time.Time_Span; + Right : CPU_Time) return CPU_Time; + + function "-" + (Left : CPU_Time; + Right : Ada.Real_Time.Time_Span) return CPU_Time; + + function "-" + (Left : CPU_Time; + Right : CPU_Time) return Ada.Real_Time.Time_Span; + + function "<" (Left, Right : CPU_Time) return Boolean; + function "<=" (Left, Right : CPU_Time) return Boolean; + function ">" (Left, Right : CPU_Time) return Boolean; + function ">=" (Left, Right : CPU_Time) return Boolean; + + procedure Split + (T : CPU_Time; + SC : out Ada.Real_Time.Seconds_Count; + TS : out Ada.Real_Time.Time_Span); + + function Time_Of + (SC : Ada.Real_Time.Seconds_Count; + TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero) + return CPU_Time; + + private + + type CPU_Time is new Ada.Real_Time.Time; + + CPU_Time_First : constant CPU_Time := CPU_Time (Ada.Real_Time.Time_First); + CPU_Time_Last : constant CPU_Time := CPU_Time (Ada.Real_Time.Time_Last); + + CPU_Tick : constant Ada.Real_Time.Time_Span := Ada.Real_Time.Tick; + + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, ">="); + + end Ada.Execution_Time; diff -Nrcpad gcc-4.5.2/gcc/ada/a-exetim-posix.adb gcc-4.6.0/gcc/ada/a-exetim-posix.adb *** gcc-4.5.2/gcc/ada/a-exetim-posix.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-exetim-posix.adb Tue Oct 12 10:32:58 2010 *************** *** 0 **** --- 1,157 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . E X E C U T I O N _ T I M E -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2007-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is the POSIX (Realtime Extension) version of this package + + with Ada.Task_Identification; use Ada.Task_Identification; + with Ada.Unchecked_Conversion; + + with System.OS_Interface; use System.OS_Interface; + + with Interfaces.C; use Interfaces.C; + + package body Ada.Execution_Time is + + pragma Linker_Options ("-lrt"); + -- POSIX.1b Realtime Extensions library. Needed to have access to function + -- clock_gettime. + + --------- + -- "+" -- + --------- + + function "+" + (Left : CPU_Time; + Right : Ada.Real_Time.Time_Span) return CPU_Time + is + use type Ada.Real_Time.Time; + begin + return CPU_Time (Ada.Real_Time.Time (Left) + Right); + end "+"; + + function "+" + (Left : Ada.Real_Time.Time_Span; + Right : CPU_Time) return CPU_Time + is + use type Ada.Real_Time.Time; + begin + return CPU_Time (Left + Ada.Real_Time.Time (Right)); + end "+"; + + --------- + -- "-" -- + --------- + + function "-" + (Left : CPU_Time; + Right : Ada.Real_Time.Time_Span) return CPU_Time + is + use type Ada.Real_Time.Time; + begin + return CPU_Time (Ada.Real_Time.Time (Left) - Right); + end "-"; + + function "-" + (Left : CPU_Time; + Right : CPU_Time) return Ada.Real_Time.Time_Span + is + use type Ada.Real_Time.Time; + begin + return (Ada.Real_Time.Time (Left) - Ada.Real_Time.Time (Right)); + end "-"; + + ----------- + -- Clock -- + ----------- + + function Clock + (T : Ada.Task_Identification.Task_Id := + Ada.Task_Identification.Current_Task) + return CPU_Time + is + TS : aliased timespec; + Result : Interfaces.C.int; + + function To_CPU_Time is + new Ada.Unchecked_Conversion (Duration, CPU_Time); + -- Time is equal to Duration (although it is a private type) and + -- CPU_Time is equal to Time. + + function clock_gettime + (clock_id : Interfaces.C.int; + tp : access timespec) + return int; + pragma Import (C, clock_gettime, "clock_gettime"); + -- Function from the POSIX.1b Realtime Extensions library + + CLOCK_THREAD_CPUTIME_ID : constant := 3; + -- Identifier for the clock returning per-task CPU time + + begin + if T = Ada.Task_Identification.Null_Task_Id then + raise Program_Error; + end if; + + Result := clock_gettime + (clock_id => CLOCK_THREAD_CPUTIME_ID, tp => TS'Unchecked_Access); + pragma Assert (Result = 0); + + return To_CPU_Time (To_Duration (TS)); + end Clock; + + ----------- + -- Split -- + ----------- + + procedure Split + (T : CPU_Time; + SC : out Ada.Real_Time.Seconds_Count; + TS : out Ada.Real_Time.Time_Span) + is + use type Ada.Real_Time.Time; + begin + Ada.Real_Time.Split (Ada.Real_Time.Time (T), SC, TS); + end Split; + + ------------- + -- Time_Of -- + ------------- + + function Time_Of + (SC : Ada.Real_Time.Seconds_Count; + TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero) + return CPU_Time + is + begin + return CPU_Time (Ada.Real_Time.Time_Of (SC, TS)); + end Time_Of; + + end Ada.Execution_Time; diff -Nrcpad gcc-4.5.2/gcc/ada/a-exetim.ads gcc-4.6.0/gcc/ada/a-exetim.ads *** gcc-4.5.2/gcc/ada/a-exetim.ads Fri Apr 6 09:43:23 2007 --- gcc-4.6.0/gcc/ada/a-exetim.ads Tue Oct 12 10:38:39 2010 *************** package Ada.Execution_Time is *** 37,44 **** CPU_Tick : constant Ada.Real_Time.Time_Span; function Clock ! (T : Ada.Task_Identification.Task_Id ! := Ada.Task_Identification.Current_Task) return CPU_Time; function "+" --- 37,44 ---- CPU_Tick : constant Ada.Real_Time.Time_Span; function Clock ! (T : Ada.Task_Identification.Task_Id := ! Ada.Task_Identification.Current_Task) return CPU_Time; function "+" diff -Nrcpad gcc-4.5.2/gcc/ada/a-exexda.adb gcc-4.6.0/gcc/ada/a-exexda.adb *** gcc-4.5.2/gcc/ada/a-exexda.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-exexda.adb Tue Oct 19 12:29:25 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exception_Data is *** 556,594 **** ------------------------- procedure Set_Exception_C_Msg ! (Id : Exception_Id; ! Msg1 : System.Address; ! Line : Integer := 0; ! Msg2 : System.Address := System.Null_Address) is Excep : constant EOA := Get_Current_Excep.all; - Val : Integer := Line; Remind : Integer; - Size : Integer := 1; Ptr : Natural; ! begin ! Exception_Propagation.Setup_Exception (Excep, Excep); ! Excep.Exception_Raised := False; ! Excep.Id := Id; ! Excep.Num_Tracebacks := 0; ! Excep.Pid := Local_Partition_ID; ! Excep.Msg_Length := 0; ! Excep.Cleanup_Flag := False; ! while To_Ptr (Msg1) (Excep.Msg_Length + 1) /= ASCII.NUL ! and then Excep.Msg_Length < Exception_Msg_Max_Length ! loop ! Excep.Msg_Length := Excep.Msg_Length + 1; ! Excep.Msg (Excep.Msg_Length) := To_Ptr (Msg1) (Excep.Msg_Length); ! end loop; ! -- Append line number if present ! if Line > 0 then -- Compute the number of needed characters while Val > 0 loop Val := Val / 10; Size := Size + 1; --- 556,591 ---- ------------------------- procedure Set_Exception_C_Msg ! (Id : Exception_Id; ! Msg1 : System.Address; ! Line : Integer := 0; ! Column : Integer := 0; ! Msg2 : System.Address := System.Null_Address) is Excep : constant EOA := Get_Current_Excep.all; Remind : Integer; Ptr : Natural; ! procedure Append_Number (Number : Integer); ! -- Append given number to Excep.Msg ! ------------------- ! -- Append_Number -- ! ------------------- ! procedure Append_Number (Number : Integer) is ! Val : Integer; ! Size : Integer; ! begin ! if Number <= 0 then ! return; ! end if; -- Compute the number of needed characters + Size := 1; + Val := Number; while Val > 0 loop Val := Val / 10; Size := Size + 1; *************** package body Exception_Data is *** 599,605 **** if Excep.Msg_Length <= Exception_Msg_Max_Length - Size then Excep.Msg (Excep.Msg_Length + 1) := ':'; Excep.Msg_Length := Excep.Msg_Length + Size; ! Val := Line; Size := 0; while Val > 0 loop --- 596,602 ---- if Excep.Msg_Length <= Exception_Msg_Max_Length - Size then Excep.Msg (Excep.Msg_Length + 1) := ':'; Excep.Msg_Length := Excep.Msg_Length + Size; ! Val := Number; Size := 0; while Val > 0 loop *************** package body Exception_Data is *** 610,616 **** Size := Size + 1; end loop; end if; ! end if; -- Append second message if present --- 607,634 ---- Size := Size + 1; end loop; end if; ! end Append_Number; ! ! -- Start of processing for Set_Exception_C_Msg ! ! begin ! Exception_Propagation.Setup_Exception (Excep, Excep); ! Excep.Exception_Raised := False; ! Excep.Id := Id; ! Excep.Num_Tracebacks := 0; ! Excep.Pid := Local_Partition_ID; ! Excep.Msg_Length := 0; ! Excep.Cleanup_Flag := False; ! ! while To_Ptr (Msg1) (Excep.Msg_Length + 1) /= ASCII.NUL ! and then Excep.Msg_Length < Exception_Msg_Max_Length ! loop ! Excep.Msg_Length := Excep.Msg_Length + 1; ! Excep.Msg (Excep.Msg_Length) := To_Ptr (Msg1) (Excep.Msg_Length); ! end loop; ! ! Append_Number (Line); ! Append_Number (Column); -- Append second message if present diff -Nrcpad gcc-4.5.2/gcc/ada/a-exextr.adb gcc-4.6.0/gcc/ada/a-exextr.adb *** gcc-4.5.2/gcc/ada/a-exextr.adb Wed Apr 15 10:46:56 2009 --- gcc-4.6.0/gcc/ada/a-exextr.adb Fri Oct 22 08:51:09 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exception_Traces is *** 53,60 **** pragma Export (Ada, Raise_Hook_Initialized, "__gnat_exception_actions_initialized"); ! procedure Last_Chance_Handler ! (Except : Exception_Occurrence); pragma Import (C, Last_Chance_Handler, "__gnat_last_chance_handler"); pragma No_Return (Last_Chance_Handler); -- Users can replace the default version of this routine, --- 53,59 ---- pragma Export (Ada, Raise_Hook_Initialized, "__gnat_exception_actions_initialized"); ! procedure Last_Chance_Handler (Except : Exception_Occurrence); pragma Import (C, Last_Chance_Handler, "__gnat_last_chance_handler"); pragma No_Return (Last_Chance_Handler); -- Users can replace the default version of this routine, diff -Nrcpad gcc-4.5.2/gcc/ada/a-locale.adb gcc-4.6.0/gcc/ada/a-locale.adb *** gcc-4.5.2/gcc/ada/a-locale.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-locale.adb Fri Oct 22 10:02:10 2010 *************** *** 0 **** --- 1,65 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . L O C A L E S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with System; use System; + + package body Ada.Locales is + + type Lower_4 is array (1 .. 4) of Character range 'a' .. 'z'; + type Upper_4 is array (1 .. 4) of Character range 'A' .. 'Z'; + + -------------- + -- Language -- + -------------- + + function Language return Language_Code is + procedure C_Get_Language_Code (P : Address); + pragma Import (C, C_Get_Language_Code); + F : Lower_4; + begin + C_Get_Language_Code (F'Address); + return Language_Code (F (1 .. 3)); + end Language; + + ------------- + -- Country -- + ------------- + + function Country return Country_Code is + procedure C_Get_Country_Code (P : Address); + pragma Import (C, C_Get_Country_Code); + F : Upper_4; + begin + C_Get_Country_Code (F'Address); + return Country_Code (F (1 .. 2)); + end Country; + + end Ada.Locales; diff -Nrcpad gcc-4.5.2/gcc/ada/a-locale.ads gcc-4.6.0/gcc/ada/a-locale.ads *** gcc-4.5.2/gcc/ada/a-locale.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-locale.ads Fri Oct 22 10:00:18 2010 *************** *** 0 **** --- 1,31 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . L O C A L E S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2010, Free Software Foundation, Inc. -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + package Ada.Locales is + pragma Preelaborate (Locales); + pragma Remote_Types (Locales); + + type Language_Code is array (1 .. 3) of Character range 'a' .. 'z'; + type Country_Code is array (1 .. 2) of Character range 'A' .. 'Z'; + + Language_Unknown : constant Language_Code := "und"; + Country_Unknown : constant Country_Code := "ZZ"; + + function Language return Language_Code; + function Country return Country_Code; + + end Ada.Locales; diff -Nrcpad gcc-4.5.2/gcc/ada/a-ngcoty.adb gcc-4.6.0/gcc/ada/a-ngcoty.adb *** gcc-4.5.2/gcc/ada/a-ngcoty.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-ngcoty.adb Tue Jun 22 17:17:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Numerics.Generic_Comple *** 43,48 **** --- 43,54 ---- --------- function "*" (Left, Right : Complex) return Complex is + + Scale : constant R := R (R'Machine_Radix) ** ((R'Machine_Emax - 1) / 2); + -- In case of overflow, scale the operands by the largest power of the + -- radix (to avoid rounding error), so that the square of the scale does + -- not overflow itself. + X : R; Y : R; *************** package body Ada.Numerics.Generic_Comple *** 53,66 **** -- If either component overflows, try to scale (skip in fast math mode) if not Standard'Fast_Math then ! if abs (X) > R'Last then ! X := R'(4.0) * (R'(Left.Re / 2.0) * R'(Right.Re / 2.0) ! - R'(Left.Im / 2.0) * R'(Right.Im / 2.0)); end if; ! if abs (Y) > R'Last then ! Y := R'(4.0) * (R'(Left.Re / 2.0) * R'(Right.Im / 2.0) ! - R'(Left.Im / 2.0) * R'(Right.Re / 2.0)); end if; end if; --- 59,78 ---- -- If either component overflows, try to scale (skip in fast math mode) if not Standard'Fast_Math then ! ! -- Note that the test below is written as a negation. This is to ! -- account for the fact that X and Y may be NaNs, because both of ! -- their operands could overflow. Given that all operations on NaNs ! -- return false, the test can only be written thus. ! ! if not (abs (X) <= R'Last) then ! X := Scale**2 * ((Left.Re / Scale) * (Right.Re / Scale) - ! (Left.Im / Scale) * (Right.Im / Scale)); end if; ! if not (abs (Y) <= R'Last) then ! Y := Scale**2 * ((Left.Re / Scale) * (Right.Im / Scale) ! + (Left.Im / Scale) * (Right.Re / Scale)); end if; end if; *************** package body Ada.Numerics.Generic_Comple *** 569,575 **** -- in order to prevent inaccuracies on machines where not all -- immediate expressions are rounded, such as PowerPC. ! if Re2 > R'Last then raise Constraint_Error; end if; --- 581,588 ---- -- in order to prevent inaccuracies on machines where not all -- immediate expressions are rounded, such as PowerPC. ! -- ??? same weird test, why not Re2 > R'Last ??? ! if not (Re2 <= R'Last) then raise Constraint_Error; end if; *************** package body Ada.Numerics.Generic_Comple *** 582,588 **** begin Im2 := X.Im ** 2; ! if Im2 > R'Last then raise Constraint_Error; end if; --- 595,602 ---- begin Im2 := X.Im ** 2; ! -- ??? same weird test ! if not (Im2 <= R'Last) then raise Constraint_Error; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/a-nudira.adb gcc-4.6.0/gcc/ada/a-nudira.adb *** gcc-4.5.2/gcc/ada/a-nudira.adb Sat Jun 20 10:45:27 2009 --- gcc-4.6.0/gcc/ada/a-nudira.adb Tue Jun 22 17:29:41 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,92 **** -- -- ------------------------------------------------------------------------------ - with Ada.Calendar; - - with Interfaces; use Interfaces; - package body Ada.Numerics.Discrete_Random is ! ------------------------- ! -- Implementation Note -- ! ------------------------- ! ! -- The design of this spec is very awkward, as a result of Ada 95 not ! -- permitting in-out parameters for function formals (most naturally ! -- Generator values would be passed this way). In pure Ada 95, the only ! -- solution is to use the heap and pointers, and, to avoid memory leaks, ! -- controlled types. ! ! -- This is awfully heavy, so what we do is to use Unrestricted_Access to ! -- get a pointer to the state in the passed Generator. This works because ! -- Generator is a limited type and will thus always be passed by reference. ! ! type Pointer is access all State; ! ! Fits_In_32_Bits : constant Boolean := ! Rst'Size < 31 ! or else (Rst'Size = 31 ! and then Rst'Pos (Rst'First) < 0); ! -- This is set True if we do not need more than 32 bits in the result. If ! -- we need 64-bits, we will only use the meaningful 48 bits of any 64-bit ! -- number generated, since if more than 48 bits are required, we split the ! -- computation into two separate parts, since the algorithm does not behave ! -- above 48 bits. ! ! -- The way this expression works is that obviously if the size is 31 bits, ! -- it fits in 32 bits. In the 32-bit case, it fits in 32-bit signed if the ! -- range has negative values. It is too conservative in the case that the ! -- programmer has set a size greater than the default, e.g. a size of 33 ! -- for an integer type with a range of 1..10, but an over-conservative ! -- result is OK. The important thing is that the value is only True if ! -- we know the result will fit in 32-bits signed. If the value is False ! -- when it could be True, the behavior will be correct, just a bit less ! -- efficient than it could have been in some unusual cases. ! -- ! -- One might assume that we could get a more accurate result by testing ! -- the lower and upper bounds of the type Rst against the bounds of 32-bit ! -- Integer. However, there is no easy way to do that. Why? Because in the ! -- relatively rare case where this expresion has to be evaluated at run ! -- time rather than compile time (when the bounds are dynamic), we need a ! -- type to use for the computation. But the possible range of upper bound ! -- values for Rst (remembering the possibility of 64-bit modular types) is ! -- from -2**63 to 2**64-1, and no run-time type has a big enough range. ! ! ----------------------- ! -- Local Subprograms -- ! ----------------------- ! ! function Square_Mod_N (X, N : Int) return Int; ! pragma Inline (Square_Mod_N); ! -- Computes X**2 mod N avoiding intermediate overflow ----------- -- Image -- --- 29,38 ---- -- -- ------------------------------------------------------------------------------ package body Ada.Numerics.Discrete_Random is ! package SRN renames System.Random_Numbers; ! use SRN; ----------- -- Image -- *************** package body Ada.Numerics.Discrete_Rando *** 94,297 **** function Image (Of_State : State) return String is begin ! return Int'Image (Of_State.X1) & ! ',' & ! Int'Image (Of_State.X2) & ! ',' & ! Int'Image (Of_State.Q); end Image; ------------ -- Random -- ------------ ! function Random (Gen : Generator) return Rst is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; ! Temp : Int; ! TF : Flt; ! begin ! -- Check for flat range here, since we are typically run with checks ! -- off, note that in practice, this condition will usually be static ! -- so we will not actually generate any code for the normal case. ! ! if Rst'Last < Rst'First then ! raise Constraint_Error; ! end if; ! ! -- Continue with computation if non-flat range ! ! Genp.X1 := Square_Mod_N (Genp.X1, Genp.P); ! Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q); ! Temp := Genp.X2 - Genp.X1; ! ! -- Following duplication is not an error, it is a loop unwinding! ! ! if Temp < 0 then ! Temp := Temp + Genp.Q; ! end if; ! ! if Temp < 0 then ! Temp := Temp + Genp.Q; ! end if; ! ! TF := Offs + (Flt (Temp) * Flt (Genp.P) + Flt (Genp.X1)) * Genp.Scl; ! ! -- Pathological, but there do exist cases where the rounding implicit ! -- in calculating the scale factor will cause rounding to 'Last + 1. ! -- In those cases, returning 'First results in the least bias. ! ! if TF >= Flt (Rst'Pos (Rst'Last)) + 0.5 then ! return Rst'First; ! ! elsif not Fits_In_32_Bits then ! return Rst'Val (Interfaces.Integer_64 (TF)); ! ! else ! return Rst'Val (Int (TF)); ! end if; end Random; ----------- -- Reset -- ----------- ! procedure Reset (Gen : Generator; Initiator : Integer) is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; ! X1, X2 : Int; ! begin ! X1 := 2 + Int (Initiator) mod (K1 - 3); ! X2 := 2 + Int (Initiator) mod (K2 - 3); ! ! for J in 1 .. 5 loop ! X1 := Square_Mod_N (X1, K1); ! X2 := Square_Mod_N (X2, K2); ! end loop; ! ! -- Eliminate effects of small Initiators ! ! Genp.all := ! (X1 => X1, ! X2 => X2, ! P => K1, ! Q => K2, ! FP => K1F, ! Scl => Scal); end Reset; ! ----------- ! -- Reset -- ! ----------- ! ! procedure Reset (Gen : Generator) is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; ! Now : constant Calendar.Time := Calendar.Clock; ! X1 : Int; ! X2 : Int; ! begin ! X1 := Int (Calendar.Year (Now)) * 12 * 31 + ! Int (Calendar.Month (Now) * 31) + ! Int (Calendar.Day (Now)); ! ! X2 := Int (Calendar.Seconds (Now) * Duration (1000.0)); ! ! X1 := 2 + X1 mod (K1 - 3); ! X2 := 2 + X2 mod (K2 - 3); ! ! -- Eliminate visible effects of same day starts ! ! for J in 1 .. 5 loop ! X1 := Square_Mod_N (X1, K1); ! X2 := Square_Mod_N (X2, K2); ! end loop; ! ! Genp.all := ! (X1 => X1, ! X2 => X2, ! P => K1, ! Q => K2, ! FP => K1F, ! Scl => Scal); ! end Reset; - ----------- - -- Reset -- - ----------- - procedure Reset (Gen : Generator; From_State : State) is - Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; begin ! Genp.all := From_State; end Reset; ---------- -- Save -- ---------- ! procedure Save (Gen : Generator; To_State : out State) is begin ! To_State := Gen.Gen_State; end Save; - ------------------ - -- Square_Mod_N -- - ------------------ - - function Square_Mod_N (X, N : Int) return Int is - begin - return Int ((Integer_64 (X) ** 2) mod (Integer_64 (N))); - end Square_Mod_N; - ----------- -- Value -- ----------- function Value (Coded_State : String) return State is - Last : constant Natural := Coded_State'Last; - Start : Positive := Coded_State'First; - Stop : Positive := Coded_State'First; - Outs : State; - begin ! while Stop <= Last and then Coded_State (Stop) /= ',' loop ! Stop := Stop + 1; ! end loop; ! ! if Stop > Last then ! raise Constraint_Error; ! end if; ! ! Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1)); ! Start := Stop + 1; ! ! loop ! Stop := Stop + 1; ! exit when Stop > Last or else Coded_State (Stop) = ','; ! end loop; ! ! if Stop > Last then ! raise Constraint_Error; ! end if; ! ! Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1)); ! Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last)); ! Outs.P := Outs.Q * 2 + 1; ! Outs.FP := Flt (Outs.P); ! Outs.Scl := (RstL - RstF + 1.0) / (Flt (Outs.P) * Flt (Outs.Q)); ! ! -- Now do *some* sanity checks ! ! if Outs.Q < 31 ! or else Outs.X1 not in 2 .. Outs.P - 1 ! or else Outs.X2 not in 2 .. Outs.Q - 1 ! then ! raise Constraint_Error; ! end if; ! ! return Outs; end Value; end Ada.Numerics.Discrete_Random; --- 40,94 ---- function Image (Of_State : State) return String is begin ! return Image (SRN.State (Of_State)); end Image; ------------ -- Random -- ------------ ! function Random (Gen : Generator) return Result_Subtype is ! function Random is ! new SRN.Random_Discrete (Result_Subtype, Result_Subtype'First); begin ! return Random (SRN.Generator (Gen)); end Random; ----------- -- Reset -- ----------- ! procedure Reset (Gen : Generator) is begin ! Reset (SRN.Generator (Gen)); end Reset; ! procedure Reset (Gen : Generator; Initiator : Integer) is begin ! Reset (SRN.Generator (Gen), Initiator); end Reset; procedure Reset (Gen : Generator; From_State : State) is begin ! Reset (SRN.Generator (Gen), SRN.State (From_State)); end Reset; ---------- -- Save -- ---------- ! procedure Save (Gen : Generator; To_State : out State) is begin ! Save (SRN.Generator (Gen), SRN.State (To_State)); end Save; ----------- -- Value -- ----------- function Value (Coded_State : String) return State is begin ! return State (SRN.State'(Value (Coded_State))); end Value; end Ada.Numerics.Discrete_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/a-nudira.ads gcc-4.6.0/gcc/ada/a-nudira.ads *** gcc-4.5.2/gcc/ada/a-nudira.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-nudira.ads Tue Jun 22 17:29:41 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** *** 33,71 **** -- -- ------------------------------------------------------------------------------ ! -- Note: the implementation used in this package was contributed by Robert ! -- Eachus. It is based on the work of L. Blum, M. Blum, and M. Shub, SIAM ! -- Journal of Computing, Vol 15. No 2, May 1986. The particular choices for P ! -- and Q chosen here guarantee a period of 562,085,314,430,582 (about 2**49), ! -- and the generated sequence has excellent randomness properties. For further ! -- details, see the paper "Fast Generation of Trustworthy Random Numbers", by ! -- Robert Eachus, which describes both the algorithm and the efficient ! -- implementation approach used here. ! with Interfaces; generic type Result_Subtype is (<>); package Ada.Numerics.Discrete_Random is - -- The algorithm used here is reliable from a required statistical point of - -- view only up to 48 bits. We try to behave reasonably in the case of - -- larger types, but we can't guarantee the required properties. So - -- generate a warning for these (slightly) dubious cases. - - pragma Compile_Time_Warning - (Result_Subtype'Size > 48, - "statistical properties not guaranteed for size > 48"); - -- Basic facilities type Generator is limited private; function Random (Gen : Generator) return Result_Subtype; - procedure Reset (Gen : Generator); procedure Reset (Gen : Generator; Initiator : Integer); -- Advanced facilities --- 33,56 ---- -- -- ------------------------------------------------------------------------------ ! -- Note: the implementation used in this package is a version of the ! -- Mersenne Twister. See s-rannum.adb for details and references. ! with System.Random_Numbers; generic type Result_Subtype is (<>); package Ada.Numerics.Discrete_Random is -- Basic facilities type Generator is limited private; function Random (Gen : Generator) return Result_Subtype; procedure Reset (Gen : Generator; Initiator : Integer); + procedure Reset (Gen : Generator); -- Advanced facilities *************** package Ada.Numerics.Discrete_Random is *** 74,114 **** procedure Save (Gen : Generator; To_State : out State); procedure Reset (Gen : Generator; From_State : State); ! Max_Image_Width : constant := 80; function Image (Of_State : State) return String; function Value (Coded_State : String) return State; private - subtype Int is Interfaces.Integer_32; - subtype Rst is Result_Subtype; ! -- We prefer to use 14 digits for Flt, but some targets are more limited ! ! type Flt is digits Positive'Min (14, Long_Long_Float'Digits); ! ! RstF : constant Flt := Flt (Rst'Pos (Rst'First)); ! RstL : constant Flt := Flt (Rst'Pos (Rst'Last)); ! ! Offs : constant Flt := RstF - 0.5; ! ! K1 : constant := 94_833_359; ! K1F : constant := 94_833_359.0; ! K2 : constant := 47_416_679; ! K2F : constant := 47_416_679.0; ! Scal : constant Flt := (RstL - RstF + 1.0) / (K1F * K2F); ! ! type State is record ! X1 : Int := Int (2999 ** 2); ! X2 : Int := Int (1439 ** 2); ! P : Int := K1; ! Q : Int := K2; ! FP : Flt := K1F; ! Scl : Flt := Scal; ! end record; ! type Generator is limited record ! Gen_State : State; ! end record; end Ada.Numerics.Discrete_Random; --- 59,73 ---- procedure Save (Gen : Generator; To_State : out State); procedure Reset (Gen : Generator; From_State : State); ! Max_Image_Width : constant := System.Random_Numbers.Max_Image_Width; function Image (Of_State : State) return String; function Value (Coded_State : String) return State; private ! type Generator is new System.Random_Numbers.Generator; ! type State is new System.Random_Numbers.State; end Ada.Numerics.Discrete_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/a-nuflra.adb gcc-4.6.0/gcc/ada/a-nuflra.adb *** gcc-4.5.2/gcc/ada/a-nuflra.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-nuflra.adb Tue Jun 22 17:29:41 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,125 **** -- -- ------------------------------------------------------------------------------ - with Ada.Calendar; - package body Ada.Numerics.Float_Random is ! ------------------------- ! -- Implementation Note -- ! ------------------------- ! ! -- The design of this spec is very awkward, as a result of Ada 95 not ! -- permitting in-out parameters for function formals (most naturally ! -- Generator values would be passed this way). In pure Ada 95, the only ! -- solution is to use the heap and pointers, and, to avoid memory leaks, ! -- controlled types. ! ! -- This is awfully heavy, so what we do is to use Unrestricted_Access to ! -- get a pointer to the state in the passed Generator. This works because ! -- Generator is a limited type and will thus always be passed by reference. ! ! type Pointer is access all State; ! ! ----------------------- ! -- Local Subprograms -- ! ----------------------- ! ! procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int); ! ! function Euclid (P, Q : Int) return Int; ! ! function Square_Mod_N (X, N : Int) return Int; ! ! ------------ ! -- Euclid -- ! ------------ ! ! procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int) is ! ! XT : Int := 1; ! YT : Int := 0; ! ! procedure Recur ! (P, Q : Int; -- a (i-1), a (i) ! X, Y : Int; -- x (i), y (i) ! XP, YP : in out Int; -- x (i-1), y (i-1) ! GCD : out Int); ! ! procedure Recur ! (P, Q : Int; ! X, Y : Int; ! XP, YP : in out Int; ! GCD : out Int) ! is ! Quo : Int := P / Q; -- q <-- |_ a (i-1) / a (i) _| ! XT : Int := X; -- x (i) ! YT : Int := Y; -- y (i) ! ! begin ! if P rem Q = 0 then -- while does not divide ! GCD := Q; ! XP := X; ! YP := Y; ! else ! Recur (Q, P - Q * Quo, XP - Quo * X, YP - Quo * Y, XT, YT, Quo); ! ! -- a (i) <== a (i) ! -- a (i+1) <-- a (i-1) - q*a (i) ! -- x (i+1) <-- x (i-1) - q*x (i) ! -- y (i+1) <-- y (i-1) - q*y (i) ! -- x (i) <== x (i) ! -- y (i) <== y (i) ! ! XP := XT; ! YP := YT; ! GCD := Quo; ! end if; ! end Recur; ! ! -- Start of processing for Euclid ! ! begin ! Recur (P, Q, 0, 1, XT, YT, GCD); ! X := XT; ! Y := YT; ! end Euclid; ! ! function Euclid (P, Q : Int) return Int is ! X, Y, GCD : Int; ! pragma Unreferenced (Y, GCD); ! begin ! Euclid (P, Q, X, Y, GCD); ! return X; ! end Euclid; ----------- -- Image -- --- 29,38 ---- -- -- ------------------------------------------------------------------------------ package body Ada.Numerics.Float_Random is ! package SRN renames System.Random_Numbers; ! use SRN; ----------- -- Image -- *************** package body Ada.Numerics.Float_Random i *** 127,311 **** function Image (Of_State : State) return String is begin ! return Int'Image (Of_State.X1) & ',' & Int'Image (Of_State.X2) ! & ',' & ! Int'Image (Of_State.P) & ',' & Int'Image (Of_State.Q); end Image; ------------ -- Random -- ------------ ! function Random (Gen : Generator) return Uniformly_Distributed is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; ! begin ! Genp.X1 := Square_Mod_N (Genp.X1, Genp.P); ! Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q); ! return ! Float ((Flt (((Genp.X2 - Genp.X1) * Genp.X) ! mod Genp.Q) * Flt (Genp.P) ! + Flt (Genp.X1)) * Genp.Scl); end Random; ----------- -- Reset -- ----------- ! -- Version that works from given initiator value ! ! procedure Reset (Gen : Generator; Initiator : Integer) is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; ! X1, X2 : Int; begin ! X1 := 2 + Int (Initiator) mod (K1 - 3); ! X2 := 2 + Int (Initiator) mod (K2 - 3); ! ! -- Eliminate effects of small initiators ! ! for J in 1 .. 5 loop ! X1 := Square_Mod_N (X1, K1); ! X2 := Square_Mod_N (X2, K2); ! end loop; ! ! Genp.all := ! (X1 => X1, ! X2 => X2, ! P => K1, ! Q => K2, ! X => 1, ! Scl => Scal); end Reset; ! -- Version that works from specific saved state ! ! procedure Reset (Gen : Generator; From_State : State) is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; begin ! Genp.all := From_State; end Reset; ! -- Version that works from calendar ! ! procedure Reset (Gen : Generator) is ! Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; ! Now : constant Calendar.Time := Calendar.Clock; ! X1, X2 : Int; begin ! X1 := Int (Calendar.Year (Now)) * 12 * 31 + ! Int (Calendar.Month (Now)) * 31 + ! Int (Calendar.Day (Now)); ! ! X2 := Int (Calendar.Seconds (Now) * Duration (1000.0)); ! ! X1 := 2 + X1 mod (K1 - 3); ! X2 := 2 + X2 mod (K2 - 3); ! ! -- Eliminate visible effects of same day starts ! ! for J in 1 .. 5 loop ! X1 := Square_Mod_N (X1, K1); ! X2 := Square_Mod_N (X2, K2); ! end loop; ! ! Genp.all := ! (X1 => X1, ! X2 => X2, ! P => K1, ! Q => K2, ! X => 1, ! Scl => Scal); ! end Reset; ---------- -- Save -- ---------- ! procedure Save (Gen : Generator; To_State : out State) is begin ! To_State := Gen.Gen_State; end Save; - ------------------ - -- Square_Mod_N -- - ------------------ - - function Square_Mod_N (X, N : Int) return Int is - Temp : constant Flt := Flt (X) * Flt (X); - Div : Int; - - begin - Div := Int (Temp / Flt (N)); - Div := Int (Temp - Flt (Div) * Flt (N)); - - if Div < 0 then - return Div + N; - else - return Div; - end if; - end Square_Mod_N; - ----------- -- Value -- ----------- function Value (Coded_State : String) return State is ! Last : constant Natural := Coded_State'Last; ! Start : Positive := Coded_State'First; ! Stop : Positive := Coded_State'First; ! Outs : State; ! begin ! while Stop <= Last and then Coded_State (Stop) /= ',' loop ! Stop := Stop + 1; ! end loop; ! ! if Stop > Last then ! raise Constraint_Error; ! end if; ! ! Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1)); ! Start := Stop + 1; ! ! loop ! Stop := Stop + 1; ! exit when Stop > Last or else Coded_State (Stop) = ','; ! end loop; ! ! if Stop > Last then ! raise Constraint_Error; ! end if; ! ! Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1)); ! Start := Stop + 1; ! ! loop ! Stop := Stop + 1; ! exit when Stop > Last or else Coded_State (Stop) = ','; ! end loop; ! ! if Stop > Last then ! raise Constraint_Error; ! end if; ! ! Outs.P := Int'Value (Coded_State (Start .. Stop - 1)); ! Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last)); ! Outs.X := Euclid (Outs.P, Outs.Q); ! Outs.Scl := 1.0 / (Flt (Outs.P) * Flt (Outs.Q)); ! ! -- Now do *some* sanity checks ! ! if Outs.Q < 31 or else Outs.P < 31 ! or else Outs.X1 not in 2 .. Outs.P - 1 ! or else Outs.X2 not in 2 .. Outs.Q - 1 ! then ! raise Constraint_Error; ! end if; ! ! return Outs; end Value; end Ada.Numerics.Float_Random; --- 40,102 ---- function Image (Of_State : State) return String is begin ! return Image (SRN.State (Of_State)); end Image; ------------ -- Random -- ------------ ! function Random (Gen : Generator) return Uniformly_Distributed is begin ! return Random (SRN.Generator (Gen)); end Random; ----------- -- Reset -- ----------- ! -- Version that works from calendar + procedure Reset (Gen : Generator) is begin ! Reset (SRN.Generator (Gen)); end Reset; ! -- Version that works from given initiator value + procedure Reset (Gen : Generator; Initiator : Integer) is begin ! Reset (SRN.Generator (Gen), Initiator); end Reset; ! -- Version that works from specific saved state + procedure Reset (Gen : Generator; From_State : State) is begin ! Reset (SRN.Generator (Gen), From_State); end Reset; ---------- -- Save -- ---------- ! procedure Save (Gen : Generator; To_State : out State) is begin ! Save (SRN.Generator (Gen), To_State); end Save; ----------- -- Value -- ----------- function Value (Coded_State : String) return State is ! G : SRN.Generator; ! S : SRN.State; begin ! Reset (G, Coded_State); ! Save (G, S); ! return State (S); end Value; + end Ada.Numerics.Float_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/a-nuflra.ads gcc-4.6.0/gcc/ada/a-nuflra.ads *** gcc-4.5.2/gcc/ada/a-nuflra.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-nuflra.ads Tue Jun 22 17:29:41 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** *** 33,49 **** -- -- ------------------------------------------------------------------------------ ! -- Note: the implementation used in this package was contributed by ! -- Robert Eachus. It is based on the work of L. Blum, M. Blum, and ! -- M. Shub, SIAM Journal of Computing, Vol 15. No 2, May 1986. The ! -- particular choices for P and Q chosen here guarantee a period of ! -- 562,085,314,430,582 (about 2**49), and the generated sequence has ! -- excellent randomness properties. For further details, see the ! -- paper "Fast Generation of Trustworthy Random Numbers", by Robert ! -- Eachus, which describes both the algorithm and the efficient ! -- implementation approach used here. ! with Interfaces; package Ada.Numerics.Float_Random is --- 33,42 ---- -- -- ------------------------------------------------------------------------------ ! -- Note: the implementation used in this package is a version of the ! -- Mersenne Twister. See s-rannum.adb for details and references. ! with System.Random_Numbers; package Ada.Numerics.Float_Random is *************** package Ada.Numerics.Float_Random is *** 65,99 **** procedure Save (Gen : Generator; To_State : out State); procedure Reset (Gen : Generator; From_State : State); ! Max_Image_Width : constant := 80; function Image (Of_State : State) return String; function Value (Coded_State : String) return State; private - type Int is new Interfaces.Integer_32; ! -- We prefer to use 14 digits for Flt, but some targets are more limited ! ! type Flt is digits Positive'Min (14, Long_Long_Float'Digits); ! ! K1 : constant := 94_833_359; ! K1F : constant := 94_833_359.0; ! K2 : constant := 47_416_679; ! K2F : constant := 47_416_679.0; ! Scal : constant := 1.0 / (K1F * K2F); ! ! type State is record ! X1 : Int := 2999 ** 2; -- Square mod p ! X2 : Int := 1439 ** 2; -- Square mod q ! P : Int := K1; ! Q : Int := K2; ! X : Int := 1; ! Scl : Flt := Scal; ! end record; ! type Generator is limited record ! Gen_State : State; ! end record; end Ada.Numerics.Float_Random; --- 58,72 ---- procedure Save (Gen : Generator; To_State : out State); procedure Reset (Gen : Generator; From_State : State); ! Max_Image_Width : constant := System.Random_Numbers.Max_Image_Width; function Image (Of_State : State) return String; function Value (Coded_State : String) return State; private ! type Generator is new System.Random_Numbers.Generator; ! type State is new System.Random_Numbers.State; end Ada.Numerics.Float_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/a-rbtgbk.adb gcc-4.6.0/gcc/ada/a-rbtgbk.adb *** gcc-4.5.2/gcc/ada/a-rbtgbk.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-rbtgbk.adb Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,599 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_KEYS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys is + + package Ops renames Tree_Operations; + + ------------- + -- Ceiling -- + ------------- + + -- AKA Lower_Bound + + function Ceiling + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type + is + Y : Count_Type; + X : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + Y := 0; + + X := Tree.Root; + while X /= 0 loop + if Is_Greater_Key_Node (Key, N (X)) then + X := Ops.Right (N (X)); + else + Y := X; + X := Ops.Left (N (X)); + end if; + end loop; + + return Y; + end Ceiling; + + ---------- + -- Find -- + ---------- + + function Find + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type + is + Y : Count_Type; + X : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + Y := 0; + + X := Tree.Root; + while X /= 0 loop + if Is_Greater_Key_Node (Key, N (X)) then + X := Ops.Right (N (X)); + else + Y := X; + X := Ops.Left (N (X)); + end if; + end loop; + + if Y = 0 then + return 0; + end if; + + if Is_Less_Key_Node (Key, N (Y)) then + return 0; + end if; + + return Y; + end Find; + + ----------- + -- Floor -- + ----------- + + function Floor + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type + is + Y : Count_Type; + X : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + Y := 0; + + X := Tree.Root; + while X /= 0 loop + if Is_Less_Key_Node (Key, N (X)) then + X := Ops.Left (N (X)); + else + Y := X; + X := Ops.Right (N (X)); + end if; + end loop; + + return Y; + end Floor; + + -------------------------------- + -- Generic_Conditional_Insert -- + -------------------------------- + + procedure Generic_Conditional_Insert + (Tree : in out Tree_Type'Class; + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean) + is + Y : Count_Type; + X : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + Y := 0; + + X := Tree.Root; + Inserted := True; + while X /= 0 loop + Y := X; + Inserted := Is_Less_Key_Node (Key, N (X)); + X := (if Inserted then Ops.Left (N (X)) else Ops.Right (N (X))); + end loop; + + -- If Inserted is True, then this means either that Tree is + -- empty, or there was a least one node (strictly) greater than + -- Key. Otherwise, it means that Key is equal to or greater than + -- every node. + + if Inserted then + if Y = Tree.First then + Insert_Post (Tree, Y, True, Node); + return; + end if; + + Node := Ops.Previous (Tree, Y); + + else + Node := Y; + end if; + + -- Here Node has a value that is less than or equal to Key. We + -- now have to resolve whether Key is equal to or greater than + -- Node, which determines whether the insertion succeeds. + + if Is_Greater_Key_Node (Key, N (Node)) then + Insert_Post (Tree, Y, Inserted, Node); + Inserted := True; + return; + end if; + + Inserted := False; + end Generic_Conditional_Insert; + + ------------------------------------------ + -- Generic_Conditional_Insert_With_Hint -- + ------------------------------------------ + + procedure Generic_Conditional_Insert_With_Hint + (Tree : in out Tree_Type'Class; + Position : Count_Type; + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean) + is + N : Nodes_Type renames Tree.Nodes; + + begin + -- The purpose of a hint is to avoid a search from the root of + -- tree. If we have it hint it means we only need to traverse the + -- subtree rooted at the hint to find the nearest neighbor. Note + -- that finding the neighbor means merely walking the tree; this + -- is not a search and the only comparisons that occur are with + -- the hint and its neighbor. + + -- If Position is 0, this is interpreted to mean that Key is + -- large relative to the nodes in the tree. If the tree is empty, + -- or Key is greater than the last node in the tree, then we're + -- done; otherwise the hint was "wrong" and we must search. + + if Position = 0 then -- largest + if Tree.Last = 0 + or else Is_Greater_Key_Node (Key, N (Tree.Last)) + then + Insert_Post (Tree, Tree.Last, False, Node); + Inserted := True; + else + Conditional_Insert_Sans_Hint (Tree, Key, Node, Inserted); + end if; + + return; + end if; + + pragma Assert (Tree.Length > 0); + + -- A hint can either name the node that immediately follows Key, + -- or immediately precedes Key. We first test whether Key is + -- less than the hint, and if so we compare Key to the node that + -- precedes the hint. If Key is both less than the hint and + -- greater than the hint's preceding neighbor, then we're done; + -- otherwise we must search. + + -- Note also that a hint can either be an anterior node or a leaf + -- node. A new node is always inserted at the bottom of the tree + -- (at least prior to rebalancing), becoming the new left or + -- right child of leaf node (which prior to the insertion must + -- necessarily be null, since this is a leaf). If the hint names + -- an anterior node then its neighbor must be a leaf, and so + -- (here) we insert after the neighbor. If the hint names a leaf + -- then its neighbor must be anterior and so we insert before the + -- hint. + + if Is_Less_Key_Node (Key, N (Position)) then + declare + Before : constant Count_Type := Ops.Previous (Tree, Position); + + begin + if Before = 0 then + Insert_Post (Tree, Tree.First, True, Node); + Inserted := True; + + elsif Is_Greater_Key_Node (Key, N (Before)) then + if Ops.Right (N (Before)) = 0 then + Insert_Post (Tree, Before, False, Node); + else + Insert_Post (Tree, Position, True, Node); + end if; + + Inserted := True; + + else + Conditional_Insert_Sans_Hint (Tree, Key, Node, Inserted); + end if; + end; + + return; + end if; + + -- We know that Key isn't less than the hint so we try again, + -- this time to see if it's greater than the hint. If so we + -- compare Key to the node that follows the hint. If Key is both + -- greater than the hint and less than the hint's next neighbor, + -- then we're done; otherwise we must search. + + if Is_Greater_Key_Node (Key, N (Position)) then + declare + After : constant Count_Type := Ops.Next (Tree, Position); + + begin + if After = 0 then + Insert_Post (Tree, Tree.Last, False, Node); + Inserted := True; + + elsif Is_Less_Key_Node (Key, N (After)) then + if Ops.Right (N (Position)) = 0 then + Insert_Post (Tree, Position, False, Node); + else + Insert_Post (Tree, After, True, Node); + end if; + + Inserted := True; + + else + Conditional_Insert_Sans_Hint (Tree, Key, Node, Inserted); + end if; + end; + + return; + end if; + + -- We know that Key is neither less than the hint nor greater + -- than the hint, and that's the definition of equivalence. + -- There's nothing else we need to do, since a search would just + -- reach the same conclusion. + + Node := Position; + Inserted := False; + end Generic_Conditional_Insert_With_Hint; + + ------------------------- + -- Generic_Insert_Post -- + ------------------------- + + procedure Generic_Insert_Post + (Tree : in out Tree_Type'Class; + Y : Count_Type; + Before : Boolean; + Z : out Count_Type) + is + N : Nodes_Type renames Tree.Nodes; + + begin + if Tree.Length >= Tree.Capacity then + raise Capacity_Error with "not enough capacity to insert new item"; + end if; + + if Tree.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Z := New_Node; + pragma Assert (Z /= 0); + + if Y = 0 then + pragma Assert (Tree.Length = 0); + pragma Assert (Tree.Root = 0); + pragma Assert (Tree.First = 0); + pragma Assert (Tree.Last = 0); + + Tree.Root := Z; + Tree.First := Z; + Tree.Last := Z; + + elsif Before then + pragma Assert (Ops.Left (N (Y)) = 0); + + Ops.Set_Left (N (Y), Z); + + if Y = Tree.First then + Tree.First := Z; + end if; + + else + pragma Assert (Ops.Right (N (Y)) = 0); + + Ops.Set_Right (N (Y), Z); + + if Y = Tree.Last then + Tree.Last := Z; + end if; + end if; + + Ops.Set_Color (N (Z), Red); + Ops.Set_Parent (N (Z), Y); + Ops.Rebalance_For_Insert (Tree, Z); + Tree.Length := Tree.Length + 1; + end Generic_Insert_Post; + + ----------------------- + -- Generic_Iteration -- + ----------------------- + + procedure Generic_Iteration + (Tree : Tree_Type'Class; + Key : Key_Type) + is + procedure Iterate (Index : Count_Type); + + ------------- + -- Iterate -- + ------------- + + procedure Iterate (Index : Count_Type) is + J : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + J := Index; + while J /= 0 loop + if Is_Less_Key_Node (Key, N (J)) then + J := Ops.Left (N (J)); + elsif Is_Greater_Key_Node (Key, N (J)) then + J := Ops.Right (N (J)); + else + Iterate (Ops.Left (N (J))); + Process (J); + J := Ops.Right (N (J)); + end if; + end loop; + end Iterate; + + -- Start of processing for Generic_Iteration + + begin + Iterate (Tree.Root); + end Generic_Iteration; + + ------------------------------- + -- Generic_Reverse_Iteration -- + ------------------------------- + + procedure Generic_Reverse_Iteration + (Tree : Tree_Type'Class; + Key : Key_Type) + is + procedure Iterate (Index : Count_Type); + + ------------- + -- Iterate -- + ------------- + + procedure Iterate (Index : Count_Type) is + J : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + J := Index; + while J /= 0 loop + if Is_Less_Key_Node (Key, N (J)) then + J := Ops.Left (N (J)); + elsif Is_Greater_Key_Node (Key, N (J)) then + J := Ops.Right (N (J)); + else + Iterate (Ops.Right (N (J))); + Process (J); + J := Ops.Left (N (J)); + end if; + end loop; + end Iterate; + + -- Start of processing for Generic_Reverse_Iteration + + begin + Iterate (Tree.Root); + end Generic_Reverse_Iteration; + + ---------------------------------- + -- Generic_Unconditional_Insert -- + ---------------------------------- + + procedure Generic_Unconditional_Insert + (Tree : in out Tree_Type'Class; + Key : Key_Type; + Node : out Count_Type) + is + Y : Count_Type; + X : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + Before : Boolean; + + begin + Y := 0; + Before := False; + + X := Tree.Root; + while X /= 0 loop + Y := X; + Before := Is_Less_Key_Node (Key, N (X)); + X := (if Before then Ops.Left (N (X)) else Ops.Right (N (X))); + end loop; + + Insert_Post (Tree, Y, Before, Node); + end Generic_Unconditional_Insert; + + -------------------------------------------- + -- Generic_Unconditional_Insert_With_Hint -- + -------------------------------------------- + + procedure Generic_Unconditional_Insert_With_Hint + (Tree : in out Tree_Type'Class; + Hint : Count_Type; + Key : Key_Type; + Node : out Count_Type) + is + N : Nodes_Type renames Tree.Nodes; + + begin + -- There are fewer constraints for an unconditional insertion + -- than for a conditional insertion, since we allow duplicate + -- keys. So instead of having to check (say) whether Key is + -- (strictly) greater than the hint's previous neighbor, here we + -- allow Key to be equal to or greater than the previous node. + + -- There is the issue of what to do if Key is equivalent to the + -- hint. Does the new node get inserted before or after the hint? + -- We decide that it gets inserted after the hint, reasoning that + -- this is consistent with behavior for non-hint insertion, which + -- inserts a new node after existing nodes with equivalent keys. + + -- First we check whether the hint is null, which is interpreted + -- to mean that Key is large relative to existing nodes. + -- Following our rule above, if Key is equal to or greater than + -- the last node, then we insert the new node immediately after + -- last. (We don't have an operation for testing whether a key is + -- "equal to or greater than" a node, so we must say instead "not + -- less than", which is equivalent.) + + if Hint = 0 then -- largest + if Tree.Last = 0 then + Insert_Post (Tree, 0, False, Node); + elsif Is_Less_Key_Node (Key, N (Tree.Last)) then + Unconditional_Insert_Sans_Hint (Tree, Key, Node); + else + Insert_Post (Tree, Tree.Last, False, Node); + end if; + + return; + end if; + + pragma Assert (Tree.Length > 0); + + -- We decide here whether to insert the new node prior to the + -- hint. Key could be equivalent to the hint, so in theory we + -- could write the following test as "not greater than" (same as + -- "less than or equal to"). If Key were equivalent to the hint, + -- that would mean that the new node gets inserted before an + -- equivalent node. That wouldn't break any container invariants, + -- but our rule above says that new nodes always get inserted + -- after equivalent nodes. So here we test whether Key is both + -- less than the hint and equal to or greater than the hint's + -- previous neighbor, and if so insert it before the hint. + + if Is_Less_Key_Node (Key, N (Hint)) then + declare + Before : constant Count_Type := Ops.Previous (Tree, Hint); + begin + if Before = 0 then + Insert_Post (Tree, Hint, True, Node); + elsif Is_Less_Key_Node (Key, N (Before)) then + Unconditional_Insert_Sans_Hint (Tree, Key, Node); + elsif Ops.Right (N (Before)) = 0 then + Insert_Post (Tree, Before, False, Node); + else + Insert_Post (Tree, Hint, True, Node); + end if; + end; + + return; + end if; + + -- We know that Key isn't less than the hint, so it must be equal + -- or greater. So we just test whether Key is less than or equal + -- to (same as "not greater than") the hint's next neighbor, and + -- if so insert it after the hint. + + declare + After : constant Count_Type := Ops.Next (Tree, Hint); + begin + if After = 0 then + Insert_Post (Tree, Hint, False, Node); + elsif Is_Greater_Key_Node (Key, N (After)) then + Unconditional_Insert_Sans_Hint (Tree, Key, Node); + elsif Ops.Right (N (Hint)) = 0 then + Insert_Post (Tree, Hint, False, Node); + else + Insert_Post (Tree, After, True, Node); + end if; + end; + end Generic_Unconditional_Insert_With_Hint; + + ----------------- + -- Upper_Bound -- + ----------------- + + function Upper_Bound + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type + is + Y : Count_Type; + X : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + Y := 0; + + X := Tree.Root; + while X /= 0 loop + if Is_Less_Key_Node (Key, N (X)) then + Y := X; + X := Ops.Left (N (X)); + else + X := Ops.Right (N (X)); + end if; + end loop; + + return Y; + end Upper_Bound; + + end Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys; diff -Nrcpad gcc-4.5.2/gcc/ada/a-rbtgbk.ads gcc-4.6.0/gcc/ada/a-rbtgbk.ads *** gcc-4.5.2/gcc/ada/a-rbtgbk.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-rbtgbk.ads Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,193 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_KEYS -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + -- Tree_Type is used to implement ordered containers. This package declares + -- the tree operations that depend on keys. + + with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; + + generic + with package Tree_Operations is new Generic_Bounded_Operations (<>); + + use Tree_Operations.Tree_Types; + + type Key_Type (<>) is limited private; + + with function Is_Less_Key_Node + (L : Key_Type; + R : Node_Type) return Boolean; + + with function Is_Greater_Key_Node + (L : Key_Type; + R : Node_Type) return Boolean; + + package Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys is + pragma Pure; + + generic + with function New_Node return Count_Type; + + procedure Generic_Insert_Post + (Tree : in out Tree_Type'Class; + Y : Count_Type; + Before : Boolean; + Z : out Count_Type); + -- Completes an insertion after the insertion position has been + -- determined. On output Z contains the index of the newly inserted + -- node, allocated using Allocate. If Tree is busy then + -- Program_Error is raised. If Y is 0, then Tree must be empty. + -- Otherwise Y denotes the insertion position, and Before specifies + -- whether the new node is Y's left (True) or right (False) child. + + generic + with procedure Insert_Post + (T : in out Tree_Type'Class; + Y : Count_Type; + B : Boolean; + Z : out Count_Type); + + procedure Generic_Conditional_Insert + (Tree : in out Tree_Type'Class; + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean); + -- Inserts a new node in Tree, but only if the tree does not already + -- contain Key. Generic_Conditional_Insert first searches for a key + -- equivalent to Key in Tree. If an equivalent key is found, then on + -- output Node designates the node with that key and Inserted is + -- False; there is no allocation and Tree is not modified. Otherwise + -- Node designates a new node allocated using Insert_Post, and + -- Inserted is True. + + generic + with procedure Insert_Post + (T : in out Tree_Type'Class; + Y : Count_Type; + B : Boolean; + Z : out Count_Type); + + procedure Generic_Unconditional_Insert + (Tree : in out Tree_Type'Class; + Key : Key_Type; + Node : out Count_Type); + -- Inserts a new node in Tree. On output Node designates the new + -- node, which is allocated using Insert_Post. The node is inserted + -- immediately after already-existing equivalent keys. + + generic + with procedure Insert_Post + (T : in out Tree_Type'Class; + Y : Count_Type; + B : Boolean; + Z : out Count_Type); + + with procedure Unconditional_Insert_Sans_Hint + (Tree : in out Tree_Type'Class; + Key : Key_Type; + Node : out Count_Type); + + procedure Generic_Unconditional_Insert_With_Hint + (Tree : in out Tree_Type'Class; + Hint : Count_Type; + Key : Key_Type; + Node : out Count_Type); + -- Inserts a new node in Tree near position Hint, to avoid having to + -- search from the root for the insertion position. If Hint is 0 + -- then Generic_Unconditional_Insert_With_Hint attempts to insert + -- the new node after Tree.Last. If Hint is non-zero then if Key is + -- less than Hint, it attempts to insert the new node immediately + -- prior to Hint. Otherwise it attempts to insert the node + -- immediately following Hint. We say "attempts" above to emphasize + -- that insertions always preserve invariants with respect to key + -- order, even when there's a hint. So if Key can't be inserted + -- immediately near Hint, then the new node is inserted in the + -- normal way, by searching for the correct position starting from + -- the root. + + generic + with procedure Insert_Post + (T : in out Tree_Type'Class; + Y : Count_Type; + B : Boolean; + Z : out Count_Type); + + with procedure Conditional_Insert_Sans_Hint + (Tree : in out Tree_Type'Class; + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean); + + procedure Generic_Conditional_Insert_With_Hint + (Tree : in out Tree_Type'Class; + Position : Count_Type; -- the hint + Key : Key_Type; + Node : out Count_Type; + Inserted : out Boolean); + -- Inserts a new node in Tree if the tree does not already contain + -- Key, using Position as a hint about where to insert the new node. + -- See Generic_Unconditional_Insert_With_Hint for more details about + -- hint semantics. + + function Find + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type; + -- Searches Tree for the smallest node equivalent to Key + + function Ceiling + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type; + -- Searches Tree for the smallest node equal to or greater than Key + + function Floor + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type; + -- Searches Tree for the largest node less than or equal to Key + + function Upper_Bound + (Tree : Tree_Type'Class; + Key : Key_Type) return Count_Type; + -- Searches Tree for the smallest node greater than Key + + generic + with procedure Process (Index : Count_Type); + procedure Generic_Iteration + (Tree : Tree_Type'Class; + Key : Key_Type); + -- Calls Process for each node in Tree equivalent to Key, in order + -- from earliest in range to latest. + + generic + with procedure Process (Index : Count_Type); + procedure Generic_Reverse_Iteration + (Tree : Tree_Type'Class; + Key : Key_Type); + -- Calls Process for each node in Tree equivalent to Key, but in + -- order from largest in range to earliest. + + end Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys; diff -Nrcpad gcc-4.5.2/gcc/ada/a-rbtgbo.adb gcc-4.6.0/gcc/ada/a-rbtgbo.adb *** gcc-4.5.2/gcc/ada/a-rbtgbo.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-rbtgbo.adb Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,1118 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_OPERATIONS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + -- The references below to "CLR" refer to the following book, from which + -- several of the algorithms here were adapted: + -- Introduction to Algorithms + -- by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest + -- Publisher: The MIT Press (June 18, 1990) + -- ISBN: 0262031418 + + with System; use type System.Address; + + package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is + + ----------------------- + -- Local Subprograms -- + ----------------------- + + procedure Delete_Fixup (Tree : in out Tree_Type'Class; Node : Count_Type); + procedure Delete_Swap (Tree : in out Tree_Type'Class; Z, Y : Count_Type); + + procedure Left_Rotate (Tree : in out Tree_Type'Class; X : Count_Type); + procedure Right_Rotate (Tree : in out Tree_Type'Class; Y : Count_Type); + + ---------------- + -- Clear_Tree -- + ---------------- + + procedure Clear_Tree (Tree : in out Tree_Type'Class) is + begin + if Tree.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + Tree.First := 0; + Tree.Last := 0; + Tree.Root := 0; + Tree.Length := 0; + -- Tree.Busy + -- Tree.Lock + Tree.Free := -1; + end Clear_Tree; + + ------------------ + -- Delete_Fixup -- + ------------------ + + procedure Delete_Fixup + (Tree : in out Tree_Type'Class; + Node : Count_Type) + is + + -- CLR p274 + + X : Count_Type; + W : Count_Type; + N : Nodes_Type renames Tree.Nodes; + + begin + X := Node; + while X /= Tree.Root + and then Color (N (X)) = Black + loop + if X = Left (N (Parent (N (X)))) then + W := Right (N (Parent (N (X)))); + + if Color (N (W)) = Red then + Set_Color (N (W), Black); + Set_Color (N (Parent (N (X))), Red); + Left_Rotate (Tree, Parent (N (X))); + W := Right (N (Parent (N (X)))); + end if; + + if (Left (N (W)) = 0 or else Color (N (Left (N (W)))) = Black) + and then + (Right (N (W)) = 0 or else Color (N (Right (N (W)))) = Black) + then + Set_Color (N (W), Red); + X := Parent (N (X)); + + else + if Right (N (W)) = 0 + or else Color (N (Right (N (W)))) = Black + then + -- As a condition for setting the color of the left child to + -- black, the left child access value must be non-null. A + -- truth table analysis shows that if we arrive here, that + -- condition holds, so there's no need for an explicit test. + -- The assertion is here to document what we know is true. + + pragma Assert (Left (N (W)) /= 0); + Set_Color (N (Left (N (W))), Black); + + Set_Color (N (W), Red); + Right_Rotate (Tree, W); + W := Right (N (Parent (N (X)))); + end if; + + Set_Color (N (W), Color (N (Parent (N (X))))); + Set_Color (N (Parent (N (X))), Black); + Set_Color (N (Right (N (W))), Black); + Left_Rotate (Tree, Parent (N (X))); + X := Tree.Root; + end if; + + else + pragma Assert (X = Right (N (Parent (N (X))))); + + W := Left (N (Parent (N (X)))); + + if Color (N (W)) = Red then + Set_Color (N (W), Black); + Set_Color (N (Parent (N (X))), Red); + Right_Rotate (Tree, Parent (N (X))); + W := Left (N (Parent (N (X)))); + end if; + + if (Left (N (W)) = 0 or else Color (N (Left (N (W)))) = Black) + and then + (Right (N (W)) = 0 or else Color (N (Right (N (W)))) = Black) + then + Set_Color (N (W), Red); + X := Parent (N (X)); + + else + if Left (N (W)) = 0 + or else Color (N (Left (N (W)))) = Black + then + -- As a condition for setting the color of the right child + -- to black, the right child access value must be non-null. + -- A truth table analysis shows that if we arrive here, that + -- condition holds, so there's no need for an explicit test. + -- The assertion is here to document what we know is true. + + pragma Assert (Right (N (W)) /= 0); + Set_Color (N (Right (N (W))), Black); + + Set_Color (N (W), Red); + Left_Rotate (Tree, W); + W := Left (N (Parent (N (X)))); + end if; + + Set_Color (N (W), Color (N (Parent (N (X))))); + Set_Color (N (Parent (N (X))), Black); + Set_Color (N (Left (N (W))), Black); + Right_Rotate (Tree, Parent (N (X))); + X := Tree.Root; + end if; + end if; + end loop; + + Set_Color (N (X), Black); + end Delete_Fixup; + + --------------------------- + -- Delete_Node_Sans_Free -- + --------------------------- + + procedure Delete_Node_Sans_Free + (Tree : in out Tree_Type'Class; + Node : Count_Type) + is + -- CLR p273 + + X, Y : Count_Type; + + Z : constant Count_Type := Node; + pragma Assert (Z /= 0); + + N : Nodes_Type renames Tree.Nodes; + + begin + if Tree.Busy > 0 then + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; + end if; + + pragma Assert (Tree.Length > 0); + pragma Assert (Tree.Root /= 0); + pragma Assert (Tree.First /= 0); + pragma Assert (Tree.Last /= 0); + pragma Assert (Parent (N (Tree.Root)) = 0); + + pragma Assert ((Tree.Length > 1) + or else (Tree.First = Tree.Last + and then Tree.First = Tree.Root)); + + pragma Assert ((Left (N (Node)) = 0) + or else (Parent (N (Left (N (Node)))) = Node)); + + pragma Assert ((Right (N (Node)) = 0) + or else (Parent (N (Right (N (Node)))) = Node)); + + pragma Assert (((Parent (N (Node)) = 0) and then (Tree.Root = Node)) + or else ((Parent (N (Node)) /= 0) and then + ((Left (N (Parent (N (Node)))) = Node) + or else + (Right (N (Parent (N (Node)))) = Node)))); + + if Left (N (Z)) = 0 then + if Right (N (Z)) = 0 then + if Z = Tree.First then + Tree.First := Parent (N (Z)); + end if; + + if Z = Tree.Last then + Tree.Last := Parent (N (Z)); + end if; + + if Color (N (Z)) = Black then + Delete_Fixup (Tree, Z); + end if; + + pragma Assert (Left (N (Z)) = 0); + pragma Assert (Right (N (Z)) = 0); + + if Z = Tree.Root then + pragma Assert (Tree.Length = 1); + pragma Assert (Parent (N (Z)) = 0); + Tree.Root := 0; + elsif Z = Left (N (Parent (N (Z)))) then + Set_Left (N (Parent (N (Z))), 0); + else + pragma Assert (Z = Right (N (Parent (N (Z))))); + Set_Right (N (Parent (N (Z))), 0); + end if; + + else + pragma Assert (Z /= Tree.Last); + + X := Right (N (Z)); + + if Z = Tree.First then + Tree.First := Min (Tree, X); + end if; + + if Z = Tree.Root then + Tree.Root := X; + elsif Z = Left (N (Parent (N (Z)))) then + Set_Left (N (Parent (N (Z))), X); + else + pragma Assert (Z = Right (N (Parent (N (Z))))); + Set_Right (N (Parent (N (Z))), X); + end if; + + Set_Parent (N (X), Parent (N (Z))); + + if Color (N (Z)) = Black then + Delete_Fixup (Tree, X); + end if; + end if; + + elsif Right (N (Z)) = 0 then + pragma Assert (Z /= Tree.First); + + X := Left (N (Z)); + + if Z = Tree.Last then + Tree.Last := Max (Tree, X); + end if; + + if Z = Tree.Root then + Tree.Root := X; + elsif Z = Left (N (Parent (N (Z)))) then + Set_Left (N (Parent (N (Z))), X); + else + pragma Assert (Z = Right (N (Parent (N (Z))))); + Set_Right (N (Parent (N (Z))), X); + end if; + + Set_Parent (N (X), Parent (N (Z))); + + if Color (N (Z)) = Black then + Delete_Fixup (Tree, X); + end if; + + else + pragma Assert (Z /= Tree.First); + pragma Assert (Z /= Tree.Last); + + Y := Next (Tree, Z); + pragma Assert (Left (N (Y)) = 0); + + X := Right (N (Y)); + + if X = 0 then + if Y = Left (N (Parent (N (Y)))) then + pragma Assert (Parent (N (Y)) /= Z); + Delete_Swap (Tree, Z, Y); + Set_Left (N (Parent (N (Z))), Z); + + else + pragma Assert (Y = Right (N (Parent (N (Y))))); + pragma Assert (Parent (N (Y)) = Z); + Set_Parent (N (Y), Parent (N (Z))); + + if Z = Tree.Root then + Tree.Root := Y; + elsif Z = Left (N (Parent (N (Z)))) then + Set_Left (N (Parent (N (Z))), Y); + else + pragma Assert (Z = Right (N (Parent (N (Z))))); + Set_Right (N (Parent (N (Z))), Y); + end if; + + Set_Left (N (Y), Z); + Set_Parent (N (Left (N (Y))), Y); + Set_Right (N (Y), Z); + Set_Parent (N (Z), Y); + Set_Left (N (Z), 0); + Set_Right (N (Z), 0); + + declare + Y_Color : constant Color_Type := Color (N (Y)); + begin + Set_Color (N (Y), Color (N (Z))); + Set_Color (N (Z), Y_Color); + end; + end if; + + if Color (N (Z)) = Black then + Delete_Fixup (Tree, Z); + end if; + + pragma Assert (Left (N (Z)) = 0); + pragma Assert (Right (N (Z)) = 0); + + if Z = Right (N (Parent (N (Z)))) then + Set_Right (N (Parent (N (Z))), 0); + else + pragma Assert (Z = Left (N (Parent (N (Z))))); + Set_Left (N (Parent (N (Z))), 0); + end if; + + else + if Y = Left (N (Parent (N (Y)))) then + pragma Assert (Parent (N (Y)) /= Z); + + Delete_Swap (Tree, Z, Y); + + Set_Left (N (Parent (N (Z))), X); + Set_Parent (N (X), Parent (N (Z))); + + else + pragma Assert (Y = Right (N (Parent (N (Y))))); + pragma Assert (Parent (N (Y)) = Z); + + Set_Parent (N (Y), Parent (N (Z))); + + if Z = Tree.Root then + Tree.Root := Y; + elsif Z = Left (N (Parent (N (Z)))) then + Set_Left (N (Parent (N (Z))), Y); + else + pragma Assert (Z = Right (N (Parent (N (Z))))); + Set_Right (N (Parent (N (Z))), Y); + end if; + + Set_Left (N (Y), Left (N (Z))); + Set_Parent (N (Left (N (Y))), Y); + + declare + Y_Color : constant Color_Type := Color (N (Y)); + begin + Set_Color (N (Y), Color (N (Z))); + Set_Color (N (Z), Y_Color); + end; + end if; + + if Color (N (Z)) = Black then + Delete_Fixup (Tree, X); + end if; + end if; + end if; + + Tree.Length := Tree.Length - 1; + end Delete_Node_Sans_Free; + + ----------------- + -- Delete_Swap -- + ----------------- + + procedure Delete_Swap + (Tree : in out Tree_Type'Class; + Z, Y : Count_Type) + is + N : Nodes_Type renames Tree.Nodes; + + pragma Assert (Z /= Y); + pragma Assert (Parent (N (Y)) /= Z); + + Y_Parent : constant Count_Type := Parent (N (Y)); + Y_Color : constant Color_Type := Color (N (Y)); + + begin + Set_Parent (N (Y), Parent (N (Z))); + Set_Left (N (Y), Left (N (Z))); + Set_Right (N (Y), Right (N (Z))); + Set_Color (N (Y), Color (N (Z))); + + if Tree.Root = Z then + Tree.Root := Y; + elsif Right (N (Parent (N (Y)))) = Z then + Set_Right (N (Parent (N (Y))), Y); + else + pragma Assert (Left (N (Parent (N (Y)))) = Z); + Set_Left (N (Parent (N (Y))), Y); + end if; + + if Right (N (Y)) /= 0 then + Set_Parent (N (Right (N (Y))), Y); + end if; + + if Left (N (Y)) /= 0 then + Set_Parent (N (Left (N (Y))), Y); + end if; + + Set_Parent (N (Z), Y_Parent); + Set_Color (N (Z), Y_Color); + Set_Left (N (Z), 0); + Set_Right (N (Z), 0); + end Delete_Swap; + + ---------- + -- Free -- + ---------- + + procedure Free (Tree : in out Tree_Type'Class; X : Count_Type) is + pragma Assert (X > 0); + pragma Assert (X <= Tree.Capacity); + + N : Nodes_Type renames Tree.Nodes; + -- pragma Assert (N (X).Prev >= 0); -- node is active + -- Find a way to mark a node as active vs. inactive; we could + -- use a special value in Color_Type for this. ??? + + begin + -- The set container actually contains two data structures: a list for + -- the "active" nodes that contain elements that have been inserted + -- onto the tree, and another for the "inactive" nodes of the free + -- store. + -- + -- We desire that merely declaring an object should have only minimal + -- cost; specially, we want to avoid having to initialize the free + -- store (to fill in the links), especially if the capacity is large. + -- + -- The head of the free list is indicated by Container.Free. If its + -- value is non-negative, then the free store has been initialized + -- in the "normal" way: Container.Free points to the head of the list + -- of free (inactive) nodes, and the value 0 means the free list is + -- empty. Each node on the free list has been initialized to point + -- to the next free node (via its Parent component), and the value 0 + -- means that this is the last free node. + -- + -- If Container.Free is negative, then the links on the free store + -- have not been initialized. In this case the link values are + -- implied: the free store comprises the components of the node array + -- started with the absolute value of Container.Free, and continuing + -- until the end of the array (Nodes'Last). + -- + -- ??? + -- It might be possible to perform an optimization here. Suppose that + -- the free store can be represented as having two parts: one + -- comprising the non-contiguous inactive nodes linked together + -- in the normal way, and the other comprising the contiguous + -- inactive nodes (that are not linked together, at the end of the + -- nodes array). This would allow us to never have to initialize + -- the free store, except in a lazy way as nodes become inactive. + + -- When an element is deleted from the list container, its node + -- becomes inactive, and so we set its Prev component to a negative + -- value, to indicate that it is now inactive. This provides a useful + -- way to detect a dangling cursor reference. + + -- The comment above is incorrect; we need some other way to + -- indicate a node is inactive, for example by using a special + -- Color_Type value. ??? + -- N (X).Prev := -1; -- Node is deallocated (not on active list) + + if Tree.Free >= 0 then + -- The free store has previously been initialized. All we need to + -- do here is link the newly-free'd node onto the free list. + + Set_Parent (N (X), Tree.Free); + Tree.Free := X; + + elsif X + 1 = abs Tree.Free then + -- The free store has not been initialized, and the node becoming + -- inactive immediately precedes the start of the free store. All + -- we need to do is move the start of the free store back by one. + + Tree.Free := Tree.Free + 1; + + else + -- The free store has not been initialized, and the node becoming + -- inactive does not immediately precede the free store. Here we + -- first initialize the free store (meaning the links are given + -- values in the traditional way), and then link the newly-free'd + -- node onto the head of the free store. + + -- ??? + -- See the comments above for an optimization opportunity. If + -- the next link for a node on the free store is negative, then + -- this means the remaining nodes on the free store are + -- physically contiguous, starting as the absolute value of + -- that index value. + + Tree.Free := abs Tree.Free; + + if Tree.Free > Tree.Capacity then + Tree.Free := 0; + + else + for I in Tree.Free .. Tree.Capacity - 1 loop + Set_Parent (N (I), I + 1); + end loop; + + Set_Parent (N (Tree.Capacity), 0); + end if; + + Set_Parent (N (X), Tree.Free); + Tree.Free := X; + end if; + end Free; + + ----------------------- + -- Generic_Allocate -- + ----------------------- + + procedure Generic_Allocate + (Tree : in out Tree_Type'Class; + Node : out Count_Type) + is + N : Nodes_Type renames Tree.Nodes; + + begin + if Tree.Free >= 0 then + Node := Tree.Free; + + -- We always perform the assignment first, before we + -- change container state, in order to defend against + -- exceptions duration assignment. + + Set_Element (N (Node)); + Tree.Free := Parent (N (Node)); + + else + -- A negative free store value means that the links of the nodes + -- in the free store have not been initialized. In this case, the + -- nodes are physically contiguous in the array, starting at the + -- index that is the absolute value of the Container.Free, and + -- continuing until the end of the array (Nodes'Last). + + Node := abs Tree.Free; + + -- As above, we perform this assignment first, before modifying + -- any container state. + + Set_Element (N (Node)); + Tree.Free := Tree.Free - 1; + end if; + end Generic_Allocate; + + ------------------- + -- Generic_Equal -- + ------------------- + + function Generic_Equal (Left, Right : Tree_Type'Class) return Boolean is + L_Node : Count_Type; + R_Node : Count_Type; + + begin + if Left'Address = Right'Address then + return True; + end if; + + if Left.Length /= Right.Length then + return False; + end if; + + L_Node := Left.First; + R_Node := Right.First; + while L_Node /= 0 loop + if not Is_Equal (Left.Nodes (L_Node), Right.Nodes (R_Node)) then + return False; + end if; + + L_Node := Next (Left, L_Node); + R_Node := Next (Right, R_Node); + end loop; + + return True; + end Generic_Equal; + + ----------------------- + -- Generic_Iteration -- + ----------------------- + + procedure Generic_Iteration (Tree : Tree_Type'Class) is + procedure Iterate (P : Count_Type); + + ------------- + -- Iterate -- + ------------- + + procedure Iterate (P : Count_Type) is + X : Count_Type := P; + begin + while X /= 0 loop + Iterate (Left (Tree.Nodes (X))); + Process (X); + X := Right (Tree.Nodes (X)); + end loop; + end Iterate; + + -- Start of processing for Generic_Iteration + + begin + Iterate (Tree.Root); + end Generic_Iteration; + + ------------------ + -- Generic_Read -- + ------------------ + + procedure Generic_Read + (Stream : not null access Root_Stream_Type'Class; + Tree : in out Tree_Type'Class) + is + Len : Count_Type'Base; + + Node, Last_Node : Count_Type; + + N : Nodes_Type renames Tree.Nodes; + + begin + Clear_Tree (Tree); + Count_Type'Base'Read (Stream, Len); + + if Len < 0 then + raise Program_Error with "bad container length (corrupt stream)"; + end if; + + if Len = 0 then + return; + end if; + + if Len > Tree.Capacity then + raise Constraint_Error with "length exceeds capacity"; + end if; + + -- Use Unconditional_Insert_With_Hint here instead ??? + + Allocate (Tree, Node); + pragma Assert (Node /= 0); + + Set_Color (N (Node), Black); + + Tree.Root := Node; + Tree.First := Node; + Tree.Last := Node; + Tree.Length := 1; + + for J in Count_Type range 2 .. Len loop + Last_Node := Node; + pragma Assert (Last_Node = Tree.Last); + + Allocate (Tree, Node); + pragma Assert (Node /= 0); + + Set_Color (N (Node), Red); + Set_Right (N (Last_Node), Right => Node); + Tree.Last := Node; + Set_Parent (N (Node), Parent => Last_Node); + + Rebalance_For_Insert (Tree, Node); + Tree.Length := Tree.Length + 1; + end loop; + end Generic_Read; + + ------------------------------- + -- Generic_Reverse_Iteration -- + ------------------------------- + + procedure Generic_Reverse_Iteration (Tree : Tree_Type'Class) is + procedure Iterate (P : Count_Type); + + ------------- + -- Iterate -- + ------------- + + procedure Iterate (P : Count_Type) is + X : Count_Type := P; + begin + while X /= 0 loop + Iterate (Right (Tree.Nodes (X))); + Process (X); + X := Left (Tree.Nodes (X)); + end loop; + end Iterate; + + -- Start of processing for Generic_Reverse_Iteration + + begin + Iterate (Tree.Root); + end Generic_Reverse_Iteration; + + ------------------- + -- Generic_Write -- + ------------------- + + procedure Generic_Write + (Stream : not null access Root_Stream_Type'Class; + Tree : Tree_Type'Class) + is + procedure Process (Node : Count_Type); + pragma Inline (Process); + + procedure Iterate is + new Generic_Iteration (Process); + + ------------- + -- Process -- + ------------- + + procedure Process (Node : Count_Type) is + begin + Write_Node (Stream, Tree.Nodes (Node)); + end Process; + + -- Start of processing for Generic_Write + + begin + Count_Type'Base'Write (Stream, Tree.Length); + Iterate (Tree); + end Generic_Write; + + ----------------- + -- Left_Rotate -- + ----------------- + + procedure Left_Rotate (Tree : in out Tree_Type'Class; X : Count_Type) is + -- CLR p266 + + N : Nodes_Type renames Tree.Nodes; + + Y : constant Count_Type := Right (N (X)); + pragma Assert (Y /= 0); + + begin + Set_Right (N (X), Left (N (Y))); + + if Left (N (Y)) /= 0 then + Set_Parent (N (Left (N (Y))), X); + end if; + + Set_Parent (N (Y), Parent (N (X))); + + if X = Tree.Root then + Tree.Root := Y; + elsif X = Left (N (Parent (N (X)))) then + Set_Left (N (Parent (N (X))), Y); + else + pragma Assert (X = Right (N (Parent (N (X))))); + Set_Right (N (Parent (N (X))), Y); + end if; + + Set_Left (N (Y), X); + Set_Parent (N (X), Y); + end Left_Rotate; + + --------- + -- Max -- + --------- + + function Max + (Tree : Tree_Type'Class; + Node : Count_Type) return Count_Type + is + -- CLR p248 + + X : Count_Type := Node; + Y : Count_Type; + + begin + loop + Y := Right (Tree.Nodes (X)); + + if Y = 0 then + return X; + end if; + + X := Y; + end loop; + end Max; + + --------- + -- Min -- + --------- + + function Min + (Tree : Tree_Type'Class; + Node : Count_Type) return Count_Type + is + -- CLR p248 + + X : Count_Type := Node; + Y : Count_Type; + + begin + loop + Y := Left (Tree.Nodes (X)); + + if Y = 0 then + return X; + end if; + + X := Y; + end loop; + end Min; + + ---------- + -- Next -- + ---------- + + function Next + (Tree : Tree_Type'Class; + Node : Count_Type) return Count_Type + is + begin + -- CLR p249 + + if Node = 0 then + return 0; + end if; + + if Right (Tree.Nodes (Node)) /= 0 then + return Min (Tree, Right (Tree.Nodes (Node))); + end if; + + declare + X : Count_Type := Node; + Y : Count_Type := Parent (Tree.Nodes (Node)); + + begin + while Y /= 0 + and then X = Right (Tree.Nodes (Y)) + loop + X := Y; + Y := Parent (Tree.Nodes (Y)); + end loop; + + return Y; + end; + end Next; + + -------------- + -- Previous -- + -------------- + + function Previous + (Tree : Tree_Type'Class; + Node : Count_Type) return Count_Type + is + begin + if Node = 0 then + return 0; + end if; + + if Left (Tree.Nodes (Node)) /= 0 then + return Max (Tree, Left (Tree.Nodes (Node))); + end if; + + declare + X : Count_Type := Node; + Y : Count_Type := Parent (Tree.Nodes (Node)); + + begin + while Y /= 0 + and then X = Left (Tree.Nodes (Y)) + loop + X := Y; + Y := Parent (Tree.Nodes (Y)); + end loop; + + return Y; + end; + end Previous; + + -------------------------- + -- Rebalance_For_Insert -- + -------------------------- + + procedure Rebalance_For_Insert + (Tree : in out Tree_Type'Class; + Node : Count_Type) + is + -- CLR p.268 + + N : Nodes_Type renames Tree.Nodes; + + X : Count_Type := Node; + pragma Assert (X /= 0); + pragma Assert (Color (N (X)) = Red); + + Y : Count_Type; + + begin + while X /= Tree.Root and then Color (N (Parent (N (X)))) = Red loop + if Parent (N (X)) = Left (N (Parent (N (Parent (N (X)))))) then + Y := Right (N (Parent (N (Parent (N (X)))))); + + if Y /= 0 and then Color (N (Y)) = Red then + Set_Color (N (Parent (N (X))), Black); + Set_Color (N (Y), Black); + Set_Color (N (Parent (N (Parent (N (X))))), Red); + X := Parent (N (Parent (N (X)))); + + else + if X = Right (N (Parent (N (X)))) then + X := Parent (N (X)); + Left_Rotate (Tree, X); + end if; + + Set_Color (N (Parent (N (X))), Black); + Set_Color (N (Parent (N (Parent (N (X))))), Red); + Right_Rotate (Tree, Parent (N (Parent (N (X))))); + end if; + + else + pragma Assert (Parent (N (X)) = + Right (N (Parent (N (Parent (N (X))))))); + + Y := Left (N (Parent (N (Parent (N (X)))))); + + if Y /= 0 and then Color (N (Y)) = Red then + Set_Color (N (Parent (N (X))), Black); + Set_Color (N (Y), Black); + Set_Color (N (Parent (N (Parent (N (X))))), Red); + X := Parent (N (Parent (N (X)))); + + else + if X = Left (N (Parent (N (X)))) then + X := Parent (N (X)); + Right_Rotate (Tree, X); + end if; + + Set_Color (N (Parent (N (X))), Black); + Set_Color (N (Parent (N (Parent (N (X))))), Red); + Left_Rotate (Tree, Parent (N (Parent (N (X))))); + end if; + end if; + end loop; + + Set_Color (N (Tree.Root), Black); + end Rebalance_For_Insert; + + ------------------ + -- Right_Rotate -- + ------------------ + + procedure Right_Rotate (Tree : in out Tree_Type'Class; Y : Count_Type) is + N : Nodes_Type renames Tree.Nodes; + + X : constant Count_Type := Left (N (Y)); + pragma Assert (X /= 0); + + begin + Set_Left (N (Y), Right (N (X))); + + if Right (N (X)) /= 0 then + Set_Parent (N (Right (N (X))), Y); + end if; + + Set_Parent (N (X), Parent (N (Y))); + + if Y = Tree.Root then + Tree.Root := X; + elsif Y = Left (N (Parent (N (Y)))) then + Set_Left (N (Parent (N (Y))), X); + else + pragma Assert (Y = Right (N (Parent (N (Y))))); + Set_Right (N (Parent (N (Y))), X); + end if; + + Set_Right (N (X), Y); + Set_Parent (N (Y), X); + end Right_Rotate; + + --------- + -- Vet -- + --------- + + function Vet (Tree : Tree_Type'Class; Index : Count_Type) return Boolean is + Nodes : Nodes_Type renames Tree.Nodes; + Node : Node_Type renames Nodes (Index); + + begin + if Parent (Node) = Index + or else Left (Node) = Index + or else Right (Node) = Index + then + return False; + end if; + + if Tree.Length = 0 + or else Tree.Root = 0 + or else Tree.First = 0 + or else Tree.Last = 0 + then + return False; + end if; + + if Parent (Nodes (Tree.Root)) /= 0 then + return False; + end if; + + if Left (Nodes (Tree.First)) /= 0 then + return False; + end if; + + if Right (Nodes (Tree.Last)) /= 0 then + return False; + end if; + + if Tree.Length = 1 then + if Tree.First /= Tree.Last + or else Tree.First /= Tree.Root + then + return False; + end if; + + if Index /= Tree.First then + return False; + end if; + + if Parent (Node) /= 0 + or else Left (Node) /= 0 + or else Right (Node) /= 0 + then + return False; + end if; + + return True; + end if; + + if Tree.First = Tree.Last then + return False; + end if; + + if Tree.Length = 2 then + if Tree.First /= Tree.Root + and then Tree.Last /= Tree.Root + then + return False; + end if; + + if Tree.First /= Index + and then Tree.Last /= Index + then + return False; + end if; + end if; + + if Left (Node) /= 0 + and then Parent (Nodes (Left (Node))) /= Index + then + return False; + end if; + + if Right (Node) /= 0 + and then Parent (Nodes (Right (Node))) /= Index + then + return False; + end if; + + if Parent (Node) = 0 then + if Tree.Root /= Index then + return False; + end if; + + elsif Left (Nodes (Parent (Node))) /= Index + and then Right (Nodes (Parent (Node))) /= Index + then + return False; + end if; + + return True; + end Vet; + + end Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/a-rbtgbo.ads gcc-4.6.0/gcc/ada/a-rbtgbo.ads *** gcc-4.5.2/gcc/ada/a-rbtgbo.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-rbtgbo.ads Mon Oct 25 15:26:02 2010 *************** *** 0 **** --- 1,155 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT LIBRARY COMPONENTS -- + -- -- + -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_OPERATIONS -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2004-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- This unit was originally developed by Matthew J Heaney. -- + ------------------------------------------------------------------------------ + + -- Tree_Type is used to implement the ordered containers. This package + -- declares the tree operations that do not depend on keys. + + with Ada.Streams; use Ada.Streams; + + generic + with package Tree_Types is new Generic_Bounded_Tree_Types (<>); + use Tree_Types; + + with function Parent (Node : Node_Type) return Count_Type is <>; + + with procedure Set_Parent + (Node : in out Node_Type; + Parent : Count_Type) is <>; + + with function Left (Node : Node_Type) return Count_Type is <>; + + with procedure Set_Left + (Node : in out Node_Type; + Left : Count_Type) is <>; + + with function Right (Node : Node_Type) return Count_Type is <>; + + with procedure Set_Right + (Node : in out Node_Type; + Right : Count_Type) is <>; + + with function Color (Node : Node_Type) return Color_Type is <>; + + with procedure Set_Color + (Node : in out Node_Type; + Color : Color_Type) is <>; + + package Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is + pragma Pure; + + function Min (Tree : Tree_Type'Class; Node : Count_Type) return Count_Type; + -- Returns the smallest-valued node of the subtree rooted at Node + + function Max (Tree : Tree_Type'Class; Node : Count_Type) return Count_Type; + -- Returns the largest-valued node of the subtree rooted at Node + + function Vet (Tree : Tree_Type'Class; Index : Count_Type) return Boolean; + -- Inspects Node to determine (to the extent possible) whether + -- the node is valid; used to detect if the node is dangling. + + function Next + (Tree : Tree_Type'Class; + Node : Count_Type) return Count_Type; + -- Returns the smallest node greater than Node + + function Previous + (Tree : Tree_Type'Class; + Node : Count_Type) return Count_Type; + -- Returns the largest node less than Node + + generic + with function Is_Equal (L, R : Node_Type) return Boolean; + function Generic_Equal (Left, Right : Tree_Type'Class) return Boolean; + -- Uses Is_Equal to perform a node-by-node comparison of the + -- Left and Right trees; processing stops as soon as the first + -- non-equal node is found. + + procedure Delete_Node_Sans_Free + (Tree : in out Tree_Type'Class; Node : Count_Type); + -- Removes Node from Tree without deallocating the node. If Tree + -- is busy then Program_Error is raised. + + procedure Clear_Tree (Tree : in out Tree_Type'Class); + -- Clears Tree by deallocating all of its nodes. If Tree is busy then + -- Program_Error is raised. + + generic + with procedure Process (Node : Count_Type) is <>; + procedure Generic_Iteration (Tree : Tree_Type'Class); + -- Calls Process for each node in Tree, in order from smallest-valued + -- node to largest-valued node. + + generic + with procedure Process (Node : Count_Type) is <>; + procedure Generic_Reverse_Iteration (Tree : Tree_Type'Class); + -- Calls Process for each node in Tree, in order from largest-valued + -- node to smallest-valued node. + + generic + with procedure Write_Node + (Stream : not null access Root_Stream_Type'Class; + Node : Node_Type); + procedure Generic_Write + (Stream : not null access Root_Stream_Type'Class; + Tree : Tree_Type'Class); + -- Used to implement stream attribute T'Write. Generic_Write + -- first writes the number of nodes into Stream, then calls + -- Write_Node for each node in Tree. + + generic + with procedure Allocate + (Tree : in out Tree_Type'Class; + Node : out Count_Type); + procedure Generic_Read + (Stream : not null access Root_Stream_Type'Class; + Tree : in out Tree_Type'Class); + -- Used to implement stream attribute T'Read. Generic_Read + -- first clears Tree. It then reads the number of nodes out of + -- Stream, and calls Read_Node for each node in Stream. + + procedure Rebalance_For_Insert + (Tree : in out Tree_Type'Class; + Node : Count_Type); + -- This rebalances Tree to complete the insertion of Node (which + -- must already be linked in at its proper insertion position). + + generic + with procedure Set_Element (Node : in out Node_Type); + procedure Generic_Allocate + (Tree : in out Tree_Type'Class; + Node : out Count_Type); + -- Claim a node from the free store. Generic_Allocate first + -- calls Set_Element on the potential node, and then returns + -- the node's index as the value of the Node parameter. + + procedure Free (Tree : in out Tree_Type'Class; X : Count_Type); + -- Return a node back to the free store, from where it had + -- been previously claimed via Generic_Allocate. + + end Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/a-reatim.adb gcc-4.6.0/gcc/ada/a-reatim.adb *** gcc-4.5.2/gcc/ada/a-reatim.adb Fri Oct 30 13:27:40 2009 --- gcc-4.6.0/gcc/ada/a-reatim.adb Wed Jun 23 06:31:57 2010 *************** *** 7,13 **** -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2009, 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- -- --- 7,13 ---- -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2010, 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- -- *************** *** 32,37 **** --- 32,39 ---- -- -- ------------------------------------------------------------------------------ + with System.Tasking; + package body Ada.Real_Time is --------- *************** package body Ada.Real_Time is *** 242,245 **** --- 244,253 ---- return Time_Span (D); end To_Time_Span; + begin + -- Ensure that the tasking run time is initialized when using clock and/or + -- delay operations. The initialization routine has the required machinery + -- to prevent multiple calls to Initialize. + + System.Tasking.Initialize; end Ada.Real_Time; diff -Nrcpad gcc-4.5.2/gcc/ada/a-retide.adb gcc-4.6.0/gcc/ada/a-retide.adb *** gcc-4.5.2/gcc/ada/a-retide.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-retide.adb Wed Jun 23 06:31:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Real_Time.Delays is *** 75,84 **** return To_Duration (Time_Span (T)); end To_Duration; - begin - -- Ensure that the tasking run time is initialized when using delay - -- operations. The initialization routine has the required machinery to - -- prevent multiple calls to Initialize. - - System.Tasking.Initialize; end Ada.Real_Time.Delays; --- 75,78 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/a-rttiev.adb gcc-4.6.0/gcc/ada/a-rttiev.adb *** gcc-4.5.2/gcc/ada/a-rttiev.adb Mon Nov 30 14:19:48 2009 --- gcc-4.6.0/gcc/ada/a-rttiev.adb Fri Oct 8 10:32:07 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2010, 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,37 **** --- 32,38 ---- with System.Task_Primitives.Operations; with System.Tasking.Utilities; with System.Soft_Links; + with System.Interrupt_Management.Operations; with Ada.Containers.Doubly_Linked_Lists; pragma Elaborate_All (Ada.Containers.Doubly_Linked_Lists); *************** package body Ada.Real_Time.Timing_Events *** 98,103 **** --- 99,110 ---- begin System.Tasking.Utilities.Make_Independent; + -- Since this package may be elaborated before System.Interrupt, + -- we need to call Setup_Interrupt_Mask explicitly to ensure that + -- this task has the proper signal mask. + + System.Interrupt_Management.Operations.Setup_Interrupt_Mask; + -- We await the call to Start to ensure that Event_Queue_Lock has been -- initialized by the package executable part prior to accessing it in -- the loop. The task is activated before the first statement of the diff -Nrcpad gcc-4.5.2/gcc/ada/a-strbou.ads gcc-4.6.0/gcc/ada/a-strbou.ads *** gcc-4.5.2/gcc/ada/a-strbou.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-strbou.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Strings.Bounded is *** 292,297 **** --- 292,306 ---- procedure Find_Token (Source : Bounded_String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Bounded_String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural); *************** package Ada.Strings.Bounded is *** 749,754 **** --- 758,772 ---- procedure Find_Token (Source : Bounded_String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + renames Super_Find_Token; + + procedure Find_Token + (Source : Bounded_String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-strfix.adb gcc-4.6.0/gcc/ada/a-strfix.adb *** gcc-4.5.2/gcc/ada/a-strfix.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/a-strfix.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Fixed is *** 123,128 **** --- 123,137 ---- procedure Find_Token (Source : String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + renames Ada.Strings.Search.Find_Token; + + procedure Find_Token + (Source : String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-strfix.ads gcc-4.6.0/gcc/ada/a-strfix.ads *** gcc-4.5.2/gcc/ada/a-strfix.ads Fri Apr 6 09:13:42 2007 --- gcc-4.6.0/gcc/ada/a-strfix.ads Fri Oct 8 13:02:55 2010 *************** package Ada.Strings.Fixed is *** 102,107 **** --- 102,116 ---- procedure Find_Token (Source : String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-strsea.adb gcc-4.6.0/gcc/ada/a-strsea.adb *** gcc-4.5.2/gcc/ada/a-strsea.adb Tue Jul 7 13:38:45 2009 --- gcc-4.6.0/gcc/ada/a-strsea.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Search is *** 197,202 **** --- 197,236 ---- procedure Find_Token (Source : String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + is + begin + for J in From .. Source'Last loop + if Belongs (Source (J), Set, Test) then + First := J; + + for K in J + 1 .. Source'Last loop + if not Belongs (Source (K), Set, Test) then + Last := K - 1; + return; + end if; + end loop; + + -- Here if J indexes first char of token, and all chars after J + -- are in the token. + + Last := Source'Last; + return; + end if; + end loop; + + -- Here if no token found + + First := From; + Last := 0; + end Find_Token; + + procedure Find_Token + (Source : String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-strsea.ads gcc-4.6.0/gcc/ada/a-strsea.ads *** gcc-4.5.2/gcc/ada/a-strsea.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-strsea.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** private package Ada.Strings.Search is *** 106,111 **** --- 106,119 ---- procedure Find_Token (Source : String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + + procedure Find_Token + (Source : String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-strsup.adb gcc-4.6.0/gcc/ada/a-strsup.adb *** gcc-4.5.2/gcc/ada/a-strsup.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-strsup.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package body Ada.Strings.Superbounded is *** 795,800 **** --- 795,813 ---- procedure Super_Find_Token (Source : Super_String; Set : Maps.Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + begin + Search.Find_Token + (Source.Data (From .. Source.Current_Length), Set, Test, First, Last); + end Super_Find_Token; + + procedure Super_Find_Token + (Source : Super_String; + Set : Maps.Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-strsup.ads gcc-4.6.0/gcc/ada/a-strsup.ads *** gcc-4.5.2/gcc/ada/a-strsup.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-strsup.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package Ada.Strings.Superbounded is *** 293,298 **** --- 293,306 ---- procedure Super_Find_Token (Source : Super_String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + + procedure Super_Find_Token + (Source : Super_String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-strunb-shared.adb gcc-4.6.0/gcc/ada/a-strunb-shared.adb *** gcc-4.5.2/gcc/ada/a-strunb-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-strunb-shared.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,2099 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . U N B O U N D E D -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Strings.Search; + with Ada.Unchecked_Deallocation; + + package body Ada.Strings.Unbounded is + + use Ada.Strings.Maps; + + Growth_Factor : constant := 32; + -- The growth factor controls how much extra space is allocated when + -- we have to increase the size of an allocated unbounded string. By + -- allocating extra space, we avoid the need to reallocate on every + -- append, particularly important when a string is built up by repeated + -- append operations of small pieces. This is expressed as a factor so + -- 32 means add 1/32 of the length of the string as growth space. + + Min_Mul_Alloc : constant := Standard'Maximum_Alignment; + -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes + -- no memory loss as most (all?) malloc implementations are obliged to + -- align the returned memory on the maximum alignment as malloc does not + -- know the target alignment. + + procedure Sync_Add_And_Fetch + (Ptr : access Interfaces.Unsigned_32; + Value : Interfaces.Unsigned_32); + pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4"); + + function Sync_Sub_And_Fetch + (Ptr : access Interfaces.Unsigned_32; + Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; + pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4"); + + function Aligned_Max_Length (Max_Length : Natural) return Natural; + -- Returns recommended length of the shared string which is greater or + -- equal to specified length. Calculation take in sense alignment of the + -- allocated memory segments to use memory effectively by Append/Insert/etc + -- operations. + + --------- + -- "&" -- + --------- + + function "&" + (Left : Unbounded_String; + Right : Unbounded_String) return Unbounded_String + is + LR : constant Shared_String_Access := Left.Reference; + RR : constant Shared_String_Access := Right.Reference; + DL : constant Natural := LR.Last + RR.Last; + DR : Shared_String_Access; + + begin + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Left string is empty, return Right string + + elsif LR.Last = 0 then + Reference (RR); + DR := RR; + + -- Right string is empty, return Left string + + elsif RR.Last = 0 then + Reference (LR); + DR := LR; + + -- Otherwise, allocate new shared string and fill data + + else + DR := Allocate (LR.Last + RR.Last); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Unbounded_String; + Right : String) return Unbounded_String + is + LR : constant Shared_String_Access := Left.Reference; + DL : constant Natural := LR.Last + Right'Length; + DR : Shared_String_Access; + + begin + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Right is an empty string, return Left string + + elsif Right'Length = 0 then + Reference (LR); + DR := LR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (LR.Last + 1 .. DL) := Right; + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : String; + Right : Unbounded_String) return Unbounded_String + is + RR : constant Shared_String_Access := Right.Reference; + DL : constant Natural := Left'Length + RR.Last; + DR : Shared_String_Access; + + begin + -- Result is an empty string, reuse shared one + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Left is empty string, return Right string + + elsif Left'Length = 0 then + Reference (RR); + DR := RR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Left'Length) := Left; + DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Unbounded_String; + Right : Character) return Unbounded_String + is + LR : constant Shared_String_Access := Left.Reference; + DL : constant Natural := LR.Last + 1; + DR : Shared_String_Access; + + begin + DR := Allocate (DL); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (DL) := Right; + DR.Last := DL; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Character; + Right : Unbounded_String) return Unbounded_String + is + RR : constant Shared_String_Access := Right.Reference; + DL : constant Natural := 1 + RR.Last; + DR : Shared_String_Access; + + begin + DR := Allocate (DL); + DR.Data (1) := Left; + DR.Data (2 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + + return (AF.Controlled with Reference => DR); + end "&"; + + --------- + -- "*" -- + --------- + + function "*" + (Left : Natural; + Right : Character) return Unbounded_String + is + DR : Shared_String_Access; + + begin + -- Result is an empty string, reuse shared empty string + + if Left = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Left); + + for J in 1 .. Left loop + DR.Data (J) := Right; + end loop; + + DR.Last := Left; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + function "*" + (Left : Natural; + Right : String) return Unbounded_String + is + DL : constant Natural := Left * Right'Length; + DR : Shared_String_Access; + K : Positive; + + begin + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + K := 1; + + for J in 1 .. Left loop + DR.Data (K .. K + Right'Length - 1) := Right; + K := K + Right'Length; + end loop; + + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + function "*" + (Left : Natural; + Right : Unbounded_String) return Unbounded_String + is + RR : constant Shared_String_Access := Right.Reference; + DL : constant Natural := Left * RR.Last; + DR : Shared_String_Access; + K : Positive; + + begin + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Coefficient is one, just return string itself + + elsif Left = 1 then + Reference (RR); + DR := RR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + K := 1; + + for J in 1 .. Left loop + DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last); + K := K + RR.Last; + end loop; + + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + --------- + -- "<" -- + --------- + + function "<" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + RR : constant Shared_String_Access := Right.Reference; + begin + return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last); + end "<"; + + function "<" + (Left : Unbounded_String; + Right : String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) < Right; + end "<"; + + function "<" + (Left : String; + Right : Unbounded_String) return Boolean + is + RR : constant Shared_String_Access := Right.Reference; + begin + return Left < RR.Data (1 .. RR.Last); + end "<"; + + ---------- + -- "<=" -- + ---------- + + function "<=" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + RR : constant Shared_String_Access := Right.Reference; + + begin + -- LR = RR means two strings shares shared string, thus they are equal + + return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last); + end "<="; + + function "<=" + (Left : Unbounded_String; + Right : String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) <= Right; + end "<="; + + function "<=" + (Left : String; + Right : Unbounded_String) return Boolean + is + RR : constant Shared_String_Access := Right.Reference; + begin + return Left <= RR.Data (1 .. RR.Last); + end "<="; + + --------- + -- "=" -- + --------- + + function "=" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + RR : constant Shared_String_Access := Right.Reference; + + begin + return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last); + -- LR = RR means two strings shares shared string, thus they are equal + end "="; + + function "=" + (Left : Unbounded_String; + Right : String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) = Right; + end "="; + + function "=" + (Left : String; + Right : Unbounded_String) return Boolean + is + RR : constant Shared_String_Access := Right.Reference; + begin + return Left = RR.Data (1 .. RR.Last); + end "="; + + --------- + -- ">" -- + --------- + + function ">" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + RR : constant Shared_String_Access := Right.Reference; + begin + return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last); + end ">"; + + function ">" + (Left : Unbounded_String; + Right : String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) > Right; + end ">"; + + function ">" + (Left : String; + Right : Unbounded_String) return Boolean + is + RR : constant Shared_String_Access := Right.Reference; + begin + return Left > RR.Data (1 .. RR.Last); + end ">"; + + ---------- + -- ">=" -- + ---------- + + function ">=" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + RR : constant Shared_String_Access := Right.Reference; + + begin + -- LR = RR means two strings shares shared string, thus they are equal + + return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last); + end ">="; + + function ">=" + (Left : Unbounded_String; + Right : String) return Boolean + is + LR : constant Shared_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) >= Right; + end ">="; + + function ">=" + (Left : String; + Right : Unbounded_String) return Boolean + is + RR : constant Shared_String_Access := Right.Reference; + begin + return Left >= RR.Data (1 .. RR.Last); + end ">="; + + ------------ + -- Adjust -- + ------------ + + procedure Adjust (Object : in out Unbounded_String) is + begin + Reference (Object.Reference); + end Adjust; + + ------------------------ + -- Aligned_Max_Length -- + ------------------------ + + function Aligned_Max_Length (Max_Length : Natural) return Natural is + Static_Size : constant Natural := + Empty_Shared_String'Size / Standard'Storage_Unit; + -- Total size of all static components + + begin + return + ((Static_Size + Max_Length - 1) / Min_Mul_Alloc + 2) * Min_Mul_Alloc + - Static_Size; + end Aligned_Max_Length; + + -------------- + -- Allocate -- + -------------- + + function Allocate (Max_Length : Natural) return Shared_String_Access is + begin + -- Empty string requested, return shared empty string + + if Max_Length = 0 then + Reference (Empty_Shared_String'Access); + return Empty_Shared_String'Access; + + -- Otherwise, allocate requested space (and probably some more room) + + else + return new Shared_String (Aligned_Max_Length (Max_Length)); + end if; + end Allocate; + + ------------ + -- Append -- + ------------ + + procedure Append + (Source : in out Unbounded_String; + New_Item : Unbounded_String) + is + SR : constant Shared_String_Access := Source.Reference; + NR : constant Shared_String_Access := New_Item.Reference; + DL : constant Natural := SR.Last + NR.Last; + DR : Shared_String_Access; + + begin + -- Source is an empty string, reuse New_Item data + + if SR.Last = 0 then + Reference (NR); + Source.Reference := NR; + Unreference (SR); + + -- New_Item is empty string, nothing to do + + elsif NR.Last = 0 then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); + SR.Last := DL; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + procedure Append + (Source : in out Unbounded_String; + New_Item : String) + is + SR : constant Shared_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_String_Access; + + begin + -- New_Item is an empty string, nothing to do + + if New_Item'Length = 0 then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (SR.Last + 1 .. DL) := New_Item; + SR.Last := DL; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (SR.Last + 1 .. DL) := New_Item; + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + procedure Append + (Source : in out Unbounded_String; + New_Item : Character) + is + SR : constant Shared_String_Access := Source.Reference; + DL : constant Natural := SR.Last + 1; + DR : Shared_String_Access; + + begin + -- Try to reuse existing shared string + + if Can_Be_Reused (SR, SR.Last + 1) then + SR.Data (SR.Last + 1) := New_Item; + SR.Last := SR.Last + 1; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (DL) := New_Item; + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + ------------------- + -- Can_Be_Reused -- + ------------------- + + function Can_Be_Reused + (Item : Shared_String_Access; + Length : Natural) return Boolean + is + use Interfaces; + begin + return + Item.Counter = 1 + and then Item.Max_Length >= Length + and then Item.Max_Length <= + Aligned_Max_Length (Length + Length / Growth_Factor); + end Can_Be_Reused; + + ----------- + -- Count -- + ----------- + + function Count + (Source : Unbounded_String; + Pattern : String; + Mapping : Maps.Character_Mapping := Maps.Identity) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); + end Count; + + function Count + (Source : Unbounded_String; + Pattern : String; + Mapping : Maps.Character_Mapping_Function) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); + end Count; + + function Count + (Source : Unbounded_String; + Set : Maps.Character_Set) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Count (SR.Data (1 .. SR.Last), Set); + end Count; + + ------------ + -- Delete -- + ------------ + + function Delete + (Source : Unbounded_String; + From : Positive; + Through : Natural) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Empty slice is deleted, use the same shared string + + if From > Through then + Reference (SR); + DR := SR; + + -- Index is out of range + + elsif Through > SR.Last then + raise Index_Error; + + -- Compute size of the result + + else + DL := SR.Last - (Through - From + 1); + + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); + DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Delete; + + procedure Delete + (Source : in out Unbounded_String; + From : Positive; + Through : Natural) + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Nothing changed, return + + if From > Through then + null; + + -- Through is outside of the range + + elsif Through > SR.Last then + raise Index_Error; + + else + DL := SR.Last - (Through - From + 1); + + -- Result is empty, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + SR.Last := DL; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); + DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Delete; + + ------------- + -- Element -- + ------------- + + function Element + (Source : Unbounded_String; + Index : Positive) return Character + is + SR : constant Shared_String_Access := Source.Reference; + begin + if Index <= SR.Last then + return SR.Data (Index); + else + raise Index_Error; + end if; + end Element; + + -------------- + -- Finalize -- + -------------- + + procedure Finalize (Object : in out Unbounded_String) is + SR : constant Shared_String_Access := Object.Reference; + + begin + if SR /= null then + + -- The same controlled object can be finalized several times for + -- some reason. As per 7.6.1(24) this should have no ill effect, + -- so we need to add a guard for the case of finalizing the same + -- object twice. + + Object.Reference := null; + Unreference (SR); + end if; + end Finalize; + + ---------------- + -- Find_Token -- + ---------------- + + procedure Find_Token + (Source : Unbounded_String; + Set : Maps.Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + SR : constant Shared_String_Access := Source.Reference; + begin + Search.Find_Token (SR.Data (From .. SR.Last), Set, Test, First, Last); + end Find_Token; + + procedure Find_Token + (Source : Unbounded_String; + Set : Maps.Character_Set; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + SR : constant Shared_String_Access := Source.Reference; + begin + Search.Find_Token (SR.Data (1 .. SR.Last), Set, Test, First, Last); + end Find_Token; + + ---------- + -- Free -- + ---------- + + procedure Free (X : in out String_Access) is + procedure Deallocate is + new Ada.Unchecked_Deallocation (String, String_Access); + begin + Deallocate (X); + end Free; + + ---------- + -- Head -- + ---------- + + function Head + (Source : Unbounded_String; + Count : Natural; + Pad : Character := Space) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Result is empty, reuse shared empty string + + if Count = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Length of the string is the same as requested, reuse source shared + -- string. + + elsif Count = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Count); + + -- Length of the source string is more than requested, copy + -- corresponding slice. + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (1 .. Count); + + -- Length of the source string is less then requested, copy all + -- contents and fill others by Pad character. + + else + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + + for J in SR.Last + 1 .. Count loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + end if; + + return (AF.Controlled with Reference => DR); + end Head; + + procedure Head + (Source : in out Unbounded_String; + Count : Natural; + Pad : Character := Space) + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Result is empty, reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- Result is same as source string, reuse source shared string + + elsif Count = SR.Last then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, Count) then + if Count > SR.Last then + for J in SR.Last + 1 .. Count loop + SR.Data (J) := Pad; + end loop; + end if; + + SR.Last := Count; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Count); + + -- Length of the source string is greater then requested, copy + -- corresponding slice. + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (1 .. Count); + + -- Length of the source string is less the requested, copy all + -- existing data and fill remaining positions with Pad characters. + + else + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + + for J in SR.Last + 1 .. Count loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + Source.Reference := DR; + Unreference (SR); + end if; + end Head; + + ----------- + -- Index -- + ----------- + + function Index + (Source : Unbounded_String; + Pattern : String; + Going : Strings.Direction := Strings.Forward; + Mapping : Maps.Character_Mapping := Maps.Identity) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_String; + Pattern : String; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping_Function) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_String; + Set : Maps.Character_Set; + Test : Strings.Membership := Strings.Inside; + Going : Strings.Direction := Strings.Forward) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going); + end Index; + + function Index + (Source : Unbounded_String; + Pattern : String; + From : Positive; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping := Maps.Identity) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index + (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_String; + Pattern : String; + From : Positive; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping_Function) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index + (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_String; + Set : Maps.Character_Set; + From : Positive; + Test : Membership := Inside; + Going : Direction := Forward) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index (SR.Data (1 .. SR.Last), Set, From, Test, Going); + end Index; + + --------------------- + -- Index_Non_Blank -- + --------------------- + + function Index_Non_Blank + (Source : Unbounded_String; + Going : Strings.Direction := Strings.Forward) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going); + end Index_Non_Blank; + + function Index_Non_Blank + (Source : Unbounded_String; + From : Positive; + Going : Direction := Forward) return Natural + is + SR : constant Shared_String_Access := Source.Reference; + begin + return Search.Index_Non_Blank (SR.Data (1 .. SR.Last), From, Going); + end Index_Non_Blank; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize (Object : in out Unbounded_String) is + begin + Reference (Object.Reference); + end Initialize; + + ------------ + -- Insert -- + ------------ + + function Insert + (Source : Unbounded_String; + Before : Positive; + New_Item : String) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_String_Access; + + begin + -- Check index first + + if Before > SR.Last + 1 then + raise Index_Error; + end if; + + -- Result is empty, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Inserted string is empty, reuse source shared string + + elsif New_Item'Length = 0 then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL + DL /Growth_Factor); + DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); + DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + DR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Insert; + + procedure Insert + (Source : in out Unbounded_String; + Before : Positive; + New_Item : String) + is + SR : constant Shared_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_String_Access; + + begin + -- Check bounds + + if Before > SR.Last + 1 then + raise Index_Error; + end if; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- Inserted string is empty, nothing to do + + elsif New_Item'Length = 0 then + null; + + -- Try to reuse existing shared string first + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + SR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + SR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); + DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + DR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Insert; + + ------------ + -- Length -- + ------------ + + function Length (Source : Unbounded_String) return Natural is + begin + return Source.Reference.Last; + end Length; + + --------------- + -- Overwrite -- + --------------- + + function Overwrite + (Source : Unbounded_String; + Position : Positive; + New_Item : String) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Check bounds + + if Position > SR.Last + 1 then + raise Index_Error; + end if; + + DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Result is same as source string, reuse source shared string + + elsif New_Item'Length = 0 then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); + DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + DR.Data (Position + New_Item'Length .. DL) := + SR.Data (Position + New_Item'Length .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Overwrite; + + procedure Overwrite + (Source : in out Unbounded_String; + Position : Positive; + New_Item : String) + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Bounds check + + if Position > SR.Last + 1 then + raise Index_Error; + end if; + + DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- String unchanged, nothing to do + + elsif New_Item'Length = 0 then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + SR.Last := DL; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); + DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + DR.Data (Position + New_Item'Length .. DL) := + SR.Data (Position + New_Item'Length .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Overwrite; + + --------------- + -- Reference -- + --------------- + + procedure Reference (Item : not null Shared_String_Access) is + begin + Sync_Add_And_Fetch (Item.Counter'Access, 1); + end Reference; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Source : in out Unbounded_String; + Index : Positive; + By : Character) + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Bounds check. + + if Index <= SR.Last then + + -- Try to reuse existing shared string + + if Can_Be_Reused (SR, SR.Last) then + SR.Data (Index) := By; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (Index) := By; + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + + else + raise Index_Error; + end if; + end Replace_Element; + + ------------------- + -- Replace_Slice -- + ------------------- + + function Replace_Slice + (Source : Unbounded_String; + Low : Positive; + High : Natural; + By : String) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 then + raise Index_Error; + end if; + + -- Do replace operation when removed slice is not empty + + if High >= Low then + DL := By'Length + SR.Last + Low - High - 1; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); + DR.Data (Low .. Low + By'Length - 1) := By; + DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + + -- Otherwise just insert string + + else + return Insert (Source, Low, By); + end if; + end Replace_Slice; + + procedure Replace_Slice + (Source : in out Unbounded_String; + Low : Positive; + High : Natural; + By : String) + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Bounds check + + if Low > SR.Last + 1 then + raise Index_Error; + end if; + + -- Do replace operation only when replaced slice is not empty + + if High >= Low then + DL := By'Length + SR.Last + Low - High - 1; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + SR.Data (Low .. Low + By'Length - 1) := By; + SR.Last := DL; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); + DR.Data (Low .. Low + By'Length - 1) := By; + DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + + -- Otherwise just insert item + + else + Insert (Source, Low, By); + end if; + end Replace_Slice; + + -------------------------- + -- Set_Unbounded_String -- + -------------------------- + + procedure Set_Unbounded_String + (Target : out Unbounded_String; + Source : String) + is + TR : constant Shared_String_Access := Target.Reference; + DR : Shared_String_Access; + + begin + -- In case of empty string, reuse empty shared string + + if Source'Length = 0 then + Reference (Empty_Shared_String'Access); + Target.Reference := Empty_Shared_String'Access; + + else + -- Try to reuse existing shared string + + if Can_Be_Reused (TR, Source'Length) then + Reference (TR); + DR := TR; + + -- Otherwise allocate new shared string + + else + DR := Allocate (Source'Length); + Target.Reference := DR; + end if; + + DR.Data (1 .. Source'Length) := Source; + DR.Last := Source'Length; + end if; + + Unreference (TR); + end Set_Unbounded_String; + + ----------- + -- Slice -- + ----------- + + function Slice + (Source : Unbounded_String; + Low : Positive; + High : Natural) return String + is + SR : constant Shared_String_Access := Source.Reference; + + begin + -- Note: test of High > Length is in accordance with AI95-00128 + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + else + return SR.Data (Low .. High); + end if; + end Slice; + + ---------- + -- Tail -- + ---------- + + function Tail + (Source : Unbounded_String; + Count : Natural; + Pad : Character := Space) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- For empty result reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Result is whole source string, reuse source shared string + + elsif Count = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (Count); + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); + + else + for J in 1 .. Count - SR.Last loop + DR.Data (J) := Pad; + end loop; + + DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); + end if; + + DR.Last := Count; + end if; + + return (AF.Controlled with Reference => DR); + end Tail; + + procedure Tail + (Source : in out Unbounded_String; + Count : Natural; + Pad : Character := Space) + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + procedure Common + (SR : Shared_String_Access; + DR : Shared_String_Access; + Count : Natural); + -- Common code of tail computation. SR/DR can point to the same object + + ------------ + -- Common -- + ------------ + + procedure Common + (SR : Shared_String_Access; + DR : Shared_String_Access; + Count : Natural) is + begin + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); + + else + DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); + + for J in 1 .. Count - SR.Last loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + end Common; + + begin + -- Result is empty string, reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- Length of the result is the same as length of the source string, + -- reuse source shared string. + + elsif Count = SR.Last then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, Count) then + Common (SR, SR, Count); + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (Count); + Common (SR, DR, Count); + Source.Reference := DR; + Unreference (SR); + end if; + end Tail; + + --------------- + -- To_String -- + --------------- + + function To_String (Source : Unbounded_String) return String is + begin + return Source.Reference.Data (1 .. Source.Reference.Last); + end To_String; + + ------------------------- + -- To_Unbounded_String -- + ------------------------- + + function To_Unbounded_String (Source : String) return Unbounded_String is + DR : constant Shared_String_Access := Allocate (Source'Length); + begin + DR.Data (1 .. Source'Length) := Source; + DR.Last := Source'Length; + return (AF.Controlled with Reference => DR); + end To_Unbounded_String; + + function To_Unbounded_String (Length : Natural) return Unbounded_String is + DR : constant Shared_String_Access := Allocate (Length); + begin + DR.Last := Length; + return (AF.Controlled with Reference => DR); + end To_Unbounded_String; + + --------------- + -- Translate -- + --------------- + + function Translate + (Source : Unbounded_String; + Mapping : Maps.Character_Mapping) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Nothing to translate, reuse empty shared string + + if SR.Last = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + DR.Last := SR.Last; + end if; + + return (AF.Controlled with Reference => DR); + end Translate; + + procedure Translate + (Source : in out Unbounded_String; + Mapping : Maps.Character_Mapping) + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Nothing to translate + + if SR.Last = 0 then + null; + + -- Try to reuse shared string + + elsif Can_Be_Reused (SR, SR.Last) then + for J in 1 .. SR.Last loop + SR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + end Translate; + + function Translate + (Source : Unbounded_String; + Mapping : Maps.Character_Mapping_Function) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Nothing to translate, reuse empty shared string + + if SR.Last = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + DR.Last := SR.Last; + end if; + + return (AF.Controlled with Reference => DR); + + exception + when others => + Unreference (DR); + + raise; + end Translate; + + procedure Translate + (Source : in out Unbounded_String; + Mapping : Maps.Character_Mapping_Function) + is + SR : constant Shared_String_Access := Source.Reference; + DR : Shared_String_Access; + + begin + -- Nothing to translate + + if SR.Last = 0 then + null; + + -- Try to reuse shared string + + elsif Can_Be_Reused (SR, SR.Last) then + for J in 1 .. SR.Last loop + SR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + + exception + when others => + if DR /= null then + Unreference (DR); + end if; + + raise; + end Translate; + + ---------- + -- Trim -- + ---------- + + function Trim + (Source : Unbounded_String; + Side : Trim_End) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index_Non_Blank (Source, Forward); + + -- All blanks, reuse empty shared string + + if Low = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + else + case Side is + when Left => + High := SR.Last; + DL := SR.Last - Low + 1; + + when Right => + Low := 1; + High := Index_Non_Blank (Source, Backward); + DL := High; + + when Both => + High := Index_Non_Blank (Source, Backward); + DL := High - Low + 1; + end case; + + -- Length of the result is the same as length of the source string, + -- reuse source shared string. + + if DL = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Trim; + + procedure Trim + (Source : in out Unbounded_String; + Side : Trim_End) + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index_Non_Blank (Source, Forward); + + -- All blanks, reuse empty shared string + + if Low = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + else + case Side is + when Left => + High := SR.Last; + DL := SR.Last - Low + 1; + + when Right => + Low := 1; + High := Index_Non_Blank (Source, Backward); + DL := High; + + when Both => + High := Index_Non_Blank (Source, Backward); + DL := High - Low + 1; + end case; + + -- Length of the result is the same as length of the source string, + -- nothing to do. + + if DL = SR.Last then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (1 .. DL) := SR.Data (Low .. High); + SR.Last := DL; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Trim; + + function Trim + (Source : Unbounded_String; + Left : Maps.Character_Set; + Right : Maps.Character_Set) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index (Source, Left, Outside, Forward); + + -- Source includes only characters from Left set, reuse empty shared + -- string. + + if Low = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + else + High := Index (Source, Right, Outside, Backward); + DL := Integer'Max (0, High - Low + 1); + + -- Source includes only characters from Right set or result string + -- is empty, reuse empty shared string. + + if High = 0 or else DL = 0 then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Trim; + + procedure Trim + (Source : in out Unbounded_String; + Left : Maps.Character_Set; + Right : Maps.Character_Set) + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index (Source, Left, Outside, Forward); + + -- Source includes only characters from Left set, reuse empty shared + -- string. + + if Low = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + else + High := Index (Source, Right, Outside, Backward); + DL := Integer'Max (0, High - Low + 1); + + -- Source includes only characters from Right set or result string + -- is empty, reuse empty shared string. + + if High = 0 or else DL = 0 then + Reference (Empty_Shared_String'Access); + Source.Reference := Empty_Shared_String'Access; + Unreference (SR); + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (1 .. DL) := SR.Data (Low .. High); + SR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Trim; + + --------------------- + -- Unbounded_Slice -- + --------------------- + + function Unbounded_Slice + (Source : Unbounded_String; + Low : Positive; + High : Natural) return Unbounded_String + is + SR : constant Shared_String_Access := Source.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + -- Result is empty slice, reuse empty shared string + + elsif Low > High then + Reference (Empty_Shared_String'Access); + DR := Empty_Shared_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DL := High - Low + 1; + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Unbounded_Slice; + + procedure Unbounded_Slice + (Source : Unbounded_String; + Target : out Unbounded_String; + Low : Positive; + High : Natural) + is + SR : constant Shared_String_Access := Source.Reference; + TR : constant Shared_String_Access := Target.Reference; + DL : Natural; + DR : Shared_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + -- Result is empty slice, reuse empty shared string + + elsif Low > High then + Reference (Empty_Shared_String'Access); + Target.Reference := Empty_Shared_String'Access; + Unreference (TR); + + else + DL := High - Low + 1; + + -- Try to reuse existing shared string + + if Can_Be_Reused (TR, DL) then + TR.Data (1 .. DL) := SR.Data (Low .. High); + TR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Target.Reference := DR; + Unreference (TR); + end if; + end if; + end Unbounded_Slice; + + ----------------- + -- Unreference -- + ----------------- + + procedure Unreference (Item : not null Shared_String_Access) is + use Interfaces; + + procedure Free is + new Ada.Unchecked_Deallocation (Shared_String, Shared_String_Access); + + Aux : Shared_String_Access := Item; + + begin + if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then + + -- Reference counter of Empty_Shared_String must never reach zero + + pragma Assert (Aux /= Empty_Shared_String'Access); + + Free (Aux); + end if; + end Unreference; + + end Ada.Strings.Unbounded; diff -Nrcpad gcc-4.5.2/gcc/ada/a-strunb-shared.ads gcc-4.6.0/gcc/ada/a-strunb-shared.ads *** gcc-4.5.2/gcc/ada/a-strunb-shared.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-strunb-shared.ads Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,490 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . U N B O U N D E D -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This package provides an implementation of Ada.Strings.Unbounded that uses + -- reference counts to implement copy on modification (rather than copy on + -- assignment). This is significantly more efficient on many targets. + + -- This version is supported on: + -- - all Alpha platforms + -- - all ia64 platforms + -- - all PowerPC platforms + -- - all SPARC V9 platforms + -- - all x86_64 platforms + + -- This package uses several techniques to increase speed: + + -- - Implicit sharing or copy-on-write. An Unbounded_String contains only + -- the reference to the data which is shared between several instances. + -- The shared data is reallocated only when its value is changed and + -- the object mutation can't be used or it is inefficient to use it. + + -- - Object mutation. Shared data object can be reused without memory + -- reallocation when all of the following requirements are met: + -- - the shared data object is no longer used by anyone else; + -- - the size is sufficient to store the new value; + -- - the gap after reuse is less then a defined threshold. + + -- - Memory preallocation. Most of used memory allocation algorithms + -- align allocated segments on the some boundary, thus some amount of + -- additional memory can be preallocated without any impact. Such + -- preallocated memory can used later by Append/Insert operations + -- without reallocation. + + -- Reference counting uses GCC builtin atomic operations, which allows to + -- safely share internal data between Ada tasks. Nevertheless, this doesn't + -- make objects of Unbounded_String thread-safe: each instance can't be + -- accessed by several tasks simultaneously. + + with Ada.Strings.Maps; + private with Ada.Finalization; + private with Interfaces; + + package Ada.Strings.Unbounded is + pragma Preelaborate; + + type Unbounded_String is private; + pragma Preelaborable_Initialization (Unbounded_String); + + Null_Unbounded_String : constant Unbounded_String; + + function Length (Source : Unbounded_String) return Natural; + + type String_Access is access all String; + + procedure Free (X : in out String_Access); + + -------------------------------------------------------- + -- Conversion, Concatenation, and Selection Functions -- + -------------------------------------------------------- + + function To_Unbounded_String + (Source : String) return Unbounded_String; + + function To_Unbounded_String + (Length : Natural) return Unbounded_String; + + function To_String (Source : Unbounded_String) return String; + + procedure Set_Unbounded_String + (Target : out Unbounded_String; + Source : String); + pragma Ada_05 (Set_Unbounded_String); + + procedure Append + (Source : in out Unbounded_String; + New_Item : Unbounded_String); + + procedure Append + (Source : in out Unbounded_String; + New_Item : String); + + procedure Append + (Source : in out Unbounded_String; + New_Item : Character); + + function "&" + (Left : Unbounded_String; + Right : Unbounded_String) return Unbounded_String; + + function "&" + (Left : Unbounded_String; + Right : String) return Unbounded_String; + + function "&" + (Left : String; + Right : Unbounded_String) return Unbounded_String; + + function "&" + (Left : Unbounded_String; + Right : Character) return Unbounded_String; + + function "&" + (Left : Character; + Right : Unbounded_String) return Unbounded_String; + + function Element + (Source : Unbounded_String; + Index : Positive) return Character; + + procedure Replace_Element + (Source : in out Unbounded_String; + Index : Positive; + By : Character); + + function Slice + (Source : Unbounded_String; + Low : Positive; + High : Natural) return String; + + function Unbounded_Slice + (Source : Unbounded_String; + Low : Positive; + High : Natural) return Unbounded_String; + pragma Ada_05 (Unbounded_Slice); + + procedure Unbounded_Slice + (Source : Unbounded_String; + Target : out Unbounded_String; + Low : Positive; + High : Natural); + pragma Ada_05 (Unbounded_Slice); + + function "=" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean; + + function "=" + (Left : Unbounded_String; + Right : String) return Boolean; + + function "=" + (Left : String; + Right : Unbounded_String) return Boolean; + + function "<" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean; + + function "<" + (Left : Unbounded_String; + Right : String) return Boolean; + + function "<" + (Left : String; + Right : Unbounded_String) return Boolean; + + function "<=" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean; + + function "<=" + (Left : Unbounded_String; + Right : String) return Boolean; + + function "<=" + (Left : String; + Right : Unbounded_String) return Boolean; + + function ">" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean; + + function ">" + (Left : Unbounded_String; + Right : String) return Boolean; + + function ">" + (Left : String; + Right : Unbounded_String) return Boolean; + + function ">=" + (Left : Unbounded_String; + Right : Unbounded_String) return Boolean; + + function ">=" + (Left : Unbounded_String; + Right : String) return Boolean; + + function ">=" + (Left : String; + Right : Unbounded_String) return Boolean; + + ------------------------ + -- Search Subprograms -- + ------------------------ + + function Index + (Source : Unbounded_String; + Pattern : String; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping := Maps.Identity) return Natural; + + function Index + (Source : Unbounded_String; + Pattern : String; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping_Function) return Natural; + + function Index + (Source : Unbounded_String; + Set : Maps.Character_Set; + Test : Membership := Inside; + Going : Direction := Forward) return Natural; + + function Index + (Source : Unbounded_String; + Pattern : String; + From : Positive; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping := Maps.Identity) return Natural; + pragma Ada_05 (Index); + + function Index + (Source : Unbounded_String; + Pattern : String; + From : Positive; + Going : Direction := Forward; + Mapping : Maps.Character_Mapping_Function) return Natural; + pragma Ada_05 (Index); + + function Index + (Source : Unbounded_String; + Set : Maps.Character_Set; + From : Positive; + Test : Membership := Inside; + Going : Direction := Forward) return Natural; + pragma Ada_05 (Index); + + function Index_Non_Blank + (Source : Unbounded_String; + Going : Direction := Forward) return Natural; + + function Index_Non_Blank + (Source : Unbounded_String; + From : Positive; + Going : Direction := Forward) return Natural; + pragma Ada_05 (Index_Non_Blank); + + function Count + (Source : Unbounded_String; + Pattern : String; + Mapping : Maps.Character_Mapping := Maps.Identity) return Natural; + + function Count + (Source : Unbounded_String; + Pattern : String; + Mapping : Maps.Character_Mapping_Function) return Natural; + + function Count + (Source : Unbounded_String; + Set : Maps.Character_Set) return Natural; + + procedure Find_Token + (Source : Unbounded_String; + Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Unbounded_String; + Set : Maps.Character_Set; + Test : Membership; + First : out Positive; + Last : out Natural); + + ------------------------------------ + -- String Translation Subprograms -- + ------------------------------------ + + function Translate + (Source : Unbounded_String; + Mapping : Maps.Character_Mapping) return Unbounded_String; + + procedure Translate + (Source : in out Unbounded_String; + Mapping : Maps.Character_Mapping); + + function Translate + (Source : Unbounded_String; + Mapping : Maps.Character_Mapping_Function) return Unbounded_String; + + procedure Translate + (Source : in out Unbounded_String; + Mapping : Maps.Character_Mapping_Function); + + --------------------------------------- + -- String Transformation Subprograms -- + --------------------------------------- + + function Replace_Slice + (Source : Unbounded_String; + Low : Positive; + High : Natural; + By : String) return Unbounded_String; + + procedure Replace_Slice + (Source : in out Unbounded_String; + Low : Positive; + High : Natural; + By : String); + + function Insert + (Source : Unbounded_String; + Before : Positive; + New_Item : String) return Unbounded_String; + + procedure Insert + (Source : in out Unbounded_String; + Before : Positive; + New_Item : String); + + function Overwrite + (Source : Unbounded_String; + Position : Positive; + New_Item : String) return Unbounded_String; + + procedure Overwrite + (Source : in out Unbounded_String; + Position : Positive; + New_Item : String); + + function Delete + (Source : Unbounded_String; + From : Positive; + Through : Natural) return Unbounded_String; + + procedure Delete + (Source : in out Unbounded_String; + From : Positive; + Through : Natural); + + function Trim + (Source : Unbounded_String; + Side : Trim_End) return Unbounded_String; + + procedure Trim + (Source : in out Unbounded_String; + Side : Trim_End); + + function Trim + (Source : Unbounded_String; + Left : Maps.Character_Set; + Right : Maps.Character_Set) return Unbounded_String; + + procedure Trim + (Source : in out Unbounded_String; + Left : Maps.Character_Set; + Right : Maps.Character_Set); + + function Head + (Source : Unbounded_String; + Count : Natural; + Pad : Character := Space) return Unbounded_String; + + procedure Head + (Source : in out Unbounded_String; + Count : Natural; + Pad : Character := Space); + + function Tail + (Source : Unbounded_String; + Count : Natural; + Pad : Character := Space) return Unbounded_String; + + procedure Tail + (Source : in out Unbounded_String; + Count : Natural; + Pad : Character := Space); + + function "*" + (Left : Natural; + Right : Character) return Unbounded_String; + + function "*" + (Left : Natural; + Right : String) return Unbounded_String; + + function "*" + (Left : Natural; + Right : Unbounded_String) return Unbounded_String; + + private + pragma Inline (Length); + + package AF renames Ada.Finalization; + + type Shared_String (Max_Length : Natural) is limited record + Counter : aliased Interfaces.Unsigned_32 := 1; + -- Reference counter + + Last : Natural := 0; + Data : String (1 .. Max_Length); + -- Last is the index of last significant element of the Data. All + -- elements with larger indexes are currently insignificant. + end record; + + type Shared_String_Access is access all Shared_String; + + procedure Reference (Item : not null Shared_String_Access); + -- Increment reference counter + + procedure Unreference (Item : not null Shared_String_Access); + -- Decrement reference counter, deallocate Item when counter goes to zero + + function Can_Be_Reused + (Item : Shared_String_Access; + Length : Natural) return Boolean; + -- Returns True if Shared_String can be reused. There are two criteria when + -- Shared_String can be reused: its reference counter must be one (thus + -- Shared_String is owned exclusively) and its size is sufficient to + -- store string with specified length effectively. + + function Allocate (Max_Length : Natural) return Shared_String_Access; + -- Allocates new Shared_String with at least specified maximum length. + -- Actual maximum length of the allocated Shared_String can be slightly + -- greater. Returns reference to Empty_Shared_String when requested length + -- is zero. + + Empty_Shared_String : aliased Shared_String (0); + + function To_Unbounded (S : String) return Unbounded_String + renames To_Unbounded_String; + -- This renames are here only to be used in the pragma Stream_Convert + + type Unbounded_String is new AF.Controlled with record + Reference : Shared_String_Access := Empty_Shared_String'Access; + end record; + + 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 + + overriding procedure Initialize (Object : in out Unbounded_String); + overriding procedure Adjust (Object : in out Unbounded_String); + overriding procedure Finalize (Object : in out Unbounded_String); + + Null_Unbounded_String : constant Unbounded_String := + (AF.Controlled with + Reference => Empty_Shared_String'Access); + + end Ada.Strings.Unbounded; diff -Nrcpad gcc-4.5.2/gcc/ada/a-strunb.adb gcc-4.6.0/gcc/ada/a-strunb.adb *** gcc-4.5.2/gcc/ada/a-strunb.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-strunb.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Unbounded is *** 507,512 **** --- 507,525 ---- procedure Find_Token (Source : Unbounded_String; Set : Maps.Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + begin + Search.Find_Token + (Source.Reference (From .. Source.Last), Set, Test, First, Last); + end Find_Token; + + procedure Find_Token + (Source : Unbounded_String; + Set : Maps.Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) *************** package body Ada.Strings.Unbounded is *** 914,922 **** function To_Unbounded_String (Source : String) return Unbounded_String is Result : Unbounded_String; begin ! Result.Last := Source'Length; ! Result.Reference := new String (1 .. Source'Length); ! Result.Reference.all := Source; return Result; end To_Unbounded_String; --- 927,940 ---- function To_Unbounded_String (Source : String) return Unbounded_String is Result : Unbounded_String; begin ! -- Do not allocate an empty string: keep the default ! ! if Source'Length > 0 then ! Result.Last := Source'Length; ! Result.Reference := new String (1 .. Source'Length); ! Result.Reference.all := Source; ! end if; ! return Result; end To_Unbounded_String; *************** package body Ada.Strings.Unbounded is *** 924,932 **** (Length : Natural) return Unbounded_String is Result : Unbounded_String; begin ! Result.Last := Length; ! Result.Reference := new String (1 .. Length); return Result; end To_Unbounded_String; --- 942,956 ---- (Length : Natural) return Unbounded_String is Result : Unbounded_String; + begin ! -- Do not allocate an empty string: keep the default ! ! if Length > 0 then ! Result.Last := Length; ! Result.Reference := new String (1 .. Length); ! end if; ! return Result; end To_Unbounded_String; diff -Nrcpad gcc-4.5.2/gcc/ada/a-strunb.ads gcc-4.6.0/gcc/ada/a-strunb.ads *** gcc-4.5.2/gcc/ada/a-strunb.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-strunb.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Strings.Unbounded is *** 259,264 **** --- 259,273 ---- procedure Find_Token (Source : Unbounded_String; Set : Maps.Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Unbounded_String; + Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-ststio.adb gcc-4.6.0/gcc/ada/a-ststio.adb *** gcc-4.5.2/gcc/ada/a-ststio.adb Mon Jan 25 16:24:20 2010 --- gcc-4.6.0/gcc/ada/a-ststio.adb Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Streams.Stream_IO is *** 147,153 **** function End_Of_File (File : File_Type) return Boolean is begin FIO.Check_Read_Status (AP (File)); ! return Count (File.Index) > Size (File); end End_Of_File; ----------- --- 147,153 ---- function End_Of_File (File : File_Type) return Boolean is begin FIO.Check_Read_Status (AP (File)); ! return File.Index > Size (File); end End_Of_File; ----------- *************** package body Ada.Streams.Stream_IO is *** 175,181 **** function Index (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); ! return Count (File.Index); end Index; ------------- --- 175,181 ---- function Index (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); ! return File.Index; end Index; ------------- diff -Nrcpad gcc-4.5.2/gcc/ada/a-stunau-shared.adb gcc-4.6.0/gcc/ada/a-stunau-shared.adb *** gcc-4.5.2/gcc/ada/a-stunau-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stunau-shared.adb Wed Jun 23 12:51:37 2010 *************** *** 0 **** --- 1,62 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . U N B O U N D E D . A U X -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.Unbounded.Aux is + + ---------------- + -- Get_String -- + ---------------- + + procedure Get_String + (U : Unbounded_String; + S : out Big_String_Access; + L : out Natural) + is + X : aliased Big_String; + for X'Address use U.Reference.Data'Address; + begin + S := X'Unchecked_Access; + L := U.Reference.Last; + end Get_String; + + ---------------- + -- Set_String -- + ---------------- + + procedure Set_String (UP : in out Unbounded_String; S : String_Access) is + X : String_Access := S; + + begin + Set_Unbounded_String (UP, S.all); + Free (X); + end Set_String; + + end Ada.Strings.Unbounded.Aux; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stunau.adb gcc-4.6.0/gcc/ada/a-stunau.adb *** gcc-4.5.2/gcc/ada/a-stunau.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stunau.adb Fri Jun 18 12:29:49 2010 *************** package body Ada.Strings.Unbounded.Aux i *** 37,47 **** procedure Get_String (U : Unbounded_String; ! S : out String_Access; L : out Natural) is begin ! S := U.Reference; L := U.Last; end Get_String; --- 37,50 ---- procedure Get_String (U : Unbounded_String; ! S : out Big_String_Access; L : out Natural) is + X : aliased Big_String; + for X'Address use U.Reference.all'Address; + begin ! S := X'Unchecked_Access; L := U.Last; end Get_String; *************** package body Ada.Strings.Unbounded.Aux i *** 49,65 **** -- Set_String -- ---------------- - procedure Set_String (UP : in out Unbounded_String; S : String) is - begin - if S'Length > UP.Last then - Finalize (UP); - UP.Reference := new String (1 .. S'Length); - end if; - - UP.Reference (1 .. S'Length) := S; - UP.Last := S'Length; - end Set_String; - procedure Set_String (UP : in out Unbounded_String; S : String_Access) is begin Finalize (UP); --- 52,57 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/a-stunau.ads gcc-4.6.0/gcc/ada/a-stunau.ads *** gcc-4.5.2/gcc/ada/a-stunau.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stunau.ads Fri Jun 18 12:29:49 2010 *************** *** 37,45 **** package Ada.Strings.Unbounded.Aux is pragma Preelaborate; procedure Get_String (U : Unbounded_String; ! S : out String_Access; L : out Natural); pragma Inline (Get_String); -- This procedure returns the internal string pointer used in the --- 37,48 ---- package Ada.Strings.Unbounded.Aux is pragma Preelaborate; + subtype Big_String is String (1 .. Positive'Last); + type Big_String_Access is access all Big_String; + procedure Get_String (U : Unbounded_String; ! S : out Big_String_Access; L : out Natural); pragma Inline (Get_String); -- This procedure returns the internal string pointer used in the *************** package Ada.Strings.Unbounded.Aux is *** 54,71 **** -- referenced string returned by this call is always one, so the actual -- string data is always accessible as S (1 .. L). ! procedure Set_String (UP : in out Unbounded_String; S : String); ! pragma Inline (Set_String); ! -- This function sets the string contents of the referenced unbounded ! -- string to the given string value. It is significantly more efficient ! -- than the use of To_Unbounded_String with an assignment, since it ! -- avoids the necessity of messing with finalization chains. The lower ! -- bound of the string S is not required to be one. procedure Set_String (UP : in out Unbounded_String; S : String_Access); pragma Inline (Set_String); ! -- This version of Set_String takes a string access value, rather than a ! -- string. The lower bound of the string value is required to be one, and ! -- this requirement is not checked. end Ada.Strings.Unbounded.Aux; --- 57,72 ---- -- referenced string returned by this call is always one, so the actual -- string data is always accessible as S (1 .. L). ! procedure Set_String (UP : out Unbounded_String; S : String) ! renames Set_Unbounded_String; ! -- This function is simply a renaming of the new Ada 2005 function as shown ! -- above. It is provided for historical reasons, but should be removed at ! -- this stage??? procedure Set_String (UP : in out Unbounded_String; S : String_Access); pragma Inline (Set_String); ! -- This version of Set_Unbounded_String takes a string access value, rather ! -- than a string. The lower bound of the string value is required to be ! -- one, and this requirement is not checked. end Ada.Strings.Unbounded.Aux; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stuten.adb gcc-4.6.0/gcc/ada/a-stuten.adb *** gcc-4.5.2/gcc/ada/a-stuten.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stuten.adb Wed Jun 23 12:44:34 2010 *************** *** 0 **** --- 1,209 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . U T F _ E N C O D I N G -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.UTF_Encoding is + use Interfaces; + + -------------- + -- Encoding -- + -------------- + + function Encoding + (Item : UTF_String; + Default : Encoding_Scheme := UTF_8) return Encoding_Scheme + is + begin + if Item'Length >= 2 then + if Item (Item'First .. Item'First + 1) = BOM_16BE then + return UTF_16BE; + + elsif Item (Item'First .. Item'First + 1) = BOM_16LE then + return UTF_16LE; + + elsif Item'Length >= 3 + and then Item (Item'First .. Item'First + 2) = BOM_8 + then + return UTF_8; + end if; + end if; + + return Default; + end Encoding; + + ----------------- + -- From_UTF_16 -- + ----------------- + + function From_UTF_16 + (Item : UTF_16_Wide_String; + Output_Scheme : UTF_XE_Encoding; + Output_BOM : Boolean := False) return UTF_String + is + BSpace : constant Natural := 2 * Boolean'Pos (Output_BOM); + Result : UTF_String (1 .. 2 * Item'Length + BSpace); + Len : Natural; + C : Unsigned_16; + Iptr : Natural; + + begin + if Output_BOM then + Result (1 .. 2) := + (if Output_Scheme = UTF_16BE then BOM_16BE else BOM_16LE); + Len := 2; + else + Len := 0; + end if; + + -- Skip input BOM + + Iptr := Item'First; + + if Iptr <= Item'Last and then Item (Iptr) = BOM_16 (1) then + Iptr := Iptr + 1; + end if; + + -- UTF-16BE case + + if Output_Scheme = UTF_16BE then + while Iptr <= Item'Last loop + C := To_Unsigned_16 (Item (Iptr)); + Result (Len + 1) := Character'Val (Shift_Right (C, 8)); + Result (Len + 2) := Character'Val (C and 16#00_FF#); + Len := Len + 2; + Iptr := Iptr + 1; + end loop; + + -- UTF-16LE case + + else + while Iptr <= Item'Last loop + C := To_Unsigned_16 (Item (Iptr)); + Result (Len + 1) := Character'Val (C and 16#00_FF#); + Result (Len + 2) := Character'Val (Shift_Right (C, 8)); + Len := Len + 2; + Iptr := Iptr + 1; + end loop; + end if; + + return Result (1 .. Len); + end From_UTF_16; + + -------------------------- + -- Raise_Encoding_Error -- + -------------------------- + + procedure Raise_Encoding_Error (Index : Natural) is + Val : constant String := Index'Img; + begin + raise Encoding_Error with + "bad input at Item (" & Val (Val'First + 1 .. Val'Last) & ')'; + end Raise_Encoding_Error; + + --------------- + -- To_UTF_16 -- + --------------- + + function To_UTF_16 + (Item : UTF_String; + Input_Scheme : UTF_XE_Encoding; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + Result : UTF_16_Wide_String (1 .. Item'Length / 2 + 1); + Len : Natural; + Iptr : Natural; + + begin + if Item'Length mod 2 /= 0 then + raise Encoding_Error with "UTF-16BE/LE string has odd length"; + end if; + + -- Deal with input BOM, skip if OK, error if bad BOM + + Iptr := Item'First; + + if Item'Length >= 2 then + if Item (Iptr .. Iptr + 1) = BOM_16BE then + if Input_Scheme = UTF_16BE then + Iptr := Iptr + 2; + else + Raise_Encoding_Error (Iptr); + end if; + + elsif Item (Iptr .. Iptr + 1) = BOM_16LE then + if Input_Scheme = UTF_16LE then + Iptr := Iptr + 2; + else + Raise_Encoding_Error (Iptr); + end if; + + elsif Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then + Raise_Encoding_Error (Iptr); + end if; + end if; + + -- Output BOM if specified + + if Output_BOM then + Result (1) := BOM_16 (1); + Len := 1; + else + Len := 0; + end if; + + -- UTF-16BE case + + if Input_Scheme = UTF_16BE then + while Iptr < Item'Last loop + Len := Len + 1; + Result (Len) := + Wide_Character'Val + (Character'Pos (Item (Iptr)) * 256 + + Character'Pos (Item (Iptr + 1))); + Iptr := Iptr + 2; + end loop; + + -- UTF-16LE case + + else + while Iptr < Item'Last loop + Len := Len + 1; + Result (Len) := + Wide_Character'Val + (Character'Pos (Item (Iptr)) + + Character'Pos (Item (Iptr + 1)) * 256); + Iptr := Iptr + 2; + end loop; + end if; + + return Result (1 .. Len); + end To_UTF_16; + + end Ada.Strings.UTF_Encoding; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stuten.ads gcc-4.6.0/gcc/ada/a-stuten.ads *** gcc-4.5.2/gcc/ada/a-stuten.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stuten.ads Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,146 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . U T F _ E N C O D I N G -- + -- -- + -- S p e c -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is one of the Ada 2012 package defined in AI05-0137-1. It is a parent + -- package that contains declarations used in the child packages for handling + -- UTF encoded strings. Note: this package is consistent with Ada 95, and may + -- be used in Ada 95 or Ada 2005 mode. + + with Interfaces; + with Unchecked_Conversion; + + package Ada.Strings.UTF_Encoding is + pragma Pure (UTF_Encoding); + + subtype UTF_String is String; + -- Used to represent a string of 8-bit values containing a sequence of + -- values encoded in one of three ways (UTF-8, UTF-16BE, or UTF-16LE). + -- Typically used in connection with a Scheme parameter indicating which + -- of the encodings applies. This is not strictly a String value in the + -- sense defined in the Ada RM, but in practice type String accommodates + -- all possible 256 codes, and can be used to hold any sequence of 8-bit + -- codes. We use String directly rather than create a new type so that + -- all existing facilities for manipulating type String (e.g. the child + -- packages of Ada.Strings) are available for manipulation of UTF_Strings. + + type Encoding_Scheme is (UTF_8, UTF_16BE, UTF_16LE); + -- Used to specify which of three possible encodings apply to a UTF_String + + subtype UTF_8_String is String; + -- Similar to UTF_String but specifically represents a UTF-8 encoded string + + subtype UTF_16_Wide_String is Wide_String; + -- This is similar to UTF_8_String but is used to represent a Wide_String + -- value which is a sequence of 16-bit values encoded using UTF-16. Again + -- this is not strictly a Wide_String in the sense of the Ada RM, but the + -- type Wide_String can be used to represent a sequence of arbitrary 16-bit + -- values, and it is more convenient to use Wide_String than a new type. + + Encoding_Error : exception; + -- This exception is raised in the following situations: + -- a) A UTF encoded string contains an invalid encoding sequence + -- b) A UTF-16BE or UTF-16LE input string has an odd length + -- c) An incorrect character value is present in the Input string + -- d) The result for a Wide_Character output exceeds 16#FFFF# + -- The exception message has the index value where the error occurred. + + -- The BOM (BYTE_ORDER_MARK) values defined here are used at the start of + -- a string to indicate the encoding. The convention in this package is + -- that on input a correct BOM is ignored and an incorrect BOM causes an + -- Encoding_Error exception. On output, the output string may or may not + -- include a BOM depending on the setting of Output_BOM. + + BOM_8 : constant UTF_8_String := + Character'Val (16#EF#) & + Character'Val (16#BB#) & + Character'Val (16#BF#); + + BOM_16BE : constant UTF_String := + Character'Val (16#FE#) & + Character'Val (16#FF#); + + BOM_16LE : constant UTF_String := + Character'Val (16#FF#) & + Character'Val (16#FE#); + + BOM_16 : constant UTF_16_Wide_String := + (1 => Wide_Character'Val (16#FEFF#)); + + function Encoding + (Item : UTF_String; + Default : Encoding_Scheme := UTF_8) return Encoding_Scheme; + -- This function inspects a UTF_String value to determine whether it + -- starts with a BOM for UTF-8, UTF-16BE, or UTF_16LE. If so, the result + -- is the scheme corresponding to the BOM. If no valid BOM is present + -- then the result is the specified Default value. + + private + function To_Unsigned_8 is new + Unchecked_Conversion (Character, Interfaces.Unsigned_8); + + function To_Unsigned_16 is new + Unchecked_Conversion (Wide_Character, Interfaces.Unsigned_16); + + function To_Unsigned_32 is new + Unchecked_Conversion (Wide_Wide_Character, Interfaces.Unsigned_32); + + subtype UTF_XE_Encoding is Encoding_Scheme range UTF_16BE .. UTF_16LE; + -- Subtype containing only UTF_16BE and UTF_16LE entries + + -- Utility routines for converting between UTF-16 and UTF-16LE/BE + + function From_UTF_16 + (Item : UTF_16_Wide_String; + Output_Scheme : UTF_XE_Encoding; + Output_BOM : Boolean := False) return UTF_String; + -- The input string Item is encoded in UTF-16. The output is encoded using + -- Output_Scheme (which is either UTF-16LE or UTF-16BE). There are no error + -- cases. The output starts with BOM_16BE/LE if Output_BOM is True. + + function To_UTF_16 + (Item : UTF_String; + Input_Scheme : UTF_XE_Encoding; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- The input string Item is encoded using Input_Scheme which is either + -- UTF-16LE or UTF-16BE. The output is the corresponding UTF_16 wide + -- string. Encoding error is raised if the length of the input is odd. + -- The output starts with BOM_16 if Output_BOM is True. + + procedure Raise_Encoding_Error (Index : Natural); + pragma No_Return (Raise_Encoding_Error); + -- Raise Encoding_Error exception for bad encoding in input item. The + -- parameter Index is the index of the location in Item for the error. + + end Ada.Strings.UTF_Encoding; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwibo.ads gcc-4.6.0/gcc/ada/a-stwibo.ads *** gcc-4.5.2/gcc/ada/a-stwibo.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwibo.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Strings.Wide_Bounded is *** 296,301 **** --- 296,310 ---- procedure Find_Token (Source : Bounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Bounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); *************** package Ada.Strings.Wide_Bounded is *** 754,759 **** --- 763,777 ---- procedure Find_Token (Source : Bounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + renames Super_Find_Token; + + procedure Find_Token + (Source : Bounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwifi.adb gcc-4.6.0/gcc/ada/a-stwifi.adb *** gcc-4.5.2/gcc/ada/a-stwifi.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwifi.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Wide_Fixed is *** 117,122 **** --- 117,131 ---- procedure Find_Token (Source : Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + renames Ada.Strings.Wide_Search.Find_Token; + + procedure Find_Token + (Source : Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwifi.ads gcc-4.6.0/gcc/ada/a-stwifi.ads *** gcc-4.5.2/gcc/ada/a-stwifi.ads Wed Jun 6 10:20:30 2007 --- gcc-4.6.0/gcc/ada/a-stwifi.ads Fri Oct 8 13:02:55 2010 *************** package Ada.Strings.Wide_Fixed is *** 105,110 **** --- 105,119 ---- procedure Find_Token (Source : Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwise.adb gcc-4.6.0/gcc/ada/a-stwise.adb *** gcc-4.5.2/gcc/ada/a-stwise.adb Tue Jul 7 13:38:45 2009 --- gcc-4.6.0/gcc/ada/a-stwise.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Wide_Search is *** 192,197 **** --- 192,231 ---- procedure Find_Token (Source : Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + is + begin + for J in From .. Source'Last loop + if Belongs (Source (J), Set, Test) then + First := J; + + for K in J + 1 .. Source'Last loop + if not Belongs (Source (K), Set, Test) then + Last := K - 1; + return; + end if; + end loop; + + -- Here if J indexes first char of token, and all chars after J + -- are in the token. + + Last := Source'Last; + return; + end if; + end loop; + + -- Here if no token found + + First := From; + Last := 0; + end Find_Token; + + procedure Find_Token + (Source : Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwise.ads gcc-4.6.0/gcc/ada/a-stwise.ads *** gcc-4.5.2/gcc/ada/a-stwise.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwise.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** private package Ada.Strings.Wide_Search *** 109,114 **** --- 109,123 ---- procedure Find_Token (Source : Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwisu.adb gcc-4.6.0/gcc/ada/a-stwisu.adb *** gcc-4.5.2/gcc/ada/a-stwisu.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwisu.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package body Ada.Strings.Wide_Superbound *** 796,801 **** --- 796,814 ---- procedure Super_Find_Token (Source : Super_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + begin + Wide_Search.Find_Token + (Source.Data (From .. Source.Current_Length), Set, Test, First, Last); + end Super_Find_Token; + + procedure Super_Find_Token + (Source : Super_String; + Set : Wide_Maps.Wide_Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwisu.ads gcc-4.6.0/gcc/ada/a-stwisu.ads *** gcc-4.5.2/gcc/ada/a-stwisu.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwisu.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package Ada.Strings.Wide_Superbounded is *** 299,304 **** --- 299,312 ---- procedure Super_Find_Token (Source : Super_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + + procedure Super_Find_Token + (Source : Super_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwiun-shared.adb gcc-4.6.0/gcc/ada/a-stwiun-shared.adb *** gcc-4.5.2/gcc/ada/a-stwiun-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stwiun-shared.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,2119 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . W I D E _ U N B O U N D E D -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Strings.Wide_Search; + with Ada.Unchecked_Deallocation; + + package body Ada.Strings.Wide_Unbounded is + + use Ada.Strings.Wide_Maps; + + Growth_Factor : constant := 32; + -- The growth factor controls how much extra space is allocated when + -- we have to increase the size of an allocated unbounded string. By + -- allocating extra space, we avoid the need to reallocate on every + -- append, particularly important when a string is built up by repeated + -- append operations of small pieces. This is expressed as a factor so + -- 32 means add 1/32 of the length of the string as growth space. + + Min_Mul_Alloc : constant := Standard'Maximum_Alignment; + -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes + -- no memory loss as most (all?) malloc implementations are obliged to + -- align the returned memory on the maximum alignment as malloc does not + -- know the target alignment. + + procedure Sync_Add_And_Fetch + (Ptr : access Interfaces.Unsigned_32; + Value : Interfaces.Unsigned_32); + pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4"); + + function Sync_Sub_And_Fetch + (Ptr : access Interfaces.Unsigned_32; + Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; + pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4"); + + function Aligned_Max_Length (Max_Length : Natural) return Natural; + -- Returns recommended length of the shared string which is greater or + -- equal to specified length. Calculation take in sense alignment of + -- the allocated memory segments to use memory effectively by + -- Append/Insert/etc operations. + + --------- + -- "&" -- + --------- + + function "&" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Unbounded_Wide_String + is + LR : constant Shared_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_String_Access := Right.Reference; + DL : constant Natural := LR.Last + RR.Last; + DR : Shared_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Left string is empty, return Right string. + + elsif LR.Last = 0 then + Reference (RR); + DR := RR; + + -- Right string is empty, return Left string. + + elsif RR.Last = 0 then + Reference (LR); + DR := LR; + + -- Otherwise, allocate new shared string and fill data. + + else + DR := Allocate (LR.Last + RR.Last); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Unbounded_Wide_String + is + LR : constant Shared_Wide_String_Access := Left.Reference; + DL : constant Natural := LR.Last + Right'Length; + DR : Shared_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Right is an empty string, return Left string. + + elsif Right'Length = 0 then + Reference (LR); + DR := LR; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (LR.Last + 1 .. DL) := Right; + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Unbounded_Wide_String + is + RR : constant Shared_Wide_String_Access := Right.Reference; + DL : constant Natural := Left'Length + RR.Last; + DR : Shared_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared one. + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Left is empty string, return Right string. + + elsif Left'Length = 0 then + Reference (RR); + DR := RR; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + DR.Data (1 .. Left'Length) := Left; + DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Unbounded_Wide_String; + Right : Wide_Character) return Unbounded_Wide_String + is + LR : constant Shared_Wide_String_Access := Left.Reference; + DL : constant Natural := LR.Last + 1; + DR : Shared_Wide_String_Access; + + begin + DR := Allocate (DL); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (DL) := Right; + DR.Last := DL; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Wide_Character; + Right : Unbounded_Wide_String) return Unbounded_Wide_String + is + RR : constant Shared_Wide_String_Access := Right.Reference; + DL : constant Natural := 1 + RR.Last; + DR : Shared_Wide_String_Access; + + begin + DR := Allocate (DL); + DR.Data (1) := Left; + DR.Data (2 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + + return (AF.Controlled with Reference => DR); + end "&"; + + --------- + -- "*" -- + --------- + + function "*" + (Left : Natural; + Right : Wide_Character) return Unbounded_Wide_String + is + DR : Shared_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared empty string. + + if Left = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (Left); + + for J in 1 .. Left loop + DR.Data (J) := Right; + end loop; + + DR.Last := Left; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + function "*" + (Left : Natural; + Right : Wide_String) return Unbounded_Wide_String + is + DL : constant Natural := Left * Right'Length; + DR : Shared_Wide_String_Access; + K : Positive; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + K := 1; + + for J in 1 .. Left loop + DR.Data (K .. K + Right'Length - 1) := Right; + K := K + Right'Length; + end loop; + + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + function "*" + (Left : Natural; + Right : Unbounded_Wide_String) return Unbounded_Wide_String + is + RR : constant Shared_Wide_String_Access := Right.Reference; + DL : constant Natural := Left * RR.Last; + DR : Shared_Wide_String_Access; + K : Positive; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Coefficient is one, just return string itself. + + elsif Left = 1 then + Reference (RR); + DR := RR; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + K := 1; + + for J in 1 .. Left loop + DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last); + K := K + RR.Last; + end loop; + + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + --------- + -- "<" -- + --------- + + function "<" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last); + end "<"; + + function "<" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) < Right; + end "<"; + + function "<" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return Left < RR.Data (1 .. RR.Last); + end "<"; + + ---------- + -- "<=" -- + ---------- + + function "<=" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_String_Access := Right.Reference; + + begin + -- LR = RR means two strings shares shared string, thus they are equal + + return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last); + end "<="; + + function "<=" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) <= Right; + end "<="; + + function "<=" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return Left <= RR.Data (1 .. RR.Last); + end "<="; + + --------- + -- "=" -- + --------- + + function "=" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_String_Access := Right.Reference; + + begin + return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last); + -- LR = RR means two strings shares shared string, thus they are equal. + end "="; + + function "=" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) = Right; + end "="; + + function "=" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return Left = RR.Data (1 .. RR.Last); + end "="; + + --------- + -- ">" -- + --------- + + function ">" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last); + end ">"; + + function ">" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) > Right; + end ">"; + + function ">" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return Left > RR.Data (1 .. RR.Last); + end ">"; + + ---------- + -- ">=" -- + ---------- + + function ">=" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_String_Access := Right.Reference; + + begin + -- LR = RR means two strings shares shared string, thus they are equal + + return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last); + end ">="; + + function ">=" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean + is + LR : constant Shared_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) >= Right; + end ">="; + + function ">=" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean + is + RR : constant Shared_Wide_String_Access := Right.Reference; + begin + return Left >= RR.Data (1 .. RR.Last); + end ">="; + + ------------ + -- Adjust -- + ------------ + + procedure Adjust (Object : in out Unbounded_Wide_String) is + begin + Reference (Object.Reference); + end Adjust; + + ------------------------ + -- Aligned_Max_Length -- + ------------------------ + + function Aligned_Max_Length (Max_Length : Natural) return Natural is + Static_Size : constant Natural := + Empty_Shared_Wide_String'Size / Standard'Storage_Unit; + -- Total size of all static components + + Element_Size : constant Natural := + Wide_Character'Size / Standard'Storage_Unit; + + begin + return + (((Static_Size + Max_Length * Element_Size - 1) / Min_Mul_Alloc + 2) + * Min_Mul_Alloc - Static_Size) / Element_Size; + end Aligned_Max_Length; + + -------------- + -- Allocate -- + -------------- + + function Allocate (Max_Length : Natural) return Shared_Wide_String_Access is + begin + -- Empty string requested, return shared empty string + + if Max_Length = 0 then + Reference (Empty_Shared_Wide_String'Access); + return Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate requested space (and probably some more room) + + else + return new Shared_Wide_String (Aligned_Max_Length (Max_Length)); + end if; + end Allocate; + + ------------ + -- Append -- + ------------ + + procedure Append + (Source : in out Unbounded_Wide_String; + New_Item : Unbounded_Wide_String) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + NR : constant Shared_Wide_String_Access := New_Item.Reference; + DL : constant Natural := SR.Last + NR.Last; + DR : Shared_Wide_String_Access; + + begin + -- Source is an empty string, reuse New_Item data + + if SR.Last = 0 then + Reference (NR); + Source.Reference := NR; + Unreference (SR); + + -- New_Item is empty string, nothing to do + + elsif NR.Last = 0 then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); + SR.Last := DL; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + procedure Append + (Source : in out Unbounded_Wide_String; + New_Item : Wide_String) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_Wide_String_Access; + + begin + -- New_Item is an empty string, nothing to do + + if New_Item'Length = 0 then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (SR.Last + 1 .. DL) := New_Item; + SR.Last := DL; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (SR.Last + 1 .. DL) := New_Item; + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + procedure Append + (Source : in out Unbounded_Wide_String; + New_Item : Wide_Character) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + 1; + DR : Shared_Wide_String_Access; + + begin + -- Try to reuse existing shared string + + if Can_Be_Reused (SR, SR.Last + 1) then + SR.Data (SR.Last + 1) := New_Item; + SR.Last := SR.Last + 1; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (DL) := New_Item; + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + ------------------- + -- Can_Be_Reused -- + ------------------- + + function Can_Be_Reused + (Item : Shared_Wide_String_Access; + Length : Natural) return Boolean + is + use Interfaces; + begin + return + Item.Counter = 1 + and then Item.Max_Length >= Length + and then Item.Max_Length <= + Aligned_Max_Length (Length + Length / Growth_Factor); + end Can_Be_Reused; + + ----------- + -- Count -- + ----------- + + function Count + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) + return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); + end Count; + + function Count + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); + end Count; + + function Count + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Count (SR.Data (1 .. SR.Last), Set); + end Count; + + ------------ + -- Delete -- + ------------ + + function Delete + (Source : Unbounded_Wide_String; + From : Positive; + Through : Natural) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Empty slice is deleted, use the same shared string + + if From > Through then + Reference (SR); + DR := SR; + + -- Index is out of range + + elsif Through > SR.Last then + raise Index_Error; + + -- Compute size of the result + + else + DL := SR.Last - (Through - From + 1); + + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); + DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Delete; + + procedure Delete + (Source : in out Unbounded_Wide_String; + From : Positive; + Through : Natural) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Nothing changed, return + + if From > Through then + null; + + -- Through is outside of the range + + elsif Through > SR.Last then + raise Index_Error; + + else + DL := SR.Last - (Through - From + 1); + + -- Result is empty, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + SR.Last := DL; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); + DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Delete; + + ------------- + -- Element -- + ------------- + + function Element + (Source : Unbounded_Wide_String; + Index : Positive) return Wide_Character + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + if Index <= SR.Last then + return SR.Data (Index); + else + raise Index_Error; + end if; + end Element; + + -------------- + -- Finalize -- + -------------- + + procedure Finalize (Object : in out Unbounded_Wide_String) is + SR : constant Shared_Wide_String_Access := Object.Reference; + + begin + if SR /= null then + + -- The same controlled object can be finalized several times for + -- some reason. As per 7.6.1(24) this should have no ill effect, + -- so we need to add a guard for the case of finalizing the same + -- object twice. + + Object.Reference := null; + Unreference (SR); + end if; + end Finalize; + + ---------------- + -- Find_Token -- + ---------------- + + procedure Find_Token + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + Wide_Search.Find_Token + (SR.Data (From .. SR.Last), Set, Test, First, Last); + end Find_Token; + + procedure Find_Token + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + Wide_Search.Find_Token + (SR.Data (1 .. SR.Last), Set, Test, First, Last); + end Find_Token; + + ---------- + -- Free -- + ---------- + + procedure Free (X : in out Wide_String_Access) is + procedure Deallocate is + new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access); + begin + Deallocate (X); + end Free; + + ---------- + -- Head -- + ---------- + + function Head + (Source : Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Result is empty, reuse shared empty string + + if Count = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Length of the string is the same as requested, reuse source shared + -- string. + + elsif Count = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Count); + + -- Length of the source string is more than requested, copy + -- corresponding slice. + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (1 .. Count); + + -- Length of the source string is less then requested, copy all + -- contents and fill others by Pad character. + + else + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + + for J in SR.Last + 1 .. Count loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + end if; + + return (AF.Controlled with Reference => DR); + end Head; + + procedure Head + (Source : in out Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Result is empty, reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- Result is same with source string, reuse source shared string + + elsif Count = SR.Last then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, Count) then + if Count > SR.Last then + for J in SR.Last + 1 .. Count loop + SR.Data (J) := Pad; + end loop; + end if; + + SR.Last := Count; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Count); + + -- Length of the source string is greater then requested, copy + -- corresponding slice. + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (1 .. Count); + + -- Length of the source string is less the requested, copy all + -- exists data and fill others by Pad character. + + else + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + + for J in SR.Last + 1 .. Count loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + Source.Reference := DR; + Unreference (SR); + end if; + end Head; + + ----------- + -- Index -- + ----------- + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Going : Strings.Direction := Strings.Forward; + Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) + return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + Test : Strings.Membership := Strings.Inside; + Going : Strings.Direction := Strings.Forward) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going); + end Index; + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) + return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership := Inside; + Going : Direction := Forward) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index + (SR.Data (1 .. SR.Last), Set, From, Test, Going); + end Index; + + --------------------- + -- Index_Non_Blank -- + --------------------- + + function Index_Non_Blank + (Source : Unbounded_Wide_String; + Going : Strings.Direction := Strings.Forward) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going); + end Index_Non_Blank; + + function Index_Non_Blank + (Source : Unbounded_Wide_String; + From : Positive; + Going : Direction := Forward) return Natural + is + SR : constant Shared_Wide_String_Access := Source.Reference; + begin + return Wide_Search.Index_Non_Blank + (SR.Data (1 .. SR.Last), From, Going); + end Index_Non_Blank; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize (Object : in out Unbounded_Wide_String) is + begin + Reference (Object.Reference); + end Initialize; + + ------------ + -- Insert -- + ------------ + + function Insert + (Source : Unbounded_Wide_String; + Before : Positive; + New_Item : Wide_String) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_Wide_String_Access; + + begin + -- Check index first + + if Before > SR.Last + 1 then + raise Index_Error; + end if; + + -- Result is empty, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Inserted string is empty, reuse source shared string + + elsif New_Item'Length = 0 then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); + DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + DR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Insert; + + procedure Insert + (Source : in out Unbounded_Wide_String; + Before : Positive; + New_Item : Wide_String) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_Wide_String_Access; + + begin + -- Check bounds + + if Before > SR.Last + 1 then + raise Index_Error; + end if; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- Inserted string is empty, nothing to do + + elsif New_Item'Length = 0 then + null; + + -- Try to reuse existent shared string first + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + SR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + SR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); + DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + DR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Insert; + + ------------ + -- Length -- + ------------ + + function Length (Source : Unbounded_Wide_String) return Natural is + begin + return Source.Reference.Last; + end Length; + + --------------- + -- Overwrite -- + --------------- + + function Overwrite + (Source : Unbounded_Wide_String; + Position : Positive; + New_Item : Wide_String) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Check bounds + + if Position > SR.Last + 1 then + raise Index_Error; + end if; + + DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Result is same with source string, reuse source shared string + + elsif New_Item'Length = 0 then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); + DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + DR.Data (Position + New_Item'Length .. DL) := + SR.Data (Position + New_Item'Length .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Overwrite; + + procedure Overwrite + (Source : in out Unbounded_Wide_String; + Position : Positive; + New_Item : Wide_String) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Bounds check + + if Position > SR.Last + 1 then + raise Index_Error; + end if; + + DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- String unchanged, nothing to do + + elsif New_Item'Length = 0 then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + SR.Last := DL; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); + DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + DR.Data (Position + New_Item'Length .. DL) := + SR.Data (Position + New_Item'Length .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Overwrite; + + --------------- + -- Reference -- + --------------- + + procedure Reference (Item : not null Shared_Wide_String_Access) is + begin + Sync_Add_And_Fetch (Item.Counter'Access, 1); + end Reference; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Source : in out Unbounded_Wide_String; + Index : Positive; + By : Wide_Character) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Bounds check. + + if Index <= SR.Last then + + -- Try to reuse existent shared string + + if Can_Be_Reused (SR, SR.Last) then + SR.Data (Index) := By; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (Index) := By; + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + + else + raise Index_Error; + end if; + end Replace_Element; + + ------------------- + -- Replace_Slice -- + ------------------- + + function Replace_Slice + (Source : Unbounded_Wide_String; + Low : Positive; + High : Natural; + By : Wide_String) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 then + raise Index_Error; + end if; + + -- Do replace operation when removed slice is not empty + + if High >= Low then + DL := By'Length + SR.Last + Low - High - 1; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); + DR.Data (Low .. Low + By'Length - 1) := By; + DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + + -- Otherwise just insert string + + else + return Insert (Source, Low, By); + end if; + end Replace_Slice; + + procedure Replace_Slice + (Source : in out Unbounded_Wide_String; + Low : Positive; + High : Natural; + By : Wide_String) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Bounds check + + if Low > SR.Last + 1 then + raise Index_Error; + end if; + + -- Do replace operation only when replaced slice is not empty + + if High >= Low then + DL := By'Length + SR.Last + Low - High - 1; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + SR.Data (Low .. Low + By'Length - 1) := By; + SR.Last := DL; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); + DR.Data (Low .. Low + By'Length - 1) := By; + DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + + -- Otherwise just insert item + + else + Insert (Source, Low, By); + end if; + end Replace_Slice; + + ------------------------------- + -- Set_Unbounded_Wide_String -- + ------------------------------- + + procedure Set_Unbounded_Wide_String + (Target : out Unbounded_Wide_String; + Source : Wide_String) + is + TR : constant Shared_Wide_String_Access := Target.Reference; + DR : Shared_Wide_String_Access; + + begin + -- In case of empty string, reuse empty shared string + + if Source'Length = 0 then + Reference (Empty_Shared_Wide_String'Access); + Target.Reference := Empty_Shared_Wide_String'Access; + + else + -- Try to reuse existent shared string + + if Can_Be_Reused (TR, Source'Length) then + Reference (TR); + DR := TR; + + -- Otherwise allocate new shared string + + else + DR := Allocate (Source'Length); + Target.Reference := DR; + end if; + + DR.Data (1 .. Source'Length) := Source; + DR.Last := Source'Length; + end if; + + Unreference (TR); + end Set_Unbounded_Wide_String; + + ----------- + -- Slice -- + ----------- + + function Slice + (Source : Unbounded_Wide_String; + Low : Positive; + High : Natural) return Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + + begin + -- Note: test of High > Length is in accordance with AI95-00128 + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + else + return SR.Data (Low .. High); + end if; + end Slice; + + ---------- + -- Tail -- + ---------- + + function Tail + (Source : Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- For empty result reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Result is hole source string, reuse source shared string + + elsif Count = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (Count); + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); + + else + for J in 1 .. Count - SR.Last loop + DR.Data (J) := Pad; + end loop; + + DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); + end if; + + DR.Last := Count; + end if; + + return (AF.Controlled with Reference => DR); + end Tail; + + procedure Tail + (Source : in out Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + procedure Common + (SR : Shared_Wide_String_Access; + DR : Shared_Wide_String_Access; + Count : Natural); + -- Common code of tail computation. SR/DR can point to the same object + + ------------ + -- Common -- + ------------ + + procedure Common + (SR : Shared_Wide_String_Access; + DR : Shared_Wide_String_Access; + Count : Natural) is + begin + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); + + else + DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); + + for J in 1 .. Count - SR.Last loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + end Common; + + begin + -- Result is empty string, reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- Length of the result is the same with length of the source string, + -- reuse source shared string. + + elsif Count = SR.Last then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, Count) then + Common (SR, SR, Count); + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (Count); + Common (SR, DR, Count); + Source.Reference := DR; + Unreference (SR); + end if; + end Tail; + + -------------------- + -- To_Wide_String -- + -------------------- + + function To_Wide_String + (Source : Unbounded_Wide_String) return Wide_String is + begin + return Source.Reference.Data (1 .. Source.Reference.Last); + end To_Wide_String; + + ------------------------------ + -- To_Unbounded_Wide_String -- + ------------------------------ + + function To_Unbounded_Wide_String + (Source : Wide_String) return Unbounded_Wide_String + is + DR : constant Shared_Wide_String_Access := Allocate (Source'Length); + begin + DR.Data (1 .. Source'Length) := Source; + DR.Last := Source'Length; + return (AF.Controlled with Reference => DR); + end To_Unbounded_Wide_String; + + function To_Unbounded_Wide_String + (Length : Natural) return Unbounded_Wide_String + is + DR : constant Shared_Wide_String_Access := Allocate (Length); + begin + DR.Last := Length; + return (AF.Controlled with Reference => DR); + end To_Unbounded_Wide_String; + + --------------- + -- Translate -- + --------------- + + function Translate + (Source : Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Nothing to translate, reuse empty shared string + + if SR.Last = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + DR.Last := SR.Last; + end if; + + return (AF.Controlled with Reference => DR); + end Translate; + + procedure Translate + (Source : in out Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Nothing to translate + + if SR.Last = 0 then + null; + + -- Try to reuse shared string + + elsif Can_Be_Reused (SR, SR.Last) then + for J in 1 .. SR.Last loop + SR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + end Translate; + + function Translate + (Source : Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) + return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Nothing to translate, reuse empty shared string + + if SR.Last = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + DR.Last := SR.Last; + end if; + + return (AF.Controlled with Reference => DR); + + exception + when others => + Unreference (DR); + + raise; + end Translate; + + procedure Translate + (Source : in out Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DR : Shared_Wide_String_Access; + + begin + -- Nothing to translate + + if SR.Last = 0 then + null; + + -- Try to reuse shared string + + elsif Can_Be_Reused (SR, SR.Last) then + for J in 1 .. SR.Last loop + SR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + + exception + when others => + if DR /= null then + Unreference (DR); + end if; + + raise; + end Translate; + + ---------- + -- Trim -- + ---------- + + function Trim + (Source : Unbounded_Wide_String; + Side : Trim_End) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index_Non_Blank (Source, Forward); + + -- All blanks, reuse empty shared string + + if Low = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + else + case Side is + when Left => + High := SR.Last; + DL := SR.Last - Low + 1; + + when Right => + Low := 1; + High := Index_Non_Blank (Source, Backward); + DL := High; + + when Both => + High := Index_Non_Blank (Source, Backward); + DL := High - Low + 1; + end case; + + -- Length of the result is the same as length of the source string, + -- reuse source shared string. + + if DL = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Trim; + + procedure Trim + (Source : in out Unbounded_Wide_String; + Side : Trim_End) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index_Non_Blank (Source, Forward); + + -- All blanks, reuse empty shared string + + if Low = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + else + case Side is + when Left => + High := SR.Last; + DL := SR.Last - Low + 1; + + when Right => + Low := 1; + High := Index_Non_Blank (Source, Backward); + DL := High; + + when Both => + High := Index_Non_Blank (Source, Backward); + DL := High - Low + 1; + end case; + + -- Length of the result is the same as length of the source string, + -- nothing to do. + + if DL = SR.Last then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (1 .. DL) := SR.Data (Low .. High); + SR.Last := DL; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Trim; + + function Trim + (Source : Unbounded_Wide_String; + Left : Wide_Maps.Wide_Character_Set; + Right : Wide_Maps.Wide_Character_Set) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index (Source, Left, Outside, Forward); + + -- Source includes only characters from Left set, reuse empty shared + -- string. + + if Low = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + else + High := Index (Source, Right, Outside, Backward); + DL := Integer'Max (0, High - Low + 1); + + -- Source includes only characters from Right set or result string + -- is empty, reuse empty shared string. + + if High = 0 or else DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Trim; + + procedure Trim + (Source : in out Unbounded_Wide_String; + Left : Wide_Maps.Wide_Character_Set; + Right : Wide_Maps.Wide_Character_Set) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index (Source, Left, Outside, Forward); + + -- Source includes only characters from Left set, reuse empty shared + -- string. + + if Low = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + else + High := Index (Source, Right, Outside, Backward); + DL := Integer'Max (0, High - Low + 1); + + -- Source includes only characters from Right set or result string + -- is empty, reuse empty shared string. + + if High = 0 or else DL = 0 then + Reference (Empty_Shared_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_String'Access; + Unreference (SR); + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (1 .. DL) := SR.Data (Low .. High); + SR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Trim; + + --------------------- + -- Unbounded_Slice -- + --------------------- + + function Unbounded_Slice + (Source : Unbounded_Wide_String; + Low : Positive; + High : Natural) return Unbounded_Wide_String + is + SR : constant Shared_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + -- Result is empty slice, reuse empty shared string + + elsif Low > High then + Reference (Empty_Shared_Wide_String'Access); + DR := Empty_Shared_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DL := High - Low + 1; + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Unbounded_Slice; + + procedure Unbounded_Slice + (Source : Unbounded_Wide_String; + Target : out Unbounded_Wide_String; + Low : Positive; + High : Natural) + is + SR : constant Shared_Wide_String_Access := Source.Reference; + TR : constant Shared_Wide_String_Access := Target.Reference; + DL : Natural; + DR : Shared_Wide_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + -- Result is empty slice, reuse empty shared string + + elsif Low > High then + Reference (Empty_Shared_Wide_String'Access); + Target.Reference := Empty_Shared_Wide_String'Access; + Unreference (TR); + + else + DL := High - Low + 1; + + -- Try to reuse existent shared string + + if Can_Be_Reused (TR, DL) then + TR.Data (1 .. DL) := SR.Data (Low .. High); + TR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Target.Reference := DR; + Unreference (TR); + end if; + end if; + end Unbounded_Slice; + + ----------------- + -- Unreference -- + ----------------- + + procedure Unreference (Item : not null Shared_Wide_String_Access) is + use Interfaces; + + procedure Free is + new Ada.Unchecked_Deallocation + (Shared_Wide_String, Shared_Wide_String_Access); + + Aux : Shared_Wide_String_Access := Item; + + begin + if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then + + -- Reference counter of Empty_Shared_Wide_String must never reach + -- zero. + + pragma Assert (Aux /= Empty_Shared_Wide_String'Access); + + Free (Aux); + end if; + end Unreference; + + end Ada.Strings.Wide_Unbounded; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwiun-shared.ads gcc-4.6.0/gcc/ada/a-stwiun-shared.ads *** gcc-4.5.2/gcc/ada/a-stwiun-shared.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stwiun-shared.ads Mon Dec 20 17:32:06 2010 *************** *** 0 **** --- 1,492 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . W I D E _ U N B O U N D E D -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This version is supported on: + -- - all Alpha platforms + -- - all ia64 platforms + -- - all PowerPC platforms + -- - all SPARC V9 platforms + -- - all x86_64 platforms + + with Ada.Strings.Wide_Maps; + private with Ada.Finalization; + private with Interfaces; + + package Ada.Strings.Wide_Unbounded is + pragma Preelaborate; + + type Unbounded_Wide_String is private; + pragma Preelaborable_Initialization (Unbounded_Wide_String); + + Null_Unbounded_Wide_String : constant Unbounded_Wide_String; + + function Length (Source : Unbounded_Wide_String) return Natural; + + type Wide_String_Access is access all Wide_String; + + procedure Free (X : in out Wide_String_Access); + + -------------------------------------------------------- + -- Conversion, Concatenation, and Selection Functions -- + -------------------------------------------------------- + + function To_Unbounded_Wide_String + (Source : Wide_String) return Unbounded_Wide_String; + + function To_Unbounded_Wide_String + (Length : Natural) return Unbounded_Wide_String; + + function To_Wide_String + (Source : Unbounded_Wide_String) return Wide_String; + + procedure Set_Unbounded_Wide_String + (Target : out Unbounded_Wide_String; + Source : Wide_String); + pragma Ada_05 (Set_Unbounded_Wide_String); + + procedure Append + (Source : in out Unbounded_Wide_String; + New_Item : Unbounded_Wide_String); + + procedure Append + (Source : in out Unbounded_Wide_String; + New_Item : Wide_String); + + procedure Append + (Source : in out Unbounded_Wide_String; + New_Item : Wide_Character); + + function "&" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Unbounded_Wide_String; + + function "&" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Unbounded_Wide_String; + + function "&" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Unbounded_Wide_String; + + function "&" + (Left : Unbounded_Wide_String; + Right : Wide_Character) return Unbounded_Wide_String; + + function "&" + (Left : Wide_Character; + Right : Unbounded_Wide_String) return Unbounded_Wide_String; + + function Element + (Source : Unbounded_Wide_String; + Index : Positive) return Wide_Character; + + procedure Replace_Element + (Source : in out Unbounded_Wide_String; + Index : Positive; + By : Wide_Character); + + function Slice + (Source : Unbounded_Wide_String; + Low : Positive; + High : Natural) return Wide_String; + + function Unbounded_Slice + (Source : Unbounded_Wide_String; + Low : Positive; + High : Natural) return Unbounded_Wide_String; + pragma Ada_05 (Unbounded_Slice); + + procedure Unbounded_Slice + (Source : Unbounded_Wide_String; + Target : out Unbounded_Wide_String; + Low : Positive; + High : Natural); + pragma Ada_05 (Unbounded_Slice); + + function "=" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function "=" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean; + + function "=" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function "<" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function "<" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean; + + function "<" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function "<=" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function "<=" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean; + + function "<=" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function ">" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function ">" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean; + + function ">" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function ">=" + (Left : Unbounded_Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + function ">=" + (Left : Unbounded_Wide_String; + Right : Wide_String) return Boolean; + + function ">=" + (Left : Wide_String; + Right : Unbounded_Wide_String) return Boolean; + + ------------------------ + -- Search Subprograms -- + ------------------------ + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) + return Natural; + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural; + + function Index + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + Test : Membership := Inside; + Going : Direction := Forward) return Natural; + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) + return Natural; + pragma Ada_05 (Index); + + function Index + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural; + pragma Ada_05 (Index); + + function Index + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership := Inside; + Going : Direction := Forward) return Natural; + pragma Ada_05 (Index); + + function Index_Non_Blank + (Source : Unbounded_Wide_String; + Going : Direction := Forward) return Natural; + + function Index_Non_Blank + (Source : Unbounded_Wide_String; + From : Positive; + Going : Direction := Forward) return Natural; + pragma Ada_05 (Index_Non_Blank); + + function Count + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) + return Natural; + + function Count + (Source : Unbounded_Wide_String; + Pattern : Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural; + + function Count + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set) return Natural; + + procedure Find_Token + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; + Test : Membership; + First : out Positive; + Last : out Natural); + + ------------------------------------ + -- String Translation Subprograms -- + ------------------------------------ + + function Translate + (Source : Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping) + return Unbounded_Wide_String; + + procedure Translate + (Source : in out Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping); + + function Translate + (Source : Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping_Function) + return Unbounded_Wide_String; + + procedure Translate + (Source : in out Unbounded_Wide_String; + Mapping : Wide_Maps.Wide_Character_Mapping_Function); + + --------------------------------------- + -- String Transformation Subprograms -- + --------------------------------------- + + function Replace_Slice + (Source : Unbounded_Wide_String; + Low : Positive; + High : Natural; + By : Wide_String) return Unbounded_Wide_String; + + procedure Replace_Slice + (Source : in out Unbounded_Wide_String; + Low : Positive; + High : Natural; + By : Wide_String); + + function Insert + (Source : Unbounded_Wide_String; + Before : Positive; + New_Item : Wide_String) return Unbounded_Wide_String; + + procedure Insert + (Source : in out Unbounded_Wide_String; + Before : Positive; + New_Item : Wide_String); + + function Overwrite + (Source : Unbounded_Wide_String; + Position : Positive; + New_Item : Wide_String) return Unbounded_Wide_String; + + procedure Overwrite + (Source : in out Unbounded_Wide_String; + Position : Positive; + New_Item : Wide_String); + + function Delete + (Source : Unbounded_Wide_String; + From : Positive; + Through : Natural) return Unbounded_Wide_String; + + procedure Delete + (Source : in out Unbounded_Wide_String; + From : Positive; + Through : Natural); + + function Trim + (Source : Unbounded_Wide_String; + Side : Trim_End) return Unbounded_Wide_String; + + procedure Trim + (Source : in out Unbounded_Wide_String; + Side : Trim_End); + + function Trim + (Source : Unbounded_Wide_String; + Left : Wide_Maps.Wide_Character_Set; + Right : Wide_Maps.Wide_Character_Set) return Unbounded_Wide_String; + + procedure Trim + (Source : in out Unbounded_Wide_String; + Left : Wide_Maps.Wide_Character_Set; + Right : Wide_Maps.Wide_Character_Set); + + function Head + (Source : Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String; + + procedure Head + (Source : in out Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space); + + function Tail + (Source : Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String; + + procedure Tail + (Source : in out Unbounded_Wide_String; + Count : Natural; + Pad : Wide_Character := Wide_Space); + + function "*" + (Left : Natural; + Right : Wide_Character) return Unbounded_Wide_String; + + function "*" + (Left : Natural; + Right : Wide_String) return Unbounded_Wide_String; + + function "*" + (Left : Natural; + Right : Unbounded_Wide_String) return Unbounded_Wide_String; + + private + pragma Inline (Length); + + package AF renames Ada.Finalization; + + type Shared_Wide_String (Max_Length : Natural) is limited record + Counter : aliased Interfaces.Unsigned_32 := 1; + -- Reference counter. + + Last : Natural := 0; + Data : Wide_String (1 .. Max_Length); + -- Last is the index of last significant element of the Data. All + -- elements with larger indices are just an extra room. + end record; + + type Shared_Wide_String_Access is access all Shared_Wide_String; + + procedure Reference (Item : not null Shared_Wide_String_Access); + -- Increment reference counter. + + procedure Unreference (Item : not null Shared_Wide_String_Access); + -- Decrement reference counter. Deallocate Item when reference counter is + -- zero. + + function Can_Be_Reused + (Item : Shared_Wide_String_Access; + Length : Natural) return Boolean; + -- Returns True if Shared_Wide_String can be reused. There are two criteria + -- when Shared_Wide_String can be reused: its reference counter must be one + -- (thus Shared_Wide_String is owned exclusively) and its size is + -- sufficient to store string with specified length effectively. + + function Allocate (Max_Length : Natural) return Shared_Wide_String_Access; + -- Allocates new Shared_Wide_String with at least specified maximum length. + -- Actual maximum length of the allocated Shared_Wide_String can be + -- slightly greater. Returns reference to Empty_Shared_Wide_String when + -- requested length is zero. + + Empty_Shared_Wide_String : aliased Shared_Wide_String (0); + + function To_Unbounded (S : Wide_String) return Unbounded_Wide_String + renames To_Unbounded_Wide_String; + -- This renames are here only to be used in the pragma Stream_Convert. + + type Unbounded_Wide_String is new AF.Controlled with record + Reference : Shared_Wide_String_Access := Empty_Shared_Wide_String'Access; + end record; + + -- The Unbounded_Wide_String uses several techniques to increase speed of + -- the application: + -- - implicit sharing or copy-on-write. Unbounded_Wide_String contains + -- only the reference to the data which is shared between several + -- instances. The shared data is reallocated only when its value is + -- changed and the object mutation can't be used or it is inefficient to + -- use it; + -- - object mutation. Shared data object can be reused without memory + -- reallocation when all of the following requirements are meat: + -- - shared data object don't used anywhere longer; + -- - its size is sufficient to store new value; + -- - the gap after reuse is less then some threshold. + -- - memory preallocation. Most of used memory allocation algorithms + -- aligns allocated segment on the some boundary, thus some amount of + -- additional memory can be preallocated without any impact. Such + -- preallocated memory can used later by Append/Insert operations + -- without reallocation. + -- + -- Reference counting uses GCC builtin atomic operations, which allows to + -- safely share internal data between Ada tasks. Nevertheless, this not + -- make objects of Unbounded_Wide_String thread-safe, so each instance + -- can't be accessed by several tasks simultaneously. + + pragma Stream_Convert (Unbounded_Wide_String, To_Unbounded, To_Wide_String); + -- Provide stream routines without dragging in Ada.Streams + + pragma Finalize_Storage_Only (Unbounded_Wide_String); + -- Finalization is required only for freeing storage + + overriding procedure Initialize (Object : in out Unbounded_Wide_String); + overriding procedure Adjust (Object : in out Unbounded_Wide_String); + overriding procedure Finalize (Object : in out Unbounded_Wide_String); + + Null_Unbounded_Wide_String : constant Unbounded_Wide_String := + (AF.Controlled with + Reference => Empty_Shared_Wide_String'Access); + + end Ada.Strings.Wide_Unbounded; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwiun.adb gcc-4.6.0/gcc/ada/a-stwiun.adb *** gcc-4.5.2/gcc/ada/a-stwiun.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwiun.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Wide_Unbounded *** 514,519 **** --- 514,532 ---- procedure Find_Token (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + begin + Wide_Search.Find_Token + (Source.Reference (From .. Source.Last), Set, Test, First, Last); + end Find_Token; + + procedure Find_Token + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stwiun.ads gcc-4.6.0/gcc/ada/a-stwiun.ads *** gcc-4.5.2/gcc/ada/a-stwiun.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stwiun.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Strings.Wide_Unbounded is *** 264,269 **** --- 264,278 ---- procedure Find_Token (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Unbounded_Wide_String; + Set : Wide_Maps.Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzbou.ads gcc-4.6.0/gcc/ada/a-stzbou.ads *** gcc-4.5.2/gcc/ada/a-stzbou.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzbou.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Strings.Wide_Wide_Bounded is *** 302,307 **** --- 302,316 ---- procedure Find_Token (Source : Bounded_Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Bounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); *************** package Ada.Strings.Wide_Wide_Bounded is *** 769,774 **** --- 778,792 ---- procedure Find_Token (Source : Bounded_Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + renames Super_Find_Token; + + procedure Find_Token + (Source : Bounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzfix.adb gcc-4.6.0/gcc/ada/a-stzfix.adb *** gcc-4.5.2/gcc/ada/a-stzfix.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzfix.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Wide_Wide_Fixed *** 123,128 **** --- 123,137 ---- procedure Find_Token (Source : Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + renames Ada.Strings.Wide_Wide_Search.Find_Token; + + procedure Find_Token + (Source : Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzfix.ads gcc-4.6.0/gcc/ada/a-stzfix.ads *** gcc-4.5.2/gcc/ada/a-stzfix.ads Wed Jun 6 10:20:30 2007 --- gcc-4.6.0/gcc/ada/a-stzfix.ads Fri Oct 8 13:02:55 2010 *************** package Ada.Strings.Wide_Wide_Fixed is *** 110,115 **** --- 110,124 ---- procedure Find_Token (Source : Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzsea.adb gcc-4.6.0/gcc/ada/a-stzsea.adb *** gcc-4.5.2/gcc/ada/a-stzsea.adb Tue Jul 7 13:38:45 2009 --- gcc-4.6.0/gcc/ada/a-stzsea.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Wide_Wide_Searc *** 194,199 **** --- 194,233 ---- procedure Find_Token (Source : Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural) + is + begin + for J in From .. Source'Last loop + if Belongs (Source (J), Set, Test) then + First := J; + + for K in J + 1 .. Source'Last loop + if not Belongs (Source (K), Set, Test) then + Last := K - 1; + return; + end if; + end loop; + + -- Here if J indexes first char of token, and all chars after J + -- are in the token. + + Last := Source'Last; + return; + end if; + end loop; + + -- Here if no token found + + First := From; + Last := 0; + end Find_Token; + + procedure Find_Token + (Source : Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzsea.ads gcc-4.6.0/gcc/ada/a-stzsea.ads *** gcc-4.5.2/gcc/ada/a-stzsea.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzsea.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** private package Ada.Strings.Wide_Wide_Se *** 115,120 **** --- 115,128 ---- procedure Find_Token (Source : Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + + procedure Find_Token + (Source : Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzsup.adb gcc-4.6.0/gcc/ada/a-stzsup.adb *** gcc-4.5.2/gcc/ada/a-stzsup.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzsup.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package body Ada.Strings.Wide_Wide_Super *** 799,804 **** --- 799,817 ---- procedure Super_Find_Token (Source : Super_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + begin + Wide_Wide_Search.Find_Token + (Source.Data (From .. Source.Current_Length), Set, Test, First, Last); + end Super_Find_Token; + + procedure Super_Find_Token + (Source : Super_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzsup.ads gcc-4.6.0/gcc/ada/a-stzsup.ads *** gcc-4.5.2/gcc/ada/a-stzsup.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzsup.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package Ada.Strings.Wide_Wide_Superbound *** 307,312 **** --- 307,320 ---- procedure Super_Find_Token (Source : Super_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + + procedure Super_Find_Token + (Source : Super_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzunb-shared.adb gcc-4.6.0/gcc/ada/a-stzunb-shared.adb *** gcc-4.5.2/gcc/ada/a-stzunb-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stzunb-shared.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,2132 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Strings.Wide_Wide_Search; + with Ada.Unchecked_Deallocation; + + package body Ada.Strings.Wide_Wide_Unbounded is + + use Ada.Strings.Wide_Wide_Maps; + + Growth_Factor : constant := 32; + -- The growth factor controls how much extra space is allocated when + -- we have to increase the size of an allocated unbounded string. By + -- allocating extra space, we avoid the need to reallocate on every + -- append, particularly important when a string is built up by repeated + -- append operations of small pieces. This is expressed as a factor so + -- 32 means add 1/32 of the length of the string as growth space. + + Min_Mul_Alloc : constant := Standard'Maximum_Alignment; + -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes + -- no memory loss as most (all?) malloc implementations are obliged to + -- align the returned memory on the maximum alignment as malloc does not + -- know the target alignment. + + procedure Sync_Add_And_Fetch + (Ptr : access Interfaces.Unsigned_32; + Value : Interfaces.Unsigned_32); + pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4"); + + function Sync_Sub_And_Fetch + (Ptr : access Interfaces.Unsigned_32; + Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; + pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4"); + + function Aligned_Max_Length (Max_Length : Natural) return Natural; + -- Returns recommended length of the shared string which is greater or + -- equal to specified length. Calculation take in sense alignment of + -- the allocated memory segments to use memory effectively by + -- Append/Insert/etc operations. + + --------- + -- "&" -- + --------- + + function "&" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + DL : constant Natural := LR.Last + RR.Last; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Left string is empty, return Right string. + + elsif LR.Last = 0 then + Reference (RR); + DR := RR; + + -- Right string is empty, return Left string. + + elsif RR.Last = 0 then + Reference (LR); + DR := LR; + + -- Otherwise, allocate new shared string and fill data. + + else + DR := Allocate (LR.Last + RR.Last); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Unbounded_Wide_Wide_String + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + DL : constant Natural := LR.Last + Right'Length; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Right is an empty string, return Left string. + + elsif Right'Length = 0 then + Reference (LR); + DR := LR; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (LR.Last + 1 .. DL) := Right; + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + DL : constant Natural := Left'Length + RR.Last; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared one. + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Left is empty string, return Right string. + + elsif Left'Length = 0 then + Reference (RR); + DR := RR; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + DR.Data (1 .. Left'Length) := Left; + DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + DL : constant Natural := LR.Last + 1; + DR : Shared_Wide_Wide_String_Access; + + begin + DR := Allocate (DL); + DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); + DR.Data (DL) := Right; + DR.Last := DL; + + return (AF.Controlled with Reference => DR); + end "&"; + + function "&" + (Left : Wide_Wide_Character; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + DL : constant Natural := 1 + RR.Last; + DR : Shared_Wide_Wide_String_Access; + + begin + DR := Allocate (DL); + DR.Data (1) := Left; + DR.Data (2 .. DL) := RR.Data (1 .. RR.Last); + DR.Last := DL; + + return (AF.Controlled with Reference => DR); + end "&"; + + --------- + -- "*" -- + --------- + + function "*" + (Left : Natural; + Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String + is + DR : Shared_Wide_Wide_String_Access; + + begin + -- Result is an empty string, reuse shared empty string. + + if Left = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (Left); + + for J in 1 .. Left loop + DR.Data (J) := Right; + end loop; + + DR.Last := Left; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + function "*" + (Left : Natural; + Right : Wide_Wide_String) return Unbounded_Wide_Wide_String + is + DL : constant Natural := Left * Right'Length; + DR : Shared_Wide_Wide_String_Access; + K : Positive; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + K := 1; + + for J in 1 .. Left loop + DR.Data (K .. K + Right'Length - 1) := Right; + K := K + Right'Length; + end loop; + + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + function "*" + (Left : Natural; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + DL : constant Natural := Left * RR.Last; + DR : Shared_Wide_Wide_String_Access; + K : Positive; + + begin + -- Result is an empty string, reuse shared empty string. + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Coefficient is one, just return string itself. + + elsif Left = 1 then + Reference (RR); + DR := RR; + + -- Otherwise, allocate new shared string and fill it. + + else + DR := Allocate (DL); + K := 1; + + for J in 1 .. Left loop + DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last); + K := K + RR.Last; + end loop; + + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end "*"; + + --------- + -- "<" -- + --------- + + function "<" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last); + end "<"; + + function "<" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) < Right; + end "<"; + + function "<" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return Left < RR.Data (1 .. RR.Last); + end "<"; + + ---------- + -- "<=" -- + ---------- + + function "<=" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + + begin + -- LR = RR means two strings shares shared string, thus they are equal + + return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last); + end "<="; + + function "<=" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) <= Right; + end "<="; + + function "<=" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return Left <= RR.Data (1 .. RR.Last); + end "<="; + + --------- + -- "=" -- + --------- + + function "=" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + + begin + return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last); + -- LR = RR means two strings shares shared string, thus they are equal. + end "="; + + function "=" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) = Right; + end "="; + + function "=" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return Left = RR.Data (1 .. RR.Last); + end "="; + + --------- + -- ">" -- + --------- + + function ">" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last); + end ">"; + + function ">" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) > Right; + end ">"; + + function ">" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return Left > RR.Data (1 .. RR.Last); + end ">"; + + ---------- + -- ">=" -- + ---------- + + function ">=" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + + begin + -- LR = RR means two strings shares shared string, thus they are equal + + return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last); + end ">="; + + function ">=" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean + is + LR : constant Shared_Wide_Wide_String_Access := Left.Reference; + begin + return LR.Data (1 .. LR.Last) >= Right; + end ">="; + + function ">=" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean + is + RR : constant Shared_Wide_Wide_String_Access := Right.Reference; + begin + return Left >= RR.Data (1 .. RR.Last); + end ">="; + + ------------ + -- Adjust -- + ------------ + + procedure Adjust (Object : in out Unbounded_Wide_Wide_String) is + begin + Reference (Object.Reference); + end Adjust; + + ------------------------ + -- Aligned_Max_Length -- + ------------------------ + + function Aligned_Max_Length (Max_Length : Natural) return Natural is + Static_Size : constant Natural := + Empty_Shared_Wide_Wide_String'Size + / Standard'Storage_Unit; + -- Total size of all static components + + Element_Size : constant Natural := + Wide_Wide_Character'Size / Standard'Storage_Unit; + + begin + return + (((Static_Size + Max_Length * Element_Size - 1) / Min_Mul_Alloc + 2) + * Min_Mul_Alloc - Static_Size) / Element_Size; + end Aligned_Max_Length; + + -------------- + -- Allocate -- + -------------- + + function Allocate + (Max_Length : Natural) return Shared_Wide_Wide_String_Access is + begin + -- Empty string requested, return shared empty string + + if Max_Length = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + return Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate requested space (and probably some more room) + + else + return new Shared_Wide_Wide_String (Aligned_Max_Length (Max_Length)); + end if; + end Allocate; + + ------------ + -- Append -- + ------------ + + procedure Append + (Source : in out Unbounded_Wide_Wide_String; + New_Item : Unbounded_Wide_Wide_String) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + NR : constant Shared_Wide_Wide_String_Access := New_Item.Reference; + DL : constant Natural := SR.Last + NR.Last; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Source is an empty string, reuse New_Item data + + if SR.Last = 0 then + Reference (NR); + Source.Reference := NR; + Unreference (SR); + + -- New_Item is empty string, nothing to do + + elsif NR.Last = 0 then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); + SR.Last := DL; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + procedure Append + (Source : in out Unbounded_Wide_Wide_String; + New_Item : Wide_Wide_String) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_Wide_Wide_String_Access; + + begin + -- New_Item is an empty string, nothing to do + + if New_Item'Length = 0 then + null; + + -- Try to reuse existing shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (SR.Last + 1 .. DL) := New_Item; + SR.Last := DL; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (SR.Last + 1 .. DL) := New_Item; + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + procedure Append + (Source : in out Unbounded_Wide_Wide_String; + New_Item : Wide_Wide_Character) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + 1; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Try to reuse existing shared string + + if Can_Be_Reused (SR, SR.Last + 1) then + SR.Data (SR.Last + 1) := New_Item; + SR.Last := SR.Last + 1; + + -- Otherwise, allocate new one and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (DL) := New_Item; + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Append; + + ------------------- + -- Can_Be_Reused -- + ------------------- + + function Can_Be_Reused + (Item : Shared_Wide_Wide_String_Access; + Length : Natural) return Boolean + is + use Interfaces; + begin + return + Item.Counter = 1 + and then Item.Max_Length >= Length + and then Item.Max_Length <= + Aligned_Max_Length (Length + Length / Growth_Factor); + end Can_Be_Reused; + + ----------- + -- Count -- + ----------- + + function Count + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping := + Wide_Wide_Maps.Identity) + return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); + end Count; + + function Count + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); + end Count; + + function Count + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Count (SR.Data (1 .. SR.Last), Set); + end Count; + + ------------ + -- Delete -- + ------------ + + function Delete + (Source : Unbounded_Wide_Wide_String; + From : Positive; + Through : Natural) return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Empty slice is deleted, use the same shared string + + if From > Through then + Reference (SR); + DR := SR; + + -- Index is out of range + + elsif Through > SR.Last then + raise Index_Error; + + -- Compute size of the result + + else + DL := SR.Last - (Through - From + 1); + + -- Result is an empty string, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); + DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Delete; + + procedure Delete + (Source : in out Unbounded_Wide_Wide_String; + From : Positive; + Through : Natural) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Nothing changed, return + + if From > Through then + null; + + -- Through is outside of the range + + elsif Through > SR.Last then + raise Index_Error; + + else + DL := SR.Last - (Through - From + 1); + + -- Result is empty, reuse shared empty string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + SR.Last := DL; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); + DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Delete; + + ------------- + -- Element -- + ------------- + + function Element + (Source : Unbounded_Wide_Wide_String; + Index : Positive) return Wide_Wide_Character + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + if Index <= SR.Last then + return SR.Data (Index); + else + raise Index_Error; + end if; + end Element; + + -------------- + -- Finalize -- + -------------- + + procedure Finalize (Object : in out Unbounded_Wide_Wide_String) is + SR : constant Shared_Wide_Wide_String_Access := Object.Reference; + + begin + if SR /= null then + + -- The same controlled object can be finalized several times for + -- some reason. As per 7.6.1(24) this should have no ill effect, + -- so we need to add a guard for the case of finalizing the same + -- object twice. + + Object.Reference := null; + Unreference (SR); + end if; + end Finalize; + + ---------------- + -- Find_Token -- + ---------------- + + procedure Find_Token + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + Wide_Wide_Search.Find_Token + (SR.Data (From .. SR.Last), Set, Test, First, Last); + end Find_Token; + + procedure Find_Token + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + Wide_Wide_Search.Find_Token + (SR.Data (1 .. SR.Last), Set, Test, First, Last); + end Find_Token; + + ---------- + -- Free -- + ---------- + + procedure Free (X : in out Wide_Wide_String_Access) is + procedure Deallocate is + new Ada.Unchecked_Deallocation + (Wide_Wide_String, Wide_Wide_String_Access); + begin + Deallocate (X); + end Free; + + ---------- + -- Head -- + ---------- + + function Head + (Source : Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space) + return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Result is empty, reuse shared empty string + + if Count = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Length of the string is the same as requested, reuse source shared + -- string. + + elsif Count = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Count); + + -- Length of the source string is more than requested, copy + -- corresponding slice. + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (1 .. Count); + + -- Length of the source string is less then requested, copy all + -- contents and fill others by Pad character. + + else + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + + for J in SR.Last + 1 .. Count loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + end if; + + return (AF.Controlled with Reference => DR); + end Head; + + procedure Head + (Source : in out Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Result is empty, reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- Result is same with source string, reuse source shared string + + elsif Count = SR.Last then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, Count) then + if Count > SR.Last then + for J in SR.Last + 1 .. Count loop + SR.Data (J) := Pad; + end loop; + end if; + + SR.Last := Count; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (Count); + + -- Length of the source string is greater then requested, copy + -- corresponding slice. + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (1 .. Count); + + -- Length of the source string is less the requested, copy all + -- exists data and fill others by Pad character. + + else + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + + for J in SR.Last + 1 .. Count loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + Source.Reference := DR; + Unreference (SR); + end if; + end Head; + + ----------- + -- Index -- + ----------- + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Going : Strings.Direction := Strings.Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping := + Wide_Wide_Maps.Identity) + return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + Test : Strings.Membership := Strings.Inside; + Going : Strings.Direction := Strings.Forward) return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going); + end Index; + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping := + Wide_Wide_Maps.Identity) + return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index + (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); + end Index; + + function Index + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership := Inside; + Going : Direction := Forward) return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index + (SR.Data (1 .. SR.Last), Set, From, Test, Going); + end Index; + + --------------------- + -- Index_Non_Blank -- + --------------------- + + function Index_Non_Blank + (Source : Unbounded_Wide_Wide_String; + Going : Strings.Direction := Strings.Forward) return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going); + end Index_Non_Blank; + + function Index_Non_Blank + (Source : Unbounded_Wide_Wide_String; + From : Positive; + Going : Direction := Forward) return Natural + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + begin + return Wide_Wide_Search.Index_Non_Blank + (SR.Data (1 .. SR.Last), From, Going); + end Index_Non_Blank; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize (Object : in out Unbounded_Wide_Wide_String) is + begin + Reference (Object.Reference); + end Initialize; + + ------------ + -- Insert -- + ------------ + + function Insert + (Source : Unbounded_Wide_Wide_String; + Before : Positive; + New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Check index first + + if Before > SR.Last + 1 then + raise Index_Error; + end if; + + -- Result is empty, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Inserted string is empty, reuse source shared string + + elsif New_Item'Length = 0 then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); + DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + DR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Insert; + + procedure Insert + (Source : in out Unbounded_Wide_Wide_String; + Before : Positive; + New_Item : Wide_Wide_String) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : constant Natural := SR.Last + New_Item'Length; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Check bounds + + if Before > SR.Last + 1 then + raise Index_Error; + end if; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- Inserted string is empty, nothing to do + + elsif New_Item'Length = 0 then + null; + + -- Try to reuse existent shared string first + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + SR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + SR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL + DL / Growth_Factor); + DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); + DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; + DR.Data (Before + New_Item'Length .. DL) := + SR.Data (Before .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Insert; + + ------------ + -- Length -- + ------------ + + function Length (Source : Unbounded_Wide_Wide_String) return Natural is + begin + return Source.Reference.Last; + end Length; + + --------------- + -- Overwrite -- + --------------- + + function Overwrite + (Source : Unbounded_Wide_Wide_String; + Position : Positive; + New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Check bounds + + if Position > SR.Last + 1 then + raise Index_Error; + end if; + + DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Result is same with source string, reuse source shared string + + elsif New_Item'Length = 0 then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); + DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + DR.Data (Position + New_Item'Length .. DL) := + SR.Data (Position + New_Item'Length .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Overwrite; + + procedure Overwrite + (Source : in out Unbounded_Wide_Wide_String; + Position : Positive; + New_Item : Wide_Wide_String) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Bounds check + + if Position > SR.Last + 1 then + raise Index_Error; + end if; + + DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- String unchanged, nothing to do + + elsif New_Item'Length = 0 then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + SR.Last := DL; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); + DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; + DR.Data (Position + New_Item'Length .. DL) := + SR.Data (Position + New_Item'Length .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end Overwrite; + + --------------- + -- Reference -- + --------------- + + procedure Reference (Item : not null Shared_Wide_Wide_String_Access) is + begin + Sync_Add_And_Fetch (Item.Counter'Access, 1); + end Reference; + + --------------------- + -- Replace_Element -- + --------------------- + + procedure Replace_Element + (Source : in out Unbounded_Wide_Wide_String; + Index : Positive; + By : Wide_Wide_Character) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Bounds check. + + if Index <= SR.Last then + + -- Try to reuse existent shared string + + if Can_Be_Reused (SR, SR.Last) then + SR.Data (Index) := By; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); + DR.Data (Index) := By; + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + + else + raise Index_Error; + end if; + end Replace_Element; + + ------------------- + -- Replace_Slice -- + ------------------- + + function Replace_Slice + (Source : Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural; + By : Wide_Wide_String) return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 then + raise Index_Error; + end if; + + -- Do replace operation when removed slice is not empty + + if High >= Low then + DL := By'Length + SR.Last + Low - High - 1; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); + DR.Data (Low .. Low + By'Length - 1) := By; + DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + + -- Otherwise just insert string + + else + return Insert (Source, Low, By); + end if; + end Replace_Slice; + + procedure Replace_Slice + (Source : in out Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural; + By : Wide_Wide_String) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Bounds check + + if Low > SR.Last + 1 then + raise Index_Error; + end if; + + -- Do replace operation only when replaced slice is not empty + + if High >= Low then + DL := By'Length + SR.Last + Low - High - 1; + + -- Result is empty string, reuse empty shared string + + if DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + SR.Data (Low .. Low + By'Length - 1) := By; + SR.Last := DL; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); + DR.Data (Low .. Low + By'Length - 1) := By; + DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + + -- Otherwise just insert item + + else + Insert (Source, Low, By); + end if; + end Replace_Slice; + + ------------------------------- + -- Set_Unbounded_Wide_Wide_String -- + ------------------------------- + + procedure Set_Unbounded_Wide_Wide_String + (Target : out Unbounded_Wide_Wide_String; + Source : Wide_Wide_String) + is + TR : constant Shared_Wide_Wide_String_Access := Target.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- In case of empty string, reuse empty shared string + + if Source'Length = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Target.Reference := Empty_Shared_Wide_Wide_String'Access; + + else + -- Try to reuse existent shared string + + if Can_Be_Reused (TR, Source'Length) then + Reference (TR); + DR := TR; + + -- Otherwise allocate new shared string + + else + DR := Allocate (Source'Length); + Target.Reference := DR; + end if; + + DR.Data (1 .. Source'Length) := Source; + DR.Last := Source'Length; + end if; + + Unreference (TR); + end Set_Unbounded_Wide_Wide_String; + + ----------- + -- Slice -- + ----------- + + function Slice + (Source : Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural) return Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + + begin + -- Note: test of High > Length is in accordance with AI95-00128 + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + else + return SR.Data (Low .. High); + end if; + end Slice; + + ---------- + -- Tail -- + ---------- + + function Tail + (Source : Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space) + return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- For empty result reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Result is hole source string, reuse source shared string + + elsif Count = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (Count); + + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); + + else + for J in 1 .. Count - SR.Last loop + DR.Data (J) := Pad; + end loop; + + DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); + end if; + + DR.Last := Count; + end if; + + return (AF.Controlled with Reference => DR); + end Tail; + + procedure Tail + (Source : in out Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + procedure Common + (SR : Shared_Wide_Wide_String_Access; + DR : Shared_Wide_Wide_String_Access; + Count : Natural); + -- Common code of tail computation. SR/DR can point to the same object + + ------------ + -- Common -- + ------------ + + procedure Common + (SR : Shared_Wide_Wide_String_Access; + DR : Shared_Wide_Wide_String_Access; + Count : Natural) is + begin + if Count < SR.Last then + DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); + + else + DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); + + for J in 1 .. Count - SR.Last loop + DR.Data (J) := Pad; + end loop; + end if; + + DR.Last := Count; + end Common; + + begin + -- Result is empty string, reuse empty shared string + + if Count = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- Length of the result is the same with length of the source string, + -- reuse source shared string. + + elsif Count = SR.Last then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, Count) then + Common (SR, SR, Count); + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (Count); + Common (SR, DR, Count); + Source.Reference := DR; + Unreference (SR); + end if; + end Tail; + + -------------------- + -- To_Wide_Wide_String -- + -------------------- + + function To_Wide_Wide_String + (Source : Unbounded_Wide_Wide_String) return Wide_Wide_String is + begin + return Source.Reference.Data (1 .. Source.Reference.Last); + end To_Wide_Wide_String; + + ------------------------------ + -- To_Unbounded_Wide_Wide_String -- + ------------------------------ + + function To_Unbounded_Wide_Wide_String + (Source : Wide_Wide_String) return Unbounded_Wide_Wide_String + is + DR : constant Shared_Wide_Wide_String_Access := Allocate (Source'Length); + begin + DR.Data (1 .. Source'Length) := Source; + DR.Last := Source'Length; + return (AF.Controlled with Reference => DR); + end To_Unbounded_Wide_Wide_String; + + function To_Unbounded_Wide_Wide_String + (Length : Natural) return Unbounded_Wide_Wide_String + is + DR : constant Shared_Wide_Wide_String_Access := Allocate (Length); + begin + DR.Last := Length; + return (AF.Controlled with Reference => DR); + end To_Unbounded_Wide_Wide_String; + + --------------- + -- Translate -- + --------------- + + function Translate + (Source : Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping) + return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Nothing to translate, reuse empty shared string + + if SR.Last = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + DR.Last := SR.Last; + end if; + + return (AF.Controlled with Reference => DR); + end Translate; + + procedure Translate + (Source : in out Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Nothing to translate + + if SR.Last = 0 then + null; + + -- Try to reuse shared string + + elsif Can_Be_Reused (SR, SR.Last) then + for J in 1 .. SR.Last loop + SR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Value (Mapping, SR.Data (J)); + end loop; + + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + end Translate; + + function Translate + (Source : Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Nothing to translate, reuse empty shared string + + if SR.Last = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + DR.Last := SR.Last; + end if; + + return (AF.Controlled with Reference => DR); + + exception + when others => + Unreference (DR); + + raise; + end Translate; + + procedure Translate + (Source : in out Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Nothing to translate + + if SR.Last = 0 then + null; + + -- Try to reuse shared string + + elsif Can_Be_Reused (SR, SR.Last) then + for J in 1 .. SR.Last loop + SR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + -- Otherwise allocate new shared string and fill it + + else + DR := Allocate (SR.Last); + + for J in 1 .. SR.Last loop + DR.Data (J) := Mapping.all (SR.Data (J)); + end loop; + + DR.Last := SR.Last; + Source.Reference := DR; + Unreference (SR); + end if; + + exception + when others => + if DR /= null then + Unreference (DR); + end if; + + raise; + end Translate; + + ---------- + -- Trim -- + ---------- + + function Trim + (Source : Unbounded_Wide_Wide_String; + Side : Trim_End) return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index_Non_Blank (Source, Forward); + + -- All blanks, reuse empty shared string + + if Low = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + else + case Side is + when Left => + High := SR.Last; + DL := SR.Last - Low + 1; + + when Right => + Low := 1; + High := Index_Non_Blank (Source, Backward); + DL := High; + + when Both => + High := Index_Non_Blank (Source, Backward); + DL := High - Low + 1; + end case; + + -- Length of the result is the same as length of the source string, + -- reuse source shared string. + + if DL = SR.Last then + Reference (SR); + DR := SR; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Trim; + + procedure Trim + (Source : in out Unbounded_Wide_Wide_String; + Side : Trim_End) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index_Non_Blank (Source, Forward); + + -- All blanks, reuse empty shared string + + if Low = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + else + case Side is + when Left => + High := SR.Last; + DL := SR.Last - Low + 1; + + when Right => + Low := 1; + High := Index_Non_Blank (Source, Backward); + DL := High; + + when Both => + High := Index_Non_Blank (Source, Backward); + DL := High - Low + 1; + end case; + + -- Length of the result is the same as length of the source string, + -- nothing to do. + + if DL = SR.Last then + null; + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (1 .. DL) := SR.Data (Low .. High); + SR.Last := DL; + + -- Otherwise, allocate new shared string + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Trim; + + function Trim + (Source : Unbounded_Wide_Wide_String; + Left : Wide_Wide_Maps.Wide_Wide_Character_Set; + Right : Wide_Wide_Maps.Wide_Wide_Character_Set) + return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index (Source, Left, Outside, Forward); + + -- Source includes only characters from Left set, reuse empty shared + -- string. + + if Low = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + else + High := Index (Source, Right, Outside, Backward); + DL := Integer'Max (0, High - Low + 1); + + -- Source includes only characters from Right set or result string + -- is empty, reuse empty shared string. + + if High = 0 or else DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + end if; + + return (AF.Controlled with Reference => DR); + end Trim; + + procedure Trim + (Source : in out Unbounded_Wide_Wide_String; + Left : Wide_Wide_Maps.Wide_Wide_Character_Set; + Right : Wide_Wide_Maps.Wide_Wide_Character_Set) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + Low : Natural; + High : Natural; + + begin + Low := Index (Source, Left, Outside, Forward); + + -- Source includes only characters from Left set, reuse empty shared + -- string. + + if Low = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + else + High := Index (Source, Right, Outside, Backward); + DL := Integer'Max (0, High - Low + 1); + + -- Source includes only characters from Right set or result string + -- is empty, reuse empty shared string. + + if High = 0 or else DL = 0 then + Reference (Empty_Shared_Wide_Wide_String'Access); + Source.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (SR); + + -- Try to reuse existent shared string + + elsif Can_Be_Reused (SR, DL) then + SR.Data (1 .. DL) := SR.Data (Low .. High); + SR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Source.Reference := DR; + Unreference (SR); + end if; + end if; + end Trim; + + --------------------- + -- Unbounded_Slice -- + --------------------- + + function Unbounded_Slice + (Source : Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural) return Unbounded_Wide_Wide_String + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + -- Result is empty slice, reuse empty shared string + + elsif Low > High then + Reference (Empty_Shared_Wide_Wide_String'Access); + DR := Empty_Shared_Wide_Wide_String'Access; + + -- Otherwise, allocate new shared string and fill it + + else + DL := High - Low + 1; + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + end if; + + return (AF.Controlled with Reference => DR); + end Unbounded_Slice; + + procedure Unbounded_Slice + (Source : Unbounded_Wide_Wide_String; + Target : out Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural) + is + SR : constant Shared_Wide_Wide_String_Access := Source.Reference; + TR : constant Shared_Wide_Wide_String_Access := Target.Reference; + DL : Natural; + DR : Shared_Wide_Wide_String_Access; + + begin + -- Check bounds + + if Low > SR.Last + 1 or else High > SR.Last then + raise Index_Error; + + -- Result is empty slice, reuse empty shared string + + elsif Low > High then + Reference (Empty_Shared_Wide_Wide_String'Access); + Target.Reference := Empty_Shared_Wide_Wide_String'Access; + Unreference (TR); + + else + DL := High - Low + 1; + + -- Try to reuse existent shared string + + if Can_Be_Reused (TR, DL) then + TR.Data (1 .. DL) := SR.Data (Low .. High); + TR.Last := DL; + + -- Otherwise, allocate new shared string and fill it + + else + DR := Allocate (DL); + DR.Data (1 .. DL) := SR.Data (Low .. High); + DR.Last := DL; + Target.Reference := DR; + Unreference (TR); + end if; + end if; + end Unbounded_Slice; + + ----------------- + -- Unreference -- + ----------------- + + procedure Unreference (Item : not null Shared_Wide_Wide_String_Access) is + use Interfaces; + + procedure Free is + new Ada.Unchecked_Deallocation + (Shared_Wide_Wide_String, Shared_Wide_Wide_String_Access); + + Aux : Shared_Wide_Wide_String_Access := Item; + + begin + if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then + + -- Reference counter of Empty_Shared_Wide_Wide_String must never + -- reach zero. + + pragma Assert (Aux /= Empty_Shared_Wide_Wide_String'Access); + + Free (Aux); + end if; + end Unreference; + + end Ada.Strings.Wide_Wide_Unbounded; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzunb-shared.ads gcc-4.6.0/gcc/ada/a-stzunb-shared.ads *** gcc-4.5.2/gcc/ada/a-stzunb-shared.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-stzunb-shared.ads Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,510 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This version is supported on: + -- - all Alpha platforms + -- - all ia64 platforms + -- - all PowerPC platforms + -- - all SPARC V9 platforms + -- - all x86_64 platforms + + with Ada.Strings.Wide_Wide_Maps; + private with Ada.Finalization; + private with Interfaces; + + package Ada.Strings.Wide_Wide_Unbounded is + pragma Preelaborate; + + type Unbounded_Wide_Wide_String is private; + pragma Preelaborable_Initialization (Unbounded_Wide_Wide_String); + + Null_Unbounded_Wide_Wide_String : constant Unbounded_Wide_Wide_String; + + function Length (Source : Unbounded_Wide_Wide_String) return Natural; + + type Wide_Wide_String_Access is access all Wide_Wide_String; + + procedure Free (X : in out Wide_Wide_String_Access); + + -------------------------------------------------------- + -- Conversion, Concatenation, and Selection Functions -- + -------------------------------------------------------- + + function To_Unbounded_Wide_Wide_String + (Source : Wide_Wide_String) return Unbounded_Wide_Wide_String; + + function To_Unbounded_Wide_Wide_String + (Length : Natural) return Unbounded_Wide_Wide_String; + + function To_Wide_Wide_String + (Source : Unbounded_Wide_Wide_String) return Wide_Wide_String; + + procedure Set_Unbounded_Wide_Wide_String + (Target : out Unbounded_Wide_Wide_String; + Source : Wide_Wide_String); + pragma Ada_05 (Set_Unbounded_Wide_Wide_String); + + procedure Append + (Source : in out Unbounded_Wide_Wide_String; + New_Item : Unbounded_Wide_Wide_String); + + procedure Append + (Source : in out Unbounded_Wide_Wide_String; + New_Item : Wide_Wide_String); + + procedure Append + (Source : in out Unbounded_Wide_Wide_String; + New_Item : Wide_Wide_Character); + + function "&" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String; + + function "&" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Unbounded_Wide_Wide_String; + + function "&" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String; + + function "&" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String; + + function "&" + (Left : Wide_Wide_Character; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String; + + function Element + (Source : Unbounded_Wide_Wide_String; + Index : Positive) return Wide_Wide_Character; + + procedure Replace_Element + (Source : in out Unbounded_Wide_Wide_String; + Index : Positive; + By : Wide_Wide_Character); + + function Slice + (Source : Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural) return Wide_Wide_String; + + function Unbounded_Slice + (Source : Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural) return Unbounded_Wide_Wide_String; + pragma Ada_05 (Unbounded_Slice); + + procedure Unbounded_Slice + (Source : Unbounded_Wide_Wide_String; + Target : out Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural); + pragma Ada_05 (Unbounded_Slice); + + function "=" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function "=" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean; + + function "=" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function "<" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function "<" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean; + + function "<" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function "<=" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function "<=" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean; + + function "<=" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function ">" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function ">" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean; + + function ">" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function ">=" + (Left : Unbounded_Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + function ">=" + (Left : Unbounded_Wide_Wide_String; + Right : Wide_Wide_String) return Boolean; + + function ">=" + (Left : Wide_Wide_String; + Right : Unbounded_Wide_Wide_String) return Boolean; + + ------------------------ + -- Search Subprograms -- + ------------------------ + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping := + Wide_Wide_Maps.Identity) + return Natural; + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Natural; + + function Index + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + Test : Membership := Inside; + Going : Direction := Forward) return Natural; + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping := + Wide_Wide_Maps.Identity) + return Natural; + pragma Ada_05 (Index); + + function Index + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + From : Positive; + Going : Direction := Forward; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Natural; + pragma Ada_05 (Index); + + function Index + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership := Inside; + Going : Direction := Forward) return Natural; + pragma Ada_05 (Index); + + function Index_Non_Blank + (Source : Unbounded_Wide_Wide_String; + Going : Direction := Forward) return Natural; + + function Index_Non_Blank + (Source : Unbounded_Wide_Wide_String; + From : Positive; + Going : Direction := Forward) return Natural; + pragma Ada_05 (Index_Non_Blank); + + function Count + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping := + Wide_Wide_Maps.Identity) + return Natural; + + function Count + (Source : Unbounded_Wide_Wide_String; + Pattern : Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Natural; + + function Count + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural; + + procedure Find_Token + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + Test : Membership; + First : out Positive; + Last : out Natural); + + ------------------------------------ + -- String Translation Subprograms -- + ------------------------------------ + + function Translate + (Source : Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping) + return Unbounded_Wide_Wide_String; + + procedure Translate + (Source : in out Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping); + + function Translate + (Source : Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) + return Unbounded_Wide_Wide_String; + + procedure Translate + (Source : in out Unbounded_Wide_Wide_String; + Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function); + + --------------------------------------- + -- String Transformation Subprograms -- + --------------------------------------- + + function Replace_Slice + (Source : Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural; + By : Wide_Wide_String) return Unbounded_Wide_Wide_String; + + procedure Replace_Slice + (Source : in out Unbounded_Wide_Wide_String; + Low : Positive; + High : Natural; + By : Wide_Wide_String); + + function Insert + (Source : Unbounded_Wide_Wide_String; + Before : Positive; + New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String; + + procedure Insert + (Source : in out Unbounded_Wide_Wide_String; + Before : Positive; + New_Item : Wide_Wide_String); + + function Overwrite + (Source : Unbounded_Wide_Wide_String; + Position : Positive; + New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String; + + procedure Overwrite + (Source : in out Unbounded_Wide_Wide_String; + Position : Positive; + New_Item : Wide_Wide_String); + + function Delete + (Source : Unbounded_Wide_Wide_String; + From : Positive; + Through : Natural) return Unbounded_Wide_Wide_String; + + procedure Delete + (Source : in out Unbounded_Wide_Wide_String; + From : Positive; + Through : Natural); + + function Trim + (Source : Unbounded_Wide_Wide_String; + Side : Trim_End) return Unbounded_Wide_Wide_String; + + procedure Trim + (Source : in out Unbounded_Wide_Wide_String; + Side : Trim_End); + + function Trim + (Source : Unbounded_Wide_Wide_String; + Left : Wide_Wide_Maps.Wide_Wide_Character_Set; + Right : Wide_Wide_Maps.Wide_Wide_Character_Set) + return Unbounded_Wide_Wide_String; + + procedure Trim + (Source : in out Unbounded_Wide_Wide_String; + Left : Wide_Wide_Maps.Wide_Wide_Character_Set; + Right : Wide_Wide_Maps.Wide_Wide_Character_Set); + + function Head + (Source : Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space) + return Unbounded_Wide_Wide_String; + + procedure Head + (Source : in out Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space); + + function Tail + (Source : Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space) + return Unbounded_Wide_Wide_String; + + procedure Tail + (Source : in out Unbounded_Wide_Wide_String; + Count : Natural; + Pad : Wide_Wide_Character := Wide_Wide_Space); + + function "*" + (Left : Natural; + Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String; + + function "*" + (Left : Natural; + Right : Wide_Wide_String) return Unbounded_Wide_Wide_String; + + function "*" + (Left : Natural; + Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String; + + private + pragma Inline (Length); + + package AF renames Ada.Finalization; + + type Shared_Wide_Wide_String (Max_Length : Natural) is limited record + Counter : aliased Interfaces.Unsigned_32 := 1; + -- Reference counter. + + Last : Natural := 0; + Data : Wide_Wide_String (1 .. Max_Length); + -- Last is the index of last significant element of the Data. All + -- elements with larger indices are just an extra room. + end record; + + type Shared_Wide_Wide_String_Access is access all Shared_Wide_Wide_String; + + procedure Reference (Item : not null Shared_Wide_Wide_String_Access); + -- Increment reference counter. + + procedure Unreference (Item : not null Shared_Wide_Wide_String_Access); + -- Decrement reference counter. Deallocate Item when reference counter is + -- zero. + + function Can_Be_Reused + (Item : Shared_Wide_Wide_String_Access; + Length : Natural) return Boolean; + -- Returns True if Shared_Wide_Wide_String can be reused. There are two + -- criteria when Shared_Wide_Wide_String can be reused: its reference + -- counter must be one (thus Shared_Wide_Wide_String is owned exclusively) + -- and its size is sufficient to store string with specified length + -- effectively. + + function Allocate + (Max_Length : Natural) return Shared_Wide_Wide_String_Access; + -- Allocates new Shared_Wide_Wide_String with at least specified maximum + -- length. Actual maximum length of the allocated Shared_Wide_Wide_String + -- can be slightly greater. Returns reference to + -- Empty_Shared_Wide_Wide_String when requested length is zero. + + Empty_Shared_Wide_Wide_String : aliased Shared_Wide_Wide_String (0); + + function To_Unbounded + (S : Wide_Wide_String) return Unbounded_Wide_Wide_String + renames To_Unbounded_Wide_Wide_String; + -- This renames are here only to be used in the pragma Stream_Convert. + + type Unbounded_Wide_Wide_String is new AF.Controlled with record + Reference : Shared_Wide_Wide_String_Access := + Empty_Shared_Wide_Wide_String'Access; + end record; + + -- The Unbounded_Wide_Wide_String uses several techniques to increase speed + -- of the application: + -- - implicit sharing or copy-on-write. Unbounded_Wide_Wide_String + -- contains only the reference to the data which is shared between + -- several instances. The shared data is reallocated only when its value + -- is changed and the object mutation can't be used or it is inefficient + -- to use it; + -- - object mutation. Shared data object can be reused without memory + -- reallocation when all of the following requirements are meat: + -- - shared data object don't used anywhere longer; + -- - its size is sufficient to store new value; + -- - the gap after reuse is less then some threshold. + -- - memory preallocation. Most of used memory allocation algorithms + -- aligns allocated segment on the some boundary, thus some amount of + -- additional memory can be preallocated without any impact. Such + -- preallocated memory can used later by Append/Insert operations + -- without reallocation. + -- + -- Reference counting uses GCC builtin atomic operations, which allows to + -- safely share internal data between Ada tasks. Nevertheless, this not + -- make objects of Unbounded_Wide_Wide_String thread-safe, so each instance + -- can't be accessed by several tasks simultaneously. + + pragma Stream_Convert + (Unbounded_Wide_Wide_String, To_Unbounded, To_Wide_Wide_String); + -- Provide stream routines without dragging in Ada.Streams + + pragma Finalize_Storage_Only (Unbounded_Wide_Wide_String); + -- Finalization is required only for freeing storage + + overriding procedure Initialize + (Object : in out Unbounded_Wide_Wide_String); + overriding procedure Adjust + (Object : in out Unbounded_Wide_Wide_String); + overriding procedure Finalize + (Object : in out Unbounded_Wide_Wide_String); + + Null_Unbounded_Wide_Wide_String : constant Unbounded_Wide_Wide_String := + (AF.Controlled with + Reference => + Empty_Shared_Wide_Wide_String'Access); + + end Ada.Strings.Wide_Wide_Unbounded; diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzunb.adb gcc-4.6.0/gcc/ada/a-stzunb.adb *** gcc-4.5.2/gcc/ada/a-stzunb.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzunb.adb Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Strings.Wide_Wide_Unbou *** 517,522 **** --- 517,535 ---- procedure Find_Token (Source : Unbounded_Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Strings.Membership; + First : out Positive; + Last : out Natural) + is + begin + Wide_Wide_Search.Find_Token + (Source.Reference (From .. Source.Last), Set, Test, First, Last); + end Find_Token; + + procedure Find_Token + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) diff -Nrcpad gcc-4.5.2/gcc/ada/a-stzunb.ads gcc-4.6.0/gcc/ada/a-stzunb.ads *** gcc-4.5.2/gcc/ada/a-stzunb.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-stzunb.ads Fri Oct 8 13:02:55 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Strings.Wide_Wide_Unbounded *** 269,274 **** --- 269,283 ---- procedure Find_Token (Source : Unbounded_Wide_Wide_String; Set : Wide_Wide_Maps.Wide_Wide_Character_Set; + From : Positive; + Test : Membership; + First : out Positive; + Last : out Natural); + pragma Ada_2012 (Find_Token); + + procedure Find_Token + (Source : Unbounded_Wide_Wide_String; + Set : Wide_Wide_Maps.Wide_Wide_Character_Set; Test : Membership; First : out Positive; Last : out Natural); diff -Nrcpad gcc-4.5.2/gcc/ada/a-suenco.adb gcc-4.6.0/gcc/ada/a-suenco.adb *** gcc-4.5.2/gcc/ada/a-suenco.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suenco.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,390 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.CONVERSIONS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.UTF_Encoding.Conversions is + use Interfaces; + + -- Convert from UTF-8/UTF-16BE/LE to UTF-8/UTF-16BE/LE + + function Convert + (Item : UTF_String; + Input_Scheme : Encoding_Scheme; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String + is + begin + -- Nothing to do if identical schemes + + if Input_Scheme = Output_Scheme then + return Item; + + -- For remaining cases, one or other of the operands is UTF-16BE/LE + -- encoded, so go through UTF-16 intermediate. + + else + return Convert (UTF_16_Wide_String'(Convert (Item, Input_Scheme)), + Output_Scheme, Output_BOM); + end if; + end Convert; + + -- Convert from UTF-8/UTF-16BE/LE to UTF-16 + + function Convert + (Item : UTF_String; + Input_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + begin + if Input_Scheme = UTF_8 then + return Convert (Item, Output_BOM); + else + return To_UTF_16 (Item, Input_Scheme, Output_BOM); + end if; + end Convert; + + -- Convert from UTF-8 to UTF-16 + + function Convert + (Item : UTF_8_String; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + Result : UTF_16_Wide_String (1 .. Item'Length + 1); + -- Maximum length of result, including possible BOM + + Len : Natural := 0; + -- Number of characters stored so far in Result + + Iptr : Natural; + -- Next character to process in Item + + C : Unsigned_8; + -- Input UTF-8 code + + R : Unsigned_16; + -- Output UTF-16 code + + procedure Get_Continuation; + -- Reads a continuation byte of the form 10xxxxxx, shifts R left + -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On + -- return Ptr is incremented. Raises exception if continuation + -- byte does not exist or is invalid. + + ---------------------- + -- Get_Continuation -- + ---------------------- + + procedure Get_Continuation is + begin + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + + else + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + if C < 2#10_000000# or else C > 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + + else + R := Shift_Left (R, 6) or + Unsigned_16 (C and 2#00_111111#); + end if; + end if; + end Get_Continuation; + + -- Start of processing for Convert + + begin + -- Output BOM if required + + if Output_BOM then + Len := Len + 1; + Result (Len) := BOM_16 (1); + end if; + + -- Skip OK BOM + + Iptr := Item'First; + + if Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then + Iptr := Iptr + 3; + + -- Error if bad BOM + + elsif Item'Length >= 2 + and then (Item (Iptr .. Iptr + 1) = BOM_16BE + or else + Item (Iptr .. Iptr + 1) = BOM_16LE) + then + Raise_Encoding_Error (Iptr); + + -- No BOM present + + else + Iptr := Item'First; + end if; + + while Iptr <= Item'Last loop + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#00# - 16#7F# + -- UTF-8: 0xxxxxxx + -- UTF-16: 00000000_0xxxxxxx + + if C <= 16#7F# then + Len := Len + 1; + Result (Len) := Wide_Character'Val (C); + + -- No initial code can be of the form 10xxxxxx. Such codes are used + -- only for continuations. + + elsif C <= 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + + -- Codes in the range 16#80# - 16#7FF# + -- UTF-8: 110yyyxx 10xxxxxx + -- UTF-16: 00000yyy_xxxxxxxx + + elsif C <= 2#110_11111# then + R := Unsigned_16 (C and 2#000_11111#); + Get_Continuation; + Len := Len + 1; + Result (Len) := Wide_Character'Val (R); + + -- Codes in the range 16#800# - 16#FFFF# + -- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx + -- UTF-16: yyyyyyyy_xxxxxxxx + + elsif C <= 2#1110_1111# then + R := Unsigned_16 (C and 2#0000_1111#); + Get_Continuation; + Get_Continuation; + Len := Len + 1; + Result (Len) := Wide_Character'Val (R); + + -- Make sure that we don't have a result in the forbidden range + -- reserved for UTF-16 surrogate characters. + + if R in 16#D800# .. 16#DF00# then + Raise_Encoding_Error (Iptr - 3); + end if; + + -- Codes in the range 16#10000# - 16#10FFFF# + -- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + -- UTF-16: 110110zz_zzyyyyyy 110111yy_xxxxxxxx + -- Note: zzzz in the output is input zzzzz - 1 + + elsif C <= 2#11110_111# then + R := Unsigned_16 (C and 2#00000_111#); + Get_Continuation; + + -- R now has zzzzzyyyy + + R := R - 2#0000_1_0000#; + + -- R now has zzzzyyyy (zzzz minus one for the output) + + Get_Continuation; + + -- R now has zzzzyyyyyyyyxx + + Len := Len + 1; + Result (Len) := + Wide_Character'Val + (2#110110_00_0000_0000# or Shift_Right (R, 4)); + + R := R and 2#1111#; + Get_Continuation; + Len := Len + 1; + Result (Len) := + Wide_Character'Val (2#110111_00_0000_0000# or R); + + -- Any other code is an error + + else + Raise_Encoding_Error (Iptr - 1); + end if; + end loop; + + return Result (1 .. Len); + end Convert; + + -- Convert from UTF-16 to UTF-8/UTF-16-BE/LE + + function Convert + (Item : UTF_16_Wide_String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String + is + begin + if Output_Scheme = UTF_8 then + return Convert (Item, Output_BOM); + else + return From_UTF_16 (Item, Output_Scheme, Output_BOM); + end if; + end Convert; + + -- Convert from UTF-16 to UTF-8 + + function Convert + (Item : UTF_16_Wide_String; + Output_BOM : Boolean := False) return UTF_8_String + is + Result : UTF_8_String (1 .. 3 * Item'Length + 3); + -- Worst case is 3 output codes for each input code + BOM space + + Len : Natural; + -- Number of result codes stored + + Iptr : Natural; + -- Pointer to next input character + + C1, C2 : Unsigned_16; + + zzzzz : Unsigned_16; + yyyyyyyy : Unsigned_16; + xxxxxxxx : Unsigned_16; + -- Components of double length case + + begin + Iptr := Item'First; + + -- Skip BOM at start of input + + if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then + Iptr := Iptr + 1; + end if; + + -- Generate output BOM if required + + if Output_BOM then + Result (1 .. 3) := BOM_8; + Len := 3; + else + Len := 0; + end if; + + -- Loop through input + + while Iptr <= Item'Last loop + C1 := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#0000# - 16#007F# + -- UTF-16: 000000000xxxxxxx + -- UTF-8: 0xxxxxxx + + if C1 <= 16#007F# then + Result (Len + 1) := Character'Val (C1); + Len := Len + 1; + + -- Codes in the range 16#80# - 16#7FF# + -- UTF-16: 00000yyyxxxxxxxx + -- UTF-8: 110yyyxx 10xxxxxx + + elsif C1 <= 16#07FF# then + Result (Len + 1) := + Character'Val + (2#110_00000# or Shift_Right (C1, 6)); + Result (Len + 2) := + Character'Val + (2#10_000000# or (C1 and 2#00_111111#)); + Len := Len + 2; + + -- Codes in the range 16#800# - 16#D7FF# or 16#E000# - 16#FFFF# + -- UTF-16: yyyyyyyyxxxxxxxx + -- UTF-8: 1110yyyy 10yyyyxx 10xxxxxx + + elsif C1 <= 16#D7FF# or else C1 >= 16#E000# then + Result (Len + 1) := + Character'Val + (2#1110_0000# or Shift_Right (C1, 12)); + Result (Len + 2) := + Character'Val + (2#10_000000# or (Shift_Right (C1, 6) and 2#00_111111#)); + Result (Len + 3) := + Character'Val + (2#10_000000# or (C1 and 2#00_111111#)); + Len := Len + 3; + + -- Codes in the range 16#10000# - 16#10FFFF# + -- UTF-16: 110110zzzzyyyyyy 110111yyxxxxxxxx + -- UTF-8: 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + -- Note: zzzzz in the output is input zzzz + 1 + + elsif C1 <= 2#110110_11_11111111# then + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + else + C2 := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + end if; + + if (C2 and 2#111111_00_00000000#) /= 2#110111_00_00000000# then + Raise_Encoding_Error (Iptr - 1); + end if; + + zzzzz := (Shift_Right (C1, 6) and 2#1111#) + 1; + yyyyyyyy := ((Shift_Left (C1, 2) and 2#111111_00#) + or + (Shift_Right (C2, 8) and 2#000000_11#)); + xxxxxxxx := C2 and 2#11111111#; + + Result (Len + 1) := + Character'Val + (2#11110_000# or (Shift_Right (zzzzz, 2))); + Result (Len + 2) := + Character'Val + (2#10_000000# or Shift_Left (zzzzz and 2#11#, 4) + or Shift_Right (yyyyyyyy, 4)); + Result (Len + 3) := + Character'Val + (2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 4) + or Shift_Right (xxxxxxxx, 6)); + Result (Len + 4) := + Character'Val + (2#10_000000# or (xxxxxxxx and 2#00_111111#)); + Len := Len + 4; + + -- Error if input in 16#DC00# - 16#DFFF# (2nd surrogate with no 1st) + + else + Raise_Encoding_Error (Iptr - 2); + end if; + end loop; + + return Result (1 .. Len); + end Convert; + + end Ada.Strings.UTF_Encoding.Conversions; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suenco.ads gcc-4.6.0/gcc/ada/a-suenco.ads *** gcc-4.5.2/gcc/ada/a-suenco.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suenco.ads Wed Jun 23 12:44:34 2010 *************** *** 0 **** --- 1,61 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.CONVERSIONS -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is an Ada 2012 package defined in AI05-0137-1. It provides conversions + -- from one UTF encoding method to another. Note: this package is consistent + -- with Ada 95, and may be used in Ada 95 or Ada 2005 mode. + + package Ada.Strings.UTF_Encoding.Conversions is + pragma Pure (Conversions); + + -- In the following conversion routines, a BOM in the input that matches + -- the encoding scheme is ignored, an incorrect BOM causes Encoding_Error + -- to be raised. A BOM is present in the output if the Output_BOM parameter + -- is set to True. + + function Convert + (Item : UTF_String; + Input_Scheme : Encoding_Scheme; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String; + -- Convert from input encoded in UTF-8, UTF-16LE, or UTF-16BE as specified + -- by the Input_Scheme argument, and generate an output encoded in one of + -- these three schemes as specified by the Output_Scheme argument. + + function Convert + (Item : UTF_String; + Input_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- Convert from input encoded in UTF-8, UTF-16LE, or UTF-16BE as specified + -- by the Input_Scheme argument, and generate an output encoded in UTF-16. + + function Convert + (Item : UTF_8_String; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- Convert from UTF-8 to UTF-16 + + function Convert + (Item : UTF_16_Wide_String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String; + -- Convert from UTF-16 to UTF-8, UTF-16LE, or UTF-16BE as specified by + -- the Output_Scheme argument. + + function Convert + (Item : UTF_16_Wide_String; + Output_BOM : Boolean := False) return UTF_8_String; + -- Convert from UTF-16 to UTF-8 + + end Ada.Strings.UTF_Encoding.Conversions; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suenst.adb gcc-4.6.0/gcc/ada/a-suenst.adb *** gcc-4.5.2/gcc/ada/a-suenst.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suenst.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,341 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.STRINGS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.UTF_Encoding.Strings is + use Interfaces; + + ------------ + -- Decode -- + ------------ + + -- Decode UTF-8/UTF-16BE/UTF-16LE input to String + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return String + is + begin + if Input_Scheme = UTF_8 then + return Decode (Item); + else + return Decode (To_UTF_16 (Item, Input_Scheme)); + end if; + end Decode; + + -- Decode UTF-8 input to String + + function Decode (Item : UTF_8_String) return String is + Result : String (1 .. Item'Length); + -- Result string (worst case is same length as input) + + Len : Natural := 0; + -- Length of result stored so far + + Iptr : Natural; + -- Input Item pointer + + C : Unsigned_8; + R : Unsigned_16; + + procedure Get_Continuation; + -- Reads a continuation byte of the form 10xxxxxx, shifts R left + -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On + -- return Ptr is incremented. Raises exception if continuation + -- byte does not exist or is invalid. + + ---------------------- + -- Get_Continuation -- + ---------------------- + + procedure Get_Continuation is + begin + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + + else + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + if C not in 2#10_000000# .. 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + else + R := Shift_Left (R, 6) or Unsigned_16 (C and 2#00_111111#); + end if; + end if; + end Get_Continuation; + + -- Start of processing for Decode + + begin + Iptr := Item'First; + + -- Skip BOM at start + + if Item'Length >= 3 + and then Item (Iptr .. Iptr + 2) = BOM_8 + then + Iptr := Iptr + 3; + + -- Error if bad BOM + + elsif Item'Length >= 2 + and then (Item (Iptr .. Iptr + 1) = BOM_16BE + or else + Item (Iptr .. Iptr + 1) = BOM_16LE) + then + Raise_Encoding_Error (Iptr); + end if; + + while Iptr <= Item'Last loop + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + R := Unsigned_16 (C); + + -- No initial code can be of the form 10xxxxxx. Such codes are used + -- only for continuations. + + elsif C <= 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + elsif C <= 2#110_11111# then + R := Unsigned_16 (C and 2#000_11111#); + Get_Continuation; + + -- Codes in the range 16#800# - 16#FFFF# are represented as + -- 1110yyyy 10yyyyxx 10xxxxxx + + -- Such codes are out of range for type Character + + -- Codes in the range 16#10000# - 16#10FFFF# are represented as + -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + + -- Such codes are out of range for Wide_String output + + -- Thus all remaining cases raise Encoding_Error + + else + Raise_Encoding_Error (Iptr - 1); + end if; + + Len := Len + 1; + Result (Len) := Character'Val (R); + end loop; + + return Result (1 .. Len); + end Decode; + + -- Decode UTF-16 input to String + + function Decode (Item : UTF_16_Wide_String) return String is + Result : String (1 .. Item'Length); + -- Result is same length as input (possibly minus 1 if BOM present) + + Len : Natural := 0; + -- Length of result + + Iptr : Natural; + -- Index of next Item element + + C : Unsigned_16; + + begin + -- Skip UTF-16 BOM at start + + Iptr := Item'First; + + if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then + Iptr := Iptr + 1; + end if; + + -- Loop through input characters + + while Iptr <= Item'Last loop + C := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#0000#..16#00FF# represent their own value + + if C <= 16#00FF# then + Len := Len + 1; + Result (Len) := Character'Val (C); + + -- All other codes are invalid, either they are invalid UTF-16 + -- encoding sequences, or they represent values that are out of + -- range for type Character. + + else + Raise_Encoding_Error (Iptr - 1); + end if; + end loop; + + return Result (1 .. Len); + end Decode; + + ------------ + -- Encode -- + ------------ + + -- Encode String in UTF-8, UTF-16BE or UTF-16LE + + function Encode + (Item : String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String + is + begin + -- Case of UTF_8 + + if Output_Scheme = UTF_8 then + return Encode (Item, Output_BOM); + + -- Case of UTF_16LE or UTF_16BE, use UTF-16 intermediary + + else + return From_UTF_16 (UTF_16_Wide_String'(Encode (Item)), + Output_Scheme, Output_BOM); + end if; + end Encode; + + -- Encode String in UTF-8 + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_8_String + is + Result : UTF_8_String (1 .. 3 * Item'Length + 3); + -- Worst case is three bytes per input byte + space for BOM + + Len : Natural; + -- Number of output codes stored in Result + + C : Unsigned_8; + -- Single input character + + procedure Store (C : Unsigned_8); + pragma Inline (Store); + -- Store one output code, C is in the range 0 .. 255 + + ----------- + -- Store -- + ----------- + + procedure Store (C : Unsigned_8) is + begin + Len := Len + 1; + Result (Len) := Character'Val (C); + end Store; + + -- Start of processing for UTF8_Encode + + begin + -- Output BOM if required + + if Output_BOM then + Result (1 .. 3) := BOM_8; + Len := 3; + else + Len := 0; + end if; + + -- Loop through characters of input + + for J in Item'Range loop + C := To_Unsigned_8 (Item (J)); + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + Store (C); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + -- For type character of course, the limit is 16#FF# in any case + + else + Store (2#110_00000# or Shift_Right (C, 6)); + Store (2#10_000000# or (C and 2#00_111111#)); + end if; + end loop; + + return Result (1 .. Len); + end Encode; + + -- Encode String in UTF-16 + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + Result : UTF_16_Wide_String + (1 .. Item'Length + Boolean'Pos (Output_BOM)); + -- Output is same length as input + possible BOM + + Len : Integer; + -- Length of output string + + C : Unsigned_8; + + begin + -- Output BOM if required + + if Output_BOM then + Result (1) := BOM_16 (1); + Len := 1; + else + Len := 0; + end if; + + -- Loop through input characters encoding them + + for Iptr in Item'Range loop + C := To_Unsigned_8 (Item (Iptr)); + + -- Codes in the range 16#0000#..16#00FF# are output unchanged. This + -- includes all possible cases of Character values. + + Len := Len + 1; + Result (Len) := Wide_Character'Val (C); + end loop; + + return Result; + end Encode; + + end Ada.Strings.UTF_Encoding.Strings; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suenst.ads gcc-4.6.0/gcc/ada/a-suenst.ads *** gcc-4.5.2/gcc/ada/a-suenst.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suenst.ads Mon Oct 11 08:23:31 2010 *************** *** 0 **** --- 1,65 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.STRINGS -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding + -- and decoding String values using UTF encodings. Note: this package is + -- consistent with Ada 95, and may be included in Ada 95 implementations. + + package Ada.Strings.UTF_Encoding.Strings is + pragma Pure (Strings); + + -- The encoding routines take a String as input and encode the result + -- using the specified UTF encoding method. The result includes a BOM if + -- the Output_BOM argument is set to True. All 256 values of type Character + -- are valid, so Encoding_Error cannot be raised for string input data. + + function Encode + (Item : String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String; + -- Encode String using UTF-8, UTF-16LE or UTF-16BE encoding as specified by + -- the Output_Scheme parameter. + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_8_String; + -- Encode String using UTF-8 encoding + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- Encode String using UTF_16 encoding + + -- The decoding routines take a UTF String as input, and return a decoded + -- Wide_String. If the UTF String starts with a BOM that matches the + -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error, + -- as does a code out of range of type Character. + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return String; + -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the + -- Input_Scheme parameter. It is decoded and returned as a String value. + -- Note: a convenient form for scheme may be Encoding (UTF_String). + + function Decode + (Item : UTF_8_String) return String; + -- The input is encoded in UTF-8 and returned as a String value + + function Decode + (Item : UTF_16_Wide_String) return String; + -- The input is encoded in UTF-16 and returned as a String value + + end Ada.Strings.UTF_Encoding.Strings; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suewst.adb gcc-4.6.0/gcc/ada/a-suewst.adb *** gcc-4.5.2/gcc/ada/a-suewst.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suewst.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,370 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.UTF_Encoding.Wide_Strings is + use Interfaces; + + ------------ + -- Decode -- + ------------ + + -- Decode UTF-8/UTF-16BE/UTF-16LE input to Wide_String + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return Wide_String + is + begin + if Input_Scheme = UTF_8 then + return Decode (Item); + else + return Decode (To_UTF_16 (Item, Input_Scheme)); + end if; + end Decode; + + -- Decode UTF-8 input to Wide_String + + function Decode (Item : UTF_8_String) return Wide_String is + Result : Wide_String (1 .. Item'Length); + -- Result string (worst case is same length as input) + + Len : Natural := 0; + -- Length of result stored so far + + Iptr : Natural; + -- Input Item pointer + + C : Unsigned_8; + R : Unsigned_16; + + procedure Get_Continuation; + -- Reads a continuation byte of the form 10xxxxxx, shifts R left + -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On + -- return Ptr is incremented. Raises exception if continuation + -- byte does not exist or is invalid. + + ---------------------- + -- Get_Continuation -- + ---------------------- + + procedure Get_Continuation is + begin + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + + else + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + if C not in 2#10_000000# .. 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + else + R := Shift_Left (R, 6) or Unsigned_16 (C and 2#00_111111#); + end if; + end if; + end Get_Continuation; + + -- Start of processing for Decode + + begin + Iptr := Item'First; + + -- Skip BOM at start + + if Item'Length >= 3 + and then Item (Iptr .. Iptr + 2) = BOM_8 + then + Iptr := Iptr + 3; + + -- Error if bad BOM + + elsif Item'Length >= 2 + and then (Item (Iptr .. Iptr + 1) = BOM_16BE + or else + Item (Iptr .. Iptr + 1) = BOM_16LE) + then + Raise_Encoding_Error (Iptr); + end if; + + while Iptr <= Item'Last loop + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + R := Unsigned_16 (C); + + -- No initial code can be of the form 10xxxxxx. Such codes are used + -- only for continuations. + + elsif C <= 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + elsif C <= 2#110_11111# then + R := Unsigned_16 (C and 2#000_11111#); + Get_Continuation; + + -- Codes in the range 16#800# - 16#FFFF# are represented as + -- 1110yyyy 10yyyyxx 10xxxxxx + + elsif C <= 2#1110_1111# then + R := Unsigned_16 (C and 2#0000_1111#); + Get_Continuation; + Get_Continuation; + + -- Codes in the range 16#10000# - 16#10FFFF# are represented as + -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + + -- Such codes are out of range for Wide_String output + + else + Raise_Encoding_Error (Iptr - 1); + end if; + + Len := Len + 1; + Result (Len) := Wide_Character'Val (R); + end loop; + + return Result (1 .. Len); + end Decode; + + -- Decode UTF-16 input to Wide_String + + function Decode (Item : UTF_16_Wide_String) return Wide_String is + Result : Wide_String (1 .. Item'Length); + -- Result is same length as input (possibly minus 1 if BOM present) + + Len : Natural := 0; + -- Length of result + + Iptr : Natural; + -- Index of next Item element + + C : Unsigned_16; + + begin + -- Skip UTF-16 BOM at start + + Iptr := Item'First; + + if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then + Iptr := Iptr + 1; + end if; + + -- Loop through input characters + + while Iptr <= Item'Last loop + C := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#0000#..16#D7FF# or 16#E000#..16#FFFD# + -- represent their own value. + + if C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then + Len := Len + 1; + Result (Len) := Wide_Character'Val (C); + + -- Codes in the range 16#D800#..16#DBFF# represent the first of the + -- two surrogates used to encode the range 16#01_000#..16#10_FFFF". + -- Such codes are out of range for 16-bit output. + + -- The case of input in the range 16#DC00#..16#DFFF# must never + -- occur, since it means we have a second surrogate character with + -- no corresponding first surrogate. + + -- Codes in the range 16#FFFE# .. 16#FFFF# are also invalid since + -- they conflict with codes used for BOM values. + + -- Thus all remaining codes are invalid + + else + Raise_Encoding_Error (Iptr - 1); + end if; + end loop; + + return Result (1 .. Len); + end Decode; + + ------------ + -- Encode -- + ------------ + + -- Encode Wide_String in UTF-8, UTF-16BE or UTF-16LE + + function Encode + (Item : Wide_String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String + is + begin + -- Case of UTF_8 + + if Output_Scheme = UTF_8 then + return Encode (Item, Output_BOM); + + -- Case of UTF_16LE or UTF_16BE, use UTF-16 intermediary + + else + return From_UTF_16 (UTF_16_Wide_String'(Encode (Item)), + Output_Scheme, Output_BOM); + end if; + end Encode; + + -- Encode Wide_String in UTF-8 + + function Encode + (Item : Wide_String; + Output_BOM : Boolean := False) return UTF_8_String + is + Result : UTF_8_String (1 .. 3 * Item'Length + 3); + -- Worst case is three bytes per input byte + space for BOM + + Len : Natural; + -- Number of output codes stored in Result + + C : Unsigned_16; + -- Single input character + + procedure Store (C : Unsigned_16); + pragma Inline (Store); + -- Store one output code, C is in the range 0 .. 255 + + ----------- + -- Store -- + ----------- + + procedure Store (C : Unsigned_16) is + begin + Len := Len + 1; + Result (Len) := Character'Val (C); + end Store; + + -- Start of processing for UTF8_Encode + + begin + -- Output BOM if required + + if Output_BOM then + Result (1 .. 3) := BOM_8; + Len := 3; + else + Len := 0; + end if; + + -- Loop through characters of input + + for J in Item'Range loop + C := To_Unsigned_16 (Item (J)); + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + Store (C); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + elsif C <= 16#7FF# then + Store (2#110_00000# or Shift_Right (C, 6)); + Store (2#10_000000# or (C and 2#00_111111#)); + + -- Codes in the range 16#800# - 16#FFFF# are represented as + -- 1110yyyy 10yyyyxx 10xxxxxx + + else + Store (2#1110_0000# or Shift_Right (C, 12)); + Store (2#10_000000# or + Shift_Right (C and 2#111111_000000#, 6)); + Store (2#10_000000# or (C and 2#00_111111#)); + end if; + end loop; + + return Result (1 .. Len); + end Encode; + + -- Encode Wide_String in UTF-16 + + function Encode + (Item : Wide_String; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + Result : UTF_16_Wide_String + (1 .. Item'Length + Boolean'Pos (Output_BOM)); + -- Output is same length as input + possible BOM + + Len : Integer; + -- Length of output string + + C : Unsigned_16; + + begin + -- Output BOM if required + + if Output_BOM then + Result (1) := BOM_16 (1); + Len := 1; + else + Len := 0; + end if; + + -- Loop through input characters encoding them + + for Iptr in Item'Range loop + C := To_Unsigned_16 (Item (Iptr)); + + -- Codes in the range 16#0000#..16#D7FF# or 16#E000#..16#FFFD# are + -- output unchanged. + + if C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then + Len := Len + 1; + Result (Len) := Wide_Character'Val (C); + + -- Codes in the range 16#D800#..16#DFFF# should never appear in the + -- input, since no valid Unicode characters are in this range (which + -- would conflict with the UTF-16 surrogate encodings). Similarly + -- codes in the range 16#FFFE#..16#FFFF conflict with BOM codes. + -- Thus all remaining codes are illegal. + + else + Raise_Encoding_Error (Iptr); + end if; + end loop; + + return Result; + end Encode; + + end Ada.Strings.UTF_Encoding.Wide_Strings; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suewst.ads gcc-4.6.0/gcc/ada/a-suewst.ads *** gcc-4.5.2/gcc/ada/a-suewst.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suewst.ads Mon Oct 11 08:23:31 2010 *************** *** 0 **** --- 1,67 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding + -- and decoding Wide_String values using UTF encodings. Note: this package is + -- consistent with Ada 95, and may be included in Ada 95 implementations. + + package Ada.Strings.UTF_Encoding.Wide_Strings is + pragma Pure (Wide_Strings); + + -- The encoding routines take a Wide_String as input and encode the result + -- using the specified UTF encoding method. The result includes a BOM if + -- the Output_BOM argument is set to True. Encoding_Error is raised if an + -- invalid character appears in the input. In particular the characters + -- in the range 16#D800# .. 16#DFFF# are invalid because they conflict + -- with UTF-16 surrogate encodings, and the characters 16#FFFE# and + -- 16#FFFF# are also invalid because they conflict with BOM codes. + + function Encode + (Item : Wide_String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String; + -- Encode Wide_String using UTF-8, UTF-16LE or UTF-16BE encoding as + -- specified by the Output_Scheme parameter. + + function Encode + (Item : Wide_String; + Output_BOM : Boolean := False) return UTF_8_String; + -- Encode Wide_String using UTF-8 encoding + + function Encode + (Item : Wide_String; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- Encode Wide_String using UTF_16 encoding + + -- The decoding routines take a UTF String as input, and return a decoded + -- Wide_String. If the UTF String starts with a BOM that matches the + -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error. + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return Wide_String; + -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the + -- Input_Scheme parameter. It is decoded and returned as a Wide_String + -- value. Note: a convenient form for scheme may be Encoding (UTF_String). + + function Decode + (Item : UTF_8_String) return Wide_String; + -- The input is encoded in UTF-8 and returned as a Wide_String value + + function Decode + (Item : UTF_16_Wide_String) return Wide_String; + -- The input is encoded in UTF-16 and returned as a Wide_String value + + end Ada.Strings.UTF_Encoding.Wide_Strings; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suezst.adb gcc-4.6.0/gcc/ada/a-suezst.adb *** gcc-4.5.2/gcc/ada/a-suezst.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suezst.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,429 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRINGS -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.UTF_Encoding.Wide_Wide_Strings is + use Interfaces; + + ------------ + -- Decode -- + ------------ + + -- Decode UTF-8/UTF-16BE/UTF-16LE input to Wide_Wide_String + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return Wide_Wide_String + is + begin + if Input_Scheme = UTF_8 then + return Decode (Item); + else + return Decode (To_UTF_16 (Item, Input_Scheme)); + end if; + end Decode; + + -- Decode UTF-8 input to Wide_Wide_String + + function Decode (Item : UTF_8_String) return Wide_Wide_String is + Result : Wide_Wide_String (1 .. Item'Length); + -- Result string (worst case is same length as input) + + Len : Natural := 0; + -- Length of result stored so far + + Iptr : Natural; + -- Input string pointer + + C : Unsigned_8; + R : Unsigned_32; + + procedure Get_Continuation; + -- Reads a continuation byte of the form 10xxxxxx, shifts R left + -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On + -- return Ptr is incremented. Raises exception if continuation + -- byte does not exist or is invalid. + + ---------------------- + -- Get_Continuation -- + ---------------------- + + procedure Get_Continuation is + begin + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + + else + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + if C not in 2#10_000000# .. 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + else + R := Shift_Left (R, 6) or Unsigned_32 (C and 2#00_111111#); + end if; + end if; + end Get_Continuation; + + -- Start of processing for Decode + + begin + Iptr := Item'First; + + -- Skip BOM at start + + if Item'Length >= 3 + and then Item (Iptr .. Iptr + 2) = BOM_8 + then + Iptr := Iptr + 3; + + -- Error if bad BOM + + elsif Item'Length >= 2 + and then (Item (Iptr .. Iptr + 1) = BOM_16BE + or else + Item (Iptr .. Iptr + 1) = BOM_16LE) + then + Raise_Encoding_Error (Iptr); + end if; + + -- Loop through input characters + + while Iptr <= Item'Last loop + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + R := Unsigned_32 (C); + + -- No initial code can be of the form 10xxxxxx. Such codes are used + -- only for continuations. + + elsif C <= 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + elsif C <= 2#110_11111# then + R := Unsigned_32 (C and 2#000_11111#); + Get_Continuation; + + -- Codes in the range 16#800# - 16#FFFF# are represented as + -- 1110yyyy 10yyyyxx 10xxxxxx + + elsif C <= 2#1110_1111# then + R := Unsigned_32 (C and 2#0000_1111#); + Get_Continuation; + Get_Continuation; + + -- Codes in the range 16#10000# - 16#10FFFF# are represented as + -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + + elsif C <= 2#11110_111# then + R := Unsigned_32 (C and 2#00000_111#); + Get_Continuation; + Get_Continuation; + Get_Continuation; + + -- Any other code is an error + + else + Raise_Encoding_Error (Iptr - 1); + end if; + + Len := Len + 1; + Result (Len) := Wide_Wide_Character'Val (R); + end loop; + + return Result (1 .. Len); + end Decode; + + -- Decode UTF-16 input to Wide_Wide_String + + function Decode (Item : UTF_16_Wide_String) return Wide_Wide_String is + Result : Wide_Wide_String (1 .. Item'Length); + -- Result cannot be longer than the input string + + Len : Natural := 0; + -- Length of result + + Iptr : Natural; + -- Pointer to next element in Item + + C : Unsigned_16; + R : Unsigned_32; + + begin + -- Skip UTF-16 BOM at start + + Iptr := Item'First; + + if Iptr <= Item'Last and then Item (Iptr) = BOM_16 (1) then + Iptr := Iptr + 1; + end if; + + -- Loop through input characters + + while Iptr <= Item'Last loop + C := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#0000#..16#D7FF# or 16#E000#..16#FFFD# + -- represent their own value. + + if C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then + Len := Len + 1; + Result (Len) := Wide_Wide_Character'Val (C); + + -- Codes in the range 16#D800#..16#DBFF# represent the first of the + -- two surrogates used to encode the range 16#01_000#..16#10_FFFF". + -- The first surrogate provides 10 high order bits of the result. + + elsif C <= 16#DBFF# then + R := Shift_Left ((Unsigned_32 (C) - 16#D800#), 10); + + -- Error if at end of string + + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + + -- Otherwise next character must be valid low order surrogate + -- which provides the low 10 order bits of the result. + + else + C := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + + if C not in 16#DC00# .. 16#DFFF# then + Raise_Encoding_Error (Iptr - 1); + + else + R := R or (Unsigned_32 (C) mod 2 ** 10); + + -- The final adjustment is to add 16#01_0000 to get the + -- result back in the required 21 bit range. + + R := R + 16#01_0000#; + Len := Len + 1; + Result (Len) := Wide_Wide_Character'Val (R); + end if; + end if; + + -- Remaining codes are invalid + + else + Raise_Encoding_Error (Iptr - 1); + end if; + end loop; + + return Result (1 .. Len); + end Decode; + + ------------ + -- Encode -- + ------------ + + -- Encode Wide_Wide_String in UTF-8, UTF-16BE or UTF-16LE + + function Encode + (Item : Wide_Wide_String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String + is + begin + if Output_Scheme = UTF_8 then + return Encode (Item, Output_BOM); + else + return From_UTF_16 (Encode (Item), Output_Scheme, Output_BOM); + end if; + end Encode; + + -- Encode Wide_Wide_String in UTF-8 + + function Encode + (Item : Wide_Wide_String; + Output_BOM : Boolean := False) return UTF_8_String + is + Result : String (1 .. 4 * Item'Length + 3); + -- Worst case is four bytes per input byte + space for BOM + + Len : Natural; + -- Number of output codes stored in Result + + C : Unsigned_32; + -- Single input character + + procedure Store (C : Unsigned_32); + pragma Inline (Store); + -- Store one output code (input is in range 0 .. 255) + + ----------- + -- Store -- + ----------- + + procedure Store (C : Unsigned_32) is + begin + Len := Len + 1; + Result (Len) := Character'Val (C); + end Store; + + -- Start of processing for Encode + + begin + -- Output BOM if required + + if Output_BOM then + Result (1 .. 3) := BOM_8; + Len := 3; + else + Len := 0; + end if; + + -- Loop through characters of input + + for Iptr in Item'Range loop + C := To_Unsigned_32 (Item (Iptr)); + + -- Codes in the range 16#00#..16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + Store (C); + + -- Codes in the range 16#80#..16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + elsif C <= 16#7FF# then + Store (2#110_00000# or Shift_Right (C, 6)); + Store (2#10_000000# or (C and 2#00_111111#)); + + -- Codes in the range 16#800#..16#D7FF# or 16#E000#..16#FFFD# are + -- represented as + -- 1110yyyy 10yyyyxx 10xxxxxx + + elsif C <= 16#D7FF# or else C in 16#E000# .. 16#FFFD# then + Store (2#1110_0000# or Shift_Right (C, 12)); + Store (2#10_000000# or + Shift_Right (C and 2#111111_000000#, 6)); + Store (2#10_000000# or (C and 2#00_111111#)); + + -- Codes in the range 16#10000# - 16#10FFFF# are represented as + -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + + elsif C in 16#1_0000# .. 16#10_FFFF# then + Store (2#11110_000# or + Shift_Right (C, 18)); + Store (2#10_000000# or + Shift_Right (C and 2#111111_000000_000000#, 12)); + Store (2#10_000000# or + Shift_Right (C and 2#111111_000000#, 6)); + Store (2#10_000000# or + (C and 2#00_111111#)); + + -- All other codes are invalid + + else + Raise_Encoding_Error (Iptr); + end if; + end loop; + + return Result (1 .. Len); + end Encode; + + -- Encode Wide_Wide_String in UTF-16 + + function Encode + (Item : Wide_Wide_String; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + Result : UTF_16_Wide_String (1 .. 2 * Item'Length + 1); + -- Worst case is each input character generates two output characters + -- plus one for possible BOM. + + Len : Integer; + -- Length of output string + + C : Unsigned_32; + + begin + -- Output BOM if needed + + if Output_BOM then + Result (1) := BOM_16 (1); + Len := 1; + else + Len := 0; + end if; + + -- Loop through input characters encoding them + + for Iptr in Item'Range loop + C := To_Unsigned_32 (Item (Iptr)); + + -- Codes in the range 16#00_0000#..16#00_D7FF# or 16#E000#..16#FFFD# + -- are output unchanged + + if C <= 16#00_D7FF# or else C in 16#E000# .. 16#FFFD# then + Len := Len + 1; + Result (Len) := Wide_Character'Val (C); + + -- Codes in the range 16#01_0000#..16#10_FFFF# are output using two + -- surrogate characters. First 16#1_0000# is subtracted from the code + -- point to give a 20-bit value. This is then split into two separate + -- 10-bit values each of which is represented as a surrogate with the + -- most significant half placed in the first surrogate. The ranges of + -- values used for the two surrogates are 16#D800#-16#DBFF# for the + -- first, most significant surrogate and 16#DC00#-16#DFFF# for the + -- second, least significant surrogate. + + elsif C in 16#1_0000# .. 16#10_FFFF# then + C := C - 16#1_0000#; + + Len := Len + 1; + Result (Len) := Wide_Character'Val (16#D800# + C / 2 ** 10); + + Len := Len + 1; + Result (Len) := Wide_Character'Val (16#DC00# + C mod 2 ** 10); + + -- All other codes are invalid + + else + Raise_Encoding_Error (Iptr); + end if; + end loop; + + return Result (1 .. Len); + end Encode; + + end Ada.Strings.UTF_Encoding.Wide_Wide_Strings; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suezst.ads gcc-4.6.0/gcc/ada/a-suezst.ads *** gcc-4.5.2/gcc/ada/a-suezst.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suezst.ads Mon Oct 11 08:23:31 2010 *************** *** 0 **** --- 1,64 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRINGS -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding + -- and decoding Wide_String values using UTF encodings. Note: this package is + -- consistent with Ada 2005, and may be used in Ada 2005 mode, but cannot be + -- used in Ada 95 mode, since Wide_Wide_Character is an Ada 2005 feature. + + package Ada.Strings.UTF_Encoding.Wide_Wide_Strings is + pragma Pure (Wide_Wide_Strings); + + -- The encoding routines take a Wide_Wide_String as input and encode the + -- result using the specified UTF encoding method. The result includes a + -- BOM if the Output_BOM parameter is set to True. + + function Encode + (Item : Wide_Wide_String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String; + -- Encode Wide_Wide_String using UTF-8, UTF-16LE or UTF-16BE encoding as + -- specified by the Output_Scheme parameter. + + function Encode + (Item : Wide_Wide_String; + Output_BOM : Boolean := False) return UTF_8_String; + -- Encode Wide_Wide_String using UTF-8 encoding + + function Encode + (Item : Wide_Wide_String; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- Encode Wide_Wide_String using UTF_16 encoding + + -- The decoding routines take a UTF String as input, and return a decoded + -- Wide_String. If the UTF String starts with a BOM that matches the + -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error. + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return Wide_Wide_String; + -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the + -- Input_Scheme parameter. It is decoded and returned as a Wide_Wide_String + -- value. Note: a convenient form for Scheme may be Encoding (UTF_String). + + function Decode + (Item : UTF_8_String) return Wide_Wide_String; + -- The input is encoded in UTF-8 and returned as a Wide_Wide_String value + + function Decode + (Item : UTF_16_Wide_String) return Wide_Wide_String; + -- The input is encoded in UTF-16 and returned as a Wide_String value + + end Ada.Strings.UTF_Encoding.Wide_Wide_Strings; diff -Nrcpad gcc-4.5.2/gcc/ada/a-suteio-shared.adb gcc-4.6.0/gcc/ada/a-suteio-shared.adb *** gcc-4.5.2/gcc/ada/a-suteio-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-suteio-shared.adb Wed Jun 23 12:51:37 2010 *************** *** 0 **** --- 1,132 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . U N B O U N D E D . T E X T _ I O -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1997-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Text_IO; use Ada.Text_IO; + + package body Ada.Strings.Unbounded.Text_IO is + + -------------- + -- Get_Line -- + -------------- + + function Get_Line return Unbounded_String is + Buffer : String (1 .. 1000); + Last : Natural; + Result : Unbounded_String; + + begin + Get_Line (Buffer, Last); + Set_Unbounded_String (Result, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (Buffer, Last); + Append (Result, Buffer (1 .. Last)); + end loop; + + return Result; + end Get_Line; + + function Get_Line (File : Ada.Text_IO.File_Type) return Unbounded_String is + Buffer : String (1 .. 1000); + Last : Natural; + Result : Unbounded_String; + + begin + Get_Line (File, Buffer, Last); + Set_Unbounded_String (Result, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (File, Buffer, Last); + Append (Result, Buffer (1 .. Last)); + end loop; + + return Result; + end Get_Line; + + procedure Get_Line (Item : out Unbounded_String) is + begin + Get_Line (Current_Input, Item); + end Get_Line; + + procedure Get_Line + (File : Ada.Text_IO.File_Type; + Item : out Unbounded_String) + is + Buffer : String (1 .. 1000); + Last : Natural; + + begin + Get_Line (File, Buffer, Last); + Set_Unbounded_String (Item, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (File, Buffer, Last); + Append (Item, Buffer (1 .. Last)); + end loop; + end Get_Line; + + --------- + -- Put -- + --------- + + procedure Put (U : Unbounded_String) is + UR : constant Shared_String_Access := U.Reference; + + begin + Put (UR.Data (1 .. UR.Last)); + end Put; + + procedure Put (File : File_Type; U : Unbounded_String) is + UR : constant Shared_String_Access := U.Reference; + + begin + Put (File, UR.Data (1 .. UR.Last)); + end Put; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (U : Unbounded_String) is + UR : constant Shared_String_Access := U.Reference; + + begin + Put_Line (UR.Data (1 .. UR.Last)); + end Put_Line; + + procedure Put_Line (File : File_Type; U : Unbounded_String) is + UR : constant Shared_String_Access := U.Reference; + + begin + Put_Line (File, UR.Data (1 .. UR.Last)); + end Put_Line; + + end Ada.Strings.Unbounded.Text_IO; diff -Nrcpad gcc-4.5.2/gcc/ada/a-swunau-shared.adb gcc-4.6.0/gcc/ada/a-swunau-shared.adb *** gcc-4.5.2/gcc/ada/a-swunau-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-swunau-shared.adb Wed Jun 23 12:51:37 2010 *************** *** 0 **** --- 1,65 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . W I D E _ U N B O U N D E D . A U X -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.Wide_Unbounded.Aux is + + --------------------- + -- Get_Wide_String -- + --------------------- + + procedure Get_Wide_String + (U : Unbounded_Wide_String; + S : out Big_Wide_String_Access; + L : out Natural) + is + X : aliased Big_Wide_String; + for X'Address use U.Reference.Data'Address; + begin + S := X'Unchecked_Access; + L := U.Reference.Last; + end Get_Wide_String; + + --------------------- + -- Set_Wide_String -- + --------------------- + + procedure Set_Wide_String + (UP : in out Unbounded_Wide_String; + S : Wide_String_Access) + is + X : Wide_String_Access := S; + + begin + Set_Unbounded_Wide_String (UP, S.all); + Free (X); + end Set_Wide_String; + + end Ada.Strings.Wide_Unbounded.Aux; diff -Nrcpad gcc-4.5.2/gcc/ada/a-swunau.adb gcc-4.6.0/gcc/ada/a-swunau.adb *** gcc-4.5.2/gcc/ada/a-swunau.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-swunau.adb Fri Jun 18 12:29:49 2010 *************** package body Ada.Strings.Wide_Unbounded. *** 37,47 **** procedure Get_Wide_String (U : Unbounded_Wide_String; ! S : out Wide_String_Access; L : out Natural) is begin ! S := U.Reference; L := U.Last; end Get_Wide_String; --- 37,50 ---- procedure Get_Wide_String (U : Unbounded_Wide_String; ! S : out Big_Wide_String_Access; L : out Natural) is + X : aliased Big_Wide_String; + for X'Address use U.Reference.all'Address; + begin ! S := X'Unchecked_Access; L := U.Last; end Get_Wide_String; *************** package body Ada.Strings.Wide_Unbounded. *** 51,70 **** procedure Set_Wide_String (UP : in out Unbounded_Wide_String; - S : Wide_String) - is - begin - if S'Length > UP.Last then - Finalize (UP); - UP.Reference := new Wide_String (1 .. S'Length); - end if; - - UP.Reference (1 .. S'Length) := S; - UP.Last := S'Length; - end Set_Wide_String; - - procedure Set_Wide_String - (UP : in out Unbounded_Wide_String; S : Wide_String_Access) is begin --- 54,59 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/a-swunau.ads gcc-4.6.0/gcc/ada/a-swunau.ads *** gcc-4.5.2/gcc/ada/a-swunau.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-swunau.ads Fri Jun 18 12:29:49 2010 *************** *** 37,45 **** package Ada.Strings.Wide_Unbounded.Aux is pragma Preelaborate; procedure Get_Wide_String (U : Unbounded_Wide_String; ! S : out Wide_String_Access; L : out Natural); pragma Inline (Get_Wide_String); -- This procedure returns the internal string pointer used in the --- 37,48 ---- package Ada.Strings.Wide_Unbounded.Aux is pragma Preelaborate; + subtype Big_Wide_String is Wide_String (Positive'Range); + type Big_Wide_String_Access is access all Big_Wide_String; + procedure Get_Wide_String (U : Unbounded_Wide_String; ! S : out Big_Wide_String_Access; L : out Natural); pragma Inline (Get_Wide_String); -- This procedure returns the internal string pointer used in the *************** package Ada.Strings.Wide_Unbounded.Aux i *** 54,63 **** -- referenced string returned by this call is always one, so the actual -- string data is always accessible as S (1 .. L). ! procedure Set_Wide_String ! (UP : in out Unbounded_Wide_String; ! S : Wide_String); ! pragma Inline (Set_Wide_String); -- This function sets the string contents of the referenced unbounded -- string to the given string value. It is significantly more efficient -- than the use of To_Unbounded_Wide_String with an assignment, since it --- 57,64 ---- -- referenced string returned by this call is always one, so the actual -- string data is always accessible as S (1 .. L). ! procedure Set_Wide_String (UP : out Unbounded_Wide_String; S : Wide_String) ! renames Set_Unbounded_Wide_String; -- This function sets the string contents of the referenced unbounded -- string to the given string value. It is significantly more efficient -- than the use of To_Unbounded_Wide_String with an assignment, since it diff -Nrcpad gcc-4.5.2/gcc/ada/a-swuwti-shared.adb gcc-4.6.0/gcc/ada/a-swuwti-shared.adb *** gcc-4.5.2/gcc/ada/a-swuwti-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-swuwti-shared.adb Wed Jun 23 12:51:37 2010 *************** *** 0 **** --- 1,134 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.WIDE_UNBOUNDED.WIDE_TEXT_IO -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1997-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Wide_Text_IO; use Ada.Wide_Text_IO; + + package body Ada.Strings.Wide_Unbounded.Wide_Text_IO is + + -------------- + -- Get_Line -- + -------------- + + function Get_Line return Unbounded_Wide_String is + Buffer : Wide_String (1 .. 1000); + Last : Natural; + Result : Unbounded_Wide_String; + + begin + Get_Line (Buffer, Last); + Set_Unbounded_Wide_String (Result, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (Buffer, Last); + Append (Result, Buffer (1 .. Last)); + end loop; + + return Result; + end Get_Line; + + function Get_Line + (File : Ada.Wide_Text_IO.File_Type) return Unbounded_Wide_String + is + Buffer : Wide_String (1 .. 1000); + Last : Natural; + Result : Unbounded_Wide_String; + + begin + Get_Line (File, Buffer, Last); + Set_Unbounded_Wide_String (Result, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (File, Buffer, Last); + Append (Result, Buffer (1 .. Last)); + end loop; + + return Result; + end Get_Line; + + procedure Get_Line (Item : out Unbounded_Wide_String) is + begin + Get_Line (Current_Input, Item); + end Get_Line; + + procedure Get_Line + (File : Ada.Wide_Text_IO.File_Type; + Item : out Unbounded_Wide_String) + is + Buffer : Wide_String (1 .. 1000); + Last : Natural; + + begin + Get_Line (File, Buffer, Last); + Set_Unbounded_Wide_String (Item, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (File, Buffer, Last); + Append (Item, Buffer (1 .. Last)); + end loop; + end Get_Line; + + --------- + -- Put -- + --------- + + procedure Put (U : Unbounded_Wide_String) is + UR : constant Shared_Wide_String_Access := U.Reference; + + begin + Put (UR.Data (1 .. UR.Last)); + end Put; + + procedure Put (File : File_Type; U : Unbounded_Wide_String) is + UR : constant Shared_Wide_String_Access := U.Reference; + + begin + Put (File, UR.Data (1 .. UR.Last)); + end Put; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (U : Unbounded_Wide_String) is + UR : constant Shared_Wide_String_Access := U.Reference; + + begin + Put_Line (UR.Data (1 .. UR.Last)); + end Put_Line; + + procedure Put_Line (File : File_Type; U : Unbounded_Wide_String) is + UR : constant Shared_Wide_String_Access := U.Reference; + + begin + Put_Line (File, UR.Data (1 .. UR.Last)); + end Put_Line; + + end Ada.Strings.Wide_Unbounded.Wide_Text_IO; diff -Nrcpad gcc-4.5.2/gcc/ada/a-szunau-shared.adb gcc-4.6.0/gcc/ada/a-szunau-shared.adb *** gcc-4.5.2/gcc/ada/a-szunau-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-szunau-shared.adb Wed Jun 23 12:51:37 2010 *************** *** 0 **** --- 1,65 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D . A U X -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + package body Ada.Strings.Wide_Wide_Unbounded.Aux is + + -------------------------- + -- Get_Wide_Wide_String -- + -------------------------- + + procedure Get_Wide_Wide_String + (U : Unbounded_Wide_Wide_String; + S : out Big_Wide_Wide_String_Access; + L : out Natural) + is + X : aliased Big_Wide_Wide_String; + for X'Address use U.Reference.Data'Address; + begin + S := X'Unchecked_Access; + L := U.Reference.Last; + end Get_Wide_Wide_String; + + -------------------------- + -- Set_Wide_Wide_String -- + -------------------------- + + procedure Set_Wide_Wide_String + (UP : in out Unbounded_Wide_Wide_String; + S : Wide_Wide_String_Access) + is + X : Wide_Wide_String_Access := S; + + begin + Set_Unbounded_Wide_Wide_String (UP, S.all); + Free (X); + end Set_Wide_Wide_String; + + end Ada.Strings.Wide_Wide_Unbounded.Aux; diff -Nrcpad gcc-4.5.2/gcc/ada/a-szunau.adb gcc-4.6.0/gcc/ada/a-szunau.adb *** gcc-4.5.2/gcc/ada/a-szunau.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-szunau.adb Fri Jun 18 12:29:49 2010 *************** *** 31,67 **** package body Ada.Strings.Wide_Wide_Unbounded.Aux is ! -------------------- -- Get_Wide_Wide_String -- ! --------------------- procedure Get_Wide_Wide_String (U : Unbounded_Wide_Wide_String; ! S : out Wide_Wide_String_Access; L : out Natural) is begin ! S := U.Reference; L := U.Last; end Get_Wide_Wide_String; ! --------------------- -- Set_Wide_Wide_String -- ! --------------------- ! ! procedure Set_Wide_Wide_String ! (UP : in out Unbounded_Wide_Wide_String; ! S : Wide_Wide_String) ! is ! begin ! if S'Length > UP.Last then ! Finalize (UP); ! UP.Reference := new Wide_Wide_String (1 .. S'Length); ! end if; ! ! UP.Reference (1 .. S'Length) := S; ! UP.Last := S'Length; ! end Set_Wide_Wide_String; procedure Set_Wide_Wide_String (UP : in out Unbounded_Wide_Wide_String; --- 31,56 ---- package body Ada.Strings.Wide_Wide_Unbounded.Aux is ! -------------------------- -- Get_Wide_Wide_String -- ! -------------------------- procedure Get_Wide_Wide_String (U : Unbounded_Wide_Wide_String; ! S : out Big_Wide_Wide_String_Access; L : out Natural) is + X : aliased Big_Wide_Wide_String; + for X'Address use U.Reference.all'Address; + begin ! S := X'Unchecked_Access; L := U.Last; end Get_Wide_Wide_String; ! -------------------------- -- Set_Wide_Wide_String -- ! -------------------------- procedure Set_Wide_Wide_String (UP : in out Unbounded_Wide_Wide_String; diff -Nrcpad gcc-4.5.2/gcc/ada/a-szunau.ads gcc-4.6.0/gcc/ada/a-szunau.ads *** gcc-4.5.2/gcc/ada/a-szunau.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-szunau.ads Fri Jun 18 12:29:49 2010 *************** *** 37,45 **** package Ada.Strings.Wide_Wide_Unbounded.Aux is pragma Preelaborate; procedure Get_Wide_Wide_String (U : Unbounded_Wide_Wide_String; ! S : out Wide_Wide_String_Access; L : out Natural); pragma Inline (Get_Wide_Wide_String); -- This procedure returns the internal string pointer used in the --- 37,48 ---- package Ada.Strings.Wide_Wide_Unbounded.Aux is pragma Preelaborate; + subtype Big_Wide_Wide_String is Wide_Wide_String (Positive); + type Big_Wide_Wide_String_Access is access all Big_Wide_Wide_String; + procedure Get_Wide_Wide_String (U : Unbounded_Wide_Wide_String; ! S : out Big_Wide_Wide_String_Access; L : out Natural); pragma Inline (Get_Wide_Wide_String); -- This procedure returns the internal string pointer used in the *************** package Ada.Strings.Wide_Wide_Unbounded. *** 55,63 **** -- string data is always accessible as S (1 .. L). procedure Set_Wide_Wide_String ! (UP : in out Unbounded_Wide_Wide_String; ! S : Wide_Wide_String); ! pragma Inline (Set_Wide_Wide_String); -- This function sets the string contents of the referenced unbounded -- string to the given string value. It is significantly more efficient -- than the use of To_Unbounded_Wide_Wide_String with an assignment, since --- 58,66 ---- -- string data is always accessible as S (1 .. L). procedure Set_Wide_Wide_String ! (UP : out Unbounded_Wide_Wide_String; ! S : Wide_Wide_String) ! renames Set_Unbounded_Wide_Wide_String; -- This function sets the string contents of the referenced unbounded -- string to the given string value. It is significantly more efficient -- than the use of To_Unbounded_Wide_Wide_String with an assignment, since diff -Nrcpad gcc-4.5.2/gcc/ada/a-szuzti-shared.adb gcc-4.6.0/gcc/ada/a-szuzti-shared.adb *** gcc-4.5.2/gcc/ada/a-szuzti-shared.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-szuzti-shared.adb Wed Jun 23 12:51:37 2010 *************** *** 0 **** --- 1,135 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- ADA.STRINGS.WIDE_UNBOUNDED.WIDE_TEXT_IO -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1997-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO; + + package body Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO is + + -------------- + -- Get_Line -- + -------------- + + function Get_Line return Unbounded_Wide_Wide_String is + Buffer : Wide_Wide_String (1 .. 1000); + Last : Natural; + Result : Unbounded_Wide_Wide_String; + + begin + Get_Line (Buffer, Last); + Set_Unbounded_Wide_Wide_String (Result, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (Buffer, Last); + Append (Result, Buffer (1 .. Last)); + end loop; + + return Result; + end Get_Line; + + function Get_Line + (File : Ada.Wide_Wide_Text_IO.File_Type) + return Unbounded_Wide_Wide_String + is + Buffer : Wide_Wide_String (1 .. 1000); + Last : Natural; + Result : Unbounded_Wide_Wide_String; + + begin + Get_Line (File, Buffer, Last); + Set_Unbounded_Wide_Wide_String (Result, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (File, Buffer, Last); + Append (Result, Buffer (1 .. Last)); + end loop; + + return Result; + end Get_Line; + + procedure Get_Line (Item : out Unbounded_Wide_Wide_String) is + begin + Get_Line (Current_Input, Item); + end Get_Line; + + procedure Get_Line + (File : Ada.Wide_Wide_Text_IO.File_Type; + Item : out Unbounded_Wide_Wide_String) + is + Buffer : Wide_Wide_String (1 .. 1000); + Last : Natural; + + begin + Get_Line (File, Buffer, Last); + Set_Unbounded_Wide_Wide_String (Item, Buffer (1 .. Last)); + + while Last = Buffer'Last loop + Get_Line (File, Buffer, Last); + Append (Item, Buffer (1 .. Last)); + end loop; + end Get_Line; + + --------- + -- Put -- + --------- + + procedure Put (U : Unbounded_Wide_Wide_String) is + UR : constant Shared_Wide_Wide_String_Access := U.Reference; + + begin + Put (UR.Data (1 .. UR.Last)); + end Put; + + procedure Put (File : File_Type; U : Unbounded_Wide_Wide_String) is + UR : constant Shared_Wide_Wide_String_Access := U.Reference; + + begin + Put (File, UR.Data (1 .. UR.Last)); + end Put; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (U : Unbounded_Wide_Wide_String) is + UR : constant Shared_Wide_Wide_String_Access := U.Reference; + + begin + Put_Line (UR.Data (1 .. UR.Last)); + end Put_Line; + + procedure Put_Line (File : File_Type; U : Unbounded_Wide_Wide_String) is + UR : constant Shared_Wide_Wide_String_Access := U.Reference; + + begin + Put_Line (File, UR.Data (1 .. UR.Last)); + end Put_Line; + + end Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; diff -Nrcpad gcc-4.5.2/gcc/ada/a-tags.adb gcc-4.6.0/gcc/ada/a-tags.adb *** gcc-4.5.2/gcc/ada/a-tags.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-tags.adb Thu Oct 7 09:08:36 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Tags is *** 949,954 **** --- 949,972 ---- SSD (T).SSD_Table (Position).Kind := Value; end Set_Prim_Op_Kind; + ---------------------- + -- Type_Is_Abstract -- + ---------------------- + + function Type_Is_Abstract (T : Tag) return Boolean is + TSD_Ptr : Addr_Ptr; + TSD : Type_Specific_Data_Ptr; + + begin + if T = No_Tag then + raise Tag_Error; + end if; + + TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); + TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all); + return TSD.Type_Is_Abstract; + end Type_Is_Abstract; + ------------------------ -- Wide_Expanded_Name -- ------------------------ diff -Nrcpad gcc-4.5.2/gcc/ada/a-tags.ads gcc-4.6.0/gcc/ada/a-tags.ads *** gcc-4.5.2/gcc/ada/a-tags.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-tags.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** package Ada.Tags is *** 75,80 **** --- 75,83 ---- function Interface_Ancestor_Tags (T : Tag) return Tag_Array; pragma Ada_05 (Interface_Ancestor_Tags); + function Type_Is_Abstract (T : Tag) return Boolean; + pragma Ada_2012 (Type_Is_Abstract); + Tag_Error : exception; private *************** private *** 101,107 **** -- +-------------------+ -- | hash table link | -- +-------------------+ ! -- | remotely callable | -- +-------------------+ -- | rec ctrler offset | -- +-------------------+ --- 104,112 ---- -- +-------------------+ -- | hash table link | -- +-------------------+ ! -- | transportable | ! -- +-------------------+ ! -- | type_is_abstract | -- +-------------------+ -- | rec ctrler offset | -- +-------------------+ *************** private *** 115,121 **** -- +------------------+ +-------------------+ +------------+ -- |table of | -- : entry : ! -- | indices | -- +------------------+ -- Structure of the GNAT Secondary Dispatch Table --- 120,126 ---- -- +------------------+ +-------------------+ +------------+ -- |table of | -- : entry : ! -- | indexes | -- +------------------+ -- Structure of the GNAT Secondary Dispatch Table *************** private *** 280,285 **** --- 285,293 ---- -- for being used in remote calls as actuals for classwide formals or as -- return values for classwide functions. + Type_Is_Abstract : Boolean; + -- True if the type is abstract (Ada 2012: AI05-0173) + RC_Offset : SSE.Storage_Offset; -- Controller Offset: Used to give support to tagged controlled objects -- (see Get_Deep_Controller at s-finimp) diff -Nrcpad gcc-4.5.2/gcc/ada/a-textio.adb gcc-4.6.0/gcc/ada/a-textio.adb *** gcc-4.5.2/gcc/ada/a-textio.adb Mon Nov 30 14:28:21 2009 --- gcc-4.6.0/gcc/ada/a-textio.adb Mon Oct 11 08:23:31 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,41 **** -- -- ------------------------------------------------------------------------------ ! with Ada.Streams; use Ada.Streams; ! with Interfaces.C_Streams; use Interfaces.C_Streams; with System.File_IO; with System.CRTL; ! with System.WCh_Cnv; use System.WCh_Cnv; ! with System.WCh_Con; use System.WCh_Con; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; --- 29,41 ---- -- -- ------------------------------------------------------------------------------ ! with Ada.Streams; use Ada.Streams; ! with Interfaces.C_Streams; use Interfaces.C_Streams; with System.File_IO; with System.CRTL; ! with System.WCh_Cnv; use System.WCh_Cnv; ! with System.WCh_Con; use System.WCh_Con; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; *************** package body Ada.Text_IO is *** 691,803 **** procedure Get_Line (File : File_Type; Item : out String; ! Last : out Natural) ! is ! ch : int; ! ! begin ! FIO.Check_Read_Status (AP (File)); ! Last := Item'First - 1; ! ! -- Immediate exit for null string, this is a case in which we do not ! -- need to test for end of file and we do not skip a line mark under ! -- any circumstances. ! ! if Last >= Item'Last then ! return; ! end if; ! ! -- Here we have at least one character, if we are immediately before ! -- a line mark, then we will just skip past it storing no characters. ! ! if File.Before_LM then ! File.Before_LM := False; ! File.Before_LM_PM := False; ! ! -- Otherwise we need to read some characters ! ! else ! ch := Getc (File); ! ! -- If we are at the end of file now, it means we are trying to ! -- skip a file terminator and we raise End_Error (RM A.10.7(20)) ! ! if ch = EOF then ! raise End_Error; ! end if; ! ! -- Loop through characters. Don't bother if we hit a page mark, ! -- since in normal files, page marks can only follow line marks ! -- in any case and we only promise to treat the page nonsense ! -- correctly in the absense of such rogue page marks. ! ! loop ! -- Exit the loop if read is terminated by encountering line mark ! ! exit when ch = LM; ! ! -- Otherwise store the character, note that we know that ch is ! -- something other than LM or EOF. It could possibly be a page ! -- mark if there is a stray page mark in the middle of a line, ! -- but this is not an official page mark in any case, since ! -- official page marks can only follow a line mark. The whole ! -- page business is pretty much nonsense anyway, so we do not ! -- want to waste time trying to make sense out of non-standard ! -- page marks in the file! This means that the behavior of ! -- Get_Line is different from repeated Get of a character, but ! -- that's too bad. We only promise that page numbers etc make ! -- sense if the file is formatted in a standard manner. ! ! -- Note: we do not adjust the column number because it is quicker ! -- to adjust it once at the end of the operation than incrementing ! -- it each time around the loop. ! ! Last := Last + 1; ! Item (Last) := Character'Val (ch); ! ! -- All done if the string is full, this is the case in which ! -- we do not skip the following line mark. We need to adjust ! -- the column number in this case. ! ! if Last = Item'Last then ! File.Col := File.Col + Count (Item'Length); ! return; ! end if; ! ! -- Otherwise read next character. We also exit from the loop if ! -- we read an end of file. This is the case where the last line ! -- is not terminated with a line mark, and we consider that there ! -- is an implied line mark in this case (this is a non-standard ! -- file, but it is nice to treat it reasonably). ! ! ch := Getc (File); ! exit when ch = EOF; ! end loop; ! end if; ! ! -- We have skipped past, but not stored, a line mark. Skip following ! -- page mark if one follows, but do not do this for a non-regular ! -- file (since otherwise we get annoying wait for an extra character) ! ! File.Line := File.Line + 1; ! File.Col := 1; ! ! if File.Before_LM_PM then ! File.Line := 1; ! File.Before_LM_PM := False; ! File.Page := File.Page + 1; ! ! elsif File.Is_Regular_File then ! ch := Getc (File); ! ! if ch = PM and then File.Is_Regular_File then ! File.Line := 1; ! File.Page := File.Page + 1; ! else ! Ungetc (ch, File); ! end if; ! end if; ! end Get_Line; procedure Get_Line (Item : out String; --- 691,701 ---- procedure Get_Line (File : File_Type; Item : out String; ! Last : out Natural) is separate; ! -- The implementation of Ada.Text_IO.Get_Line is split into a subunit so ! -- that different implementations can be used on different systems. In ! -- particular the standard implementation uses low level stuff that is ! -- not appropriate for the JVM and .NET implementations. procedure Get_Line (Item : out String; diff -Nrcpad gcc-4.5.2/gcc/ada/a-tifiio.adb gcc-4.6.0/gcc/ada/a-tifiio.adb *** gcc-4.5.2/gcc/ada/a-tifiio.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/a-tifiio.adb Mon Jun 21 13:35:58 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ada.Text_IO.Fixed_IO is *** 301,310 **** (To : out String; Last : out Natural; Item : Num; ! Fore : Field; Aft : Field; Exp : Field); ! -- Actual output function, used internally by all other Put routines --------- -- Get -- --- 301,314 ---- (To : out String; Last : out Natural; Item : Num; ! Fore : Integer; Aft : Field; Exp : Field); ! -- Actual output function, used internally by all other Put routines. ! -- The formal Fore is an Integer, not a Field, because the routine is ! -- also called from the version of Put that performs I/O to a string, ! -- where the starting position depends on the size of the String, and ! -- bears no relation to the bounds of Field. --------- -- Get -- *************** package body Ada.Text_IO.Fixed_IO is *** 392,398 **** Last : Natural; begin ! if Fore - Boolean'Pos (Item < 0.0) < 1 or else Fore > Field'Last then raise Layout_Error; end if; --- 396,402 ---- Last : Natural; begin ! if Fore - Boolean'Pos (Item < 0.0) < 1 then raise Layout_Error; end if; *************** package body Ada.Text_IO.Fixed_IO is *** 407,413 **** (To : out String; Last : out Natural; Item : Num; ! Fore : Field; Aft : Field; Exp : Field) is --- 411,417 ---- (To : out String; Last : out Natural; Item : Num; ! Fore : Integer; Aft : Field; Exp : Field) is diff -Nrcpad gcc-4.5.2/gcc/ada/a-tigeli.adb gcc-4.6.0/gcc/ada/a-tigeli.adb *** gcc-4.5.2/gcc/ada/a-tigeli.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-tigeli.adb Mon Oct 11 07:30:09 2010 *************** *** 0 **** --- 1,227 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . T E X T _ I O . G E T _ L I N E -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- The implementation of Ada.Text_IO.Get_Line is split into a subunit so that + -- different implementations can be used on different systems. This is the + -- standard implementation (it uses low level features not suitable for use + -- in the JVM or .NET implementations). + + with System; use System; + with System.Storage_Elements; use System.Storage_Elements; + + separate (Ada.Text_IO) + procedure Get_Line + (File : File_Type; + Item : out String; + Last : out Natural) + is + Chunk_Size : constant := 80; + -- We read into a fixed size auxiliary buffer. Because this buffer + -- needs to be pre-initialized, there is a trade-off between size and + -- speed. Experiments find returns are diminishing after 50 and this + -- size allows most lines to be processed with a single read. + + ch : int; + N : Natural; + + procedure memcpy (s1, s2 : chars; n : size_t); + pragma Import (C, memcpy); + + function memchr (s : chars; ch : int; n : size_t) return chars; + pragma Import (C, memchr); + + procedure memset (b : chars; ch : int; n : size_t); + pragma Import (C, memset); + + function Get_Chunk (N : Positive) return Natural; + -- Reads at most N - 1 characters into Item (Last + 1 .. Item'Last), + -- updating Last. Raises End_Error if nothing was read (End_Of_File). + -- Returns number of characters still to read (either 0 or 1) in + -- case of success. + + --------------- + -- Get_Chunk -- + --------------- + + function Get_Chunk (N : Positive) return Natural is + Buf : String (1 .. Chunk_Size); + S : constant chars := Buf (1)'Address; + P : chars; + + begin + if N = 1 then + return N; + end if; + + memset (S, 10, size_t (N)); + + if fgets (S, N, File.Stream) = Null_Address then + if ferror (File.Stream) /= 0 then + raise Device_Error; + + -- If incomplete last line, pretend we found a LM + + elsif Last >= Item'First then + return 0; + + else + raise End_Error; + end if; + end if; + + P := memchr (S, LM, size_t (N)); + + -- If no LM is found, the buffer got filled without reading a new + -- line. Otherwise, the LM is either one from the input, or else one + -- from the initialization, which means an incomplete end-of-line was + -- encountered. Only in first case the LM will be followed by a 0. + + if P = Null_Address then + pragma Assert (Buf (N) = ASCII.NUL); + memcpy (Item (Last + 1)'Address, + Buf (1)'Address, size_t (N - 1)); + Last := Last + N - 1; + + return 1; + + else + -- P points to the LM character. Set K so Buf (K) is the character + -- right before. + + declare + K : Natural := Natural (P - S); + + begin + -- Now Buf (K + 2) should be 0, or otherwise Buf (K) is the 0 + -- put in by fgets, so compensate. + + if K + 2 > Buf'Last or else Buf (K + 2) /= ASCII.NUL then + + -- Incomplete last line, so remove the extra 0 + + pragma Assert (Buf (K) = ASCII.NUL); + K := K - 1; + end if; + + memcpy (Item (Last + 1)'Address, + Buf (1)'Address, size_t (K)); + Last := Last + K; + end; + + return 0; + end if; + end Get_Chunk; + + -- Start of processing for Get_Line + + begin + FIO.Check_Read_Status (AP (File)); + + -- Immediate exit for null string, this is a case in which we do not + -- need to test for end of file and we do not skip a line mark under + -- any circumstances. + + if Item'First > Item'Last then + return; + end if; + + N := Item'Last - Item'First + 1; + + Last := Item'First - 1; + + -- Here we have at least one character, if we are immediately before + -- a line mark, then we will just skip past it storing no characters. + + if File.Before_LM then + File.Before_LM := False; + File.Before_LM_PM := False; + + -- Otherwise we need to read some characters + + else + while N >= Chunk_Size loop + if Get_Chunk (Chunk_Size) = 0 then + N := 0; + else + N := N - Chunk_Size + 1; + end if; + end loop; + + if N > 1 then + N := Get_Chunk (N); + end if; + + -- Almost there, only a little bit more to read + + if N = 1 then + ch := Getc (File); + + -- If we get EOF after already reading data, this is an incomplete + -- last line, in which case no End_Error should be raised. + + if ch = EOF and then Last < Item'First then + raise End_Error; + + elsif ch /= LM then + + -- Buffer really is full without having seen LM, update col + + Last := Last + 1; + Item (Last) := Character'Val (ch); + File.Col := File.Col + Count (Last - Item'First + 1); + return; + end if; + end if; + end if; + + -- We have skipped past, but not stored, a line mark. Skip following + -- page mark if one follows, but do not do this for a non-regular file + -- (since otherwise we get annoying wait for an extra character) + + File.Line := File.Line + 1; + File.Col := 1; + + if File.Before_LM_PM then + File.Line := 1; + File.Before_LM_PM := False; + File.Page := File.Page + 1; + + elsif File.Is_Regular_File then + ch := Getc (File); + + if ch = PM and then File.Is_Regular_File then + File.Line := 1; + File.Page := File.Page + 1; + else + Ungetc (ch, File); + end if; + end if; + end Get_Line; diff -Nrcpad gcc-4.5.2/gcc/ada/a-wichha.adb gcc-4.6.0/gcc/ada/a-wichha.adb *** gcc-4.5.2/gcc/ada/a-wichha.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-wichha.adb Thu Oct 7 09:26:27 2010 *************** *** 0 **** --- 1,186 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . W I D E _ C H A R A C T E R S . H A N D L I N G -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Wide_Characters.Unicode; use Ada.Wide_Characters.Unicode; + + package body Ada.Wide_Characters.Handling is + + --------------------- + -- Is_Alphanumeric -- + --------------------- + + function Is_Alphanumeric (Item : Wide_Character) return Boolean is + begin + return Is_Letter (Item) or else Is_Digit (Item); + end Is_Alphanumeric; + + ---------------- + -- Is_Control -- + ---------------- + + function Is_Control (Item : Wide_Character) return Boolean is + begin + return Get_Category (Item) = Cc; + end Is_Control; + + -------------- + -- Is_Digit -- + -------------- + + function Is_Digit (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Digit; + + ---------------- + -- Is_Graphic -- + ---------------- + + function Is_Graphic (Item : Wide_Character) return Boolean is + begin + return not Is_Non_Graphic (Item); + end Is_Graphic; + + -------------------------- + -- Is_Hexadecimal_Digit -- + -------------------------- + + function Is_Hexadecimal_Digit (Item : Wide_Character) return Boolean is + begin + return Is_Digit (Item) + or else Item in 'A' .. 'F' + or else Item in 'a' .. 'f'; + end Is_Hexadecimal_Digit; + + --------------- + -- Is_Letter -- + --------------- + + function Is_Letter (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Letter; + + ------------------------ + -- Is_Line_Terminator -- + ------------------------ + + function Is_Line_Terminator (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Line_Terminator; + + -------------- + -- Is_Lower -- + -------------- + + function Is_Lower (Item : Wide_Character) return Boolean is + begin + return Get_Category (Item) = Ll; + end Is_Lower; + + ------------- + -- Is_Mark -- + ------------- + + function Is_Mark (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Mark; + + -------------- + -- Is_Other -- + -------------- + + function Is_Other (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Other; + + -------------------- + -- Is_Punctuation -- + -------------------- + + function Is_Punctuation (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Punctuation; + + -------------- + -- Is_Space -- + -------------- + + function Is_Space (Item : Wide_Character) return Boolean + renames Ada.Wide_Characters.Unicode.Is_Space; + + ---------------- + -- Is_Special -- + ---------------- + + function Is_Special (Item : Wide_Character) return Boolean is + begin + return Is_Graphic (Item) and then not Is_Alphanumeric (Item); + end Is_Special; + + -------------- + -- Is_Upper -- + -------------- + + function Is_Upper (Item : Wide_Character) return Boolean is + begin + return Get_Category (Item) = Lu; + end Is_Upper; + + -------------- + -- To_Lower -- + -------------- + + function To_Lower (Item : Wide_Character) return Wide_Character + renames Ada.Wide_Characters.Unicode.To_Lower_Case; + + function To_Lower (Item : Wide_String) return Wide_String is + Result : Wide_String (Item'Range); + + begin + for J in Result'Range loop + Result (J) := To_Lower (Item (J)); + end loop; + + return Result; + end To_Lower; + + -------------- + -- To_Upper -- + -------------- + + function To_Upper (Item : Wide_Character) return Wide_Character + renames Ada.Wide_Characters.Unicode.To_Upper_Case; + + function To_Upper (Item : Wide_String) return Wide_String is + Result : Wide_String (Item'Range); + + begin + for J in Result'Range loop + Result (J) := To_Upper (Item (J)); + end loop; + + return Result; + end To_Upper; + + end Ada.Wide_Characters.Handling; diff -Nrcpad gcc-4.5.2/gcc/ada/a-wichha.ads gcc-4.6.0/gcc/ada/a-wichha.ads *** gcc-4.5.2/gcc/ada/a-wichha.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-wichha.ads Thu Oct 7 09:26:27 2010 *************** *** 0 **** --- 1,120 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . W I D E _ C H A R A C T E R S . H A N D L I N G -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + package Ada.Wide_Characters.Handling is + + function Is_Control (Item : Wide_Character) return Boolean; + pragma Inline (Is_Control); + -- Returns True if the Wide_Character designated by Item is categorized as + -- other_control, otherwise returns false. + + function Is_Letter (Item : Wide_Character) return Boolean; + pragma Inline (Is_Letter); + -- Returns True if the Wide_Character designated by Item is categorized as + -- letter_uppercase, letter_lowercase, letter_titlecase, letter_modifier, + -- letter_other, or number_letter. Otherwise returns false. + + function Is_Lower (Item : Wide_Character) return Boolean; + pragma Inline (Is_Lower); + -- Returns True if the Wide_Character designated by Item is categorized as + -- letter_lowercase, otherwise returns false. + + function Is_Upper (Item : Wide_Character) return Boolean; + pragma Inline (Is_Upper); + -- Returns True if the Wide_Character designated by Item is categorized as + -- letter_uppercase, otherwise returns false. + + function Is_Digit (Item : Wide_Character) return Boolean; + pragma Inline (Is_Digit); + -- Returns True if the Wide_Character designated by Item is categorized as + -- number_decimal, otherwise returns false. + + function Is_Decimal_Digit (Item : Wide_Character) return Boolean + renames Is_Digit; + + function Is_Hexadecimal_Digit (Item : Wide_Character) return Boolean; + -- Returns True if the Wide_Character designated by Item is categorized as + -- number_decimal, or is in the range 'A' .. 'F' or 'a' .. 'f', otherwise + -- returns false. + + function Is_Alphanumeric (Item : Wide_Character) return Boolean; + pragma Inline (Is_Alphanumeric); + -- Returns True if the Wide_Character designated by Item is categorized as + -- number_decimal, or is in the range 'A' .. 'F' or 'a' .. 'f', otherwise + -- returns false. + + function Is_Special (Item : Wide_Character) return Boolean; + pragma Inline (Is_Special); + -- Returns True if the Wide_Character designated by Item is categorized + -- as graphic_character, but not categorized as letter_uppercase, + -- letter_lowercase, letter_titlecase, letter_modifier, letter_other, + -- number_letter, or number_decimal. Otherwise returns false. + + function Is_Line_Terminator (Item : Wide_Character) return Boolean; + pragma Inline (Is_Line_Terminator); + -- Returns True if the Wide_Character designated by Item is categorized as + -- separator_line or separator_paragraph, or if Item is a conventional line + -- terminator character (CR, LF, VT, or FF). Otherwise returns false. + + function Is_Mark (Item : Wide_Character) return Boolean; + pragma Inline (Is_Mark); + -- Returns True if the Wide_Character designated by Item is categorized as + -- mark_non_spacing or mark_spacing_combining, otherwise returns false. + + function Is_Other (Item : Wide_Character) return Boolean; + pragma Inline (Is_Other); + -- Returns True if the Wide_Character designated by Item is categorized as + -- other_format, otherwise returns false. + + function Is_Punctuation (Item : Wide_Character) return Boolean; + pragma Inline (Is_Punctuation); + -- Returns True if the Wide_Character designated by Item is categorized as + -- punctuation_connector, otherwise returns false. + + function Is_Space (Item : Wide_Character) return Boolean; + pragma Inline (Is_Space); + -- Returns True if the Wide_Character designated by Item is categorized as + -- separator_space, otherwise returns false. + + function Is_Graphic (Item : Wide_Character) return Boolean; + pragma Inline (Is_Graphic); + -- Returns True if the Wide_Character designated by Item is categorized as + -- graphic_character, otherwise returns false. + + function To_Lower (Item : Wide_Character) return Wide_Character; + pragma Inline (To_Lower); + -- Returns the Simple Lowercase Mapping of the Wide_Character designated by + -- Item. If the Simple Lowercase Mapping does not exist for the + -- Wide_Character designated by Item, then the value of Item is returned. + + function To_Lower (Item : Wide_String) return Wide_String; + -- Returns the result of applying the To_Lower Wide_Character to + -- Wide_Character conversion to each element of the Wide_String designated + -- by Item. The result is the null Wide_String if the value of the formal + -- parameter is the null Wide_String. + + function To_Upper (Item : Wide_Character) return Wide_Character; + pragma Inline (To_Upper); + -- Returns the Simple Uppercase Mapping of the Wide_Character designated by + -- Item. If the Simple Uppercase Mapping does not exist for the + -- Wide_Character designated by Item, then the value of Item is returned. + + function To_Upper (Item : Wide_String) return Wide_String; + -- Returns the result of applying the To_Upper Wide_Character to + -- Wide_Character conversion to each element of the Wide_String designated + -- by Item. The result is the null Wide_String if the value of the formal + -- parameter is the null Wide_String. + + end Ada.Wide_Characters.Handling; diff -Nrcpad gcc-4.5.2/gcc/ada/a-wichun.adb gcc-4.6.0/gcc/ada/a-wichun.adb *** gcc-4.5.2/gcc/ada/a-wichun.adb Fri Oct 30 13:30:32 2009 --- gcc-4.6.0/gcc/ada/a-wichun.adb Thu Oct 7 09:26:27 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** package body Ada.Wide_Characters.Unicode *** 150,155 **** --- 150,168 ---- end Is_Space; ------------------- + -- To_Lower_Case -- + ------------------- + + function To_Lower_Case + (U : Wide_Character) return Wide_Character + is + begin + return + Wide_Character'Val + (G.UTF_32_To_Lower_Case (Wide_Character'Pos (U))); + end To_Lower_Case; + + ------------------- -- To_Upper_Case -- ------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/a-wichun.ads gcc-4.6.0/gcc/ada/a-wichun.ads *** gcc-4.5.2/gcc/ada/a-wichun.ads Fri Oct 30 13:30:32 2009 --- gcc-4.6.0/gcc/ada/a-wichun.ads Thu Oct 7 09:26:27 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** package Ada.Wide_Characters.Unicode is *** 176,182 **** -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all ! -- letters to upper case using this routine. function To_Upper_Case (U : Wide_Character) return Wide_Character; pragma Inline (To_Upper_Case); --- 176,190 ---- -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all ! -- letters to upper case using this routine. A corresponding function to ! -- fold to lower case is also provided. ! ! function To_Lower_Case (U : Wide_Character) return Wide_Character; ! pragma Inline (To_Lower_Case); ! -- If U represents an upper case letter, returns the corresponding lower ! -- case letter, otherwise U is returned unchanged. The folding is locale ! -- independent as defined by documents referenced in the note in section ! -- 1 of ISO/IEC 10646:2003 function To_Upper_Case (U : Wide_Character) return Wide_Character; pragma Inline (To_Upper_Case); diff -Nrcpad gcc-4.5.2/gcc/ada/a-zchhan.adb gcc-4.6.0/gcc/ada/a-zchhan.adb *** gcc-4.5.2/gcc/ada/a-zchhan.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-zchhan.adb Thu Oct 7 09:26:27 2010 *************** *** 0 **** --- 1,186 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . W I D E _ W I D E _ C H A R A C T E R S . H A N D L I N G -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Wide_Wide_Characters.Unicode; use Ada.Wide_Wide_Characters.Unicode; + + package body Ada.Wide_Wide_Characters.Handling is + + --------------------- + -- Is_Alphanumeric -- + --------------------- + + function Is_Alphanumeric (Item : Wide_Wide_Character) return Boolean is + begin + return Is_Letter (Item) or else Is_Digit (Item); + end Is_Alphanumeric; + + ---------------- + -- Is_Control -- + ---------------- + + function Is_Control (Item : Wide_Wide_Character) return Boolean is + begin + return Get_Category (Item) = Cc; + end Is_Control; + + -------------- + -- Is_Digit -- + -------------- + + function Is_Digit (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Digit; + + ---------------- + -- Is_Graphic -- + ---------------- + + function Is_Graphic (Item : Wide_Wide_Character) return Boolean is + begin + return not Is_Non_Graphic (Item); + end Is_Graphic; + + -------------------------- + -- Is_Hexadecimal_Digit -- + -------------------------- + + function Is_Hexadecimal_Digit (Item : Wide_Wide_Character) return Boolean is + begin + return Is_Digit (Item) + or else Item in 'A' .. 'F' + or else Item in 'a' .. 'f'; + end Is_Hexadecimal_Digit; + + --------------- + -- Is_Letter -- + --------------- + + function Is_Letter (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Letter; + + ------------------------ + -- Is_Line_Terminator -- + ------------------------ + + function Is_Line_Terminator (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Line_Terminator; + + -------------- + -- Is_Lower -- + -------------- + + function Is_Lower (Item : Wide_Wide_Character) return Boolean is + begin + return Get_Category (Item) = Ll; + end Is_Lower; + + ------------- + -- Is_Mark -- + ------------- + + function Is_Mark (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Mark; + + -------------- + -- Is_Other -- + -------------- + + function Is_Other (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Other; + + -------------------- + -- Is_Punctuation -- + -------------------- + + function Is_Punctuation (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Punctuation; + + -------------- + -- Is_Space -- + -------------- + + function Is_Space (Item : Wide_Wide_Character) return Boolean + renames Ada.Wide_Wide_Characters.Unicode.Is_Space; + + ---------------- + -- Is_Special -- + ---------------- + + function Is_Special (Item : Wide_Wide_Character) return Boolean is + begin + return Is_Graphic (Item) and then not Is_Alphanumeric (Item); + end Is_Special; + + -------------- + -- Is_Upper -- + -------------- + + function Is_Upper (Item : Wide_Wide_Character) return Boolean is + begin + return Get_Category (Item) = Lu; + end Is_Upper; + + -------------- + -- To_Lower -- + -------------- + + function To_Lower (Item : Wide_Wide_Character) return Wide_Wide_Character + renames Ada.Wide_Wide_Characters.Unicode.To_Lower_Case; + + function To_Lower (Item : Wide_Wide_String) return Wide_Wide_String is + Result : Wide_Wide_String (Item'Range); + + begin + for J in Result'Range loop + Result (J) := To_Lower (Item (J)); + end loop; + + return Result; + end To_Lower; + + -------------- + -- To_Upper -- + -------------- + + function To_Upper (Item : Wide_Wide_Character) return Wide_Wide_Character + renames Ada.Wide_Wide_Characters.Unicode.To_Upper_Case; + + function To_Upper (Item : Wide_Wide_String) return Wide_Wide_String is + Result : Wide_Wide_String (Item'Range); + + begin + for J in Result'Range loop + Result (J) := To_Upper (Item (J)); + end loop; + + return Result; + end To_Upper; + + end Ada.Wide_Wide_Characters.Handling; diff -Nrcpad gcc-4.5.2/gcc/ada/a-zchhan.ads gcc-4.6.0/gcc/ada/a-zchhan.ads *** gcc-4.5.2/gcc/ada/a-zchhan.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/a-zchhan.ads Thu Oct 7 09:26:27 2010 *************** *** 0 **** --- 1,126 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- A D A . W I D E _ W I D E _ C H A R A C T E R S . H A N D L I N G -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + package Ada.Wide_Wide_Characters.Handling is + + function Is_Control (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Control); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as other_control, otherwise returns false. + + function Is_Letter (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Letter); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as letter_uppercase, letter_lowercase, letter_titlecase, + -- letter_modifier, letter_other, or number_letter. Otherwise returns + -- false. + + function Is_Lower (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Lower); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as letter_lowercase, otherwise returns false. + + function Is_Upper (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Upper); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as letter_uppercase, otherwise returns false. + + function Is_Digit (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Digit); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as number_decimal, otherwise returns false. + + function Is_Decimal_Digit (Item : Wide_Wide_Character) return Boolean + renames Is_Digit; + + function Is_Hexadecimal_Digit (Item : Wide_Wide_Character) return Boolean; + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as number_decimal, or is in the range 'A' .. 'F' or + -- 'a' .. 'f', otherwise returns false. + + function Is_Alphanumeric (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Alphanumeric); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as letter_uppercase, letter_lowercase, letter_titlecase, + -- letter_modifier, letter_other, number_letter, or number_decimal. + -- Otherwise returns false. + + function Is_Special (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Special); + -- Returns True if the Wide_Wide_Character designated by Item + -- is categorized as graphic_character, but not categorized as + -- letter_uppercase, letter_lowercase, letter_titlecase, letter_modifier, + -- letter_other, number_letter, or number_decimal. Otherwise returns false. + + function Is_Line_Terminator (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Line_Terminator); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as separator_line or separator_paragraph, or if Item is a + -- conventional line terminator character (CR, LF, VT, or FF). Otherwise + -- returns false. + + function Is_Mark (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Mark); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as mark_non_spacing or mark_spacing_combining, otherwise + -- returns false. + + function Is_Other (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Other); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as other_format, otherwise returns false. + + function Is_Punctuation (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Punctuation); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as punctuation_connector, otherwise returns false. + + function Is_Space (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Space); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as separator_space, otherwise returns false. + + function Is_Graphic (Item : Wide_Wide_Character) return Boolean; + pragma Inline (Is_Graphic); + -- Returns True if the Wide_Wide_Character designated by Item is + -- categorized as graphic_character, otherwise returns false. + + function To_Lower (Item : Wide_Wide_Character) return Wide_Wide_Character; + pragma Inline (To_Lower); + -- Returns the Simple Lowercase Mapping of the Wide_Wide_Character + -- designated by Item. If the Simple Lowercase Mapping does not exist for + -- the Wide_Wide_Character designated by Item, then the value of Item is + -- returned. + + function To_Lower (Item : Wide_Wide_String) return Wide_Wide_String; + -- Returns the result of applying the To_Lower Wide_Wide_Character to + -- Wide_Wide_Character conversion to each element of the Wide_Wide_String + -- designated by Item. The result is the null Wide_Wide_String if the value + -- of the formal parameter is the null Wide_Wide_String. + + function To_Upper (Item : Wide_Wide_Character) return Wide_Wide_Character; + pragma Inline (To_Upper); + -- Returns the Simple Uppercase Mapping of the Wide_Wide_Character + -- designated by Item. If the Simple Uppercase Mapping does not exist for + -- the Wide_Wide_Character designated by Item, then the value of Item is + -- returned. + + function To_Upper (Item : Wide_Wide_String) return Wide_Wide_String; + -- Returns the result of applying the To_Upper Wide_Wide_Character to + -- Wide_Wide_Character conversion to each element of the Wide_Wide_String + -- designated by Item. The result is the null Wide_Wide_String if the value + -- of the formal parameter is the null Wide_Wide_String. + + end Ada.Wide_Wide_Characters.Handling; diff -Nrcpad gcc-4.5.2/gcc/ada/a-zchuni.adb gcc-4.6.0/gcc/ada/a-zchuni.adb *** gcc-4.5.2/gcc/ada/a-zchuni.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-zchuni.adb Thu Oct 7 09:26:27 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** package body Ada.Wide_Wide_Characters.Un *** 150,155 **** --- 150,168 ---- end Is_Space; ------------------- + -- To_Lower_Case -- + ------------------- + + function To_Lower_Case + (U : Wide_Wide_Character) return Wide_Wide_Character + is + begin + return + Wide_Wide_Character'Val + (G.UTF_32_To_Lower_Case (Wide_Wide_Character'Pos (U))); + end To_Lower_Case; + + ------------------- -- To_Upper_Case -- ------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/a-zchuni.ads gcc-4.6.0/gcc/ada/a-zchuni.ads *** gcc-4.5.2/gcc/ada/a-zchuni.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/a-zchuni.ads Thu Oct 7 09:26:27 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** package Ada.Wide_Wide_Characters.Unicode *** 173,179 **** -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all ! -- letters to upper case using this routine. function To_Upper_Case (U : Wide_Wide_Character) return Wide_Wide_Character; --- 173,188 ---- -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all ! -- letters to upper case using this routine. A fold to lower routine is ! -- also provided. ! ! function To_Lower_Case ! (U : Wide_Wide_Character) return Wide_Wide_Character; ! pragma Inline (To_Lower_Case); ! -- If U represents an upper case letter, returns the corresponding lower ! -- case letter, otherwise U is returned unchanged. The folding is locale ! -- independent as defined by documents referenced in the note in section ! -- 1 of ISO/IEC 10646:2003 function To_Upper_Case (U : Wide_Wide_Character) return Wide_Wide_Character; diff -Nrcpad gcc-4.5.2/gcc/ada/adaint.c gcc-4.6.0/gcc/ada/adaint.c *** gcc-4.5.2/gcc/ada/adaint.c Mon Nov 30 16:16:55 2009 --- gcc-4.6.0/gcc/ada/adaint.c Mon Oct 25 15:26:02 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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,54 **** --- 49,63 ---- #endif /* VxWorks */ + #if (defined (__mips) && defined (__sgi)) || defined (__APPLE__) + #include + #endif + + #if defined (__hpux__) + #include + #include + #endif + #ifdef VMS #define _POSIX_EXIT 1 #define HOST_EXECUTABLE_SUFFIX ".exe" *************** UINT CurrentCodePage; *** 132,138 **** #include #endif ! #if defined (__EMX__) || defined (MSDOS) || defined (_WIN32) #elif defined (VMS) /* Header files and definitions for __gnat_set_file_time_name. */ --- 141,147 ---- #include #endif ! #if defined (_WIN32) #elif defined (VMS) /* Header files and definitions for __gnat_set_file_time_name. */ *************** struct vstring *** 179,189 **** char string[NAM$C_MAXRSS+1]; }; #else #include #endif ! #if defined (__EMX__) || defined (MSDOS) || defined (_WIN32) #include #endif --- 188,201 ---- char string[NAM$C_MAXRSS+1]; }; + #define SYI$_ACTIVECPU_CNT 0x111e + extern int LIB$GETSYI (int *, unsigned int *); + #else #include #endif ! #if defined (_WIN32) #include #endif *************** struct vstring *** 205,218 **** external file mapped to LF in internal file), but in Unix-like systems, no text translation is required, so these flags have no effect. */ - #if defined (__EMX__) - #include - #endif - - #if defined (MSDOS) - #include - #endif - #ifndef O_BINARY #define O_BINARY 0 #endif --- 217,222 ---- *************** char __gnat_path_separator = PATH_SEPARA *** 275,283 **** as well. This is only a temporary work-around for 3.11b. */ #ifndef GNAT_LIBRARY_TEMPLATE ! #if defined (__EMX__) ! #define GNAT_LIBRARY_TEMPLATE "*.a" ! #elif defined (VMS) #define GNAT_LIBRARY_TEMPLATE "*.olb" #else #define GNAT_LIBRARY_TEMPLATE "lib*.a" --- 279,285 ---- as well. This is only a temporary work-around for 3.11b. */ #ifndef GNAT_LIBRARY_TEMPLATE ! #if defined (VMS) #define GNAT_LIBRARY_TEMPLATE "*.olb" #else #define GNAT_LIBRARY_TEMPLATE "lib*.a" *************** const int __gnat_vmsp = 1; *** 294,303 **** const int __gnat_vmsp = 0; #endif ! #ifdef __EMX__ ! #define GNAT_MAX_PATH_LEN MAX_PATH ! ! #elif defined (VMS) #define GNAT_MAX_PATH_LEN 256 /* PATH_MAX */ #elif defined (__vxworks) || defined (__OPENNT) || defined(__nucleus__) --- 296,302 ---- const int __gnat_vmsp = 0; #endif ! #if defined (VMS) #define GNAT_MAX_PATH_LEN 256 /* PATH_MAX */ #elif defined (__vxworks) || defined (__OPENNT) || defined(__nucleus__) *************** to_ptr32 (char **ptr64) *** 377,383 **** #define MAYBE_TO_PTR32(argv) argv #endif ! const char ATTR_UNSET = 127; void __gnat_reset_attributes --- 376,382 ---- #define MAYBE_TO_PTR32(argv) argv #endif ! static const char ATTR_UNSET = 127; void __gnat_reset_attributes *************** __gnat_readlink (char *path ATTRIBUTE_UN *** 478,485 **** char *buf ATTRIBUTE_UNUSED, size_t bufsiz ATTRIBUTE_UNUSED) { ! #if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \ ! || defined (VMS) || defined(__vxworks) || defined (__nucleus__) return -1; #else return readlink (path, buf, bufsiz); --- 477,484 ---- char *buf ATTRIBUTE_UNUSED, size_t bufsiz ATTRIBUTE_UNUSED) { ! #if defined (_WIN32) || defined (VMS) \ ! || defined(__vxworks) || defined (__nucleus__) return -1; #else return readlink (path, buf, bufsiz); *************** int *** 494,501 **** __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, char *newpath ATTRIBUTE_UNUSED) { ! #if defined (MSDOS) || defined (_WIN32) || defined (__EMX__) \ ! || defined (VMS) || defined(__vxworks) || defined (__nucleus__) return -1; #else return symlink (oldpath, newpath); --- 493,500 ---- __gnat_symlink (char *oldpath ATTRIBUTE_UNUSED, char *newpath ATTRIBUTE_UNUSED) { ! #if defined (_WIN32) || defined (VMS) \ ! || defined(__vxworks) || defined (__nucleus__) return -1; #else return symlink (oldpath, newpath); *************** __gnat_symlink (char *oldpath ATTRIBUTE_ *** 504,511 **** /* Try to lock a file, return 1 if success. */ ! #if defined (__vxworks) || defined (__nucleus__) || defined (MSDOS) \ ! || defined (_WIN32) || defined (__EMX__) || defined (VMS) /* Version that does not use link. */ --- 503,510 ---- /* Try to lock a file, return 1 if success. */ ! #if defined (__vxworks) || defined (__nucleus__) \ ! || defined (_WIN32) || defined (VMS) /* Version that does not use link. */ *************** __gnat_try_lock (char *dir, char *file) *** 577,585 **** int __gnat_get_maximum_file_name_length (void) { ! #if defined (MSDOS) ! return 8; ! #elif defined (VMS) if (getenv ("GNAT$EXTENDED_FILE_SPECIFICATIONS")) return -1; else --- 576,582 ---- int __gnat_get_maximum_file_name_length (void) { ! #if defined (VMS) if (getenv ("GNAT$EXTENDED_FILE_SPECIFICATIONS")) return -1; else *************** __gnat_get_maximum_file_name_length (voi *** 594,614 **** int __gnat_get_file_names_case_sensitive (void) { ! #if defined (__EMX__) || defined (MSDOS) || defined (VMS) || defined (WINNT) ! return 0; #else ! return 1; #endif } char __gnat_get_default_identifier_character_set (void) { - #if defined (__EMX__) || defined (MSDOS) - return 'p'; - #else return '1'; - #endif } /* Return the current working directory. */ --- 591,626 ---- int __gnat_get_file_names_case_sensitive (void) { ! const char *sensitive = getenv ("GNAT_FILE_NAME_CASE_SENSITIVE"); ! ! if (sensitive != NULL ! && (sensitive[0] == '0' || sensitive[0] == '1') ! && sensitive[1] == '\0') ! return sensitive[0] - '0'; ! else ! #if defined (VMS) || defined (WINNT) || defined (__APPLE__) ! return 0; #else ! return 1; ! #endif ! } ! ! /* Return nonzero if environment variables are case sensitive. */ ! ! int ! __gnat_get_env_vars_case_sensitive (void) ! { ! #if defined (VMS) || defined (WINNT) ! return 0; ! #else ! return 1; #endif } char __gnat_get_default_identifier_character_set (void) { return '1'; } /* Return the current working directory. */ *************** __gnat_get_executable_suffix_ptr (int *l *** 675,686 **** void __gnat_get_debuggable_suffix_ptr (int *len, const char **value) { - #ifndef MSDOS *value = HOST_EXECUTABLE_SUFFIX; - #else - /* On DOS, the extensionless COFF file is what gdb likes. */ - *value = ""; - #endif if (*value == 0) *len = 0; --- 687,693 ---- *************** __gnat_fopen (char *path, char *mode, in *** 807,813 **** } FILE * ! __gnat_freopen (char *path, char *mode, FILE *stream, int encoding ATTRIBUTE_UNUSED) { #if defined (_WIN32) && ! defined (__vxworks) && ! defined (IS_CROSS) TCHAR wpath[GNAT_MAX_PATH_LEN]; --- 814,823 ---- } FILE * ! __gnat_freopen (char *path, ! char *mode, ! FILE *stream, ! int encoding ATTRIBUTE_UNUSED) { #if defined (_WIN32) && ! defined (__vxworks) && ! defined (IS_CROSS) TCHAR wpath[GNAT_MAX_PATH_LEN]; *************** __gnat_open_read (char *path, int fmode) *** 859,865 **** return fd < 0 ? -1 : fd; } ! #if defined (__EMX__) || defined (__MINGW32__) #define PERM (S_IREAD | S_IWRITE) #elif defined (VMS) /* Excerpt from DECC C RTL Reference Manual: --- 869,875 ---- return fd < 0 ? -1 : fd; } ! #if defined (__MINGW32__) #define PERM (S_IREAD | S_IWRITE) #elif defined (VMS) /* Excerpt from DECC C RTL Reference Manual: *************** __gnat_stat_to_attr (int fd, char* name, *** 1089,1098 **** either case. */ attr->file_length = statbuf.st_size; /* all systems */ - #ifndef __MINGW32__ - /* on Windows requires extra system call, see comment in __gnat_file_exists_attr */ attr->exists = !ret; - #endif #if !defined (_WIN32) || defined (RTX) /* on Windows requires extra system call, see __gnat_is_readable_file_attr */ --- 1099,1105 ---- *************** __gnat_stat_to_attr (int fd, char* name, *** 1101,1108 **** attr->executable = (!ret && (statbuf.st_mode & S_IXUSR)); #endif - #if !defined (__EMX__) && !defined (MSDOS) && (!defined (_WIN32) || defined (RTX)) - /* on Windows requires extra system call, see __gnat_file_time_name_attr */ if (ret != 0) { attr->timestamp = (OS_Time)-1; } else { --- 1108,1113 ---- *************** __gnat_stat_to_attr (int fd, char* name, *** 1113,1120 **** attr->timestamp = (OS_Time)statbuf.st_mtime; #endif } - #endif - } /**************************************************************** --- 1118,1123 ---- *************** win32_filetime (HANDLE h) *** 1334,1339 **** --- 1337,1356 ---- return (time_t) (t_write.ull_time / 10000000ULL - w32_epoch_offset); return (time_t) 0; } + + /* As above but starting from a FILETIME. */ + static void + f2t (const FILETIME *ft, time_t *t) + { + union + { + FILETIME ft_time; + unsigned long long ull_time; + } t_write; + + t_write.ft_time = *ft; + *t = (time_t) (t_write.ull_time / 10000000ULL - w32_epoch_offset); + } #endif /* Return a GNAT time stamp given a file name. */ *************** OS_Time *** 1342,1366 **** __gnat_file_time_name_attr (char* name, struct file_attributes* attr) { if (attr->timestamp == (OS_Time)-2) { ! #if defined (__EMX__) || defined (MSDOS) ! int fd = open (name, O_RDONLY | O_BINARY); ! time_t ret = __gnat_file_time_fd (fd); ! close (fd); ! attr->timestamp = (OS_Time)ret; ! ! #elif defined (_WIN32) && !defined (RTX) time_t ret = -1; TCHAR wname[GNAT_MAX_PATH_LEN]; S2WSC (wname, name, GNAT_MAX_PATH_LEN); ! HANDLE h = CreateFile ! (wname, GENERIC_READ, FILE_SHARE_READ, 0, ! OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); ! ! if (h != INVALID_HANDLE_VALUE) { ! ret = win32_filetime (h); ! CloseHandle (h); ! } attr->timestamp = (OS_Time) ret; #else __gnat_stat_to_attr (-1, name, attr); --- 1359,1373 ---- __gnat_file_time_name_attr (char* name, struct file_attributes* attr) { if (attr->timestamp == (OS_Time)-2) { ! #if defined (_WIN32) && !defined (RTX) ! BOOL res; ! WIN32_FILE_ATTRIBUTE_DATA fad; time_t ret = -1; TCHAR wname[GNAT_MAX_PATH_LEN]; S2WSC (wname, name, GNAT_MAX_PATH_LEN); ! if (res = GetFileAttributesEx (wname, GetFileExInfoStandard, &fad)) ! f2t (&fad.ftLastWriteTime, &ret); attr->timestamp = (OS_Time) ret; #else __gnat_stat_to_attr (-1, name, attr); *************** OS_Time *** 1383,1456 **** __gnat_file_time_fd_attr (int fd, struct file_attributes* attr) { if (attr->timestamp == (OS_Time)-2) { ! /* The following workaround code is due to the fact that under EMX and ! DJGPP fstat attempts to convert time values to GMT rather than keep the ! actual OS timestamp of the file. By using the OS2/DOS functions directly ! the GNAT timestamp are independent of this behavior, which is desired to ! facilitate the distribution of GNAT compiled libraries. */ ! ! #if defined (__EMX__) || defined (MSDOS) ! #ifdef __EMX__ ! ! FILESTATUS fs; ! int ret = DosQueryFileInfo (fd, 1, (unsigned char *) &fs, ! sizeof (FILESTATUS)); ! ! unsigned file_year = fs.fdateLastWrite.year; ! unsigned file_month = fs.fdateLastWrite.month; ! unsigned file_day = fs.fdateLastWrite.day; ! unsigned file_hour = fs.ftimeLastWrite.hours; ! unsigned file_min = fs.ftimeLastWrite.minutes; ! unsigned file_tsec = fs.ftimeLastWrite.twosecs; ! ! #else ! struct ftime fs; ! int ret = getftime (fd, &fs); ! ! unsigned file_year = fs.ft_year; ! unsigned file_month = fs.ft_month; ! unsigned file_day = fs.ft_day; ! unsigned file_hour = fs.ft_hour; ! unsigned file_min = fs.ft_min; ! unsigned file_tsec = fs.ft_tsec; ! #endif ! ! /* Calculate the seconds since epoch from the time components. First count ! the whole days passed. The value for years returned by the DOS and OS2 ! functions count years from 1980, so to compensate for the UNIX epoch which ! begins in 1970 start with 10 years worth of days and add days for each ! four year period since then. */ ! ! time_t tot_secs; ! int cum_days[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; ! int days_passed = 3652 + (file_year / 4) * 1461; ! int years_since_leap = file_year % 4; ! ! if (years_since_leap == 1) ! days_passed += 366; ! else if (years_since_leap == 2) ! days_passed += 731; ! else if (years_since_leap == 3) ! days_passed += 1096; ! ! if (file_year > 20) ! days_passed -= 1; ! ! days_passed += cum_days[file_month - 1]; ! if (years_since_leap == 0 && file_year != 20 && file_month > 2) ! days_passed++; ! ! days_passed += file_day - 1; ! ! /* OK - have whole days. Multiply -- then add in other parts. */ ! ! tot_secs = days_passed * 86400; ! tot_secs += file_hour * 3600; ! tot_secs += file_min * 60; ! tot_secs += file_tsec * 2; ! attr->timestamp = (OS_Time) tot_secs; ! ! #elif defined (_WIN32) && !defined (RTX) HANDLE h = (HANDLE) _get_osfhandle (fd); time_t ret = win32_filetime (h); attr->timestamp = (OS_Time) ret; --- 1390,1396 ---- __gnat_file_time_fd_attr (int fd, struct file_attributes* attr) { if (attr->timestamp == (OS_Time)-2) { ! #if defined (_WIN32) && !defined (RTX) HANDLE h = (HANDLE) _get_osfhandle (fd); time_t ret = win32_filetime (h); attr->timestamp = (OS_Time) ret; *************** __gnat_file_time_fd (int fd) *** 1476,1482 **** void __gnat_set_file_time_name (char *name, time_t time_stamp) { ! #if defined (__EMX__) || defined (MSDOS) || defined (__vxworks) /* Code to implement __gnat_set_file_time_name for these systems. */ --- 1416,1422 ---- void __gnat_set_file_time_name (char *name, time_t time_stamp) { ! #if defined (__vxworks) /* Code to implement __gnat_set_file_time_name for these systems. */ *************** int *** 1749,1763 **** __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf) { #ifdef __MINGW32__ ! /* Under Windows the directory name for the stat function must not be ! terminated by a directory separator except if just after a drive name ! or with UNC path without directory (only the name of the shared ! resource), for example: \\computer\share\ */ ! TCHAR wname [GNAT_MAX_PATH_LEN + 2]; ! int name_len, k; ! TCHAR last_char; ! int dirsep_count = 0; S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2); name_len = _tcslen (wname); --- 1689,1698 ---- __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf) { #ifdef __MINGW32__ ! WIN32_FILE_ATTRIBUTE_DATA fad; TCHAR wname [GNAT_MAX_PATH_LEN + 2]; ! int name_len; ! BOOL res; S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2); name_len = _tcslen (wname); *************** __gnat_stat (char *name, GNAT_STRUCT_STA *** 1765,1793 **** if (name_len > GNAT_MAX_PATH_LEN) return -1; ! last_char = wname[name_len - 1]; ! while (name_len > 1 && (last_char == _T('\\') || last_char == _T('/'))) ! { ! wname[name_len - 1] = _T('\0'); ! name_len--; ! last_char = wname[name_len - 1]; } ! /* Count back-slashes. */ ! for (k=0; k 3 && wname[0] == _T('\\') && wname[1] == _T('\\') ! && dirsep_count == 3)) ! _tcscat (wname, _T("\\")); ! return _tstat (wname, (struct _stat *)statbuf); #else return GNAT_STAT (name, statbuf); --- 1700,1742 ---- if (name_len > GNAT_MAX_PATH_LEN) return -1; ! ZeroMemory (statbuf, sizeof(GNAT_STRUCT_STAT)); ! res = GetFileAttributesEx (wname, GetFileExInfoStandard, &fad); ! ! if (res == FALSE) ! switch (GetLastError()) { ! case ERROR_ACCESS_DENIED: ! case ERROR_SHARING_VIOLATION: ! case ERROR_LOCK_VIOLATION: ! case ERROR_SHARING_BUFFER_EXCEEDED: ! return EACCES; ! case ERROR_BUFFER_OVERFLOW: ! return ENAMETOOLONG; ! case ERROR_NOT_ENOUGH_MEMORY: ! return ENOMEM; ! default: ! return ENOENT; } ! f2t (&fad.ftCreationTime, &statbuf->st_ctime); ! f2t (&fad.ftLastWriteTime, &statbuf->st_mtime); ! f2t (&fad.ftLastAccessTime, &statbuf->st_atime); ! statbuf->st_size = (off_t)fad.nFileSizeLow; ! /* We do not have the S_IEXEC attribute, but this is not used on GNAT. */ ! statbuf->st_mode = S_IREAD; ! if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ! statbuf->st_mode |= S_IFDIR; ! else ! statbuf->st_mode |= S_IFREG; ! ! if (!(fad.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) ! statbuf->st_mode |= S_IWRITE; ! ! return 0; #else return GNAT_STAT (name, statbuf); *************** int *** 1802,1817 **** __gnat_file_exists_attr (char* name, struct file_attributes* attr) { if (attr->exists == ATTR_UNSET) { - #ifdef __MINGW32__ - /* On Windows do not use __gnat_stat() because of a bug in Microsoft - _stat() routine. When the system time-zone is set with a negative - offset the _stat() routine fails on specific files like CON: */ - TCHAR wname [GNAT_MAX_PATH_LEN + 2]; - S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2); - attr->exists = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES; - #else __gnat_stat_to_attr (-1, name, attr); - #endif } return attr->exists; --- 1751,1757 ---- *************** __gnat_is_absolute_path (char *name, int *** 1857,1863 **** #else return (length != 0) && (*name == '/' || *name == DIR_SEPARATOR ! #if defined (__EMX__) || defined (MSDOS) || defined (WINNT) || (length > 1 && ISALPHA (name[0]) && name[1] == ':') #endif ); --- 1797,1803 ---- #else return (length != 0) && (*name == '/' || *name == DIR_SEPARATOR ! #if defined (WINNT) || (length > 1 && ISALPHA (name[0]) && name[1] == ':') #endif ); *************** __gnat_is_readable_file_attr (char* name *** 2104,2110 **** { ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING)); GenericMapping.GenericRead = GENERIC_READ; ! attr->readable = __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping); } else attr->readable = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES; --- 2044,2051 ---- { ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING)); GenericMapping.GenericRead = GENERIC_READ; ! attr->readable = ! __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping); } else attr->readable = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES; *************** __gnat_is_executable_file_attr (char* na *** 2177,2183 **** ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING)); GenericMapping.GenericExecute = GENERIC_EXECUTE; ! attr->executable = __gnat_check_OWNER_ACL (wname, FILE_EXECUTE, GenericMapping); } else attr->executable = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES --- 2118,2125 ---- ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING)); GenericMapping.GenericExecute = GENERIC_EXECUTE; ! attr->executable = ! __gnat_check_OWNER_ACL (wname, FILE_EXECUTE, GenericMapping); } else attr->executable = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES *************** __gnat_portable_spawn (char *args[]) *** 2358,2364 **** #if defined (__vxworks) || defined(__nucleus__) || defined(RTX) return -1; ! #elif defined (MSDOS) || defined (_WIN32) /* args[0] must be quotes as it could contain a full pathname with spaces */ char *args_0 = args[0]; args[0] = (char *)xmalloc (strlen (args_0) + 3); --- 2300,2306 ---- #if defined (__vxworks) || defined(__nucleus__) || defined(RTX) return -1; ! #elif defined (_WIN32) /* args[0] must be quotes as it could contain a full pathname with spaces */ char *args_0 = args[0]; args[0] = (char *)xmalloc (strlen (args_0) + 3); *************** __gnat_portable_spawn (char *args[]) *** 2379,2390 **** #else - #ifdef __EMX__ - pid = spawnvp (P_NOWAIT, args[0], args); - if (pid == -1) - return -1; - - #else pid = fork (); if (pid < 0) return -1; --- 2321,2326 ---- *************** __gnat_portable_spawn (char *args[]) *** 2399,2405 **** _exit (1); #endif } - #endif /* The parent. */ finished = waitpid (pid, &status, 0); --- 2335,2340 ---- *************** __gnat_dup2 (int oldfd, int newfd) *** 2443,2448 **** --- 2378,2418 ---- #endif } + int + __gnat_number_of_cpus (void) + { + int cores = 1; + + #if defined (linux) || defined (sun) || defined (AIX) \ + || (defined (__alpha__) && defined (_osf_)) || defined (__APPLE__) + cores = (int) sysconf (_SC_NPROCESSORS_ONLN); + + #elif (defined (__mips) && defined (__sgi)) + cores = (int) sysconf (_SC_NPROC_ONLN); + + #elif defined (__hpux__) + struct pst_dynamic psd; + if (pstat_getdynamic (&psd, sizeof (psd), 1, 0) != -1) + cores = (int) psd.psd_proc_cnt; + + #elif defined (_WIN32) + SYSTEM_INFO sysinfo; + GetSystemInfo (&sysinfo); + cores = (int) sysinfo.dwNumberOfProcessors; + + #elif defined (VMS) + int code = SYI$_ACTIVECPU_CNT; + unsigned int res; + int status; + + status = LIB$GETSYI (&code, &res); + if ((status & 1) != 0) + cores = res; + #endif + + return cores; + } + /* WIN32 code to implement a wait call that wait for any child process. */ #if defined (_WIN32) && !defined (RTX) *************** static HANDLE *HANDLES_LIST = NULL; *** 2474,2480 **** static int *PID_LIST = NULL, plist_length = 0, plist_max_length = 0; static void ! add_handle (HANDLE h) { /* -------------------- critical section -------------------- */ --- 2444,2450 ---- static int *PID_LIST = NULL, plist_length = 0, plist_max_length = 0; static void ! add_handle (HANDLE h, int pid) { /* -------------------- critical section -------------------- */ *************** add_handle (HANDLE h) *** 2490,2496 **** } HANDLES_LIST[plist_length] = h; ! PID_LIST[plist_length] = GetProcessId (h); ++plist_length; (*Unlock_Task) (); --- 2460,2466 ---- } HANDLES_LIST[plist_length] = h; ! PID_LIST[plist_length] = pid; ++plist_length; (*Unlock_Task) (); *************** __gnat_win32_remove_handle (HANDLE h, in *** 2521,2528 **** /* -------------------- critical section -------------------- */ } ! static HANDLE ! win32_no_block_spawn (char *command, char *args[]) { BOOL result; STARTUPINFO SI; --- 2491,2498 ---- /* -------------------- critical section -------------------- */ } ! static void ! win32_no_block_spawn (char *command, char *args[], HANDLE *h, int *pid) { BOOL result; STARTUPINFO SI; *************** win32_no_block_spawn (char *command, cha *** 2587,2596 **** if (result == TRUE) { CloseHandle (PI.hThread); ! return PI.hProcess; } else ! return NULL; } static int --- 2557,2570 ---- if (result == TRUE) { CloseHandle (PI.hThread); ! *h = PI.hProcess; ! *pid = PI.dwProcessId; } else ! { ! *h = NULL; ! *pid = 0; ! } } static int *************** win32_wait (int *status) *** 2627,2633 **** h = hl[res - WAIT_OBJECT_0]; GetExitCodeProcess (h, &exitcode); ! pid = GetProcessId (h); __gnat_win32_remove_handle (h, -1); free (hl); --- 2601,2607 ---- h = hl[res - WAIT_OBJECT_0]; GetExitCodeProcess (h, &exitcode); ! pid = PID_LIST [res - WAIT_OBJECT_0]; __gnat_win32_remove_handle (h, -1); free (hl); *************** __gnat_portable_no_block_spawn (char *ar *** 2645,2672 **** #if defined (__vxworks) || defined (__nucleus__) || defined (RTX) return -1; - #elif defined (__EMX__) || defined (MSDOS) - - /* ??? For PC machines I (Franco) don't know the system calls to implement - this routine. So I'll fake it as follows. This routine will behave - exactly like the blocking portable_spawn and will systematically return - a pid of 0 unless the spawned task did not complete successfully, in - which case we return a pid of -1. To synchronize with this the - portable_wait below systematically returns a pid of 0 and reports that - the subprocess terminated successfully. */ - - if (spawnvp (P_WAIT, args[0], args) != 0) - return -1; - #elif defined (_WIN32) HANDLE h = NULL; ! h = win32_no_block_spawn (args[0], args); if (h != NULL) { ! add_handle (h); ! return GetProcessId (h); } else return -1; --- 2619,2634 ---- #if defined (__vxworks) || defined (__nucleus__) || defined (RTX) return -1; #elif defined (_WIN32) HANDLE h = NULL; + int pid; ! win32_no_block_spawn (args[0], args, &h, &pid); if (h != NULL) { ! add_handle (h, pid); ! return pid; } else return -1; *************** __gnat_portable_wait (int *process_statu *** 2698,2713 **** int pid = 0; #if defined (__vxworks) || defined (__nucleus__) || defined (RTX) ! /* Not sure what to do here, so do same as __EMX__ case, i.e., nothing but ! return zero. */ #elif defined (_WIN32) pid = win32_wait (&status); - #elif defined (__EMX__) || defined (MSDOS) - /* ??? See corresponding comment in portable_no_block_spawn. */ - #else pid = waitpid (-1, &status, 0); --- 2660,2671 ---- int pid = 0; #if defined (__vxworks) || defined (__nucleus__) || defined (RTX) ! /* Not sure what to do here, so do nothing but return zero. */ #elif defined (_WIN32) pid = win32_wait (&status); #else pid = waitpid (-1, &status, 0); *************** __gnat_locate_regular_file (char *file_n *** 2779,2794 **** { /* The result has to be smaller than path_val + file_name. */ ! char *file_path = (char *) alloca (strlen (path_val) + strlen (file_name) + 2); for (;;) { - for (; *path_val == PATH_SEPARATOR; path_val++) - ; - - if (*path_val == 0) - return 0; - /* Skip the starting quote */ if (*path_val == '"') --- 2737,2747 ---- { /* The result has to be smaller than path_val + file_name. */ ! char *file_path = ! (char *) alloca (strlen (path_val) + strlen (file_name) + 2); for (;;) { /* Skip the starting quote */ if (*path_val == '"') *************** __gnat_locate_regular_file (char *file_n *** 2797,2803 **** for (ptr = file_path; *path_val && *path_val != PATH_SEPARATOR; ) *ptr++ = *path_val++; ! ptr--; /* Skip the ending quote */ --- 2750,2763 ---- for (ptr = file_path; *path_val && *path_val != PATH_SEPARATOR; ) *ptr++ = *path_val++; ! /* If directory is empty, it is the current directory*/ ! ! if (ptr == file_path) ! { ! *ptr = '.'; ! } ! else ! ptr--; /* Skip the ending quote */ *************** __gnat_locate_regular_file (char *file_n *** 2811,2816 **** --- 2771,2783 ---- if (__gnat_is_regular_file (file_path)) return xstrdup (file_path); + + if (*path_val == 0) + return 0; + + /* Skip path separator */ + + path_val++; } } *************** __gnat_locate_exec (char *exec_name, cha *** 2827,2834 **** char *ptr; if (!strstr (exec_name, HOST_EXECUTABLE_SUFFIX)) { ! char *full_exec_name ! = (char *) alloca (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1); strcpy (full_exec_name, exec_name); strcat (full_exec_name, HOST_EXECUTABLE_SUFFIX); --- 2794,2802 ---- char *ptr; if (!strstr (exec_name, HOST_EXECUTABLE_SUFFIX)) { ! char *full_exec_name = ! (char *) alloca ! (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1); strcpy (full_exec_name, exec_name); strcat (full_exec_name, HOST_EXECUTABLE_SUFFIX); *************** __gnat_adjust_os_resource_limits (void) *** 3445,3458 **** #endif - /* For EMX, we cannot include dummy in libgcc, since it is too difficult - to coordinate this with the EMX distribution. Consequently, we put the - definition of dummy which is used for exception handling, here. */ - - #if defined (__EMX__) - void __dummy () {} - #endif - #if defined (__mips_vxworks) int _flush_cache() --- 3413,3418 ---- *************** void __main (void) {} *** 3716,3748 **** #endif #endif - #if defined (linux) || defined(__GLIBC__) - /* pthread affinity support */ - - int __gnat_pthread_setaffinity_np (pthread_t th, - size_t cpusetsize, - const void *cpuset); - - #ifdef CPU_SETSIZE - #include - int - __gnat_pthread_setaffinity_np (pthread_t th, - size_t cpusetsize, - const cpu_set_t *cpuset) - { - return pthread_setaffinity_np (th, cpusetsize, cpuset); - } - #else - int - __gnat_pthread_setaffinity_np (pthread_t th ATTRIBUTE_UNUSED, - size_t cpusetsize ATTRIBUTE_UNUSED, - const void *cpuset ATTRIBUTE_UNUSED) - { - return 0; - } - #endif - #endif - #if defined (linux) /* There is no function in the glibc to retrieve the LWP of the current thread. We need to do a system call in order to retrieve this --- 3676,3681 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/adaint.h gcc-4.6.0/gcc/ada/adaint.h *** gcc-4.5.2/gcc/ada/adaint.h Mon Nov 30 16:16:55 2009 --- gcc-4.6.0/gcc/ada/adaint.h Mon Oct 11 08:48:19 2010 *************** *** 6,12 **** * * * C Header File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** extern void __gnat_to_gm_time (OS *** 101,106 **** --- 101,107 ---- extern int __gnat_get_maximum_file_name_length (void); extern int __gnat_get_switches_case_sensitive (void); extern int __gnat_get_file_names_case_sensitive (void); + extern int __gnat_get_env_vars_case_sensitive (void); extern char __gnat_get_default_identifier_character_set (void); extern void __gnat_get_current_dir (char *, int *); extern void __gnat_get_object_suffix_ptr (int *, *************** extern int __gnat_open_read *** 130,135 **** --- 131,138 ---- extern int __gnat_open_rw (char *, int); extern int __gnat_open_create (char *, int); extern int __gnat_create_output_file (char *); + extern int __gnat_create_output_file_new (char *); + extern int __gnat_open_append (char *, int); extern long __gnat_file_length (int); extern long __gnat_named_file_length (char *); *************** extern int __gnat_set_close_on_exec *** 234,239 **** --- 237,244 ---- extern int __gnat_dup (int); extern int __gnat_dup2 (int, int); + extern int __gnat_number_of_cpus (void); + extern void __gnat_os_filename (char *, char *, char *, int *, char *, int *); #if defined (linux) diff -Nrcpad gcc-4.5.2/gcc/ada/ali-util.adb gcc-4.6.0/gcc/ada/ali-util.adb *** gcc-4.5.2/gcc/ada/ali-util.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/ali-util.adb Fri Oct 8 10:22:31 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body ALI.Util is *** 50,57 **** procedure Error_Msg_SP (Msg : String); - procedure Obsolescent_Check (S : Source_Ptr); - -- Instantiation of Styleg, needed to instantiate Scng package Style is new Styleg --- 50,55 ---- *************** package body ALI.Util is *** 61,68 **** -- Get_File_Checksum). package Scanner is new Scng ! (Post_Scan, Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP, ! Obsolescent_Check, Style); type Header_Num is range 0 .. 1_000; --- 59,65 ---- -- Get_File_Checksum). package Scanner is new Scng ! (Post_Scan, Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP, Style); type Header_Num is range 0 .. 1_000; *************** package body ALI.Util is *** 158,166 **** -- recognized as reserved words, but as identifiers. The byte info for -- those names have been set if we are in gnatmake. ! Set_Name_Table_Byte (Name_Project, 0); ! Set_Name_Table_Byte (Name_Extends, 0); ! Set_Name_Table_Byte (Name_External, 0); -- Scan the complete file to compute its checksum --- 155,164 ---- -- recognized as reserved words, but as identifiers. The byte info for -- those names have been set if we are in gnatmake. ! Set_Name_Table_Byte (Name_Project, 0); ! Set_Name_Table_Byte (Name_Extends, 0); ! Set_Name_Table_Byte (Name_External, 0); ! Set_Name_Table_Byte (Name_External_As_List, 0); -- Scan the complete file to compute its checksum *************** package body ALI.Util is *** 201,216 **** Interfaces.Reset; end Initialize_ALI_Source; - ----------------------- - -- Obsolescent_Check -- - ----------------------- - - procedure Obsolescent_Check (S : Source_Ptr) is - pragma Warnings (Off, S); - begin - null; - end Obsolescent_Check; - --------------- -- Post_Scan -- --------------- --- 199,204 ---- *************** package body ALI.Util is *** 220,230 **** null; end Post_Scan; ! -------------- ! -- Read_ALI -- ! -------------- ! procedure Read_ALI (Id : ALI_Id) is Afile : File_Name_Type; Text : Text_Buffer_Ptr; Idread : ALI_Id; --- 208,218 ---- null; end Post_Scan; ! ---------------------- ! -- Read_Withed_ALIs -- ! ---------------------- ! procedure Read_Withed_ALIs (Id : ALI_Id) is Afile : File_Name_Type; Text : Text_Buffer_Ptr; Idread : ALI_Id; *************** package body ALI.Util is *** 298,304 **** else -- Otherwise, recurse to get new dependents ! Read_ALI (Idread); end if; -- If the ALI file has already been processed and is an interface, --- 286,292 ---- else -- Otherwise, recurse to get new dependents ! Read_Withed_ALIs (Idread); end if; -- If the ALI file has already been processed and is an interface, *************** package body ALI.Util is *** 309,315 **** end if; end loop; end loop; ! end Read_ALI; ---------------------- -- Set_Source_Table -- --- 297,303 ---- end if; end loop; end loop; ! end Read_Withed_ALIs; ---------------------- -- Set_Source_Table -- *************** package body ALI.Util is *** 481,486 **** --- 469,482 ---- (Get_File_Checksum (Sdep.Table (D).Sfile), Source.Table (Src).Checksum) then + if Verbose_Mode then + Write_Str (" "); + Write_Str (Get_Name_String (Sdep.Table (D).Sfile)); + Write_Str (": up to date, different timestamps " & + "but same checksum"); + Write_Eol; + end if; + Sdep.Table (D).Stamp := Source.Table (Src).Stamp; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/ali-util.ads gcc-4.6.0/gcc/ada/ali-util.ads *** gcc-4.5.2/gcc/ada/ali-util.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/ali-util.ads Tue Jun 22 09:02:09 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package ALI.Util is *** 32,40 **** -- Source File Table -- ----------------------- ! -- A source file table entry is built for every source file that is ! -- in the source dependency table of any of the ALI files that make ! -- up the current program. No_Source_Id : constant Source_Id := Source_Id'First; -- Special value indicating no Source table entry --- 32,39 ---- -- Source File Table -- ----------------------- ! -- A table entry is built for every source file that is in the source ! -- dependency table of any ALI file that is part of the current program. No_Source_Id : constant Source_Id := Source_Id'First; -- Special value indicating no Source table entry *************** package ALI.Util is *** 101,111 **** -- Subprograms for Manipulating ALI Information -- -------------------------------------------------- ! procedure Read_ALI (Id : ALI_Id); ! -- Process an ALI file which has been read and scanned by looping ! -- through all withed units in the ALI file, checking if they have ! -- been processed. Each unit that has not yet been processed will ! -- be read, scanned, and processed recursively. procedure Set_Source_Table (A : ALI_Id); -- Build source table entry corresponding to the ALI file whose id is A --- 100,110 ---- -- Subprograms for Manipulating ALI Information -- -------------------------------------------------- ! procedure Read_Withed_ALIs (Id : ALI_Id); ! -- Process an ALI file which has been read and scanned by looping through ! -- all withed units in the ALI file, checking if they have been processed. ! -- Each unit that has not yet been processed will be read, scanned, and ! -- processed recursively. procedure Set_Source_Table (A : ALI_Id); -- Build source table entry corresponding to the ALI file whose id is A diff -Nrcpad gcc-4.5.2/gcc/ada/ali.adb gcc-4.6.0/gcc/ada/ali.adb *** gcc-4.5.2/gcc/ada/ali.adb Wed Oct 28 13:50:10 2009 --- gcc-4.6.0/gcc/ada/ali.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body ALI is *** 49,54 **** --- 49,55 ---- 'U' => True, -- unit 'W' => True, -- with 'L' => True, -- linker option + 'N' => True, -- notes 'E' => True, -- external 'D' => True, -- dependency 'X' => True, -- xref *************** package body ALI is *** 89,102 **** Withs.Init; Sdep.Init; Linker_Options.Init; Xref_Section.Init; Xref_Entity.Init; Xref.Init; Version_Ref.Reset; ! -- Add dummy zero'th item in Linker_Options for the sort function Linker_Options.Increment_Last; -- Initialize global variables recording cumulative options in all -- ALI files that are read for a given processing run in gnatbind. --- 90,105 ---- Withs.Init; Sdep.Init; Linker_Options.Init; + Notes.Init; Xref_Section.Init; Xref_Entity.Init; Xref.Init; Version_Ref.Reset; ! -- Add dummy zero'th item in Linker_Options and Notes for sort calls Linker_Options.Increment_Last; + Notes.Increment_Last; -- Initialize global variables recording cumulative options in all -- ALI files that are read for a given processing run in gnatbind. *************** package body ALI is *** 119,132 **** -------------- function Scan_ALI ! (F : File_Name_Type; ! T : Text_Buffer_Ptr; ! Ignore_ED : Boolean; ! Err : Boolean; ! Read_Xref : Boolean := False; ! Read_Lines : String := ""; ! Ignore_Lines : String := "X"; ! Ignore_Errors : Boolean := False) return ALI_Id is P : Text_Ptr := T'First; Line : Logical_Line_Number := 1; --- 122,136 ---- -------------- function Scan_ALI ! (F : File_Name_Type; ! T : Text_Buffer_Ptr; ! Ignore_ED : Boolean; ! Err : Boolean; ! Read_Xref : Boolean := False; ! Read_Lines : String := ""; ! Ignore_Lines : String := "X"; ! Ignore_Errors : Boolean := False; ! Directly_Scanned : Boolean := False) return ALI_Id is P : Text_Ptr := T'First; Line : Logical_Line_Number := 1; *************** package body ALI is *** 204,210 **** -- -- If Ignore_Special is False (normal case), the scan is terminated by -- a typeref bracket or an equal sign except for the special case of ! -- an operator name starting with a double quite which is terminated -- by another double quote. -- -- It is an error to set both Ignore_Spaces and Ignore_Special to True. --- 208,214 ---- -- -- If Ignore_Special is False (normal case), the scan is terminated by -- a typeref bracket or an equal sign except for the special case of ! -- an operator name starting with a double quote which is terminated -- by another double quote. -- -- It is an error to set both Ignore_Spaces and Ignore_Special to True. *************** package body ALI is *** 814,819 **** --- 818,824 ---- Last_Unit => No_Unit_Id, Locking_Policy => ' ', Main_Priority => -1, + Main_CPU => -1, Main_Program => None, No_Object => False, Normalize_Scalars => False, *************** package body ALI is *** 824,829 **** --- 829,835 ---- Sfile => No_File, Task_Dispatching_Policy => ' ', Time_Slice_Value => -1, + Allocator_In_Body => False, WC_Encoding => 'b', Unit_Exception_Table => False, Ver => (others => ' '), *************** package body ALI is *** 906,911 **** --- 912,933 ---- Skip_Space; + if Nextc = 'A' then + P := P + 1; + Checkc ('B'); + ALIs.Table (Id).Allocator_In_Body := True; + end if; + + Skip_Space; + + if Nextc = 'C' then + P := P + 1; + Checkc ('='); + ALIs.Table (Id).Main_CPU := Get_Nat; + end if; + + Skip_Space; + Checkc ('W'); Checkc ('='); ALIs.Table (Id).WC_Encoding := Getc; *************** package body ALI is *** 1291,1299 **** else Skip_Space; No_Deps.Append ((Id, Get_Name)); end if; - Skip_Eol; C := Getc; end loop; --- 1313,1321 ---- else Skip_Space; No_Deps.Append ((Id, Get_Name)); + Skip_Eol; end if; C := Getc; end loop; *************** package body ALI is *** 1415,1420 **** --- 1437,1443 ---- UL.First_Arg := First_Arg; UL.Elab_Position := 0; UL.SAL_Interface := ALIs.Table (Id).SAL_Interface; + UL.Directly_Scanned := Directly_Scanned; UL.Body_Needed_For_SAL := False; UL.Elaborate_Body_Desirable := False; UL.Optimize_Alignment := 'O'; *************** package body ALI is *** 1860,1865 **** --- 1883,1927 ---- Linker_Options.Table (Linker_Options.Last).Original_Pos := Linker_Options.Last; end if; + + -- If there are notes present, scan them + + Notes_Loop : loop + Check_Unknown_Line; + exit Notes_Loop when C /= 'N'; + + if Ignore ('N') then + Skip_Line; + + else + Checkc (' '); + + Notes.Increment_Last; + Notes.Table (Notes.Last).Pragma_Type := Getc; + Notes.Table (Notes.Last).Pragma_Line := Get_Nat; + Checkc (':'); + Notes.Table (Notes.Last).Pragma_Col := Get_Nat; + Notes.Table (Notes.Last).Unit := Units.Last; + + if At_Eol then + Notes.Table (Notes.Last).Pragma_Args := No_Name; + + else + Checkc (' '); + + Name_Len := 0; + while not At_Eol loop + Add_Char_To_Name_Buffer (Getc); + end loop; + + Notes.Table (Notes.Last).Pragma_Args := Name_Enter; + end if; + + Skip_Eol; + end if; + + C := Getc; + end loop Notes_Loop; end loop U_Loop; -- End loop through units for one ALI file *************** package body ALI is *** 2146,2155 **** -- Start of processing for Read_Refs_For_One_Entity begin ! XE.Line := Get_Nat; ! XE.Etype := Getc; ! XE.Col := Get_Nat; ! XE.Lib := (Getc = '*'); XE.Entity := Get_Name; -- Handle the information about generic instantiations --- 2208,2226 ---- -- Start of processing for Read_Refs_For_One_Entity begin ! XE.Line := Get_Nat; ! XE.Etype := Getc; ! XE.Col := Get_Nat; ! ! case Getc is ! when '*' => ! XE.Visibility := Global; ! when '+' => ! XE.Visibility := Static; ! when others => ! XE.Visibility := Other; ! end case; ! XE.Entity := Get_Name; -- Handle the information about generic instantiations diff -Nrcpad gcc-4.5.2/gcc/ada/ali.ads gcc-4.6.0/gcc/ada/ali.ads *** gcc-4.5.2/gcc/ada/ali.ads Wed Jul 22 15:35:52 2009 --- gcc-4.6.0/gcc/ada/ali.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package ALI is *** 131,141 **** --- 131,151 ---- -- that no parameter was found, or no M line was present. Not set if -- 'M' appears in Ignore_Lines. + Main_CPU : Int; + -- Indicates processor if Main_Program field indicates that this can + -- be a main program. A value of -1 (No_Main_CPU) indicates that no C + -- parameter was found, or no M line was present. Not set if 'M' appears + -- in Ignore_Lines. + Time_Slice_Value : Int; -- Indicates value of time slice parameter from T=xxx on main program -- line. A value of -1 indicates that no T=xxx parameter was found, or -- no M line was present. Not set if 'M' appears in Ignore_Lines. + Allocator_In_Body : Boolean; + -- Set True if an AB switch appears on the main program line. False + -- if no M line, or AB not present, or 'M appears in Ignore_Lines. + WC_Encoding : Character; -- Wide character encoding if main procedure. Otherwise not relevant. -- Not set if 'M' appears in Ignore_Lines. *************** package ALI is *** 208,213 **** --- 218,226 ---- No_Main_Priority : constant Int := -1; -- Code for no main priority set + No_Main_CPU : constant Int := -1; + -- Code for no main cpu set + package ALIs is new Table.Table ( Table_Component_Type => ALIs_Record, Table_Index_Type => ALI_Id, *************** package ALI is *** 342,347 **** --- 355,363 ---- SAL_Interface : Boolean; -- Set True when this is an interface to a standalone library + Directly_Scanned : Boolean; + -- True iff it is a unit from an ALI file specified to gnatbind + Body_Needed_For_SAL : Boolean; -- Indicates that the source for the body of the unit (subprogram, -- package, or generic unit) must be included in a standalone library. *************** package ALI is *** 602,609 **** -- table. end record; - -- Declare the Linker_Options Table - -- The indexes of active entries in this table range from 1 to the -- value of Linker_Options.Last. The zero'th element is for sort call. --- 618,623 ---- *************** package ALI is *** 615,620 **** --- 629,672 ---- Table_Increment => 400, Table_Name => "Linker_Options"); + ----------------- + -- Notes Table -- + ----------------- + + -- The notes table records entries from N lines + + type Notes_Record is record + Pragma_Type : Character; + -- 'A', 'C', 'I', 'S', 'T' for Annotate/Comment/Ident/Subtitle/Title + + Pragma_Line : Nat; + -- Line number of pragma + + Pragma_Col : Nat; + -- Column number of pragma + + Unit : Unit_Id; + -- Unit_Id for the entry + + Pragma_Args : Name_Id; + -- Pragma arguments. No_Name if no arguments, otherwise a single + -- name table entry consisting of all the characters on the notes + -- line from the first non-blank character following the source + -- location to the last character on the line. + end record; + + -- The indexes of active entries in this table range from 1 to the + -- value of Linker_Options.Last. The zero'th element is for convenience + -- if the table needs to be sorted. + + package Notes is new Table.Table ( + Table_Component_Type => Notes_Record, + Table_Index_Type => Integer, + Table_Low_Bound => 0, + Table_Initial => 200, + Table_Increment => 400, + Table_Name => "Notes"); + ------------------------------------------- -- External Version Reference Hash Table -- ------------------------------------------- *************** package ALI is *** 772,777 **** --- 824,834 ---- Tref_Derived, -- Derived type typeref (points to parent type) Tref_Type); -- All other cases + type Visibility_Kind is + (Global, -- Library level entity + Static, -- Static C/C++ entity + Other); -- Local and other entity + -- The following table records entities for which xrefs are recorded type Xref_Entity_Record is record *************** package ALI is *** 785,792 **** Col : Pos; -- Column number of definition ! Lib : Boolean; ! -- True if entity is library level entity Entity : Name_Id; -- Name of entity --- 842,849 ---- Col : Pos; -- Column number of definition ! Visibility : Visibility_Kind; ! -- Visibility of entity Entity : Name_Id; -- Name of entity *************** package ALI is *** 933,946 **** -- Initialize the ALI tables. Also resets all switch values to defaults function Scan_ALI ! (F : File_Name_Type; ! T : Text_Buffer_Ptr; ! Ignore_ED : Boolean; ! Err : Boolean; ! Read_Xref : Boolean := False; ! Read_Lines : String := ""; ! Ignore_Lines : String := "X"; ! Ignore_Errors : Boolean := False) return ALI_Id; -- Given the text, T, of an ALI file, F, scan and store the information -- from the file, and return the Id of the resulting entry in the ALI -- table. Switch settings may be modified as described above in the --- 990,1004 ---- -- Initialize the ALI tables. Also resets all switch values to defaults function Scan_ALI ! (F : File_Name_Type; ! T : Text_Buffer_Ptr; ! Ignore_ED : Boolean; ! Err : Boolean; ! Read_Xref : Boolean := False; ! Read_Lines : String := ""; ! Ignore_Lines : String := "X"; ! Ignore_Errors : Boolean := False; ! Directly_Scanned : Boolean := False) return ALI_Id; -- Given the text, T, of an ALI file, F, scan and store the information -- from the file, and return the Id of the resulting entry in the ALI -- table. Switch settings may be modified as described above in the *************** package ALI is *** 986,990 **** --- 1044,1054 ---- -- Scan_ALI was completely unable to process the file (e.g. it did not -- look like an ALI file at all). Ignore_Errors is intended to improve -- the downward compatibility of new compilers with old tools. + -- + -- Directly_Scanned is normally False. If it is set to True, then the + -- units (spec and/or body) corresponding to the ALI file are marked as + -- such. It is used to decide for what units gnatbind should generate + -- the symbols corresponding to 'Version or 'Body_Version in + -- Stand-Alone Libraries. end ALI; diff -Nrcpad gcc-4.5.2/gcc/ada/alloc.ads gcc-4.6.0/gcc/ada/alloc.ads *** gcc-4.5.2/gcc/ada/alloc.ads Wed May 6 08:11:41 2009 --- gcc-4.6.0/gcc/ada/alloc.ads Mon Jun 14 13:01:07 2010 *************** package Alloc is *** 100,105 **** --- 100,108 ---- Nodes_Initial : constant := 50_000; -- Atree Nodes_Increment : constant := 100; + Notes_Initial : constant := 100; -- Lib + Notes_Increment : constant := 200; + Obsolescent_Warnings_Initial : constant := 50; -- Sem_Prag Obsolescent_Warnings_Increment : constant := 200; diff -Nrcpad gcc-4.5.2/gcc/ada/aspects.adb gcc-4.6.0/gcc/ada/aspects.adb *** gcc-4.5.2/gcc/ada/aspects.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/aspects.adb Mon Oct 18 09:53:00 2010 *************** *** 0 **** --- 1,272 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- A S P E C T S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Atree; use Atree; + with Nlists; use Nlists; + with Sinfo; use Sinfo; + with Snames; use Snames; + with Tree_IO; use Tree_IO; + + with GNAT.HTable; use GNAT.HTable; + + package body Aspects is + + ------------------------------------------ + -- Hash Table for Aspect Specifications -- + ------------------------------------------ + + type AS_Hash_Range is range 0 .. 510; + -- Size of hash table headers + + function AS_Hash (F : Node_Id) return AS_Hash_Range; + -- Hash function for hash table + + function AS_Hash (F : Node_Id) return AS_Hash_Range is + begin + return AS_Hash_Range (F mod 511); + end AS_Hash; + + package Aspect_Specifications_Hash_Table is new + GNAT.HTable.Simple_HTable + (Header_Num => AS_Hash_Range, + Element => List_Id, + No_Element => No_List, + Key => Node_Id, + Hash => AS_Hash, + Equal => "="); + + ----------------------------------------- + -- Table Linking Names and Aspect_Id's -- + ----------------------------------------- + + type Aspect_Entry is record + Nam : Name_Id; + Asp : Aspect_Id; + end record; + + Aspect_Names : constant array (Integer range <>) of Aspect_Entry := ( + (Name_Ada_2005, Aspect_Ada_2005), + (Name_Ada_2012, Aspect_Ada_2012), + (Name_Address, Aspect_Address), + (Name_Alignment, Aspect_Alignment), + (Name_Atomic, Aspect_Atomic), + (Name_Atomic_Components, Aspect_Atomic_Components), + (Name_Bit_Order, Aspect_Bit_Order), + (Name_Component_Size, Aspect_Component_Size), + (Name_Discard_Names, Aspect_Discard_Names), + (Name_External_Tag, Aspect_External_Tag), + (Name_Favor_Top_Level, Aspect_Favor_Top_Level), + (Name_Inline, Aspect_Inline), + (Name_Inline_Always, Aspect_Inline_Always), + (Name_Input, Aspect_Input), + (Name_Invariant, Aspect_Invariant), + (Name_Machine_Radix, Aspect_Machine_Radix), + (Name_Object_Size, Aspect_Object_Size), + (Name_Output, Aspect_Output), + (Name_Pack, Aspect_Pack), + (Name_Persistent_BSS, Aspect_Persistent_BSS), + (Name_Post, Aspect_Post), + (Name_Pre, Aspect_Pre), + (Name_Predicate, Aspect_Predicate), + (Name_Preelaborable_Initialization, Aspect_Preelaborable_Initialization), + (Name_Pure_Function, Aspect_Pure_Function), + (Name_Read, Aspect_Read), + (Name_Shared, Aspect_Shared), + (Name_Size, Aspect_Size), + (Name_Storage_Pool, Aspect_Storage_Pool), + (Name_Storage_Size, Aspect_Storage_Size), + (Name_Stream_Size, Aspect_Stream_Size), + (Name_Suppress, Aspect_Suppress), + (Name_Suppress_Debug_Info, Aspect_Suppress_Debug_Info), + (Name_Unchecked_Union, Aspect_Unchecked_Union), + (Name_Universal_Aliasing, Aspect_Universal_Aliasing), + (Name_Unmodified, Aspect_Unmodified), + (Name_Unreferenced, Aspect_Unreferenced), + (Name_Unreferenced_Objects, Aspect_Unreferenced_Objects), + (Name_Unsuppress, Aspect_Unsuppress), + (Name_Value_Size, Aspect_Value_Size), + (Name_Volatile, Aspect_Volatile), + (Name_Volatile_Components, Aspect_Volatile_Components), + (Name_Warnings, Aspect_Warnings), + (Name_Write, Aspect_Write)); + + ------------------------------------- + -- Hash Table for Aspect Id Values -- + ------------------------------------- + + type AI_Hash_Range is range 0 .. 112; + -- Size of hash table headers + + function AI_Hash (F : Name_Id) return AI_Hash_Range; + -- Hash function for hash table + + function AI_Hash (F : Name_Id) return AI_Hash_Range is + begin + return AI_Hash_Range (F mod 113); + end AI_Hash; + + package Aspect_Id_Hash_Table is new + GNAT.HTable.Simple_HTable + (Header_Num => AI_Hash_Range, + Element => Aspect_Id, + No_Element => No_Aspect, + Key => Name_Id, + Hash => AI_Hash, + Equal => "="); + + ------------------- + -- Get_Aspect_Id -- + ------------------- + + function Get_Aspect_Id (Name : Name_Id) return Aspect_Id is + begin + return Aspect_Id_Hash_Table.Get (Name); + end Get_Aspect_Id; + + --------------------------- + -- Aspect_Specifications -- + --------------------------- + + function Aspect_Specifications (N : Node_Id) return List_Id is + begin + if Has_Aspects (N) then + return Aspect_Specifications_Hash_Table.Get (N); + else + return No_List; + end if; + end Aspect_Specifications; + + ------------------ + -- Move_Aspects -- + ------------------ + + procedure Move_Aspects (From : Node_Id; To : Node_Id) is + pragma Assert (not Has_Aspects (To)); + begin + if Has_Aspects (From) then + Set_Aspect_Specifications (To, Aspect_Specifications (From)); + Aspect_Specifications_Hash_Table.Remove (From); + Set_Has_Aspects (From, False); + end if; + end Move_Aspects; + + ----------------------------------- + -- Permits_Aspect_Specifications -- + ----------------------------------- + + Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean := + (N_Abstract_Subprogram_Declaration => True, + N_Component_Declaration => True, + N_Entry_Declaration => True, + N_Exception_Declaration => True, + N_Formal_Abstract_Subprogram_Declaration => True, + N_Formal_Concrete_Subprogram_Declaration => True, + N_Formal_Object_Declaration => True, + N_Formal_Package_Declaration => True, + N_Formal_Type_Declaration => True, + N_Full_Type_Declaration => True, + N_Function_Instantiation => True, + N_Generic_Package_Declaration => True, + N_Generic_Subprogram_Declaration => True, + N_Object_Declaration => True, + N_Package_Declaration => True, + N_Package_Instantiation => True, + N_Private_Extension_Declaration => True, + N_Private_Type_Declaration => True, + N_Procedure_Instantiation => True, + N_Protected_Type_Declaration => True, + N_Single_Protected_Declaration => True, + N_Single_Task_Declaration => True, + N_Subprogram_Declaration => True, + N_Subtype_Declaration => True, + N_Task_Type_Declaration => True, + others => False); + + function Permits_Aspect_Specifications (N : Node_Id) return Boolean is + begin + return Has_Aspect_Specifications_Flag (Nkind (N)); + end Permits_Aspect_Specifications; + + ------------------------------- + -- Set_Aspect_Specifications -- + ------------------------------- + + procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id) is + begin + pragma Assert (Permits_Aspect_Specifications (N)); + pragma Assert (not Has_Aspects (N)); + pragma Assert (L /= No_List); + + Set_Has_Aspects (N); + Set_Parent (L, N); + Aspect_Specifications_Hash_Table.Set (N, L); + end Set_Aspect_Specifications; + + --------------- + -- Tree_Read -- + --------------- + + procedure Tree_Read is + Node : Node_Id; + List : List_Id; + begin + loop + Tree_Read_Int (Int (Node)); + Tree_Read_Int (Int (List)); + exit when List = No_List; + Set_Aspect_Specifications (Node, List); + end loop; + end Tree_Read; + + ---------------- + -- Tree_Write -- + ---------------- + + procedure Tree_Write is + Node : Node_Id := Empty; + List : List_Id; + begin + Aspect_Specifications_Hash_Table.Get_First (Node, List); + loop + Tree_Write_Int (Int (Node)); + Tree_Write_Int (Int (List)); + exit when List = No_List; + Aspect_Specifications_Hash_Table.Get_Next (Node, List); + end loop; + end Tree_Write; + + -- Package initialization sets up Aspect Id hash table + + begin + for J in Aspect_Names'Range loop + Aspect_Id_Hash_Table.Set (Aspect_Names (J).Nam, Aspect_Names (J).Asp); + end loop; + end Aspects; diff -Nrcpad gcc-4.5.2/gcc/ada/aspects.ads gcc-4.6.0/gcc/ada/aspects.ads *** gcc-4.5.2/gcc/ada/aspects.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/aspects.ads Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,218 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- A S P E C T S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- This package defines the aspects that are recognized by GNAT in aspect + -- specifications. It also contains the subprograms for storing/retrieving + -- aspect specifications from the tree. The semantic processing for aspect + -- specifications is found in Sem_Ch13.Analyze_Aspect_Specifications. + + with Namet; use Namet; + with Types; use Types; + + package Aspects is + + -- Type defining recognized aspects + + type Aspect_Id is + (No_Aspect, -- Dummy entry for no aspect + Aspect_Ada_2005, -- GNAT + Aspect_Ada_2012, -- GNAT + Aspect_Address, + Aspect_Alignment, + Aspect_Atomic, + Aspect_Atomic_Components, + Aspect_Bit_Order, + Aspect_Component_Size, + Aspect_Discard_Names, + Aspect_External_Tag, + Aspect_Favor_Top_Level, -- GNAT + Aspect_Inline, + Aspect_Inline_Always, -- GNAT + Aspect_Input, + Aspect_Invariant, + Aspect_Machine_Radix, + Aspect_No_Return, + Aspect_Object_Size, -- GNAT + Aspect_Output, + Aspect_Pack, + Aspect_Persistent_BSS, -- GNAT + Aspect_Post, + Aspect_Pre, + Aspect_Predicate, -- GNAT??? + Aspect_Preelaborable_Initialization, + Aspect_Pure_Function, -- GNAT + Aspect_Read, + Aspect_Shared, -- GNAT (equivalent to Atomic) + Aspect_Size, + Aspect_Storage_Pool, + Aspect_Storage_Size, + Aspect_Stream_Size, + Aspect_Suppress, + Aspect_Suppress_Debug_Info, -- GNAT + Aspect_Unchecked_Union, + Aspect_Universal_Aliasing, -- GNAT + Aspect_Unmodified, -- GNAT + Aspect_Unreferenced, -- GNAT + Aspect_Unreferenced_Objects, -- GNAT + Aspect_Unsuppress, + Aspect_Value_Size, -- GNAT + Aspect_Volatile, + Aspect_Volatile_Components, + Aspect_Warnings, + Aspect_Write); -- GNAT + + -- The following array indicates aspects that accept 'Class + + Class_Aspect_OK : constant array (Aspect_Id) of Boolean := + (Aspect_Invariant => True, + Aspect_Pre => True, + Aspect_Predicate => True, + Aspect_Post => True, + others => False); + + -- The following type is used for indicating allowed expression forms + + type Aspect_Expression is + (Optional, -- Optional boolean expression + Expression, -- Required non-boolean expression + Name); -- Required name + + -- The following array indicates what argument type is required + + Aspect_Argument : constant array (Aspect_Id) of Aspect_Expression := + (No_Aspect => Optional, + Aspect_Ada_2005 => Optional, + Aspect_Ada_2012 => Optional, + Aspect_Address => Expression, + Aspect_Alignment => Expression, + Aspect_Atomic => Optional, + Aspect_Atomic_Components => Optional, + Aspect_Bit_Order => Expression, + Aspect_Component_Size => Expression, + Aspect_Discard_Names => Optional, + Aspect_External_Tag => Expression, + Aspect_Favor_Top_Level => Optional, + Aspect_Inline => Optional, + Aspect_Inline_Always => Optional, + Aspect_Input => Name, + Aspect_Invariant => Expression, + Aspect_Machine_Radix => Expression, + Aspect_No_Return => Optional, + Aspect_Object_Size => Expression, + Aspect_Output => Name, + Aspect_Persistent_BSS => Optional, + Aspect_Pack => Optional, + Aspect_Post => Expression, + Aspect_Pre => Expression, + Aspect_Predicate => Expression, + Aspect_Preelaborable_Initialization => Optional, + Aspect_Pure_Function => Optional, + Aspect_Read => Name, + Aspect_Shared => Optional, + Aspect_Size => Expression, + Aspect_Storage_Pool => Name, + Aspect_Storage_Size => Expression, + Aspect_Stream_Size => Expression, + Aspect_Suppress => Name, + Aspect_Suppress_Debug_Info => Optional, + Aspect_Unchecked_Union => Optional, + Aspect_Universal_Aliasing => Optional, + Aspect_Unmodified => Optional, + Aspect_Unreferenced => Optional, + Aspect_Unreferenced_Objects => Optional, + Aspect_Unsuppress => Name, + Aspect_Value_Size => Expression, + Aspect_Volatile => Optional, + Aspect_Volatile_Components => Optional, + Aspect_Warnings => Name, + Aspect_Write => Name); + + function Get_Aspect_Id (Name : Name_Id) return Aspect_Id; + pragma Inline (Get_Aspect_Id); + -- Given a name Nam, returns the corresponding aspect id value. If the name + -- does not match any aspect, then No_Aspect is returned as the result. + + --------------------------------------------------- + -- Handling of Aspect Specifications in the Tree -- + --------------------------------------------------- + + -- Several kinds of declaration node permit aspect specifications in Ada + -- 2012 mode. If there was room in all the corresponding declaration nodes, + -- we could just have a field Aspect_Specifications pointing to a list of + -- nodes for the aspects (N_Aspect_Specification nodes). But there isn't + -- room, so we adopt a different approach. + + -- The following subprograms provide access to a specialized interface + -- implemented internally with a hash table in the body, that provides + -- access to aspect specifications. + + function Permits_Aspect_Specifications (N : Node_Id) return Boolean; + -- Returns True if the node N is a declaration node that permits aspect + -- specifications in the grammar. It is possible for other nodes to have + -- aspect specifications as a result of Rewrite or Replace calls. + + function Aspect_Specifications (N : Node_Id) return List_Id; + -- Given a node N, returns the list of N_Aspect_Specification nodes that + -- are attached to this declaration node. If the node is in the class of + -- declaration nodes that permit aspect specifications, as defined by the + -- predicate above, and if their Has_Aspects flag is set to True, then this + -- will always be a non-empty list. If this flag is set to False, then + -- No_List is returned. Normally, the only nodes that have Has_Aspects set + -- True are the nodes for which Permits_Aspect_Specifications would return + -- True (i.e. the declaration nodes defined in the RM as permitting the + -- presence of Aspect_Specifications). However, it is possible for the + -- flag Has_Aspects to be set on other nodes as a result of Rewrite and + -- Replace calls, and this function may be used to retrieve the aspect + -- specifications for the original rewritten node in such cases. + + procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id); + -- The node N must be in the class of declaration nodes that permit aspect + -- specifications and the Has_Aspects flag must be False on entry. L must + -- be a non-empty list of N_Aspect_Specification nodes. This procedure sets + -- the Has_Aspects flag to True, and makes an entry that can be retrieved + -- by a subsequent Aspect_Specifications call. It is an error to call this + -- procedure with a node that does not permit aspect specifications, or a + -- node that has its Has_Aspects flag set True on entry, or with L being an + -- empty list or No_List. + + procedure Move_Aspects (From : Node_Id; To : Node_Id); + -- Moves aspects from 'From' node to 'To' node. Has_Aspects (To) must be + -- False on entry. If Has_Aspects (From) is False, the call has no effect. + -- Otherwise the aspects are moved and on return Has_Aspects (To) is True, + -- and Has_Aspects (From) is False. + + procedure Tree_Write; + -- Writes contents of Aspect_Specifications hash table to the tree file + + procedure Tree_Read; + -- Reads contents of Aspect_Specifications hash table from the tree file + + end Aspects; diff -Nrcpad gcc-4.5.2/gcc/ada/atree.adb gcc-4.6.0/gcc/ada/atree.adb *** gcc-4.5.2/gcc/ada/atree.adb Mon Jul 13 13:10:51 2009 --- gcc-4.6.0/gcc/ada/atree.adb Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** pragma Style_Checks (All_Checks); *** 36,41 **** --- 36,42 ---- -- file must be properly reflected in the file atree.h which is a C header -- file containing equivalent definitions for use by gigi. + with Aspects; use Aspects; with Debug; use Debug; with Nlists; use Nlists; with Output; use Output; *************** with Tree_IO; use Tree_IO; *** 44,49 **** --- 45,53 ---- package body Atree is + Reporting_Proc : Report_Proc := null; + -- Record argument to last call to Set_Reporting_Proc + --------------- -- Debugging -- --------------- *************** package body Atree is *** 63,75 **** -- Either way, gnat1 will stop when node 12345 is created ! -- The second method is faster ww : Node_Id'Base := Node_Id'First - 1; pragma Export (Ada, ww); -- trick the optimizer Watch_Node : Node_Id'Base renames ww; ! -- Node to "watch"; that is, whenever a node is created, we check if it is ! -- equal to Watch_Node, and if so, call New_Node_Breakpoint. You have -- presumably set a breakpoint on New_Node_Breakpoint. Note that the -- initial value of Node_Id'First - 1 ensures that by default, no node -- will be equal to Watch_Node. --- 67,81 ---- -- Either way, gnat1 will stop when node 12345 is created ! -- The second method is much faster ! ! -- Similarly, rr and rrd allow breaking on rewriting of a given node ww : Node_Id'Base := Node_Id'First - 1; pragma Export (Ada, ww); -- trick the optimizer Watch_Node : Node_Id'Base renames ww; ! -- Node to "watch"; that is, whenever a node is created, we check if it ! -- is equal to Watch_Node, and if so, call New_Node_Breakpoint. You have -- presumably set a breakpoint on New_Node_Breakpoint. Note that the -- initial value of Node_Id'First - 1 ensures that by default, no node -- will be equal to Watch_Node. *************** package body Atree is *** 89,94 **** --- 95,119 ---- -- If Node = Watch_Node, this prints out the new node and calls -- New_Node_Breakpoint. Otherwise, does nothing. + procedure rr; + pragma Export (Ada, rr); + procedure Rewrite_Breakpoint renames rr; + -- This doesn't do anything interesting; it's just for setting breakpoint + -- on as explained above. + + procedure rrd (Old_Node, New_Node : Node_Id); + pragma Export (Ada, rrd); + procedure Rewrite_Debugging_Output + (Old_Node, New_Node : Node_Id) renames rrd; + -- For debugging. If debugging is turned on, Rewrite calls this. If debug + -- flag N is turned on, this prints out the new node. + -- + -- If Old_Node = Watch_Node, this prints out the old and new nodes and + -- calls Rewrite_Breakpoint. Otherwise, does nothing. + + procedure Node_Debug_Output (Op : String; N : Node_Id); + -- Common code for nnd and rrd, writes Op followed by information about N + ----------------------------- -- Local Objects and Types -- ----------------------------- *************** package body Atree is *** 130,135 **** --- 155,210 ---- function To_Flag_Byte_Ptr is new Unchecked_Conversion (Node_Kind_Ptr, Flag_Byte_Ptr); + -- The following declarations are used to store flags 239-246 in the + -- Nkind field of the fourth component of an extended (entity) node. + + type Flag_Byte2 is record + Flag239 : Boolean; + Flag240 : Boolean; + Flag241 : Boolean; + Flag242 : Boolean; + Flag243 : Boolean; + Flag244 : Boolean; + Flag245 : Boolean; + Flag246 : Boolean; + end record; + + pragma Pack (Flag_Byte2); + for Flag_Byte2'Size use 8; + + type Flag_Byte2_Ptr is access all Flag_Byte2; + + function To_Flag_Byte2 is new + Unchecked_Conversion (Node_Kind, Flag_Byte2); + + function To_Flag_Byte2_Ptr is new + Unchecked_Conversion (Node_Kind_Ptr, Flag_Byte2_Ptr); + + -- The following declarations are used to store flags 247-254 in the + -- Nkind field of the fifth component of an extended (entity) node. + + type Flag_Byte3 is record + Flag247 : Boolean; + Flag248 : Boolean; + Flag249 : Boolean; + Flag250 : Boolean; + Flag251 : Boolean; + Flag252 : Boolean; + Flag253 : Boolean; + Flag254 : Boolean; + end record; + + pragma Pack (Flag_Byte3); + for Flag_Byte3'Size use 8; + + type Flag_Byte3_Ptr is access all Flag_Byte3; + + function To_Flag_Byte3 is new + Unchecked_Conversion (Node_Kind, Flag_Byte3); + + function To_Flag_Byte3_Ptr is new + Unchecked_Conversion (Node_Kind_Ptr, Flag_Byte3_Ptr); + -- The following declarations are used to store flags 73-96 and the -- Convention field in the Field12 field of the third component of an -- extended (Entity) node. *************** package body Atree is *** 285,291 **** Unchecked_Conversion (Union_Id_Ptr, Flag_Word3_Ptr); -- The following declarations are used to store flags 184-215 in the ! -- Field11 field of the fifth component of an extended (entity) node. type Flag_Word4 is record Flag184 : Boolean; --- 360,366 ---- Unchecked_Conversion (Union_Id_Ptr, Flag_Word3_Ptr); -- The following declarations are used to store flags 184-215 in the ! -- Field12 field of the fifth component of an extended (entity) node. type Flag_Word4 is record Flag184 : Boolean; *************** package body Atree is *** 337,395 **** function To_Flag_Word4_Ptr is new Unchecked_Conversion (Union_Id_Ptr, Flag_Word4_Ptr); - -- The following declarations are used to store flags 216-247 in the - -- Field12 field of the fifth component of an extended (entity) node. - - type Flag_Word5 is record - Flag216 : Boolean; - Flag217 : Boolean; - Flag218 : Boolean; - Flag219 : Boolean; - Flag220 : Boolean; - Flag221 : Boolean; - Flag222 : Boolean; - Flag223 : Boolean; - - Flag224 : Boolean; - Flag225 : Boolean; - Flag226 : Boolean; - Flag227 : Boolean; - Flag228 : Boolean; - Flag229 : Boolean; - Flag230 : Boolean; - Flag231 : Boolean; - - Flag232 : Boolean; - Flag233 : Boolean; - Flag234 : Boolean; - Flag235 : Boolean; - Flag236 : Boolean; - Flag237 : Boolean; - Flag238 : Boolean; - Flag239 : Boolean; - - Flag240 : Boolean; - Flag241 : Boolean; - Flag242 : Boolean; - Flag243 : Boolean; - Flag244 : Boolean; - Flag245 : Boolean; - Flag246 : Boolean; - Flag247 : Boolean; - end record; - - pragma Pack (Flag_Word5); - for Flag_Word5'Size use 32; - for Flag_Word5'Alignment use 4; - - type Flag_Word5_Ptr is access all Flag_Word5; - - function To_Flag_Word5 is new - Unchecked_Conversion (Union_Id, Flag_Word5); - - function To_Flag_Word5_Ptr is new - Unchecked_Conversion (Union_Id_Ptr, Flag_Word5_Ptr); - -------------------------------------------------- -- Implementation of Tree Substitution Routines -- -------------------------------------------------- --- 412,417 ---- *************** package body Atree is *** 510,515 **** --- 532,544 ---- Orig_Nodes.Set_Last (Nodes.Last); Allocate_List_Tables (Nodes.Last); + + -- Invoke the reporting procedure (if available) + + if Reporting_Proc /= null then + Reporting_Proc.all (Target => New_Id, Source => Src); + end if; + return New_Id; end Allocate_Initialize_Node; *************** package body Atree is *** 766,771 **** --- 795,939 ---- return N_To_E (Nodes.Table (E + 1).Nkind); end Ekind; + -------------- + -- Ekind_In -- + -------------- + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind) return Boolean + is + begin + return T = V1 or else + T = V2; + end Ekind_In; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind) return Boolean + is + begin + return T = V1 or else + T = V2 or else + T = V3; + end Ekind_In; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind) return Boolean + is + begin + return T = V1 or else + T = V2 or else + T = V3 or else + T = V4; + end Ekind_In; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind) return Boolean + is + begin + return T = V1 or else + T = V2 or else + T = V3 or else + T = V4 or else + T = V5; + end Ekind_In; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind; + V6 : Entity_Kind) return Boolean + is + begin + return T = V1 or else + T = V2 or else + T = V3 or else + T = V4 or else + T = V5 or else + T = V6; + end Ekind_In; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind) return Boolean + is + begin + return Ekind_In (Ekind (E), V1, V2); + end Ekind_In; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind) return Boolean + is + begin + return Ekind_In (Ekind (E), V1, V2, V3); + end Ekind_In; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind) return Boolean + is + begin + return Ekind_In (Ekind (E), V1, V2, V3, V4); + end Ekind_In; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind) return Boolean + is + begin + return Ekind_In (Ekind (E), V1, V2, V3, V4, V5); + end Ekind_In; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind; + V6 : Entity_Kind) return Boolean + is + begin + return Ekind_In (Ekind (E), V1, V2, V3, V4, V5, V6); + end Ekind_In; + + ------------------------ + -- Set_Reporting_Proc -- + ------------------------ + + procedure Set_Reporting_Proc (P : Report_Proc) is + begin + pragma Assert (Reporting_Proc = null); + Reporting_Proc := P; + end Set_Reporting_Proc; + ------------------ -- Error_Posted -- ------------------ *************** package body Atree is *** 920,925 **** --- 1088,1103 ---- return Default_Node.Comes_From_Source; end Get_Comes_From_Source_Default; + ----------------- + -- Has_Aspects -- + ----------------- + + function Has_Aspects (N : Node_Id) return Boolean is + begin + pragma Assert (N <= Nodes.Last); + return Nodes.Table (N).Has_Aspects; + end Has_Aspects; + ------------------- -- Has_Extension -- ------------------- *************** package body Atree is *** 1013,1019 **** begin if Source > Empty_Or_Error then - New_Id := Allocate_Initialize_Node (Source, Has_Extension (Source)); Nodes.Table (New_Id).Link := Empty_List_Or_Node; --- 1191,1196 ---- *************** package body Atree is *** 1024,1029 **** --- 1201,1211 ---- Nodes.Table (New_Id).Rewrite_Ins := False; pragma Debug (New_Node_Debugging_Output (New_Id)); + + -- Always clear Has_Aspects, the caller must take care of copying + -- aspects if this is required for the particular situation. + + Set_Has_Aspects (New_Id, False); end if; return New_Id; *************** package body Atree is *** 1091,1097 **** -- New_Node_Breakpoint -- ------------------------- ! procedure nn is -- New_Node_Breakpoint begin Write_Str ("Watched node "); Write_Int (Int (Watch_Node)); --- 1273,1279 ---- -- New_Node_Breakpoint -- ------------------------- ! procedure nn is begin Write_Str ("Watched node "); Write_Int (Int (Watch_Node)); *************** package body Atree is *** 1103,1128 **** -- New_Node_Debugging_Output -- ------------------------------- ! procedure nnd (N : Node_Id) is -- New_Node_Debugging_Output Node_Is_Watched : constant Boolean := N = Watch_Node; begin if Debug_Flag_N or else Node_Is_Watched then ! Write_Str ("Allocate "); ! ! if Nkind (N) in N_Entity then ! Write_Str ("entity"); ! else ! Write_Str ("node"); ! end if; ! ! Write_Str (", Id = "); ! Write_Int (Int (N)); ! Write_Str (" "); ! Write_Location (Sloc (N)); ! Write_Str (" "); ! Write_Str (Node_Kind'Image (Nkind (N))); ! Write_Eol; if Node_Is_Watched then New_Node_Breakpoint; --- 1285,1296 ---- -- New_Node_Debugging_Output -- ------------------------------- ! procedure nnd (N : Node_Id) is Node_Is_Watched : constant Boolean := N = Watch_Node; begin if Debug_Flag_N or else Node_Is_Watched then ! Node_Debug_Output ("Allocate", N); if Node_Is_Watched then New_Node_Breakpoint; *************** package body Atree is *** 1242,1247 **** --- 1410,1416 ---- begin return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6, V7, V8, V9); end Nkind_In; + -------- -- No -- -------- *************** package body Atree is *** 1251,1256 **** --- 1420,1448 ---- return N = Empty; end No; + ----------------------- + -- Node_Debug_Output -- + ----------------------- + + procedure Node_Debug_Output (Op : String; N : Node_Id) is + begin + Write_Str (Op); + + if Nkind (N) in N_Entity then + Write_Str (" entity"); + else + Write_Str (" node"); + end if; + + Write_Str (" Id = "); + Write_Int (Int (N)); + Write_Str (" "); + Write_Location (Sloc (N)); + Write_Str (" "); + Write_Str (Node_Kind'Image (Nkind (N))); + Write_Eol; + end Node_Debug_Output; + ------------------- -- Nodes_Address -- ------------------- *************** package body Atree is *** 1386,1405 **** ------------- procedure Replace (Old_Node, New_Node : Node_Id) is ! Old_Post : constant Boolean := Nodes.Table (Old_Node).Error_Posted; ! Old_CFS : constant Boolean := Nodes.Table (Old_Node).Comes_From_Source; begin pragma Assert (not Has_Extension (Old_Node) ! and not Has_Extension (New_Node) ! and not Nodes.Table (New_Node).In_List); ! -- Do copy, preserving link and in list status and comes from source Copy_Node (Source => New_Node, Destination => Old_Node); Nodes.Table (Old_Node).Comes_From_Source := Old_CFS; Nodes.Table (Old_Node).Error_Posted := Old_Post; -- Fix parents of substituted node, since it has changed identity --- 1578,1599 ---- ------------- procedure Replace (Old_Node, New_Node : Node_Id) is ! Old_Post : constant Boolean := Nodes.Table (Old_Node).Error_Posted; ! Old_HasA : constant Boolean := Nodes.Table (Old_Node).Has_Aspects; ! Old_CFS : constant Boolean := Nodes.Table (Old_Node).Comes_From_Source; begin pragma Assert (not Has_Extension (Old_Node) ! and not Has_Extension (New_Node) ! and not Nodes.Table (New_Node).In_List); ! -- Do copy, preserving link and in list status and required flags Copy_Node (Source => New_Node, Destination => Old_Node); Nodes.Table (Old_Node).Comes_From_Source := Old_CFS; Nodes.Table (Old_Node).Error_Posted := Old_Post; + Nodes.Table (Old_Node).Has_Aspects := Old_HasA; -- Fix parents of substituted node, since it has changed identity *************** package body Atree is *** 1410,1415 **** --- 1604,1615 ---- -- to Rewrite if there were an intention to save the original node. Orig_Nodes.Table (Old_Node) := Old_Node; + + -- Invoke the reporting procedure (if available) + + if Reporting_Proc /= null then + Reporting_Proc.all (Target => Old_Node, Source => New_Node); + end if; end Replace; ------------- *************** package body Atree is *** 1418,1424 **** procedure Rewrite (Old_Node, New_Node : Node_Id) is Old_Error_P : constant Boolean := Nodes.Table (Old_Node).Error_Posted; ! -- This fields is always preserved in the new node Old_Paren_Count : Nat; Old_Must_Not_Freeze : Boolean; --- 1618,1627 ---- procedure Rewrite (Old_Node, New_Node : Node_Id) is Old_Error_P : constant Boolean := Nodes.Table (Old_Node).Error_Posted; ! -- This field is always preserved in the new node ! ! Old_Has_Aspects : constant Boolean := Nodes.Table (Old_Node).Has_Aspects; ! -- This field is always preserved in the new node Old_Paren_Count : Nat; Old_Must_Not_Freeze : Boolean; *************** package body Atree is *** 1433,1446 **** begin pragma Assert (not Has_Extension (Old_Node) ! and not Has_Extension (New_Node) ! and not Nodes.Table (New_Node).In_List); if Nkind (Old_Node) in N_Subexpr then Old_Paren_Count := Paren_Count (Old_Node); Old_Must_Not_Freeze := Must_Not_Freeze (Old_Node); else ! Old_Paren_Count := 0; Old_Must_Not_Freeze := False; end if; --- 1636,1650 ---- begin pragma Assert (not Has_Extension (Old_Node) ! and not Has_Extension (New_Node) ! and not Nodes.Table (New_Node).In_List); ! pragma Debug (Rewrite_Debugging_Output (Old_Node, New_Node)); if Nkind (Old_Node) in N_Subexpr then Old_Paren_Count := Paren_Count (Old_Node); Old_Must_Not_Freeze := Must_Not_Freeze (Old_Node); else ! Old_Paren_Count := 0; Old_Must_Not_Freeze := False; end if; *************** package body Atree is *** 1454,1465 **** --- 1658,1679 ---- Sav_Node := New_Copy (Old_Node); Orig_Nodes.Table (Sav_Node) := Sav_Node; Orig_Nodes.Table (Old_Node) := Sav_Node; + + -- Both the old and new copies of the node will share the same list + -- of aspect specifications if aspect specifications are present. + + if Has_Aspects (Sav_Node) then + Set_Has_Aspects (Sav_Node, False); + Set_Aspect_Specifications + (Sav_Node, Aspect_Specifications (Old_Node)); + end if; end if; -- Copy substitute node into place, preserving old fields as required Copy_Node (Source => New_Node, Destination => Old_Node); Nodes.Table (Old_Node).Error_Posted := Old_Error_P; + Nodes.Table (Old_Node).Has_Aspects := Old_Has_Aspects; if Nkind (New_Node) in N_Subexpr then Set_Paren_Count (Old_Node, Old_Paren_Count); *************** package body Atree is *** 1467,1474 **** --- 1681,1724 ---- end if; Fix_Parents (Ref_Node => New_Node, Fix_Node => Old_Node); + + -- Invoke the reporting procedure (if available) + + if Reporting_Proc /= null then + Reporting_Proc.all (Target => Old_Node, Source => New_Node); + end if; end Rewrite; + ------------------------- + -- Rewrite_Breakpoint -- + ------------------------- + + procedure rr is + begin + Write_Str ("Watched node "); + Write_Int (Int (Watch_Node)); + Write_Str (" rewritten"); + Write_Eol; + end rr; + + ------------------------------ + -- Rewrite_Debugging_Output -- + ------------------------------ + + procedure rrd (Old_Node, New_Node : Node_Id) is + Node_Is_Watched : constant Boolean := Old_Node = Watch_Node; + + begin + if Debug_Flag_N or else Node_Is_Watched then + Node_Debug_Output ("Rewrite", Old_Node); + Node_Debug_Output ("into", New_Node); + + if Node_Is_Watched then + Rewrite_Breakpoint; + end if; + end if; + end rrd; + ------------------ -- Set_Analyzed -- ------------------ *************** package body Atree is *** 1517,1522 **** --- 1767,1782 ---- end Set_Error_Posted; --------------------- + -- Set_Has_Aspects -- + --------------------- + + procedure Set_Has_Aspects (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (N <= Nodes.Last); + Nodes.Table (N).Has_Aspects := Val; + end Set_Has_Aspects; + + --------------------- -- Set_Paren_Count -- --------------------- *************** package body Atree is *** 1918,1923 **** --- 2178,2189 ---- return Nodes.Table (N + 4).Field10; end Field28; + function Field29 (N : Node_Id) return Union_Id is + begin + pragma Assert (Nkind (N) in N_Entity); + return Nodes.Table (N + 4).Field11; + end Field29; + function Node1 (N : Node_Id) return Node_Id is begin pragma Assert (N <= Nodes.Last); *************** package body Atree is *** 2086,2091 **** --- 2352,2363 ---- return Node_Id (Nodes.Table (N + 4).Field10); end Node28; + function Node29 (N : Node_Id) return Node_Id is + begin + pragma Assert (Nkind (N) in N_Entity); + return Node_Id (Nodes.Table (N + 4).Field11); + end Node29; + function List1 (N : Node_Id) return List_Id is begin pragma Assert (N <= Nodes.Last); *************** package body Atree is *** 2128,2133 **** --- 2400,2411 ---- return List_Id (Nodes.Table (N + 2).Field7); end List14; + function List25 (N : Node_Id) return List_Id is + begin + pragma Assert (Nkind (N) in N_Entity); + return List_Id (Nodes.Table (N + 4).Field7); + end List25; + function Elist1 (N : Node_Id) return Elist_Id is pragma Assert (N <= Nodes.Last); Value : constant Union_Id := Nodes.Table (N).Field1; *************** package body Atree is *** 2183,2188 **** --- 2461,2477 ---- end if; end Elist8; + function Elist10 (N : Node_Id) return Elist_Id is + pragma Assert (Nkind (N) in N_Entity); + Value : constant Union_Id := Nodes.Table (N + 1).Field10; + begin + if Value = 0 then + return No_Elist; + else + return Elist_Id (Value); + end if; + end Elist10; + function Elist13 (N : Node_Id) return Elist_Id is pragma Assert (Nkind (N) in N_Entity); Value : constant Union_Id := Nodes.Table (N + 2).Field6; *************** package body Atree is *** 2571,2577 **** function Flag20 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 1).Unused_1; end Flag20; function Flag21 (N : Node_Id) return Boolean is --- 2860,2866 ---- function Flag20 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 1).Has_Aspects; end Flag20; function Flag21 (N : Node_Id) return Boolean is *************** package body Atree is *** 2697,2703 **** function Flag41 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 2).Unused_1; end Flag41; function Flag42 (N : Node_Id) return Boolean is --- 2986,2992 ---- function Flag41 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 2).Has_Aspects; end Flag41; function Flag42 (N : Node_Id) return Boolean is *************** package body Atree is *** 3231,3237 **** function Flag130 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 3).Unused_1; end Flag130; function Flag131 (N : Node_Id) return Boolean is --- 3520,3526 ---- function Flag130 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 3).Has_Aspects; end Flag130; function Flag131 (N : Node_Id) return Boolean is *************** package body Atree is *** 3555,3941 **** function Flag184 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag184; end Flag184; function Flag185 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag185; end Flag185; function Flag186 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag186; end Flag186; function Flag187 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag187; end Flag187; function Flag188 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag188; end Flag188; function Flag189 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag189; end Flag189; function Flag190 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag190; end Flag190; function Flag191 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag191; end Flag191; function Flag192 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag192; end Flag192; function Flag193 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag193; end Flag193; function Flag194 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag194; end Flag194; function Flag195 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag195; end Flag195; function Flag196 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag196; end Flag196; function Flag197 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag197; end Flag197; function Flag198 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag198; end Flag198; function Flag199 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag199; end Flag199; function Flag200 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag200; end Flag200; function Flag201 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag201; end Flag201; function Flag202 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag202; end Flag202; function Flag203 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag203; end Flag203; function Flag204 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag204; end Flag204; function Flag205 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag205; end Flag205; function Flag206 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag206; end Flag206; function Flag207 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag207; end Flag207; function Flag208 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag208; end Flag208; function Flag209 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag209; end Flag209; function Flag210 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag210; end Flag210; function Flag211 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag211; end Flag211; function Flag212 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag212; end Flag212; function Flag213 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag213; end Flag213; function Flag214 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag214; end Flag214; function Flag215 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag215; end Flag215; function Flag216 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag216; end Flag216; function Flag217 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag217; end Flag217; function Flag218 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag218; end Flag218; function Flag219 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag219; end Flag219; function Flag220 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag220; end Flag220; function Flag221 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag221; end Flag221; function Flag222 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag222; end Flag222; function Flag223 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag223; end Flag223; function Flag224 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag224; end Flag224; function Flag225 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag225; end Flag225; function Flag226 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag226; end Flag226; function Flag227 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag227; end Flag227; function Flag228 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag228; end Flag228; function Flag229 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag229; end Flag229; function Flag230 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag230; end Flag230; function Flag231 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag231; end Flag231; function Flag232 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag232; end Flag232; function Flag233 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag233; end Flag233; function Flag234 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag234; end Flag234; function Flag235 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag235; end Flag235; function Flag236 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag236; end Flag236; function Flag237 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag237; end Flag237; function Flag238 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag238; end Flag238; function Flag239 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag239; end Flag239; function Flag240 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag240; end Flag240; function Flag241 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag241; end Flag241; function Flag242 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag242; end Flag242; function Flag243 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag243; end Flag243; function Flag244 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag244; end Flag244; function Flag245 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag245; end Flag245; function Flag246 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag246; end Flag246; function Flag247 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word5 (Nodes.Table (N + 4).Field12).Flag247; end Flag247; procedure Set_Nkind (N : Node_Id; Val : Node_Kind) is begin pragma Assert (N <= Nodes.Last); --- 3844,4272 ---- function Flag184 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag184; end Flag184; function Flag185 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag185; end Flag185; function Flag186 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag186; end Flag186; function Flag187 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag187; end Flag187; function Flag188 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag188; end Flag188; function Flag189 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag189; end Flag189; function Flag190 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag190; end Flag190; function Flag191 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag191; end Flag191; function Flag192 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag192; end Flag192; function Flag193 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag193; end Flag193; function Flag194 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag194; end Flag194; function Flag195 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag195; end Flag195; function Flag196 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag196; end Flag196; function Flag197 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag197; end Flag197; function Flag198 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag198; end Flag198; function Flag199 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag199; end Flag199; function Flag200 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag200; end Flag200; function Flag201 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag201; end Flag201; function Flag202 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag202; end Flag202; function Flag203 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag203; end Flag203; function Flag204 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag204; end Flag204; function Flag205 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag205; end Flag205; function Flag206 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag206; end Flag206; function Flag207 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag207; end Flag207; function Flag208 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag208; end Flag208; function Flag209 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag209; end Flag209; function Flag210 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag210; end Flag210; function Flag211 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag211; end Flag211; function Flag212 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag212; end Flag212; function Flag213 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag213; end Flag213; function Flag214 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag214; end Flag214; function Flag215 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag215; end Flag215; function Flag216 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).In_List; end Flag216; function Flag217 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Has_Aspects; end Flag217; function Flag218 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Rewrite_Ins; end Flag218; function Flag219 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Analyzed; end Flag219; function Flag220 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Comes_From_Source; end Flag220; function Flag221 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Error_Posted; end Flag221; function Flag222 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag4; end Flag222; function Flag223 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag5; end Flag223; function Flag224 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag6; end Flag224; function Flag225 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag7; end Flag225; function Flag226 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag8; end Flag226; function Flag227 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag9; end Flag227; function Flag228 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag10; end Flag228; function Flag229 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag11; end Flag229; function Flag230 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag12; end Flag230; function Flag231 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag13; end Flag231; function Flag232 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag14; end Flag232; function Flag233 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag15; end Flag233; function Flag234 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag16; end Flag234; function Flag235 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag17; end Flag235; function Flag236 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Flag18; end Flag236; function Flag237 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Pflag1; end Flag237; function Flag238 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return Nodes.Table (N + 4).Pflag2; end Flag238; function Flag239 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag239; end Flag239; function Flag240 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag240; end Flag240; function Flag241 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag241; end Flag241; function Flag242 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag242; end Flag242; function Flag243 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag243; end Flag243; function Flag244 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag244; end Flag244; function Flag245 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag245; end Flag245; function Flag246 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag246; end Flag246; function Flag247 (N : Node_Id) return Boolean is begin pragma Assert (Nkind (N) in N_Entity); ! return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag247; end Flag247; + function Flag248 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag248; + end Flag248; + + function Flag249 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag249; + end Flag249; + + function Flag250 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag250; + end Flag250; + + function Flag251 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag251; + end Flag251; + + function Flag252 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag252; + end Flag252; + + function Flag253 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag253; + end Flag253; + + function Flag254 (N : Node_Id) return Boolean is + begin + pragma Assert (Nkind (N) in N_Entity); + return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag254; + end Flag254; + procedure Set_Nkind (N : Node_Id; Val : Node_Kind) is begin pragma Assert (N <= Nodes.Last); *************** package body Atree is *** 4110,4115 **** --- 4441,4452 ---- Nodes.Table (N + 4).Field10 := Val; end Set_Field28; + procedure Set_Field29 (N : Node_Id; Val : Union_Id) is + begin + pragma Assert (Nkind (N) in N_Entity); + Nodes.Table (N + 4).Field11 := Val; + end Set_Field29; + procedure Set_Node1 (N : Node_Id; Val : Node_Id) is begin pragma Assert (N <= Nodes.Last); *************** package body Atree is *** 4278,4283 **** --- 4615,4626 ---- Nodes.Table (N + 4).Field10 := Union_Id (Val); end Set_Node28; + procedure Set_Node29 (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (Nkind (N) in N_Entity); + Nodes.Table (N + 4).Field11 := Union_Id (Val); + end Set_Node29; + procedure Set_List1 (N : Node_Id; Val : List_Id) is begin pragma Assert (N <= Nodes.Last); *************** package body Atree is *** 4320,4325 **** --- 4663,4674 ---- Nodes.Table (N + 2).Field7 := Union_Id (Val); end Set_List14; + procedure Set_List25 (N : Node_Id; Val : List_Id) is + begin + pragma Assert (Nkind (N) in N_Entity); + Nodes.Table (N + 4).Field7 := Union_Id (Val); + end Set_List25; + procedure Set_Elist1 (N : Node_Id; Val : Elist_Id) is begin Nodes.Table (N).Field1 := Union_Id (Val); *************** package body Atree is *** 4346,4351 **** --- 4695,4706 ---- Nodes.Table (N + 1).Field8 := Union_Id (Val); end Set_Elist8; + procedure Set_Elist10 (N : Node_Id; Val : Elist_Id) is + begin + pragma Assert (Nkind (N) in N_Entity); + Nodes.Table (N + 1).Field10 := Union_Id (Val); + end Set_Elist10; + procedure Set_Elist13 (N : Node_Id; Val : Elist_Id) is begin pragma Assert (Nkind (N) in N_Entity); *************** package body Atree is *** 4619,4625 **** procedure Set_Flag20 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 1).Unused_1 := Val; end Set_Flag20; procedure Set_Flag21 (N : Node_Id; Val : Boolean) is --- 4974,4980 ---- procedure Set_Flag20 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 1).Has_Aspects := Val; end Set_Flag20; procedure Set_Flag21 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 4745,4751 **** procedure Set_Flag41 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 2).Unused_1 := Val; end Set_Flag41; procedure Set_Flag42 (N : Node_Id; Val : Boolean) is --- 5100,5106 ---- procedure Set_Flag41 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 2).Has_Aspects := Val; end Set_Flag41; procedure Set_Flag42 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5407,5413 **** procedure Set_Flag130 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 3).Unused_1 := Val; end Set_Flag130; procedure Set_Flag131 (N : Node_Id; Val : Boolean) is --- 5762,5768 ---- procedure Set_Flag130 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 3).Has_Aspects := Val; end Set_Flag130; procedure Set_Flag131 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5797,5803 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag184 := Val; end Set_Flag184; procedure Set_Flag185 (N : Node_Id; Val : Boolean) is --- 6152,6158 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag184 := Val; end Set_Flag184; procedure Set_Flag185 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5805,5811 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag185 := Val; end Set_Flag185; procedure Set_Flag186 (N : Node_Id; Val : Boolean) is --- 6160,6166 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag185 := Val; end Set_Flag185; procedure Set_Flag186 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5813,5819 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag186 := Val; end Set_Flag186; procedure Set_Flag187 (N : Node_Id; Val : Boolean) is --- 6168,6174 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag186 := Val; end Set_Flag186; procedure Set_Flag187 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5821,5827 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag187 := Val; end Set_Flag187; procedure Set_Flag188 (N : Node_Id; Val : Boolean) is --- 6176,6182 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag187 := Val; end Set_Flag187; procedure Set_Flag188 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5829,5835 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag188 := Val; end Set_Flag188; procedure Set_Flag189 (N : Node_Id; Val : Boolean) is --- 6184,6190 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag188 := Val; end Set_Flag188; procedure Set_Flag189 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5837,5843 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag189 := Val; end Set_Flag189; procedure Set_Flag190 (N : Node_Id; Val : Boolean) is --- 6192,6198 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag189 := Val; end Set_Flag189; procedure Set_Flag190 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5845,5851 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag190 := Val; end Set_Flag190; procedure Set_Flag191 (N : Node_Id; Val : Boolean) is --- 6200,6206 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag190 := Val; end Set_Flag190; procedure Set_Flag191 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5853,5859 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag191 := Val; end Set_Flag191; procedure Set_Flag192 (N : Node_Id; Val : Boolean) is --- 6208,6214 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag191 := Val; end Set_Flag191; procedure Set_Flag192 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5861,5867 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag192 := Val; end Set_Flag192; procedure Set_Flag193 (N : Node_Id; Val : Boolean) is --- 6216,6222 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag192 := Val; end Set_Flag192; procedure Set_Flag193 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5869,5875 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag193 := Val; end Set_Flag193; procedure Set_Flag194 (N : Node_Id; Val : Boolean) is --- 6224,6230 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag193 := Val; end Set_Flag193; procedure Set_Flag194 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5877,5883 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag194 := Val; end Set_Flag194; procedure Set_Flag195 (N : Node_Id; Val : Boolean) is --- 6232,6238 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag194 := Val; end Set_Flag194; procedure Set_Flag195 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5885,5891 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag195 := Val; end Set_Flag195; procedure Set_Flag196 (N : Node_Id; Val : Boolean) is --- 6240,6246 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag195 := Val; end Set_Flag195; procedure Set_Flag196 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5893,5899 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag196 := Val; end Set_Flag196; procedure Set_Flag197 (N : Node_Id; Val : Boolean) is --- 6248,6254 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag196 := Val; end Set_Flag196; procedure Set_Flag197 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5901,5907 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag197 := Val; end Set_Flag197; procedure Set_Flag198 (N : Node_Id; Val : Boolean) is --- 6256,6262 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag197 := Val; end Set_Flag197; procedure Set_Flag198 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5909,5915 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag198 := Val; end Set_Flag198; procedure Set_Flag199 (N : Node_Id; Val : Boolean) is --- 6264,6270 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag198 := Val; end Set_Flag198; procedure Set_Flag199 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5917,5923 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag199 := Val; end Set_Flag199; procedure Set_Flag200 (N : Node_Id; Val : Boolean) is --- 6272,6278 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag199 := Val; end Set_Flag199; procedure Set_Flag200 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5925,5931 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag200 := Val; end Set_Flag200; procedure Set_Flag201 (N : Node_Id; Val : Boolean) is --- 6280,6286 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag200 := Val; end Set_Flag200; procedure Set_Flag201 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5933,5939 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag201 := Val; end Set_Flag201; procedure Set_Flag202 (N : Node_Id; Val : Boolean) is --- 6288,6294 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag201 := Val; end Set_Flag201; procedure Set_Flag202 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5941,5947 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag202 := Val; end Set_Flag202; procedure Set_Flag203 (N : Node_Id; Val : Boolean) is --- 6296,6302 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag202 := Val; end Set_Flag202; procedure Set_Flag203 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5949,5955 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag203 := Val; end Set_Flag203; procedure Set_Flag204 (N : Node_Id; Val : Boolean) is --- 6304,6310 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag203 := Val; end Set_Flag203; procedure Set_Flag204 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5957,5963 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag204 := Val; end Set_Flag204; procedure Set_Flag205 (N : Node_Id; Val : Boolean) is --- 6312,6318 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag204 := Val; end Set_Flag204; procedure Set_Flag205 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5965,5971 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag205 := Val; end Set_Flag205; procedure Set_Flag206 (N : Node_Id; Val : Boolean) is --- 6320,6326 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag205 := Val; end Set_Flag205; procedure Set_Flag206 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5973,5979 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag206 := Val; end Set_Flag206; procedure Set_Flag207 (N : Node_Id; Val : Boolean) is --- 6328,6334 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag206 := Val; end Set_Flag206; procedure Set_Flag207 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5981,5987 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag207 := Val; end Set_Flag207; procedure Set_Flag208 (N : Node_Id; Val : Boolean) is --- 6336,6342 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag207 := Val; end Set_Flag207; procedure Set_Flag208 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5989,5995 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag208 := Val; end Set_Flag208; procedure Set_Flag209 (N : Node_Id; Val : Boolean) is --- 6344,6350 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag208 := Val; end Set_Flag208; procedure Set_Flag209 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 5997,6003 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag209 := Val; end Set_Flag209; procedure Set_Flag210 (N : Node_Id; Val : Boolean) is --- 6352,6358 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag209 := Val; end Set_Flag209; procedure Set_Flag210 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 6005,6011 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag210 := Val; end Set_Flag210; procedure Set_Flag211 (N : Node_Id; Val : Boolean) is --- 6360,6366 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag210 := Val; end Set_Flag210; procedure Set_Flag211 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 6013,6019 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag211 := Val; end Set_Flag211; procedure Set_Flag212 (N : Node_Id; Val : Boolean) is --- 6368,6374 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag211 := Val; end Set_Flag211; procedure Set_Flag212 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 6021,6027 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag212 := Val; end Set_Flag212; procedure Set_Flag213 (N : Node_Id; Val : Boolean) is --- 6376,6382 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag212 := Val; end Set_Flag212; procedure Set_Flag213 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 6029,6035 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag213 := Val; end Set_Flag213; procedure Set_Flag214 (N : Node_Id; Val : Boolean) is --- 6384,6390 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag213 := Val; end Set_Flag213; procedure Set_Flag214 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 6037,6043 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag214 := Val; end Set_Flag214; procedure Set_Flag215 (N : Node_Id; Val : Boolean) is --- 6392,6398 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag214 := Val; end Set_Flag214; procedure Set_Flag215 (N : Node_Id; Val : Boolean) is *************** package body Atree is *** 6045,6309 **** pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag215 := Val; end Set_Flag215; procedure Set_Flag216 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag216 := Val; end Set_Flag216; procedure Set_Flag217 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag217 := Val; end Set_Flag217; procedure Set_Flag218 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag218 := Val; end Set_Flag218; procedure Set_Flag219 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag219 := Val; end Set_Flag219; procedure Set_Flag220 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag220 := Val; end Set_Flag220; procedure Set_Flag221 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag221 := Val; end Set_Flag221; procedure Set_Flag222 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag222 := Val; end Set_Flag222; procedure Set_Flag223 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag223 := Val; end Set_Flag223; procedure Set_Flag224 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag224 := Val; end Set_Flag224; procedure Set_Flag225 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag225 := Val; end Set_Flag225; procedure Set_Flag226 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag226 := Val; end Set_Flag226; procedure Set_Flag227 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag227 := Val; end Set_Flag227; procedure Set_Flag228 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag228 := Val; end Set_Flag228; procedure Set_Flag229 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag229 := Val; end Set_Flag229; procedure Set_Flag230 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag230 := Val; end Set_Flag230; procedure Set_Flag231 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag231 := Val; end Set_Flag231; procedure Set_Flag232 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag232 := Val; end Set_Flag232; procedure Set_Flag233 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag233 := Val; end Set_Flag233; procedure Set_Flag234 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag234 := Val; end Set_Flag234; procedure Set_Flag235 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag235 := Val; end Set_Flag235; procedure Set_Flag236 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag236 := Val; end Set_Flag236; procedure Set_Flag237 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag237 := Val; end Set_Flag237; procedure Set_Flag238 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag238 := Val; end Set_Flag238; procedure Set_Flag239 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag239 := Val; end Set_Flag239; procedure Set_Flag240 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag240 := Val; end Set_Flag240; procedure Set_Flag241 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag241 := Val; end Set_Flag241; procedure Set_Flag242 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag242 := Val; end Set_Flag242; procedure Set_Flag243 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag243 := Val; end Set_Flag243; procedure Set_Flag244 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag244 := Val; end Set_Flag244; procedure Set_Flag245 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag245 := Val; end Set_Flag245; procedure Set_Flag246 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag246 := Val; end Set_Flag246; procedure Set_Flag247 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Word5_Ptr ! (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag247 := Val; end Set_Flag247; procedure Set_Node1_With_Parent (N : Node_Id; Val : Node_Id) is begin pragma Assert (N <= Nodes.Last); --- 6400,6674 ---- pragma Assert (Nkind (N) in N_Entity); To_Flag_Word4_Ptr (Union_Id_Ptr' ! (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag215 := Val; end Set_Flag215; procedure Set_Flag216 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).In_List := Val; end Set_Flag216; procedure Set_Flag217 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Has_Aspects := Val; end Set_Flag217; procedure Set_Flag218 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Rewrite_Ins := Val; end Set_Flag218; procedure Set_Flag219 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Analyzed := Val; end Set_Flag219; procedure Set_Flag220 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Comes_From_Source := Val; end Set_Flag220; procedure Set_Flag221 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Error_Posted := Val; end Set_Flag221; procedure Set_Flag222 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag4 := Val; end Set_Flag222; procedure Set_Flag223 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag5 := Val; end Set_Flag223; procedure Set_Flag224 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag6 := Val; end Set_Flag224; procedure Set_Flag225 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag7 := Val; end Set_Flag225; procedure Set_Flag226 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag8 := Val; end Set_Flag226; procedure Set_Flag227 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag9 := Val; end Set_Flag227; procedure Set_Flag228 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag10 := Val; end Set_Flag228; procedure Set_Flag229 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag11 := Val; end Set_Flag229; procedure Set_Flag230 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag12 := Val; end Set_Flag230; procedure Set_Flag231 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag13 := Val; end Set_Flag231; procedure Set_Flag232 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag14 := Val; end Set_Flag232; procedure Set_Flag233 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag15 := Val; end Set_Flag233; procedure Set_Flag234 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag16 := Val; end Set_Flag234; procedure Set_Flag235 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag17 := Val; end Set_Flag235; procedure Set_Flag236 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Flag18 := Val; end Set_Flag236; procedure Set_Flag237 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Pflag1 := Val; end Set_Flag237; procedure Set_Flag238 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! Nodes.Table (N + 4).Pflag2 := Val; end Set_Flag238; procedure Set_Flag239 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag239 := Val; end Set_Flag239; procedure Set_Flag240 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag240 := Val; end Set_Flag240; procedure Set_Flag241 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag241 := Val; end Set_Flag241; procedure Set_Flag242 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag242 := Val; end Set_Flag242; procedure Set_Flag243 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag243 := Val; end Set_Flag243; procedure Set_Flag244 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag244 := Val; end Set_Flag244; procedure Set_Flag245 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag245 := Val; end Set_Flag245; procedure Set_Flag246 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte2_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag246 := Val; end Set_Flag246; procedure Set_Flag247 (N : Node_Id; Val : Boolean) is begin pragma Assert (Nkind (N) in N_Entity); ! To_Flag_Byte3_Ptr ! (Node_Kind_Ptr' ! (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag247 := Val; end Set_Flag247; + procedure Set_Flag248 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag248 := Val; + end Set_Flag248; + + procedure Set_Flag249 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag249 := Val; + end Set_Flag249; + + procedure Set_Flag250 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag250 := Val; + end Set_Flag250; + + procedure Set_Flag251 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag251 := Val; + end Set_Flag251; + + procedure Set_Flag252 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag252 := Val; + end Set_Flag252; + + procedure Set_Flag253 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag253 := Val; + end Set_Flag253; + + procedure Set_Flag254 (N : Node_Id; Val : Boolean) is + begin + pragma Assert (Nkind (N) in N_Entity); + To_Flag_Byte3_Ptr + (Node_Kind_Ptr' + (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag254 := Val; + end Set_Flag254; + procedure Set_Node1_With_Parent (N : Node_Id; Val : Node_Id) is begin pragma Assert (N <= Nodes.Last); diff -Nrcpad gcc-4.5.2/gcc/ada/atree.ads gcc-4.6.0/gcc/ada/atree.ads *** gcc-4.5.2/gcc/ada/atree.ads Mon Jul 13 13:10:51 2009 --- gcc-4.6.0/gcc/ada/atree.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Atree is *** 85,94 **** -- In_List A flag used to indicate if the node is a member -- of a node list. - -- Rewrite_Sub A flag set if the node has been rewritten using - -- the Rewrite procedure. The original value of the - -- node is retrievable with Original_Node. - -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted -- node as a result of a call to Mark_Rewrite_Insertion. --- 85,90 ---- *************** package Atree is *** 155,171 **** -- it is useful to be able to do untyped traversals, and an internal -- package in Atree allows for direct untyped accesses in such cases. ! -- Flag4 Fifteen Boolean flags (use depends on Nkind and -- Flag5 Ekind, as described for FieldN). Again the access -- Flag6 is usually via subprograms in Sinfo and Einfo which -- Flag7 provide high-level synonyms for these flags, and -- Flag8 contain debugging code that checks that the values -- Flag9 in Nkind and Ekind are appropriate for the access. -- Flag10 ! -- Flag11 Note that Flag1-3 are missing from this list. The ! -- Flag12 first three flag positions are reserved for the ! -- Flag13 standard flags (Comes_From_Source, Error_Posted, ! -- Flag14 and Analyzed) -- Flag15 -- Flag16 -- Flag17 --- 151,167 ---- -- it is useful to be able to do untyped traversals, and an internal -- package in Atree allows for direct untyped accesses in such cases. ! -- Flag4 Sixteen Boolean flags (use depends on Nkind and -- Flag5 Ekind, as described for FieldN). Again the access -- Flag6 is usually via subprograms in Sinfo and Einfo which -- Flag7 provide high-level synonyms for these flags, and -- Flag8 contain debugging code that checks that the values -- Flag9 in Nkind and Ekind are appropriate for the access. -- Flag10 ! -- Flag11 Note that Flag1-2 are missing from this list. For ! -- Flag12 historical reasons, these flag names are unused. ! -- Flag13 ! -- Flag14 -- Flag15 -- Flag16 -- Flag17 *************** package Atree is *** 184,192 **** -- entity, it is of type Entity_Kind which is defined -- in package Einfo. ! -- Flag19 229 additional flags -- ... ! -- Flag247 -- Convention Entity convention (Convention_Id value) --- 180,188 ---- -- entity, it is of type Entity_Kind which is defined -- in package Einfo. ! -- Flag19 235 additional flags -- ... ! -- Flag254 -- Convention Entity convention (Convention_Id value) *************** package Atree is *** 197,204 **** -- Uint6 Synonym for Field6 typed as Uint (Empty = Uint_0) -- Similar definitions for Field7 to Field28 (and Node7-Node28, ! -- Elist7-Elist28, Uint7-Uint28, Ureal7-Ureal28). Note that not all ! -- these functions are defined, only the ones that are actually used. function Last_Node_Id return Node_Id; pragma Inline (Last_Node_Id); --- 193,200 ---- -- Uint6 Synonym for Field6 typed as Uint (Empty = Uint_0) -- Similar definitions for Field7 to Field28 (and Node7-Node28, ! -- Elist7-Elist28, Uint7-Uint28, Ureal7-Ureal28). Note that not all these ! -- functions are defined, only the ones that are actually used. function Last_Node_Id return Node_Id; pragma Inline (Last_Node_Id); *************** package Atree is *** 281,287 **** -- Field1-5 fields are set to Empty ! -- Field6-22 fields in extended nodes are set to Empty -- Parent is set to Empty --- 277,283 ---- -- Field1-5 fields are set to Empty ! -- Field6-29 fields in extended nodes are set to Empty -- Parent is set to Empty *************** package Atree is *** 296,302 **** ------------------------------------- -- A subpackage Atree.Unchecked_Access provides routines for reading and ! -- writing the fields defined above (Field1-27, Node1-27, Flag1-247 etc). -- These unchecked access routines can be used for untyped traversals. -- In addition they are used in the implementations of the Sinfo and -- Einfo packages. These packages both provide logical synonyms for --- 292,298 ---- ------------------------------------- -- A subpackage Atree.Unchecked_Access provides routines for reading and ! -- writing the fields defined above (Field1-27, Node1-27, Flag4-254 etc). -- These unchecked access routines can be used for untyped traversals. -- In addition they are used in the implementations of the Sinfo and -- Einfo packages. These packages both provide logical synonyms for *************** package Atree is *** 402,408 **** -- The parent pointer of the destination and its list link, if any, are -- not affected by the copy. Note that parent pointers of descendents -- are not adjusted, so the descendents of the destination node after ! -- the Copy_Node is completed have dubious parent pointers. function New_Copy (Source : Node_Id) return Node_Id; -- This function allocates a completely new node, and then initializes --- 398,407 ---- -- The parent pointer of the destination and its list link, if any, are -- not affected by the copy. Note that parent pointers of descendents -- are not adjusted, so the descendents of the destination node after ! -- the Copy_Node is completed have dubious parent pointers. Note that ! -- this routine does NOT copy aspect specifications, the Has_Aspects ! -- flag in the returned node will always be False. The caller must deal ! -- with copying aspect specifications where this is required. function New_Copy (Source : Node_Id) return Node_Id; -- This function allocates a completely new node, and then initializes *************** package Atree is *** 461,466 **** --- 460,471 ---- -- function is used only by Sinfo.CN to change nodes into their -- corresponding entities. + type Report_Proc is access procedure (Target : Node_Id; Source : Node_Id); + + procedure Set_Reporting_Proc (P : Report_Proc); + -- Register a procedure that is invoked when a node is allocated, replaced + -- or rewritten. + type Traverse_Result is (Abandon, OK, OK_Orig, Skip); -- This is the type of the result returned by the Process function passed -- to Traverse_Func and Traverse_Proc. See below for details. *************** package Atree is *** 515,520 **** --- 520,528 ---- function Analyzed (N : Node_Id) return Boolean; pragma Inline (Analyzed); + function Has_Aspects (N : Node_Id) return Boolean; + pragma Inline (Has_Aspects); + function Comes_From_Source (N : Node_Id) return Boolean; pragma Inline (Comes_From_Source); *************** package Atree is *** 529,537 **** function Parent (N : Node_Id) return Node_Id; pragma Inline (Parent); ! -- Returns the parent of a node if the node is not a list member, or ! -- else the parent of the list containing the node if the node is a ! -- list member. function No (N : Node_Id) return Boolean; pragma Inline (No); --- 537,544 ---- function Parent (N : Node_Id) return Node_Id; pragma Inline (Parent); ! -- Returns the parent of a node if the node is not a list member, or else ! -- the parent of the list containing the node if the node is a list member. function No (N : Node_Id) return Boolean; pragma Inline (No); *************** package Atree is *** 543,550 **** -- Tests given Id for inequality with the Empty node. This allows notations -- like "if Present (Statement)" as opposed to "if Statement /= Empty". ! -- Node_Kind tests, like the functions in Sinfo, but the first argument is ! -- a Node_Id, and the tested field is Nkind (N). function Nkind_In (N : Node_Id; --- 550,561 ---- -- Tests given Id for inequality with the Empty node. This allows notations -- like "if Present (Statement)" as opposed to "if Statement /= Empty". ! --------------------- ! -- Node_Kind Tests -- ! --------------------- ! ! -- These are like the functions in Sinfo, but the first argument is a ! -- Node_Id, and the tested field is Nkind (N). function Nkind_In (N : Node_Id; *************** package Atree is *** 617,622 **** --- 628,715 ---- pragma Inline (Nkind_In); -- Inline all above functions + ----------------------- + -- Entity_Kind_Tests -- + ----------------------- + + -- Utility functions to test whether an Entity_Kind value, either given + -- directly as the first argument, or the Ekind field of an Entity give + -- as the first argument, matches any of the given list of Entity_Kind + -- values. Return True if any match, False if no match. + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind) return Boolean; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind) return Boolean; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind) return Boolean; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind) return Boolean; + + function Ekind_In + (E : Entity_Id; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind; + V6 : Entity_Kind) return Boolean; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind) return Boolean; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind) return Boolean; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind) return Boolean; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind) return Boolean; + + function Ekind_In + (T : Entity_Kind; + V1 : Entity_Kind; + V2 : Entity_Kind; + V3 : Entity_Kind; + V4 : Entity_Kind; + V5 : Entity_Kind; + V6 : Entity_Kind) return Boolean; + + pragma Inline (Ekind_In); + -- Inline all above functions + ----------------------------- -- Entity Access Functions -- ----------------------------- *************** package Atree is *** 661,666 **** --- 754,762 ---- -- unusual cases, the value needs to be reset (e.g. when a source -- node is copied, and the copy must not have Comes_From_Source set. + procedure Set_Has_Aspects (N : Node_Id; Val : Boolean := True); + pragma Inline (Set_Has_Aspects); + ------------------------------ -- Entity Update Procedures -- ------------------------------ *************** package Atree is *** 748,754 **** -- This is similar to Rewrite, except that the old value of Old_Node is -- not saved, and the New_Node is deleted after the replace, since it -- is assumed that it can no longer be legitimately needed. The flag ! -- Is_Rewrite_Susbtitute will be False for the resulting node, unless -- it was already true on entry, and Original_Node will not return the -- original contents of the Old_Node, but rather the New_Node value (unless -- Old_Node had already been rewritten using Rewrite). Replace also --- 844,850 ---- -- This is similar to Rewrite, except that the old value of Old_Node is -- not saved, and the New_Node is deleted after the replace, since it -- is assumed that it can no longer be legitimately needed. The flag ! -- Is_Rewrite_Substitution will be False for the resulting node, unless -- it was already true on entry, and Original_Node will not return the -- original contents of the Old_Node, but rather the New_Node value (unless -- Old_Node had already been rewritten using Rewrite). Replace also *************** package Atree is *** 889,894 **** --- 985,993 ---- function Field28 (N : Node_Id) return Union_Id; pragma Inline (Field28); + function Field29 (N : Node_Id) return Union_Id; + pragma Inline (Field29); + function Node1 (N : Node_Id) return Node_Id; pragma Inline (Node1); *************** package Atree is *** 973,978 **** --- 1072,1080 ---- function Node28 (N : Node_Id) return Node_Id; pragma Inline (Node28); + function Node29 (N : Node_Id) return Node_Id; + pragma Inline (Node29); + function List1 (N : Node_Id) return List_Id; pragma Inline (List1); *************** package Atree is *** 994,999 **** --- 1096,1104 ---- function List14 (N : Node_Id) return List_Id; pragma Inline (List14); + function List25 (N : Node_Id) return List_Id; + pragma Inline (List25); + function Elist1 (N : Node_Id) return Elist_Id; pragma Inline (Elist1); *************** package Atree is *** 1009,1014 **** --- 1114,1122 ---- function Elist8 (N : Node_Id) return Elist_Id; pragma Inline (Elist8); + function Elist10 (N : Node_Id) return Elist_Id; + pragma Inline (Elist10); + function Elist13 (N : Node_Id) return Elist_Id; pragma Inline (Elist13); *************** package Atree is *** 1833,1838 **** --- 1941,1967 ---- function Flag247 (N : Node_Id) return Boolean; pragma Inline (Flag247); + function Flag248 (N : Node_Id) return Boolean; + pragma Inline (Flag248); + + function Flag249 (N : Node_Id) return Boolean; + pragma Inline (Flag249); + + function Flag250 (N : Node_Id) return Boolean; + pragma Inline (Flag250); + + function Flag251 (N : Node_Id) return Boolean; + pragma Inline (Flag251); + + function Flag252 (N : Node_Id) return Boolean; + pragma Inline (Flag252); + + function Flag253 (N : Node_Id) return Boolean; + pragma Inline (Flag253); + + function Flag254 (N : Node_Id) return Boolean; + pragma Inline (Flag254); + -- Procedures to set value of indicated field procedure Set_Nkind (N : Node_Id; Val : Node_Kind); *************** package Atree is *** 1922,1927 **** --- 2051,2059 ---- procedure Set_Field28 (N : Node_Id; Val : Union_Id); pragma Inline (Set_Field28); + procedure Set_Field29 (N : Node_Id; Val : Union_Id); + pragma Inline (Set_Field29); + procedure Set_Node1 (N : Node_Id; Val : Node_Id); pragma Inline (Set_Node1); *************** package Atree is *** 2006,2011 **** --- 2138,2146 ---- procedure Set_Node28 (N : Node_Id; Val : Node_Id); pragma Inline (Set_Node28); + procedure Set_Node29 (N : Node_Id; Val : Node_Id); + pragma Inline (Set_Node29); + procedure Set_List1 (N : Node_Id; Val : List_Id); pragma Inline (Set_List1); *************** package Atree is *** 2027,2032 **** --- 2162,2170 ---- procedure Set_List14 (N : Node_Id; Val : List_Id); pragma Inline (Set_List14); + procedure Set_List25 (N : Node_Id; Val : List_Id); + pragma Inline (Set_List25); + procedure Set_Elist1 (N : Node_Id; Val : Elist_Id); pragma Inline (Set_Elist1); *************** package Atree is *** 2042,2047 **** --- 2180,2188 ---- procedure Set_Elist8 (N : Node_Id; Val : Elist_Id); pragma Inline (Set_Elist8); + procedure Set_Elist10 (N : Node_Id; Val : Elist_Id); + pragma Inline (Set_Elist10); + procedure Set_Elist13 (N : Node_Id; Val : Elist_Id); pragma Inline (Set_Elist13); *************** package Atree is *** 2861,2866 **** --- 3002,3028 ---- procedure Set_Flag247 (N : Node_Id; Val : Boolean); pragma Inline (Set_Flag247); + procedure Set_Flag248 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag248); + + procedure Set_Flag249 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag249); + + procedure Set_Flag250 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag250); + + procedure Set_Flag251 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag251); + + procedure Set_Flag252 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag252); + + procedure Set_Flag253 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag253); + + procedure Set_Flag254 (N : Node_Id; Val : Boolean); + pragma Inline (Set_Flag254); + -- The following versions of Set_Noden also set the parent -- pointer of the referenced node if it is non_Empty *************** package Atree is *** 2942,2949 **** -- Flag used to indicate if node is a member of a list. -- This field is considered private to the Atree package. ! Unused_1 : Boolean; ! -- Currently unused flag Rewrite_Ins : Boolean; -- Flag set by Mark_Rewrite_Insertion procedure. --- 3104,3112 ---- -- Flag used to indicate if node is a member of a list. -- This field is considered private to the Atree package. ! Has_Aspects : Boolean; ! -- Flag used to indicate that a node has aspect specifications that ! -- are associated with the node. See Aspects package for details. Rewrite_Ins : Boolean; -- Flag set by Mark_Rewrite_Insertion procedure. *************** package Atree is *** 2977,3009 **** Flag18 : Boolean; -- The eighteen flags for a normal node ! -- The above fields are used as follows in components 2-4 of ! -- an extended node entry. These fields are not currently ! -- used in component 5 (where we still have lots of room!) ! -- In_List used as Flag19, Flag40, Flag129 ! -- Unused_1 used as Flag20, Flag41, Flag130 ! -- Rewrite_Ins used as Flag21, Flag42, Flag131 ! -- Analyzed used as Flag22, Flag43, Flag132 ! -- Comes_From_Source used as Flag23, Flag44, Flag133 ! -- Error_Posted used as Flag24, Flag45, Flag134 ! -- Flag4 used as Flag25, Flag46, Flag135 ! -- Flag5 used as Flag26, Flag47, Flag136 ! -- Flag6 used as Flag27, Flag48, Flag137 ! -- Flag7 used as Flag28, Flag49, Flag138 ! -- Flag8 used as Flag29, Flag50, Flag139 ! -- Flag9 used as Flag30, Flag51, Flag140 ! -- Flag10 used as Flag31, Flag52, Flag141 ! -- Flag11 used as Flag32, Flag53, Flag142 ! -- Flag12 used as Flag33, Flag54, Flag143 ! -- Flag13 used as Flag34, Flag55, Flag144 ! -- Flag14 used as Flag35, Flag56, Flag145 ! -- Flag15 used as Flag36, Flag57, Flag146 ! -- Flag16 used as Flag37, Flag58, Flag147 ! -- Flag17 used as Flag38, Flag59, Flag148 ! -- Flag18 used as Flag39, Flag60, Flag149 ! -- Pflag1 used as Flag61, Flag62, Flag150 ! -- Pflag2 used as Flag63, Flag64, Flag151 Nkind : Node_Kind; -- For a non-extended node, or the initial section of an extended --- 3140,3171 ---- Flag18 : Boolean; -- The eighteen flags for a normal node ! -- The above fields are used as follows in components 2-5 of ! -- an extended node entry. ! -- In_List used as Flag19, Flag40, Flag129, Flag216 ! -- Has_Aspects used as Flag20, Flag41, Flag130, Flag217 ! -- Rewrite_Ins used as Flag21, Flag42, Flag131, Flag218 ! -- Analyzed used as Flag22, Flag43, Flag132, Flag219 ! -- Comes_From_Source used as Flag23, Flag44, Flag133, Flag220 ! -- Error_Posted used as Flag24, Flag45, Flag134, Flag221 ! -- Flag4 used as Flag25, Flag46, Flag135, Flag222 ! -- Flag5 used as Flag26, Flag47, Flag136, Flag223 ! -- Flag6 used as Flag27, Flag48, Flag137, Flag224 ! -- Flag7 used as Flag28, Flag49, Flag138, Flag225 ! -- Flag8 used as Flag29, Flag50, Flag139, Flag226 ! -- Flag9 used as Flag30, Flag51, Flag140, Flag227 ! -- Flag10 used as Flag31, Flag52, Flag141, Flag228 ! -- Flag11 used as Flag32, Flag53, Flag142, Flag229 ! -- Flag12 used as Flag33, Flag54, Flag143, Flag230 ! -- Flag13 used as Flag34, Flag55, Flag144, Flag231 ! -- Flag14 used as Flag35, Flag56, Flag145, Flag232 ! -- Flag15 used as Flag36, Flag57, Flag146, Flag233 ! -- Flag16 used as Flag37, Flag58, Flag147, Flag234 ! -- Flag17 used as Flag38, Flag59, Flag148, Flag235 ! -- Flag18 used as Flag39, Flag60, Flag149, Flag236 ! -- Pflag1 used as Flag61, Flag62, Flag150, Flag237 ! -- Pflag2 used as Flag63, Flag64, Flag151, Flag238 Nkind : Node_Kind; -- For a non-extended node, or the initial section of an extended *************** package Atree is *** 3012,3018 **** -- -- Second entry: holds the Ekind field of the entity -- Third entry: holds 8 additional flags (Flag65-Flag72) ! -- Fourth entry: not currently used -- Now finally (on an 32-bit boundary!) comes the variant part --- 3174,3181 ---- -- -- Second entry: holds the Ekind field of the entity -- Third entry: holds 8 additional flags (Flag65-Flag72) ! -- Fourth entry: holds 8 additional flags (Flag239-246) ! -- Fifth entry: holds 8 additional flags (Flag247-254) -- Now finally (on an 32-bit boundary!) comes the variant part *************** package Atree is *** 3075,3083 **** -- above is used to hold additional general fields and flags -- as follows: ! -- Field6-10 Holds Field24-Field28 ! -- Field11 Holds Flag184-Flag215 ! -- Field12 Holds Flag216-Flag247 end case; end record; --- 3238,3245 ---- -- above is used to hold additional general fields and flags -- as follows: ! -- Field6-11 Holds Field24-Field29 ! -- Field12 Holds Flag184-Flag215 end case; end record; *************** package Atree is *** 3097,3103 **** Pflag1 => False, Pflag2 => False, In_List => False, ! Unused_1 => False, Rewrite_Ins => False, Analyzed => False, Comes_From_Source => False, --- 3259,3265 ---- Pflag1 => False, Pflag2 => False, In_List => False, ! Has_Aspects => False, Rewrite_Ins => False, Analyzed => False, Comes_From_Source => False, *************** package Atree is *** 3142,3148 **** Pflag1 => False, Pflag2 => False, In_List => False, ! Unused_1 => False, Rewrite_Ins => False, Analyzed => False, Comes_From_Source => False, --- 3304,3310 ---- Pflag1 => False, Pflag2 => False, In_List => False, ! Has_Aspects => False, Rewrite_Ins => False, Analyzed => False, Comes_From_Source => False, diff -Nrcpad gcc-4.5.2/gcc/ada/atree.h gcc-4.6.0/gcc/ada/atree.h *** gcc-4.5.2/gcc/ada/atree.h Thu Apr 9 10:15:20 2009 --- gcc-4.6.0/gcc/ada/atree.h Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** * * * C Header File * * * ! * 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** *** 36,51 **** struct NFK { ! Boolean is_extension : 1; ! Boolean pflag1 : 1; ! Boolean pflag2 : 1; ! Boolean in_list : 1; ! Boolean rewrite_sub : 1; ! Boolean rewrite_ins : 1; ! Boolean analyzed : 1; ! Boolean c_f_s : 1; ! Boolean error_posted : 1; Boolean flag4 : 1; Boolean flag5 : 1; Boolean flag6 : 1; --- 36,51 ---- struct NFK { ! Boolean is_extension : 1; ! Boolean pflag1 : 1; ! Boolean pflag2 : 1; ! Boolean in_list : 1; ! Boolean has_aspects : 1; ! Boolean rewrite_ins : 1; ! Boolean analyzed : 1; ! Boolean c_f_s : 1; Boolean error_posted : 1; + Boolean flag4 : 1; Boolean flag5 : 1; Boolean flag6 : 1; *************** struct NFK *** 71,86 **** struct NFNK { ! Boolean is_extension : 1; ! Boolean pflag1 : 1; ! Boolean pflag2 : 1; ! Boolean in_list : 1; ! Boolean rewrite_sub : 1; ! Boolean rewrite_ins : 1; ! Boolean analyzed : 1; ! Boolean c_f_s : 1; ! Boolean error_posted : 1; Boolean flag4 : 1; Boolean flag5 : 1; Boolean flag6 : 1; --- 71,86 ---- struct NFNK { ! Boolean is_extension : 1; ! Boolean pflag1 : 1; ! Boolean pflag2 : 1; ! Boolean in_list : 1; ! Boolean has_aspects : 1; ! Boolean rewrite_ins : 1; ! Boolean analyzed : 1; ! Boolean c_f_s : 1; Boolean error_posted : 1; + Boolean flag4 : 1; Boolean flag5 : 1; Boolean flag6 : 1; *************** struct Flag_Word3 *** 215,221 **** Boolean flag183 : 1; }; ! /* Structure used for extra flags in fifth component overlaying Field11 */ struct Flag_Word4 { Boolean flag184 : 1; --- 215,221 ---- Boolean flag183 : 1; }; ! /* Structure used for extra flags in fifth component overlaying Field12 */ struct Flag_Word4 { Boolean flag184 : 1; *************** struct Flag_Word4 *** 255,300 **** Boolean flag215 : 1; }; - /* Structure used for extra flags in fifth component overlaying Field12 */ - struct Flag_Word5 - { - Boolean flag216 : 1; - Boolean flag217 : 1; - Boolean flag218 : 1; - Boolean flag219 : 1; - Boolean flag220 : 1; - Boolean flag221 : 1; - Boolean flag222 : 1; - Boolean flag223 : 1; - - Boolean flag224 : 1; - Boolean flag225 : 1; - Boolean flag226 : 1; - Boolean flag227 : 1; - Boolean flag228 : 1; - Boolean flag229 : 1; - Boolean flag230 : 1; - Boolean flag231 : 1; - - Boolean flag232 : 1; - Boolean flag233 : 1; - Boolean flag234 : 1; - Boolean flag235 : 1; - Boolean flag236 : 1; - Boolean flag237 : 1; - Boolean flag238 : 1; - Boolean flag239 : 1; - - Boolean flag240 : 1; - Boolean flag241 : 1; - Boolean flag242 : 1; - Boolean flag243 : 1; - Boolean flag244 : 1; - Boolean flag245 : 1; - Boolean flag246 : 1; - Boolean flag247 : 1; - }; - struct Non_Extended { Source_Ptr sloc; --- 255,260 ---- *************** struct Extended *** 318,324 **** { Int field11; struct Flag_Word3 fw3; - struct Flag_Word4 fw4; } X; union --- 278,283 ---- *************** struct Extended *** 326,332 **** Int field12; struct Flag_Word fw; struct Flag_Word2 fw2; ! struct Flag_Word5 fw5; } U; }; --- 285,291 ---- Int field12; struct Flag_Word fw; struct Flag_Word2 fw2; ! struct Flag_Word4 fw4; } U; }; *************** extern Node_Id Current_Error_Node; *** 423,428 **** --- 382,388 ---- #define Field26(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.field8) #define Field27(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.field9) #define Field28(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.field10) + #define Field29(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.field11) #define Node1(N) Field1 (N) #define Node2(N) Field2 (N) *************** extern Node_Id Current_Error_Node; *** 452,457 **** --- 412,418 ---- #define Node26(N) Field26 (N) #define Node27(N) Field27 (N) #define Node28(N) Field28 (N) + #define Node29(N) Field29 (N) #define List1(N) Field1 (N) #define List2(N) Field2 (N) *************** extern Node_Id Current_Error_Node; *** 460,471 **** --- 421,434 ---- #define List5(N) Field5 (N) #define List10(N) Field10 (N) #define List14(N) Field14 (N) + #define List25(N) Field25 (N) #define Elist1(N) Field1 (N) #define Elist2(N) Field2 (N) #define Elist3(N) Field3 (N) #define Elist4(N) Field4 (N) #define Elist8(N) Field8 (N) + #define Elist10(N) Field10 (N) #define Elist13(N) Field13 (N) #define Elist15(N) Field15 (N) #define Elist16(N) Field16 (N) *************** extern Node_Id Current_Error_Node; *** 505,510 **** --- 468,474 ---- #define Analyzed(N) (Nodes_Ptr[(N) - First_Node_Id].U.K.analyzed) #define Comes_From_Source(N) (Nodes_Ptr[(N) - First_Node_Id].U.K.c_f_s) #define Error_Posted(N) (Nodes_Ptr[(N) - First_Node_Id].U.K.error_posted) + #define Has_Aspects(N) (Nodes_Ptr[(N) - First_Node_Id].U.K.has_aspects) #define Convention(N) \ (Nodes_Ptr[(N) - First_Node_Id + 2].V.EX.U.fw.convention) *************** extern Node_Id Current_Error_Node; *** 525,531 **** #define Flag18(N) (Nodes_Ptr[(N) - First_Node_Id].U.K.flag18) #define Flag19(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.in_list) ! #define Flag20(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.rewrite_sub) #define Flag21(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.rewrite_ins) #define Flag22(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.analyzed) #define Flag23(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.c_f_s) --- 489,495 ---- #define Flag18(N) (Nodes_Ptr[(N) - First_Node_Id].U.K.flag18) #define Flag19(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.in_list) ! #define Flag20(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.has_aspects) #define Flag21(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.rewrite_ins) #define Flag22(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.analyzed) #define Flag23(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.c_f_s) *************** extern Node_Id Current_Error_Node; *** 547,553 **** #define Flag39(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.flag18) #define Flag40(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.in_list) ! #define Flag41(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.rewrite_sub) #define Flag42(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.rewrite_ins) #define Flag43(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.analyzed) #define Flag44(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.c_f_s) --- 511,517 ---- #define Flag39(N) (Nodes_Ptr[(N) - First_Node_Id + 1].U.K.flag18) #define Flag40(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.in_list) ! #define Flag41(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.has_aspects) #define Flag42(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.rewrite_ins) #define Flag43(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.analyzed) #define Flag44(N) (Nodes_Ptr[(N) - First_Node_Id + 2].U.K.c_f_s) *************** extern Node_Id Current_Error_Node; *** 639,645 **** #define Flag128(N) (Nodes_Ptr[(N) - First_Node_Id + 3].V.EX.U.fw2.flag128) #define Flag129(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.in_list) ! #define Flag130(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.rewrite_sub) #define Flag131(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.rewrite_ins) #define Flag132(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.analyzed) #define Flag133(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.c_f_s) --- 603,609 ---- #define Flag128(N) (Nodes_Ptr[(N) - First_Node_Id + 3].V.EX.U.fw2.flag128) #define Flag129(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.in_list) ! #define Flag130(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.has_aspects) #define Flag131(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.rewrite_ins) #define Flag132(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.analyzed) #define Flag133(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.K.c_f_s) *************** extern Node_Id Current_Error_Node; *** 695,762 **** #define Flag182(N) (Nodes_Ptr[(N) - First_Node_Id + 3].V.EX.X.fw3.flag182) #define Flag183(N) (Nodes_Ptr[(N) - First_Node_Id + 3].V.EX.X.fw3.flag183) ! #define Flag184(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag184) ! #define Flag185(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag185) ! #define Flag186(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag186) ! #define Flag187(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag187) ! #define Flag188(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag188) ! #define Flag189(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag189) ! #define Flag190(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag190) ! #define Flag191(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag191) ! #define Flag192(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag192) ! #define Flag193(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag193) ! #define Flag194(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag194) ! #define Flag195(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag195) ! #define Flag196(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag196) ! #define Flag197(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag197) ! #define Flag198(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag198) ! #define Flag199(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag199) ! #define Flag200(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag200) ! #define Flag201(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag201) ! #define Flag202(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag202) ! #define Flag203(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag203) ! #define Flag204(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag204) ! #define Flag205(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag205) ! #define Flag206(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag206) ! #define Flag207(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag207) ! #define Flag208(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag208) ! #define Flag209(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag209) ! #define Flag210(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag210) ! #define Flag211(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag211) ! #define Flag212(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag212) ! #define Flag213(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag213) ! #define Flag214(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag214) ! #define Flag215(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag215) - #define Flag216(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag216) - #define Flag217(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag217) - #define Flag218(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag218) - #define Flag219(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag219) - #define Flag220(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag220) - #define Flag221(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag221) - #define Flag222(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag222) - #define Flag223(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag223) - #define Flag224(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag224) - #define Flag225(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag225) - #define Flag226(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag226) - #define Flag227(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag227) - #define Flag228(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag228) - #define Flag229(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag229) - #define Flag230(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag230) - #define Flag231(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag231) - #define Flag232(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag232) - #define Flag233(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag233) - #define Flag234(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag234) - #define Flag235(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag235) - #define Flag236(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag236) - #define Flag237(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag237) - #define Flag238(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag238) - #define Flag239(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag239) - #define Flag240(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag240) - #define Flag241(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag241) - #define Flag242(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag242) - #define Flag243(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag243) - #define Flag244(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag244) - #define Flag245(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag245) - #define Flag246(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag246) - #define Flag247(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag247) --- 659,736 ---- #define Flag182(N) (Nodes_Ptr[(N) - First_Node_Id + 3].V.EX.X.fw3.flag182) #define Flag183(N) (Nodes_Ptr[(N) - First_Node_Id + 3].V.EX.X.fw3.flag183) ! #define Flag184(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag184) ! #define Flag185(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag185) ! #define Flag186(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag186) ! #define Flag187(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag187) ! #define Flag188(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag188) ! #define Flag189(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag189) ! #define Flag190(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag190) ! #define Flag191(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag191) ! #define Flag192(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag192) ! #define Flag193(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag193) ! #define Flag194(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag194) ! #define Flag195(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag195) ! #define Flag196(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag196) ! #define Flag197(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag197) ! #define Flag198(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag198) ! #define Flag199(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag199) ! #define Flag200(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag200) ! #define Flag201(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag201) ! #define Flag202(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag202) ! #define Flag203(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag203) ! #define Flag204(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag204) ! #define Flag205(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag205) ! #define Flag206(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag206) ! #define Flag207(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag207) ! #define Flag208(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag208) ! #define Flag209(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag209) ! #define Flag210(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag210) ! #define Flag211(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag211) ! #define Flag212(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag212) ! #define Flag213(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag213) ! #define Flag214(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag214) ! #define Flag215(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw4.flag215) ! ! #define Flag216(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.in_list) ! #define Flag217(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.has_aspects) ! #define Flag218(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.rewrite_ins) ! #define Flag219(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.analyzed) ! #define Flag220(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.c_f_s) ! #define Flag221(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.error_posted) ! #define Flag222(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag4) ! #define Flag223(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag5) ! #define Flag224(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag6) ! #define Flag225(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag7) ! #define Flag226(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag8) ! #define Flag227(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag9) ! #define Flag228(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag10) ! #define Flag229(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag11) ! #define Flag230(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag12) ! #define Flag231(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag13) ! #define Flag232(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag14) ! #define Flag233(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag15) ! #define Flag234(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag16) ! #define Flag235(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag17) ! #define Flag236(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.flag18) ! #define Flag237(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.pflag1) ! #define Flag238(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.K.pflag2) ! ! #define Flag239(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag65) ! #define Flag240(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag66) ! #define Flag241(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag67) ! #define Flag242(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag68) ! #define Flag243(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag69) ! #define Flag244(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag70) ! #define Flag245(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag71) ! #define Flag246(N) (Nodes_Ptr[(N) - First_Node_Id + 3].U.NK.flag72) ! ! #define Flag247(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag65) ! #define Flag248(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag66) ! #define Flag249(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag67) ! #define Flag250(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag68) ! #define Flag251(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag69) ! #define Flag252(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag70) ! #define Flag253(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag71) ! #define Flag254(N) (Nodes_Ptr[(N) - First_Node_Id + 4].U.NK.flag72) diff -Nrcpad gcc-4.5.2/gcc/ada/back_end.adb gcc-4.6.0/gcc/ada/back_end.adb *** gcc-4.5.2/gcc/ada/back_end.adb Sun May 24 09:14:53 2009 --- gcc-4.6.0/gcc/ada/back_end.adb Tue Oct 5 10:07:35 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,31 **** --- 26,32 ---- with Atree; use Atree; with Debug; use Debug; with Elists; use Elists; + with Errout; use Errout; with Lib; use Lib; with Osint; use Osint; with Opt; use Opt; *************** with Switch.C; use Switch.C; *** 40,47 **** --- 41,69 ---- with System; use System; with Types; use Types; + with System.OS_Lib; use System.OS_Lib; + package body Back_End is + type Arg_Array is array (Nat) of Big_String_Ptr; + type Arg_Array_Ptr is access Arg_Array; + -- Types to access compiler arguments + + flag_stack_check : Int; + pragma Import (C, flag_stack_check); + -- Indicates if stack checking is enabled, imported from decl.c + + save_argc : Nat; + pragma Import (C, save_argc); + -- Saved value of argc (number of arguments), imported from misc.c + + save_argv : Arg_Array_Ptr; + pragma Import (C, save_argv); + -- Saved value of argv (argument pointers), imported from misc.c + + function Len_Arg (Arg : Pos) return Nat; + -- Determine length of argument number Arg on original gnat1 command line + ------------------- -- Call_Back_End -- ------------------- *************** package body Back_End is *** 78,83 **** --- 100,106 ---- file_info_ptr : Address; gigi_standard_boolean : Entity_Id; gigi_standard_integer : Entity_Id; + gigi_standard_character : Entity_Id; gigi_standard_long_long_float : Entity_Id; gigi_standard_exception_type : Entity_Id; gigi_operating_mode : Back_End_Mode_Type); *************** package body Back_End is *** 96,101 **** --- 119,135 ---- File_Info_Array (J).Num_Source_Lines := Num_Source_Lines (J); end loop; + if Generate_SCIL then + Error_Msg_N ("'S'C'I'L generation not available", Cunit (Main_Unit)); + + if CodePeer_Mode + or else (Mode /= Generate_Object + and then not Back_Annotate_Rep_Info) + then + return; + end if; + end if; + gigi (gnat_root => Int (Cunit (Main_Unit)), max_gnat_node => Int (Last_Node_Id - First_Node_Id + 1), *************** package body Back_End is *** 115,156 **** file_info_ptr => File_Info_Array'Address, gigi_standard_boolean => Standard_Boolean, gigi_standard_integer => Standard_Integer, gigi_standard_long_long_float => Standard_Long_Long_Float, gigi_standard_exception_type => Standard_Exception_Type, gigi_operating_mode => Mode); end Call_Back_End; ----------------------------- -- Scan_Compiler_Arguments -- ----------------------------- procedure Scan_Compiler_Arguments is - Next_Arg : Pos := 1; - - type Arg_Array is array (Nat) of Big_String_Ptr; - type Arg_Array_Ptr is access Arg_Array; - - flag_stack_check : Int; - pragma Import (C, flag_stack_check); - -- Import from toplev.c ! save_argc : Nat; ! pragma Import (C, save_argc); ! -- Import from toplev.c ! ! save_argv : Arg_Array_Ptr; ! pragma Import (C, save_argv); ! -- Import from toplev.c Output_File_Name_Seen : Boolean := False; -- Set to True after having scanned file_name for switch "-gnatO file" - -- Local functions - - function Len_Arg (Arg : Pos) return Nat; - -- Determine length of argument number Arg on the original command line - -- from gnat1. - procedure Scan_Back_End_Switches (Switch_Chars : String); -- Procedure to scan out switches stored in Switch_Chars. The first -- character is known to be a valid switch character, and there are no --- 149,187 ---- file_info_ptr => File_Info_Array'Address, gigi_standard_boolean => Standard_Boolean, gigi_standard_integer => Standard_Integer, + gigi_standard_character => Standard_Character, gigi_standard_long_long_float => Standard_Long_Long_Float, gigi_standard_exception_type => Standard_Exception_Type, gigi_operating_mode => Mode); end Call_Back_End; + ------------- + -- Len_Arg -- + ------------- + + function Len_Arg (Arg : Pos) return Nat is + begin + for J in 1 .. Nat'Last loop + if save_argv (Arg).all (Natural (J)) = ASCII.NUL then + return J - 1; + end if; + end loop; + + raise Program_Error; + end Len_Arg; + ----------------------------- -- Scan_Compiler_Arguments -- ----------------------------- procedure Scan_Compiler_Arguments is ! Next_Arg : Positive; ! -- Next argument to be scanned Output_File_Name_Seen : Boolean := False; -- Set to True after having scanned file_name for switch "-gnatO file" procedure Scan_Back_End_Switches (Switch_Chars : String); -- Procedure to scan out switches stored in Switch_Chars. The first -- character is known to be a valid switch character, and there are no *************** package body Back_End is *** 163,183 **** -- switches must still be scanned to skip "-o" or internal GCC switches -- with their argument. - ------------- - -- Len_Arg -- - ------------- - - function Len_Arg (Arg : Pos) return Nat is - begin - for J in 1 .. Nat'Last loop - if save_argv (Arg).all (Natural (J)) = ASCII.NUL then - return J - 1; - end if; - end loop; - - raise Program_Error; - end Len_Arg; - ---------------------------- -- Scan_Back_End_Switches -- ---------------------------- --- 194,199 ---- *************** package body Back_End is *** 220,225 **** --- 236,246 ---- end if; end Scan_Back_End_Switches; + -- Local variables + + Arg_Count : constant Natural := Natural (save_argc - 1); + Args : Argument_List (1 .. Arg_Count); + -- Start of processing for Scan_Compiler_Arguments begin *************** package body Back_End is *** 227,240 **** Opt.Stack_Checking_Enabled := (flag_stack_check /= 0); ! -- Loop through command line arguments, storing them for later access ! while Next_Arg < save_argc loop ! Look_At_Arg : declare ! 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 --- 248,272 ---- Opt.Stack_Checking_Enabled := (flag_stack_check /= 0); ! -- Put the arguments in Args ! for Arg in Pos range 1 .. save_argc - 1 loop ! declare ! Argv_Ptr : constant Big_String_Ptr := save_argv (Arg); ! Argv_Len : constant Nat := Len_Arg (Arg); Argv : constant String := Argv_Ptr (1 .. Natural (Argv_Len)); + begin + Args (Positive (Arg)) := new String'(Argv); + end; + end loop; + + -- Loop through command line arguments, storing them for later access + + Next_Arg := 1; + while Next_Arg <= Args'Last loop + Look_At_Arg : declare + Argv : constant String := Args (Next_Arg).all; begin -- If the previous switch has set the Output_File_Name_Present *************** package body Back_End is *** 281,287 **** Opt.No_Stdlib := True; elsif Is_Front_End_Switch (Argv) then ! Scan_Front_End_Switches (Argv); -- All non-front-end switches are back-end switches --- 313,319 ---- Opt.No_Stdlib := True; elsif Is_Front_End_Switch (Argv) then ! Scan_Front_End_Switches (Argv, Args, Next_Arg); -- All non-front-end switches are back-end switches *************** package body Back_End is *** 293,297 **** Next_Arg := Next_Arg + 1; end loop; end Scan_Compiler_Arguments; - end Back_End; --- 325,328 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/back_end.ads gcc-4.6.0/gcc/ada/back_end.ads *** gcc-4.5.2/gcc/ada/back_end.ads Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/back_end.ads Tue Oct 5 09:57:10 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Back_End is *** 35,41 **** Declarations_Only, -- Partial back end operation with no object file generation. In this -- mode the only useful action performed by gigi is to process all ! -- declarations issuing any error messages (in partcicular those to -- do with rep clauses), and to back annotate representation info. Skip); --- 35,41 ---- Declarations_Only, -- Partial back end operation with no object file generation. In this -- mode the only useful action performed by gigi is to process all ! -- declarations issuing any error messages (in particular those to -- do with rep clauses), and to back annotate representation info. Skip); diff -Nrcpad gcc-4.5.2/gcc/ada/bcheck.adb gcc-4.6.0/gcc/ada/bcheck.adb *** gcc-4.5.2/gcc/ada/bcheck.adb Mon Nov 30 09:42:59 2009 --- gcc-4.6.0/gcc/ada/bcheck.adb Fri Oct 8 12:54:03 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Bcheck is *** 854,859 **** --- 854,875 ---- -- Start of processing for Check_Consistent_Restrictions begin + -- A special test, if we have a main program, then if it has an + -- allocator in the body, this is considered to be a violation of + -- the restriction No_Allocators_After_Elaboration. We just mark + -- this restriction and then the normal circuit will flag it. + + if Bind_Main_Program + and then ALIs.Table (ALIs.First).Main_Program /= None + and then not No_Main_Subprogram + and then ALIs.Table (ALIs.First).Allocator_In_Body + then + Cumulative_Restrictions.Violated + (No_Allocators_After_Elaboration) := True; + ALIs.Table (ALIs.First).Restrictions.Violated + (No_Allocators_After_Elaboration) := True; + end if; + -- Loop through all restriction violations for R in All_Restrictions loop diff -Nrcpad gcc-4.5.2/gcc/ada/binde.adb gcc-4.6.0/gcc/ada/binde.adb *** gcc-4.5.2/gcc/ada/binde.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/binde.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Binde is *** 224,248 **** After : Unit_Id; R : Succ_Reason; Ea_Id : Elab_All_Id := No_Elab_All_Link); ! -- Establish a successor link, Before must be elaborated before After, ! -- and the reason for the link is R. Ea_Id is the contents to be placed ! -- in the Elab_All_Link of the entry. procedure Choose (Chosen : Unit_Id); ! -- Chosen is the next entry chosen in the elaboration order. This ! -- procedure updates all data structures appropriately. function Corresponding_Body (U : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Body); ! -- Given a unit which is a spec for which there is a separate body, ! -- return the unit id of the body. It is an error to call this routine ! -- with a unit that is not a spec, or which does not have a separate body. function Corresponding_Spec (U : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Spec); ! -- Given a unit which is a body for which there is a separate spec, ! -- return the unit id of the spec. It is an error to call this routine ! -- with a unit that is not a body, or which does not have a separate spec. procedure Diagnose_Elaboration_Problem; -- Called when no elaboration order can be found. Outputs an appropriate --- 224,248 ---- After : Unit_Id; R : Succ_Reason; Ea_Id : Elab_All_Id := No_Elab_All_Link); ! -- Establish a successor link, Before must be elaborated before After, and ! -- the reason for the link is R. Ea_Id is the contents to be placed in the ! -- Elab_All_Link of the entry. procedure Choose (Chosen : Unit_Id); ! -- Chosen is the next entry chosen in the elaboration order. This procedure ! -- updates all data structures appropriately. function Corresponding_Body (U : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Body); ! -- Given a unit which is a spec for which there is a separate body, return ! -- the unit id of the body. It is an error to call this routine with a unit ! -- that is not a spec, or which does not have a separate body. function Corresponding_Spec (U : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Spec); ! -- Given a unit which is a body for which there is a separate spec, return ! -- the unit id of the spec. It is an error to call this routine with a unit ! -- that is not a body, or which does not have a separate spec. procedure Diagnose_Elaboration_Problem; -- Called when no elaboration order can be found. Outputs an appropriate *************** package body Binde is *** 276,281 **** --- 276,285 ---- pragma Inline (Is_Body_Unit); -- Determines if given unit is a body + function Is_Pure_Or_Preelab_Unit (U : Unit_Id) return Boolean; + -- Returns True if corresponding unit is Pure or Preelaborate. Includes + -- dealing with testing flags on spec if it is given a body. + function Is_Waiting_Body (U : Unit_Id) return Boolean; pragma Inline (Is_Waiting_Body); -- Determines if U is a waiting body, defined as a body which has *************** package body Binde is *** 286,301 **** Link : Elab_All_Id) return Elab_All_Id; -- Make an Elab_All_Entries table entry with the given Unam and Link ! function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id; ! -- This function uses the Info field set in the names table to obtain ! -- the unit Id of a unit, given its name id value. ! ! function Worse_Choice (U1, U2 : Unit_Id) return Boolean; -- This is like Better_Choice, and has the same interface, but returns ! -- true if U1 is a worse choice than U2 in the sense of the -h (horrible -- elaboration order) switch. We still have to obey Ada rules, so it is -- not quite the direct inverse of Better_Choice. procedure Write_Dependencies; -- Write out dependencies (called only if appropriate option is set) --- 290,305 ---- Link : Elab_All_Id) return Elab_All_Id; -- Make an Elab_All_Entries table entry with the given Unam and Link ! function Pessimistic_Better_Choice (U1, U2 : Unit_Id) return Boolean; -- This is like Better_Choice, and has the same interface, but returns ! -- true if U1 is a worse choice than U2 in the sense of the -p (pessimistic -- elaboration order) switch. We still have to obey Ada rules, so it is -- not quite the direct inverse of Better_Choice. + function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id; + -- This function uses the Info field set in the names table to obtain + -- the unit Id of a unit, given its name id value. + procedure Write_Dependencies; -- Write out dependencies (called only if appropriate option is set) *************** package body Binde is *** 323,329 **** -- Note: the checks here are applied in sequence, and the ordering is -- significant (i.e. the more important criteria are applied first). ! -- Prefer a waiting body to any other case if Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then if Debug_Flag_B then --- 327,333 ---- -- Note: the checks here are applied in sequence, and the ordering is -- significant (i.e. the more important criteria are applied first). ! -- Prefer a waiting body to one that is not a waiting body if Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then if Debug_Flag_B then *************** package body Binde is *** 370,375 **** --- 374,401 ---- return False; + -- Prefer a pure or preelaborable unit to one that is not + + elsif Is_Pure_Or_Preelab_Unit (U1) + and then not + Is_Pure_Or_Preelab_Unit (U2) + then + if Debug_Flag_B then + Write_Line (" True: u1 is pure/preelab, u2 is not"); + end if; + + return True; + + elsif Is_Pure_Or_Preelab_Unit (U2) + and then not + Is_Pure_Or_Preelab_Unit (U1) + then + if Debug_Flag_B then + Write_Line (" False: u2 is pure/preelab, u1 is not"); + end if; + + return False; + -- Prefer a body to a spec elsif Is_Body_Unit (U1) and then not Is_Body_Unit (U2) then *************** package body Binde is *** 588,594 **** Write_Str (" decrementing Num_Pred for unit "); Write_Unit_Name (Units.Table (U).Uname); Write_Str (" new value = "); ! Write_Int (Int (UNR.Table (U).Num_Pred)); Write_Eol; end if; --- 614,620 ---- Write_Str (" decrementing Num_Pred for unit "); Write_Unit_Name (Units.Table (U).Uname); Write_Str (" new value = "); ! Write_Int (UNR.Table (U).Num_Pred); Write_Eol; end if; *************** package body Binde is *** 1126,1132 **** Write_Str (" Elaborate_Body = True, Num_Pred for body = "); Write_Int ! (Int (UNR.Table (Corresponding_Body (U)).Num_Pred)); else Write_Str (" Elaborate_Body = False"); --- 1152,1158 ---- Write_Str (" Elaborate_Body = True, Num_Pred for body = "); Write_Int ! (UNR.Table (Corresponding_Body (U)).Num_Pred); else Write_Str (" Elaborate_Body = False"); *************** package body Binde is *** 1141,1147 **** or else ((not Pessimistic_Elab_Order) and then Better_Choice (U, Best_So_Far)) or else (Pessimistic_Elab_Order ! and then Worse_Choice (U, Best_So_Far)) then if Debug_Flag_N then Write_Str (" tentatively chosen (best so far)"); --- 1167,1173 ---- or else ((not Pessimistic_Elab_Order) and then Better_Choice (U, Best_So_Far)) or else (Pessimistic_Elab_Order ! and then Pessimistic_Better_Choice (U, Best_So_Far)) then if Debug_Flag_N then Write_Str (" tentatively chosen (best so far)"); *************** package body Binde is *** 1217,1224 **** goto Next_With; end if; ! Withed_Unit := ! Unit_Id (Unit_Id_Of (Withs.Table (W).Uname)); -- Pragma Elaborate_All case, for this we use the recursive -- Elab_All_Links procedure to establish the links. --- 1243,1249 ---- goto Next_With; end if; ! Withed_Unit := Unit_Id_Of (Withs.Table (W).Uname); -- Pragma Elaborate_All case, for this we use the recursive -- Elab_All_Links procedure to establish the links. *************** package body Binde is *** 1321,1326 **** --- 1346,1373 ---- or else Units.Table (U).Utype = Is_Body_Only; end Is_Body_Unit; + ----------------------------- + -- Is_Pure_Or_Preelab_Unit -- + ----------------------------- + + function Is_Pure_Or_Preelab_Unit (U : Unit_Id) return Boolean is + begin + -- If we have a body with separate spec, test flags on the spec + + if Units.Table (U).Utype = Is_Body then + return Units.Table (U + 1).Preelab + or else + Units.Table (U + 1).Pure; + + -- Otherwise we have a spec or body acting as spec, test flags on unit + + else + return Units.Table (U).Preelab + or else + Units.Table (U).Pure; + end if; + end Is_Pure_Or_Preelab_Unit; + --------------------- -- Is_Waiting_Body -- --------------------- *************** package body Binde is *** 1346,1396 **** return Elab_All_Entries.Last; end Make_Elab_Entry; ! ---------------- ! -- Unit_Id_Of -- ! ---------------- ! ! function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id is ! Info : constant Int := Get_Name_Table_Info (Uname); ! begin ! pragma Assert (Info /= 0 and then Unit_Id (Info) /= No_Unit_Id); ! return Unit_Id (Info); ! end Unit_Id_Of; ! ! ------------------ ! -- Worse_Choice -- ! ------------------ ! function Worse_Choice (U1, U2 : Unit_Id) return Boolean is UT1 : Unit_Record renames Units.Table (U1); UT2 : Unit_Record renames Units.Table (U2); begin -- Note: the checks here are applied in sequence, and the ordering is -- significant (i.e. the more important criteria are applied first). ! -- If either unit is internal, then use Better_Choice, since the ! -- language requires that predefined units not mess up in the choice ! -- of elaboration order, and for internal units, any problems are ! -- ours and not the programmers. ! if UT1.Internal or else UT2.Internal then ! return Better_Choice (U1, U2); ! -- Prefer anything else to a waiting body (!) elsif Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then return False; elsif Is_Waiting_Body (U2) and then not Is_Waiting_Body (U1) then return True; -- Prefer a spec to a body (!) elsif Is_Body_Unit (U1) and then not Is_Body_Unit (U2) then return False; elsif Is_Body_Unit (U2) and then not Is_Body_Unit (U1) then return True; -- If both are waiting bodies, then prefer the one whose spec is --- 1393,1507 ---- return Elab_All_Entries.Last; end Make_Elab_Entry; ! ------------------------------- ! -- Pessimistic_Better_Choice -- ! ------------------------------- ! function Pessimistic_Better_Choice (U1, U2 : Unit_Id) return Boolean is UT1 : Unit_Record renames Units.Table (U1); UT2 : Unit_Record renames Units.Table (U2); begin + if Debug_Flag_B then + Write_Str ("Pessimistic_Better_Choice ("); + Write_Unit_Name (UT1.Uname); + Write_Str (", "); + Write_Unit_Name (UT2.Uname); + Write_Line (")"); + end if; + -- Note: the checks here are applied in sequence, and the ordering is -- significant (i.e. the more important criteria are applied first). ! -- If either unit is predefined or internal, then we use the normal ! -- Better_Choice rule, since we don't want to disturb the elaboration ! -- rules of the language with -p, same treatment for Pure/Preelab. ! -- Prefer a predefined unit to a non-predefined unit ! if UT1.Predefined and then not UT2.Predefined then ! if Debug_Flag_B then ! Write_Line (" True: u1 is predefined, u2 is not"); ! end if; ! ! return True; ! ! elsif UT2.Predefined and then not UT1.Predefined then ! if Debug_Flag_B then ! Write_Line (" False: u2 is predefined, u1 is not"); ! end if; ! ! return False; ! ! -- Prefer an internal unit to a non-internal unit ! ! elsif UT1.Internal and then not UT2.Internal then ! if Debug_Flag_B then ! Write_Line (" True: u1 is internal, u2 is not"); ! end if; ! ! return True; ! ! elsif UT2.Internal and then not UT1.Internal then ! if Debug_Flag_B then ! Write_Line (" False: u2 is internal, u1 is not"); ! end if; ! ! return False; ! ! -- Prefer a pure or preelaborable unit to one that is not ! ! elsif Is_Pure_Or_Preelab_Unit (U1) ! and then not ! Is_Pure_Or_Preelab_Unit (U2) ! then ! if Debug_Flag_B then ! Write_Line (" True: u1 is pure/preelab, u2 is not"); ! end if; ! ! return True; ! ! elsif Is_Pure_Or_Preelab_Unit (U2) ! and then not ! Is_Pure_Or_Preelab_Unit (U1) ! then ! if Debug_Flag_B then ! Write_Line (" False: u2 is pure/preelab, u1 is not"); ! end if; ! ! return False; ! ! -- Prefer anything else to a waiting body. We want to make bodies wait ! -- as long as possible, till we are forced to choose them! elsif Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then + if Debug_Flag_B then + Write_Line (" False: u1 is waiting body, u2 is not"); + end if; + return False; elsif Is_Waiting_Body (U2) and then not Is_Waiting_Body (U1) then + if Debug_Flag_B then + Write_Line (" True: u2 is waiting body, u1 is not"); + end if; + return True; -- Prefer a spec to a body (!) elsif Is_Body_Unit (U1) and then not Is_Body_Unit (U2) then + if Debug_Flag_B then + Write_Line (" False: u1 is body, u2 is not"); + end if; + return False; elsif Is_Body_Unit (U2) and then not Is_Body_Unit (U1) then + if Debug_Flag_B then + Write_Line (" True: u2 is body, u1 is not"); + end if; + return True; -- If both are waiting bodies, then prefer the one whose spec is *************** package body Binde is *** 1404,1415 **** -- A before the spec of B if it could. Since it could not, there it -- must be the case that A depends on B. It is therefore a good idea -- to put the body of B last so that if there is an elaboration order ! -- problem, we will find it (that's what horrible order is about) elsif Is_Waiting_Body (U1) and then Is_Waiting_Body (U2) then ! return ! UNR.Table (Corresponding_Spec (U1)).Elab_Position < ! UNR.Table (Corresponding_Spec (U2)).Elab_Position; end if; -- Remaining choice rules are disabled by Debug flag -do --- 1515,1538 ---- -- A before the spec of B if it could. Since it could not, there it -- must be the case that A depends on B. It is therefore a good idea -- to put the body of B last so that if there is an elaboration order ! -- problem, we will find it (that's what pessimistic order is about) elsif Is_Waiting_Body (U1) and then Is_Waiting_Body (U2) then ! declare ! Result : constant Boolean := ! UNR.Table (Corresponding_Spec (U1)).Elab_Position < ! UNR.Table (Corresponding_Spec (U2)).Elab_Position; ! begin ! if Debug_Flag_B then ! if Result then ! Write_Line (" True: based on waiting body elab positions"); ! else ! Write_Line (" False: based on waiting body elab positions"); ! end if; ! end if; ! ! return Result; ! end; end if; -- Remaining choice rules are disabled by Debug flag -do *************** package body Binde is *** 1420,1463 **** -- as Elaborate_Body_Desirable. In the normal case, we generally want -- to delay the elaboration of these specs as long as possible, so -- that bodies have better chance of being elaborated closer to the ! -- specs. Worse_Choice as usual wants to do the opposite and ! -- elaborate such specs as early as possible. -- If we have two units, one of which is a spec for which this flag -- is set, and the other is not, we normally prefer to delay the spec ! -- for which the flag is set, and so Worse_Choice does the opposite. if not UT1.Elaborate_Body_Desirable and then UT2.Elaborate_Body_Desirable then return False; elsif not UT2.Elaborate_Body_Desirable and then UT1.Elaborate_Body_Desirable then return True; -- If we have two specs that are both marked as Elaborate_Body -- desirable, we normally prefer the one whose body is nearer to -- being able to be elaborated, based on the Num_Pred count. This -- helps to ensure bodies are as close to specs as possible. As ! -- usual, Worse_Choice does the opposite. elsif UT1.Elaborate_Body_Desirable and then UT2.Elaborate_Body_Desirable then ! return UNR.Table (Corresponding_Body (U1)).Num_Pred >= ! UNR.Table (Corresponding_Body (U2)).Num_Pred; end if; end if; -- If we fall through, it means that no preference rule applies, so we -- use alphabetical order to at least give a deterministic result. Since ! -- Worse_Choice is in the business of stirring up the order, we will ! -- use reverse alphabetical ordering. return Uname_Less (UT2.Uname, UT1.Uname); ! end Worse_Choice; ------------------------ -- Write_Dependencies -- --- 1543,1623 ---- -- as Elaborate_Body_Desirable. In the normal case, we generally want -- to delay the elaboration of these specs as long as possible, so -- that bodies have better chance of being elaborated closer to the ! -- specs. Pessimistic_Better_Choice as usual wants to do the opposite ! -- and elaborate such specs as early as possible. -- If we have two units, one of which is a spec for which this flag -- is set, and the other is not, we normally prefer to delay the spec ! -- for which the flag is set, so again Pessimistic_Better_Choice does ! -- the opposite. if not UT1.Elaborate_Body_Desirable and then UT2.Elaborate_Body_Desirable then + if Debug_Flag_B then + Write_Line (" False: u1 is elab body desirable, u2 is not"); + end if; + return False; elsif not UT2.Elaborate_Body_Desirable and then UT1.Elaborate_Body_Desirable then + if Debug_Flag_B then + Write_Line (" True: u1 is elab body desirable, u2 is not"); + end if; + return True; -- If we have two specs that are both marked as Elaborate_Body -- desirable, we normally prefer the one whose body is nearer to -- being able to be elaborated, based on the Num_Pred count. This -- helps to ensure bodies are as close to specs as possible. As ! -- usual, Pessimistic_Better_Choice does the opposite. elsif UT1.Elaborate_Body_Desirable and then UT2.Elaborate_Body_Desirable then ! declare ! Result : constant Boolean := ! UNR.Table (Corresponding_Body (U1)).Num_Pred >= ! UNR.Table (Corresponding_Body (U2)).Num_Pred; ! begin ! if Debug_Flag_B then ! if Result then ! Write_Line (" True based on Num_Pred compare"); ! else ! Write_Line (" False based on Num_Pred compare"); ! end if; ! end if; ! ! return Result; ! end; end if; end if; -- If we fall through, it means that no preference rule applies, so we -- use alphabetical order to at least give a deterministic result. Since ! -- Pessimistic_Better_Choice is in the business of stirring up the ! -- order, we will use reverse alphabetical ordering. ! ! if Debug_Flag_B then ! Write_Line (" choose on reverse alpha order"); ! end if; return Uname_Less (UT2.Uname, UT1.Uname); ! end Pessimistic_Better_Choice; ! ! ---------------- ! -- Unit_Id_Of -- ! ---------------- ! ! function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id is ! Info : constant Int := Get_Name_Table_Info (Uname); ! begin ! pragma Assert (Info /= 0 and then Unit_Id (Info) /= No_Unit_Id); ! return Unit_Id (Info); ! end Unit_Id_Of; ------------------------ -- Write_Dependencies -- diff -Nrcpad gcc-4.5.2/gcc/ada/bindgen.adb gcc-4.6.0/gcc/ada/bindgen.adb *** gcc-4.5.2/gcc/ada/bindgen.adb Fri Sep 18 13:50:26 2009 --- gcc-4.6.0/gcc/ada/bindgen.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Bindgen is *** 111,116 **** --- 111,117 ---- -- Main_Priority : Integer; -- Time_Slice_Value : Integer; + -- Heap_Size : Natural; -- WC_Encoding : Character; -- Locking_Policy : Character; -- Queuing_Policy : Character; *************** package body Bindgen is *** 126,131 **** --- 127,133 ---- -- Detect_Blocking : Integer; -- Default_Stack_Size : Integer; -- Leap_Seconds_Support : Integer; + -- Main_CPU : Integer; -- Main_Priority is the priority value set by pragma Priority in the main -- program. If no such pragma is present, the value is -1. *************** package body Bindgen is *** 136,141 **** --- 138,147 ---- -- A value of zero indicates that time slicing should be suppressed. If no -- pragma is present, and no -T switch was used, the value is -1. + -- Heap_Size is the heap to use for memory allocations set by use of a + -- -Hnn parameter for the binder or by the GNAT$NO_MALLOC_64 logical. + -- Valid values are 32 and 64. This switch is only effective on VMS. + -- WC_Encoding shows the wide character encoding method used for the main -- program. This is one of the encoding letters defined in -- System.WCh_Con.WC_Encoding_Letters. *************** package body Bindgen is *** 210,215 **** --- 216,224 ---- -- disabled. A value of zero indicates that leap seconds are turned "off", -- while a value of one signifies "on" status. + -- Main_CPU is the processor set by pragma CPU in the main program. If no + -- such pragma is present, the value is -1. + ----------------------- -- Local Subprograms -- ----------------------- *************** package body Bindgen is *** 344,349 **** --- 353,363 ---- -- Sets characters of given string in Statement_Buffer, starting at the -- Last + 1 position, and updating last past the string value. + procedure Set_String_Replace (S : String); + -- Replaces the last S'Length characters in the Statement_Buffer with + -- the characters of S. The caller must ensure that these characters do + -- in fact exist in the Statement_Buffer. + procedure Set_Unit_Name; -- Given a unit name in the Name_Buffer, copies it to Statement_Buffer, -- starting at the Last + 1 position, and updating last past the value. *************** package body Bindgen is *** 426,431 **** --- 440,446 ---- procedure Gen_Adainit_Ada is Main_Priority : Int renames ALIs.Table (ALIs.First).Main_Priority; + Main_CPU : Int renames ALIs.Table (ALIs.First).Main_CPU; begin WBI (" procedure " & Ada_Init_Name.all & " is"); *************** package body Bindgen is *** 469,477 **** Set_String (", """); Get_Name_String (U.Uname); ! -- In the case of JGNAT we need to emit an Import name ! -- that includes the class name (using '$' separators ! -- in the case of a child unit name). if VM_Target /= No_VM then for J in 1 .. Name_Len - 2 loop --- 484,492 ---- Set_String (", """); Get_Name_String (U.Uname); ! -- In the case of JGNAT we need to emit an Import name that ! -- includes the class name (using '$' separators in the case ! -- of a child unit name). if VM_Target /= No_VM then for J in 1 .. Name_Len - 2 loop *************** package body Bindgen is *** 510,518 **** Write_Statement_Buffer; ! -- If the standard library is suppressed, then the only global variable ! -- that might be needed (by the Ravenscar profile) is the priority of ! -- the environment. if Suppress_Standard_Library_On_Target then if Main_Priority /= No_Main_Priority then --- 525,533 ---- Write_Statement_Buffer; ! -- If the standard library is suppressed, then the only global variables ! -- that might be needed (by the Ravenscar profile) are the priority and ! -- the processor for the environment task. if Suppress_Standard_Library_On_Target then if Main_Priority /= No_Main_Priority then *************** package body Bindgen is *** 522,527 **** --- 537,549 ---- WBI (""); end if; + if Main_CPU /= No_Main_CPU then + WBI (" Main_CPU : Integer;"); + WBI (" pragma Import (C, Main_CPU," & + " ""__gl_main_cpu"");"); + WBI (""); + end if; + WBI (" begin"); if Main_Priority /= No_Main_Priority then *************** package body Bindgen is *** 529,536 **** Set_Int (Main_Priority); Set_Char (';'); Write_Statement_Buffer; ! else WBI (" null;"); end if; --- 551,568 ---- Set_Int (Main_Priority); Set_Char (';'); Write_Statement_Buffer; + end if; ! if Main_CPU /= No_Main_CPU then ! Set_String (" Main_CPU := "); ! Set_Int (Main_CPU); ! Set_Char (';'); ! Write_Statement_Buffer; ! end if; ! ! if Main_Priority = No_Main_Priority ! and then Main_CPU = No_Main_CPU ! then WBI (" null;"); end if; *************** package body Bindgen is *** 561,566 **** --- 593,601 ---- WBI (" Num_Specific_Dispatching : Integer;"); WBI (" pragma Import (C, Num_Specific_Dispatching, " & """__gl_num_specific_dispatching"");"); + WBI (" Main_CPU : Integer;"); + WBI (" pragma Import (C, Main_CPU, " & + """__gl_main_cpu"");"); WBI (" Interrupt_States : System.Address;"); WBI (" pragma Import (C, Interrupt_States, " & *************** package body Bindgen is *** 615,620 **** --- 650,664 ---- WBI (" Features_Set : Integer;"); WBI (" pragma Import (C, Features_Set, " & """__gnat_features_set"");"); + + if Opt.Heap_Size /= 0 then + WBI (""); + WBI (" Heap_Size : Integer;"); + WBI (" pragma Import (C, Heap_Size, " & + """__gl_heap_size"");"); + + Write_Statement_Buffer; + end if; end if; -- Initialize stack limit variable of the environment task if the *************** package body Bindgen is *** 712,717 **** --- 756,766 ---- Set_Char (';'); Write_Statement_Buffer; + Set_String (" Main_CPU := "); + Set_Int (Main_CPU); + Set_Char (';'); + Write_Statement_Buffer; + WBI (" Interrupt_States := Local_Interrupt_States'Address;"); Set_String (" Num_Interrupt_States := "); *************** package body Bindgen is *** 774,783 **** -- Generate call to Install_Handler ! WBI (""); ! WBI (" if Handler_Installed = 0 then"); ! WBI (" Install_Handler;"); ! WBI (" end if;"); -- Generate call to Set_Features --- 823,839 ---- -- Generate call to Install_Handler ! -- In .NET, when binding with -z, we don't install the signal handler ! -- to let the caller handle the last exception handler. ! ! if VM_Target /= CLI_Target ! or else Bind_Main_Program ! then ! WBI (""); ! WBI (" if Handler_Installed = 0 then"); ! WBI (" Install_Handler;"); ! WBI (" end if;"); ! end if; -- Generate call to Set_Features *************** package body Bindgen is *** 786,791 **** --- 842,857 ---- WBI (" if Features_Set = 0 then"); WBI (" Set_Features;"); WBI (" end if;"); + + -- Features_Set may twiddle the heap size according to a logical + -- name, but the binder switch must override. + + if Opt.Heap_Size /= 0 then + Set_String (" Heap_Size := "); + Set_Int (Opt.Heap_Size); + Set_Char (';'); + Write_Statement_Buffer; + end if; end if; end if; *************** package body Bindgen is *** 855,860 **** --- 921,927 ---- procedure Gen_Adainit_C is Main_Priority : Int renames ALIs.Table (ALIs.First).Main_Priority; + Main_CPU : Int renames ALIs.Table (ALIs.First).Main_CPU; begin WBI ("void " & Ada_Init_Name.all & " (void)"); *************** package body Bindgen is *** 898,905 **** if Suppress_Standard_Library_On_Target then ! -- Case of High_Integrity_Mode mode. Set __gl_main_priority if needed ! -- for the Ravenscar profile. if Main_Priority /= No_Main_Priority then WBI (" extern int __gl_main_priority;"); --- 965,972 ---- if Suppress_Standard_Library_On_Target then ! -- Case of High_Integrity_Mode mode. Set __gl_main_priority and ! -- __gl_main_cpu if needed for the Ravenscar profile. if Main_Priority /= No_Main_Priority then WBI (" extern int __gl_main_priority;"); *************** package body Bindgen is *** 909,914 **** --- 976,989 ---- Write_Statement_Buffer; end if; + if Main_CPU /= No_Main_CPU then + WBI (" extern int __gl_main_cpu;"); + Set_String (" __gl_main_cpu = "); + Set_Int (Main_CPU); + Set_Char (';'); + Write_Statement_Buffer; + end if; + -- Normal case (standard library not suppressed) else *************** package body Bindgen is *** 994,999 **** --- 1069,1080 ---- Set_String ("';"); Write_Statement_Buffer; + WBI (" extern int __gl_main_cpu;"); + Set_String (" __gl_main_cpu = "); + Set_Int (Main_CPU); + Set_Char (';'); + Write_Statement_Buffer; + Gen_Restrictions_C; WBI (" extern const void *__gl_interrupt_states;"); *************** package body Bindgen is *** 1936,1945 **** WBI (""); Write_Info_Ada_C ("-- ", "/* ", " BEGIN Object file/option list"); for E in Elab_Order.First .. Elab_Order.Last loop ! -- If not spec that has an associated body, then generate a ! -- comment giving the name of the corresponding object file. if (not Units.Table (Elab_Order.Table (E)).SAL_Interface) and then Units.Table (Elab_Order.Table (E)).Utype /= Is_Spec --- 2017,2030 ---- WBI (""); Write_Info_Ada_C ("-- ", "/* ", " BEGIN Object file/option list"); + if Object_List_Filename /= null then + Set_List_File (Object_List_Filename.all); + end if; + for E in Elab_Order.First .. Elab_Order.Last loop ! -- If not spec that has an associated body, then generate a comment ! -- giving the name of the corresponding object file. if (not Units.Table (Elab_Order.Table (E)).SAL_Interface) and then Units.Table (Elab_Order.Table (E)).Utype /= Is_Spec *************** package body Bindgen is *** 1948,1955 **** (ALIs.Table (Units.Table (Elab_Order.Table (E)).My_ALI).Ofile_Full_Name); ! -- If the presence of an object file is necessary or if it ! -- exists, then use it. if not Hostparm.Exclude_Missing_Objects or else --- 2033,2040 ---- (ALIs.Table (Units.Table (Elab_Order.Table (E)).My_ALI).Ofile_Full_Name); ! -- If the presence of an object file is necessary or if it exists, ! -- then use it. if not Hostparm.Exclude_Missing_Objects or else *************** package body Bindgen is *** 1971,1978 **** (ALIs.Table (Units.Table (Elab_Order.Table (E)).My_ALI).Sfile) then ! -- Special case for g-trasym.obj, which is not included ! -- in libgnat. Get_Name_String (ALIs.Table (Units.Table (Elab_Order.Table (E)).My_ALI).Sfile); --- 2056,2062 ---- (ALIs.Table (Units.Table (Elab_Order.Table (E)).My_ALI).Sfile) then ! -- Special case for g-trasym.obj (not included in libgnat) Get_Name_String (ALIs.Table (Units.Table (Elab_Order.Table (E)).My_ALI).Sfile); *************** package body Bindgen is *** 1985,2039 **** end if; end loop; ! -- Add a "-Ldir" for each directory in the object path ! for J in 1 .. Nb_Dir_In_Obj_Search_Path loop ! declare ! Dir : constant String_Ptr := Dir_In_Obj_Search_Path (J); ! begin ! Name_Len := 0; ! Add_Str_To_Name_Buffer ("-L"); ! Add_Str_To_Name_Buffer (Dir.all); ! Write_Linker_Option; ! end; ! end loop; -- Sort linker options -- This sort accomplishes two important purposes: ! -- a) All application files are sorted to the front, and all ! -- GNAT internal files are sorted to the end. This results ! -- in a well defined dividing line between the two sets of ! -- files, for the purpose of inserting certain standard ! -- library references into the linker arguments list. ! -- b) Given two different units, we sort the linker options so ! -- that those from a unit earlier in the elaboration order ! -- comes later in the list. This is a heuristic designed ! -- to create a more friendly order of linker options when ! -- the operations appear in separate units. The idea is that ! -- if unit A must be elaborated before unit B, then it is ! -- more likely that B references libraries included by A, ! -- than vice versa, so we want the libraries included by ! -- A to come after the libraries included by B. ! -- These two criteria are implemented by function Lt_Linker_Option. ! -- Note that a special case of b) is that specs are elaborated before ! -- bodies, so linker options from specs come after linker options ! -- for bodies, and again, the assumption is that libraries used by ! -- the body are more likely to reference libraries used by the spec, ! -- than vice versa. Sort (Linker_Options.Last, Move_Linker_Option'Access, Lt_Linker_Option'Access); ! -- Write user linker options, i.e. the set of linker options that ! -- come from all files other than GNAT internal files, Lgnat is ! -- left set to point to the first entry from a GNAT internal file, ! -- or past the end of the entriers if there are no internal files. Lgnat := Linker_Options.Last + 1; --- 2069,2126 ---- end if; end loop; ! if Object_List_Filename /= null then ! Close_List_File; ! end if; ! -- Add a "-Ldir" for each directory in the object path ! if VM_Target /= CLI_Target then ! for J in 1 .. Nb_Dir_In_Obj_Search_Path loop ! declare ! Dir : constant String_Ptr := Dir_In_Obj_Search_Path (J); ! begin ! Name_Len := 0; ! Add_Str_To_Name_Buffer ("-L"); ! Add_Str_To_Name_Buffer (Dir.all); ! Write_Linker_Option; ! end; ! end loop; ! end if; -- Sort linker options -- This sort accomplishes two important purposes: ! -- a) All application files are sorted to the front, and all GNAT ! -- internal files are sorted to the end. This results in a well ! -- defined dividing line between the two sets of files, for the ! -- purpose of inserting certain standard library references into ! -- the linker arguments list. ! -- b) Given two different units, we sort the linker options so that ! -- those from a unit earlier in the elaboration order comes later ! -- in the list. This is a heuristic designed to create a more ! -- friendly order of linker options when the operations appear in ! -- separate units. The idea is that if unit A must be elaborated ! -- before unit B, then it is more likely that B references ! -- libraries included by A, than vice versa, so we want libraries ! -- included by A to come after libraries included by B. ! -- These two criteria are implemented by function Lt_Linker_Option. Note ! -- that a special case of b) is that specs are elaborated before bodies, ! -- so linker options from specs come after linker options for bodies, ! -- and again, the assumption is that libraries used by the body are more ! -- likely to reference libraries used by the spec, than vice versa. Sort (Linker_Options.Last, Move_Linker_Option'Access, Lt_Linker_Option'Access); ! -- Write user linker options, i.e. the set of linker options that come ! -- from all files other than GNAT internal files, Lgnat is left set to ! -- point to the first entry from a GNAT internal file, or past the end ! -- of the entries if there are no internal files. Lgnat := Linker_Options.Last + 1; *************** package body Bindgen is *** 2137,2145 **** Set_PSD_Pragma_Table; ! -- Override Ada_Bind_File and Bind_Main_Program for VMs since ! -- JGNAT only supports Ada code, and the main program is already ! -- generated by the compiler. if VM_Target /= No_VM then Ada_Bind_File := True; --- 2224,2232 ---- Set_PSD_Pragma_Table; ! -- Override Ada_Bind_File and Bind_Main_Program for VMs since JGNAT only ! -- supports Ada code, and the main program is already generated by the ! -- compiler. if VM_Target /= No_VM then Ada_Bind_File := True; *************** package body Bindgen is *** 2271,2278 **** WBI (" gnat_envp : System.Address;"); -- If the standard library is not suppressed, these variables ! -- are in the runtime data area for easy access from the ! -- runtime. if not Suppress_Standard_Library_On_Target then WBI (""); --- 2358,2364 ---- WBI (" gnat_envp : System.Address;"); -- If the standard library is not suppressed, these variables ! -- are in the run-time data area for easy run time access. if not Suppress_Standard_Library_On_Target then WBI (""); *************** package body Bindgen is *** 2308,2314 **** WBI (""); WBI (" GNAT_Version : constant String :="); ! WBI (" ""GNAT Version: " & Gnat_Version_String & """ & ASCII.NUL;"); WBI (" pragma Export (C, GNAT_Version, ""__gnat_version"");"); --- 2394,2400 ---- WBI (""); WBI (" GNAT_Version : constant String :="); ! WBI (" """ & Ver_Prefix & Gnat_Version_String & """ & ASCII.NUL;"); WBI (" pragma Export (C, GNAT_Version, ""__gnat_version"");"); *************** package body Bindgen is *** 2467,2474 **** if not Cumulative_Restrictions.Set (No_Finalization) then ! -- In the Java case, pragma Import C cannot be used, so the ! -- standard Ada constructs will be used instead. if VM_Target = No_VM then WBI (""); --- 2553,2560 ---- if not Cumulative_Restrictions.Set (No_Finalization) then ! -- In the Java case, pragma Import C cannot be used, so the standard ! -- Ada constructs will be used instead. if VM_Target = No_VM then WBI (""); *************** package body Bindgen is *** 2623,2630 **** WBI ("extern void __gnat_stack_usage_initialize (int size);"); end if; ! -- Initialize stack limit for the environment task if the stack ! -- check method is stack limit and stack check is enabled. if Stack_Check_Limits_On_Target and then (Stack_Check_Default_On_Target or Stack_Check_Switch_Set) --- 2709,2716 ---- WBI ("extern void __gnat_stack_usage_initialize (int size);"); end if; ! -- Initialize stack limit for the environment task if the stack check ! -- method is stack limit and stack check is enabled. if Stack_Check_Limits_On_Target and then (Stack_Check_Default_On_Target or Stack_Check_Switch_Set) *************** package body Bindgen is *** 2658,2665 **** if Bind_Main_Program then ! -- First deal with argc/argv/envp. In the normal case they ! -- are in the run-time library. if not Configurable_Run_Time_On_Target then WBI ("extern int gnat_argc;"); --- 2744,2751 ---- if Bind_Main_Program then ! -- First deal with argc/argv/envp. In the normal case they are in the ! -- run-time library. if not Configurable_Run_Time_On_Target then WBI ("extern int gnat_argc;"); *************** package body Bindgen is *** 2672,2679 **** elsif not Command_Line_Args_On_Target then null; ! -- Otherwise, in the configurable run-time case they are right in ! -- the binder file. else WBI ("int gnat_argc;"); --- 2758,2765 ---- elsif not Command_Line_Args_On_Target then null; ! -- Otherwise, in the configurable run-time case they are right in the ! -- binder file. else WBI ("int gnat_argc;"); *************** package body Bindgen is *** 2686,2693 **** if not Configurable_Run_Time_On_Target then WBI ("extern int gnat_exit_status;"); ! -- If configurable run time and no exit status on target, then ! -- the generation of this variables is entirely suppressed. elsif not Exit_Status_Supported_On_Target then null; --- 2772,2779 ---- if not Configurable_Run_Time_On_Target then WBI ("extern int gnat_exit_status;"); ! -- If configurable run time and no exit status on target, then the ! -- generation of this variables is entirely suppressed. elsif not Exit_Status_Supported_On_Target then null; *************** package body Bindgen is *** 2702,2710 **** WBI (""); end if; ! -- When suppressing the standard library, the __gnat_break_start ! -- routine (for the debugger to get initial control) is defined in ! -- this file. if Suppress_Standard_Library_On_Target then WBI (""); --- 2788,2795 ---- WBI (""); end if; ! -- When suppressing the standard library, the __gnat_break_start routine ! -- (for the debugger to get initial control) is defined in this file. if Suppress_Standard_Library_On_Target then WBI (""); *************** package body Bindgen is *** 2718,2724 **** if Bind_Main_Program then WBI (""); ! WBI ("char __gnat_version[] = ""GNAT Version: " & Gnat_Version_String & """;"); Set_String ("char __gnat_ada_main_program_name[] = """); --- 2803,2809 ---- if Bind_Main_Program then WBI (""); ! WBI ("char __gnat_version[] = """ & Ver_Prefix & Gnat_Version_String & """;"); Set_String ("char __gnat_ada_main_program_name[] = """); *************** package body Bindgen is *** 2728,2735 **** Write_Statement_Buffer; end if; ! -- Generate the adafinal routine. In no runtime mode, this is ! -- not needed, since there is no finalization to do. if not Cumulative_Restrictions.Set (No_Finalization) then Gen_Adafinal_C; --- 2813,2820 ---- Write_Statement_Buffer; end if; ! -- Generate the adafinal routine. In no runtime mode, this is not ! -- needed, since there is no finalization to do. if not Cumulative_Restrictions.Set (No_Finalization) then Gen_Adafinal_C; *************** package body Bindgen is *** 2774,2858 **** Count := 0; ! for J in Cumulative_Restrictions.Set'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Set'Last) ! loop Set_Boolean (Cumulative_Restrictions.Set (J)); Set_String (", "); Count := Count + 1; ! if Count = 8 then Write_Statement_Buffer; Set_String (" "); Count := 0; end if; end loop; ! Set_Boolean ! (Cumulative_Restrictions.Set (Cumulative_Restrictions.Set'Last)); ! Set_String ("),"); Write_Statement_Buffer; Set_String (" Value => ("); ! for J in Cumulative_Restrictions.Value'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Value'Last) ! loop Set_Int (Int (Cumulative_Restrictions.Value (J))); Set_String (", "); end loop; ! Set_Int (Int (Cumulative_Restrictions.Value ! (Cumulative_Restrictions.Value'Last))); ! Set_String ("),"); Write_Statement_Buffer; WBI (" Violated =>"); Set_String (" ("); Count := 0; ! for J in Cumulative_Restrictions.Violated'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Violated'Last) ! loop Set_Boolean (Cumulative_Restrictions.Violated (J)); Set_String (", "); Count := Count + 1; ! if Count = 8 then Write_Statement_Buffer; Set_String (" "); Count := 0; end if; end loop; ! Set_Boolean (Cumulative_Restrictions.Violated ! (Cumulative_Restrictions.Violated'Last)); ! Set_String ("),"); Write_Statement_Buffer; Set_String (" Count => ("); ! for J in Cumulative_Restrictions.Count'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Count'Last) ! loop Set_Int (Int (Cumulative_Restrictions.Count (J))); Set_String (", "); end loop; ! Set_Int (Int (Cumulative_Restrictions.Count ! (Cumulative_Restrictions.Count'Last))); ! Set_String ("),"); Write_Statement_Buffer; Set_String (" Unknown => ("); ! for J in Cumulative_Restrictions.Unknown'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Unknown'Last) ! loop Set_Boolean (Cumulative_Restrictions.Unknown (J)); Set_String (", "); end loop; ! Set_Boolean ! (Cumulative_Restrictions.Unknown ! (Cumulative_Restrictions.Unknown'Last)); ! Set_String ("));"); Write_Statement_Buffer; end Gen_Restrictions_Ada; --- 2859,2923 ---- Count := 0; ! for J in Cumulative_Restrictions.Set'Range loop Set_Boolean (Cumulative_Restrictions.Set (J)); Set_String (", "); Count := Count + 1; ! if J /= Cumulative_Restrictions.Set'Last and then Count = 8 then Write_Statement_Buffer; Set_String (" "); Count := 0; end if; end loop; ! Set_String_Replace ("),"); Write_Statement_Buffer; Set_String (" Value => ("); ! for J in Cumulative_Restrictions.Value'Range loop Set_Int (Int (Cumulative_Restrictions.Value (J))); Set_String (", "); end loop; ! Set_String_Replace ("),"); Write_Statement_Buffer; WBI (" Violated =>"); Set_String (" ("); Count := 0; ! for J in Cumulative_Restrictions.Violated'Range loop Set_Boolean (Cumulative_Restrictions.Violated (J)); Set_String (", "); Count := Count + 1; ! if J /= Cumulative_Restrictions.Set'Last and then Count = 8 then Write_Statement_Buffer; Set_String (" "); Count := 0; end if; end loop; ! Set_String_Replace ("),"); Write_Statement_Buffer; Set_String (" Count => ("); ! for J in Cumulative_Restrictions.Count'Range loop Set_Int (Int (Cumulative_Restrictions.Count (J))); Set_String (", "); end loop; ! Set_String_Replace ("),"); Write_Statement_Buffer; Set_String (" Unknown => ("); ! for J in Cumulative_Restrictions.Unknown'Range loop Set_Boolean (Cumulative_Restrictions.Unknown (J)); Set_String (", "); end loop; ! Set_String_Replace ("))"); ! Set_String (";"); Write_Statement_Buffer; end Gen_Restrictions_Ada; *************** package body Bindgen is *** 2899,2966 **** WBI (" restrictions r = {"); Set_String (" {"); ! for J in Cumulative_Restrictions.Set'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Set'Last) ! loop Set_Int (Boolean'Pos (Cumulative_Restrictions.Set (J))); Set_String (", "); end loop; ! Set_Int (Boolean'Pos ! (Cumulative_Restrictions.Set (Cumulative_Restrictions.Set'Last))); ! Set_String ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Value'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Value'Last) ! loop Set_Int (Int (Cumulative_Restrictions.Value (J))); Set_String (", "); end loop; ! Set_Int (Int (Cumulative_Restrictions.Value ! (Cumulative_Restrictions.Value'Last))); ! Set_String ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Violated'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Violated'Last) ! loop Set_Int (Boolean'Pos (Cumulative_Restrictions.Violated (J))); Set_String (", "); end loop; ! Set_Int (Boolean'Pos (Cumulative_Restrictions.Violated ! (Cumulative_Restrictions.Violated'Last))); ! Set_String ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Count'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Count'Last) ! loop Set_Int (Int (Cumulative_Restrictions.Count (J))); Set_String (", "); end loop; ! Set_Int (Int (Cumulative_Restrictions.Count ! (Cumulative_Restrictions.Count'Last))); ! Set_String ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Unknown'First .. ! Restriction_Id'Pred (Cumulative_Restrictions.Unknown'Last) ! loop Set_Int (Boolean'Pos (Cumulative_Restrictions.Unknown (J))); Set_String (", "); end loop; ! Set_Int (Boolean'Pos (Cumulative_Restrictions.Unknown ! (Cumulative_Restrictions.Unknown'Last))); ! Set_String ("}};"); Write_Statement_Buffer; WBI (" system__restrictions__run_time_restrictions = r;"); end Gen_Restrictions_C; --- 2964,3012 ---- WBI (" restrictions r = {"); Set_String (" {"); ! for J in Cumulative_Restrictions.Set'Range loop Set_Int (Boolean'Pos (Cumulative_Restrictions.Set (J))); Set_String (", "); end loop; ! Set_String_Replace ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Value'Range loop Set_Int (Int (Cumulative_Restrictions.Value (J))); Set_String (", "); end loop; ! Set_String_Replace ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Violated'Range loop Set_Int (Boolean'Pos (Cumulative_Restrictions.Violated (J))); Set_String (", "); end loop; ! Set_String_Replace ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Count'Range loop Set_Int (Int (Cumulative_Restrictions.Count (J))); Set_String (", "); end loop; ! Set_String_Replace ("},"); Write_Statement_Buffer; Set_String (" {"); ! for J in Cumulative_Restrictions.Unknown'Range loop Set_Int (Boolean'Pos (Cumulative_Restrictions.Unknown (J))); Set_String (", "); end loop; ! Set_String_Replace ("}}"); ! Set_String (";"); Write_Statement_Buffer; WBI (" system__restrictions__run_time_restrictions = r;"); end Gen_Restrictions_C; *************** package body Bindgen is *** 2969,2985 **** -- Gen_Versions_Ada -- ---------------------- ! -- This routine generates two sets of lines. The first set has the form: -- unnnnn : constant Integer := 16#hhhhhhhh#; - - -- The second set has the form - -- pragma Export (C, unnnnn, unam); ! -- for each unit, where unam is the unit name suffixed by either B or ! -- S for body or spec, with dots replaced by double underscores, and ! -- hhhhhhhh is the version number, and nnnnn is a 5-digits serial number. procedure Gen_Versions_Ada is Ubuf : String (1 .. 6) := "u00000"; --- 3015,3028 ---- -- Gen_Versions_Ada -- ---------------------- ! -- This routine generates lines such as: -- unnnnn : constant Integer := 16#hhhhhhhh#; -- pragma Export (C, unnnnn, unam); ! -- for each unit, where unam is the unit name suffixed by either B or S for ! -- body or spec, with dots replaced by double underscores, and hhhhhhhh is ! -- the version number, and nnnnn is a 5-digits serial number. procedure Gen_Versions_Ada is Ubuf : String (1 .. 6) := "u00000"; *************** package body Bindgen is *** 2999,3055 **** -- Start of processing for Gen_Versions_Ada begin - if Bind_For_Library then - - -- When building libraries, the version number of each unit can - -- not be computed, since the binder does not know the full list - -- of units. Therefore, the 'Version and 'Body_Version - -- attributes cannot supported in this case. - - return; - end if; - WBI (""); WBI (" type Version_32 is mod 2 ** 32;"); for U in Units.First .. Units.Last loop ! Increment_Ubuf; ! WBI (" " & Ubuf & " : constant Version_32 := 16#" & ! Units.Table (U).Version & "#;"); ! end loop; ! ! WBI (""); ! Ubuf := "u00000"; ! for U in Units.First .. Units.Last loop ! Increment_Ubuf; ! Set_String (" pragma Export (C, "); ! Set_String (Ubuf); ! Set_String (", """); ! Get_Name_String (Units.Table (U).Uname); ! for K in 1 .. Name_Len loop ! if Name_Buffer (K) = '.' then ! Set_Char ('_'); ! Set_Char ('_'); ! elsif Name_Buffer (K) = '%' then ! exit; else ! Set_Char (Name_Buffer (K)); end if; - end loop; ! if Name_Buffer (Name_Len) = 's' then ! Set_Char ('S'); ! else ! Set_Char ('B'); end if; - - Set_String (""");"); - Write_Statement_Buffer; end loop; end Gen_Versions_Ada; --- 3042,3085 ---- -- Start of processing for Gen_Versions_Ada begin WBI (""); WBI (" type Version_32 is mod 2 ** 32;"); for U in Units.First .. Units.Last loop ! if not Units.Table (U).SAL_Interface and then ! ((not Bind_For_Library) or else Units.Table (U).Directly_Scanned) ! then ! Increment_Ubuf; ! WBI (" " & Ubuf & " : constant Version_32 := 16#" & ! Units.Table (U).Version & "#;"); ! Set_String (" pragma Export (C, "); ! Set_String (Ubuf); ! Set_String (", """); ! Get_Name_String (Units.Table (U).Uname); ! for K in 1 .. Name_Len loop ! if Name_Buffer (K) = '.' then ! Set_Char ('_'); ! Set_Char ('_'); ! elsif Name_Buffer (K) = '%' then ! exit; ! else ! Set_Char (Name_Buffer (K)); ! end if; ! end loop; + if Name_Buffer (Name_Len) = 's' then + Set_Char ('S'); else ! Set_Char ('B'); end if; ! Set_String (""");"); ! Write_Statement_Buffer; end if; end loop; end Gen_Versions_Ada; *************** package body Bindgen is *** 3062,3109 **** -- unsigned unam = 0xhhhhhhhh; ! -- for each unit, where unam is the unit name suffixed by either B or ! -- S for body or spec, with dots replaced by double underscores. procedure Gen_Versions_C is begin - if Bind_For_Library then - - -- When building libraries, the version number of each unit can - -- not be computed, since the binder does not know the full list - -- of units. Therefore, the 'Version and 'Body_Version - -- attributes cannot supported. - - return; - end if; - for U in Units.First .. Units.Last loop ! Set_String ("unsigned "); ! Get_Name_String (Units.Table (U).Uname); ! for K in 1 .. Name_Len loop ! if Name_Buffer (K) = '.' then ! Set_String ("__"); ! elsif Name_Buffer (K) = '%' then ! exit; else ! Set_Char (Name_Buffer (K)); end if; - end loop; ! if Name_Buffer (Name_Len) = 's' then ! Set_Char ('S'); ! else ! Set_Char ('B'); end if; - - Set_String (" = 0x"); - Set_String (Units.Table (U).Version); - Set_Char (';'); - Write_Statement_Buffer; end loop; end Gen_Versions_C; --- 3092,3133 ---- -- unsigned unam = 0xhhhhhhhh; ! -- for each unit, where unam is the unit name suffixed by either B or S for ! -- body or spec, with dots replaced by double underscores. procedure Gen_Versions_C is begin for U in Units.First .. Units.Last loop ! if not Units.Table (U).SAL_Interface and then ! ((not Bind_For_Library) or else Units.Table (U).Directly_Scanned) ! then ! Set_String ("unsigned "); ! Get_Name_String (Units.Table (U).Uname); ! for K in 1 .. Name_Len loop ! if Name_Buffer (K) = '.' then ! Set_String ("__"); ! elsif Name_Buffer (K) = '%' then ! exit; ! ! else ! Set_Char (Name_Buffer (K)); ! end if; ! end loop; + if Name_Buffer (Name_Len) = 's' then + Set_Char ('S'); else ! Set_Char ('B'); end if; ! Set_String (" = 0x"); ! Set_String (Units.Table (U).Version); ! Set_Char (';'); ! Write_Statement_Buffer; end if; end loop; end Gen_Versions_C; *************** package body Bindgen is *** 3207,3215 **** Get_Name_String (Units.Table (First_Unit_Entry).Uname); ! -- If this is a child name, return only the name of the child, ! -- since we can't have dots in a nested program name. Note that ! -- we do not include the %b at the end of the unit name. for J in reverse 1 .. Name_Len - 2 loop if J = 1 or else Name_Buffer (J - 1) = '.' then --- 3231,3239 ---- Get_Name_String (Units.Table (First_Unit_Entry).Uname); ! -- If this is a child name, return only the name of the child, since ! -- we can't have dots in a nested program name. Note that we do not ! -- include the %b at the end of the unit name. for J in reverse 1 .. Name_Len - 2 loop if J = 1 or else Name_Buffer (J - 1) = '.' then *************** package body Bindgen is *** 3241,3252 **** -- no better choice. If some other encoding is required when there is -- no main, it must be set explicitly using -Wx. ! -- Note: if the ALI file always passed the wide character encoding ! -- of every file, then we could use the encoding of the initial ! -- specified file, but this information is passed only for potential ! -- main programs. We could fix this sometime, but it is a very minor ! -- point (wide character default encoding for [Wide_[Wide_]Text_IO ! -- when there is no main program). elsif No_Main_Subprogram then return 'b'; --- 3265,3276 ---- -- no better choice. If some other encoding is required when there is -- no main, it must be set explicitly using -Wx. ! -- Note: if the ALI file always passed the wide character encoding of ! -- every file, then we could use the encoding of the initial specified ! -- file, but this information is passed only for potential main ! -- programs. We could fix this sometime, but it is a very minor point ! -- (wide character default encoding for [Wide_[Wide_]Text_IO when there ! -- is no main program). elsif No_Main_Subprogram then return 'b'; *************** package body Bindgen is *** 3277,3284 **** Linker_Options.Table (Op2).Internal_File; -- If both internal or both non-internal, sort according to the ! -- elaboration position. A unit that is elaborated later should ! -- come earlier in the linker options list. else return Units.Table (Linker_Options.Table (Op1).Unit).Elab_Position --- 3301,3308 ---- Linker_Options.Table (Op2).Internal_File; -- If both internal or both non-internal, sort according to the ! -- elaboration position. A unit that is elaborated later should come ! -- earlier in the linker options list. else return Units.Table (Linker_Options.Table (Op1).Unit).Elab_Position *************** package body Bindgen is *** 3307,3315 **** Get_Name_String (Units.Table (Elab_Order.Table (E)).Uname); -- This is not a perfect approach, but is the current protocol ! -- between the run-time and the binder to indicate that tasking ! -- is used: system.os_interface should always be used by any ! -- tasking application. if Name_Buffer (1 .. 19) = "system.os_interface" then With_GNARL := True; --- 3331,3339 ---- Get_Name_String (Units.Table (Elab_Order.Table (E)).Uname); -- This is not a perfect approach, but is the current protocol ! -- between the run-time and the binder to indicate that tasking is ! -- used: system.os_interface should always be used by any tasking ! -- application. if Name_Buffer (1 .. 19) = "system.os_interface" then With_GNARL := True; *************** package body Bindgen is *** 3470,3475 **** --- 3494,3508 ---- Last := Last + S'Length; end Set_String; + ------------------------ + -- Set_String_Replace -- + ------------------------ + + procedure Set_String_Replace (S : String) is + begin + Statement_Buffer (Last - S'Length + 1 .. Last) := S; + end Set_String_Replace; + ------------------- -- Set_Unit_Name -- ------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/bindgen.ads gcc-4.6.0/gcc/ada/bindgen.ads *** gcc-4.5.2/gcc/ada/bindgen.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/bindgen.ads Mon Jun 21 14:17:34 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,30 **** ------------------------------------------------------------------------------ -- This package contains the routines to output the binder file. This is ! -- a C program which contains the following: -- initialization for main program case -- sequence of calls to elaboration routines in appropriate order --- 24,30 ---- ------------------------------------------------------------------------------ -- This package contains the routines to output the binder file. This is ! -- an Ada or C program which contains the following: -- initialization for main program case -- sequence of calls to elaboration routines in appropriate order diff -Nrcpad gcc-4.5.2/gcc/ada/bindusg.adb gcc-4.6.0/gcc/ada/bindusg.adb *** gcc-4.5.2/gcc/ada/bindusg.adb Mon Jun 22 13:28:59 2009 --- gcc-4.6.0/gcc/ada/bindusg.adb Wed Jun 23 05:48:28 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Bindusg is *** 73,81 **** Write_Line (" -a Automatically initialize elaboration " & "procedure"); ! -- Line for A switch ! Write_Line (" -A Generate binder program in Ada (default)"); -- Line for -b switch --- 73,81 ---- Write_Line (" -a Automatically initialize elaboration " & "procedure"); ! -- Line for -A switch ! Write_Line (" -A Give list of ALI files in partition"); -- Line for -b switch *************** package body Bindusg is *** 87,96 **** Write_Line (" -c Check only, no generation of " & "binder output file"); - -- Line for C switch - - Write_Line (" -C Generate binder program in C"); - -- Line for -d switch Write_Line (" -dnn[k|m] Default primary stack " & --- 87,92 ---- *************** package body Bindusg is *** 120,125 **** --- 116,126 ---- Write_Line (" -h Output this usage (help) information"); + -- Line for -H switch + + Write_Line (" -Hnn Use nn bit heap where nn is 32 or 64 " & + "(VMS Only)"); + -- Lines for -I switch Write_Line (" -Idir Specify library and source files search path"); *************** package body Bindusg is *** 185,191 **** -- Line for -R switch Write_Line ! (" -R List sources referenced in closure (implies -c)"); -- Line for -s switch --- 186,192 ---- -- Line for -R switch Write_Line ! (" -R List sources referenced in closure"); -- Line for -s switch diff -Nrcpad gcc-4.5.2/gcc/ada/casing.ads gcc-4.6.0/gcc/ada/casing.ads *** gcc-4.5.2/gcc/ada/casing.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/casing.ads Thu Sep 9 09:44:34 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Casing is *** 61,66 **** --- 61,69 ---- -- (e.g. X, Y_3, M4, A_B, or if it is inconsistent ABC_def). ); + subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case; + -- Exclude Unknown casing + ------------------------------ -- Case Control Subprograms -- ------------------------------ diff -Nrcpad gcc-4.5.2/gcc/ada/ceinfo.adb gcc-4.6.0/gcc/ada/ceinfo.adb *** gcc-4.5.2/gcc/ada/ceinfo.adb Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/ceinfo.adb Tue Oct 26 12:30:25 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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,30 **** -- -- ------------------------------------------------------------------------------ ! -- Program to check consistency of einfo.ads and einfo.adb. Checks that ! -- field name usage is consistent, including comments mentioning fields. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; --- 23,34 ---- -- -- ------------------------------------------------------------------------------ ! -- Check consistency of einfo.ads and einfo.adb. Checks that field name usage ! -- is consistent, including comments mentioning fields. ! ! -- Note that this is used both as a standalone program, and as a procedure ! -- called by XEinfo. This raises an unhandled exception if it finds any ! -- errors; we don't attempt any sophisticated error recovery. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; *************** procedure CEinfo is *** 42,47 **** --- 46,54 ---- Infil : File_Type; Lineno : Natural := 0; + Err : exception; + -- Raised on error + Fieldnm : VString; Accessfunc : VString; Line : VString; *************** begin *** 126,131 **** --- 133,140 ---- Put_Line ("*** unknown field name " & Fieldnm & " at line " & Lineno); end if; + + raise Err; end if; end if; end loop; *************** begin *** 153,158 **** --- 162,169 ---- Put_Line ("*** unknown field name " & Fieldnm & " at line " & Lineno); end if; + + raise Err; end if; end loop; *************** begin *** 172,177 **** --- 183,189 ---- Put_Line ("*** incorrect field at line " & Lineno); Put_Line (" found field " & Accessfunc); Put_Line (" expecting field " & Get (Fields, Fieldnm)); + raise Err; end if; end loop; *************** begin *** 196,204 **** --- 208,219 ---- Put_Line ("*** incorrect field at line " & Lineno); Put_Line (" found field " & Accessfunc); Put_Line (" expecting field " & Get (Fields, Fieldnm)); + raise Err; end if; end loop; + Close (Infil); + Put_Line ("All tests completed successfully, no errors detected"); end CEinfo; diff -Nrcpad gcc-4.5.2/gcc/ada/checks.adb gcc-4.6.0/gcc/ada/checks.adb *** gcc-4.5.2/gcc/ada/checks.adb Tue Oct 27 13:22:25 2009 --- gcc-4.6.0/gcc/ada/checks.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Checks is *** 102,108 **** -- how we ensure that this condition is met. -- First, we need to know for certain that the previous expression has ! -- been executed. This is done principly by the mechanism of calling -- Conditional_Statements_Begin at the start of any statement sequence -- and Conditional_Statements_End at the end. The End call causes all -- checks remembered since the Begin call to be discarded. This does --- 102,108 ---- -- how we ensure that this condition is met. -- First, we need to know for certain that the previous expression has ! -- been executed. This is done principally by the mechanism of calling -- Conditional_Statements_Begin at the start of any statement sequence -- and Conditional_Statements_End at the end. The End call causes all -- checks remembered since the Begin call to be discarded. This does *************** package body Checks is *** 159,165 **** Target_Type : Entity_Id; -- Used only if Do_Range_Check is set. Records the target type for -- the check. We need this, because a check is a duplicate only if ! -- it has a the same target type (or more accurately one with a -- range that is smaller or equal to the stored target type of a -- saved check). end record; --- 159,165 ---- Target_Type : Entity_Id; -- Used only if Do_Range_Check is set. Records the target type for -- the check. We need this, because a check is a duplicate only if ! -- it has the same target type (or more accurately one with a -- range that is smaller or equal to the stored target type of a -- saved check). end record; *************** package body Checks is *** 650,659 **** return; end if; ! -- Here we do not know if the value is acceptable. Stricly we don't have ! -- to do anything, since if the alignment is bad, we have an erroneous ! -- program. However we are allowed to check for erroneous conditions and ! -- we decide to do this by default if the check is not suppressed. -- However, don't do the check if elaboration code is unwanted --- 650,660 ---- return; end if; ! -- Here we do not know if the value is acceptable. Strictly we don't ! -- have to do anything, since if the alignment is bad, we have an ! -- erroneous program. However we are allowed to check for erroneous ! -- conditions and we decide to do this by default if the check is not ! -- suppressed. -- However, don't do the check if elaboration code is unwanted *************** package body Checks is *** 722,729 **** procedure Apply_Arithmetic_Overflow_Check (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Typ : Entity_Id := Etype (N); ! Rtyp : Entity_Id := Root_Type (Typ); begin -- An interesting special case. If the arithmetic operation appears as --- 723,730 ---- procedure Apply_Arithmetic_Overflow_Check (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Typ : constant Entity_Id := Etype (N); ! Rtyp : constant Entity_Id := Root_Type (Typ); begin -- An interesting special case. If the arithmetic operation appears as *************** package body Checks is *** 815,823 **** Subtype_Mark => New_Occurrence_Of (Target_Type, Loc), Expression => Relocate_Node (Right_Opnd (N)))); Set_Etype (N, Target_Type); ! Typ := Target_Type; ! Rtyp := Root_Type (Typ); Analyze_And_Resolve (Left_Opnd (N), Target_Type); Analyze_And_Resolve (Right_Opnd (N), Target_Type); --- 816,829 ---- Subtype_Mark => New_Occurrence_Of (Target_Type, Loc), Expression => Relocate_Node (Right_Opnd (N)))); + -- Rewrite the conversion operand so that the original + -- node is retained, in order to avoid the warning for + -- redundant conversions in Resolve_Type_Conversion. + + Rewrite (N, Relocate_Node (N)); + Set_Etype (N, Target_Type); ! Analyze_And_Resolve (Left_Opnd (N), Target_Type); Analyze_And_Resolve (Right_Opnd (N), Target_Type); *************** package body Checks is *** 992,1001 **** Desig_Typ : Entity_Id; begin if Inside_A_Generic then return; ! elsif Is_Scalar_Type (Typ) then Apply_Scalar_Range_Check (N, Typ); elsif Is_Array_Type (Typ) then --- 998,1012 ---- Desig_Typ : Entity_Id; begin + -- No checks inside a generic (check the instantiations) + if Inside_A_Generic then return; + end if; ! -- Apply required constraint checks ! ! if Is_Scalar_Type (Typ) then Apply_Scalar_Range_Check (N, Typ); elsif Is_Array_Type (Typ) then *************** package body Checks is *** 1084,1089 **** --- 1095,1105 ---- Cond : Node_Id; T_Typ : Entity_Id; + function Denotes_Explicit_Dereference (Obj : Node_Id) return Boolean; + -- A heap object with an indefinite subtype is constrained by its + -- initial value, and assigning to it requires a constraint_check. + -- The target may be an explicit dereference, or a renaming of one. + function Is_Aliased_Unconstrained_Component return Boolean; -- It is possible for an aliased component to have a nominal -- unconstrained subtype (through instantiation). If this is a *************** package body Checks is *** 1091,1096 **** --- 1107,1127 ---- -- in an initialization, the check must be suppressed. This unusual -- situation requires a predicate of its own. + ---------------------------------- + -- Denotes_Explicit_Dereference -- + ---------------------------------- + + function Denotes_Explicit_Dereference (Obj : Node_Id) return Boolean is + begin + return + Nkind (Obj) = N_Explicit_Dereference + or else + (Is_Entity_Name (Obj) + and then Present (Renamed_Object (Entity (Obj))) + and then Nkind (Renamed_Object (Entity (Obj))) = + N_Explicit_Dereference); + end Denotes_Explicit_Dereference; + ---------------------------------------- -- Is_Aliased_Unconstrained_Component -- ---------------------------------------- *************** package body Checks is *** 1164,1180 **** -- Ada 2005 (AI-363): For Ada 2005, we limit the building of the actual -- subtype to the parameter and dereference cases, since other aliased -- objects are unconstrained (unless the nominal subtype is explicitly ! -- constrained). (But we also need to test for renamings???) if Present (Lhs) and then (Present (Param_Entity (Lhs)) ! or else (Ada_Version < Ada_05 and then not Is_Constrained (T_Typ) and then Is_Aliased_View (Lhs) and then not Is_Aliased_Unconstrained_Component) ! or else (Ada_Version >= Ada_05 and then not Is_Constrained (T_Typ) ! and then Nkind (Lhs) = N_Explicit_Dereference and then Nkind (Original_Node (Lhs)) /= N_Function_Call)) then --- 1195,1211 ---- -- Ada 2005 (AI-363): For Ada 2005, we limit the building of the actual -- subtype to the parameter and dereference cases, since other aliased -- objects are unconstrained (unless the nominal subtype is explicitly ! -- constrained). if Present (Lhs) and then (Present (Param_Entity (Lhs)) ! or else (Ada_Version < Ada_2005 and then not Is_Constrained (T_Typ) and then Is_Aliased_View (Lhs) and then not Is_Aliased_Unconstrained_Component) ! or else (Ada_Version >= Ada_2005 and then not Is_Constrained (T_Typ) ! and then Denotes_Explicit_Dereference (Lhs) and then Nkind (Original_Node (Lhs)) /= N_Function_Call)) then *************** package body Checks is *** 1191,1197 **** -- Ada 2005: nothing to do if the type is one for which there is a -- partial view that is constrained. ! elsif Ada_Version >= Ada_05 and then Has_Constrained_Partial_View (Base_Type (T_Typ)) then return; --- 1222,1228 ---- -- Ada 2005: nothing to do if the type is one for which there is a -- partial view that is constrained. ! elsif Ada_Version >= Ada_2005 and then Has_Constrained_Partial_View (Base_Type (T_Typ)) then return; *************** package body Checks is *** 1534,1541 **** Truncate : constant Boolean := Float_Truncate (Par); Max_Bound : constant Uint := UI_Expon ! (Machine_Radix (Expr_Type), ! Machine_Mantissa (Expr_Type) - 1) - 1; -- Largest bound, so bound plus or minus half is a machine number of F --- 1565,1572 ---- Truncate : constant Boolean := Float_Truncate (Par); Max_Bound : constant Uint := UI_Expon ! (Machine_Radix_Value (Expr_Type), ! Machine_Mantissa_Value (Expr_Type) - 1) - 1; -- Largest bound, so bound plus or minus half is a machine number of F *************** package body Checks is *** 1564,1572 **** pragma Assert (Target_Base /= Target_Typ); ! Temp : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); begin Apply_Float_Conversion_Check (Ck_Node, Target_Base); --- 1595,1601 ---- pragma Assert (Target_Base /= Target_Typ); ! Temp : constant Entity_Id := Make_Temporary (Loc, 'T', Par); begin Apply_Float_Conversion_Check (Ck_Node, Target_Base); *************** package body Checks is *** 1725,1730 **** --- 1754,1771 ---- (Ck_Node, Target_Typ, Source_Typ, Do_Static => False); end Apply_Length_Check; + --------------------------- + -- Apply_Predicate_Check -- + --------------------------- + + procedure Apply_Predicate_Check (N : Node_Id; Typ : Entity_Id) is + begin + if Present (Predicate_Function (Typ)) then + Insert_Action (N, + Make_Predicate_Check (Typ, Duplicate_Subexpr (N))); + end if; + end Apply_Predicate_Check; + ----------------------- -- Apply_Range_Check -- ----------------------- *************** package body Checks is *** 2108,2114 **** -- If checks are off, then analyze the length check after -- temporarily attaching it to the tree in case the relevant ! -- condition can be evaluted at compile time. We still want a -- compile time warning in this case. else --- 2149,2155 ---- -- If checks are off, then analyze the length check after -- temporarily attaching it to the tree in case the relevant ! -- condition can be evaluated at compile time. We still want a -- compile time warning in this case. else *************** package body Checks is *** 2379,2392 **** -- one of the stored discriminants, this will provide the -- required consistency check. ! Append_Elmt ( ! Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr_No_Checks (Expr, Name_Req => True), Selector_Name => Make_Identifier (Loc, Chars (Discr))), ! New_Constraints); else -- Discriminant of more remote ancestor ??? --- 2420,2433 ---- -- one of the stored discriminants, this will provide the -- required consistency check. ! Append_Elmt ! (Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr_No_Checks (Expr, Name_Req => True), Selector_Name => Make_Identifier (Loc, Chars (Discr))), ! New_Constraints); else -- Discriminant of more remote ancestor ??? *************** package body Checks is *** 2723,2734 **** end case; if K = N_Op_And then ! Error_Msg_N ("use `AND THEN` instead of AND?", P); else ! Error_Msg_N ("use `OR ELSE` instead of OR?", P); end if; ! -- If not short-circuited, we need the ckeck return True; --- 2764,2777 ---- end case; if K = N_Op_And then ! Error_Msg_N -- CODEFIX ! ("use `AND THEN` instead of AND?", P); else ! Error_Msg_N -- CODEFIX ! ("use `OR ELSE` instead of OR?", P); end if; ! -- If not short-circuited, we need the check return True; *************** package body Checks is *** 3331,3336 **** --- 3374,3387 ---- Indx := Next_Index (Indx); end loop; + -- If the index type is a formal type or derived from + -- one, the bounds are not static. + + if Is_Generic_Type (Root_Type (Etype (Indx))) then + OK := False; + return; + end if; + Determine_Range (Type_Low_Bound (Etype (Indx)), OK1, LL, LU, Assume_Valid); *************** package body Checks is *** 3350,3357 **** -- For constrained arrays, the minimum value for -- Length is taken from the actual value of the ! -- bounds, since the index will be exactly of ! -- this subtype. if Is_Constrained (Atyp) then Lor := UI_Max (Uint_0, UL - LU + 1); --- 3401,3408 ---- -- For constrained arrays, the minimum value for -- Length is taken from the actual value of the ! -- bounds, since the index will be exactly of this ! -- subtype. if Is_Constrained (Atyp) then Lor := UI_Max (Uint_0, UL - LU + 1); *************** package body Checks is *** 3367,3373 **** end; -- No special handling for other attributes ! -- Probably more opportunities exist here ??? when others => OK1 := False; --- 3418,3424 ---- end; -- No special handling for other attributes ! -- Probably more opportunities exist here??? when others => OK1 := False; *************** package body Checks is *** 3388,3420 **** Hir := No_Uint; end case; ! -- At this stage, if OK1 is true, then we know that the actual ! -- result of the computed expression is in the range Lor .. Hir. ! -- We can use this to restrict the possible range of results. if OK1 then ! -- If the refined value of the low bound is greater than the ! -- type high bound, then reset it to the more restrictive ! -- value. However, we do NOT do this for the case of a modular ! -- type where the possible upper bound on the value is above the ! -- base type high bound, because that means the result could wrap. if Lor > Lo ! and then not (Is_Modular_Integer_Type (Typ) ! and then Hir > Hbound) then Lo := Lor; end if; ! -- Similarly, if the refined value of the high bound is less ! -- than the value so far, then reset it to the more restrictive ! -- value. Again, we do not do this if the refined low bound is ! -- negative for a modular type, since this would wrap. if Hir < Hi ! and then not (Is_Modular_Integer_Type (Typ) ! and then Lor < Uint_0) then Hi := Hir; end if; --- 3439,3469 ---- Hir := No_Uint; end case; ! -- At this stage, if OK1 is true, then we know that the actual result of ! -- the computed expression is in the range Lor .. Hir. We can use this ! -- to restrict the possible range of results. if OK1 then ! -- If the refined value of the low bound is greater than the type ! -- high bound, then reset it to the more restrictive value. However, ! -- we do NOT do this for the case of a modular type where the ! -- possible upper bound on the value is above the base type high ! -- bound, because that means the result could wrap. if Lor > Lo ! and then not (Is_Modular_Integer_Type (Typ) and then Hir > Hbound) then Lo := Lor; end if; ! -- Similarly, if the refined value of the high bound is less than the ! -- value so far, then reset it to the more restrictive value. Again, ! -- we do not do this if the refined low bound is negative for a ! -- modular type, since this would wrap. if Hir < Hi ! and then not (Is_Modular_Integer_Type (Typ) and then Lor < Uint_0) then Hi := Hir; end if; *************** package body Checks is *** 3428,3435 **** Determine_Range_Cache_Hi (Cindex) := Hi; return; ! -- 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 -- 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 a range in this case after all. --- 3477,3484 ---- Determine_Range_Cache_Hi (Cindex) := Hi; return; ! -- If any exception occurs, it means that we have some bug in the compiler, ! -- 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 a range in this case after all. *************** package body Checks is *** 3701,3706 **** --- 3750,3764 ---- return; end if; + -- Do not set range check flag if parent is assignment statement or + -- object declaration with Suppress_Assignment_Checks flag set + + if Nkind_In (Parent (N), N_Assignment_Statement, N_Object_Declaration) + and then Suppress_Assignment_Checks (Parent (N)) + then + return; + end if; + -- Check for various cases where we should suppress the range check -- No check if range checks suppressed for type of node *************** package body Checks is *** 3972,3978 **** then return; ! -- No check on a univeral real constant. The context will eventually -- convert it to a machine number for some target type, or report an -- illegality. --- 4030,4036 ---- then return; ! -- No check on a universal real constant. The context will eventually -- convert it to a machine number for some target type, or report an -- illegality. *************** package body Checks is *** 3981,3987 **** then return; ! -- If the expression denotes a component of a packed boolean arrray, -- no possible check applies. We ignore the old ACATS chestnuts that -- involve Boolean range True..True. --- 4039,4045 ---- then return; ! -- If the expression denotes a component of a packed boolean array, -- no possible check applies. We ignore the old ACATS chestnuts that -- involve Boolean range True..True. *************** package body Checks is *** 4068,4073 **** --- 4126,4142 ---- end if; end if; + -- If this is a boolean expression, only its elementary operands need + -- checking: if they are valid, a boolean or short-circuit operation + -- with them will be valid as well. + + if Base_Type (Typ) = Standard_Boolean + and then + (Nkind (Expr) in N_Op or else Nkind (Expr) in N_Short_Circuit) + then + return; + end if; + -- If we fall through, a validity check is required Insert_Valid_Check (Expr); *************** package body Checks is *** 4687,4695 **** -- Then the conversion itself is replaced by an occurrence of Tnn declare ! Tnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); begin Insert_Actions (N, New_List ( --- 4756,4762 ---- -- Then the conversion itself is replaced by an occurrence of Tnn declare ! Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', N); begin Insert_Actions (N, New_List ( *************** package body Checks is *** 4840,4848 **** -- the value is non-negative declare ! Tnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); begin Insert_Actions (N, New_List ( --- 4907,4913 ---- -- the value is non-negative declare ! Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', N); begin Insert_Actions (N, New_List ( *************** package body Checks is *** 5162,5168 **** Reason => CE_Invalid_Data), Suppress => Validity_Check); ! -- If the expression is a a reference to an element of a bit-packed -- array, then it is rewritten as a renaming declaration. If the -- expression is an actual in a call, it has not been expanded, -- waiting for the proper point at which to do it. The same happens --- 5227,5233 ---- Reason => CE_Invalid_Data), Suppress => Validity_Check); ! -- If the expression is a reference to an element of a bit-packed -- array, then it is rewritten as a renaming declaration. If the -- expression is an actual in a call, it has not been expanded, -- waiting for the proper point at which to do it. The same happens *************** package body Checks is *** 5206,5212 **** ---------------------------------- procedure Install_Null_Excluding_Check (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); Typ : constant Entity_Id := Etype (N); function Safe_To_Capture_In_Parameter_Value return Boolean; --- 5271,5277 ---- ---------------------------------- procedure Install_Null_Excluding_Check (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (Parent (N)); Typ : constant Entity_Id := Etype (N); function Safe_To_Capture_In_Parameter_Value return Boolean; *************** package body Checks is *** 5279,5284 **** --- 5344,5359 ---- return False; end if; + -- If we are in a case expression, and not part of the + -- expression, then we return False, since a particular + -- branch may not always be elaborated + + if Nkind (P) = N_Case_Expression + and then N /= Expression (P) + then + return False; + end if; + -- While traversing the parent chain, we find that N -- belongs to a statement, thus it may never appear in -- a declarative region. *************** package body Checks is *** 5999,6005 **** -- The checking code to be generated will freeze the -- corresponding array type. However, we must freeze the -- type now, so that the freeze node does not appear within ! -- the generated condional expression, but ahead of it. Freeze_Before (Ck_Node, T_Typ); --- 6074,6080 ---- -- The checking code to be generated will freeze the -- corresponding array type. However, we must freeze the -- type now, so that the freeze node does not appear within ! -- the generated conditional expression, but ahead of it. Freeze_Before (Ck_Node, T_Typ); *************** package body Checks is *** 6223,6233 **** -- Expr > Typ'Last function Get_E_First_Or_Last ! (E : Entity_Id; Indx : Nat; Nam : Name_Id) return Node_Id; ! -- Returns expression to compute: -- E'First or E'Last function Get_N_First (N : Node_Id; Indx : Nat) return Node_Id; function Get_N_Last (N : Node_Id; Indx : Nat) return Node_Id; --- 6298,6315 ---- -- Expr > Typ'Last function Get_E_First_Or_Last ! (Loc : Source_Ptr; ! E : Entity_Id; Indx : Nat; Nam : Name_Id) return Node_Id; ! -- Returns an attribute reference -- E'First or E'Last + -- with a source location of Loc. + -- + -- Nam is Name_First or Name_Last, according to which attribute is + -- desired. If Indx is non-zero, it is passed as a literal in the + -- Expressions of the attribute reference (identifying the desired + -- array dimension). function Get_N_First (N : Node_Id; Indx : Nat) return Node_Id; function Get_N_Last (N : Node_Id; Indx : Nat) return Node_Id; *************** package body Checks is *** 6294,6300 **** Duplicate_Subexpr_No_Checks (Expr)), Right_Opnd => Convert_To (Base_Type (Typ), ! Get_E_First_Or_Last (Typ, 0, Name_First))), Right_Opnd => Make_Op_Gt (Loc, --- 6376,6382 ---- Duplicate_Subexpr_No_Checks (Expr)), Right_Opnd => Convert_To (Base_Type (Typ), ! Get_E_First_Or_Last (Loc, Typ, 0, Name_First))), Right_Opnd => Make_Op_Gt (Loc, *************** package body Checks is *** 6304,6310 **** Right_Opnd => Convert_To (Base_Type (Typ), ! Get_E_First_Or_Last (Typ, 0, Name_Last)))); end Discrete_Expr_Cond; ------------------------- --- 6386,6392 ---- Right_Opnd => Convert_To (Base_Type (Typ), ! Get_E_First_Or_Last (Loc, Typ, 0, Name_Last)))); end Discrete_Expr_Cond; ------------------------- *************** package body Checks is *** 6342,6348 **** Right_Opnd => Convert_To ! (Base_Type (Typ), Get_E_First_Or_Last (Typ, 0, Name_First))); if Base_Type (Typ) = Typ then return Left_Opnd; --- 6424,6431 ---- Right_Opnd => Convert_To ! (Base_Type (Typ), ! Get_E_First_Or_Last (Loc, Typ, 0, Name_First))); if Base_Type (Typ) = Typ then return Left_Opnd; *************** package body Checks is *** 6377,6383 **** Right_Opnd => Convert_To (Base_Type (Typ), ! Get_E_First_Or_Last (Typ, 0, Name_Last))); return Make_Or_Else (Loc, Left_Opnd, Right_Opnd); end Discrete_Range_Cond; --- 6460,6466 ---- Right_Opnd => Convert_To (Base_Type (Typ), ! Get_E_First_Or_Last (Loc, Typ, 0, Name_Last))); return Make_Or_Else (Loc, Left_Opnd, Right_Opnd); end Discrete_Range_Cond; *************** package body Checks is *** 6387,6501 **** ------------------------- function Get_E_First_Or_Last ! (E : Entity_Id; Indx : Nat; Nam : Name_Id) return Node_Id is ! N : Node_Id; ! LB : Node_Id; ! HB : Node_Id; ! Bound : Node_Id; ! begin ! if Is_Array_Type (E) then ! N := First_Index (E); ! ! for J in 2 .. Indx loop ! Next_Index (N); ! end loop; ! ! else ! N := Scalar_Range (E); ! end if; ! ! if Nkind (N) = N_Subtype_Indication then ! LB := Low_Bound (Range_Expression (Constraint (N))); ! HB := High_Bound (Range_Expression (Constraint (N))); ! ! elsif Is_Entity_Name (N) then ! LB := Type_Low_Bound (Etype (N)); ! HB := Type_High_Bound (Etype (N)); ! ! else ! LB := Low_Bound (N); ! HB := High_Bound (N); ! end if; ! ! if Nam = Name_First then ! Bound := LB; else ! Bound := HB; end if; ! if Nkind (Bound) = N_Identifier ! and then Ekind (Entity (Bound)) = E_Discriminant ! then ! -- If this is a task discriminant, and we are the body, we must ! -- retrieve the corresponding body discriminal. This is another ! -- consequence of the early creation of discriminals, and the ! -- need to generate constraint checks before their declarations ! -- are made visible. ! ! if Is_Concurrent_Record_Type (Scope (Entity (Bound))) then ! declare ! Tsk : constant Entity_Id := ! Corresponding_Concurrent_Type ! (Scope (Entity (Bound))); ! Disc : Entity_Id; ! ! begin ! if In_Open_Scopes (Tsk) ! and then Has_Completion (Tsk) ! then ! -- Find discriminant of original task, and use its ! -- current discriminal, which is the renaming within ! -- the task body. ! ! Disc := First_Discriminant (Tsk); ! while Present (Disc) loop ! if Chars (Disc) = Chars (Entity (Bound)) then ! Set_Scope (Discriminal (Disc), Tsk); ! return New_Occurrence_Of (Discriminal (Disc), Loc); ! end if; ! ! Next_Discriminant (Disc); ! end loop; ! ! -- That loop should always succeed in finding a matching ! -- entry and returning. Fatal error if not. ! ! raise Program_Error; ! ! else ! return ! New_Occurrence_Of (Discriminal (Entity (Bound)), Loc); ! end if; ! end; ! else ! return New_Occurrence_Of (Discriminal (Entity (Bound)), Loc); ! end if; ! ! elsif Nkind (Bound) = N_Identifier ! and then Ekind (Entity (Bound)) = E_In_Parameter ! and then not Inside_Init_Proc ! then ! return Get_Discriminal (E, Bound); ! ! elsif Nkind (Bound) = N_Integer_Literal then ! return Make_Integer_Literal (Loc, Intval (Bound)); ! ! -- Case of a bound rewritten to an N_Raise_Constraint_Error node ! -- because it is an out-of-range value. Duplicate_Subexpr cannot be ! -- called on this node because an N_Raise_Constraint_Error is not ! -- side effect free, and we may not assume that we are in the proper ! -- context to remove side effects on it at the point of reference. ! ! elsif Nkind (Bound) = N_Raise_Constraint_Error then ! return New_Copy_Tree (Bound); ! ! else ! return Duplicate_Subexpr_No_Checks (Bound); ! end if; end Get_E_First_Or_Last; ----------------- --- 6470,6492 ---- ------------------------- function Get_E_First_Or_Last ! (Loc : Source_Ptr; ! E : Entity_Id; Indx : Nat; Nam : Name_Id) return Node_Id is ! Exprs : List_Id; begin ! if Indx > 0 then ! Exprs := New_List (Make_Integer_Literal (Loc, UI_From_Int (Indx))); else ! Exprs := No_List; end if; ! return Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (E, Loc), ! Attribute_Name => Nam, ! Expressions => Exprs); end Get_E_First_Or_Last; ----------------- *************** package body Checks is *** 6542,6554 **** Make_Or_Else (Loc, Left_Opnd => Make_Op_Lt (Loc, ! Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_First), ! Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_First)), Right_Opnd => Make_Op_Gt (Loc, ! Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_Last), ! Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_Last))); end Range_E_Cond; ------------------------ --- 6533,6549 ---- Make_Or_Else (Loc, Left_Opnd => Make_Op_Lt (Loc, ! Left_Opnd => ! Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_First), ! Right_Opnd => ! Get_E_First_Or_Last (Loc, Typ, Indx, Name_First)), Right_Opnd => Make_Op_Gt (Loc, ! Left_Opnd => ! Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_Last), ! Right_Opnd => ! Get_E_First_Or_Last (Loc, Typ, Indx, Name_Last))); end Range_E_Cond; ------------------------ *************** package body Checks is *** 6565,6576 **** Make_Or_Else (Loc, Left_Opnd => Make_Op_Ne (Loc, ! Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_First), ! Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_First)), Right_Opnd => Make_Op_Ne (Loc, ! Left_Opnd => Get_E_First_Or_Last (Exptyp, Indx, Name_Last), ! Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_Last))); end Range_Equal_E_Cond; ------------------ --- 6560,6576 ---- Make_Or_Else (Loc, Left_Opnd => Make_Op_Ne (Loc, ! Left_Opnd => ! Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_First), ! Right_Opnd => ! Get_E_First_Or_Last (Loc, Typ, Indx, Name_First)), ! Right_Opnd => Make_Op_Ne (Loc, ! Left_Opnd => ! Get_E_First_Or_Last (Loc, Exptyp, Indx, Name_Last), ! Right_Opnd => ! Get_E_First_Or_Last (Loc, Typ, Indx, Name_Last))); end Range_Equal_E_Cond; ------------------ *************** package body Checks is *** 6587,6599 **** Make_Or_Else (Loc, Left_Opnd => Make_Op_Lt (Loc, ! Left_Opnd => Get_N_First (Expr, Indx), ! Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_First)), Right_Opnd => Make_Op_Gt (Loc, ! Left_Opnd => Get_N_Last (Expr, Indx), ! Right_Opnd => Get_E_First_Or_Last (Typ, Indx, Name_Last))); end Range_N_Cond; -- Start of processing for Selected_Range_Checks --- 6587,6603 ---- Make_Or_Else (Loc, Left_Opnd => Make_Op_Lt (Loc, ! Left_Opnd => ! Get_N_First (Expr, Indx), ! Right_Opnd => ! Get_E_First_Or_Last (Loc, Typ, Indx, Name_First)), Right_Opnd => Make_Op_Gt (Loc, ! Left_Opnd => ! Get_N_Last (Expr, Indx), ! Right_Opnd => ! Get_E_First_Or_Last (Loc, Typ, Indx, Name_Last))); end Range_N_Cond; -- Start of processing for Selected_Range_Checks diff -Nrcpad gcc-4.5.2/gcc/ada/checks.ads gcc-4.6.0/gcc/ada/checks.ads *** gcc-4.5.2/gcc/ada/checks.ads Mon Apr 20 13:32:11 2009 --- gcc-4.6.0/gcc/ada/checks.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Checks is *** 134,143 **** (N : Node_Id; Typ : Entity_Id; No_Sliding : Boolean := False); ! -- Top-level procedure, calls all the others depending on the class of Typ. ! -- Checks that expression N satisfies the constraint of type Typ. ! -- No_Sliding is only relevant for constrained array types, if set to True, ! -- it checks that indexes are in range. procedure Apply_Discriminant_Check (N : Node_Id; --- 134,143 ---- (N : Node_Id; Typ : Entity_Id; No_Sliding : Boolean := False); ! -- Top-level procedure, calls all the others depending on the class of ! -- Typ. Checks that expression N satisfies the constraint of type Typ. ! -- No_Sliding is only relevant for constrained array types, if set to ! -- True, it checks that indexes are in range. procedure Apply_Discriminant_Check (N : Node_Id; *************** package Checks is *** 150,158 **** -- where the target object may be needed to determine the subtype to -- check against (such as the cases of unconstrained formal parameters -- and unconstrained aliased objects). For the case of unconstrained ! -- formals, the check is peformed only if the corresponding actual is -- constrained, i.e., whether Lhs'Constrained is True. function Build_Discriminant_Checks (N : Node_Id; T_Typ : Entity_Id) --- 150,163 ---- -- where the target object may be needed to determine the subtype to -- check against (such as the cases of unconstrained formal parameters -- and unconstrained aliased objects). For the case of unconstrained ! -- formals, the check is performed only if the corresponding actual is -- constrained, i.e., whether Lhs'Constrained is True. + procedure Apply_Predicate_Check (N : Node_Id; Typ : Entity_Id); + -- N is an expression to which a predicate check may need to be applied + -- for Typ, if Typ has a predicate function. The check is applied only + -- if the type of N does not match Typ. + function Build_Discriminant_Checks (N : Node_Id; T_Typ : Entity_Id) diff -Nrcpad gcc-4.5.2/gcc/ada/clean.adb gcc-4.6.0/gcc/ada/clean.adb *** gcc-4.5.2/gcc/ada/clean.adb Mon Nov 30 13:45:45 2009 --- gcc-4.6.0/gcc/ada/clean.adb Tue Oct 5 09:26:00 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package body Clean is *** 1556,1562 **** -- Initialize some packages Csets.Initialize; - Namet.Initialize; Snames.Initialize; Project_Node_Tree := new Project_Node_Tree_Data; --- 1556,1561 ---- *************** package body Clean is *** 1677,1682 **** --- 1676,1684 ---- new String' (Arg (Subdirs_Option'Length + 1 .. Arg'Last)); + elsif Arg = Makeutl.Unchecked_Shared_Lib_Imports then + Opt.Unchecked_Shared_Lib_Imports := True; + else Bad_Argument; end if; *************** package body Clean is *** 1690,1697 **** Add_Lib_Search_Dir (Arg (4 .. Arg'Last)); elsif Arg (3) = 'P' then ! Prj.Ext.Add_Search_Project_Directory ! (Project_Node_Tree, Arg (4 .. Arg'Last)); else Bad_Argument; --- 1692,1700 ---- Add_Lib_Search_Dir (Arg (4 .. Arg'Last)); elsif Arg (3) = 'P' then ! Prj.Env.Add_Directories ! (Project_Node_Tree.Project_Path, ! Arg (4 .. Arg'Last)); else Bad_Argument; *************** package body Clean is *** 1957,1962 **** --- 1960,1967 ---- New_Line; Put_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs"); + Put_Line (" " & Makeutl.Unchecked_Shared_Lib_Imports); + Put_Line (" Allow shared libraries to import static libraries"); New_Line; Put_Line (" -c Only delete compiler generated files"); diff -Nrcpad gcc-4.5.2/gcc/ada/csets.adb gcc-4.6.0/gcc/ada/csets.adb *** gcc-4.5.2/gcc/ada/csets.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/csets.adb Tue Jun 22 16:57:01 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Csets is *** 618,626 **** -- Definitions for IBM PC (Code Page 437) -- -------------------------------------------- ! -- Note: Code page 437 is the typical default in DOS, Windows and OS/2 ! -- for PC's in the US, it corresponds to the original PC character set. ! -- See also the definitions for code page 850. Fold_IBM_PC_437 : constant Translate_Table := Translate_Table'( --- 618,626 ---- -- Definitions for IBM PC (Code Page 437) -- -------------------------------------------- ! -- Note: Code page 437 is the typical default in Windows for PC's in the ! -- US, it corresponds to the original PC character set. See also the ! -- definitions for code page 850. Fold_IBM_PC_437 : constant Translate_Table := Translate_Table'( *************** package body Csets is *** 752,761 **** -- Definitions for IBM PC (Code Page 850) -- -------------------------------------------- ! -- Note: Code page 850 is the typical default in DOS, Windows and OS/2 ! -- for PC's in Europe, it is an extension of the original PC character ! -- set to include the additional characters defined in ISO Latin-1. ! -- See also the definitions for code page 437. Fold_IBM_PC_850 : constant Translate_Table := Translate_Table'( --- 752,761 ---- -- Definitions for IBM PC (Code Page 850) -- -------------------------------------------- ! -- Note: Code page 850 is the typical default in Windows for PC's in ! -- Europe, it is an extension of the original PC character set to include ! -- the additional characters defined in ISO Latin-1. See also the ! -- definitions for code page 437. Fold_IBM_PC_850 : constant Translate_Table := Translate_Table'( diff -Nrcpad gcc-4.5.2/gcc/ada/csinfo.adb gcc-4.6.0/gcc/ada/csinfo.adb *** gcc-4.5.2/gcc/ada/csinfo.adb Mon Nov 30 14:03:03 2009 --- gcc-4.6.0/gcc/ada/csinfo.adb Tue Oct 26 12:19:56 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,32 **** -- -- ------------------------------------------------------------------------------ ! -- Program to check consistency of sinfo.ads and sinfo.adb. Checks that field ! -- name usage is consistent and that assertion cross-reference lists are ! -- correct, as well as making sure that all the comments on field name usage ! -- are consistent. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; --- 23,35 ---- -- -- ------------------------------------------------------------------------------ ! -- Check consistency of sinfo.ads and sinfo.adb. Checks that field name usage ! -- is consistent and that assertion cross-reference lists are correct, as well ! -- as making sure that all the comments on field name usage are consistent. ! ! -- Note that this is used both as a standalone program, and as a procedure ! -- called by XSinfo. This raises an unhandled exception if it finds any ! -- errors; we don't attempt any sophisticated error recovery. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; *************** begin *** 210,215 **** --- 213,219 ---- Set (Special, "Etype", True); Set (Special, "Evaluate_Once", True); Set (Special, "First_Itype", True); + Set (Special, "Has_Aspect_Specifications", True); Set (Special, "Has_Dynamic_Itype", True); Set (Special, "Has_Dynamic_Range_Check", True); Set (Special, "Has_Dynamic_Length_Check", True); *************** begin *** 634,641 **** New_Line; Put_Line ("All tests completed successfully, no errors detected"); - exception - when Done => - null; - end CSinfo; --- 638,641 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/cstand.adb gcc-4.6.0/gcc/ada/cstand.adb *** gcc-4.5.2/gcc/ada/cstand.adb Thu Apr 9 12:56:35 2009 --- gcc-4.6.0/gcc/ada/cstand.adb Fri Oct 22 10:19:58 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Output; use Output; *** 36,42 **** with Targparm; use Targparm; with Tbuild; use Tbuild; with Ttypes; use Ttypes; - with Ttypef; use Ttypef; with Scn; with Sem_Mech; use Sem_Mech; with Sem_Util; use Sem_Util; --- 36,41 ---- *************** package body CStand is *** 141,148 **** --- 140,155 ---- Set_Type_Definition (Parent (E), Make_Floating_Point_Definition (Stloc, Digits_Expression => Make_Integer (UI_From_Int (Digs)))); + Set_Ekind (E, E_Floating_Point_Type); Set_Etype (E, E); + + if AAMP_On_Target then + Set_Float_Rep (E, AAMP); + else + Set_Float_Rep (E, IEEE_Binary); + end if; + Init_Size (E, Siz); Set_Elem_Alignment (E); Init_Digits_Value (E, Digs); *************** package body CStand is *** 287,297 **** Set_Etype (Last_Entity (Standard_Op_Concatw), Standard_Wide_String); Set_Etype (First_Entity (Standard_Op_Concatww), ! Standard_Wide_Wide_String); Set_Etype (Last_Entity (Standard_Op_Concatww), ! Standard_Wide_Wide_String); ! end Create_Operators; --------------------- --- 294,303 ---- Set_Etype (Last_Entity (Standard_Op_Concatw), Standard_Wide_String); Set_Etype (First_Entity (Standard_Op_Concatww), ! Standard_Wide_Wide_String); Set_Etype (Last_Entity (Standard_Op_Concatww), ! Standard_Wide_Wide_String); end Create_Operators; --------------------- *************** package body CStand is *** 324,329 **** --- 330,339 ---- procedure Build_Exception (S : Standard_Entity_Type); -- Procedure to declare given entity as an exception + procedure Pack_String_Type (String_Type : Entity_Id); + -- Generate proper tree for pragma Pack that applies to given type, and + -- mark type as having the pragma. + --------------------- -- Build_Exception -- --------------------- *************** package body CStand is *** 341,346 **** --- 351,375 ---- Append (Decl, Decl_S); end Build_Exception; + ---------------------- + -- Pack_String_Type -- + ---------------------- + + procedure Pack_String_Type (String_Type : Entity_Id) is + Prag : constant Node_Id := + Make_Pragma (Stloc, + Chars => Name_Pack, + Pragma_Argument_Associations => + New_List ( + Make_Pragma_Argument_Association (Stloc, + Expression => + New_Occurrence_Of (String_Type, Stloc)))); + begin + Append (Prag, Decl_S); + Record_Rep_Item (String_Type, Prag); + Set_Has_Pragma_Pack (String_Type, True); + end Pack_String_Type; + -- Start of processing for Create_Standard begin *************** package body CStand is *** 424,429 **** --- 453,459 ---- Set_Is_Unsigned_Type (Standard_Boolean); Set_Size_Known_At_Compile_Time (Standard_Boolean); + Set_Has_Pragma_Ordered (Standard_Boolean); Set_Ekind (Standard_True, E_Enumeration_Literal); Set_Etype (Standard_True, Standard_Boolean); *************** package body CStand is *** 544,549 **** --- 574,580 ---- Init_RM_Size (Standard_Character, 8); Set_Elem_Alignment (Standard_Character); + Set_Has_Pragma_Ordered (Standard_Character); Set_Is_Unsigned_Type (Standard_Character); Set_Is_Character_Type (Standard_Character); Set_Is_Known_Valid (Standard_Character); *************** package body CStand is *** 589,594 **** --- 620,626 ---- Init_Size (Standard_Wide_Character, Standard_Wide_Character_Size); Set_Elem_Alignment (Standard_Wide_Character); + Set_Has_Pragma_Ordered (Standard_Wide_Character); Set_Is_Unsigned_Type (Standard_Wide_Character); Set_Is_Character_Type (Standard_Wide_Character); Set_Is_Known_Valid (Standard_Wide_Character); *************** package body CStand is *** 636,641 **** --- 668,674 ---- Standard_Wide_Wide_Character_Size); Set_Elem_Alignment (Standard_Wide_Wide_Character); + Set_Has_Pragma_Ordered (Standard_Wide_Wide_Character); Set_Is_Unsigned_Type (Standard_Wide_Wide_Character); Set_Is_Character_Type (Standard_Wide_Wide_Character); Set_Is_Known_Valid (Standard_Wide_Wide_Character); *************** package body CStand is *** 688,699 **** Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_String), Tdef_Node); ! Set_Ekind (Standard_String, E_String_Type); ! Set_Etype (Standard_String, Standard_String); ! Set_Component_Type (Standard_String, Standard_Character); ! Set_Component_Size (Standard_String, Uint_8); ! Init_Size_Align (Standard_String); ! Set_Alignment (Standard_String, Uint_1); -- On targets where a storage unit is larger than a byte (such as AAMP), -- pragma Pack has a real effect on the representation of type String, --- 721,733 ---- Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_String), Tdef_Node); ! Set_Ekind (Standard_String, E_String_Type); ! Set_Etype (Standard_String, Standard_String); ! Set_Component_Type (Standard_String, Standard_Character); ! Set_Component_Size (Standard_String, Uint_8); ! Init_Size_Align (Standard_String); ! Set_Alignment (Standard_String, Uint_1); ! Pack_String_Type (Standard_String); -- On targets where a storage unit is larger than a byte (such as AAMP), -- pragma Pack has a real effect on the representation of type String, *************** package body CStand is *** 731,741 **** Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_Wide_String), Tdef_Node); ! Set_Ekind (Standard_Wide_String, E_String_Type); ! Set_Etype (Standard_Wide_String, Standard_Wide_String); ! Set_Component_Type (Standard_Wide_String, Standard_Wide_Character); ! Set_Component_Size (Standard_Wide_String, Uint_16); ! Init_Size_Align (Standard_Wide_String); -- Set index type of Wide_String --- 765,776 ---- Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node)); Set_Type_Definition (Parent (Standard_Wide_String), Tdef_Node); ! Set_Ekind (Standard_Wide_String, E_String_Type); ! Set_Etype (Standard_Wide_String, Standard_Wide_String); ! Set_Component_Type (Standard_Wide_String, Standard_Wide_Character); ! Set_Component_Size (Standard_Wide_String, Uint_16); ! Init_Size_Align (Standard_Wide_String); ! Pack_String_Type (Standard_Wide_String); -- Set index type of Wide_String *************** package body CStand is *** 772,777 **** --- 807,813 ---- Set_Component_Size (Standard_Wide_Wide_String, Uint_32); Init_Size_Align (Standard_Wide_Wide_String); Set_Is_Ada_2005_Only (Standard_Wide_Wide_String); + Pack_String_Type (Standard_Wide_Wide_String); -- Set index type of Wide_Wide_String *************** package body CStand is *** 1641,1701 **** ------------------- procedure P_Float_Range (Id : Entity_Id) is - Digs : constant Nat := UI_To_Int (Digits_Value (Id)); - begin Write_Str (" range "); ! ! if Vax_Float (Id) then ! if Digs = VAXFF_Digits then ! Write_Str (VAXFF_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (VAXFF_Last'Universal_Literal_String); ! ! elsif Digs = VAXDF_Digits then ! Write_Str (VAXDF_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (VAXDF_Last'Universal_Literal_String); ! ! else ! pragma Assert (Digs = VAXGF_Digits); ! ! Write_Str (VAXGF_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (VAXGF_Last'Universal_Literal_String); ! end if; ! ! elsif Is_AAMP_Float (Id) then ! if Digs = AAMPS_Digits then ! Write_Str (AAMPS_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (AAMPS_Last'Universal_Literal_String); ! ! else ! pragma Assert (Digs = AAMPL_Digits); ! Write_Str (AAMPL_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (AAMPL_Last'Universal_Literal_String); ! end if; ! ! elsif Digs = IEEES_Digits then ! Write_Str (IEEES_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (IEEES_Last'Universal_Literal_String); ! ! elsif Digs = IEEEL_Digits then ! Write_Str (IEEEL_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (IEEEL_Last'Universal_Literal_String); ! ! else ! pragma Assert (Digs = IEEEX_Digits); ! ! Write_Str (IEEEX_First'Universal_Literal_String); ! Write_Str (" .. "); ! Write_Str (IEEEX_Last'Universal_Literal_String); ! end if; ! Write_Str (";"); Write_Eol; end P_Float_Range; --- 1677,1687 ---- ------------------- procedure P_Float_Range (Id : Entity_Id) is begin Write_Str (" range "); ! UR_Write (Realval (Type_Low_Bound (Id))); ! Write_Str (" .. "); ! UR_Write (Realval (Type_High_Bound (Id))); Write_Str (";"); Write_Eol; end P_Float_Range; *************** package body CStand is *** 1879,1959 **** ---------------------- procedure Set_Float_Bounds (Id : Entity_Id) is ! L : Node_Id; -- Low bound of literal value ! H : Node_Id; -- High bound of literal value ! R : Node_Id; -- Range specification ! Digs : constant Nat := UI_To_Int (Digits_Value (Id)); ! -- Digits value, used to select bounds begin -- Note: for the call from Cstand to initially create the types in ! -- Standard, Vax_Float will always be False. Circuitry in Sem_Vfpt ! -- will adjust these types appropriately in the Vax_Float case if ! -- a pragma Float_Representation (VAX_Float) is used. ! ! if Vax_Float (Id) then ! if Digs = VAXFF_Digits then ! L := Real_Convert ! (VAXFF_First'Universal_Literal_String); ! H := Real_Convert ! (VAXFF_Last'Universal_Literal_String); ! ! elsif Digs = VAXDF_Digits then ! L := Real_Convert ! (VAXDF_First'Universal_Literal_String); ! H := Real_Convert ! (VAXDF_Last'Universal_Literal_String); ! ! else ! pragma Assert (Digs = VAXGF_Digits); ! ! L := Real_Convert ! (VAXGF_First'Universal_Literal_String); ! H := Real_Convert ! (VAXGF_Last'Universal_Literal_String); ! end if; ! ! elsif Is_AAMP_Float (Id) then ! if Digs = AAMPS_Digits then ! L := Real_Convert ! (AAMPS_First'Universal_Literal_String); ! H := Real_Convert ! (AAMPS_Last'Universal_Literal_String); ! ! else ! pragma Assert (Digs = AAMPL_Digits); ! L := Real_Convert ! (AAMPL_First'Universal_Literal_String); ! H := Real_Convert ! (AAMPL_Last'Universal_Literal_String); ! end if; ! ! elsif Digs = IEEES_Digits then ! L := Real_Convert ! (IEEES_First'Universal_Literal_String); ! H := Real_Convert ! (IEEES_Last'Universal_Literal_String); ! ! elsif Digs = IEEEL_Digits then ! L := Real_Convert ! (IEEEL_First'Universal_Literal_String); ! H := Real_Convert ! (IEEEL_Last'Universal_Literal_String); ! ! else ! pragma Assert (Digs = IEEEX_Digits); ! L := Real_Convert ! (IEEEX_First'Universal_Literal_String); ! H := Real_Convert ! (IEEEX_Last'Universal_Literal_String); ! end if; Set_Etype (L, Id); Set_Is_Static_Expression (L); --- 1865,1893 ---- ---------------------- procedure Set_Float_Bounds (Id : Entity_Id) is ! L : Node_Id; -- Low bound of literal value ! H : Node_Id; -- High bound of literal value ! R : Node_Id; -- Range specification ! Radix : constant Uint := Machine_Radix_Value (Id); ! Mantissa : constant Uint := Machine_Mantissa_Value (Id); ! Emax : constant Uint := Machine_Emax_Value (Id); ! Significand : constant Uint := Radix ** Mantissa - 1; ! Exponent : constant Uint := Emax - Mantissa; begin -- Note: for the call from Cstand to initially create the types in ! -- Standard, Float_Rep will never be VAX_Native. Circuitry in Sem_Vfpt ! -- will adjust these types appropriately VAX_Native if a pragma ! -- Float_Representation (VAX_Float) is used. ! H := Make_Float_Literal (Stloc, Radix, Significand, Exponent); ! L := Make_Float_Literal (Stloc, Radix, -Significand, Exponent); Set_Etype (L, Id); Set_Is_Static_Expression (L); diff -Nrcpad gcc-4.5.2/gcc/ada/cstreams.c gcc-4.6.0/gcc/ada/cstreams.c *** gcc-4.5.2/gcc/ada/cstreams.c Sun Jul 26 15:09:10 2009 --- gcc-4.6.0/gcc/ada/cstreams.c Tue Jun 22 16:57:01 2010 *************** *** 6,12 **** * * * Auxiliary C functions for Interfaces.C.Streams * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * Auxiliary C functions for Interfaces.C.Streams * * * ! * Copyright (C) 1992-2010, 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- * *************** __gnat_is_regular_file_fd (int fd) *** 98,112 **** int ret; GNAT_STRUCT_STAT statbuf; - #ifdef __EMX__ - /* Programs using screen I/O may need to reset the FPU after - initialization of screen-handling related DLL's, so force - DLL initialization by doing a null-write and then reset the FPU */ - - DosWrite (0, &ret, 0, &ret); - __gnat_init_float(); - #endif - ret = GNAT_FSTAT (fd, &statbuf); return (!ret && S_ISREG (statbuf.st_mode)); } --- 98,103 ---- *************** __gnat_full_name (char *nam, char *buffe *** 166,174 **** else buffer[0] = '\0'; ! #elif defined(__EMX__) || defined (__MINGW32__) ! /* If this is a device file return it as is; under Windows NT and ! OS/2 a device file end with ":". */ if (nam[strlen (nam) - 1] == ':') strcpy (buffer, nam); else --- 157,165 ---- else buffer[0] = '\0'; ! #elif defined (__MINGW32__) ! /* If this is a device file return it as is; ! under Windows NT a device file ends with ":". */ if (nam[strlen (nam) - 1] == ':') strcpy (buffer, nam); else *************** __gnat_full_name (char *nam, char *buffe *** 182,190 **** *p = '\\'; } - #elif defined (MSDOS) - _fixpath (nam, buffer); - #elif defined (sgi) || defined (__FreeBSD__) /* Use realpath function which resolves links and references to . and .. --- 173,178 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/debug.adb gcc-4.6.0/gcc/ada/debug.adb *** gcc-4.5.2/gcc/ada/debug.adb Mon Nov 30 14:15:51 2009 --- gcc-4.6.0/gcc/ada/debug.adb Tue Oct 12 13:05:11 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Debug is *** 76,82 **** -- dJ Output debugging trace info for JGNAT (Java VM version of GNAT) -- dK Kill all error messages -- dL Output trace information on elaboration checking ! -- dM Asssume all variables are modified (no current values) -- dN No file name information in exception messages -- dO Output immediate error messages -- dP Do not check for controlled objects in preelaborable packages --- 76,82 ---- -- dJ Output debugging trace info for JGNAT (Java VM version of GNAT) -- dK Kill all error messages -- dL Output trace information on elaboration checking ! -- dM Assume all variables are modified (no current values) -- dN No file name information in exception messages -- dO Output immediate error messages -- dP Do not check for controlled objects in preelaborable packages *************** package body Debug is *** 105,124 **** -- d.l Use Ada 95 semantics for limited function returns -- d.m For -gnatl, print full source only for main unit -- d.n Print source file names ! -- d.o ! -- d.p -- d.q -- d.r Enable OK_To_Reorder_Components in non-variant records -- d.s Disable expansion of slice move, use memmove -- d.t Disable static allocation of library level dispatch tables -- d.u -- d.v Enable OK_To_Reorder_Components in variant records ! -- d.w Do not check for infinite while loops -- d.x No exception handlers -- d.y -- d.z ! -- d.A -- d.B -- d.C Generate concatenation call, do not generate inline code -- d.D --- 105,124 ---- -- d.l Use Ada 95 semantics for limited function returns -- d.m For -gnatl, print full source only for main unit -- d.n Print source file names ! -- d.o Generate .NET listing of CIL code ! -- d.p Enable the .NET CIL verifier -- d.q -- d.r Enable OK_To_Reorder_Components in non-variant records -- d.s Disable expansion of slice move, use memmove -- d.t Disable static allocation of library level dispatch tables -- d.u -- d.v Enable OK_To_Reorder_Components in variant records ! -- d.w Do not check for infinite loops -- d.x No exception handlers -- d.y -- d.z ! -- d.A Read/write Aspect_Specifications hash table to tree -- d.B -- d.C Generate concatenation call, do not generate inline code -- d.D *************** package body Debug is *** 127,135 **** -- d.G -- d.H -- d.I SCIL generation mode ! -- d.J Parallel SCIL generation mode -- d.K ! -- d.L -- d.M -- d.N -- d.O Dump internal SCO tables --- 127,135 ---- -- d.G -- d.H -- d.I SCIL generation mode ! -- d.J Disable parallel SCIL generation mode -- d.K ! -- d.L Depend on back end for limited types in conditional expressions -- d.M -- d.N -- d.O Dump internal SCO tables *************** package body Debug is *** 141,148 **** -- d.U -- d.V -- d.W Print out debugging information for Walk_Library_Items ! -- d.X ! -- d.Y -- d.Z -- d1 Error msgs have node numbers where possible --- 141,148 ---- -- d.U -- d.V -- d.W Print out debugging information for Walk_Library_Items ! -- d.X Use Expression_With_Actions ! -- d.Y Do not use Expression_With_Actions -- d.Z -- d1 Error msgs have node numbers where possible *************** package body Debug is *** 198,204 **** -- dj -- dk -- dl ! -- dm -- dn Do not delete temp files created by gnatmake -- do -- dp Prints the contents of the Q used by Make.Compile_Sources --- 198,204 ---- -- dj -- dk -- dl ! -- dm Display the number of maximum simultaneous compilations -- dn Do not delete temp files created by gnatmake -- do -- dp Prints the contents of the Q used by Make.Compile_Sources *************** package body Debug is *** 531,536 **** --- 531,543 ---- -- compiler has a bug -- these are the files that need to be included -- in a bug report. + -- d.o Generate listing showing the IL instructions generated by the .NET + -- compiler for each subprogram. + + -- d.p Enable the .NET CIL verifier. During development the verifier is + -- disabled by default and this flag is used to enable it. In the + -- future we will reverse this functionality. + -- d.r Forces the flag OK_To_Reorder_Components to be set in all record -- base types that have no discriminants. *************** package body Debug is *** 548,556 **** -- d.v Forces the flag OK_To_Reorder_Components to be set in all record -- base types that have at least one discriminant (v = variant). ! -- d.w This flag turns off the scanning of while loops to detect possible -- infinite loops. -- d.x No exception handlers in generated code. This causes exception -- handlers to be eliminated from the generated code. They are still -- fully compiled and analyzed, they just get eliminated from the --- 555,568 ---- -- d.v Forces the flag OK_To_Reorder_Components to be set in all record -- base types that have at least one discriminant (v = variant). ! -- d.w This flag turns off the scanning of loops to detect possible -- infinite loops. + -- d.A There seems to be a problem with ASIS if we activate the circuit + -- for reading and writing the aspect specification hash table, so + -- for now, this is controlled by the debug flag d.A. The hash table + -- is only written and read if this flag is set. + -- d.x No exception handlers in generated code. This causes exception -- handlers to be eliminated from the generated code. They are still -- fully compiled and analyzed, they just get eliminated from the *************** package body Debug is *** 563,571 **** -- of static analysis tools, and ensure additional tree consistency -- between different compilations of specs. ! -- d.J Ensure the SCIL generated is compatible with parallel builds. ! -- This means in particular not writing the same files under the ! -- same directory. -- d.O Dump internal SCO tables. Before outputting the SCO information to -- the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table) --- 575,588 ---- -- of static analysis tools, and ensure additional tree consistency -- between different compilations of specs. ! -- d.J Disable parallel SCIL generation. Normally SCIL file generation is ! -- done in parallel to speed processing. This switch disables this ! -- behavior. ! ! -- d.L Normally the front end generates special expansion for conditional ! -- expressions of a limited type. This debug flag removes this special ! -- case expansion, leaving it up to the back end to handle conditional ! -- expressions correctly. -- d.O Dump internal SCO tables. Before outputting the SCO information to -- the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table) *************** package body Debug is *** 576,583 **** -- d.T Force Optimize_Alignment (Time) mode as the default -- d.W Print out debugging information for Walk_Library_Items, including ! -- the order in which units are walked. This is primarily for SofCheck ! -- Inspector. -- d1 Error messages have node numbers where possible. Normally error -- messages have only source locations. This option is useful when --- 593,612 ---- -- d.T Force Optimize_Alignment (Time) mode as the default -- d.W Print out debugging information for Walk_Library_Items, including ! -- the order in which units are walked. This is primarily for use in ! -- debugging CodePeer mode. ! ! -- d.X By default, the compiler uses an elaborate rewriting framework for ! -- short-circuited forms where the right hand condition generates ! -- actions to be inserted. With the gcc backend, we now use the new ! -- N_Expression_With_Actions node for this expansion, but we still use ! -- the old method for other backends and in SCIL mode. This debug flag ! -- forces use of the new N_Expression_With_Actions node in these other ! -- cases and is intended for transitional use. ! ! -- d.Y Prevents the use of the N_Expression_With_Actions node even in the ! -- case of the gcc back end. Provided as a back up in case the new ! -- scheme has problems. -- d1 Error messages have node numbers where possible. Normally error -- messages have only source locations. This option is useful when *************** package body Debug is *** 669,674 **** --- 698,706 ---- -- df Only output file names, not path names, in log + -- dm Issue a message indicating the maximum number of simultaneous + -- compilations. + -- 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 -Nrcpad gcc-4.5.2/gcc/ada/einfo.adb gcc-4.6.0/gcc/ada/einfo.adb *** gcc-4.5.2/gcc/ada/einfo.adb Thu Jul 23 09:42:18 2009 --- gcc-4.6.0/gcc/ada/einfo.adb Tue Oct 26 12:56:43 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,42 **** pragma Style_Checks (All_Checks); -- Turn off subprogram ordering, not used for this unit ! with Atree; use Atree; ! with Nlists; use Nlists; ! with Output; use Output; ! with Sinfo; use Sinfo; ! with Stand; use Stand; package body Einfo is --- 32,42 ---- pragma Style_Checks (All_Checks); -- Turn off subprogram ordering, not used for this unit ! with Atree; use Atree; ! with Nlists; use Nlists; ! with Output; use Output; ! with Sinfo; use Sinfo; ! with Stand; use Stand; package body Einfo is *************** package body Einfo is *** 79,93 **** -- Normalized_First_Bit Uint8 -- Postcondition_Proc Node8 -- Return_Applies_To Node8 -- Class_Wide_Type Node9 -- Current_Value Node9 -- Renaming_Map Uint9 -- Discriminal_Link Node10 -- Handler_Records List10 -- Normalized_Position_Max Uint10 - -- Referenced_Object Node10 -- Component_Bit_Offset Uint11 -- Full_View Node11 --- 79,95 ---- -- Normalized_First_Bit Uint8 -- Postcondition_Proc Node8 -- Return_Applies_To Node8 + -- First_Exit_Statement Node8 -- Class_Wide_Type Node9 -- Current_Value Node9 -- Renaming_Map Uint9 + -- Direct_Primitive_Operations Elist10 -- Discriminal_Link Node10 + -- Float_Rep Uint10 (but returns Float_Rep_Kind) -- Handler_Records List10 -- Normalized_Position_Max Uint10 -- Component_Bit_Offset Uint11 -- Full_View Node11 *************** package body Einfo is *** 120,126 **** -- Entry_Parameters_Type Node15 -- Extra_Formal Node15 -- Lit_Indexes Node15 - -- Primitive_Operations Elist15 -- Related_Instance Node15 -- Scale_Value Uint15 -- Storage_Size_Variable Node15 --- 122,127 ---- *************** package body Einfo is *** 148,153 **** --- 149,155 ---- -- Alias Node18 -- Corresponding_Concurrent_Type Node18 + -- Corresponding_Protected_Entry Node18 -- Corresponding_Record_Type Node18 -- Delta_Value Ureal18 -- Enclosing_Scope Node18 *************** package body Einfo is *** 207,232 **** -- Related_Expression Node24 -- Spec_PPC_List Node24 - -- Underlying_Record_View Node24 -- Interface_Alias Node25 -- Interfaces Elist25 -- Debug_Renaming_Link Node25 -- DT_Offset_To_Top_Func Node25 -- Task_Body_Procedure Node25 -- Dispatch_Table_Wrappers Elist26 -- Last_Assignment Node26 -- 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 --------------------------------------------- -- Usage of Flags in Defining Entity Nodes -- --- 209,238 ---- -- Related_Expression Node24 -- Spec_PPC_List Node24 -- Interface_Alias Node25 -- Interfaces Elist25 -- Debug_Renaming_Link Node25 -- DT_Offset_To_Top_Func Node25 + -- PPC_Wrapper Node25 + -- Static_Predicate List25 -- Task_Body_Procedure Node25 -- Dispatch_Table_Wrappers Elist26 -- Last_Assignment Node26 -- Overridden_Operation Node26 -- Package_Instantiation Node26 -- Relative_Deadline_Variable Node26 -- Static_Initialization Node26 -- Current_Use_Clause Node27 + -- Related_Type Node27 -- Wrapped_Entity Node27 -- Extra_Formals Node28 + -- Underlying_Record_View Node28 + + -- Subprograms_For_Type Node29 --------------------------------------------- -- Usage of Flags in Defining Entity Nodes -- *************** package body Einfo is *** 237,245 **** -- sense for them to be set true for certain subsets of entity kinds. See -- the spec of Einfo for further details. ! -- Note: Flag1-Flag3 are absent from this list, since these flag positions ! -- are used for the flags Analyzed, Comes_From_Source, and Error_Posted, ! -- which are common to all nodes, including entity nodes. -- Is_Frozen Flag4 -- Has_Discriminants Flag5 --- 243,249 ---- -- sense for them to be set true for certain subsets of entity kinds. See -- the spec of Einfo for further details. ! -- Note: Flag1-Flag3 are absent from this list, for historical reasons -- Is_Frozen Flag4 -- Has_Discriminants Flag5 *************** package body Einfo is *** 279,285 **** -- Referenced_As_LHS Flag36 -- Is_Known_Non_Null Flag37 -- Can_Never_Be_Null Flag38 - -- Is_Overriding_Operation Flag39 -- Body_Needed_For_SAL Flag40 -- Treat_As_Volatile Flag41 --- 283,288 ---- *************** package body Einfo is *** 403,409 **** -- Is_Compilation_Unit Flag149 -- Has_Pragma_Elaborate_Body Flag150 - -- Vax_Float Flag151 -- Entry_Accepted Flag152 -- Is_Obsolescent Flag153 -- Has_Per_Object_Constraint Flag154 --- 406,411 ---- *************** package body Einfo is *** 454,463 **** -- Is_Primitive_Wrapper Flag195 -- Was_Hidden Flag196 -- Is_Limited_Interface Flag197 ! -- Is_Protected_Interface Flag198 ! -- Is_Synchronized_Interface Flag199 ! -- Is_Task_Interface Flag200 -- Has_Anon_Block_Suffix Flag201 -- Itype_Printed Flag202 -- Has_Pragma_Pure Flag203 --- 456,465 ---- -- Is_Primitive_Wrapper Flag195 -- Was_Hidden Flag196 -- Is_Limited_Interface Flag197 ! -- Has_Pragma_Ordered Flag198 ! -- Is_Ada_2012_Only Flag199 + -- Has_Delayed_Aspects Flag200 -- Has_Anon_Block_Suffix Flag201 -- Itype_Printed Flag202 -- Has_Pragma_Pure Flag203 *************** package body Einfo is *** 492,498 **** -- Has_Pragma_Inline_Always Flag230 -- Renamed_In_Spec Flag231 ! -- Implemented_By_Entry Flag232 -- Has_Pragma_Unmodified Flag233 -- Is_Dispatch_Table_Entity Flag234 -- Is_Trivial_Subprogram Flag235 --- 494,500 ---- -- Has_Pragma_Inline_Always Flag230 -- Renamed_In_Spec Flag231 ! -- Has_Invariants Flag232 -- Has_Pragma_Unmodified Flag233 -- Is_Dispatch_Table_Entity Flag234 -- Is_Trivial_Subprogram Flag235 *************** package body Einfo is *** 509,514 **** --- 511,526 ---- -- Is_Private_Primitive Flag245 -- Is_Underlying_Record_View Flag246 -- OK_To_Rename Flag247 + -- Has_Inheritable_Invariants Flag248 + -- Has_Predicates Flag250 + + -- (unused) Flag39 + -- (unused) Flag151 + -- (unused) Flag249 + -- (unused) Flag251 + -- (unused) Flag252 + -- (unused) Flag253 + -- (unused) Flag254 ----------------------- -- Local subprograms -- *************** package body Einfo is *** 518,523 **** --- 530,545 ---- -- Returns the attribute definition clause for Id whose name is Rep_Name. -- Returns Empty if no matching attribute definition clause found for Id. + --------------- + -- Float_Rep -- + --------------- + + function Float_Rep (Id : E) return F is + pragma Assert (Is_Floating_Point_Type (Id)); + begin + return F'Val (UI_To_Int (Uint10 (Base_Type (Id)))); + end Float_Rep; + ---------------- -- Rep_Clause -- ---------------- *************** package body Einfo is *** 533,539 **** then return Ritem; else ! Ritem := Next_Rep_Item (Ritem); end if; end loop; --- 555,561 ---- then return Ritem; else ! Next_Rep_Item (Ritem); end if; end loop; *************** package body Einfo is *** 558,566 **** function Actual_Subtype (Id : E) return E is begin pragma Assert ! (Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Variable ! or else Ekind (Id) = E_Generic_In_Out_Parameter or else Is_Formal (Id)); return Node17 (Id); end Actual_Subtype; --- 580,586 ---- function Actual_Subtype (Id : E) return E is begin pragma Assert ! (Ekind_In (Id, E_Constant, E_Variable, E_Generic_In_Out_Parameter) or else Is_Formal (Id)); return Node17 (Id); end Actual_Subtype; *************** package body Einfo is *** 581,590 **** begin pragma Assert (Is_Type (Id) or else Is_Formal (Id) ! or else Ekind (Id) = E_Loop_Parameter ! or else Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Exception ! or else Ekind (Id) = E_Variable); return Uint14 (Id); end Alignment; --- 601,610 ---- begin pragma Assert (Is_Type (Id) or else Is_Formal (Id) ! or else Ekind_In (Id, E_Loop_Parameter, ! E_Constant, ! E_Exception, ! E_Variable)); return Uint14 (Id); end Alignment; *************** package body Einfo is *** 625,632 **** function Body_Entity (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package); return Node19 (Id); end Body_Entity; --- 645,651 ---- function Body_Entity (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); return Node19 (Id); end Body_Entity; *************** package body Einfo is *** 663,686 **** function Cloned_Subtype (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Record_Subtype ! or else ! Ekind (Id) = E_Class_Wide_Subtype); return Node16 (Id); end Cloned_Subtype; function Component_Bit_Offset (Id : E) return U is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); return Uint11 (Id); end Component_Bit_Offset; function Component_Clause (Id : E) return N is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); return Node13 (Id); end Component_Clause; --- 682,700 ---- function Cloned_Subtype (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Class_Wide_Subtype)); return Node16 (Id); end Cloned_Subtype; function Component_Bit_Offset (Id : E) return U is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); return Uint11 (Id); end Component_Bit_Offset; function Component_Clause (Id : E) return N is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); return Node13 (Id); end Component_Clause; *************** package body Einfo is *** 717,722 **** --- 731,742 ---- return Node13 (Id); end Corresponding_Equality; + function Corresponding_Protected_Entry (Id : E) return E is + begin + pragma Assert (Ekind (Id) = E_Subprogram_Body); + return Node18 (Id); + end Corresponding_Protected_Entry; + function Corresponding_Record_Type (Id : E) return E is begin pragma Assert (Is_Concurrent_Type (Id)); *************** package body Einfo is *** 808,813 **** --- 828,839 ---- return Uint17 (Id); end Digits_Value; + function Direct_Primitive_Operations (Id : E) return L is + begin + pragma Assert (Is_Tagged_Type (Id)); + return Elist10 (Id); + end Direct_Primitive_Operations; + function Directly_Designated_Type (Id : E) return E is begin pragma Assert (Is_Access_Type (Id)); *************** package body Einfo is *** 874,890 **** function DT_Position (Id : E) return U is begin ! pragma Assert ! ((Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure) ! and then Present (DTC_Entity (Id))); return Uint15 (Id); end DT_Position; function DTC_Entity (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure); return Node16 (Id); end DTC_Entity; --- 900,913 ---- function DT_Position (Id : E) return U is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure) ! and then Present (DTC_Entity (Id))); return Uint15 (Id); end DT_Position; function DTC_Entity (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); return Node16 (Id); end DTC_Entity; *************** package body Einfo is *** 985,995 **** function Equivalent_Type (Id : E) return E is begin pragma Assert ! (Ekind (Id) = E_Class_Wide_Subtype or else ! Ekind (Id) = E_Access_Protected_Subprogram_Type or else ! Ekind (Id) = E_Anonymous_Access_Protected_Subprogram_Type or else ! Ekind (Id) = E_Access_Subprogram_Type or else ! Ekind (Id) = E_Exception_Type); return Node18 (Id); end Equivalent_Type; --- 1008,1019 ---- function Equivalent_Type (Id : E) return E is begin pragma Assert ! (Ekind_In (Id, E_Class_Wide_Type, ! E_Class_Wide_Subtype, ! E_Access_Protected_Subprogram_Type, ! E_Anonymous_Access_Protected_Subprogram_Type, ! E_Access_Subprogram_Type, ! E_Exception_Type)); return Node18 (Id); end Equivalent_Type; *************** package body Einfo is *** 1025,1033 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Entry_Family ! or else Ekind (Id) = E_Subprogram_Body ! or else Ekind (Id) = E_Subprogram_Type); return Node28 (Id); end Extra_Formals; --- 1049,1057 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Entry_Family, ! E_Subprogram_Body, ! E_Subprogram_Type)); return Node28 (Id); end Extra_Formals; *************** package body Einfo is *** 1053,1058 **** --- 1077,1088 ---- return Node17 (Id); end First_Entity; + function First_Exit_Statement (Id : E) return N is + begin + pragma Assert (Ekind (Id) = E_Loop); + return Node8 (Id); + end First_Exit_Statement; + function First_Index (Id : E) return N is begin pragma Assert (Is_Array_Type (Id) or else Is_String_Type (Id)); *************** package body Einfo is *** 1067,1081 **** function First_Optional_Parameter (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure); return Node14 (Id); end First_Optional_Parameter; function First_Private_Entity (Id : E) return E is begin ! pragma Assert (Ekind (Id) = E_Package ! or else Ekind (Id) = E_Generic_Package or else Ekind (Id) in Concurrent_Kind); return Node16 (Id); end First_Private_Entity; --- 1097,1109 ---- function First_Optional_Parameter (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); return Node14 (Id); end First_Optional_Parameter; function First_Private_Entity (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package) or else Ekind (Id) in Concurrent_Kind); return Node16 (Id); end First_Private_Entity; *************** package body Einfo is *** 1196,1201 **** --- 1224,1235 ---- return Flag119 (Id); end Has_Convention_Pragma; + function Has_Delayed_Aspects (Id : E) return B is + begin + pragma Assert (Nkind (Id) in N_Entity); + return Flag200 (Id); + end Has_Delayed_Aspects; + function Has_Delayed_Freeze (Id : E) return B is begin pragma Assert (Nkind (Id) in N_Entity); *************** package body Einfo is *** 1251,1263 **** return Flag56 (Id); end Has_Homonym; function Has_Initial_Value (Id : E) return B is begin ! pragma Assert ! (Ekind (Id) = E_Variable or else Is_Formal (Id)); return Flag219 (Id); end Has_Initial_Value; function Has_Machine_Radix_Clause (Id : E) return B is begin pragma Assert (Is_Decimal_Fixed_Point_Type (Id)); --- 1285,1308 ---- return Flag56 (Id); end Has_Homonym; + function Has_Inheritable_Invariants (Id : E) return B is + begin + pragma Assert (Is_Type (Id)); + return Flag248 (Id); + end Has_Inheritable_Invariants; + function Has_Initial_Value (Id : E) return B is begin ! pragma Assert (Ekind (Id) = E_Variable or else Is_Formal (Id)); return Flag219 (Id); end Has_Initial_Value; + function Has_Invariants (Id : E) return B is + begin + pragma Assert (Is_Type (Id) or else Ekind (Id) = E_Procedure); + return Flag232 (Id); + end Has_Invariants; + function Has_Machine_Radix_Clause (Id : E) return B is begin pragma Assert (Is_Decimal_Fixed_Point_Type (Id)); *************** package body Einfo is *** 1271,1278 **** function Has_Missing_Return (Id : E) return B is begin ! pragma Assert ! (Ekind (Id) = E_Function or else Ekind (Id) = E_Generic_Function); return Flag142 (Id); end Has_Missing_Return; --- 1316,1322 ---- function Has_Missing_Return (Id : E) return B is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Generic_Function)); return Flag142 (Id); end Has_Missing_Return; *************** package body Einfo is *** 1329,1334 **** --- 1373,1384 ---- return Flag230 (Id); end Has_Pragma_Inline_Always; + function Has_Pragma_Ordered (Id : E) return B is + begin + pragma Assert (Is_Enumeration_Type (Id)); + return Flag198 (Implementation_Base_Type (Id)); + end Has_Pragma_Ordered; + function Has_Pragma_Pack (Id : E) return B is begin pragma Assert (Is_Record_Type (Id) or else Is_Array_Type (Id)); *************** package body Einfo is *** 1371,1376 **** --- 1421,1431 ---- return Flag212 (Id); end Has_Pragma_Unreferenced_Objects; + function Has_Predicates (Id : E) return B is + begin + return Flag250 (Id); + end Has_Predicates; + function Has_Primitive_Operations (Id : E) return B is begin pragma Assert (Is_Type (Id)); *************** package body Einfo is *** 1474,1480 **** function Has_Thunks (Id : E) return B is begin - pragma Assert (Ekind (Id) = E_Constant); return Flag228 (Id); end Has_Thunks; --- 1529,1534 ---- *************** package body Einfo is *** 1492,1500 **** function Has_Up_Level_Access (Id : E) return B is begin pragma Assert ! (Ekind (Id) = E_Variable ! or else Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Loop_Parameter); return Flag215 (Id); end Has_Up_Level_Access; --- 1546,1552 ---- function Has_Up_Level_Access (Id : E) return B is begin pragma Assert ! (Ekind_In (Id, E_Variable, E_Constant, E_Loop_Parameter)); return Flag215 (Id); end Has_Up_Level_Access; *************** package body Einfo is *** 1519,1531 **** return Node4 (Id); end Homonym; ! function Implemented_By_Entry (Id : E) return B is begin ! pragma Assert ! (Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure); ! return Flag232 (Id); ! end Implemented_By_Entry; function Interfaces (Id : E) return L is begin --- 1571,1581 ---- return Node4 (Id); end Homonym; ! function Interface_Alias (Id : E) return E is begin ! pragma Assert (Is_Subprogram (Id)); ! return Node25 (Id); ! end Interface_Alias; function Interfaces (Id : E) return L is begin *************** package body Einfo is *** 1533,1544 **** return Elist25 (Id); end Interfaces; - function Interface_Alias (Id : E) return E is - begin - pragma Assert (Is_Subprogram (Id)); - return Node25 (Id); - end Interface_Alias; - function In_Package_Body (Id : E) return B is begin return Flag48 (Id); --- 1583,1588 ---- *************** package body Einfo is *** 1594,1599 **** --- 1638,1648 ---- return Flag185 (Id); end Is_Ada_2005_Only; + function Is_Ada_2012_Only (Id : E) return B is + begin + return Flag199 (Id); + end Is_Ada_2012_Only; + function Is_Aliased (Id : E) return B is begin pragma Assert (Nkind (Id) in N_Entity); *************** package body Einfo is *** 1608,1615 **** function Is_Asynchronous (Id : E) return B is begin ! pragma Assert ! (Ekind (Id) = E_Procedure or else Is_Type (Id)); return Flag81 (Id); end Is_Asynchronous; --- 1657,1663 ---- function Is_Asynchronous (Id : E) return B is begin ! pragma Assert (Ekind (Id) = E_Procedure or else Is_Type (Id)); return Flag81 (Id); end Is_Asynchronous; *************** package body Einfo is *** 1625,1632 **** function Is_Called (Id : E) return B is begin ! pragma Assert ! (Ekind (Id) = E_Procedure or else Ekind (Id) = E_Function); return Flag102 (Id); end Is_Called; --- 1673,1679 ---- function Is_Called (Id : E) return B is begin ! pragma Assert (Ekind_In (Id, E_Procedure, E_Function)); return Flag102 (Id); end Is_Called; *************** package body Einfo is *** 1737,1746 **** function Is_For_Access_Subtype (Id : E) return B is begin ! pragma Assert ! (Ekind (Id) = E_Record_Subtype ! or else ! Ekind (Id) = E_Private_Subtype); return Flag118 (Id); end Is_For_Access_Subtype; --- 1784,1790 ---- function Is_For_Access_Subtype (Id : E) return B is begin ! pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Private_Subtype)); return Flag118 (Id); end Is_For_Access_Subtype; *************** package body Einfo is *** 1894,1905 **** return Flag134 (Id); end Is_Optional_Parameter; - function Is_Overriding_Operation (Id : E) return B is - begin - pragma Assert (Is_Subprogram (Id)); - return Flag39 (Id); - end Is_Overriding_Operation; - function Is_Package_Body_Entity (Id : E) return B is begin return Flag160 (Id); --- 1938,1943 ---- *************** package body Einfo is *** 1930,1944 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Generic_Function ! or else Ekind (Id) = E_Generic_Procedure); return Flag218 (Id); end Is_Primitive; function Is_Primitive_Wrapper (Id : E) return B is begin ! pragma Assert (Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure); return Flag195 (Id); end Is_Primitive_Wrapper; --- 1968,1980 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Generic_Function, E_Generic_Procedure)); return Flag218 (Id); end Is_Primitive; function Is_Primitive_Wrapper (Id : E) return B is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); return Flag195 (Id); end Is_Primitive_Wrapper; *************** package body Einfo is *** 1955,1971 **** function Is_Private_Primitive (Id : E) return B is begin ! pragma Assert (Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure); return Flag245 (Id); end Is_Private_Primitive; - function Is_Protected_Interface (Id : E) return B is - begin - pragma Assert (Is_Interface (Id)); - return Flag198 (Id); - end Is_Protected_Interface; - function Is_Public (Id : E) return B is begin pragma Assert (Nkind (Id) in N_Entity); --- 1991,2000 ---- function Is_Private_Primitive (Id : E) return B is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); return Flag245 (Id); end Is_Private_Primitive; function Is_Public (Id : E) return B is begin pragma Assert (Nkind (Id) in N_Entity); *************** package body Einfo is *** 2025,2036 **** return Flag28 (Id); end Is_Statically_Allocated; - function Is_Synchronized_Interface (Id : E) return B is - begin - pragma Assert (Is_Interface (Id)); - return Flag199 (Id); - end Is_Synchronized_Interface; - function Is_Tag (Id : E) return B is begin pragma Assert (Nkind (Id) in N_Entity); --- 2054,2059 ---- *************** package body Einfo is *** 2042,2053 **** return Flag55 (Id); end Is_Tagged_Type; - function Is_Task_Interface (Id : E) return B is - begin - pragma Assert (Is_Interface (Id)); - return Flag200 (Id); - end Is_Task_Interface; - function Is_Thunk (Id : E) return B is begin pragma Assert (Is_Subprogram (Id)); --- 2065,2070 ---- *************** package body Einfo is *** 2224,2231 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Subprogram_Type ! or else Ekind (Id) = E_Entry_Family); return Flag22 (Id); end Needs_No_Actuals; --- 2241,2247 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Subprogram_Type, E_Entry_Family)); return Flag22 (Id); end Needs_No_Actuals; *************** package body Einfo is *** 2276,2297 **** function Normalized_First_Bit (Id : E) return U is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); return Uint8 (Id); end Normalized_First_Bit; function Normalized_Position (Id : E) return U is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); return Uint14 (Id); end Normalized_Position; function Normalized_Position_Max (Id : E) return U is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); return Uint10 (Id); end Normalized_Position_Max; --- 2292,2310 ---- function Normalized_First_Bit (Id : E) return U is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); return Uint8 (Id); end Normalized_First_Bit; function Normalized_Position (Id : E) return U is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); return Uint14 (Id); end Normalized_Position; function Normalized_Position_Max (Id : E) return U is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); return Uint10 (Id); end Normalized_Position_Max; *************** package body Einfo is *** 2310,2327 **** 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; --- 2323,2336 ---- function Optimize_Alignment_Space (Id : E) return B is begin pragma Assert ! (Is_Type (Id) or else Ekind_In (Id, E_Constant, 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_In (Id, E_Constant, E_Variable)); return Flag242 (Id); end Optimize_Alignment_Time; *************** package body Einfo is *** 2333,2342 **** function Original_Record_Component (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Void ! or else Ekind (Id) = E_Component ! or else Ekind (Id) = E_Discriminant); return Node22 (Id); end Original_Record_Component; --- 2342,2348 ---- function Original_Record_Component (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Void, E_Component, E_Discriminant)); return Node22 (Id); end Original_Record_Component; *************** package body Einfo is *** 2352,2361 **** function Package_Instantiation (Id : E) return N is begin ! pragma Assert ! (False ! or else Ekind (Id) = E_Generic_Package ! or else Ekind (Id) = E_Package); return Node26 (Id); end Package_Instantiation; --- 2358,2364 ---- function Package_Instantiation (Id : E) return N is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); return Node26 (Id); end Package_Instantiation; *************** package body Einfo is *** 2377,2387 **** return Node8 (Id); end Postcondition_Proc; ! function Primitive_Operations (Id : E) return L is begin ! pragma Assert (Is_Tagged_Type (Id)); ! return Elist15 (Id); ! end Primitive_Operations; function Prival (Id : E) return E is begin --- 2380,2390 ---- return Node8 (Id); end Postcondition_Proc; ! function PPC_Wrapper (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Entry, E_Entry_Family)); ! return Node25 (Id); ! end PPC_Wrapper; function Prival (Id : E) return E is begin *************** package body Einfo is *** 2391,2398 **** function Prival_Link (Id : E) return E is begin ! pragma Assert (Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Variable); return Node20 (Id); end Prival_Link; --- 2394,2400 ---- function Prival_Link (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Constant, E_Variable)); return Node20 (Id); end Prival_Link; *************** package body Einfo is *** 2422,2431 **** function Protection_Object (Id : E) return E is begin ! 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 Protection_Object; --- 2424,2431 ---- function Protection_Object (Id : E) return E is begin ! pragma Assert ! (Ekind_In (Id, E_Entry, E_Entry_Family, E_Function, E_Procedure)); return Node23 (Id); end Protection_Object; *************** package body Einfo is *** 2449,2460 **** return Flag227 (Id); end Referenced_As_Out_Parameter; - function Referenced_Object (Id : E) return N is - begin - pragma Assert (Is_Type (Id)); - return Node10 (Id); - end Referenced_Object; - function Register_Exception_Call (Id : E) return N is begin pragma Assert (Ekind (Id) = E_Exception); --- 2449,2454 ---- *************** package body Einfo is *** 2469,2490 **** function Related_Expression (Id : E) return N is begin ! pragma Assert (Ekind (Id) = E_Constant or else Ekind (Id) = E_Variable); return Node24 (Id); end Related_Expression; function Related_Instance (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Package or else Ekind (Id) = E_Package_Body); return Node15 (Id); end Related_Instance; function Related_Type (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Constant); ! return Node26 (Id); end Related_Type; function Relative_Deadline_Variable (Id : E) return E is --- 2463,2483 ---- function Related_Expression (Id : E) return N is begin ! pragma Assert (Ekind (Id) in Type_Kind ! or else Ekind_In (Id, E_Constant, E_Variable)); return Node24 (Id); end Related_Expression; function Related_Instance (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Package_Body)); return Node15 (Id); end Related_Instance; function Related_Type (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Constant, E_Variable)); ! return Node27 (Id); end Related_Type; function Relative_Deadline_Variable (Id : E) return E is *************** package body Einfo is *** 2569,2576 **** function Shadow_Entities (Id : E) return S is begin ! pragma Assert ! (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package); return List14 (Id); end Shadow_Entities; --- 2562,2568 ---- function Shadow_Entities (Id : E) return S is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); return List14 (Id); end Shadow_Entities; *************** package body Einfo is *** 2582,2588 **** function Size_Check_Code (Id : E) return N is begin ! pragma Assert (Ekind (Id) = E_Constant or else Ekind (Id) = E_Variable); return Node19 (Id); end Size_Check_Code; --- 2574,2580 ---- function Size_Check_Code (Id : E) return N is begin ! pragma Assert (Ekind_In (Id, E_Constant, E_Variable)); return Node19 (Id); end Size_Check_Code; *************** package body Einfo is *** 2604,2620 **** function Spec_Entity (Id : E) return E is begin ! pragma Assert ! (Ekind (Id) = E_Package_Body or else Is_Formal (Id)); return Node19 (Id); end Spec_Entity; function Spec_PPC_List (Id : E) return N is begin ! pragma Assert (Is_Subprogram (Id) or else Is_Generic_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)); --- 2596,2620 ---- function Spec_Entity (Id : E) return E is begin ! pragma Assert (Ekind (Id) = E_Package_Body or else Is_Formal (Id)); return Node19 (Id); end Spec_Entity; function Spec_PPC_List (Id : E) return N is begin ! pragma Assert ! (Ekind_In (Id, E_Entry, E_Entry_Family) ! or else Is_Subprogram (Id) ! or else Is_Generic_Subprogram (Id)); return Node24 (Id); end Spec_PPC_List; + function Static_Predicate (Id : E) return S is + begin + pragma Assert (Is_Discrete_Type (Id)); + return List25 (Id); + end Static_Predicate; + function Storage_Size_Variable (Id : E) return E is begin pragma Assert (Is_Access_Type (Id) or else Is_Task_Type (Id)); *************** package body Einfo is *** 2656,2661 **** --- 2656,2667 ---- return Node15 (Id); end String_Literal_Low_Bound; + function Subprograms_For_Type (Id : E) return E is + begin + pragma Assert (Is_Type (Id) or else Is_Subprogram (Id)); + return Node29 (Id); + end Subprograms_For_Type; + function Suppress_Elaboration_Warnings (Id : E) return B is begin return Flag148 (Id); *************** package body Einfo is *** 2695,2701 **** function Underlying_Record_View (Id : E) return E is begin ! return Node24 (Id); end Underlying_Record_View; function Universal_Aliasing (Id : E) return B is --- 2701,2707 ---- function Underlying_Record_View (Id : E) return E is begin ! return Node28 (Id); end Underlying_Record_View; function Universal_Aliasing (Id : E) return B is *************** package body Einfo is *** 2719,2729 **** return Flag95 (Id); end Uses_Sec_Stack; - function Vax_Float (Id : E) return B is - begin - return Flag151 (Base_Type (Id)); - end Vax_Float; - function Warnings_Off (Id : E) return B is begin return Flag96 (Id); --- 2725,2730 ---- *************** package body Einfo is *** 2746,2754 **** function Wrapped_Entity (Id : E) return E is begin ! pragma Assert ((Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure) ! and then Is_Primitive_Wrapper (Id)); return Node27 (Id); end Wrapped_Entity; --- 2747,2754 ---- function Wrapped_Entity (Id : E) return E is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure) ! and then Is_Primitive_Wrapper (Id)); return Node27 (Id); end Wrapped_Entity; *************** package body Einfo is *** 2776,2781 **** --- 2776,2786 ---- return Ekind (Id) in Access_Subprogram_Kind; end Is_Access_Subprogram_Type; + function Is_Aggregate_Type (Id : E) return B is + begin + return Ekind (Id) in Aggregate_Kind; + end Is_Aggregate_Type; + function Is_Array_Type (Id : E) return B is begin return Ekind (Id) in Array_Kind; *************** package body Einfo is *** 2956,2963 **** function Is_Signed_Integer_Type (Id : E) return B is begin ! return Ekind (Id) in ! Signed_Integer_Kind; end Is_Signed_Integer_Type; function Is_Subprogram (Id : E) return B is --- 2961,2967 ---- function Is_Signed_Integer_Type (Id : E) return B is begin ! return Ekind (Id) in Signed_Integer_Kind; end Is_Signed_Integer_Type; function Is_Subprogram (Id : E) return B is *************** package body Einfo is *** 2979,2984 **** --- 2983,2994 ---- -- Attribute Set Procedures -- ------------------------------ + -- Note: in many of these set procedures an "obvious" assertion is missing. + -- The reason for this is that in many cases, a field is set before the + -- Ekind field is set, so that the field is set when Ekind = E_Void. It + -- it is possible to add assertions that specifically include the E_Void + -- possibility, but in some cases, we just omit the assertions. + procedure Set_Accept_Address (Id : E; V : L) is begin Set_Elist21 (Id, V); *************** package body Einfo is *** 2986,2992 **** procedure Set_Access_Disp_Table (Id : E; V : L) is begin ! pragma Assert (Is_Tagged_Type (Id) and then Id = Base_Type (Id)); Set_Elist16 (Id, V); end Set_Access_Disp_Table; --- 2996,3002 ---- procedure Set_Access_Disp_Table (Id : E; V : L) is begin ! pragma Assert (Is_Tagged_Type (Id) and then Is_Base_Type (Id)); Set_Elist16 (Id, V); end Set_Access_Disp_Table; *************** package body Einfo is *** 3008,3023 **** procedure Set_Associated_Storage_Pool (Id : E; V : E) is begin ! pragma Assert (Is_Access_Type (Id) and then Id = Base_Type (Id)); Set_Node22 (Id, V); end Set_Associated_Storage_Pool; procedure Set_Actual_Subtype (Id : E; V : E) is begin pragma Assert ! (Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Variable ! or else Ekind (Id) = E_Generic_In_Out_Parameter or else Is_Formal (Id)); Set_Node17 (Id, V); end Set_Actual_Subtype; --- 3018,3031 ---- procedure Set_Associated_Storage_Pool (Id : E; V : E) is begin ! pragma Assert (Is_Access_Type (Id) and then Is_Base_Type (Id)); Set_Node22 (Id, V); end Set_Associated_Storage_Pool; procedure Set_Actual_Subtype (Id : E; V : E) is begin pragma Assert ! (Ekind_In (Id, E_Constant, E_Variable, E_Generic_In_Out_Parameter) or else Is_Formal (Id)); Set_Node17 (Id, V); end Set_Actual_Subtype; *************** package body Einfo is *** 3037,3047 **** procedure Set_Alignment (Id : E; V : U) is begin pragma Assert (Is_Type (Id) ! or else Is_Formal (Id) ! or else Ekind (Id) = E_Loop_Parameter ! or else Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Exception ! or else Ekind (Id) = E_Variable); Set_Uint14 (Id, V); end Set_Alignment; --- 3045,3055 ---- procedure Set_Alignment (Id : E; V : U) is begin pragma Assert (Is_Type (Id) ! or else Is_Formal (Id) ! or else Ekind_In (Id, E_Loop_Parameter, ! E_Constant, ! E_Exception, ! E_Variable)); Set_Uint14 (Id, V); end Set_Alignment; *************** package body Einfo is *** 3059,3066 **** procedure Set_Body_Entity (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package); Set_Node19 (Id, V); end Set_Body_Entity; --- 3067,3073 ---- procedure Set_Body_Entity (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); Set_Node19 (Id, V); end Set_Body_Entity; *************** package body Einfo is *** 3068,3081 **** begin pragma Assert (Ekind (Id) = E_Package ! or else Is_Subprogram (Id) ! or else Is_Generic_Unit (Id)); Set_Flag40 (Id, V); end Set_Body_Needed_For_SAL; procedure Set_C_Pass_By_Copy (Id : E; V : B := True) is begin ! pragma Assert (Is_Record_Type (Id) and then Id = Base_Type (Id)); Set_Flag125 (Id, V); end Set_C_Pass_By_Copy; --- 3075,3088 ---- begin pragma Assert (Ekind (Id) = E_Package ! or else Is_Subprogram (Id) ! or else Is_Generic_Unit (Id)); Set_Flag40 (Id, V); end Set_Body_Needed_For_SAL; procedure Set_C_Pass_By_Copy (Id : E; V : B := True) is begin ! pragma Assert (Is_Record_Type (Id) and then Is_Base_Type (Id)); Set_Flag125 (Id, V); end Set_C_Pass_By_Copy; *************** package body Einfo is *** 3097,3131 **** procedure Set_Cloned_Subtype (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Record_Subtype ! or else Ekind (Id) = E_Class_Wide_Subtype); Set_Node16 (Id, V); end Set_Cloned_Subtype; procedure Set_Component_Bit_Offset (Id : E; V : U) is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); Set_Uint11 (Id, V); end Set_Component_Bit_Offset; procedure Set_Component_Clause (Id : E; V : N) is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); Set_Node13 (Id, V); end Set_Component_Clause; procedure Set_Component_Size (Id : E; V : U) is begin ! pragma Assert (Is_Array_Type (Id) and then Id = Base_Type (Id)); Set_Uint22 (Id, V); end Set_Component_Size; procedure Set_Component_Type (Id : E; V : E) is begin ! pragma Assert (Is_Array_Type (Id) and then Id = Base_Type (Id)); Set_Node20 (Id, V); end Set_Component_Type; --- 3104,3134 ---- procedure Set_Cloned_Subtype (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Class_Wide_Subtype)); Set_Node16 (Id, V); end Set_Cloned_Subtype; procedure Set_Component_Bit_Offset (Id : E; V : U) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); Set_Uint11 (Id, V); end Set_Component_Bit_Offset; procedure Set_Component_Clause (Id : E; V : N) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); Set_Node13 (Id, V); end Set_Component_Clause; procedure Set_Component_Size (Id : E; V : U) is begin ! pragma Assert (Is_Array_Type (Id) and then Is_Base_Type (Id)); Set_Uint22 (Id, V); end Set_Component_Size; procedure Set_Component_Type (Id : E; V : E) is begin ! pragma Assert (Is_Array_Type (Id) and then Is_Base_Type (Id)); Set_Node20 (Id, V); end Set_Component_Type; *************** package body Einfo is *** 3151,3156 **** --- 3154,3165 ---- Set_Node13 (Id, V); end Set_Corresponding_Equality; + procedure Set_Corresponding_Protected_Entry (Id : E; V : E) is + begin + pragma Assert (Ekind_In (Id, E_Void, E_Subprogram_Body)); + Set_Node18 (Id, V); + end Set_Corresponding_Protected_Entry; + procedure Set_Corresponding_Record_Type (Id : E; V : E) is begin pragma Assert (Is_Concurrent_Type (Id)); *************** package body Einfo is *** 3218,3226 **** procedure Set_Delay_Subprogram_Descriptors (Id : E; V : B := True) is begin pragma Assert ! (Is_Subprogram (Id) ! or else Ekind (Id) = E_Package ! or else Ekind (Id) = E_Package_Body); Set_Flag50 (Id, V); end Set_Delay_Subprogram_Descriptors; --- 3227,3233 ---- procedure Set_Delay_Subprogram_Descriptors (Id : E; V : B := True) is begin pragma Assert ! (Is_Subprogram (Id) or else Ekind_In (Id, E_Package, E_Package_Body)); Set_Flag50 (Id, V); end Set_Delay_Subprogram_Descriptors; *************** package body Einfo is *** 3295,3301 **** procedure Set_Dispatch_Table_Wrappers (Id : E; V : L) is begin ! pragma Assert (Is_Tagged_Type (Id) and then Id = Base_Type (Id)); Set_Elist26 (Id, V); end Set_Dispatch_Table_Wrappers; --- 3302,3313 ---- procedure Set_Dispatch_Table_Wrappers (Id : E; V : L) is begin ! pragma Assert (Is_Tagged_Type (Id) ! and then Is_Base_Type (Id) ! and then Ekind_In (Id, E_Record_Type, ! E_Record_Subtype, ! E_Record_Type_With_Private, ! E_Record_Subtype_With_Private)); Set_Elist26 (Id, V); end Set_Dispatch_Table_Wrappers; *************** package body Einfo is *** 3313,3326 **** procedure Set_DT_Position (Id : E; V : U) is begin ! pragma Assert (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure); Set_Uint15 (Id, V); end Set_DT_Position; procedure Set_DTC_Entity (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure); Set_Node16 (Id, V); end Set_DTC_Entity; --- 3325,3337 ---- procedure Set_DT_Position (Id : E; V : U) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); Set_Uint15 (Id, V); end Set_DT_Position; procedure Set_DTC_Entity (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); Set_Node16 (Id, V); end Set_DTC_Entity; *************** package body Einfo is *** 3421,3432 **** procedure Set_Equivalent_Type (Id : E; V : E) is begin pragma Assert ! (Ekind (Id) = E_Class_Wide_Type or else ! Ekind (Id) = E_Class_Wide_Subtype or else ! Ekind (Id) = E_Access_Protected_Subprogram_Type or else ! Ekind (Id) = E_Anonymous_Access_Protected_Subprogram_Type or else ! Ekind (Id) = E_Access_Subprogram_Type or else ! Ekind (Id) = E_Exception_Type); Set_Node18 (Id, V); end Set_Equivalent_Type; --- 3432,3443 ---- procedure Set_Equivalent_Type (Id : E; V : E) is begin pragma Assert ! (Ekind_In (Id, E_Class_Wide_Type, ! E_Class_Wide_Subtype, ! E_Access_Protected_Subprogram_Type, ! E_Anonymous_Access_Protected_Subprogram_Type, ! E_Access_Subprogram_Type, ! E_Exception_Type)); Set_Node18 (Id, V); end Set_Equivalent_Type; *************** package body Einfo is *** 3462,3478 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Entry_Family ! or else Ekind (Id) = E_Subprogram_Body ! or else Ekind (Id) = E_Subprogram_Type); Set_Node28 (Id, V); end Set_Extra_Formals; procedure Set_Can_Use_Internal_Rep (Id : E; V : B := True) is begin pragma Assert ! (Is_Access_Subprogram_Type (Id) ! and then Id = Base_Type (Id)); Set_Flag229 (Id, V); end Set_Can_Use_Internal_Rep; --- 3473,3488 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Entry_Family, ! E_Subprogram_Body, ! E_Subprogram_Type)); Set_Node28 (Id, V); end Set_Extra_Formals; procedure Set_Can_Use_Internal_Rep (Id : E; V : B := True) is begin pragma Assert ! (Is_Access_Subprogram_Type (Id) and then Is_Base_Type (Id)); Set_Flag229 (Id, V); end Set_Can_Use_Internal_Rep; *************** package body Einfo is *** 3483,3489 **** procedure Set_Finalize_Storage_Only (Id : E; V : B := True) is begin ! pragma Assert (Is_Type (Id) and then Id = Base_Type (Id)); Set_Flag158 (Id, V); end Set_Finalize_Storage_Only; --- 3493,3499 ---- procedure Set_Finalize_Storage_Only (Id : E; V : B := True) is begin ! pragma Assert (Is_Type (Id) and then Is_Base_Type (Id)); Set_Flag158 (Id, V); end Set_Finalize_Storage_Only; *************** package body Einfo is *** 3492,3497 **** --- 3502,3513 ---- Set_Node17 (Id, V); end Set_First_Entity; + procedure Set_First_Exit_Statement (Id : E; V : N) is + begin + pragma Assert (Ekind (Id) = E_Loop); + Set_Node8 (Id, V); + end Set_First_Exit_Statement; + procedure Set_First_Index (Id : E; V : N) is begin pragma Assert (Is_Array_Type (Id) or else Is_String_Type (Id)); *************** package body Einfo is *** 3506,3521 **** procedure Set_First_Optional_Parameter (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure); Set_Node14 (Id, V); end Set_First_Optional_Parameter; procedure Set_First_Private_Entity (Id : E; V : E) is begin ! pragma Assert (Ekind (Id) = E_Package ! or else Ekind (Id) = E_Generic_Package ! or else Ekind (Id) in Concurrent_Kind); Set_Node16 (Id, V); end Set_First_Private_Entity; --- 3522,3535 ---- procedure Set_First_Optional_Parameter (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); Set_Node14 (Id, V); end Set_First_Optional_Parameter; procedure Set_First_Private_Entity (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package) ! or else Ekind (Id) in Concurrent_Kind); Set_Node16 (Id, V); end Set_First_Private_Entity; *************** package body Einfo is *** 3524,3529 **** --- 3538,3549 ---- Set_Node6 (Id, V); end Set_First_Rep_Item; + procedure Set_Float_Rep (Id : E; V : F) is + pragma Assert (Ekind (Id) = E_Floating_Point_Type); + begin + Set_Uint10 (Id, UI_From_Int (F'Pos (V))); + end Set_Float_Rep; + procedure Set_Freeze_Node (Id : E; V : N) is begin Set_Node7 (Id, V); *************** package body Einfo is *** 3533,3539 **** begin pragma Assert (Is_Type (Id) ! or else Ekind (Id) = E_Package); Set_Flag159 (Id, V); end Set_From_With_Type; --- 3553,3559 ---- begin pragma Assert (Is_Type (Id) ! or else Ekind (Id) = E_Package); Set_Flag159 (Id, V); end Set_From_With_Type; *************** package body Einfo is *** 3581,3587 **** procedure Set_Has_Atomic_Components (Id : E; V : B := True) is begin ! pragma Assert (not Is_Type (Id) or else Id = Base_Type (Id)); Set_Flag86 (Id, V); end Set_Has_Atomic_Components; --- 3601,3607 ---- procedure Set_Has_Atomic_Components (Id : E; V : B := True) is begin ! pragma Assert (not Is_Type (Id) or else Is_Base_Type (Id)); Set_Flag86 (Id, V); end Set_Has_Atomic_Components; *************** package body Einfo is *** 3642,3647 **** --- 3662,3673 ---- Set_Flag119 (Id, V); end Set_Has_Convention_Pragma; + procedure Set_Has_Delayed_Aspects (Id : E; V : B := True) is + begin + pragma Assert (Nkind (Id) in N_Entity); + Set_Flag200 (Id, V); + end Set_Has_Delayed_Aspects; + procedure Set_Has_Delayed_Freeze (Id : E; V : B := True) is begin pragma Assert (Nkind (Id) in N_Entity); *************** package body Einfo is *** 3698,3710 **** Set_Flag56 (Id, V); end Set_Has_Homonym; procedure Set_Has_Initial_Value (Id : E; V : B := True) is begin ! pragma Assert ! (Ekind (Id) = E_Variable or else Ekind (Id) = E_Out_Parameter); Set_Flag219 (Id, V); end Set_Has_Initial_Value; procedure Set_Has_Machine_Radix_Clause (Id : E; V : B := True) is begin pragma Assert (Is_Decimal_Fixed_Point_Type (Id)); --- 3724,3749 ---- Set_Flag56 (Id, V); end Set_Has_Homonym; + procedure Set_Has_Inheritable_Invariants (Id : E; V : B := True) is + begin + pragma Assert (Is_Type (Id)); + Set_Flag248 (Id, V); + end Set_Has_Inheritable_Invariants; + procedure Set_Has_Initial_Value (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Variable, E_Out_Parameter)); Set_Flag219 (Id, V); end Set_Has_Initial_Value; + procedure Set_Has_Invariants (Id : E; V : B := True) is + begin + pragma Assert (Is_Type (Id) + or else Ekind (Id) = E_Procedure + or else Ekind (Id) = E_Void); + Set_Flag232 (Id, V); + end Set_Has_Invariants; + procedure Set_Has_Machine_Radix_Clause (Id : E; V : B := True) is begin pragma Assert (Is_Decimal_Fixed_Point_Type (Id)); *************** package body Einfo is *** 3718,3725 **** procedure Set_Has_Missing_Return (Id : E; V : B := True) is begin ! pragma Assert ! (Ekind (Id) = E_Function or else Ekind (Id) = E_Generic_Function); Set_Flag142 (Id, V); end Set_Has_Missing_Return; --- 3757,3763 ---- procedure Set_Has_Missing_Return (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Generic_Function)); Set_Flag142 (Id, V); end Set_Has_Missing_Return; *************** package body Einfo is *** 3730,3739 **** procedure Set_Has_Up_Level_Access (Id : E; V : B := True) is begin ! pragma Assert ! (Ekind (Id) = E_Variable ! or else Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Loop_Parameter); Set_Flag215 (Id, V); end Set_Has_Up_Level_Access; --- 3768,3774 ---- procedure Set_Has_Up_Level_Access (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Variable, E_Constant, E_Loop_Parameter)); Set_Flag215 (Id, V); end Set_Has_Up_Level_Access; *************** package body Einfo is *** 3786,3791 **** --- 3821,3833 ---- Set_Flag230 (Id, V); end Set_Has_Pragma_Inline_Always; + procedure Set_Has_Pragma_Ordered (Id : E; V : B := True) is + begin + pragma Assert (Is_Enumeration_Type (Id)); + pragma Assert (Id = Base_Type (Id)); + Set_Flag198 (Id, V); + end Set_Has_Pragma_Ordered; + procedure Set_Has_Pragma_Pack (Id : E; V : B := True) is begin pragma Assert (Is_Array_Type (Id) or else Is_Record_Type (Id)); *************** package body Einfo is *** 3829,3834 **** --- 3871,3881 ---- Set_Flag212 (Id, V); end Set_Has_Pragma_Unreferenced_Objects; + procedure Set_Has_Predicates (Id : E; V : B := True) is + begin + Set_Flag250 (Id, V); + end Set_Has_Predicates; + procedure Set_Has_Primitive_Operations (Id : E; V : B := True) is begin pragma Assert (Id = Base_Type (Id)); *************** package body Einfo is *** 3934,3941 **** procedure Set_Has_Thunks (Id : E; V : B := True) is begin ! pragma Assert (Is_Tag (Id) ! and then Ekind (Id) = E_Constant); Set_Flag228 (Id, V); end Set_Has_Thunks; --- 3981,3987 ---- procedure Set_Has_Thunks (Id : E; V : B := True) is begin ! pragma Assert (Is_Tag (Id)); Set_Flag228 (Id, V); end Set_Has_Thunks; *************** package body Einfo is *** 3953,3959 **** procedure Set_Has_Volatile_Components (Id : E; V : B := True) is begin ! pragma Assert (not Is_Type (Id) or else Id = Base_Type (Id)); Set_Flag87 (Id, V); end Set_Has_Volatile_Components; --- 3999,4005 ---- procedure Set_Has_Volatile_Components (Id : E; V : B := True) is begin ! pragma Assert (not Is_Type (Id) or else Is_Base_Type (Id)); Set_Flag87 (Id, V); end Set_Has_Volatile_Components; *************** package body Einfo is *** 3974,3986 **** Set_Node4 (Id, V); end Set_Homonym; ! procedure Set_Implemented_By_Entry (Id : E; V : B := True) is begin pragma Assert ! (Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure); ! Set_Flag232 (Id, V); ! end Set_Implemented_By_Entry; procedure Set_Interfaces (Id : E; V : L) is begin --- 4020,4033 ---- Set_Node4 (Id, V); end Set_Homonym; ! procedure Set_Interface_Alias (Id : E; V : E) is begin pragma Assert ! (Is_Internal (Id) ! and then Is_Hidden (Id) ! and then (Ekind_In (Id, E_Procedure, E_Function))); ! Set_Node25 (Id, V); ! end Set_Interface_Alias; procedure Set_Interfaces (Id : E; V : L) is begin *************** package body Einfo is *** 3988,4003 **** Set_Elist25 (Id, V); end Set_Interfaces; - procedure Set_Interface_Alias (Id : E; V : E) is - begin - pragma Assert - (Is_Internal (Id) - and then Is_Hidden (Id) - and then (Ekind (Id) = E_Procedure - or else Ekind (Id) = E_Function)); - Set_Node25 (Id, V); - end Set_Interface_Alias; - procedure Set_In_Package_Body (Id : E; V : B := True) is begin Set_Flag48 (Id, V); --- 4035,4040 ---- *************** package body Einfo is *** 4053,4058 **** --- 4090,4100 ---- Set_Flag185 (Id, V); end Set_Is_Ada_2005_Only; + procedure Set_Is_Ada_2012_Only (Id : E; V : B := True) is + begin + Set_Flag199 (Id, V); + end Set_Is_Ada_2012_Only; + procedure Set_Is_Aliased (Id : E; V : B := True) is begin pragma Assert (Nkind (Id) in N_Entity); *************** package body Einfo is *** 4080,4094 **** procedure Set_Is_Bit_Packed_Array (Id : E; V : B := True) is begin pragma Assert ((not V) ! or else (Is_Array_Type (Id) and then Id = Base_Type (Id))); Set_Flag122 (Id, V); end Set_Is_Bit_Packed_Array; procedure Set_Is_Called (Id : E; V : B := True) is begin ! pragma Assert ! (Ekind (Id) = E_Procedure or else Ekind (Id) = E_Function); Set_Flag102 (Id, V); end Set_Is_Called; --- 4122,4135 ---- procedure Set_Is_Bit_Packed_Array (Id : E; V : B := True) is begin pragma Assert ((not V) ! or else (Is_Array_Type (Id) and then Is_Base_Type (Id))); Set_Flag122 (Id, V); end Set_Is_Bit_Packed_Array; procedure Set_Is_Called (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Procedure, E_Function)); Set_Flag102 (Id, V); end Set_Is_Called; *************** package body Einfo is *** 4211,4220 **** procedure Set_Is_For_Access_Subtype (Id : E; V : B := True) is begin ! pragma Assert ! (Ekind (Id) = E_Record_Subtype ! or else ! Ekind (Id) = E_Private_Subtype); Set_Flag118 (Id, V); end Set_Is_For_Access_Subtype; --- 4252,4258 ---- procedure Set_Is_For_Access_Subtype (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Record_Subtype, E_Private_Subtype)); Set_Flag118 (Id, V); end Set_Is_For_Access_Subtype; *************** package body Einfo is *** 4275,4286 **** procedure Set_Is_Interface (Id : E; V : B := True) is begin pragma Assert ! (Ekind (Id) = E_Record_Type ! or else Ekind (Id) = E_Record_Subtype ! or else Ekind (Id) = E_Record_Type_With_Private ! or else Ekind (Id) = E_Record_Subtype_With_Private ! or else Ekind (Id) = E_Class_Wide_Type ! or else Ekind (Id) = E_Class_Wide_Subtype); Set_Flag186 (Id, V); end Set_Is_Interface; --- 4313,4324 ---- procedure Set_Is_Interface (Id : E; V : B := True) is begin pragma Assert ! (Ekind_In (Id, E_Record_Type, ! E_Record_Subtype, ! E_Record_Type_With_Private, ! E_Record_Subtype_With_Private, ! E_Class_Wide_Type, ! E_Class_Wide_Subtype)); Set_Flag186 (Id, V); end Set_Is_Interface; *************** package body Einfo is *** 4378,4389 **** Set_Flag134 (Id, V); end Set_Is_Optional_Parameter; - procedure Set_Is_Overriding_Operation (Id : E; V : B := True) is - begin - pragma Assert (Is_Subprogram (Id)); - Set_Flag39 (Id, V); - end Set_Is_Overriding_Operation; - procedure Set_Is_Package_Body_Entity (Id : E; V : B := True) is begin Set_Flag160 (Id, V); --- 4416,4421 ---- *************** package body Einfo is *** 4415,4429 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Generic_Function ! or else Ekind (Id) = E_Generic_Procedure); Set_Flag218 (Id, V); end Set_Is_Primitive; procedure Set_Is_Primitive_Wrapper (Id : E; V : B := True) is begin ! pragma Assert (Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure); Set_Flag195 (Id, V); end Set_Is_Primitive_Wrapper; --- 4447,4459 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Generic_Function, E_Generic_Procedure)); Set_Flag218 (Id, V); end Set_Is_Primitive; procedure Set_Is_Primitive_Wrapper (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); Set_Flag195 (Id, V); end Set_Is_Primitive_Wrapper; *************** package body Einfo is *** 4440,4456 **** procedure Set_Is_Private_Primitive (Id : E; V : B := True) is begin ! pragma Assert (Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure); Set_Flag245 (Id, V); end Set_Is_Private_Primitive; - procedure Set_Is_Protected_Interface (Id : E; V : B := True) is - begin - pragma Assert (Is_Interface (Id)); - Set_Flag198 (Id, V); - end Set_Is_Protected_Interface; - procedure Set_Is_Public (Id : E; V : B := True) is begin pragma Assert (Nkind (Id) in N_Entity); --- 4470,4479 ---- procedure Set_Is_Private_Primitive (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure)); Set_Flag245 (Id, V); end Set_Is_Private_Primitive; procedure Set_Is_Public (Id : E; V : B := True) is begin pragma Assert (Nkind (Id) in N_Entity); *************** package body Einfo is *** 4508,4532 **** procedure Set_Is_Statically_Allocated (Id : E; V : B := True) is begin pragma Assert ! (Ekind (Id) = E_Exception ! or else Ekind (Id) = E_Variable ! or else Ekind (Id) = E_Constant ! or else Is_Type (Id) ! or else Ekind (Id) = E_Void); Set_Flag28 (Id, V); end Set_Is_Statically_Allocated; - procedure Set_Is_Synchronized_Interface (Id : E; V : B := True) is - begin - pragma Assert (Is_Interface (Id)); - Set_Flag199 (Id, V); - end Set_Is_Synchronized_Interface; - procedure Set_Is_Tag (Id : E; V : B := True) is begin ! pragma Assert ! (Ekind (Id) = E_Component ! or else Ekind (Id) = E_Constant); Set_Flag78 (Id, V); end Set_Is_Tag; --- 4531,4547 ---- procedure Set_Is_Statically_Allocated (Id : E; V : B := True) is begin pragma Assert ! (Is_Type (Id) ! or else Ekind_In (Id, E_Exception, ! E_Variable, ! E_Constant, ! E_Void)); Set_Flag28 (Id, V); end Set_Is_Statically_Allocated; procedure Set_Is_Tag (Id : E; V : B := True) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Constant, E_Variable)); Set_Flag78 (Id, V); end Set_Is_Tag; *************** package body Einfo is *** 4535,4546 **** Set_Flag55 (Id, V); end Set_Is_Tagged_Type; - procedure Set_Is_Task_Interface (Id : E; V : B := True) is - begin - pragma Assert (Is_Interface (Id)); - Set_Flag200 (Id, V); - end Set_Is_Task_Interface; - procedure Set_Is_Thunk (Id : E; V : B := True) is begin Set_Flag225 (Id, V); --- 4550,4555 ---- *************** package body Einfo is *** 4715,4722 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Subprogram_Type ! or else Ekind (Id) = E_Entry_Family); Set_Flag22 (Id, V); end Set_Needs_No_Actuals; --- 4724,4730 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Subprogram_Type, E_Entry_Family)); Set_Flag22 (Id, V); end Set_Needs_No_Actuals; *************** package body Einfo is *** 4732,4759 **** procedure Set_No_Pool_Assigned (Id : E; V : B := True) is begin ! pragma Assert (Is_Access_Type (Id) and then Id = Base_Type (Id)); Set_Flag131 (Id, V); end Set_No_Pool_Assigned; procedure Set_No_Return (Id : E; V : B := True) is begin pragma Assert ! (V = False ! or else Ekind (Id) = E_Procedure ! or else Ekind (Id) = E_Generic_Procedure); Set_Flag113 (Id, V); end Set_No_Return; procedure Set_No_Strict_Aliasing (Id : E; V : B := True) is begin ! pragma Assert (Is_Access_Type (Id) and then Id = Base_Type (Id)); Set_Flag136 (Id, V); end Set_No_Strict_Aliasing; procedure Set_Non_Binary_Modulus (Id : E; V : B := True) is begin ! pragma Assert (Is_Type (Id) and then Id = Base_Type (Id)); Set_Flag58 (Id, V); end Set_Non_Binary_Modulus; --- 4740,4765 ---- procedure Set_No_Pool_Assigned (Id : E; V : B := True) is begin ! pragma Assert (Is_Access_Type (Id) and then Is_Base_Type (Id)); Set_Flag131 (Id, V); end Set_No_Pool_Assigned; procedure Set_No_Return (Id : E; V : B := True) is begin pragma Assert ! (V = False or else Ekind_In (Id, E_Procedure, E_Generic_Procedure)); Set_Flag113 (Id, V); end Set_No_Return; procedure Set_No_Strict_Aliasing (Id : E; V : B := True) is begin ! pragma Assert (Is_Access_Type (Id) and then Is_Base_Type (Id)); Set_Flag136 (Id, V); end Set_No_Strict_Aliasing; procedure Set_Non_Binary_Modulus (Id : E; V : B := True) is begin ! pragma Assert (Is_Type (Id) and then Is_Base_Type (Id)); Set_Flag58 (Id, V); end Set_Non_Binary_Modulus; *************** package body Einfo is *** 4773,4794 **** procedure Set_Normalized_First_Bit (Id : E; V : U) is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); Set_Uint8 (Id, V); end Set_Normalized_First_Bit; procedure Set_Normalized_Position (Id : E; V : U) is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); Set_Uint14 (Id, V); end Set_Normalized_Position; procedure Set_Normalized_Position_Max (Id : E; V : U) is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Discriminant); Set_Uint10 (Id, V); end Set_Normalized_Position_Max; --- 4779,4797 ---- procedure Set_Normalized_First_Bit (Id : E; V : U) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); Set_Uint8 (Id, V); end Set_Normalized_First_Bit; procedure Set_Normalized_Position (Id : E; V : U) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); Set_Uint14 (Id, V); end Set_Normalized_Position; procedure Set_Normalized_Position_Max (Id : E; V : U) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Discriminant)); Set_Uint10 (Id, V); end Set_Normalized_Position_Max; *************** package body Einfo is *** 4801,4825 **** procedure Set_OK_To_Reorder_Components (Id : E; V : B := True) is begin pragma Assert ! (Is_Record_Type (Id) and then Id = Base_Type (Id)); 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; --- 4804,4824 ---- procedure Set_OK_To_Reorder_Components (Id : E; V : B := True) is begin pragma Assert ! (Is_Record_Type (Id) and then Is_Base_Type (Id)); 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_In (Id, E_Constant, 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_In (Id, E_Constant, E_Variable)); Set_Flag242 (Id, V); end Set_Optimize_Alignment_Time; *************** package body Einfo is *** 4831,4840 **** procedure Set_Original_Record_Component (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Void ! or else Ekind (Id) = E_Component ! or else Ekind (Id) = E_Discriminant); Set_Node22 (Id, V); end Set_Original_Record_Component; --- 4830,4836 ---- procedure Set_Original_Record_Component (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Void, E_Component, E_Discriminant)); Set_Node22 (Id, V); end Set_Original_Record_Component; *************** package body Einfo is *** 4850,4859 **** procedure Set_Package_Instantiation (Id : E; V : N) is begin ! pragma Assert ! (Ekind (Id) = E_Void ! or else Ekind (Id) = E_Generic_Package ! or else Ekind (Id) = E_Package); Set_Node26 (Id, V); end Set_Package_Instantiation; --- 4846,4852 ---- procedure Set_Package_Instantiation (Id : E; V : N) is begin ! pragma Assert (Ekind_In (Id, E_Void, E_Generic_Package, E_Package)); Set_Node26 (Id, V); end Set_Package_Instantiation; *************** package body Einfo is *** 4875,4885 **** Set_Node8 (Id, V); end Set_Postcondition_Proc; ! procedure Set_Primitive_Operations (Id : E; V : L) is begin pragma Assert (Is_Tagged_Type (Id)); ! Set_Elist15 (Id, V); ! end Set_Primitive_Operations; procedure Set_Prival (Id : E; V : E) is begin --- 4868,4884 ---- Set_Node8 (Id, V); end Set_Postcondition_Proc; ! procedure Set_PPC_Wrapper (Id : E; V : E) is ! begin ! pragma Assert (Ekind_In (Id, E_Entry, E_Entry_Family)); ! Set_Node25 (Id, V); ! end Set_PPC_Wrapper; ! ! procedure Set_Direct_Primitive_Operations (Id : E; V : L) is begin pragma Assert (Is_Tagged_Type (Id)); ! Set_Elist10 (Id, V); ! end Set_Direct_Primitive_Operations; procedure Set_Prival (Id : E; V : E) is begin *************** package body Einfo is *** 4889,4896 **** procedure Set_Prival_Link (Id : E; V : E) is begin ! pragma Assert (Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Variable); Set_Node20 (Id, V); end Set_Prival_Link; --- 4888,4894 ---- procedure Set_Prival_Link (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Constant, E_Variable)); Set_Node20 (Id, V); end Set_Prival_Link; *************** package body Einfo is *** 4920,4929 **** procedure Set_Protection_Object (Id : E; V : E) is begin ! 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_Protection_Object; --- 4918,4927 ---- procedure Set_Protection_Object (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Entry, ! E_Entry_Family, ! E_Function, ! E_Procedure)); Set_Node23 (Id, V); end Set_Protection_Object; *************** package body Einfo is *** 4947,4958 **** Set_Flag227 (Id, V); end Set_Referenced_As_Out_Parameter; - procedure Set_Referenced_Object (Id : E; V : N) is - begin - pragma Assert (Is_Type (Id)); - Set_Node10 (Id, V); - end Set_Referenced_Object; - procedure Set_Register_Exception_Call (Id : E; V : N) is begin pragma Assert (Ekind (Id) = E_Exception); --- 4945,4950 ---- *************** package body Einfo is *** 4967,4992 **** procedure Set_Related_Expression (Id : E; V : N) is begin Set_Node24 (Id, V); end Set_Related_Expression; procedure Set_Related_Instance (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Package or else Ekind (Id) = E_Package_Body); Set_Node15 (Id, V); end Set_Related_Instance; procedure Set_Related_Type (Id : E; V : E) is begin ! pragma Assert ! (Ekind (Id) = E_Component or else Ekind (Id) = E_Constant); ! 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; --- 4959,4984 ---- procedure Set_Related_Expression (Id : E; V : N) is begin + pragma Assert (Ekind (Id) in Type_Kind + or else Ekind_In (Id, E_Constant, E_Variable, E_Void)); Set_Node24 (Id, V); end Set_Related_Expression; procedure Set_Related_Instance (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Package_Body)); Set_Node15 (Id, V); end Set_Related_Instance; procedure Set_Related_Type (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Component, E_Constant, E_Variable)); ! Set_Node27 (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 Is_Base_Type (Id)); Set_Node26 (Id, V); end Set_Relative_Deadline_Variable; *************** package body Einfo is *** 5035,5041 **** procedure Set_Reverse_Bit_Order (Id : E; V : B := True) is begin pragma Assert ! (Is_Record_Type (Id) and then Id = Base_Type (Id)); Set_Flag164 (Id, V); end Set_Reverse_Bit_Order; --- 5027,5033 ---- procedure Set_Reverse_Bit_Order (Id : E; V : B := True) is begin pragma Assert ! (Is_Record_Type (Id) and then Is_Base_Type (Id)); Set_Flag164 (Id, V); end Set_Reverse_Bit_Order; *************** package body Einfo is *** 5068,5075 **** procedure Set_Shadow_Entities (Id : E; V : S) is begin ! pragma Assert ! (Ekind (Id) = E_Package or else Ekind (Id) = E_Generic_Package); Set_List14 (Id, V); end Set_Shadow_Entities; --- 5060,5066 ---- procedure Set_Shadow_Entities (Id : E; V : S) is begin ! pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); Set_List14 (Id, V); end Set_Shadow_Entities; *************** package body Einfo is *** 5081,5087 **** procedure Set_Size_Check_Code (Id : E; V : N) is begin ! pragma Assert (Ekind (Id) = E_Constant or else Ekind (Id) = E_Variable); Set_Node19 (Id, V); end Set_Size_Check_Code; --- 5072,5078 ---- procedure Set_Size_Check_Code (Id : E; V : N) is begin ! pragma Assert (Ekind_In (Id, E_Constant, E_Variable)); Set_Node19 (Id, V); end Set_Size_Check_Code; *************** package body Einfo is *** 5109,5118 **** procedure Set_Spec_PPC_List (Id : E; V : N) is begin ! pragma Assert (Is_Subprogram (Id) or else Is_Generic_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)); --- 5100,5122 ---- procedure Set_Spec_PPC_List (Id : E; V : N) is begin ! pragma Assert ! (Ekind_In (Id, E_Entry, E_Entry_Family, E_Void) ! or else Is_Subprogram (Id) ! or else Is_Generic_Subprogram (Id)); Set_Node24 (Id, V); end Set_Spec_PPC_List; + procedure Set_Static_Predicate (Id : E; V : S) is + begin + pragma Assert + (Ekind_In (Id, E_Enumeration_Subtype, + E_Modular_Integer_Subtype, + E_Signed_Integer_Subtype) + and then Has_Predicates (Id)); + Set_List25 (Id, V); + end Set_Static_Predicate; + procedure Set_Storage_Size_Variable (Id : E; V : E) is begin pragma Assert (Is_Access_Type (Id) or else Is_Task_Type (Id)); *************** package body Einfo is *** 5157,5162 **** --- 5161,5172 ---- Set_Node15 (Id, V); end Set_String_Literal_Low_Bound; + procedure Set_Subprograms_For_Type (Id : E; V : E) is + begin + pragma Assert (Is_Type (Id) or else Is_Subprogram (Id)); + Set_Node29 (Id, V); + end Set_Subprograms_For_Type; + procedure Set_Suppress_Elaboration_Warnings (Id : E; V : B := True) is begin Set_Flag148 (Id, V); *************** package body Einfo is *** 5198,5209 **** procedure Set_Underlying_Record_View (Id : E; V : E) is begin pragma Assert (Ekind (Id) = E_Record_Type); ! Set_Node24 (Id, V); end Set_Underlying_Record_View; procedure Set_Universal_Aliasing (Id : E; V : B := True) is begin ! pragma Assert (Is_Type (Id) and then Id = Base_Type (Id)); Set_Flag216 (Id, V); end Set_Universal_Aliasing; --- 5208,5219 ---- procedure Set_Underlying_Record_View (Id : E; V : E) is begin pragma Assert (Ekind (Id) = E_Record_Type); ! Set_Node28 (Id, V); end Set_Underlying_Record_View; procedure Set_Universal_Aliasing (Id : E; V : B := True) is begin ! pragma Assert (Is_Type (Id) and then Is_Base_Type (Id)); Set_Flag216 (Id, V); end Set_Universal_Aliasing; *************** package body Einfo is *** 5222,5233 **** Set_Flag222 (Id, V); end Set_Used_As_Generic_Actual; - procedure Set_Vax_Float (Id : E; V : B := True) is - begin - pragma Assert (Id = Base_Type (Id)); - Set_Flag151 (Id, V); - end Set_Vax_Float; - procedure Set_Warnings_Off (Id : E; V : B := True) is begin Set_Flag96 (Id, V); --- 5232,5237 ---- *************** package body Einfo is *** 5255,5263 **** procedure Set_Wrapped_Entity (Id : E; V : E) is begin ! pragma Assert ((Ekind (Id) = E_Function ! or else Ekind (Id) = E_Procedure) ! and then Is_Primitive_Wrapper (Id)); Set_Node27 (Id, V); end Set_Wrapped_Entity; --- 5259,5266 ---- procedure Set_Wrapped_Entity (Id : E; V : E) is begin ! pragma Assert (Ekind_In (Id, E_Function, E_Procedure) ! and then Is_Primitive_Wrapper (Id)); Set_Node27 (Id, V); end Set_Wrapped_Entity; *************** package body Einfo is *** 5452,5458 **** function Known_Static_Esize (E : Entity_Id) return B is begin ! return Uint12 (E) > Uint_0; end Known_Static_Esize; function Known_Static_Normalized_First_Bit (E : Entity_Id) return B is --- 5455,5462 ---- function Known_Static_Esize (E : Entity_Id) return B is begin ! return Uint12 (E) > Uint_0 ! and then not Is_Generic_Type (E); end Known_Static_Esize; function Known_Static_Normalized_First_Bit (E : Entity_Id) return B is *************** package body Einfo is *** 5475,5483 **** function Known_Static_RM_Size (E : Entity_Id) return B is begin ! return Uint13 (E) > Uint_0 ! or else Is_Discrete_Type (E) ! or else Is_Fixed_Point_Type (E); end Known_Static_RM_Size; function Unknown_Alignment (E : Entity_Id) return B is --- 5479,5488 ---- function Known_Static_RM_Size (E : Entity_Id) return B is begin ! return (Uint13 (E) > Uint_0 ! or else Is_Discrete_Type (E) ! or else Is_Fixed_Point_Type (E)) ! and then not Is_Generic_Type (E); end Known_Static_RM_Size; function Unknown_Alignment (E : Entity_Id) return B is *************** package body Einfo is *** 5537,5542 **** --- 5542,5563 ---- return Rep_Clause (Id, Name_Address); end Address_Clause; + --------------- + -- Aft_Value -- + --------------- + + function Aft_Value (Id : E) return U is + Result : Nat := 1; + Delta_Val : Ureal := Delta_Value (Id); + begin + while Delta_Val < Ureal_Tenth loop + Delta_Val := Delta_Val * Ureal_10; + Result := Result + 1; + end loop; + + return UI_From_Int (Result); + end Aft_Value; + ---------------------- -- Alignment_Clause -- ---------------------- *************** package body Einfo is *** 5752,5760 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Entry_Family ! or else Ekind (Id) = E_Subprogram_Body ! or else Ekind (Id) = E_Subprogram_Type); if Ekind (Id) = E_Enumeration_Literal then return Empty; --- 5773,5781 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Entry_Family, ! E_Subprogram_Body, ! E_Subprogram_Type)); if Ekind (Id) = E_Enumeration_Literal then return Empty; *************** package body Einfo is *** 5780,5788 **** begin pragma Assert (Is_Overloadable (Id) ! or else Ekind (Id) = E_Entry_Family ! or else Ekind (Id) = E_Subprogram_Body ! or else Ekind (Id) = E_Subprogram_Type); if Ekind (Id) = E_Enumeration_Literal then return Empty; --- 5801,5809 ---- begin pragma Assert (Is_Overloadable (Id) ! or else Ekind_In (Id, E_Entry_Family, ! E_Subprogram_Body, ! E_Subprogram_Type)); if Ekind (Id) = E_Enumeration_Literal then return Empty; *************** package body Einfo is *** 5829,5837 **** function Get_Full_View (T : Entity_Id) return Entity_Id is begin ! if Ekind (T) = E_Incomplete_Type ! and then Present (Full_View (T)) ! then return Full_View (T); elsif Is_Class_Wide_Type (T) --- 5850,5856 ---- function Get_Full_View (T : Entity_Id) return Entity_Id is begin ! if Ekind (T) = E_Incomplete_Type and then Present (Full_View (T)) then return Full_View (T); elsif Is_Class_Wide_Type (T) *************** package body Einfo is *** 5845,5850 **** --- 5864,5929 ---- end if; end Get_Full_View; + -------------------------------------- + -- Get_Record_Representation_Clause -- + -------------------------------------- + + function Get_Record_Representation_Clause (E : Entity_Id) return Node_Id is + N : Node_Id; + + begin + N := First_Rep_Item (E); + while Present (N) loop + if Nkind (N) = N_Record_Representation_Clause then + return N; + end if; + + Next_Rep_Item (N); + end loop; + + return Empty; + end Get_Record_Representation_Clause; + + ----------------------------- + -- Get_Rep_Item_For_Entity -- + ----------------------------- + + function Get_Rep_Item_For_Entity + (E : Entity_Id; + Nam : Name_Id) return Node_Id + is + N : Node_Id; + Arg : Node_Id; + + begin + N := First_Rep_Item (E); + while Present (N) loop + if Nkind (N) = N_Pragma and then Pragma_Name (N) = Nam then + Arg := Get_Pragma_Arg (First (Pragma_Argument_Associations (N))); + + if Is_Entity_Name (Arg) and then Entity (Arg) = E then + return N; + end if; + + elsif Nkind (N) = N_Attribute_Definition_Clause + and then Chars (N) = Nam + and then Entity (N) = E + then + return N; + + elsif Nkind (N) = N_Aspect_Specification + and then Chars (Identifier (N)) = Nam + and then Entity (N) = E + then + return N; + end if; + + Next_Rep_Item (N); + end loop; + + return Empty; + end Get_Rep_Item_For_Entity; + -------------------- -- Get_Rep_Pragma -- -------------------- *************** package body Einfo is *** 5882,5888 **** then return True; else ! Ritem := Next_Rep_Item (Ritem); end if; end loop; --- 5961,5967 ---- then return True; else ! Next_Rep_Item (Ritem); end if; end loop; *************** package body Einfo is *** 5929,5935 **** function Has_Foreign_Convention (Id : E) return B is begin ! return Convention (Id) in Foreign_Convention; end Has_Foreign_Convention; --------------------------- --- 6008,6020 ---- function Has_Foreign_Convention (Id : E) return B is begin ! -- While regular Intrinsics such as the Standard operators fit in the ! -- "Ada" convention, those with an Interface_Name materialize GCC ! -- builtin imports for which Ada special treatments shouldn't apply. ! ! return Convention (Id) in Foreign_Convention ! or else (Convention (Id) = Convention_Intrinsic ! and then Present (Interface_Name (Id))); end Has_Foreign_Convention; --------------------------- *************** package body Einfo is *** 5949,5955 **** then return True; else ! Ritem := Next_Rep_Item (Ritem); end if; end loop; --- 6034,6040 ---- then return True; else ! Next_Rep_Item (Ritem); end if; end loop; *************** package body Einfo is *** 6059,6064 **** --- 6144,6185 ---- end if; end Implementation_Base_Type; + ------------------------- + -- Invariant_Procedure -- + ------------------------- + + function Invariant_Procedure (Id : E) return E is + S : Entity_Id; + + begin + pragma Assert (Is_Type (Id) and then Has_Invariants (Id)); + + if No (Subprograms_For_Type (Id)) then + return Empty; + + else + S := Subprograms_For_Type (Id); + while Present (S) loop + if Has_Invariants (S) then + return S; + else + S := Subprograms_For_Type (S); + end if; + end loop; + + return Empty; + end if; + end Invariant_Procedure; + + ------------------ + -- Is_Base_Type -- + ------------------ + + function Is_Base_Type (Id : E) return Boolean is + begin + return Id = Base_Type (Id); + end Is_Base_Type; + --------------------- -- Is_Boolean_Type -- --------------------- *************** package body Einfo is *** 6085,6094 **** 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; ---------------------- --- 6206,6213 ---- function Is_Discriminal (Id : E) return B is begin ! return (Ekind_In (Id, E_Constant, E_In_Parameter) ! and then Present (Discriminal_Link (Id))); end Is_Discriminal; ---------------------- *************** package body Einfo is *** 6108,6113 **** --- 6227,6236 ---- or else Ekind (Id) = E_Task_Type or else + (Ekind (Id) = E_Limited_Private_Type + and then Present (Full_View (Id)) + and then Ekind (Full_View (Id)) = E_Task_Type) + or else Ekind (Id) = E_Entry or else Ekind (Id) = E_Entry_Family *************** package body Einfo is *** 6150,6165 **** Ekind (Id) = E_Generic_Package; end Is_Package_Or_Generic_Package; --------------- -- Is_Prival -- --------------- function Is_Prival (Id : E) return B is begin ! return ! (Ekind (Id) = E_Constant ! or else Ekind (Id) = E_Variable) ! and then Present (Prival_Link (Id)); end Is_Prival; ---------------------------- --- 6273,6313 ---- Ekind (Id) = E_Generic_Package; end Is_Package_Or_Generic_Package; + ------------------------ + -- Predicate_Function -- + ------------------------ + + function Predicate_Function (Id : E) return E is + S : Entity_Id; + + begin + pragma Assert (Is_Type (Id)); + + if No (Subprograms_For_Type (Id)) then + return Empty; + + else + S := Subprograms_For_Type (Id); + while Present (S) loop + if Has_Predicates (S) then + return S; + else + S := Subprograms_For_Type (S); + end if; + end loop; + + return Empty; + end if; + end Predicate_Function; + --------------- -- Is_Prival -- --------------- function Is_Prival (Id : E) return B is begin ! return (Ekind_In (Id, E_Constant, E_Variable) ! and then Present (Prival_Link (Id))); end Is_Prival; ---------------------------- *************** package body Einfo is *** 6172,6177 **** --- 6320,6341 ---- and then Is_Protected_Type (Scope (Id)); end Is_Protected_Component; + ---------------------------- + -- Is_Protected_Interface -- + ---------------------------- + + function Is_Protected_Interface (Id : E) return B is + Typ : constant Entity_Id := Base_Type (Id); + begin + if not Is_Interface (Typ) then + return False; + elsif Is_Class_Wide_Type (Typ) then + return Is_Protected_Interface (Etype (Typ)); + else + return Protected_Present (Type_Definition (Parent (Typ))); + end if; + end Is_Protected_Interface; + ------------------------------ -- Is_Protected_Record_Type -- ------------------------------ *************** package body Einfo is *** 6214,6223 **** begin return Ekind (Id) in String_Kind or else (Is_Array_Type (Id) ! and then Number_Dimensions (Id) = 1 ! and then Is_Character_Type (Component_Type (Id))); end Is_String_Type; ------------------------- -- Is_Task_Record_Type -- ------------------------- --- 6378,6425 ---- begin return Ekind (Id) in String_Kind or else (Is_Array_Type (Id) ! and then Id /= Any_Composite ! and then Number_Dimensions (Id) = 1 ! and then Is_Character_Type (Component_Type (Id))); end Is_String_Type; + ------------------------------- + -- Is_Synchronized_Interface -- + ------------------------------- + + function Is_Synchronized_Interface (Id : E) return B is + Typ : constant Entity_Id := Base_Type (Id); + + begin + if not Is_Interface (Typ) then + return False; + + elsif Is_Class_Wide_Type (Typ) then + return Is_Synchronized_Interface (Etype (Typ)); + + else + return Protected_Present (Type_Definition (Parent (Typ))) + or else Synchronized_Present (Type_Definition (Parent (Typ))) + or else Task_Present (Type_Definition (Parent (Typ))); + end if; + end Is_Synchronized_Interface; + + ----------------------- + -- Is_Task_Interface -- + ----------------------- + + function Is_Task_Interface (Id : E) return B is + Typ : constant Entity_Id := Base_Type (Id); + begin + if not Is_Interface (Typ) then + return False; + elsif Is_Class_Wide_Type (Typ) then + return Is_Task_Interface (Etype (Typ)); + else + return Task_Present (Type_Definition (Parent (Typ))); + end if; + end Is_Task_Interface; + ------------------------- -- Is_Task_Record_Type -- ------------------------- *************** package body Einfo is *** 6236,6244 **** function Is_Wrapper_Package (Id : E) return B is begin return (Ekind (Id) = E_Package ! and then Present (Related_Instance (Id))); end Is_Wrapper_Package; -------------------- -- Next_Component -- -------------------- --- 6438,6598 ---- function Is_Wrapper_Package (Id : E) return B is begin return (Ekind (Id) = E_Package ! and then Present (Related_Instance (Id))); end Is_Wrapper_Package; + ----------------- + -- Last_Formal -- + ----------------- + + function Last_Formal (Id : E) return E is + Formal : E; + + begin + pragma Assert + (Is_Overloadable (Id) + or else Ekind_In (Id, E_Entry_Family, + E_Subprogram_Body, + E_Subprogram_Type)); + + if Ekind (Id) = E_Enumeration_Literal then + return Empty; + + else + Formal := First_Formal (Id); + + if Present (Formal) then + while Present (Next_Formal (Formal)) loop + Formal := Next_Formal (Formal); + end loop; + end if; + + return Formal; + end if; + end Last_Formal; + + function Model_Emin_Value (Id : E) return Uint is + begin + return Machine_Emin_Value (Id); + end Model_Emin_Value; + + ------------------------- + -- Model_Epsilon_Value -- + ------------------------- + + function Model_Epsilon_Value (Id : E) return Ureal is + Radix : constant Ureal := UR_From_Uint (Machine_Radix_Value (Id)); + begin + return Radix ** (1 - Model_Mantissa_Value (Id)); + end Model_Epsilon_Value; + + -------------------------- + -- Model_Mantissa_Value -- + -------------------------- + + function Model_Mantissa_Value (Id : E) return Uint is + begin + return Machine_Mantissa_Value (Id); + end Model_Mantissa_Value; + + ----------------------- + -- Model_Small_Value -- + ----------------------- + + function Model_Small_Value (Id : E) return Ureal is + Radix : constant Ureal := UR_From_Uint (Machine_Radix_Value (Id)); + begin + return Radix ** (Model_Emin_Value (Id) - 1); + end Model_Small_Value; + + ------------------------ + -- Machine_Emax_Value -- + ------------------------ + + function Machine_Emax_Value (Id : E) return Uint is + Digs : constant Pos := UI_To_Int (Digits_Value (Base_Type (Id))); + + begin + case Float_Rep (Id) is + when IEEE_Binary => + case Digs is + when 1 .. 6 => return Uint_128; + when 7 .. 15 => return 2**10; + when 16 .. 18 => return 2**14; + when others => return No_Uint; + end case; + + when VAX_Native => + case Digs is + when 1 .. 9 => return 2**7 - 1; + when 10 .. 15 => return 2**10 - 1; + when others => return No_Uint; + end case; + + when AAMP => + return Uint_2 ** Uint_7 - Uint_1; + end case; + end Machine_Emax_Value; + + ------------------------ + -- Machine_Emin_Value -- + ------------------------ + + function Machine_Emin_Value (Id : E) return Uint is + begin + case Float_Rep (Id) is + when IEEE_Binary => return Uint_3 - Machine_Emax_Value (Id); + when VAX_Native => return -Machine_Emax_Value (Id); + when AAMP => return -Machine_Emax_Value (Id); + end case; + end Machine_Emin_Value; + + ---------------------------- + -- Machine_Mantissa_Value -- + ---------------------------- + + function Machine_Mantissa_Value (Id : E) return Uint is + Digs : constant Pos := UI_To_Int (Digits_Value (Base_Type (Id))); + + begin + case Float_Rep (Id) is + when IEEE_Binary => + case Digs is + when 1 .. 6 => return Uint_24; + when 7 .. 15 => return UI_From_Int (53); + when 16 .. 18 => return Uint_64; + when others => return No_Uint; + end case; + + when VAX_Native => + case Digs is + when 1 .. 6 => return Uint_24; + when 7 .. 9 => return UI_From_Int (56); + when 10 .. 15 => return UI_From_Int (53); + when others => return No_Uint; + end case; + + when AAMP => + case Digs is + when 1 .. 6 => return Uint_24; + when 7 .. 9 => return UI_From_Int (40); + when others => return No_Uint; + end case; + end case; + end Machine_Mantissa_Value; + + ------------------------- + -- Machine_Radix_Value -- + ------------------------- + + function Machine_Radix_Value (Id : E) return U is + begin + case Float_Rep (Id) is + when IEEE_Binary | VAX_Native | AAMP => + return Uint_2; + end case; + end Machine_Radix_Value; + -------------------- -- Next_Component -- -------------------- *************** package body Einfo is *** 6266,6274 **** begin Comp_Id := Next_Entity (Id); while Present (Comp_Id) loop ! exit when Ekind (Comp_Id) = E_Component ! or else ! Ekind (Comp_Id) = E_Discriminant; Comp_Id := Next_Entity (Comp_Id); end loop; --- 6620,6626 ---- begin Comp_Id := Next_Entity (Id); while Present (Comp_Id) loop ! exit when Ekind_In (Comp_Id, E_Component, E_Discriminant); Comp_Id := Next_Entity (Comp_Id); end loop; *************** package body Einfo is *** 6305,6311 **** D := Next_Entity (D); if No (D) or else (Ekind (D) /= E_Discriminant ! and then not Is_Itype (D)) then return Empty; end if; --- 6657,6663 ---- D := Next_Entity (D); if No (D) or else (Ekind (D) /= E_Discriminant ! and then not Is_Itype (D)) then return Empty; end if; *************** package body Einfo is *** 6331,6337 **** -- of analyzing default expressions. P := Id; - loop P := Next_Entity (P); --- 6683,6688 ---- *************** package body Einfo is *** 6462,6467 **** --- 6813,6836 ---- return Ekind (Id); end Parameter_Mode; + -------------------------- + -- Primitive_Operations -- + -------------------------- + + function Primitive_Operations (Id : E) return L is + begin + if Is_Concurrent_Type (Id) then + if Present (Corresponding_Record_Type (Id)) then + return Direct_Primitive_Operations + (Corresponding_Record_Type (Id)); + else + return No_Elist; + end if; + else + return Direct_Primitive_Operations (Id); + end if; + end Primitive_Operations; + --------------------- -- Record_Rep_Item -- --------------------- *************** package body Einfo is *** 6530,6535 **** --- 6899,6950 ---- end if; end Root_Type; + --------------------- + -- Safe_Emax_Value -- + --------------------- + + function Safe_Emax_Value (Id : E) return Uint is + begin + return Machine_Emax_Value (Id); + end Safe_Emax_Value; + + ---------------------- + -- Safe_First_Value -- + ---------------------- + + function Safe_First_Value (Id : E) return Ureal is + begin + return -Safe_Last_Value (Id); + end Safe_First_Value; + + --------------------- + -- Safe_Last_Value -- + --------------------- + + function Safe_Last_Value (Id : E) return Ureal is + Radix : constant Uint := Machine_Radix_Value (Id); + Mantissa : constant Uint := Machine_Mantissa_Value (Id); + Emax : constant Uint := Safe_Emax_Value (Id); + Significand : constant Uint := Radix ** Mantissa - 1; + Exponent : constant Uint := Emax - Mantissa; + + begin + if Radix = 2 then + return + UR_From_Components + (Num => Significand * 2 ** (Exponent mod 4), + Den => -Exponent / 4, + Rbase => 16); + + else + return + UR_From_Components + (Num => Significand, + Den => -Exponent, + Rbase => 16); + end if; + end Safe_Last_Value; + ----------------- -- Scope_Depth -- ----------------- *************** package body Einfo is *** 6575,6581 **** procedure Set_Component_Alignment (Id : E; V : C) is begin pragma Assert ((Is_Array_Type (Id) or else Is_Record_Type (Id)) ! and then Id = Base_Type (Id)); case V is when Calign_Default => --- 6990,6996 ---- procedure Set_Component_Alignment (Id : E; V : C) is begin pragma Assert ((Is_Array_Type (Id) or else Is_Record_Type (Id)) ! and then Is_Base_Type (Id)); case V is when Calign_Default => *************** package body Einfo is *** 6596,6601 **** --- 7011,7064 ---- end case; end Set_Component_Alignment; + ----------------------------- + -- Set_Invariant_Procedure -- + ----------------------------- + + procedure Set_Invariant_Procedure (Id : E; V : E) is + S : Entity_Id; + + begin + pragma Assert (Is_Type (Id) and then Has_Invariants (Id)); + + S := Subprograms_For_Type (Id); + Set_Subprograms_For_Type (Id, V); + + while Present (S) loop + if Has_Invariants (S) then + raise Program_Error; + else + S := Subprograms_For_Type (S); + end if; + end loop; + + Set_Subprograms_For_Type (Id, V); + end Set_Invariant_Procedure; + + ---------------------------- + -- Set_Predicate_Function -- + ---------------------------- + + procedure Set_Predicate_Function (Id : E; V : E) is + S : Entity_Id; + + begin + pragma Assert (Is_Type (Id) and then Has_Predicates (Id)); + + S := Subprograms_For_Type (Id); + Set_Subprograms_For_Type (Id, V); + + while Present (S) loop + if Has_Predicates (S) then + raise Program_Error; + else + S := Subprograms_For_Type (S); + end if; + end loop; + + Set_Subprograms_For_Type (Id, V); + end Set_Predicate_Function; + ----------------- -- Size_Clause -- ----------------- *************** package body Einfo is *** 6778,6783 **** --- 7241,7255 ---- end if; end Underlying_Type; + --------------- + -- Vax_Float -- + --------------- + + function Vax_Float (Id : E) return B is + begin + return Is_Floating_Point_Type (Id) and then Float_Rep (Id) = VAX_Native; + end Vax_Float; + ------------------------ -- Write_Entity_Flags -- ------------------------ *************** package body Einfo is *** 6805,6811 **** begin if (Is_Array_Type (Id) or else Is_Record_Type (Id)) ! and then Id = Base_Type (Id) then Write_Str (Prefix); Write_Str ("Component_Alignment = "); --- 7277,7283 ---- begin if (Is_Array_Type (Id) or else Is_Record_Type (Id)) ! and then Is_Base_Type (Id) then Write_Str (Prefix); Write_Str ("Component_Alignment = "); *************** package body Einfo is *** 6858,6863 **** --- 7330,7336 ---- W ("Has_Controlled_Component", Flag43 (Id)); W ("Has_Controlling_Result", Flag98 (Id)); W ("Has_Convention_Pragma", Flag119 (Id)); + W ("Has_Delayed_Aspects", Flag200 (Id)); W ("Has_Delayed_Freeze", Flag18 (Id)); W ("Has_Discriminants", Flag5 (Id)); W ("Has_Enumeration_Rep_Clause", Flag66 (Id)); *************** package body Einfo is *** 6867,6873 **** --- 7340,7348 ---- W ("Has_Fully_Qualified_Name", Flag173 (Id)); W ("Has_Gigi_Rep_Item", Flag82 (Id)); W ("Has_Homonym", Flag56 (Id)); + W ("Has_Inheritable_Invariants", Flag248 (Id)); W ("Has_Initial_Value", Flag219 (Id)); + W ("Has_Invariants", Flag232 (Id)); W ("Has_Machine_Radix_Clause", Flag83 (Id)); W ("Has_Master_Entity", Flag21 (Id)); W ("Has_Missing_Return", Flag142 (Id)); *************** package body Einfo is *** 6881,6886 **** --- 7356,7362 ---- W ("Has_Pragma_Elaborate_Body", Flag150 (Id)); W ("Has_Pragma_Inline", Flag157 (Id)); W ("Has_Pragma_Inline_Always", Flag230 (Id)); + W ("Has_Pragma_Ordered", Flag198 (Id)); W ("Has_Pragma_Pack", Flag121 (Id)); W ("Has_Pragma_Preelab_Init", Flag221 (Id)); W ("Has_Pragma_Pure", Flag203 (Id)); *************** package body Einfo is *** 6889,6894 **** --- 7365,7371 ---- W ("Has_Pragma_Unmodified", Flag233 (Id)); W ("Has_Pragma_Unreferenced", Flag180 (Id)); W ("Has_Pragma_Unreferenced_Objects", Flag212 (Id)); + W ("Has_Predicates", Flag250 (Id)); W ("Has_Primitive_Operations", Flag120 (Id)); W ("Has_Private_Declaration", Flag155 (Id)); W ("Has_Qualified_Name", Flag161 (Id)); *************** package body Einfo is *** 6913,6919 **** W ("Has_Up_Level_Access", Flag215 (Id)); W ("Has_Volatile_Components", Flag87 (Id)); W ("Has_Xref_Entry", Flag182 (Id)); - W ("Implemented_By_Entry", Flag232 (Id)); W ("In_Package_Body", Flag48 (Id)); W ("In_Private_Part", Flag45 (Id)); W ("In_Use", Flag8 (Id)); --- 7390,7395 ---- *************** package body Einfo is *** 6923,6928 **** --- 7399,7405 ---- W ("Is_Local_Anonymous_Access", Flag194 (Id)); W ("Is_Access_Constant", Flag69 (Id)); W ("Is_Ada_2005_Only", Flag185 (Id)); + W ("Is_Ada_2012_Only", Flag199 (Id)); W ("Is_Aliased", Flag15 (Id)); W ("Is_Asynchronous", Flag81 (Id)); W ("Is_Atomic", Flag85 (Id)); *************** package body Einfo is *** 6978,6984 **** W ("Is_Obsolescent", Flag153 (Id)); W ("Is_Only_Out_Parameter", Flag226 (Id)); W ("Is_Optional_Parameter", Flag134 (Id)); - W ("Is_Overriding_Operation", Flag39 (Id)); W ("Is_Package_Body_Entity", Flag160 (Id)); W ("Is_Packed", Flag51 (Id)); W ("Is_Packed_Array_Type", Flag138 (Id)); --- 7455,7460 ---- *************** package body Einfo is *** 6989,6995 **** W ("Is_Private_Composite", Flag107 (Id)); W ("Is_Private_Descendant", Flag53 (Id)); W ("Is_Private_Primitive", Flag245 (Id)); - W ("Is_Protected_Interface", Flag198 (Id)); W ("Is_Public", Flag10 (Id)); W ("Is_Pure", Flag44 (Id)); W ("Is_Pure_Unit_Access_Type", Flag189 (Id)); --- 7465,7470 ---- *************** package body Einfo is *** 7000,7010 **** W ("Is_Renaming_Of_Object", Flag112 (Id)); W ("Is_Return_Object", Flag209 (Id)); W ("Is_Shared_Passive", Flag60 (Id)); - W ("Is_Synchronized_Interface", Flag199 (Id)); W ("Is_Statically_Allocated", Flag28 (Id)); W ("Is_Tag", Flag78 (Id)); W ("Is_Tagged_Type", Flag55 (Id)); - W ("Is_Task_Interface", Flag200 (Id)); W ("Is_Thunk", Flag225 (Id)); W ("Is_Trivial_Subprogram", Flag235 (Id)); W ("Is_True_Constant", Flag163 (Id)); --- 7475,7483 ---- *************** package body Einfo is *** 7061,7067 **** W ("Universal_Aliasing", Flag216 (Id)); W ("Used_As_Generic_Actual", Flag222 (Id)); W ("Uses_Sec_Stack", Flag95 (Id)); - W ("Vax_Float", Flag151 (Id)); W ("Warnings_Off", Flag96 (Id)); W ("Warnings_Off_Used", Flag236 (Id)); W ("Warnings_Off_Used_Unmodified", Flag237 (Id)); --- 7534,7539 ---- *************** package body Einfo is *** 7156,7162 **** (" Component Type ", Component_Type (Id)); Write_Eol; Write_Str (Prefix); ! Write_Str (" Indices "); Index := First_Index (Id); while Present (Index) loop --- 7628,7634 ---- (" Component Type ", Component_Type (Id)); Write_Eol; Write_Str (Prefix); ! Write_Str (" Indexes "); Index := First_Index (Id); while Present (Index) loop *************** package body Einfo is *** 7236,7241 **** --- 7708,7716 ---- when Type_Kind => Write_Str ("Associated_Node_For_Itype"); + when E_Loop => + Write_Str ("First_Exit_Statement"); + when E_Package => Write_Str ("Dependent_Instances"); *************** package body Einfo is *** 7286,7293 **** procedure Write_Field10_Name (Id : Entity_Id) is begin case Ekind (Id) is ! when Type_Kind => ! Write_Str ("Referenced_Object"); when E_In_Parameter | E_Constant => --- 7761,7776 ---- procedure Write_Field10_Name (Id : Entity_Id) is begin case Ekind (Id) is ! when Class_Wide_Kind | ! Incomplete_Kind | ! E_Record_Type | ! E_Record_Subtype | ! Private_Kind | ! Concurrent_Kind => ! Write_Str ("Direct_Primitive_Operations"); ! ! when Float_Kind => ! Write_Str ("Float_Rep"); when E_In_Parameter | E_Constant => *************** package body Einfo is *** 7470,7481 **** Task_Kind => Write_Str ("Storage_Size_Variable"); - when Class_Wide_Kind | - E_Record_Type | - E_Record_Subtype | - Private_Kind => - Write_Str ("Primitive_Operations"); - when E_Component => Write_Str ("DT_Entry_Count"); --- 7953,7958 ---- *************** package body Einfo is *** 7640,7645 **** --- 8117,8125 ---- when E_Record_Type => Write_Str ("Corresponding_Concurrent_Type"); + when E_Subprogram_Body => + Write_Str ("Corresponding_Protected_Entry"); + when E_Entry_Index_Parameter => Write_Str ("Entry_Index_Constant"); *************** package body Einfo is *** 7663,7669 **** E_Generic_Package => Write_Str ("Renamed_Entity"); ! when Incomplete_Or_Private_Kind => Write_Str ("Private_Dependents"); when Concurrent_Kind => --- 8143,8150 ---- E_Generic_Package => Write_Str ("Renamed_Entity"); ! when Incomplete_Or_Private_Kind | ! E_Record_Subtype => Write_Str ("Private_Dependents"); when Concurrent_Kind => *************** package body Einfo is *** 7770,7776 **** E_Return_Statement | E_Subprogram_Body | E_Subprogram_Type => - Write_Str ("Last_Entity"); when Scalar_Kind => --- 8251,8256 ---- *************** package body Einfo is *** 7960,7973 **** when Subprogram_Kind => Write_Str ("Spec_PPC_List"); ! when E_Record_Type => ! Write_Str ("Underlying record view"); ! ! when E_Variable | E_Constant => ! Write_Str ("Related expression"); when others => ! Write_Str ("???"); end case; end Write_Field24_Name; --- 8440,8450 ---- when Subprogram_Kind => Write_Str ("Spec_PPC_List"); ! when E_Variable | E_Constant | Type_Kind => ! Write_Str ("Related_Expression"); when others => ! Write_Str ("Field24???"); end case; end Write_Field24_Name; *************** package body Einfo is *** 7997,8002 **** --- 8474,8488 ---- when E_Variable => Write_Str ("Debug_Renaming_Link"); + when E_Entry | + E_Entry_Family => + Write_Str ("PPC_Wrapper"); + + when E_Enumeration_Subtype | + E_Modular_Integer_Subtype | + E_Signed_Integer_Subtype => + Write_Str ("Static_Predicate"); + when others => Write_Str ("Field25??"); end case; *************** package body Einfo is *** 8009,8025 **** procedure Write_Field26_Name (Id : Entity_Id) is begin case Ekind (Id) is - when E_Component | - E_Constant => - Write_Str ("Related_Type"); - when E_Generic_Package | E_Package => Write_Str ("Package_Instantiation"); when E_Procedure | E_Function => - if Is_Dispatching_Operation (Id) then Write_Str ("Overridden_Operation"); else --- 8495,8506 ---- *************** package body Einfo is *** 8050,8055 **** --- 8531,8541 ---- procedure Write_Field27_Name (Id : Entity_Id) is begin case Ekind (Id) is + when E_Component | + E_Constant | + E_Variable => + Write_Str ("Related_Type"); + when E_Procedure => Write_Str ("Wrapped_Entity"); *************** package body Einfo is *** 8071,8081 **** --- 8557,8581 ---- when E_Procedure | E_Function | E_Entry => Write_Str ("Extra_Formals"); + when E_Record_Type => + Write_Str ("Underlying_Record_View"); + when others => Write_Str ("Field28??"); end case; end Write_Field28_Name; + procedure Write_Field29_Name (Id : Entity_Id) is + begin + case Ekind (Id) is + when Type_Kind => + Write_Str ("Subprograms_For_Type"); + + when others => + Write_Str ("Field29??"); + end case; + end Write_Field29_Name; + ------------------------- -- Iterator Procedures -- ------------------------- *************** package body Einfo is *** 8089,8097 **** begin N := Next_Entity (N); while Present (N) loop ! exit when Ekind (N) = E_Component ! or else ! Ekind (N) = E_Discriminant; N := Next_Entity (N); end loop; end Proc_Next_Component_Or_Discriminant; --- 8589,8595 ---- begin N := Next_Entity (N); while Present (N) loop ! exit when Ekind_In (N, E_Component, E_Discriminant); N := Next_Entity (N); end loop; end Proc_Next_Component_Or_Discriminant; diff -Nrcpad gcc-4.5.2/gcc/ada/einfo.ads gcc-4.6.0/gcc/ada/einfo.ads *** gcc-4.5.2/gcc/ada/einfo.ads Tue Dec 1 09:52:51 2009 --- gcc-4.6.0/gcc/ada/einfo.ads Mon Dec 20 07:26:57 2010 *************** *** 6,13 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,13 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Einfo is *** 250,255 **** --- 250,289 ---- -- reference GCC expressions for the case of non-static sizes, as explained -- in Repinfo. + -------------------------------------- + -- Delayed Freezing and Elaboration -- + -------------------------------------- + + -- The flag Has_Delayed_Freeze indicates that an entity carries an explicit + -- freeze node, which appears later in the expanded tree. + + -- a) The flag is used by the front-end to trigger expansion actions which + -- include the generation of that freeze node. Typically this happens at the + -- end of the current compilation unit, or before the first subprogram body is + -- encountered in the current unit. See files freeze and exp_ch13 for details + -- on the actions triggered by a freeze node, which include the construction + -- of initialization procedures and dispatch tables. + + -- b) The presence of a freeze node on an entity is used by the backend to + -- defer elaboration of the entity until its freeze node is seen. In the + -- absence of an explicit freeze node, an entity is frozen (and elaborated) + -- at the point of declaration. + + -- For object declarations, the flag is set when an address clause for the + -- object is encountered. Legality checks on the address expression only take + -- place at the freeze point of the object. + + -- Most types have an explicit freeze node, because they cannot be elaborated + -- until all representation and operational items that apply to them have been + -- analyzed. Private types and incomplete types have the flag set as well, as + -- do task and protected types. + + -- Implicit base types created for type derivations, as well as classwide + -- types created for all tagged types, have the flag set. + + -- If a subprogram has an access parameter whose designated type is incomplete + -- the subprogram has the flag set. + ----------------------- -- Entity Attributes -- ----------------------- *************** package Einfo is *** 303,308 **** --- 337,356 ---- -- on the list. A stack is required to handle the case of nested select -- statements referencing the same entry. + -- Access_Disp_Table (Elist16) [implementation base type only] + -- Present in record type entities. For a tagged type, points to the + -- dispatch tables associated with the tagged type. The first two + -- entities correspond with the primary dispatch table: 1) primary + -- dispatch table with user-defined primitives, 2) primary dispatch table + -- with predefined primitives. For each interface type covered by the + -- tagged type we also have: 3) secondary dispatch table with thunks of + -- primitives covering user-defined interface primitives, 4) secondary + -- dispatch table with thunks of predefined primitives, 5) secondary + -- dispatch table with user-defined primitives, and 6) secondary dispatch + -- table with predefined primitives. The last entity of this list is an + -- access type declaration used to expand dispatching calls through the + -- primary dispatch table. For a non-tagged record, contains Empty. + -- Actual_Subtype (Node17) -- Present in variables, constants, and formal parameters. This is the -- subtype imposed by the value of the object, as opposed to its nominal *************** package Einfo is *** 321,340 **** -- rather irregular, and the semantic checks that depend on the nominal -- subtype being unconstrained use flag Is_Constr_Subt_For_U_Nominal(qv). - -- Access_Disp_Table (Elist16) [implementation base type only] - -- Present in record type entities. For a tagged type, points to the - -- dispatch tables associated with the tagged type. The first two - -- entities correspond with the primary dispatch table: 1) primary - -- dispatch table with user-defined primitives, 2) primary dispatch table - -- with predefined primitives. For each interface type covered by the - -- tagged type we also have: 3) secondary dispatch table with thunks of - -- primitives covering user-defined interface primitives, 4) secondary - -- dispatch table with thunks of predefined primitives, 5) secondary - -- dispatch table with user-defined primitives, and 6) secondary dispatch - -- table with predefined primitives. The last entity of this list is an - -- access type declaration used to expand dispatching calls through the - -- primary dispatch table. For a non-tagged record, contains Empty. - -- Address_Clause (synthesized) -- Applies to entries, objects and subprograms. Set if an address clause -- is present which references the object or subprogram and points to --- 369,374 ---- *************** package Einfo is *** 350,355 **** --- 384,393 ---- -- make sure that the address can be meaningfully taken, and also in -- the case of subprograms to control output of certain warnings. + -- Aft_Value (synthesized) + -- Applies to fixed and decimal types. Computes a universal integer + -- that holds value of the Aft attribute for the type. + -- Alias (Node18) -- Present in overloaded entities (literals, subprograms, entries) and -- subprograms that cover a primitive operation of an abstract interface *************** package Einfo is *** 466,472 **** -- which can never have a null value. This is set True for constant -- access values initialized to a non-null value. This is also True for -- all access parameters in Ada 83 and Ada 95 modes, and for access ! -- parameters that explicily exlude null in Ada 2005. -- -- This is used to avoid unnecessary resetting of the Is_Known_Non_Null -- flag for such entities. In Ada 2005 mode, this is also used when --- 504,510 ---- -- which can never have a null value. This is set True for constant -- access values initialized to a non-null value. This is also True for -- all access parameters in Ada 83 and Ada 95 modes, and for access ! -- parameters that explicitly exclude null in Ada 2005. -- -- This is used to avoid unnecessary resetting of the Is_Known_Non_Null -- flag for such entities. In Ada 2005 mode, this is also used when *************** package Einfo is *** 593,598 **** --- 631,640 ---- -- other function entities, only in implicit inequality routines, -- where Comes_From_Source is always False. + -- Corresponding_Protected_Entry (Node18) + -- Present in subprogram bodies. Set for subprogram bodies that implement + -- a protected type entry to point to the entity for the entry. + -- Corresponding_Record_Type (Node18) -- Present in protected and task types and subtypes. References the -- entity for the corresponding record type constructed by the expander *************** package Einfo is *** 600,606 **** -- Corresponding_Remote_Type (Node22) -- Present in record types that describe the fat pointer structure for ! -- Remote_Access_To_Subrogram types. References the original access type. -- CR_Discriminant (Node23) -- Present in discriminants of concurrent types. Denotes the homologous --- 642,649 ---- -- Corresponding_Remote_Type (Node22) -- Present in record types that describe the fat pointer structure for ! -- Remote_Access_To_Subprogram types. References the original access ! -- type. -- CR_Discriminant (Node23) -- Present in discriminants of concurrent types. Denotes the homologous *************** package Einfo is *** 650,662 **** -- details of the use of this field. -- Declaration_Node (synthesized) ! -- Applies to all entities. Returns the tree node for the declaration ! -- that declared the entity. Normally this is just the Parent of the ! -- entity. One exception arises with child units, where the parent of ! -- the entity is a selected component or a defining program unit name. ! -- Another exception is that if the entity is an incomplete type that ! -- has been completed, then we obtain the declaration node denoted by ! -- the full type, i.e. the full type declaration node. -- Default_Expr_Function (Node21) -- Present in parameters. It holds the entity of the parameterless --- 693,707 ---- -- details of the use of this field. -- Declaration_Node (synthesized) ! -- Applies to all entities. Returns the tree node for the construct that ! -- declared the entity. Normally this is just the Parent of the entity. ! -- One exception arises with child units, where the parent of the entity ! -- is a selected component/defining program unit name. Another exception ! -- is that if the entity is an incomplete type that has been completed, ! -- then we obtain the declaration node denoted by the full type, i.e. the ! -- full type declaration node. Also note that for subprograms, this ! -- returns the {function,procedure}_specification, not the subprogram_ ! -- declaration. -- Default_Expr_Function (Node21) -- Present in parameters. It holds the entity of the parameterless *************** package Einfo is *** 727,732 **** --- 772,786 ---- -- Present in floating point types and subtypes and decimal types and -- subtypes. Contains the Digits value specified in the declaration. + -- Direct_Primitive_Operations (Elist10) + -- Present in tagged types and subtypes (including synchronized types), + -- in tagged private types and in tagged incomplete types. Element list + -- of entities for primitive operations of the tagged type. Not present + -- in untagged types. In order to follow the C++ ABI, entities of + -- primitives that come from source must be stored in this list in the + -- order of their occurrence in the sources. For incomplete types the + -- list is always empty. + -- Directly_Designated_Type (Node20) -- Present in access types. This field points to the type that is -- directly designated by the access type. In the case of an access *************** package Einfo is *** 799,808 **** -- index starting at 1 and ranging up to number of discriminants. -- Dispatch_Table_Wrappers (Elist26) [implementation base type only] ! -- Present in library level record type entities if we are generating ! -- statically allocated dispatch tables. For a tagged type, points to ! -- the list of dispatch table wrappers associated with the tagged type. ! -- For a non-tagged record, contains No_Elist. -- DTC_Entity (Node16) -- Present in function and procedure entities. Set to Empty unless --- 853,863 ---- -- index starting at 1 and ranging up to number of discriminants. -- Dispatch_Table_Wrappers (Elist26) [implementation base type only] ! -- Present in record type [with private] entities. Set in library level ! -- record type entities if we are generating statically allocated ! -- dispatch tables. For a tagged type, points to the list of dispatch ! -- table wrappers associated with the tagged type. For a non-tagged ! -- record, contains No_Elist. -- DTC_Entity (Node16) -- Present in function and procedure entities. Set to Empty unless *************** package Einfo is *** 996,1004 **** -- a class wide type, points to the parent type. For a subprogram or -- subprogram type, Etype has the return type of a function or is set -- to Standard_Void_Type to represent a procedure. -- Exception_Code (Uint22) ! -- Present in exception entitites. Set to zero unless either an -- Import_Exception or Export_Exception pragma applies to the -- pragma and specifies a Code value. See description of these -- pragmas for details. Note that this field is relevant only if --- 1051,1062 ---- -- a class wide type, points to the parent type. For a subprogram or -- subprogram type, Etype has the return type of a function or is set -- to Standard_Void_Type to represent a procedure. + -- + -- Note one obscure case: for pragma Default_Storage_Pool (null), the + -- Etype of the N_Null node is Empty. -- Exception_Code (Uint22) ! -- Present in exception entities. Set to zero unless either an -- Import_Exception or Export_Exception pragma applies to the -- pragma and specifies a Code value. See description of these -- pragmas for details. Note that this field is relevant only if *************** package Einfo is *** 1116,1121 **** --- 1174,1186 ---- -- Points to a list of associated entities using the Next_Entity field -- as a chain pointer with Empty marking the end of the list. + -- First_Exit_Statement (Node8) + -- Present in E_Loop entity. The exit statements for a loop are chained + -- (in reverse order of appearance) using this field to point to the + -- first entry in the chain (last exit statement in the loop). The + -- entries are chained through the Next_Exit_Statement field of the + -- N_Exit_Statement node with Empty marking the end of the list. + -- First_Formal (synthesized) -- Applies to subprograms and subprogram types, and also in entries -- and entry families. Returns first formal of the subprogram or entry. *************** package Einfo is *** 1189,1195 **** -- Alignment attribute definition clause -- Machine_Attribute pragma -- Link_Alias pragma ! -- Link-Section pragma -- Weak_External pragma -- -- If any of these items are present, then the flag Has_Gigi_Rep_Item --- 1254,1260 ---- -- Alignment attribute definition clause -- Machine_Attribute pragma -- Link_Alias pragma ! -- Linker_Section pragma -- Weak_External pragma -- -- If any of these items are present, then the flag Has_Gigi_Rep_Item *************** package Einfo is *** 1200,1205 **** --- 1265,1275 ---- -- Note in particular that size clauses are present only for this -- purpose, and should only be accessed if Has_Size_Clause is set. + -- Float_Rep (Uint10) + -- Present in floating-point entities. Contains a value of type + -- Float_Rep_Kind. Together with the Digits_Value uniquely defines + -- the floating-point representation to be used. + -- Freeze_Node (Node7) -- Present in all entities. If there is an associated freeze node for -- the entity, this field references this freeze node. If no freeze *************** package Einfo is *** 1224,1230 **** -- Present in all type and subtype entities and in deferred constants. -- References the entity for the corresponding full type declaration. -- For all types other than private and incomplete types, this field ! -- always contains Empty. See also Underlying_Type. -- Generic_Homonym (Node11) -- Present in generic packages. The generic homonym is the entity of --- 1294,1303 ---- -- Present in all type and subtype entities and in deferred constants. -- References the entity for the corresponding full type declaration. -- For all types other than private and incomplete types, this field ! -- always contains Empty. If an incomplete type E1 is completed by a ! -- private type E2 whose full type declaration entity is E3 then the ! -- full view of E1 is E2, and the full view of E2 is E3. See also ! -- Underlying_Type. -- Generic_Homonym (Node11) -- Present in generic packages. The generic homonym is the entity of *************** package Einfo is *** 1263,1269 **** -- Has_Anon_Block_Suffix (Flag201) -- Present in all entities. Set if the entity is nested within one or -- more anonymous blocks and the Chars field contains a name with an ! -- anonymous block suffix (see Exp_Dbug for furthert details). -- Has_Atomic_Components (Flag86) [implementation base type only] -- Present in all types and objects. Set only for an array type or --- 1336,1342 ---- -- Has_Anon_Block_Suffix (Flag201) -- Present in all entities. Set if the entity is nested within one or -- more anonymous blocks and the Chars field contains a name with an ! -- anonymous block suffix (see Exp_Dbug for further details). -- Has_Atomic_Components (Flag86) [implementation base type only] -- Present in all types and objects. Set only for an array type or *************** package Einfo is *** 1342,1347 **** --- 1415,1426 ---- -- Convention, Import, or Export pragma has been given. Used to prevent -- more than one such pragma appearing for a given entity (RM B.1(45)). + -- Has_Delayed_Aspects (Flag200) Present in all entities. Set true if the + -- Rep_Item chain for the entity has one or more N_Aspect_Definition + -- nodes chained which are not to be evaluated till the freeze point. + -- The aspect definition expression clause has been preanalyzed to get + -- visibility at the point of use, but no other action has been taken. + -- Has_Delayed_Freeze (Flag18) -- Present in all entities. Set to indicate that an explicit freeze -- node must be generated for the entity at its freezing point. See *************** package Einfo is *** 1435,1440 **** --- 1514,1540 ---- -- definition contains at least one procedure to which a pragma -- Interrupt_Handler applies. + -- Has_Invariants (Flag232) + -- Present in all type entities and in subprogram entities. Set True in + -- private types if an Invariant or Invariant'Class aspect applies to the + -- type, or if the type inherits one or more Invariant'Class aspects. + -- Also set in the corresponding full type. Note: if this flag is set + -- True, then usually the Invariant_Procedure attribute is set once the + -- type is frozen, however this may not be true in some error situations. + -- Note that it might be the full type which has inheritable invariants, + -- and then the flag will also be set in the private type. Also set in + -- the invariant procedure entity, to distinguish it among entries in the + -- Subprograms_For_Type. + + -- Has_Inheritable_Invariants (Flag248) + -- Present in all type entities. Set True in private types from which one + -- or more Invariant'Class aspects will be inherited if a another type is + -- derived from the type (i.e. those types which have an Invariant'Class + -- aspect, or which inherit one or more Invariant'Class aspects). Also + -- set in the corresponding full types. Note that it might be the full + -- type which has inheritable invariants, and in this case the flag will + -- also be set in the private type. + -- Has_Machine_Radix_Clause (Flag83) -- Present in decimal types and subtypes, set if a Machine_Radix -- representation clause is present. This flag is used to detect *************** package Einfo is *** 1449,1455 **** -- Present in functions and generic functions. Set if there is one or -- more missing return statements in the function. This is used to -- control wrapping of the body in Exp_Ch6 to ensure that the program ! -- 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 --- 1549,1555 ---- -- Present in functions and generic functions. Set if there is one or -- more missing return statements in the function. This is used to -- control wrapping of the body in Exp_Ch6 to ensure that the program ! -- error exception 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 *************** package Einfo is *** 1529,1534 **** --- 1629,1640 ---- -- pragma Inline_Always applies. Note that if this flag is set, the flag -- Has_Pragma_Inline is also set. + -- Has_Pragma_Ordered (Flag198) [implementation base type only] + -- Present in entities for enumeration types. If set indicates that a + -- valid pragma Ordered was given for the type. This flag is inherited + -- by derived enumeration types. We don't need to distinguish the derived + -- case since we allow multiple occurrences of this pragma anyway. + -- Has_Pragma_Pack (Flag121) [implementation base type only] -- Present in all entities. If set, indicates that a valid pragma Pack -- was given for the type. Note that this flag is not inherited by *************** package Einfo is *** 1546,1552 **** -- Has_Pragma_Pure_Function (Flag179) -- Present in all entities. If set, indicates that a valid pragma -- Pure_Function was given for the entity. In some cases, we need to ! -- know that Is_Pure was explicitly set using this pragma. -- Has_Pragma_Thread_Local_Storage (Flag169) -- Present in all entities. If set, indicates that a valid pragma --- 1652,1660 ---- -- Has_Pragma_Pure_Function (Flag179) -- Present in all entities. If set, indicates that a valid pragma -- Pure_Function was given for the entity. In some cases, we need to ! -- know that Is_Pure was explicitly set using this pragma. We also set ! -- this flag for some internal entities that we know should be treated ! -- as pure for optimization purposes. -- Has_Pragma_Thread_Local_Storage (Flag169) -- Present in all entities. If set, indicates that a valid pragma *************** package Einfo is *** 1575,1580 **** --- 1683,1695 ---- -- (but unlike the case with pragma Unreferenced, it is ok to reference -- such an object and no warning is generated. + -- Has_Predicates (Flag250) + -- Present in all entities. Set in type and subtype entities if a pragma + -- Predicate or Predicate aspect applies to the type, or if it inherits a + -- Predicate aspect from its parent or progenitor types. Also set in the + -- predicate function entity, to distinguish it among entries in the + -- Subprograms_For_Type. + -- Has_Primitive_Operations (Flag120) [base type only] -- Present in all type entities. Set if at least one primitive operation -- is defined for the type. *************** package Einfo is *** 1589,1595 **** -- of a private type declaration or its corresponding full declaration. -- This flag is thus preserved when the full and the partial views are -- exchanged, to indicate if a full type declaration is a completion. ! -- Used for semantic checks in E.4 (18), and elsewhere. -- Has_Qualified_Name (Flag161) -- Present in all entities. Set True if the name in the Chars field --- 1704,1710 ---- -- of a private type declaration or its corresponding full declaration. -- This flag is thus preserved when the full and the partial views are -- exchanged, to indicate if a full type declaration is a completion. ! -- Used for semantic checks in E.4(18) and elsewhere. -- Has_Qualified_Name (Flag161) -- Present in all entities. Set True if the name in the Chars field *************** package Einfo is *** 1751,1765 **** -- that we still have a concrete type. For entities other than types, -- returns the entity unchanged. - -- Implemented_By_Entry (Flag232) - -- Applies to functions and procedures. Set if pragma Implemented_By_ - -- Entry is applied on the subprogram entity. - - -- Interfaces (Elist25) - -- Present in record types and subtypes. List of abstract interfaces - -- implemented by a tagged type that are not already implemented by the - -- ancestors (Ada 2005: AI-251). - -- Interface_Alias (Node25) -- Present in subprograms that cover a primitive operation of an abstract -- interface type. Can be set only if the Is_Hidden flag is also set, --- 1866,1871 ---- *************** package Einfo is *** 1767,1772 **** --- 1873,1883 ---- -- interface subprogram. It is used to register the subprogram in -- secondary dispatch table of the interface (Ada 2005: AI-251). + -- Interfaces (Elist25) + -- Present in record types and subtypes. List of abstract interfaces + -- implemented by a tagged type that are not already implemented by the + -- ancestors (Ada 2005: AI-251). + -- In_Package_Body (Flag48) -- Present in package entities. Set on the entity that denotes the -- package (the defining occurrence of the package declaration) while *************** package Einfo is *** 1807,1813 **** --- 1918,1937 ---- -- object fields. A pragma Import for a component can define the -- External_Name of the imported Java field (which is generally needed, -- because Java names are case sensitive). + + -- Invariant_Procedure (synthesized) + -- Present in types and subtypes. Set for private types if one or more + -- Invariant, or Invariant'Class, or inherited Invariant'Class aspects + -- apply to the type. Points to the entity for a procedure which checks + -- the invariant. This invariant procedure takes a single argument of the + -- given type, and returns if the invariant holds, or raises exception + -- Assertion_Error with an appropriate message if it does not hold. This + -- attribute is present but always empty for private subtypes. This + -- attribute is also set for the corresponding full type. -- + -- Note: the reason this is marked as a synthesized attribute is that the + -- way this is stored is as an element of the Subprograms_For_Type field. + -- In_Use (Flag8) -- Present in packages and types. Set when analyzing a use clause for -- the corresponding entity. Reset at end of corresponding declarative *************** package Einfo is *** 1834,1843 **** -- Applies to all entities, true for access types and subtypes -- Is_Ada_2005_Only (Flag185) ! -- Present in all entities, true if a valid pragma Ada_05 applies to the ! -- entity which specifically names the entity, indicating that the entity ! -- is Ada 2005 only. Note that this flag is not set if the entity is part ! -- of a unit compiled with the normal no-argument form of pragma Ada_05. -- Is_Aliased (Flag15) -- Present in objects whose declarations carry the keyword aliased, --- 1958,1975 ---- -- Applies to all entities, true for access types and subtypes -- Is_Ada_2005_Only (Flag185) ! -- Present in all entities, true if a valid pragma Ada_05 or Ada_2005 ! -- applies to the entity which specifically names the entity, indicating ! -- that the entity is Ada 2005 only. Note that this flag is not set if ! -- the entity is part of a unit compiled with the normal no-argument form ! -- of pragma Ada_05 or Ada_2005. ! ! -- Is_Ada_2012_Only (Flag199) ! -- Present in all entities, true if a valid pragma Ada_12 or Ada_2012 ! -- applies to the entity which specifically names the entity, indicating ! -- that the entity is Ada 2012 only. Note that this flag is not set if ! -- the entity is part of a unit compiled with the normal no-argument form ! -- of pragma Ada_12 or Ada_2012. -- Is_Aliased (Flag15) -- Present in objects whose declarations carry the keyword aliased, *************** package Einfo is *** 1863,1868 **** --- 1995,2003 ---- -- Present in all type entities and in procedure entities. Set -- if a pragma Asynchronous applies to the entity. + -- Is_Base_Type (synthesized) + -- Applies to type and subtype entities. True if entity is a base type + -- Is_Bit_Packed_Array (Flag122) [implementation base type only] -- Present in all entities. This flag is set for a packed array type that -- is bit packed (i.e. the component size is known by the front end and *************** package Einfo is *** 1981,1987 **** -- Is_Discrete_Type (synthesized) -- Applies to all entities, true for all discrete types and subtypes ! -- Is_Discrete__Or_Fixed_Point_Type (synthesized) -- Applies to all entities, true for all discrete types and subtypes -- and all fixed-point types and subtypes. --- 2116,2122 ---- -- Is_Discrete_Type (synthesized) -- Applies to all entities, true for all discrete types and subtypes ! -- Is_Discrete_Or_Fixed_Point_Type (synthesized) -- Applies to all entities, true for all discrete types and subtypes -- and all fixed-point types and subtypes. *************** package Einfo is *** 2355,2364 **** -- Applies to all entities, true for ordinary fixed point types and -- subtypes. - -- Is_Overriding_Operation (Flag39) - -- Present in subprograms. Set if the subprogram is a primitive - -- operation of a derived type, that overrides an inherited operation. - -- Is_Package_Or_Generic_Package (synthesized) -- Applies to all entities. True for packages and generic packages. -- False for all other entities. --- 2490,2495 ---- *************** package Einfo is *** 2377,2383 **** -- 4. Setting Component_Size of an array to a bit-packable value -- 3. Indexing an array with a non-standard enumeration type. -- ! -- For records, Is_Packed is always set if Has_Pack_Pragma is set, -- and can also be set on its own in a derived type which inherited -- its packed status. -- --- 2508,2514 ---- -- 4. Setting Component_Size of an array to a bit-packable value -- 3. Indexing an array with a non-standard enumeration type. -- ! -- For records, Is_Packed is always set if Has_Pragma_Pack is set, -- and can also be set on its own in a derived type which inherited -- its packed status. -- *************** package Einfo is *** 2396,2402 **** -- the bit packed case once the array type is frozen. -- -- Before an array type is frozen, Is_Packed will always be set if ! -- Has_Pack_Pragma is set. Before the freeze point, it is not possible -- to know the component size, since the component type is not frozen -- until the array type is frozen. Thus Is_Packed for an array type -- before it is frozen means that packed is required. Then if it turns --- 2527,2533 ---- -- the bit packed case once the array type is frozen. -- -- Before an array type is frozen, Is_Packed will always be set if ! -- Has_Pragma_Pack is set. Before the freeze point, it is not possible -- to know the component size, since the component type is not frozen -- until the array type is frozen. Thus Is_Packed for an array type -- before it is frozen means that packed is required. Then if it turns *************** package Einfo is *** 2470,2476 **** -- 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. --- 2601,2607 ---- -- Applicable to all entities, true if the entity denotes a private -- component of a protected type. ! -- Is_Protected_Interface (synthesized) -- Present in types that are interfaces. True if interface is declared -- protected, or is derived from protected interfaces. *************** package Einfo is *** 2577,2583 **** -- 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 -- interface. --- 2708,2714 ---- -- Applies to all entities, true for function, procedure and operator -- entities. ! -- Is_Synchronized_Interface (synthesized) -- Present in types that are interfaces. True if interface is declared -- synchronized, task, or protected, or is derived from a synchronized -- interface. *************** package Einfo is *** 2591,2597 **** -- 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 if interface is declared as -- a task interface, or if it is derived from task interfaces. --- 2722,2728 ---- -- Is_Tagged_Type (Flag55) -- Present in all entities. Set for an entity for a tagged type. ! -- Is_Task_Interface (synthesized) -- Present in types that are interfaces. True if interface is declared as -- a task interface, or if it is derived from task interfaces. *************** package Einfo is *** 2745,2750 **** --- 2876,2888 ---- -- Points to the last entry in the list of associated entities chained -- through the Next_Entity field. Empty if no entities are chained. + -- Last_Formal (synthesized) + -- Applies to subprograms and subprogram types, and also in entries + -- and entry families. Returns last formal of the subprogram or entry. + -- The formals are the first entities declared in a subprogram or in + -- a subprogram type (the designated type of an Access_To_Subprogram + -- definition) or in an entry. + -- Limited_View (Node23) -- Present in non-generic package entities that are not instances. Bona -- fide package with the limited-view list through the first_entity and *************** package Einfo is *** 2926,2937 **** -- Empty if there are no more formals. The list returned includes -- all the extra formals (see description of Extra_Formal field) - -- Next_Girder_Discriminant (synthesized) - -- Applies to discriminants. Set only for a discriminant returned by - -- a call to First/Next_Girder_Discriminant. Returns next girder - -- discriminant, if there are more (see complete description in - -- First_Girder_Discriminant), or Empty if there are no more. - -- Next_Index (synthesized) -- Applies to array types and subtypes and to string types and -- subtypes. Yields the next index. The first index is obtained by --- 3064,3069 ---- *************** package Einfo is *** 2965,2976 **** -- interpreted as true. Currently this is set true for derived Boolean -- types which have a convention of C, C++ or Fortran. ! -- No_Pool_Assigned (Flag131) [root type only] ! -- Present in access types. Set if a storage size clause applies to ! -- the variable with a compile time known value of zero. This flag is ! -- used to generate warnings if any attempt is made to allocate or free ! -- an instance of such an access type. This is set only in the root ! -- type, since derived types must have the same pool. -- No_Return (Flag113) -- Present in all entities. Always false except in the case of procedures --- 3097,3108 ---- -- interpreted as true. Currently this is set true for derived Boolean -- types which have a convention of C, C++ or Fortran. ! -- No_Pool_Assigned (Flag131) [root type only] Present in access types. ! -- Set if a storage size clause applies to the variable with a static ! -- expression value of zero. This flag is used to generate errors if any ! -- attempt is made to allocate or free an instance of such an access ! -- type. This is set only in the root type, since derived types must ! -- have the same pool. -- No_Return (Flag113) -- Present in all entities. Always false except in the case of procedures *************** package Einfo is *** 3129,3140 **** -- to generate the call to this procedure in case the expander inserts -- implicit return statements. ! -- Primitive_Operations (Elist15) ! -- Present in tagged record types and subtypes and in tagged private ! -- types. Points to an element list of entities for primitive operations ! -- for the tagged type. Not present (and not set) in untagged types (it ! -- 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 --- 3261,3287 ---- -- to generate the call to this procedure in case the expander inserts -- implicit return statements. ! -- PPC_Wrapper (Node25) ! -- Present in entries and entry families. Set only if pre- or post- ! -- conditions are present. The precondition_wrapper body is the original ! -- entry call, decorated with the given precondition for the entry. ! ! -- Primitive_Operations (synthesized) ! -- Present in concurrent types, tagged record types and subtypes, tagged ! -- private types and tagged incomplete types. For concurrent types whose ! -- Corresponding_Record_Type (CRT) is available, returns the list of ! -- Direct_Primitive_Operations of its CRT; otherwise returns No_Elist. ! -- For all the other types returns the Direct_Primitive_Operations. ! ! -- Predicate_Function (synthesized) ! -- Present in all types. Set for types for which (Has_Predicates is True) ! -- and for which a predicate procedure has been built that tests that the ! -- specified predicates are True. Contains the entity for the function ! -- which takes a single argument of the given type, and returns True if ! -- the predicate holds and False if it does not. ! -- ! -- Note: the reason this is marked as a synthesized attribute is that the ! -- way this is stored is as an element of the Subprograms_For_Type field. -- Prival (Node17) -- Present in private components of protected types. Refers to the entity *************** package Einfo is *** 3216,3227 **** -- we have a separate warning for variables that are only assigned and -- never read, and out parameters are a special case. - -- Referenced_Object (Node10) - -- Present in all type entities. Set non-Empty only for type entities - -- constructed for unconstrained objects, or objects that depend on - -- discriminants. Points to the expression from which the actual - -- subtype of the object can be evaluated. - -- Register_Exception_Call (Node20) -- Present in exception entities. When an exception is declared, -- a call is expanded to Register_Exception. This field points to --- 3363,3368 ---- *************** package Einfo is *** 3237,3245 **** -- only for type-related error messages. -- Related_Expression (Node24) ! -- Present in variables generated internally. Denotes the source ! -- expression whose elaboration created the variable declaration. ! -- Used for clearer messages from CodePeer. -- Related_Instance (Node15) -- Present in the wrapper packages created for subprogram instances. --- 3378,3390 ---- -- only for type-related error messages. -- Related_Expression (Node24) ! -- Present in variables and types. Set only for internally generated ! -- entities, where it may be used to denote the source expression whose ! -- elaboration created the variable declaration. If set, it is used ! -- for generating clearer messages from CodePeer. ! -- ! -- Shouldn't it also be used for the same purpose in errout? It seems ! -- odd to have two mechanisms here??? -- Related_Instance (Node15) -- Present in the wrapper packages created for subprogram instances. *************** package Einfo is *** 3247,3256 **** -- wrapper package, but for debugging purposes its external symbol -- must correspond to the name and scope of the related instance. ! -- Related_Type (Node26) ! -- Present in components and constants associated with dispatch tables. ! -- 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 --- 3392,3401 ---- -- wrapper package, but for debugging purposes its external symbol -- must correspond to the name and scope of the related instance. ! -- Related_Type (Node27) ! -- Present in components, constants and variables. Set when there is an ! -- associated dispatch table to point to entities containing primary or ! -- secondary tags. Not set in the _tag component of record types. -- Relative_Deadline_Variable (Node26) [implementation base type only] -- Present in task type entities. This flag is set if a valid and *************** package Einfo is *** 3370,3398 **** -- the Scope will be Standard. -- Scope_Depth (synthesized) ! -- Applies to program units, blocks, concurrent types and entries, ! -- and also to record types, i.e. to any entity that can appear on ! -- the scope stack. Yields the scope depth value, which for those ! -- entities other than records is simply the scope depth value, ! -- for record entities, it is the Scope_Depth of the record scope. -- Scope_Depth_Value (Uint22) ! -- Present in program units, blocks, concurrent types and entries. ! -- Indicates the number of scopes that statically enclose the ! -- declaration of the unit or type. Library units have a depth of zero. ! -- Note that record types can act as scopes but do NOT have this field ! -- set (see Scope_Depth above) -- Scope_Depth_Set (synthesized) -- Applies to a special predicate function that returns a Boolean value ! -- indicating whether or not the Scope_Depth field has been set. It ! -- is needed, since returns an invalid value in this case! -- Sec_Stack_Needed_For_Return (Flag167) -- Present in scope entities (blocks, functions, procedures, tasks, ! -- entries). Set to True when secondary stack is used to hold ! -- the returned value of a function and thus should not be ! -- released on scope exit. -- Shadow_Entities (List14) -- Present in package and generic package entities. Points to a list --- 3515,3543 ---- -- the Scope will be Standard. -- Scope_Depth (synthesized) ! -- Applies to program units, blocks, concurrent types and entries, and ! -- also to record types, i.e. to any entity that can appear on the scope ! -- stack. Yields the scope depth value, which for those entities other ! -- than records is simply the scope depth value, for record entities, it ! -- is the Scope_Depth of the record scope. -- Scope_Depth_Value (Uint22) ! -- Present in program units, blocks, concurrent types, and entries. ! -- Indicates the number of scopes that statically enclose the declaration ! -- of the unit or type. Library units have a depth of zero. Note that ! -- record types can act as scopes but do NOT have this field set (see ! -- Scope_Depth above) -- Scope_Depth_Set (synthesized) -- Applies to a special predicate function that returns a Boolean value ! -- indicating whether or not the Scope_Depth field has been set. It is ! -- needed, since returns an invalid value in this case! -- Sec_Stack_Needed_For_Return (Flag167) -- Present in scope entities (blocks, functions, procedures, tasks, ! -- entries). Set to True when secondary stack is used to hold the ! -- returned value of a function and thus should not be released on ! -- scope exit. -- Shadow_Entities (List14) -- Present in package and generic package entities. Points to a list *************** package Einfo is *** 3453,3463 **** -- the corresponding parameter entities in the spec. -- Spec_PPC_List (Node24) ! -- Present in subprogram and generic subprogram entities. Points to a ! -- list of Precondition and Postcondition 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 ! -- appearance. -- Storage_Size_Variable (Node15) [implementation base type only] -- Present in access types and task type entities. This flag is set --- 3598,3619 ---- -- the corresponding parameter entities in the spec. -- Spec_PPC_List (Node24) ! -- Present in entries, and in subprogram and generic subprogram entities. ! -- Points to a list of Precondition and Postcondition 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 appearance. Note that this includes precondition/postcondition ! -- pragmas generated to correspond to Pre/Post aspects. ! ! -- Static_Predicate (List25) ! -- Present in discrete types/subtypes with predicates (Has_Predicates ! -- set True). Points to a list of expression and N_Range nodes that ! -- represent the predicate in canonical form. The canonical form has ! -- entries sorted in ascending order, with all duplicates eliminated, ! -- and adjacent ranges coalesced, so that there is always a gap in the ! -- values between successive entries. The entries in this list are ! -- fully analyzed and typed with the base type of the subtype. Note ! -- that all entries are static and have values within the subtype range. -- Storage_Size_Variable (Node15) [implementation base type only] -- Present in access types and task type entities. This flag is set *************** package Einfo is *** 3505,3510 **** --- 3661,3676 ---- -- the low bound of the applicable index constraint if there is one, -- or a copy of the low bound of the index base type if not. + -- Subprograms_For_Type (Node29) + -- Present in all type entities, and in subprogram entities. This is used + -- to hold a list of subprogram entities for subprograms associated with + -- the type, linked through the Subprogram_List field of the subprogram + -- entity. Basically this is a way of multiplexing the single field to + -- hold more than one entity (since we ran out of space in some type + -- entities). This is currently used for Invariant_Procedure and also + -- for Predicate_Function, and clients will always use the latter two + -- names to access entries in this list. + -- Suppress_Elaboration_Warnings (Flag148) -- Present in all entities, can be set only for subprogram entities and -- for variables. If this flag is set then Sem_Elab will not generate *************** package Einfo is *** 3532,3543 **** -- value may be passed around, and if used, may clobber a local variable. -- Task_Body_Procedure (Node25) ! -- Present in task types and subtypes. Points to the entity for ! -- the task body procedure (as further described in Exp_Ch9, task ! -- bodies are expanded into procedures). A convenient function to ! -- retrieve this field is Sem_Util.Get_Task_Body_Procedure. ! -- The last sentence is odd ??? Why not have Task_Body_Procedure ! -- go to the Underlying_Type of the Root_Type??? -- Treat_As_Volatile (Flag41) -- Present in all type entities, and also in constants, components and --- 3698,3710 ---- -- value may be passed around, and if used, may clobber a local variable. -- Task_Body_Procedure (Node25) ! -- Present in task types and subtypes. Points to the entity for the task ! -- task body procedure (as further described in Exp_Ch9, task bodies are ! -- expanded into procedures). A convenient function to retrieve this ! -- field is Sem_Util.Get_Task_Body_Procedure. ! -- ! -- The last sentence is odd??? Why not have Task_Body_Procedure go to the ! -- Underlying_Type of the Root_Type??? -- Treat_As_Volatile (Flag41) -- Present in all type entities, and also in constants, components and *************** package Einfo is *** 3584,3590 **** -- private completion. If Td is already constrained, then its full view -- can serve directly as the full view of T. ! -- Underlying_Record_View (Node24) -- Present in record types. Set for record types that are extensions of -- types with unknown discriminants, and also set for internally built -- underlying record views to reference its original record type. Record --- 3751,3757 ---- -- private completion. If Td is already constrained, then its full view -- can serve directly as the full view of T. ! -- Underlying_Record_View (Node28) -- Present in record types. Set for record types that are extensions of -- types with unknown discriminants, and also set for internally built -- underlying record views to reference its original record type. Record *************** package Einfo is *** 3630,3640 **** -- entries). Set to True when secondary stack is used in this scope and -- must be released on exit unless Sec_Stack_Needed_For_Return is set. - -- Vax_Float (Flag151) [base type only] - -- Present in all type and subtype entities. Set only on the base type of - -- float types with Vax format. The particular format is determined by - -- the Digits_Value value which is 6,9,15 for F_Float, D_Float, G_Float. - -- Warnings_Off (Flag96) -- Present in all entities. Set if a pragma Warnings (Off, entity-name) -- is used to suppress warnings for a given entity. It is also used by --- 3797,3802 ---- *************** package Einfo is *** 3685,3699 **** -- E_Access_Subtype is for an access subtype created by a subtype -- declaration. ! -- In addition, we define the kind E_Allocator_Type to label ! -- allocators. This is because special resolution rules apply to this ! -- construct. Eventually the constructs are labeled with the access ! -- type imposed by the context. Gigi should never see the type ! -- E_Allocator. ! -- Similarly, the type E_Access_Attribute_Type is used as the initial ! -- kind associated with an access attribute. After resolution a specific ! -- access type will be established as determined by the context. -- Finally, the type Any_Access is used to label -null- during type -- resolution. Any_Access is also replaced by the context type after --- 3847,3860 ---- -- E_Access_Subtype is for an access subtype created by a subtype -- declaration. ! -- In addition, we define the kind E_Allocator_Type to label allocators. ! -- This is because special resolution rules apply to this construct. ! -- Eventually the constructs are labeled with the access type imposed by ! -- the context. Gigi should never see the type E_Allocator. ! -- Similarly, the type E_Access_Attribute_Type is used as the initial kind ! -- associated with an access attribute. After resolution a specific access ! -- type will be established as determined by the context. -- Finally, the type Any_Access is used to label -null- during type -- resolution. Any_Access is also replaced by the context type after *************** package Einfo is *** 3722,3732 **** type Entity_Kind is ( E_Void, ! -- The initial Ekind value for a newly created entity. Also used as ! -- the Ekind for Standard_Void_Type, a type entity in Standard used ! -- as a dummy type for the return type of a procedure (the reason we ! -- create this type is to share the circuits for performing overload ! -- resolution on calls). ------------- -- Objects -- --- 3883,3893 ---- type Entity_Kind is ( E_Void, ! -- The initial Ekind value for a newly created entity. Also used as the ! -- Ekind for Standard_Void_Type, a type entity in Standard used as a ! -- dummy type for the return type of a procedure (the reason we create ! -- this type is to share the circuits for performing overload resolution ! -- on calls). ------------- -- Objects -- *************** package Einfo is *** 4149,4154 **** --- 4310,4326 ---- E_Access_Protected_Subprogram_Type .. E_Anonymous_Access_Protected_Subprogram_Type; + subtype Aggregate_Kind is Entity_Kind range + E_Array_Type .. + -- E_Array_Subtype + -- E_String_Type + -- E_String_Subtype + -- E_String_Literal_Subtype + -- E_Class_Wide_Type + -- E_Class_Wide_Subtype + -- E_Record_Type + E_Record_Subtype; + subtype Array_Kind is Entity_Kind range E_Array_Type .. -- E_Array_Subtype *************** package Einfo is *** 4487,4492 **** --- 4659,4665 ---- -- Has_Anon_Block_Suffix (Flag201) -- Has_Controlled_Component (Flag43) (base type only) -- Has_Convention_Pragma (Flag119) + -- Has_Delayed_Aspects (Flag200) -- Has_Delayed_Freeze (Flag18) -- Has_Fully_Qualified_Name (Flag173) -- Has_Gigi_Rep_Item (Flag82) *************** package Einfo is *** 4501,4506 **** --- 4674,4680 ---- -- Has_Pragma_Thread_Local_Storage (Flag169) -- Has_Pragma_Unmodified (Flag233) -- Has_Pragma_Unreferenced (Flag180) + -- Has_Predicates (Flag250) -- Has_Private_Declaration (Flag155) -- Has_Qualified_Name (Flag161) -- Has_Stream_Size_Clause (Flag184) *************** package Einfo is *** 4508,4513 **** --- 4682,4688 ---- -- Has_Xref_Entry (Flag182) -- In_Private_Part (Flag45) -- Is_Ada_2005_Only (Flag185) + -- Is_Ada_2012_Only (Flag199) -- Is_Bit_Packed_Array (Flag122) (base type only) -- Is_Character_Type (Flag63) -- Is_Child_Unit (Flag73) *************** package Einfo is *** 4587,4597 **** -- Associated_Node_For_Itype (Node8) -- Class_Wide_Type (Node9) - -- Referenced_Object (Node10) -- Full_View (Node11) -- Esize (Uint12) -- RM_Size (Uint13) -- Alignment (Uint14) -- Depends_On_Private (Flag14) -- Discard_Names (Flag88) --- 4762,4774 ---- -- Associated_Node_For_Itype (Node8) -- Class_Wide_Type (Node9) -- Full_View (Node11) -- Esize (Uint12) -- RM_Size (Uint13) -- Alignment (Uint14) + -- Related_Expression (Node24) + -- Current_Use_Clause (Node27) + -- Subprograms_For_Type (Node29) -- Depends_On_Private (Flag14) -- Discard_Names (Flag88) *************** package Einfo is *** 4604,4609 **** --- 4781,4788 ---- -- Has_Complex_Representation (Flag140) (base type only) -- Has_Constrained_Partial_View (Flag187) -- Has_Discriminants (Flag5) + -- Has_Inheritable_Invariants (Flag248) + -- Has_Invariants (Flag232) -- Has_Non_Standard_Rep (Flag75) (base type only) -- Has_Object_Size_Clause (Flag172) -- Has_Pragma_Preelab_Init (Flag221) *************** package Einfo is *** 4628,4637 **** -- Is_Eliminated (Flag124) -- Is_Frozen (Flag4) -- Is_Generic_Actual_Type (Flag94) - -- Is_Protected_Interface (Flag198) -- Is_RACW_Stub_Type (Flag244) - -- Is_Synchronized_Interface (Flag199) - -- Is_Task_Interface (Flag200) -- Is_Non_Static_Subtype (Flag109) -- Is_Packed (Flag51) (base type only) -- Is_Private_Composite (Flag107) --- 4807,4813 ---- *************** package Einfo is *** 4654,4660 **** --- 4830,4838 ---- -- Base_Type (synth) -- Has_Private_Ancestor (synth) -- Implementation_Base_Type (synth) + -- Invariant_Procedure (synth) -- Is_Access_Protected_Subprogram_Type (synth) + -- Predicate_Function (synth) -- Root_Type (synth) -- Size_Clause (synth) *************** package Einfo is *** 4745,4750 **** --- 4923,4929 ---- -- E_Class_Wide_Type -- E_Class_Wide_Subtype + -- Direct_Primitive_Operations (Elist10) -- Cloned_Subtype (Node16) (subtype case only) -- First_Entity (Node17) -- Equivalent_Type (Node18) (always Empty for type) *************** package Einfo is *** 4769,4775 **** -- Interface_Name (Node21) (JGNAT usage only) -- Original_Record_Component (Node22) -- DT_Offset_To_Top_Func (Node25) ! -- Related_Type (Node26) -- Has_Biased_Representation (Flag139) -- Has_Per_Object_Constraint (Flag154) -- Is_Atomic (Flag85) --- 4948,4954 ---- -- Interface_Name (Node21) (JGNAT usage only) -- Original_Record_Component (Node22) -- DT_Offset_To_Top_Func (Node25) ! -- Related_Type (Node27) -- Has_Biased_Representation (Flag139) -- Has_Per_Object_Constraint (Flag154) -- Is_Atomic (Flag85) *************** package Einfo is *** 4792,4798 **** -- Size_Check_Code (Node19) (constants only) -- Prival_Link (Node20) (privals only) -- Interface_Name (Node21) ! -- Related_Type (Node26) (constants only) -- Has_Alignment_Clause (Flag46) -- Has_Atomic_Components (Flag86) -- Has_Biased_Representation (Flag139) --- 4971,4977 ---- -- Size_Check_Code (Node19) (constants only) -- Prival_Link (Node20) (privals only) -- Interface_Name (Node21) ! -- Related_Type (Node27) (constants only) -- Has_Alignment_Clause (Flag46) -- Has_Atomic_Components (Flag86) -- Has_Biased_Representation (Flag139) *************** package Einfo is *** 4822,4827 **** --- 5001,5007 ---- -- Small_Value (Ureal21) -- Has_Machine_Radix_Clause (Flag83) -- Machine_Radix_10 (Flag84) + -- Aft_Value (synth) -- Type_Low_Bound (synth) -- Type_High_Bound (synth) -- (plus type attributes) *************** package Einfo is *** 4859,4864 **** --- 5039,5046 ---- -- Accept_Address (Elist21) -- Scope_Depth_Value (Uint22) -- Protection_Object (Node23) (protected kind) + -- Spec_PPC_List (Node24) (for entry only) + -- PPC_Wrapper (Node25) -- Default_Expressions_Processed (Flag108) -- Entry_Accepted (Flag152) -- Is_AST_Entry (Flag132) (for entry only) *************** package Einfo is *** 4866,4874 **** -- Sec_Stack_Needed_For_Return (Flag167) -- Uses_Sec_Stack (Flag95) -- Address_Clause (synth) -- First_Formal (synth) -- First_Formal_With_Extras (synth) ! -- Entry_Index_Type (synth) -- Number_Formals (synth) -- Scope_Depth (synth) --- 5048,5057 ---- -- Sec_Stack_Needed_For_Return (Flag167) -- Uses_Sec_Stack (Flag95) -- Address_Clause (synth) + -- Entry_Index_Type (synth) -- First_Formal (synth) -- First_Formal_With_Extras (synth) ! -- Last_Formal (synth) -- Number_Formals (synth) -- Scope_Depth (synth) *************** package Einfo is *** 4889,4897 **** --- 5072,5082 ---- -- First_Literal (Node17) -- Scalar_Range (Node20) -- Enum_Pos_To_Rep (Node23) (type only) + -- Static_Predicate (List25) -- Has_Biased_Representation (Flag139) -- Has_Contiguous_Rep (Flag181) -- Has_Enumeration_Rep_Clause (Flag66) + -- Has_Pragma_Ordered (Flag198) (base type only) -- Nonzero_Is_True (Flag162) (base type only) -- Type_Low_Bound (synth) -- Type_High_Bound (synth) *************** package Einfo is *** 4915,4923 **** --- 5100,5121 ---- -- E_Floating_Point_Type -- E_Floating_Point_Subtype -- Digits_Value (Uint17) + -- Float_Rep (Uint10) (Float_Rep_Kind) + -- Machine_Emax_Value (synth) + -- Machine_Emin_Value (synth) + -- Machine_Mantissa_Value (synth) + -- Machine_Radix_Value (synth) + -- Model_Emin_Value (synth) + -- Model_Epsilon_Value (synth) + -- Model_Mantissa_Value (synth) + -- Model_Small_Value (synth) + -- Safe_Emax_Value (synth) + -- Safe_First_Value (synth) + -- Safe_Last_Value (synth) -- Scalar_Range (Node20) -- Type_Low_Bound (synth) -- Type_High_Bound (synth) + -- Vax_Float (synth) -- (plus type attributes) -- E_Function *************** package Einfo is *** 4947,4952 **** --- 5145,5151 ---- -- Overridden_Operation (Node26) -- Wrapped_Entity (Node27) (non-generic case only) -- Extra_Formals (Node28) + -- Subprograms_For_Type (Node29) -- Body_Needed_For_SAL (Flag40) -- Elaboration_Entity_Required (Flag174) -- Default_Expressions_Processed (Flag108) *************** package Einfo is *** 4955,4967 **** -- Discard_Names (Flag88) -- Has_Completion (Flag26) -- Has_Controlling_Result (Flag98) -- 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) -- Is_Abstract_Subprogram (Flag19) (non-generic case only) -- Is_Called (Flag102) (non-generic case only) -- Is_Constructor (Flag76) --- 5154,5166 ---- -- Discard_Names (Flag88) -- Has_Completion (Flag26) -- Has_Controlling_Result (Flag98) + -- Has_Invariants (Flag232) -- 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) -- Is_Abstract_Subprogram (Flag19) (non-generic case only) -- Is_Called (Flag102) (non-generic case only) -- Is_Constructor (Flag76) *************** package Einfo is *** 4970,4976 **** -- Is_Instantiated (Flag126) (generic case only) -- Is_Intrinsic_Subprogram (Flag64) -- Is_Machine_Code_Subprogram (Flag137) (non-generic case only) - -- Is_Overriding_Operation (Flag39) (non-generic case only) -- Is_Primitive (Flag218) -- Is_Primitive_Wrapper (Flag195) (non-generic case only) -- Is_Private_Descendant (Flag53) --- 5169,5174 ---- *************** package Einfo is *** 4987,4992 **** --- 5185,5191 ---- -- Address_Clause (synth) -- First_Formal (synth) -- First_Formal_With_Extras (synth) + -- Last_Formal (synth) -- Number_Formals (synth) -- Scope_Depth (synth) *************** package Einfo is *** 5012,5017 **** --- 5211,5217 ---- -- E_Incomplete_Type -- E_Incomplete_Subtype + -- Direct_Primitive_Operations (Elist10) -- Non_Limited_View (Node17) -- Private_Dependents (Elist18) -- Discriminant_Constraint (Elist21) *************** package Einfo is *** 5063,5068 **** --- 5263,5269 ---- -- (plus type attributes) -- E_Loop + -- First_Exit_Statement (Node8) -- Has_Exit (Flag47) -- Has_Master_Entity (Flag21) -- Has_Nested_Block_With_Handler (Flag101) *************** package Einfo is *** 5072,5077 **** --- 5273,5279 ---- -- Modulus (Uint17) (base type only) -- Original_Array_Type (Node21) -- Scalar_Range (Node20) + -- Static_Predicate (List25) -- Non_Binary_Modulus (Flag58) (base type only) -- Has_Biased_Representation (Flag139) -- Type_Low_Bound (synth) *************** package Einfo is *** 5086,5096 **** -- First_Entity (Node17) -- Alias (Node18) -- Last_Entity (Node20) -- Has_Postconditions (Flag240) -- Is_Machine_Code_Subprogram (Flag137) -- Is_Pure (Flag44) -- Is_Intrinsic_Subprogram (Flag64) - -- Is_Overriding_Operation (Flag39) -- Is_Primitive (Flag218) -- Is_Thunk (Flag225) -- Default_Expressions_Processed (Flag108) --- 5288,5300 ---- -- First_Entity (Node17) -- Alias (Node18) -- Last_Entity (Node20) + -- Overridden_Operation (Node26) + -- Subprograms_For_Type (Node29) + -- Has_Invariants (Flag232) -- Has_Postconditions (Flag240) -- Is_Machine_Code_Subprogram (Flag137) -- Is_Pure (Flag44) -- Is_Intrinsic_Subprogram (Flag64) -- Is_Primitive (Flag218) -- Is_Thunk (Flag225) -- Default_Expressions_Processed (Flag108) *************** package Einfo is *** 5103,5108 **** --- 5307,5313 ---- -- Scalar_Range (Node20) -- Small_Value (Ureal21) -- Has_Small_Clause (Flag67) + -- Aft_Value (synth) -- Type_Low_Bound (synth) -- Type_High_Bound (synth) -- (plus type attributes) *************** package Einfo is *** 5164,5170 **** -- E_Private_Type -- E_Private_Subtype ! -- Primitive_Operations (Elist15) -- First_Entity (Node17) -- Private_Dependents (Elist18) -- Underlying_Full_View (Node19) --- 5369,5375 ---- -- E_Private_Type -- E_Private_Subtype ! -- Direct_Primitive_Operations (Elist10) -- First_Entity (Node17) -- Private_Dependents (Elist18) -- Underlying_Full_View (Node19) *************** package Einfo is *** 5201,5207 **** -- Spec_PPC_List (Node24) -- Interface_Alias (Node25) -- Static_Initialization (Node26) (init_proc only) ! -- Overridden_Operation (Node26) -- Wrapped_Entity (Node27) (non-generic case only) -- Extra_Formals (Node28) -- Body_Needed_For_SAL (Flag40) --- 5406,5412 ---- -- Spec_PPC_List (Node24) -- Interface_Alias (Node25) -- Static_Initialization (Node26) (init_proc only) ! -- Overridden_Operation (Node26) (never for init proc) -- Wrapped_Entity (Node27) (non-generic case only) -- Extra_Formals (Node28) -- Body_Needed_For_SAL (Flag40) *************** package Einfo is *** 5213,5223 **** -- Delay_Subprogram_Descriptors (Flag50) -- Discard_Names (Flag88) -- 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_Abstract_Subprogram (Flag19) (non-generic case only) -- Is_Asynchronous (Flag81) -- Is_Called (Flag102) (non-generic case only) --- 5418,5428 ---- -- Delay_Subprogram_Descriptors (Flag50) -- Discard_Names (Flag88) -- Has_Completion (Flag26) + -- Has_Invariants (Flag232) -- Has_Master_Entity (Flag21) -- Has_Nested_Block_With_Handler (Flag101) -- Has_Postconditions (Flag240) -- Has_Subprogram_Descriptor (Flag93) -- Is_Abstract_Subprogram (Flag19) (non-generic case only) -- Is_Asynchronous (Flag81) -- Is_Called (Flag102) (non-generic case only) *************** package Einfo is *** 5228,5234 **** -- Is_Intrinsic_Subprogram (Flag64) -- Is_Machine_Code_Subprogram (Flag137) (non-generic case only) -- Is_Null_Init_Proc (Flag178) - -- Is_Overriding_Operation (Flag39) (non-generic case only) -- Is_Primitive (Flag218) -- Is_Primitive_Wrapper (Flag195) (non-generic case only) -- Is_Private_Descendant (Flag53) --- 5433,5438 ---- *************** package Einfo is *** 5244,5249 **** --- 5448,5454 ---- -- Address_Clause (synth) -- First_Formal (synth) -- First_Formal_With_Extras (synth) + -- Last_Formal (synth) -- Number_Formals (synth) -- E_Protected_Body *************** package Einfo is *** 5253,5258 **** --- 5458,5464 ---- -- E_Protected_Type -- E_Protected_Subtype + -- Direct_Primitive_Operations (Elist10) -- Entry_Bodies_Array (Node15) -- First_Private_Entity (Node16) -- First_Entity (Node17) *************** package Einfo is *** 5271,5279 **** -- E_Record_Type -- E_Record_Subtype ! -- Primitive_Operations (Elist15) -- Access_Disp_Table (Elist16) (base type only) - -- Dispatch_Table_Wrappers (Elist26) (base type only) -- Cloned_Subtype (Node16) (subtype case only) -- First_Entity (Node17) -- Corresponding_Concurrent_Type (Node18) --- 5477,5484 ---- -- E_Record_Type -- E_Record_Subtype ! -- Direct_Primitive_Operations (Elist10) -- Access_Disp_Table (Elist16) (base type only) -- Cloned_Subtype (Node16) (subtype case only) -- First_Entity (Node17) -- Corresponding_Concurrent_Type (Node18) *************** package Einfo is *** 5282,5289 **** -- Discriminant_Constraint (Elist21) -- Corresponding_Remote_Type (Node22) -- Stored_Constraint (Elist23) - -- Underlying_Record_View (Node24) (base type only) -- Interfaces (Elist25) -- Component_Alignment (special) (base type only) -- C_Pass_By_Copy (Flag125) (base type only) -- Has_Dispatch_Table (Flag220) (base tagged type only) --- 5487,5495 ---- -- Discriminant_Constraint (Elist21) -- Corresponding_Remote_Type (Node22) -- Stored_Constraint (Elist23) -- Interfaces (Elist25) + -- Dispatch_Table_Wrappers (Elist26) (base type only) + -- Underlying_Record_View (Node28) (base type only) -- Component_Alignment (special) (base type only) -- C_Pass_By_Copy (Flag125) (base type only) -- Has_Dispatch_Table (Flag220) (base tagged type only) *************** package Einfo is *** 5304,5312 **** -- E_Record_Type_With_Private -- E_Record_Subtype_With_Private ! -- Primitive_Operations (Elist15) -- Access_Disp_Table (Elist16) (base type only) - -- Dispatch_Table_Wrappers (Elist26) (base type only) -- First_Entity (Node17) -- Private_Dependents (Elist18) -- Underlying_Full_View (Node19) --- 5510,5517 ---- -- E_Record_Type_With_Private -- E_Record_Subtype_With_Private ! -- Direct_Primitive_Operations (Elist10) -- Access_Disp_Table (Elist16) (base type only) -- First_Entity (Node17) -- Private_Dependents (Elist18) -- Underlying_Full_View (Node19) *************** package Einfo is *** 5315,5320 **** --- 5520,5526 ---- -- Private_View (Node22) -- Stored_Constraint (Elist23) -- Interfaces (Elist25) + -- Dispatch_Table_Wrappers (Elist26) (base type only) -- Has_Completion (Flag26) -- Has_Record_Rep_Clause (Flag65) (base type only) -- Has_External_Tag_Rep_Clause (Flag110) *************** package Einfo is *** 5336,5341 **** --- 5542,5548 ---- -- E_Signed_Integer_Type -- E_Signed_Integer_Subtype -- Scalar_Range (Node20) + -- Static_Predicate (List25) -- Has_Biased_Representation (Flag139) -- Type_Low_Bound (synth) -- Type_High_Bound (synth) *************** package Einfo is *** 5360,5365 **** --- 5567,5573 ---- -- E_Subprogram_Body -- Mechanism (Uint8) -- First_Entity (Node17) + -- Corresponding_Protected_Entry (Node18) -- Last_Entity (Node20) -- Scope_Depth_Value (Uint22) -- Scope_Depth (synth) *************** package Einfo is *** 5368,5373 **** --- 5576,5582 ---- -- Directly_Designated_Type (Node20) -- First_Formal (synth) -- First_Formal_With_Extras (synth) + -- Last_Formal (synth) -- Number_Formals (synth) -- (plus type attributes) *************** package Einfo is *** 5376,5381 **** --- 5585,5591 ---- -- E_Task_Type -- E_Task_Subtype + -- Direct_Primitive_Operations (Elist10) -- Storage_Size_Variable (Node15) (base type only) -- First_Private_Entity (Node16) -- First_Entity (Node17) *************** package Einfo is *** 5414,5419 **** --- 5624,5630 ---- -- Related_Expression (Node24) -- Debug_Renaming_Link (Node25) -- Last_Assignment (Node26) + -- Related_Type (Node27) -- Has_Alignment_Clause (Flag46) -- Has_Atomic_Components (Flag86) -- Has_Biased_Representation (Flag139) *************** package Einfo is *** 5466,5471 **** --- 5677,5691 ---- Calign_Component_Size_4, -- natural for size <= 4, 4 for size >= 4 Calign_Storage_Unit); -- all components byte aligned + ----------------------------------- + -- Floating Point Representation -- + ----------------------------------- + + type Float_Rep_Kind is ( + IEEE_Binary, -- IEEE 754p conform binary format + VAX_Native, -- VAX D, F, G or H format + AAMP); -- AAMP format + --------------- -- Iterators -- --------------- *************** package Einfo is *** 5645,5650 **** --- 5865,5871 ---- subtype B is Boolean; subtype C is Component_Alignment_Kind; subtype E is Entity_Id; + subtype F is Float_Rep_Kind; subtype M is Mechanism_Type; subtype N is Node_Id; subtype U is Uint; *************** package Einfo is *** 5688,5693 **** --- 5909,5915 ---- function Corresponding_Concurrent_Type (Id : E) return E; function Corresponding_Discriminant (Id : E) return E; function Corresponding_Equality (Id : E) return E; + function Corresponding_Protected_Entry (Id : E) return E; function Corresponding_Record_Type (Id : E) return E; function Corresponding_Remote_Type (Id : E) return E; function Current_Use_Clause (Id : E) return E; *************** package Einfo is *** 5743,5753 **** --- 5965,5977 ---- function Finalization_Chain_Entity (Id : E) return E; function Finalize_Storage_Only (Id : E) return B; function First_Entity (Id : E) return E; + function First_Exit_Statement (Id : E) return N; function First_Index (Id : E) return N; function First_Literal (Id : E) return E; function First_Optional_Parameter (Id : E) return E; function First_Private_Entity (Id : E) return E; function First_Rep_Item (Id : E) return N; + function Float_Rep (Id : E) return F; function Freeze_Node (Id : E) return N; function From_With_Type (Id : E) return B; function Full_View (Id : E) return E; *************** package Einfo is *** 5769,5774 **** --- 5993,5999 ---- function Has_Controlled_Component (Id : E) return B; function Has_Controlling_Result (Id : E) return B; function Has_Convention_Pragma (Id : E) return B; + function Has_Delayed_Aspects (Id : E) return B; function Has_Delayed_Freeze (Id : E) return B; function Has_Discriminants (Id : E) return B; function Has_Dispatch_Table (Id : E) return B; *************** package Einfo is *** 5778,5784 **** --- 6003,6011 ---- function Has_Fully_Qualified_Name (Id : E) return B; function Has_Gigi_Rep_Item (Id : E) return B; function Has_Homonym (Id : E) return B; + function Has_Inheritable_Invariants (Id : E) return B; function Has_Initial_Value (Id : E) return B; + function Has_Invariants (Id : E) return B; function Has_Interrupt_Handler (Id : E) return B; function Has_Machine_Radix_Clause (Id : E) return B; function Has_Master_Entity (Id : E) return B; *************** package Einfo is *** 5795,5800 **** --- 6022,6028 ---- function Has_Pragma_Elaborate_Body (Id : E) return B; function Has_Pragma_Inline (Id : E) return B; function Has_Pragma_Inline_Always (Id : E) return B; + function Has_Pragma_Ordered (Id : E) return B; function Has_Pragma_Pack (Id : E) return B; function Has_Pragma_Preelab_Init (Id : E) return B; function Has_Pragma_Pure (Id : E) return B; *************** package Einfo is *** 5803,5808 **** --- 6031,6037 ---- function Has_Pragma_Unmodified (Id : E) return B; function Has_Pragma_Unreferenced (Id : E) return B; function Has_Pragma_Unreferenced_Objects (Id : E) return B; + function Has_Predicates (Id : E) return B; function Has_Primitive_Operations (Id : E) return B; function Has_Qualified_Name (Id : E) return B; function Has_RACW (Id : E) return B; *************** package Einfo is *** 5827,5845 **** function Has_Xref_Entry (Id : E) return B; function Hiding_Loop_Variable (Id : E) return E; function Homonym (Id : E) return E; - function Implemented_By_Entry (Id : E) return B; function In_Package_Body (Id : E) return B; function In_Private_Part (Id : E) return B; function In_Use (Id : E) return B; function Inner_Instances (Id : E) return L; - function Interfaces (Id : E) return L; function Interface_Alias (Id : E) return E; function Interface_Name (Id : E) return N; function Is_AST_Entry (Id : E) return B; function Is_Abstract_Subprogram (Id : E) return B; function Is_Abstract_Type (Id : E) return B; function Is_Access_Constant (Id : E) return B; function Is_Ada_2005_Only (Id : E) return B; function Is_Aliased (Id : E) return B; function Is_Asynchronous (Id : E) return B; function Is_Atomic (Id : E) return B; --- 6056,6074 ---- function Has_Xref_Entry (Id : E) return B; function Hiding_Loop_Variable (Id : E) return E; function Homonym (Id : E) return E; function In_Package_Body (Id : E) return B; function In_Private_Part (Id : E) return B; function In_Use (Id : E) return B; function Inner_Instances (Id : E) return L; function Interface_Alias (Id : E) return E; + function Interfaces (Id : E) return L; function Interface_Name (Id : E) return N; function Is_AST_Entry (Id : E) return B; function Is_Abstract_Subprogram (Id : E) return B; function Is_Abstract_Type (Id : E) return B; function Is_Access_Constant (Id : E) return B; function Is_Ada_2005_Only (Id : E) return B; + function Is_Ada_2012_Only (Id : E) return B; function Is_Aliased (Id : E) return B; function Is_Asynchronous (Id : E) return B; function Is_Atomic (Id : E) return B; *************** package Einfo is *** 5900,5906 **** function Is_Private_Composite (Id : E) return B; function Is_Private_Descendant (Id : E) return B; function Is_Private_Primitive (Id : E) return B; - function Is_Protected_Interface (Id : E) return B; function Is_Public (Id : E) return B; function Is_Pure (Id : E) return B; function Is_Pure_Unit_Access_Type (Id : E) return B; --- 6129,6134 ---- *************** package Einfo is *** 5912,5921 **** function Is_Return_Object (Id : E) return B; function Is_Shared_Passive (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; function Is_Tagged_Type (Id : E) return B; - function Is_Task_Interface (Id : E) return B; function Is_Thunk (Id : E) return B; function Is_Trivial_Subprogram (Id : E) return B; function Is_True_Constant (Id : E) return B; --- 6140,6147 ---- *************** package Einfo is *** 5970,5976 **** function Packed_Array_Type (Id : E) return E; function Parent_Subtype (Id : E) return E; function Postcondition_Proc (Id : E) return E; ! function Primitive_Operations (Id : E) return L; function Prival (Id : E) return E; function Prival_Link (Id : E) return E; function Private_Dependents (Id : E) return L; --- 6196,6203 ---- function Packed_Array_Type (Id : E) return E; function Parent_Subtype (Id : E) return E; function Postcondition_Proc (Id : E) return E; ! function PPC_Wrapper (Id : E) return E; ! function Direct_Primitive_Operations (Id : E) return L; function Prival (Id : E) return E; function Prival_Link (Id : E) return E; function Private_Dependents (Id : E) return L; *************** package Einfo is *** 5983,5989 **** function Referenced (Id : E) return B; function Referenced_As_LHS (Id : E) return B; function Referenced_As_Out_Parameter (Id : E) return B; - function Referenced_Object (Id : E) return N; function Register_Exception_Call (Id : E) return N; function Related_Array_Object (Id : E) return E; function Related_Expression (Id : E) return N; --- 6210,6215 ---- *************** package Einfo is *** 6011,6016 **** --- 6237,6243 ---- function Small_Value (Id : E) return R; function Spec_Entity (Id : E) return E; function Spec_PPC_List (Id : E) return N; + function Static_Predicate (Id : E) return S; function Storage_Size_Variable (Id : E) return E; function Static_Elaboration_Desired (Id : E) return B; function Static_Initialization (Id : E) return N; *************** package Einfo is *** 6018,6023 **** --- 6245,6251 ---- function Strict_Alignment (Id : E) return B; function String_Literal_Length (Id : E) return U; function String_Literal_Low_Bound (Id : E) return N; + function Subprograms_For_Type (Id : E) return E; function Suppress_Elaboration_Warnings (Id : E) return B; function Suppress_Init_Proc (Id : E) return B; function Suppress_Style_Checks (Id : E) return B; *************** package Einfo is *** 6051,6056 **** --- 6279,6285 ---- function Is_Access_Type (Id : E) return B; function Is_Access_Protected_Subprogram_Type (Id : E) return B; function Is_Access_Subprogram_Type (Id : E) return B; + function Is_Aggregate_Type (Id : E) return B; function Is_Array_Type (Id : E) return B; function Is_Assignable (Id : E) return B; function Is_Class_Wide_Type (Id : E) return B; *************** package Einfo is *** 6085,6091 **** function Is_Object (Id : E) return B; function Is_Ordinary_Fixed_Point_Type (Id : E) return B; function Is_Overloadable (Id : E) return B; - function Is_Overriding_Operation (Id : E) return B; function Is_Private_Type (Id : E) return B; function Is_Protected_Type (Id : E) return B; function Is_Real_Type (Id : E) return B; --- 6314,6319 ---- *************** package Einfo is *** 6104,6109 **** --- 6332,6338 ---- -- so they do not correspond to defined fields in the entity itself. function Address_Clause (Id : E) return N; + function Aft_Value (Id : E) return U; function Alignment_Clause (Id : E) return N; function Base_Type (Id : E) return E; function Declaration_Node (Id : E) return N; *************** package Einfo is *** 6118,6123 **** --- 6347,6353 ---- function Has_Private_Ancestor (Id : E) return B; function Has_Private_Declaration (Id : E) return B; function Implementation_Base_Type (Id : E) return E; + function Is_Base_Type (Id : E) return B; function Is_Boolean_Type (Id : E) return B; function Is_Constant_Object (Id : E) return B; function Is_Discriminal (Id : E) return B; *************** package Einfo is *** 6125,6135 **** --- 6355,6377 ---- function Is_Package_Or_Generic_Package (Id : E) return B; function Is_Prival (Id : E) return B; function Is_Protected_Component (Id : E) return B; + function Is_Protected_Interface (Id : E) return B; function Is_Protected_Record_Type (Id : E) return B; function Is_Standard_Character_Type (Id : E) return B; function Is_String_Type (Id : E) return B; + function Is_Synchronized_Interface (Id : E) return B; + function Is_Task_Interface (Id : E) return B; function Is_Task_Record_Type (Id : E) return B; function Is_Wrapper_Package (Id : E) return B; + function Last_Formal (Id : E) return E; + function Machine_Emax_Value (Id : E) return U; + function Machine_Emin_Value (Id : E) return U; + function Machine_Mantissa_Value (Id : E) return U; + function Machine_Radix_Value (Id : E) return U; + function Model_Emin_Value (Id : E) return U; + function Model_Epsilon_Value (Id : E) return R; + function Model_Mantissa_Value (Id : E) return U; + function Model_Small_Value (Id : E) return R; function Next_Component (Id : E) return E; function Next_Component_Or_Discriminant (Id : E) return E; function Next_Discriminant (Id : E) return E; *************** package Einfo is *** 6140,6147 **** function Number_Dimensions (Id : E) return Pos; function Number_Entries (Id : E) return Nat; function Number_Formals (Id : E) return Pos; - function Root_Type (Id : E) return E; function Parameter_Mode (Id : E) return Formal_Kind; function Scope_Depth_Set (Id : E) return B; function Size_Clause (Id : E) return N; function Stream_Size_Clause (Id : E) return N; --- 6382,6393 ---- function Number_Dimensions (Id : E) return Pos; function Number_Entries (Id : E) return Nat; function Number_Formals (Id : E) return Pos; function Parameter_Mode (Id : E) return Formal_Kind; + function Primitive_Operations (Id : E) return L; + function Root_Type (Id : E) return E; + function Safe_Emax_Value (Id : E) return U; + function Safe_First_Value (Id : E) return R; + function Safe_Last_Value (Id : E) return R; function Scope_Depth_Set (Id : E) return B; function Size_Clause (Id : E) return N; function Stream_Size_Clause (Id : E) return N; *************** package Einfo is *** 6159,6165 **** -- predicate is true only if the value is set (Known) and is set to a -- compile time known value. Note that in the case of Alignment and -- Normalized_First_Bit, dynamic values are not possible, so we do not ! -- need a separate Known_Static calls in these cases. The not set (unknown -- values are as follows: -- Alignment Uint_0 or No_Uint --- 6405,6411 ---- -- predicate is true only if the value is set (Known) and is set to a -- compile time known value. Note that in the case of Alignment and -- Normalized_First_Bit, dynamic values are not possible, so we do not ! -- need a separate Known_Static calls in these cases. The not set (unknown) -- values are as follows: -- Alignment Uint_0 or No_Uint *************** package Einfo is *** 6179,6184 **** --- 6425,6437 ---- -- value is always known static for discrete types (and no other types can -- have an RM_Size value of zero). + -- In two cases, Known_Static_Esize and Known_Static_RM_Size, there is one + -- more consideration, which is that we always return False for generic + -- types. Within a template, the size can look known, because of the fake + -- size values we put in template types, but they are not really known and + -- anyone testing if they are known within the template should get False as + -- a result to prevent incorrect assumptions. + function Known_Alignment (E : Entity_Id) return B; function Known_Component_Bit_Offset (E : Entity_Id) return B; function Known_Component_Size (E : Entity_Id) return B; *************** package Einfo is *** 6238,6243 **** --- 6491,6497 ---- procedure Set_Corresponding_Concurrent_Type (Id : E; V : E); procedure Set_Corresponding_Discriminant (Id : E; V : E); procedure Set_Corresponding_Equality (Id : E; V : E); + procedure Set_Corresponding_Protected_Entry (Id : E; V : E); procedure Set_Corresponding_Record_Type (Id : E; V : E); procedure Set_Corresponding_Remote_Type (Id : E; V : E); procedure Set_Current_Use_Clause (Id : E; V : E); *************** package Einfo is *** 6291,6301 **** --- 6545,6557 ---- procedure Set_Finalization_Chain_Entity (Id : E; V : E); procedure Set_Finalize_Storage_Only (Id : E; V : B := True); procedure Set_First_Entity (Id : E; V : E); + procedure Set_First_Exit_Statement (Id : E; V : N); procedure Set_First_Index (Id : E; V : N); procedure Set_First_Literal (Id : E; V : E); procedure Set_First_Optional_Parameter (Id : E; V : E); procedure Set_First_Private_Entity (Id : E; V : E); procedure Set_First_Rep_Item (Id : E; V : N); + procedure Set_Float_Rep (Id : E; V : F); procedure Set_Freeze_Node (Id : E; V : N); procedure Set_From_With_Type (Id : E; V : B := True); procedure Set_Full_View (Id : E; V : E); *************** package Einfo is *** 6317,6322 **** --- 6573,6579 ---- procedure Set_Has_Controlled_Component (Id : E; V : B := True); procedure Set_Has_Controlling_Result (Id : E; V : B := True); procedure Set_Has_Convention_Pragma (Id : E; V : B := True); + procedure Set_Has_Delayed_Aspects (Id : E; V : B := True); procedure Set_Has_Delayed_Freeze (Id : E; V : B := True); procedure Set_Has_Discriminants (Id : E; V : B := True); procedure Set_Has_Dispatch_Table (Id : E; V : B := True); *************** package Einfo is *** 6326,6332 **** --- 6583,6591 ---- procedure Set_Has_Fully_Qualified_Name (Id : E; V : B := True); procedure Set_Has_Gigi_Rep_Item (Id : E; V : B := True); procedure Set_Has_Homonym (Id : E; V : B := True); + procedure Set_Has_Inheritable_Invariants (Id : E; V : B := True); procedure Set_Has_Initial_Value (Id : E; V : B := True); + procedure Set_Has_Invariants (Id : E; V : B := True); procedure Set_Has_Machine_Radix_Clause (Id : E; V : B := True); procedure Set_Has_Master_Entity (Id : E; V : B := True); procedure Set_Has_Missing_Return (Id : E; V : B := True); *************** package Einfo is *** 6342,6347 **** --- 6601,6607 ---- procedure Set_Has_Pragma_Elaborate_Body (Id : E; V : B := True); procedure Set_Has_Pragma_Inline (Id : E; V : B := True); procedure Set_Has_Pragma_Inline_Always (Id : E; V : B := True); + procedure Set_Has_Pragma_Ordered (Id : E; V : B := True); procedure Set_Has_Pragma_Pack (Id : E; V : B := True); procedure Set_Has_Pragma_Preelab_Init (Id : E; V : B := True); procedure Set_Has_Pragma_Pure (Id : E; V : B := True); *************** package Einfo is *** 6350,6355 **** --- 6610,6616 ---- procedure Set_Has_Pragma_Unmodified (Id : E; V : B := True); procedure Set_Has_Pragma_Unreferenced (Id : E; V : B := True); procedure Set_Has_Pragma_Unreferenced_Objects (Id : E; V : B := True); + procedure Set_Has_Predicates (Id : E; V : B := True); procedure Set_Has_Primitive_Operations (Id : E; V : B := True); procedure Set_Has_Private_Declaration (Id : E; V : B := True); procedure Set_Has_Qualified_Name (Id : E; V : B := True); *************** package Einfo is *** 6375,6381 **** procedure Set_Has_Xref_Entry (Id : E; V : B := True); procedure Set_Hiding_Loop_Variable (Id : E; V : E); procedure Set_Homonym (Id : E; V : E); - procedure Set_Implemented_By_Entry (Id : E; V : B := True); procedure Set_Interfaces (Id : E; V : L); procedure Set_In_Package_Body (Id : E; V : B := True); procedure Set_In_Private_Part (Id : E; V : B := True); --- 6636,6641 ---- *************** package Einfo is *** 6388,6393 **** --- 6648,6654 ---- procedure Set_Is_Abstract_Type (Id : E; V : B := True); procedure Set_Is_Access_Constant (Id : E; V : B := True); procedure Set_Is_Ada_2005_Only (Id : E; V : B := True); + procedure Set_Is_Ada_2012_Only (Id : E; V : B := True); procedure Set_Is_Aliased (Id : E; V : B := True); procedure Set_Is_Asynchronous (Id : E; V : B := True); procedure Set_Is_Atomic (Id : E; V : B := True); *************** package Einfo is *** 6444,6450 **** procedure Set_Is_Obsolescent (Id : E; V : B := True); procedure Set_Is_Only_Out_Parameter (Id : E; V : B := True); procedure Set_Is_Optional_Parameter (Id : E; V : B := True); - procedure Set_Is_Overriding_Operation (Id : E; V : B := True); procedure Set_Is_Package_Body_Entity (Id : E; V : B := True); procedure Set_Is_Packed (Id : E; V : B := True); procedure Set_Is_Packed_Array_Type (Id : E; V : B := True); --- 6705,6710 ---- *************** package Einfo is *** 6455,6461 **** procedure Set_Is_Private_Composite (Id : E; V : B := True); procedure Set_Is_Private_Descendant (Id : E; V : B := True); procedure Set_Is_Private_Primitive (Id : E; V : B := True); - procedure Set_Is_Protected_Interface (Id : E; V : B := True); procedure Set_Is_Public (Id : E; V : B := True); procedure Set_Is_Pure (Id : E; V : B := True); procedure Set_Is_Pure_Unit_Access_Type (Id : E; V : B := True); --- 6715,6720 ---- *************** package Einfo is *** 6467,6476 **** procedure Set_Is_Return_Object (Id : E; V : B := True); procedure Set_Is_Shared_Passive (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); procedure Set_Is_Tagged_Type (Id : E; V : B := True); - procedure Set_Is_Task_Interface (Id : E; V : B := True); procedure Set_Is_Thunk (Id : E; V : B := True); procedure Set_Is_Trivial_Subprogram (Id : E; V : B := True); procedure Set_Is_True_Constant (Id : E; V : B := True); --- 6726,6733 ---- *************** package Einfo is *** 6525,6531 **** procedure Set_Packed_Array_Type (Id : E; V : E); procedure Set_Parent_Subtype (Id : E; V : E); procedure Set_Postcondition_Proc (Id : E; V : E); ! procedure Set_Primitive_Operations (Id : E; V : L); procedure Set_Prival (Id : E; V : E); procedure Set_Prival_Link (Id : E; V : E); procedure Set_Private_Dependents (Id : E; V : L); --- 6782,6789 ---- procedure Set_Packed_Array_Type (Id : E; V : E); procedure Set_Parent_Subtype (Id : E; V : E); procedure Set_Postcondition_Proc (Id : E; V : E); ! procedure Set_PPC_Wrapper (Id : E; V : E); ! procedure Set_Direct_Primitive_Operations (Id : E; V : L); procedure Set_Prival (Id : E; V : E); procedure Set_Prival_Link (Id : E; V : E); procedure Set_Private_Dependents (Id : E; V : L); *************** package Einfo is *** 6538,6544 **** procedure Set_Referenced (Id : E; V : B := True); procedure Set_Referenced_As_LHS (Id : E; V : B := True); procedure Set_Referenced_As_Out_Parameter (Id : E; V : B := True); - procedure Set_Referenced_Object (Id : E; V : N); procedure Set_Register_Exception_Call (Id : E; V : N); procedure Set_Related_Array_Object (Id : E; V : E); procedure Set_Related_Expression (Id : E; V : N); --- 6796,6801 ---- *************** package Einfo is *** 6566,6571 **** --- 6823,6829 ---- 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_Static_Predicate (Id : E; V : S); 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); *************** package Einfo is *** 6573,6578 **** --- 6831,6837 ---- procedure Set_Strict_Alignment (Id : E; V : B := True); procedure Set_String_Literal_Length (Id : E; V : U); procedure Set_String_Literal_Low_Bound (Id : E; V : N); + procedure Set_Subprograms_For_Type (Id : E; V : E); procedure Set_Suppress_Elaboration_Warnings (Id : E; V : B := True); procedure Set_Suppress_Init_Proc (Id : E; V : B := True); procedure Set_Suppress_Style_Checks (Id : E; V : B := True); *************** package Einfo is *** 6585,6591 **** procedure Set_Unset_Reference (Id : E; V : N); procedure Set_Used_As_Generic_Actual (Id : E; V : B := True); procedure Set_Uses_Sec_Stack (Id : E; V : B := True); - procedure Set_Vax_Float (Id : E; V : B := True); procedure Set_Warnings_Off (Id : E; V : B := True); procedure Set_Warnings_Off_Used (Id : E; V : B := True); procedure Set_Warnings_Off_Used_Unmodified (Id : E; V : B := True); --- 6844,6849 ---- *************** package Einfo is *** 6593,6598 **** --- 6851,6866 ---- procedure Set_Was_Hidden (Id : E; V : B := True); procedure Set_Wrapped_Entity (Id : E; V : E); + --------------------------------------------------- + -- Access to Subprograms in Subprograms_For_Type -- + --------------------------------------------------- + + function Invariant_Procedure (Id : E) return N; + function Predicate_Function (Id : E) return N; + + procedure Set_Invariant_Procedure (Id : E; V : E); + procedure Set_Predicate_Function (Id : E; V : E); + ----------------------------------- -- Field Initialization Routines -- ----------------------------------- *************** package Einfo is *** 6741,6753 **** -- Subprograms for Accessing Rep Item Chain -- ---------------------------------------------- ! -- The First_Rep_Item field of every entity points to a linked list ! -- (linked through Next_Rep_Item) of representation pragmas and attribute ! -- definition clauses that apply to the item. Note that in the case of ! -- types, it is assumed that any such rep items for a base type also apply ! -- to all subtypes. This is implemented by having the chain for subtypes ! -- link onto the chain for the base type, so that any new entries for the ! -- subtype are added at the start of the chain. function Get_Attribute_Definition_Clause (E : Entity_Id; --- 7009,7025 ---- -- Subprograms for Accessing Rep Item Chain -- ---------------------------------------------- ! -- The First_Rep_Item field of every entity points to a linked list (linked ! -- through Next_Rep_Item) of representation pragmas, attribute definition ! -- clauses, representation clauses, and aspect specifications that apply to ! -- the item. Note that in the case of types, it is assumed that any such ! -- rep items for a base type also apply to all subtypes. This is achieved ! -- by having the chain for subtypes link onto the chain for the base type, ! -- so that new entries for the subtype are added at the start of the chain. ! -- ! -- Note: aspect specification nodes are linked only when evaluation of the ! -- expression is deferred to the freeze point. For further details see ! -- Sem_Ch13.Analyze_Aspect_Specifications. function Get_Attribute_Definition_Clause (E : Entity_Id; *************** package Einfo is *** 6757,6762 **** --- 7029,7049 ---- -- value returned is the N_Attribute_Definition_Clause node, otherwise -- Empty is returned. + function Get_Rep_Item_For_Entity + (E : Entity_Id; + Nam : Name_Id) return Node_Id; + -- Searches the Rep_Item chain for a given entity E, for an instance of a + -- rep item (pragma, attribute definition clause, or aspect specification) + -- whose name matches the given name. If one is found, it is returned, + -- otherwise Empty is returned. Unlike the other Get routines for the + -- Rep_Item chain, this only returns items whose entity matches E (it + -- does not return items from the parent chain). + + function Get_Record_Representation_Clause (E : Entity_Id) return Node_Id; + -- Searches the Rep_Item chain for a given entity E, for a record + -- representation clause, and if found, returns it. Returns Empty + -- if no such clause is found. + function Get_Rep_Pragma (E : Entity_Id; Nam : Name_Id) return Node_Id; -- Searches the Rep_Item chain for the given entity E, for an instance -- a representation pragma with the given name Nam. If found then the *************** package Einfo is *** 6775,6789 **** -- is returned, otherwise False indicates that no matching entry was found. procedure Record_Rep_Item (E : Entity_Id; N : Node_Id); ! -- N is the node for either a representation pragma or an attribute ! -- definition clause that applies to entity E. This procedure links the ! -- node N onto the Rep_Item chain for entity E. Note that it is an error to ! -- call this procedure with E being overloadable, and N being a pragma that ! -- can apply to multiple overloadable entities (i.e. Convention, Interface, ! -- Inline, Inline_Always, Import, Export, External). This is not allowed ! -- even if in fact the entity is not overloaded, since we can't rely on ! -- it being present in the overloaded case, it is not useful to have it ! -- present in the non-overloaded case. ------------------------------- -- Miscellaneous Subprograms -- --- 7062,7076 ---- -- is returned, otherwise False indicates that no matching entry was found. procedure Record_Rep_Item (E : Entity_Id; N : Node_Id); ! -- N is the node for a representation pragma, representation clause, an ! -- attribute definition clause, or an aspect specification that applies to ! -- entity E. This procedure links the node N onto the Rep_Item chain for ! -- entity E. Note that it is an error to call this procedure with E being ! -- overloadable, and N being a pragma that applies to multiple overloadable ! -- entities (Convention, Interface, Inline, Inline_Always, Import, Export, ! -- External). This is not allowed even in the case where the entity is not ! -- overloaded, since we can't rely on it being present in the overloaded ! -- case, it is not useful to have it present in the non-overloaded case. ------------------------------- -- Miscellaneous Subprograms -- *************** package Einfo is *** 6793,6801 **** -- Add an entity to the list of entities declared in the scope V function Get_Full_View (T : Entity_Id) return Entity_Id; ! -- If T is an incomplete type and the full declaration has been ! -- seen, or is the name of a class_wide type whose root is incomplete. ! -- return the corresponding full declaration. function Is_Entity_Name (N : Node_Id) return Boolean; -- Test if the node N is the name of an entity (i.e. is an identifier, --- 7080,7088 ---- -- Add an entity to the list of entities declared in the scope V function Get_Full_View (T : Entity_Id) return Entity_Id; ! -- If T is an incomplete type and the full declaration has been seen, or ! -- is the name of a class_wide type whose root is incomplete, return the ! -- corresponding full declaration, else return T itself. function Is_Entity_Name (N : Node_Id) return Boolean; -- Test if the node N is the name of an entity (i.e. is an identifier, *************** package Einfo is *** 6851,6859 **** procedure Write_Field26_Name (Id : Entity_Id); procedure Write_Field27_Name (Id : Entity_Id); procedure Write_Field28_Name (Id : Entity_Id); ! -- These routines are used to output a nice symbolic name for the given ! -- field, depending on the Ekind. No blanks or end of lines are output, ! -- just the characters of the field name. -------------------- -- Inline Pragmas -- --- 7138,7147 ---- procedure Write_Field26_Name (Id : Entity_Id); procedure Write_Field27_Name (Id : Entity_Id); procedure Write_Field28_Name (Id : Entity_Id); ! procedure Write_Field29_Name (Id : Entity_Id); ! -- These routines are used in Treepr to output a nice symbolic name for ! -- the given field, depending on the Ekind. No blanks or end of lines are ! -- output, just the characters of the field name. -------------------- -- Inline Pragmas -- *************** package Einfo is *** 6891,6896 **** --- 7179,7185 ---- pragma Inline (Corresponding_Concurrent_Type); pragma Inline (Corresponding_Discriminant); pragma Inline (Corresponding_Equality); + pragma Inline (Corresponding_Protected_Entry); pragma Inline (Corresponding_Record_Type); pragma Inline (Corresponding_Remote_Type); pragma Inline (Current_Use_Clause); *************** package Einfo is *** 6911,6916 **** --- 7200,7206 ---- pragma Inline (Dependent_Instances); pragma Inline (Depends_On_Private); pragma Inline (Digits_Value); + pragma Inline (Direct_Primitive_Operations); pragma Inline (Directly_Designated_Type); pragma Inline (Discard_Names); pragma Inline (Discriminal); *************** package Einfo is *** 6945,6950 **** --- 7235,7241 ---- pragma Inline (Can_Use_Internal_Rep); pragma Inline (Finalization_Chain_Entity); pragma Inline (First_Entity); + pragma Inline (First_Exit_Statement); pragma Inline (First_Index); pragma Inline (First_Literal); pragma Inline (First_Optional_Parameter); *************** package Einfo is *** 6971,6976 **** --- 7262,7268 ---- pragma Inline (Has_Controlled_Component); pragma Inline (Has_Controlling_Result); pragma Inline (Has_Convention_Pragma); + pragma Inline (Has_Delayed_Aspects); pragma Inline (Has_Delayed_Freeze); pragma Inline (Has_Discriminants); pragma Inline (Has_Dispatch_Table); *************** package Einfo is *** 6980,6986 **** --- 7272,7280 ---- pragma Inline (Has_Fully_Qualified_Name); pragma Inline (Has_Gigi_Rep_Item); pragma Inline (Has_Homonym); + pragma Inline (Has_Inheritable_Invariants); pragma Inline (Has_Initial_Value); + pragma Inline (Has_Invariants); pragma Inline (Has_Machine_Radix_Clause); pragma Inline (Has_Master_Entity); pragma Inline (Has_Missing_Return); *************** package Einfo is *** 6995,7000 **** --- 7289,7295 ---- pragma Inline (Has_Pragma_Elaborate_Body); pragma Inline (Has_Pragma_Inline); pragma Inline (Has_Pragma_Inline_Always); + pragma Inline (Has_Pragma_Ordered); pragma Inline (Has_Pragma_Pack); pragma Inline (Has_Pragma_Preelab_Init); pragma Inline (Has_Pragma_Pure); *************** package Einfo is *** 7003,7008 **** --- 7298,7304 ---- pragma Inline (Has_Pragma_Unmodified); pragma Inline (Has_Pragma_Unreferenced); pragma Inline (Has_Pragma_Unreferenced_Objects); + pragma Inline (Has_Predicates); pragma Inline (Has_Primitive_Operations); pragma Inline (Has_Private_Declaration); pragma Inline (Has_Qualified_Name); *************** package Einfo is *** 7029,7035 **** pragma Inline (Has_Xref_Entry); pragma Inline (Hiding_Loop_Variable); pragma Inline (Homonym); - pragma Inline (Implemented_By_Entry); pragma Inline (Interfaces); pragma Inline (In_Package_Body); pragma Inline (In_Private_Part); --- 7325,7330 ---- *************** package Einfo is *** 7042,7050 **** --- 7337,7347 ---- pragma Inline (Is_Abstract_Type); pragma Inline (Is_Access_Constant); pragma Inline (Is_Ada_2005_Only); + pragma Inline (Is_Ada_2012_Only); pragma Inline (Is_Access_Type); pragma Inline (Is_Access_Protected_Subprogram_Type); pragma Inline (Is_Access_Subprogram_Type); + pragma Inline (Is_Aggregate_Type); pragma Inline (Is_Aliased); pragma Inline (Is_Array_Type); pragma Inline (Is_Assignable); *************** package Einfo is *** 7130,7136 **** pragma Inline (Is_Package_Body_Entity); pragma Inline (Is_Ordinary_Fixed_Point_Type); pragma Inline (Is_Overloadable); - pragma Inline (Is_Overriding_Operation); pragma Inline (Is_Packed); pragma Inline (Is_Packed_Array_Type); pragma Inline (Is_Potentially_Use_Visible); --- 7427,7432 ---- *************** package Einfo is *** 7141,7147 **** pragma Inline (Is_Private_Descendant); pragma Inline (Is_Private_Primitive); pragma Inline (Is_Private_Type); - pragma Inline (Is_Protected_Interface); pragma Inline (Is_Protected_Type); pragma Inline (Is_Public); pragma Inline (Is_Pure); --- 7437,7442 ---- *************** package Einfo is *** 7159,7168 **** pragma Inline (Is_Signed_Integer_Type); pragma Inline (Is_Statically_Allocated); pragma Inline (Is_Subprogram); - pragma Inline (Is_Synchronized_Interface); pragma Inline (Is_Tag); pragma Inline (Is_Tagged_Type); - pragma Inline (Is_Task_Interface); pragma Inline (Is_True_Constant); pragma Inline (Is_Task_Type); pragma Inline (Is_Thunk); --- 7454,7461 ---- *************** package Einfo is *** 7221,7227 **** pragma Inline (Parameter_Mode); pragma Inline (Parent_Subtype); pragma Inline (Postcondition_Proc); ! pragma Inline (Primitive_Operations); pragma Inline (Prival); pragma Inline (Prival_Link); pragma Inline (Private_Dependents); --- 7514,7520 ---- pragma Inline (Parameter_Mode); pragma Inline (Parent_Subtype); pragma Inline (Postcondition_Proc); ! pragma Inline (PPC_Wrapper); pragma Inline (Prival); pragma Inline (Prival_Link); pragma Inline (Private_Dependents); *************** package Einfo is *** 7234,7240 **** pragma Inline (Referenced); pragma Inline (Referenced_As_LHS); pragma Inline (Referenced_As_Out_Parameter); - pragma Inline (Referenced_Object); pragma Inline (Register_Exception_Call); pragma Inline (Related_Array_Object); pragma Inline (Related_Expression); --- 7527,7532 ---- *************** package Einfo is *** 7262,7267 **** --- 7554,7560 ---- pragma Inline (Small_Value); pragma Inline (Spec_Entity); pragma Inline (Spec_PPC_List); + pragma Inline (Static_Predicate); pragma Inline (Storage_Size_Variable); pragma Inline (Static_Elaboration_Desired); pragma Inline (Static_Initialization); *************** package Einfo is *** 7269,7274 **** --- 7562,7568 ---- pragma Inline (Strict_Alignment); pragma Inline (String_Literal_Length); pragma Inline (String_Literal_Low_Bound); + pragma Inline (Subprograms_For_Type); pragma Inline (Suppress_Elaboration_Warnings); pragma Inline (Suppress_Init_Proc); pragma Inline (Suppress_Style_Checks); *************** package Einfo is *** 7281,7287 **** pragma Inline (Unset_Reference); pragma Inline (Used_As_Generic_Actual); pragma Inline (Uses_Sec_Stack); - pragma Inline (Vax_Float); pragma Inline (Warnings_Off); pragma Inline (Warnings_Off_Used); pragma Inline (Warnings_Off_Used_Unmodified); --- 7575,7580 ---- *************** package Einfo is *** 7323,7328 **** --- 7616,7622 ---- pragma Inline (Set_Corresponding_Concurrent_Type); pragma Inline (Set_Corresponding_Discriminant); pragma Inline (Set_Corresponding_Equality); + pragma Inline (Set_Corresponding_Protected_Entry); pragma Inline (Set_Corresponding_Record_Type); pragma Inline (Set_Corresponding_Remote_Type); pragma Inline (Set_Current_Use_Clause); *************** package Einfo is *** 7344,7349 **** --- 7638,7644 ---- pragma Inline (Set_Dependent_Instances); pragma Inline (Set_Depends_On_Private); pragma Inline (Set_Digits_Value); + pragma Inline (Set_Direct_Primitive_Operations); pragma Inline (Set_Directly_Designated_Type); pragma Inline (Set_Discard_Names); pragma Inline (Set_Discriminal); *************** package Einfo is *** 7376,7381 **** --- 7671,7677 ---- pragma Inline (Set_Can_Use_Internal_Rep); pragma Inline (Set_Finalization_Chain_Entity); pragma Inline (Set_First_Entity); + pragma Inline (Set_First_Exit_Statement); pragma Inline (Set_First_Index); pragma Inline (Set_First_Literal); pragma Inline (Set_First_Optional_Parameter); *************** package Einfo is *** 7402,7407 **** --- 7698,7704 ---- pragma Inline (Set_Has_Controlled_Component); pragma Inline (Set_Has_Controlling_Result); pragma Inline (Set_Has_Convention_Pragma); + pragma Inline (Set_Has_Delayed_Aspects); pragma Inline (Set_Has_Delayed_Freeze); pragma Inline (Set_Has_Discriminants); pragma Inline (Set_Has_Dispatch_Table); *************** package Einfo is *** 7411,7417 **** --- 7708,7716 ---- pragma Inline (Set_Has_Fully_Qualified_Name); pragma Inline (Set_Has_Gigi_Rep_Item); pragma Inline (Set_Has_Homonym); + pragma Inline (Set_Has_Inheritable_Invariants); pragma Inline (Set_Has_Initial_Value); + pragma Inline (Set_Has_Invariants); pragma Inline (Set_Has_Machine_Radix_Clause); pragma Inline (Set_Has_Master_Entity); pragma Inline (Set_Has_Missing_Return); *************** package Einfo is *** 7426,7431 **** --- 7725,7731 ---- pragma Inline (Set_Has_Pragma_Elaborate_Body); pragma Inline (Set_Has_Pragma_Inline); pragma Inline (Set_Has_Pragma_Inline_Always); + pragma Inline (Set_Has_Pragma_Ordered); pragma Inline (Set_Has_Pragma_Pack); pragma Inline (Set_Has_Pragma_Preelab_Init); pragma Inline (Set_Has_Pragma_Pure); *************** package Einfo is *** 7434,7439 **** --- 7734,7740 ---- pragma Inline (Set_Has_Pragma_Unmodified); pragma Inline (Set_Has_Pragma_Unreferenced); pragma Inline (Set_Has_Pragma_Unreferenced_Objects); + pragma Inline (Set_Has_Predicates); pragma Inline (Set_Has_Primitive_Operations); pragma Inline (Set_Has_Private_Declaration); pragma Inline (Set_Has_Qualified_Name); *************** package Einfo is *** 7460,7466 **** pragma Inline (Set_Has_Xref_Entry); pragma Inline (Set_Hiding_Loop_Variable); pragma Inline (Set_Homonym); - pragma Inline (Set_Implemented_By_Entry); pragma Inline (Set_Interfaces); pragma Inline (Set_In_Package_Body); pragma Inline (Set_In_Private_Part); --- 7761,7766 ---- *************** package Einfo is *** 7473,7478 **** --- 7773,7779 ---- pragma Inline (Set_Is_Abstract_Type); pragma Inline (Set_Is_Access_Constant); pragma Inline (Set_Is_Ada_2005_Only); + pragma Inline (Set_Is_Ada_2012_Only); pragma Inline (Set_Is_Aliased); pragma Inline (Set_Is_Asynchronous); pragma Inline (Set_Is_Atomic); *************** package Einfo is *** 7529,7535 **** pragma Inline (Set_Is_Obsolescent); pragma Inline (Set_Is_Only_Out_Parameter); pragma Inline (Set_Is_Optional_Parameter); - pragma Inline (Set_Is_Overriding_Operation); pragma Inline (Set_Is_Package_Body_Entity); pragma Inline (Set_Is_Packed); pragma Inline (Set_Is_Packed_Array_Type); --- 7830,7835 ---- *************** package Einfo is *** 7540,7546 **** pragma Inline (Set_Is_Private_Composite); pragma Inline (Set_Is_Private_Descendant); pragma Inline (Set_Is_Private_Primitive); - pragma Inline (Set_Is_Protected_Interface); pragma Inline (Set_Is_Public); pragma Inline (Set_Is_Pure); pragma Inline (Set_Is_Pure_Unit_Access_Type); --- 7840,7845 ---- *************** package Einfo is *** 7552,7561 **** pragma Inline (Set_Is_Return_Object); pragma Inline (Set_Is_Shared_Passive); pragma Inline (Set_Is_Statically_Allocated); - pragma Inline (Set_Is_Synchronized_Interface); pragma Inline (Set_Is_Tag); pragma Inline (Set_Is_Tagged_Type); - pragma Inline (Set_Is_Task_Interface); pragma Inline (Set_Is_Thunk); pragma Inline (Set_Is_Trivial_Subprogram); pragma Inline (Set_Is_True_Constant); --- 7851,7858 ---- *************** package Einfo is *** 7610,7616 **** pragma Inline (Set_Packed_Array_Type); pragma Inline (Set_Parent_Subtype); pragma Inline (Set_Postcondition_Proc); ! pragma Inline (Set_Primitive_Operations); pragma Inline (Set_Prival); pragma Inline (Set_Prival_Link); pragma Inline (Set_Private_Dependents); --- 7907,7913 ---- pragma Inline (Set_Packed_Array_Type); pragma Inline (Set_Parent_Subtype); pragma Inline (Set_Postcondition_Proc); ! pragma Inline (Set_PPC_Wrapper); pragma Inline (Set_Prival); pragma Inline (Set_Prival_Link); pragma Inline (Set_Private_Dependents); *************** package Einfo is *** 7623,7629 **** pragma Inline (Set_Referenced); pragma Inline (Set_Referenced_As_LHS); pragma Inline (Set_Referenced_As_Out_Parameter); - pragma Inline (Set_Referenced_Object); pragma Inline (Set_Register_Exception_Call); pragma Inline (Set_Related_Array_Object); pragma Inline (Set_Related_Expression); --- 7920,7925 ---- *************** package Einfo is *** 7650,7655 **** --- 7946,7952 ---- pragma Inline (Set_Small_Value); pragma Inline (Set_Spec_Entity); pragma Inline (Set_Spec_PPC_List); + pragma Inline (Set_Static_Predicate); pragma Inline (Set_Storage_Size_Variable); pragma Inline (Set_Static_Elaboration_Desired); pragma Inline (Set_Static_Initialization); *************** package Einfo is *** 7657,7662 **** --- 7954,7960 ---- pragma Inline (Set_Strict_Alignment); pragma Inline (Set_String_Literal_Length); pragma Inline (Set_String_Literal_Low_Bound); + pragma Inline (Set_Subprograms_For_Type); pragma Inline (Set_Suppress_Elaboration_Warnings); pragma Inline (Set_Suppress_Init_Proc); pragma Inline (Set_Suppress_Style_Checks); *************** package Einfo is *** 7669,7675 **** pragma Inline (Set_Unset_Reference); pragma Inline (Set_Used_As_Generic_Actual); pragma Inline (Set_Uses_Sec_Stack); - pragma Inline (Set_Vax_Float); pragma Inline (Set_Warnings_Off); pragma Inline (Set_Warnings_Off_Used); pragma Inline (Set_Warnings_Off_Used_Unmodified); --- 7967,7972 ---- *************** package Einfo is *** 7686,7691 **** --- 7983,7989 ---- -- things here which are small, but not of the canonical attribute -- access/set format that can be handled by xeinfo. + pragma Inline (Is_Base_Type); pragma Inline (Is_Package_Or_Generic_Package); pragma Inline (Is_Volatile); pragma Inline (Is_Wrapper_Package); diff -Nrcpad gcc-4.5.2/gcc/ada/elists.adb gcc-4.6.0/gcc/ada/elists.adb *** gcc-4.5.2/gcc/ada/elists.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/elists.adb Thu Oct 21 10:30:24 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Elists is *** 389,395 **** -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then - pragma Assert (Nxt = Elmt); Elists.Table (List).First := No_Elmt; --- 389,394 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/env.c gcc-4.6.0/gcc/ada/env.c *** gcc-4.5.2/gcc/ada/env.c Tue Jan 26 09:42:04 2010 --- gcc-4.6.0/gcc/ada/env.c Tue Jun 22 16:57:01 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 2005-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 2005-2010, 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- * *************** typedef struct _ile3 *** 107,115 **** void __gnat_setenv (char *name, char *value) { ! #ifdef MSDOS ! ! #elif defined (VMS) struct descriptor_s name_desc; /* Put in JOB table for now, so that the project stuff at least works. */ struct descriptor_s table_desc = {7, 0, "LNM$JOB"}; --- 107,113 ---- void __gnat_setenv (char *name, char *value) { ! #if defined (VMS) struct descriptor_s name_desc; /* Put in JOB table for now, so that the project stuff at least works. */ struct descriptor_s table_desc = {7, 0, "LNM$JOB"}; diff -Nrcpad gcc-4.5.2/gcc/ada/err_vars.ads gcc-4.6.0/gcc/ada/err_vars.ads *** gcc-4.5.2/gcc/ada/err_vars.ads Thu Apr 30 14:35:22 2009 --- gcc-4.6.0/gcc/ada/err_vars.ads Mon Dec 20 07:26:57 2010 *************** package Err_Vars is *** 35,41 **** -- All of these variables are set when needed, so they do not need to be -- initialized. However, there is code that saves and restores existing -- values, which may malfunction in -gnatVa mode if the variable has never ! -- been iniitalized, so we initialize some variables to avoid exceptions -- from invalid values in such cases. ------------------ --- 35,41 ---- -- All of these variables are set when needed, so they do not need to be -- initialized. However, there is code that saves and restores existing -- values, which may malfunction in -gnatVa mode if the variable has never ! -- been initialized, so we initialize some variables to avoid exceptions -- from invalid values in such cases. ------------------ diff -Nrcpad gcc-4.5.2/gcc/ada/errout.adb gcc-4.6.0/gcc/ada/errout.adb *** gcc-4.5.2/gcc/ada/errout.adb Mon Nov 30 13:58:01 2009 --- gcc-4.6.0/gcc/ada/errout.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Opt; use Opt; *** 43,48 **** --- 43,49 ---- with Nlists; use Nlists; with Output; use Output; with Scans; use Scans; + with Sem_Aux; use Sem_Aux; with Sinput; use Sinput; with Sinfo; use Sinfo; with Snames; use Snames; *************** package body Errout is *** 176,200 **** -- If the message should be generated (the normal case) False is returned. procedure Unwind_Internal_Type (Ent : in out Entity_Id); ! -- This procedure is given an entity id for an internal type, i.e. ! -- a type with an internal name. It unwinds the type to try to get ! -- to something reasonably printable, generating prefixes like ! -- "subtype of", "access to", etc along the way in the buffer. The ! -- value in Ent on return is the final name to be printed. Hopefully ! -- this is not an internal name, but in some internal name cases, it ! -- is an internal name, and has to be printed anyway (although in this ! -- case the message has been killed if possible). The global variable ! -- Class_Flag is set to True if the resulting entity should have ! -- 'Class appended to its name (see Add_Class procedure), and is ! -- otherwise unchanged. procedure VMS_Convert; ! -- This procedure has no effect if called when the host is not OpenVMS. ! -- If the host is indeed OpenVMS, then the error message stored in ! -- Msg_Buffer is scanned for appearances of switch names which need ! -- converting to corresponding VMS qualifier names. See Gnames/Vnames ! -- table in Errout spec for precise definition of the conversion that ! -- is performed by this routine in OpenVMS mode. ----------------------- -- Change_Error_Text -- --- 177,200 ---- -- If the message should be generated (the normal case) False is returned. procedure Unwind_Internal_Type (Ent : in out Entity_Id); ! -- This procedure is given an entity id for an internal type, i.e. a type ! -- with an internal name. It unwinds the type to try to get to something ! -- reasonably printable, generating prefixes like "subtype of", "access ! -- to", etc along the way in the buffer. The value in Ent on return is the ! -- final name to be printed. Hopefully this is not an internal name, but in ! -- some internal name cases, it is an internal name, and has to be printed ! -- anyway (although in this case the message has been killed if possible). ! -- The global variable Class_Flag is set to True if the resulting entity ! -- should have 'Class appended to its name (see Add_Class procedure), and ! -- is otherwise unchanged. procedure VMS_Convert; ! -- This procedure has no effect if called when the host is not OpenVMS. If ! -- the host is indeed OpenVMS, then the error message stored in Msg_Buffer ! -- is scanned for appearances of switch names which need converting to ! -- corresponding VMS qualifier names. See Gnames/Vnames table in Errout ! -- spec for precise definition of the conversion that is performed by this ! -- routine in OpenVMS mode. ----------------------- -- Change_Error_Text -- *************** package body Errout is *** 242,251 **** --------------- -- Error_Msg posts a flag at the given location, except that if the ! -- Flag_Location points within a generic template and corresponds ! -- to an instantiation of this generic template, then the actual ! -- message will be posted on the generic instantiation, along with ! -- additional messages referencing the generic declaration. procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is Sindex : Source_File_Index; --- 242,251 ---- --------------- -- Error_Msg posts a flag at the given location, except that if the ! -- Flag_Location points within a generic template and corresponds to an ! -- instantiation of this generic template, then the actual message will be ! -- posted on the generic instantiation, along with additional messages ! -- referencing the generic declaration. procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is Sindex : Source_File_Index; *************** package body Errout is *** 256,263 **** -- template in instantiation case, otherwise unchanged). begin ! -- It is a fatal error to issue an error message when scanning from ! -- the internal source buffer (see Sinput for further documentation) pragma Assert (Sinput.Source /= Internal_Source_Ptr); --- 256,263 ---- -- template in instantiation case, otherwise unchanged). begin ! -- It is a fatal error to issue an error message when scanning from the ! -- internal source buffer (see Sinput for further documentation) pragma Assert (Sinput.Source /= Internal_Source_Ptr); *************** package body Errout is *** 267,274 **** return; end if; ! -- If we already have messages, and we are trying to place a message ! -- at No_Location or in package Standard, then just ignore the attempt -- since we assume that what is happening is some cascaded junk. Note -- that this is safe in the sense that proceeding will surely bomb. --- 267,274 ---- return; end if; ! -- If we already have messages, and we are trying to place a message at ! -- No_Location or in package Standard, then just ignore the attempt -- since we assume that what is happening is some cascaded junk. Note -- that this is safe in the sense that proceeding will surely bomb. *************** package body Errout is *** 284,307 **** Test_Style_Warning_Serious_Msg (Msg); Orig_Loc := Original_Location (Flag_Location); ! -- If the current location is in an instantiation, the issue arises ! -- of whether to post the message on the template or the instantiation. ! -- The way we decide is to see if we have posted the same message ! -- on the template when we compiled the template (the template is ! -- always compiled before any instantiations). For this purpose, ! -- we use a separate table of messages. The reason we do this is ! -- twofold: -- First, the messages can get changed by various processing -- including the insertion of tokens etc, making it hard to -- do the comparison. ! -- Second, we will suppress a warning on a template if it is ! -- not in the current extended source unit. That's reasonable ! -- and means we don't want the warning on the instantiation ! -- here either, but it does mean that the main error table ! -- would not in any case include the message. if Flag_Location = Orig_Loc then Non_Instance_Msgs.Append ((new String'(Msg), Flag_Location)); --- 284,306 ---- Test_Style_Warning_Serious_Msg (Msg); Orig_Loc := Original_Location (Flag_Location); ! -- If the current location is in an instantiation, the issue arises of ! -- whether to post the message on the template or the instantiation. ! -- The way we decide is to see if we have posted the same message on ! -- the template when we compiled the template (the template is always ! -- compiled before any instantiations). For this purpose, we use a ! -- separate table of messages. The reason we do this is twofold: -- First, the messages can get changed by various processing -- including the insertion of tokens etc, making it hard to -- do the comparison. ! -- Second, we will suppress a warning on a template if it is not in ! -- the current extended source unit. That's reasonable and means we ! -- don't want the warning on the instantiation here either, but it ! -- does mean that the main error table would not in any case include ! -- the message. if Flag_Location = Orig_Loc then Non_Instance_Msgs.Append ((new String'(Msg), Flag_Location)); *************** package body Errout is *** 310,317 **** -- Here we have an instance message else ! -- Delete if debug flag off, and this message duplicates a ! -- message already posted on the corresponding template if not Debug_Flag_GG then for J in Non_Instance_Msgs.First .. Non_Instance_Msgs.Last loop --- 309,316 ---- -- Here we have an instance message else ! -- Delete if debug flag off, and this message duplicates a message ! -- already posted on the corresponding template if not Debug_Flag_GG then for J in Non_Instance_Msgs.First .. Non_Instance_Msgs.Last loop *************** package body Errout is *** 373,381 **** -- instantiation error message can be repeated, pointing to each -- of the relevant instantiations. ! -- Note: the instantiation mechanism is also shared for inlining ! -- of subprogram bodies when front end inlining is done. In this ! -- case the messages have the form: -- in inlined body at ... -- original error message --- 372,380 ---- -- instantiation error message can be repeated, pointing to each -- of the relevant instantiations. ! -- Note: the instantiation mechanism is also shared for inlining of ! -- subprogram bodies when front end inlining is done. In this case the ! -- messages have the form: -- in inlined body at ... -- original error message *************** package body Errout is *** 385,393 **** -- warning: in inlined body at -- warning: original warning message ! -- OK, this is the case where we have an instantiation error, and ! -- we need to generate the error on the instantiation, rather than ! -- on the template. declare Actual_Error_Loc : Source_Ptr; --- 384,391 ---- -- warning: in inlined body at -- warning: original warning message ! -- OK, here we have an instantiation error, and we need to generate the ! -- error on the instantiation, rather than on the template. declare Actual_Error_Loc : Source_Ptr; *************** package body Errout is *** 396,404 **** -- location where all error messages will actually be posted. Save_Error_Msg_Sloc : constant Source_Ptr := Error_Msg_Sloc; ! -- Save possible location set for caller's message. We need to ! -- use Error_Msg_Sloc for the location of the instantiation error ! -- but we have to preserve a possible original value. X : Source_File_Index; --- 394,402 ---- -- location where all error messages will actually be posted. Save_Error_Msg_Sloc : constant Source_Ptr := Error_Msg_Sloc; ! -- Save possible location set for caller's message. We need to use ! -- Error_Msg_Sloc for the location of the instantiation error but we ! -- have to preserve a possible original value. X : Source_File_Index; *************** package body Errout is *** 417,426 **** exit when Instantiation (X) = No_Location; end loop; ! -- Since we are generating the messages at the instantiation ! -- point in any case, we do not want the references to the ! -- bad lines in the instance to be annotated with the location ! -- of the instantiation. Suppress_Instance_Location := True; Msg_Cont_Status := False; --- 415,423 ---- exit when Instantiation (X) = No_Location; end loop; ! -- Since we are generating the messages at the instantiation point in ! -- any case, we do not want the references to the bad lines in the ! -- instance to be annotated with the location of the instantiation. Suppress_Instance_Location := True; Msg_Cont_Status := False; *************** package body Errout is *** 429,435 **** Error_Msg_Sloc := Flag_Location; X := Get_Source_File_Index (Flag_Location); - while Instantiation (X) /= No_Location loop -- Suppress instantiation message on continuation lines --- 426,431 ---- *************** package body Errout is *** 679,688 **** Expander_Active := False; end if; ! -- Set the fatal error flag in the unit table unless we are ! -- in Try_Semantics mode. This stops the semantics from being ! -- performed if we find a serious error. This is skipped if we ! -- are currently dealing with the configuration pragma file. if not Try_Semantics and then Current_Source_Unit /= No_Unit then Set_Fatal_Error (Get_Source_Unit (Sptr)); --- 675,684 ---- Expander_Active := False; end if; ! -- Set the fatal error flag in the unit table unless we are in ! -- Try_Semantics mode. This stops the semantics from being performed ! -- if we find a serious error. This is skipped if we are currently ! -- dealing with the configuration pragma file. if not Try_Semantics and then Current_Source_Unit /= No_Unit then Set_Fatal_Error (Get_Source_Unit (Sptr)); *************** package body Errout is *** 722,731 **** return; end if; ! -- Return without doing anything if message is killed and this ! -- is not the first error message. The philosophy is that if we ! -- get a weird error message and we already have had a message, ! -- then we hope the weird message is a junk cascaded message if Kill_Message and then not All_Errors_Mode --- 718,727 ---- return; end if; ! -- Return without doing anything if message is killed and this is not ! -- the first error message. The philosophy is that if we get a weird ! -- error message and we already have had a message, then we hope the ! -- weird message is a junk cascaded message if Kill_Message and then not All_Errors_Mode *************** package body Errout is *** 749,763 **** return; end if; ! -- If the flag location is in the main extended source unit ! -- then for sure we want the warning since it definitely belongs if In_Extended_Main_Source_Unit (Sptr) then null; ! -- If the flag location is not in the main extended source unit, ! -- then we want to eliminate the warning, unless it is in the ! -- extended main code unit and we want warnings on the instance. elsif In_Extended_Main_Code_Unit (Sptr) and then Warn_On_Instance then null; --- 745,759 ---- return; end if; ! -- If the flag location is in the main extended source unit then for ! -- sure we want the warning since it definitely belongs if In_Extended_Main_Source_Unit (Sptr) then null; ! -- If the flag location is not in the main extended source unit, then ! -- we want to eliminate the warning, unless it is in the extended ! -- main code unit and we want warnings on the instance. elsif In_Extended_Main_Code_Unit (Sptr) and then Warn_On_Instance then null; *************** package body Errout is *** 884,889 **** --- 880,886 ---- Errors.Append ((Text => new String'(Msg_Buffer (1 .. Msglen)), Next => No_Error_Msg, + Prev => No_Error_Msg, Sptr => Sptr, Optr => Optr, Sfile => Get_Source_File_Index (Sptr), *************** package body Errout is *** 1217,1223 **** --- 1214,1247 ---- Nxt : Error_Msg_Id; F : Error_Msg_Id; + procedure Delete_Warning (E : Error_Msg_Id); + -- Delete a message if not already deleted and adjust warning count + + -------------------- + -- Delete_Warning -- + -------------------- + + procedure Delete_Warning (E : Error_Msg_Id) is + begin + if not Errors.Table (E).Deleted then + Errors.Table (E).Deleted := True; + Warnings_Detected := Warnings_Detected - 1; + end if; + end Delete_Warning; + + -- Start of message for Finalize + begin + -- Set Prev pointers + + Cur := First_Error_Msg; + while Cur /= No_Error_Msg loop + Nxt := Errors.Table (Cur).Next; + exit when Nxt = No_Error_Msg; + Errors.Table (Nxt).Prev := Cur; + Cur := Nxt; + end loop; + -- Eliminate any duplicated error messages from the list. This is -- done after the fact to avoid problems with Change_Error_Text. *************** package body Errout is *** 1242,1252 **** while Cur /= No_Error_Msg loop if not Errors.Table (Cur).Deleted and then Warning_Specifically_Suppressed ! (Errors.Table (Cur).Sptr, ! Errors.Table (Cur).Text) then ! Errors.Table (Cur).Deleted := True; ! Warnings_Detected := Warnings_Detected - 1; end if; Cur := Errors.Table (Cur).Next; --- 1266,1292 ---- while Cur /= No_Error_Msg loop if not Errors.Table (Cur).Deleted and then Warning_Specifically_Suppressed ! (Errors.Table (Cur).Sptr, Errors.Table (Cur).Text) then ! Delete_Warning (Cur); ! ! -- If this is a continuation, delete previous messages ! ! F := Cur; ! while Errors.Table (F).Msg_Cont loop ! F := Errors.Table (F).Prev; ! Delete_Warning (F); ! end loop; ! ! -- Delete any following continuations ! ! F := Cur; ! loop ! F := Errors.Table (F).Next; ! exit when F = No_Error_Msg; ! exit when not Errors.Table (F).Msg_Cont; ! Delete_Warning (F); ! end loop; end if; Cur := Errors.Table (Cur).Next; *************** package body Errout is *** 1325,1337 **** S := Sloc (F); -- The following circuit is a bit subtle. When we have parenthesized ! -- expressions, then the Sloc will not record the location of the ! -- paren, but we would like to post the flag on the paren. So what ! -- we do is to crawl up the tree from the First_Node, adjusting the ! -- Sloc value for any parentheses we know are present. Yes, we know ! -- this circuit is not 100% reliable (e.g. because we don't record ! -- all possible paren level values), but this is only for an error ! -- message so it is good enough. Node_Loop : loop Paren_Loop : for J in 1 .. Paren_Count (F) loop --- 1365,1376 ---- S := Sloc (F); -- The following circuit is a bit subtle. When we have parenthesized ! -- expressions, then the Sloc will not record the location of the paren, ! -- but we would like to post the flag on the paren. So what we do is to ! -- crawl up the tree from the First_Node, adjusting the Sloc value for ! -- any parentheses we know are present. Yes, we know this circuit is not ! -- 100% reliable (e.g. because we don't record all possible paren level ! -- values), but this is only for an error message so it is good enough. Node_Loop : loop Paren_Loop : for J in 1 .. Paren_Count (F) loop *************** package body Errout is *** 1378,1385 **** Cur_Msg := No_Error_Msg; List_Pragmas.Init; ! -- Initialize warnings table, if all warnings are suppressed, supply ! -- an initial dummy entry covering all possible source locations. Warnings.Init; Specific_Warnings.Init; --- 1417,1424 ---- Cur_Msg := No_Error_Msg; List_Pragmas.Init; ! -- Initialize warnings table, if all warnings are suppressed, supply an ! -- initial dummy entry covering all possible source locations. Warnings.Init; Specific_Warnings.Init; *************** package body Errout is *** 2100,2111 **** Flen := Flen + 1; end loop; ! -- Loop through file names to find matching one. This is a bit slow, ! -- but we only do it in error situations so it is not so terrible. ! -- Note that if the loop does not exit, then the desired case will ! -- be left set to Mixed_Case, this can happen if the name was not ! -- in canonical form, and gets canonicalized on VMS. Possibly we ! -- could fix this by unconditinally canonicalizing these names ??? for J in 1 .. Last_Source_File loop Get_Name_String (Full_Debug_Name (J)); --- 2139,2150 ---- Flen := Flen + 1; end loop; ! -- Loop through file names to find matching one. This is a bit slow, but ! -- we only do it in error situations so it is not so terrible. Note that ! -- if the loop does not exit, then the desired case will be left set to ! -- Mixed_Case, this can happen if the name was not in canonical form, ! -- and gets canonicalized on VMS. Possibly we could fix this by ! -- unconditionally canonicalizing these names ??? for J in 1 .. Last_Source_File loop Get_Name_String (Full_Debug_Name (J)); *************** package body Errout is *** 2185,2193 **** K := Nkind (Error_Msg_Node_1); -- If we have operator case, skip quotes since name of operator ! -- itself will supply the required quotations. An operator can be ! -- an applied use in an expression or an explicit operator symbol, ! -- or an identifier whose name indicates it is an operator. if K in N_Op or else K = N_Operator_Symbol --- 2224,2232 ---- K := Nkind (Error_Msg_Node_1); -- If we have operator case, skip quotes since name of operator ! -- itself will supply the required quotations. An operator can be an ! -- applied use in an expression or an explicit operator symbol, or an ! -- identifier whose name indicates it is an operator. if K in N_Op or else K = N_Operator_Symbol *************** package body Errout is *** 2333,2340 **** Set_Msg_Node (Ent); Add_Class; ! -- If Ent is an anonymous subprogram type, there is no name ! -- to print, so remove enclosing quotes. if Buffer_Ends_With ("""") then Buffer_Remove (""""); --- 2372,2379 ---- Set_Msg_Node (Ent); Add_Class; ! -- If Ent is an anonymous subprogram type, there is no name to print, ! -- so remove enclosing quotes. if Buffer_Ends_With ("""") then Buffer_Remove (""""); *************** package body Errout is *** 2343,2350 **** end if; end if; ! -- If the original type did not come from a predefined ! -- file, add the location where the type was defined. if Sloc (Error_Msg_Node_1) > Standard_Location and then --- 2382,2389 ---- end if; end if; ! -- If the original type did not come from a predefined file, add the ! -- location where the type was defined. if Sloc (Error_Msg_Node_1) > Standard_Location and then *************** package body Errout is *** 2504,2510 **** -- in case, which is the case when we can copy from the source. declare ! Src_Loc : constant Source_Ptr := Sloc (Error_Msg_Node_1); Sbuffer : Source_Buffer_Ptr; Ref_Ptr : Integer; Src_Ptr : Source_Ptr; --- 2543,2549 ---- -- in case, which is the case when we can copy from the source. declare ! Src_Loc : constant Source_Ptr := Sloc (Node); Sbuffer : Source_Buffer_Ptr; Ref_Ptr : Integer; Src_Ptr : Source_Ptr; *************** package body Errout is *** 2521,2529 **** Set_Casing (Mixed_Case); else ! -- Determine if the reference we are dealing with corresponds ! -- to text at the point of the error reference. This will often ! -- be the case for simple identifier references, and is the case -- where we can copy the spelling from the source. Sbuffer := Source_Text (Get_Source_File_Index (Src_Loc)); --- 2560,2568 ---- Set_Casing (Mixed_Case); else ! -- Determine if the reference we are dealing with corresponds to ! -- text at the point of the error reference. This will often be ! -- the case for simple identifier references, and is the case -- where we can copy the spelling from the source. Sbuffer := Source_Text (Get_Source_File_Index (Src_Loc)); *************** package body Errout is *** 2536,2543 **** Src_Ptr := Src_Ptr + 1; end loop; ! -- If we get through the loop without a mismatch, then output ! -- the name the way it is spelled in the source program if Ref_Ptr > Name_Len then Src_Ptr := Src_Loc; --- 2575,2582 ---- Src_Ptr := Src_Ptr + 1; end loop; ! -- If we get through the loop without a mismatch, then output the ! -- name the way it is spelled in the source program if Ref_Ptr > Name_Len then Src_Ptr := Src_Loc; *************** package body Errout is *** 2572,2579 **** Is_Unconditional_Msg := False; Msglen := 0; Flag_Source := Get_Source_File_Index (Flag); - P := Text'First; while P <= Text'Last loop C := Text (P); P := P + 1; --- 2611,2618 ---- Is_Unconditional_Msg := False; Msglen := 0; Flag_Source := Get_Source_File_Index (Flag); + P := Text'First; while P <= Text'Last loop C := Text (P); P := P + 1; *************** package body Errout is *** 2829,2835 **** -- "type derived from" message more than once in the case where we climb -- up multiple levels. ! loop Old_Ent := Ent; -- Implicit access type, use directly designated type In Ada 2005, --- 2868,2874 ---- -- "type derived from" message more than once in the case where we climb -- up multiple levels. ! Find : loop Old_Ent := Ent; -- Implicit access type, use directly designated type In Ada 2005, *************** package body Errout is *** 2877,2883 **** Set_Msg_Str ("access to procedure "); end if; ! exit; -- Type is access to object, named or anonymous --- 2916,2922 ---- Set_Msg_Str ("access to procedure "); end if; ! exit Find; -- Type is access to object, named or anonymous *************** package body Errout is *** 2915,2965 **** -- itself an internal name. This avoids the obvious loop (subtype -> -- basetype -> subtype) which would otherwise occur!) ! elsif Present (Freeze_Node (Ent)) ! and then Present (First_Subtype_Link (Freeze_Node (Ent))) ! and then ! not Is_Internal_Name ! (Chars (First_Subtype_Link (Freeze_Node (Ent)))) ! then ! Ent := First_Subtype_Link (Freeze_Node (Ent)); ! -- Otherwise use root type ! else ! if not Derived then ! Buffer_Remove ("type "); ! -- Test for "subtype of type derived from" which seems ! -- excessive and is replaced by simply "type derived from" ! Buffer_Remove ("subtype of"); ! -- Avoid duplication "type derived from type derived from" ! if not Buffer_Ends_With ("type derived from ") then ! Set_Msg_Str ("type derived from "); ! end if; ! Derived := True; ! end if; Ent := Etype (Ent); end if; -- If we are stuck in a loop, get out and settle for the internal ! -- name after all. In this case we set to kill the message if it ! -- is not the first error message (we really try hard not to show ! -- the dirty laundry of the implementation to the poor user!) if Ent = Old_Ent then Kill_Message := True; ! exit; end if; -- Get out if we finally found a non-internal name to use ! exit when not Is_Internal_Name (Chars (Ent)); ! end loop; if Mchar = '"' then Set_Msg_Char ('"'); --- 2954,3007 ---- -- itself an internal name. This avoids the obvious loop (subtype -> -- basetype -> subtype) which would otherwise occur!) ! else ! declare ! FST : constant Entity_Id := First_Subtype (Ent); ! begin ! if not Is_Internal_Name (Chars (FST)) then ! Ent := FST; ! exit Find; ! -- Otherwise use root type ! else ! if not Derived then ! Buffer_Remove ("type "); ! -- Test for "subtype of type derived from" which seems ! -- excessive and is replaced by "type derived from". ! Buffer_Remove ("subtype of"); ! -- Avoid duplicated "type derived from type derived from" ! if not Buffer_Ends_With ("type derived from ") then ! Set_Msg_Str ("type derived from "); ! end if; ! ! Derived := True; ! end if; ! end if; ! end; Ent := Etype (Ent); end if; -- If we are stuck in a loop, get out and settle for the internal ! -- name after all. In this case we set to kill the message if it is ! -- not the first error message (we really try hard not to show the ! -- dirty laundry of the implementation to the poor user!) if Ent = Old_Ent then Kill_Message := True; ! exit Find; end if; -- Get out if we finally found a non-internal name to use ! exit Find when not Is_Internal_Name (Chars (Ent)); ! end loop Find; if Mchar = '"' then Set_Msg_Char ('"'); diff -Nrcpad gcc-4.5.2/gcc/ada/errout.ads gcc-4.6.0/gcc/ada/errout.ads *** gcc-4.5.2/gcc/ada/errout.ads Wed May 6 12:49:36 2009 --- gcc-4.6.0/gcc/ada/errout.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Errout is *** 60,72 **** -- the use of constructs not permitted by the library in use, or improper -- constructs in No_Run_Time mode). - type Compiler_State_Type is (Parsing, Analyzing); - Compiler_State : Compiler_State_Type; - -- Indicates current state of compilation. This is put in the Errout spec - -- because it affects the action of the error message handling. In - -- particular, an attempt is made by Errout to suppress cascaded error - -- messages in Parsing mode, but not in the other modes. - Current_Error_Source_File : Source_File_Index renames Err_Vars.Current_Error_Source_File; -- Id of current messages. Used to post file name when unit changes. This --- 60,65 ---- *************** package Errout is *** 209,219 **** -- are that an RM reference may follow in the form (RM .....) and a -- right parenthesis may immediately follow the #. In the case of -- continued messages, # can only appear at the end of a group of ! -- continuation messsages, except that \\ messages which always start -- a new line end the sequence from the point of view of this rule. -- The idea is that for any use of -gnatj, it will still be the case -- that a location reference appears only at the end of a line. -- Insertion character } (Right brace: insert type reference) -- The character } is replaced by a string describing the type -- referenced by the entity whose Id is stored in Error_Msg_Node_1. --- 202,216 ---- -- are that an RM reference may follow in the form (RM .....) and a -- right parenthesis may immediately follow the #. In the case of -- continued messages, # can only appear at the end of a group of ! -- continuation messages, except that \\ messages which always start -- a new line end the sequence from the point of view of this rule. -- The idea is that for any use of -gnatj, it will still be the case -- that a location reference appears only at the end of a line. + -- Note: the output of the string "at " is suppressed if the string + -- " from" or " from " immediately precedes the insertion character #. + -- Certain messages read better with from than at. + -- Insertion character } (Right brace: insert type reference) -- The character } is replaced by a string describing the type -- referenced by the entity whose Id is stored in Error_Msg_Node_1. *************** package Errout is *** 376,381 **** --- 373,387 ---- Gname5 : aliased constant String := "gnat05"; Vname5 : aliased constant String := "05"; + Gname6 : aliased constant String := "gnat2005"; + Vname6 : aliased constant String := "2005"; + + Gname7 : aliased constant String := "gnat12"; + Vname7 : aliased constant String := "12"; + + Gname8 : aliased constant String := "gnat2012"; + Vname8 : aliased constant String := "2012"; + type Cstring_Ptr is access constant String; Gnames : array (Nat range <>) of Cstring_Ptr := *************** package Errout is *** 383,396 **** Gname2'Access, Gname3'Access, Gname4'Access, ! Gname5'Access); Vnames : array (Nat range <>) of Cstring_Ptr := (Vname1'Access, Vname2'Access, Vname3'Access, Vname4'Access, ! Vname5'Access); ----------------------------------------------------- -- Global Values Used for Error Message Insertions -- --- 389,408 ---- Gname2'Access, Gname3'Access, Gname4'Access, ! Gname5'Access, ! Gname6'Access, ! Gname7'Access, ! Gname8'Access); Vnames : array (Nat range <>) of Cstring_Ptr := (Vname1'Access, Vname2'Access, Vname3'Access, Vname4'Access, ! Vname5'Access, ! Vname6'Access, ! Vname7'Access, ! Vname8'Access); ----------------------------------------------------- -- Global Values Used for Error Message Insertions -- *************** package Errout is *** 601,613 **** -- without appropriate coordination. If new messages are added which may -- be susceptible to automatic codefix action, they are marked using: - -- Error_Msg -- CODEFIX??? - -- (parameters) - - -- And subsequently either the appropriate code is added to codefix and the - -- ??? are removed, or it is determined that this is not an appropriate - -- case for codefix action, and the comment is removed. - ------------------------------ -- Error Output Subprograms -- ------------------------------ --- 613,618 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/erroutc.adb gcc-4.6.0/gcc/ada/erroutc.adb *** gcc-4.5.2/gcc/ada/erroutc.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/erroutc.adb Tue Oct 12 11:00:42 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Erroutc is *** 717,727 **** Sindex_Loc : Source_File_Index; Sindex_Flag : Source_File_Index; begin Set_Msg_Blank; if Loc = No_Location then ! Set_Msg_Str ("at unknown location"); elsif Loc = System_Location then Set_Msg_Str ("in package System"); --- 717,747 ---- Sindex_Loc : Source_File_Index; Sindex_Flag : Source_File_Index; + procedure Set_At; + -- Outputs "at " unless last characters in buffer are " from ". Certain + -- messages read better with from than at. + + ------------ + -- Set_At -- + ------------ + + procedure Set_At is + begin + if Msglen < 6 + or else Msg_Buffer (Msglen - 5 .. Msglen) /= " from " + then + Set_Msg_Str ("at "); + end if; + end Set_At; + + -- Start of processing for Set_Msg_Insertion_Line_Number + begin Set_Msg_Blank; if Loc = No_Location then ! Set_At; ! Set_Msg_Str ("unknown location"); elsif Loc = System_Location then Set_Msg_Str ("in package System"); *************** package body Erroutc is *** 743,749 **** Sindex_Flag := Get_Source_File_Index (Flag); if Full_File_Name (Sindex_Loc) /= Full_File_Name (Sindex_Flag) then ! Set_Msg_Str ("at "); Get_Name_String (Reference_Name (Get_Source_File_Index (Loc))); Set_Msg_Name_Buffer; --- 763,769 ---- Sindex_Flag := Get_Source_File_Index (Flag); if Full_File_Name (Sindex_Loc) /= Full_File_Name (Sindex_Flag) then ! Set_At; Get_Name_String (Reference_Name (Get_Source_File_Index (Loc))); Set_Msg_Name_Buffer; *************** package body Erroutc is *** 752,758 **** -- If in current file, add text "at line " else ! Set_Msg_Str ("at line "); end if; -- Output line number for reference --- 772,779 ---- -- If in current file, add text "at line " else ! Set_At; ! Set_Msg_Str ("line "); end if; -- Output line number for reference diff -Nrcpad gcc-4.5.2/gcc/ada/erroutc.ads gcc-4.6.0/gcc/ada/erroutc.ads *** gcc-4.5.2/gcc/ada/erroutc.ads Thu Apr 9 10:38:54 2009 --- gcc-4.6.0/gcc/ada/erroutc.ads Tue Jun 22 17:29:41 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Erroutc is *** 147,152 **** --- 147,157 ---- -- Pointer to next message in error chain. A value of No_Error_Msg -- indicates the end of the chain. + Prev : Error_Msg_Id; + -- Pointer to previous message in error chain. Only set during the + -- Finalize procedure. A value of No_Error_Msg indicates the first + -- message in the chain. + Sfile : Source_File_Index; -- Source table index of source file. In the case of an error that -- refers to a template, always references the original template diff -Nrcpad gcc-4.5.2/gcc/ada/eval_fat.adb gcc-4.6.0/gcc/ada/eval_fat.adb *** gcc-4.5.2/gcc/ada/eval_fat.adb Thu Dec 13 10:24:08 2007 --- gcc-4.6.0/gcc/ada/eval_fat.adb Fri Oct 22 09:28:24 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,32 **** with Einfo; use Einfo; with Errout; use Errout; - with Sem_Util; use Sem_Util; - with Ttypef; use Ttypef; with Targparm; use Targparm; package body Eval_Fat is --- 25,30 ---- *************** package body Eval_Fat is *** 67,79 **** Mode : Rounding_Mode); -- This is similar to Decompose, except that the Fraction value returned -- is an integer representing the value Fraction * Scale, where Scale is ! -- the value (Radix ** Machine_Mantissa (RT)). The value is obtained by ! -- using biased rounding (halfway cases round away from zero), round to ! -- even, a floor operation or a ceiling operation depending on the setting ! -- of Mode (see corresponding descriptions in Urealp). ! ! function Machine_Emin (RT : R) return Int; ! -- Return value of the Machine_Emin attribute -------------- -- Adjacent -- --- 65,75 ---- Mode : Rounding_Mode); -- This is similar to Decompose, except that the Fraction value returned -- is an integer representing the value Fraction * Scale, where Scale is ! -- the value (Machine_Radix_Value (RT) ** Machine_Mantissa_Value (RT)). The ! -- value is obtained by using biased rounding (halfway cases round away ! -- from zero), round to even, a floor operation or a ceiling operation ! -- depending on the setting of Mode (see corresponding descriptions in ! -- Urealp). -------------- -- Adjacent -- *************** package body Eval_Fat is *** 155,161 **** Fraction := UR_From_Components (Num => Int_F, ! Den => UI_From_Int (Machine_Mantissa (RT)), Rbase => Radix, Negative => False); --- 151,157 ---- Fraction := UR_From_Components (Num => Int_F, ! Den => Machine_Mantissa_Value (RT), Rbase => Radix, Negative => False); *************** package body Eval_Fat is *** 192,198 **** -- True iff Fraction is even Most_Significant_Digit : constant UI := ! Radix ** (Machine_Mantissa (RT) - 1); Uintp_Mark : Uintp.Save_Mark; -- The code is divided into blocks that systematically release --- 188,194 ---- -- True iff Fraction is even Most_Significant_Digit : constant UI := ! Radix ** (Machine_Mantissa_Value (RT) - 1); Uintp_Mark : Uintp.Save_Mark; -- The code is divided into blocks that systematically release *************** package body Eval_Fat is *** 475,481 **** ------------------ function Leading_Part (RT : R; X : T; Radix_Digits : UI) return T is ! RD : constant UI := UI_Min (Radix_Digits, Machine_Mantissa (RT)); L : UI; Y : T; begin --- 471,477 ---- ------------------ function Leading_Part (RT : R; X : T; Radix_Digits : UI) return T is ! RD : constant UI := UI_Min (Radix_Digits, Machine_Mantissa_Value (RT)); L : UI; Y : T; begin *************** package body Eval_Fat is *** 496,502 **** is X_Frac : T; X_Exp : UI; ! Emin : constant UI := UI_From_Int (Machine_Emin (RT)); begin Decompose (RT, X, X_Frac, X_Exp, Mode); --- 492,498 ---- is X_Frac : T; X_Exp : UI; ! Emin : constant UI := Machine_Emin_Value (RT); begin Decompose (RT, X, X_Frac, X_Exp, Mode); *************** package body Eval_Fat is *** 513,521 **** if X_Exp < Emin then declare ! Emin_Den : constant UI := ! UI_From_Int ! (Machine_Emin (RT) - Machine_Mantissa (RT) + 1); begin if X_Exp < Emin_Den or not Denorm_On_Target then if UR_Is_Negative (X) then --- 509,516 ---- if X_Exp < Emin then declare ! Emin_Den : constant UI := Machine_Emin_Value (RT) ! - Machine_Mantissa_Value (RT) + Uint_1; begin if X_Exp < Emin_Den or not Denorm_On_Target then if UR_Is_Negative (X) then *************** package body Eval_Fat is *** 569,676 **** return Scaling (RT, X_Frac, X_Exp); end Machine; - ------------------ - -- Machine_Emin -- - ------------------ - - function Machine_Emin (RT : R) return Int is - Digs : constant UI := Digits_Value (RT); - Emin : Int; - - begin - if Vax_Float (RT) then - if Digs = VAXFF_Digits then - Emin := VAXFF_Machine_Emin; - - elsif Digs = VAXDF_Digits then - Emin := VAXDF_Machine_Emin; - - else - pragma Assert (Digs = VAXGF_Digits); - Emin := VAXGF_Machine_Emin; - end if; - - elsif Is_AAMP_Float (RT) then - if Digs = AAMPS_Digits then - Emin := AAMPS_Machine_Emin; - - else - pragma Assert (Digs = AAMPL_Digits); - Emin := AAMPL_Machine_Emin; - end if; - - else - if Digs = IEEES_Digits then - Emin := IEEES_Machine_Emin; - - elsif Digs = IEEEL_Digits then - Emin := IEEEL_Machine_Emin; - - else - pragma Assert (Digs = IEEEX_Digits); - Emin := IEEEX_Machine_Emin; - end if; - end if; - - return Emin; - end Machine_Emin; - - ---------------------- - -- Machine_Mantissa -- - ---------------------- - - function Machine_Mantissa (RT : R) return Nat is - Digs : constant UI := Digits_Value (RT); - Mant : Nat; - - begin - if Vax_Float (RT) then - if Digs = VAXFF_Digits then - Mant := VAXFF_Machine_Mantissa; - - elsif Digs = VAXDF_Digits then - Mant := VAXDF_Machine_Mantissa; - - else - pragma Assert (Digs = VAXGF_Digits); - Mant := VAXGF_Machine_Mantissa; - end if; - - elsif Is_AAMP_Float (RT) then - if Digs = AAMPS_Digits then - Mant := AAMPS_Machine_Mantissa; - - else - pragma Assert (Digs = AAMPL_Digits); - Mant := AAMPL_Machine_Mantissa; - end if; - - else - if Digs = IEEES_Digits then - Mant := IEEES_Machine_Mantissa; - - elsif Digs = IEEEL_Digits then - Mant := IEEEL_Machine_Mantissa; - - else - pragma Assert (Digs = IEEEX_Digits); - Mant := IEEEX_Machine_Mantissa; - end if; - end if; - - return Mant; - end Machine_Mantissa; - - ------------------- - -- Machine_Radix -- - ------------------- - - function Machine_Radix (RT : R) return Nat is - pragma Warnings (Off, RT); - begin - return Radix; - end Machine_Radix; - ----------- -- Model -- ----------- --- 564,569 ---- *************** package body Eval_Fat is *** 818,825 **** ---------- function Succ (RT : R; X : T) return T is ! Emin : constant UI := UI_From_Int (Machine_Emin (RT)); ! Mantissa : constant UI := UI_From_Int (Machine_Mantissa (RT)); Exp : UI := UI_Max (Emin, Exponent (RT, X)); Frac : T; New_Frac : T; --- 711,718 ---- ---------- function Succ (RT : R; X : T) return T is ! Emin : constant UI := Machine_Emin_Value (RT); ! Mantissa : constant UI := Machine_Mantissa_Value (RT); Exp : UI := UI_Max (Emin, Exponent (RT, X)); Frac : T; New_Frac : T; diff -Nrcpad gcc-4.5.2/gcc/ada/eval_fat.ads gcc-4.6.0/gcc/ada/eval_fat.ads *** gcc-4.5.2/gcc/ada/eval_fat.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/eval_fat.ads Fri Oct 22 09:28:24 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Eval_Fat is *** 65,74 **** function Leading_Part (RT : R; X : T; Radix_Digits : UI) return T; - function Machine_Mantissa (RT : R) return Nat; - - function Machine_Radix (RT : R) return Nat; - function Model (RT : R; X : T) return T; function Pred (RT : R; X : T) return T; --- 65,70 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/exp_aggr.adb gcc-4.6.0/gcc/ada/exp_aggr.adb *** gcc-4.5.2/gcc/ada/exp_aggr.adb Mon Jan 25 14:37:39 2010 --- gcc-4.6.0/gcc/ada/exp_aggr.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Exp_Util; use Exp_Util; *** 34,39 **** --- 34,40 ---- with Exp_Ch3; use Exp_Ch3; with Exp_Ch7; use Exp_Ch7; with Exp_Ch9; use Exp_Ch9; + with Exp_Disp; use Exp_Disp; with Exp_Tss; use Exp_Tss; with Fname; use Fname; with Freeze; use Freeze; *************** package body Exp_Aggr is *** 93,99 **** function Has_Default_Init_Comps (N : Node_Id) return Boolean; -- N is an aggregate (record or array). Checks the presence of default ! -- initialization (<>) in any component (Ada 2005: AI-287) function Is_Static_Dispatch_Table_Aggregate (N : Node_Id) return Boolean; -- Returns true if N is an aggregate used to initialize the components --- 94,100 ---- function Has_Default_Init_Comps (N : Node_Id) return Boolean; -- N is an aggregate (record or array). Checks the presence of default ! -- initialization (<>) in any component (Ada 2005: AI-287). function Is_Static_Dispatch_Table_Aggregate (N : Node_Id) return Boolean; -- Returns true if N is an aggregate used to initialize the components *************** package body Exp_Aggr is *** 173,186 **** ----------------------------------------------------- function Aggr_Size_OK (N : Node_Id; Typ : Entity_Id) return Boolean; ! -- Very large static aggregates present problems to the back-end, and ! -- are transformed into assignments and loops. This function verifies ! -- that the total number of components of an aggregate is acceptable ! -- for transformation into a purely positional static form. It is called ! -- prior to calling Flatten. ! -- This function also detects and warns about one-component aggregates ! -- that appear in a non-static context. Even if the component value is ! -- static, such an aggregate must be expanded into an assignment. procedure Convert_Array_Aggr_In_Allocator (Decl : Node_Id; --- 174,188 ---- ----------------------------------------------------- function Aggr_Size_OK (N : Node_Id; Typ : Entity_Id) return Boolean; ! -- Very large static aggregates present problems to the back-end, and are ! -- transformed into assignments and loops. This function verifies that the ! -- total number of components of an aggregate is acceptable for rewriting ! -- into a purely positional static form. Aggr_Size_OK must be called before ! -- calling Flatten. ! -- ! -- This function also detects and warns about one-component aggregates that ! -- appear in a non-static context. Even if the component value is static, ! -- such an aggregate must be expanded into an assignment. procedure Convert_Array_Aggr_In_Allocator (Decl : Node_Id; *************** package body Exp_Aggr is *** 225,231 **** Index : Node_Id; Into : Node_Id; Scalar_Comp : Boolean; ! Indices : List_Id := No_List; Flist : Node_Id := Empty) return List_Id; -- This recursive routine returns a list of statements containing the -- loops and assignments that are needed for the expansion of the array --- 227,233 ---- Index : Node_Id; Into : Node_Id; Scalar_Comp : Boolean; ! Indexes : List_Id := No_List; Flist : Node_Id := Empty) return List_Id; -- This recursive routine returns a list of statements containing the -- loops and assignments that are needed for the expansion of the array *************** package body Exp_Aggr is *** 242,248 **** -- -- Scalar_Comp is True if the component type of the aggregate is scalar. -- ! -- Indices is the current list of expressions used to index the -- object we are writing into. -- -- Flist is an expression representing the finalization list on which --- 244,250 ---- -- -- Scalar_Comp is True if the component type of the aggregate is scalar. -- ! -- Indexes is the current list of expressions used to index the -- object we are writing into. -- -- Flist is an expression representing the finalization list on which *************** package body Exp_Aggr is *** 594,600 **** -- If component is limited, aggregate must be expanded because each -- component assignment must be built in place. ! if Is_Inherently_Limited_Type (Component_Type (Typ)) then return False; end if; --- 596,602 ---- -- If component is limited, aggregate must be expanded because each -- component assignment must be built in place. ! if Is_Immutably_Limited_Type (Component_Type (Typ)) then return False; end if; *************** package body Exp_Aggr is *** 699,705 **** Index : Node_Id; Into : Node_Id; Scalar_Comp : Boolean; ! Indices : List_Id := No_List; Flist : Node_Id := Empty) return List_Id is Loc : constant Source_Ptr := Sloc (N); --- 701,707 ---- Index : Node_Id; Into : Node_Id; Scalar_Comp : Boolean; ! Indexes : List_Id := No_List; Flist : Node_Id := Empty) return List_Id is Loc : constant Source_Ptr := Sloc (N); *************** package body Exp_Aggr is *** 726,732 **** -- N to Build_Loop contains no sub-aggregates, then this function -- returns the assignment statement: -- ! -- Into (Indices, Ind) := Expr; -- -- Otherwise we call Build_Code recursively -- --- 728,734 ---- -- N to Build_Loop contains no sub-aggregates, then this function -- returns the assignment statement: -- ! -- Into (Indexes, Ind) := Expr; -- -- Otherwise we call Build_Code recursively -- *************** package body Exp_Aggr is *** 739,745 **** -- This routine returns the for loop statement -- -- for J in Index_Base'(L) .. Index_Base'(H) loop ! -- Into (Indices, J) := Expr; -- end loop; -- -- Otherwise we call Build_Code recursively. --- 741,747 ---- -- This routine returns the for loop statement -- -- for J in Index_Base'(L) .. Index_Base'(H) loop ! -- Into (Indexes, J) := Expr; -- end loop; -- -- Otherwise we call Build_Code recursively. *************** package body Exp_Aggr is *** 754,760 **** -- J : Index_Base := L; -- while J < H loop -- J := Index_Base'Succ (J); ! -- Into (Indices, J) := Expr; -- end loop; -- -- Otherwise we call Build_Code recursively --- 756,762 ---- -- J : Index_Base := L; -- while J < H loop -- J := Index_Base'Succ (J); ! -- Into (Indexes, J) := Expr; -- end loop; -- -- Otherwise we call Build_Code recursively *************** package body Exp_Aggr is *** 940,946 **** F : Entity_Id; A : Node_Id; ! New_Indices : List_Id; Indexed_Comp : Node_Id; Expr_Q : Node_Id; Comp_Type : Entity_Id := Empty; --- 942,948 ---- F : Entity_Id; A : Node_Id; ! New_Indexes : List_Id; Indexed_Comp : Node_Id; Expr_Q : Node_Id; Comp_Type : Entity_Id := Empty; *************** package body Exp_Aggr is *** 980,992 **** -- Start of processing for Gen_Assign begin ! if No (Indices) then ! New_Indices := New_List; else ! New_Indices := New_Copy_List_Tree (Indices); end if; ! Append_To (New_Indices, Ind); if Present (Flist) then F := New_Copy_Tree (Flist); --- 982,994 ---- -- Start of processing for Gen_Assign begin ! if No (Indexes) then ! New_Indexes := New_List; else ! New_Indexes := New_Copy_List_Tree (Indexes); end if; ! Append_To (New_Indexes, Ind); if Present (Flist) then F := New_Copy_Tree (Flist); *************** package body Exp_Aggr is *** 1012,1018 **** Index => Next_Index (Index), Into => Into, Scalar_Comp => Scalar_Comp, ! Indices => New_Indices, Flist => F)); end if; --- 1014,1020 ---- Index => Next_Index (Index), Into => Into, Scalar_Comp => Scalar_Comp, ! Indexes => New_Indexes, Flist => F)); end if; *************** package body Exp_Aggr is *** 1022,1028 **** Checks_Off (Make_Indexed_Component (Loc, Prefix => New_Copy_Tree (Into), ! Expressions => New_Indices)); Set_Assignment_OK (Indexed_Comp); --- 1024,1030 ---- Checks_Off (Make_Indexed_Component (Loc, Prefix => New_Copy_Tree (Into), ! Expressions => New_Indexes)); Set_Assignment_OK (Indexed_Comp); *************** package body Exp_Aggr is *** 1043,1049 **** Comp_Type := Component_Type (Etype (N)); pragma Assert (Comp_Type = Ctype); -- AI-287 ! elsif Present (Next (First (New_Indices))) then -- Ada 2005 (AI-287): Do nothing in case of default initialized -- component because we have received the component type in --- 1045,1051 ---- Comp_Type := Component_Type (Etype (N)); pragma Assert (Comp_Type = Ctype); -- AI-287 ! elsif Present (Next (First (New_Indexes))) then -- Ada 2005 (AI-287): Do nothing in case of default initialized -- component because we have received the component type in *************** package body Exp_Aggr is *** 1099,1105 **** if Is_Delayed_Aggregate (Expr_Q) then ! -- This is either a subaggregate of a multidimentional array, -- or a component of an array type whose component type is -- also an array. In the latter case, the expression may have -- component associations that provide different bounds from --- 1101,1107 ---- if Is_Delayed_Aggregate (Expr_Q) then ! -- This is either a subaggregate of a multidimensional array, -- or a component of an array type whose component type is -- also an array. In the latter case, the expression may have -- component associations that provide different bounds from *************** package body Exp_Aggr is *** 1347,1353 **** -- Otherwise construct the loop, starting with the loop index L_J ! L_J := Make_Defining_Identifier (Loc, New_Internal_Name ('J')); -- Construct "L .. H" in Index_Base. We use a qualified expression -- for the bound to convert to the index base, but we don't need --- 1349,1355 ---- -- Otherwise construct the loop, starting with the loop index L_J ! L_J := Make_Temporary (Loc, 'J', L); -- Construct "L .. H" in Index_Base. We use a qualified expression -- for the bound to convert to the index base, but we don't need *************** package body Exp_Aggr is *** 1455,1461 **** -- Build the decl of W_J ! W_J := Make_Defining_Identifier (Loc, New_Internal_Name ('J')); W_Decl := Make_Object_Declaration (Loc, --- 1457,1463 ---- -- Build the decl of W_J ! W_J := Make_Temporary (Loc, 'J', L); W_Decl := Make_Object_Declaration (Loc, *************** package body Exp_Aggr is *** 2118,2124 **** then RC := RE_Limited_Record_Controller; ! elsif Is_Inherently_Limited_Type (Target_Type) then RC := RE_Limited_Record_Controller; else --- 2120,2126 ---- then RC := RE_Limited_Record_Controller; ! elsif Is_Immutably_Limited_Type (Target_Type) then RC := RE_Limited_Record_Controller; else *************** package body Exp_Aggr is *** 2224,2231 **** Prefix => New_Reference_To ( Associated_Final_Chain (Etype (Alloc)), Loc), ! Selector_Name => ! Make_Identifier (Loc, Name_F)); elsif Present (Flist) then External_Final_List := New_Copy_Tree (Flist); --- 2226,2232 ---- Prefix => New_Reference_To ( Associated_Final_Chain (Etype (Alloc)), Loc), ! Selector_Name => Make_Identifier (Loc, Name_F)); elsif Present (Flist) then External_Final_List := New_Copy_Tree (Flist); *************** package body Exp_Aggr is *** 2390,2396 **** Make_Identifier (Loc, Name_uController)); F := Make_Selected_Component (Loc, ! Prefix => F, Selector_Name => Make_Identifier (Loc, Name_F)); Attach := Make_Integer_Literal (Loc, 1); --- 2391,2397 ---- Make_Identifier (Loc, Name_uController)); F := Make_Selected_Component (Loc, ! Prefix => F, Selector_Name => Make_Identifier (Loc, Name_F)); Attach := Make_Integer_Literal (Loc, 1); *************** package body Exp_Aggr is *** 2426,2439 **** function Rewrite_Discriminant (Expr : Node_Id) return Traverse_Result is begin ! if Nkind (Expr) = N_Identifier and then Present (Entity (Expr)) and then Ekind (Entity (Expr)) = E_In_Parameter and then Present (Discriminal_Link (Entity (Expr))) then Rewrite (Expr, Make_Selected_Component (Loc, ! Prefix => New_Occurrence_Of (Obj, Loc), Selector_Name => Make_Identifier (Loc, Chars (Expr)))); end if; return OK; --- 2427,2442 ---- function Rewrite_Discriminant (Expr : Node_Id) return Traverse_Result is begin ! if Is_Entity_Name (Expr) and then Present (Entity (Expr)) and then Ekind (Entity (Expr)) = E_In_Parameter and then Present (Discriminal_Link (Entity (Expr))) + and then Scope (Discriminal_Link (Entity (Expr))) + = Base_Type (Etype (N)) then Rewrite (Expr, Make_Selected_Component (Loc, ! Prefix => New_Copy_Tree (Lhs), Selector_Name => Make_Identifier (Loc, Chars (Expr)))); end if; return OK; *************** package body Exp_Aggr is *** 2837,2848 **** -- constructor to ensure the proper initialization of the _Tag -- component. ! if Is_CPP_Class (Typ) then ! pragma Assert (Present (Base_Init_Proc (Typ))); ! Append_List_To (L, ! Build_Initialization_Call (Loc, ! Id_Ref => Lhs, ! Typ => Typ)); end if; -- Generate the assignments, component by component --- 2840,2900 ---- -- constructor to ensure the proper initialization of the _Tag -- component. ! if Is_CPP_Class (Root_Type (Typ)) ! and then CPP_Num_Prims (Typ) > 0 ! then ! Invoke_Constructor : declare ! CPP_Parent : constant Entity_Id := ! Enclosing_CPP_Parent (Typ); ! ! procedure Invoke_IC_Proc (T : Entity_Id); ! -- Recursive routine used to climb to parents. Required because ! -- parents must be initialized before descendants to ensure ! -- propagation of inherited C++ slots. ! ! -------------------- ! -- Invoke_IC_Proc -- ! -------------------- ! ! procedure Invoke_IC_Proc (T : Entity_Id) is ! begin ! -- Avoid generating extra calls. Initialization required ! -- only for types defined from the level of derivation of ! -- type of the constructor and the type of the aggregate. ! ! if T = CPP_Parent then ! return; ! end if; ! ! Invoke_IC_Proc (Etype (T)); ! ! -- Generate call to the IC routine ! ! if Present (CPP_Init_Proc (T)) then ! Append_To (L, ! Make_Procedure_Call_Statement (Loc, ! New_Reference_To (CPP_Init_Proc (T), Loc))); ! end if; ! end Invoke_IC_Proc; ! ! -- Start of processing for Invoke_Constructor ! ! begin ! -- Implicit invocation of the C++ constructor ! ! if Nkind (N) = N_Aggregate then ! Append_To (L, ! Make_Procedure_Call_Statement (Loc, ! Name => ! New_Reference_To ! (Base_Init_Proc (CPP_Parent), Loc), ! Parameter_Associations => New_List ( ! Unchecked_Convert_To (CPP_Parent, ! New_Copy_Tree (Lhs))))); ! end if; ! ! Invoke_IC_Proc (Typ); ! end Invoke_Constructor; end if; -- Generate the assignments, component by component *************** package body Exp_Aggr is *** 2860,2873 **** if Is_CPP_Constructor_Call (Expression (Comp)) then Append_List_To (L, Build_Initialization_Call (Loc, ! Id_Ref => Make_Selected_Component (Loc, ! Prefix => New_Copy_Tree (Target), ! Selector_Name => New_Occurrence_Of (Selector, ! Loc)), ! Typ => Etype (Selector), ! Enclos_Type => Typ, With_Default_Init => True, ! Constructor_Ref => Expression (Comp))); -- Ada 2005 (AI-287): For each default-initialized component generate -- a call to the corresponding IP subprogram if available. --- 2912,2925 ---- if Is_CPP_Constructor_Call (Expression (Comp)) then Append_List_To (L, Build_Initialization_Call (Loc, ! Id_Ref => Make_Selected_Component (Loc, ! Prefix => New_Copy_Tree (Target), ! Selector_Name => ! New_Occurrence_Of (Selector, Loc)), ! Typ => Etype (Selector), ! Enclos_Type => Typ, With_Default_Init => True, ! Constructor_Ref => Expression (Comp))); -- Ada 2005 (AI-287): For each default-initialized component generate -- a call to the corresponding IP subprogram if available. *************** package body Exp_Aggr is *** 2886,2893 **** declare Ctype : constant Entity_Id := Etype (Selector); ! Inside_Allocator : Boolean := False; ! P : Node_Id := Parent (N); begin if Is_Task_Type (Ctype) or else Has_Task (Ctype) then --- 2938,2945 ---- declare Ctype : constant Entity_Id := Etype (Selector); ! Inside_Allocator : Boolean := False; ! P : Node_Id := Parent (N); begin if Is_Task_Type (Ctype) or else Has_Task (Ctype) then *************** package body Exp_Aggr is *** 2908,2919 **** Append_List_To (L, Build_Initialization_Call (Loc, ! Id_Ref => Make_Selected_Component (Loc, ! Prefix => New_Copy_Tree (Target), ! Selector_Name => New_Occurrence_Of (Selector, ! Loc)), ! Typ => Etype (Selector), ! Enclos_Type => Typ, With_Default_Init => True)); -- Prepare for component assignment --- 2960,2971 ---- Append_List_To (L, Build_Initialization_Call (Loc, ! Id_Ref => Make_Selected_Component (Loc, ! Prefix => New_Copy_Tree (Target), ! Selector_Name => ! New_Occurrence_Of (Selector, Loc)), ! Typ => Etype (Selector), ! Enclos_Type => Typ, With_Default_Init => True)); -- Prepare for component assignment *************** package body Exp_Aggr is *** 2948,2962 **** if Needs_Finalization (Comp_Type) then Internal_Final_List := Make_Selected_Component (Loc, ! Prefix => Convert_To ( ! Scope (Original_Record_Component (Selector)), ! New_Copy_Tree (Target)), ! Selector_Name => ! Make_Identifier (Loc, Name_uController)); Internal_Final_List := Make_Selected_Component (Loc, ! Prefix => Internal_Final_List, Selector_Name => Make_Identifier (Loc, Name_F)); -- The internal final list can be part of a constant object --- 3000,3013 ---- if Needs_Finalization (Comp_Type) then Internal_Final_List := Make_Selected_Component (Loc, ! Prefix => Convert_To ! (Scope (Original_Record_Component (Selector)), ! New_Copy_Tree (Target)), ! Selector_Name => Make_Identifier (Loc, Name_uController)); Internal_Final_List := Make_Selected_Component (Loc, ! Prefix => Internal_Final_List, Selector_Name => Make_Identifier (Loc, Name_F)); -- The internal final list can be part of a constant object *************** package body Exp_Aggr is *** 3008,3016 **** -- the corresponding aggregate. declare ! SubE : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); SubD : constant Node_Id := Make_Subtype_Declaration (Loc, --- 3059,3065 ---- -- the corresponding aggregate. declare ! SubE : constant Entity_Id := Make_Temporary (Loc, 'T'); SubD : constant Node_Id := Make_Subtype_Declaration (Loc, *************** package body Exp_Aggr is *** 3597,3603 **** -- in place within the caller's scope). or else ! (Is_Inherently_Limited_Type (Typ) and then (Nkind (Parent (Parent_Node)) = N_Extended_Return_Statement or else Nkind (Parent_Node) = N_Simple_Return_Statement)) --- 3646,3652 ---- -- in place within the caller's scope). or else ! (Is_Immutably_Limited_Type (Typ) and then (Nkind (Parent (Parent_Node)) = N_Extended_Return_Statement or else Nkind (Parent_Node) = N_Simple_Return_Statement)) *************** package body Exp_Aggr is *** 3682,3688 **** function Is_Flat (N : Node_Id; Dims : Int) return Boolean; -- Return True iff the array N is flat (which is not trivial in the case ! -- of multidimensionsl aggregates). ----------------------------- -- Check_Static_Components -- --- 3731,3737 ---- function Is_Flat (N : Node_Id; Dims : Int) return Boolean; -- Return True iff the array N is flat (which is not trivial in the case ! -- of multidimensional aggregates). ----------------------------- -- Check_Static_Components -- *************** package body Exp_Aggr is *** 3717,3728 **** then Expr := First (Component_Associations (N)); while Present (Expr) loop ! if Nkind (Expression (Expr)) = N_Integer_Literal then null; elsif Nkind (Expression (Expr)) /= N_Aggregate ! or else ! not Compile_Time_Known_Aggregate (Expression (Expr)) or else Expansion_Delayed (Expression (Expr)) then Static_Components := False; --- 3766,3785 ---- then Expr := First (Component_Associations (N)); while Present (Expr) loop ! if Nkind_In (Expression (Expr), N_Integer_Literal, ! N_Real_Literal) ! then ! null; ! ! elsif Is_Entity_Name (Expression (Expr)) ! and then Present (Entity (Expression (Expr))) ! and then Ekind (Entity (Expression (Expr))) = ! E_Enumeration_Literal ! then null; elsif Nkind (Expression (Expr)) /= N_Aggregate ! or else not Compile_Time_Known_Aggregate (Expression (Expr)) or else Expansion_Delayed (Expression (Expr)) then Static_Components := False; *************** package body Exp_Aggr is *** 3784,3793 **** Rep_Count : Nat; -- Used to validate Max_Others_Replicate limit ! Elmt : Node_Id; ! Num : Int := UI_To_Int (Lov); ! Choice : Node_Id; ! Lo, Hi : Node_Id; begin if Present (Expressions (N)) then --- 3841,3851 ---- Rep_Count : Nat; -- Used to validate Max_Others_Replicate limit ! Elmt : Node_Id; ! Num : Int := UI_To_Int (Lov); ! Choice_Index : Int; ! Choice : Node_Id; ! Lo, Hi : Node_Id; begin if Present (Expressions (N)) then *************** package body Exp_Aggr is *** 3886,3894 **** exit Component_Loop; ! -- Case of a subtype mark ! elsif Nkind (Choice) = N_Identifier and then Is_Type (Entity (Choice)) then Lo := Type_Low_Bound (Etype (Choice)); --- 3944,3952 ---- exit Component_Loop; ! -- Case of a subtype mark, identifier or expanded name ! elsif Is_Entity_Name (Choice) and then Is_Type (Entity (Choice)) then Lo := Type_Low_Bound (Etype (Choice)); *************** package body Exp_Aggr is *** 3913,3921 **** return False; else ! Vals (UI_To_Int (Expr_Value (Choice))) := ! New_Copy_Tree (Expression (Elmt)); ! goto Continue; end if; end if; --- 3971,3988 ---- return False; else ! Choice_Index := UI_To_Int (Expr_Value (Choice)); ! if Choice_Index in Vals'Range then ! Vals (Choice_Index) := ! New_Copy_Tree (Expression (Elmt)); ! goto Continue; ! ! else ! -- Choice is statically out-of-range, will be ! -- rewritten to raise Constraint_Error. ! ! return False; ! end if; end if; end if; *************** package body Exp_Aggr is *** 4122,4133 **** -- array sub-aggregate we start the computation from. Dim is the -- dimension corresponding to the sub-aggregate. - function Has_Address_Clause (D : Node_Id) return Boolean; - -- If the aggregate is the expression in an object declaration, it - -- cannot be expanded in place. This function does a lookahead in the - -- current declarative part to find an address clause for the object - -- being declared. - function In_Place_Assign_OK return Boolean; -- Simple predicate to determine whether an aggregate assignment can -- be done in place, because none of the new values can depend on the --- 4189,4194 ---- *************** package body Exp_Aggr is *** 4139,4163 **** -- Sub_Aggr is an array sub-aggregate. Dim is the dimension -- corresponding to the sub-aggregate. ---------------------------- -- Build_Constrained_Type -- ---------------------------- procedure Build_Constrained_Type (Positional : Boolean) is Loc : constant Source_Ptr := Sloc (N); ! Agg_Type : Entity_Id; Comp : Node_Id; Decl : Node_Id; Typ : constant Entity_Id := Etype (N); ! Indices : constant List_Id := New_List; Num : Int; Sub_Agg : Node_Id; begin - Agg_Type := - Make_Defining_Identifier ( - Loc, New_Internal_Name ('A')); - -- If the aggregate is purely positional, all its subaggregates -- have the same size. We collect the dimensions from the first -- subaggregate at each level. --- 4200,4225 ---- -- Sub_Aggr is an array sub-aggregate. Dim is the dimension -- corresponding to the sub-aggregate. + function Safe_Left_Hand_Side (N : Node_Id) return Boolean; + -- In addition to Maybe_In_Place_OK, in order for an aggregate to be + -- built directly into the target of the assignment it must be free + -- of side-effects. + ---------------------------- -- Build_Constrained_Type -- ---------------------------- procedure Build_Constrained_Type (Positional : Boolean) is Loc : constant Source_Ptr := Sloc (N); ! Agg_Type : constant Entity_Id := Make_Temporary (Loc, 'A'); Comp : Node_Id; Decl : Node_Id; Typ : constant Entity_Id := Etype (N); ! Indexes : constant List_Id := New_List; Num : Int; Sub_Agg : Node_Id; begin -- If the aggregate is purely positional, all its subaggregates -- have the same size. We collect the dimensions from the first -- subaggregate at each level. *************** package body Exp_Aggr is *** 4175,4200 **** Next (Comp); end loop; ! Append ( Make_Range (Loc, ! Low_Bound => Make_Integer_Literal (Loc, 1), ! High_Bound => ! Make_Integer_Literal (Loc, Num)), ! Indices); end loop; else -- We know the aggregate type is unconstrained and the aggregate -- is not processable by the back end, therefore not necessarily -- positional. Retrieve each dimension bounds (computed earlier). - -- earlier. for D in 1 .. Number_Dimensions (Typ) loop Append ( Make_Range (Loc, Low_Bound => Aggr_Low (D), High_Bound => Aggr_High (D)), ! Indices); end loop; end if; --- 4237,4259 ---- Next (Comp); end loop; ! Append_To (Indexes, Make_Range (Loc, ! Low_Bound => Make_Integer_Literal (Loc, 1), ! High_Bound => Make_Integer_Literal (Loc, Num))); end loop; else -- We know the aggregate type is unconstrained and the aggregate -- is not processable by the back end, therefore not necessarily -- positional. Retrieve each dimension bounds (computed earlier). for D in 1 .. Number_Dimensions (Typ) loop Append ( Make_Range (Loc, Low_Bound => Aggr_Low (D), High_Bound => Aggr_High (D)), ! Indexes); end loop; end if; *************** package body Exp_Aggr is *** 4203,4212 **** Defining_Identifier => Agg_Type, Type_Definition => Make_Constrained_Array_Definition (Loc, ! Discrete_Subtype_Definitions => Indices, ! Component_Definition => Make_Component_Definition (Loc, ! Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Component_Type (Typ), Loc)))); --- 4262,4271 ---- Defining_Identifier => Agg_Type, Type_Definition => Make_Constrained_Array_Definition (Loc, ! Discrete_Subtype_Definitions => Indexes, ! Component_Definition => Make_Component_Definition (Loc, ! Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Component_Type (Typ), Loc)))); *************** package body Exp_Aggr is *** 4435,4469 **** end Compute_Others_Present; ------------------------ - -- Has_Address_Clause -- - ------------------------ - - function Has_Address_Clause (D : Node_Id) return Boolean is - Id : constant Entity_Id := Defining_Identifier (D); - Decl : Node_Id; - - begin - Decl := Next (D); - while Present (Decl) loop - if Nkind (Decl) = N_At_Clause - and then Chars (Identifier (Decl)) = Chars (Id) - then - return True; - - elsif Nkind (Decl) = N_Attribute_Definition_Clause - and then Chars (Decl) = Name_Address - and then Chars (Name (Decl)) = Chars (Id) - then - return True; - end if; - - Next (Decl); - end loop; - - return False; - end Has_Address_Clause; - - ------------------------ -- In_Place_Assign_OK -- ------------------------ --- 4494,4499 ---- *************** package body Exp_Aggr is *** 4903,4909 **** end if; end Others_Check; ! -- Remaining Expand_Array_Aggregate variables Tmp : Entity_Id; -- Holds the temporary aggregate value --- 4933,5003 ---- end if; end Others_Check; ! ------------------------- ! -- Safe_Left_Hand_Side -- ! ------------------------- ! ! function Safe_Left_Hand_Side (N : Node_Id) return Boolean is ! function Is_Safe_Index (Indx : Node_Id) return Boolean; ! -- If the left-hand side includes an indexed component, check that ! -- the indexes are free of side-effect. ! ! ------------------- ! -- Is_Safe_Index -- ! ------------------- ! ! function Is_Safe_Index (Indx : Node_Id) return Boolean is ! begin ! if Is_Entity_Name (Indx) then ! return True; ! ! elsif Nkind (Indx) = N_Integer_Literal then ! return True; ! ! elsif Nkind (Indx) = N_Function_Call ! and then Is_Entity_Name (Name (Indx)) ! and then ! Has_Pragma_Pure_Function (Entity (Name (Indx))) ! then ! return True; ! ! elsif Nkind (Indx) = N_Type_Conversion ! and then Is_Safe_Index (Expression (Indx)) ! then ! return True; ! ! else ! return False; ! end if; ! end Is_Safe_Index; ! ! -- Start of processing for Safe_Left_Hand_Side ! ! begin ! if Is_Entity_Name (N) then ! return True; ! ! elsif Nkind_In (N, N_Explicit_Dereference, N_Selected_Component) ! and then Safe_Left_Hand_Side (Prefix (N)) ! then ! return True; ! ! elsif Nkind (N) = N_Indexed_Component ! and then Safe_Left_Hand_Side (Prefix (N)) ! and then ! Is_Safe_Index (First (Expressions (N))) ! then ! return True; ! ! elsif Nkind (N) = N_Unchecked_Type_Conversion then ! return Safe_Left_Hand_Side (Expression (N)); ! ! else ! return False; ! end if; ! end Safe_Left_Hand_Side; ! ! -- Local variables Tmp : Entity_Id; -- Holds the temporary aggregate value *************** package body Exp_Aggr is *** 4927,4933 **** end if; -- If the semantic analyzer has determined that aggregate N will raise ! -- Constraint_Error at run-time, then the aggregate node has been -- replaced with an N_Raise_Constraint_Error node and we should -- never get here. --- 5021,5027 ---- end if; -- If the semantic analyzer has determined that aggregate N will raise ! -- Constraint_Error at run time, then the aggregate node has been -- replaced with an N_Raise_Constraint_Error node and we should -- never get here. *************** package body Exp_Aggr is *** 5162,5167 **** --- 5256,5263 ---- Build_Activation_Chain_Entity (N); end if; + -- Should document these individual tests ??? + if not Has_Default_Init_Comps (N) and then Comes_From_Source (Parent (N)) and then Nkind (Parent (N)) = N_Object_Declaration *************** package body Exp_Aggr is *** 5170,5176 **** and then N = Expression (Parent (N)) and then not Is_Bit_Packed_Array (Typ) and then not Has_Controlled_Component (Typ) ! and then not Has_Address_Clause (Parent (N)) then Tmp := Defining_Identifier (Parent (N)); Set_No_Initialization (Parent (N)); --- 5266,5278 ---- and then N = Expression (Parent (N)) and then not Is_Bit_Packed_Array (Typ) and then not Has_Controlled_Component (Typ) ! ! -- If the aggregate is the expression in an object declaration, it ! -- cannot be expanded in place. Lookahead in the current declarative ! -- part to find an address clause for the object being declared. If ! -- one is present, we cannot build in place. Unclear comment??? ! ! and then not Has_Following_Address_Clause (Parent (N)) then Tmp := Defining_Identifier (Parent (N)); Set_No_Initialization (Parent (N)); *************** package body Exp_Aggr is *** 5203,5211 **** -- In the remaining cases the aggregate is the RHS of an assignment elsif Maybe_In_Place_OK ! and then Is_Entity_Name (Name (Parent (N))) then ! Tmp := Entity (Name (Parent (N))); if Etype (Tmp) /= Etype (N) then Apply_Length_Check (N, Etype (Tmp)); --- 5305,5313 ---- -- In the remaining cases the aggregate is the RHS of an assignment elsif Maybe_In_Place_OK ! and then Safe_Left_Hand_Side (Name (Parent (N))) then ! Tmp := Name (Parent (N)); if Etype (Tmp) /= Etype (N) then Apply_Length_Check (N, Etype (Tmp)); *************** package body Exp_Aggr is *** 5219,5234 **** end if; elsif Maybe_In_Place_OK - and then Nkind (Name (Parent (N))) = N_Explicit_Dereference - and then Is_Entity_Name (Prefix (Name (Parent (N)))) - then - Tmp := Name (Parent (N)); - - if Etype (Tmp) /= Etype (N) then - Apply_Length_Check (N, Etype (Tmp)); - end if; - - elsif Maybe_In_Place_OK and then Nkind (Name (Parent (N))) = N_Slice and then Safe_Slice_Assignment (N) then --- 5321,5326 ---- *************** package body Exp_Aggr is *** 5365,5371 **** -- of the following form (c1 and c2 are inherited components) -- (Exp with c3 => a, c4 => b) ! -- ==> (c1 => Exp.c1, c2 => Exp.c2, c1 => a, c2 => b) else Set_Etype (N, Typ); --- 5457,5463 ---- -- of the following form (c1 and c2 are inherited components) -- (Exp with c3 => a, c4 => b) ! -- ==> (c1 => Exp.c1, c2 => Exp.c2, c3 => a, c4 => b) else Set_Etype (N, Typ); *************** package body Exp_Aggr is *** 5442,5447 **** --- 5534,5547 ---- C := First (Comps); while Present (C) loop + + -- If the component has box initialization, expansion is needed + -- and component is not ready for backend. + + if Box_Present (C) then + return True; + end if; + if Nkind (Expression (C)) = N_Qualified_Expression then Expr_Q := Expression (Expression (C)); else *************** package body Exp_Aggr is *** 5527,5539 **** end if; -- Ada 2005 (AI-318-2): We need to convert to assignments if components ! -- are build-in-place function calls. This test could be more specific, ! -- but doing it for all inherently limited aggregates seems harmless. ! -- The assignments will turn into build-in-place function calls (see ! -- Make_Build_In_Place_Call_In_Assignment). ! if Ada_Version >= Ada_05 and then Is_Inherently_Limited_Type (Typ) then ! Convert_To_Assignments (N, Typ); -- Gigi doesn't handle properly temporaries of variable size -- so we generate it in the front-end --- 5627,5660 ---- end if; -- Ada 2005 (AI-318-2): We need to convert to assignments if components ! -- are build-in-place function calls. The assignments will each turn ! -- into a build-in-place function call. If components are all static, ! -- we can pass the aggregate to the backend regardless of limitedness. ! -- Extension aggregates, aggregates in extended return statements, and ! -- aggregates for C++ imported types must be expanded. ! ! if Ada_Version >= Ada_2005 and then Is_Immutably_Limited_Type (Typ) then ! if not Nkind_In (Parent (N), N_Object_Declaration, ! N_Component_Association) ! then ! Convert_To_Assignments (N, Typ); ! ! elsif Nkind (N) = N_Extension_Aggregate ! or else Convention (Typ) = Convention_CPP ! then ! Convert_To_Assignments (N, Typ); ! ! elsif not Size_Known_At_Compile_Time (Typ) ! or else Component_Not_OK_For_Backend ! or else not Static_Components ! then ! Convert_To_Assignments (N, Typ); ! ! else ! Set_Compile_Time_Known_Aggregate (N); ! Set_Expansion_Delayed (N, False); ! end if; -- Gigi doesn't handle properly temporaries of variable size -- so we generate it in the front-end *************** package body Exp_Aggr is *** 5720,5728 **** Decl := Make_Subtype_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('T')), Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => --- 5841,5847 ---- Decl := Make_Subtype_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'T'), Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => *************** package body Exp_Aggr is *** 6018,6024 **** Index => First_Index (Typ), Into => Target, Scalar_Comp => Is_Scalar_Type (Component_Type (Typ)), ! Indices => No_List, Flist => Flist); end if; end Late_Expansion; --- 6137,6143 ---- Index => First_Index (Typ), Into => Target, Scalar_Comp => Is_Scalar_Type (Component_Type (Typ)), ! Indexes => No_List, Flist => Flist); end if; end Late_Expansion; *************** package body Exp_Aggr is *** 6411,6419 **** and then Nkind (First (Choices (First (Component_Associations (N))))) = N_Others_Choice then ! Expr := ! Expression (First (Component_Associations (N))); ! L_J := Make_Defining_Identifier (Loc, New_Internal_Name ('J')); L_Iter := Make_Iteration_Scheme (Loc, --- 6530,6537 ---- and then Nkind (First (Choices (First (Component_Associations (N))))) = N_Others_Choice then ! Expr := Expression (First (Component_Associations (N))); ! L_J := Make_Temporary (Loc, 'J'); L_Iter := Make_Iteration_Scheme (Loc, diff -Nrcpad gcc-4.5.2/gcc/ada/exp_atag.adb gcc-4.6.0/gcc/ada/exp_atag.adb *** gcc-4.5.2/gcc/ada/exp_atag.adb Mon Nov 30 11:55:21 2009 --- gcc-4.6.0/gcc/ada/exp_atag.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2006-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2006-2010, 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,31 **** --- 26,32 ---- with Atree; use Atree; with Einfo; use Einfo; with Elists; use Elists; + with Exp_Disp; use Exp_Disp; with Exp_Util; use Exp_Util; with Namet; use Namet; with Nlists; use Nlists; *************** with Nmake; use Nmake; *** 33,38 **** --- 34,40 ---- with Rtsfind; use Rtsfind; with Sinfo; use Sinfo; with Sem_Aux; use Sem_Aux; + with Sem_Disp; use Sem_Disp; with Sem_Util; use Sem_Util; with Stand; use Stand; with Snames; use Snames; *************** package body Exp_Atag is *** 81,88 **** Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => ! Make_Identifier (Loc, Name_uC), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc), --- 83,89 ---- Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => Make_Identifier (Loc, Name_uC), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc), *************** package body Exp_Atag is *** 110,135 **** Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, ! Left_Opnd => ! Make_Identifier (Loc, Name_uC), Right_Opnd => New_Reference_To (RTE (RE_POK_Procedure), Loc)), Right_Opnd => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, ! Left_Opnd => ! Make_Identifier (Loc, Name_uC), Right_Opnd => ! New_Reference_To (RTE ( ! RE_POK_Protected_Procedure), Loc)), Right_Opnd => Make_Op_Eq (Loc, ! Left_Opnd => ! Make_Identifier (Loc, Name_uC), Right_Opnd => ! New_Reference_To (RTE ( ! RE_POK_Task_Procedure), Loc)))), Then_Statements => New_List ( --- 111,133 ---- Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, ! Left_Opnd => Make_Identifier (Loc, Name_uC), Right_Opnd => New_Reference_To (RTE (RE_POK_Procedure), Loc)), Right_Opnd => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, ! Left_Opnd => Make_Identifier (Loc, Name_uC), Right_Opnd => ! New_Reference_To ! (RTE (RE_POK_Protected_Procedure), Loc)), Right_Opnd => Make_Op_Eq (Loc, ! Left_Opnd => Make_Identifier (Loc, Name_uC), Right_Opnd => ! New_Reference_To ! (RTE (RE_POK_Task_Procedure), Loc)))), Then_Statements => New_List ( *************** package body Exp_Atag is *** 150,163 **** Related_Nod : Node_Id; New_Node : out Node_Id) is ! Tag_Addr : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')); ! Obj_TSD : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')); ! Typ_TSD : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')); ! Index : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')); begin -- Generate: --- 148,157 ---- Related_Nod : Node_Id; New_Node : out Node_Id) is ! Tag_Addr : constant Entity_Id := Make_Temporary (Loc, 'D', Obj_Tag_Node); ! Obj_TSD : constant Entity_Id := Make_Temporary (Loc, 'D'); ! Typ_TSD : constant Entity_Id := Make_Temporary (Loc, 'D'); ! Index : constant Entity_Id := Make_Temporary (Loc, 'D'); begin -- Generate: *************** package body Exp_Atag is *** 321,336 **** New_Reference_To (RTU_Entity (System_Storage_Elements), Loc), Selector_Name => ! Make_Identifier (Loc, ! Chars => Name_Op_Subtract)), Parameter_Associations => New_List ( Ctrl_Tag, ! 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; ------------------------- -- Build_Inherit_Prims -- ------------------------- --- 315,581 ---- New_Reference_To (RTU_Entity (System_Storage_Elements), Loc), Selector_Name => ! Make_Identifier (Loc, Name_Op_Subtract)), Parameter_Associations => New_List ( Ctrl_Tag, ! 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; + ----------------------------- + -- Build_Inherit_CPP_Prims -- + ----------------------------- + + function Build_Inherit_CPP_Prims (Typ : Entity_Id) return List_Id is + Loc : constant Source_Ptr := Sloc (Typ); + CPP_Nb_Prims : constant Nat := CPP_Num_Prims (Typ); + CPP_Table : array (1 .. CPP_Nb_Prims) of Boolean := (others => False); + CPP_Typ : constant Entity_Id := Enclosing_CPP_Parent (Typ); + Result : constant List_Id := New_List; + Parent_Typ : constant Entity_Id := Etype (Typ); + E : Entity_Id; + Elmt : Elmt_Id; + Parent_Tag : Entity_Id; + Prim : Entity_Id; + Prim_Pos : Nat; + Typ_Tag : Entity_Id; + + begin + pragma Assert (not Is_CPP_Class (Typ)); + + -- No code needed if this type has no primitives inherited from C++ + + if CPP_Nb_Prims = 0 then + return Result; + end if; + + -- Stage 1: Inherit and override C++ slots of the primary dispatch table + + -- Generate: + -- Typ'Tag (Prim_Pos) := Prim'Unrestricted_Access; + + Parent_Tag := Node (First_Elmt (Access_Disp_Table (Parent_Typ))); + Typ_Tag := Node (First_Elmt (Access_Disp_Table (Typ))); + + Elmt := First_Elmt (Primitive_Operations (Typ)); + while Present (Elmt) loop + Prim := Node (Elmt); + E := Ultimate_Alias (Prim); + Prim_Pos := UI_To_Int (DT_Position (E)); + + -- Skip predefined, abstract, and eliminated primitives. Skip also + -- primitives not located in the C++ part of the dispatch table. + + if not Is_Predefined_Dispatching_Operation (Prim) + and then not Is_Predefined_Dispatching_Operation (E) + and then not Present (Interface_Alias (Prim)) + and then not Is_Abstract_Subprogram (E) + and then not Is_Eliminated (E) + and then Prim_Pos <= CPP_Nb_Prims + and then Find_Dispatching_Type (E) = Typ + then + -- Remember that this slot is used + + pragma Assert (CPP_Table (Prim_Pos) = False); + CPP_Table (Prim_Pos) := True; + + Append_To (Result, + Make_Assignment_Statement (Loc, + Name => + Make_Indexed_Component (Loc, + Prefix => + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To + (Node (Last_Elmt (Access_Disp_Table (Typ))), + New_Reference_To (Typ_Tag, Loc))), + Expressions => + New_List (Make_Integer_Literal (Loc, Prim_Pos))), + + Expression => + Unchecked_Convert_To (RTE (RE_Prim_Ptr), + Make_Attribute_Reference (Loc, + Prefix => New_Reference_To (E, Loc), + Attribute_Name => Name_Unrestricted_Access)))); + end if; + + Next_Elmt (Elmt); + end loop; + + -- If all primitives have been overridden then there is no need to copy + -- from Typ's parent its dispatch table. Otherwise, if some primitive is + -- inherited from the parent we copy only the C++ part of the dispatch + -- table from the parent before the assignments that initialize the + -- overridden primitives. + + -- Generate: + + -- type CPP_TypG is array (1 .. CPP_Nb_Prims) ofd Prim_Ptr; + -- type CPP_TypH is access CPP_TypG; + -- CPP_TypG!(Typ_Tag).all := CPP_TypG!(Parent_Tag).all; + + -- Note: There is no need to duplicate the declarations of CPP_TypG and + -- CPP_TypH because, for expansion of dispatching calls, these + -- entities are stored in the last elements of Access_Disp_Table. + + for J in CPP_Table'Range loop + if not CPP_Table (J) then + Prepend_To (Result, + Make_Assignment_Statement (Loc, + Name => + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To + (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))), + New_Reference_To (Typ_Tag, Loc))), + Expression => + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To + (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))), + New_Reference_To (Parent_Tag, Loc))))); + exit; + end if; + end loop; + + -- Stage 2: Inherit and override C++ slots of secondary dispatch tables + + declare + Iface : Entity_Id; + Iface_Nb_Prims : Nat; + Parent_Ifaces_List : Elist_Id; + Parent_Ifaces_Comp_List : Elist_Id; + Parent_Ifaces_Tag_List : Elist_Id; + Parent_Iface_Tag_Elmt : Elmt_Id; + Typ_Ifaces_List : Elist_Id; + Typ_Ifaces_Comp_List : Elist_Id; + Typ_Ifaces_Tag_List : Elist_Id; + Typ_Iface_Tag_Elmt : Elmt_Id; + + begin + Collect_Interfaces_Info + (T => Parent_Typ, + Ifaces_List => Parent_Ifaces_List, + Components_List => Parent_Ifaces_Comp_List, + Tags_List => Parent_Ifaces_Tag_List); + + Collect_Interfaces_Info + (T => Typ, + Ifaces_List => Typ_Ifaces_List, + Components_List => Typ_Ifaces_Comp_List, + Tags_List => Typ_Ifaces_Tag_List); + + Parent_Iface_Tag_Elmt := First_Elmt (Parent_Ifaces_Tag_List); + Typ_Iface_Tag_Elmt := First_Elmt (Typ_Ifaces_Tag_List); + while Present (Parent_Iface_Tag_Elmt) loop + Parent_Tag := Node (Parent_Iface_Tag_Elmt); + Typ_Tag := Node (Typ_Iface_Tag_Elmt); + + pragma Assert + (Related_Type (Parent_Tag) = Related_Type (Typ_Tag)); + Iface := Related_Type (Parent_Tag); + + Iface_Nb_Prims := + UI_To_Int (DT_Entry_Count (First_Tag_Component (Iface))); + + if Iface_Nb_Prims > 0 then + + -- Update slots of overridden primitives + + declare + Last_Nod : constant Node_Id := Last (Result); + Nb_Prims : constant Nat := UI_To_Int + (DT_Entry_Count + (First_Tag_Component (Iface))); + Elmt : Elmt_Id; + Prim : Entity_Id; + E : Entity_Id; + Prim_Pos : Nat; + + Prims_Table : array (1 .. Nb_Prims) of Boolean; + + begin + Prims_Table := (others => False); + + Elmt := First_Elmt (Primitive_Operations (Typ)); + while Present (Elmt) loop + Prim := Node (Elmt); + E := Ultimate_Alias (Prim); + + if not Is_Predefined_Dispatching_Operation (Prim) + and then Present (Interface_Alias (Prim)) + and then Find_Dispatching_Type (Interface_Alias (Prim)) + = Iface + and then not Is_Abstract_Subprogram (E) + and then not Is_Eliminated (E) + and then Find_Dispatching_Type (E) = Typ + then + Prim_Pos := UI_To_Int (DT_Position (Prim)); + + -- Remember that this slot is already initialized + + pragma Assert (Prims_Table (Prim_Pos) = False); + Prims_Table (Prim_Pos) := True; + + Append_To (Result, + Make_Assignment_Statement (Loc, + Name => + Make_Indexed_Component (Loc, + Prefix => + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To + (Node + (Last_Elmt + (Access_Disp_Table (Iface))), + New_Reference_To (Typ_Tag, Loc))), + Expressions => + New_List + (Make_Integer_Literal (Loc, Prim_Pos))), + + Expression => + Unchecked_Convert_To (RTE (RE_Prim_Ptr), + Make_Attribute_Reference (Loc, + Prefix => New_Reference_To (E, Loc), + Attribute_Name => + Name_Unrestricted_Access)))); + end if; + + Next_Elmt (Elmt); + end loop; + + -- Check if all primitives from the parent have been + -- overridden (to avoid copying the whole secondary + -- table from the parent). + + -- IfaceG!(Typ_Sec_Tag).all := IfaceG!(Parent_Sec_Tag).all; + + for J in Prims_Table'Range loop + if not Prims_Table (J) then + Insert_After (Last_Nod, + Make_Assignment_Statement (Loc, + Name => + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To + (Node (Last_Elmt (Access_Disp_Table (Iface))), + New_Reference_To (Typ_Tag, Loc))), + Expression => + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To + (Node (Last_Elmt (Access_Disp_Table (Iface))), + New_Reference_To (Parent_Tag, Loc))))); + exit; + end if; + end loop; + end; + end if; + + Next_Elmt (Typ_Iface_Tag_Elmt); + Next_Elmt (Parent_Iface_Tag_Elmt); + end loop; + end; + + return Result; + end Build_Inherit_CPP_Prims; + ------------------------- -- Build_Inherit_Prims -- ------------------------- *************** package body Exp_Atag is *** 514,528 **** 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; ------------------------------------------ --- 759,773 ---- 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, 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; ------------------------------------------ *************** package body Exp_Atag is *** 617,631 **** 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; --- 862,876 ---- 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, 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; *************** package body Exp_Atag is *** 648,656 **** Prefix => New_Reference_To (RTU_Entity (System_Storage_Elements), Loc), ! Selector_Name => ! Make_Identifier (Loc, ! Chars => Name_Op_Subtract)), Parameter_Associations => New_List ( Tag_Node_Addr, --- 893,899 ---- Prefix => New_Reference_To (RTU_Entity (System_Storage_Elements), Loc), ! Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)), Parameter_Associations => New_List ( Tag_Node_Addr, diff -Nrcpad gcc-4.5.2/gcc/ada/exp_atag.ads gcc-4.6.0/gcc/ada/exp_atag.ads *** gcc-4.5.2/gcc/ada/exp_atag.ads Mon Nov 30 11:55:21 2009 --- gcc-4.6.0/gcc/ada/exp_atag.ads Tue Aug 10 14:29:36 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2006-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2006-2010, 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- -- *************** package Exp_Atag is *** 97,102 **** --- 97,107 ---- -- -- Generates: TSD (Tag).Transportable; + function Build_Inherit_CPP_Prims (Typ : Entity_Id) return List_Id; + -- Build code that copies from Typ's parent the dispatch table slots of + -- inherited primitives and updates slots of overridden primitives. The + -- generated code handles primary and secondary dispatch tables of Typ. + function Build_Inherit_Predefined_Prims (Loc : Source_Ptr; Old_Tag_Node : Node_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_attr.adb gcc-4.6.0/gcc/ada/exp_attr.adb *** gcc-4.5.2/gcc/ada/exp_attr.adb Wed Oct 28 13:50:10 2009 --- gcc-4.6.0/gcc/ada/exp_attr.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Attr is *** 84,90 **** Check : Boolean); -- The body for a stream subprogram may be generated outside of the scope -- of the type. If the type is fully private, it may depend on the full ! -- view of other types (e.g. indices) that are currently private as well. -- We install the declarations of the package in which the type is declared -- before compiling the body in what is its proper environment. The Check -- parameter indicates if checks are to be suppressed for the stream body. --- 84,90 ---- Check : Boolean); -- The body for a stream subprogram may be generated outside of the scope -- of the type. If the type is fully private, it may depend on the full ! -- view of other types (e.g. indexes) that are currently private as well. -- We install the declarations of the package in which the type is declared -- before compiling the body in what is its proper environment. The Check -- parameter indicates if checks are to be suppressed for the stream body. *************** package body Exp_Attr is *** 96,102 **** (N : Node_Id; Pref : Node_Id; Typ : Entity_Id); - -- An attribute reference to a protected subprogram is transformed into -- a pair of pointers: one to the object, and one to the operations. -- This expansion is performed for 'Access and for 'Unrestricted_Access. --- 96,101 ---- *************** package body Exp_Attr is *** 156,161 **** --- 155,165 ---- -- defining it, is returned. In both cases, inheritance of representation -- aspects is thus taken into account. + function Full_Base (T : Entity_Id) return Entity_Id; + -- The stream functions need to examine the underlying representation of + -- composite types. In some cases T may be non-private but its base type + -- is, in which case the function returns the corresponding full view. + function Get_Stream_Convert_Pragma (T : Entity_Id) return Node_Id; -- Given a type, find a corresponding stream convert pragma that applies to -- the implementation base type of this type (Typ). If found, return the *************** package body Exp_Attr is *** 280,295 **** -- Start of processing for Expand_Access_To_Protected_Op begin ! -- Within the body of the protected type, the prefix ! -- designates a local operation, and the object is the first ! -- parameter of the corresponding protected body of the ! -- current enclosing operation. if Is_Entity_Name (Pref) then if May_Be_External_Call then Sub := ! New_Occurrence_Of ! (External_Subprogram (Entity (Pref)), Loc); else Sub := New_Occurrence_Of --- 284,297 ---- -- Start of processing for Expand_Access_To_Protected_Op begin ! -- Within the body of the protected type, the prefix designates a local ! -- operation, and the object is the first parameter of the corresponding ! -- protected body of the current enclosing operation. if Is_Entity_Name (Pref) then if May_Be_External_Call then Sub := ! New_Occurrence_Of (External_Subprogram (Entity (Pref)), Loc); else Sub := New_Occurrence_Of *************** package body Exp_Attr is *** 372,377 **** --- 374,384 ---- Make_Aggregate (Loc, Expressions => New_List (Obj_Ref, Sub_Ref)); + -- Sub_Ref has been marked as analyzed, but we still need to make sure + -- Sub is correctly frozen. + + Freeze_Before (N, Entity (Sub)); + Rewrite (N, Agg); Analyze_And_Resolve (N, E_T); *************** package body Exp_Attr is *** 530,538 **** and then Is_Written then declare ! Temp : constant Entity_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('V')); Decl : Node_Id; Assn : Node_Id; --- 537,543 ---- and then Is_Written then declare ! Temp : constant Entity_Id := Make_Temporary (Loc, 'V'); Decl : Node_Id; Assn : Node_Id; *************** package body Exp_Attr is *** 648,654 **** -- 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); --- 653,659 ---- -- eventually we plan to expand the functions that are treated as -- build-in-place to include other composite result types. ! if Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Pref) then Make_Build_In_Place_Call_In_Anonymous_Context (Pref); *************** package body Exp_Attr is *** 1208,1213 **** --- 1213,1232 ---- Analyze_And_Resolve (N, RTE (RE_AST_Handler)); end AST_Entry; + --------- + -- Bit -- + --------- + + -- We compute this if a packed array reference was present, otherwise we + -- leave the computation up to the back end. + + when Attribute_Bit => + if Involves_Packed_Array_Reference (Pref) then + Expand_Packed_Bit_Reference (N); + else + Apply_Universal_Integer_Attribute_Checks (N); + end if; + ------------------ -- Bit_Position -- ------------------ *************** package body Exp_Attr is *** 1220,1227 **** -- in generated code (i.e. the prefix is an identifier that -- references the component or discriminant entity). ! when Attribute_Bit_Position => Bit_Position : ! declare CE : Entity_Id; begin --- 1239,1245 ---- -- in generated code (i.e. the prefix is an identifier that -- references the component or discriminant entity). ! when Attribute_Bit_Position => Bit_Position : declare CE : Entity_Id; begin *************** package body Exp_Attr is *** 1257,1270 **** -- and T is B for the cases of Body_Version, or Version applied to a -- subprogram acting as its own spec, and S for Version applied to a -- subprogram spec or package. This sequence of code references the ! -- the unsigned constant created in the main program by the binder. ! -- A special exception occurs for Standard, where the string ! -- returned is a copy of the library string in gnatvsn.ads. when Attribute_Body_Version | Attribute_Version => Version : declare ! E : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('V')); Pent : Entity_Id; S : String_Id; --- 1275,1287 ---- -- and T is B for the cases of Body_Version, or Version applied to a -- subprogram acting as its own spec, and S for Version applied to a -- subprogram spec or package. This sequence of code references the ! -- unsigned constant created in the main program by the binder. ! -- A special exception occurs for Standard, where the string returned ! -- is a copy of the library string in gnatvsn.ads. when Attribute_Body_Version | Attribute_Version => Version : declare ! E : constant Entity_Id := Make_Temporary (Loc, 'V'); Pent : Entity_Id; S : String_Id; *************** package body Exp_Attr is *** 1379,1385 **** -- to Callable. Generate: -- callable (Task_Id (Pref._disp_get_task_id)); ! if Ada_Version >= Ada_05 and then Ekind (Ptyp) = E_Class_Wide_Type and then Is_Interface (Ptyp) and then Is_Task_Interface (Ptyp) --- 1396,1402 ---- -- to Callable. Generate: -- callable (Task_Id (Pref._disp_get_task_id)); ! if Ada_Version >= Ada_2005 and then Ekind (Ptyp) = E_Class_Wide_Type and then Is_Interface (Ptyp) and then Is_Task_Interface (Ptyp) *************** package body Exp_Attr is *** 1610,1618 **** elsif not Is_Variable (Pref) or else Present (Formal_Ent) ! or else (Ada_Version < Ada_05 and then Is_Aliased_View (Pref)) ! or else (Ada_Version >= Ada_05 and then Is_Constrained_Aliased_View (Pref)) then Res := True; --- 1627,1635 ---- elsif not Is_Variable (Pref) or else Present (Formal_Ent) ! or else (Ada_Version < Ada_2005 and then Is_Aliased_View (Pref)) ! or else (Ada_Version >= Ada_2005 and then Is_Constrained_Aliased_View (Pref)) then Res := True; *************** package body Exp_Attr is *** 1627,1643 **** -- internally for passing to the Extra_Constrained parameter. else ! Res := Is_Constrained (Underlying_Type (Etype (Ent))); end if; ! Rewrite (N, ! 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). else Rewrite (N, --- 1644,1673 ---- -- internally for passing to the Extra_Constrained parameter. else ! -- In Ada 2012, test for case of a limited tagged type, in ! -- which case the attribute is always required to return ! -- True. The underlying type is tested, to make sure we also ! -- return True for cases where there is an unconstrained ! -- object with an untagged limited partial view which has ! -- defaulted discriminants (such objects always produce a ! -- False in earlier versions of Ada). (Ada 2012: AI05-0214) ! ! Res := Is_Constrained (Underlying_Type (Etype (Ent))) ! or else ! (Ada_Version >= Ada_2012 ! and then Is_Tagged_Type (Underlying_Type (Ptyp)) ! and then Is_Limited_Type (Ptyp)); end if; ! Rewrite (N, 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: AI95-0363). If the ! -- underlying type is a limited tagged type, then Constrained is ! -- required to always return True (Ada 2012: AI05-0214). else Rewrite (N, *************** package body Exp_Attr is *** 1646,1654 **** not Is_Variable (Pref) or else (Nkind (Pref) = N_Explicit_Dereference ! and then ! not Has_Constrained_Partial_View (Base_Type (Ptyp))) ! or else Is_Constrained (Underlying_Type (Ptyp))), Loc)); end if; --- 1676,1687 ---- not Is_Variable (Pref) or else (Nkind (Pref) = N_Explicit_Dereference ! and then ! not Has_Constrained_Partial_View (Base_Type (Ptyp))) ! or else Is_Constrained (Underlying_Type (Ptyp)) ! or else (Ada_Version >= Ada_2012 ! and then Is_Tagged_Type (Underlying_Type (Ptyp)) ! and then Is_Limited_Type (Ptyp))), Loc)); end if; *************** package body Exp_Attr is *** 1777,1785 **** Attribute_Elab_Spec => Elab_Body : declare ! Ent : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('E')); Str : String_Id; Lang : Node_Id; --- 1810,1816 ---- Attribute_Elab_Spec => Elab_Body : declare ! Ent : constant Entity_Id := Make_Temporary (Loc, 'E'); Str : String_Id; Lang : Node_Id; *************** package body Exp_Attr is *** 1851,1866 **** Make_Pragma (Loc, Chars => Name_Import, Pragma_Argument_Associations => New_List ( ! Make_Pragma_Argument_Association (Loc, ! Expression => Lang), Make_Pragma_Argument_Association (Loc, ! Expression => ! Make_Identifier (Loc, Chars (Ent))), Make_Pragma_Argument_Association (Loc, ! Expression => ! Make_String_Literal (Loc, Str)))))); Set_Entity (N, Ent); Rewrite (N, New_Occurrence_Of (Ent, Loc)); --- 1882,1894 ---- Make_Pragma (Loc, Chars => Name_Import, Pragma_Argument_Associations => New_List ( ! Make_Pragma_Argument_Association (Loc, Expression => Lang), Make_Pragma_Argument_Association (Loc, ! Expression => Make_Identifier (Loc, Chars (Ent))), Make_Pragma_Argument_Association (Loc, ! Expression => Make_String_Literal (Loc, Str)))))); Set_Entity (N, Ent); Rewrite (N, New_Occurrence_Of (Ent, Loc)); *************** package body Exp_Attr is *** 2191,2197 **** -- dynamically through a dispatching call, as for other task -- attributes applied to interfaces. ! if Ada_Version >= Ada_05 and then Ekind (Ptyp) = E_Class_Wide_Type and then Is_Interface (Ptyp) and then Is_Task_Interface (Ptyp) --- 2219,2225 ---- -- dynamically through a dispatching call, as for other task -- attributes applied to interfaces. ! if Ada_Version >= Ada_2005 and then Ekind (Ptyp) = E_Class_Wide_Type and then Is_Interface (Ptyp) and then Is_Task_Interface (Ptyp) *************** package body Exp_Attr is *** 2389,2401 **** Rtyp : constant Entity_Id := Root_Type (P_Type); Dnn : Entity_Id; Decl : Node_Id; begin -- Read the internal tag (RM 13.13.2(34)) and use it to -- initialize a dummy tag object: ! -- Dnn : Ada.Tags.Tag ! -- := Descendant_Tag (String'Input (Strm), P_Type); -- This dummy object is used only to provide a controlling -- argument for the eventual _Input call. Descendant_Tag is --- 2417,2430 ---- Rtyp : constant Entity_Id := Root_Type (P_Type); Dnn : Entity_Id; Decl : Node_Id; + Expr : Node_Id; begin -- Read the internal tag (RM 13.13.2(34)) and use it to -- initialize a dummy tag object: ! -- Dnn : Ada.Tags.Tag := ! -- Descendant_Tag (String'Input (Strm), P_Type); -- This dummy object is used only to provide a controlling -- argument for the eventual _Input call. Descendant_Tag is *************** package body Exp_Attr is *** 2406,2435 **** -- required for Ada 2005 because tagged types can be -- extended in nested scopes (AI-344). ! Dnn := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('D')); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Dnn, ! Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), ! Expression => ! Make_Function_Call (Loc, ! Name => ! New_Occurrence_Of (RTE (RE_Descendant_Tag), Loc), ! Parameter_Associations => New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Occurrence_Of (Standard_String, Loc), ! Attribute_Name => Name_Input, ! Expressions => New_List ( ! Relocate_Node ! (Duplicate_Subexpr (Strm)))), ! Make_Attribute_Reference (Loc, ! Prefix => New_Reference_To (P_Type, Loc), ! Attribute_Name => Name_Tag)))); Insert_Action (N, Decl); --- 2435,2462 ---- -- required for Ada 2005 because tagged types can be -- extended in nested scopes (AI-344). ! Expr := ! Make_Function_Call (Loc, ! Name => ! New_Occurrence_Of (RTE (RE_Descendant_Tag), Loc), ! Parameter_Associations => New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Standard_String, Loc), ! Attribute_Name => Name_Input, ! Expressions => New_List ( ! Relocate_Node (Duplicate_Subexpr (Strm)))), ! Make_Attribute_Reference (Loc, ! Prefix => New_Reference_To (P_Type, Loc), ! Attribute_Name => Name_Tag))); ! ! Dnn := Make_Temporary (Loc, 'D', Expr); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Dnn, ! Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), ! Expression => Expr); Insert_Action (N, Decl); *************** package body Exp_Attr is *** 2440,2447 **** -- tagged object). Fname := Find_Prim_Op (Rtyp, TSS_Stream_Input); ! Cntrl := Unchecked_Convert_To (P_Type, ! New_Occurrence_Of (Dnn, Loc)); Set_Etype (Cntrl, P_Type); Set_Parent (Cntrl, N); end; --- 2467,2475 ---- -- tagged object). Fname := Find_Prim_Op (Rtyp, TSS_Stream_Input); ! Cntrl := ! Unchecked_Convert_To (P_Type, ! New_Occurrence_Of (Dnn, Loc)); Set_Etype (Cntrl, P_Type); Set_Parent (Cntrl, N); end; *************** package body Exp_Attr is *** 2987,2995 **** --------- when Attribute_Old => Old : declare ! Tnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); Subp : Node_Id; Asn_Stm : Node_Id; --- 3015,3021 ---- --------- when Attribute_Old => Old : declare ! Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', Pref); Subp : Node_Id; Asn_Stm : Node_Id; *************** package body Exp_Attr is *** 3003,3009 **** 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, --- 3029,3036 ---- and then Chars (Defining_Entity (Subp)) /= Name_uPostconditions; end loop; ! -- Insert the initialized object declaration at the start of the ! -- subprogram's declarations. Asn_Stm := Make_Object_Declaration (Loc, *************** package body Exp_Attr is *** 3012,3017 **** --- 3039,3054 ---- Object_Definition => New_Occurrence_Of (Etype (N), Loc), Expression => Pref); + -- Push the subprogram's scope, so that the object will be analyzed + -- in that context (rather than the context of the Precondition + -- subprogram) and will have its Scope set properly. + + if Present (Corresponding_Spec (Subp)) then + Push_Scope (Corresponding_Spec (Subp)); + else + Push_Scope (Defining_Entity (Subp)); + end if; + if Is_Empty_List (Declarations (Subp)) then Set_Declarations (Subp, New_List (Asn_Stm)); Analyze (Asn_Stm); *************** package body Exp_Attr is *** 3019,3024 **** --- 3056,3063 ---- Insert_Action (First (Declarations (Subp)), Asn_Stm); end if; + Pop_Scope; + Rewrite (N, New_Occurrence_Of (Tnn, Loc)); end Old; *************** package body Exp_Attr is *** 3148,3154 **** -- We cannot figure out a practical way to implement this -- accessibility check on virtual machines, so we omit it. ! if Ada_Version >= Ada_05 and then Tagged_Type_Expansion then Insert_Action (N, --- 3187,3193 ---- -- We cannot figure out a practical way to implement this -- accessibility check on virtual machines, so we omit it. ! if Ada_Version >= Ada_2005 and then Tagged_Type_Expansion then Insert_Action (N, *************** package body Exp_Attr is *** 3239,3247 **** -- For enumeration types with a standard representation, Pos is -- 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 ! -- type was frozen. The call has the form -- _rep_to_pos (expr, flag) --- 3278,3286 ---- -- For enumeration types with a standard representation, Pos is -- 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 type was frozen. ! -- The call has the form -- _rep_to_pos (expr, flag) *************** package body Exp_Attr is *** 3491,3506 **** Object_Parm := Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => ! Unchecked_Convert_To (New_Itype, ! New_Reference_To ! (First_Entity ! (Protected_Body_Subprogram (Subprg)), ! Loc)), ! Selector_Name => ! Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); end; --- 3530,3545 ---- Object_Parm := Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => ! Unchecked_Convert_To (New_Itype, ! New_Reference_To ! (First_Entity ! (Protected_Body_Subprogram (Subprg)), ! Loc)), ! Selector_Name => ! Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); end; *************** package body Exp_Attr is *** 3515,3522 **** (First_Entity (Protected_Body_Subprogram (Subprg)), Loc), ! Selector_Name => ! Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); end if; --- 3554,3560 ---- (First_Entity (Protected_Body_Subprogram (Subprg)), Loc), ! Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); end if; *************** package body Exp_Attr is *** 3548,3553 **** --- 3586,3592 ---- ------------------ 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 *************** package body Exp_Attr is *** 3586,3593 **** Attribute_Name => Name_First, Prefix => New_Occurrence_Of (Ptyp, Loc))))), ! Right_Opnd => ! Make_Integer_Literal (Loc, 1))); Analyze_And_Resolve (N, Typ); --- 3625,3631 ---- Attribute_Name => Name_First, Prefix => New_Occurrence_Of (Ptyp, Loc))))), ! Right_Opnd => Make_Integer_Literal (Loc, 1))); Analyze_And_Resolve (N, Typ); *************** package body Exp_Attr is *** 3707,3713 **** Rewrite (N, Make_Assignment_Statement (Loc, ! Name => Lhs, Expression => Rhs)); Analyze (N); --- 3745,3751 ---- Rewrite (N, Make_Assignment_Statement (Loc, ! Name => Lhs, Expression => Rhs)); Analyze (N); *************** package body Exp_Attr is *** 3749,3758 **** (Discriminant_Default_Value (First_Discriminant (U_Type))) then Build_Mutable_Record_Read_Procedure ! (Loc, Base_Type (U_Type), Decl, Pname); else Build_Record_Read_Procedure ! (Loc, Base_Type (U_Type), Decl, Pname); end if; -- Suppress checks, uninitialized or otherwise invalid --- 3787,3796 ---- (Discriminant_Default_Value (First_Discriminant (U_Type))) then Build_Mutable_Record_Read_Procedure ! (Loc, Full_Base (U_Type), Decl, Pname); else Build_Record_Read_Procedure ! (Loc, Full_Base (U_Type), Decl, Pname); end if; -- Suppress checks, uninitialized or otherwise invalid *************** package body Exp_Attr is *** 3766,3771 **** --- 3804,3815 ---- Rewrite_Stream_Proc_Call (Pname); end Read; + --------- + -- Ref -- + --------- + + -- Ref is identical to To_Address, see To_Address for processing + --------------- -- Remainder -- --------------- *************** package body Exp_Attr is *** 3785,3793 **** -- 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); ----------- --- 3829,3835 ---- -- 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); ----------- *************** package body Exp_Attr is *** 4267,4274 **** -- 2. For floating-point, generate call to attribute function -- 3. For other cases, deal with constraint checking ! when Attribute_Succ => Succ : ! declare Etyp : constant Entity_Id := Base_Type (Ptyp); begin --- 4309,4315 ---- -- 2. For floating-point, generate call to attribute function -- 3. For other cases, deal with constraint checking ! when Attribute_Succ => Succ : declare Etyp : constant Entity_Id := Base_Type (Ptyp); begin *************** package body Exp_Attr is *** 4360,4367 **** -- Transforms X'Tag into a direct reference to the tag of X ! when Attribute_Tag => Tag : ! declare Ttyp : Entity_Id; Prefix_Is_Type : Boolean; --- 4401,4407 ---- -- Transforms X'Tag into a direct reference to the tag of X ! when Attribute_Tag => Tag : declare Ttyp : Entity_Id; Prefix_Is_Type : Boolean; *************** package body Exp_Attr is *** 4449,4455 **** -- Generate: -- terminated (Task_Id (Pref._disp_get_task_id)); ! if Ada_Version >= Ada_05 and then Ekind (Ptyp) = E_Class_Wide_Type and then Is_Interface (Ptyp) and then Is_Task_Interface (Ptyp) --- 4489,4495 ---- -- Generate: -- terminated (Task_Id (Pref._disp_get_task_id)); ! if Ada_Version >= Ada_2005 and then Ekind (Ptyp) = E_Class_Wide_Type and then Is_Interface (Ptyp) and then Is_Task_Interface (Ptyp) *************** package body Exp_Attr is *** 4485,4494 **** -- To_Address -- ---------------- ! -- Transforms System'To_Address (X) into unchecked conversion ! -- from (integral) type of X to type address. ! when Attribute_To_Address => Rewrite (N, Unchecked_Convert_To (RTE (RE_Address), Relocate_Node (First (Exprs)))); --- 4525,4534 ---- -- To_Address -- ---------------- ! -- Transforms System'To_Address (X) and System.Address'Ref (X) into ! -- unchecked conversion from (integral) type of X to type address. ! when Attribute_To_Address | Attribute_Ref => Rewrite (N, Unchecked_Convert_To (RTE (RE_Address), Relocate_Node (First (Exprs)))); *************** package body Exp_Attr is *** 4555,4562 **** ----------------- when Attribute_UET_Address => UET_Address : declare ! Ent : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('T')); begin Insert_Action (N, --- 4595,4601 ---- ----------------- when Attribute_UET_Address => UET_Address : declare ! Ent : constant Entity_Id := Make_Temporary (Loc, 'T'); begin Insert_Action (N, *************** package body Exp_Attr is *** 4609,4616 **** -- with a non-standard representation we use the _Pos_To_Rep array that -- was created when the type was frozen. ! when Attribute_Val => Val : ! declare Etyp : constant Entity_Id := Base_Type (Entity (Pref)); begin --- 4648,4654 ---- -- with a non-standard representation we use the _Pos_To_Rep array that -- was created when the type was frozen. ! when Attribute_Val => Val : declare Etyp : constant Entity_Id := Base_Type (Entity (Pref)); begin *************** package body Exp_Attr is *** 4673,4680 **** -- The code for valid is dependent on the particular types involved. -- See separate sections below for the generated code in each case. ! when Attribute_Valid => Valid : ! declare Btyp : Entity_Id := Base_Type (Ptyp); Tst : Node_Id; --- 4711,4717 ---- -- The code for valid is dependent on the particular types involved. -- See separate sections below for the generated code in each case. ! when Attribute_Valid => Valid : declare Btyp : Entity_Id := Base_Type (Ptyp); Tst : Node_Id; *************** package body Exp_Attr is *** 4686,4694 **** function Make_Range_Test return Node_Id; -- Build the code for a range test of the form ! -- Btyp!(Pref) >= Btyp!(Ptyp'First) ! -- and then ! -- Btyp!(Pref) <= Btyp!(Ptyp'Last) --------------------- -- Make_Range_Test -- --- 4723,4729 ---- function Make_Range_Test return Node_Id; -- Build the code for a range test of the form ! -- Btyp!(Pref) in Btyp!(Ptyp'First) .. Btyp!(Ptyp'Last) --------------------- -- Make_Range_Test -- *************** package body Exp_Attr is *** 4707,4730 **** end if; return ! Make_And_Then (Loc, ! Left_Opnd => ! Make_Op_Ge (Loc, ! Left_Opnd => ! Unchecked_Convert_To (Btyp, Temp), ! ! Right_Opnd => Unchecked_Convert_To (Btyp, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ptyp, Loc), ! Attribute_Name => Name_First))), ! ! Right_Opnd => ! Make_Op_Le (Loc, ! Left_Opnd => ! Unchecked_Convert_To (Btyp, Temp), ! ! Right_Opnd => Unchecked_Convert_To (Btyp, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ptyp, Loc), --- 4742,4758 ---- end if; return ! Make_In (Loc, ! Left_Opnd => ! Unchecked_Convert_To (Btyp, Temp), ! Right_Opnd => ! Make_Range (Loc, ! Low_Bound => Unchecked_Convert_To (Btyp, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ptyp, Loc), ! Attribute_Name => Name_First)), ! High_Bound => Unchecked_Convert_To (Btyp, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ptyp, Loc), *************** package body Exp_Attr is *** 4734,4739 **** --- 4762,4774 ---- -- Start of processing for Attribute_Valid begin + -- Do not expand sourced code 'Valid reference in CodePeer mode, + -- will be handled by the back-end directly. + + if CodePeer_Mode and then Comes_From_Source (N) then + return; + end if; + -- Turn off validity checks. We do not want any implicit validity -- checks to intefere with the explicit check from the attribute *************** package body Exp_Attr is *** 4748,4800 **** Ftp : Entity_Id; begin - -- For vax fpt types, call appropriate routine in special vax - -- floating point unit. We do not have to worry about loads in - -- this case, since these types have no signalling NaN's. ! if Vax_Float (Btyp) then ! Expand_Vax_Valid (N); ! -- The AAMP back end handles Valid for floating-point types ! elsif Is_AAMP_Float (Btyp) then ! Analyze_And_Resolve (Pref, Ptyp); ! Set_Etype (N, Standard_Boolean); ! Set_Analyzed (N); ! -- Non VAX float case ! else ! 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 ! -- the needed copy, being careful not to load the value into ! -- any floating-point register. The argument in this case is ! -- obj'Address (see Unaligned_Valid routine in Fat_Gen). ! if Is_Possibly_Unaligned_Object (Pref) then ! Expand_Fpt_Attribute ! (N, Pkg, Name_Unaligned_Valid, ! New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => Relocate_Node (Pref), ! Attribute_Name => Name_Address))); ! -- In the normal case where we are sure the object is ! -- aligned, we generate a call to Valid, and the argument in ! -- this case is obj'Unrestricted_Access (after converting ! -- obj to the right floating-point type). ! else ! Expand_Fpt_Attribute ! (N, Pkg, Name_Valid, ! New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => Unchecked_Convert_To (Ftp, Pref), ! Attribute_Name => Name_Unrestricted_Access))); ! end if; ! end if; -- One more task, we still need a range check. Required -- only if we have a constraint, since the Valid routine --- 4783,4836 ---- Ftp : Entity_Id; begin ! case Float_Rep (Btyp) is ! -- For vax fpt types, call appropriate routine in special ! -- vax floating point unit. No need to worry about loads in ! -- this case, since these types have no signalling NaN's. ! when VAX_Native => Expand_Vax_Valid (N); ! -- The AAMP back end handles Valid for floating-point types ! when AAMP => ! Analyze_And_Resolve (Pref, Ptyp); ! Set_Etype (N, Standard_Boolean); ! Set_Analyzed (N); ! when IEEE_Binary => ! 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 the needed copy, being careful not to ! -- load the value into any floating-point register. ! -- The argument in this case is obj'Address (see ! -- Unaligned_Valid routine in Fat_Gen). ! if Is_Possibly_Unaligned_Object (Pref) then ! Expand_Fpt_Attribute ! (N, Pkg, Name_Unaligned_Valid, ! New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => Relocate_Node (Pref), ! Attribute_Name => Name_Address))); ! -- In the normal case where we are sure the object is ! -- aligned, we generate a call to Valid, and the argument ! -- in this case is obj'Unrestricted_Access (after ! -- converting obj to the right floating-point type). ! ! else ! Expand_Fpt_Attribute ! (N, Pkg, Name_Valid, ! New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => Unchecked_Convert_To (Ftp, Pref), ! Attribute_Name => Name_Unrestricted_Access))); ! end if; ! end case; -- One more task, we still need a range check. Required -- only if we have a constraint, since the Valid routine *************** package body Exp_Attr is *** 5224,5233 **** (Discriminant_Default_Value (First_Discriminant (U_Type))) then Build_Mutable_Record_Write_Procedure ! (Loc, Base_Type (U_Type), Decl, Pname); else Build_Record_Write_Procedure ! (Loc, Base_Type (U_Type), Decl, Pname); end if; Insert_Action (N, Decl); --- 5260,5269 ---- (Discriminant_Default_Value (First_Discriminant (U_Type))) then Build_Mutable_Record_Write_Procedure ! (Loc, Full_Base (U_Type), Decl, Pname); else Build_Record_Write_Procedure ! (Loc, Full_Base (U_Type), Decl, Pname); end if; Insert_Action (N, Decl); *************** package body Exp_Attr is *** 5278,5286 **** -- that the result is in range. when Attribute_Aft | ! Attribute_Bit | ! Attribute_Max_Size_In_Storage_Elements ! => Apply_Universal_Integer_Attribute_Checks (N); -- The following attributes should not appear at this stage, since they --- 5314,5321 ---- -- that the result is in range. when Attribute_Aft | ! Attribute_Max_Alignment_For_Allocation | ! Attribute_Max_Size_In_Storage_Elements => Apply_Universal_Integer_Attribute_Checks (N); -- The following attributes should not appear at this stage, since they *************** package body Exp_Attr is *** 5330,5335 **** --- 5365,5371 ---- Attribute_Stub_Type | Attribute_Target_Name | Attribute_Type_Class | + Attribute_Type_Key | Attribute_Unconstrained_Array | Attribute_Universal_Literal_String | Attribute_Wchar_T_Size | *************** package body Exp_Attr is *** 5367,5375 **** --- 5403,5415 ---- -- These checks are not generated for modular types, since the proper -- semantics for Succ and Pred on modular types is to wrap, not raise CE. + -- We also suppress these checks if we are the right side of an assignment + -- statement or the expression of an object declaration, where the flag + -- Suppress_Assignment_Checks is set for the assignment/declaration. procedure Expand_Pred_Succ (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); + P : constant Node_Id := Parent (N); Cnam : Name_Id; begin *************** package body Exp_Attr is *** 5379,5396 **** Cnam := Name_Last; end if; ! Insert_Action (N, ! Make_Raise_Constraint_Error (Loc, ! Condition => ! Make_Op_Eq (Loc, ! Left_Opnd => ! Duplicate_Subexpr_Move_Checks (First (Expressions (N))), ! Right_Opnd => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Reference_To (Base_Type (Etype (Prefix (N))), Loc), ! Attribute_Name => Cnam)), ! Reason => CE_Overflow_Check_Failed)); end Expand_Pred_Succ; ------------------- --- 5419,5440 ---- Cnam := Name_Last; end if; ! if not Nkind_In (P, N_Assignment_Statement, N_Object_Declaration) ! or else not Suppress_Assignment_Checks (P) ! then ! Insert_Action (N, ! Make_Raise_Constraint_Error (Loc, ! Condition => ! Make_Op_Eq (Loc, ! Left_Opnd => ! Duplicate_Subexpr_Move_Checks (First (Expressions (N))), ! Right_Opnd => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Reference_To (Base_Type (Etype (Prefix (N))), Loc), ! Attribute_Name => Cnam)), ! Reason => CE_Overflow_Check_Failed)); ! end if; end Expand_Pred_Succ; ------------------- *************** package body Exp_Attr is *** 5445,5451 **** raise Program_Error; end case; ! -- If neither the base type nor the root type is VAX_Float then VAX -- float is out of the picture, and we can just use the root type. else --- 5489,5495 ---- raise Program_Error; end case; ! -- If neither the base type nor the root type is VAX_Native then VAX -- float is out of the picture, and we can just use the root type. else *************** package body Exp_Attr is *** 5499,5507 **** -- 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 --- 5543,5553 ---- -- 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 creating dependences on files not -- supported in the AAMP library (such as s-fileio.adb). if VM_Target /= JVM_Target *************** package body Exp_Attr is *** 5616,5621 **** --- 5662,5686 ---- end if; end Find_Stream_Subprogram; + --------------- + -- Full_Base -- + --------------- + + function Full_Base (T : Entity_Id) return Entity_Id is + BT : Entity_Id; + + begin + BT := Base_Type (T); + + if Is_Private_Type (BT) + and then Present (Full_View (BT)) + then + BT := Full_View (BT); + end if; + + return BT; + end Full_Base; + ----------------------- -- Get_Index_Subtype -- ----------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/exp_cg.adb gcc-4.6.0/gcc/ada/exp_cg.adb *** gcc-4.5.2/gcc/ada/exp_cg.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/exp_cg.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,670 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- E X P _ C G -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + ------------------------------------------------------------------------------ + + with Atree; use Atree; + with Einfo; use Einfo; + with Elists; use Elists; + with Exp_Disp; use Exp_Disp; + with Exp_Dbug; use Exp_Dbug; + with Exp_Tss; use Exp_Tss; + with Lib; use Lib; + with Namet; use Namet; + with Opt; use Opt; + with Output; use Output; + with Sem_Aux; use Sem_Aux; + with Sem_Disp; use Sem_Disp; + with Sem_Type; use Sem_Type; + with Sem_Util; use Sem_Util; + with Sinfo; use Sinfo; + with Sinput; use Sinput; + with Snames; use Snames; + with System; use System; + with Table; + with Uintp; use Uintp; + + package body Exp_CG is + + -- We duplicate here some declarations from packages Interfaces.C and + -- Interfaces.C_Streams because adding their dependence to the frontend + -- causes bootstrapping problems with old versions of the compiler. + + subtype FILEs is System.Address; + -- Corresponds to the C type FILE* + + subtype C_chars is System.Address; + -- Pointer to null-terminated array of characters + + function fputs (Strng : C_chars; Stream : FILEs) return Integer; + pragma Import (C, fputs, "fputs"); + + -- Import the file stream associated with the "ci" output file. Done to + -- generate the output in the file created and left opened by routine + -- toplev.c before calling gnat1drv. + + Callgraph_Info_File : FILEs; + pragma Import (C, Callgraph_Info_File); + + package Call_Graph_Nodes is new Table.Table ( + Table_Component_Type => Node_Id, + Table_Index_Type => Natural, + Table_Low_Bound => 1, + Table_Initial => 50, + Table_Increment => 100, + Table_Name => "Call_Graph_Nodes"); + -- This table records nodes associated with dispatching calls and tagged + -- type declarations found in the main compilation unit. Used as an + -- auxiliary storage because the call-graph output requires fully qualified + -- names and they are not available until the backend is called. + + function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean; + -- Determines if E is a predefined primitive operation. + -- Note: This routine should replace the routine with the same name that is + -- currently available in exp_disp because it extends its functionality to + -- handle fully qualified names ??? + + function Slot_Number (Prim : Entity_Id) return Uint; + -- Returns the slot number associated with Prim. For predefined primitives + -- the slot is returned as a negative number. + + procedure Write_Output (Str : String); + -- Used to print a line in the output file (this is used as the + -- argument for a call to Set_Special_Output in package Output). + + procedure Write_Call_Info (Call : Node_Id); + -- Subsidiary of Generate_CG_Output that generates the output associated + -- with a dispatching call. + + procedure Write_Type_Info (Typ : Entity_Id); + -- Subsidiary of Generate_CG_Output that generates the output associated + -- with a tagged type declaration. + + ------------------------ + -- Generate_CG_Output -- + ------------------------ + + procedure Generate_CG_Output is + N : Node_Id; + + begin + -- No output if the "ci" output file has not been previously opened + -- by toplev.c + + if Callgraph_Info_File = Null_Address then + return; + end if; + + -- Setup write routine, create the output file and generate the output + + Set_Special_Output (Write_Output'Access); + + for J in Call_Graph_Nodes.First .. Call_Graph_Nodes.Last loop + N := Call_Graph_Nodes.Table (J); + + if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) then + Write_Call_Info (N); + + else pragma Assert (Nkind (N) = N_Defining_Identifier); + + -- The type may be a private untagged type whose completion is + -- tagged, in which case we must use the full tagged view. + + if not Is_Tagged_Type (N) and then Is_Private_Type (N) then + N := Full_View (N); + end if; + + pragma Assert (Is_Tagged_Type (N)); + + Write_Type_Info (N); + end if; + end loop; + + Set_Special_Output (null); + end Generate_CG_Output; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize is + begin + Call_Graph_Nodes.Init; + end Initialize; + + ----------------------------------------- + -- Is_Predefined_Dispatching_Operation -- + ----------------------------------------- + + function Is_Predefined_Dispatching_Operation + (E : Entity_Id) return Boolean + is + function Homonym_Suffix_Length (E : Entity_Id) return Natural; + -- Returns the length of the homonym suffix corresponding to E. + -- Note: This routine relies on the functionality provided by routines + -- of Exp_Dbug. Further work needed here to decide if it should be + -- located in that package??? + + --------------------------- + -- Homonym_Suffix_Length -- + --------------------------- + + function Homonym_Suffix_Length (E : Entity_Id) return Natural is + Prefix_Length : constant := 2; + -- Length of prefix "__" + + H : Entity_Id; + Nr : Nat := 1; + + begin + if not Has_Homonym (E) then + return 0; + + else + H := Homonym (E); + while Present (H) loop + if Scope (H) = Scope (E) then + Nr := Nr + 1; + end if; + + H := Homonym (H); + end loop; + + if Nr = 1 then + return 0; + + -- Prefix "__" followed by number + + else + declare + Result : Natural := Prefix_Length + 1; + + begin + while Nr >= 10 loop + Result := Result + 1; + Nr := Nr / 10; + end loop; + + return Result; + end; + end if; + end if; + end Homonym_Suffix_Length; + + -- Local variables + + Full_Name : constant String := Get_Name_String (Chars (E)); + Suffix_Length : Natural; + TSS_Name : TSS_Name_Type; + + -- Start of processing for Is_Predefined_Dispatching_Operation + + begin + if not Is_Dispatching_Operation (E) then + return False; + end if; + + -- Search for and strip suffix for body-nested package entities + + Suffix_Length := Homonym_Suffix_Length (E); + for J in reverse Full_Name'First + 2 .. Full_Name'Last loop + if Full_Name (J) = 'X' then + + -- Include the "X", "Xb", "Xn", ... in the part of the + -- suffix to be removed. + + Suffix_Length := Suffix_Length + Full_Name'Last - J + 1; + exit; + end if; + + exit when Full_Name (J) /= 'b' and then Full_Name (J) /= 'n'; + end loop; + + -- Most predefined primitives have internally generated names. Equality + -- must be treated differently; the predefined operation is recognized + -- as a homogeneous binary operator that returns Boolean. + + if Full_Name'Length > TSS_Name_Type'Length then + TSS_Name := + TSS_Name_Type + (Full_Name + (Full_Name'Last - TSS_Name'Length - Suffix_Length + 1 + .. Full_Name'Last - Suffix_Length)); + + if TSS_Name = TSS_Stream_Read + or else TSS_Name = TSS_Stream_Write + or else TSS_Name = TSS_Stream_Input + or else TSS_Name = TSS_Stream_Output + or else TSS_Name = TSS_Deep_Adjust + or else TSS_Name = TSS_Deep_Finalize + then + return True; + + elsif not Has_Fully_Qualified_Name (E) then + if Chars (E) = Name_uSize + or else Chars (E) = Name_uAlignment + or else + (Chars (E) = Name_Op_Eq + and then Etype (First_Formal (E)) = Etype (Last_Formal (E))) + or else Chars (E) = Name_uAssign + or else Is_Predefined_Interface_Primitive (E) + then + return True; + end if; + + -- Handle fully qualified names + + else + declare + type Names_Table is array (Positive range <>) of Name_Id; + + Predef_Names_95 : constant Names_Table := + (Name_uSize, + Name_uAlignment, + Name_Op_Eq, + Name_uAssign); + + Predef_Names_05 : constant Names_Table := + (Name_uDisp_Asynchronous_Select, + Name_uDisp_Conditional_Select, + Name_uDisp_Get_Prim_Op_Kind, + Name_uDisp_Get_Task_Id, + Name_uDisp_Requeue, + Name_uDisp_Timed_Select); + + begin + for J in Predef_Names_95'Range loop + Get_Name_String (Predef_Names_95 (J)); + + -- The predefined primitive operations are identified by the + -- names "_size", "_alignment", etc. If we try a pattern + -- matching against this string, we can wrongly match other + -- primitive operations like "get_size". To avoid this, we + -- add the "__" scope separator, which can only prepend + -- predefined primitive operations because other primitive + -- operations can neither start with an underline nor + -- contain two consecutive underlines in its name. + + if Full_Name'Last - Suffix_Length > Name_Len + 2 + and then + Full_Name + (Full_Name'Last - Name_Len - 2 - Suffix_Length + 1 + .. Full_Name'Last - Suffix_Length) = + "__" & Name_Buffer (1 .. Name_Len) + then + -- For the equality operator the type of the two operands + -- must also match. + + return Predef_Names_95 (J) /= Name_Op_Eq + or else + Etype (First_Formal (E)) = Etype (Last_Formal (E)); + end if; + end loop; + + if Ada_Version >= Ada_2005 then + for J in Predef_Names_05'Range loop + Get_Name_String (Predef_Names_05 (J)); + + if Full_Name'Last - Suffix_Length > Name_Len + 2 + and then + Full_Name + (Full_Name'Last - Name_Len - 2 - Suffix_Length + 1 + .. Full_Name'Last - Suffix_Length) = + "__" & Name_Buffer (1 .. Name_Len) + then + return True; + end if; + end loop; + end if; + end; + end if; + end if; + + return False; + end Is_Predefined_Dispatching_Operation; + + ---------------------- + -- Register_CG_Node -- + ---------------------- + + procedure Register_CG_Node (N : Node_Id) is + begin + if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) then + if Current_Scope = Main_Unit_Entity + or else Entity_Is_In_Main_Unit (Current_Scope) + then + -- Register a copy of the dispatching call node. Needed since the + -- node containing a dispatching call is rewritten by the + -- expander. + + declare + Copy : constant Node_Id := New_Copy (N); + Par : Node_Id; + + begin + -- Determine the enclosing scope to use when generating the + -- call graph. This must be done now to avoid problems with + -- control structures that may be rewritten during expansion. + + Par := Parent (N); + while Nkind (Par) /= N_Subprogram_Body + and then Nkind (Parent (Par)) /= N_Compilation_Unit + loop + Par := Parent (Par); + pragma Assert (Present (Par)); + end loop; + + Set_Parent (Copy, Par); + Call_Graph_Nodes.Append (Copy); + end; + end if; + + else pragma Assert (Nkind (N) = N_Defining_Identifier); + if Entity_Is_In_Main_Unit (N) then + Call_Graph_Nodes.Append (N); + end if; + end if; + end Register_CG_Node; + + ----------------- + -- Slot_Number -- + ----------------- + + function Slot_Number (Prim : Entity_Id) return Uint is + E : constant Entity_Id := Ultimate_Alias (Prim); + begin + if Is_Predefined_Dispatching_Operation (E) then + return -DT_Position (E); + else + return DT_Position (E); + end if; + end Slot_Number; + + ------------------ + -- Write_Output -- + ------------------ + + procedure Write_Output (Str : String) is + Nul : constant Character := Character'First; + Line : String (Str'First .. Str'Last + 1); + Errno : Integer; + + begin + -- Add the null character to the string as required by fputs + + Line := Str & Nul; + Errno := fputs (Line'Address, Callgraph_Info_File); + pragma Assert (Errno >= 0); + end Write_Output; + + --------------------- + -- Write_Call_Info -- + --------------------- + + procedure Write_Call_Info (Call : Node_Id) is + Ctrl_Arg : constant Node_Id := Controlling_Argument (Call); + Ctrl_Typ : constant Entity_Id := Base_Type (Etype (Ctrl_Arg)); + Prim : constant Entity_Id := Entity (Sinfo.Name (Call)); + P : constant Node_Id := Parent (Call); + + begin + Write_Str ("edge: { sourcename: "); + Write_Char ('"'); + + -- The parent node is the construct that contains the call: subprogram + -- body or library-level package. Display the qualified name of the + -- entity of the construct. For a subprogram, it is the entity of the + -- spec, which carries a homonym counter when it is overloaded. + + if Nkind (P) = N_Subprogram_Body + and then not Acts_As_Spec (P) + then + Get_External_Name (Corresponding_Spec (P), Has_Suffix => False); + + else + Get_External_Name (Defining_Entity (P), Has_Suffix => False); + end if; + + Write_Str (Name_Buffer (1 .. Name_Len)); + + if Nkind (P) = N_Package_Declaration then + Write_Str ("___elabs"); + + elsif Nkind (P) = N_Package_Body then + Write_Str ("___elabb"); + end if; + + Write_Char ('"'); + Write_Eol; + + -- The targetname is a triple: + -- N: the index in a vtable used for dispatch + -- V: the type who's vtable is used + -- S: the static type of the expression + + Write_Str (" targetname: "); + Write_Char ('"'); + + pragma Assert (No (Interface_Alias (Prim))); + + -- The check on Is_Ancestor is done here to avoid problems with + -- renamings of primitives. For example: + + -- type Root is tagged ... + -- procedure Base (Obj : Root); + -- procedure Base2 (Obj : Root) renames Base; + + if Present (Alias (Prim)) + and then + Is_Ancestor + (Find_Dispatching_Type (Ultimate_Alias (Prim)), + Root_Type (Ctrl_Typ)) + then + -- This is a special case in which we generate in the ci file the + -- slot number of the renaming primitive (i.e. Base2) but instead of + -- generating the name of this renaming entity we reference directly + -- the renamed entity (i.e. Base). + + Write_Int (UI_To_Int (Slot_Number (Prim))); + Write_Char (':'); + Write_Name + (Chars (Find_Dispatching_Type (Ultimate_Alias (Prim)))); + else + Write_Int (UI_To_Int (Slot_Number (Prim))); + Write_Char (':'); + Write_Name (Chars (Root_Type (Ctrl_Typ))); + end if; + + Write_Char (','); + Write_Name (Chars (Root_Type (Ctrl_Typ))); + + Write_Char ('"'); + Write_Eol; + + Write_Str (" label: "); + Write_Char ('"'); + Write_Location (Sloc (Call)); + Write_Char ('"'); + Write_Eol; + + Write_Char ('}'); + Write_Eol; + end Write_Call_Info; + + --------------------- + -- Write_Type_Info -- + --------------------- + + procedure Write_Type_Info (Typ : Entity_Id) is + Elmt : Elmt_Id; + Prim : Node_Id; + + Parent_Typ : Entity_Id; + Separator_Needed : Boolean := False; + + begin + -- 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; + + Write_Str ("class {"); + Write_Eol; + + Write_Str (" classname: "); + Write_Char ('"'); + Write_Name (Chars (Typ)); + Write_Char ('"'); + Write_Eol; + + Write_Str (" label: "); + Write_Char ('"'); + Write_Name (Chars (Typ)); + Write_Char ('\'); + Write_Location (Sloc (Typ)); + Write_Char ('"'); + Write_Eol; + + if Parent_Typ /= Typ then + Write_Str (" parent: "); + Write_Char ('"'); + Write_Name (Chars (Parent_Typ)); + + -- Note: Einfo prefix not needed if this routine is moved to + -- exp_disp??? + + if Present (Einfo.Interfaces (Typ)) + and then not Is_Empty_Elmt_List (Einfo.Interfaces (Typ)) + then + Elmt := First_Elmt (Einfo.Interfaces (Typ)); + while Present (Elmt) loop + Write_Str (", "); + Write_Name (Chars (Node (Elmt))); + Next_Elmt (Elmt); + end loop; + end if; + + Write_Char ('"'); + Write_Eol; + end if; + + Write_Str (" virtuals: "); + Write_Char ('"'); + + Elmt := First_Elmt (Primitive_Operations (Typ)); + while Present (Elmt) loop + Prim := Node (Elmt); + + -- Skip internal entities associated with overridden interface + -- primitives, and also inherited primitives. + + if Present (Interface_Alias (Prim)) + or else + (Present (Alias (Prim)) + and then Find_Dispatching_Type (Prim) /= + Find_Dispatching_Type (Alias (Prim))) + then + goto Continue; + end if; + + -- Do not generate separator for output of first primitive + + if Separator_Needed then + Write_Str ("\n"); + Write_Eol; + Write_Str (" "); + else + Separator_Needed := True; + end if; + + Write_Int (UI_To_Int (Slot_Number (Prim))); + Write_Char (':'); + + -- Handle renamed primitives + + if Present (Alias (Prim)) then + Write_Name (Chars (Ultimate_Alias (Prim))); + else + Write_Name (Chars (Prim)); + end if; + + -- Display overriding of parent primitives + + if Present (Overridden_Operation (Prim)) + and then + Is_Ancestor + (Find_Dispatching_Type (Overridden_Operation (Prim)), Typ) + then + Write_Char (','); + Write_Int + (UI_To_Int (Slot_Number (Overridden_Operation (Prim)))); + Write_Char (':'); + Write_Name + (Chars (Find_Dispatching_Type (Overridden_Operation (Prim)))); + end if; + + -- Display overriding of interface primitives + + if Has_Interfaces (Typ) then + declare + Prim_Elmt : Elmt_Id; + Prim_Op : Node_Id; + Int_Alias : Entity_Id; + + begin + Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); + while Present (Prim_Elmt) loop + Prim_Op := Node (Prim_Elmt); + Int_Alias := Interface_Alias (Prim_Op); + + if Present (Int_Alias) + and then + not Is_Ancestor (Find_Dispatching_Type (Int_Alias), Typ) + and then (Alias (Prim_Op)) = Prim + then + Write_Char (','); + Write_Int (UI_To_Int (Slot_Number (Int_Alias))); + Write_Char (':'); + Write_Name (Chars (Find_Dispatching_Type (Int_Alias))); + end if; + + Next_Elmt (Prim_Elmt); + end loop; + end; + end if; + + <> + Next_Elmt (Elmt); + end loop; + + Write_Char ('"'); + Write_Eol; + + Write_Char ('}'); + Write_Eol; + end Write_Type_Info; + + end Exp_CG; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_cg.ads gcc-4.6.0/gcc/ada/exp_cg.ads *** gcc-4.5.2/gcc/ada/exp_cg.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/exp_cg.ads Fri Jun 18 15:03:14 2010 *************** *** 0 **** --- 1,47 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- E X P _ C G -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2010, 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 package contains routines used to store and handle nodes required + -- to generate call graph information of dispatching calls. + + with Types; use Types; + + package Exp_CG is + + procedure Generate_CG_Output; + -- Generate in the standard output the information associated with tagged + -- types declaration and dispatching calls + + procedure Initialize; + -- Called at the start of compilation to initialize the table that stores + -- the tree nodes used by Generate_Output. This table is required because + -- the format of the output requires fully qualified names (and hence the + -- output must be generated after the source program has been compiled). + + procedure Register_CG_Node (N : Node_Id); + -- Register a dispatching call node or the defining entity of a tagged + -- type declaration + + end Exp_CG; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch11.adb gcc-4.6.0/gcc/ada/exp_ch11.adb *** gcc-4.5.2/gcc/ada/exp_ch11.adb Thu Jul 9 10:29:09 2009 --- gcc-4.6.0/gcc/ada/exp_ch11.adb Thu Oct 7 10:59:32 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Ch11 is *** 469,477 **** Local_Expansion_Required := True; declare ! L : constant Entity_Id := ! Make_Defining_Identifier (Sloc (H), ! Chars => New_Internal_Name ('L')); begin Set_Exception_Label (H, L); Add_Label_Declaration (L); --- 469,475 ---- Local_Expansion_Required := True; declare ! L : constant Entity_Id := Make_Temporary (Sloc (H), 'L'); begin Set_Exception_Label (H, L); Add_Label_Declaration (L); *************** package body Exp_Ch11 is *** 646,654 **** declare -- L3 is the label to exit the HSS ! L3_Dent : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); Labl_L3 : constant Node_Id := Make_Label (Loc, --- 644,650 ---- declare -- L3 is the label to exit the HSS ! L3_Dent : constant Entity_Id := Make_Temporary (Loc, 'L'); Labl_L3 : constant Node_Id := Make_Label (Loc, *************** package body Exp_Ch11 is *** 670,676 **** Rewrite (HSS, Make_Handled_Sequence_Of_Statements (Loc, ! Statements => New_List (Blk_Stm))); -- Set block statement as analyzed, we don't want to actually call -- Analyze on this block, it would cause a recursion in exception --- 666,673 ---- Rewrite (HSS, Make_Handled_Sequence_Of_Statements (Loc, ! Statements => New_List (Blk_Stm), ! End_Label => Relocate_Node (End_Label (HSS)))); -- Set block statement as analyzed, we don't want to actually call -- Analyze on this block, it would cause a recursion in exception *************** package body Exp_Ch11 is *** 745,757 **** Relmt := First_Elmt (Local_Raise_Statements (Handler)); while Present (Relmt) loop declare ! Raise_S : constant Node_Id := Node (Relmt); ! Name_L1 : constant Node_Id := New_Occurrence_Of (L1_Dent, Loc); - Goto_L1 : constant Node_Id := ! Make_Goto_Statement (Loc, Name => Name_L1); begin --- 742,753 ---- Relmt := First_Elmt (Local_Raise_Statements (Handler)); while Present (Relmt) loop declare ! Raise_S : constant Node_Id := Node (Relmt); ! RLoc : constant Source_Ptr := Sloc (Raise_S); Name_L1 : constant Node_Id := New_Occurrence_Of (L1_Dent, Loc); Goto_L1 : constant Node_Id := ! Make_Goto_Statement (RLoc, Name => Name_L1); begin *************** package body Exp_Ch11 is *** 1253,1259 **** begin -- There is no expansion needed when compiling for the JVM since the ! -- JVM has a built-in exception mechanism. See 4jexcept.ads for details. if VM_Target /= No_VM then return; --- 1249,1256 ---- begin -- There is no expansion needed when compiling for the JVM since the ! -- JVM has a built-in exception mechanism. See cil/gnatlib/a-except.ads ! -- for details. if VM_Target /= No_VM then return; *************** package body Exp_Ch11 is *** 1268,1274 **** Object_Definition => New_Occurrence_Of (Standard_String, Loc), Expression => Make_String_Literal (Loc, ! Strval => Full_Qualified_Name (Id)))); Set_Is_Statically_Allocated (Exname); --- 1265,1271 ---- Object_Definition => New_Occurrence_Of (Standard_String, Loc), Expression => Make_String_Literal (Loc, ! Strval => Fully_Qualified_Name_String (Id)))); Set_Is_Statically_Allocated (Exname); *************** package body Exp_Ch11 is *** 1516,1530 **** -- Remaining processing is for the case where no string expression -- is present. - -- There is no expansion needed for statement "raise ;" when - -- compiling for the JVM since the JVM has a built-in exception - -- mechanism. However we need to keep the expansion for "raise;" - -- statements. See 4jexcept.ads for details. - - if Present (Name (N)) and then VM_Target /= No_VM then - return; - end if; - -- Don't expand a raise statement that does not come from source -- if we have already had configurable run-time violations, since -- most likely it will be junk cascaded nonsense. --- 1513,1518 ---- *************** package body Exp_Ch11 is *** 1686,1692 **** -- be referencing this entity by normal visibility methods. if No (Choice_Parameter (Ehand)) then ! E := Make_Defining_Identifier (Loc, New_Internal_Name ('E')); Set_Choice_Parameter (Ehand, E); Set_Ekind (E, E_Variable); Set_Etype (E, RTE (RE_Exception_Occurrence)); --- 1674,1680 ---- -- be referencing this entity by normal visibility methods. if No (Choice_Parameter (Ehand)) then ! E := Make_Temporary (Loc, 'E'); Set_Choice_Parameter (Ehand, E); Set_Ekind (E, E_Variable); Set_Etype (E, RTE (RE_Exception_Occurrence)); *************** package body Exp_Ch11 is *** 2019,2025 **** procedure Warn_If_No_Propagation (N : Node_Id) is begin ! if Restriction_Active (No_Exception_Propagation) and then Warn_On_Non_Local_Exception then Warn_No_Exception_Propagation_Active (N); --- 2007,2013 ---- procedure Warn_If_No_Propagation (N : Node_Id) is begin ! if Restriction_Check_Required (No_Exception_Propagation) and then Warn_On_Non_Local_Exception then Warn_No_Exception_Propagation_Active (N); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch13.adb gcc-4.6.0/gcc/ada/exp_ch13.adb *** gcc-4.5.2/gcc/ada/exp_ch13.adb Fri Jul 10 13:18:49 2009 --- gcc-4.6.0/gcc/ada/exp_ch13.adb Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Snames; use Snames; *** 46,51 **** --- 46,52 ---- with Stand; use Stand; with Tbuild; use Tbuild; with Uintp; use Uintp; + with Validsw; use Validsw; package body Exp_Ch13 is *************** package body Exp_Ch13 is *** 126,131 **** --- 127,142 ---- else Set_Expression (Decl, Empty); end if; + + -- An object declaration to which an address clause applies + -- has a delayed freeze, but the address expression itself + -- must be elaborated at the point it appears. If the object + -- is controlled, additional checks apply elsewhere. + + elsif Nkind (Decl) = N_Object_Declaration + and then not Needs_Constant_Address (Decl, Typ) + then + Remove_Side_Effects (Exp); end if; end; *************** package body Exp_Ch13 is *** 209,214 **** --- 220,250 ---- Delete : Boolean := False; begin + -- If there are delayed aspect specifications, we insert them just + -- before the freeze node. They are already analyzed so we don't need + -- to reanalyze them (they were analyzed before the type was frozen), + -- but we want them in the tree for the back end, and so that the + -- listing from sprint is clearer on where these occur logically. + + if Has_Delayed_Aspects (E) then + declare + Aitem : Node_Id; + Ritem : Node_Id; + + begin + Ritem := First_Rep_Item (E); + while Present (Ritem) loop + if Nkind (Ritem) = N_Aspect_Specification then + Aitem := Aspect_Rep_Item (Ritem); + pragma Assert (Is_Delayed_Aspect (Aitem)); + Insert_Before (N, Aitem); + end if; + + Next_Rep_Item (Ritem); + end loop; + end; + end if; + -- Processing for objects with address clauses if Is_Object (E) and then Present (Address_Clause (E)) then *************** package body Exp_Ch13 is *** 346,351 **** --- 382,404 ---- Analyze (Decl, Suppress => All_Checks); Pop_Scope; + -- We treat generated equality specially, if validity checks are + -- enabled, in order to detect components default-initialized + -- with invalid values. + + elsif Nkind (Decl) = N_Subprogram_Body + and then Chars (Defining_Entity (Decl)) = Name_Op_Eq + and then Validity_Checks_On + and then Initialize_Scalars + then + declare + Save_Force : constant Boolean := Force_Validity_Checks; + begin + Force_Validity_Checks := True; + Analyze (Decl); + Force_Validity_Checks := Save_Force; + end; + else Analyze (Decl, Suppress => All_Checks); end if; *************** package body Exp_Ch13 is *** 361,366 **** --- 414,421 ---- Rewrite (N, Make_Null_Statement (Sloc (N))); end if; + -- Pop scope if we installed one for the analysis + if In_Other_Scope then if Ekind (Current_Scope) = E_Package then End_Package_Scope (E_Scope); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch3.adb gcc-4.6.0/gcc/ada/exp_ch3.adb *** gcc-4.5.2/gcc/ada/exp_ch3.adb Thu Dec 3 15:10:58 2009 --- gcc-4.6.0/gcc/ada/exp_ch3.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Exp_Strm; use Exp_Strm; *** 41,48 **** with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; - with Nlists; use Nlists; with Namet; use Namet; with Nmake; use Nmake; with Opt; use Opt; with Restrict; use Restrict; --- 41,48 ---- with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Namet; use Namet; + with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Restrict; use Restrict; *************** package body Exp_Ch3 is *** 141,146 **** --- 141,152 ---- -- the code expansion for controlled components (when control actions -- are active) can lead to very large blocks that GCC3 handles poorly. + procedure Build_Untagged_Equality (Typ : Entity_Id); + -- AI05-0123: Equality on untagged records composes. This procedure + -- builds the equality routine for an untagged record that has components + -- of a record type that has user-defined primitive equality operations. + -- The resulting operation is a TSS subprogram. + procedure Build_Variant_Record_Equality (Typ : Entity_Id); -- Create An Equality function for the non-tagged variant record 'Typ' -- and attach it to the TSS list *************** package body Exp_Ch3 is *** 214,222 **** --- 220,238 ---- -- Check if E is defined in the RTL (in a child of Ada or System). Used -- to avoid to bring in the overhead of _Input, _Output for tagged types. + function Is_Variable_Size_Array (E : Entity_Id) return Boolean; + -- Returns true if E has variable size components + function Is_Variable_Size_Record (E : Entity_Id) return Boolean; -- Returns true if E has variable size components + function Make_Eq_Body + (Typ : Entity_Id; + Eq_Name : Name_Id) return Node_Id; + -- Build the body of a primitive equality operation for a tagged record + -- type, or in Ada 2012 for any record type that has components with a + -- user-defined equality. Factored out of Predefined_Primitive_Bodies. + function Make_Eq_Case (E : Entity_Id; CL : Node_Id; *************** package body Exp_Ch3 is *** 296,304 **** -- invoking the inherited subprogram's parent subprogram and extended -- with a null association list. ! procedure Make_Null_Procedure_Specs ! (Tag_Typ : Entity_Id; ! Decl_List : out List_Id); -- Ada 2005 (AI-251): Makes specs for null procedures associated with any -- null procedures inherited from an interface type that have not been -- overridden. Only one null procedure will be created for a given set of --- 312,318 ---- -- invoking the inherited subprogram's parent subprogram and extended -- with a null association list. ! function Make_Null_Procedure_Specs (Tag_Typ : Entity_Id) return List_Id; -- Ada 2005 (AI-251): Makes specs for null procedures associated with any -- null procedures inherited from an interface type that have not been -- overridden. Only one null procedure will be created for a given set of *************** package body Exp_Ch3 is *** 504,510 **** -- And insert this declaration into the tree. The type of the -- discriminant is then reset to this more restricted subtype. ! Tnn := Make_Defining_Identifier (Loc, New_Internal_Name ('T')); Insert_Action (Declaration_Node (Rtype), Make_Subtype_Declaration (Loc, --- 518,524 ---- -- And insert this declaration into the tree. The type of the -- discriminant is then reset to this more restricted subtype. ! Tnn := Make_Temporary (Loc, 'T'); Insert_Action (Declaration_Node (Rtype), Make_Subtype_Declaration (Loc, *************** package body Exp_Ch3 is *** 546,552 **** function Init_Component return List_Id; -- Create one statement to initialize one array component, designated ! -- by a full set of indices. function Init_One_Dimension (N : Int) return List_Id; -- Create loop to initialize one dimension of the array. The single --- 560,566 ---- function Init_Component return List_Id; -- Create one statement to initialize one array component, designated ! -- by a full set of indexes. function Init_One_Dimension (N : Int) return List_Id; -- Create loop to initialize one dimension of the array. The single *************** package body Exp_Ch3 is *** 566,572 **** begin Comp := Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Expressions => Index_List); if Needs_Simple_Initialization (Comp_Type) then --- 580,586 ---- begin Comp := Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Expressions => Index_List); if Needs_Simple_Initialization (Comp_Type) then *************** package body Exp_Ch3 is *** 593,599 **** ------------------------ function Init_One_Dimension (N : Int) return List_Id is ! Index : Entity_Id; begin -- If the component does not need initializing, then there is nothing --- 607,613 ---- ------------------------ function Init_One_Dimension (N : Int) return List_Id is ! Index : Entity_Id; begin -- If the component does not need initializing, then there is nothing *************** package body Exp_Ch3 is *** 631,637 **** Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Range, ! Expressions => New_List ( Make_Integer_Literal (Loc, N))))), Statements => Init_One_Dimension (N + 1))); end if; --- 645,651 ---- Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Range, ! Expressions => New_List ( Make_Integer_Literal (Loc, N))))), Statements => Init_One_Dimension (N + 1))); end if; *************** package body Exp_Ch3 is *** 784,789 **** --- 798,804 ---- Decl : Node_Id; P : Node_Id; Par : Node_Id; + Scop : Entity_Id; begin -- Nothing to do if there is no task hierarchy *************** package body Exp_Ch3 is *** 802,810 **** P := Parent (T); end if; -- Nothing to do if we already built a master entity for this scope ! if not Has_Master_Entity (Scope (T)) then -- First build the master entity -- _Master : constant Master_Id := Current_Master.all; --- 817,827 ---- P := Parent (T); end if; + Scop := Find_Master_Scope (T); + -- Nothing to do if we already built a master entity for this scope ! if not Has_Master_Entity (Scop) then -- First build the master entity -- _Master : constant Master_Id := Current_Master.all; *************** package body Exp_Ch3 is *** 820,828 **** Make_Explicit_Dereference (Loc, New_Reference_To (RTE (RE_Current_Master), Loc))); Insert_Action (P, Decl); Analyze (Decl); - Set_Has_Master_Entity (Scope (T)); -- Now mark the containing scope as a task master. Masters -- associated with return statements are already marked at --- 837,845 ---- Make_Explicit_Dereference (Loc, New_Reference_To (RTE (RE_Current_Master), Loc))); + Set_Has_Master_Entity (Scop); Insert_Action (P, Decl); Analyze (Decl); -- Now mark the containing scope as a task master. Masters -- associated with return statements are already marked at *************** package body Exp_Ch3 is *** 855,862 **** Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => M_Id, ! Subtype_Mark => New_Reference_To (Standard_Integer, Loc), ! Name => Make_Identifier (Loc, Name_uMaster)); Insert_Before (P, Decl); Analyze (Decl); --- 872,879 ---- Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => M_Id, ! Subtype_Mark => New_Reference_To (Standard_Integer, Loc), ! Name => Make_Identifier (Loc, Name_uMaster)); Insert_Before (P, Decl); Analyze (Decl); *************** package body Exp_Ch3 is *** 921,928 **** -- Replace the discriminant which controls the variant, with the name -- of the formal of the checking function. ! Set_Expression (Case_Node, ! Make_Identifier (Loc, Chars (Case_Id))); Choice := First (Discrete_Choices (Variant)); --- 938,944 ---- -- Replace the discriminant which controls the variant, with the name -- of the formal of the checking function. ! Set_Expression (Case_Node, Make_Identifier (Loc, Chars (Case_Id))); Choice := First (Discrete_Choices (Variant)); *************** package body Exp_Ch3 is *** 1464,1475 **** if Has_Task (Full_Type) then if Restriction_Active (No_Task_Hierarchy) then ! ! -- See comments in System.Tasking.Initialization.Init_RTS ! -- for the value 3 (should be rtsfindable constant ???) ! ! Append_To (Args, Make_Integer_Literal (Loc, 3)); ! else Append_To (Args, Make_Identifier (Loc, Name_uMaster)); end if; --- 1480,1487 ---- if Has_Task (Full_Type) then if Restriction_Active (No_Task_Hierarchy) then ! Append_To (Args, ! New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc)); else Append_To (Args, Make_Identifier (Loc, Name_uMaster)); end if; *************** package body Exp_Ch3 is *** 1648,1654 **** and then Has_New_Controlled_Component (Enclos_Type) and then Has_Controlled_Component (Typ) then ! if Is_Inherently_Limited_Type (Typ) then Controller_Typ := RTE (RE_Limited_Record_Controller); else Controller_Typ := RTE (RE_Record_Controller); --- 1660,1666 ---- and then Has_New_Controlled_Component (Enclos_Type) and then Has_Controlled_Component (Typ) then ! if Is_Immutably_Limited_Type (Typ) then Controller_Typ := RTE (RE_Limited_Record_Controller); else Controller_Typ := RTE (RE_Record_Controller); *************** package body Exp_Ch3 is *** 1699,1706 **** Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => M_Id, ! Subtype_Mark => New_Reference_To (RTE (RE_Master_Id), Loc), ! Name => Make_Identifier (Loc, Name_uMaster)); Insert_Before (N, Decl); Analyze (Decl); return M_Id; --- 1711,1718 ---- Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => M_Id, ! Subtype_Mark => New_Reference_To (RTE (RE_Master_Id), Loc), ! Name => Make_Identifier (Loc, Name_uMaster)); Insert_Before (N, Decl); Analyze (Decl); return M_Id; *************** package body Exp_Ch3 is *** 1777,1782 **** --- 1789,1800 ---- -- -- This function builds the call statement in this _init_proc. + procedure Build_CPP_Init_Procedure; + -- Build the tree corresponding to the procedure specification and body + -- of the IC procedure that initializes the C++ part of the dispatch + -- table of an Ada tagged type that is a derivation of a CPP type. + -- Install it as the CPP_Init TSS. + procedure Build_Init_Procedure; -- Build the tree corresponding to the procedure specification and body -- of the initialization procedure (by calling all the preceding *************** package body Exp_Ch3 is *** 1842,1848 **** Loc := Sloc (N); Lhs := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => New_Occurrence_Of (Id, Loc)); Set_Assignment_OK (Lhs); --- 1860,1866 ---- Loc := Sloc (N); Lhs := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => New_Occurrence_Of (Id, Loc)); Set_Assignment_OK (Lhs); *************** package body Exp_Ch3 is *** 1911,1917 **** if Needs_Finalization (Typ) and then not (Nkind_In (Kind, N_Aggregate, N_Extension_Aggregate)) ! and then not Is_Inherently_Limited_Type (Typ) then declare Ref : constant Node_Id := --- 1929,1935 ---- if Needs_Finalization (Typ) and then not (Nkind_In (Kind, N_Aggregate, N_Extension_Aggregate)) ! and then not Is_Immutably_Limited_Type (Typ) then declare Ref : constant Node_Id := *************** package body Exp_Ch3 is *** 2019,2029 **** if Has_Task (Rec_Type) then if Restriction_Active (No_Task_Hierarchy) then ! ! -- See comments in System.Tasking.Initialization.Init_RTS ! -- for the value 3. ! ! Append_To (Args, Make_Integer_Literal (Loc, 3)); else Append_To (Args, Make_Identifier (Loc, Name_uMaster)); end if; --- 2037,2044 ---- if Has_Task (Rec_Type) then if Restriction_Active (No_Task_Hierarchy) then ! Append_To (Args, ! New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc)); else Append_To (Args, Make_Identifier (Loc, Name_uMaster)); end if; *************** package body Exp_Ch3 is *** 2115,2124 **** Spec_Node : Node_Id; begin ! Func_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('F')); ! Set_DT_Offset_To_Top_Func (Iface_Comp, Func_Id); -- Generate --- 2130,2136 ---- Spec_Node : Node_Id; begin ! Func_Id := Make_Temporary (Loc, 'F'); Set_DT_Offset_To_Top_Func (Iface_Comp, Func_Id); -- Generate *************** package body Exp_Ch3 is *** 2149,2159 **** Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, ! Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uO), ! Selector_Name => New_Reference_To ! (Iface_Comp, Loc)), Attribute_Name => Name_Position))))); Set_Ekind (Func_Id, E_Function); --- 2161,2171 ---- Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, ! Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uO), ! Selector_Name => ! New_Reference_To (Iface_Comp, Loc)), Attribute_Name => Name_Position))))); Set_Ekind (Func_Id, E_Function); *************** package body Exp_Ch3 is *** 2213,2218 **** --- 2225,2328 ---- end loop; end Build_Offset_To_Top_Functions; + ------------------------------ + -- Build_CPP_Init_Procedure -- + ------------------------------ + + procedure Build_CPP_Init_Procedure is + Body_Node : Node_Id; + Body_Stmts : List_Id; + Flag_Id : Entity_Id; + Flag_Decl : Node_Id; + Handled_Stmt_Node : Node_Id; + Init_Tags_List : List_Id; + Proc_Id : Entity_Id; + Proc_Spec_Node : Node_Id; + + begin + -- Check cases requiring no IC routine + + if not Is_CPP_Class (Root_Type (Rec_Type)) + or else Is_CPP_Class (Rec_Type) + or else CPP_Num_Prims (Rec_Type) = 0 + or else not Tagged_Type_Expansion + or else No_Run_Time_Mode + then + return; + end if; + + -- Generate: + + -- Flag : Boolean := False; + -- + -- procedure Typ_IC is + -- begin + -- if not Flag then + -- Copy C++ dispatch table slots from parent + -- Update C++ slots of overridden primitives + -- end if; + -- end; + + Flag_Id := Make_Temporary (Loc, 'F'); + + Flag_Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Flag_Id, + Object_Definition => + New_Reference_To (Standard_Boolean, Loc), + Expression => + New_Reference_To (Standard_True, Loc)); + + Analyze (Flag_Decl); + Append_Freeze_Action (Rec_Type, Flag_Decl); + + Body_Stmts := New_List; + Body_Node := New_Node (N_Subprogram_Body, Loc); + + Proc_Spec_Node := New_Node (N_Procedure_Specification, Loc); + + Proc_Id := + Make_Defining_Identifier (Loc, + Chars => Make_TSS_Name (Rec_Type, TSS_CPP_Init_Proc)); + + Set_Ekind (Proc_Id, E_Procedure); + Set_Is_Internal (Proc_Id); + + Set_Defining_Unit_Name (Proc_Spec_Node, Proc_Id); + + Set_Parameter_Specifications (Proc_Spec_Node, New_List); + Set_Specification (Body_Node, Proc_Spec_Node); + Set_Declarations (Body_Node, New_List); + + Init_Tags_List := Build_Inherit_CPP_Prims (Rec_Type); + + Append_To (Init_Tags_List, + Make_Assignment_Statement (Loc, + Name => + New_Reference_To (Flag_Id, Loc), + Expression => + New_Reference_To (Standard_False, Loc))); + + Append_To (Body_Stmts, + Make_If_Statement (Loc, + Condition => New_Occurrence_Of (Flag_Id, Loc), + Then_Statements => Init_Tags_List)); + + Handled_Stmt_Node := + New_Node (N_Handled_Sequence_Of_Statements, Loc); + Set_Statements (Handled_Stmt_Node, Body_Stmts); + Set_Exception_Handlers (Handled_Stmt_Node, No_List); + Set_Handled_Statement_Sequence (Body_Node, Handled_Stmt_Node); + + if not Debug_Generated_Code then + Set_Debug_Info_Off (Proc_Id); + end if; + + -- Associate CPP_Init_Proc with type + + Set_Init_Proc (Rec_Type, Proc_Id); + end Build_CPP_Init_Procedure; + -------------------------- -- Build_Init_Procedure -- -------------------------- *************** package body Exp_Ch3 is *** 2243,2254 **** -- a type extension. If the flag is false, we do not set the tag -- because it has been set already in the extension. ! if Is_Tagged_Type (Rec_Type) ! and then not Is_CPP_Class (Rec_Type) ! then ! Set_Tag := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); Append_To (Parameters, Make_Parameter_Specification (Loc, --- 2353,2360 ---- -- a type extension. If the flag is false, we do not set the tag -- because it has been set already in the extension. ! if Is_Tagged_Type (Rec_Type) then ! Set_Tag := Make_Temporary (Loc, 'P'); Append_To (Parameters, Make_Parameter_Specification (Loc, *************** package body Exp_Ch3 is *** 2318,2466 **** -- the C++ side. if Is_Tagged_Type (Rec_Type) - and then not Is_CPP_Class (Rec_Type) and then Tagged_Type_Expansion and then not No_Run_Time_Mode then ! -- Initialize the primary tag ! ! Init_Tags_List := New_List ( ! Make_Assignment_Statement (Loc, ! Name => ! Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), ! Selector_Name => ! New_Reference_To (First_Tag_Component (Rec_Type), Loc)), ! ! Expression => ! New_Reference_To ! (Node (First_Elmt (Access_Disp_Table (Rec_Type))), Loc))); ! ! -- Generate the SCIL node associated with the initialization of ! -- the tag component. ! ! if Generate_SCIL then ! declare ! New_Node : Node_Id; ! begin ! New_Node := ! Make_SCIL_Tag_Init (Sloc (First (Init_Tags_List))); ! Set_SCIL_Related_Node (New_Node, First (Init_Tags_List)); ! Set_SCIL_Entity (New_Node, Rec_Type); ! Prepend_To (Init_Tags_List, New_Node); ! end; ! end if; ! -- Ada 2005 (AI-251): Initialize the secondary tags components ! -- located at fixed positions (tags whose position depends on ! -- variable size components are initialized later ---see below). ! if Ada_Version >= Ada_05 ! and then not Is_Interface (Rec_Type) ! and then Has_Interfaces (Rec_Type) ! then ! Init_Secondary_Tags ! (Typ => Rec_Type, ! Target => Make_Identifier (Loc, Name_uInit), ! Stmts_List => Init_Tags_List, ! Fixed_Comps => True, ! Variable_Comps => False); ! end if; ! -- The tag must be inserted before the assignments to other ! -- components, because the initial value of the component may ! -- depend on the tag (eg. through a dispatching operation on ! -- an access to the current type). The tag assignment is not done ! -- when initializing the parent component of a type extension, ! -- because in that case the tag is set in the extension. ! -- Extensions of imported C++ classes add a final complication, ! -- because we cannot inhibit tag setting in the constructor for ! -- the parent. In that case we insert the tag initialization ! -- after the calls to initialize the parent. - if not Is_CPP_Class (Root_Type (Rec_Type)) then Prepend_To (Body_Stmts, Make_If_Statement (Loc, Condition => New_Occurrence_Of (Set_Tag, Loc), Then_Statements => Init_Tags_List)); ! -- CPP_Class derivation: In this case the dispatch table of the ! -- parent was built in the C++ side and we copy the table of the ! -- parent to initialize the new dispatch table. else declare ! Nod : Node_Id; begin ! -- We assume the first init_proc call is for the parent ! Nod := First (Body_Stmts); ! while Present (Next (Nod)) ! and then (Nkind (Nod) /= N_Procedure_Call_Statement ! or else not Is_Init_Proc (Name (Nod))) loop ! Nod := Next (Nod); end loop; ! -- Generate: ! -- ancestor_constructor (_init.parent); ! -- if Arg2 then ! -- inherit_prim_ops (_init._tag, new_dt, num_prims); ! -- _init._tag := new_dt; ! -- end if; ! ! Prepend_To (Init_Tags_List, ! Build_Inherit_Prims (Loc, ! Typ => Rec_Type, ! Old_Tag_Node => ! Make_Selected_Component (Loc, ! Prefix => ! Make_Identifier (Loc, ! Chars => Name_uInit), ! Selector_Name => ! New_Reference_To ! (First_Tag_Component (Rec_Type), Loc)), ! New_Tag_Node => ! New_Reference_To ! (Node (First_Elmt (Access_Disp_Table (Rec_Type))), ! Loc), ! Num_Prims => ! UI_To_Int ! (DT_Entry_Count (First_Tag_Component (Rec_Type))))); ! Insert_After (Nod, ! Make_If_Statement (Loc, ! Condition => New_Occurrence_Of (Set_Tag, Loc), ! Then_Statements => Init_Tags_List)); ! -- We have inherited table of the parent from the CPP side. ! -- Now we fill the slots associated with Ada primitives. ! -- This needs more work to avoid its execution each time ! -- an object is initialized??? ! declare ! E : Elmt_Id; ! Prim : Node_Id; ! begin ! E := First_Elmt (Primitive_Operations (Rec_Type)); ! while Present (E) loop ! Prim := Node (E); ! if not Is_Imported (Prim) ! and then Convention (Prim) = Convention_CPP ! and then not Present (Interface_Alias (Prim)) ! then ! Append_List_To (Init_Tags_List, ! Register_Primitive (Loc, Prim => Prim)); ! end if; ! Next_Elmt (E); ! end loop; ! end; end; end if; --- 2424,2577 ---- -- the C++ side. if Is_Tagged_Type (Rec_Type) and then Tagged_Type_Expansion and then not No_Run_Time_Mode then ! -- Case 1: Ada tagged types with no CPP ancestor. Set the tags of ! -- the actual object and invoke the IP of the parent (in this ! -- order). The tag must be initialized before the call to the IP ! -- of the parent and the assignments to other components because ! -- the initial value of the components may depend on the tag (eg. ! -- through a dispatching operation on an access to the current ! -- type). The tag assignment is not done when initializing the ! -- parent component of a type extension, because in that case the ! -- tag is set in the extension. ! if not Is_CPP_Class (Root_Type (Rec_Type)) then ! -- Initialize the primary tag component ! Init_Tags_List := New_List ( ! Make_Assignment_Statement (Loc, ! Name => ! Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), ! Selector_Name => ! New_Reference_To ! (First_Tag_Component (Rec_Type), Loc)), ! Expression => ! New_Reference_To ! (Node ! (First_Elmt (Access_Disp_Table (Rec_Type))), Loc))); ! -- Ada 2005 (AI-251): Initialize the secondary tags components ! -- located at fixed positions (tags whose position depends on ! -- variable size components are initialized later ---see below) ! if Ada_Version >= Ada_2005 ! and then not Is_Interface (Rec_Type) ! and then Has_Interfaces (Rec_Type) ! then ! Init_Secondary_Tags ! (Typ => Rec_Type, ! Target => Make_Identifier (Loc, Name_uInit), ! Stmts_List => Init_Tags_List, ! Fixed_Comps => True, ! Variable_Comps => False); ! end if; Prepend_To (Body_Stmts, Make_If_Statement (Loc, Condition => New_Occurrence_Of (Set_Tag, Loc), Then_Statements => Init_Tags_List)); ! -- Case 2: CPP type. The imported C++ constructor takes care of ! -- tags initialization. No action needed here because the IP ! -- is built by Set_CPP_Constructors; in this case the IP is a ! -- wrapper that invokes the C++ constructor and copies the C++ ! -- tags locally. Done to inherit the C++ slots in Ada derivations ! -- (see case 3). ! ! elsif Is_CPP_Class (Rec_Type) then ! pragma Assert (False); ! null; ! ! -- Case 3: Combined hierarchy containing C++ types and Ada tagged ! -- type derivations. Derivations of imported C++ classes add a ! -- complication, because we cannot inhibit tag setting in the ! -- constructor for the parent. Hence we initialize the tag after ! -- the call to the parent IP (that is, in reverse order compared ! -- with pure Ada hierarchies ---see comment on case 1). else + -- Initialize the primary tag + + Init_Tags_List := New_List ( + Make_Assignment_Statement (Loc, + Name => + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Name_uInit), + Selector_Name => + New_Reference_To + (First_Tag_Component (Rec_Type), Loc)), + Expression => + New_Reference_To + (Node + (First_Elmt (Access_Disp_Table (Rec_Type))), Loc))); + + -- Ada 2005 (AI-251): Initialize the secondary tags components + -- located at fixed positions (tags whose position depends on + -- variable size components are initialized later ---see below) + + if Ada_Version >= Ada_2005 + and then not Is_Interface (Rec_Type) + and then Has_Interfaces (Rec_Type) + then + Init_Secondary_Tags + (Typ => Rec_Type, + Target => Make_Identifier (Loc, Name_uInit), + Stmts_List => Init_Tags_List, + Fixed_Comps => True, + Variable_Comps => False); + end if; + + -- Initialize the tag component after invocation of parent IP. + + -- Generate: + -- parent_IP(_init.parent); // Invokes the C++ constructor + -- [ typIC; ] // Inherit C++ slots from parent + -- init_tags + declare ! Ins_Nod : Node_Id; begin ! -- Search for the call to the IP of the parent. We assume ! -- that the first init_proc call is for the parent. ! Ins_Nod := First (Body_Stmts); ! while Present (Next (Ins_Nod)) ! and then (Nkind (Ins_Nod) /= N_Procedure_Call_Statement ! or else not Is_Init_Proc (Name (Ins_Nod))) loop ! Next (Ins_Nod); end loop; ! -- The IC routine copies the inherited slots of the C+ part ! -- of the dispatch table from the parent and updates the ! -- overridden C++ slots. ! if CPP_Num_Prims (Rec_Type) > 0 then ! declare ! Init_DT : Entity_Id; ! New_Nod : Node_Id; ! begin ! Init_DT := CPP_Init_Proc (Rec_Type); ! pragma Assert (Present (Init_DT)); ! New_Nod := ! Make_Procedure_Call_Statement (Loc, ! New_Reference_To (Init_DT, Loc)); ! Insert_After (Ins_Nod, New_Nod); ! -- Update location of init tag statements ! Ins_Nod := New_Nod; ! end; ! end if; ! Insert_List_After (Ins_Nod, Init_Tags_List); end; end if; *************** package body Exp_Ch3 is *** 2471,2477 **** -- depend on discriminants is only safely read at runtime after -- the parent components have been initialized. ! if Ada_Version >= Ada_05 and then not Is_Interface (Rec_Type) and then Has_Interfaces (Rec_Type) and then Has_Discriminants (Etype (Rec_Type)) --- 2582,2588 ---- -- depend on discriminants is only safely read at runtime after -- the parent components have been initialized. ! if Ada_Version >= Ada_2005 and then not Is_Interface (Rec_Type) and then Has_Interfaces (Rec_Type) and then Has_Discriminants (Etype (Rec_Type)) *************** package body Exp_Ch3 is *** 2751,2764 **** Append_To (Statement_List, Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), Expression => Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), ! Selector_Name => ! Make_Identifier (Loc, Name_uATCB)), Attribute_Name => Name_Unchecked_Access))); end if; --- 2862,2874 ---- Append_To (Statement_List, Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), Expression => Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), ! Selector_Name => Make_Identifier (Loc, Name_uATCB)), Attribute_Name => Name_Unchecked_Access))); end if; *************** package body Exp_Ch3 is *** 2802,2813 **** RTE (RE_Bind_Interrupt_To_Entry), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), ! Entry_Index_Expression ( ! Loc, Ent, Empty, Task_Type), Expression (Vis_Decl)))); end if; end if; --- 2912,2923 ---- RTE (RE_Bind_Interrupt_To_Entry), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), ! Entry_Index_Expression ! (Loc, Ent, Empty, Task_Type), Expression (Vis_Decl)))); end if; end if; *************** package body Exp_Ch3 is *** 3138,3144 **** -- at the other end of the call, even if it does nothing!) -- Note: the reason we exclude the CPP_Class case is because in this ! -- case the initialization is performed in the C++ side. if Is_CPP_Class (Rec_Id) then return False; --- 3248,3255 ---- -- at the other end of the call, even if it does nothing!) -- Note: the reason we exclude the CPP_Class case is because in this ! -- case the initialization is performed by the C++ constructors, and ! -- the IP is built by Set_CPP_Constructors. if Is_CPP_Class (Rec_Id) then return False; *************** package body Exp_Ch3 is *** 3265,3270 **** --- 3376,3382 ---- end if; Build_Offset_To_Top_Functions; + Build_CPP_Init_Procedure; Build_Init_Procedure; Set_Is_Public (Proc_Id, Is_Public (Pe)); *************** package body Exp_Ch3 is *** 3404,3440 **** Loc : constant Source_Ptr := Sloc (Typ); Index : constant Entity_Id := Base_Type (Etype (First_Index (Typ))); ! -- Build formal parameters of procedure - Larray : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('A')); - Rarray : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('R')); - Left_Lo : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('L')); - Left_Hi : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('L')); - Right_Lo : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('R')); - Right_Hi : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('R')); - Rev : constant Entity_Id := - Make_Defining_Identifier - (Loc, Chars => New_Internal_Name ('D')); Proc_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name (Typ, TSS_Slice_Assign)); ! Lnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('L')); ! Rnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); -- Subscripts for left and right sides Decls : List_Id; --- 3516,3536 ---- Loc : constant Source_Ptr := Sloc (Typ); Index : constant Entity_Id := Base_Type (Etype (First_Index (Typ))); ! Larray : constant Entity_Id := Make_Temporary (Loc, 'A'); ! Rarray : constant Entity_Id := Make_Temporary (Loc, 'R'); ! Left_Lo : constant Entity_Id := Make_Temporary (Loc, 'L'); ! Left_Hi : constant Entity_Id := Make_Temporary (Loc, 'L'); ! Right_Lo : constant Entity_Id := Make_Temporary (Loc, 'R'); ! Right_Hi : constant Entity_Id := Make_Temporary (Loc, 'R'); ! Rev : constant Entity_Id := Make_Temporary (Loc, 'D'); ! -- Formal parameters of procedure Proc_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name (Typ, TSS_Slice_Assign)); ! Lnn : constant Entity_Id := Make_Temporary (Loc, 'L'); ! Rnn : constant Entity_Id := Make_Temporary (Loc, 'R'); -- Subscripts for left and right sides Decls : List_Id; *************** package body Exp_Ch3 is *** 3442,3448 **** Stats : List_Id; begin ! -- Build declarations for indices Decls := New_List; --- 3538,3544 ---- Stats : List_Id; begin ! -- Build declarations for indexes Decls := New_List; *************** package body Exp_Ch3 is *** 3470,3476 **** Right_Opnd => New_Occurrence_Of (Left_Lo, Loc)), Then_Statements => New_List (Make_Simple_Return_Statement (Loc)))); ! -- Build initializations for indices declare F_Init : constant List_Id := New_List; --- 3566,3572 ---- Right_Opnd => New_Occurrence_Of (Left_Lo, Loc)), Then_Statements => New_List (Make_Simple_Return_Statement (Loc)))); ! -- Build initializations for indexes declare F_Init : constant List_Id := New_List; *************** package body Exp_Ch3 is *** 3655,3660 **** --- 3751,3899 ---- Set_Is_Pure (Proc_Name); end Build_Slice_Assignment; + ----------------------------- + -- Build_Untagged_Equality -- + ----------------------------- + + procedure Build_Untagged_Equality (Typ : Entity_Id) is + Build_Eq : Boolean; + Comp : Entity_Id; + Decl : Node_Id; + Op : Entity_Id; + Prim : Elmt_Id; + Eq_Op : Entity_Id; + + function User_Defined_Eq (T : Entity_Id) return Entity_Id; + -- Check whether the type T has a user-defined primitive equality. If so + -- return it, else return Empty. If true for a component of Typ, we have + -- to build the primitive equality for it. + + --------------------- + -- User_Defined_Eq -- + --------------------- + + function User_Defined_Eq (T : Entity_Id) return Entity_Id is + Prim : Elmt_Id; + Op : Entity_Id; + + begin + Op := TSS (T, TSS_Composite_Equality); + + if Present (Op) then + return Op; + end if; + + Prim := First_Elmt (Collect_Primitive_Operations (T)); + while Present (Prim) loop + Op := Node (Prim); + + if Chars (Op) = Name_Op_Eq + and then Etype (Op) = Standard_Boolean + and then Etype (First_Formal (Op)) = T + and then Etype (Next_Formal (First_Formal (Op))) = T + then + return Op; + end if; + + Next_Elmt (Prim); + end loop; + + return Empty; + end User_Defined_Eq; + + -- Start of processing for Build_Untagged_Equality + + begin + -- If a record component has a primitive equality operation, we must + -- build the corresponding one for the current type. + + Build_Eq := False; + Comp := First_Component (Typ); + while Present (Comp) loop + if Is_Record_Type (Etype (Comp)) + and then Present (User_Defined_Eq (Etype (Comp))) + then + Build_Eq := True; + end if; + + Next_Component (Comp); + end loop; + + -- If there is a user-defined equality for the type, we do not create + -- the implicit one. + + Prim := First_Elmt (Collect_Primitive_Operations (Typ)); + Eq_Op := Empty; + while Present (Prim) loop + if Chars (Node (Prim)) = Name_Op_Eq + and then Comes_From_Source (Node (Prim)) + + -- Don't we also need to check formal types and return type as in + -- User_Defined_Eq above??? + + then + Eq_Op := Node (Prim); + Build_Eq := False; + exit; + end if; + + Next_Elmt (Prim); + end loop; + + -- If the type is derived, inherit the operation, if present, from the + -- parent type. It may have been declared after the type derivation. If + -- the parent type itself is derived, it may have inherited an operation + -- that has itself been overridden, so update its alias and related + -- flags. Ditto for inequality. + + if No (Eq_Op) and then Is_Derived_Type (Typ) then + Prim := First_Elmt (Collect_Primitive_Operations (Etype (Typ))); + while Present (Prim) loop + if Chars (Node (Prim)) = Name_Op_Eq then + Copy_TSS (Node (Prim), Typ); + Build_Eq := False; + + declare + Op : constant Entity_Id := User_Defined_Eq (Typ); + Eq_Op : constant Entity_Id := Node (Prim); + NE_Op : constant Entity_Id := Next_Entity (Eq_Op); + + begin + if Present (Op) then + Set_Alias (Op, Eq_Op); + Set_Is_Abstract_Subprogram + (Op, Is_Abstract_Subprogram (Eq_Op)); + + if Chars (Next_Entity (Op)) = Name_Op_Ne then + Set_Is_Abstract_Subprogram + (Next_Entity (Op), Is_Abstract_Subprogram (NE_Op)); + end if; + end if; + end; + + exit; + end if; + + Next_Elmt (Prim); + end loop; + end if; + + -- If not inherited and not user-defined, build body as for a type with + -- tagged components. + + if Build_Eq then + Decl := + Make_Eq_Body (Typ, Make_TSS_Name (Typ, TSS_Composite_Equality)); + Op := Defining_Entity (Decl); + Set_TSS (Typ, Op); + Set_Is_Pure (Op); + + if Is_Library_Level_Entity (Typ) then + Set_Is_Public (Op); + end if; + end if; + end Build_Untagged_Equality; + ------------------------------------ -- Build_Variant_Record_Equality -- ------------------------------------ *************** package body Exp_Ch3 is *** 4081,4087 **** Expand_Access_Protected_Subprogram_Type (N); end if; ! elsif Ada_Version >= Ada_05 and then Is_Array_Type (Def_Id) and then Is_Access_Type (Component_Type (Def_Id)) and then Ekind (Component_Type (Def_Id)) = E_Anonymous_Access_Type --- 4320,4326 ---- Expand_Access_Protected_Subprogram_Type (N); end if; ! elsif Ada_Version >= Ada_2005 and then Is_Array_Type (Def_Id) and then Is_Access_Type (Component_Type (Def_Id)) and then Ekind (Component_Type (Def_Id)) = E_Anonymous_Access_Type *************** package body Exp_Ch3 is *** 4091,4097 **** elsif Has_Task (Def_Id) then Expand_Previous_Access_Type (Def_Id); ! elsif Ada_Version >= Ada_05 and then (Is_Record_Type (Def_Id) or else (Is_Array_Type (Def_Id) --- 4330,4336 ---- elsif Has_Task (Def_Id) then Expand_Previous_Access_Type (Def_Id); ! elsif Ada_Version >= Ada_2005 and then (Is_Record_Type (Def_Id) or else (Is_Array_Type (Def_Id) *************** package body Exp_Ch3 is *** 4329,4334 **** --- 4568,4586 ---- if No (Expr) then + -- For the default initialization case, if we have a private type + -- with invariants, and invariant checks are enabled, then insert an + -- invariant check after the object declaration. Note that it is OK + -- to clobber the object with an invalid value since if the exception + -- is raised, then the object will go out of scope. + + if Has_Invariants (Typ) + and then Present (Invariant_Procedure (Typ)) + then + Insert_After (N, + Make_Invariant_Call (New_Occurrence_Of (Def_Id, Loc))); + end if; + -- Expand Initialize call for controlled objects. One may wonder why -- the Initialize Call is not done in the regular Init procedure -- attached to the record type. That's because the init procedure is *************** package body Exp_Ch3 is *** 4466,4472 **** -- it will be assigned subsequently. In particular, there is no point -- in applying Initialize_Scalars to such a temporary. ! elsif Needs_Simple_Initialization (Typ) and then not Is_Internal (Def_Id) and then not Has_Init_Expression (N) then --- 4718,4727 ---- -- it will be assigned subsequently. In particular, there is no point -- in applying Initialize_Scalars to such a temporary. ! elsif Needs_Simple_Initialization ! (Typ, ! Initialize_Scalars ! and then not Has_Following_Address_Clause (N)) and then not Is_Internal (Def_Id) and then not Has_Init_Expression (N) then *************** package body Exp_Ch3 is *** 4526,4532 **** -- plan to expand the allowed forms of functions that are treated as -- build-in-place. ! elsif Ada_Version >= Ada_05 and then Is_Build_In_Place_Function_Call (Expr_Q) then Make_Build_In_Place_Call_In_Object_Declaration (N, Expr_Q); --- 4781,4787 ---- -- plan to expand the allowed forms of functions that are treated as -- build-in-place. ! elsif Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Expr_Q) then Make_Build_In_Place_Call_In_Object_Declaration (N, Expr_Q); *************** package body Exp_Ch3 is *** 4556,4562 **** -- creating the object (via allocator) and initializing it. if Is_Return_Object (Def_Id) ! and then Is_Inherently_Limited_Type (Typ) then null; --- 4811,4817 ---- -- creating the object (via allocator) and initializing it. if Is_Return_Object (Def_Id) ! and then Is_Immutably_Limited_Type (Typ) then null; *************** package body Exp_Ch3 is *** 4565,4584 **** Iface : constant Entity_Id := Root_Type (Typ); Expr_N : Node_Id := Expr; Expr_Typ : Entity_Id; - - Decl_1 : Node_Id; - Decl_2 : Node_Id; New_Expr : Node_Id; begin -- If the original node of the expression was a conversion -- to this specific class-wide interface type then we ! -- restore the original node to generate code that ! -- statically displaces the pointer to the interface ! -- component. if not Comes_From_Source (Expr_N) ! and then Nkind (Expr_N) = N_Unchecked_Type_Conversion and then Nkind (Original_Node (Expr_N)) = N_Type_Conversion and then Etype (Original_Node (Expr_N)) = Typ then --- 4820,4839 ---- Iface : constant Entity_Id := Root_Type (Typ); Expr_N : Node_Id := Expr; Expr_Typ : Entity_Id; New_Expr : Node_Id; + Obj_Id : Entity_Id; + Tag_Comp : Node_Id; begin -- If the original node of the expression was a conversion -- to this specific class-wide interface type then we ! -- restore the original node because we must copy the object ! -- before displacing the pointer to reference the secondary ! -- tag component. This code must be kept synchronized with ! -- the expansion done by routine Expand_Interface_Conversion if not Comes_From_Source (Expr_N) ! and then Nkind (Expr_N) = N_Explicit_Dereference and then Nkind (Original_Node (Expr_N)) = N_Type_Conversion and then Etype (Original_Node (Expr_N)) = Typ then *************** package body Exp_Ch3 is *** 4595,4600 **** --- 4850,4856 ---- Set_Expression (N, Expr_N); end if; + Obj_Id := Make_Temporary (Loc, 'D', Expr_N); Expr_Typ := Base_Type (Etype (Expr_N)); if Is_Class_Wide_Type (Expr_Typ) then *************** package body Exp_Ch3 is *** 4605,4734 **** -- CW : I'Class := Obj; -- by -- Tmp : T := Obj; ! -- CW : I'Class renames TiC!(Tmp.I_Tag); if Comes_From_Source (Expr_N) and then Nkind (Expr_N) = N_Identifier and then not Is_Interface (Expr_Typ) and then (Expr_Typ = Etype (Expr_Typ) or else not Is_Variable_Size_Record (Etype (Expr_Typ))) then ! Decl_1 := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')), Object_Definition => New_Occurrence_Of (Expr_Typ, Loc), Expression => ! Unchecked_Convert_To (Expr_Typ, ! Relocate_Node (Expr_N))); -- Statically reference the tag associated with the -- interface ! Decl_2 := ! Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')), ! Subtype_Mark => ! New_Occurrence_Of (Typ, Loc), ! Name => ! Unchecked_Convert_To (Typ, ! Make_Selected_Component (Loc, ! Prefix => ! New_Occurrence_Of ! (Defining_Identifier (Decl_1), Loc), ! Selector_Name => ! New_Reference_To ! (Find_Interface_Tag (Expr_Typ, Iface), ! Loc)))); ! ! -- General case: -- Replace -- IW : I'Class := Obj; -- by -- type Equiv_Record is record ... end record; -- implicit subtype CW is ; ! -- Temp : CW := CW!(Obj'Address); ! -- IW : I'Class renames Displace (Temp, I'Tag); else ! -- Generate the equivalent record type Expand_Subtype_From_Expr (N => N, Unc_Type => Typ, Subtype_Indic => Object_Definition (N), ! Exp => Expression (N)); - if not Is_Interface (Etype (Expression (N))) then - New_Expr := Relocate_Node (Expression (N)); else New_Expr := ! Make_Explicit_Dereference (Loc, ! Unchecked_Convert_To (RTE (RE_Tag_Ptr), ! Make_Attribute_Reference (Loc, ! Prefix => Relocate_Node (Expression (N)), ! Attribute_Name => Name_Address))); end if; ! Decl_1 := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')), Object_Definition => New_Occurrence_Of ! (Etype (Object_Definition (N)), Loc), ! Expression => ! Unchecked_Convert_To ! (Etype (Object_Definition (N)), New_Expr)); ! Decl_2 := ! Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')), ! Subtype_Mark => ! New_Occurrence_Of (Typ, Loc), ! Name => ! Unchecked_Convert_To (Typ, ! Make_Explicit_Dereference (Loc, ! Unchecked_Convert_To (RTE (RE_Tag_Ptr), ! Make_Function_Call (Loc, ! Name => ! New_Reference_To (RTE (RE_Displace), Loc), ! Parameter_Associations => New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Occurrence_Of ! (Defining_Identifier (Decl_1), Loc), ! Attribute_Name => Name_Address), ! Unchecked_Convert_To (RTE (RE_Tag), ! New_Reference_To ! (Node ! (First_Elmt ! (Access_Disp_Table (Iface))), ! Loc)))))))); end if; ! Insert_Action (N, Decl_1); ! Rewrite (N, Decl_2); ! Analyze (N); ! -- Replace internal identifier of Decl_2 by the identifier ! -- found in the sources. We also have to exchange entities ! -- containing their defining identifiers to ensure the ! -- correct replacement of the object declaration by this ! -- object renaming declaration (because such definings ! -- identifier have been previously added by Enter_Name to ! -- the current scope). We must preserve the homonym chain ! -- of the source entity as well. Set_Chars (Defining_Identifier (N), Chars (Def_Id)); Set_Homonym (Defining_Identifier (N), Homonym (Def_Id)); --- 4861,4974 ---- -- CW : I'Class := Obj; -- by -- Tmp : T := Obj; ! -- type Ityp is not null access I'Class; ! -- CW : I'Class renames Ityp(Tmp.I_Tag'Address).all; if Comes_From_Source (Expr_N) and then Nkind (Expr_N) = N_Identifier and then not Is_Interface (Expr_Typ) + and then Interface_Present_In_Ancestor (Expr_Typ, Typ) and then (Expr_Typ = Etype (Expr_Typ) or else not Is_Variable_Size_Record (Etype (Expr_Typ))) then ! -- Copy the object ! ! Insert_Action (N, Make_Object_Declaration (Loc, ! Defining_Identifier => Obj_Id, Object_Definition => New_Occurrence_Of (Expr_Typ, Loc), Expression => ! Relocate_Node (Expr_N))); -- Statically reference the tag associated with the -- interface ! Tag_Comp := ! Make_Selected_Component (Loc, ! Prefix => New_Occurrence_Of (Obj_Id, Loc), ! Selector_Name => ! New_Reference_To ! (Find_Interface_Tag (Expr_Typ, Iface), Loc)); -- Replace -- IW : I'Class := Obj; -- by -- type Equiv_Record is record ... end record; -- implicit subtype CW is ; ! -- Tmp : CW := CW!(Obj); ! -- type Ityp is not null access I'Class; ! -- IW : I'Class renames ! -- Ityp!(Displace (Temp'Address, I'Tag)).all; else ! -- Generate the equivalent record type and update the ! -- subtype indication to reference it. Expand_Subtype_From_Expr (N => N, Unc_Type => Typ, Subtype_Indic => Object_Definition (N), ! Exp => Expr_N); ! ! if not Is_Interface (Etype (Expr_N)) then ! New_Expr := Relocate_Node (Expr_N); ! ! -- For interface types we use 'Address which displaces ! -- the pointer to the base of the object (if required) else New_Expr := ! Unchecked_Convert_To (Etype (Object_Definition (N)), ! Make_Explicit_Dereference (Loc, ! Unchecked_Convert_To (RTE (RE_Tag_Ptr), ! Make_Attribute_Reference (Loc, ! Prefix => Relocate_Node (Expr_N), ! Attribute_Name => Name_Address)))); end if; ! -- Copy the object ! ! Insert_Action (N, Make_Object_Declaration (Loc, ! Defining_Identifier => Obj_Id, Object_Definition => New_Occurrence_Of ! (Etype (Object_Definition (N)), Loc), ! Expression => New_Expr)); ! -- Dynamically reference the tag associated with the ! -- interface. ! Tag_Comp := ! Make_Function_Call (Loc, ! Name => New_Reference_To (RTE (RE_Displace), Loc), ! Parameter_Associations => New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Obj_Id, Loc), ! Attribute_Name => Name_Address), ! New_Reference_To ! (Node (First_Elmt (Access_Disp_Table (Iface))), ! Loc))); end if; ! Rewrite (N, ! Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'D'), ! Subtype_Mark => New_Occurrence_Of (Typ, Loc), ! Name => Convert_Tag_To_Interface (Typ, Tag_Comp))); ! Analyze (N, Suppress => All_Checks); ! ! -- Replace internal identifier of rewritten node by the ! -- identifier found in the sources. We also have to exchange ! -- entities containing their defining identifiers to ensure ! -- the correct replacement of the object declaration by this ! -- object renaming declaration ---because these identifiers ! -- were previously added by Enter_Name to the current scope. ! -- We must preserve the homonym chain of the source entity ! -- as well. Set_Chars (Defining_Identifier (N), Chars (Def_Id)); Set_Homonym (Defining_Identifier (N), Homonym (Def_Id)); *************** package body Exp_Ch3 is *** 4758,4764 **** and then No_Initialization (Expr) then null; ! else Apply_Constraint_Check (Expr, Typ); -- If the expression has been marked as requiring a range --- 4998,5007 ---- and then No_Initialization (Expr) then null; ! ! -- Otherwise apply a constraint check now if no prev error ! ! elsif Nkind (Expr) /= N_Error then Apply_Constraint_Check (Expr, Typ); -- If the expression has been marked as requiring a range *************** package body Exp_Ch3 is *** 4766,4772 **** if Do_Range_Check (Expr) then Set_Do_Range_Check (Expr, False); ! Generate_Range_Check (Expr, Typ, CE_Range_Check_Failed); end if; end if; end if; --- 5009,5019 ---- if Do_Range_Check (Expr) then Set_Do_Range_Check (Expr, False); ! ! if not Suppress_Assignment_Checks (N) then ! Generate_Range_Check ! (Expr, Typ, CE_Range_Check_Failed); ! end if; end if; end if; end if; *************** package body Exp_Ch3 is *** 4782,4788 **** -- renaming declaration. if Needs_Finalization (Typ) ! and then not Is_Inherently_Limited_Type (Typ) and then not Rewrite_As_Renaming then Insert_Actions_After (Init_After, --- 5029,5035 ---- -- renaming declaration. if Needs_Finalization (Typ) ! and then not Is_Immutably_Limited_Type (Typ) and then not Rewrite_As_Renaming then Insert_Actions_After (Init_After, *************** package body Exp_Ch3 is *** 4944,4952 **** Set_Renamed_Object (Defining_Identifier (N), Expr_Q); Set_Analyzed (N); end if; - end if; exception when RE_Not_Available => return; --- 5191,5200 ---- Set_Renamed_Object (Defining_Identifier (N), Expr_Q); Set_Analyzed (N); end if; end if; + -- Exception on library entity not available + exception when RE_Not_Available => return; *************** package body Exp_Ch3 is *** 5059,5065 **** Loc := Sloc (First (Component_Items (Comp_List))); end if; ! if Is_Inherently_Limited_Type (T) then Controller_Type := RTE (RE_Limited_Record_Controller); else Controller_Type := RTE (RE_Record_Controller); --- 5307,5313 ---- Loc := Sloc (First (Component_Items (Comp_List))); end if; ! if Is_Immutably_Limited_Type (T) then Controller_Type := RTE (RE_Limited_Record_Controller); else Controller_Type := RTE (RE_Record_Controller); *************** package body Exp_Ch3 is *** 5507,5519 **** Pos_Expr := Convert_To (Standard_Integer, Make_Op_Subtract (Loc, ! Left_Opnd => ! Unchecked_Convert_To (Ityp, ! Make_Identifier (Loc, Name_uA)), ! Right_Opnd => ! Make_Integer_Literal (Loc, ! Intval => ! Enumeration_Rep (First_Literal (Typ))))); end if; Append_To (Lst, --- 5755,5766 ---- Pos_Expr := Convert_To (Standard_Integer, Make_Op_Subtract (Loc, ! Left_Opnd => ! Unchecked_Convert_To ! (Ityp, Make_Identifier (Loc, Name_uA)), ! Right_Opnd => ! Make_Integer_Literal (Loc, ! Intval => Enumeration_Rep (First_Literal (Typ))))); end if; Append_To (Lst, *************** package body Exp_Ch3 is *** 5606,5617 **** Statements => New_List ( Make_Case_Statement (Loc, Expression => ! Unchecked_Convert_To (Ityp, ! Make_Identifier (Loc, Name_uA)), Alternatives => Lst)))); Set_TSS (Typ, Fent); Set_Is_Pure (Fent); if not Debug_Generated_Code then Set_Debug_Info_Off (Fent); --- 5853,5874 ---- Statements => New_List ( Make_Case_Statement (Loc, Expression => ! Unchecked_Convert_To ! (Ityp, Make_Identifier (Loc, Name_uA)), Alternatives => Lst)))); Set_TSS (Typ, Fent); + + -- Set Pure flag (it will be reset if the current context is not Pure). + -- We also pretend there was a pragma Pure_Function so that for purposes + -- of optimization and constant-folding, we will consider the function + -- Pure even if we are not in a Pure context). + Set_Is_Pure (Fent); + Set_Has_Pragma_Pure_Function (Fent); + + -- Unless we are in -gnatD mode, where we are debugging generated code, + -- this is an internal entity for which we don't need debug info. if not Debug_Generated_Code then Set_Debug_Info_Off (Fent); *************** package body Exp_Ch3 is *** 5627,5638 **** ------------------------------- procedure Expand_Freeze_Record_Type (N : Node_Id) is ! Def_Id : constant Node_Id := Entity (N); ! Type_Decl : constant Node_Id := Parent (Def_Id); ! Comp : Entity_Id; ! Comp_Typ : Entity_Id; ! Has_Static_DT : Boolean := False; ! Predef_List : List_Id; Flist : Entity_Id := Empty; -- Finalization list allocated for the case of a type with anonymous --- 5884,5894 ---- ------------------------------- procedure Expand_Freeze_Record_Type (N : Node_Id) is ! Def_Id : constant Node_Id := Entity (N); ! Type_Decl : constant Node_Id := Parent (Def_Id); ! Comp : Entity_Id; ! Comp_Typ : Entity_Id; ! Predef_List : List_Id; Flist : Entity_Id := Empty; -- Finalization list allocated for the case of a type with anonymous *************** package body Exp_Ch3 is *** 5645,5653 **** -- user-defined equality function). Used to pass this entity from -- Make_Predefined_Primitive_Specs to Predefined_Primitive_Bodies. ! Wrapper_Decl_List : List_Id := No_List; ! Wrapper_Body_List : List_Id := No_List; ! Null_Proc_Decl_List : List_Id := No_List; -- Start of processing for Expand_Freeze_Record_Type --- 5901,5908 ---- -- user-defined equality function). Used to pass this entity from -- Make_Predefined_Primitive_Specs to Predefined_Primitive_Bodies. ! Wrapper_Decl_List : List_Id := No_List; ! Wrapper_Body_List : List_Id := No_List; -- Start of processing for Expand_Freeze_Record_Type *************** package body Exp_Ch3 is *** 5668,5676 **** elsif Is_Derived_Type (Def_Id) and then not Is_Tagged_Type (Def_Id) ! -- If we have a derived Unchecked_Union, we do not inherit the ! -- discriminant checking functions from the parent type since the ! -- discriminants are non existent. and then not Is_Unchecked_Union (Def_Id) and then Has_Discriminants (Def_Id) --- 5923,5931 ---- elsif Is_Derived_Type (Def_Id) and then not Is_Tagged_Type (Def_Id) ! -- If we have a derived Unchecked_Union, we do not inherit the ! -- discriminant checking functions from the parent type since the ! -- discriminants are non existent. and then not Is_Unchecked_Union (Def_Id) and then Has_Discriminants (Def_Id) *************** package body Exp_Ch3 is *** 5708,5714 **** -- declaration. Comp := First_Component (Def_Id); - while Present (Comp) loop Comp_Typ := Etype (Comp); --- 5963,5968 ---- *************** package body Exp_Ch3 is *** 5751,5759 **** -- just use it. if Is_Tagged_Type (Def_Id) then - Has_Static_DT := - Static_Dispatch_Tables - and then Is_Library_Level_Tagged_Type (Def_Id); -- Add the _Tag component --- 6005,6010 ---- *************** package body Exp_Ch3 is *** 5763,5769 **** if Is_CPP_Class (Def_Id) then Set_All_DT_Position (Def_Id); - Set_CPP_Constructors (Def_Id); -- Create the tag entities with a minimum decoration --- 6014,6019 ---- *************** package body Exp_Ch3 is *** 5771,5778 **** Append_Freeze_Actions (Def_Id, Make_Tags (Def_Id)); end if; else ! if not Has_Static_DT then -- Usually inherited primitives are not delayed but the first -- Ada extension of a CPP_Class is an exception since the --- 6021,6030 ---- Append_Freeze_Actions (Def_Id, Make_Tags (Def_Id)); end if; + Set_CPP_Constructors (Def_Id); + else ! if not Building_Static_DT (Def_Id) then -- Usually inherited primitives are not delayed but the first -- Ada extension of a CPP_Class is an exception since the *************** package body Exp_Ch3 is *** 5782,5795 **** -- Similarly, if this is an inherited operation whose parent is -- not frozen yet, it is not in the DT of the parent, and we -- generate an explicit freeze node for the inherited operation ! -- so that it is properly inserted in the DT of the current ! -- type. declare ! Elmt : Elmt_Id := First_Elmt (Primitive_Operations (Def_Id)); Subp : Entity_Id; begin while Present (Elmt) loop Subp := Node (Elmt); --- 6034,6047 ---- -- Similarly, if this is an inherited operation whose parent is -- not frozen yet, it is not in the DT of the parent, and we -- generate an explicit freeze node for the inherited operation ! -- so it is properly inserted in the DT of the current type. declare ! Elmt : Elmt_Id; Subp : Entity_Id; begin + Elmt := First_Elmt (Primitive_Operations (Def_Id)); while Present (Elmt) loop Subp := Node (Elmt); *************** package body Exp_Ch3 is *** 5825,5830 **** --- 6077,6090 ---- then null; + -- Do not add the spec of predefined primitives in case of + -- CIL and Java tagged types + + elsif Convention (Def_Id) = Convention_CIL + or else Convention (Def_Id) = Convention_Java + then + null; + -- Do not add the spec of the predefined primitives if we are -- compiling under restriction No_Dispatching_Calls *************** package body Exp_Ch3 is *** 5838,5846 **** -- wrapper functions for each nonoverridden inherited function -- with a controlling result of the type. The wrapper for such -- a function returns an extension aggregate that invokes the ! -- the parent function. ! if Ada_Version >= Ada_05 and then not Is_Abstract_Type (Def_Id) and then Is_Null_Extension (Def_Id) then --- 6098,6106 ---- -- wrapper functions for each nonoverridden inherited function -- with a controlling result of the type. The wrapper for such -- a function returns an extension aggregate that invokes the ! -- parent function. ! if Ada_Version >= Ada_2005 and then not Is_Abstract_Type (Def_Id) and then Is_Null_Extension (Def_Id) then *************** package body Exp_Ch3 is *** 5855,5870 **** -- overridden. This is done to ensure that the dispatch table -- entry associated with such null primitives are properly filled. ! if Ada_Version >= Ada_05 and then Etype (Def_Id) /= Def_Id and then not Is_Abstract_Type (Def_Id) then ! Make_Null_Procedure_Specs (Def_Id, Null_Proc_Decl_List); ! Insert_Actions (N, Null_Proc_Decl_List); end if; Set_Is_Frozen (Def_Id); ! Set_All_DT_Position (Def_Id); -- Add the controlled component before the freezing actions -- referenced in those actions. --- 6115,6134 ---- -- overridden. This is done to ensure that the dispatch table -- entry associated with such null primitives are properly filled. ! if Ada_Version >= Ada_2005 and then Etype (Def_Id) /= Def_Id and then not Is_Abstract_Type (Def_Id) + and then Has_Interfaces (Def_Id) then ! Insert_Actions (N, Make_Null_Procedure_Specs (Def_Id)); end if; Set_Is_Frozen (Def_Id); ! if not Is_Derived_Type (Def_Id) ! or else Is_Tagged_Type (Etype (Def_Id)) ! then ! Set_All_DT_Position (Def_Id); ! end if; -- Add the controlled component before the freezing actions -- referenced in those actions. *************** package body Exp_Ch3 is *** 5884,5890 **** -- Dispatch tables of library level tagged types are built -- later (see Analyze_Declarations). ! if not Has_Static_DT then Append_Freeze_Actions (Def_Id, Make_DT (Def_Id)); end if; end if; --- 6148,6154 ---- -- Dispatch tables of library level tagged types are built -- later (see Analyze_Declarations). ! if not Building_Static_DT (Def_Id) then Append_Freeze_Actions (Def_Id, Make_DT (Def_Id)); end if; end if; *************** package body Exp_Ch3 is *** 5905,5912 **** (Rep, Access_Disp_Table (Def_Id)); Set_Dispatch_Table_Wrappers (Rep, Dispatch_Table_Wrappers (Def_Id)); ! Set_Primitive_Operations ! (Rep, Primitive_Operations (Def_Id)); end; end if; --- 6169,6176 ---- (Rep, Access_Disp_Table (Def_Id)); Set_Dispatch_Table_Wrappers (Rep, Dispatch_Table_Wrappers (Def_Id)); ! Set_Direct_Primitive_Operations ! (Rep, Direct_Primitive_Operations (Def_Id)); end; end if; *************** package body Exp_Ch3 is *** 5918,5933 **** if not Is_Limited_Type (Def_Id) then Append_Freeze_Actions (Def_Id, Freeze_Entity ! (Find_Prim_Op (Def_Id, Name_Adjust), Sloc (Def_Id))); end if; Append_Freeze_Actions (Def_Id, Freeze_Entity ! (Find_Prim_Op (Def_Id, Name_Initialize), Sloc (Def_Id))); Append_Freeze_Actions (Def_Id, Freeze_Entity ! (Find_Prim_Op (Def_Id, Name_Finalize), Sloc (Def_Id))); end if; -- Freeze rest of primitive operations. There is no need to handle --- 6182,6197 ---- if not Is_Limited_Type (Def_Id) then Append_Freeze_Actions (Def_Id, Freeze_Entity ! (Find_Prim_Op (Def_Id, Name_Adjust), Def_Id)); end if; Append_Freeze_Actions (Def_Id, Freeze_Entity ! (Find_Prim_Op (Def_Id, Name_Initialize), Def_Id)); Append_Freeze_Actions (Def_Id, Freeze_Entity ! (Find_Prim_Op (Def_Id, Name_Finalize), Def_Id)); end if; -- Freeze rest of primitive operations. There is no need to handle *************** package body Exp_Ch3 is *** 5940,5947 **** end if; end if; ! -- In the non-tagged case, an equality function is provided only for ! -- variant records (that are not unchecked unions). elsif Has_Discriminants (Def_Id) and then not Is_Limited_Type (Def_Id) --- 6204,6213 ---- end if; end if; ! -- In the non-tagged case, ever since Ada83 an equality function must ! -- be provided for variant records that are not unchecked unions. ! -- In Ada 2012 the equality function composes, and thus must be built ! -- explicitly just as for tagged records. elsif Has_Discriminants (Def_Id) and then not Is_Limited_Type (Def_Id) *************** package body Exp_Ch3 is *** 5949,5955 **** declare Comps : constant Node_Id := Component_List (Type_Definition (Type_Decl)); - begin if Present (Comps) and then Present (Variant_Part (Comps)) --- 6215,6220 ---- *************** package body Exp_Ch3 is *** 5957,5962 **** --- 6222,6241 ---- Build_Variant_Record_Equality (Def_Id); end if; end; + + -- Otherwise create primitive equality operation (AI05-0123) + + -- This is done unconditionally to ensure that tools can be linked + -- properly with user programs compiled with older language versions. + -- It might be worth including a switch to revert to a non-composable + -- equality for untagged records, even though no program depending on + -- non-composability has surfaced ??? + + elsif Comes_From_Source (Def_Id) + and then Convention (Def_Id) = Convention_Ada + and then not Is_Limited_Type (Def_Id) + then + Build_Untagged_Equality (Def_Id); end if; -- Before building the record initialization procedure, if we are *************** package body Exp_Ch3 is *** 5969,5976 **** and then Has_Discriminants (Def_Id) then declare ! Ctyp : constant Entity_Id := ! Corresponding_Concurrent_Type (Def_Id); Conc_Discr : Entity_Id; Rec_Discr : Entity_Id; Temp : Entity_Id; --- 6248,6255 ---- and then Has_Discriminants (Def_Id) then declare ! Ctyp : constant Entity_Id := ! Corresponding_Concurrent_Type (Def_Id); Conc_Discr : Entity_Id; Rec_Discr : Entity_Id; Temp : Entity_Id; *************** package body Exp_Ch3 is *** 5978,5984 **** begin Conc_Discr := First_Discriminant (Ctyp); Rec_Discr := First_Discriminant (Def_Id); - while Present (Conc_Discr) loop Temp := Discriminal (Conc_Discr); Set_Discriminal (Conc_Discr, Discriminal (Rec_Discr)); --- 6257,6262 ---- *************** package body Exp_Ch3 is *** 6012,6022 **** end if; -- For tagged type that are not interfaces, build bodies of primitive ! -- operations. Note that we do this after building the record ! -- initialization procedure, since the primitive operations may need ! -- the initialization routine. There is no need to add predefined ! -- primitives of interfaces because all their predefined primitives ! -- are abstract. if Is_Tagged_Type (Def_Id) and then not Is_Interface (Def_Id) --- 6290,6299 ---- end if; -- For tagged type that are not interfaces, build bodies of primitive ! -- operations. Note: do this after building the record initialization ! -- procedure, since the primitive operations may need the initialization ! -- routine. There is no need to add predefined primitives of interfaces ! -- because all their predefined primitives are abstract. if Is_Tagged_Type (Def_Id) and then not Is_Interface (Def_Id) *************** package body Exp_Ch3 is *** 6029,6034 **** --- 6306,6319 ---- then null; + -- Do not add the body of predefined primitives in case of + -- CIL and Java tagged types. + + elsif Convention (Def_Id) = Convention_CIL + or else Convention (Def_Id) = Convention_Java + then + null; + -- Do not add the body of the predefined primitives if we are -- compiling under restriction No_Dispatching_Calls or if we are -- compiling a CPP tagged type. *************** package body Exp_Ch3 is *** 6101,6108 **** N_Subprogram_Declaration and then not Is_Frozen (Stream_Op) then ! Append_Freeze_Actions ! (Typ, Freeze_Entity (Stream_Op, Sloc (N))); end if; end loop; end Freeze_Stream_Operations; --- 6386,6392 ---- N_Subprogram_Declaration and then not Is_Frozen (Stream_Op) then ! Append_Freeze_Actions (Typ, Freeze_Entity (Stream_Op, N)); end if; end loop; end Freeze_Stream_Operations; *************** package body Exp_Ch3 is *** 6247,6255 **** -- See GNAT Pool packages in the Run-Time for more details ! elsif Ekind (Def_Id) = E_Access_Type ! or else Ekind (Def_Id) = E_General_Access_Type ! then declare Loc : constant Source_Ptr := Sloc (N); Desig_Type : constant Entity_Id := Designated_Type (Def_Id); --- 6531,6537 ---- -- See GNAT Pool packages in the Run-Time for more details ! elsif Ekind_In (Def_Id, E_Access_Type, E_General_Access_Type) then declare Loc : constant Source_Ptr := Sloc (N); Desig_Type : constant Entity_Id := Designated_Type (Def_Id); *************** package body Exp_Ch3 is *** 6976,6986 **** is Loc : constant Source_Ptr := Sloc (Target); - procedure Inherit_CPP_Tag - (Typ : Entity_Id; - Iface : Entity_Id; - Tag_Comp : Entity_Id; - Iface_Tag : Node_Id); -- Inherit the C++ tag of the secondary dispatch table of Typ associated -- with Iface. Tag_Comp is the component of Typ that stores Iface_Tag. --- 7258,7263 ---- *************** package body Exp_Ch3 is *** 6995,7026 **** -- of Typ CPP tagged type we generate code to inherit the contents of -- the dispatch table directly from the ancestor. - --------------------- - -- Inherit_CPP_Tag -- - --------------------- - - procedure Inherit_CPP_Tag - (Typ : Entity_Id; - Iface : Entity_Id; - Tag_Comp : Entity_Id; - Iface_Tag : Node_Id) - is - begin - pragma Assert (Is_CPP_Class (Etype (Typ))); - - Append_To (Stmts_List, - Build_Inherit_Prims (Loc, - Typ => Iface, - Old_Tag_Node => - Make_Selected_Component (Loc, - Prefix => New_Copy_Tree (Target), - Selector_Name => New_Reference_To (Tag_Comp, Loc)), - New_Tag_Node => - New_Reference_To (Iface_Tag, Loc), - Num_Prims => - UI_To_Int (DT_Entry_Count (First_Tag_Component (Iface))))); - end Inherit_CPP_Tag; - -------------------- -- Initialize_Tag -- -------------------- --- 7272,7277 ---- *************** package body Exp_Ch3 is *** 7221,7246 **** while Present (Iface_Elmt) loop Tag_Comp := Node (Iface_Comp_Elmt); -- If we are compiling under the CPP full ABI compatibility mode and -- the ancestor is a CPP_Pragma tagged type then we generate code to ! -- inherit the contents of the dispatch table directly from the ! -- ancestor. ! if Is_CPP_Class (Etype (Full_Typ)) then ! Inherit_CPP_Tag (Full_Typ, ! Iface => Node (Iface_Elmt), ! Tag_Comp => Tag_Comp, ! Iface_Tag => Node (Iface_Tag_Elmt)); ! -- Otherwise generate code to initialize the tag ! else ! -- Check if the parent of the record type has variable size ! -- components. ! In_Variable_Pos := Scope (Tag_Comp) /= Etype (Scope (Tag_Comp)) ! and then Is_Variable_Size_Record (Etype (Scope (Tag_Comp))); if (In_Variable_Pos and then Variable_Comps) or else (not In_Variable_Pos and then Fixed_Comps) then --- 7472,7556 ---- while Present (Iface_Elmt) loop Tag_Comp := Node (Iface_Comp_Elmt); + -- Check if parent of record type has variable size components + + In_Variable_Pos := Scope (Tag_Comp) /= Etype (Scope (Tag_Comp)) + and then Is_Variable_Size_Record (Etype (Scope (Tag_Comp))); + -- If we are compiling under the CPP full ABI compatibility mode and -- the ancestor is a CPP_Pragma tagged type then we generate code to ! -- initialize the secondary tag components from tags that reference ! -- secondary tables filled with copy of parent slots. ! if Is_CPP_Class (Root_Type (Full_Typ)) then ! -- Reject interface components located at variable offset in ! -- C++ derivations. This is currently unsupported. ! if not Fixed_Comps and then In_Variable_Pos then ! -- Locate the first dynamic component of the record. Done to ! -- improve the text of the warning. + declare + Comp : Entity_Id; + Comp_Typ : Entity_Id; + + begin + Comp := First_Entity (Typ); + while Present (Comp) loop + Comp_Typ := Etype (Comp); + + if Ekind (Comp) /= E_Discriminant + and then not Is_Tag (Comp) + then + exit when + (Is_Record_Type (Comp_Typ) + and then Is_Variable_Size_Record + (Base_Type (Comp_Typ))) + or else + (Is_Array_Type (Comp_Typ) + and then Is_Variable_Size_Array (Comp_Typ)); + end if; + + Next_Entity (Comp); + end loop; + + pragma Assert (Present (Comp)); + Error_Msg_Node_2 := Comp; + Error_Msg_NE + ("parent type & with dynamic component & cannot be parent" + & " of 'C'P'P derivation if new interfaces are present", + Typ, Scope (Original_Record_Component (Comp))); + + Error_Msg_Sloc := + Sloc (Scope (Original_Record_Component (Comp))); + Error_Msg_NE + ("type derived from 'C'P'P type & defined #", + Typ, Scope (Original_Record_Component (Comp))); + + -- Avoid duplicated warnings + + exit; + end; + + -- Initialize secondary tags + + else + Append_To (Stmts_List, + Make_Assignment_Statement (Loc, + Name => + Make_Selected_Component (Loc, + Prefix => New_Copy_Tree (Target), + Selector_Name => + New_Reference_To (Node (Iface_Comp_Elmt), Loc)), + Expression => + New_Reference_To (Node (Iface_Tag_Elmt), Loc))); + end if; + + -- Otherwise generate code to initialize the tag + + else if (In_Variable_Pos and then Variable_Comps) or else (not In_Variable_Pos and then Fixed_Comps) then *************** package body Exp_Ch3 is *** 7257,7270 **** end loop; end Init_Secondary_Tags; ! ----------------------------- ! -- Is_Variable_Size_Record -- ! ----------------------------- ! function Is_Variable_Size_Record (E : Entity_Id) return Boolean is ! Comp : Entity_Id; ! 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 --- 7567,7577 ---- end loop; end Init_Secondary_Tags; ! ---------------------------- ! -- Is_Variable_Size_Array -- ! ---------------------------- ! function Is_Variable_Size_Array (E : Entity_Id) return Boolean is function Is_Constant_Bound (Exp : Node_Id) return Boolean; -- To simplify handling of array components. Determines whether the *************** package body Exp_Ch3 is *** 7290,7331 **** end if; end Is_Constant_Bound; ! -- Start of processing for Is_Variable_Sized_Record ! begin ! pragma Assert (Is_Record_Type (E)); ! Comp := First_Entity (E); ! while Present (Comp) loop ! Comp_Typ := Etype (Comp); ! if Is_Record_Type (Comp_Typ) then ! -- Recursive call if the record type has discriminants ! if Has_Discriminants (Comp_Typ) ! and then Is_Variable_Size_Record (Comp_Typ) then return True; end if; ! elsif Is_Array_Type (Comp_Typ) then ! -- Check if some index is initialized with a non-constant value ! Idx := First_Index (Comp_Typ); ! while Present (Idx) loop ! if Nkind (Idx) = N_Range then ! if not Is_Constant_Bound (Low_Bound (Idx)) ! or else ! not Is_Constant_Bound (High_Bound (Idx)) ! then ! return True; ! end if; ! end if; ! Idx := Next_Index (Idx); ! end loop; end if; Next_Entity (Comp); --- 7597,7656 ---- end if; end Is_Constant_Bound; ! -- Local variables ! Idx : Node_Id; ! -- Start of processing for Is_Variable_Sized_Array ! begin ! pragma Assert (Is_Array_Type (E)); ! -- Check if some index is initialized with a non-constant value ! Idx := First_Index (E); ! while Present (Idx) loop ! if Nkind (Idx) = N_Range then ! if not Is_Constant_Bound (Low_Bound (Idx)) ! or else not Is_Constant_Bound (High_Bound (Idx)) then return True; end if; + end if; ! Idx := Next_Index (Idx); ! end loop; ! return False; ! end Is_Variable_Size_Array; ! ----------------------------- ! -- Is_Variable_Size_Record -- ! ----------------------------- ! function Is_Variable_Size_Record (E : Entity_Id) return Boolean is ! Comp : Entity_Id; ! Comp_Typ : Entity_Id; ! ! begin ! pragma Assert (Is_Record_Type (E)); ! ! Comp := First_Entity (E); ! while Present (Comp) loop ! Comp_Typ := Etype (Comp); ! ! -- Recursive call if the record type has discriminants ! ! if Is_Record_Type (Comp_Typ) ! and then Has_Discriminants (Comp_Typ) ! and then Is_Variable_Size_Record (Comp_Typ) ! then ! return True; ! ! elsif Is_Array_Type (Comp_Typ) ! and then Is_Variable_Size_Array (Comp_Typ) ! then ! return True; end if; Next_Entity (Comp); *************** package body Exp_Ch3 is *** 7512,7517 **** --- 7837,7915 ---- end loop; end Make_Controlling_Function_Wrappers; + ------------------- + -- Make_Eq_Body -- + ------------------- + + function Make_Eq_Body + (Typ : Entity_Id; + Eq_Name : Name_Id) return Node_Id + is + Loc : constant Source_Ptr := Sloc (Parent (Typ)); + Decl : Node_Id; + Def : constant Node_Id := Parent (Typ); + Stmts : constant List_Id := New_List; + Variant_Case : Boolean := Has_Discriminants (Typ); + Comps : Node_Id := Empty; + Typ_Def : Node_Id := Type_Definition (Def); + + begin + Decl := + Predef_Spec_Or_Body (Loc, + Tag_Typ => Typ, + Name => Eq_Name, + Profile => New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_X), + Parameter_Type => New_Reference_To (Typ, Loc)), + + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_Y), + Parameter_Type => New_Reference_To (Typ, Loc))), + + Ret_Type => Standard_Boolean, + For_Body => True); + + if Variant_Case then + if Nkind (Typ_Def) = N_Derived_Type_Definition then + Typ_Def := Record_Extension_Part (Typ_Def); + end if; + + if Present (Typ_Def) then + Comps := Component_List (Typ_Def); + end if; + + Variant_Case := + Present (Comps) and then Present (Variant_Part (Comps)); + end if; + + if Variant_Case then + Append_To (Stmts, + Make_Eq_If (Typ, Discriminant_Specifications (Def))); + Append_List_To (Stmts, Make_Eq_Case (Typ, Comps)); + Append_To (Stmts, + Make_Simple_Return_Statement (Loc, + Expression => New_Reference_To (Standard_True, Loc))); + + else + Append_To (Stmts, + Make_Simple_Return_Statement (Loc, + Expression => + Expand_Record_Equality + (Typ, + Typ => Typ, + Lhs => Make_Identifier (Loc, Name_X), + Rhs => Make_Identifier (Loc, Name_Y), + Bodies => Declarations (Decl)))); + end if; + + Set_Handled_Statement_Sequence + (Decl, Make_Handled_Sequence_Of_Statements (Loc, Stmts)); + return Decl; + end Make_Eq_Body; + ------------------ -- Make_Eq_Case -- ------------------ *************** package body Exp_Ch3 is *** 7571,7577 **** Make_Case_Statement (Loc, Expression => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_X), Selector_Name => New_Copy (Name (Variant_Part (CL)))), Alternatives => Alt_List)); end if; --- 7969,7975 ---- Make_Case_Statement (Loc, Expression => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_X), Selector_Name => New_Copy (Name (Variant_Part (CL)))), Alternatives => Alt_List)); end if; *************** package body Exp_Ch3 is *** 7633,7646 **** Left_Opnd => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_X), ! Selector_Name => ! Make_Identifier (Loc, Field_Name)), Right_Opnd => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_Y), ! Selector_Name => ! Make_Identifier (Loc, Field_Name)))); end if; Next_Non_Pragma (C); --- 8031,8042 ---- Left_Opnd => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_X), ! Selector_Name => Make_Identifier (Loc, Field_Name)), Right_Opnd => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_Y), ! Selector_Name => Make_Identifier (Loc, Field_Name)))); end if; Next_Non_Pragma (C); *************** package body Exp_Ch3 is *** 7664,7703 **** -- Make_Null_Procedure_Specs -- ------------------------------- ! procedure Make_Null_Procedure_Specs ! (Tag_Typ : Entity_Id; ! Decl_List : out List_Id) ! is ! Loc : constant Source_Ptr := Sloc (Tag_Typ); ! Formal : Entity_Id; Formal_List : List_Id; New_Param_Spec : Node_Id; Parent_Subp : Entity_Id; Prim_Elmt : Elmt_Id; - Proc_Decl : Node_Id; Subp : Entity_Id; - function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean; - -- Returns True if E is a null procedure that is an interface primitive - - --------------------------------- - -- Is_Null_Interface_Primitive -- - --------------------------------- - - function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean is - begin - return Comes_From_Source (E) - and then Is_Dispatching_Operation (E) - and then Ekind (E) = E_Procedure - and then Null_Present (Parent (E)) - and then Is_Interface (Find_Dispatching_Type (E)); - end Is_Null_Interface_Primitive; - - -- Start of processing for Make_Null_Procedure_Specs - begin - Decl_List := New_List; Prim_Elmt := First_Elmt (Primitive_Operations (Tag_Typ)); while Present (Prim_Elmt) loop Subp := Node (Prim_Elmt); --- 8060,8076 ---- -- Make_Null_Procedure_Specs -- ------------------------------- ! function Make_Null_Procedure_Specs (Tag_Typ : Entity_Id) return List_Id is ! Decl_List : constant List_Id := New_List; ! Loc : constant Source_Ptr := Sloc (Tag_Typ); Formal : Entity_Id; Formal_List : List_Id; New_Param_Spec : Node_Id; Parent_Subp : Entity_Id; Prim_Elmt : Elmt_Id; Subp : Entity_Id; begin Prim_Elmt := First_Elmt (Primitive_Operations (Tag_Typ)); while Present (Prim_Elmt) loop Subp := Node (Prim_Elmt); *************** package body Exp_Ch3 is *** 7757,7775 **** end loop; end if; ! Proc_Decl := Make_Subprogram_Declaration (Loc, Make_Procedure_Specification (Loc, Defining_Unit_Name => Make_Defining_Identifier (Loc, Chars (Subp)), Parameter_Specifications => Formal_List, ! Null_Present => True)); ! Append_To (Decl_List, Proc_Decl); ! Analyze (Proc_Decl); end if; Next_Elmt (Prim_Elmt); end loop; end Make_Null_Procedure_Specs; ------------------------------------- --- 8130,8148 ---- end loop; end if; ! Append_To (Decl_List, Make_Subprogram_Declaration (Loc, Make_Procedure_Specification (Loc, Defining_Unit_Name => Make_Defining_Identifier (Loc, Chars (Subp)), Parameter_Specifications => Formal_List, ! Null_Present => True))); end if; Next_Elmt (Prim_Elmt); end loop; + + return Decl_List; end Make_Null_Procedure_Specs; ------------------------------------- *************** package body Exp_Ch3 is *** 7865,7876 **** -- If a primitive is encountered that renames the predefined -- equality operator before reaching any explicit equality ! -- primitive, then we still need to create a predefined ! -- equality function, because calls to it can occur via ! -- the renaming. A new name is created for the equality ! -- to avoid conflicting with any user-defined equality. ! -- (Note that this doesn't account for renamings of ! -- equality nested within subpackages???) if Is_Predefined_Eq_Renaming (Node (Prim)) then Eq_Name := New_External_Name (Chars (Node (Prim)), 'E'); --- 8238,8248 ---- -- If a primitive is encountered that renames the predefined -- equality operator before reaching any explicit equality ! -- primitive, then we still need to create a predefined equality ! -- function, because calls to it can occur via the renaming. A new ! -- name is created for the equality to avoid conflicting with any ! -- user-defined equality. (Note that this doesn't account for ! -- renamings of equality nested within subpackages???) if Is_Predefined_Eq_Renaming (Node (Prim)) then Eq_Name := New_External_Name (Chars (Node (Prim)), 'E'); *************** package body Exp_Ch3 is *** 8009,8015 **** -- disable their generation in this case. Disable the generation of -- these bodies if No_Dispatching_Calls, Ravenscar or ZFP is active. ! if Ada_Version >= Ada_05 and then Tagged_Type_Expansion and then not Restriction_Active (No_Dispatching_Calls) and then not Restriction_Active (No_Select_Statements) --- 8381,8387 ---- -- disable their generation in this case. Disable the generation of -- these bodies if No_Dispatching_Calls, Ravenscar or ZFP is active. ! if Ada_Version >= Ada_2005 and then Tagged_Type_Expansion and then not Restriction_Active (No_Dispatching_Calls) and then not Restriction_Active (No_Select_Statements) *************** package body Exp_Ch3 is *** 8145,8151 **** -- Needs_Simple_Initialization -- --------------------------------- ! function Needs_Simple_Initialization (T : Entity_Id) return Boolean is begin -- Check for private type, in which case test applies to the underlying -- type of the private type. --- 8517,8530 ---- -- Needs_Simple_Initialization -- --------------------------------- ! function Needs_Simple_Initialization ! (T : Entity_Id; ! Consider_IS : Boolean := True) return Boolean ! is ! Consider_IS_NS : constant Boolean := ! Normalize_Scalars ! or (Initialize_Scalars and Consider_IS); ! begin -- Check for private type, in which case test applies to the underlying -- type of the private type. *************** package body Exp_Ch3 is *** 8167,8173 **** -- types. elsif Is_Access_Type (T) ! or else (Init_Or_Norm_Scalars and then (Is_Scalar_Type (T))) then return True; --- 8546,8552 ---- -- types. elsif Is_Access_Type (T) ! or else (Consider_IS_NS and then (Is_Scalar_Type (T))) then return True; *************** package body Exp_Ch3 is *** 8176,8182 **** -- expanding an aggregate (since in the latter case they will be -- filled with appropriate initializing values before they are used). ! elsif Init_Or_Norm_Scalars and then (Root_Type (T) = Standard_String or else Root_Type (T) = Standard_Wide_String --- 8555,8561 ---- -- expanding an aggregate (since in the latter case they will be -- filled with appropriate initializing values before they are used). ! elsif Consider_IS_NS and then (Root_Type (T) = Standard_String or else Root_Type (T) = Standard_Wide_String *************** package body Exp_Ch3 is *** 8427,8433 **** Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_X), Attribute_Name => Name_Alignment))))); Append_To (Res, Decl); --- 8806,8812 ---- Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_X), Attribute_Name => Name_Alignment))))); Append_To (Res, Decl); *************** package body Exp_Ch3 is *** 8450,8456 **** Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_X), Attribute_Name => Name_Size))))); Append_To (Res, Decl); --- 8829,8835 ---- Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_X), Attribute_Name => Name_Size))))); Append_To (Res, Decl); *************** package body Exp_Ch3 is *** 8509,8515 **** -- disable their generation in this case. Disable the generation of -- these bodies if No_Dispatching_Calls, Ravenscar or ZFP is active. ! if Ada_Version >= Ada_05 and then Tagged_Type_Expansion and then not Is_Interface (Tag_Typ) and then --- 8888,8894 ---- -- disable their generation in this case. Disable the generation of -- these bodies if No_Dispatching_Calls, Ravenscar or ZFP is active. ! if Ada_Version >= Ada_2005 and then Tagged_Type_Expansion and then not Is_Interface (Tag_Typ) and then *************** package body Exp_Ch3 is *** 8535,8601 **** -- Body for equality if Eq_Needed then ! Decl := ! Predef_Spec_Or_Body (Loc, ! Tag_Typ => Tag_Typ, ! Name => Eq_Name, ! Profile => New_List ( ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, Name_X), ! Parameter_Type => New_Reference_To (Tag_Typ, Loc)), ! ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, Name_Y), ! Parameter_Type => New_Reference_To (Tag_Typ, Loc))), ! ! Ret_Type => Standard_Boolean, ! For_Body => True); ! ! declare ! Def : constant Node_Id := Parent (Tag_Typ); ! Stmts : constant List_Id := New_List; ! Variant_Case : Boolean := Has_Discriminants (Tag_Typ); ! Comps : Node_Id := Empty; ! Typ_Def : Node_Id := Type_Definition (Def); ! ! begin ! if Variant_Case then ! if Nkind (Typ_Def) = N_Derived_Type_Definition then ! Typ_Def := Record_Extension_Part (Typ_Def); ! end if; ! ! if Present (Typ_Def) then ! Comps := Component_List (Typ_Def); ! end if; ! ! Variant_Case := Present (Comps) ! and then Present (Variant_Part (Comps)); ! end if; ! ! if Variant_Case then ! Append_To (Stmts, ! Make_Eq_If (Tag_Typ, Discriminant_Specifications (Def))); ! Append_List_To (Stmts, Make_Eq_Case (Tag_Typ, Comps)); ! Append_To (Stmts, ! Make_Simple_Return_Statement (Loc, ! Expression => New_Reference_To (Standard_True, Loc))); ! ! else ! Append_To (Stmts, ! Make_Simple_Return_Statement (Loc, ! Expression => ! Expand_Record_Equality (Tag_Typ, ! Typ => Tag_Typ, ! Lhs => Make_Identifier (Loc, Name_X), ! Rhs => Make_Identifier (Loc, Name_Y), ! Bodies => Declarations (Decl)))); ! end if; ! ! Set_Handled_Statement_Sequence (Decl, ! Make_Handled_Sequence_Of_Statements (Loc, Stmts)); ! end; Append_To (Res, Decl); end if; --- 8914,8920 ---- -- Body for equality if Eq_Needed then ! Decl := Make_Eq_Body (Tag_Typ, Eq_Name); Append_To (Res, Decl); end if; *************** package body Exp_Ch3 is *** 8701,8707 **** function Predefined_Primitive_Freeze (Tag_Typ : Entity_Id) return List_Id is - Loc : constant Source_Ptr := Sloc (Tag_Typ); Res : constant List_Id := New_List; Prim : Elmt_Id; Frnodes : List_Id; --- 9020,9025 ---- *************** package body Exp_Ch3 is *** 8710,8716 **** Prim := First_Elmt (Primitive_Operations (Tag_Typ)); while Present (Prim) loop if Is_Predefined_Dispatching_Operation (Node (Prim)) then ! Frnodes := Freeze_Entity (Node (Prim), Loc); if Present (Frnodes) then Append_List_To (Res, Frnodes); --- 9028,9034 ---- Prim := First_Elmt (Primitive_Operations (Tag_Typ)); while Present (Prim) loop if Is_Predefined_Dispatching_Operation (Node (Prim)) then ! Frnodes := Freeze_Entity (Node (Prim), Tag_Typ); if Present (Frnodes) then Append_List_To (Res, Frnodes); *************** package body Exp_Ch3 is *** 8756,8769 **** Has_Predefined_Or_Specified_Stream_Attribute := Has_Specified_Stream_Input (Typ) or else ! (Ada_Version >= Ada_05 and then Stream_Operation_OK (Typ, TSS_Stream_Read)); elsif Operation = TSS_Stream_Output then Has_Predefined_Or_Specified_Stream_Attribute := Has_Specified_Stream_Output (Typ) or else ! (Ada_Version >= Ada_05 and then Stream_Operation_OK (Typ, TSS_Stream_Write)); end if; --- 9074,9087 ---- Has_Predefined_Or_Specified_Stream_Attribute := Has_Specified_Stream_Input (Typ) or else ! (Ada_Version >= Ada_2005 and then Stream_Operation_OK (Typ, TSS_Stream_Read)); elsif Operation = TSS_Stream_Output then Has_Predefined_Or_Specified_Stream_Attribute := Has_Specified_Stream_Output (Typ) or else ! (Ada_Version >= Ada_2005 and then Stream_Operation_OK (Typ, TSS_Stream_Write)); end if; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch3.ads gcc-4.6.0/gcc/ada/exp_ch3.ads *** gcc-4.5.2/gcc/ada/exp_ch3.ads Wed Apr 29 13:29:08 2009 --- gcc-4.6.0/gcc/ada/exp_ch3.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Ch3 is *** 77,83 **** -- enable the use of discriminals. Enclos_Type is the enclosing type when -- initializing a component in an outer init proc, and it is used for -- various expansion cases including the case where Typ is a task type ! -- which is an array component, the indices of the enclosing type are -- used to build the string that identifies each task at runtime. -- -- Discr_Map is used to replace discriminants by their discriminals in --- 77,83 ---- -- enable the use of discriminals. Enclos_Type is the enclosing type when -- initializing a component in an outer init proc, and it is used for -- various expansion cases including the case where Typ is a task type ! -- which is an array component, the indexes of the enclosing type are -- used to build the string that identifies each task at runtime. -- -- Discr_Map is used to replace discriminants by their discriminals in *************** package Exp_Ch3 is *** 126,139 **** -- then tags components located at variable positions of Target are -- initialized. ! function Needs_Simple_Initialization (T : Entity_Id) return Boolean; -- Certain types need initialization even though there is no specific -- initialization routine. In this category are access types (which need -- initializing to null), packed array types whose implementation is a -- modular type, and all scalar types if Normalize_Scalars is set, as well -- as private types whose underlying type is present and meets any of these -- criteria. Finally, descendants of String and Wide_String also need ! -- initialization in Initialize/Normalize_Scalars mode. function Get_Simple_Init_Val (T : Entity_Id; --- 126,143 ---- -- then tags components located at variable positions of Target are -- initialized. ! function Needs_Simple_Initialization ! (T : Entity_Id; ! Consider_IS : Boolean := True) return Boolean; -- Certain types need initialization even though there is no specific -- initialization routine. In this category are access types (which need -- initializing to null), packed array types whose implementation is a -- modular type, and all scalar types if Normalize_Scalars is set, as well -- as private types whose underlying type is present and meets any of these -- criteria. Finally, descendants of String and Wide_String also need ! -- initialization in Initialize/Normalize_Scalars mode. Consider_IS is ! -- normally True. If it is False, the Initialize_Scalars is not considered ! -- in determining whether simple initialization is needed. function Get_Simple_Init_Val (T : Entity_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch4.adb gcc-4.6.0/gcc/ada/exp_ch4.adb *** gcc-4.5.2/gcc/ada/exp_ch4.adb Mon Jan 25 14:37:39 2010 --- gcc-4.6.0/gcc/ada/exp_ch4.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Exp_Ch7; use Exp_Ch7; *** 37,42 **** --- 37,43 ---- with Exp_Ch9; use Exp_Ch9; with Exp_Disp; use Exp_Disp; with Exp_Fixd; use Exp_Fixd; + with Exp_Intr; use Exp_Intr; with Exp_Pakd; use Exp_Pakd; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; *************** with Namet; use Namet; *** 47,52 **** --- 48,54 ---- with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; + with Par_SCO; use Par_SCO; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; *************** with Sem_Ch8; use Sem_Ch8; *** 58,70 **** with Sem_Ch13; use Sem_Ch13; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; - with Sem_SCIL; use Sem_SCIL; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Targparm; use Targparm; with Tbuild; use Tbuild; with Ttypes; use Ttypes; --- 60,72 ---- with Sem_Ch13; use Sem_Ch13; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; + with SCIL_LL; use SCIL_LL; with Targparm; use Targparm; with Tbuild; use Tbuild; with Ttypes; use Ttypes; *************** package body Exp_Ch4 is *** 127,132 **** --- 129,137 ---- -- Common expansion processing for Boolean operators (And, Or, Xor) for the -- case of array type arguments. + procedure Expand_Short_Circuit_Operator (N : Node_Id); + -- Common expansion processing for short-circuit boolean operators + function Expand_Composite_Equality (Nod : Node_Id; Typ : Entity_Id; *************** package body Exp_Ch4 is *** 251,257 **** Prefix => Name (N), Attribute_Name => Name_Address); ! Arg1 : constant Node_Id := Op1; Arg2 : Node_Id := Op2; Call_Node : Node_Id; Proc_Name : Entity_Id; --- 256,262 ---- Prefix => Name (N), Attribute_Name => Name_Address); ! Arg1 : Node_Id := Op1; Arg2 : Node_Id := Op2; Call_Node : Node_Id; Proc_Name : Entity_Id; *************** package body Exp_Ch4 is *** 317,328 **** -- X xor (not Y) = not (X xor Y) = Nxor (X, Y) if Nkind (Op1) = N_Op_Not then if Kind = N_Op_And then Proc_Name := RTE (RE_Vector_Nor); - elsif Kind = N_Op_Or then Proc_Name := RTE (RE_Vector_Nand); - else Proc_Name := RTE (RE_Vector_Xor); end if; --- 322,333 ---- -- X xor (not Y) = not (X xor Y) = Nxor (X, Y) if Nkind (Op1) = N_Op_Not then + Arg1 := Right_Opnd (Op1); + Arg2 := Right_Opnd (Op2); if Kind = N_Op_And then Proc_Name := RTE (RE_Vector_Nor); elsif Kind = N_Op_Or then Proc_Name := RTE (RE_Vector_Nand); else Proc_Name := RTE (RE_Vector_Xor); end if; *************** package body Exp_Ch4 is *** 330,343 **** else if Kind = N_Op_And then Proc_Name := RTE (RE_Vector_And); - elsif Kind = N_Op_Or then Proc_Name := RTE (RE_Vector_Or); - elsif Nkind (Op2) = N_Op_Not then Proc_Name := RTE (RE_Vector_Nxor); Arg2 := Right_Opnd (Op2); - else Proc_Name := RTE (RE_Vector_Xor); end if; --- 335,345 ---- *************** package body Exp_Ch4 is *** 348,362 **** Name => New_Occurrence_Of (Proc_Name, Loc), Parameter_Associations => New_List ( Target, ! Make_Attribute_Reference (Loc, ! Prefix => Arg1, ! Attribute_Name => Name_Address), ! Make_Attribute_Reference (Loc, ! Prefix => Arg2, ! Attribute_Name => Name_Address), ! Make_Attribute_Reference (Loc, ! Prefix => Op1, ! Attribute_Name => Name_Length))); end if; Rewrite (N, Call_Node); --- 350,364 ---- Name => New_Occurrence_Of (Proc_Name, Loc), Parameter_Associations => New_List ( Target, ! Make_Attribute_Reference (Loc, ! Prefix => Arg1, ! Attribute_Name => Name_Address), ! Make_Attribute_Reference (Loc, ! Prefix => Arg2, ! Attribute_Name => Name_Address), ! Make_Attribute_Reference (Loc, ! Prefix => Arg1, ! Attribute_Name => Name_Length))); end if; Rewrite (N, Call_Node); *************** package body Exp_Ch4 is *** 514,520 **** -- Note: we skip the accessibility check for the VM case, since -- there does not seem to be any practical way of implementing it. ! if Ada_Version >= Ada_05 and then Tagged_Type_Expansion and then Is_Class_Wide_Type (DesigT) and then not Scope_Suppress (Accessibility_Check) --- 516,522 ---- -- Note: we skip the accessibility check for the VM case, since -- there does not seem to be any practical way of implementing it. ! if Ada_Version >= Ada_2005 and then Tagged_Type_Expansion and then Is_Class_Wide_Type (DesigT) and then not Scope_Suppress (Accessibility_Check) *************** package body Exp_Ch4 is *** 591,597 **** Set_Analyzed (Node); ! Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Insert_Action (N, Make_Object_Declaration (Loc, --- 593,599 ---- Set_Analyzed (Node); ! Temp := Make_Temporary (Loc, 'P', N); Insert_Action (N, Make_Object_Declaration (Loc, *************** package body Exp_Ch4 is *** 634,640 **** -- we plan to expand the allowed forms of functions that are treated -- as build-in-place. ! if Ada_Version >= Ada_05 and then Is_Build_In_Place_Function_Call (Exp) then Make_Build_In_Place_Call_In_Allocator (N, Exp); --- 636,642 ---- -- we plan to expand the allowed forms of functions that are treated -- as build-in-place. ! if Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Exp) then Make_Build_In_Place_Call_In_Allocator (N, Exp); *************** package body Exp_Ch4 is *** 660,667 **** Remove_Side_Effects (Exp); end if; ! Temp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')); -- For a class wide allocation generate the following code: --- 662,668 ---- Remove_Side_Effects (Exp); end if; ! Temp := Make_Temporary (Loc, 'P', N); -- For a class wide allocation generate the following code: *************** package body Exp_Ch4 is *** 751,759 **** else declare ! Def_Id : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('T')); New_Decl : Node_Id; begin --- 752,758 ---- else declare ! Def_Id : constant Entity_Id := Make_Temporary (Loc, 'T'); New_Decl : Node_Id; begin *************** package body Exp_Ch4 is *** 830,837 **** New_Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Defining_Identifier (Loc, ! New_Internal_Name ('P')), Object_Definition => New_Reference_To (PtrT, Loc), Expression => Unchecked_Convert_To (PtrT, New_Reference_To (Temp, Loc))); --- 829,835 ---- New_Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'P'), Object_Definition => New_Reference_To (PtrT, Loc), Expression => Unchecked_Convert_To (PtrT, New_Reference_To (Temp, Loc))); *************** package body Exp_Ch4 is *** 912,927 **** if Is_RTE (Apool, RE_SS_Pool) then declare ! F : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('F')); begin Insert_Action (N, Make_Object_Declaration (Loc, Defining_Identifier => F, ! Object_Definition => New_Reference_To (RTE ! (RE_Finalizable_Ptr), Loc))); ! Flist := New_Reference_To (F, Loc); Attach := Make_Integer_Literal (Loc, 1); end; --- 910,922 ---- if Is_RTE (Apool, RE_SS_Pool) then declare ! F : constant Entity_Id := Make_Temporary (Loc, 'F'); begin Insert_Action (N, Make_Object_Declaration (Loc, Defining_Identifier => F, ! Object_Definition => ! New_Reference_To (RTE (RE_Finalizable_Ptr), Loc))); Flist := New_Reference_To (F, Loc); Attach := Make_Integer_Literal (Loc, 1); end; *************** package body Exp_Ch4 is *** 953,959 **** -- want to Adjust. if not Aggr_In_Place ! and then not Is_Inherently_Limited_Type (T) then Insert_Actions (N, Make_Adjust_Call ( --- 948,954 ---- -- want to Adjust. if not Aggr_In_Place ! and then not Is_Immutably_Limited_Type (T) then Insert_Actions (N, Make_Adjust_Call ( *************** package body Exp_Ch4 is *** 987,994 **** end if; elsif Aggr_In_Place then ! Temp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Tmp_Node := Make_Object_Declaration (Loc, Defining_Identifier => Temp, --- 982,988 ---- end if; elsif Aggr_In_Place then ! Temp := Make_Temporary (Loc, 'P', N); Tmp_Node := Make_Object_Declaration (Loc, Defining_Identifier => Temp, *************** package body Exp_Ch4 is *** 1072,1080 **** and then Is_Packed (T) then declare ! ConstrT : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Internal_Exp : constant Node_Id := Relocate_Node (Exp); begin Insert_Action (Exp, --- 1066,1072 ---- and then Is_Packed (T) then declare ! ConstrT : constant Entity_Id := Make_Temporary (Loc, 'A'); Internal_Exp : constant Node_Id := Relocate_Node (Exp); begin Insert_Action (Exp, *************** package body Exp_Ch4 is *** 1094,1100 **** -- we plan to expand the allowed forms of functions that are treated -- as build-in-place. ! if Ada_Version >= Ada_05 and then Is_Build_In_Place_Function_Call (Exp) then Make_Build_In_Place_Call_In_Allocator (N, Exp); --- 1086,1092 ---- -- we plan to expand the allowed forms of functions that are treated -- as build-in-place. ! if Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Exp) then Make_Build_In_Place_Call_In_Allocator (N, Exp); *************** package body Exp_Ch4 is *** 1428,1434 **** function Component_Equality (Typ : Entity_Id) return Node_Id; -- Create one statement to compare corresponding components, designated ! -- by a full set of indices. function Get_Arg_Type (N : Node_Id) return Entity_Id; -- Given one of the arguments, computes the appropriate type to be used --- 1420,1426 ---- function Component_Equality (Typ : Entity_Id) return Node_Id; -- Create one statement to compare corresponding components, designated ! -- by a full set of indexes. function Get_Arg_Type (N : Node_Id) return Entity_Id; -- Given one of the arguments, computes the appropriate type to be used *************** package body Exp_Ch4 is *** 1450,1456 **** -- end loop; -- end; -- ! -- If both indices are constrained and identical, the procedure -- returns a simpler loop: -- -- for An in A'Range (N) loop --- 1442,1448 ---- -- end loop; -- end; -- ! -- If both indexes are constrained and identical, the procedure -- returns a simpler loop: -- -- for An in A'Range (N) loop *************** package body Exp_Ch4 is *** 1512,1523 **** L := Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars (A)), Expressions => Index_List1); R := Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars (B)), Expressions => Index_List2); Test := Expand_Composite_Equality --- 1504,1515 ---- L := Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars (A)), Expressions => Index_List1); R := Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars (B)), Expressions => Index_List2); Test := Expand_Composite_Equality *************** package body Exp_Ch4 is *** 1594,1601 **** -- constrained types, then we can use the same index for both -- of the arrays. ! An : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Bn : Entity_Id; Index_T : Entity_Id; --- 1586,1592 ---- -- constrained types, then we can use the same index for both -- of the arrays. ! An : constant Entity_Id := Make_Temporary (Loc, 'A'); Bn : Entity_Id; Index_T : Entity_Id; *************** package body Exp_Ch4 is *** 1612,1620 **** Index_T := Base_Type (Etype (Index)); if Need_Separate_Indexes then ! Bn := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('B')); else Bn := An; end if; --- 1603,1609 ---- Index_T := Base_Type (Etype (Index)); if Need_Separate_Indexes then ! Bn := Make_Temporary (Loc, 'B'); else Bn := An; end if; *************** package body Exp_Ch4 is *** 1627,1633 **** if Need_Separate_Indexes then ! -- Generate guard for loop, followed by increments of indices Append_To (Stm_List, Make_Exit_Statement (Loc, --- 1616,1622 ---- if Need_Separate_Indexes then ! -- Generate guard for loop, followed by increments of indexes Append_To (Stm_List, Make_Exit_Statement (Loc, *************** package body Exp_Ch4 is *** 1801,1807 **** Defining_Identifier => B, Parameter_Type => New_Reference_To (Rtyp, Loc))); ! Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('E')); -- Build statement sequence for function --- 1790,1796 ---- Defining_Identifier => B, Parameter_Type => New_Reference_To (Rtyp, Loc))); ! Func_Name := Make_Temporary (Loc, 'E'); -- Build statement sequence for function *************** package body Exp_Ch4 is *** 2184,2206 **** Lhs_Discr_Val, Rhs_Discr_Val)); end; end if; ! -- Shouldn't this be an else, we can't fall through the above ! -- IF, right??? ! return ! Make_Function_Call (Loc, ! Name => New_Reference_To (Eq_Op, Loc), ! Parameter_Associations => New_List (Lhs, Rhs)); ! end if; else return Expand_Record_Equality (Nod, Full_Type, Lhs, Rhs, Bodies); end if; else ! -- It can be a simple record or the full view of a scalar private return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs); end if; --- 2173,2233 ---- Lhs_Discr_Val, Rhs_Discr_Val)); end; + + else + return + Make_Function_Call (Loc, + Name => New_Reference_To (Eq_Op, Loc), + Parameter_Associations => New_List (Lhs, Rhs)); end if; + end if; ! elsif Ada_Version >= Ada_2012 then ! -- if no TSS has been created for the type, check whether there is ! -- a primitive equality declared for it. If it is abstract replace ! -- the call with an explicit raise (AI05-0123). ! ! declare ! Prim : Elmt_Id; ! ! begin ! Prim := First_Elmt (Collect_Primitive_Operations (Full_Type)); ! while Present (Prim) loop ! ! -- Locate primitive equality with the right signature ! ! if Chars (Node (Prim)) = Name_Op_Eq ! and then Etype (First_Formal (Node (Prim))) = ! Etype (Next_Formal (First_Formal (Node (Prim)))) ! and then Etype (Node (Prim)) = Standard_Boolean ! then ! if Is_Abstract_Subprogram (Node (Prim)) then ! return ! Make_Raise_Program_Error (Loc, ! Reason => PE_Explicit_Raise); ! else ! return ! Make_Function_Call (Loc, ! Name => New_Reference_To (Node (Prim), Loc), ! Parameter_Associations => New_List (Lhs, Rhs)); ! end if; ! end if; ! ! Next_Elmt (Prim); ! end loop; ! end; ! ! -- Use predefined equality iff no user-defined primitive exists ! ! return Make_Op_Eq (Loc, Lhs, Rhs); else return Expand_Record_Equality (Nod, Full_Type, Lhs, Rhs, Bodies); end if; else ! -- If not array or record type, it is predefined equality. return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs); end if; *************** package body Exp_Ch4 is *** 2313,2319 **** -- in packages System.Concat_n. Known_Non_Null_Operand_Seen : Boolean; ! -- Set True during generation of the assignements of operands into -- result once an operand known to be non-null has been seen. function Make_Artyp_Literal (Val : Nat) return Node_Id; --- 2340,2346 ---- -- in packages System.Concat_n. Known_Non_Null_Operand_Seen : Boolean; ! -- Set True during generation of the assignments of operands into -- result once an operand known to be non-null has been seen. function Make_Artyp_Literal (Val : Nat) return Node_Id; *************** package body Exp_Ch4 is *** 2407,2415 **** -- We can't just use the index type, or even its base type for this -- purpose for two reasons. First it might be an enumeration type which ! -- is not suitable fo computations of any kind, and second it may simply ! -- not have enough range. For example if the index type is -128..+127 ! -- then lengths can be up to 256, which is out of range of the type. -- For enumeration types, we can simply use Standard_Integer, this is -- sufficient since the actual number of enumeration literals cannot --- 2434,2443 ---- -- We can't just use the index type, or even its base type for this -- purpose for two reasons. First it might be an enumeration type which ! -- is not suitable for computations of any kind, and second it may ! -- simply not have enough range. For example if the index type is ! -- -128..+127 then lengths can be up to 256, which is out of range of ! -- the type. -- For enumeration types, we can simply use Standard_Integer, this is -- sufficient since the actual number of enumeration literals cannot *************** package body Exp_Ch4 is *** 2466,2474 **** Opnd_Typ := Etype (Opnd); -- The parent got messed up when we put the operands in a list, ! -- so now put back the proper parent for the saved operand. ! Set_Parent (Opnd, Parent (Cnode)); -- Set will be True when we have setup one entry in the array --- 2494,2504 ---- Opnd_Typ := Etype (Opnd); -- The parent got messed up when we put the operands in a list, ! -- so now put back the proper parent for the saved operand, that ! -- is to say the concatenation node, to make sure that each operand ! -- is seen as a subexpression, e.g. if actions must be inserted. ! Set_Parent (Opnd, Cnode); -- Set will be True when we have setup one entry in the array *************** package body Exp_Ch4 is *** 2621,2629 **** Operands (NN) := Opnd; Is_Fixed_Length (NN) := False; ! Var_Length (NN) := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); Append_To (Actions, Make_Object_Declaration (Loc, --- 2651,2657 ---- Operands (NN) := Opnd; Is_Fixed_Length (NN) := False; ! Var_Length (NN) := Make_Temporary (Loc, 'L'); Append_To (Actions, Make_Object_Declaration (Loc, *************** package body Exp_Ch4 is *** 2670,2678 **** -- create an entity initialized to this length. else ! Ent := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); if Is_Fixed_Length (NN) then Clen := Make_Integer_Literal (Loc, Fixed_Length (NN)); --- 2698,2704 ---- -- create an entity initialized to this length. else ! Ent := Make_Temporary (Loc, 'L'); if Is_Fixed_Length (NN) then Clen := Make_Integer_Literal (Loc, Fixed_Length (NN)); *************** package body Exp_Ch4 is *** 2790,2797 **** end Get_Known_Bound; begin ! Ent := ! Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('L')); Append_To (Actions, Make_Object_Declaration (Loc, --- 2816,2822 ---- end Get_Known_Bound; begin ! Ent := Make_Temporary (Loc, 'L'); Append_To (Actions, Make_Object_Declaration (Loc, *************** package body Exp_Ch4 is *** 2845,2855 **** Insert_Actions (Cnode, Actions, Suppress => All_Checks); ! -- Now we construct an array object with appropriate bounds ! Ent := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); -- If the bound is statically known to be out of range, we do not want -- to abort, we want a warning and a runtime constraint error. Note that --- 2870,2881 ---- Insert_Actions (Cnode, Actions, Suppress => All_Checks); ! -- Now we construct an array object with appropriate bounds. We mark ! -- the target as internal to prevent useless initialization when ! -- Initialize_Scalars is enabled. ! Ent := Make_Temporary (Loc, 'S'); ! Set_Is_Internal (Ent); -- If the bound is statically known to be out of range, we do not want -- to abort, we want a warning and a runtime constraint error. Note that *************** package body Exp_Ch4 is *** 3173,3181 **** declare Decl : Node_Id; Outer_S : Entity_Id; ! S : Entity_Id := Current_Scope; begin while Present (S) and then S /= Standard_Standard loop if Ekind (S) = E_Function then Outer_S := Scope (S); --- 3199,3208 ---- declare Decl : Node_Id; Outer_S : Entity_Id; ! S : Entity_Id; begin + S := Current_Scope; while Present (S) and then S /= Standard_Standard loop if Ekind (S) = E_Function then Outer_S := Scope (S); *************** package body Exp_Ch4 is *** 3211,3220 **** Flist := Make_Selected_Component (Loc, ! Prefix => New_Reference_To (Associated_Final_Chain (PtrT), Loc), ! Selector_Name => ! Make_Identifier (Loc, Name_F)); Coext_Elmt := First_Elmt (Coextensions (N)); while Present (Coext_Elmt) loop --- 3238,3246 ---- Flist := Make_Selected_Component (Loc, ! Prefix => New_Reference_To (Associated_Final_Chain (PtrT), Loc), ! Selector_Name => Make_Identifier (Loc, Name_F)); Coext_Elmt := First_Elmt (Coextensions (N)); while Present (Coext_Elmt) loop *************** package body Exp_Ch4 is *** 3273,3281 **** ------------------------- procedure Rewrite_Coextension (N : Node_Id) is ! Temp : constant Node_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('C')); -- Generate: -- Cnn : aliased Etyp; --- 3299,3305 ---- ------------------------- procedure Rewrite_Coextension (N : Node_Id) is ! Temp : constant Node_Id := Make_Temporary (Loc, 'C'); -- Generate: -- Cnn : aliased Etyp; *************** package body Exp_Ch4 is *** 3330,3336 **** -- number-of-elements * component_type'Max_Size_In_Storage_Elements ! -- which avoids this problem. All this is a big bogus, but it does -- mean we catch common cases of trying to allocate arrays that -- are too large, and which in the absence of a check results in -- undetected chaos ??? --- 3354,3360 ---- -- number-of-elements * component_type'Max_Size_In_Storage_Elements ! -- which avoids this problem. All this is a bit bogus, but it does -- mean we catch common cases of trying to allocate arrays that -- are too large, and which in the absence of a check results in -- undetected chaos ??? *************** package body Exp_Ch4 is *** 3428,3436 **** -- and replace the allocator by Tnn'Unrestricted_Access. Tnn is -- marked as requiring static allocation. ! Temp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('T')); ! Desig := Subtype_Mark (Expression (N)); -- If context is constrained, use constrained subtype directly, --- 3452,3458 ---- -- and replace the allocator by Tnn'Unrestricted_Access. Tnn is -- marked as requiring static allocation. ! Temp := Make_Temporary (Loc, 'T', Expression (Expression (N))); Desig := Subtype_Mark (Expression (N)); -- If context is constrained, use constrained subtype directly, *************** package body Exp_Ch4 is *** 3465,3471 **** -- Same if the allocator is an access discriminant for a local object: -- instead of an allocator we create a local value and constrain the ! -- the enclosing object with the corresponding access attribute. if Is_Static_Coextension (N) then Rewrite_Coextension (N); --- 3487,3493 ---- -- Same if the allocator is an access discriminant for a local object: -- instead of an allocator we create a local value and constrain the ! -- enclosing object with the corresponding access attribute. if Is_Static_Coextension (N) then Rewrite_Coextension (N); *************** package body Exp_Ch4 is *** 3496,3502 **** -- raise Storage_Error; -- end if; ! -- where 3.5 gigabytes is a constant large enough to accomodate any -- reasonable request for. But we can't do it this way because at -- least at the moment we don't compute this attribute right, and -- can silently give wrong results when the result gets large. Since --- 3518,3524 ---- -- raise Storage_Error; -- end if; ! -- where 3.5 gigabytes is a constant large enough to accommodate any -- reasonable request for. But we can't do it this way because at -- least at the moment we don't compute this attribute right, and -- can silently give wrong results when the result gets large. Since *************** package body Exp_Ch4 is *** 3593,3599 **** if not Restriction_Active (No_Default_Initialization) then Init := Base_Init_Proc (T); Nod := N; ! Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); -- Construct argument list for the initialization routine call --- 3615,3621 ---- if not Restriction_Active (No_Default_Initialization) then Init := Base_Init_Proc (T); Nod := N; ! Temp := Make_Temporary (Loc, 'P'); -- Construct argument list for the initialization routine call *************** package body Exp_Ch4 is *** 3653,3673 **** if Has_Task (T) then if No (Master_Id (Base_Type (PtrT))) then - -- If we have a non-library level task with restriction - -- No_Task_Hierarchy set, then no point in expanding. - - if not Is_Library_Level_Entity (T) - and then Restriction_Active (No_Task_Hierarchy) - then - return; - end if; - -- The designated type was an incomplete type, and the -- access type did not get expanded. Salvage it now. ! pragma Assert (Present (Parent (Base_Type (PtrT)))); ! Expand_N_Full_Type_Declaration ! (Parent (Base_Type (PtrT))); end if; -- If the context of the allocator is a declaration or an --- 3675,3688 ---- if Has_Task (T) then if No (Master_Id (Base_Type (PtrT))) then -- The designated type was an incomplete type, and the -- access type did not get expanded. Salvage it now. ! if not Restriction_Active (No_Task_Hierarchy) then ! pragma Assert (Present (Parent (Base_Type (PtrT)))); ! Expand_N_Full_Type_Declaration ! (Parent (Base_Type (PtrT))); ! end if; end if; -- If the context of the allocator is a declaration or an *************** package body Exp_Ch4 is *** 3710,3725 **** 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)); Decl := Last (Decls); Append_To (Args, New_Occurrence_Of (Defining_Identifier (Decl), Loc)); ! -- Has_Task is false, Decls not used else Decls := No_List; --- 3725,3746 ---- Decls := Build_Task_Image_Decls (Loc, T, T); end if; ! if Restriction_Active (No_Task_Hierarchy) then ! Append_To (Args, ! New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc)); ! else ! Append_To (Args, ! New_Reference_To ! (Master_Id (Base_Type (Root_Type (PtrT))), Loc)); ! end if; ! Append_To (Args, Make_Identifier (Loc, Name_uChain)); Decl := Last (Decls); Append_To (Args, New_Occurrence_Of (Defining_Identifier (Decl), Loc)); ! -- Has_Task is false, Decls not used else Decls := No_List; *************** package body Exp_Ch4 is *** 3755,3761 **** 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 --- 3776,3782 ---- if not Is_Constrained (Typ) and then Present (Discriminant_Default_Value (First_Discriminant (Typ))) ! and then (Ada_Version < Ada_2005 or else not Has_Constrained_Partial_View (Typ)) then *************** package body Exp_Ch4 is *** 3772,3778 **** -- anonymous access type make sure an accessibility -- check is inserted if necessary (3.10.2(22.q/2)) ! if Ada_Version >= Ada_05 and then Ekind (Etype (Nod)) = E_Anonymous_Access_Type then --- 3793,3799 ---- -- anonymous access type make sure an accessibility -- check is inserted if necessary (3.10.2(22.q/2)) ! if Ada_Version >= Ada_2005 and then Ekind (Etype (Nod)) = E_Anonymous_Access_Type then *************** package body Exp_Ch4 is *** 3900,4018 **** -- Expand_N_And_Then -- ----------------------- ! -- Expand into conditional expression if Actions present, and also deal ! -- with optimizing case of arguments being True or False. ! procedure Expand_N_And_Then (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Typ : constant Entity_Id := Etype (N); ! Left : constant Node_Id := Left_Opnd (N); ! Right : constant Node_Id := Right_Opnd (N); ! Actlist : List_Id; begin ! -- Deal with non-standard booleans ! if Is_Boolean_Type (Typ) then ! Adjust_Condition (Left); ! Adjust_Condition (Right); ! Set_Etype (N, Standard_Boolean); ! end if; ! -- Check for cases where left argument is known to be True or False ! if Compile_Time_Known_Value (Left) then ! -- If left argument is True, change (True and then Right) to Right. ! -- Any actions associated with Right will be executed unconditionally ! -- and can thus be inserted into the tree unconditionally. ! if Expr_Value_E (Left) = Standard_True then ! if Present (Actions (N)) then ! Insert_Actions (N, Actions (N)); ! end if; ! Rewrite (N, Right); ! -- If left argument is False, change (False and then Right) to False. ! -- In this case we can forget the actions associated with Right, ! -- since they will never be executed. ! else pragma Assert (Expr_Value_E (Left) = Standard_False); ! Kill_Dead_Code (Right); ! Kill_Dead_Code (Actions (N)); ! Rewrite (N, New_Occurrence_Of (Standard_False, Loc)); ! end if; ! Adjust_Result_Type (N, Typ); ! return; end if; ! -- If Actions are present, we expand ! -- left and then right ! -- into ! -- if left then right else false end ! -- with the actions becoming the Then_Actions of the conditional ! -- expression. This conditional expression is then further expanded ! -- (and will eventually disappear) ! if Present (Actions (N)) then ! Actlist := Actions (N); ! Rewrite (N, ! Make_Conditional_Expression (Loc, ! Expressions => New_List ( ! Left, ! Right, ! New_Occurrence_Of (Standard_False, Loc)))); ! -- If the right part of the expression is a function call then it can ! -- be part of the expansion of the predefined equality operator of a ! -- tagged type and we may need to adjust its SCIL dispatching node. ! if Generate_SCIL ! and then Nkind (Right) = N_Function_Call ! then ! Adjust_SCIL_Node (N, Right); ! end if; ! Set_Then_Actions (N, Actlist); ! Analyze_And_Resolve (N, Standard_Boolean); ! Adjust_Result_Type (N, Typ); ! return; end if; ! -- No actions present, check for cases of right argument True/False ! ! if Compile_Time_Known_Value (Right) then ! ! -- Change (Left and then True) to Left. Note that we know there are ! -- no actions associated with the True operand, since we just checked ! -- for this case above. ! ! if Expr_Value_E (Right) = Standard_True then ! Rewrite (N, Left); ! ! -- Change (Left and then False) to False, making sure to preserve any ! -- side effects associated with the Left operand. ! ! else pragma Assert (Expr_Value_E (Right) = Standard_False); ! Remove_Side_Effects (Left); ! Rewrite (N, New_Occurrence_Of (Standard_False, Loc)); ! end if; ! end if; ! Adjust_Result_Type (N, Typ); ! end Expand_N_And_Then; ------------------------------------- -- Expand_N_Conditional_Expression -- ------------------------------------- ! -- Expand into expression actions if then/else actions present procedure Expand_N_Conditional_Expression (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); --- 3921,4065 ---- -- Expand_N_And_Then -- ----------------------- ! procedure Expand_N_And_Then (N : Node_Id) ! renames Expand_Short_Circuit_Operator; ! ------------------------------ ! -- Expand_N_Case_Expression -- ! ------------------------------ ! ! procedure Expand_N_Case_Expression (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Typ : constant Entity_Id := Etype (N); ! Cstmt : Node_Id; ! Tnn : Entity_Id; ! Pnn : Entity_Id; ! Actions : List_Id; ! Ttyp : Entity_Id; ! Alt : Node_Id; ! Fexp : Node_Id; begin ! -- We expand ! -- case X is when A => AX, when B => BX ... ! -- to ! -- do ! -- Tnn : typ; ! -- case X is ! -- when A => ! -- Tnn := AX; ! -- when B => ! -- Tnn := BX; ! -- ... ! -- end case; ! -- in Tnn end; ! -- However, this expansion is wrong for limited types, and also ! -- wrong for unconstrained types (since the bounds may not be the ! -- same in all branches). Furthermore it involves an extra copy ! -- for large objects. So we take care of this by using the following ! -- modified expansion for non-scalar types: ! -- do ! -- type Pnn is access all typ; ! -- Tnn : Pnn; ! -- case X is ! -- when A => ! -- T := AX'Unrestricted_Access; ! -- when B => ! -- T := BX'Unrestricted_Access; ! -- ... ! -- end case; ! -- in Tnn.all end; ! Cstmt := ! Make_Case_Statement (Loc, ! Expression => Expression (N), ! Alternatives => New_List); ! Actions := New_List; ! -- Scalar case ! if Is_Scalar_Type (Typ) then ! Ttyp := Typ; ! ! else ! Pnn := Make_Temporary (Loc, 'P'); ! Append_To (Actions, ! Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Pnn, ! Type_Definition => ! Make_Access_To_Object_Definition (Loc, ! All_Present => True, ! Subtype_Indication => ! New_Reference_To (Typ, Loc)))); ! Ttyp := Pnn; end if; ! Tnn := Make_Temporary (Loc, 'T'); ! Append_To (Actions, ! Make_Object_Declaration (Loc, ! Defining_Identifier => Tnn, ! Object_Definition => New_Occurrence_Of (Ttyp, Loc))); ! -- Now process the alternatives ! Alt := First (Alternatives (N)); ! while Present (Alt) loop ! declare ! Aexp : Node_Id := Expression (Alt); ! Aloc : constant Source_Ptr := Sloc (Aexp); ! begin ! if not Is_Scalar_Type (Typ) then ! Aexp := ! Make_Attribute_Reference (Aloc, ! Prefix => Relocate_Node (Aexp), ! Attribute_Name => Name_Unrestricted_Access); ! end if; ! Append_To ! (Alternatives (Cstmt), ! Make_Case_Statement_Alternative (Sloc (Alt), ! Discrete_Choices => Discrete_Choices (Alt), ! Statements => New_List ( ! Make_Assignment_Statement (Aloc, ! Name => New_Occurrence_Of (Tnn, Loc), ! Expression => Aexp)))); ! end; ! Next (Alt); ! end loop; ! Append_To (Actions, Cstmt); ! -- Construct and return final expression with actions ! if Is_Scalar_Type (Typ) then ! Fexp := New_Occurrence_Of (Tnn, Loc); ! else ! Fexp := ! Make_Explicit_Dereference (Loc, ! Prefix => New_Occurrence_Of (Tnn, Loc)); end if; ! Rewrite (N, ! Make_Expression_With_Actions (Loc, ! Expression => Fexp, ! Actions => Actions)); ! Analyze_And_Resolve (N, Typ); ! end Expand_N_Case_Expression; ------------------------------------- -- Expand_N_Conditional_Expression -- ------------------------------------- ! -- Deal with limited types and expression actions procedure Expand_N_Conditional_Expression (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); *************** package body Exp_Ch4 is *** 4021,4053 **** Elsex : constant Node_Id := Next (Thenx); Typ : constant Entity_Id := Etype (N); ! Cnn : Entity_Id; ! Decl : Node_Id; ! New_If : Node_Id; ! New_N : Node_Id; ! P_Decl : Node_Id; begin ! -- If either then or else actions are present, then given: ! -- if cond then then-expr else else-expr end ! -- we insert the following sequence of actions (using Insert_Actions): ! -- Cnn : typ; ! -- if cond then ! -- <> ! -- Cnn := then-expr; ! -- else ! -- <> ! -- Cnn := else-expr ! -- end if; ! -- and replace the conditional expression by a reference to Cnn ! -- If the type is limited or unconstrained, the above expansion is ! -- not legal, because it involves either an uninitialized object ! -- or an illegal assignment. Instead, we generate: -- type Ptr is access all Typ; -- Cnn : Ptr; --- 4068,4135 ---- Elsex : constant Node_Id := Next (Thenx); Typ : constant Entity_Id := Etype (N); ! Cnn : Entity_Id; ! Decl : Node_Id; ! New_If : Node_Id; ! New_N : Node_Id; ! P_Decl : Node_Id; ! Expr : Node_Id; ! Actions : List_Id; begin ! -- Fold at compile time if condition known. We have already folded ! -- static conditional expressions, but it is possible to fold any ! -- case in which the condition is known at compile time, even though ! -- the result is non-static. ! -- Note that we don't do the fold of such cases in Sem_Elab because ! -- it can cause infinite loops with the expander adding a conditional ! -- expression, and Sem_Elab circuitry removing it repeatedly. ! if Compile_Time_Known_Value (Cond) then ! if Is_True (Expr_Value (Cond)) then ! Expr := Thenx; ! Actions := Then_Actions (N); ! else ! Expr := Elsex; ! Actions := Else_Actions (N); ! end if; ! Remove (Expr); ! if Present (Actions) then ! -- If we are not allowed to use Expression_With_Actions, just ! -- skip the optimization, it is not critical for correctness. ! ! if not Use_Expression_With_Actions then ! goto Skip_Optimization; ! end if; ! ! Rewrite (N, ! Make_Expression_With_Actions (Loc, ! Expression => Relocate_Node (Expr), ! Actions => Actions)); ! Analyze_And_Resolve (N, Typ); ! ! else ! Rewrite (N, Relocate_Node (Expr)); ! end if; ! ! -- Note that the result is never static (legitimate cases of static ! -- conditional expressions were folded in Sem_Eval). ! ! Set_Is_Static_Expression (N, False); ! return; ! end if; ! ! <> ! ! -- If the type is limited or unconstrained, we expand as follows to ! -- avoid any possibility of improper copies. ! ! -- Note: it may be possible to avoid this special processing if the ! -- back end uses its own mechanisms for handling by-reference types ??? -- type Ptr is access all Typ; -- Cnn : Ptr; *************** package body Exp_Ch4 is *** 4059,4073 **** -- Cnn := else-expr'Unrestricted_Access; -- end if; ! -- and replace the conditional expresion by a reference to Cnn.all. ! if Is_By_Reference_Type (Typ) then Cnn := Make_Temporary (Loc, 'C', N); P_Decl := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')), Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, --- 4141,4159 ---- -- Cnn := else-expr'Unrestricted_Access; -- end if; ! -- and replace the conditional expression by a reference to Cnn.all. ! -- This special case can be skipped if the back end handles limited ! -- types properly and ensures that no incorrect copies are made. ! ! if Is_By_Reference_Type (Typ) ! and then not Back_End_Handles_Limited_Types ! then Cnn := Make_Temporary (Loc, 'C', N); P_Decl := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'A'), Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, *************** package body Exp_Ch4 is *** 4110,4149 **** -- associated with either branch. elsif Present (Then_Actions (N)) or else Present (Else_Actions (N)) then - Cnn := Make_Temporary (Loc, 'C', N); ! Decl := ! Make_Object_Declaration (Loc, ! Defining_Identifier => Cnn, ! Object_Definition => New_Occurrence_Of (Typ, Loc)); ! New_If := ! Make_Implicit_If_Statement (N, ! Condition => Relocate_Node (Cond), ! Then_Statements => New_List ( ! Make_Assignment_Statement (Sloc (Thenx), ! Name => New_Occurrence_Of (Cnn, Sloc (Thenx)), ! Expression => Relocate_Node (Thenx))), ! Else_Statements => New_List ( ! Make_Assignment_Statement (Sloc (Elsex), ! Name => New_Occurrence_Of (Cnn, Sloc (Elsex)), ! Expression => Relocate_Node (Elsex)))); ! Set_Assignment_OK (Name (First (Then_Statements (New_If)))); ! Set_Assignment_OK (Name (First (Else_Statements (New_If)))); ! New_N := New_Occurrence_Of (Cnn, Loc); ! else ! -- No expansion needed, gigi handles it like a C conditional ! -- expression. return; end if; ! -- Move the SLOC of the parent If statement to the newly created one and -- change it to the SLOC of the expression which, after expansion, will -- correspond to what is being evaluated. --- 4196,4279 ---- -- associated with either branch. elsif Present (Then_Actions (N)) or else Present (Else_Actions (N)) then ! -- We have two approaches to handling this. If we are allowed to use ! -- N_Expression_With_Actions, then we can just wrap the actions into ! -- the appropriate expression. ! if Use_Expression_With_Actions then ! if Present (Then_Actions (N)) then ! Rewrite (Thenx, ! Make_Expression_With_Actions (Sloc (Thenx), ! Actions => Then_Actions (N), ! Expression => Relocate_Node (Thenx))); ! Set_Then_Actions (N, No_List); ! Analyze_And_Resolve (Thenx, Typ); ! end if; ! if Present (Else_Actions (N)) then ! Rewrite (Elsex, ! Make_Expression_With_Actions (Sloc (Elsex), ! Actions => Else_Actions (N), ! Expression => Relocate_Node (Elsex))); ! Set_Else_Actions (N, No_List); ! Analyze_And_Resolve (Elsex, Typ); ! end if; ! return; ! -- if we can't use N_Expression_With_Actions nodes, then we insert ! -- the following sequence of actions (using Insert_Actions): ! -- Cnn : typ; ! -- if cond then ! -- <> ! -- Cnn := then-expr; ! -- else ! -- <> ! -- Cnn := else-expr ! -- end if; ! -- and replace the conditional expression by a reference to Cnn ! ! else ! Cnn := Make_Temporary (Loc, 'C', N); ! ! Decl := ! Make_Object_Declaration (Loc, ! Defining_Identifier => Cnn, ! Object_Definition => New_Occurrence_Of (Typ, Loc)); ! ! New_If := ! Make_Implicit_If_Statement (N, ! Condition => Relocate_Node (Cond), ! ! Then_Statements => New_List ( ! Make_Assignment_Statement (Sloc (Thenx), ! Name => New_Occurrence_Of (Cnn, Sloc (Thenx)), ! Expression => Relocate_Node (Thenx))), + Else_Statements => New_List ( + Make_Assignment_Statement (Sloc (Elsex), + Name => New_Occurrence_Of (Cnn, Sloc (Elsex)), + Expression => Relocate_Node (Elsex)))); + + Set_Assignment_OK (Name (First (Then_Statements (New_If)))); + Set_Assignment_OK (Name (First (Else_Statements (New_If)))); + + New_N := New_Occurrence_Of (Cnn, Loc); + end if; + + -- If no actions then no expansion needed, gigi will handle it using + -- the same approach as a C conditional expression. + + else return; end if; ! -- Fall through here for either the limited expansion, or the case of ! -- inserting actions for non-limited types. In both these cases, we must ! -- move the SLOC of the parent If statement to the newly created one and -- change it to the SLOC of the expression which, after expansion, will -- correspond to what is being evaluated. *************** package body Exp_Ch4 is *** 4190,4203 **** procedure Expand_N_In (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Rtyp : constant Entity_Id := Etype (N); Lop : constant Node_Id := Left_Opnd (N); Rop : constant Node_Id := Right_Opnd (N); Static : constant Boolean := Is_OK_Static_Expression (N); procedure Expand_Set_Membership; ! -- For each disjunct we create a simple equality or membership test. ! -- The whole membership is rewritten as a short-circuit disjunction. --------------------------- -- Expand_Set_Membership -- --- 4320,4336 ---- procedure Expand_N_In (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Restyp : constant Entity_Id := Etype (N); Lop : constant Node_Id := Left_Opnd (N); Rop : constant Node_Id := Right_Opnd (N); Static : constant Boolean := Is_OK_Static_Expression (N); + Ltyp : Entity_Id; + Rtyp : Entity_Id; + procedure Expand_Set_Membership; ! -- For each choice we create a simple equality or membership test. ! -- The whole membership is rewritten connecting these with OR ELSE. --------------------------- -- Expand_Set_Membership -- *************** package body Exp_Ch4 is *** 4221,4243 **** R : constant Node_Id := Relocate_Node (Alt); begin ! if Is_Entity_Name (Alt) ! and then Is_Type (Entity (Alt)) then Cond := Make_In (Sloc (Alt), Left_Opnd => L, Right_Opnd => R); else ! Cond := Make_Op_Eq (Sloc (Alt), ! Left_Opnd => L, ! Right_Opnd => R); end if; return Cond; end Make_Cond; ! -- Start of proessing for Expand_N_In begin Alt := Last (Alternatives (N)); --- 4354,4377 ---- R : constant Node_Id := Relocate_Node (Alt); begin ! if (Is_Entity_Name (Alt) and then Is_Type (Entity (Alt))) ! or else Nkind (Alt) = N_Range then Cond := Make_In (Sloc (Alt), Left_Opnd => L, Right_Opnd => R); else ! Cond := ! Make_Op_Eq (Sloc (Alt), ! Left_Opnd => L, ! Right_Opnd => R); end if; return Cond; end Make_Cond; ! -- Start of processing for Expand_Set_Membership begin Alt := Last (Alternatives (N)); *************** package body Exp_Ch4 is *** 4271,4286 **** Prefix => Relocate_Node (Lop), Attribute_Name => Name_Valid)); ! Analyze_And_Resolve (N, Rtyp); Error_Msg_N ("?explicit membership test may be optimized away", N); ! Error_Msg_N ("\?use ''Valid attribute instead", N); return; end Substitute_Valid_Check; -- Start of processing for Expand_N_In begin if Present (Alternatives (N)) then Remove_Side_Effects (Lop); --- 4405,4422 ---- Prefix => Relocate_Node (Lop), Attribute_Name => Name_Valid)); ! Analyze_And_Resolve (N, Restyp); Error_Msg_N ("?explicit membership test may be optimized away", N); ! Error_Msg_N -- CODEFIX ! ("\?use ''Valid attribute instead", N); return; end Substitute_Valid_Check; -- Start of processing for Expand_N_In begin + -- If set membership case, expand with separate procedure if Present (Alternatives (N)) then Remove_Side_Effects (Lop); *************** package body Exp_Ch4 is *** 4288,4302 **** return; end if; -- Check case of explicit test for an expression in range of its -- subtype. This is suspicious usage and we replace it with a 'Valid ! -- test and give a warning. ! if Is_Scalar_Type (Etype (Lop)) and then Nkind (Rop) in N_Has_Entity ! and then Etype (Lop) = Entity (Rop) and then Comes_From_Source (N) and then VM_Target = No_VM then Substitute_Valid_Check; return; --- 4424,4450 ---- return; end if; + -- Not set membership, proceed with expansion + + Ltyp := Etype (Left_Opnd (N)); + Rtyp := Etype (Right_Opnd (N)); + -- Check case of explicit test for an expression in range of its -- subtype. This is suspicious usage and we replace it with a 'Valid ! -- test and give a warning. For floating point types however, this is a ! -- standard way to check for finite numbers, and using 'Valid would ! -- typically be a pessimization. Also skip this test for predicated ! -- types, since it is perfectly reasonable to check if a value meets ! -- its predicate. ! if Is_Scalar_Type (Ltyp) ! and then not Is_Floating_Point_Type (Ltyp) and then Nkind (Rop) in N_Has_Entity ! and then Ltyp = Entity (Rop) and then Comes_From_Source (N) and then VM_Target = No_VM + and then not (Is_Discrete_Type (Ltyp) + and then Present (Predicate_Function (Ltyp))) then Substitute_Valid_Check; return; *************** package body Exp_Ch4 is *** 4316,4323 **** Lo : constant Node_Id := Low_Bound (Rop); Hi : constant Node_Id := High_Bound (Rop); - Ltyp : constant Entity_Id := Etype (Lop); - Lo_Orig : constant Node_Id := Original_Node (Lo); Hi_Orig : constant Node_Id := Original_Node (Hi); --- 4464,4469 ---- *************** package body Exp_Ch4 is *** 4329,4337 **** and then Comes_From_Source (N) and then not In_Instance; -- This must be true for any of the optimization warnings, we ! -- clearly want to give them only for source with the flag on. ! -- We also skip these warnings in an instance since it may be ! -- the case that different instantiations have different ranges. Warn2 : constant Boolean := Warn1 --- 4475,4483 ---- and then Comes_From_Source (N) and then not In_Instance; -- This must be true for any of the optimization warnings, we ! -- clearly want to give them only for source with the flag on. We ! -- also skip these warnings in an instance since it may be the ! -- case that different instantiations have different ranges. Warn2 : constant Boolean := Warn1 *************** package body Exp_Ch4 is *** 4340,4350 **** -- For the case where only one bound warning is elided, we also -- insist on an explicit range and an integer type. The reason is -- that the use of enumeration ranges including an end point is ! -- common, as is the use of a subtype name, one of whose bounds ! -- is the same as the type of the expression. begin ! -- If test is explicit x'first .. x'last, replace by valid check if Is_Scalar_Type (Ltyp) and then Nkind (Lo_Orig) = N_Attribute_Reference --- 4486,4498 ---- -- For the case where only one bound warning is elided, we also -- insist on an explicit range and an integer type. The reason is -- that the use of enumeration ranges including an end point is ! -- common, as is the use of a subtype name, one of whose bounds is ! -- the same as the type of the expression. begin ! -- If test is explicit x'First .. x'Last, replace by valid check ! ! -- Could use some individual comments for this complex test ??? if Is_Scalar_Type (Ltyp) and then Nkind (Lo_Orig) = N_Attribute_Reference *************** package body Exp_Ch4 is *** 4359,4365 **** and then VM_Target = No_VM then Substitute_Valid_Check; ! return; end if; -- If bounds of type are known at compile time, and the end points --- 4507,4513 ---- and then VM_Target = No_VM then Substitute_Valid_Check; ! goto Leave; end if; -- If bounds of type are known at compile time, and the end points *************** package body Exp_Ch4 is *** 4383,4393 **** and then not In_Instance then Substitute_Valid_Check; ! return; end if; ! -- If we have an explicit range, do a bit of optimization based ! -- on range analysis (we may be able to kill one or both checks). Lcheck := Compile_Time_Compare (Lop, Lo, Assume_Valid => False); Ucheck := Compile_Time_Compare (Lop, Hi, Assume_Valid => False); --- 4531,4541 ---- and then not In_Instance then Substitute_Valid_Check; ! goto Leave; end if; ! -- If we have an explicit range, do a bit of optimization based on ! -- range analysis (we may be able to kill one or both checks). Lcheck := Compile_Time_Compare (Lop, Lo, Assume_Valid => False); Ucheck := Compile_Time_Compare (Lop, Hi, Assume_Valid => False); *************** package body Exp_Ch4 is *** 4402,4413 **** Error_Msg_N ("\?value is known to be out of range", N); end if; ! Rewrite (N, ! New_Reference_To (Standard_False, Loc)); ! Analyze_And_Resolve (N, Rtyp); Set_Is_Static_Expression (N, Static); ! ! return; -- If both checks are known to succeed, replace result by True, -- since we know we are in range. --- 4550,4559 ---- Error_Msg_N ("\?value is known to be out of range", N); end if; ! Rewrite (N, New_Reference_To (Standard_False, Loc)); ! Analyze_And_Resolve (N, Restyp); Set_Is_Static_Expression (N, Static); ! goto Leave; -- If both checks are known to succeed, replace result by True, -- since we know we are in range. *************** package body Exp_Ch4 is *** 4418,4429 **** Error_Msg_N ("\?value is known to be in range", N); end if; ! Rewrite (N, ! New_Reference_To (Standard_True, Loc)); ! Analyze_And_Resolve (N, Rtyp); Set_Is_Static_Expression (N, Static); ! ! return; -- If lower bound check succeeds and upper bound check is not -- known to succeed or fail, then replace the range check with --- 4564,4573 ---- Error_Msg_N ("\?value is known to be in range", N); end if; ! Rewrite (N, New_Reference_To (Standard_True, Loc)); ! Analyze_And_Resolve (N, Restyp); Set_Is_Static_Expression (N, Static); ! goto Leave; -- If lower bound check succeeds and upper bound check is not -- known to succeed or fail, then replace the range check with *************** package body Exp_Ch4 is *** 4439,4447 **** Make_Op_Le (Loc, Left_Opnd => Lop, Right_Opnd => High_Bound (Rop))); ! Analyze_And_Resolve (N, Rtyp); ! ! return; -- If upper bound check succeeds and lower bound check is not -- known to succeed or fail, then replace the range check with --- 4583,4590 ---- Make_Op_Le (Loc, Left_Opnd => Lop, Right_Opnd => High_Bound (Rop))); ! Analyze_And_Resolve (N, Restyp); ! goto Leave; -- If upper bound check succeeds and lower bound check is not -- known to succeed or fail, then replace the range check with *************** package body Exp_Ch4 is *** 4457,4465 **** Make_Op_Ge (Loc, Left_Opnd => Lop, Right_Opnd => Low_Bound (Rop))); ! Analyze_And_Resolve (N, Rtyp); ! ! return; end if; -- We couldn't optimize away the range check, but there is one --- 4600,4607 ---- Make_Op_Ge (Loc, Left_Opnd => Lop, Right_Opnd => Low_Bound (Rop))); ! Analyze_And_Resolve (N, Restyp); ! goto Leave; end if; -- We couldn't optimize away the range check, but there is one *************** package body Exp_Ch4 is *** 4500,4506 **** -- For all other cases of an explicit range, nothing to be done ! return; -- Here right operand is a subtype mark --- 4642,4648 ---- -- For all other cases of an explicit range, nothing to be done ! goto Leave; -- Here right operand is a subtype mark *************** package body Exp_Ch4 is *** 4528,4567 **** if Tagged_Type_Expansion then Tagged_Membership (N, SCIL_Node, New_N); Rewrite (N, New_N); ! Analyze_And_Resolve (N, Rtyp); -- Update decoration of relocated node referenced by the -- SCIL node. ! if Generate_SCIL ! and then Present (SCIL_Node) ! then ! Set_SCIL_Related_Node (SCIL_Node, N); ! Insert_Action (N, SCIL_Node); end if; end if; ! return; ! -- If type is scalar type, rewrite as x in t'first .. t'last. -- This reason we do this is that the bounds may have the wrong -- type if they come from the original type definition. Also this -- way we get all the processing above for an explicit range. elsif Is_Scalar_Type (Typ) then ! Rewrite (Rop, ! Make_Range (Loc, ! Low_Bound => ! Make_Attribute_Reference (Loc, ! Attribute_Name => Name_First, ! Prefix => New_Reference_To (Typ, Loc)), ! High_Bound => ! Make_Attribute_Reference (Loc, ! Attribute_Name => Name_Last, ! Prefix => New_Reference_To (Typ, Loc)))); ! Analyze_And_Resolve (N, Rtyp); ! return; -- Ada 2005 (AI-216): Program_Error is raised when evaluating -- a membership test if the subtype mark denotes a constrained --- 4670,4712 ---- if Tagged_Type_Expansion then Tagged_Membership (N, SCIL_Node, New_N); Rewrite (N, New_N); ! Analyze_And_Resolve (N, Restyp); -- Update decoration of relocated node referenced by the -- SCIL node. ! if Generate_SCIL and then Present (SCIL_Node) then ! Set_SCIL_Node (N, SCIL_Node); end if; end if; ! goto Leave; ! -- If type is scalar type, rewrite as x in t'First .. t'Last. -- This reason we do this is that the bounds may have the wrong -- type if they come from the original type definition. Also this -- way we get all the processing above for an explicit range. + -- Don't do this for predicated types, since in this case we + -- want to check the predicate! + elsif Is_Scalar_Type (Typ) then ! if No (Predicate_Function (Typ)) then ! Rewrite (Rop, ! Make_Range (Loc, ! Low_Bound => ! Make_Attribute_Reference (Loc, ! Attribute_Name => Name_First, ! Prefix => New_Reference_To (Typ, Loc)), ! High_Bound => ! Make_Attribute_Reference (Loc, ! Attribute_Name => Name_Last, ! Prefix => New_Reference_To (Typ, Loc)))); ! Analyze_And_Resolve (N, Restyp); ! end if; ! ! goto Leave; -- Ada 2005 (AI-216): Program_Error is raised when evaluating -- a membership test if the subtype mark denotes a constrained *************** package body Exp_Ch4 is *** 4576,4588 **** Make_Raise_Program_Error (Loc, Reason => PE_Unchecked_Union_Restriction)); ! -- Prevent Gigi from generating incorrect code by rewriting ! -- the test as a standard False. ! ! Rewrite (N, ! New_Occurrence_Of (Standard_False, Loc)); ! return; end if; -- Here we have a non-scalar type --- 4721,4731 ---- Make_Raise_Program_Error (Loc, Reason => PE_Unchecked_Union_Restriction)); ! -- Prevent Gigi from generating incorrect code by rewriting the ! -- test as False. ! Rewrite (N, New_Occurrence_Of (Standard_False, Loc)); ! goto Leave; end if; -- Here we have a non-scalar type *************** package body Exp_Ch4 is *** 4592,4619 **** end if; if not Is_Constrained (Typ) then ! Rewrite (N, ! New_Reference_To (Standard_True, Loc)); ! Analyze_And_Resolve (N, Rtyp); -- For the constrained array case, we have to check the subscripts -- for an exact match if the lengths are non-zero (the lengths -- must match in any case). elsif Is_Array_Type (Typ) then - Check_Subscripts : declare ! function Construct_Attribute_Reference (E : Node_Id; Nam : Name_Id; Dim : Nat) return Node_Id; ! -- Build attribute reference E'Nam(Dim) ! ----------------------------------- ! -- Construct_Attribute_Reference -- ! ----------------------------------- ! function Construct_Attribute_Reference (E : Node_Id; Nam : Name_Id; Dim : Nat) return Node_Id --- 4735,4760 ---- end if; if not Is_Constrained (Typ) then ! Rewrite (N, New_Reference_To (Standard_True, Loc)); ! Analyze_And_Resolve (N, Restyp); -- For the constrained array case, we have to check the subscripts -- for an exact match if the lengths are non-zero (the lengths -- must match in any case). elsif Is_Array_Type (Typ) then Check_Subscripts : declare ! function Build_Attribute_Reference (E : Node_Id; Nam : Name_Id; Dim : Nat) return Node_Id; ! -- Build attribute reference E'Nam (Dim) ! ------------------------------- ! -- Build_Attribute_Reference -- ! ------------------------------- ! function Build_Attribute_Reference (E : Node_Id; Nam : Name_Id; Dim : Nat) return Node_Id *************** package body Exp_Ch4 is *** 4621,4631 **** begin return Make_Attribute_Reference (Loc, ! Prefix => E, Attribute_Name => Nam, ! Expressions => New_List ( Make_Integer_Literal (Loc, Dim))); ! end Construct_Attribute_Reference; -- Start of processing for Check_Subscripts --- 4762,4772 ---- begin return Make_Attribute_Reference (Loc, ! Prefix => E, Attribute_Name => Nam, ! Expressions => New_List ( Make_Integer_Literal (Loc, Dim))); ! end Build_Attribute_Reference; -- Start of processing for Check_Subscripts *************** package body Exp_Ch4 is *** 4634,4654 **** Evolve_And_Then (Cond, Make_Op_Eq (Loc, Left_Opnd => ! Construct_Attribute_Reference (Duplicate_Subexpr_No_Checks (Obj), Name_First, J), Right_Opnd => ! Construct_Attribute_Reference (New_Occurrence_Of (Typ, Loc), Name_First, J))); Evolve_And_Then (Cond, Make_Op_Eq (Loc, Left_Opnd => ! Construct_Attribute_Reference (Duplicate_Subexpr_No_Checks (Obj), Name_Last, J), Right_Opnd => ! Construct_Attribute_Reference (New_Occurrence_Of (Typ, Loc), Name_Last, J))); end loop; --- 4775,4795 ---- Evolve_And_Then (Cond, Make_Op_Eq (Loc, Left_Opnd => ! Build_Attribute_Reference (Duplicate_Subexpr_No_Checks (Obj), Name_First, J), Right_Opnd => ! Build_Attribute_Reference (New_Occurrence_Of (Typ, Loc), Name_First, J))); Evolve_And_Then (Cond, Make_Op_Eq (Loc, Left_Opnd => ! Build_Attribute_Reference (Duplicate_Subexpr_No_Checks (Obj), Name_Last, J), Right_Opnd => ! Build_Attribute_Reference (New_Occurrence_Of (Typ, Loc), Name_Last, J))); end loop; *************** package body Exp_Ch4 is *** 4663,4669 **** end if; Rewrite (N, Cond); ! Analyze_And_Resolve (N, Rtyp); end Check_Subscripts; -- These are the cases where constraint checks may be required, --- 4804,4810 ---- end if; Rewrite (N, Cond); ! Analyze_And_Resolve (N, Restyp); end Check_Subscripts; -- These are the cases where constraint checks may be required, *************** package body Exp_Ch4 is *** 4694,4703 **** end if; Rewrite (N, Cond); ! Analyze_And_Resolve (N, Rtyp); end if; end; end if; end Expand_N_In; -------------------------------- --- 4835,4877 ---- end if; Rewrite (N, Cond); ! Analyze_And_Resolve (N, Restyp); end if; end; end if; + + -- At this point, we have done the processing required for the basic + -- membership test, but not yet dealt with the predicate. + + <> + + -- If a predicate is present, then we do the predicate test, but we + -- most certainly want to omit this if we are within the predicate + -- function itself, since otherwise we have an infinite recursion! + + declare + PFunc : constant Entity_Id := Predicate_Function (Rtyp); + + begin + if Present (PFunc) + and then Current_Scope /= PFunc + then + Rewrite (N, + Make_And_Then (Loc, + Left_Opnd => Relocate_Node (N), + Right_Opnd => Make_Predicate_Call (Rtyp, Lop))); + + -- Analyze new expression, mark left operand as analyzed to + -- avoid infinite recursion adding predicate calls. + + Set_Analyzed (Left_Opnd (N)); + Analyze_And_Resolve (N, Standard_Boolean); + + -- All done, skip attempt at compile time determination of result + + return; + end if; + end; end Expand_N_In; -------------------------------- *************** package body Exp_Ch4 is *** 4739,4745 **** -- 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); --- 4913,4919 ---- -- 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_2005 and then Is_Build_In_Place_Function_Call (P) then Make_Build_In_Place_Call_In_Anonymous_Context (P); *************** package body Exp_Ch4 is *** 4795,4801 **** -- The second expression in a 'Read attribute reference ! -- The prefix of an address or size attribute reference -- The following circuit detects these exceptions --- 4969,4975 ---- -- The second expression in a 'Read attribute reference ! -- The prefix of an address or bit or size attribute reference -- The following circuit detects these exceptions *************** package body Exp_Ch4 is *** 4819,4824 **** --- 4993,5000 ---- elsif Nkind (Parnt) = N_Attribute_Reference and then (Attribute_Name (Parnt) = Name_Address or else + Attribute_Name (Parnt) = Name_Bit + or else Attribute_Name (Parnt) = Name_Size) and then Prefix (Parnt) = Child then *************** package body Exp_Ch4 is *** 4907,4921 **** -- Expand_N_Null -- ------------------- ! -- The only replacement required is for the case of a null of type that is ! -- an access to protected subprogram. We represent such access values as a ! -- record, and so we must replace the occurrence of null by the equivalent ! -- record (with a null address and a null pointer in it), so that the ! -- backend creates the proper value. procedure Expand_N_Null (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Typ : constant Entity_Id := Etype (N); Agg : Node_Id; begin --- 5083,5097 ---- -- Expand_N_Null -- ------------------- ! -- The only replacement required is for the case of a null of a type that ! -- is an access to protected subprogram, or a subtype thereof. We represent ! -- such access values as a record, and so we must replace the occurrence of ! -- null by the equivalent record (with a null address and a null pointer in ! -- it), so that the backend creates the proper value. procedure Expand_N_Null (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Typ : constant Entity_Id := Base_Type (Etype (N)); Agg : Node_Id; begin *************** package body Exp_Ch4 is *** 5061,5066 **** --- 5237,5246 ---- Set_Etype (N, Standard_Boolean); Adjust_Result_Type (N, Typ); end if; + + elsif Is_Intrinsic_Subprogram (Entity (N)) then + Expand_Intrinsic_Call (N, Entity (N)); + end if; end Expand_N_Op_And; *************** package body Exp_Ch4 is *** 5168,5174 **** and then Is_Power_Of_2_For_Shift (Ropnd) -- We cannot do this transformation in configurable run time mode if we ! -- have 64-bit -- integers and long shifts are not available. and then (Esize (Ltyp) <= 32 --- 5348,5354 ---- and then Is_Power_Of_2_For_Shift (Ropnd) -- We cannot do this transformation in configurable run time mode if we ! -- have 64-bit integers and long shifts are not available. and then (Esize (Ltyp) <= 32 *************** package body Exp_Ch4 is *** 5390,5401 **** then -- Enclosing record is an Unchecked_Union, use formal A ! if Is_Unchecked_Union (Scope ! (Entity (Selector_Name (Lhs)))) then ! Lhs_Discr_Val := ! Make_Identifier (Loc, ! Chars => Name_A); -- Enclosing record is of a non-Unchecked_Union type, it is -- possible to reference the discriminant. --- 5570,5579 ---- then -- Enclosing record is an Unchecked_Union, use formal A ! if Is_Unchecked_Union ! (Scope (Entity (Selector_Name (Lhs)))) then ! Lhs_Discr_Val := Make_Identifier (Loc, Name_A); -- Enclosing record is of a non-Unchecked_Union type, it is -- possible to reference the discriminant. *************** package body Exp_Ch4 is *** 5434,5442 **** if Is_Unchecked_Union (Scope (Entity (Selector_Name (Rhs)))) then ! Rhs_Discr_Val := ! Make_Identifier (Loc, ! Chars => Name_B); else Rhs_Discr_Val := --- 5612,5618 ---- if Is_Unchecked_Union (Scope (Entity (Selector_Name (Rhs)))) then ! Rhs_Discr_Val := Make_Identifier (Loc, Name_B); else Rhs_Discr_Val := *************** package body Exp_Ch4 is *** 5983,5990 **** -- En * En else -- Expv = 4 ! Temp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('E')); Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, --- 6159,6165 ---- -- En * En else -- Expv = 4 ! Temp := Make_Temporary (Loc, 'E', Base); Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, *************** package body Exp_Ch4 is *** 6014,6019 **** --- 6189,6197 ---- -- the flag Is_Natural_Power_Of_2_for_Shift set, then the expansion -- of the higher level node converts it into a shift. + -- Another case is 2 ** N in any other context. We simply convert + -- this to 1 * 2 ** N, and then the above transformation applies. + -- Note: this transformation is not applicable for a modular type with -- a non-binary modulus in the multiplication case, since we get a wrong -- result if the shift causes an overflow before the modular reduction. *************** package body Exp_Ch4 is *** 6024,6056 **** and then Esize (Root_Type (Exptyp)) <= Esize (Standard_Integer) and then Is_Unsigned_Type (Exptyp) and then not Ovflo - and then Nkind (Parent (N)) in N_Binary_Op then ! declare ! P : constant Node_Id := Parent (N); ! L : constant Node_Id := Left_Opnd (P); ! R : constant Node_Id := Right_Opnd (P); ! begin ! if (Nkind (P) = N_Op_Multiply ! and then not Non_Binary_Modulus (Typ) ! and then ! ((Is_Integer_Type (Etype (L)) and then R = N) ! or else ! (Is_Integer_Type (Etype (R)) and then L = N)) ! and then not Do_Overflow_Check (P)) ! or else ! (Nkind (P) = N_Op_Divide ! and then Is_Integer_Type (Etype (L)) ! and then Is_Unsigned_Type (Etype (L)) ! and then R = N ! and then not Do_Overflow_Check (P)) ! then ! Set_Is_Power_Of_2_For_Shift (N); ! return; ! end if; ! end; end if; -- Fall through if exponentiation must be done using a runtime routine --- 6202,6246 ---- and then Esize (Root_Type (Exptyp)) <= Esize (Standard_Integer) and then Is_Unsigned_Type (Exptyp) and then not Ovflo then ! -- First the multiply and divide cases ! if Nkind_In (Parent (N), N_Op_Divide, N_Op_Multiply) then ! declare ! P : constant Node_Id := Parent (N); ! L : constant Node_Id := Left_Opnd (P); ! R : constant Node_Id := Right_Opnd (P); ! begin ! if (Nkind (P) = N_Op_Multiply ! and then not Non_Binary_Modulus (Typ) ! and then ! ((Is_Integer_Type (Etype (L)) and then R = N) ! or else ! (Is_Integer_Type (Etype (R)) and then L = N)) ! and then not Do_Overflow_Check (P)) ! or else ! (Nkind (P) = N_Op_Divide ! and then Is_Integer_Type (Etype (L)) ! and then Is_Unsigned_Type (Etype (L)) ! and then R = N ! and then not Do_Overflow_Check (P)) ! then ! Set_Is_Power_Of_2_For_Shift (N); ! return; ! end if; ! end; ! ! -- Now the other cases ! ! elsif not Non_Binary_Modulus (Typ) then ! Rewrite (N, ! Make_Op_Multiply (Loc, ! Left_Opnd => Make_Integer_Literal (Loc, 1), ! Right_Opnd => Relocate_Node (N))); ! Analyze_And_Resolve (N, Typ); ! return; ! end if; end if; -- Fall through if exponentiation must be done using a runtime routine *************** package body Exp_Ch4 is *** 6743,6749 **** --------------------- -- If the argument is other than a Boolean array type, there is no special ! -- expansion required. -- For the packed case, we call the special routine in Exp_Pakd, except -- that if the component size is greater than one, we use the standard --- 6933,6939 ---- --------------------- -- If the argument is other than a Boolean array type, there is no special ! -- expansion required, except for VMS operations on signed integers. -- For the packed case, we call the special routine in Exp_Pakd, except -- that if the component size is greater than one, we use the standard *************** package body Exp_Ch4 is *** 6793,6798 **** --- 6983,7031 ---- return; end if; + -- For the VMS "not" on signed integer types, use conversion to and from + -- a predefined modular type. + + if Is_VMS_Operator (Entity (N)) then + declare + Rtyp : Entity_Id; + Utyp : Entity_Id; + + begin + -- If this is a derived type, retrieve original VMS type so that + -- the proper sized type is used for intermediate values. + + if Is_Derived_Type (Typ) then + Rtyp := First_Subtype (Etype (Typ)); + else + Rtyp := Typ; + end if; + + -- The proper unsigned type must have a size compatible with the + -- operand, to prevent misalignment. + + if RM_Size (Rtyp) <= 8 then + Utyp := RTE (RE_Unsigned_8); + + elsif RM_Size (Rtyp) <= 16 then + Utyp := RTE (RE_Unsigned_16); + + elsif RM_Size (Rtyp) = RM_Size (Standard_Unsigned) then + Utyp := RTE (RE_Unsigned_32); + + else + Utyp := RTE (RE_Long_Long_Unsigned); + end if; + + Rewrite (N, + Unchecked_Convert_To (Typ, + Make_Op_Not (Loc, + Unchecked_Convert_To (Utyp, Right_Opnd (N))))); + Analyze_And_Resolve (N, Typ); + return; + end; + end if; + -- Only array types need any other processing if not Is_Array_Type (Typ) then *************** package body Exp_Ch4 is *** 6846,6863 **** begin if Safe_In_Place_Array_Op (Lhs, Op1, Op2) then - if N = Op1 - and then Nkind (Op2) = N_Op_Not - then - -- (not A) op (not B) can be reduced to a single call return; ! elsif N = Op2 ! and then Nkind (Parent (N)) = N_Op_Xor ! then ! -- A xor (not B) can also be special-cased return; end if; end if; --- 7079,7096 ---- begin if Safe_In_Place_Array_Op (Lhs, Op1, Op2) then + -- (not A) op (not B) can be reduced to a single call + + if N = Op1 and then Nkind (Op2) = N_Op_Not then return; ! elsif N = Op2 and then Nkind (Op1) = N_Op_Not then ! return; ! ! -- A xor (not B) can also be special-cased + elsif N = Op2 and then Nkind (Parent (N)) = N_Op_Xor then return; end if; end if; *************** package body Exp_Ch4 is *** 6886,6895 **** Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, ! Defining_Identifier => J, Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Chars (A)), Attribute_Name => Name_Range))), Statements => New_List ( --- 7119,7128 ---- Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, ! Defining_Identifier => J, Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Chars (A)), Attribute_Name => Name_Range))), Statements => New_List ( *************** package body Exp_Ch4 is *** 6897,6903 **** Name => B_J, Expression => Make_Op_Not (Loc, A_J)))); ! Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('N')); Set_Is_Inlined (Func_Name); Insert_Action (N, --- 7130,7136 ---- Name => B_J, Expression => Make_Op_Not (Loc, A_J)))); ! Func_Name := Make_Temporary (Loc, 'N'); Set_Is_Inlined (Func_Name); Insert_Action (N, *************** package body Exp_Ch4 is *** 6921,6932 **** Statements => New_List ( Loop_Statement, Make_Simple_Return_Statement (Loc, ! Expression => ! Make_Identifier (Loc, Chars (B))))))); Rewrite (N, Make_Function_Call (Loc, ! Name => New_Reference_To (Func_Name, Loc), Parameter_Associations => New_List (Opnd))); Analyze_And_Resolve (N, Typ); --- 7154,7164 ---- Statements => New_List ( Loop_Statement, Make_Simple_Return_Statement (Loc, ! Expression => Make_Identifier (Loc, Chars (B))))))); Rewrite (N, Make_Function_Call (Loc, ! Name => New_Reference_To (Func_Name, Loc), Parameter_Associations => New_List (Opnd))); Analyze_And_Resolve (N, Typ); *************** package body Exp_Ch4 is *** 6947,6955 **** elsif Is_Boolean_Type (Etype (N)) then ! -- Replace OR by OR ELSE if Short_Circuit_And_Or active and the ! -- type is standard Boolean (do not mess with AND that uses a non- ! -- standard Boolean type, because something strange is going on). if Short_Circuit_And_Or and then Typ = Standard_Boolean then Rewrite (N, --- 7179,7187 ---- elsif Is_Boolean_Type (Etype (N)) then ! -- Replace OR by OR ELSE if Short_Circuit_And_Or active and the type ! -- is standard Boolean (do not mess with AND that uses a non-standard ! -- Boolean type, because something strange is going on). if Short_Circuit_And_Or and then Typ = Standard_Boolean then Rewrite (N, *************** package body Exp_Ch4 is *** 6966,6971 **** --- 7198,7207 ---- Set_Etype (N, Standard_Boolean); Adjust_Result_Type (N, Typ); end if; + + elsif Is_Intrinsic_Subprogram (Entity (N)) then + Expand_Intrinsic_Call (N, Entity (N)); + end if; end Expand_N_Op_Or; *************** package body Exp_Ch4 is *** 7049,7058 **** Make_Conditional_Expression (Loc, Expressions => New_List ( Make_Op_Eq (Loc, ! Left_Opnd => Duplicate_Subexpr (Right), Right_Opnd => ! Unchecked_Convert_To (Typ, ! Make_Integer_Literal (Loc, -1))), Unchecked_Convert_To (Typ, Make_Integer_Literal (Loc, Uint_0)), --- 7285,7293 ---- Make_Conditional_Expression (Loc, Expressions => New_List ( Make_Op_Eq (Loc, ! Left_Opnd => Duplicate_Subexpr (Right), Right_Opnd => ! Unchecked_Convert_To (Typ, Make_Integer_Literal (Loc, -1))), Unchecked_Convert_To (Typ, Make_Integer_Literal (Loc, Uint_0)), *************** package body Exp_Ch4 is *** 7132,7142 **** -- Arithmetic overflow checks for signed integer/fixed point types if Is_Signed_Integer_Type (Typ) ! or else Is_Fixed_Point_Type (Typ) then Apply_Arithmetic_Overflow_Check (N); ! -- Vax floating-point types case elsif Vax_Float (Typ) then Expand_Vax_Arith (N); --- 7367,7378 ---- -- Arithmetic overflow checks for signed integer/fixed point types if Is_Signed_Integer_Type (Typ) ! or else ! Is_Fixed_Point_Type (Typ) then Apply_Arithmetic_Overflow_Check (N); ! -- VAX floating-point types case elsif Vax_Float (Typ) then Expand_Vax_Arith (N); *************** package body Exp_Ch4 is *** 7161,7166 **** --- 7397,7406 ---- Adjust_Condition (Right_Opnd (N)); Set_Etype (N, Standard_Boolean); Adjust_Result_Type (N, Typ); + + elsif Is_Intrinsic_Subprogram (Entity (N)) then + Expand_Intrinsic_Call (N, Entity (N)); + end if; end Expand_N_Op_Xor; *************** package body Exp_Ch4 is *** 7168,7298 **** -- Expand_N_Or_Else -- ---------------------- ! -- Expand into conditional expression if Actions present, and also ! -- deal with optimizing case of arguments being True or False. ! procedure Expand_N_Or_Else (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Typ : constant Entity_Id := Etype (N); ! Left : constant Node_Id := Left_Opnd (N); ! Right : constant Node_Id := Right_Opnd (N); ! Actlist : List_Id; begin ! -- Deal with non-standard booleans ! if Is_Boolean_Type (Typ) then ! Adjust_Condition (Left); ! Adjust_Condition (Right); ! Set_Etype (N, Standard_Boolean); end if; ! -- Check for cases where left argument is known to be True or False ! ! if Compile_Time_Known_Value (Left) then ! ! -- If left argument is False, change (False or else Right) to Right. ! -- Any actions associated with Right will be executed unconditionally ! -- and can thus be inserted into the tree unconditionally. ! ! if Expr_Value_E (Left) = Standard_False then ! if Present (Actions (N)) then ! Insert_Actions (N, Actions (N)); ! end if; ! ! Rewrite (N, Right); ! ! -- If left argument is True, change (True and then Right) to True. In ! -- this case we can forget the actions associated with Right, since ! -- they will never be executed. ! else pragma Assert (Expr_Value_E (Left) = Standard_True); ! Kill_Dead_Code (Right); ! Kill_Dead_Code (Actions (N)); ! Rewrite (N, New_Occurrence_Of (Standard_True, Loc)); ! end if; ! Adjust_Result_Type (N, Typ); ! return; end if; ! -- If Actions are present, we expand ! -- left or else right ! -- into ! -- if left then True else right end ! -- with the actions becoming the Else_Actions of the conditional ! -- expression. This conditional expression is then further expanded ! -- (and will eventually disappear) ! if Present (Actions (N)) then ! Actlist := Actions (N); ! Rewrite (N, ! Make_Conditional_Expression (Loc, ! Expressions => New_List ( ! Left, ! New_Occurrence_Of (Standard_True, Loc), ! Right))); ! Set_Else_Actions (N, Actlist); ! Analyze_And_Resolve (N, Standard_Boolean); ! Adjust_Result_Type (N, Typ); ! return; ! end if; ! -- No actions present, check for cases of right argument True/False ! if Compile_Time_Known_Value (Right) then ! -- Change (Left or else False) to Left. Note that we know there are ! -- no actions associated with the True operand, since we just checked ! -- for this case above. ! if Expr_Value_E (Right) = Standard_False then ! Rewrite (N, Left); ! -- Change (Left or else True) to True, making sure to preserve any ! -- side effects associated with the Left operand. ! else pragma Assert (Expr_Value_E (Right) = Standard_True); ! Remove_Side_Effects (Left); ! Rewrite ! (N, New_Occurrence_Of (Standard_True, Loc)); ! end if; ! end if; ! Adjust_Result_Type (N, Typ); ! end Expand_N_Or_Else; ! ----------------------------------- ! -- Expand_N_Qualified_Expression -- ! ----------------------------------- ! procedure Expand_N_Qualified_Expression (N : Node_Id) is ! Operand : constant Node_Id := Expression (N); ! Target_Type : constant Entity_Id := Entity (Subtype_Mark (N)); ! begin ! -- Do validity check if validity checking operands ! if Validity_Checks_On ! and then Validity_Check_Operands ! then ! Ensure_Valid (Operand); ! end if; ! -- Apply possible constraint check ! Apply_Constraint_Check (Operand, Target_Type, No_Sliding => True); ! if Do_Range_Check (Operand) then ! Set_Do_Range_Check (Operand, False); ! Generate_Range_Check (Operand, Target_Type, CE_Range_Check_Failed); ! end if; ! end Expand_N_Qualified_Expression; --------------------------------- -- Expand_N_Selected_Component -- --- 7408,7542 ---- -- Expand_N_Or_Else -- ---------------------- ! procedure Expand_N_Or_Else (N : Node_Id) ! renames Expand_Short_Circuit_Operator; ! ----------------------------------- ! -- Expand_N_Qualified_Expression -- ! ----------------------------------- ! ! procedure Expand_N_Qualified_Expression (N : Node_Id) is ! Operand : constant Node_Id := Expression (N); ! Target_Type : constant Entity_Id := Entity (Subtype_Mark (N)); begin ! -- Do validity check if validity checking operands ! if Validity_Checks_On ! and then Validity_Check_Operands ! then ! Ensure_Valid (Operand); end if; ! -- Apply possible constraint check ! Apply_Constraint_Check (Operand, Target_Type, No_Sliding => True); ! if Do_Range_Check (Operand) then ! Set_Do_Range_Check (Operand, False); ! Generate_Range_Check (Operand, Target_Type, CE_Range_Check_Failed); end if; + end Expand_N_Qualified_Expression; ! ------------------------------------ ! -- Expand_N_Quantified_Expression -- ! ------------------------------------ ! -- We expand: ! -- for all X in range => Cond ! -- into: ! -- T := True; ! -- for X in range loop ! -- if not Cond then ! -- T := False; ! -- exit; ! -- end if; ! -- end loop; ! -- Conversely, an existentially quantified expression: ! -- for some X in range => Cond ! -- becomes: ! -- T := False; ! -- for X in range loop ! -- if Cond then ! -- T := True; ! -- exit; ! -- end if; ! -- end loop; ! -- In both cases, the iteration may be over a container in which case it is ! -- given by an iterator specification, not a loop parameter specification. ! procedure Expand_N_Quantified_Expression (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Is_Universal : constant Boolean := All_Present (N); ! Actions : constant List_Id := New_List; ! Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', N); ! Cond : Node_Id; ! Decl : Node_Id; ! I_Scheme : Node_Id; ! Test : Node_Id; ! begin ! Decl := ! Make_Object_Declaration (Loc, ! Defining_Identifier => Tnn, ! Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), ! Expression => ! New_Occurrence_Of (Boolean_Literals (Is_Universal), Loc)); ! Append_To (Actions, Decl); ! Cond := Relocate_Node (Condition (N)); ! if Is_Universal then ! Cond := Make_Op_Not (Loc, Cond); ! end if; ! Test := ! Make_Implicit_If_Statement (N, ! Condition => Cond, ! Then_Statements => New_List ( ! Make_Assignment_Statement (Loc, ! Name => New_Occurrence_Of (Tnn, Loc), ! Expression => ! New_Occurrence_Of (Boolean_Literals (not Is_Universal), Loc)), ! Make_Exit_Statement (Loc))); ! if Present (Loop_Parameter_Specification (N)) then ! I_Scheme := ! Make_Iteration_Scheme (Loc, ! Loop_Parameter_Specification => ! Loop_Parameter_Specification (N)); ! else ! I_Scheme := ! Make_Iteration_Scheme (Loc, ! Iterator_Specification => Iterator_Specification (N)); ! end if; ! Append_To (Actions, ! Make_Loop_Statement (Loc, ! Iteration_Scheme => I_Scheme, ! Statements => New_List (Test), ! End_Label => Empty)); ! -- The components of the scheme have already been analyzed, and the loop ! -- parameter declaration has been processed. ! Set_Analyzed (Iteration_Scheme (Last (Actions))); ! Rewrite (N, ! Make_Expression_With_Actions (Loc, ! Expression => New_Occurrence_Of (Tnn, Loc), ! Actions => Actions)); ! Analyze_And_Resolve (N, Standard_Boolean); ! end Expand_N_Quantified_Expression; --------------------------------- -- Expand_N_Selected_Component -- *************** package body Exp_Ch4 is *** 7309,7314 **** --- 7553,7559 ---- Disc : Entity_Id; New_N : Node_Id; Dcon : Elmt_Id; + Dval : Node_Id; function In_Left_Hand_Side (Comp : Node_Id) return Boolean; -- Gigi needs a temporary for prefixes that depend on a discriminant, *************** package body Exp_Ch4 is *** 7322,7331 **** function In_Left_Hand_Side (Comp : Node_Id) return Boolean is begin return (Nkind (Parent (Comp)) = N_Assignment_Statement ! and then Comp = Name (Parent (Comp))) or else (Present (Parent (Comp)) ! and then Nkind (Parent (Comp)) in N_Subexpr ! and then In_Left_Hand_Side (Parent (Comp))); end In_Left_Hand_Side; -- Start of processing for Expand_N_Selected_Component --- 7567,7576 ---- function In_Left_Hand_Side (Comp : Node_Id) return Boolean is begin return (Nkind (Parent (Comp)) = N_Assignment_Statement ! and then Comp = Name (Parent (Comp))) or else (Present (Parent (Comp)) ! and then Nkind (Parent (Comp)) in N_Subexpr ! and then In_Left_Hand_Side (Parent (Comp))); end In_Left_Hand_Side; -- Start of processing for Expand_N_Selected_Component *************** package body Exp_Ch4 is *** 7366,7372 **** -- 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); --- 7611,7617 ---- -- 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_2005 and then Is_Build_In_Place_Function_Call (P) then Make_Build_In_Place_Call_In_Anonymous_Context (P); *************** package body Exp_Ch4 is *** 7404,7412 **** null; -- Don't do this on the left hand of an assignment statement. ! -- Normally one would think that references like this would ! -- not occur, but they do in generated code, and mean that ! -- we really do want to assign the discriminant! elsif Nkind (Par) = N_Assignment_Statement and then Name (Par) = N --- 7649,7657 ---- null; -- Don't do this on the left hand of an assignment statement. ! -- Normally one would think that references like this would not ! -- occur, but they do in generated code, and mean that we really ! -- do want to assign the discriminant! elsif Nkind (Par) = N_Assignment_Statement and then Name (Par) = N *************** package body Exp_Ch4 is *** 7414,7420 **** null; -- Don't do this optimization for the prefix of an attribute or ! -- the operand of an object renaming declaration since these are -- contexts where we do not want the value anyway. elsif (Nkind (Par) = N_Attribute_Reference --- 7659,7665 ---- null; -- Don't do this optimization for the prefix of an attribute or ! -- the name of an object renaming declaration since these are -- contexts where we do not want the value anyway. elsif (Nkind (Par) = N_Attribute_Reference *************** package body Exp_Ch4 is *** 7441,7446 **** --- 7686,7692 ---- Disc := First_Discriminant (Ptyp); Dcon := First_Elmt (Discriminant_Constraint (Ptyp)); Discr_Loop : while Present (Dcon) loop + Dval := Node (Dcon); -- Check if this is the matching discriminant *************** package body Exp_Ch4 is *** 7451,7459 **** -- constrained by an outer discriminant, which cannot -- be optimized away. ! if ! Denotes_Discriminant ! (Node (Dcon), Check_Concurrent => True) then exit Discr_Loop; --- 7697,7726 ---- -- constrained by an outer discriminant, which cannot -- be optimized away. ! if Denotes_Discriminant ! (Dval, Check_Concurrent => True) ! then ! exit Discr_Loop; ! ! elsif Nkind (Original_Node (Dval)) = N_Selected_Component ! and then ! Denotes_Discriminant ! (Selector_Name (Original_Node (Dval)), True) ! then ! exit Discr_Loop; ! ! -- Do not retrieve value if constraint is not static. It ! -- is generally not useful, and the constraint may be a ! -- rewritten outer discriminant in which case it is in ! -- fact incorrect. ! ! elsif Is_Entity_Name (Dval) ! and then Nkind (Parent (Entity (Dval))) ! = N_Object_Declaration ! and then Present (Expression (Parent (Entity (Dval)))) ! and then ! not Is_Static_Expression ! (Expression (Parent (Entity (Dval)))) then exit Discr_Loop; *************** package body Exp_Ch4 is *** 7463,7476 **** -- missing cases. elsif Nkind (Parent (N)) = N_Case_Statement ! and then Etype (Node (Dcon)) /= Etype (Disc) then Rewrite (N, Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (Etype (Disc), Loc), Expression => ! New_Copy_Tree (Node (Dcon)))); Analyze_And_Resolve (N, Etype (Disc)); -- In case that comes out as a static expression, --- 7730,7743 ---- -- missing cases. elsif Nkind (Parent (N)) = N_Case_Statement ! and then Etype (Dval) /= Etype (Disc) then Rewrite (N, Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (Etype (Disc), Loc), Expression => ! New_Copy_Tree (Dval))); Analyze_And_Resolve (N, Etype (Disc)); -- In case that comes out as a static expression, *************** package body Exp_Ch4 is *** 7487,7493 **** -- yet, and this must be done now. else ! Rewrite (N, New_Copy_Tree (Node (Dcon))); Analyze_And_Resolve (N); Set_Is_Static_Expression (N, False); return; --- 7754,7760 ---- -- yet, and this must be done now. else ! Rewrite (N, New_Copy_Tree (Dval)); Analyze_And_Resolve (N); Set_Is_Static_Expression (N, False); return; *************** package body Exp_Ch4 is *** 7604,7609 **** --- 7871,7877 ---- procedure Make_Temporary_For_Slice is Decl : Node_Id; Ent : constant Entity_Id := Make_Temporary (Loc, 'T', N); + begin Decl := Make_Object_Declaration (Loc, *************** package body Exp_Ch4 is *** 7641,7647 **** -- 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); --- 7909,7915 ---- -- 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_2005 and then Is_Build_In_Place_Function_Call (Pfx) then Make_Build_In_Place_Call_In_Anonymous_Context (Pfx); *************** package body Exp_Ch4 is *** 7739,7745 **** Cons : List_Id; begin - -- Nothing else to do if no change of representation if Same_Representation (Operand_Type, Target_Type) then --- 8007,8012 ---- *************** package body Exp_Ch4 is *** 7775,7781 **** while Present (Disc) loop Append_To (Cons, Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr_Move_Checks (Operand), Selector_Name => Make_Identifier (Loc, Chars (Disc)))); Next_Discriminant (Disc); --- 8042,8049 ---- while Present (Disc) loop Append_To (Cons, Make_Selected_Component (Loc, ! Prefix => ! Duplicate_Subexpr_Move_Checks (Operand), Selector_Name => Make_Identifier (Loc, Chars (Disc)))); Next_Discriminant (Disc); *************** package body Exp_Ch4 is *** 7828,7834 **** Constraints => Cons)); end if; ! Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('C')); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp, --- 8096,8102 ---- Constraints => Cons)); end if; ! Temp := Make_Temporary (Loc, 'C'); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp, *************** package body Exp_Ch4 is *** 7990,8004 **** Enable_Overflow_Check (Conv); end if; ! Tnn := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Tnn, Object_Definition => New_Occurrence_Of (Btyp, Loc), ! Expression => Conv), Make_Raise_Constraint_Error (Loc, Condition => --- 8258,8271 ---- Enable_Overflow_Check (Conv); end if; ! Tnn := Make_Temporary (Loc, 'T', Conv); Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Tnn, Object_Definition => New_Occurrence_Of (Btyp, Loc), ! Constant_Present => True, ! Expression => Conv), Make_Raise_Constraint_Error (Loc, Condition => *************** package body Exp_Ch4 is *** 8039,8045 **** end if; Rewrite (N, Relocate_Node (Operand)); ! return; end if; -- Nothing to do if this is the second argument of read. This is a --- 8306,8312 ---- end if; Rewrite (N, Relocate_Node (Operand)); ! goto Done; end if; -- Nothing to do if this is the second argument of read. This is a *************** package body Exp_Ch4 is *** 8050,8056 **** and then Attribute_Name (Parent (N)) = Name_Read and then Next (First (Expressions (Parent (N)))) = N then ! return; end if; -- Here if we may need to expand conversion --- 8317,8351 ---- and then Attribute_Name (Parent (N)) = Name_Read and then Next (First (Expressions (Parent (N)))) = N then ! goto Done; ! end if; ! ! -- Check for case of converting to a type that has an invariant ! -- associated with it. This required an invariant check. We convert ! ! -- typ (expr) ! ! -- into ! ! -- do invariant_check (typ (expr)) in typ (expr); ! ! -- using Duplicate_Subexpr to avoid multiple side effects ! ! -- Note: the Comes_From_Source check, and then the resetting of this ! -- flag prevents what would otherwise be an infinite recursion. ! ! if Has_Invariants (Target_Type) ! and then Present (Invariant_Procedure (Target_Type)) ! and then Comes_From_Source (N) ! then ! Set_Comes_From_Source (N, False); ! Rewrite (N, ! Make_Expression_With_Actions (Loc, ! Actions => New_List ( ! Make_Invariant_Call (Duplicate_Subexpr (N))), ! Expression => Duplicate_Subexpr_No_Checks (N))); ! Analyze_And_Resolve (N, Target_Type); ! goto Done; end if; -- Here if we may need to expand conversion *************** package body Exp_Ch4 is *** 8079,8085 **** -- target is a real type or a 64-bit integer type, and the operand -- is an arithmetic operation using a 32-bit integer type. However, -- we do not bother with this case, because it could cause significant ! -- ineffiencies on 32-bit machines. On a 64-bit machine it would be -- much cheaper, but we don't want different behavior on 32-bit and -- 64-bit machines. Note that the exclusion of the 64-bit case also -- handles the configurable run-time cases where 64-bit arithmetic --- 8374,8380 ---- -- target is a real type or a 64-bit integer type, and the operand -- is an arithmetic operation using a 32-bit integer type. However, -- we do not bother with this case, because it could cause significant ! -- inefficiencies on 32-bit machines. On a 64-bit machine it would be -- much cheaper, but we don't want different behavior on 32-bit and -- 64-bit machines. Note that the exclusion of the 64-bit case also -- handles the configurable run-time cases where 64-bit arithmetic *************** package body Exp_Ch4 is *** 8123,8129 **** Expression => Opnd)); Analyze_And_Resolve (N, Target_Type); ! return; end; end if; --- 8418,8424 ---- Expression => Opnd)); Analyze_And_Resolve (N, Target_Type); ! goto Done; end; end if; *************** package body Exp_Ch4 is *** 8196,8202 **** Type_Access_Level (Target_Type) then Raise_Accessibility_Error; ! return; end if; end if; --- 8491,8497 ---- Type_Access_Level (Target_Type) then Raise_Accessibility_Error; ! goto Done; end if; end if; *************** package body Exp_Ch4 is *** 8223,8237 **** -- renaming, since this is an error situation which will be caught by -- Sem_Ch8, and the expansion can interfere with this error check. ! if Is_Access_Type (Target_Type) ! and then Is_Renamed_Object (N) ! then ! return; end if; -- Otherwise, proceed with processing tagged conversion ! declare Actual_Op_Typ : Entity_Id; Actual_Targ_Typ : Entity_Id; Make_Conversion : Boolean := False; --- 8518,8530 ---- -- renaming, since this is an error situation which will be caught by -- Sem_Ch8, and the expansion can interfere with this error check. ! if Is_Access_Type (Target_Type) and then Is_Renamed_Object (N) then ! goto Done; end if; -- Otherwise, proceed with processing tagged conversion ! Tagged_Conversion : declare Actual_Op_Typ : Entity_Id; Actual_Targ_Typ : Entity_Id; Make_Conversion : Boolean := False; *************** package body Exp_Ch4 is *** 8286,8292 **** Reason => CE_Tag_Check_Failed)); end Make_Tag_Check; ! -- Start of processing begin if Is_Access_Type (Target_Type) then --- 8579,8585 ---- Reason => CE_Tag_Check_Failed)); end Make_Tag_Check; ! -- Start of processing for Tagged_Conversion begin if Is_Access_Type (Target_Type) then *************** package body Exp_Ch4 is *** 8308,8314 **** if Is_Interface (Actual_Op_Typ) then Expand_Interface_Conversion (N, Is_Static => False); ! return; end if; if not Tag_Checks_Suppressed (Actual_Targ_Typ) then --- 8601,8607 ---- if Is_Interface (Actual_Op_Typ) then Expand_Interface_Conversion (N, Is_Static => False); ! goto Done; end if; if not Tag_Checks_Suppressed (Actual_Targ_Typ) then *************** package body Exp_Ch4 is *** 8383,8389 **** end; end if; end if; ! end; -- Case of other access type conversions --- 8676,8682 ---- end; end if; end if; ! end Tagged_Conversion; -- Case of other access type conversions *************** package body Exp_Ch4 is *** 8420,8428 **** end if; -- Otherwise do correct fixed-conversion, but skip these if the ! -- Conversion_OK flag is set, because from a semantic point of ! -- view these are simple integer conversions needing no further ! -- processing (the backend will simply treat them as integers) if not Conversion_OK (N) then if Is_Fixed_Point_Type (Etype (N)) then --- 8713,8721 ---- end if; -- Otherwise do correct fixed-conversion, but skip these if the ! -- Conversion_OK flag is set, because from a semantic point of view ! -- these are simple integer conversions needing no further processing ! -- (the backend will simply treat them as integers). if not Conversion_OK (N) then if Is_Fixed_Point_Type (Etype (N)) then *************** package body Exp_Ch4 is *** 8476,8482 **** -- with the end-point. But that can lose precision in some cases, and -- give a wrong result. Converting the operand to Universal_Real is -- helpful, but still does not catch all cases with 64-bit integers ! -- on targets with only 64-bit floats -- The above comment seems obsoleted by Apply_Float_Conversion_Check -- Can this code be removed ??? --- 8769,8775 ---- -- with the end-point. But that can lose precision in some cases, and -- give a wrong result. Converting the operand to Universal_Real is -- helpful, but still does not catch all cases with 64-bit integers ! -- on targets with only 64-bit floats. -- The above comment seems obsoleted by Apply_Float_Conversion_Check -- Can this code be removed ??? *************** package body Exp_Ch4 is *** 8501,8507 **** -- this case, see Handle_Changed_Representation. elsif Is_Array_Type (Target_Type) then - if Is_Constrained (Target_Type) then Apply_Length_Check (Operand, Target_Type); else --- 8794,8799 ---- *************** package body Exp_Ch4 is *** 8559,8565 **** elsif Is_Enumeration_Type (Target_Type) then -- Special processing is required if there is a change of ! -- representation (from enumeration representation clauses) if not Same_Representation (Target_Type, Operand_Type) then --- 8851,8857 ---- elsif Is_Enumeration_Type (Target_Type) then -- Special processing is required if there is a change of ! -- representation (from enumeration representation clauses). if not Same_Representation (Target_Type, Operand_Type) then *************** package body Exp_Ch4 is *** 8585,8593 **** end if; -- At this stage, either the conversion node has been transformed into ! -- some other equivalent expression, or left as a conversion that can ! -- be handled by Gigi. The conversions that Gigi can handle are the ! -- following: -- Conversions with no change of representation or type --- 8877,8884 ---- end if; -- At this stage, either the conversion node has been transformed into ! -- some other equivalent expression, or left as a conversion that can be ! -- handled by Gigi, in the following cases: -- Conversions with no change of representation or type *************** package body Exp_Ch4 is *** 8640,8646 **** end if; -- Reset overflow flag, since the range check will include ! -- dealing with possible overflow, and generate the check If -- Address is either a source type or target type, suppress -- range check to avoid typing anomalies when it is a visible -- integer type. --- 8931,8937 ---- end if; -- Reset overflow flag, since the range check will include ! -- dealing with possible overflow, and generate the check. If -- Address is either a source type or target type, suppress -- range check to avoid typing anomalies when it is a visible -- integer type. *************** package body Exp_Ch4 is *** 8663,8669 **** and then (Vax_Float (Operand_Type) or else Vax_Float (Target_Type)) then Expand_Vax_Conversion (N); ! return; end if; end Expand_N_Type_Conversion; --- 8954,8977 ---- and then (Vax_Float (Operand_Type) or else Vax_Float (Target_Type)) then Expand_Vax_Conversion (N); ! goto Done; ! end if; ! ! -- Here at end of processing ! ! <> ! -- Apply predicate check if required. Note that we can't just call ! -- Apply_Predicate_Check here, because the type looks right after ! -- the conversion and it would omit the check. The Comes_From_Source ! -- guard is necessary to prevent infinite recursions when we generate ! -- internal conversions for the purpose of checking predicates. ! ! if Present (Predicate_Function (Target_Type)) ! and then Target_Type /= Operand_Type ! and then Comes_From_Source (N) ! then ! Insert_Action (N, ! Make_Predicate_Check (Target_Type, Duplicate_Subexpr (N))); end if; end Expand_N_Type_Conversion; *************** package body Exp_Ch4 is *** 8671,8686 **** -- Expand_N_Unchecked_Expression -- ----------------------------------- ! -- Remove the unchecked expression node from the tree. It's job was simply -- to make sure that its constituent expression was handled with checks -- off, and now that that is done, we can remove it from the tree, and ! -- indeed must, since gigi does not expect to see these nodes. procedure Expand_N_Unchecked_Expression (N : Node_Id) is Exp : constant Node_Id := Expression (N); - begin ! Set_Assignment_OK (Exp, Assignment_OK (N) or Assignment_OK (Exp)); Rewrite (N, Exp); end Expand_N_Unchecked_Expression; --- 8979,8993 ---- -- Expand_N_Unchecked_Expression -- ----------------------------------- ! -- Remove the unchecked expression node from the tree. Its job was simply -- to make sure that its constituent expression was handled with checks -- off, and now that that is done, we can remove it from the tree, and ! -- indeed must, since Gigi does not expect to see these nodes. procedure Expand_N_Unchecked_Expression (N : Node_Id) is Exp : constant Node_Id := Expression (N); begin ! Set_Assignment_OK (Exp, Assignment_OK (N) or else Assignment_OK (Exp)); Rewrite (N, Exp); end Expand_N_Unchecked_Expression; *************** package body Exp_Ch4 is *** 8699,8707 **** begin -- Nothing at all to do if conversion is to the identical type so remove -- the conversion completely, it is useless, except that it may carry ! -- an Assignment_OK indication which must be proprgated to the operand. if Operand_Type = Target_Type then if Assignment_OK (N) then Set_Assignment_OK (Operand); end if; --- 9006,9017 ---- begin -- Nothing at all to do if conversion is to the identical type so remove -- the conversion completely, it is useless, except that it may carry ! -- an Assignment_OK indication which must be propagated to the operand. if Operand_Type = Target_Type then + + -- Code duplicates Expand_N_Unchecked_Expression above, factor??? + if Assignment_OK (N) then Set_Assignment_OK (Operand); end if; *************** package body Exp_Ch4 is *** 8859,8865 **** Result := New_Reference_To (Standard_True, Loc); C := Suitable_Element (First_Entity (Typ)); - while Present (C) loop declare New_Lhs : Node_Id; --- 9169,9174 ---- *************** package body Exp_Ch4 is *** 8909,8914 **** --- 9218,9423 ---- return Result; end Expand_Record_Equality; + ----------------------------------- + -- Expand_Short_Circuit_Operator -- + ----------------------------------- + + -- Deal with special expansion if actions are present for the right operand + -- and deal with optimizing case of arguments being True or False. We also + -- deal with the special case of non-standard boolean values. + + procedure Expand_Short_Circuit_Operator (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + Typ : constant Entity_Id := Etype (N); + Left : constant Node_Id := Left_Opnd (N); + Right : constant Node_Id := Right_Opnd (N); + LocR : constant Source_Ptr := Sloc (Right); + Actlist : List_Id; + + Shortcut_Value : constant Boolean := Nkind (N) = N_Or_Else; + Shortcut_Ent : constant Entity_Id := Boolean_Literals (Shortcut_Value); + -- If Left = Shortcut_Value then Right need not be evaluated + + function Make_Test_Expr (Opnd : Node_Id) return Node_Id; + -- For Opnd a boolean expression, return a Boolean expression equivalent + -- to Opnd /= Shortcut_Value. + + -------------------- + -- Make_Test_Expr -- + -------------------- + + function Make_Test_Expr (Opnd : Node_Id) return Node_Id is + begin + if Shortcut_Value then + return Make_Op_Not (Sloc (Opnd), Opnd); + else + return Opnd; + end if; + end Make_Test_Expr; + + Op_Var : Entity_Id; + -- Entity for a temporary variable holding the value of the operator, + -- used for expansion in the case where actions are present. + + -- Start of processing for Expand_Short_Circuit_Operator + + begin + -- Deal with non-standard booleans + + if Is_Boolean_Type (Typ) then + Adjust_Condition (Left); + Adjust_Condition (Right); + Set_Etype (N, Standard_Boolean); + end if; + + -- Check for cases where left argument is known to be True or False + + if Compile_Time_Known_Value (Left) then + + -- Mark SCO for left condition as compile time known + + if Generate_SCO and then Comes_From_Source (Left) then + Set_SCO_Condition (Left, Expr_Value_E (Left) = Standard_True); + end if; + + -- Rewrite True AND THEN Right / False OR ELSE Right to Right. + -- Any actions associated with Right will be executed unconditionally + -- and can thus be inserted into the tree unconditionally. + + if Expr_Value_E (Left) /= Shortcut_Ent then + if Present (Actions (N)) then + Insert_Actions (N, Actions (N)); + end if; + + Rewrite (N, Right); + + -- Rewrite False AND THEN Right / True OR ELSE Right to Left. + -- In this case we can forget the actions associated with Right, + -- since they will never be executed. + + else + Kill_Dead_Code (Right); + Kill_Dead_Code (Actions (N)); + Rewrite (N, New_Occurrence_Of (Shortcut_Ent, Loc)); + end if; + + Adjust_Result_Type (N, Typ); + return; + end if; + + -- If Actions are present for the right operand, we have to do some + -- special processing. We can't just let these actions filter back into + -- code preceding the short circuit (which is what would have happened + -- if we had not trapped them in the short-circuit form), since they + -- must only be executed if the right operand of the short circuit is + -- executed and not otherwise. + + -- the temporary variable C. + + if Present (Actions (N)) then + Actlist := Actions (N); + + -- The old approach is to expand: + + -- left AND THEN right + + -- into + + -- C : Boolean := False; + -- IF left THEN + -- Actions; + -- IF right THEN + -- C := True; + -- END IF; + -- END IF; + + -- and finally rewrite the operator into a reference to C. Similarly + -- for left OR ELSE right, with negated values. Note that this + -- rewrite causes some difficulties for coverage analysis because + -- of the introduction of the new variable C, which obscures the + -- structure of the test. + + -- We use this "old approach" if use of N_Expression_With_Actions + -- is False (see description in Opt of when this is or is not set). + + if not Use_Expression_With_Actions then + Op_Var := Make_Temporary (Loc, 'C', Related_Node => N); + + Insert_Action (N, + Make_Object_Declaration (Loc, + Defining_Identifier => + Op_Var, + Object_Definition => + New_Occurrence_Of (Standard_Boolean, Loc), + Expression => + New_Occurrence_Of (Shortcut_Ent, Loc))); + + Append_To (Actlist, + Make_Implicit_If_Statement (Right, + Condition => Make_Test_Expr (Right), + Then_Statements => New_List ( + Make_Assignment_Statement (LocR, + Name => New_Occurrence_Of (Op_Var, LocR), + Expression => + New_Occurrence_Of + (Boolean_Literals (not Shortcut_Value), LocR))))); + + Insert_Action (N, + Make_Implicit_If_Statement (Left, + Condition => Make_Test_Expr (Left), + Then_Statements => Actlist)); + + Rewrite (N, New_Occurrence_Of (Op_Var, Loc)); + Analyze_And_Resolve (N, Standard_Boolean); + + -- The new approach, activated for now by the use of debug flag + -- -gnatd.X is to use the new Expression_With_Actions node for the + -- right operand of the short-circuit form. This should solve the + -- traceability problems for coverage analysis. + + else + Rewrite (Right, + Make_Expression_With_Actions (LocR, + Expression => Relocate_Node (Right), + Actions => Actlist)); + Set_Actions (N, No_List); + Analyze_And_Resolve (Right, Standard_Boolean); + end if; + + Adjust_Result_Type (N, Typ); + return; + end if; + + -- No actions present, check for cases of right argument True/False + + if Compile_Time_Known_Value (Right) then + + -- Mark SCO for left condition as compile time known + + if Generate_SCO and then Comes_From_Source (Right) then + Set_SCO_Condition (Right, Expr_Value_E (Right) = Standard_True); + end if; + + -- Change (Left and then True), (Left or else False) to Left. + -- Note that we know there are no actions associated with the right + -- operand, since we just checked for this case above. + + if Expr_Value_E (Right) /= Shortcut_Ent then + Rewrite (N, Left); + + -- Change (Left and then False), (Left or else True) to Right, + -- making sure to preserve any side effects associated with the Left + -- operand. + + else + Remove_Side_Effects (Left); + Rewrite (N, New_Occurrence_Of (Shortcut_Ent, Loc)); + end if; + end if; + + Adjust_Result_Type (N, Typ); + end Expand_Short_Circuit_Operator; + ------------------------------------- -- Fixup_Universal_Fixed_Operation -- ------------------------------------- *************** package body Exp_Ch4 is *** 8975,8981 **** PtrT /= Etype (Defining_Unit_Name (Associated_Node_For_Itype (PtrT))) then ! Owner := Make_Defining_Identifier (Loc, New_Internal_Name ('J')); Insert_Action (N, Make_Full_Type_Declaration (Loc, Defining_Identifier => Owner, --- 9484,9490 ---- PtrT /= Etype (Defining_Unit_Name (Associated_Node_For_Itype (PtrT))) then ! Owner := Make_Temporary (Loc, 'J'); Insert_Action (N, Make_Full_Type_Declaration (Loc, Defining_Identifier => Owner, *************** package body Exp_Ch4 is *** 8999,9005 **** then Owner := Scope (Return_Applies_To (Scope (PtrT))); ! -- Case of an access discriminant, or (Ada 2005), of an anonymous -- access component or anonymous access function result: find the -- final list associated with the scope of the type. (In the -- anonymous access component kind, a list controller will have --- 9508,9514 ---- then Owner := Scope (Return_Applies_To (Scope (PtrT))); ! -- Case of an access discriminant, or (Ada 2005) of an anonymous -- access component or anonymous access function result: find the -- final list associated with the scope of the type. (In the -- anonymous access component kind, a list controller will have *************** package body Exp_Ch4 is *** 9466,9472 **** -- if ... end if; -- end Gnnn; ! Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('G')); Func_Body := Make_Subprogram_Body (Loc, --- 9975,9981 ---- -- if ... end if; -- end Gnnn; ! Func_Name := Make_Temporary (Loc, 'G'); Func_Body := Make_Subprogram_Body (Loc, *************** package body Exp_Ch4 is *** 9594,9601 **** Defining_Identifier => B, Parameter_Type => New_Reference_To (Typ, Loc))); ! Func_Name := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Set_Is_Inlined (Func_Name); Func_Body := --- 10103,10109 ---- Defining_Identifier => B, Parameter_Type => New_Reference_To (Typ, Loc))); ! Func_Name := Make_Temporary (Loc, 'A'); Set_Is_Inlined (Func_Name); Func_Body := *************** package body Exp_Ch4 is *** 9647,9653 **** -- in the call to Compile_Time_Compare. If this call results in a -- clear result of always True or Always False, that's decisive and -- we are done. Otherwise we repeat the processing with Assume_Valid ! -- set to True to generate additional warnings. We can stil that step -- if Constant_Condition_Warnings is False. for AV in False .. True loop --- 10155,10161 ---- -- in the call to Compile_Time_Compare. If this call results in a -- clear result of always True or Always False, that's decisive and -- we are done. Otherwise we repeat the processing with Assume_Valid ! -- set to True to generate additional warnings. We can skip that step -- if Constant_Condition_Warnings is False. for AV in False .. True loop *************** package body Exp_Ch4 is *** 9736,9744 **** end if; -- If this is the second iteration (AV = True), and the original ! -- node comes from source and we are not in an instance, then ! -- give a warning if we know result would be True or False. Note ! -- we know Constant_Condition_Warnings is set if we get here. elsif Comes_From_Source (Original_Node (N)) and then not In_Instance --- 10244,10252 ---- end if; -- If this is the second iteration (AV = True), and the original ! -- node comes from source and we are not in an instance, then give ! -- a warning if we know result would be True or False. Note: we ! -- know Constant_Condition_Warnings is set if we get here. elsif Comes_From_Source (Original_Node (N)) and then not In_Instance *************** package body Exp_Ch4 is *** 9756,9764 **** end; -- Skip second iteration if not warning on constant conditions or ! -- if the first iteration already generated a warning of some kind ! -- or if we are in any case assuming all values are valid (so that ! -- the first iteration took care of the valid case). exit when not Constant_Condition_Warnings; exit when Warning_Generated; --- 10264,10272 ---- end; -- Skip second iteration if not warning on constant conditions or ! -- if the first iteration already generated a warning of some kind or ! -- if we are in any case assuming all values are valid (so that the ! -- first iteration took care of the valid case). exit when not Constant_Condition_Warnings; exit when Warning_Generated; *************** package body Exp_Ch4 is *** 9825,9831 **** end if; end Is_Safe_Operand; ! -- Start of processing for Is_Safe_In_Place_Array_Op begin -- Skip this processing if the component size is different from system --- 10333,10339 ---- end if; end Is_Safe_Operand; ! -- Start of processing for Is_Safe_In_Place_Array_Op begin -- Skip this processing if the component size is different from system *************** package body Exp_Ch4 is *** 9846,9857 **** elsif not Is_Unaliased (Lhs) then return False; else Target := Entity (Lhs); ! ! return ! Is_Safe_Operand (Op1) ! and then Is_Safe_Operand (Op2); end if; end Safe_In_Place_Array_Op; --- 10354,10363 ---- elsif not Is_Unaliased (Lhs) then return False; + else Target := Entity (Lhs); ! return Is_Safe_Operand (Op1) and then Is_Safe_Operand (Op2); end if; end Safe_In_Place_Array_Op; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch4.ads gcc-4.6.0/gcc/ada/exp_ch4.ads *** gcc-4.5.2/gcc/ada/exp_ch4.ads Tue Oct 27 13:16:48 2009 --- gcc-4.6.0/gcc/ada/exp_ch4.ads Tue Oct 19 12:29:25 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Ch4 is *** 31,39 **** procedure Expand_N_Allocator (N : Node_Id); procedure Expand_N_And_Then (N : Node_Id); procedure Expand_N_Conditional_Expression (N : Node_Id); - procedure Expand_N_In (N : Node_Id); procedure Expand_N_Explicit_Dereference (N : Node_Id); procedure Expand_N_Indexed_Component (N : Node_Id); procedure Expand_N_Not_In (N : Node_Id); procedure Expand_N_Null (N : Node_Id); --- 31,40 ---- procedure Expand_N_Allocator (N : Node_Id); procedure Expand_N_And_Then (N : Node_Id); + procedure Expand_N_Case_Expression (N : Node_Id); procedure Expand_N_Conditional_Expression (N : Node_Id); procedure Expand_N_Explicit_Dereference (N : Node_Id); + procedure Expand_N_In (N : Node_Id); procedure Expand_N_Indexed_Component (N : Node_Id); procedure Expand_N_Not_In (N : Node_Id); procedure Expand_N_Null (N : Node_Id); *************** package Exp_Ch4 is *** 65,70 **** --- 66,72 ---- procedure Expand_N_Op_Xor (N : Node_Id); procedure Expand_N_Or_Else (N : Node_Id); procedure Expand_N_Qualified_Expression (N : Node_Id); + procedure Expand_N_Quantified_Expression (N : Node_Id); procedure Expand_N_Selected_Component (N : Node_Id); procedure Expand_N_Slice (N : Node_Id); procedure Expand_N_Type_Conversion (N : Node_Id); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch5.adb gcc-4.6.0/gcc/ada/exp_ch5.adb *** gcc-4.5.2/gcc/ada/exp_ch5.adb Thu Sep 17 10:54:01 2009 --- gcc-4.6.0/gcc/ada/exp_ch5.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Atree; use Atree; *** 27,34 **** with Checks; use Checks; with Debug; use Debug; with Einfo; use Einfo; - with Elists; use Elists; - with Exp_Atag; use Exp_Atag; with Exp_Aggr; use Exp_Aggr; with Exp_Ch6; use Exp_Ch6; with Exp_Ch7; use Exp_Ch7; --- 27,32 ---- *************** package body Exp_Ch5 is *** 105,119 **** -- clause (this last case is required because holes in the tagged type -- might be filled with components from child types). ! procedure Expand_Non_Function_Return (N : Node_Id); ! -- Called by Expand_N_Simple_Return_Statement in case we're returning from ! -- a procedure body, entry body, accept statement, or extended return ! -- statement. Note that all non-function returns are simple return ! -- statements. ! procedure Expand_Simple_Function_Return (N : Node_Id); ! -- 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, that --- 103,114 ---- -- clause (this last case is required because holes in the tagged type -- might be filled with components from child types). ! procedure Expand_Iterator_Loop (N : Node_Id); ! -- Expand loop over arrays and containers that uses the form "for X of C" ! -- with an optional subtype mark, or "for Y in C". ! procedure Expand_Predicated_Loop (N : Node_Id); ! -- Expand for loop over predicated subtype function Make_Tag_Ctrl_Assignment (N : Node_Id) return List_Id; -- Generate the necessary code for controlled and tagged assignment, that *************** package body Exp_Ch5 is *** 516,523 **** if Nkind (Rhs) = N_String_Literal then declare ! Temp : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('T')); Decl : Node_Id; begin --- 511,517 ---- if Nkind (Rhs) = N_String_Literal then declare ! Temp : constant Entity_Id := Make_Temporary (Loc, 'T', Rhs); Decl : Node_Id; begin *************** package body Exp_Ch5 is *** 575,589 **** -- cannot assign to elements of the array without this extra -- unchecked conversion. if Nkind (Act_Lhs) = N_Slice then Larray := Prefix (Act_Lhs); else Larray := Act_Lhs; if Is_Private_Type (Etype (Larray)) then ! Larray := ! Unchecked_Convert_To ! (Underlying_Type (Etype (Larray)), Larray); end if; end if; --- 569,591 ---- -- cannot assign to elements of the array without this extra -- unchecked conversion. + -- Note: We propagate Parent to the conversion nodes to generate + -- a well-formed subtree. + if Nkind (Act_Lhs) = N_Slice then Larray := Prefix (Act_Lhs); else Larray := Act_Lhs; if Is_Private_Type (Etype (Larray)) then ! declare ! Par : constant Node_Id := Parent (Larray); ! begin ! Larray := ! Unchecked_Convert_To ! (Underlying_Type (Etype (Larray)), Larray); ! Set_Parent (Larray, Par); ! end; end if; end if; *************** package body Exp_Ch5 is *** 593,601 **** Rarray := Act_Rhs; if Is_Private_Type (Etype (Rarray)) then ! Rarray := ! Unchecked_Convert_To ! (Underlying_Type (Etype (Rarray)), Rarray); end if; end if; --- 595,608 ---- Rarray := Act_Rhs; if Is_Private_Type (Etype (Rarray)) then ! declare ! Par : constant Node_Id := Parent (Rarray); ! begin ! Rarray := ! Unchecked_Convert_To ! (Underlying_Type (Etype (Rarray)), Rarray); ! Set_Parent (Rarray, Par); ! end; end if; end if; *************** package body Exp_Ch5 is *** 885,891 **** end if; -- Reset the Analyzed flag, because the bounds of the index ! -- type itself may be universal, and must must be reaanalyzed -- to acquire the proper type for the back end. Set_Analyzed (Cleft_Lo, False); --- 892,898 ---- end if; -- Reset the Analyzed flag, because the bounds of the index ! -- type itself may be universal, and must must be reanalyzed -- to acquire the proper type for the back end. Set_Analyzed (Cleft_Lo, False); *************** package body Exp_Ch5 is *** 1008,1013 **** --- 1015,1076 ---- F_Or_L : Name_Id; S_Or_P : Name_Id; + function Build_Step (J : Nat) return Node_Id; + -- The increment step for the index of the right-hand side is written + -- as an attribute reference (Succ or Pred). This function returns + -- the corresponding node, which is placed at the end of the loop body. + + ---------------- + -- Build_Step -- + ---------------- + + function Build_Step (J : Nat) return Node_Id is + Step : Node_Id; + Lim : Name_Id; + + begin + if Rev then + Lim := Name_First; + else + Lim := Name_Last; + end if; + + Step := + Make_Assignment_Statement (Loc, + Name => New_Occurrence_Of (Rnn (J), Loc), + Expression => + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (R_Index_Type (J), Loc), + Attribute_Name => S_Or_P, + Expressions => New_List ( + New_Occurrence_Of (Rnn (J), Loc)))); + + -- Note that on the last iteration of the loop, the index is increased + -- (or decreased) past the corresponding bound. This is consistent with + -- the C semantics of the back-end, where such an off-by-one value on a + -- dead index variable is OK. However, in CodePeer mode this leads to + -- spurious warnings, and thus we place a guard around the attribute + -- reference. For obvious reasons we only do this for CodePeer. + + if CodePeer_Mode then + Step := + Make_If_Statement (Loc, + Condition => + Make_Op_Ne (Loc, + Left_Opnd => New_Occurrence_Of (Lnn (J), Loc), + Right_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (L_Index_Type (J), Loc), + Attribute_Name => Lim)), + Then_Statements => New_List (Step)); + end if; + + return Step; + end Build_Step; + + -- Start of processing for Expand_Assign_Array_Loop + begin if Rev then F_Or_L := Name_Last; *************** package body Exp_Ch5 is *** 1028,1040 **** R_Index := First_Index (R_Type); for J in 1 .. Ndim loop ! Lnn (J) := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); ! ! Rnn (J) := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); L_Index_Type (J) := Etype (L_Index); R_Index_Type (J) := Etype (R_Index); --- 1091,1098 ---- R_Index := First_Index (R_Type); for J in 1 .. Ndim loop ! Lnn (J) := Make_Temporary (Loc, 'L'); ! Rnn (J) := Make_Temporary (Loc, 'R'); L_Index_Type (J) := Etype (L_Index); R_Index_Type (J) := Etype (R_Index); *************** package body Exp_Ch5 is *** 1109,1126 **** Discrete_Subtype_Definition => New_Reference_To (L_Index_Type (J), Loc))), ! Statements => New_List ( ! Assign, ! ! Make_Assignment_Statement (Loc, ! Name => New_Occurrence_Of (Rnn (J), Loc), ! Expression => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Occurrence_Of (R_Index_Type (J), Loc), ! Attribute_Name => S_Or_P, ! Expressions => New_List ( ! New_Occurrence_Of (Rnn (J), Loc))))))))); end loop; return Assign; --- 1167,1173 ---- Discrete_Subtype_Definition => New_Reference_To (L_Index_Type (J), Loc))), ! Statements => New_List (Assign, Build_Step (J)))))); end loop; return Assign; *************** package body Exp_Ch5 is *** 1195,1201 **** -- part expression as the switch for the generated case statement. function Make_Field_Assign ! (C : Entity_Id; U_U : Boolean := False) return Node_Id; -- Given C, the entity for a discriminant or component, build an -- assignment for the corresponding field values. The flag U_U --- 1242,1248 ---- -- part expression as the switch for the generated case statement. function Make_Field_Assign ! (C : Entity_Id; U_U : Boolean := False) return Node_Id; -- Given C, the entity for a discriminant or component, build an -- assignment for the corresponding field values. The flag U_U *************** package body Exp_Ch5 is *** 1285,1291 **** else Expr := Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Rhs), Selector_Name => Make_Identifier (Loc, Chars (Name (VP)))); end if; --- 1332,1338 ---- else Expr := Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Rhs), Selector_Name => Make_Identifier (Loc, Chars (Name (VP)))); end if; *************** package body Exp_Ch5 is *** 1304,1310 **** ----------------------- function Make_Field_Assign ! (C : Entity_Id; U_U : Boolean := False) return Node_Id is A : Node_Id; --- 1351,1357 ---- ----------------------- function Make_Field_Assign ! (C : Entity_Id; U_U : Boolean := False) return Node_Id is A : Node_Id; *************** package body Exp_Ch5 is *** 1322,1328 **** else Expr := Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Rhs), Selector_Name => New_Occurrence_Of (C, Loc)); end if; --- 1369,1375 ---- else Expr := Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Rhs), Selector_Name => New_Occurrence_Of (C, Loc)); end if; *************** package body Exp_Ch5 is *** 1330,1336 **** Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Lhs), Selector_Name => New_Occurrence_Of (Find_Component (L_Typ, C), Loc)), Expression => Expr); --- 1377,1383 ---- Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Lhs), Selector_Name => New_Occurrence_Of (Find_Component (L_Typ, C), Loc)), Expression => Expr); *************** package body Exp_Ch5 is *** 1360,1365 **** --- 1407,1413 ---- begin Item := First (CI); Result := New_List; + while Present (Item) loop -- Look for components, but exclude _tag field assignment if *************** package body Exp_Ch5 is *** 1367,1373 **** if Nkind (Item) = N_Component_Declaration and then not (Is_Tag (Defining_Identifier (Item)) ! and then Componentwise_Assignment (N)) then Append_To (Result, Make_Field_Assign (Defining_Identifier (Item))); --- 1415,1421 ---- if Nkind (Item) = N_Component_Declaration and then not (Is_Tag (Defining_Identifier (Item)) ! and then Componentwise_Assignment (N)) then Append_To (Result, Make_Field_Assign (Defining_Identifier (Item))); *************** package body Exp_Ch5 is *** 1510,1516 **** -- about complications that would other arise from X'Priority'Access, -- which is illegal, because of the lack of aliasing. ! if Ada_Version >= Ada_05 then declare Call : Node_Id; Conctyp : Entity_Id; --- 1558,1564 ---- -- about complications that would other arise from X'Priority'Access, -- which is illegal, because of the lack of aliasing. ! if Ada_Version >= Ada_2005 then declare Call : Node_Id; Conctyp : Entity_Id; *************** package body Exp_Ch5 is *** 1578,1588 **** end; end if; ! -- First deal with generation of range check if required ! if Do_Range_Check (Rhs) then ! Set_Do_Range_Check (Rhs, False); ! Generate_Range_Check (Rhs, Typ, CE_Range_Check_Failed); end if; -- Check for a special case where a high level transformation is --- 1626,1645 ---- end; end if; ! -- Deal with assignment checks unless suppressed ! if not Suppress_Assignment_Checks (N) then ! ! -- First deal with generation of range check if required ! ! if Do_Range_Check (Rhs) then ! Set_Do_Range_Check (Rhs, False); ! Generate_Range_Check (Rhs, Typ, CE_Range_Check_Failed); ! end if; ! ! -- Then generate predicate check if required ! ! Apply_Predicate_Check (Rhs, Typ); end if; -- Check for a special case where a high level transformation is *************** package body Exp_Ch5 is *** 1624,1631 **** BPAR_Expr : constant Node_Id := Relocate_Node (Prefix (Lhs)); BPAR_Typ : constant Entity_Id := Etype (BPAR_Expr); Tnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); begin -- Insert the post assignment first, because we want to copy the --- 1681,1687 ---- BPAR_Expr : constant Node_Id := Relocate_Node (Prefix (Lhs)); BPAR_Typ : constant Entity_Id := Etype (BPAR_Expr); Tnn : constant Entity_Id := ! Make_Temporary (Loc, 'T', BPAR_Expr); begin -- Insert the post assignment first, because we want to copy the *************** package body Exp_Ch5 is *** 1734,1739 **** --- 1790,1796 ---- -- has discriminants (necessarily with defaults) a check may still be -- necessary if the Lhs is aliased. The private determinants must be -- visible to build the discriminant constraints. + -- What is a "determinant"??? -- Only an explicit dereference that comes from source indicates -- aliasing. Access to formals of protected operations and entries *************** package body Exp_Ch5 is *** 1840,1846 **** -- build-in-place for user-written assignment statements (the assignment -- here came from an aggregate.) ! elsif Ada_Version >= Ada_05 and then Is_Build_In_Place_Function_Call (Rhs) then Make_Build_In_Place_Call_In_Assignment (N, Rhs); --- 1897,1903 ---- -- build-in-place for user-written assignment statements (the assignment -- here came from an aggregate.) ! elsif Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Rhs) then Make_Build_In_Place_Call_In_Assignment (N, Rhs); *************** package body Exp_Ch5 is *** 1929,1953 **** Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Lhs), Selector_Name => ! Make_Identifier (Loc, ! Chars => Name_uTag)), Right_Opnd => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Rhs), Selector_Name => ! Make_Identifier (Loc, ! Chars => Name_uTag))), Reason => CE_Tag_Check_Failed)); end if; ! Append_To (L, ! Make_Procedure_Call_Statement (Loc, ! Name => New_Reference_To (Op, Loc), ! Parameter_Associations => New_List ( ! Unchecked_Convert_To (F_Typ, ! Duplicate_Subexpr (Lhs)), ! Unchecked_Convert_To (F_Typ, ! Duplicate_Subexpr (Rhs))))); end; else --- 1986,2023 ---- Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Lhs), Selector_Name => ! Make_Identifier (Loc, Name_uTag)), Right_Opnd => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Rhs), Selector_Name => ! Make_Identifier (Loc, Name_uTag))), Reason => CE_Tag_Check_Failed)); end if; ! declare ! Left_N : Node_Id := Duplicate_Subexpr (Lhs); ! Right_N : Node_Id := Duplicate_Subexpr (Rhs); ! ! begin ! -- In order to dispatch the call to _assign the type of ! -- the actuals must match. Add conversion (if required). ! ! if Etype (Lhs) /= F_Typ then ! Left_N := Unchecked_Convert_To (F_Typ, Left_N); ! end if; ! ! if Etype (Rhs) /= F_Typ then ! Right_N := Unchecked_Convert_To (F_Typ, Right_N); ! end if; ! ! Append_To (L, ! Make_Procedure_Call_Statement (Loc, ! Name => New_Reference_To (Op, Loc), ! Parameter_Associations => New_List ( ! Node1 => Left_N, ! Node2 => Right_N))); ! end; end; else *************** package body Exp_Ch5 is *** 2399,3126 **** Adjust_Condition (Condition (N)); end Expand_N_Exit_Statement; - ---------------------------------------- - -- Expand_N_Extended_Return_Statement -- - ---------------------------------------- - - -- If there is a Handled_Statement_Sequence, we rewrite this: - - -- return Result : T := do - -- - -- end return; - - -- to be: - - -- declare - -- Result : T := ; - -- begin - -- - -- return Result; - -- end; - - -- Otherwise (no Handled_Statement_Sequence), we rewrite this: - - -- return Result : T := ; - - -- to be: - - -- return ; - - -- unless it's build-in-place or there's no , in which case - -- we generate: - - -- declare - -- Result : T := ; - -- begin - -- return Result; - -- end; - - -- Note that this case could have been written by the user as an extended - -- return statement, or could have been transformed to this from a simple - -- return statement. - - -- That is, we need to have a reified return object if there are statements - -- (which might refer to it) or if we're doing build-in-place (so we can - -- set its address to the final resting place or if there is no expression - -- (in which case default initial values might need to be set). - - procedure Expand_N_Extended_Return_Statement (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - - Return_Object_Entity : constant Entity_Id := - First_Entity (Return_Statement_Entity (N)); - Return_Object_Decl : constant Node_Id := - Parent (Return_Object_Entity); - Parent_Function : constant Entity_Id := - Return_Applies_To (Return_Statement_Entity (N)); - Parent_Function_Typ : constant Entity_Id := Etype (Parent_Function); - Is_Build_In_Place : constant Boolean := - Is_Build_In_Place_Function (Parent_Function); - - Return_Stm : Node_Id; - Statements : List_Id; - Handled_Stm_Seq : Node_Id; - Result : Node_Id; - Exp : Node_Id; - - function Has_Controlled_Parts (Typ : Entity_Id) return Boolean; - -- Determine whether type Typ is controlled or contains a controlled - -- subcomponent. - - function Move_Activation_Chain return Node_Id; - -- Construct a call to System.Tasking.Stages.Move_Activation_Chain - -- with parameters: - -- From current activation chain - -- To activation chain passed in by the caller - -- New_Master master passed in by the caller - - function Move_Final_List return Node_Id; - -- Construct call to System.Finalization_Implementation.Move_Final_List - -- with parameters: - -- - -- From finalization list of the return statement - -- To finalization list passed in by the caller - - -------------------------- - -- Has_Controlled_Parts -- - -------------------------- - - function Has_Controlled_Parts (Typ : Entity_Id) return Boolean is - begin - return - Is_Controlled (Typ) - or else Has_Controlled_Component (Typ); - end Has_Controlled_Parts; - - --------------------------- - -- Move_Activation_Chain -- - --------------------------- - - function Move_Activation_Chain return Node_Id is - Activation_Chain_Formal : constant Entity_Id := - Build_In_Place_Formal - (Parent_Function, BIP_Activation_Chain); - To : constant Node_Id := - New_Reference_To - (Activation_Chain_Formal, Loc); - Master_Formal : constant Entity_Id := - Build_In_Place_Formal - (Parent_Function, BIP_Master); - New_Master : constant Node_Id := - New_Reference_To (Master_Formal, Loc); - - Chain_Entity : Entity_Id; - From : Node_Id; - - begin - Chain_Entity := First_Entity (Return_Statement_Entity (N)); - while Chars (Chain_Entity) /= Name_uChain loop - Chain_Entity := Next_Entity (Chain_Entity); - end loop; - - From := - Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Chain_Entity, Loc), - Attribute_Name => Name_Unrestricted_Access); - -- ??? Not clear why "Make_Identifier (Loc, Name_uChain)" doesn't - -- work, instead of "New_Reference_To (Chain_Entity, Loc)" above. - - return - Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To (RTE (RE_Move_Activation_Chain), Loc), - Parameter_Associations => New_List (From, To, New_Master)); - end Move_Activation_Chain; - - --------------------- - -- Move_Final_List -- - --------------------- - - function Move_Final_List return Node_Id is - Flist : constant Entity_Id := - Finalization_Chain_Entity (Return_Statement_Entity (N)); - - From : constant Node_Id := New_Reference_To (Flist, Loc); - - Caller_Final_List : constant Entity_Id := - Build_In_Place_Formal - (Parent_Function, BIP_Final_List); - - To : constant Node_Id := New_Reference_To (Caller_Final_List, Loc); - - begin - -- Catch cases where a finalization chain entity has not been - -- associated with the return statement entity. - - pragma Assert (Present (Flist)); - - -- Build required call - - return - Make_If_Statement (Loc, - Condition => - Make_Op_Ne (Loc, - Left_Opnd => New_Copy (From), - Right_Opnd => New_Node (N_Null, Loc)), - Then_Statements => - New_List ( - Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To (RTE (RE_Move_Final_List), Loc), - Parameter_Associations => New_List (From, To)))); - end Move_Final_List; - - -- Start of processing for Expand_N_Extended_Return_Statement - - begin - if Nkind (Return_Object_Decl) = N_Object_Declaration then - Exp := Expression (Return_Object_Decl); - else - Exp := Empty; - end if; - - Handled_Stm_Seq := Handled_Statement_Sequence (N); - - -- Build a simple_return_statement that returns the return object when - -- there is a statement sequence, or no expression, or the result will - -- be built in place. Note however that we currently do this for all - -- composite cases, even though nonlimited composite results are not yet - -- built in place (though we plan to do so eventually). - - if Present (Handled_Stm_Seq) - or else Is_Composite_Type (Etype (Parent_Function)) - or else No (Exp) - then - if No (Handled_Stm_Seq) then - Statements := New_List; - - -- If the extended return has a handled statement sequence, then wrap - -- it in a block and use the block as the first statement. - - else - Statements := - New_List (Make_Block_Statement (Loc, - Declarations => New_List, - Handled_Statement_Sequence => Handled_Stm_Seq)); - end if; - - -- If control gets past the above Statements, we have successfully - -- completed the return statement. If the result type has controlled - -- parts and the return is for a build-in-place function, then we - -- call Move_Final_List to transfer responsibility for finalization - -- of the return object to the caller. An alternative would be to - -- declare a Success flag in the function, initialize it to False, - -- and set it to True here. Then move the Move_Final_List call into - -- the cleanup code, and check Success. If Success then make a call - -- to Move_Final_List else do finalization. Then we can remove the - -- abort-deferral and the nulling-out of the From parameter from - -- Move_Final_List. Note that the current method is not quite correct - -- in the rather obscure case of a select-then-abort statement whose - -- abortable part contains the return statement. - - -- Check the type of the function to determine whether to move the - -- finalization list. A special case arises when processing a simple - -- return statement which has been rewritten as an extended return. - -- In that case check the type of the returned object or the original - -- expression. - - if Is_Build_In_Place - and then - (Has_Controlled_Parts (Parent_Function_Typ) - or else (Is_Class_Wide_Type (Parent_Function_Typ) - and then - Has_Controlled_Parts (Root_Type (Parent_Function_Typ))) - or else Has_Controlled_Parts (Etype (Return_Object_Entity)) - or else (Present (Exp) - and then Has_Controlled_Parts (Etype (Exp)))) - then - Append_To (Statements, Move_Final_List); - end if; - - -- Similarly to the above Move_Final_List, if the result type - -- contains tasks, we call Move_Activation_Chain. Later, the cleanup - -- code will call Complete_Master, which will terminate any - -- unactivated tasks belonging to the return statement master. But - -- Move_Activation_Chain updates their master to be that of the - -- caller, so they will not be terminated unless the return statement - -- completes unsuccessfully due to exception, abort, goto, or exit. - -- As a formality, we test whether the function requires the result - -- to be built in place, though that's necessarily true for the case - -- of result types with task parts. - - if Is_Build_In_Place and Has_Task (Etype (Parent_Function)) then - Append_To (Statements, Move_Activation_Chain); - end if; - - -- Build a simple_return_statement that returns the return object - - Return_Stm := - Make_Simple_Return_Statement (Loc, - Expression => New_Occurrence_Of (Return_Object_Entity, Loc)); - Append_To (Statements, Return_Stm); - - Handled_Stm_Seq := - Make_Handled_Sequence_Of_Statements (Loc, Statements); - end if; - - -- Case where we build a block - - if Present (Handled_Stm_Seq) then - Result := - Make_Block_Statement (Loc, - Declarations => Return_Object_Declarations (N), - Handled_Statement_Sequence => Handled_Stm_Seq); - - -- We set the entity of the new block statement to be that of the - -- return statement. This is necessary so that various fields, such - -- as Finalization_Chain_Entity carry over from the return statement - -- to the block. Note that this block is unusual, in that its entity - -- is an E_Return_Statement rather than an E_Block. - - Set_Identifier - (Result, New_Occurrence_Of (Return_Statement_Entity (N), Loc)); - - -- If the object decl was already rewritten as a renaming, then - -- we don't want to do the object allocation and transformation of - -- of the return object declaration to a renaming. This case occurs - -- when the return object is initialized by a call to another - -- build-in-place function, and that function is responsible for the - -- allocation of the return object. - - if Is_Build_In_Place - and then - Nkind (Return_Object_Decl) = N_Object_Renaming_Declaration - then - pragma Assert (Nkind (Original_Node (Return_Object_Decl)) = - N_Object_Declaration - and then Is_Build_In_Place_Function_Call - (Expression (Original_Node (Return_Object_Decl)))); - - Set_By_Ref (Return_Stm); -- Return build-in-place results by ref - - elsif Is_Build_In_Place then - - -- Locate the implicit access parameter associated with the - -- caller-supplied return object and convert the return - -- statement's return object declaration to a renaming of a - -- dereference of the access parameter. If the return object's - -- declaration includes an expression that has not already been - -- expanded as separate assignments, then add an assignment - -- statement to ensure the return object gets initialized. - - -- declare - -- Result : T [:= ]; - -- begin - -- ... - - -- is converted to - - -- declare - -- Result : T renames FuncRA.all; - -- [Result := New_Reference_To (Return_Obj_Id, Loc), - Expression => Relocate_Node (Return_Obj_Expr)); - Set_Etype (Name (Init_Assignment), Etype (Return_Obj_Id)); - Set_Assignment_OK (Name (Init_Assignment)); - Set_No_Ctrl_Actions (Init_Assignment); - - Set_Parent (Name (Init_Assignment), Init_Assignment); - Set_Parent (Expression (Init_Assignment), Init_Assignment); - - Set_Expression (Return_Object_Decl, Empty); - - if Is_Class_Wide_Type (Etype (Return_Obj_Id)) - and then not Is_Class_Wide_Type - (Etype (Expression (Init_Assignment))) - then - Rewrite (Expression (Init_Assignment), - Make_Type_Conversion (Loc, - Subtype_Mark => - New_Occurrence_Of - (Etype (Return_Obj_Id), Loc), - Expression => - Relocate_Node (Expression (Init_Assignment)))); - end if; - - -- In the case of functions where the calling context can - -- determine the form of allocation needed, initialization - -- is done with each part of the if statement that handles - -- the different forms of allocation (this is true for - -- unconstrained and tagged result subtypes). - - if Constr_Result - and then not Is_Tagged_Type (Underlying_Type (Result_Subt)) - then - Insert_After (Return_Object_Decl, Init_Assignment); - end if; - end if; - - -- When the function's subtype is unconstrained, a run-time - -- test is needed to determine the form of allocation to use - -- for the return object. The function has an implicit formal - -- parameter indicating this. If the BIP_Alloc_Form formal has - -- the value one, then the caller has passed access to an - -- existing object for use as the return object. If the value - -- is two, then the return object must be allocated on the - -- secondary stack. Otherwise, the object must be allocated in - -- a storage pool (currently only supported for the global - -- heap, user-defined storage pools TBD ???). We generate an - -- if statement to test the implicit allocation formal and - -- initialize a local access value appropriately, creating - -- allocators in the secondary stack and global heap cases. - -- The special formal also exists and must be tested when the - -- function has a tagged result, even when the result subtype - -- is constrained, because in general such functions can be - -- called in dispatching contexts and must be handled similarly - -- to functions with a class-wide result. - - if not Constr_Result - or else Is_Tagged_Type (Underlying_Type (Result_Subt)) - then - Obj_Alloc_Formal := - Build_In_Place_Formal (Parent_Function, BIP_Alloc_Form); - - declare - Ref_Type : Entity_Id; - Ptr_Type_Decl : Node_Id; - Alloc_Obj_Id : Entity_Id; - Alloc_Obj_Decl : Node_Id; - Alloc_If_Stmt : Node_Id; - SS_Allocator : Node_Id; - Heap_Allocator : Node_Id; - - begin - -- Reuse the itype created for the function's implicit - -- access formal. This avoids the need to create a new - -- access type here, plus it allows assigning the access - -- formal directly without applying a conversion. - - -- Ref_Type := Etype (Object_Access); - - -- Create an access type designating the function's - -- result subtype. - - Ref_Type := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - - Ptr_Type_Decl := - Make_Full_Type_Declaration (Loc, - Defining_Identifier => Ref_Type, - Type_Definition => - Make_Access_To_Object_Definition (Loc, - All_Present => True, - Subtype_Indication => - New_Reference_To (Return_Obj_Typ, Loc))); - - Insert_Before (Return_Object_Decl, Ptr_Type_Decl); - - -- Create an access object that will be initialized to an - -- access value denoting the return object, either coming - -- from an implicit access value passed in by the caller - -- or from the result of an allocator. - - Alloc_Obj_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('R')); - Set_Etype (Alloc_Obj_Id, Ref_Type); - - Alloc_Obj_Decl := - Make_Object_Declaration (Loc, - Defining_Identifier => Alloc_Obj_Id, - Object_Definition => New_Reference_To - (Ref_Type, Loc)); - - Insert_Before (Return_Object_Decl, Alloc_Obj_Decl); - - -- Create allocators for both the secondary stack and - -- global heap. If there's an initialization expression, - -- then create these as initialized allocators. - - if Present (Return_Obj_Expr) - and then not No_Initialization (Return_Object_Decl) - then - -- Always use the type of the expression for the - -- qualified expression, rather than the result type. - -- In general we cannot always use the result type - -- for the allocator, because the expression might be - -- of a specific type, such as in the case of an - -- aggregate or even a nonlimited object when the - -- result type is a limited class-wide interface type. - - Heap_Allocator := - Make_Allocator (Loc, - Expression => - Make_Qualified_Expression (Loc, - Subtype_Mark => - New_Reference_To - (Etype (Return_Obj_Expr), Loc), - Expression => - New_Copy_Tree (Return_Obj_Expr))); - - else - -- If the function returns a class-wide type we cannot - -- use the return type for the allocator. Instead we - -- use the type of the expression, which must be an - -- aggregate of a definite type. - - if Is_Class_Wide_Type (Return_Obj_Typ) then - Heap_Allocator := - Make_Allocator (Loc, - Expression => - New_Reference_To - (Etype (Return_Obj_Expr), Loc)); - else - Heap_Allocator := - Make_Allocator (Loc, - Expression => - New_Reference_To (Return_Obj_Typ, Loc)); - end if; - - -- If the object requires default initialization then - -- that will happen later following the elaboration of - -- the object renaming. If we don't turn it off here - -- then the object will be default initialized twice. - - Set_No_Initialization (Heap_Allocator); - end if; - - -- If the No_Allocators restriction is active, then only - -- an allocator for secondary stack allocation is needed. - -- It's OK for such allocators to have Comes_From_Source - -- set to False, because gigi knows not to flag them as - -- being a violation of No_Implicit_Heap_Allocations. - - if Restriction_Active (No_Allocators) then - SS_Allocator := Heap_Allocator; - Heap_Allocator := Make_Null (Loc); - - -- Otherwise the heap allocator may be needed, so we make - -- another allocator for secondary stack allocation. - - else - SS_Allocator := New_Copy_Tree (Heap_Allocator); - - -- The heap allocator is marked Comes_From_Source - -- since it corresponds to an explicit user-written - -- allocator (that is, it will only be executed on - -- behalf of callers that call the function as - -- initialization for such an allocator). This - -- prevents errors when No_Implicit_Heap_Allocations - -- is in force. - - Set_Comes_From_Source (Heap_Allocator, True); - end if; - - -- The allocator is returned on the secondary stack. We - -- don't do this on VM targets, since the SS is not used. - - if VM_Target = No_VM then - Set_Storage_Pool (SS_Allocator, RTE (RE_SS_Pool)); - Set_Procedure_To_Call - (SS_Allocator, RTE (RE_SS_Allocate)); - - -- The allocator is returned on the secondary stack, - -- so indicate that the function return, as well as - -- the block that encloses the allocator, must not - -- release it. The flags must be set now because the - -- decision to use the secondary stack is done very - -- late in the course of expanding the return - -- statement, past the point where these flags are - -- normally set. - - Set_Sec_Stack_Needed_For_Return (Parent_Function); - Set_Sec_Stack_Needed_For_Return - (Return_Statement_Entity (N)); - Set_Uses_Sec_Stack (Parent_Function); - Set_Uses_Sec_Stack (Return_Statement_Entity (N)); - end if; - - -- Create an if statement to test the BIP_Alloc_Form - -- formal and initialize the access object to either the - -- BIP_Object_Access formal (BIP_Alloc_Form = 0), the - -- result of allocating the object in the secondary stack - -- (BIP_Alloc_Form = 1), or else an allocator to create - -- the return object in the heap (BIP_Alloc_Form = 2). - - -- ??? An unchecked type conversion must be made in the - -- case of assigning the access object formal to the - -- local access object, because a normal conversion would - -- be illegal in some cases (such as converting access- - -- to-unconstrained to access-to-constrained), but the - -- the unchecked conversion will presumably fail to work - -- right in just such cases. It's not clear at all how to - -- handle this. ??? - - Alloc_If_Stmt := - Make_If_Statement (Loc, - Condition => - Make_Op_Eq (Loc, - Left_Opnd => - New_Reference_To (Obj_Alloc_Formal, Loc), - Right_Opnd => - Make_Integer_Literal (Loc, - UI_From_Int (BIP_Allocation_Form'Pos - (Caller_Allocation)))), - Then_Statements => - New_List (Make_Assignment_Statement (Loc, - Name => - New_Reference_To - (Alloc_Obj_Id, Loc), - Expression => - Make_Unchecked_Type_Conversion (Loc, - Subtype_Mark => - New_Reference_To (Ref_Type, Loc), - Expression => - New_Reference_To - (Object_Access, Loc)))), - Elsif_Parts => - New_List (Make_Elsif_Part (Loc, - Condition => - Make_Op_Eq (Loc, - Left_Opnd => - New_Reference_To - (Obj_Alloc_Formal, Loc), - Right_Opnd => - Make_Integer_Literal (Loc, - UI_From_Int ( - BIP_Allocation_Form'Pos - (Secondary_Stack)))), - Then_Statements => - New_List - (Make_Assignment_Statement (Loc, - Name => - New_Reference_To - (Alloc_Obj_Id, Loc), - Expression => - SS_Allocator)))), - Else_Statements => - New_List (Make_Assignment_Statement (Loc, - Name => - New_Reference_To - (Alloc_Obj_Id, Loc), - Expression => - Heap_Allocator))); - - -- If a separate initialization assignment was created - -- earlier, append that following the assignment of the - -- implicit access formal to the access object, to ensure - -- that the return object is initialized in that case. - -- In this situation, the target of the assignment must - -- be rewritten to denote a dereference of the access to - -- the return object passed in by the caller. - - if Present (Init_Assignment) then - Rewrite (Name (Init_Assignment), - Make_Explicit_Dereference (Loc, - Prefix => New_Reference_To (Alloc_Obj_Id, Loc))); - Set_Etype - (Name (Init_Assignment), Etype (Return_Obj_Id)); - - Append_To - (Then_Statements (Alloc_If_Stmt), - Init_Assignment); - end if; - - Insert_Before (Return_Object_Decl, Alloc_If_Stmt); - - -- Remember the local access object for use in the - -- dereference of the renaming created below. - - Object_Access := Alloc_Obj_Id; - end; - end if; - - -- Replace the return object declaration with a renaming of a - -- dereference of the access value designating the return - -- object. - - Obj_Acc_Deref := - Make_Explicit_Dereference (Loc, - Prefix => New_Reference_To (Object_Access, Loc)); - - Rewrite (Return_Object_Decl, - Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Return_Obj_Id, - Access_Definition => Empty, - Subtype_Mark => New_Occurrence_Of - (Return_Obj_Typ, Loc), - Name => Obj_Acc_Deref)); - - Set_Renamed_Object (Return_Obj_Id, Obj_Acc_Deref); - end; - end if; - - -- Case where we do not build a block - - else - -- We're about to drop Return_Object_Declarations on the floor, so - -- we need to insert it, in case it got expanded into useful code. - - Insert_List_Before (N, Return_Object_Declarations (N)); - - -- Build simple_return_statement that returns the expression directly - - Return_Stm := Make_Simple_Return_Statement (Loc, Expression => Exp); - - Result := Return_Stm; - end if; - - -- Set the flag to prevent infinite recursion - - Set_Comes_From_Extended_Return_Statement (Return_Stm); - - Rewrite (N, Result); - Analyze (N); - end Expand_N_Extended_Return_Statement; - ----------------------------- -- Expand_N_Goto_Statement -- ----------------------------- --- 2469,2474 ---- *************** package body Exp_Ch5 is *** 3409,3414 **** --- 2757,2963 ---- end if; end Expand_N_If_Statement; + -------------------------- + -- Expand_Iterator_Loop -- + -------------------------- + + procedure Expand_Iterator_Loop (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + Isc : constant Node_Id := Iteration_Scheme (N); + I_Spec : constant Node_Id := Iterator_Specification (Isc); + Id : constant Entity_Id := Defining_Identifier (I_Spec); + Container : constant Entity_Id := Entity (Name (I_Spec)); + Typ : constant Entity_Id := Etype (Container); + + Cursor : Entity_Id; + New_Loop : Node_Id; + Stats : List_Id; + + begin + if Is_Array_Type (Typ) then + if Of_Present (I_Spec) then + Cursor := Make_Temporary (Loc, 'C'); + + -- for Elem of Arr loop ... + + declare + Decl : constant Node_Id := + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Id, + Subtype_Mark => + New_Occurrence_Of (Component_Type (Typ), Loc), + Name => + Make_Indexed_Component (Loc, + Prefix => + New_Occurrence_Of (Container, Loc), + Expressions => + New_List (New_Occurrence_Of (Cursor, Loc)))); + begin + Stats := Statements (N); + Prepend (Decl, Stats); + + New_Loop := + Make_Loop_Statement (Loc, + Iteration_Scheme => + Make_Iteration_Scheme (Loc, + Loop_Parameter_Specification => + Make_Loop_Parameter_Specification (Loc, + Defining_Identifier => Cursor, + Discrete_Subtype_Definition => + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Container, Loc), + Attribute_Name => Name_Range), + Reverse_Present => Reverse_Present (I_Spec))), + Statements => Stats, + End_Label => Empty); + end; + + else + -- for Index in Array loop ... + + -- The cursor (index into the array) is the source Id + + Cursor := Id; + New_Loop := + Make_Loop_Statement (Loc, + Iteration_Scheme => + Make_Iteration_Scheme (Loc, + Loop_Parameter_Specification => + Make_Loop_Parameter_Specification (Loc, + Defining_Identifier => Cursor, + Discrete_Subtype_Definition => + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Container, Loc), + Attribute_Name => Name_Range), + Reverse_Present => Reverse_Present (I_Spec))), + Statements => Statements (N), + End_Label => Empty); + end if; + + -- Iterators over containers + + else + -- In both cases these require a cursor of the proper type + + -- Cursor : P.Cursor_Type := Container.First; + -- while Cursor /= P.No_Element loop + + -- Obj : P.Element_Type renames Element (Cursor); + -- -- For the "of" form, the element name renames the element + -- -- designated by the cursor. + + -- Statements; + -- P.Next (Cursor); + -- end loop; + + -- with the obvious replacements if "reverse" is specified. + + declare + Element_Type : constant Entity_Id := Etype (Id); + Pack : constant Entity_Id := Scope (Etype (Container)); + Name_Init : Name_Id; + Name_Step : Name_Id; + Cond : Node_Id; + Cursor_Decl : Node_Id; + Renaming_Decl : Node_Id; + + begin + Stats := Statements (N); + + if Of_Present (I_Spec) then + Cursor := Make_Temporary (Loc, 'C'); + else + Cursor := Id; + end if; + + if Reverse_Present (I_Spec) then + + -- Must verify that the container has a reverse iterator ??? + + Name_Init := Name_Last; + Name_Step := Name_Previous; + + else + Name_Init := Name_First; + Name_Step := Name_Next; + end if; + + -- C : Cursor_Type := Container.First; + + Cursor_Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Cursor, + Object_Definition => + Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Pack, Loc), + Selector_Name => Make_Identifier (Loc, Name_Cursor)), + Expression => + Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Container, Loc), + Selector_Name => Make_Identifier (Loc, Name_Init))); + + Insert_Action (N, Cursor_Decl); + + -- while C /= No_Element loop + + Cond := Make_Op_Ne (Loc, + Left_Opnd => New_Occurrence_Of (Cursor, Loc), + Right_Opnd => Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Pack, Loc), + Selector_Name => + Make_Identifier (Loc, Name_No_Element))); + + if Of_Present (I_Spec) then + + -- Id : Element_Type renames Pack.Element (Cursor); + + Renaming_Decl := + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Id, + Subtype_Mark => + New_Occurrence_Of (Element_Type, Loc), + Name => + Make_Indexed_Component (Loc, + Prefix => + Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Pack, Loc), + Selector_Name => + Make_Identifier (Loc, Chars => Name_Element)), + Expressions => + New_List (New_Occurrence_Of (Cursor, Loc)))); + + Prepend (Renaming_Decl, Stats); + end if; + + -- For both iterator forms, add call to step operation (Next or + -- Previous) to advance cursor. + + Append_To (Stats, + Make_Procedure_Call_Statement (Loc, + Name => + Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Pack, Loc), + Selector_Name => Make_Identifier (Loc, Name_Step)), + Parameter_Associations => + New_List (New_Occurrence_Of (Cursor, Loc)))); + + New_Loop := Make_Loop_Statement (Loc, + Iteration_Scheme => + Make_Iteration_Scheme (Loc, Condition => Cond), + Statements => Stats, + End_Label => Empty); + end; + end if; + + -- Set_Analyzed (I_Spec); + -- Why is this commented out??? + + Rewrite (N, New_Loop); + Analyze (N); + end Expand_Iterator_Loop; + ----------------------------- -- Expand_N_Loop_Statement -- ----------------------------- *************** package body Exp_Ch5 is *** 3417,3423 **** -- 2. Deal with while condition for C/Fortran boolean -- 3. Deal with loops with a non-standard enumeration type range -- 4. Deal with while loops where Condition_Actions is set ! -- 5. Insert polling call if required procedure Expand_N_Loop_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); --- 2966,2974 ---- -- 2. Deal with while condition for C/Fortran boolean -- 3. Deal with loops with a non-standard enumeration type range -- 4. Deal with while loops where Condition_Actions is set ! -- 5. Deal with loops over predicated subtypes ! -- 6. Deal with loops with iterators over arrays and containers ! -- 7. Insert polling call if required procedure Expand_N_Loop_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); *************** package body Exp_Ch5 is *** 3446,3478 **** -- Nothing more to do for plain loop with no iteration scheme if No (Isc) then ! return; ! end if; -- Note: we do not have to worry about validity checking of the for loop -- range bounds here, since they were frozen with constant declarations -- and it is during that process that the validity checking is done. ! -- Handle the case where we have a for loop with the range type being an ! -- enumeration type with non-standard representation. In this case we ! -- expand: ! ! -- for x in [reverse] a .. b loop ! -- ... ! -- end loop; ! ! -- to ! ! -- for xP in [reverse] integer ! -- range etype'Pos (a) .. etype'Pos (b) loop ! -- declare ! -- x : constant etype := Pos_To_Rep (xP); ! -- begin ! -- ... ! -- end; ! -- end loop; ! ! if Present (Loop_Parameter_Specification (Isc)) then declare LPS : constant Node_Id := Loop_Parameter_Specification (Isc); Loop_Id : constant Entity_Id := Defining_Identifier (LPS); --- 2997,3011 ---- -- Nothing more to do for plain loop with no iteration scheme if No (Isc) then ! null; ! ! -- Case of for loop (Loop_Parameter_Specification present) -- Note: we do not have to worry about validity checking of the for loop -- range bounds here, since they were frozen with constant declarations -- and it is during that process that the validity checking is done. ! elsif Present (Loop_Parameter_Specification (Isc)) then declare LPS : constant Node_Id := Loop_Parameter_Specification (Isc); Loop_Id : constant Entity_Id := Defining_Identifier (LPS); *************** package body Exp_Ch5 is *** 3482,3576 **** New_Id : Entity_Id; begin ! if not Is_Enumeration_Type (Btype) ! or else No (Enum_Pos_To_Rep (Btype)) then ! return; ! end if; ! New_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Loop_Id), 'P')); ! -- If the type has a contiguous representation, successive values ! -- can be generated as offsets from the first literal. ! if Has_Contiguous_Rep (Btype) then ! Expr := ! Unchecked_Convert_To (Btype, ! Make_Op_Add (Loc, ! Left_Opnd => ! Make_Integer_Literal (Loc, ! Enumeration_Rep (First_Literal (Btype))), ! Right_Opnd => New_Reference_To (New_Id, Loc))); ! else ! -- Use the constructed array Enum_Pos_To_Rep ! Expr := ! Make_Indexed_Component (Loc, ! Prefix => New_Reference_To (Enum_Pos_To_Rep (Btype), Loc), ! Expressions => New_List (New_Reference_To (New_Id, Loc))); ! end if; ! Rewrite (N, ! Make_Loop_Statement (Loc, ! Identifier => Identifier (N), ! Iteration_Scheme => ! Make_Iteration_Scheme (Loc, ! Loop_Parameter_Specification => ! Make_Loop_Parameter_Specification (Loc, ! Defining_Identifier => New_Id, ! Reverse_Present => Reverse_Present (LPS), ! Discrete_Subtype_Definition => ! Make_Subtype_Indication (Loc, ! Subtype_Mark => ! New_Reference_To (Standard_Natural, Loc), ! Constraint => ! Make_Range_Constraint (Loc, ! Range_Expression => ! Make_Range (Loc, ! Low_Bound => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Reference_To (Btype, Loc), ! Attribute_Name => Name_Pos, ! Expressions => New_List ( ! Relocate_Node ! (Type_Low_Bound (Ltype)))), ! High_Bound => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Reference_To (Btype, Loc), ! Attribute_Name => Name_Pos, ! Expressions => New_List ( ! Relocate_Node ! (Type_High_Bound (Ltype))))))))), ! Statements => New_List ( ! Make_Block_Statement (Loc, ! Declarations => New_List ( ! Make_Object_Declaration (Loc, ! Defining_Identifier => Loop_Id, ! Constant_Present => True, ! Object_Definition => New_Reference_To (Ltype, Loc), ! Expression => Expr)), ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => Statements (N)))), ! End_Label => End_Label (N))); ! Analyze (N); end; -- Second case, if we have a while loop with Condition_Actions set, then --- 3015,3143 ---- New_Id : Entity_Id; begin ! -- Deal with loop over predicates ! ! if Is_Discrete_Type (Ltype) ! and then Present (Predicate_Function (Ltype)) then ! Expand_Predicated_Loop (N); ! -- Handle the case where we have a for loop with the range type ! -- being an enumeration type with non-standard representation. ! -- In this case we expand: ! -- for x in [reverse] a .. b loop ! -- ... ! -- end loop; ! -- to ! -- for xP in [reverse] integer ! -- range etype'Pos (a) .. etype'Pos (b) ! -- loop ! -- declare ! -- x : constant etype := Pos_To_Rep (xP); ! -- begin ! -- ... ! -- end; ! -- end loop; ! elsif Is_Enumeration_Type (Btype) ! and then Present (Enum_Pos_To_Rep (Btype)) ! then ! New_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Loop_Id), 'P')); ! -- If the type has a contiguous representation, successive ! -- values can be generated as offsets from the first literal. ! if Has_Contiguous_Rep (Btype) then ! Expr := ! Unchecked_Convert_To (Btype, ! Make_Op_Add (Loc, ! Left_Opnd => ! Make_Integer_Literal (Loc, ! Enumeration_Rep (First_Literal (Btype))), ! Right_Opnd => New_Reference_To (New_Id, Loc))); ! else ! -- Use the constructed array Enum_Pos_To_Rep ! Expr := ! Make_Indexed_Component (Loc, ! Prefix => ! New_Reference_To (Enum_Pos_To_Rep (Btype), Loc), ! Expressions => ! New_List (New_Reference_To (New_Id, Loc))); ! end if; ! Rewrite (N, ! Make_Loop_Statement (Loc, ! Identifier => Identifier (N), ! Iteration_Scheme => ! Make_Iteration_Scheme (Loc, ! Loop_Parameter_Specification => ! Make_Loop_Parameter_Specification (Loc, ! Defining_Identifier => New_Id, ! Reverse_Present => Reverse_Present (LPS), ! Discrete_Subtype_Definition => ! Make_Subtype_Indication (Loc, ! Subtype_Mark => ! New_Reference_To (Standard_Natural, Loc), ! Constraint => ! Make_Range_Constraint (Loc, ! Range_Expression => ! Make_Range (Loc, ! Low_Bound => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Reference_To (Btype, Loc), ! Attribute_Name => Name_Pos, ! Expressions => New_List ( ! Relocate_Node ! (Type_Low_Bound (Ltype)))), ! High_Bound => ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Reference_To (Btype, Loc), ! Attribute_Name => Name_Pos, ! ! Expressions => New_List ( ! Relocate_Node ! (Type_High_Bound ! (Ltype))))))))), ! ! Statements => New_List ( ! Make_Block_Statement (Loc, ! Declarations => New_List ( ! Make_Object_Declaration (Loc, ! Defining_Identifier => Loop_Id, ! Constant_Present => True, ! Object_Definition => ! New_Reference_To (Ltype, Loc), ! Expression => Expr)), ! ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => Statements (N)))), ! ! End_Label => End_Label (N))); ! Analyze (N); ! ! -- Nothing to do with other cases of for loops ! ! else ! null; ! end if; end; -- Second case, if we have a while loop with Condition_Actions set, then *************** package body Exp_Ch5 is *** 3617,4353 **** Analyze (N); end; - end if; - end Expand_N_Loop_Statement; ! -------------------------------------- ! -- Expand_N_Simple_Return_Statement -- ! -------------------------------------- ! ! procedure Expand_N_Simple_Return_Statement (N : Node_Id) is ! begin ! -- Defend against previous errors (i.e. 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 ! ! when E_Function | ! E_Generic_Function => ! Expand_Simple_Function_Return (N); ! ! when E_Procedure | ! E_Generic_Procedure | ! E_Entry | ! E_Entry_Family | ! E_Return_Statement => ! Expand_Non_Function_Return (N); ! ! when others => ! raise Program_Error; ! end case; ! ! exception ! when RE_Not_Available => ! return; ! end Expand_N_Simple_Return_Statement; ! ! -------------------------------- ! -- Expand_Non_Function_Return -- ! -------------------------------- ! procedure Expand_Non_Function_Return (N : Node_Id) is ! pragma Assert (No (Expression (N))); ! Loc : constant Source_Ptr := Sloc (N); ! Scope_Id : Entity_Id := ! Return_Applies_To (Return_Statement_Entity (N)); ! Kind : constant Entity_Kind := Ekind (Scope_Id); ! Call : Node_Id; ! Acc_Stat : Node_Id; ! Goto_Stat : Node_Id; ! Lab_Node : Node_Id; begin ! -- Call _Postconditions procedure if procedure with active ! -- postconditions. Here, we use the Postcondition_Proc attribute, which ! -- is needed for implicitly-generated returns. Functions never ! -- have implicitly-generated returns, and there's no room for ! -- Postcondition_Proc in E_Function, so we look up the identifier ! -- Name_uPostconditions for function returns (see ! -- Expand_Simple_Function_Return). ! ! if Ekind (Scope_Id) = E_Procedure ! and then Has_Postconditions (Scope_Id) ! then ! pragma Assert (Present (Postcondition_Proc (Scope_Id))); ! Insert_Action (N, ! Make_Procedure_Call_Statement (Loc, ! Name => New_Reference_To (Postcondition_Proc (Scope_Id), Loc))); ! 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 ! return; ! ! -- If it is a nested return within an extended one, replace it with a ! -- return of the previously declared return object. ! ! elsif Kind = E_Return_Statement then ! Rewrite (N, ! Make_Simple_Return_Statement (Loc, ! Expression => ! New_Occurrence_Of (First_Entity (Scope_Id), Loc))); ! Set_Comes_From_Extended_Return_Statement (N); ! Set_Return_Statement_Entity (N, Scope_Id); ! Expand_Simple_Function_Return (N); ! return; ! end if; ! ! pragma Assert (Is_Entry (Scope_Id)); ! ! -- Look at the enclosing block to see whether the return is from an ! -- accept statement or an entry body. ! ! for J in reverse 0 .. Scope_Stack.Last loop ! Scope_Id := Scope_Stack.Table (J).Entity; ! exit when Is_Concurrent_Type (Scope_Id); ! end loop; ! ! -- If it is a return from accept statement it is expanded as call to ! -- RTS Complete_Rendezvous and a goto to the end of the accept body. ! ! -- (cf : Expand_N_Accept_Statement, Expand_N_Selective_Accept, ! -- Expand_N_Accept_Alternative in exp_ch9.adb) ! ! if Is_Task_Type (Scope_Id) then ! ! Call := ! Make_Procedure_Call_Statement (Loc, ! Name => New_Reference_To (RTE (RE_Complete_Rendezvous), Loc)); ! Insert_Before (N, Call); ! -- why not insert actions here??? ! Analyze (Call); ! ! Acc_Stat := Parent (N); ! while Nkind (Acc_Stat) /= N_Accept_Statement loop ! Acc_Stat := Parent (Acc_Stat); ! end loop; ! ! Lab_Node := Last (Statements ! (Handled_Statement_Sequence (Acc_Stat))); ! Goto_Stat := Make_Goto_Statement (Loc, ! Name => New_Occurrence_Of ! (Entity (Identifier (Lab_Node)), Loc)); ! Set_Analyzed (Goto_Stat); ! Rewrite (N, Goto_Stat); Analyze (N); ! -- If it is a return from an entry body, put a Complete_Entry_Body call ! -- in front of the return. ! ! 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, ! Prefix => ! New_Reference_To ! (Find_Protection_Object (Current_Scope), Loc), ! Attribute_Name => ! Name_Unchecked_Access))); ! ! Insert_Before (N, Call); ! Analyze (Call); ! end if; ! end Expand_Non_Function_Return; ! ! ----------------------------------- ! -- Expand_Simple_Function_Return -- ! ----------------------------------- ! ! -- The "simple" comes from the syntax rule simple_return_statement. ! -- The semantics are not at all simple! ! ! procedure Expand_Simple_Function_Return (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! ! Scope_Id : constant Entity_Id := ! Return_Applies_To (Return_Statement_Entity (N)); ! -- The function we are returning from ! ! R_Type : constant Entity_Id := Etype (Scope_Id); ! -- The result type of the function ! ! Utyp : constant Entity_Id := Underlying_Type (R_Type); ! ! Exp : constant Node_Id := Expression (N); ! pragma Assert (Present (Exp)); ! ! Exptyp : constant Entity_Id := Etype (Exp); ! -- The type of the expression (not necessarily the same as R_Type) ! ! Subtype_Ind : Node_Id; ! -- If the result type of the function is class-wide and the ! -- expression has a specific type, then we use the expression's ! -- type as the type of the return object. In cases where the ! -- expression is an aggregate that is built in place, this avoids ! -- the need for an expensive conversion of the return object to ! -- the specific type on assignments to the individual components. ! ! begin ! if Is_Class_Wide_Type (R_Type) ! and then not Is_Class_Wide_Type (Etype (Exp)) ! then ! Subtype_Ind := New_Occurrence_Of (Etype (Exp), Loc); ! else ! Subtype_Ind := New_Occurrence_Of (R_Type, Loc); ! end if; ! ! -- 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 ;" to be: ! ! -- return _anon_ : := ! ! -- 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. 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 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 do 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 ! -- class-wide interface type, which is not a limited type, even though ! -- the type of the expression may be. ! ! 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 not Debug_Flag_Dot_L ! then ! declare ! Return_Object_Entity : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); ! Obj_Decl : constant Node_Id := ! Make_Object_Declaration (Loc, ! Defining_Identifier => Return_Object_Entity, ! Object_Definition => Subtype_Ind, ! Expression => Exp); ! ! Ext : constant Node_Id := Make_Extended_Return_Statement (Loc, ! Return_Object_Declarations => New_List (Obj_Decl)); ! -- Do not perform this high-level optimization if the result type ! -- is an interface because the "this" pointer must be displaced. ! ! begin ! Rewrite (N, Ext); ! Analyze (N); ! return; ! end; ! end if; ! ! -- Here we have a simple return statement that is part of the expansion ! -- of an extended return statement (either written by the user, or ! -- generated by the above code). ! ! -- Always normalize C/Fortran boolean result. This is not always needed, ! -- but it seems a good idea to minimize the passing around of non- ! -- normalized values, and in any case this handles the processing of ! -- barrier functions for protected types, which turn the condition into ! -- a return statement. ! ! if Is_Boolean_Type (Exptyp) ! and then Nonzero_Is_True (Exptyp) ! then ! Adjust_Condition (Exp); ! Adjust_Result_Type (Exp, Exptyp); ! end if; ! ! -- Do validity check if enabled for returns ! ! if Validity_Checks_On ! and then Validity_Check_Returns ! then ! Ensure_Valid (Exp); ! end if; ! ! -- Check the result expression of a scalar function against the subtype ! -- of the function by inserting a conversion. This conversion must ! -- eventually be performed for other classes of types, but for now it's ! -- only done for scalars. ! -- ??? ! ! if Is_Scalar_Type (Exptyp) then ! Rewrite (Exp, Convert_To (R_Type, Exp)); ! ! -- The expression is resolved to ensure that the conversion gets ! -- expanded to generate a possible constraint check. ! ! Analyze_And_Resolve (Exp, R_Type); ! end if; ! ! -- Deal with returning variable length objects and controlled types ! ! -- Nothing to do if we are returning by reference, or this is not a ! -- type that requires special processing (indicated by the fact that ! -- it requires a cleanup scope for the secondary stack case). ! if Is_Inherently_Limited_Type (Exptyp) ! or else Is_Limited_Interface (Exptyp) ! then ! null; ! elsif not Requires_Transient_Scope (R_Type) then ! -- Mutable records with no variable length components are not ! -- returned on the sec-stack, so we need to make sure that the ! -- backend will only copy back the size of the actual value, and not ! -- the maximum size. We create an actual subtype for this purpose. ! declare ! Ubt : constant Entity_Id := Underlying_Type (Base_Type (Exptyp)); ! Decl : Node_Id; ! Ent : Entity_Id; ! begin ! if Has_Discriminants (Ubt) ! and then not Is_Constrained (Ubt) ! and then not Has_Unchecked_Union (Ubt) ! then ! Decl := Build_Actual_Subtype (Ubt, Exp); ! Ent := Defining_Identifier (Decl); ! Insert_Action (Exp, Decl); ! Rewrite (Exp, Unchecked_Convert_To (Ent, Exp)); ! Analyze_And_Resolve (Exp); ! end if; ! end; ! -- Here if secondary stack is used else ! -- Make sure that no surrounding block will reclaim the secondary ! -- stack on which we are going to put the result. Not only may this ! -- introduce secondary stack leaks but worse, if the reclamation is ! -- done too early, then the result we are returning may get ! -- clobbered. ! ! declare ! S : Entity_Id; ! begin ! S := Current_Scope; ! while Ekind (S) = E_Block or else Ekind (S) = E_Loop loop ! Set_Sec_Stack_Needed_For_Return (S, True); ! S := Enclosing_Dynamic_Scope (S); ! end loop; ! end; ! ! -- Optimize the case where the result is a function call. In this ! -- case either the result is already on the secondary stack, or is ! -- already being returned with the stack pointer depressed and no ! -- further processing is required except to set the By_Ref flag to ! -- ensure that gigi does not attempt an extra unnecessary copy. ! -- (actually not just unnecessary but harmfully wrong in the case ! -- of a controlled type, where gigi does not know how to do a copy). ! -- To make up for a gcc 2.8.1 deficiency (???), we perform ! -- the copy for array types if the constrained status of the ! -- target type is different from that of the expression. ! ! if Requires_Transient_Scope (Exptyp) ! and then ! (not Is_Array_Type (Exptyp) ! or else Is_Constrained (Exptyp) = Is_Constrained (R_Type) ! or else CW_Or_Has_Controlled_Part (Utyp)) ! and then Nkind (Exp) = N_Function_Call ! then ! Set_By_Ref (N); ! ! -- Remove side effects from the expression now so that other parts ! -- of the expander do not have to reanalyze this node without this ! -- optimization ! ! Rewrite (Exp, Duplicate_Subexpr_No_Checks (Exp)); ! ! -- For controlled types, do the allocation on the secondary stack ! -- manually in order to call adjust at the right time: ! -- type Anon1 is access R_Type; ! -- for Anon1'Storage_pool use ss_pool; ! -- Anon2 : anon1 := new R_Type'(expr); ! -- return Anon2.all; ! -- We do the same for classwide types that are not potentially ! -- controlled (by the virtue of restriction No_Finalization) because ! -- gigi is not able to properly allocate class-wide types. ! elsif CW_Or_Has_Controlled_Part (Utyp) then ! declare ! Loc : constant Source_Ptr := Sloc (N); ! Temp : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); ! Acc_Typ : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); ! Alloc_Node : Node_Id; begin ! Set_Ekind (Acc_Typ, E_Access_Type); ! ! Set_Associated_Storage_Pool (Acc_Typ, RTE (RE_SS_Pool)); ! ! -- This is an allocator for the secondary stack, and it's fine ! -- to have Comes_From_Source set False on it, as gigi knows not ! -- to flag it as a violation of No_Implicit_Heap_Allocations. ! ! Alloc_Node := ! Make_Allocator (Loc, ! Expression => ! Make_Qualified_Expression (Loc, ! Subtype_Mark => New_Reference_To (Etype (Exp), Loc), ! Expression => Relocate_Node (Exp))); ! ! -- We do not want discriminant checks on the declaration, ! -- given that it gets its value from the allocator. ! ! Set_No_Initialization (Alloc_Node); ! ! Insert_List_Before_And_Analyze (N, New_List ( ! Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Acc_Typ, ! Type_Definition => ! Make_Access_To_Object_Definition (Loc, ! Subtype_Indication => Subtype_Ind)), ! ! Make_Object_Declaration (Loc, ! Defining_Identifier => Temp, ! Object_Definition => New_Reference_To (Acc_Typ, Loc), ! Expression => Alloc_Node))); ! ! Rewrite (Exp, ! Make_Explicit_Dereference (Loc, ! Prefix => New_Reference_To (Temp, Loc))); ! ! Analyze_And_Resolve (Exp, R_Type); ! end; ! ! -- Otherwise use the gigi mechanism to allocate result on the ! -- secondary stack. ! ! else ! Check_Restriction (No_Secondary_Stack, N); ! 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. ! ! if VM_Target = No_VM then ! Set_Procedure_To_Call (N, RTE (RE_SS_Allocate)); ! end if; ! end if; ! end if; ! ! -- Implement the rules of 6.5(8-10), which require a tag check in the ! -- case of a limited tagged return type, and tag reassignment for ! -- nonlimited tagged results. These actions are needed when the return ! -- type is a specific tagged type and the result expression is a ! -- conversion or a formal parameter, because in that case the tag of the ! -- expression might differ from the tag of the specific result type. ! ! if Is_Tagged_Type (Utyp) ! and then not Is_Class_Wide_Type (Utyp) ! and then (Nkind_In (Exp, N_Type_Conversion, ! N_Unchecked_Type_Conversion) ! or else (Is_Entity_Name (Exp) ! and then Ekind (Entity (Exp)) in Formal_Kind)) ! then ! -- When the return type is limited, perform a check that the ! -- tag of the result is the same as the tag of the return type. ! ! if Is_Limited_Type (R_Type) then ! Insert_Action (Exp, ! Make_Raise_Constraint_Error (Loc, ! Condition => ! Make_Op_Ne (Loc, ! Left_Opnd => ! Make_Selected_Component (Loc, ! Prefix => Duplicate_Subexpr (Exp), ! Selector_Name => ! New_Reference_To (First_Tag_Component (Utyp), Loc)), ! Right_Opnd => ! Unchecked_Convert_To (RTE (RE_Tag), ! New_Reference_To ! (Node (First_Elmt ! (Access_Disp_Table (Base_Type (Utyp)))), ! Loc))), ! Reason => CE_Tag_Check_Failed)); ! ! -- If the result type is a specific nonlimited tagged type, then we ! -- have to ensure that the tag of the result is that of the result ! -- type. This is handled by making a copy of the expression in the ! -- case where it might have a different tag, namely when the ! -- expression is a conversion or a formal parameter. We create a new ! -- object of the result type and initialize it from the expression, ! -- which will implicitly force the tag to be set appropriately. ! else ! declare ! Result_Id : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); ! Result_Exp : constant Node_Id := ! New_Reference_To (Result_Id, Loc); ! Result_Obj : constant Node_Id := ! Make_Object_Declaration (Loc, ! Defining_Identifier => Result_Id, ! Object_Definition => ! New_Reference_To (R_Type, Loc), ! Constant_Present => True, ! Expression => Relocate_Node (Exp)); begin ! Set_Assignment_OK (Result_Obj); ! Insert_Action (Exp, Result_Obj); ! ! Rewrite (Exp, Result_Exp); ! Analyze_And_Resolve (Exp, R_Type); ! end; ! end if; ! ! -- Ada 2005 (AI-344): If the result type is class-wide, then insert ! -- a check that the level of the return expression's underlying type ! -- is not deeper than the level of the master enclosing the function. ! -- Always generate the check when the type of the return expression ! -- is class-wide, when it's a type conversion, or when it's a formal ! -- parameter. Otherwise, suppress the check in the case where the ! -- return expression has a specific type whose level is known not to ! -- be statically deeper than the function's result type. ! ! -- Note: accessibility check is skipped in the VM case, since there ! -- does not seem to be any practical way to implement this check. ! ! elsif Ada_Version >= Ada_05 ! and then Tagged_Type_Expansion ! and then Is_Class_Wide_Type (R_Type) ! and then not Scope_Suppress (Accessibility_Check) ! and then ! (Is_Class_Wide_Type (Etype (Exp)) ! or else Nkind_In (Exp, N_Type_Conversion, ! N_Unchecked_Type_Conversion) ! or else (Is_Entity_Name (Exp) ! and then Ekind (Entity (Exp)) in Formal_Kind) ! or else Scope_Depth (Enclosing_Dynamic_Scope (Etype (Exp))) > ! Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id))) ! then ! declare ! Tag_Node : Node_Id; ! ! begin ! -- Ada 2005 (AI-251): In class-wide interface objects we displace ! -- "this" to reference the base of the object --- required to get ! -- access to the TSD of the object. ! ! if Is_Class_Wide_Type (Etype (Exp)) ! and then Is_Interface (Etype (Exp)) ! and then Nkind (Exp) = N_Explicit_Dereference ! then ! Tag_Node := ! Make_Explicit_Dereference (Loc, ! Unchecked_Convert_To (RTE (RE_Tag_Ptr), ! Make_Function_Call (Loc, ! Name => New_Reference_To (RTE (RE_Base_Address), Loc), ! Parameter_Associations => New_List ( ! Unchecked_Convert_To (RTE (RE_Address), ! Duplicate_Subexpr (Prefix (Exp))))))); ! else ! Tag_Node := ! Make_Attribute_Reference (Loc, ! Prefix => Duplicate_Subexpr (Exp), ! Attribute_Name => Name_Tag); ! end if; ! ! Insert_Action (Exp, ! Make_Raise_Program_Error (Loc, ! Condition => ! Make_Op_Gt (Loc, ! Left_Opnd => ! Build_Get_Access_Level (Loc, Tag_Node), ! Right_Opnd => ! Make_Integer_Literal (Loc, ! Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))), ! Reason => PE_Accessibility_Check_Failed)); ! end; ! end if; ! -- If we are returning an object that may not be bit-aligned, then ! -- copy the value into a temporary first. This copy may need to expand ! -- to a loop of component operations.. - if Is_Possibly_Unaligned_Slice (Exp) - or else Is_Possibly_Unaligned_Object (Exp) - then - declare - Tnn : constant Entity_Id := - Make_Defining_Identifier (Loc, New_Internal_Name ('T')); begin ! 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)); ! 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; ! -- Ada 2005 (AI-251): If this return statement corresponds with an ! -- simple return statement associated with an extended return statement ! -- and the type of the returned object is an interface then generate an ! -- implicit conversion to force displacement of the "this" pointer. ! if Ada_Version >= Ada_05 ! and then Comes_From_Extended_Return_Statement (N) ! and then Nkind (Expression (N)) = N_Identifier ! and then Is_Interface (Utyp) ! and then Utyp /= Underlying_Type (Exptyp) ! then ! Rewrite (Exp, Convert_To (Utyp, Relocate_Node (Exp))); ! Analyze_And_Resolve (Exp); end if; ! end Expand_Simple_Function_Return; ------------------------------ -- Make_Tag_Ctrl_Assignment -- --- 3184,3401 ---- Analyze (N); end; ! -- Here to deal with iterator case ! elsif Present (Isc) ! and then Present (Iterator_Specification (Isc)) then ! Expand_Iterator_Loop (N); end if; + end Expand_N_Loop_Statement; ! ---------------------------- ! -- Expand_Predicated_Loop -- ! ---------------------------- ! -- Note: the expander can handle generation of loops over predicated ! -- subtypes for both the dynamic and static cases. Depending on what ! -- we decide is allowed in Ada 2012 mode and/or extensions allowed ! -- mode, the semantic analyzer may disallow one or both forms. ! procedure Expand_Predicated_Loop (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Isc : constant Node_Id := Iteration_Scheme (N); ! LPS : constant Node_Id := Loop_Parameter_Specification (Isc); ! Loop_Id : constant Entity_Id := Defining_Identifier (LPS); ! Ltype : constant Entity_Id := Etype (Loop_Id); ! Stat : constant List_Id := Static_Predicate (Ltype); ! Stmts : constant List_Id := Statements (N); begin ! -- Case of iteration over non-static predicate, should not be possible ! -- since this is not allowed by the semantics and should have been ! -- caught during analysis of the loop statement. ! if No (Stat) then ! raise Program_Error; ! -- If the predicate list is empty, that corresponds to a predicate of ! -- False, in which case the loop won't run at all, and we rewrite the ! -- entire loop as a null statement. ! elsif Is_Empty_List (Stat) then ! Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); ! -- For expansion over a static predicate we generate the following ! -- declare ! -- J : Ltype := min-val; ! -- begin ! -- loop ! -- body ! -- case J is ! -- when endpoint => J := startpoint; ! -- when endpoint => J := startpoint; ! -- ... ! -- when max-val => exit; ! -- when others => J := Lval'Succ (J); ! -- end case; ! -- end loop; ! -- end; ! -- To make this a little clearer, let's take a specific example: ! -- type Int is range 1 .. 10; ! -- subtype L is Int with ! -- predicate => L in 3 | 10 | 5 .. 7; ! -- ... ! -- for L in StaticP loop ! -- Put_Line ("static:" & J'Img); ! -- end loop; ! -- In this case, the loop is transformed into ! -- begin ! -- J : L := 3; ! -- loop ! -- body ! -- case J is ! -- when 3 => J := 5; ! -- when 7 => J := 10; ! -- when 10 => exit; ! -- when others => J := L'Succ (J); ! -- end case; ! -- end loop; ! -- end; else ! Static_Predicate : declare ! S : Node_Id; ! D : Node_Id; ! P : Node_Id; ! Alts : List_Id; ! Cstm : Node_Id; ! function Lo_Val (N : Node_Id) return Node_Id; ! -- Given static expression or static range, returns an identifier ! -- whose value is the low bound of the expression value or range. ! function Hi_Val (N : Node_Id) return Node_Id; ! -- Given static expression or static range, returns an identifier ! -- whose value is the high bound of the expression value or range. ! ------------ ! -- Hi_Val -- ! ------------ + function Hi_Val (N : Node_Id) return Node_Id is begin ! if Is_Static_Expression (N) then ! return New_Copy (N); ! else ! pragma Assert (Nkind (N) = N_Range); ! return New_Copy (High_Bound (N)); ! end if; ! end Hi_Val; ! ------------ ! -- Lo_Val -- ! ------------ + function Lo_Val (N : Node_Id) return Node_Id is begin ! if Is_Static_Expression (N) then ! return New_Copy (N); ! else ! pragma Assert (Nkind (N) = N_Range); ! return New_Copy (Low_Bound (N)); ! end if; ! end Lo_Val; ! -- Start of processing for Static_Predicate begin ! -- Convert loop identifier to normal variable and reanalyze it so ! -- that this conversion works. We have to use the same defining ! -- identifier, since there may be references in the loop body. ! Set_Analyzed (Loop_Id, False); ! Set_Ekind (Loop_Id, E_Variable); ! -- Loop to create branches of case statement ! Alts := New_List; ! P := First (Stat); ! while Present (P) loop ! if No (Next (P)) then ! S := Make_Exit_Statement (Loc); ! else ! S := ! Make_Assignment_Statement (Loc, ! Name => New_Occurrence_Of (Loop_Id, Loc), ! Expression => Lo_Val (Next (P))); ! Set_Suppress_Assignment_Checks (S); ! end if; ! Append_To (Alts, ! Make_Case_Statement_Alternative (Loc, ! Statements => New_List (S), ! Discrete_Choices => New_List (Hi_Val (P)))); ! Next (P); ! end loop; ! -- Add others choice ! S := ! Make_Assignment_Statement (Loc, ! Name => New_Occurrence_Of (Loop_Id, Loc), ! Expression => ! Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Ltype, Loc), ! Attribute_Name => Name_Succ, ! Expressions => New_List ( ! New_Occurrence_Of (Loop_Id, Loc)))); ! Set_Suppress_Assignment_Checks (S); ! Append_To (Alts, ! Make_Case_Statement_Alternative (Loc, ! Discrete_Choices => New_List (Make_Others_Choice (Loc)), ! Statements => New_List (S))); ! -- Construct case statement and append to body statements ! Cstm := ! Make_Case_Statement (Loc, ! Expression => New_Occurrence_Of (Loop_Id, Loc), ! Alternatives => Alts); ! Append_To (Stmts, Cstm); ! -- Rewrite the loop ! D := ! Make_Object_Declaration (Loc, ! Defining_Identifier => Loop_Id, ! Object_Definition => New_Occurrence_Of (Ltype, Loc), ! Expression => Lo_Val (First (Stat))); ! Set_Suppress_Assignment_Checks (D); ! Rewrite (N, ! Make_Block_Statement (Loc, ! Declarations => New_List (D), ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => New_List ( ! Make_Loop_Statement (Loc, ! Statements => Stmts, ! End_Label => Empty))))); ! Analyze (N); ! end Static_Predicate; end if; ! end Expand_Predicated_Loop; ------------------------------ -- Make_Tag_Ctrl_Assignment -- *************** package body Exp_Ch5 is *** 4421,4428 **** -- Save the Tag in a local variable Tag_Tmp if Save_Tag then ! Tag_Tmp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Append_To (Res, Make_Object_Declaration (Loc, --- 3469,3475 ---- -- Save the Tag in a local variable Tag_Tmp if Save_Tag then ! Tag_Tmp := Make_Temporary (Loc, 'A'); Append_To (Res, Make_Object_Declaration (Loc, *************** package body Exp_Ch5 is *** 4461,4468 **** New_Reference_To (Controller_Component (T), Loc)); end if; ! Prev_Tmp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('B')); Append_To (Res, Make_Object_Declaration (Loc, --- 3508,3514 ---- New_Reference_To (Controller_Component (T), Loc)); end if; ! Prev_Tmp := Make_Temporary (Loc, 'B'); Append_To (Res, Make_Object_Declaration (Loc, *************** package body Exp_Ch5 is *** 4477,4485 **** Unchecked_Convert_To (RTE (RE_Finalizable), Ctrl_Ref), Selector_Name => Make_Identifier (Loc, Name_Prev)))); ! Next_Tmp := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('C')); Append_To (Res, Make_Object_Declaration (Loc, --- 3523,3529 ---- Unchecked_Convert_To (RTE (RE_Finalizable), Ctrl_Ref), Selector_Name => Make_Identifier (Loc, Name_Prev)))); ! Next_Tmp := Make_Temporary (Loc, 'C'); Append_To (Res, Make_Object_Declaration (Loc, *************** package body Exp_Ch5 is *** 4638,4646 **** Make_Integer_Literal (Loc, Intval => System_Storage_Unit)); ! Range_Type := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('G')); Append_To (Res, Make_Subtype_Declaration (Loc, --- 3682,3688 ---- Make_Integer_Literal (Loc, Intval => System_Storage_Unit)); ! Range_Type := Make_Temporary (Loc, 'G'); Append_To (Res, Make_Subtype_Declaration (Loc, *************** package body Exp_Ch5 is *** 4659,4667 **** Append_To (Res, Make_Subtype_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('S')), Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => --- 3701,3707 ---- Append_To (Res, Make_Subtype_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => *************** package body Exp_Ch5 is *** 4673,4681 **** -- type A is access S ! Opaque_Type := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Append_To (Res, Make_Full_Type_Declaration (Loc, --- 3713,3719 ---- -- type A is access S ! Opaque_Type := Make_Temporary (Loc, 'A'); Append_To (Res, Make_Full_Type_Declaration (Loc, *************** package body Exp_Ch5 is *** 4711,4717 **** if Has_Controlled_Component (T) then Prev_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr_No_Checks (L), Selector_Name => --- 3749,3755 ---- if Has_Controlled_Component (T) then Prev_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr_No_Checks (L), Selector_Name => *************** package body Exp_Ch5 is *** 4721,4729 **** -- Last index before hole: determined by position of the -- _Controller.Prev component. ! Last_Before_Hole := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('L')); Append_To (Res, Make_Object_Declaration (Loc, --- 3759,3765 ---- -- Last index before hole: determined by position of the -- _Controller.Prev component. ! Last_Before_Hole := Make_Temporary (Loc, 'L'); Append_To (Res, Make_Object_Declaration (Loc, *************** package body Exp_Ch5 is *** 4731,4737 **** Object_Definition => New_Occurrence_Of ( RTE (RE_Storage_Offset), Loc), Constant_Present => True, ! Expression => Make_Op_Add (Loc, Make_Attribute_Reference (Loc, Prefix => Prev_Ref, Attribute_Name => Name_Position), --- 3767,3774 ---- Object_Definition => New_Occurrence_Of ( RTE (RE_Storage_Offset), Loc), Constant_Present => True, ! Expression => ! Make_Op_Add (Loc, Make_Attribute_Reference (Loc, Prefix => Prev_Ref, Attribute_Name => Name_Position), *************** package body Exp_Ch5 is *** 4756,4764 **** -- First index after hole ! First_After_Hole := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('F')); Append_To (Res, Make_Object_Declaration (Loc, --- 3793,3799 ---- -- First index after hole ! First_After_Hole := Make_Temporary (Loc, 'F'); Append_To (Res, Make_Object_Declaration (Loc, *************** package body Exp_Ch5 is *** 4858,4864 **** Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (RTE (RE_Finalizable), New_Copy_Tree (Ctrl_Ref)), Selector_Name => Make_Identifier (Loc, Name_Prev)), --- 3893,3899 ---- Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (RTE (RE_Finalizable), New_Copy_Tree (Ctrl_Ref)), Selector_Name => Make_Identifier (Loc, Name_Prev)), *************** package body Exp_Ch5 is *** 4868,4874 **** Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (RTE (RE_Finalizable), New_Copy_Tree (Ctrl_Ref)), Selector_Name => Make_Identifier (Loc, Name_Next)), --- 3903,3909 ---- Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (RTE (RE_Finalizable), New_Copy_Tree (Ctrl_Ref)), Selector_Name => Make_Identifier (Loc, Name_Next)), diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch5.ads gcc-4.6.0/gcc/ada/exp_ch5.ads *** gcc-4.5.2/gcc/ada/exp_ch5.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/exp_ch5.ads Mon Oct 11 09:04:40 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Ch5 is *** 32,40 **** procedure Expand_N_Block_Statement (N : Node_Id); procedure Expand_N_Case_Statement (N : Node_Id); procedure Expand_N_Exit_Statement (N : Node_Id); - procedure Expand_N_Extended_Return_Statement (N : Node_Id); procedure Expand_N_Goto_Statement (N : Node_Id); procedure Expand_N_If_Statement (N : Node_Id); procedure Expand_N_Loop_Statement (N : Node_Id); - procedure Expand_N_Simple_Return_Statement (N : Node_Id); end Exp_Ch5; --- 32,38 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch6.adb gcc-4.6.0/gcc/ada/exp_ch6.adb *** gcc-4.5.2/gcc/ada/exp_ch6.adb Mon Jan 25 16:24:20 2010 --- gcc-4.6.0/gcc/ada/exp_ch6.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Util; use Sem_Util; *** 69,74 **** --- 69,75 ---- with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; + with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; with Validsw; use Validsw; *************** package body Exp_Ch6 is *** 133,141 **** -- expression to pass for the master. In most cases, this is the current -- master (_master). The two exceptions are: If the function call is the -- initialization expression for an allocator, we pass the master of the ! -- access type. If the function call is the initialization expression for ! -- a return object, we pass along the master passed in by the caller. The ! -- activation chain to pass is always the local one. procedure Check_Overriding_Operation (Subp : Entity_Id); -- Subp is a dispatching operation. Check whether it may override an --- 134,143 ---- -- expression to pass for the master. In most cases, this is the current -- master (_master). The two exceptions are: If the function call is the -- initialization expression for an allocator, we pass the master of the ! -- access type. If the function call is the initialization expression for a ! -- return object, we pass along the master passed in by the caller. The ! -- activation chain to pass is always the local one. Note: Master_Actual ! -- can be Empty, but only if there are no tasks. procedure Check_Overriding_Operation (Subp : Entity_Id); -- Subp is a dispatching operation. Check whether it may override an *************** package body Exp_Ch6 is *** 202,207 **** --- 204,215 ---- -- expressions in the body must be converted to the desired type (which -- is simply not noted in the tree without inline expansion). + procedure Expand_Non_Function_Return (N : Node_Id); + -- Called by Expand_N_Simple_Return_Statement in case we're returning from + -- a procedure body, entry body, accept statement, or extended return + -- statement. Note that all non-function returns are simple return + -- statements. + function Expand_Protected_Object_Reference (N : Node_Id; Scop : Entity_Id) return Node_Id; *************** package body Exp_Ch6 is *** 219,224 **** --- 227,236 ---- -- Predicate to recognize stubbed procedures and null procedures, which -- can be inlined unconditionally in all cases. + procedure Expand_Simple_Function_Return (N : Node_Id); + -- 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. + ---------------------------------------------- -- Add_Access_Actual_To_Build_In_Place_Call -- ---------------------------------------------- *************** package body Exp_Ch6 is *** 462,470 **** (Function_Call : Node_Id; Function_Id : Entity_Id; Master_Actual : Node_Id) - -- Note: Master_Actual can be Empty, but only if there are no tasks is ! Loc : constant Source_Ptr := Sloc (Function_Call); begin -- No such extra parameters are needed if there are no tasks --- 474,482 ---- (Function_Call : Node_Id; Function_Id : Entity_Id; Master_Actual : Node_Id) is ! Loc : constant Source_Ptr := Sloc (Function_Call); ! Actual : Node_Id := Master_Actual; begin -- No such extra parameters are needed if there are no tasks *************** package body Exp_Ch6 is *** 473,478 **** --- 485,496 ---- return; end if; + -- Use a dummy _master actual in case of No_Task_Hierarchy + + if Restriction_Active (No_Task_Hierarchy) then + Actual := New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc); + end if; + -- The master declare *************** package body Exp_Ch6 is *** 482,494 **** Master_Formal := Build_In_Place_Formal (Function_Id, BIP_Master); ! Analyze_And_Resolve (Master_Actual, Etype (Master_Formal)); -- Build the parameter association for the new actual and add it to -- the end of the function's actuals. Add_Extra_Actual_To_Call ! (Function_Call, Master_Formal, Master_Actual); end; -- The activation chain --- 500,512 ---- Master_Formal := Build_In_Place_Formal (Function_Id, BIP_Master); ! Analyze_And_Resolve (Actual, Etype (Master_Formal)); -- Build the parameter association for the new actual and add it to -- the end of the function's actuals. Add_Extra_Actual_To_Call ! (Function_Call, Master_Formal, Actual); end; -- The activation chain *************** package body Exp_Ch6 is *** 582,588 **** if Is_Derived_Type (Typ) and then not Is_Private_Type (Typ) and then In_Open_Scopes (Scope (Etype (Typ))) ! and then Typ = Base_Type (Typ) then -- Subp overrides an inherited private operation if there is an -- inherited operation with a different name than Subp (see --- 600,606 ---- if Is_Derived_Type (Typ) and then not Is_Private_Type (Typ) and then In_Open_Scopes (Scope (Etype (Typ))) ! and then Is_Base_Type (Typ) then -- Subp overrides an inherited private operation if there is an -- inherited operation with a different name than Subp (see *************** package body Exp_Ch6 is *** 808,816 **** Elm := First_Elmt (Var_List); while Present (Elm) loop Var := Node (Elm); ! Ent := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); Append_Elmt (Ent, Shad_List); -- Insert a declaration for this temporary at the start of the --- 826,832 ---- Elm := First_Elmt (Var_List); while Present (Elm) loop Var := Node (Elm); ! Ent := Make_Temporary (Loc, 'S'); Append_Elmt (Ent, Shad_List); -- Insert a declaration for this temporary at the start of the *************** package body Exp_Ch6 is *** 966,974 **** return; end if; ! Temp := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); -- Use formal type for temp, unless formal type is an unconstrained -- array, in which case we don't have to worry about bounds checks, --- 982,988 ---- return; end if; ! Temp := Make_Temporary (Loc, 'T', Actual); -- Use formal type for temp, unless formal type is an unconstrained -- array, in which case we don't have to worry about bounds checks, *************** package body Exp_Ch6 is *** 1220,1228 **** Reset_Packed_Prefix; ! Temp := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); Incod := Relocate_Node (Actual); Outcod := New_Copy_Tree (Incod); --- 1234,1240 ---- Reset_Packed_Prefix; ! Temp := Make_Temporary (Loc, 'T', Actual); Incod := Relocate_Node (Actual); Outcod := New_Copy_Tree (Incod); *************** package body Exp_Ch6 is *** 1387,1395 **** return Entity (Actual); else ! Var := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); N_Node := Make_Object_Renaming_Declaration (Loc, --- 1399,1405 ---- return Entity (Actual); else ! Var := Make_Temporary (Loc, 'T', Actual); N_Node := Make_Object_Renaming_Declaration (Loc, *************** package body Exp_Ch6 is *** 1462,1468 **** -- 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 (Actual) then Make_Build_In_Place_Call_In_Anonymous_Context (Actual); --- 1472,1478 ---- -- functions that are treated as build-in-place to include other -- composite result types. ! if Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Actual) then Make_Build_In_Place_Call_In_Anonymous_Context (Actual); *************** package body Exp_Ch6 is *** 1662,1667 **** --- 1672,1695 ---- elsif Is_Possibly_Unaligned_Slice (Actual) then Add_Call_By_Copy_Code; + + -- An unusual case: a current instance of an enclosing task can be + -- an actual, and must be replaced by a reference to self. + + elsif Is_Entity_Name (Actual) + and then Is_Task_Type (Entity (Actual)) + then + if In_Open_Scopes (Entity (Actual)) then + Rewrite (Actual, + (Make_Function_Call (Loc, + Name => New_Reference_To (RTE (RE_Self), Loc)))); + Analyze (Actual); + + -- A task type cannot otherwise appear as an actual + + else + raise Program_Error; + end if; end if; end if; *************** package body Exp_Ch6 is *** 1728,1733 **** --- 1756,1762 ---- procedure Expand_Call (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); + Call_Node : Node_Id := N; Extra_Actuals : List_Id := No_List; Prev : Node_Id := Empty; *************** package body Exp_Ch6 is *** 1750,1755 **** --- 1779,1789 ---- -- convoluted tree traversal before setting the proper subprogram to be -- called. + function New_Value (From : Node_Id) return Node_Id; + -- From is the original Expression. New_Value is equivalent to a call + -- to Duplicate_Subexpr with an explicit dereference when From is an + -- access parameter. + -------------------------- -- Add_Actual_Parameter -- -------------------------- *************** package body Exp_Ch6 is *** 1764,1776 **** if No (Prev) or else Nkind (Parent (Prev)) /= N_Parameter_Association then ! Set_Next_Named_Actual (Insert_Param, First_Named_Actual (N)); ! Set_First_Named_Actual (N, Actual_Expr); if No (Prev) then ! if No (Parameter_Associations (N)) then ! Set_Parameter_Associations (N, New_List); ! Append (Insert_Param, Parameter_Associations (N)); end if; else Insert_After (Prev, Insert_Param); --- 1798,1811 ---- if No (Prev) or else Nkind (Parent (Prev)) /= N_Parameter_Association then ! Set_Next_Named_Actual ! (Insert_Param, First_Named_Actual (Call_Node)); ! Set_First_Named_Actual (Call_Node, Actual_Expr); if No (Prev) then ! if No (Parameter_Associations (Call_Node)) then ! Set_Parameter_Associations (Call_Node, New_List); ! Append (Insert_Param, Parameter_Associations (Call_Node)); end if; else Insert_After (Prev, Insert_Param); *************** package body Exp_Ch6 is *** 1782,1788 **** Set_Next_Named_Actual (Insert_Param, Next_Named_Actual (Parent (Prev))); Set_Next_Named_Actual (Parent (Prev), Actual_Expr); ! Append (Insert_Param, Parameter_Associations (N)); end if; Prev := Actual_Expr; --- 1817,1823 ---- Set_Next_Named_Actual (Insert_Param, Next_Named_Actual (Parent (Prev))); Set_Next_Named_Actual (Parent (Prev), Actual_Expr); ! Append (Insert_Param, Parameter_Associations (Call_Node)); end if; Prev := Actual_Expr; *************** package body Exp_Ch6 is *** 1798,1815 **** begin if Extra_Actuals = No_List then Extra_Actuals := New_List; ! Set_Parent (Extra_Actuals, N); end if; Append_To (Extra_Actuals, Make_Parameter_Association (Loc, ! Explicit_Actual_Parameter => Expr, ! Selector_Name => ! Make_Identifier (Loc, Chars (EF)))); Analyze_And_Resolve (Expr, Etype (EF)); ! if Nkind (N) = N_Function_Call then Set_Is_Accessibility_Actual (Parent (Expr)); end if; end Add_Extra_Actual; --- 1833,1849 ---- begin if Extra_Actuals = No_List then Extra_Actuals := New_List; ! Set_Parent (Extra_Actuals, Call_Node); end if; Append_To (Extra_Actuals, Make_Parameter_Association (Loc, ! Selector_Name => Make_Identifier (Loc, Chars (EF)), ! Explicit_Actual_Parameter => Expr)); Analyze_And_Resolve (Expr, Etype (EF)); ! if Nkind (Call_Node) = N_Function_Call then Set_Is_Accessibility_Actual (Parent (Expr)); end if; end Add_Extra_Actual; *************** package body Exp_Ch6 is *** 1913,1921 **** raise Program_Error; end Inherited_From_Formal; -- Local variables ! Remote : constant Boolean := Is_Remote_Call (N); Actual : Node_Id; Formal : Entity_Id; Orig_Subp : Entity_Id := Empty; --- 1947,1971 ---- raise Program_Error; end Inherited_From_Formal; + --------------- + -- New_Value -- + --------------- + + function New_Value (From : Node_Id) return Node_Id is + Res : constant Node_Id := Duplicate_Subexpr (From); + begin + if Is_Access_Type (Etype (From)) then + return + Make_Explicit_Dereference (Sloc (From), + Prefix => Res); + else + return Res; + end if; + end New_Value; + -- Local variables ! Remote : constant Boolean := Is_Remote_Call (Call_Node); Actual : Node_Id; Formal : Entity_Id; Orig_Subp : Entity_Id := Empty; *************** package body Exp_Ch6 is *** 1938,1972 **** begin -- Ignore if previous error ! if Nkind (N) in N_Has_Etype and then Etype (N) = Any_Type then return; end if; -- Call using access to subprogram with explicit dereference ! if Nkind (Name (N)) = N_Explicit_Dereference then ! Subp := Etype (Name (N)); Parent_Subp := Empty; -- Case of call to simple entry, where the Name is a selected component -- whose prefix is the task, and whose selector name is the entry name ! elsif Nkind (Name (N)) = N_Selected_Component then ! Subp := Entity (Selector_Name (Name (N))); Parent_Subp := Empty; -- Case of call to member of entry family, where Name is an indexed -- component, with the prefix being a selected component giving the -- task and entry family name, and the index being the entry index. ! elsif Nkind (Name (N)) = N_Indexed_Component then ! Subp := Entity (Selector_Name (Prefix (Name (N)))); Parent_Subp := Empty; -- Normal case else ! Subp := Entity (Name (N)); Parent_Subp := Alias (Subp); -- Replace call to Raise_Exception by call to Raise_Exception_Always --- 1988,2024 ---- begin -- Ignore if previous error ! if Nkind (Call_Node) in N_Has_Etype ! and then Etype (Call_Node) = Any_Type ! then return; end if; -- Call using access to subprogram with explicit dereference ! if Nkind (Name (Call_Node)) = N_Explicit_Dereference then ! Subp := Etype (Name (Call_Node)); Parent_Subp := Empty; -- Case of call to simple entry, where the Name is a selected component -- whose prefix is the task, and whose selector name is the entry name ! elsif Nkind (Name (Call_Node)) = N_Selected_Component then ! Subp := Entity (Selector_Name (Name (Call_Node))); Parent_Subp := Empty; -- Case of call to member of entry family, where Name is an indexed -- component, with the prefix being a selected component giving the -- task and entry family name, and the index being the entry index. ! elsif Nkind (Name (Call_Node)) = N_Indexed_Component then ! Subp := Entity (Selector_Name (Prefix (Name (Call_Node)))); Parent_Subp := Empty; -- Normal case else ! Subp := Entity (Name (Call_Node)); Parent_Subp := Alias (Subp); -- Replace call to Raise_Exception by call to Raise_Exception_Always *************** package body Exp_Ch6 is *** 1981,1987 **** and then RTE_Available (RE_Raise_Exception_Always) then declare ! FA : constant Node_Id := Original_Node (First_Actual (N)); begin -- The case we catch is where the first argument is obtained --- 2033,2040 ---- and then RTE_Available (RE_Raise_Exception_Always) then declare ! FA : constant Node_Id := ! Original_Node (First_Actual (Call_Node)); begin -- The case we catch is where the first argument is obtained *************** package body Exp_Ch6 is *** 1992,1998 **** and then Attribute_Name (FA) = Name_Identity then Subp := RTE (RE_Raise_Exception_Always); ! Set_Name (N, New_Occurrence_Of (Subp, Loc)); end if; end; end if; --- 2045,2051 ---- and then Attribute_Name (FA) = Name_Identity then Subp := RTE (RE_Raise_Exception_Always); ! Set_Name (Call_Node, New_Occurrence_Of (Subp, Loc)); end if; end; end if; *************** package body Exp_Ch6 is *** 2007,2020 **** -- a conditional or timed select. Check whether the procedure call -- is a renaming of an entry and rewrite it as an entry call. ! if Ada_Version >= Ada_05 ! and then Nkind (N) = N_Procedure_Call_Statement and then ! ((Nkind (Parent (N)) = N_Triggering_Alternative ! and then Triggering_Statement (Parent (N)) = N) or else ! (Nkind (Parent (N)) = N_Entry_Call_Alternative ! and then Entry_Call_Statement (Parent (N)) = N)) then declare Ren_Decl : Node_Id; --- 2060,2073 ---- -- a conditional or timed select. Check whether the procedure call -- is a renaming of an entry and rewrite it as an entry call. ! if Ada_Version >= Ada_2005 ! and then Nkind (Call_Node) = N_Procedure_Call_Statement and then ! ((Nkind (Parent (Call_Node)) = N_Triggering_Alternative ! and then Triggering_Statement (Parent (Call_Node)) = Call_Node) or else ! (Nkind (Parent (Call_Node)) = N_Entry_Call_Alternative ! and then Entry_Call_Statement (Parent (Call_Node)) = Call_Node)) then declare Ren_Decl : Node_Id; *************** package body Exp_Ch6 is *** 2031,2042 **** Ren_Decl := Original_Node (Parent (Parent (Ren_Root))); if Nkind (Ren_Decl) = N_Subprogram_Renaming_Declaration then ! Rewrite (N, Make_Entry_Call_Statement (Loc, Name => New_Copy_Tree (Name (Ren_Decl)), Parameter_Associations => ! New_Copy_List_Tree (Parameter_Associations (N)))); return; end if; --- 2084,2096 ---- Ren_Decl := Original_Node (Parent (Parent (Ren_Root))); if Nkind (Ren_Decl) = N_Subprogram_Renaming_Declaration then ! Rewrite (Call_Node, Make_Entry_Call_Statement (Loc, Name => New_Copy_Tree (Name (Ren_Decl)), Parameter_Associations => ! New_Copy_List_Tree ! (Parameter_Associations (Call_Node)))); return; end if; *************** package body Exp_Ch6 is *** 2054,2060 **** -- (Though it seems that this would be better done in Expand_Actuals???) Formal := First_Formal (Subp); ! Actual := First_Actual (N); Param_Count := 1; while Present (Formal) loop --- 2108,2114 ---- -- (Though it seems that this would be better done in Expand_Actuals???) Formal := First_Formal (Subp); ! Actual := First_Actual (Call_Node); Param_Count := 1; while Present (Formal) loop *************** package body Exp_Ch6 is *** 2182,2189 **** Prev_Orig := Prev; end if; ! -- Ada 2005 (AI-251): Thunks must propagate the extra actuals ! -- of accessibility levels. if Ekind (Current_Scope) in Subprogram_Kind and then Is_Thunk (Current_Scope) --- 2236,2243 ---- Prev_Orig := Prev; end if; ! -- Ada 2005 (AI-251): Thunks must propagate the extra actuals of ! -- accessibility levels. if Ekind (Current_Scope) in Subprogram_Kind and then Is_Thunk (Current_Scope) *************** package body Exp_Ch6 is *** 2307,2313 **** Extra_Accessibility (Formal)); -- No other cases of attributes returning access ! -- values that can be passed to access parameters when others => raise Program_Error; --- 2361,2367 ---- Extra_Accessibility (Formal)); -- No other cases of attributes returning access ! -- values that can be passed to access parameters. when others => raise Program_Error; *************** package body Exp_Ch6 is *** 2339,2355 **** end if; -- Perform the check of 4.6(49) that prevents a null value from being ! -- passed as an actual to an access parameter. Note that the check is ! -- elided in the common cases of passing an access attribute or -- access parameter as an actual. Also, we currently don't enforce -- this check for expander-generated actuals and when -gnatdj is set. ! if Ada_Version >= Ada_05 then ! -- Ada 2005 (AI-231): Check null-excluding access types if Is_Access_Type (Etype (Formal)) and then Can_Never_Be_Null (Etype (Formal)) and then Nkind (Prev) /= N_Raise_Constraint_Error and then (Known_Null (Prev) or else not Can_Never_Be_Null (Etype (Prev))) --- 2393,2414 ---- end if; -- Perform the check of 4.6(49) that prevents a null value from being ! -- passed as an actual to an access parameter. Note that the check ! -- is elided in the common cases of passing an access attribute or -- access parameter as an actual. Also, we currently don't enforce -- this check for expander-generated actuals and when -gnatdj is set. ! if Ada_Version >= Ada_2005 then ! -- Ada 2005 (AI-231): Check null-excluding access types. Note that ! -- the intent of 6.4.1(13) is that null-exclusion checks should ! -- not be done for 'out' parameters, even though it refers only ! -- to constraint checks, and a null_exclusion is not a constraint. ! -- Note that AI05-0196-1 corrects this mistake in the RM. if Is_Access_Type (Etype (Formal)) and then Can_Never_Be_Null (Etype (Formal)) + and then Ekind (Formal) /= E_Out_Parameter and then Nkind (Prev) /= N_Raise_Constraint_Error and then (Known_Null (Prev) or else not Can_Never_Be_Null (Etype (Prev))) *************** package body Exp_Ch6 is *** 2357,2363 **** Install_Null_Excluding_Check (Prev); end if; ! -- Ada_Version < Ada_05 else if Ekind (Etype (Formal)) /= E_Anonymous_Access_Type --- 2416,2422 ---- Install_Null_Excluding_Check (Prev); end if; ! -- Ada_Version < Ada_2005 else if Ekind (Etype (Formal)) /= E_Anonymous_Access_Type *************** package body Exp_Ch6 is *** 2433,2444 **** -- since this is a left side reference. We only do this for calls -- from the source program since we assume that compiler generated -- calls explicitly generate any required checks. We also need it ! -- only if we are doing standard validity checks, since clearly it ! -- is not needed if validity checks are off, and in subscript ! -- validity checking mode, all indexed components are checked with ! -- a call directly from Expand_N_Indexed_Component. ! if Comes_From_Source (N) and then Ekind (Formal) /= E_In_Parameter and then Validity_Checks_On and then Validity_Check_Default --- 2492,2503 ---- -- since this is a left side reference. We only do this for calls -- from the source program since we assume that compiler generated -- calls explicitly generate any required checks. We also need it ! -- only if we are doing standard validity checks, since clearly it is ! -- not needed if validity checks are off, and in subscript validity ! -- checking mode, all indexed components are checked with a call ! -- directly from Expand_N_Indexed_Component. ! if Comes_From_Source (Call_Node) and then Ekind (Formal) /= E_In_Parameter and then Validity_Checks_On and then Validity_Check_Default *************** package body Exp_Ch6 is *** 2537,2586 **** -- assignment might be transformed to a declaration for an unconstrained -- value if the expression is classwide. ! if Nkind (N) = N_Function_Call ! and then Is_Tag_Indeterminate (N) ! and then Is_Entity_Name (Name (N)) then declare Ass : Node_Id := Empty; begin ! if Nkind (Parent (N)) = N_Assignment_Statement then ! Ass := Parent (N); ! elsif Nkind (Parent (N)) = N_Qualified_Expression ! and then Nkind (Parent (Parent (N))) = N_Assignment_Statement then ! Ass := Parent (Parent (N)); ! elsif Nkind (Parent (N)) = N_Explicit_Dereference ! and then Nkind (Parent (Parent (N))) = N_Assignment_Statement then ! Ass := Parent (Parent (N)); end if; if Present (Ass) and then Is_Class_Wide_Type (Etype (Name (Ass))) then ! if Is_Access_Type (Etype (N)) then ! if Designated_Type (Etype (N)) /= Root_Type (Etype (Name (Ass))) then Error_Msg_NE ("tag-indeterminate expression " & " must have designated type& (RM 5.2 (6))", ! N, Root_Type (Etype (Name (Ass)))); else ! Propagate_Tag (Name (Ass), N); end if; ! elsif Etype (N) /= Root_Type (Etype (Name (Ass))) then Error_Msg_NE ("tag-indeterminate expression must have type&" ! & "(RM 5.2 (6))", N, Root_Type (Etype (Name (Ass)))); else ! Propagate_Tag (Name (Ass), N); end if; -- The call will be rewritten as a dispatching call, and --- 2596,2648 ---- -- assignment might be transformed to a declaration for an unconstrained -- value if the expression is classwide. ! if Nkind (Call_Node) = N_Function_Call ! and then Is_Tag_Indeterminate (Call_Node) ! and then Is_Entity_Name (Name (Call_Node)) then declare Ass : Node_Id := Empty; begin ! if Nkind (Parent (Call_Node)) = N_Assignment_Statement then ! Ass := Parent (Call_Node); ! elsif Nkind (Parent (Call_Node)) = N_Qualified_Expression ! and then Nkind (Parent (Parent (Call_Node))) = ! N_Assignment_Statement then ! Ass := Parent (Parent (Call_Node)); ! elsif Nkind (Parent (Call_Node)) = N_Explicit_Dereference ! and then Nkind (Parent (Parent (Call_Node))) = ! N_Assignment_Statement then ! Ass := Parent (Parent (Call_Node)); end if; if Present (Ass) and then Is_Class_Wide_Type (Etype (Name (Ass))) then ! if Is_Access_Type (Etype (Call_Node)) then ! if Designated_Type (Etype (Call_Node)) /= Root_Type (Etype (Name (Ass))) then Error_Msg_NE ("tag-indeterminate expression " & " must have designated type& (RM 5.2 (6))", ! Call_Node, Root_Type (Etype (Name (Ass)))); else ! Propagate_Tag (Name (Ass), Call_Node); end if; ! elsif Etype (Call_Node) /= Root_Type (Etype (Name (Ass))) then Error_Msg_NE ("tag-indeterminate expression must have type&" ! & "(RM 5.2 (6))", ! Call_Node, Root_Type (Etype (Name (Ass)))); else ! Propagate_Tag (Name (Ass), Call_Node); end if; -- The call will be rewritten as a dispatching call, and *************** package body Exp_Ch6 is *** 2594,2643 **** -- Ada 2005 (AI-251): If some formal is a class-wide interface, expand -- it to point to the correct secondary virtual table ! if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) and then CW_Interface_Formals_Present then ! Expand_Interface_Actuals (N); end if; -- Deals with Dispatch_Call if we still have a call, before expanding -- extra actuals since this will be done on the re-analysis of the ! -- dispatching call. Note that we do not try to shorten the actual ! -- list for a dispatching call, it would not make sense to do so. ! -- Expansion of dispatching calls is suppressed when VM_Target, because ! -- the VM back-ends directly handle the generation of dispatching ! -- calls and would have to undo any expansion to an indirect call. ! if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) ! and then Present (Controlling_Argument (N)) then ! if Tagged_Type_Expansion then ! Expand_Dispatching_Call (N); ! -- The following return is worrisome. Is it really OK to ! -- skip all remaining processing in this procedure ??? ! return; ! else ! Apply_Tag_Checks (N); ! -- 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. ! 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. ! 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 -- is a protected procedure, or for an internal protected subprogram --- 2656,2768 ---- -- Ada 2005 (AI-251): If some formal is a class-wide interface, expand -- it to point to the correct secondary virtual table ! if Nkind_In (Call_Node, N_Function_Call, N_Procedure_Call_Statement) and then CW_Interface_Formals_Present then ! Expand_Interface_Actuals (Call_Node); end if; -- Deals with Dispatch_Call if we still have a call, before expanding -- extra actuals since this will be done on the re-analysis of the ! -- dispatching call. Note that we do not try to shorten the actual list ! -- for a dispatching call, it would not make sense to do so. Expansion ! -- of dispatching calls is suppressed when VM_Target, because the VM ! -- back-ends directly handle the generation of dispatching calls and ! -- would have to undo any expansion to an indirect call. ! if Nkind_In (Call_Node, N_Function_Call, N_Procedure_Call_Statement) ! and then Present (Controlling_Argument (Call_Node)) then ! declare ! Call_Typ : constant Entity_Id := Etype (Call_Node); ! Typ : constant Entity_Id := Find_Dispatching_Type (Subp); ! Eq_Prim_Op : Entity_Id := Empty; ! New_Call : Node_Id; ! Param : Node_Id; ! Prev_Call : Node_Id; ! begin ! if not Is_Limited_Type (Typ) then ! Eq_Prim_Op := Find_Prim_Op (Typ, Name_Op_Eq); ! end if; ! if Tagged_Type_Expansion then ! Expand_Dispatching_Call (Call_Node); ! -- The following return is worrisome. Is it really OK to skip ! -- all remaining processing in this procedure ??? ! return; ! -- VM targets ! ! else ! Apply_Tag_Checks (Call_Node); ! ! -- If this is a dispatching "=", we must first compare the ! -- tags so we generate: x.tag = y.tag and then x = y ! ! if Subp = Eq_Prim_Op then ! ! -- Mark the node as analyzed to avoid reanalizing this ! -- dispatching call (which would cause a never-ending loop) ! ! Prev_Call := Relocate_Node (Call_Node); ! Set_Analyzed (Prev_Call); ! ! Param := First_Actual (Call_Node); ! New_Call := ! Make_And_Then (Loc, ! Left_Opnd => ! Make_Op_Eq (Loc, ! Left_Opnd => ! Make_Selected_Component (Loc, ! Prefix => New_Value (Param), ! Selector_Name => ! New_Reference_To (First_Tag_Component (Typ), ! Loc)), ! ! Right_Opnd => ! Make_Selected_Component (Loc, ! Prefix => ! Unchecked_Convert_To (Typ, ! New_Value (Next_Actual (Param))), ! Selector_Name => ! New_Reference_To ! (First_Tag_Component (Typ), Loc))), ! Right_Opnd => Prev_Call); ! ! Rewrite (Call_Node, New_Call); ! ! Analyze_And_Resolve ! (Call_Node, Call_Typ, Suppress => All_Checks); ! end if; ! ! -- 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. ! ! Kill_Current_Values; ! end if; ! ! -- If this is a dispatching "=" then we must update the reference ! -- to the call node because we generated: ! -- x.tag = y.tag and then x = y ! ! if Subp = Eq_Prim_Op then ! Call_Node := Right_Opnd (Call_Node); ! end if; ! end; 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. ! if Is_All_Remote_Call (Call_Node) then ! Expand_All_Calls_Remote_Subprogram_Call (Call_Node); -- Similarly, do not add extra actuals for an entry call whose entity -- is a protected procedure, or for an internal protected subprogram *************** package body Exp_Ch6 is *** 2659,2695 **** end loop; end if; ! -- At this point we have all the actuals, so this is the point at ! -- which the various expansion activities for actuals is carried out. ! Expand_Actuals (N, Subp); ! -- If the subprogram is a renaming, or if it is inherited, replace it ! -- in the call with the name of the actual subprogram being called. ! -- If this is a dispatching call, the run-time decides what to call. ! -- The Alias attribute does not apply to entries. ! if Nkind (N) /= N_Entry_Call_Statement ! and then No (Controlling_Argument (N)) and then Present (Parent_Subp) then if Present (Inherited_From_Formal (Subp)) then Parent_Subp := Inherited_From_Formal (Subp); else ! while Present (Alias (Parent_Subp)) loop ! Parent_Subp := Alias (Parent_Subp); ! end loop; end if; -- The below setting of Entity is suspect, see F109-018 discussion??? ! Set_Entity (Name (N), Parent_Subp); if Is_Abstract_Subprogram (Parent_Subp) and then not In_Instance then Error_Msg_NE ! ("cannot call abstract subprogram &!", Name (N), Parent_Subp); end if; -- Inspect all formals of derived subprogram Subp. Compare parameter --- 2784,2819 ---- end loop; end if; ! -- At this point we have all the actuals, so this is the point at which ! -- the various expansion activities for actuals is carried out. ! Expand_Actuals (Call_Node, Subp); ! -- If the subprogram is a renaming, or if it is inherited, replace it in ! -- the call with the name of the actual subprogram being called. If this ! -- is a dispatching call, the run-time decides what to call. The Alias ! -- attribute does not apply to entries. ! if Nkind (Call_Node) /= N_Entry_Call_Statement ! and then No (Controlling_Argument (Call_Node)) and then Present (Parent_Subp) then if Present (Inherited_From_Formal (Subp)) then Parent_Subp := Inherited_From_Formal (Subp); else ! Parent_Subp := Ultimate_Alias (Parent_Subp); end if; -- The below setting of Entity is suspect, see F109-018 discussion??? ! Set_Entity (Name (Call_Node), Parent_Subp); if Is_Abstract_Subprogram (Parent_Subp) and then not In_Instance then Error_Msg_NE ! ("cannot call abstract subprogram &!", ! Name (Call_Node), Parent_Subp); end if; -- Inspect all formals of derived subprogram Subp. Compare parameter *************** package body Exp_Ch6 is *** 2725,2731 **** Parent_Typ : Entity_Id; begin ! Actual := First_Actual (N); Formal := First_Formal (Subp); Parent_Formal := First_Formal (Parent_Subp); while Present (Formal) loop --- 2849,2855 ---- Parent_Typ : Entity_Id; begin ! Actual := First_Actual (Call_Node); Formal := First_Formal (Subp); Parent_Formal := First_Formal (Parent_Subp); while Present (Formal) loop *************** package body Exp_Ch6 is *** 2778,2797 **** Rewrite (Actual, Unchecked_Convert_To (Parent_Typ, Relocate_Node (Actual))); - - -- If the relocated node is a function call then it - -- can be part of the expansion of the predefined - -- equality operator of a tagged type and we may - -- need to adjust its SCIL dispatching node. - - if Generate_SCIL - and then Nkind (Actual) /= N_Null - and then Nkind (Expression (Actual)) - = N_Function_Call - then - Adjust_SCIL_Node (Actual, Expression (Actual)); - end if; - Analyze (Actual); Resolve (Actual, Parent_Typ); end if; --- 2902,2907 ---- *************** package body Exp_Ch6 is *** 2827,2833 **** -- Check for violation of No_Abort_Statements if Is_RTE (Subp, RE_Abort_Task) then ! Check_Restriction (No_Abort_Statements, N); -- Check for violation of No_Dynamic_Attachment --- 2937,2943 ---- -- Check for violation of No_Abort_Statements if Is_RTE (Subp, RE_Abort_Task) then ! Check_Restriction (No_Abort_Statements, Call_Node); -- Check for violation of No_Dynamic_Attachment *************** package body Exp_Ch6 is *** 2840,2868 **** Is_RTE (Subp, RE_Detach_Handler) or else Is_RTE (Subp, RE_Reference)) then ! Check_Restriction (No_Dynamic_Attachment, N); end if; -- Deal with case where call is an explicit dereference ! if Nkind (Name (N)) = N_Explicit_Dereference then -- Handle case of access to protected subprogram type if Is_Access_Protected_Subprogram_Type ! (Base_Type (Etype (Prefix (Name (N))))) then ! -- If this is a call through an access to protected operation, ! -- the prefix has the form (object'address, operation'access). ! -- Rewrite as a for other protected calls: the object is the ! -- first parameter of the list of actuals. declare Call : Node_Id; Parm : List_Id; Nam : Node_Id; Obj : Node_Id; ! Ptr : constant Node_Id := Prefix (Name (N)); T : constant Entity_Id := Equivalent_Type (Base_Type (Etype (Ptr))); --- 2950,2978 ---- Is_RTE (Subp, RE_Detach_Handler) or else Is_RTE (Subp, RE_Reference)) then ! Check_Restriction (No_Dynamic_Attachment, Call_Node); end if; -- Deal with case where call is an explicit dereference ! if Nkind (Name (Call_Node)) = N_Explicit_Dereference then -- Handle case of access to protected subprogram type if Is_Access_Protected_Subprogram_Type ! (Base_Type (Etype (Prefix (Name (Call_Node))))) then ! -- If this is a call through an access to protected operation, the ! -- prefix has the form (object'address, operation'access). Rewrite ! -- as a for other protected calls: the object is the 1st parameter ! -- of the list of actuals. declare Call : Node_Id; Parm : List_Id; Nam : Node_Id; Obj : Node_Id; ! Ptr : constant Node_Id := Prefix (Name (Call_Node)); T : constant Entity_Id := Equivalent_Type (Base_Type (Etype (Ptr))); *************** package body Exp_Ch6 is *** 2887,2894 **** Make_Explicit_Dereference (Loc, Prefix => Nam); ! if Present (Parameter_Associations (N)) then ! Parm := Parameter_Associations (N); else Parm := New_List; end if; --- 2997,3004 ---- Make_Explicit_Dereference (Loc, Prefix => Nam); ! if Present (Parameter_Associations (Call_Node)) then ! Parm := Parameter_Associations (Call_Node); else Parm := New_List; end if; *************** package body Exp_Ch6 is *** 2907,2913 **** Parameter_Associations => Parm); end if; ! Set_First_Named_Actual (Call, First_Named_Actual (N)); Set_Etype (Call, Etype (D_T)); -- We do not re-analyze the call to avoid infinite recursion. --- 3017,3023 ---- Parameter_Associations => Parm); end if; ! Set_First_Named_Actual (Call, First_Named_Actual (Call_Node)); Set_Etype (Call, Etype (D_T)); -- We do not re-analyze the call to avoid infinite recursion. *************** package body Exp_Ch6 is *** 2915,2921 **** -- the checks on the prefix that would otherwise be emitted -- when resolving a call. ! Rewrite (N, Call); Analyze (Nam); Apply_Access_Check (Nam); Analyze (Obj); --- 3025,3031 ---- -- the checks on the prefix that would otherwise be emitted -- when resolving a call. ! Rewrite (Call_Node, Call); Analyze (Nam); Apply_Access_Check (Nam); Analyze (Obj); *************** package body Exp_Ch6 is *** 2930,2957 **** -- In the case where the intrinsic is to be processed by the back end, -- the call to Expand_Intrinsic_Call will do nothing, which is fine, ! -- since the idea in this case is to pass the call unchanged. ! -- If the intrinsic is an inherited unchecked conversion, and the ! -- derived type is the target type of the conversion, we must retain ! -- it as the return type of the expression. Otherwise the expansion ! -- below, which uses the parent operation, will yield the wrong type. if Is_Intrinsic_Subprogram (Subp) then ! Expand_Intrinsic_Call (N, Subp); ! if Nkind (N) = N_Unchecked_Type_Conversion and then Parent_Subp /= Orig_Subp and then Etype (Parent_Subp) /= Etype (Orig_Subp) then ! Set_Etype (N, Etype (Orig_Subp)); end if; return; end if; ! if Ekind (Subp) = E_Function ! or else Ekind (Subp) = E_Procedure ! then -- We perform two simple optimization on calls: -- a) replace calls to null procedures unconditionally; --- 3040,3066 ---- -- In the case where the intrinsic is to be processed by the back end, -- the call to Expand_Intrinsic_Call will do nothing, which is fine, ! -- since the idea in this case is to pass the call unchanged. If the ! -- intrinsic is an inherited unchecked conversion, and the derived type ! -- is the target type of the conversion, we must retain it as the return ! -- type of the expression. Otherwise the expansion below, which uses the ! -- parent operation, will yield the wrong type. if Is_Intrinsic_Subprogram (Subp) then ! Expand_Intrinsic_Call (Call_Node, Subp); ! if Nkind (Call_Node) = N_Unchecked_Type_Conversion and then Parent_Subp /= Orig_Subp and then Etype (Parent_Subp) /= Etype (Orig_Subp) then ! Set_Etype (Call_Node, Etype (Orig_Subp)); end if; return; end if; ! if Ekind_In (Subp, E_Function, E_Procedure) then ! -- We perform two simple optimization on calls: -- a) replace calls to null procedures unconditionally; *************** package body Exp_Ch6 is *** 2966,2978 **** -- that tree generated is the same in both cases, for Inspector use. if Is_RTE (Subp, RE_To_Address) then ! Rewrite (N, Unchecked_Convert_To ! (RTE (RE_Address), Relocate_Node (First_Actual (N)))); return; elsif Is_Null_Procedure (Subp) then ! Rewrite (N, Make_Null_Statement (Loc)); return; end if; --- 3075,3087 ---- -- that tree generated is the same in both cases, for Inspector use. if Is_RTE (Subp, RE_To_Address) then ! Rewrite (Call_Node, Unchecked_Convert_To ! (RTE (RE_Address), Relocate_Node (First_Actual (Call_Node)))); return; elsif Is_Null_Procedure (Subp) then ! Rewrite (Call_Node, Make_Null_Statement (Loc)); return; end if; *************** package body Exp_Ch6 is *** 3046,3053 **** else Bod := Body_To_Inline (Spec); ! if (In_Extended_Main_Code_Unit (N) ! or else In_Extended_Main_Code_Unit (Parent (N)) or else Has_Pragma_Inline_Always (Subp)) and then (not In_Same_Extended_Unit (Sloc (Bod), Loc) or else --- 3155,3162 ---- else Bod := Body_To_Inline (Spec); ! if (In_Extended_Main_Code_Unit (Call_Node) ! or else In_Extended_Main_Code_Unit (Parent (Call_Node)) or else Has_Pragma_Inline_Always (Subp)) and then (not In_Same_Extended_Unit (Sloc (Bod), Loc) or else *************** package body Exp_Ch6 is *** 3067,3073 **** -- visible a private entity in the body of the main unit, -- that gigi will see before its sees its proper definition. ! elsif not (In_Extended_Main_Code_Unit (N)) and then In_Package_Body then Must_Inline := not In_Extended_Main_Source_Unit (Subp); --- 3176,3182 ---- -- visible a private entity in the body of the main unit, -- that gigi will see before its sees its proper definition. ! elsif not (In_Extended_Main_Code_Unit (Call_Node)) and then In_Package_Body then Must_Inline := not In_Extended_Main_Source_Unit (Subp); *************** package body Exp_Ch6 is *** 3075,3081 **** end if; if Must_Inline then ! Expand_Inlined_Call (N, Subp, Orig_Subp); else -- Let the back end handle it --- 3184,3190 ---- end if; if Must_Inline then ! Expand_Inlined_Call (Call_Node, Subp, Orig_Subp); else -- Let the back end handle it *************** package body Exp_Ch6 is *** 3084,3096 **** if Front_End_Inlining and then Nkind (Spec) = N_Subprogram_Declaration ! and then (In_Extended_Main_Code_Unit (N)) and then No (Body_To_Inline (Spec)) and then not Has_Completion (Subp) and then In_Same_Extended_Unit (Sloc (Spec), Loc) then Cannot_Inline ! ("cannot inline& (body not seen yet)?", N, Subp); end if; end if; end Inlined_Subprogram; --- 3193,3205 ---- if Front_End_Inlining and then Nkind (Spec) = N_Subprogram_Declaration ! and then (In_Extended_Main_Code_Unit (Call_Node)) and then No (Body_To_Inline (Spec)) and then not Has_Completion (Subp) and then In_Same_Extended_Unit (Sloc (Spec), Loc) then Cannot_Inline ! ("cannot inline& (body not seen yet)?", Call_Node, Subp); end if; end if; end Inlined_Subprogram; *************** package body Exp_Ch6 is *** 3104,3137 **** -- In Ada 2005, this may be an indirect call to an access parameter that -- is an access_to_subprogram. In that case the anonymous type has a -- scope that is a protected operation, but the call is a regular one. Scop := Scope (Subp); ! if Nkind (N) /= N_Entry_Call_Statement and then Is_Protected_Type (Scop) and then Ekind (Subp) /= E_Subprogram_Type then -- If the call is an internal one, it is rewritten as a call to the -- corresponding unprotected subprogram. ! Expand_Protected_Subprogram_Call (N, Subp, Scop); end if; -- Functions returning controlled objects need special attention: -- if the return type is limited, the context is an initialization -- and different processing applies. If the call is to a protected ! -- function, the expansion above will call Expand_Call recusively. -- To prevent a double attachment, check that the current call is -- not a rewriting of a protected function call. ! if Needs_Finalization (Etype (Subp)) ! and then not Is_Inherently_Limited_Type (Etype (Subp)) ! and then ! (No (First_Formal (Subp)) ! or else ! not Is_Concurrent_Record_Type (Etype (First_Formal (Subp)))) ! then ! Expand_Ctrl_Function_Call (N); end if; -- Test for First_Optional_Parameter, and if so, truncate parameter list --- 3213,3264 ---- -- In Ada 2005, this may be an indirect call to an access parameter that -- is an access_to_subprogram. In that case the anonymous type has a -- scope that is a protected operation, but the call is a regular one. + -- In either case do not expand call if subprogram is eliminated. Scop := Scope (Subp); ! if Nkind (Call_Node) /= N_Entry_Call_Statement and then Is_Protected_Type (Scop) and then Ekind (Subp) /= E_Subprogram_Type + and then not Is_Eliminated (Subp) then -- If the call is an internal one, it is rewritten as a call to the -- corresponding unprotected subprogram. ! Expand_Protected_Subprogram_Call (Call_Node, Subp, Scop); end if; -- Functions returning controlled objects need special attention: -- if the return type is limited, the context is an initialization -- and different processing applies. If the call is to a protected ! -- function, the expansion above will call Expand_Call recursively. -- To prevent a double attachment, check that the current call is -- not a rewriting of a protected function call. ! if Needs_Finalization (Etype (Subp)) then ! if not Is_Immutably_Limited_Type (Etype (Subp)) ! and then ! (No (First_Formal (Subp)) ! or else ! not Is_Concurrent_Record_Type (Etype (First_Formal (Subp)))) ! then ! Expand_Ctrl_Function_Call (Call_Node); ! ! -- Build-in-place function calls which appear in anonymous contexts ! -- need a transient scope to ensure the proper finalization of the ! -- intermediate result after its use. ! ! elsif Is_Build_In_Place_Function_Call (Call_Node) ! and then Nkind_In (Parent (Call_Node), N_Attribute_Reference, ! N_Function_Call, ! N_Indexed_Component, ! N_Object_Renaming_Declaration, ! N_Procedure_Call_Statement, ! N_Selected_Component, ! N_Slice) ! then ! Establish_Transient_Scope (Call_Node, Sec_Stack => True); ! end if; end if; -- Test for First_Optional_Parameter, and if so, truncate parameter list *************** package body Exp_Ch6 is *** 3155,3161 **** -- the validity of the parameter before setting it. Formal := First_Formal (Subp); ! Actual := First_Actual (N); while Formal /= First_Optional_Parameter (Subp) loop Last_Keep_Arg := Actual; Next_Formal (Formal); --- 3282,3288 ---- -- the validity of the parameter before setting it. Formal := First_Formal (Subp); ! Actual := First_Actual (Call_Node); while Formal /= First_Optional_Parameter (Subp) loop Last_Keep_Arg := Actual; Next_Formal (Formal); *************** package body Exp_Ch6 is *** 3189,3196 **** -- If no arguments, delete entire list, this is the easy case if No (Last_Keep_Arg) then ! Set_Parameter_Associations (N, No_List); ! Set_First_Named_Actual (N, Empty); -- Case where at the last retained argument is positional. This -- is also an easy case, since the retained arguments are already --- 3316,3323 ---- -- If no arguments, delete entire list, this is the easy case if No (Last_Keep_Arg) then ! Set_Parameter_Associations (Call_Node, No_List); ! Set_First_Named_Actual (Call_Node, Empty); -- Case where at the last retained argument is positional. This -- is also an easy case, since the retained arguments are already *************** package body Exp_Ch6 is *** 3202,3208 **** Discard_Node (Remove_Next (Last_Keep_Arg)); end loop; ! Set_First_Named_Actual (N, Empty); -- This is the annoying case where the last retained argument -- is a named parameter. Since the original arguments are not --- 3329,3335 ---- Discard_Node (Remove_Next (Last_Keep_Arg)); end loop; ! Set_First_Named_Actual (Call_Node, Empty); -- This is the annoying case where the last retained argument -- is a named parameter. Since the original arguments are not *************** package body Exp_Ch6 is *** 3219,3232 **** -- list (they are still chained using First_Named_Actual -- and Next_Named_Actual, so we have not lost them!) ! Temp := First (Parameter_Associations (N)); -- Case of all parameters named, remove them all if Nkind (Temp) = N_Parameter_Association then ! while Is_Non_Empty_List (Parameter_Associations (N)) loop ! Temp := Remove_Head (Parameter_Associations (N)); end loop; -- Case of mixed positional/named, remove named parameters --- 3346,3367 ---- -- list (they are still chained using First_Named_Actual -- and Next_Named_Actual, so we have not lost them!) ! Temp := First (Parameter_Associations (Call_Node)); -- Case of all parameters named, remove them all if Nkind (Temp) = N_Parameter_Association then ! -- Suppress warnings to avoid warning on possible ! -- infinite loop (because Call_Node is not modified). ! ! pragma Warnings (Off); ! while Is_Non_Empty_List ! (Parameter_Associations (Call_Node)) ! loop ! Temp := ! Remove_Head (Parameter_Associations (Call_Node)); end loop; + pragma Warnings (On); -- Case of mixed positional/named, remove named parameters *************** package body Exp_Ch6 is *** 3246,3256 **** -- touched since we are only reordering them on the actual -- parameter association list. ! Passoc := Parent (First_Named_Actual (N)); loop Temp := Relocate_Node (Passoc); Append_To ! (Parameter_Associations (N), Temp); exit when Last_Keep_Arg = Explicit_Actual_Parameter (Passoc); Passoc := Parent (Next_Named_Actual (Passoc)); --- 3381,3391 ---- -- touched since we are only reordering them on the actual -- parameter association list. ! Passoc := Parent (First_Named_Actual (Call_Node)); loop Temp := Relocate_Node (Passoc); Append_To ! (Parameter_Associations (Call_Node), Temp); exit when Last_Keep_Arg = Explicit_Actual_Parameter (Passoc); Passoc := Parent (Next_Named_Actual (Passoc)); *************** package body Exp_Ch6 is *** 3304,3309 **** --- 3439,3447 ---- Temp : Entity_Id; Temp_Typ : Entity_Id; + Return_Object : Entity_Id := Empty; + -- Entity in declaration in an extended_return_statement + Is_Unc : constant Boolean := Is_Array_Type (Etype (Subp)) and then not Is_Constrained (Etype (Subp)); *************** package body Exp_Ch6 is *** 3312,3319 **** procedure Make_Exit_Label; -- Build declaration for exit label to be used in Return statements, ! -- sets Exit_Lab (the label node) and Lab_Decl (corresponding implcit ! -- declaration). function Process_Formals (N : Node_Id) return Traverse_Result; -- Replace occurrence of a formal with the corresponding actual, or the --- 3450,3457 ---- procedure Make_Exit_Label; -- Build declaration for exit label to be used in Return statements, ! -- sets Exit_Lab (the label node) and Lab_Decl (corresponding implicit ! -- declaration). Does nothing if Exit_Lab already set. function Process_Formals (N : Node_Id) return Traverse_Result; -- Replace occurrence of a formal with the corresponding actual, or the *************** package body Exp_Ch6 is *** 3343,3362 **** --------------------- procedure Make_Exit_Label is begin - -- Create exit label for subprogram if one does not exist yet - if No (Exit_Lab) then ! Lab_Id := ! Make_Identifier (Loc, ! Chars => New_Internal_Name ('L')); ! Set_Entity (Lab_Id, ! Make_Defining_Identifier (Loc, Chars (Lab_Id))); Exit_Lab := Make_Label (Loc, Lab_Id); - Lab_Decl := Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Entity (Lab_Id), Label_Construct => Exit_Lab); end if; end Make_Exit_Label; --- 3481,3495 ---- --------------------- procedure Make_Exit_Label is + Lab_Ent : Entity_Id; begin if No (Exit_Lab) then ! Lab_Ent := Make_Temporary (Loc, 'L'); ! Lab_Id := New_Reference_To (Lab_Ent, Loc); Exit_Lab := Make_Label (Loc, Lab_Id); Lab_Decl := Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Lab_Ent, Label_Construct => Exit_Lab); end if; end Make_Exit_Label; *************** package body Exp_Ch6 is *** 3402,3407 **** --- 3535,3556 ---- Rewrite (N, New_Copy (A)); end if; end if; + return Skip; + + elsif Is_Entity_Name (N) + and then Present (Return_Object) + and then Chars (N) = Chars (Return_Object) + then + -- Occurrence within an extended return statement. The return + -- object is local to the body been inlined, and thus the generic + -- copy is not analyzed yet, so we match by name, and replace it + -- with target of call. + + if Nkind (Targ) = N_Defining_Identifier then + Rewrite (N, New_Occurrence_Of (Targ, Loc)); + else + Rewrite (N, New_Copy_Tree (Targ)); + end if; return Skip; *************** package body Exp_Ch6 is *** 3409,3416 **** if No (Expression (N)) then Make_Exit_Label; Rewrite (N, ! Make_Goto_Statement (Loc, ! Name => New_Copy (Lab_Id))); else if Nkind (Parent (N)) = N_Handled_Sequence_Of_Statements --- 3558,3564 ---- if No (Expression (N)) then Make_Exit_Label; Rewrite (N, ! Make_Goto_Statement (Loc, Name => New_Copy (Lab_Id))); else if Nkind (Parent (N)) = N_Handled_Sequence_Of_Statements *************** package body Exp_Ch6 is *** 3468,3473 **** --- 3616,3661 ---- return OK; + elsif Nkind (N) = N_Extended_Return_Statement then + + -- An extended return becomes a block whose first statement is + -- the assignment of the initial expression of the return object + -- to the target of the call itself. + + declare + Return_Decl : constant Entity_Id := + First (Return_Object_Declarations (N)); + Assign : Node_Id; + + begin + Return_Object := Defining_Identifier (Return_Decl); + + if Present (Expression (Return_Decl)) then + if Nkind (Targ) = N_Defining_Identifier then + Assign := + Make_Assignment_Statement (Loc, + Name => New_Occurrence_Of (Targ, Loc), + Expression => Expression (Return_Decl)); + else + Assign := + Make_Assignment_Statement (Loc, + Name => New_Copy (Targ), + Expression => Expression (Return_Decl)); + end if; + + Set_Assignment_OK (Name (Assign)); + Prepend (Assign, + Statements (Handled_Statement_Sequence (N))); + end if; + + Rewrite (N, + Make_Block_Statement (Loc, + Handled_Statement_Sequence => + Handled_Statement_Sequence (N))); + + return OK; + end; + -- Remove pragma Unreferenced since it may refer to formals that -- are not visible in the inlined body, and in any case we will -- not be posting warnings on the inlined body so it is unneeded. *************** package body Exp_Ch6 is *** 3674,3688 **** if Nkind (Orig_Bod) = N_Defining_Identifier or else Nkind (Orig_Bod) = N_Defining_Operator_Symbol then ! -- Subprogram is a renaming_as_body. Calls appearing after the ! -- renaming can be replaced with calls to the renamed entity ! -- directly, because the subprograms are subtype conformant. If ! -- the renamed subprogram is an inherited operation, we must redo ! -- the expansion because implicit conversions may be needed. Set_Name (N, New_Occurrence_Of (Orig_Bod, Loc)); ! if Present (Alias (Orig_Bod)) then Expand_Call (N); end if; --- 3862,3877 ---- if Nkind (Orig_Bod) = N_Defining_Identifier or else Nkind (Orig_Bod) = N_Defining_Operator_Symbol then ! -- Subprogram is renaming_as_body. Calls occurring after the renaming ! -- can be replaced with calls to the renamed entity directly, because ! -- the subprograms are subtype conformant. If the renamed subprogram ! -- is an inherited operation, we must redo the expansion because ! -- implicit conversions may be needed. Similarly, if the renamed ! -- entity is inlined, expand the call for further optimizations. Set_Name (N, New_Occurrence_Of (Orig_Bod, Loc)); ! if Present (Alias (Orig_Bod)) or else Is_Inlined (Orig_Bod) then Expand_Call (N); end if; *************** package body Exp_Ch6 is *** 3793,3801 **** end if; else ! Temp := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('C')); -- If the actual for an in/in-out parameter is a view conversion, -- make it into an unchecked conversion, given that an untagged --- 3982,3988 ---- end if; else ! Temp := Make_Temporary (Loc, 'C'); -- If the actual for an in/in-out parameter is a view conversion, -- make it into an unchecked conversion, given that an untagged *************** package body Exp_Ch6 is *** 3880,3890 **** then Targ := Name (Parent (N)); else -- Replace call with temporary and create its declaration ! Temp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('C')); Set_Is_Internal (Temp); -- For the unconstrained case, the generated temporary has the --- 4067,4081 ---- then Targ := Name (Parent (N)); + elsif Nkind (Parent (N)) = N_Object_Declaration + and then Is_Limited_Type (Etype (Subp)) + then + Targ := Defining_Identifier (Parent (N)); + else -- Replace call with temporary and create its declaration ! Temp := Make_Temporary (Loc, 'C'); Set_Is_Internal (Temp); -- For the unconstrained case, the generated temporary has the *************** package body Exp_Ch6 is *** 4005,4010 **** --- 4196,4923 ---- end loop; end Expand_Inlined_Call; + ---------------------------------------- + -- Expand_N_Extended_Return_Statement -- + ---------------------------------------- + + -- If there is a Handled_Statement_Sequence, we rewrite this: + + -- return Result : T := do + -- + -- end return; + + -- to be: + + -- declare + -- Result : T := ; + -- begin + -- + -- return Result; + -- end; + + -- Otherwise (no Handled_Statement_Sequence), we rewrite this: + + -- return Result : T := ; + + -- to be: + + -- return ; + + -- unless it's build-in-place or there's no , in which case + -- we generate: + + -- declare + -- Result : T := ; + -- begin + -- return Result; + -- end; + + -- Note that this case could have been written by the user as an extended + -- return statement, or could have been transformed to this from a simple + -- return statement. + + -- That is, we need to have a reified return object if there are statements + -- (which might refer to it) or if we're doing build-in-place (so we can + -- set its address to the final resting place or if there is no expression + -- (in which case default initial values might need to be set). + + procedure Expand_N_Extended_Return_Statement (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + + Return_Object_Entity : constant Entity_Id := + First_Entity (Return_Statement_Entity (N)); + Return_Object_Decl : constant Node_Id := + Parent (Return_Object_Entity); + Parent_Function : constant Entity_Id := + Return_Applies_To (Return_Statement_Entity (N)); + Parent_Function_Typ : constant Entity_Id := Etype (Parent_Function); + Is_Build_In_Place : constant Boolean := + Is_Build_In_Place_Function (Parent_Function); + + Return_Stm : Node_Id; + Statements : List_Id; + Handled_Stm_Seq : Node_Id; + Result : Node_Id; + Exp : Node_Id; + + function Has_Controlled_Parts (Typ : Entity_Id) return Boolean; + -- Determine whether type Typ is controlled or contains a controlled + -- subcomponent. + + function Move_Activation_Chain return Node_Id; + -- Construct a call to System.Tasking.Stages.Move_Activation_Chain + -- with parameters: + -- From current activation chain + -- To activation chain passed in by the caller + -- New_Master master passed in by the caller + + function Move_Final_List return Node_Id; + -- Construct call to System.Finalization_Implementation.Move_Final_List + -- with parameters: + -- + -- From finalization list of the return statement + -- To finalization list passed in by the caller + + -------------------------- + -- Has_Controlled_Parts -- + -------------------------- + + function Has_Controlled_Parts (Typ : Entity_Id) return Boolean is + begin + return + Is_Controlled (Typ) + or else Has_Controlled_Component (Typ); + end Has_Controlled_Parts; + + --------------------------- + -- Move_Activation_Chain -- + --------------------------- + + function Move_Activation_Chain return Node_Id is + Activation_Chain_Formal : constant Entity_Id := + Build_In_Place_Formal + (Parent_Function, BIP_Activation_Chain); + To : constant Node_Id := + New_Reference_To + (Activation_Chain_Formal, Loc); + Master_Formal : constant Entity_Id := + Build_In_Place_Formal + (Parent_Function, BIP_Master); + New_Master : constant Node_Id := + New_Reference_To (Master_Formal, Loc); + + Chain_Entity : Entity_Id; + From : Node_Id; + + begin + Chain_Entity := First_Entity (Return_Statement_Entity (N)); + while Chars (Chain_Entity) /= Name_uChain loop + Chain_Entity := Next_Entity (Chain_Entity); + end loop; + + From := + Make_Attribute_Reference (Loc, + Prefix => New_Reference_To (Chain_Entity, Loc), + Attribute_Name => Name_Unrestricted_Access); + -- ??? Not clear why "Make_Identifier (Loc, Name_uChain)" doesn't + -- work, instead of "New_Reference_To (Chain_Entity, Loc)" above. + + return + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (RTE (RE_Move_Activation_Chain), Loc), + Parameter_Associations => New_List (From, To, New_Master)); + end Move_Activation_Chain; + + --------------------- + -- Move_Final_List -- + --------------------- + + function Move_Final_List return Node_Id is + Flist : constant Entity_Id := + Finalization_Chain_Entity (Return_Statement_Entity (N)); + + From : constant Node_Id := New_Reference_To (Flist, Loc); + + Caller_Final_List : constant Entity_Id := + Build_In_Place_Formal + (Parent_Function, BIP_Final_List); + + To : constant Node_Id := New_Reference_To (Caller_Final_List, Loc); + + begin + -- Catch cases where a finalization chain entity has not been + -- associated with the return statement entity. + + pragma Assert (Present (Flist)); + + -- Build required call + + return + Make_If_Statement (Loc, + Condition => + Make_Op_Ne (Loc, + Left_Opnd => New_Copy (From), + Right_Opnd => New_Node (N_Null, Loc)), + Then_Statements => + New_List ( + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (RTE (RE_Move_Final_List), Loc), + Parameter_Associations => New_List (From, To)))); + end Move_Final_List; + + -- Start of processing for Expand_N_Extended_Return_Statement + + begin + if Nkind (Return_Object_Decl) = N_Object_Declaration then + Exp := Expression (Return_Object_Decl); + else + Exp := Empty; + end if; + + Handled_Stm_Seq := Handled_Statement_Sequence (N); + + -- Build a simple_return_statement that returns the return object when + -- there is a statement sequence, or no expression, or the result will + -- be built in place. Note however that we currently do this for all + -- composite cases, even though nonlimited composite results are not yet + -- built in place (though we plan to do so eventually). + + if Present (Handled_Stm_Seq) + or else Is_Composite_Type (Etype (Parent_Function)) + or else No (Exp) + then + if No (Handled_Stm_Seq) then + Statements := New_List; + + -- If the extended return has a handled statement sequence, then wrap + -- it in a block and use the block as the first statement. + + else + Statements := + New_List (Make_Block_Statement (Loc, + Declarations => New_List, + Handled_Statement_Sequence => Handled_Stm_Seq)); + end if; + + -- If control gets past the above Statements, we have successfully + -- completed the return statement. If the result type has controlled + -- parts and the return is for a build-in-place function, then we + -- call Move_Final_List to transfer responsibility for finalization + -- of the return object to the caller. An alternative would be to + -- declare a Success flag in the function, initialize it to False, + -- and set it to True here. Then move the Move_Final_List call into + -- the cleanup code, and check Success. If Success then make a call + -- to Move_Final_List else do finalization. Then we can remove the + -- abort-deferral and the nulling-out of the From parameter from + -- Move_Final_List. Note that the current method is not quite correct + -- in the rather obscure case of a select-then-abort statement whose + -- abortable part contains the return statement. + + -- Check the type of the function to determine whether to move the + -- finalization list. A special case arises when processing a simple + -- return statement which has been rewritten as an extended return. + -- In that case check the type of the returned object or the original + -- expression. + + if Is_Build_In_Place + and then + (Has_Controlled_Parts (Parent_Function_Typ) + or else (Is_Class_Wide_Type (Parent_Function_Typ) + and then + Has_Controlled_Parts (Root_Type (Parent_Function_Typ))) + or else Has_Controlled_Parts (Etype (Return_Object_Entity)) + or else (Present (Exp) + and then Has_Controlled_Parts (Etype (Exp)))) + then + Append_To (Statements, Move_Final_List); + end if; + + -- Similarly to the above Move_Final_List, if the result type + -- contains tasks, we call Move_Activation_Chain. Later, the cleanup + -- code will call Complete_Master, which will terminate any + -- unactivated tasks belonging to the return statement master. But + -- Move_Activation_Chain updates their master to be that of the + -- caller, so they will not be terminated unless the return statement + -- completes unsuccessfully due to exception, abort, goto, or exit. + -- As a formality, we test whether the function requires the result + -- to be built in place, though that's necessarily true for the case + -- of result types with task parts. + + if Is_Build_In_Place and Has_Task (Etype (Parent_Function)) then + Append_To (Statements, Move_Activation_Chain); + end if; + + -- Build a simple_return_statement that returns the return object + + Return_Stm := + Make_Simple_Return_Statement (Loc, + Expression => New_Occurrence_Of (Return_Object_Entity, Loc)); + Append_To (Statements, Return_Stm); + + Handled_Stm_Seq := + Make_Handled_Sequence_Of_Statements (Loc, Statements); + end if; + + -- Case where we build a block + + if Present (Handled_Stm_Seq) then + Result := + Make_Block_Statement (Loc, + Declarations => Return_Object_Declarations (N), + Handled_Statement_Sequence => Handled_Stm_Seq); + + -- We set the entity of the new block statement to be that of the + -- return statement. This is necessary so that various fields, such + -- as Finalization_Chain_Entity carry over from the return statement + -- to the block. Note that this block is unusual, in that its entity + -- is an E_Return_Statement rather than an E_Block. + + Set_Identifier + (Result, New_Occurrence_Of (Return_Statement_Entity (N), Loc)); + + -- If the object decl was already rewritten as a renaming, then + -- we don't want to do the object allocation and transformation of + -- of the return object declaration to a renaming. This case occurs + -- when the return object is initialized by a call to another + -- build-in-place function, and that function is responsible for the + -- allocation of the return object. + + if Is_Build_In_Place + and then + Nkind (Return_Object_Decl) = N_Object_Renaming_Declaration + then + pragma Assert (Nkind (Original_Node (Return_Object_Decl)) = + N_Object_Declaration + and then Is_Build_In_Place_Function_Call + (Expression (Original_Node (Return_Object_Decl)))); + + Set_By_Ref (Return_Stm); -- Return build-in-place results by ref + + elsif Is_Build_In_Place then + + -- Locate the implicit access parameter associated with the + -- caller-supplied return object and convert the return + -- statement's return object declaration to a renaming of a + -- dereference of the access parameter. If the return object's + -- declaration includes an expression that has not already been + -- expanded as separate assignments, then add an assignment + -- statement to ensure the return object gets initialized. + + -- declare + -- Result : T [:= ]; + -- begin + -- ... + + -- is converted to + + -- declare + -- Result : T renames FuncRA.all; + -- [Result := New_Reference_To (Return_Obj_Id, Loc), + Expression => Relocate_Node (Return_Obj_Expr)); + Set_Etype (Name (Init_Assignment), Etype (Return_Obj_Id)); + Set_Assignment_OK (Name (Init_Assignment)); + Set_No_Ctrl_Actions (Init_Assignment); + + Set_Parent (Name (Init_Assignment), Init_Assignment); + Set_Parent (Expression (Init_Assignment), Init_Assignment); + + Set_Expression (Return_Object_Decl, Empty); + + if Is_Class_Wide_Type (Etype (Return_Obj_Id)) + and then not Is_Class_Wide_Type + (Etype (Expression (Init_Assignment))) + then + Rewrite (Expression (Init_Assignment), + Make_Type_Conversion (Loc, + Subtype_Mark => + New_Occurrence_Of + (Etype (Return_Obj_Id), Loc), + Expression => + Relocate_Node (Expression (Init_Assignment)))); + end if; + + -- In the case of functions where the calling context can + -- determine the form of allocation needed, initialization + -- is done with each part of the if statement that handles + -- the different forms of allocation (this is true for + -- unconstrained and tagged result subtypes). + + if Constr_Result + and then not Is_Tagged_Type (Underlying_Type (Result_Subt)) + then + Insert_After (Return_Object_Decl, Init_Assignment); + end if; + end if; + + -- When the function's subtype is unconstrained, a run-time + -- test is needed to determine the form of allocation to use + -- for the return object. The function has an implicit formal + -- parameter indicating this. If the BIP_Alloc_Form formal has + -- the value one, then the caller has passed access to an + -- existing object for use as the return object. If the value + -- is two, then the return object must be allocated on the + -- secondary stack. Otherwise, the object must be allocated in + -- a storage pool (currently only supported for the global + -- heap, user-defined storage pools TBD ???). We generate an + -- if statement to test the implicit allocation formal and + -- initialize a local access value appropriately, creating + -- allocators in the secondary stack and global heap cases. + -- The special formal also exists and must be tested when the + -- function has a tagged result, even when the result subtype + -- is constrained, because in general such functions can be + -- called in dispatching contexts and must be handled similarly + -- to functions with a class-wide result. + + if not Constr_Result + or else Is_Tagged_Type (Underlying_Type (Result_Subt)) + then + Obj_Alloc_Formal := + Build_In_Place_Formal (Parent_Function, BIP_Alloc_Form); + + declare + Ref_Type : Entity_Id; + Ptr_Type_Decl : Node_Id; + Alloc_Obj_Id : Entity_Id; + Alloc_Obj_Decl : Node_Id; + Alloc_If_Stmt : Node_Id; + SS_Allocator : Node_Id; + Heap_Allocator : Node_Id; + + begin + -- Reuse the itype created for the function's implicit + -- access formal. This avoids the need to create a new + -- access type here, plus it allows assigning the access + -- formal directly without applying a conversion. + + -- Ref_Type := Etype (Object_Access); + + -- Create an access type designating the function's + -- result subtype. + + Ref_Type := Make_Temporary (Loc, 'A'); + + Ptr_Type_Decl := + Make_Full_Type_Declaration (Loc, + Defining_Identifier => Ref_Type, + Type_Definition => + Make_Access_To_Object_Definition (Loc, + All_Present => True, + Subtype_Indication => + New_Reference_To (Return_Obj_Typ, Loc))); + + Insert_Before (Return_Object_Decl, Ptr_Type_Decl); + + -- Create an access object that will be initialized to an + -- access value denoting the return object, either coming + -- from an implicit access value passed in by the caller + -- or from the result of an allocator. + + Alloc_Obj_Id := Make_Temporary (Loc, 'R'); + Set_Etype (Alloc_Obj_Id, Ref_Type); + + Alloc_Obj_Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => Alloc_Obj_Id, + Object_Definition => New_Reference_To + (Ref_Type, Loc)); + + Insert_Before (Return_Object_Decl, Alloc_Obj_Decl); + + -- Create allocators for both the secondary stack and + -- global heap. If there's an initialization expression, + -- then create these as initialized allocators. + + if Present (Return_Obj_Expr) + and then not No_Initialization (Return_Object_Decl) + then + -- Always use the type of the expression for the + -- qualified expression, rather than the result type. + -- In general we cannot always use the result type + -- for the allocator, because the expression might be + -- of a specific type, such as in the case of an + -- aggregate or even a nonlimited object when the + -- result type is a limited class-wide interface type. + + Heap_Allocator := + Make_Allocator (Loc, + Expression => + Make_Qualified_Expression (Loc, + Subtype_Mark => + New_Reference_To + (Etype (Return_Obj_Expr), Loc), + Expression => + New_Copy_Tree (Return_Obj_Expr))); + + else + -- If the function returns a class-wide type we cannot + -- use the return type for the allocator. Instead we + -- use the type of the expression, which must be an + -- aggregate of a definite type. + + if Is_Class_Wide_Type (Return_Obj_Typ) then + Heap_Allocator := + Make_Allocator (Loc, + Expression => + New_Reference_To + (Etype (Return_Obj_Expr), Loc)); + else + Heap_Allocator := + Make_Allocator (Loc, + Expression => + New_Reference_To (Return_Obj_Typ, Loc)); + end if; + + -- If the object requires default initialization then + -- that will happen later following the elaboration of + -- the object renaming. If we don't turn it off here + -- then the object will be default initialized twice. + + Set_No_Initialization (Heap_Allocator); + end if; + + -- If the No_Allocators restriction is active, then only + -- an allocator for secondary stack allocation is needed. + -- It's OK for such allocators to have Comes_From_Source + -- set to False, because gigi knows not to flag them as + -- being a violation of No_Implicit_Heap_Allocations. + + if Restriction_Active (No_Allocators) then + SS_Allocator := Heap_Allocator; + Heap_Allocator := Make_Null (Loc); + + -- Otherwise the heap allocator may be needed, so we make + -- another allocator for secondary stack allocation. + + else + SS_Allocator := New_Copy_Tree (Heap_Allocator); + + -- The heap allocator is marked Comes_From_Source + -- since it corresponds to an explicit user-written + -- allocator (that is, it will only be executed on + -- behalf of callers that call the function as + -- initialization for such an allocator). This + -- prevents errors when No_Implicit_Heap_Allocations + -- is in force. + + Set_Comes_From_Source (Heap_Allocator, True); + end if; + + -- The allocator is returned on the secondary stack. We + -- don't do this on VM targets, since the SS is not used. + + if VM_Target = No_VM then + Set_Storage_Pool (SS_Allocator, RTE (RE_SS_Pool)); + Set_Procedure_To_Call + (SS_Allocator, RTE (RE_SS_Allocate)); + + -- The allocator is returned on the secondary stack, + -- so indicate that the function return, as well as + -- the block that encloses the allocator, must not + -- release it. The flags must be set now because the + -- decision to use the secondary stack is done very + -- late in the course of expanding the return + -- statement, past the point where these flags are + -- normally set. + + Set_Sec_Stack_Needed_For_Return (Parent_Function); + Set_Sec_Stack_Needed_For_Return + (Return_Statement_Entity (N)); + Set_Uses_Sec_Stack (Parent_Function); + Set_Uses_Sec_Stack (Return_Statement_Entity (N)); + end if; + + -- Create an if statement to test the BIP_Alloc_Form + -- formal and initialize the access object to either the + -- BIP_Object_Access formal (BIP_Alloc_Form = 0), the + -- result of allocating the object in the secondary stack + -- (BIP_Alloc_Form = 1), or else an allocator to create + -- the return object in the heap (BIP_Alloc_Form = 2). + + -- ??? An unchecked type conversion must be made in the + -- case of assigning the access object formal to the + -- local access object, because a normal conversion would + -- be illegal in some cases (such as converting access- + -- to-unconstrained to access-to-constrained), but the + -- the unchecked conversion will presumably fail to work + -- right in just such cases. It's not clear at all how to + -- handle this. ??? + + Alloc_If_Stmt := + Make_If_Statement (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => + New_Reference_To (Obj_Alloc_Formal, Loc), + Right_Opnd => + Make_Integer_Literal (Loc, + UI_From_Int (BIP_Allocation_Form'Pos + (Caller_Allocation)))), + Then_Statements => + New_List (Make_Assignment_Statement (Loc, + Name => + New_Reference_To + (Alloc_Obj_Id, Loc), + Expression => + Make_Unchecked_Type_Conversion (Loc, + Subtype_Mark => + New_Reference_To (Ref_Type, Loc), + Expression => + New_Reference_To + (Object_Access, Loc)))), + Elsif_Parts => + New_List (Make_Elsif_Part (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => + New_Reference_To + (Obj_Alloc_Formal, Loc), + Right_Opnd => + Make_Integer_Literal (Loc, + UI_From_Int ( + BIP_Allocation_Form'Pos + (Secondary_Stack)))), + Then_Statements => + New_List + (Make_Assignment_Statement (Loc, + Name => + New_Reference_To + (Alloc_Obj_Id, Loc), + Expression => + SS_Allocator)))), + Else_Statements => + New_List (Make_Assignment_Statement (Loc, + Name => + New_Reference_To + (Alloc_Obj_Id, Loc), + Expression => + Heap_Allocator))); + + -- If a separate initialization assignment was created + -- earlier, append that following the assignment of the + -- implicit access formal to the access object, to ensure + -- that the return object is initialized in that case. + -- In this situation, the target of the assignment must + -- be rewritten to denote a dereference of the access to + -- the return object passed in by the caller. + + if Present (Init_Assignment) then + Rewrite (Name (Init_Assignment), + Make_Explicit_Dereference (Loc, + Prefix => New_Reference_To (Alloc_Obj_Id, Loc))); + Set_Etype + (Name (Init_Assignment), Etype (Return_Obj_Id)); + + Append_To + (Then_Statements (Alloc_If_Stmt), + Init_Assignment); + end if; + + Insert_Before (Return_Object_Decl, Alloc_If_Stmt); + + -- Remember the local access object for use in the + -- dereference of the renaming created below. + + Object_Access := Alloc_Obj_Id; + end; + end if; + + -- Replace the return object declaration with a renaming of a + -- dereference of the access value designating the return + -- object. + + Obj_Acc_Deref := + Make_Explicit_Dereference (Loc, + Prefix => New_Reference_To (Object_Access, Loc)); + + Rewrite (Return_Object_Decl, + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Return_Obj_Id, + Access_Definition => Empty, + Subtype_Mark => New_Occurrence_Of + (Return_Obj_Typ, Loc), + Name => Obj_Acc_Deref)); + + Set_Renamed_Object (Return_Obj_Id, Obj_Acc_Deref); + end; + end if; + + -- Case where we do not build a block + + else + -- We're about to drop Return_Object_Declarations on the floor, so + -- we need to insert it, in case it got expanded into useful code. + -- Remove side effects from expression, which may be duplicated in + -- subsequent checks (see Expand_Simple_Function_Return). + + Insert_List_Before (N, Return_Object_Declarations (N)); + Remove_Side_Effects (Exp); + + -- Build simple_return_statement that returns the expression directly + + Return_Stm := Make_Simple_Return_Statement (Loc, Expression => Exp); + + Result := Return_Stm; + end if; + + -- Set the flag to prevent infinite recursion + + Set_Comes_From_Extended_Return_Statement (Return_Stm); + + Rewrite (N, Result); + Analyze (N); + end Expand_N_Extended_Return_Statement; + ---------------------------- -- Expand_N_Function_Call -- ---------------------------- *************** package body Exp_Ch6 is *** 4038,4043 **** --- 4951,4995 ---- Expand_Call (N); end Expand_N_Procedure_Call_Statement; + -------------------------------------- + -- Expand_N_Simple_Return_Statement -- + -------------------------------------- + + procedure Expand_N_Simple_Return_Statement (N : Node_Id) is + begin + -- Defend against previous errors (i.e. 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 + + when E_Function | + E_Generic_Function => + Expand_Simple_Function_Return (N); + + when E_Procedure | + E_Generic_Procedure | + E_Entry | + E_Entry_Family | + E_Return_Statement => + Expand_Non_Function_Return (N); + + when others => + raise Program_Error; + end case; + + exception + when RE_Not_Available => + return; + end Expand_N_Simple_Return_Statement; + ------------------------------ -- Expand_N_Subprogram_Body -- ------------------------------ *************** package body Exp_Ch6 is *** 4064,4069 **** --- 5016,5023 ---- -- Initialize scalar out parameters if Initialize/Normalize_Scalars -- Reset Pure indication if any parameter has root type System.Address + -- or has any parameters of limited types, where limited means that the + -- run-time view is limited (i.e. the full type is limited). -- Wrap thread body *************** package body Exp_Ch6 is *** 4255,4261 **** begin F := First_Formal (Spec_Id); while Present (F) loop ! if Is_Descendent_Of_Address (Etype (F)) then Set_Is_Pure (Spec_Id, False); if Spec_Id /= Body_Id then --- 5209,5222 ---- begin F := First_Formal (Spec_Id); while Present (F) loop ! if Is_Descendent_Of_Address (Etype (F)) ! ! -- Note that this test is being made in the body of the ! -- subprogram, not the spec, so we are testing the full ! -- type for being limited here, as required. ! ! or else Is_Limited_Type (Etype (F)) ! then Set_Is_Pure (Spec_Id, False); if Spec_Id /= Body_Id then *************** package body Exp_Ch6 is *** 4343,4349 **** then null; ! elsif Is_Inherently_Limited_Type (Typ) then Set_Returns_By_Ref (Spec_Id); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then --- 5304,5310 ---- then null; ! elsif Is_Immutably_Limited_Type (Typ) then Set_Returns_By_Ref (Spec_Id); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then *************** package body Exp_Ch6 is *** 4354,4362 **** -- For a procedure, we add a return for all possible syntactic ends of -- the subprogram. ! if Ekind (Spec_Id) = E_Procedure ! or else Ekind (Spec_Id) = E_Generic_Procedure ! then Add_Return (Statements (H)); if Present (Exception_Handlers (H)) then --- 5315,5321 ---- -- For a procedure, we add a return for all possible syntactic ends of -- the subprogram. ! if Ekind_In (Spec_Id, E_Procedure, E_Generic_Procedure) then Add_Return (Statements (H)); if Present (Exception_Handlers (H)) then *************** package body Exp_Ch6 is *** 4500,4506 **** Push_Scope (Scope (Scop)); Analyze (Prot_Decl); ! Insert_Actions (N, Freeze_Entity (Prot_Id, Loc)); Set_Protected_Body_Subprogram (Subp, Prot_Id); -- Create protected operation as well. Even though the operation --- 5459,5465 ---- Push_Scope (Scope (Scop)); Analyze (Prot_Decl); ! Freeze_Before (N, Prot_Id); Set_Protected_Body_Subprogram (Subp, Prot_Id); -- Create protected operation as well. Even though the operation *************** package body Exp_Ch6 is *** 4541,4546 **** --- 5500,5621 ---- end if; end Expand_N_Subprogram_Declaration; + -------------------------------- + -- Expand_Non_Function_Return -- + -------------------------------- + + procedure Expand_Non_Function_Return (N : Node_Id) is + pragma Assert (No (Expression (N))); + + Loc : constant Source_Ptr := Sloc (N); + Scope_Id : Entity_Id := + Return_Applies_To (Return_Statement_Entity (N)); + Kind : constant Entity_Kind := Ekind (Scope_Id); + Call : Node_Id; + Acc_Stat : Node_Id; + Goto_Stat : Node_Id; + Lab_Node : Node_Id; + + begin + -- Call _Postconditions procedure if procedure with active + -- postconditions. Here, we use the Postcondition_Proc attribute, which + -- is needed for implicitly-generated returns. Functions never + -- have implicitly-generated returns, and there's no room for + -- Postcondition_Proc in E_Function, so we look up the identifier + -- Name_uPostconditions for function returns (see + -- Expand_Simple_Function_Return). + + if Ekind (Scope_Id) = E_Procedure + and then Has_Postconditions (Scope_Id) + then + pragma Assert (Present (Postcondition_Proc (Scope_Id))); + Insert_Action (N, + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (Postcondition_Proc (Scope_Id), Loc))); + 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 + return; + + -- If it is a nested return within an extended one, replace it with a + -- return of the previously declared return object. + + elsif Kind = E_Return_Statement then + Rewrite (N, + Make_Simple_Return_Statement (Loc, + Expression => + New_Occurrence_Of (First_Entity (Scope_Id), Loc))); + Set_Comes_From_Extended_Return_Statement (N); + Set_Return_Statement_Entity (N, Scope_Id); + Expand_Simple_Function_Return (N); + return; + end if; + + pragma Assert (Is_Entry (Scope_Id)); + + -- Look at the enclosing block to see whether the return is from an + -- accept statement or an entry body. + + for J in reverse 0 .. Scope_Stack.Last loop + Scope_Id := Scope_Stack.Table (J).Entity; + exit when Is_Concurrent_Type (Scope_Id); + end loop; + + -- If it is a return from accept statement it is expanded as call to + -- RTS Complete_Rendezvous and a goto to the end of the accept body. + + -- (cf : Expand_N_Accept_Statement, Expand_N_Selective_Accept, + -- Expand_N_Accept_Alternative in exp_ch9.adb) + + if Is_Task_Type (Scope_Id) then + + Call := + Make_Procedure_Call_Statement (Loc, + Name => New_Reference_To (RTE (RE_Complete_Rendezvous), Loc)); + Insert_Before (N, Call); + -- why not insert actions here??? + Analyze (Call); + + Acc_Stat := Parent (N); + while Nkind (Acc_Stat) /= N_Accept_Statement loop + Acc_Stat := Parent (Acc_Stat); + end loop; + + Lab_Node := Last (Statements + (Handled_Statement_Sequence (Acc_Stat))); + + Goto_Stat := Make_Goto_Statement (Loc, + Name => New_Occurrence_Of + (Entity (Identifier (Lab_Node)), Loc)); + + Set_Analyzed (Goto_Stat); + + Rewrite (N, Goto_Stat); + Analyze (N); + + -- If it is a return from an entry body, put a Complete_Entry_Body call + -- in front of the return. + + 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, + Prefix => + New_Reference_To + (Find_Protection_Object (Current_Scope), Loc), + Attribute_Name => + Name_Unchecked_Access))); + + Insert_Before (N, Call); + Analyze (Call); + end if; + end Expand_Non_Function_Return; + --------------------------------------- -- Expand_Protected_Object_Reference -- --------------------------------------- *************** package body Exp_Ch6 is *** 4556,4564 **** Proc : Entity_Id; begin ! Rec := ! Make_Identifier (Loc, ! Chars => Name_uObject); Set_Etype (Rec, Corresponding_Record_Type (Scop)); -- Find enclosing protected operation, and retrieve its first parameter, --- 5631,5637 ---- Proc : Entity_Id; begin ! Rec := Make_Identifier (Loc, Name_uObject); Set_Etype (Rec, Corresponding_Record_Type (Scop)); -- Find enclosing protected operation, and retrieve its first parameter, *************** package body Exp_Ch6 is *** 4610,4619 **** -- define _object later on. declare ! Decls : List_Id; ! Obj_Ptr : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => ! New_Internal_Name ('T')); begin Decls := New_List ( --- 5683,5690 ---- -- define _object later on. declare ! Decls : List_Id; ! Obj_Ptr : constant Entity_Id := Make_Temporary (Loc, 'T'); begin Decls := New_List ( *************** package body Exp_Ch6 is *** 4623,4632 **** Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Reference_To ! (Corresponding_Record_Type (Scop), Loc)))); Insert_Actions (N, Decls); ! Insert_Actions (N, Freeze_Entity (Obj_Ptr, Sloc (N))); Rec := Make_Explicit_Dereference (Loc, --- 5694,5703 ---- Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Reference_To ! (Corresponding_Record_Type (Scop), Loc)))); Insert_Actions (N, Decls); ! Freeze_Before (N, Obj_Ptr); Rec := Make_Explicit_Dereference (Loc, *************** package body Exp_Ch6 is *** 4713,4732 **** end if; end Expand_Protected_Subprogram_Call; -------------------------------- -- Is_Build_In_Place_Function -- -------------------------------- function Is_Build_In_Place_Function (E : Entity_Id) return Boolean is begin -- For now we test whether E denotes a function or access-to-function -- type whose result subtype is inherently limited. Later this test may -- be revised to allow composite nonlimited types. Functions with a -- foreign convention or whose result type has a foreign convention -- never qualify. ! if Ekind (E) = E_Function ! or else Ekind (E) = E_Generic_Function or else (Ekind (E) = E_Subprogram_Type and then Etype (E) /= Standard_Void_Type) then --- 5784,6410 ---- end if; end Expand_Protected_Subprogram_Call; + ----------------------------------- + -- Expand_Simple_Function_Return -- + ----------------------------------- + + -- The "simple" comes from the syntax rule simple_return_statement. + -- The semantics are not at all simple! + + procedure Expand_Simple_Function_Return (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + + Scope_Id : constant Entity_Id := + Return_Applies_To (Return_Statement_Entity (N)); + -- The function we are returning from + + R_Type : constant Entity_Id := Etype (Scope_Id); + -- The result type of the function + + Utyp : constant Entity_Id := Underlying_Type (R_Type); + + Exp : constant Node_Id := Expression (N); + pragma Assert (Present (Exp)); + + Exptyp : constant Entity_Id := Etype (Exp); + -- The type of the expression (not necessarily the same as R_Type) + + Subtype_Ind : Node_Id; + -- If the result type of the function is class-wide and the + -- expression has a specific type, then we use the expression's + -- type as the type of the return object. In cases where the + -- expression is an aggregate that is built in place, this avoids + -- the need for an expensive conversion of the return object to + -- the specific type on assignments to the individual components. + + begin + if Is_Class_Wide_Type (R_Type) + and then not Is_Class_Wide_Type (Etype (Exp)) + then + Subtype_Ind := New_Occurrence_Of (Etype (Exp), Loc); + else + Subtype_Ind := New_Occurrence_Of (R_Type, Loc); + end if; + + -- 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 ;" to be: + + -- return _anon_ : := + + -- 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. 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 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 do 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 + -- class-wide interface type, which is not a limited type, even though + -- the type of the expression may be. + + if not Comes_From_Extended_Return_Statement (N) + and then Is_Immutably_Limited_Type (Etype (Expression (N))) + and then Ada_Version >= Ada_2005 + and then not Debug_Flag_Dot_L + then + declare + Return_Object_Entity : constant Entity_Id := + Make_Temporary (Loc, 'R', Exp); + Obj_Decl : constant Node_Id := + Make_Object_Declaration (Loc, + Defining_Identifier => Return_Object_Entity, + Object_Definition => Subtype_Ind, + Expression => Exp); + + Ext : constant Node_Id := Make_Extended_Return_Statement (Loc, + Return_Object_Declarations => New_List (Obj_Decl)); + -- Do not perform this high-level optimization if the result type + -- is an interface because the "this" pointer must be displaced. + + begin + Rewrite (N, Ext); + Analyze (N); + return; + end; + end if; + + -- Here we have a simple return statement that is part of the expansion + -- of an extended return statement (either written by the user, or + -- generated by the above code). + + -- Always normalize C/Fortran boolean result. This is not always needed, + -- but it seems a good idea to minimize the passing around of non- + -- normalized values, and in any case this handles the processing of + -- barrier functions for protected types, which turn the condition into + -- a return statement. + + if Is_Boolean_Type (Exptyp) + and then Nonzero_Is_True (Exptyp) + then + Adjust_Condition (Exp); + Adjust_Result_Type (Exp, Exptyp); + end if; + + -- Do validity check if enabled for returns + + if Validity_Checks_On + and then Validity_Check_Returns + then + Ensure_Valid (Exp); + end if; + + -- Check the result expression of a scalar function against the subtype + -- of the function by inserting a conversion. This conversion must + -- eventually be performed for other classes of types, but for now it's + -- only done for scalars. + -- ??? + + if Is_Scalar_Type (Exptyp) then + Rewrite (Exp, Convert_To (R_Type, Exp)); + + -- The expression is resolved to ensure that the conversion gets + -- expanded to generate a possible constraint check. + + Analyze_And_Resolve (Exp, R_Type); + end if; + + -- Deal with returning variable length objects and controlled types + + -- Nothing to do if we are returning by reference, or this is not a + -- type that requires special processing (indicated by the fact that + -- it requires a cleanup scope for the secondary stack case). + + if Is_Immutably_Limited_Type (Exptyp) + or else Is_Limited_Interface (Exptyp) + then + null; + + elsif not Requires_Transient_Scope (R_Type) then + + -- Mutable records with no variable length components are not + -- returned on the sec-stack, so we need to make sure that the + -- backend will only copy back the size of the actual value, and not + -- the maximum size. We create an actual subtype for this purpose. + + declare + Ubt : constant Entity_Id := Underlying_Type (Base_Type (Exptyp)); + Decl : Node_Id; + Ent : Entity_Id; + begin + if Has_Discriminants (Ubt) + and then not Is_Constrained (Ubt) + and then not Has_Unchecked_Union (Ubt) + then + Decl := Build_Actual_Subtype (Ubt, Exp); + Ent := Defining_Identifier (Decl); + Insert_Action (Exp, Decl); + Rewrite (Exp, Unchecked_Convert_To (Ent, Exp)); + Analyze_And_Resolve (Exp); + end if; + end; + + -- Here if secondary stack is used + + else + -- Make sure that no surrounding block will reclaim the secondary + -- stack on which we are going to put the result. Not only may this + -- introduce secondary stack leaks but worse, if the reclamation is + -- done too early, then the result we are returning may get + -- clobbered. + + declare + S : Entity_Id; + begin + S := Current_Scope; + while Ekind (S) = E_Block or else Ekind (S) = E_Loop loop + Set_Sec_Stack_Needed_For_Return (S, True); + S := Enclosing_Dynamic_Scope (S); + end loop; + end; + + -- Optimize the case where the result is a function call. In this + -- case either the result is already on the secondary stack, or is + -- already being returned with the stack pointer depressed and no + -- further processing is required except to set the By_Ref flag to + -- ensure that gigi does not attempt an extra unnecessary copy. + -- (actually not just unnecessary but harmfully wrong in the case + -- of a controlled type, where gigi does not know how to do a copy). + -- To make up for a gcc 2.8.1 deficiency (???), we perform + -- the copy for array types if the constrained status of the + -- target type is different from that of the expression. + + if Requires_Transient_Scope (Exptyp) + and then + (not Is_Array_Type (Exptyp) + or else Is_Constrained (Exptyp) = Is_Constrained (R_Type) + or else CW_Or_Has_Controlled_Part (Utyp)) + and then Nkind (Exp) = N_Function_Call + then + Set_By_Ref (N); + + -- Remove side effects from the expression now so that other parts + -- of the expander do not have to reanalyze this node without this + -- optimization + + Rewrite (Exp, Duplicate_Subexpr_No_Checks (Exp)); + + -- For controlled types, do the allocation on the secondary stack + -- manually in order to call adjust at the right time: + + -- type Anon1 is access R_Type; + -- for Anon1'Storage_pool use ss_pool; + -- Anon2 : anon1 := new R_Type'(expr); + -- return Anon2.all; + + -- We do the same for classwide types that are not potentially + -- controlled (by the virtue of restriction No_Finalization) because + -- gigi is not able to properly allocate class-wide types. + + elsif CW_Or_Has_Controlled_Part (Utyp) then + declare + Loc : constant Source_Ptr := Sloc (N); + Acc_Typ : constant Entity_Id := Make_Temporary (Loc, 'A'); + Alloc_Node : Node_Id; + Temp : Entity_Id; + + begin + Set_Ekind (Acc_Typ, E_Access_Type); + + Set_Associated_Storage_Pool (Acc_Typ, RTE (RE_SS_Pool)); + + -- This is an allocator for the secondary stack, and it's fine + -- to have Comes_From_Source set False on it, as gigi knows not + -- to flag it as a violation of No_Implicit_Heap_Allocations. + + Alloc_Node := + Make_Allocator (Loc, + Expression => + Make_Qualified_Expression (Loc, + Subtype_Mark => New_Reference_To (Etype (Exp), Loc), + Expression => Relocate_Node (Exp))); + + -- We do not want discriminant checks on the declaration, + -- given that it gets its value from the allocator. + + Set_No_Initialization (Alloc_Node); + + Temp := Make_Temporary (Loc, 'R', Alloc_Node); + + Insert_List_Before_And_Analyze (N, New_List ( + Make_Full_Type_Declaration (Loc, + Defining_Identifier => Acc_Typ, + Type_Definition => + Make_Access_To_Object_Definition (Loc, + Subtype_Indication => Subtype_Ind)), + + Make_Object_Declaration (Loc, + Defining_Identifier => Temp, + Object_Definition => New_Reference_To (Acc_Typ, Loc), + Expression => Alloc_Node))); + + Rewrite (Exp, + Make_Explicit_Dereference (Loc, + Prefix => New_Reference_To (Temp, Loc))); + + Analyze_And_Resolve (Exp, R_Type); + end; + + -- Otherwise use the gigi mechanism to allocate result on the + -- secondary stack. + + else + Check_Restriction (No_Secondary_Stack, N); + 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. + + if VM_Target = No_VM then + Set_Procedure_To_Call (N, RTE (RE_SS_Allocate)); + end if; + end if; + end if; + + -- Implement the rules of 6.5(8-10), which require a tag check in the + -- case of a limited tagged return type, and tag reassignment for + -- nonlimited tagged results. These actions are needed when the return + -- type is a specific tagged type and the result expression is a + -- conversion or a formal parameter, because in that case the tag of the + -- expression might differ from the tag of the specific result type. + + if Is_Tagged_Type (Utyp) + and then not Is_Class_Wide_Type (Utyp) + and then (Nkind_In (Exp, N_Type_Conversion, + N_Unchecked_Type_Conversion) + or else (Is_Entity_Name (Exp) + and then Ekind (Entity (Exp)) in Formal_Kind)) + then + -- When the return type is limited, perform a check that the + -- tag of the result is the same as the tag of the return type. + + if Is_Limited_Type (R_Type) then + Insert_Action (Exp, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_Op_Ne (Loc, + Left_Opnd => + Make_Selected_Component (Loc, + Prefix => Duplicate_Subexpr (Exp), + Selector_Name => Make_Identifier (Loc, Name_uTag)), + Right_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (Base_Type (Utyp), Loc), + Attribute_Name => Name_Tag)), + Reason => CE_Tag_Check_Failed)); + + -- If the result type is a specific nonlimited tagged type, then we + -- have to ensure that the tag of the result is that of the result + -- type. This is handled by making a copy of the expression in the + -- case where it might have a different tag, namely when the + -- expression is a conversion or a formal parameter. We create a new + -- object of the result type and initialize it from the expression, + -- which will implicitly force the tag to be set appropriately. + + else + declare + ExpR : constant Node_Id := Relocate_Node (Exp); + Result_Id : constant Entity_Id := + Make_Temporary (Loc, 'R', ExpR); + Result_Exp : constant Node_Id := + New_Reference_To (Result_Id, Loc); + Result_Obj : constant Node_Id := + Make_Object_Declaration (Loc, + Defining_Identifier => Result_Id, + Object_Definition => + New_Reference_To (R_Type, Loc), + Constant_Present => True, + Expression => ExpR); + + begin + Set_Assignment_OK (Result_Obj); + Insert_Action (Exp, Result_Obj); + + Rewrite (Exp, Result_Exp); + Analyze_And_Resolve (Exp, R_Type); + end; + end if; + + -- Ada 2005 (AI-344): If the result type is class-wide, then insert + -- a check that the level of the return expression's underlying type + -- is not deeper than the level of the master enclosing the function. + -- Always generate the check when the type of the return expression + -- is class-wide, when it's a type conversion, or when it's a formal + -- parameter. Otherwise, suppress the check in the case where the + -- return expression has a specific type whose level is known not to + -- be statically deeper than the function's result type. + + -- Note: accessibility check is skipped in the VM case, since there + -- does not seem to be any practical way to implement this check. + + elsif Ada_Version >= Ada_2005 + and then Tagged_Type_Expansion + and then Is_Class_Wide_Type (R_Type) + and then not Scope_Suppress (Accessibility_Check) + and then + (Is_Class_Wide_Type (Etype (Exp)) + or else Nkind_In (Exp, N_Type_Conversion, + N_Unchecked_Type_Conversion) + or else (Is_Entity_Name (Exp) + and then Ekind (Entity (Exp)) in Formal_Kind) + or else Scope_Depth (Enclosing_Dynamic_Scope (Etype (Exp))) > + Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id))) + then + declare + Tag_Node : Node_Id; + + begin + -- Ada 2005 (AI-251): In class-wide interface objects we displace + -- "this" to reference the base of the object --- required to get + -- access to the TSD of the object. + + if Is_Class_Wide_Type (Etype (Exp)) + and then Is_Interface (Etype (Exp)) + and then Nkind (Exp) = N_Explicit_Dereference + then + Tag_Node := + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (RTE (RE_Tag_Ptr), + Make_Function_Call (Loc, + Name => New_Reference_To (RTE (RE_Base_Address), Loc), + Parameter_Associations => New_List ( + Unchecked_Convert_To (RTE (RE_Address), + Duplicate_Subexpr (Prefix (Exp))))))); + else + Tag_Node := + Make_Attribute_Reference (Loc, + Prefix => Duplicate_Subexpr (Exp), + Attribute_Name => Name_Tag); + end if; + + Insert_Action (Exp, + Make_Raise_Program_Error (Loc, + Condition => + Make_Op_Gt (Loc, + Left_Opnd => + Build_Get_Access_Level (Loc, Tag_Node), + Right_Opnd => + Make_Integer_Literal (Loc, + Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))), + Reason => PE_Accessibility_Check_Failed)); + end; + + -- AI05-0073: If function has a controlling access result, check that + -- the tag of the return value, if it is not null, matches designated + -- type of return type. + -- The return expression is referenced twice in the code below, so + -- it must be made free of side effects. Given that different compilers + -- may evaluate these parameters in different order, both occurrences + -- perform a copy. + + elsif Ekind (R_Type) = E_Anonymous_Access_Type + and then Has_Controlling_Result (Scope_Id) + then + Insert_Action (N, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_And_Then (Loc, + Left_Opnd => + Make_Op_Ne (Loc, + Left_Opnd => Duplicate_Subexpr (Exp), + Right_Opnd => Make_Null (Loc)), + Right_Opnd => Make_Op_Ne (Loc, + Left_Opnd => + Make_Selected_Component (Loc, + Prefix => Duplicate_Subexpr (Exp), + Selector_Name => Make_Identifier (Loc, Name_uTag)), + Right_Opnd => + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Designated_Type (R_Type), Loc), + Attribute_Name => Name_Tag))), + Reason => CE_Tag_Check_Failed), + Suppress => All_Checks); + end if; + + -- If we are returning an object that may not be bit-aligned, then copy + -- the value into a temporary first. This copy may need to expand to a + -- loop of component operations. + + if Is_Possibly_Unaligned_Slice (Exp) + or else Is_Possibly_Unaligned_Object (Exp) + then + declare + ExpR : constant Node_Id := Relocate_Node (Exp); + Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR); + begin + Insert_Action (Exp, + Make_Object_Declaration (Loc, + Defining_Identifier => Tnn, + Constant_Present => True, + Object_Definition => New_Occurrence_Of (R_Type, Loc), + Expression => ExpR), + Suppress => All_Checks); + Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); + 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 + ExpR : constant Node_Id := Relocate_Node (Exp); + Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR); + + 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 => ExpR), + 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 => ExpR), + 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; + + -- Ada 2005 (AI-251): If this return statement corresponds with an + -- simple return statement associated with an extended return statement + -- and the type of the returned object is an interface then generate an + -- implicit conversion to force displacement of the "this" pointer. + + if Ada_Version >= Ada_2005 + and then Comes_From_Extended_Return_Statement (N) + and then Nkind (Expression (N)) = N_Identifier + and then Is_Interface (Utyp) + and then Utyp /= Underlying_Type (Exptyp) + then + Rewrite (Exp, Convert_To (Utyp, Relocate_Node (Exp))); + Analyze_And_Resolve (Exp); + end if; + end Expand_Simple_Function_Return; + -------------------------------- -- Is_Build_In_Place_Function -- -------------------------------- function Is_Build_In_Place_Function (E : Entity_Id) return Boolean is begin + -- This function is called from Expand_Subtype_From_Expr during + -- semantic analysis, even when expansion is off. In those cases + -- the build_in_place expansion will not take place. + + if not Expander_Active then + return False; + end if; + -- For now we test whether E denotes a function or access-to-function -- type whose result subtype is inherently limited. Later this test may -- be revised to allow composite nonlimited types. Functions with a -- foreign convention or whose result type has a foreign convention -- never qualify. ! if Ekind_In (E, E_Function, E_Generic_Function) or else (Ekind (E) = E_Subprogram_Type and then Etype (E) /= Standard_Void_Type) then *************** package body Exp_Ch6 is *** 4745,4752 **** -- may return objects of nonlimited descendants. else ! return Is_Inherently_Limited_Type (Etype (E)) ! and then Ada_Version >= Ada_05 and then not Debug_Flag_Dot_L; end if; --- 6423,6430 ---- -- may return objects of nonlimited descendants. else ! return Is_Immutably_Limited_Type (Etype (E)) ! and then Ada_Version >= Ada_2005 and then not Debug_Flag_Dot_L; end if; *************** package body Exp_Ch6 is *** 4933,4942 **** -- Generate code to register the primitive in non statically -- allocated dispatch tables ! elsif not Static_Dispatch_Tables ! or else not ! Is_Library_Level_Tagged_Type (Scope (DTC_Entity (Subp))) ! then -- When a primitive is frozen, enter its name in its dispatch -- table slot. --- 6611,6618 ---- -- Generate code to register the primitive in non statically -- allocated dispatch tables ! elsif not Building_Static_DT (Scope (DTC_Entity (Subp))) then ! -- When a primitive is frozen, enter its name in its dispatch -- table slot. *************** package body Exp_Ch6 is *** 4962,4968 **** Typ : constant Entity_Id := Etype (Subp); Utyp : constant Entity_Id := Underlying_Type (Typ); begin ! if Is_Inherently_Limited_Type (Typ) then Set_Returns_By_Ref (Subp); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then Set_Returns_By_Ref (Subp); --- 6638,6644 ---- Typ : constant Entity_Id := Etype (Subp); Utyp : constant Entity_Id := Underlying_Type (Typ); begin ! if Is_Immutably_Limited_Type (Typ) then Set_Returns_By_Ref (Subp); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then Set_Returns_By_Ref (Subp); *************** package body Exp_Ch6 is *** 5115,5124 **** Rewrite (Allocator, New_Allocator); -- Create a new access object and initialize it to the result of the ! -- new uninitialized allocator. ! Return_Obj_Access := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Set_Etype (Return_Obj_Access, Acc_Type); Insert_Action (Allocator, --- 6791,6801 ---- Rewrite (Allocator, New_Allocator); -- Create a new access object and initialize it to the result of the ! -- new uninitialized allocator. Note: we do not use Allocator as the ! -- Related_Node of Return_Obj_Access in call to Make_Temporary below ! -- as this would create a sort of infinite "recursion". ! Return_Obj_Access := Make_Temporary (Loc, 'R'); Set_Etype (Return_Obj_Access, Acc_Type); Insert_Action (Allocator, *************** package body Exp_Ch6 is *** 5251,5259 **** -- Create a temporary object to hold the function result ! Return_Obj_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); Set_Etype (Return_Obj_Id, Result_Subt); Return_Obj_Decl := --- 6928,6934 ---- -- Create a temporary object to hold the function result ! Return_Obj_Id := Make_Temporary (Loc, 'R'); Set_Etype (Return_Obj_Id, Result_Subt); Return_Obj_Decl := *************** package body Exp_Ch6 is *** 5293,5299 **** -- scope is established to ensure eventual cleanup of the result. else - -- Pass an allocation parameter indicating that the function should -- allocate its result on the secondary stack. --- 6968,6973 ---- *************** package body Exp_Ch6 is *** 5311,5318 **** Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Empty); - - Establish_Transient_Scope (Func_Call, Sec_Stack => True); end if; end Make_Build_In_Place_Call_In_Anonymous_Context; --- 6985,6990 ---- *************** package body Exp_Ch6 is *** 5406,5413 **** -- Create an access type designating the function's result subtype ! Ptr_Typ := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, --- 7078,7084 ---- -- Create an access type designating the function's result subtype ! Ptr_Typ := Make_Temporary (Loc, 'A'); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, *************** package body Exp_Ch6 is *** 5422,5428 **** -- Finally, create an access object initialized to a reference to the -- function call. ! Obj_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Set_Etype (Obj_Id, Ptr_Typ); Obj_Decl := --- 7093,7099 ---- -- Finally, create an access object initialized to a reference to the -- function call. ! Obj_Id := Make_Temporary (Loc, 'R'); Set_Etype (Obj_Id, Ptr_Typ); Obj_Decl := *************** package body Exp_Ch6 is *** 5682,5691 **** Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Caller_Object, Is_Access => Pass_Caller_Acc); ! -- Create an access type designating the function's result subtype ! Ref_Type := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, --- 7353,7364 ---- Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Caller_Object, Is_Access => Pass_Caller_Acc); ! -- Create an access type designating the function's result subtype. We ! -- use the type of the original expression because it may be a call to ! -- an inherited operation, which the expansion has replaced with the ! -- parent operation that yields the parent type. ! Ref_Type := Make_Temporary (Loc, 'A'); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, *************** package body Exp_Ch6 is *** 5694,5700 **** Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => ! New_Reference_To (Result_Subt, Loc))); -- The access type and its accompanying object must be inserted after -- the object declaration in the constrained case, so that the function --- 7367,7373 ---- Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => ! New_Reference_To (Etype (Function_Call), Loc))); -- The access type and its accompanying object must be inserted after -- the object declaration in the constrained case, so that the function *************** package body Exp_Ch6 is *** 5712,5726 **** -- Finally, create an access object initialized to a reference to the -- function call. - Def_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('R')); - Set_Etype (Def_Id, Ref_Type); - New_Expr := Make_Reference (Loc, Prefix => Relocate_Node (Func_Call)); Insert_After_And_Analyze (Ptr_Typ_Decl, Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, --- 7385,7397 ---- -- Finally, create an access object initialized to a reference to the -- function call. New_Expr := Make_Reference (Loc, Prefix => Relocate_Node (Func_Call)); + Def_Id := Make_Temporary (Loc, 'R', New_Expr); + Set_Etype (Def_Id, Ref_Type); + Insert_After_And_Analyze (Ptr_Typ_Decl, Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, *************** package body Exp_Ch6 is *** 5742,5751 **** Make_Explicit_Dereference (Loc, Prefix => New_Reference_To (Def_Id, Loc)); Rewrite (Object_Decl, Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => Make_Defining_Identifier (Loc, ! New_Internal_Name ('D')), Access_Definition => Empty, Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc), Name => Call_Deref)); --- 7413,7422 ---- Make_Explicit_Dereference (Loc, Prefix => New_Reference_To (Def_Id, Loc)); + Loc := Sloc (Object_Decl); Rewrite (Object_Decl, Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'D'), Access_Definition => Empty, Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc), Name => Call_Deref)); *************** package body Exp_Ch6 is *** 5780,5785 **** --- 7451,7464 ---- Set_Homonym (Renaming_Def_Id, Homonym (Obj_Def_Id)); Exchange_Entities (Renaming_Def_Id, Obj_Def_Id); + + -- Preserve source indication of original declaration, so that + -- xref information is properly generated for the right entity. + + Preserve_Comes_From_Source + (Object_Decl, Original_Node (Object_Decl)); + Set_Comes_From_Source (Obj_Def_Id, True); + Set_Comes_From_Source (Renaming_Def_Id, False); end; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch6.ads gcc-4.6.0/gcc/ada/exp_ch6.ads *** gcc-4.5.2/gcc/ada/exp_ch6.ads Thu Apr 16 10:27:47 2009 --- gcc-4.6.0/gcc/ada/exp_ch6.ads Mon Oct 11 09:04:40 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Types; use Types; *** 29,39 **** package Exp_Ch6 is ! procedure Expand_N_Function_Call (N : Node_Id); ! procedure Expand_N_Subprogram_Body (N : Node_Id); ! procedure Expand_N_Subprogram_Body_Stub (N : Node_Id); ! procedure Expand_N_Subprogram_Declaration (N : Node_Id); ! procedure Expand_N_Procedure_Call_Statement (N : Node_Id); procedure Expand_Call (N : Node_Id); -- This procedure contains common processing for Expand_N_Function_Call, --- 29,41 ---- package Exp_Ch6 is ! procedure Expand_N_Extended_Return_Statement (N : Node_Id); ! procedure Expand_N_Function_Call (N : Node_Id); ! procedure Expand_N_Procedure_Call_Statement (N : Node_Id); ! procedure Expand_N_Simple_Return_Statement (N : Node_Id); ! procedure Expand_N_Subprogram_Body (N : Node_Id); ! procedure Expand_N_Subprogram_Body_Stub (N : Node_Id); ! procedure Expand_N_Subprogram_Declaration (N : Node_Id); procedure Expand_Call (N : Node_Id); -- This procedure contains common processing for Expand_N_Function_Call, diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch7.adb gcc-4.6.0/gcc/ada/exp_ch7.adb *** gcc-4.5.2/gcc/ada/exp_ch7.adb Mon Nov 30 14:24:04 2009 --- gcc-4.6.0/gcc/ada/exp_ch7.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Ch3; use Sem_Ch3; *** 54,60 **** with Sem_Ch7; use Sem_Ch7; with Sem_Ch8; use Sem_Ch8; with Sem_Res; use Sem_Res; - with Sem_SCIL; use Sem_SCIL; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Snames; use Snames; --- 54,59 ---- *************** package body Exp_Ch7 is *** 393,399 **** Typ => Typ, Stmts => Make_Deep_Array_Body (Initialize_Case, Typ))); ! if not Is_Inherently_Limited_Type (Typ) then Set_TSS (Typ, Make_Deep_Proc ( Prim => Adjust_Case, --- 392,398 ---- Typ => Typ, Stmts => Make_Deep_Array_Body (Initialize_Case, Typ))); ! if not Is_Immutably_Limited_Type (Typ) then Set_TSS (Typ, Make_Deep_Proc ( Prim => Adjust_Case, *************** package body Exp_Ch7 is *** 503,509 **** Typ => Typ, Stmts => Make_Deep_Record_Body (Initialize_Case, Typ))); ! if not Is_Inherently_Limited_Type (Typ) then Set_TSS (Typ, Make_Deep_Proc ( Prim => Adjust_Case, --- 502,508 ---- Typ => Typ, Stmts => Make_Deep_Record_Body (Initialize_Case, Typ))); ! if not Is_Immutably_Limited_Type (Typ) then Set_TSS (Typ, Make_Deep_Proc ( Prim => Adjust_Case, *************** package body Exp_Ch7 is *** 586,594 **** -- Here we generate the required loop else ! Index := ! Make_Defining_Identifier (Loc, New_Internal_Name ('J')); ! Append (New_Reference_To (Index, Loc), Index_List); return New_List ( --- 585,591 ---- -- Here we generate the required loop else ! Index := Make_Temporary (Loc, 'J'); Append (New_Reference_To (Index, Loc), Index_List); return New_List ( *************** package body Exp_Ch7 is *** 835,841 **** begin if Is_Derived_Type (Typ) and then Comes_From_Source (E) ! and then not Is_Overriding_Operation (E) then -- We know that the explicit operation on the type does not override -- the inherited operation of the parent, and that the derivation --- 832,838 ---- begin if Is_Derived_Type (Typ) and then Comes_From_Source (E) ! and then not Present (Overridden_Operation (E)) then -- We know that the explicit operation on the type does not override -- the inherited operation of the parent, and that the derivation *************** package body Exp_Ch7 is *** 1101,1107 **** -- releasing or some finalizations are needed or in the context -- of tasking ! if Uses_Sec_Stack (Current_Scope) and then not Sec_Stack_Needed_For_Return (Current_Scope) then null; --- 1098,1104 ---- -- releasing or some finalizations are needed or in the context -- of tasking ! if Uses_Sec_Stack (Current_Scope) and then not Sec_Stack_Needed_For_Return (Current_Scope) then null; *************** package body Exp_Ch7 is *** 1162,1168 **** and then not Sec_Stack_Needed_For_Return (Current_Scope) and then VM_Target = No_VM then ! Mark := Make_Defining_Identifier (Loc, New_Internal_Name ('M')); Append_To (New_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Mark, --- 1159,1165 ---- and then not Sec_Stack_Needed_For_Return (Current_Scope) and then VM_Target = No_VM then ! Mark := Make_Temporary (Loc, 'M'); Append_To (New_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Mark, *************** package body Exp_Ch7 is *** 1704,1710 **** return Make_Selected_Component (Loc, ! Prefix => Make_Selected_Component (Loc, Prefix => R, Selector_Name => Make_Identifier (Loc, Name_uController)), --- 1701,1707 ---- return Make_Selected_Component (Loc, ! Prefix => Make_Selected_Component (Loc, Prefix => R, Selector_Name => Make_Identifier (Loc, Name_uController)), *************** package body Exp_Ch7 is *** 1742,1752 **** end if; else ! if Is_Dynamic_Scope (E) then ! S := E; ! else ! S := Enclosing_Dynamic_Scope (E); ! end if; -- When the finalization chain entity is 'Error', it means that there -- should not be any chain at that level and that the enclosing one --- 1739,1745 ---- end if; else ! S := Nearest_Dynamic_Scope (E); -- When the finalization chain entity is 'Error', it means that there -- should not be any chain at that level and that the enclosing one *************** package body Exp_Ch7 is *** 1785,1793 **** end if; end if; ! Id := ! Make_Defining_Identifier (Flist_Loc, ! Chars => New_Internal_Name ('F')); end; Set_Finalization_Chain_Entity (S, Id); --- 1778,1784 ---- end if; end if; ! Id := Make_Temporary (Flist_Loc, 'F'); end; Set_Finalization_Chain_Entity (S, Id); *************** package body Exp_Ch7 is *** 2317,2326 **** Name => Name, Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, ! Prefix => Make_Selected_Component (Loc, ! Prefix => New_Reference_To ( ! Defining_Identifier (Param), Loc), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)))); --- 2308,2317 ---- Name => Name, Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, ! Prefix => Make_Selected_Component (Loc, ! Prefix => ! New_Reference_To (Defining_Identifier (Param), Loc), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)))); *************** package body Exp_Ch7 is *** 2546,2552 **** function One_Component return List_Id; -- Create one statement to initialize/adjust/finalize one array ! -- component, designated by a full set of indices. function One_Dimension (N : Int) return List_Id; -- Create loop to deal with one dimension of the array. The single --- 2537,2543 ---- function One_Component return List_Id; -- Create one statement to initialize/adjust/finalize one array ! -- component, designated by a full set of indexes. function One_Dimension (N : Int) return List_Id; -- Create loop to deal with one dimension of the array. The single *************** package body Exp_Ch7 is *** 2614,2622 **** Defining_Identifier => Index, Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Range, ! Expressions => New_List ( Make_Integer_Literal (Loc, N))), Reverse_Present => Prim = Finalize_Case)), Statements => One_Dimension (N + 1))); --- 2605,2613 ---- Defining_Identifier => Index, Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Range, ! Expressions => New_List ( Make_Integer_Literal (Loc, N))), Reverse_Present => Prim = Finalize_Case)), Statements => One_Dimension (N + 1))); *************** package body Exp_Ch7 is *** 2712,2718 **** --------------------------- -- The Deep procedures call the appropriate Controlling proc on the ! -- the controller component. In the init case, it also attach the -- controller to the current finalization list. function Make_Deep_Record_Body --- 2703,2709 ---- --------------------------- -- The Deep procedures call the appropriate Controlling proc on the ! -- controller component. In the init case, it also attach the -- controller to the current finalization list. function Make_Deep_Record_Body *************** package body Exp_Ch7 is *** 2730,2736 **** Res : constant List_Id := New_List; begin ! if Is_Inherently_Limited_Type (Typ) then Controller_Typ := RTE (RE_Limited_Record_Controller); else Controller_Typ := RTE (RE_Record_Controller); --- 2721,2727 ---- Res : constant List_Id := New_List; begin ! if Is_Immutably_Limited_Type (Typ) then Controller_Typ := RTE (RE_Limited_Record_Controller); else Controller_Typ := RTE (RE_Record_Controller); *************** package body Exp_Ch7 is *** 2756,2772 **** Parameter_Associations => New_List (New_Copy_Tree (Obj_Ref)))); ! Append_To (Res, Make_Attach_Call ( ! Obj_Ref => New_Copy_Tree (Obj_Ref), ! Flist_Ref => Make_Identifier (Loc, Name_L), ! With_Attach => Make_Identifier (Loc, Name_B))); end if; when Adjust_Case => Append_List_To (Res, ! Make_Adjust_Call (Controller_Ref, Controller_Typ, ! Make_Identifier (Loc, Name_L), ! Make_Identifier (Loc, Name_B))); -- When the type is also a controlled type by itself, -- adjust it and attach it to the finalization chain. --- 2747,2765 ---- Parameter_Associations => New_List (New_Copy_Tree (Obj_Ref)))); ! Append_To (Res, ! Make_Attach_Call ! (Obj_Ref => New_Copy_Tree (Obj_Ref), ! Flist_Ref => Make_Identifier (Loc, Name_L), ! With_Attach => Make_Identifier (Loc, Name_B))); end if; when Adjust_Case => Append_List_To (Res, ! Make_Adjust_Call ! (Controller_Ref, Controller_Typ, ! Make_Identifier (Loc, Name_L), ! Make_Identifier (Loc, Name_B))); -- When the type is also a controlled type by itself, -- adjust it and attach it to the finalization chain. *************** package body Exp_Ch7 is *** 2779,2795 **** Parameter_Associations => New_List (New_Copy_Tree (Obj_Ref)))); ! Append_To (Res, Make_Attach_Call ( ! Obj_Ref => New_Copy_Tree (Obj_Ref), ! Flist_Ref => Make_Identifier (Loc, Name_L), ! With_Attach => Make_Identifier (Loc, Name_B))); end if; when Finalize_Case => if Is_Controlled (Typ) then Append_To (Res, Make_Implicit_If_Statement (Obj_Ref, ! Condition => Make_Identifier (Loc, Name_B), Then_Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Finalize_One), Loc), --- 2772,2789 ---- Parameter_Associations => New_List (New_Copy_Tree (Obj_Ref)))); ! Append_To (Res, ! Make_Attach_Call ! (Obj_Ref => New_Copy_Tree (Obj_Ref), ! Flist_Ref => Make_Identifier (Loc, Name_L), ! With_Attach => Make_Identifier (Loc, Name_B))); end if; when Finalize_Case => if Is_Controlled (Typ) then Append_To (Res, Make_Implicit_If_Statement (Obj_Ref, ! Condition => Make_Identifier (Loc, Name_B), Then_Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Finalize_One), Loc), *************** package body Exp_Ch7 is *** 2806,2814 **** end if; Append_List_To (Res, ! Make_Final_Call (Controller_Ref, Controller_Typ, ! Make_Identifier (Loc, Name_B))); end case; return Res; end Make_Deep_Record_Body; --- 2800,2810 ---- end if; Append_List_To (Res, ! Make_Final_Call ! (Controller_Ref, Controller_Typ, ! Make_Identifier (Loc, Name_B))); end case; + return Res; end Make_Deep_Record_Body; *************** package body Exp_Ch7 is *** 3438,3444 **** -- Fxxx : Finalizable_Ptr renames Lxxx.F; if Present (Finalization_Chain_Entity (S)) then ! LC := Make_Defining_Identifier (Loc, New_Internal_Name ('L')); -- Use the Sloc of the first declaration of N's containing list, to -- maintain monotonicity of source-line stepping during debugging. --- 3434,3440 ---- -- Fxxx : Finalizable_Ptr renames Lxxx.F; if Present (Finalization_Chain_Entity (S)) then ! LC := Make_Temporary (Loc, 'L'); -- Use the Sloc of the first declaration of N's containing list, to -- maintain monotonicity of source-line stepping during debugging. *************** package body Exp_Ch7 is *** 3570,3584 **** Expr : constant Node_Id := Relocate_Node (N); begin - -- If the relocated node is a function call then check if some SCIL - -- node references it and needs readjustment. - - if Generate_SCIL - and then Nkind (N) = N_Function_Call - then - Adjust_SCIL_Node (N, Expr); - end if; - Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => E, --- 3566,3571 ---- *************** package body Exp_Ch7 is *** 3626,3640 **** New_Statement : constant Node_Id := Relocate_Node (N); begin - -- If the relocated node is a procedure call then check if some SCIL - -- node references it and needs readjustment. - - if Generate_SCIL - and then Nkind (New_Statement) = N_Procedure_Call_Statement - then - Adjust_SCIL_Node (N, New_Statement); - end if; - Rewrite (N, Make_Transient_Block (Loc, New_Statement)); -- With the scope stack back to normal, we can call analyze on the --- 3613,3618 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch7.ads gcc-4.6.0/gcc/ada/exp_ch7.ads *** gcc-4.5.2/gcc/ada/exp_ch7.ads Mon Jun 22 09:21:53 2009 --- gcc-4.6.0/gcc/ada/exp_ch7.ads Thu Jun 17 10:20:27 2010 *************** package Exp_Ch7 is *** 229,239 **** procedure Store_Before_Actions_In_Scope (L : List_Id); -- Append the list L of actions to the end of the before-actions store in ! -- the top of the scope stack procedure Store_After_Actions_In_Scope (L : List_Id); -- Append the list L of actions to the beginning of the after-actions store ! -- in the top of the scope stack procedure Wrap_Transient_Declaration (N : Node_Id); -- N is an object declaration. Expand the finalization calls after the --- 229,239 ---- procedure Store_Before_Actions_In_Scope (L : List_Id); -- Append the list L of actions to the end of the before-actions store in ! -- the top of the scope stack. procedure Store_After_Actions_In_Scope (L : List_Id); -- Append the list L of actions to the beginning of the after-actions store ! -- in the top of the scope stack. procedure Wrap_Transient_Declaration (N : Node_Id); -- N is an object declaration. Expand the finalization calls after the diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch8.adb gcc-4.6.0/gcc/ada/exp_ch8.adb *** gcc-4.5.2/gcc/ada/exp_ch8.adb Tue Nov 24 20:02:40 2009 --- gcc-4.6.0/gcc/ada/exp_ch8.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,40 **** --- 25,46 ---- with Atree; use Atree; with Einfo; use Einfo; + with Exp_Ch4; use Exp_Ch4; with Exp_Ch6; use Exp_Ch6; with Exp_Dbug; use Exp_Dbug; with Exp_Util; use Exp_Util; with Freeze; use Freeze; + with Namet; use Namet; + with Nmake; use Nmake; with Nlists; use Nlists; with Opt; use Opt; with Sem; use Sem; with Sem_Ch8; use Sem_Ch8; + with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; + with Snames; use Snames; with Stand; use Stand; + with Tbuild; use Tbuild; package body Exp_Ch8 is *************** package body Exp_Ch8 is *** 265,271 **** -- 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 (Nam) then Make_Build_In_Place_Call_In_Anonymous_Context (Nam); --- 271,277 ---- -- eventually we plan to expand the functions that are treated as -- build-in-place to include other composite result types. ! if Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Nam) then Make_Build_In_Place_Call_In_Anonymous_Context (Nam); *************** package body Exp_Ch8 is *** 350,355 **** --- 356,429 ---- elsif Nkind (Nam) = N_Explicit_Dereference then Force_Evaluation (Prefix (Nam)); end if; + + -- Check whether this is a renaming of a predefined equality on an + -- untagged record type (AI05-0123). + + if Is_Entity_Name (Nam) + and then Chars (Entity (Nam)) = Name_Op_Eq + and then Scope (Entity (Nam)) = Standard_Standard + and then Ada_Version >= Ada_2012 + then + declare + Loc : constant Source_Ptr := Sloc (N); + Id : constant Entity_Id := Defining_Entity (N); + Typ : constant Entity_Id := Etype (First_Formal (Id)); + + Decl : Node_Id; + Body_Id : constant Entity_Id := + Make_Defining_Identifier (Sloc (N), Chars (Id)); + + begin + if Is_Record_Type (Typ) + and then not Is_Tagged_Type (Typ) + and then not Is_Frozen (Typ) + then + -- Build body for renamed equality, to capture its current + -- meaning. It may be redefined later, but the renaming is + -- elaborated where it occurs. This is technically known as + -- Squirreling semantics. Renaming is rewritten as a subprogram + -- declaration, and the body is inserted at the end of the + -- current declaration list to prevent premature freezing. + + Set_Alias (Id, Empty); + Set_Has_Completion (Id, False); + Rewrite (N, + Make_Subprogram_Declaration (Sloc (N), + Specification => Specification (N))); + Set_Has_Delayed_Freeze (Id); + + Decl := Make_Subprogram_Body (Loc, + Specification => + Make_Function_Specification (Loc, + Defining_Unit_Name => Body_Id, + Parameter_Specifications => + Copy_Parameter_List (Id), + Result_Definition => + New_Occurrence_Of (Standard_Boolean, Loc)), + Declarations => Empty_List, + Handled_Statement_Sequence => Empty); + + Set_Handled_Statement_Sequence (Decl, + Make_Handled_Sequence_Of_Statements (Loc, + Statements => New_List ( + Make_Simple_Return_Statement (Loc, + Expression => + Expand_Record_Equality + (Id, + Typ => Typ, + Lhs => + Make_Identifier (Loc, Chars (First_Formal (Id))), + Rhs => + Make_Identifier + (Loc, Chars (Next_Formal (First_Formal (Id)))), + Bodies => Declarations (Decl)))))); + + Append (Decl, List_Containing (N)); + Set_Debug_Info_Needed (Body_Id); + end if; + end; + end if; end Expand_N_Subprogram_Renaming_Declaration; end Exp_Ch8; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch9.adb gcc-4.6.0/gcc/ada/exp_ch9.adb *** gcc-4.5.2/gcc/ada/exp_ch9.adb Mon Jan 25 16:24:20 2010 --- gcc-4.6.0/gcc/ada/exp_ch9.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Einfo; use Einfo; *** 29,36 **** with Elists; use Elists; with Errout; use Errout; with Exp_Ch3; use Exp_Ch3; - with Exp_Ch11; use Exp_Ch11; with Exp_Ch6; use Exp_Ch6; with Exp_Dbug; use Exp_Dbug; with Exp_Disp; use Exp_Disp; with Exp_Sel; use Exp_Sel; --- 29,36 ---- with Elists; use Elists; with Errout; use Errout; with Exp_Ch3; use Exp_Ch3; with Exp_Ch6; use Exp_Ch6; + with Exp_Ch11; use Exp_Ch11; with Exp_Dbug; use Exp_Dbug; with Exp_Disp; use Exp_Disp; with Exp_Sel; use Exp_Sel; *************** package body Exp_Ch9 is *** 128,133 **** --- 128,141 ---- -- Build a specification for a function implementing the protected entry -- barrier of the specified entry body. + function Build_Corresponding_Record + (N : Node_Id; + Ctyp : Node_Id; + Loc : Source_Ptr) return Node_Id; + -- Common to tasks and protected types. Copy discriminant specifications, + -- build record declaration. N is the type declaration, Ctyp is the + -- concurrent entity (task type or protected type). + function Build_Entry_Count_Expression (Concurrent_Type : Node_Id; Component_List : List_Id; *************** package body Exp_Ch9 is *** 154,159 **** --- 162,175 ---- -- : AnnN; -- end record; + procedure Build_PPC_Wrapper (E : Entity_Id; Decl : Node_Id); + -- Build body of wrapper procedure for an entry or entry family that has + -- pre/postconditions. The body gathers the PPC's and expands them in the + -- usual way, and performs the entry call itself. This way preconditions + -- are evaluated before the call is queued. E is the entry in question, + -- and Decl is the enclosing synchronized type declaration at whose + -- freeze point the generated body is analyzed. + procedure Build_Wrapper_Bodies (Loc : Source_Ptr; Typ : Entity_Id; *************** package body Exp_Ch9 is *** 300,306 **** Lo : Node_Id; Ttyp : Entity_Id; Cap : Boolean) return Node_Id; ! -- Compute (Hi - Lo) for two entry family indices. Hi is the index in -- an accept statement, or the upper bound in the discrete subtype of -- an entry declaration. Lo is the corresponding lower bound. Ttyp is -- the concurrent type of the entry. If Cap is true, the result is --- 316,322 ---- Lo : Node_Id; Ttyp : Entity_Id; Cap : Boolean) return Node_Id; ! -- Compute (Hi - Lo) for two entry family indexes. Hi is the index in -- an accept statement, or the upper bound in the discrete subtype of -- an entry declaration. Lo is the corresponding lower bound. Ttyp is -- the concurrent type of the entry. If Cap is true, the result is *************** package body Exp_Ch9 is *** 657,667 **** Name => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (Entry_Parameters_Type (Ent), Make_Identifier (Loc, Chars (Ptr))), ! Selector_Name => ! New_Reference_To (Comp, Loc)))); Append (Decl, Decls); Set_Renamed_Object (Formal, New_F); --- 673,682 ---- Name => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (Entry_Parameters_Type (Ent), Make_Identifier (Loc, Chars (Ptr))), ! Selector_Name => New_Reference_To (Comp, Loc)))); Append (Decl, Decls); Set_Renamed_Object (Formal, New_F); *************** package body Exp_Ch9 is *** 703,710 **** 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); --- 718,724 ---- 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); *************** package body Exp_Ch9 is *** 821,830 **** --- 835,846 ---- begin -- Loop to find enclosing construct containing activation chain variable + -- The construct is a body, a block, or an extended return. P := Parent (N); while not Nkind_In (P, N_Subprogram_Body, + N_Entry_Body, N_Package_Declaration, N_Package_Body, N_Block_Statement, *************** package body Exp_Ch9 is *** 1037,1044 **** -- record is "limited tagged". It is "limited" to reflect the underlying -- limitedness of the task or protected object that it represents, and -- ensuring for example that it is properly passed by reference. It is ! -- "tagged" to give support to dispatching calls through interfaces (Ada ! -- 2005: AI-345) return Make_Full_Type_Declaration (Loc, --- 1053,1061 ---- -- record is "limited tagged". It is "limited" to reflect the underlying -- limitedness of the task or protected object that it represents, and -- ensuring for example that it is properly passed by reference. It is ! -- "tagged" to give support to dispatching calls through interfaces. We ! -- propagate here the list of interfaces covered by the concurrent type ! -- (Ada 2005: AI-345). return Make_Full_Type_Declaration (Loc, *************** package body Exp_Ch9 is *** 1050,1056 **** Make_Component_List (Loc, Component_Items => Cdecls), Tagged_Present => ! Ada_Version >= Ada_05 and then Is_Tagged_Type (Ctyp), Limited_Present => True)); end Build_Corresponding_Record; --- 1067,1074 ---- Make_Component_List (Loc, Component_Items => Cdecls), Tagged_Present => ! Ada_Version >= Ada_2005 and then Is_Tagged_Type (Ctyp), ! Interface_List => Interface_List (N), Limited_Present => True)); end Build_Corresponding_Record; *************** package body Exp_Ch9 is *** 1168,1175 **** procedure Build_Entry_Family_Name (Id : Entity_Id) is Def : constant Node_Id := Discrete_Subtype_Definition (Parent (Id)); ! L_Id : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('L')); L_Stmts : constant List_Id := New_List; Val : Node_Id; --- 1186,1192 ---- procedure Build_Entry_Family_Name (Id : Entity_Id) is Def : constant Node_Id := Discrete_Subtype_Definition (Parent (Id)); ! L_Id : constant Entity_Id := Make_Temporary (Loc, 'L'); L_Stmts : constant List_Id := New_List; Val : Node_Id; *************** package body Exp_Ch9 is *** 1265,1273 **** Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, ! Defining_Identifier => L_Id, ! Discrete_Subtype_Definition => ! Build_Range (Def))), Statements => L_Stmts, End_Label => Empty)); end Build_Entry_Family_Name; --- 1282,1289 ---- Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, ! Defining_Identifier => L_Id, ! Discrete_Subtype_Definition => Build_Range (Def))), Statements => L_Stmts, End_Label => Empty)); end Build_Entry_Family_Name; *************** package body Exp_Ch9 is *** 1411,1417 **** return Empty; end if; ! Index := Make_Defining_Identifier (Loc, New_Internal_Name ('I')); -- Step 1: Generate the declaration of the index variable: -- Inn : Protected_Entry_Index := 0; --- 1427,1433 ---- return Empty; end if; ! Index := Make_Temporary (Loc, 'I'); -- Step 1: Generate the declaration of the index variable: -- Inn : Protected_Entry_Index := 0; *************** package body Exp_Ch9 is *** 1428,1437 **** Append_To (B_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Index, ! Object_Definition => ! New_Reference_To (RTE (Index_Typ), Loc), ! Expression => ! Make_Integer_Literal (Loc, 0))); B_Stmts := New_List; --- 1444,1451 ---- Append_To (B_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Index, ! Object_Definition => New_Reference_To (RTE (Index_Typ), Loc), ! Expression => Make_Integer_Literal (Loc, 0))); B_Stmts := New_List; *************** package body Exp_Ch9 is *** 1488,1506 **** -- Generate: -- type Ann is access all ! Comp_Nam := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Append_To (Decls, Make_Full_Type_Declaration (Loc, ! Defining_Identifier => ! Comp_Nam, ! Type_Definition => Make_Access_To_Object_Definition (Loc, ! All_Present => ! True, ! Constant_Present => ! Ekind (Formal) = E_In_Parameter, Subtype_Indication => New_Reference_To (Etype (Actual), Loc)))); --- 1502,1516 ---- -- Generate: -- type Ann is access all ! Comp_Nam := Make_Temporary (Loc, 'A'); Append_To (Decls, Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Comp_Nam, ! Type_Definition => Make_Access_To_Object_Definition (Loc, ! All_Present => True, ! Constant_Present => Ekind (Formal) = E_In_Parameter, Subtype_Indication => New_Reference_To (Etype (Actual), Loc)))); *************** package body Exp_Ch9 is *** 1525,1532 **** Next_Formal_With_Extras (Formal); end loop; ! Rec_Nam := ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')); if Has_Comp then --- 1535,1541 ---- Next_Formal_With_Extras (Formal); end loop; ! Rec_Nam := Make_Temporary (Loc, 'P'); if Has_Comp then *************** package body Exp_Ch9 is *** 1565,1570 **** --- 1574,1746 ---- return Rec_Nam; end Build_Parameter_Block; + ----------------------- + -- Build_PPC_Wrapper -- + ----------------------- + + procedure Build_PPC_Wrapper (E : Entity_Id; Decl : Node_Id) is + Loc : constant Source_Ptr := Sloc (E); + Synch_Type : constant Entity_Id := Scope (E); + + Wrapper_Id : constant Entity_Id := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (E), 'E')); + -- the wrapper procedure name + + Wrapper_Body : Node_Id; + + Synch_Id : constant Entity_Id := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (Scope (E)), 'A')); + -- The parameter that designates the synchronized object in the call + + Actuals : constant List_Id := New_List; + -- the actuals in the entry call. + + Decls : constant List_Id := New_List; + + Entry_Call : Node_Id; + Entry_Name : Node_Id; + + Specs : List_Id; + -- The specification of the wrapper procedure + + begin + + -- Only build the wrapper if entry has pre/postconditions. + -- Should this be done unconditionally instead ??? + + declare + P : Node_Id; + + begin + P := Spec_PPC_List (E); + if No (P) then + return; + end if; + + -- Transfer ppc pragmas to the declarations of the wrapper + + while Present (P) loop + if Pragma_Name (P) = Name_Precondition + or else Pragma_Name (P) = Name_Postcondition + then + Append (Relocate_Node (P), Decls); + Set_Analyzed (Last (Decls), False); + end if; + + P := Next_Pragma (P); + end loop; + end; + + -- First formal is synchronized object + + Specs := New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => Synch_Id, + Out_Present => True, + In_Present => True, + Parameter_Type => New_Occurrence_Of (Scope (E), Loc))); + + Entry_Name := + Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Synch_Id, Loc), + Selector_Name => New_Occurrence_Of (E, Loc)); + + -- If entity is entry family, second formal is the corresponding index, + -- and entry name is an indexed component. + + if Ekind (E) = E_Entry_Family then + declare + Index : constant Entity_Id := + Make_Defining_Identifier (Loc, Name_I); + begin + Append_To (Specs, + Make_Parameter_Specification (Loc, + Defining_Identifier => Index, + Parameter_Type => + New_Occurrence_Of (Entry_Index_Type (E), Loc))); + + Entry_Name := + Make_Indexed_Component (Loc, + Prefix => Entry_Name, + Expressions => New_List (New_Occurrence_Of (Index, Loc))); + end; + end if; + + Entry_Call := + Make_Procedure_Call_Statement (Loc, + Name => Entry_Name, + Parameter_Associations => Actuals); + + -- Now add formals that match those of the entry, and build actuals for + -- the nested entry call. + + declare + Form : Entity_Id; + New_Form : Entity_Id; + Parm_Spec : Node_Id; + + begin + Form := First_Formal (E); + while Present (Form) loop + New_Form := Make_Defining_Identifier (Loc, Chars (Form)); + Parm_Spec := + Make_Parameter_Specification (Loc, + Defining_Identifier => New_Form, + Out_Present => Out_Present (Parent (Form)), + In_Present => In_Present (Parent (Form)), + Parameter_Type => New_Occurrence_Of (Etype (Form), Loc)); + + Append (Parm_Spec, Specs); + Append (New_Occurrence_Of (New_Form, Loc), Actuals); + Next_Formal (Form); + end loop; + end; + + -- Add renaming declarations for the discriminants of the enclosing + -- type, which may be visible in the preconditions. + + if Has_Discriminants (Synch_Type) then + declare + D : Entity_Id; + Decl : Node_Id; + + begin + D := First_Discriminant (Synch_Type); + while Present (D) loop + Decl := + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Chars (D)), + Subtype_Mark => New_Reference_To (Etype (D), Loc), + Name => + Make_Selected_Component (Loc, + Prefix => New_Reference_To (Synch_Id, Loc), + Selector_Name => Make_Identifier (Loc, Chars (D)))); + Prepend (Decl, Decls); + Next_Discriminant (D); + end loop; + end; + end if; + + Set_PPC_Wrapper (E, Wrapper_Id); + Wrapper_Body := + Make_Subprogram_Body (Loc, + Specification => + Make_Procedure_Specification (Loc, + Defining_Unit_Name => Wrapper_Id, + Parameter_Specifications => Specs), + Declarations => Decls, + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (Loc, + Statements => New_List (Entry_Call))); + + -- The wrapper body is analyzed when the enclosing type is frozen + + Append_Freeze_Action (Defining_Entity (Decl), Wrapper_Body); + end Build_PPC_Wrapper; + -------------------------- -- Build_Wrapper_Bodies -- -------------------------- *************** package body Exp_Ch9 is *** 1610,1620 **** end if; declare ! Actuals : List_Id := No_List; ! Conv_Id : Node_Id; ! First_Form : Node_Id; ! Formal : Node_Id; ! Nam : Node_Id; begin -- Map formals to actuals. Use the list built for the wrapper --- 1786,1796 ---- end if; declare ! Actuals : List_Id := No_List; ! Conv_Id : Node_Id; ! First_Form : Node_Id; ! Formal : Node_Id; ! Nam : Node_Id; begin -- Map formals to actuals. Use the list built for the wrapper *************** package body Exp_Ch9 is *** 1627,1638 **** if Present (Formal) then Actuals := New_List; - while Present (Formal) loop Append_To (Actuals, ! Make_Identifier (Loc, Chars => ! Chars (Defining_Identifier (Formal)))); ! Next (Formal); end loop; end if; --- 1803,1812 ---- if Present (Formal) then Actuals := New_List; while Present (Formal) loop Append_To (Actuals, ! Make_Identifier (Loc, ! Chars => Chars (Defining_Identifier (Formal)))); Next (Formal); end loop; end if; *************** package body Exp_Ch9 is *** 1650,1663 **** if Is_Controlling_Formal (First_Formal (Subp_Id)) then Prepend_To (Actuals, ! Unchecked_Convert_To ( ! Corresponding_Concurrent_Type (Obj_Typ), ! Make_Identifier (Loc, Name_uO))); else Prepend_To (Actuals, ! Make_Identifier (Loc, Chars => ! Chars (Defining_Identifier (First_Form)))); end if; Nam := New_Reference_To (Subp_Id, Loc); --- 1824,1837 ---- if Is_Controlling_Formal (First_Formal (Subp_Id)) then Prepend_To (Actuals, ! Unchecked_Convert_To ! (Corresponding_Concurrent_Type (Obj_Typ), ! Make_Identifier (Loc, Name_uO))); else Prepend_To (Actuals, ! Make_Identifier (Loc, ! Chars => Chars (Defining_Identifier (First_Form)))); end if; Nam := New_Reference_To (Subp_Id, Loc); *************** package body Exp_Ch9 is *** 1681,1692 **** Nam := Make_Selected_Component (Loc, ! Prefix => ! Unchecked_Convert_To ( ! Corresponding_Concurrent_Type (Obj_Typ), ! Conv_Id), ! Selector_Name => ! New_Reference_To (Subp_Id, Loc)); end if; -- Create the subprogram body. For a function, the call to the --- 1855,1864 ---- Nam := Make_Selected_Component (Loc, ! Prefix => ! Unchecked_Convert_To ! (Corresponding_Concurrent_Type (Obj_Typ), Conv_Id), ! Selector_Name => New_Reference_To (Subp_Id, Loc)); end if; -- Create the subprogram body. For a function, the call to the *************** package body Exp_Ch9 is *** 2141,2147 **** -- record type, so mark the spec accordingly. if Ekind (Subp_Id) = E_Function then - declare Res_Def : Node_Id; --- 2313,2318 ---- *************** package body Exp_Ch9 is *** 2308,2317 **** Cond := Make_Op_Le (Loc, ! Left_Opnd => Make_Identifier (Loc, Name_uE), Right_Opnd => Siz); ! -- Map entry queue indices in the range of the current family -- into the current index, that designates the entry body. if No (If_St) then --- 2479,2488 ---- Cond := Make_Op_Le (Loc, ! Left_Opnd => Make_Identifier (Loc, Name_uE), Right_Opnd => Siz); ! -- Map entry queue indexes in the range of the current family -- into the current index, that designates the entry body. if No (If_St) then *************** package body Exp_Ch9 is *** 2397,2408 **** Add_Object_Pointer (Loc, Typ, Decls); while Present (Ent) loop - if Ekind (Ent) = E_Entry then Add_If_Clause (Make_Integer_Literal (Loc, 1)); elsif Ekind (Ent) = E_Entry_Family then - E_Typ := Etype (Discrete_Subtype_Definition (Parent (Ent))); Hi := Convert_Discriminant_Ref (Type_High_Bound (E_Typ)); Lo := Convert_Discriminant_Ref (Type_Low_Bound (E_Typ)); --- 2568,2577 ---- *************** package body Exp_Ch9 is *** 2481,2511 **** S : Entity_Id; begin ! S := Scope (E); ! ! -- Ada 2005 (AI-287): Do not set/get the has_master_entity reminder ! -- in internal scopes, unless present already.. Required for nested ! -- limited aggregates, where the expansion of task components may ! -- generate inner blocks. If the block is the rewriting of a call ! -- or the scope is an extended return statement this is valid master. ! -- The master in an extended return is only used within the return, ! -- and is subsequently overwritten in Move_Activation_Chain, but it ! -- must exist now. ! ! if Ada_Version >= Ada_05 then ! while Is_Internal (S) loop ! if Nkind (Parent (S)) = N_Block_Statement ! and then ! Nkind (Original_Node (Parent (S))) = N_Procedure_Call_Statement ! then ! exit; ! elsif Ekind (S) = E_Return_Statement then ! exit; ! else ! S := Scope (S); ! end if; ! end loop; ! end if; -- Nothing to do if we already built a master entity for this scope -- or if there is no task hierarchy. --- 2650,2656 ---- S : Entity_Id; begin ! S := Find_Master_Scope (E); -- Nothing to do if we already built a master entity for this scope -- or if there is no task hierarchy. *************** package body Exp_Ch9 is *** 2534,2547 **** Insert_Before (P, Decl); Analyze (Decl); ! -- Ada 2005 (AI-287): Set the has_master_entity reminder in the ! -- non-internal scope selected above. ! ! if Ada_Version >= Ada_05 then ! Set_Has_Master_Entity (S); ! else ! Set_Has_Master_Entity (Scope (E)); ! end if; -- Now mark the containing scope as a task master --- 2679,2685 ---- Insert_Before (P, Decl); Analyze (Decl); ! Set_Has_Master_Entity (S); -- Now mark the containing scope as a task master *************** package body Exp_Ch9 is *** 2713,2722 **** 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 --- 2851,2858 ---- 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 *************** package body Exp_Ch9 is *** 2751,2756 **** --- 2887,2896 ---- raise Program_Error; end case; + -- Establish link between subprogram body entity and source entry. + + Set_Corresponding_Protected_Entry (Edef, Ent); + -- Create body of entry procedure. The renaming declarations are -- placed ahead of the block that contains the actual entry body. *************** package body Exp_Ch9 is *** 2773,2779 **** Make_Attribute_Reference (Han_Loc, Prefix => Make_Selected_Component (Han_Loc, ! Prefix => Make_Identifier (Han_Loc, Name_uObject), Selector_Name => Make_Identifier (Han_Loc, Name_uObject)), --- 2913,2919 ---- Make_Attribute_Reference (Han_Loc, Prefix => Make_Selected_Component (Han_Loc, ! Prefix => Make_Identifier (Han_Loc, Name_uObject), Selector_Name => Make_Identifier (Han_Loc, Name_uObject)), *************** package body Exp_Ch9 is *** 3093,3101 **** Uactuals := New_List; Pformal := First (Parameter_Specifications (P_Op_Spec)); while Present (Pformal) loop ! Append ( ! Make_Identifier (Loc, Chars (Defining_Identifier (Pformal))), ! Uactuals); Next (Pformal); end loop; --- 3233,3240 ---- Uactuals := New_List; Pformal := First (Parameter_Specifications (P_Op_Spec)); while Present (Pformal) loop ! Append_To (Uactuals, ! Make_Identifier (Loc, Chars (Defining_Identifier (Pformal)))); Next (Pformal); end loop; *************** package body Exp_Ch9 is *** 3104,3110 **** if Nkind (Op_Spec) = N_Function_Specification then if Exc_Safe then ! R := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Unprot_Call := Make_Object_Declaration (Loc, Defining_Identifier => R, --- 3243,3249 ---- if Nkind (Op_Spec) = N_Function_Specification then if Exc_Safe then ! R := Make_Temporary (Loc, 'R'); Unprot_Call := Make_Object_Declaration (Loc, Defining_Identifier => R, *************** package body Exp_Ch9 is *** 3113,3129 **** Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, ! Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); ! Return_Stmt := Make_Simple_Return_Statement (Loc, ! Expression => New_Reference_To (R, Loc)); else Unprot_Call := Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, ! Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); end if; --- 3252,3270 ---- Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, ! Chars => Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); ! ! Return_Stmt := ! Make_Simple_Return_Statement (Loc, ! Expression => New_Reference_To (R, Loc)); else Unprot_Call := Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, ! Chars => Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); end if; *************** package body Exp_Ch9 is *** 3131,3138 **** Unprot_Call := Make_Procedure_Call_Statement (Loc, Name => ! Make_Identifier (Loc, ! Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals); end if; --- 3272,3278 ---- Unprot_Call := Make_Procedure_Call_Statement (Loc, Name => ! Make_Identifier (Loc, Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals); end if; *************** package body Exp_Ch9 is *** 3169,3178 **** Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, ! Prefix => ! Make_Identifier (Loc, Name_uObject), ! Selector_Name => ! Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); Lock_Stmt := Make_Procedure_Call_Statement (Loc, --- 3309,3316 ---- Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uObject), ! Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); Lock_Stmt := Make_Procedure_Call_Statement (Loc, *************** package body Exp_Ch9 is *** 3486,3496 **** 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 --- 3624,3634 ---- if Nkind (Concval) = N_Function_Call and then Is_Task_Type (Conctyp) ! and then Ada_Version >= Ada_2005 then declare ! ExpR : constant Node_Id := Relocate_Node (Concval); ! Obj : constant Entity_Id := Make_Temporary (Loc, 'F', ExpR); Decl : Node_Id; begin *************** package body Exp_Ch9 is *** 3498,3504 **** 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)); --- 3636,3642 ---- Make_Object_Declaration (Loc, Defining_Identifier => Obj, Object_Definition => New_Occurrence_Of (Conctyp, Loc), ! Expression => ExpR); Set_Etype (Obj, Conctyp); Decls := New_List (Decl); Rewrite (Concval, New_Occurrence_Of (Obj, Loc)); *************** package body Exp_Ch9 is *** 3568,3578 **** if Is_By_Copy_Type (Etype (Actual)) then N_Node := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('J')), ! Aliased_Present => True, ! Object_Definition => New_Reference_To (Etype (Formal), Loc)); -- Mark the object as not needing initialization since the --- 3706,3714 ---- if Is_By_Copy_Type (Etype (Actual)) then N_Node := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'J'), ! Aliased_Present => True, ! Object_Definition => New_Reference_To (Etype (Formal), Loc)); -- Mark the object as not needing initialization since the *************** package body Exp_Ch9 is *** 3609,3615 **** else -- Interface class-wide formal ! if Ada_Version >= Ada_05 and then Ekind (Etype (Formal)) = E_Class_Wide_Type and then Is_Interface (Etype (Formal)) then --- 3745,3751 ---- else -- Interface class-wide formal ! if Ada_Version >= Ada_2005 and then Ekind (Etype (Formal)) = E_Class_Wide_Type and then Is_Interface (Etype (Formal)) then *************** package body Exp_Ch9 is *** 3683,3695 **** -- Bnn : Communications_Block; ! Comm_Name := ! Make_Defining_Identifier (Loc, New_Internal_Name ('B')); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Comm_Name, ! Object_Definition => New_Reference_To (RTE (RE_Communication_Block), Loc))); -- Some additional statements for protected entry calls --- 3819,3830 ---- -- Bnn : Communications_Block; ! Comm_Name := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Comm_Name, ! Object_Definition => New_Reference_To (RTE (RE_Communication_Block), Loc))); -- Some additional statements for protected entry calls *************** package body Exp_Ch9 is *** 3941,3956 **** Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); ! ! Blkent : Entity_Id; Block : Node_Id; begin - Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - Block := Make_Block_Statement (Loc, ! Identifier => New_Reference_To (Blkent, Loc), Declarations => New_List ( -- _Chain : Activation_Chain; --- 4076,4088 ---- Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); ! Blkent : constant Entity_Id := Make_Temporary (Loc, 'A'); Block : Node_Id; begin Block := Make_Block_Statement (Loc, ! Identifier => New_Reference_To (Blkent, Loc), Declarations => New_List ( -- _Chain : Activation_Chain; *************** package body Exp_Ch9 is *** 4006,4017 **** Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); ! Blkent : Entity_Id; Block : Node_Id; begin - Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - Append_To (Init_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Activate_Tasks), Loc), --- 4138,4147 ---- Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); ! Blkent : constant Entity_Id := Make_Temporary (Loc, 'A'); Block : Node_Id; begin Append_To (Init_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Activate_Tasks), Loc), *************** package body Exp_Ch9 is *** 4141,4149 **** Efam := First_Entity (Conctyp); while Present (Efam) loop if Ekind (Efam) = E_Entry_Family then ! Efam_Type := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('F')); declare Bas : Entity_Id := --- 4271,4277 ---- Efam := First_Entity (Conctyp); while Present (Efam) loop if Ekind (Efam) = E_Entry_Family then ! Efam_Type := Make_Temporary (Loc, 'F'); declare Bas : Entity_Id := *************** package body Exp_Ch9 is *** 4158,4166 **** (Discrete_Subtype_Definition (Parent (Efam)), Lo, Hi); if Is_Potentially_Large_Family (Bas, Conctyp, Lo, Hi) then ! Bas := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('B')); Bas_Decl := Make_Subtype_Declaration (Loc, --- 4286,4292 ---- (Discrete_Subtype_Definition (Parent (Efam)), Lo, Hi); if Is_Potentially_Large_Family (Bas, Conctyp, Lo, Hi) then ! Bas := Make_Temporary (Loc, 'B'); Bas_Decl := Make_Subtype_Declaration (Loc, *************** package body Exp_Ch9 is *** 4397,4416 **** else declare Decl : Node_Id; ! T_Self : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); T_Body : constant Node_Id := Parent (Corresponding_Body (Parent (Entity (N)))); begin ! Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => T_Self, ! Object_Definition => ! New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc), ! Expression => ! Make_Function_Call (Loc, ! Name => New_Reference_To (RTE (RE_Self), Loc))); Prepend (Decl, Declarations (T_Body)); Analyze (Decl); Set_Scope (T_Self, Entity (N)); --- 4523,4541 ---- else declare Decl : Node_Id; ! T_Self : constant Entity_Id := Make_Temporary (Loc, 'T'); T_Body : constant Node_Id := Parent (Corresponding_Body (Parent (Entity (N)))); begin ! Decl := ! Make_Object_Declaration (Loc, ! Defining_Identifier => T_Self, ! Object_Definition => ! New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc), ! Expression => ! Make_Function_Call (Loc, ! Name => New_Reference_To (RTE (RE_Self), Loc))); Prepend (Decl, Declarations (T_Body)); Analyze (Decl); Set_Scope (T_Self, Entity (N)); *************** package body Exp_Ch9 is *** 4438,4444 **** return Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (Corresponding_Record_Type (Ntyp), New_Copy_Tree (N)), Selector_Name => Make_Identifier (Loc, Sel)); --- 4563,4569 ---- return Make_Selected_Component (Loc, ! Prefix => Unchecked_Convert_To (Corresponding_Record_Type (Ntyp), New_Copy_Tree (N)), Selector_Name => Make_Identifier (Loc, Sel)); *************** package body Exp_Ch9 is *** 4707,4731 **** -- completes in the middle of the accept body. if Present (Handled_Statement_Sequence (N)) then ! Lab_Id := Make_Identifier (Loc, New_Internal_Name ('L')); ! Set_Entity (Lab_Id, ! Make_Defining_Identifier (Loc, Chars (Lab_Id))); ! Lab := Make_Label (Loc, Lab_Id); ! Ldecl := ! Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Entity (Lab_Id), ! Label_Construct => Lab); ! Append (Lab, Statements (Handled_Statement_Sequence (N))); ! Lab_Id := Make_Identifier (Loc, New_Internal_Name ('L')); ! Set_Entity (Lab_Id, ! Make_Defining_Identifier (Loc, Chars (Lab_Id))); ! Lab := Make_Label (Loc, Lab_Id); ! Ldecl2 := ! Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Entity (Lab_Id), ! Label_Construct => Lab); ! Append (Lab, Statements (Handled_Statement_Sequence (N))); else Ldecl := Empty; --- 4832,4859 ---- -- completes in the middle of the accept body. if Present (Handled_Statement_Sequence (N)) then ! declare ! Ent : Entity_Id; ! begin ! Ent := Make_Temporary (Loc, 'L'); ! Lab_Id := New_Reference_To (Ent, Loc); ! Lab := Make_Label (Loc, Lab_Id); ! Ldecl := ! Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Ent, ! Label_Construct => Lab); ! Append (Lab, Statements (Handled_Statement_Sequence (N))); ! ! Ent := Make_Temporary (Loc, 'L'); ! Lab_Id := New_Reference_To (Ent, Loc); ! Lab := Make_Label (Loc, Lab_Id); ! Ldecl2 := ! Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Ent, ! Label_Construct => Lab); ! Append (Lab, Statements (Handled_Statement_Sequence (N))); ! end; else Ldecl := Empty; *************** package body Exp_Ch9 is *** 4737,4745 **** if Is_List_Member (N) then if Present (Handled_Statement_Sequence (N)) then ! Ann := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Adecl := Make_Object_Declaration (Loc, --- 4865,4871 ---- if Is_List_Member (N) then if Present (Handled_Statement_Sequence (N)) then ! Ann := Make_Temporary (Loc, 'A'); Adecl := Make_Object_Declaration (Loc, *************** package body Exp_Ch9 is *** 4796,4804 **** -- label for requeue expansion must be declared. if N = Accept_Statement (Alt) then ! Ann := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); ! Adecl := Make_Object_Declaration (Loc, Defining_Identifier => Ann, --- 4922,4928 ---- -- label for requeue expansion must be declared. if N = Accept_Statement (Alt) then ! Ann := Make_Temporary (Loc, 'A'); Adecl := Make_Object_Declaration (Loc, Defining_Identifier => Ann, *************** package body Exp_Ch9 is *** 4911,4920 **** Comps : List_Id; T : constant Entity_Id := Defining_Identifier (N); D_T : constant Entity_Id := Designated_Type (T); ! D_T2 : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('D')); ! 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), D_T, False); Decl1 : Node_Id; --- 5035,5042 ---- Comps : List_Id; T : constant Entity_Id := Defining_Identifier (N); D_T : constant Entity_Id := Designated_Type (T); ! D_T2 : constant Entity_Id := Make_Temporary (Loc, 'D'); ! E_T : constant Entity_Id := Make_Temporary (Loc, 'E'); P_List : constant List_Id := Build_Protected_Spec (N, RTE (RE_Address), D_T, False); Decl1 : Node_Id; *************** package body Exp_Ch9 is *** 4950,4957 **** Comps := New_List ( Make_Component_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, --- 5072,5078 ---- Comps := New_List ( Make_Component_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'P'), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, *************** package body Exp_Ch9 is *** 4959,4969 **** New_Occurrence_Of (RTE (RE_Address), Loc))), Make_Component_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')), Component_Definition => Make_Component_Definition (Loc, ! Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (D_T2, Loc)))); Decl2 := --- 5080,5089 ---- New_Occurrence_Of (RTE (RE_Address), Loc))), Make_Component_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), Component_Definition => Make_Component_Definition (Loc, ! Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (D_T2, Loc)))); Decl2 := *************** package body Exp_Ch9 is *** 5109,5115 **** -- A task interface class-wide type object is being aborted. -- Retrieve its _task_id by calling a dispatching routine. ! if Ada_Version >= Ada_05 and then Ekind (Etype (Tasknm)) = E_Class_Wide_Type and then Is_Interface (Etype (Tasknm)) and then Is_Task_Interface (Etype (Tasknm)) --- 5229,5235 ---- -- A task interface class-wide type object is being aborted. -- Retrieve its _task_id by calling a dispatching routine. ! if Ada_Version >= Ada_2005 and then Ekind (Etype (Tasknm)) = E_Class_Wide_Type and then Is_Interface (Etype (Tasknm)) and then Is_Task_Interface (Etype (Tasknm)) *************** package body Exp_Ch9 is *** 5127,5134 **** New_Reference_To (RTE (RO_ST_Task_Id), Loc), Expression => Make_Selected_Component (Loc, ! Prefix => ! New_Copy_Tree (Tasknm), Selector_Name => Make_Identifier (Loc, Name_uDisp_Get_Task_Id))))); --- 5247,5253 ---- New_Reference_To (RTE (RO_ST_Task_Id), Loc), Expression => Make_Selected_Component (Loc, ! Prefix => New_Copy_Tree (Tasknm), Selector_Name => Make_Identifier (Loc, Name_uDisp_Get_Task_Id))))); *************** package body Exp_Ch9 is *** 5291,5297 **** -- Construct the block, using the declarations from the accept -- statement if any to initialize the declarations of the block. ! Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Set_Ekind (Blkent, E_Block); Set_Etype (Blkent, Standard_Void_Type); Set_Scope (Blkent, Current_Scope); --- 5410,5416 ---- -- Construct the block, using the declarations from the accept -- statement if any to initialize the declarations of the block. ! Blkent := Make_Temporary (Loc, 'A'); Set_Ekind (Blkent, E_Block); Set_Etype (Blkent, Standard_Void_Type); Set_Scope (Blkent, Current_Scope); *************** package body Exp_Ch9 is *** 5302,5307 **** --- 5421,5431 ---- Declarations => Declarations (N), Handled_Statement_Sequence => Build_Accept_Body (N)); + -- For the analysis of the generated declarations, the parent node + -- must be properly set. + + Set_Parent (Block, Parent (N)); + -- Prepend call to Accept_Call to main statement sequence If the -- accept has exception handlers, the statement sequence is wrapped -- in a block. Insert call and renaming declarations in the *************** package body Exp_Ch9 is *** 5676,5682 **** T : Entity_Id; -- Additional status flag begin ! Blk_Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Ecall := Triggering_Statement (Trig); -- The arguments in the call may require dynamic allocation, and the --- 5800,5806 ---- T : Entity_Id; -- Additional status flag begin ! Blk_Ent := Make_Temporary (Loc, 'A'); Ecall := Triggering_Statement (Trig); -- The arguments in the call may require dynamic allocation, and the *************** package body Exp_Ch9 is *** 5697,5703 **** -- trigger which was expanded into a procedure call. if Nkind (Ecall) = N_Procedure_Call_Statement then ! if Ada_Version >= Ada_05 and then (No (Original_Node (Ecall)) or else not Nkind_In (Original_Node (Ecall), --- 5821,5827 ---- -- trigger which was expanded into a procedure call. if Nkind (Ecall) = N_Procedure_Call_Statement then ! if Ada_Version >= Ada_2005 and then (No (Original_Node (Ecall)) or else not Nkind_In (Original_Node (Ecall), *************** package body Exp_Ch9 is *** 5717,5729 **** -- Communication block processing, generate: -- Bnn : Communication_Block; ! Bnn := Make_Defining_Identifier (Loc, New_Internal_Name ('B')); ! Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => ! Bnn, ! Object_Definition => New_Reference_To (RTE (RE_Communication_Block), Loc))); -- Call kind processing, generate: --- 5841,5851 ---- -- Communication block processing, generate: -- Bnn : Communication_Block; ! Bnn := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => Bnn, ! Object_Definition => New_Reference_To (RTE (RE_Communication_Block), Loc))); -- Call kind processing, generate: *************** package body Exp_Ch9 is *** 5761,5774 **** S := Build_S (Loc, Decls); -- Additional status flag processing, generate: ! T := Make_Defining_Identifier (Loc, New_Internal_Name ('T')); ! Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => ! T, ! Object_Definition => New_Reference_To (Standard_Boolean, Loc))); ------------------------------ --- 5883,5895 ---- S := Build_S (Loc, Decls); -- Additional status flag processing, generate: + -- Tnn : Boolean; ! T := Make_Temporary (Loc, 'T'); Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => T, ! Object_Definition => New_Reference_To (Standard_Boolean, Loc))); ------------------------------ *************** package body Exp_Ch9 is *** 5793,5800 **** Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Reference_To (RTE (RE_Communication_Block), Loc), ! Expression => ! Make_Identifier (Loc, Name_uD)))); -- Generate: -- _Disp_Asynchronous_Select (, S, P'Address, D, B); --- 5914,5920 ---- Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Reference_To (RTE (RE_Communication_Block), Loc), ! Expression => Make_Identifier (Loc, Name_uD)))); -- Generate: -- _Disp_Asynchronous_Select (, S, P'Address, D, B); *************** package body Exp_Ch9 is *** 5853,5861 **** -- _clean; -- end; ! Cleanup_Block_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('C')); ! Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, Bnn); --- 5973,5979 ---- -- _clean; -- end; ! Cleanup_Block_Ent := Make_Temporary (Loc, 'C'); Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, Bnn); *************** package body Exp_Ch9 is *** 5868,5876 **** -- when Abort_Signal => Abort_Undefer; -- end; ! Abort_Block_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); ! ProtE_Stmts := New_List ( Make_Implicit_Label_Declaration (Loc, --- 5986,5992 ---- -- when Abort_Signal => Abort_Undefer; -- end; ! Abort_Block_Ent := Make_Temporary (Loc, 'A'); ProtE_Stmts := New_List ( Make_Implicit_Label_Declaration (Loc, *************** package body Exp_Ch9 is *** 5922,5929 **** Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Reference_To (RTE (RE_Communication_Block), Loc), ! Expression => ! Make_Identifier (Loc, Name_uD)))); -- Generate: -- _Disp_Asynchronous_Select (, S, P'Address, D, B); --- 6038,6044 ---- Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Reference_To (RTE (RE_Communication_Block), Loc), ! Expression => Make_Identifier (Loc, Name_uD)))); -- Generate: -- _Disp_Asynchronous_Select (, S, P'Address, D, B); *************** package body Exp_Ch9 is *** 5985,5993 **** -- _clean; -- end; ! Cleanup_Block_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('C')); ! Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, T); --- 6100,6106 ---- -- _clean; -- end; ! Cleanup_Block_Ent := Make_Temporary (Loc, 'C'); Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, T); *************** package body Exp_Ch9 is *** 6000,6012 **** -- when Abort_Signal => Abort_Undefer; -- end; ! Abort_Block_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Append_To (TaskE_Stmts, Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => ! Abort_Block_Ent)); Append_To (TaskE_Stmts, Build_Abort_Block --- 6113,6123 ---- -- when Abort_Signal => Abort_Undefer; -- end; ! Abort_Block_Ent := Make_Temporary (Loc, 'A'); Append_To (TaskE_Stmts, Make_Implicit_Label_Declaration (Loc, ! Defining_Identifier => Abort_Block_Ent)); Append_To (TaskE_Stmts, Build_Abort_Block *************** package body Exp_Ch9 is *** 6143,6150 **** -- Add a Delay_Block object to the parameter list of the delay -- procedure to form the parameter list of the Wait entry call. ! Dblock_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('D')); Pdef := Entity (Name (Ecall)); --- 6254,6260 ---- -- Add a Delay_Block object to the parameter list of the delay -- procedure to form the parameter list of the Wait entry call. ! Dblock_Ent := Make_Temporary (Loc, 'D'); Pdef := Entity (Name (Ecall)); *************** package body Exp_Ch9 is *** 6642,6648 **** S : Entity_Id; -- Primitive operation slot begin ! if Ada_Version >= Ada_05 and then Nkind (Blk) = N_Procedure_Call_Statement then Extract_Dispatching_Call (Blk, Call_Ent, Obj, Actuals, Formals); --- 6752,6758 ---- S : Entity_Id; -- Primitive operation slot begin ! if Ada_Version >= Ada_2005 and then Nkind (Blk) = N_Procedure_Call_Statement then Extract_Dispatching_Call (Blk, Call_Ent, Obj, Actuals, Formals); *************** package body Exp_Ch9 is *** 7092,7099 **** -- Declare new access type and then append ! Ctype := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Decl := Make_Full_Type_Declaration (Loc, --- 7202,7208 ---- -- Declare new access type and then append ! Ctype := Make_Temporary (Loc, 'A'); Decl := Make_Full_Type_Declaration (Loc, *************** package body Exp_Ch9 is *** 7120,7127 **** -- Create the Entry_Parameter_Record declaration ! Rec_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Decl := Make_Full_Type_Declaration (Loc, --- 7229,7235 ---- -- Create the Entry_Parameter_Record declaration ! Rec_Ent := Make_Temporary (Loc, 'P'); Decl := Make_Full_Type_Declaration (Loc, *************** package body Exp_Ch9 is *** 7137,7144 **** -- Construct and link in the corresponding access type ! Acc_Ent := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Set_Entry_Parameters_Type (Entry_Ent, Acc_Ent); --- 7245,7251 ---- -- Construct and link in the corresponding access type ! Acc_Ent := Make_Temporary (Loc, 'A'); Set_Entry_Parameters_Type (Entry_Ent, Acc_Ent); *************** package body Exp_Ch9 is *** 7302,7312 **** -- Generate a specification without a letter suffix in order to -- override an interface function or procedure. ! Spec := ! Build_Protected_Sub_Specification (N, Pid, Dispatching_Mode); ! -- The formal parameters become the actuals of the protected ! -- function or procedure call. Actuals := New_List; Formal := First (Parameter_Specifications (Spec)); --- 7409,7418 ---- -- Generate a specification without a letter suffix in order to -- override an interface function or procedure. ! Spec := Build_Protected_Sub_Specification (N, Pid, Dispatching_Mode); ! -- The formal parameters become the actuals of the protected function ! -- or procedure call. Actuals := New_List; Formal := First (Parameter_Specifications (Spec)); *************** package body Exp_Ch9 is *** 7339,7346 **** return Make_Subprogram_Body (Loc, ! Declarations => Empty_List, ! Specification => Spec, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts)); end Build_Dispatching_Subprogram_Body; --- 7445,7452 ---- return Make_Subprogram_Body (Loc, ! Declarations => Empty_List, ! Specification => Spec, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts)); end Build_Dispatching_Subprogram_Body; *************** package body Exp_Ch9 is *** 7436,7442 **** -- this subprogram if the protected type implements an -- interface. ! if Ada_Version >= Ada_05 and then Present (Interfaces (Corresponding_Record_Type (Pid))) then --- 7542,7548 ---- -- this subprogram if the protected type implements an -- interface. ! if Ada_Version >= Ada_2005 and then Present (Interfaces (Corresponding_Record_Type (Pid))) then *************** package body Exp_Ch9 is *** 7519,7525 **** -- protected body. At this point all wrapper specs have been created, -- frozen and included in the dispatch table for the protected type. ! if Ada_Version >= Ada_05 then Build_Wrapper_Bodies (Loc, Pid, Current_Node); end if; end Expand_N_Protected_Body; --- 7625,7631 ---- -- protected body. At this point all wrapper specs have been created, -- frozen and included in the dispatch table for the protected type. ! if Ada_Version >= Ada_2005 then Build_Wrapper_Bodies (Loc, Pid, Current_Node); end if; end Expand_N_Protected_Body; *************** package body Exp_Ch9 is *** 7725,7735 **** Cdecls := Component_Items (Component_List (Type_Definition (Rec_Decl))); - -- Ada 2005 (AI-345): Propagate the attribute that contains the list - -- of implemented interfaces. - - Set_Interface_List (Type_Definition (Rec_Decl), Interface_List (N)); - Qualify_Entity_Names (N); -- If the type has discriminants, their occurrences in the declaration --- 7831,7836 ---- *************** package body Exp_Ch9 is *** 7831,7837 **** -- Type has explicit entries or generated primitive entry wrappers elsif Has_Entries (Prot_Typ) ! or else (Ada_Version >= Ada_05 and then Present (Interface_List (N))) then case Corresponding_Runtime_Package (Prot_Typ) is --- 7932,7938 ---- -- Type has explicit entries or generated primitive entry wrappers elsif Has_Entries (Prot_Typ) ! or else (Ada_Version >= Ada_2005 and then Present (Interface_List (N))) then case Corresponding_Runtime_Package (Prot_Typ) is *************** package body Exp_Ch9 is *** 8002,8008 **** -- the corresponding record is frozen. If any wrappers are generated, -- Current_Node is updated accordingly. ! if Ada_Version >= Ada_05 then Build_Wrapper_Specs (Loc, Prot_Typ, Current_Node); end if; --- 8103,8109 ---- -- the corresponding record is frozen. If any wrappers are generated, -- Current_Node is updated accordingly. ! if Ada_Version >= Ada_2005 then Build_Wrapper_Specs (Loc, Prot_Typ, Current_Node); end if; *************** package body Exp_Ch9 is *** 8063,8069 **** -- Generate an overriding primitive operation specification for -- this subprogram if the protected type implements an interface. ! if Ada_Version >= Ada_05 and then Present (Interfaces (Corresponding_Record_Type (Prot_Typ))) then --- 8164,8170 ---- -- Generate an overriding primitive operation specification for -- this subprogram if the protected type implements an interface. ! if Ada_Version >= Ada_2005 and then Present (Interfaces (Corresponding_Record_Type (Prot_Typ))) then *************** package body Exp_Ch9 is *** 8108,8113 **** --- 8209,8218 ---- Insert_After (Current_Node, Sub); Analyze (Sub); + -- build wrapper procedure for pre/postconditions. + + Build_PPC_Wrapper (Comp_Id, N); + Set_Protected_Body_Subprogram (Defining_Identifier (Comp), Defining_Unit_Name (Specification (Sub))); *************** package body Exp_Ch9 is *** 8368,8375 **** -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); ! -- Ada 2005 (AI05-0030): Dispatching requeue from protected to interface ! -- class-wide type: -- procedure entE -- (O : System.Address; --- 8473,8482 ---- -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); ! -- Ada 2012 (AI05-0030): Dispatching requeue to an interface primitive ! -- marked by pragma Implemented (XXX, By_Entry). ! ! -- The requeue is inside a protected entry: -- procedure entE -- (O : System.Address; *************** package body Exp_Ch9 is *** 8405,8414 **** -- end; -- end entE; ! -- Ada 2005 (AI05-0030): Dispatching requeue from task to interface ! -- class-wide type: ! -- Accept_Call (E, Ann); -- -- _Disp_Requeue -- (, --- 8512,8520 ---- -- end; -- end entE; ! -- The requeue is inside a task entry: ! -- Accept_Call (E, Ann); -- -- _Disp_Requeue -- (, *************** package body Exp_Ch9 is *** 8428,8490 **** -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); ! -- Further details on these expansions can be found in Expand_N_Protected_ ! -- Body and Expand_N_Accept_Statement. procedure Expand_N_Requeue_Statement (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Abortable : Node_Id; ! Acc_Stat : Node_Id; ! Conc_Typ : Entity_Id; ! Concval : Node_Id; ! Ename : Node_Id; ! Index : Node_Id; ! Lab_Node : Node_Id; ! New_Param : Node_Id; ! Old_Typ : Entity_Id; ! Params : List_Id; ! Rcall : Node_Id; ! RTS_Call : Entity_Id; ! Self_Param : Node_Id; ! Skip_Stat : Node_Id; ! begin ! Abortable := ! New_Occurrence_Of (Boolean_Literals (Abort_Present (N)), Loc); ! -- Extract the components of the entry call ! Extract_Entry (N, Concval, Ename, Index); ! Conc_Typ := Etype (Concval); ! -- Examine the scope stack in order to find nearest enclosing protected ! -- or task type. This will constitute our invocation source. ! Old_Typ := Current_Scope; ! while Present (Old_Typ) ! and then not Is_Protected_Type (Old_Typ) ! and then not Is_Task_Type (Old_Typ) ! loop ! Old_Typ := Scope (Old_Typ); ! end loop; ! -- Generate the parameter list for all cases. The abortable flag is ! -- common among dispatching and regular requeue. ! Params := New_List (Abortable); ! -- Ada 2005 (AI05-0030): We have a dispatching requeue of the form ! -- Concval.Ename where the type of Concval is class-wide concurrent ! -- interface. ! if Ada_Version >= Ada_05 ! and then Present (Concval) ! and then Is_Class_Wide_Type (Conc_Typ) ! and then Is_Concurrent_Interface (Conc_Typ) ! then ! RTS_Call := Make_Identifier (Loc, Name_uDisp_Requeue); -- Generate: -- Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (Concval), -- ) --- 8534,8690 ---- -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); ! -- Ada 2012 (AI05-0030): Dispatching requeue to an interface primitive ! -- marked by pragma Implemented (XXX, By_Protected_Procedure). The requeue ! -- statement is replaced by a dispatching call with actual parameters taken ! -- from the inner-most accept statement or entry body. ! ! -- Target.Primitive (Param1, ..., ParamN); ! ! -- Ada 2012 (AI05-0030): Dispatching requeue to an interface primitive ! -- marked by pragma Implemented (XXX, By_Any) or not marked at all. ! ! -- declare ! -- S : constant Offset_Index := ! -- Get_Offset_Index (Tag (Concval), DT_Position (Ename)); ! -- C : constant Prim_Op_Kind := Get_Prim_Op_Kind (Tag (Concval), S); ! ! -- begin ! -- if C = POK_Protected_Entry ! -- or else C = POK_Task_Entry ! -- then ! -- ! ! -- elsif C = POK_Protected_Procedure then ! -- ! ! -- else ! -- raise Program_Error; ! -- end if; ! -- end; procedure Expand_N_Requeue_Statement (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Conc_Typ : Entity_Id; ! Concval : Node_Id; ! Ename : Node_Id; ! Index : Node_Id; ! Old_Typ : Entity_Id; ! function Build_Dispatching_Call_Equivalent return Node_Id; ! -- Ada 2012 (AI05-0030): N denotes a dispatching requeue statement of ! -- the form Concval.Ename. It is statically known that Ename is allowed ! -- to be implemented by a protected procedure. Create a dispatching call ! -- equivalent of Concval.Ename taking the actual parameters from the ! -- inner-most accept statement or entry body. ! function Build_Dispatching_Requeue return Node_Id; ! -- Ada 2012 (AI05-0030): N denotes a dispatching requeue statement of ! -- the form Concval.Ename. It is statically known that Ename is allowed ! -- to be implemented by a protected or a task entry. Create a call to ! -- primitive _Disp_Requeue which handles the low-level actions. ! function Build_Dispatching_Requeue_To_Any return Node_Id; ! -- Ada 2012 (AI05-0030): N denotes a dispatching requeue statement of ! -- the form Concval.Ename. Ename is either marked by pragma Implemented ! -- (XXX, By_Any) or not marked at all. Create a block which determines ! -- at runtime whether Ename denotes an entry or a procedure and perform ! -- the appropriate kind of dispatching select. ! function Build_Normal_Requeue return Node_Id; ! -- N denotes a non-dispatching requeue statement to either a task or a ! -- protected entry. Build the appropriate runtime call to perform the ! -- action. ! function Build_Skip_Statement (Search : Node_Id) return Node_Id; ! -- For a protected entry, create a return statement to skip the rest of ! -- the entry body. Otherwise, create a goto statement to skip the rest ! -- of a task accept statement. The lookup for the enclosing entry body ! -- or accept statement starts from Search. ! --------------------------------------- ! -- Build_Dispatching_Call_Equivalent -- ! --------------------------------------- ! function Build_Dispatching_Call_Equivalent return Node_Id is ! Call_Ent : constant Entity_Id := Entity (Ename); ! Obj : constant Node_Id := Original_Node (Concval); ! Acc_Ent : Node_Id; ! Actuals : List_Id; ! Formal : Node_Id; ! Formals : List_Id; ! begin ! -- Climb the parent chain looking for the inner-most entry body or ! -- accept statement. ! Acc_Ent := N; ! while Present (Acc_Ent) ! and then not Nkind_In (Acc_Ent, N_Accept_Statement, ! N_Entry_Body) ! loop ! Acc_Ent := Parent (Acc_Ent); ! end loop; ! ! -- A requeue statement should be housed inside an entry body or an ! -- accept statement at some level. If this is not the case, then the ! -- tree is malformed. ! ! pragma Assert (Present (Acc_Ent)); ! ! -- Recover the list of formal parameters ! ! if Nkind (Acc_Ent) = N_Entry_Body then ! Acc_Ent := Entry_Body_Formal_Part (Acc_Ent); ! end if; ! ! Formals := Parameter_Specifications (Acc_Ent); ! ! -- Create the actual parameters for the dispatching call. These are ! -- simply copies of the entry body or accept statement formals in the ! -- same order as they appear. ! ! Actuals := No_List; ! ! if Present (Formals) then ! Actuals := New_List; ! Formal := First (Formals); ! while Present (Formal) loop ! Append_To (Actuals, ! Make_Identifier (Loc, Chars (Defining_Identifier (Formal)))); ! Next (Formal); ! end loop; ! end if; -- Generate: + -- Obj.Call_Ent (Actuals); + + return + Make_Procedure_Call_Statement (Loc, + Name => + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Chars (Obj)), + Selector_Name => Make_Identifier (Loc, Chars (Call_Ent))), + + Parameter_Associations => Actuals); + end Build_Dispatching_Call_Equivalent; + + ------------------------------- + -- Build_Dispatching_Requeue -- + ------------------------------- + + function Build_Dispatching_Requeue return Node_Id is + Params : constant List_Id := New_List; + + begin + -- Process the "with abort" parameter + + Prepend_To (Params, + New_Reference_To (Boolean_Literals (Abort_Present (N)), Loc)); + + -- Process the entry wrapper's position in the primary dispatch + -- table parameter. Generate: + -- Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (Concval), -- ) *************** package body Exp_Ch9 is *** 8493,8648 **** Make_Function_Call (Loc, Name => New_Reference_To (RTE (RE_Get_Offset_Index), Loc), - Parameter_Associations => - New_List ( - Unchecked_Convert_To (RTE (RE_Tag), Concval), - Make_Integer_Literal (Loc, DT_Position (Entity (Ename)))))); ! -- Specific actuals for protected to interface class-wide type ! -- requeue. if Is_Protected_Type (Old_Typ) then Prepend_To (Params, Make_Attribute_Reference (Loc, -- _object'Address Prefix => Concurrent_Ref (New_Occurrence_Of (Old_Typ, Loc)), ! Attribute_Name => ! Name_Address)); Prepend_To (Params, -- True New_Reference_To (Standard_True, Loc)); ! -- Specific actuals for task to interface class-wide type requeue else pragma Assert (Is_Task_Type (Old_Typ)); Prepend_To (Params, -- null New_Reference_To (RTE (RE_Null_Address), Loc)); Prepend_To (Params, -- False New_Reference_To (Standard_False, Loc)); end if; ! -- Finally, add the common object parameter Prepend_To (Params, New_Copy_Tree (Concval)); ! -- Regular requeue processing ! else ! New_Param := Concurrent_Ref (Concval); ! -- The index expression is common among all four cases Prepend_To (Params, ! Entry_Index_Expression (Loc, Entity (Ename), Index, Conc_Typ)); ! if Is_Protected_Type (Old_Typ) then ! Self_Param := ! Make_Attribute_Reference (Loc, ! Prefix => ! Concurrent_Ref (New_Occurrence_Of (Old_Typ, Loc)), ! Attribute_Name => ! Name_Unchecked_Access); ! -- Protected to protected requeue ! if Is_Protected_Type (Conc_Typ) then ! RTS_Call := ! New_Reference_To (RTE (RE_Requeue_Protected_Entry), Loc); ! New_Param := Make_Attribute_Reference (Loc, Prefix => ! New_Param, Attribute_Name => Name_Unchecked_Access); ! -- Protected to task requeue ! else ! pragma Assert (Is_Task_Type (Conc_Typ)); ! RTS_Call := ! New_Reference_To ( ! RTE (RE_Requeue_Protected_To_Task_Entry), Loc); ! end if; ! Prepend (New_Param, Params); ! Prepend (Self_Param, Params); ! else ! pragma Assert (Is_Task_Type (Old_Typ)); -- Task to protected requeue if Is_Protected_Type (Conc_Typ) then ! RTS_Call := New_Reference_To ( RTE (RE_Requeue_Task_To_Protected_Entry), Loc); ! New_Param := Make_Attribute_Reference (Loc, Prefix => ! New_Param, Attribute_Name => Name_Unchecked_Access); -- Task to task requeue ! else ! pragma Assert (Is_Task_Type (Conc_Typ)); ! RTS_Call := New_Reference_To (RTE (RE_Requeue_Task_Entry), Loc); end if; ! Prepend (New_Param, Params); end if; - end if; - - -- Create the GNARLI or predefined primitive call ! Rcall := ! Make_Procedure_Call_Statement (Loc, ! Name => RTS_Call, ! Parameter_Associations => Params); ! Rewrite (N, Rcall); ! Analyze (N); ! if Is_Protected_Type (Old_Typ) then ! -- Build the return statement to skip the rest of the entry body ! Skip_Stat := Make_Simple_Return_Statement (Loc); - else -- If the requeue is within a task, find the end label of the ! -- enclosing accept statement. ! Acc_Stat := Parent (N); ! while Nkind (Acc_Stat) /= N_Accept_Statement loop ! Acc_Stat := Parent (Acc_Stat); ! end loop; ! -- The last statement is the second label, used for completing the ! -- rendezvous the usual way. The label we are looking for is right ! -- before it. ! Lab_Node := ! Prev (Last (Statements (Handled_Statement_Sequence (Acc_Stat)))); ! pragma Assert (Nkind (Lab_Node) = N_Label); ! -- Build the goto statement to skip the rest of the accept ! -- statement. ! Skip_Stat := ! Make_Goto_Statement (Loc, ! Name => New_Occurrence_Of (Entity (Identifier (Lab_Node)), Loc)); ! end if; ! Set_Analyzed (Skip_Stat); ! Insert_After (N, Skip_Stat); end Expand_N_Requeue_Statement; ------------------------------- --- 8693,9080 ---- Make_Function_Call (Loc, Name => New_Reference_To (RTE (RE_Get_Offset_Index), Loc), ! Parameter_Associations => New_List ( ! Unchecked_Convert_To (RTE (RE_Tag), Concval), ! Make_Integer_Literal (Loc, DT_Position (Entity (Ename)))))); ! ! -- Specific actuals for protected to XXX requeue if Is_Protected_Type (Old_Typ) then Prepend_To (Params, Make_Attribute_Reference (Loc, -- _object'Address Prefix => Concurrent_Ref (New_Occurrence_Of (Old_Typ, Loc)), ! Attribute_Name => Name_Address)); ! Prepend_To (Params, -- True New_Reference_To (Standard_True, Loc)); ! -- Specific actuals for task to XXX requeue else pragma Assert (Is_Task_Type (Old_Typ)); Prepend_To (Params, -- null New_Reference_To (RTE (RE_Null_Address), Loc)); + Prepend_To (Params, -- False New_Reference_To (Standard_False, Loc)); end if; ! -- Add the object parameter Prepend_To (Params, New_Copy_Tree (Concval)); ! -- Generate: ! -- _Disp_Requeue (); ! return ! Make_Procedure_Call_Statement (Loc, ! Name => Make_Identifier (Loc, Name_uDisp_Requeue), ! Parameter_Associations => Params); ! end Build_Dispatching_Requeue; ! -------------------------------------- ! -- Build_Dispatching_Requeue_To_Any -- ! -------------------------------------- ! ! function Build_Dispatching_Requeue_To_Any return Node_Id is ! Call_Ent : constant Entity_Id := Entity (Ename); ! Obj : constant Node_Id := Original_Node (Concval); ! Skip : constant Node_Id := Build_Skip_Statement (N); ! C : Entity_Id; ! Decls : List_Id; ! S : Entity_Id; ! Stmts : List_Id; ! ! begin ! Decls := New_List; ! Stmts := New_List; ! ! -- Dispatch table slot processing, generate: ! -- S : Integer; ! ! S := Build_S (Loc, Decls); ! ! -- Call kind processing, generate: ! -- C : Ada.Tags.Prim_Op_Kind; ! ! C := Build_C (Loc, Decls); ! ! -- Generate: ! -- S := Ada.Tags.Get_Offset_Index ! -- (Ada.Tags.Tag (Obj), DT_Position (Call_Ent)); ! ! Append_To (Stmts, Build_S_Assignment (Loc, S, Obj, Call_Ent)); ! ! -- Generate: ! -- _Disp_Get_Prim_Op_Kind (Obj, S, C); ! ! Append_To (Stmts, ! Make_Procedure_Call_Statement (Loc, ! Name => ! New_Reference_To ( ! Find_Prim_Op (Etype (Etype (Obj)), ! Name_uDisp_Get_Prim_Op_Kind), ! Loc), ! Parameter_Associations => New_List ( ! New_Copy_Tree (Obj), ! New_Reference_To (S, Loc), ! New_Reference_To (C, Loc)))); ! ! Append_To (Stmts, ! ! -- if C = POK_Protected_Entry ! -- or else C = POK_Task_Entry ! -- then ! ! Make_If_Statement (Loc, ! Condition => ! Make_Op_Or (Loc, ! Left_Opnd => ! Make_Op_Eq (Loc, ! Left_Opnd => ! New_Reference_To (C, Loc), ! Right_Opnd => ! New_Reference_To (RTE (RE_POK_Protected_Entry), Loc)), ! ! Right_Opnd => ! Make_Op_Eq (Loc, ! Left_Opnd => ! New_Reference_To (C, Loc), ! Right_Opnd => ! New_Reference_To (RTE (RE_POK_Task_Entry), Loc))), ! ! -- Dispatching requeue equivalent ! ! Then_Statements => New_List ( ! Build_Dispatching_Requeue, ! Skip), ! ! -- elsif C = POK_Protected_Procedure then ! ! Elsif_Parts => New_List ( ! Make_Elsif_Part (Loc, ! Condition => ! Make_Op_Eq (Loc, ! Left_Opnd => ! New_Reference_To (C, Loc), ! Right_Opnd => ! New_Reference_To ( ! RTE (RE_POK_Protected_Procedure), Loc)), ! ! -- Dispatching call equivalent ! ! Then_Statements => New_List ( ! Build_Dispatching_Call_Equivalent))), ! ! -- else ! -- raise Program_Error; ! -- end if; ! ! Else_Statements => New_List ( ! Make_Raise_Program_Error (Loc, ! Reason => PE_Explicit_Raise)))); ! ! -- Wrap everything into a block ! ! return ! Make_Block_Statement (Loc, ! Declarations => Decls, ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => Stmts)); ! end Build_Dispatching_Requeue_To_Any; ! ! -------------------------- ! -- Build_Normal_Requeue -- ! -------------------------- ! ! function Build_Normal_Requeue return Node_Id is ! Params : constant List_Id := New_List; ! Param : Node_Id; ! RT_Call : Node_Id; ! ! begin ! -- Process the "with abort" parameter Prepend_To (Params, ! New_Reference_To (Boolean_Literals (Abort_Present (N)), Loc)); ! -- Add the index expression to the parameters. It is common among all ! -- four cases. ! Prepend_To (Params, ! Entry_Index_Expression (Loc, Entity (Ename), Index, Conc_Typ)); ! if Is_Protected_Type (Old_Typ) then ! declare ! Self_Param : Node_Id; ! begin ! Self_Param := Make_Attribute_Reference (Loc, Prefix => ! Concurrent_Ref (New_Occurrence_Of (Old_Typ, Loc)), Attribute_Name => Name_Unchecked_Access); ! -- Protected to protected requeue ! if Is_Protected_Type (Conc_Typ) then ! RT_Call := ! New_Reference_To ( ! RTE (RE_Requeue_Protected_Entry), Loc); ! Param := ! Make_Attribute_Reference (Loc, ! Prefix => ! Concurrent_Ref (Concval), ! Attribute_Name => ! Name_Unchecked_Access); ! -- Protected to task requeue ! ! else pragma Assert (Is_Task_Type (Conc_Typ)); ! RT_Call := ! New_Reference_To ( ! RTE (RE_Requeue_Protected_To_Task_Entry), Loc); ! ! Param := Concurrent_Ref (Concval); ! end if; ! ! Prepend_To (Params, Param); ! Prepend_To (Params, Self_Param); ! end; ! ! else pragma Assert (Is_Task_Type (Old_Typ)); -- Task to protected requeue if Is_Protected_Type (Conc_Typ) then ! RT_Call := New_Reference_To ( RTE (RE_Requeue_Task_To_Protected_Entry), Loc); ! Param := Make_Attribute_Reference (Loc, Prefix => ! Concurrent_Ref (Concval), Attribute_Name => Name_Unchecked_Access); -- Task to task requeue ! else pragma Assert (Is_Task_Type (Conc_Typ)); ! RT_Call := New_Reference_To (RTE (RE_Requeue_Task_Entry), Loc); + + Param := Concurrent_Ref (Concval); end if; ! Prepend_To (Params, Param); end if; ! return ! Make_Procedure_Call_Statement (Loc, ! Name => RT_Call, ! Parameter_Associations => Params); ! end Build_Normal_Requeue; ! -------------------------- ! -- Build_Skip_Statement -- ! -------------------------- ! function Build_Skip_Statement (Search : Node_Id) return Node_Id is ! Skip_Stmt : Node_Id; ! begin ! -- Build a return statement to skip the rest of the entire body ! if Is_Protected_Type (Old_Typ) then ! Skip_Stmt := Make_Simple_Return_Statement (Loc); -- If the requeue is within a task, find the end label of the ! -- enclosing accept statement and create a goto statement to it. ! else ! declare ! Acc : Node_Id; ! Label : Node_Id; ! begin ! -- Climb the parent chain looking for the enclosing accept ! -- statement. ! Acc := Parent (Search); ! while Present (Acc) ! and then Nkind (Acc) /= N_Accept_Statement ! loop ! Acc := Parent (Acc); ! end loop; ! -- The last statement is the second label used for completing ! -- the rendezvous the usual way. The label we are looking for ! -- is right before it. ! Label := ! Prev (Last (Statements (Handled_Statement_Sequence (Acc)))); ! pragma Assert (Nkind (Label) = N_Label); ! -- Generate a goto statement to skip the rest of the accept ! Skip_Stmt := ! Make_Goto_Statement (Loc, ! Name => ! New_Occurrence_Of (Entity (Identifier (Label)), Loc)); ! end; ! end if; ! ! Set_Analyzed (Skip_Stmt); ! ! return Skip_Stmt; ! end Build_Skip_Statement; ! ! -- Start of processing for Expand_N_Requeue_Statement ! ! begin ! -- Extract the components of the entry call ! ! Extract_Entry (N, Concval, Ename, Index); ! Conc_Typ := Etype (Concval); ! ! -- Examine the scope stack in order to find nearest enclosing protected ! -- or task type. This will constitute our invocation source. ! ! Old_Typ := Current_Scope; ! while Present (Old_Typ) ! and then not Is_Protected_Type (Old_Typ) ! and then not Is_Task_Type (Old_Typ) ! loop ! Old_Typ := Scope (Old_Typ); ! end loop; ! ! -- Ada 2012 (AI05-0030): We have a dispatching requeue of the form ! -- Concval.Ename where the type of Concval is class-wide concurrent ! -- interface. ! ! if Ada_Version >= Ada_2012 ! and then Present (Concval) ! and then Is_Class_Wide_Type (Conc_Typ) ! and then Is_Concurrent_Interface (Conc_Typ) ! then ! declare ! Has_Impl : Boolean := False; ! Impl_Kind : Name_Id := No_Name; ! ! begin ! -- Check whether the Ename is flagged by pragma Implemented ! ! if Has_Rep_Pragma (Entity (Ename), Name_Implemented) then ! Has_Impl := True; ! Impl_Kind := Implementation_Kind (Entity (Ename)); ! end if; ! ! -- The procedure_or_entry_NAME is guaranteed to be overridden by ! -- an entry. Create a call to predefined primitive _Disp_Requeue. ! ! if Has_Impl ! and then Impl_Kind = Name_By_Entry ! then ! Rewrite (N, Build_Dispatching_Requeue); ! Analyze (N); ! Insert_After (N, Build_Skip_Statement (N)); ! ! -- The procedure_or_entry_NAME is guaranteed to be overridden by ! -- a protected procedure. In this case the requeue is transformed ! -- into a dispatching call. ! ! elsif Has_Impl ! and then Impl_Kind = Name_By_Protected_Procedure ! then ! Rewrite (N, Build_Dispatching_Call_Equivalent); ! Analyze (N); ! ! -- The procedure_or_entry_NAME's implementation kind is either ! -- By_Any or pragma Implemented was not applied at all. In this ! -- case a runtime test determines whether Ename denotes an entry ! -- or a protected procedure and performs the appropriate call. ! ! else ! Rewrite (N, Build_Dispatching_Requeue_To_Any); ! Analyze (N); ! end if; ! end; ! ! -- Processing for regular (non-dispatching) requeues ! ! else ! Rewrite (N, Build_Normal_Requeue); ! Analyze (N); ! Insert_After (N, Build_Skip_Statement (N)); ! end if; end Expand_N_Requeue_Statement; ------------------------------- *************** package body Exp_Ch9 is *** 8751,8758 **** function Accept_Or_Raise return List_Id is Cond : Node_Id; Stats : List_Id; ! J : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_Internal_Name ('J')); begin -- We generate the following: --- 9183,9189 ---- function Accept_Or_Raise return List_Id is Cond : Node_Id; Stats : List_Id; ! J : constant Entity_Id := Make_Temporary (Loc, 'J'); begin -- We generate the following: *************** package body Exp_Ch9 is *** 8775,8784 **** Cond := Make_Op_Ne (Loc, Left_Opnd => Make_Selected_Component (Loc, ! Prefix => Make_Indexed_Component (Loc, ! Prefix => New_Reference_To (Qnam, Loc), ! Expressions => New_List (New_Reference_To (J, Loc))), ! Selector_Name => Make_Identifier (Loc, Name_S)), Right_Opnd => New_Reference_To (RTE (RE_Null_Task_Entry), Loc)); --- 9206,9216 ---- Cond := Make_Op_Ne (Loc, Left_Opnd => Make_Selected_Component (Loc, ! Prefix => ! Make_Indexed_Component (Loc, ! Prefix => New_Reference_To (Qnam, Loc), ! Expressions => New_List (New_Reference_To (J, Loc))), ! Selector_Name => Make_Identifier (Loc, Name_S)), Right_Opnd => New_Reference_To (RTE (RE_Null_Task_Entry), Loc)); *************** package body Exp_Ch9 is *** 9344,9351 **** -- Create Duration and Delay_Mode objects used for passing a delay -- value to RTS ! D := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); ! M := Make_Defining_Identifier (Loc, New_Internal_Name ('M')); declare Discr : Entity_Id; --- 9776,9783 ---- -- Create Duration and Delay_Mode objects used for passing a delay -- value to RTS ! D := Make_Temporary (Loc, 'D'); ! M := Make_Temporary (Loc, 'M'); declare Discr : Entity_Id; *************** package body Exp_Ch9 is *** 9849,9855 **** -- the task body. At this point all wrapper specs have been created, -- frozen and included in the dispatch table for the task type. ! if Ada_Version >= Ada_05 then if Nkind (Parent (N)) = N_Subunit then Insert_Nod := Corresponding_Stub (Parent (N)); else --- 10281,10287 ---- -- the task body. At this point all wrapper specs have been created, -- frozen and included in the dispatch table for the task type. ! if Ada_Version >= Ada_2005 then if Nkind (Parent (N)) = N_Subunit then Insert_Nod := Corresponding_Stub (Parent (N)); else *************** package body Exp_Ch9 is *** 9894,9899 **** --- 10326,10332 ---- -- _Priority : Integer := priority_expression; -- _Size : Size_Type := Size_Type (size_expression); -- _Task_Info : Task_Info_Type := task_info_expression; + -- _CPU : Integer := cpu_range_expression; -- end record; -- The discriminants are present only if the corresponding task type has *************** package body Exp_Ch9 is *** 9927,9932 **** --- 10360,10370 ---- -- present in the pragma, and is used to provide the Task_Image parameter -- to the call to Create_Task. + -- The _CPU field is present only if a CPU pragma appears in the task + -- definition. The expression captures the argument that was present in + -- the pragma, and is used to provide the CPU 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 *************** package body Exp_Ch9 is *** 9990,10000 **** Rec_Decl := Build_Corresponding_Record (N, Tasktyp, Loc); - -- Ada 2005 (AI-345): Propagate the attribute that contains the list - -- of implemented interfaces. - - Set_Interface_List (Type_Definition (Rec_Decl), Interface_List (N)); - Rec_Ent := Defining_Identifier (Rec_Decl); Cdecls := Component_Items (Component_List (Type_Definition (Rec_Decl))); --- 10428,10433 ---- *************** package body Exp_Ch9 is *** 10162,10168 **** -- Add the _Priority component if a Priority pragma is present ! if Present (Taskdef) and then Has_Priority_Pragma (Taskdef) then declare Prag : constant Node_Id := Find_Task_Or_Protected_Pragma (Taskdef, Name_Priority); --- 10595,10601 ---- -- Add the _Priority component if a Priority pragma is present ! if Present (Taskdef) and then Has_Pragma_Priority (Taskdef) then declare Prag : constant Node_Id := Find_Task_Or_Protected_Pragma (Taskdef, Name_Priority); *************** package body Exp_Ch9 is *** 10250,10255 **** --- 10683,10709 ---- (Taskdef, Name_Task_Info))))))); end if; + -- Add the _CPU component if a CPU pragma is present + + if Present (Taskdef) and then Has_Pragma_CPU (Taskdef) then + Append_To (Cdecls, + Make_Component_Declaration (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_uCPU), + + Component_Definition => + Make_Component_Definition (Loc, + Aliased_Present => False, + Subtype_Indication => + New_Reference_To (RTE (RE_CPU_Range), Loc)), + + Expression => New_Copy ( + Expression (First ( + Pragma_Argument_Associations ( + Find_Task_Or_Protected_Pragma + (Taskdef, Name_CPU))))))); + 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). *************** package body Exp_Ch9 is *** 10305,10311 **** -- Ada 2005 (AI-345): Construct the primitive entry wrapper specs before -- the corresponding record has been frozen. ! if Ada_Version >= Ada_05 then Build_Wrapper_Specs (Loc, Tasktyp, Rec_Decl); end if; --- 10759,10765 ---- -- Ada 2005 (AI-345): Construct the primitive entry wrapper specs before -- the corresponding record has been frozen. ! if Ada_Version >= Ada_2005 then Build_Wrapper_Specs (Loc, Tasktyp, Rec_Decl); end if; *************** package body Exp_Ch9 is *** 10321,10327 **** -- in time if we don't freeze now. declare ! L : constant List_Id := Freeze_Entity (Rec_Ent, Loc); begin if Is_Non_Empty_List (L) then Insert_List_After (Body_Decl, L); --- 10775,10781 ---- -- in time if we don't freeze now. declare ! L : constant List_Id := Freeze_Entity (Rec_Ent, N); begin if Is_Non_Empty_List (L) then Insert_List_After (Body_Decl, L); *************** package body Exp_Ch9 is *** 10333,10338 **** --- 10787,10810 ---- -- any were declared. Expand_Previous_Access_Type (Tasktyp); + + -- Create wrappers for entries that have pre/postconditions + + declare + Ent : Entity_Id; + + begin + Ent := First_Entity (Tasktyp); + while Present (Ent) loop + if Ekind_In (Ent, E_Entry, E_Entry_Family) + and then Present (Spec_PPC_List (Ent)) + then + Build_PPC_Wrapper (Ent, N); + end if; + + Next_Entity (Ent); + end loop; + end; end Expand_N_Task_Type_Declaration; ------------------------------- *************** package body Exp_Ch9 is *** 10504,10510 **** end if; Is_Disp_Select := ! Ada_Version >= Ada_05 and then Nkind (E_Call) = N_Procedure_Call_Statement; if Is_Disp_Select then --- 10976,10982 ---- end if; Is_Disp_Select := ! Ada_Version >= Ada_2005 and then Nkind (E_Call) = N_Procedure_Call_Statement; if Is_Disp_Select then *************** package body Exp_Ch9 is *** 10579,10585 **** New_List (New_Copy (Expression (D_Stat)))); end if; ! D := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); -- Generate: -- D : Duration; --- 11051,11057 ---- New_List (New_Copy (Expression (D_Stat)))); end if; ! D := Make_Temporary (Loc, 'D'); -- Generate: -- D : Duration; *************** package body Exp_Ch9 is *** 10591,10597 **** Object_Definition => New_Reference_To (Standard_Duration, Loc))); ! M := Make_Defining_Identifier (Loc, New_Internal_Name ('M')); -- Generate: -- M : Integer := (0 | 1 | 2); --- 11063,11069 ---- Object_Definition => New_Reference_To (Standard_Duration, Loc))); ! M := Make_Temporary (Loc, 'M'); -- Generate: -- M : Integer := (0 | 1 | 2); *************** package body Exp_Ch9 is *** 11178,11183 **** --- 11650,11692 ---- Make_Integer_Literal (Loc, 0))); end Family_Size; + ----------------------- + -- Find_Master_Scope -- + ----------------------- + + function Find_Master_Scope (E : Entity_Id) return Entity_Id is + S : Entity_Id; + + begin + -- In Ada2005, the master is the innermost enclosing scope that is not + -- transient. If the enclosing block is the rewriting of a call or the + -- scope is an extended return statement this is valid master. The + -- master in an extended return is only used within the return, and is + -- subsequently overwritten in Move_Activation_Chain, but it must exist + -- now before that overwriting occurs. + + S := Scope (E); + + if Ada_Version >= Ada_2005 then + while Is_Internal (S) loop + if Nkind (Parent (S)) = N_Block_Statement + and then + Nkind (Original_Node (Parent (S))) = N_Procedure_Call_Statement + then + exit; + + elsif Ekind (S) = E_Return_Statement then + exit; + + else + S := Scope (S); + end if; + end loop; + end if; + + return S; + end Find_Master_Scope; + ----------------------------------- -- Find_Task_Or_Protected_Pragma -- ----------------------------------- *************** package body Exp_Ch9 is *** 11370,11378 **** if Is_Protected then declare ! Prot_Ent : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); Prot_Typ : RE_Id; begin --- 11879,11885 ---- if Is_Protected then declare ! Prot_Ent : constant Entity_Id := Make_Temporary (Loc, 'R'); Prot_Typ : RE_Id; begin *************** package body Exp_Ch9 is *** 11393,11399 **** 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 --- 11900,11906 ---- elsif Has_Entries (Conc_Typ) or else ! (Ada_Version >= Ada_2005 and then Present (Interface_List (Parent (Conc_Typ)))) then case Corresponding_Runtime_Package (Conc_Typ) is *************** package body Exp_Ch9 is *** 11421,11430 **** 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; --- 11928,11935 ---- 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; *************** package body Exp_Ch9 is *** 11561,11568 **** High := Replace_Bound (High); Low := Replace_Bound (Low); ! Index_Typ := ! Make_Defining_Identifier (Loc, New_Internal_Name ('J')); -- Generate: -- subtype Jnn is range Low .. High; --- 12066,12072 ---- High := Replace_Bound (High); Low := Replace_Bound (Low); ! Index_Typ := Make_Temporary (Loc, 'J'); -- Generate: -- subtype Jnn is range Low .. High; *************** package body Exp_Ch9 is *** 11746,11752 **** 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)); --- 12250,12256 ---- 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)); *************** package body Exp_Ch9 is *** 11757,11763 **** -- defined value, see D.3(10). if Present (Pdef) ! and then Has_Priority_Pragma (Pdef) then declare Prio : constant Node_Id := --- 12261,12267 ---- -- defined value, see D.3(10). if Present (Pdef) ! and then Has_Pragma_Priority (Pdef) then declare Prio : constant Node_Id := *************** package body Exp_Ch9 is *** 11790,11798 **** -- Interrupt_Priority). else ! Temp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); ! Append_To (L, Make_Object_Declaration (Loc, Defining_Identifier => Temp, --- 12294,12300 ---- -- Interrupt_Priority). else ! Temp := Make_Temporary (Loc, 'R', Prio); Append_To (L, Make_Object_Declaration (Loc, Defining_Identifier => Temp, *************** package body Exp_Ch9 is *** 11800,11806 **** New_Occurrence_Of (RTE (RE_Any_Priority), Loc), Expression => Relocate_Node (Prio))); ! Append_To (Args, New_Occurrence_Of (Temp, Loc)); end if; end; --- 12302,12308 ---- New_Occurrence_Of (RTE (RE_Any_Priority), Loc), Expression => Relocate_Node (Prio))); ! Append_To (Args, New_Occurrence_Of (Temp, Loc)); end if; end; *************** package body Exp_Ch9 is *** 11825,11830 **** --- 12327,12337 ---- -- is a pointer to the record generated by the compiler to represent -- the protected object. + -- 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. + if Has_Entry or else Has_Interrupt_Handler (Ptyp) or else Has_Attach_Handler (Ptyp) *************** package body Exp_Ch9 is *** 11850,11859 **** raise Program_Error; end case; ! if Has_Entry or else not Restricted then Append_To (Args, Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Address)); end if; --- 12357,12369 ---- raise Program_Error; end case; ! if Has_Entry ! or else not Restricted ! or else Has_Interfaces (Protect_Rec) ! then Append_To (Args, Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Address)); end if; *************** package body Exp_Ch9 is *** 11995,12001 **** 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)); --- 12505,12511 ---- 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)); *************** package body Exp_Ch9 is *** 12059,12068 **** -- Priority parameter. Set to Unspecified_Priority unless there is a -- priority pragma, in which case we take the value from the pragma. ! if Present (Tdef) and then Has_Priority_Pragma (Tdef) then Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uPriority))); else Append_To (Args, --- 12569,12578 ---- -- Priority parameter. Set to Unspecified_Priority unless there is a -- priority pragma, in which case we take the value from the pragma. ! if Present (Tdef) and then Has_Pragma_Priority (Tdef) then Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uPriority))); else Append_To (Args, *************** package body Exp_Ch9 is *** 12079,12088 **** if Preallocated_Stacks_On_Target then Append_To (Args, Make_Attribute_Reference (Loc, ! Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), ! Selector_Name => ! Make_Identifier (Loc, Name_uStack)), Attribute_Name => Name_Address)); else --- 12589,12598 ---- if Preallocated_Stacks_On_Target then Append_To (Args, Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), ! Selector_Name => Make_Identifier (Loc, Name_uStack)), Attribute_Name => Name_Address)); else *************** package body Exp_Ch9 is *** 12103,12109 **** then Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uSize))); else --- 12613,12619 ---- then Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uSize))); else *************** package body Exp_Ch9 is *** 12119,12125 **** then Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Info))); else --- 12629,12635 ---- then Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Info))); else *************** package body Exp_Ch9 is *** 12127,12132 **** --- 12637,12659 ---- New_Reference_To (RTE (RE_Unspecified_Task_Info), Loc)); end if; + -- CPU parameter. Set to Unspecified_CPU unless there is a CPU pragma, + -- in which case we take the value from the pragma. The parameter is + -- passed as an Integer because in the case of unspecified CPU the + -- value is not in the range of CPU_Range. + + if Present (Tdef) and then Has_Pragma_CPU (Tdef) then + Append_To (Args, + Convert_To (Standard_Integer, + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Name_uInit), + Selector_Name => Make_Identifier (Loc, Name_uCPU)))); + + else + Append_To (Args, + New_Reference_To (RTE (RE_Unspecified_CPU), Loc)); + end if; + if not Restricted_Profile then -- Deadline parameter. If no Relative_Deadline pragma is present, *************** package body Exp_Ch9 is *** 12141,12147 **** 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))); --- 12668,12675 ---- 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))); *************** package body Exp_Ch9 is *** 12170,12183 **** -- Master parameter. This is a reference to the _Master parameter of -- the initialization procedure, except in the case of the pragma ! -- Restrictions (No_Task_Hierarchy) where the value is fixed to 3. ! -- See comments in System.Tasking.Initialization.Init_RTS for the ! -- value 3. if Restriction_Active (No_Task_Hierarchy) = False then Append_To (Args, Make_Identifier (Loc, Name_uMaster)); else ! Append_To (Args, Make_Integer_Literal (Loc, 3)); end if; end if; --- 12698,12711 ---- -- Master parameter. This is a reference to the _Master parameter of -- the initialization procedure, except in the case of the pragma ! -- Restrictions (No_Task_Hierarchy) where the value is fixed to ! -- System.Tasking.Library_Task_Level. if Restriction_Active (No_Task_Hierarchy) = False then Append_To (Args, Make_Identifier (Loc, Name_uMaster)); else ! Append_To (Args, ! New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc)); end if; end if; *************** package body Exp_Ch9 is *** 12278,12284 **** Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id))); -- Build_Entry_Names generation flag. When set to true, the runtime --- 12806,12812 ---- Append_To (Args, Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id))); -- Build_Entry_Names generation flag. When set to true, the runtime *************** package body Exp_Ch9 is *** 12380,12387 **** -- Generate: -- Jnn : aliased ! Temp_Nam := ! Make_Defining_Identifier (Loc, New_Internal_Name ('J')); Append_To (Decls, Make_Object_Declaration (Loc, --- 12908,12914 ---- -- Generate: -- Jnn : aliased ! Temp_Nam := Make_Temporary (Loc, 'J'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Ch9 is *** 12447,12453 **** -- 'reference; -- ...); ! P := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Append_To (Decls, Make_Object_Declaration (Loc, --- 12974,12980 ---- -- 'reference; -- ...); ! P := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Ch9 is *** 12494,12500 **** Expression => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, ! Prefix => New_Reference_To (P, Loc), Selector_Name => Make_Identifier (Loc, Chars (Formal))))); --- 13021,13027 ---- Expression => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, ! Prefix => New_Reference_To (P, Loc), Selector_Name => Make_Identifier (Loc, Chars (Formal))))); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_ch9.ads gcc-4.6.0/gcc/ada/exp_ch9.ads *** gcc-4.5.2/gcc/ada/exp_ch9.ads Mon Nov 30 16:31:31 2009 --- gcc-4.6.0/gcc/ada/exp_ch9.ads Thu Sep 9 09:50:46 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Ch9 is *** 50,63 **** -- Task_Id of the associated task as the parameter. The caller is -- responsible for analyzing and resolving the resulting tree. - function Build_Corresponding_Record - (N : Node_Id; - Ctyp : Node_Id; - Loc : Source_Ptr) return Node_Id; - -- Common to tasks and protected types. Copy discriminant specifications, - -- build record declaration. N is the type declaration, Ctyp is the - -- concurrent entity (task type or protected type). - function Build_Entry_Names (Conc_Typ : Entity_Id) return Node_Id; -- Create the statements which populate the entry names array of a task or -- protected type. The statements are wrapped inside a block due to a local --- 50,55 ---- *************** package Exp_Ch9 is *** 271,276 **** --- 263,277 ---- -- return the external version of a protected operation, which locks -- the object before invoking the internal protected subprogram body. + function Find_Master_Scope (E : Entity_Id) return Entity_Id; + -- When a type includes tasks, a master entity is created in the scope, to + -- be used by the runtime during activation. In general the master is the + -- immediate scope in which the type is declared, but in Ada2005, in the + -- presence of synchronized classwide interfaces, the immediate scope of + -- an anonymous access type may be a transient scope, which has no run-time + -- presence. In this case, the scope of the master is the innermost scope + -- that comes from source. + function First_Protected_Operation (D : List_Id) return Node_Id; -- Given the declarations list for a protected body, find the -- first protected operation body. diff -Nrcpad gcc-4.5.2/gcc/ada/exp_dbug.adb gcc-4.6.0/gcc/ada/exp_dbug.adb *** gcc-4.5.2/gcc/ada/exp_dbug.adb Thu Apr 9 10:27:10 2009 --- gcc-4.6.0/gcc/ada/exp_dbug.adb Tue Oct 26 12:19:56 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** with Sinfo; use Sinfo; *** 38,43 **** --- 38,44 ---- with Stand; use Stand; with Stringt; use Stringt; with Table; + with Targparm; use Targparm; with Tbuild; use Tbuild; with Urealp; use Urealp; *************** package body Exp_Dbug is *** 341,346 **** --- 342,355 ---- return Empty; end if; + -- Do not output those local variables in VM case, as this does not + -- help debugging (they are just unused), and might lead to duplicated + -- local variable names. + + if VM_Target /= No_VM then + return Empty; + end if; + -- Get renamed entity and compute suffix Name_Len := 0; *************** package body Exp_Dbug is *** 520,527 **** -- Or if this is an enumeration base type ! or else (Is_Enumeration_Type (E) ! and then E = Base_Type (E)) -- Or if this is a dummy type for a renaming --- 529,535 ---- -- Or if this is an enumeration base type ! or else (Is_Enumeration_Type (E) and then Is_Base_Type (E)) -- Or if this is a dummy type for a renaming diff -Nrcpad gcc-4.5.2/gcc/ada/exp_dbug.ads gcc-4.6.0/gcc/ada/exp_dbug.ads *** gcc-4.5.2/gcc/ada/exp_dbug.ads Fri Oct 16 19:28:52 2009 --- gcc-4.6.0/gcc/ada/exp_dbug.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** package Exp_Dbug is *** 37,47 **** -- Encoding and Qualification of Names of Entities -- ----------------------------------------------------- ! -- This section describes how the names of entities are encoded in ! -- the generated debugging information. ! -- An entity in Ada has a name of the form X.Y.Z ... E where X,Y,Z ! -- are the enclosing scopes (not including Standard at the start). -- The encoding of the name follows this basic qualified naming scheme, -- where the encoding of individual entity names is as described in Namet --- 37,47 ---- -- Encoding and Qualification of Names of Entities -- ----------------------------------------------------- ! -- This section describes how the names of entities are encoded in the ! -- generated debugging information. ! -- An entity in Ada has a name of the form X.Y.Z ... E where X,Y,Z are the ! -- enclosing scopes (not including Standard at the start). -- The encoding of the name follows this basic qualified naming scheme, -- where the encoding of individual entity names is as described in Namet *************** package Exp_Dbug is *** 306,318 **** -- Interface Names -- --------------------- ! -- Note: if an interface name is present, then the external name ! -- is taken from the specified interface name. Given the current ! -- limitations of the gcc backend, this means that the debugging ! -- name is also set to the interface name, but conceptually, it ! -- would be possible (and indeed desirable) to have the debugging ! -- information still use the Ada name as qualified above, so we ! -- still fully qualify the name in the front end. ------------------------------------- -- Encodings Related to Task Types -- --- 306,318 ---- -- Interface Names -- --------------------- ! -- Note: if an interface name is present, then the external name is ! -- taken from the specified interface name. Given current limitations of ! -- the gcc backend, this means that the debugging name is also set to ! -- the interface name, but conceptually, it would be possible (and ! -- indeed desirable) to have the debugging information still use the Ada ! -- name as qualified above, so we still fully qualify the name in the ! -- front end. ------------------------------------- -- Encodings Related to Task Types -- *************** package Exp_Dbug is *** 330,336 **** -- end TaskObj; -- end P; -- ! -- The name of subprogram TaskObj.F1 is encoded as p__taskobjTK__f1, -- The body, B, is contained in a subprogram whose name is -- p__taskobjTKB. --- 330,336 ---- -- end TaskObj; -- end P; -- ! -- The name of subprogram TaskObj.F1 is encoded as p__taskobjTK__f1. -- The body, B, is contained in a subprogram whose name is -- p__taskobjTKB. *************** package Exp_Dbug is *** 413,434 **** No_Dollar_In_Label : constant Boolean := True; -- True iff the target does not allow dollar signs ("$") in external names ! -- ??? We want to migrate all platforms to use the same convention. ! -- As a first step, we force this constant to always be True. This ! -- constant will eventually be deleted after we have verified that ! -- the migration does not cause any unforseen adverse impact. ! -- We chose "__" because it is supported on all platforms, which is ! -- not the case of "$". procedure Get_External_Name (Entity : Entity_Id; Has_Suffix : Boolean); ! -- Set Name_Buffer and Name_Len to the external name of entity E. ! -- The external name is the Interface_Name, if specified, unless ! -- the entity has an address clause or a suffix. -- ! -- If the Interface is not present, or not used, the external name ! -- is the concatenation of: -- -- - the string "_ada_", if the entity is a library subprogram, -- - the names of any enclosing scopes, each followed by "__", --- 413,433 ---- No_Dollar_In_Label : constant Boolean := True; -- True iff the target does not allow dollar signs ("$") in external names ! -- ??? We want to migrate all platforms to use the same convention. As a ! -- first step, we force this constant to always be True. This constant will ! -- eventually be deleted after we have verified that the migration does not ! -- cause any unforeseen adverse impact. We chose "__" because it is ! -- supported on all platforms, which is not the case of "$". procedure Get_External_Name (Entity : Entity_Id; Has_Suffix : Boolean); ! -- Set Name_Buffer and Name_Len to the external name of entity E. The ! -- external name is the Interface_Name, if specified, unless the entity ! -- has an address clause or a suffix. -- ! -- If the Interface is not present, or not used, the external name is the ! -- concatenation of: -- -- - the string "_ada_", if the entity is a library subprogram, -- - the names of any enclosing scopes, each followed by "__", *************** package Exp_Dbug is *** 441,449 **** procedure Get_External_Name_With_Suffix (Entity : Entity_Id; Suffix : String); ! -- Set Name_Buffer and Name_Len to the external name of entity E. ! -- If Suffix is the empty string the external name is as above, ! -- otherwise the external name is the concatenation of: -- -- - the string "_ada_", if the entity is a library subprogram, -- - the names of any enclosing scopes, each followed by "__", --- 440,448 ---- procedure Get_External_Name_With_Suffix (Entity : Entity_Id; Suffix : String); ! -- Set Name_Buffer and Name_Len to the external name of entity E. If ! -- Suffix is the empty string the external name is as above, otherwise ! -- the external name is the concatenation of: -- -- - the string "_ada_", if the entity is a library subprogram, -- - the names of any enclosing scopes, each followed by "__", *************** package Exp_Dbug is *** 483,515 **** -- output of names for debugging purposes (which is why we are doing -- the name changes in the first place. ! -- Note: the routines Get_Unqualified_[Decoded]_Name_String in Namet ! -- are useful to remove qualification from a name qualified by the ! -- call to Qualify_All_Entity_Names. -------------------------------- -- Handling of Numeric Values -- -------------------------------- ! -- All numeric values here are encoded as strings of decimal digits. ! -- Only integer values need to be encoded. A negative value is encoded ! -- as the corresponding positive value followed by a lower case m for ! -- minus to indicate that the value is negative (e.g. 2m for -2). ------------------------- -- Type Name Encodings -- ------------------------- ! -- In the following typ is the name of the type as normally encoded by ! -- the debugger rules, i.e. a non-qualified name, all in lower case, ! -- with standard encoding of upper half and wide characters ------------------------ -- Encapsulated Types -- ------------------------ ! -- In some cases, the compiler encapsulates a type by wrapping it in ! -- a structure. For example, this is used when a size or alignment -- specification requires a larger type. Consider: -- type y is mod 2 ** 64; --- 482,514 ---- -- output of names for debugging purposes (which is why we are doing -- the name changes in the first place. ! -- Note: the routines Get_Unqualified_[Decoded]_Name_String in Namet are ! -- useful to remove qualification from a name qualified by the call to ! -- Qualify_All_Entity_Names. -------------------------------- -- Handling of Numeric Values -- -------------------------------- ! -- All numeric values here are encoded as strings of decimal digits. Only ! -- integer values need to be encoded. A negative value is encoded as the ! -- corresponding positive value followed by a lower case m for minus to ! -- indicate that the value is negative (e.g. 2m for -2). ------------------------- -- Type Name Encodings -- ------------------------- ! -- In the following typ is the name of the type as normally encoded by the ! -- debugger rules, i.e. a non-qualified name, all in lower case, with ! -- standard encoding of upper half and wide characters ------------------------ -- Encapsulated Types -- ------------------------ ! -- In some cases, the compiler encapsulates a type by wrapping it in a ! -- structure. For example, this is used when a size or alignment -- specification requires a larger type. Consider: -- type y is mod 2 ** 64; *************** package Exp_Dbug is *** 523,556 **** -- a size of 256 for a signed integer value, then a typical choice is -- to wrap a 64-bit integer in a 256 bit PAD structure. ! -- A similar encapsulation is done for some packed array types, ! -- in which case the structure type is y___JM and the field name ! -- is OBJECT. This is used in the case of a packed array stored ! -- in modular representation (see section on representation of ! -- packed array objects). In this case the JM wrapping is used to ! -- achieve correct positioning of the packed array value (left or ! -- right justified in its field depending on endianness. ! -- When the debugger sees an object of a type whose name has a ! -- suffix of ___PAD or ___JM, the type will be a record containing ! -- a single field, and the name of that field will be all upper case. ! -- In this case, it should look inside to get the value of the inner ! -- field, and neither the outer structure name, nor the field name ! -- should appear when the value is printed. -- When the debugger sees a record named REP being a field inside ! -- another record, it should treat the fields inside REP as being ! -- part of the outer record (this REP field is only present for ! -- code generation purposes). The REP record should not appear in ! -- the values printed by the debugger. ----------------------- -- Fixed-Point Types -- ----------------------- -- Fixed-point types are encoded using a suffix that indicates the ! -- delta and small values. The actual type itself is a normal ! -- integer type. -- typ___XF_nn_dd -- typ___XF_nn_dd_nn_dd --- 522,555 ---- -- a size of 256 for a signed integer value, then a typical choice is -- to wrap a 64-bit integer in a 256 bit PAD structure. ! -- A similar encapsulation is done for some packed array types, in which ! -- case the structure type is y___JM and the field name is OBJECT. ! -- This is used in the case of a packed array stored using modular ! -- representation (see section on representation of packed array ! -- objects). In this case the JM wrapping is used to achieve correct ! -- positioning of the packed array value (left or right justified in its ! -- field depending on endianness. ! -- When the debugger sees an object of a type whose name has a suffix of ! -- ___PAD or ___JM, the type will be a record containing a single field, ! -- and the name of that field will be all upper case. In this case, it ! -- should look inside to get the value of the inner field, and neither ! -- the outer structure name, nor the field name should appear when the ! -- value is printed. -- When the debugger sees a record named REP being a field inside ! -- another record, it should treat the fields inside REP as being part ! -- of the outer record (this REP field is only present for code ! -- generation purposes). The REP record should not appear in the values ! -- printed by the debugger. ----------------------- -- Fixed-Point Types -- ----------------------- -- Fixed-point types are encoded using a suffix that indicates the ! -- delta and small values. The actual type itself is a normal integer ! -- type. -- typ___XF_nn_dd -- typ___XF_nn_dd_nn_dd *************** package Exp_Dbug is *** 576,584 **** -- typ___XFG -- representing the Vax F Float, D Float, and G Float types. The ! -- debugger must treat these specially. In particular, printing ! -- these values can be achieved using the debug procedures that ! -- are provided in package System.Vax_Float_Operations: -- procedure Debug_Output_D (Arg : D); -- procedure Debug_Output_F (Arg : F); --- 575,583 ---- -- typ___XFG -- representing the Vax F Float, D Float, and G Float types. The ! -- debugger must treat these specially. In particular, printing these ! -- values can be achieved using the debug procedures that are provided ! -- in package System.Vax_Float_Operations: -- procedure Debug_Output_D (Arg : D); -- procedure Debug_Output_F (Arg : F); *************** package Exp_Dbug is *** 592,608 **** -- Discrete Types -- -------------------- ! -- Discrete types are coded with a suffix indicating the range in ! -- the case where one or both of the bounds are discriminants or ! -- variable. ! -- Note: at the current time, we also encode compile time known ! -- bounds if they do not match the natural machine type bounds, ! -- but this may be removed in the future, since it is redundant ! -- for most debugging formats. However, we do not ever need XD ! -- encoding for enumeration base types, since here it is always ! -- clear what the bounds are from the total number of enumeration ! -- literals. -- typ___XD -- typ___XDL_lowerbound --- 591,605 ---- -- Discrete Types -- -------------------- ! -- Discrete types are coded with a suffix indicating the range in the ! -- case where one or both of the bounds are discriminants or variable. ! -- Note: at the current time, we also encode compile time known bounds ! -- if they do not match the natural machine type bounds, but this may ! -- be removed in the future, since it is redundant for most debugging ! -- formats. However, we do not ever need XD encoding for enumeration ! -- base types, since here it is always clear what the bounds are from ! -- the total number of enumeration literals. -- typ___XD -- typ___XDL_lowerbound *************** package Exp_Dbug is *** 615,641 **** -- constrained range that does not correspond to the size or that -- has discriminant references or other compile time known bounds. ! -- The first form is used if both bounds are dynamic, in which case ! -- two constant objects are present whose names are typ___L and ! -- typ___U in the same scope as typ, and the values of these constants ! -- indicate the bounds. As far as the debugger is concerned, these ! -- are simply variables that can be accessed like any other variables. ! -- In the enumeration case, these values correspond to the Enum_Rep ! -- values for the lower and upper bounds. ! -- The second form is used if the upper bound is dynamic, but the ! -- lower bound is either constant or depends on a discriminant of ! -- the record with which the type is associated. The upper bound ! -- is stored in a constant object of name typ___U as previously ! -- described, but the lower bound is encoded directly into the ! -- name as either a decimal integer, or as the discriminant name. ! -- The third form is similarly used if the lower bound is dynamic, ! -- but the upper bound is compile time known or a discriminant ! -- reference, in which case the lower bound is stored in a constant ! -- object of name typ___L, and the upper bound is encoded directly ! -- into the name as either a decimal integer, or as the discriminant ! -- name. -- The fourth form is used if both bounds are discriminant references -- or compile time known values, with the encoding first for the lower --- 612,637 ---- -- constrained range that does not correspond to the size or that -- has discriminant references or other compile time known bounds. ! -- The first form is used if both bounds are dynamic, in which case two ! -- constant objects are present whose names are typ___L and typ___U in ! -- the same scope as typ, and the values of these constants indicate ! -- the bounds. As far as the debugger is concerned, these are simply ! -- variables that can be accessed like any other variables. In the ! -- enumeration case, these values correspond to the Enum_Rep values for ! -- the lower and upper bounds. ! -- The second form is used if the upper bound is dynamic, but the lower ! -- bound is either constant or depends on a discriminant of the record ! -- with which the type is associated. The upper bound is stored in a ! -- constant object of name typ___U as previously described, but the ! -- lower bound is encoded directly into the name as either a decimal ! -- integer, or as the discriminant name. ! -- The third form is similarly used if the lower bound is dynamic, but ! -- the upper bound is compile time known or a discriminant reference, ! -- in which case the lower bound is stored in a constant object of name ! -- typ___L, and the upper bound is encoded directly into the name as ! -- either a decimal integer, or as the discriminant name. -- The fourth form is used if both bounds are discriminant references -- or compile time known values, with the encoding first for the lower *************** package Exp_Dbug is *** 650,658 **** -- type x is mod N; -- Is encoded as a subrange of an unsigned base type with lower bound ! -- 0 and upper bound N. That is, there is no name encoding. We use ! -- the standard encodings provided by the debugging format. Thus ! -- we give these types a non-standard interpretation: the standard -- interpretation of our encoding would not, in general, imply that -- arithmetic on type x was to be performed modulo N (especially not -- when N is not a power of 2). --- 646,654 ---- -- type x is mod N; -- Is encoded as a subrange of an unsigned base type with lower bound ! -- zero and upper bound N. That is, there is no name encoding. We use ! -- the standard encodings provided by the debugging format. Thus we ! -- give these types a non-standard interpretation: the standard -- interpretation of our encoding would not, in general, imply that -- arithmetic on type x was to be performed modulo N (especially not -- when N is not a power of 2). *************** package Exp_Dbug is *** 661,683 **** -- Biased Types -- ------------------ ! -- Only discrete types can be biased, and the fact that they are ! -- biased is indicated by a suffix of the form: -- typ___XB_lowerbound__upperbound ! -- Here lowerbound and upperbound are decimal integers, with the ! -- usual (postfix "m") encoding for negative numbers. Biased ! -- types are only possible where the bounds are compile time ! -- known, and the values are represented as unsigned offsets ! -- from the lower bound given. For example: -- type Q is range 10 .. 15; -- for Q'size use 3; ! -- The size clause will force values of type Q in memory to be ! -- stored in biased form (e.g. 11 will be represented by the ! -- bit pattern 001). ---------------------------------------------- -- Record Types with Variable-Length Fields -- --- 657,678 ---- -- Biased Types -- ------------------ ! -- Only discrete types can be biased, and the fact that they are biased ! -- is indicated by a suffix of the form: -- typ___XB_lowerbound__upperbound ! -- Here lowerbound and upperbound are decimal integers, with the usual ! -- (postfix "m") encoding for negative numbers. Biased types are only ! -- possible where the bounds are compile time known, and the values are ! -- represented as unsigned offsets from the lower bound given. For ! -- example: -- type Q is range 10 .. 15; -- for Q'size use 3; ! -- The size clause will force values of type Q in memory to be stored ! -- in biased form (e.g. 11 will be represented by the bit pattern 001). ---------------------------------------------- -- Record Types with Variable-Length Fields -- *************** package Exp_Dbug is *** 692,701 **** -- type___XVU -- The former name is used for a record and the latter for the union ! -- that is made for a variant record (see below) if that record or ! -- union has a field of variable size or if the record or union itself ! -- has a variable size. These encodings suffix any other encodings that ! -- that might be suffixed to the type name. -- The idea here is to provide all the needed information to interpret -- objects of the original type in the form of a "fixed up" type, which --- 687,696 ---- -- type___XVU -- The former name is used for a record and the latter for the union ! -- that is made for a variant record (see below) if that record or union ! -- has a field of variable size or if the record or union itself has a ! -- variable size. These encodings suffix any other encodings that that ! -- might be suffixed to the type name. -- The idea here is to provide all the needed information to interpret -- objects of the original type in the form of a "fixed up" type, which *************** package Exp_Dbug is *** 706,728 **** -- To deal with this, we encode *all* the field bit positions of the -- special ___XV type in a non-standard manner. ! -- The idea is to encode not the position, but rather information ! -- that allows computing the position of a field from the position ! -- of the previous field. The algorithm for computing the actual ! -- positions of all fields and the length of the record is as ! -- follows. In this description, let P represent the current ! -- bit position in the record. -- 1. Initialize P to 0 -- 2. For each field in the record: ! -- 2a. If an alignment is given (see below), then round P ! -- up, if needed, to the next multiple of that alignment. ! -- 2b. If a bit position is given, then increment P by that ! -- amount (that is, treat it as an offset from the end of the ! -- preceding record). -- 2c. Assign P as the actual position of the field --- 701,722 ---- -- To deal with this, we encode *all* the field bit positions of the -- special ___XV type in a non-standard manner. ! -- The idea is to encode not the position, but rather information that ! -- allows computing the position of a field from the position of the ! -- previous field. The algorithm for computing the actual positions of ! -- all fields and the length of the record is as follows. In this ! -- description, let P represent the current bit position in the record. -- 1. Initialize P to 0 -- 2. For each field in the record: ! -- 2a. If an alignment is given (see below), then round P up, if ! -- needed, to the next multiple of that alignment. ! -- 2b. If a bit position is given, then increment P by that amount ! -- (that is, treat it as an offset from the end of the preceding ! -- record). -- 2c. Assign P as the actual position of the field *************** package Exp_Dbug is *** 738,752 **** -- where the nn after the XVA indicates the alignment value in storage -- units. This encoding is present only if an alignment is present. ! -- The size of the record described by an XVE-encoded type (in bits) ! -- is generally the maximum value attained by P' in step 2d above, ! -- rounded up according to the record's alignment. -- Second, the variable-length fields themselves are represented by ! -- replacing the type by a special access type. The designated type ! -- of this access type is the original variable-length type, and the ! -- fact that this field has been transformed in this way is signalled ! -- by encoding the field name as: -- field___XVL --- 732,746 ---- -- where the nn after the XVA indicates the alignment value in storage -- units. This encoding is present only if an alignment is present. ! -- The size of the record described by an XVE-encoded type (in bits) is ! -- generally the maximum value attained by P' in step 2d above, rounded ! -- up according to the record's alignment. -- Second, the variable-length fields themselves are represented by ! -- replacing the type by a special access type. The designated type of ! -- this access type is the original variable-length type, and the fact ! -- that this field has been transformed in this way is signalled by ! -- encoding the field name as: -- field___XVL *************** package Exp_Dbug is *** 757,780 **** -- field___XVLnn -- Note: the reason that we change the type is so that the resulting ! -- type has no variable-length fields. At least some of the formats ! -- used for debugging information simply cannot tolerate variable- ! -- length fields, so the encoded information would get lost. ! -- Third, in the case of a variant record, the special union ! -- that contains the variants is replaced by a normal C union. ! -- In this case, the positions are all zero. ! -- Discriminants appear before any variable-length fields that depend ! -- on them, with one exception. In some cases, a discriminant ! -- governing the choice of a variant clause may appear in the list ! -- of fields of an XVE type after the entry for the variant clause ! -- itself (this can happen in the presence of a representation clause ! -- for the record type in the source program). However, when this ! -- happens, the discriminant's position may be determined by first ! -- applying the rules described in this section, ignoring the variant ! -- clause. As a result, discriminants can always be located ! -- independently of the variable-length fields that depend on them. -- The size of the ___XVE or ___XVU record or union is set to the -- alignment (in bytes) of the original object so that the debugger --- 751,774 ---- -- field___XVLnn -- Note: the reason that we change the type is so that the resulting ! -- type has no variable-length fields. At least some of the formats used ! -- for debugging information simply cannot tolerate variable- length ! -- fields, so the encoded information would get lost. ! -- Third, in the case of a variant record, the special union that ! -- contains the variants is replaced by a normal C union. In this case, ! -- the positions are all zero. ! -- Discriminants appear before any variable-length fields that depend on ! -- them, with one exception. In some cases, a discriminant governing the ! -- choice of a variant clause may appear in the list of fields of an XVE ! -- type after the entry for the variant clause itself (this can happen ! -- in the presence of a representation clause for the record type in the ! -- source program). However, when this happens, the discriminant's ! -- position may be determined by first applying the rules described in ! -- this section, ignoring the variant clause. As a result, discriminants ! -- can always be located independently of the variable-length fields ! -- that depend on them. -- The size of the ___XVE or ___XVU record or union is set to the -- alignment (in bytes) of the original object so that the debugger *************** package Exp_Dbug is *** 815,834 **** -- Notes: ! -- 1) The B field could also have been encoded by using a position ! -- of zero, and an alignment of 4, but in such a case, the coding by ! -- position is preferred (since it takes up less space). We have used ! -- the (illegal) notation access xxx as field types in the example ! -- above. ! -- 2) The E field does not actually need the alignment indication ! -- but this may not be detected in this case by the conversion ! -- routines. -- 3) Our conventions do not cover all XVE-encoded records in which ! -- some, but not all, fields have representation clauses. Such ! -- records may, therefore, be displayed incorrectly by debuggers. ! -- This situation is not common. ----------------------- -- Base Record Types -- --- 809,826 ---- -- Notes: ! -- 1) The B field could also have been encoded by using a position of ! -- zero and an alignment of 4, but in such a case the coding by position ! -- is preferred (since it takes up less space). We have used the ! -- (illegal) notation access xxx as field types in the example above. ! -- 2) The E field does not actually need the alignment indication but ! -- this may not be detected in this case by the conversion routines. -- 3) Our conventions do not cover all XVE-encoded records in which ! -- some, but not all, fields have representation clauses. Such records ! -- may, therefore, be displayed incorrectly by debuggers. This situation ! -- is not common. ----------------------- -- Base Record Types -- *************** package Exp_Dbug is *** 853,868 **** -- The size of the objects typed as x should be obtained from the -- structure of x (and x___XVE, if applicable) as for ordinary types -- unless there is a variable named x___XVZ, which, if present, will ! -- hold the size (in bytes) of x. -- The type x will either be a subtype of y (see also Subtypes of ! -- Variant Records, below) or will contain no fields at all. The layout, ! -- types, and positions of these fields will be accurate, if present. ! -- (Currently, however, the GDB debugger makes no use of x except to ! -- determine its size). ! -- Among other uses, XVS types are sometimes used to encode ! -- unconstrained types. For example, given -- -- subtype Int is INTEGER range 0..10; -- type T1 (N: Int := 0) is record --- 845,861 ---- -- The size of the objects typed as x should be obtained from the -- structure of x (and x___XVE, if applicable) as for ordinary types -- unless there is a variable named x___XVZ, which, if present, will ! -- hold the size (in bytes) of x. In this latter case, the size of the ! -- x___XVS type will not be a constant but a reference to x___XVZ. -- The type x will either be a subtype of y (see also Subtypes of ! -- Variant Records, below) or will contain a single field of type y, ! -- or no fields at all. The layout, types, and positions of these ! -- fields will be accurate, if present. (Currently, however, the GDB ! -- debugger makes no use of x except to determine its size). ! -- Among other uses, XVS types are used to encode unconstrained types. ! -- For example, given: -- -- subtype Int is INTEGER range 0..10; -- type T1 (N: Int := 0) is record *************** package Exp_Dbug is *** 873,885 **** -- the element type for AT1 might have a type defined as if it had -- been written: -- ! -- type at1___PAD is record null; end record; -- for at1___PAD'Size use 16 * 8; -- ! -- and there would also be -- ! -- type at1___PAD___XVS is record t1: Integer; end record; -- type t1 is ... -- -- Had the subtype Int been dynamic: -- --- 866,879 ---- -- the element type for AT1 might have a type defined as if it had -- been written: -- ! -- type at1___PAD is record F : T1; end record; -- for at1___PAD'Size use 16 * 8; -- ! -- and there would also be: -- ! -- type at1___PAD___XVS is record t1: reft1; end record; -- type t1 is ... + -- type reft1 is -- -- Had the subtype Int been dynamic: -- *************** package Exp_Dbug is *** 901,910 **** ----------------- -- Since there is no way for the debugger to obtain the index subtypes ! -- for an array type, we produce a type that has the name of the ! -- array type followed by "___XA" and is a record whose field names ! -- are the names of the types for the bounds. The types of these ! -- fields is an integer type which is meaningless. -- To conserve space, we do not produce this type unless one of the -- index types is either an enumeration type, has a variable upper --- 895,904 ---- ----------------- -- Since there is no way for the debugger to obtain the index subtypes ! -- for an array type, we produce a type that has the name of the array ! -- type followed by "___XA" and is a record type whose field types are ! -- the respective types for the bounds (and whose field names are the ! -- names of these types). -- To conserve space, we do not produce this type unless one of the -- index types is either an enumeration type, has a variable upper *************** package Exp_Dbug is *** 963,970 **** -- Renaming -- -------------- ! -- Debugging information is generated for exception, object, package, ! -- and subprogram renaming (generic renamings are not significant, since -- generic templates are not relevant at debugging time). -- Consider a renaming declaration of the form --- 957,964 ---- -- Renaming -- -------------- ! -- Debugging information is generated for exception, object, package, and ! -- subprogram renaming (generic renamings are not significant, since -- generic templates are not relevant at debugging time). -- Consider a renaming declaration of the form *************** package Exp_Dbug is *** 995,1002 **** -- Note: subprogram renamings are not encoded at the present time ! -- The suffix of the variable name describing the renamed object is ! -- defined to use the following encoding: -- For the simple entity case, where y is just an entity name, the suffix -- is of the form: --- 989,996 ---- -- Note: subprogram renamings are not encoded at the present time ! -- The suffix of the variable name describing the renamed object is defined ! -- to use the following encoding: -- For the simple entity case, where y is just an entity name, the suffix -- is of the form: *************** package Exp_Dbug is *** 1097,1109 **** -- For every constrained packed array, two types are created, and both -- appear in the debugging output: ! -- The original declared array type is a perfectly normal array type, ! -- and its index bounds indicate the original bounds of the array. -- The corresponding packed array type, which may be a modular type, or ! -- may be an array of bytes type (see Exp_Pakd for full details). This ! -- is the type that is actually used in the generated code and for ! -- debugging information for all objects of the packed type. -- The name of the corresponding packed array type is: --- 1091,1103 ---- -- For every constrained packed array, two types are created, and both -- appear in the debugging output: ! -- The original declared array type is a perfectly normal array type, and ! -- its index bounds indicate the original bounds of the array. -- The corresponding packed array type, which may be a modular type, or ! -- may be an array of bytes type (see Exp_Pakd for full details). This is ! -- the type that is actually used in the generated code and for debugging ! -- information for all objects of the packed type. -- The name of the corresponding packed array type is: *************** package Exp_Dbug is *** 1136,1151 **** -- Packed Array Representation in Memory -- ------------------------------------------- ! -- Packed arrays are represented in tightly packed form, with no extra ! -- bits between components. This is true even when the component size ! -- is not a factor of the storage unit size, so that as a result it is ! -- possible for components to cross storage unit boundaries. -- The layout in storage is identical, regardless of whether the ! -- implementation type is a modular type or an array-of-bytes type. ! -- See Exp_Pakd for details of how these implementation types are used, ! -- but for the purpose of the debugger, only the starting address of ! -- the object in memory is significant. -- The following example should show clearly how the packing works in -- the little-endian and big-endian cases: --- 1130,1145 ---- -- Packed Array Representation in Memory -- ------------------------------------------- ! -- Packed arrays are represented in tightly packed form, with no extra bits ! -- between components. This is true even when the component size is not a ! -- factor of the storage unit size, so that as a result it is possible for ! -- components to cross storage unit boundaries. -- The layout in storage is identical, regardless of whether the ! -- implementation type is a modular type or an array-of-bytes type. See ! -- Exp_Pakd for details of how these implementation types are used, but for ! -- the purpose of the debugger, only the starting address of the object in ! -- memory is significant. -- The following example should show clearly how the packing works in -- the little-endian and big-endian cases: *************** package Exp_Dbug is *** 1185,1192 **** -- For example, in the normal modular case, if we have a 6-bit modular -- type, declared as mod 2**6, and we allocate an 8-bit object for this -- type, then we extend the value with two bits on the most significant ! -- end, and in either the little-endian or big-endian case, the value 63 is ! -- represented as 00111111 in binary in memory. -- For a modular type used to represent a packed array, the rule is -- different. In this case, if we have to extend the value, then we do it --- 1179,1186 ---- -- For example, in the normal modular case, if we have a 6-bit modular -- type, declared as mod 2**6, and we allocate an 8-bit object for this -- type, then we extend the value with two bits on the most significant ! -- end, and in either the little-endian or big-endian case, the value 63 ! -- is represented as 00111111 in binary in memory. -- For a modular type used to represent a packed array, the rule is -- different. In this case, if we have to extend the value, then we do it *************** package Exp_Dbug is *** 1223,1233 **** -- However, in the equality case, it is important to ensure that the -- undefined bits do not participate in an equality test. ! -- If a modular packed array value is assigned to a register, then ! -- logically it could always be held right justified, to avoid any need to ! -- shift, e.g. when doing comparisons. But probably this is a bad choice, ! -- as it would mean that an assignment such as a := above would require ! -- shifts when one value is in a register and the other value is in memory. ------------------------------------------------------ -- Subprograms for Handling Packed Array Type Names -- --- 1217,1227 ---- -- However, in the equality case, it is important to ensure that the -- undefined bits do not participate in an equality test. ! -- If a modular packed array value is assigned to a register then logically ! -- it could always be held right justified, to avoid any need to shift, ! -- e.g. when doing comparisons. But probably this is a bad choice, as it ! -- would mean that an assignment such as a := above would require shifts ! -- when one value is in a register and the other value is in memory. ------------------------------------------------------ -- Subprograms for Handling Packed Array Type Names -- *************** package Exp_Dbug is *** 1329,1337 **** -- where discrim is the unqualified name of the variant. This field name is -- built by gigi (not by code in this unit). For Unchecked_Union record, ! -- this discriminant will not appear in the record, and the debugger must ! -- proceed accordingly (basically it can treat this case as it would a C ! -- union). -- The type corresponding to this field has a name that is obtained by -- concatenating the type name with the above string and is similar to a C --- 1323,1330 ---- -- where discrim is the unqualified name of the variant. This field name is -- built by gigi (not by code in this unit). For Unchecked_Union record, ! -- this discriminant will not appear in the record (see Unchecked Unions, ! -- below). -- The type corresponding to this field has a name that is obtained by -- concatenating the type name with the above string and is similar to a C *************** package Exp_Dbug is *** 1344,1350 **** -- The name of the union member is encoded to indicate the choices, and -- is a string given by the following grammar: ! -- union_name ::= {choice} | others_choice -- choice ::= simple_choice | range_choice -- simple_choice ::= S number -- range_choice ::= R number T number --- 1337,1343 ---- -- The name of the union member is encoded to indicate the choices, and -- is a string given by the following grammar: ! -- member_name ::= {choice} | others_choice -- choice ::= simple_choice | range_choice -- simple_choice ::= S number -- range_choice ::= R number T number *************** package Exp_Dbug is *** 1383,1394 **** -- V1 : Var; ! -- In this case, the type var is represented as a struct with three fields, ! -- the first two are "disc" and "m", representing the values of these ! -- record components. ! -- The third field is a union of two types, with field names S1 and O. S1 ! -- is a struct with fields "r" and "s", and O is a struct with fields "t". ------------------------------------------------ -- Subprograms for Handling Variant Encodings -- --- 1376,1409 ---- -- V1 : Var; ! -- In this case, the type var is represented as a struct with three fields. ! -- The first two are "disc" and "m", representing the values of these ! -- record components. The third field is a union of two types, with field ! -- names S1 and O. S1 is a struct with fields "r" and "s", and O is a ! -- struct with field "t". ! ---------------------- ! -- Unchecked Unions -- ! ---------------------- ! ! -- The encoding for variant records changes somewhat under the influence ! -- of a "pragma Unchecked_Union" clause: ! ! -- 1. The discriminant will not be present in the record, although its ! -- name is still used in the encodings. ! -- 2. Variants containing a single component named "x" of type "T" may ! -- be encoded, as in ordinary C unions, as a single field of the ! -- enclosing union type named "x" of type "T", dispensing with the ! -- enclosing struct. In this case, of course, the discriminant values ! -- corresponding to the variant are unavailable. As for normal ! -- variants, the field name "x" may be suffixed with ___XVL if it ! -- has dynamic size. ! ! -- For example, the type Var in the preceding section, if followed by ! -- "pragma Unchecked_Union (Var);" may be encoded as a struct with two ! -- fields. The first is "m". The second field is a union of two types, ! -- with field names S1 and "t". As before, S1 is a struct with fields ! -- "r" and "s". "t" is a field of type Integer. ------------------------------------------------ -- Subprograms for Handling Variant Encodings -- diff -Nrcpad gcc-4.5.2/gcc/ada/exp_disp.adb gcc-4.6.0/gcc/ada/exp_disp.adb *** gcc-4.5.2/gcc/ada/exp_disp.adb Wed Jan 27 13:29:52 2010 --- gcc-4.6.0/gcc/ada/exp_disp.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Einfo; use Einfo; *** 30,36 **** --- 30,38 ---- with Elists; use Elists; with Errout; use Errout; with Exp_Atag; use Exp_Atag; + with Exp_Ch6; use Exp_Ch6; with Exp_Ch7; use Exp_Ch7; + with Exp_CG; use Exp_CG; with Exp_Dbug; use Exp_Dbug; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; *************** with Sinfo; use Sinfo; *** 59,64 **** --- 61,67 ---- with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; + with SCIL_LL; use SCIL_LL; with Tbuild; use Tbuild; with Uintp; use Uintp; *************** package body Exp_Disp is *** 463,468 **** --- 466,568 ---- end Build_Static_Dispatch_Tables; ------------------------------ + -- Convert_Tag_To_Interface -- + ------------------------------ + + function Convert_Tag_To_Interface + (Typ : Entity_Id; + Expr : Node_Id) return Node_Id + is + Loc : constant Source_Ptr := Sloc (Expr); + Anon_Type : Entity_Id; + Result : Node_Id; + + begin + pragma Assert (Is_Class_Wide_Type (Typ) + and then Is_Interface (Typ) + and then + ((Nkind (Expr) = N_Selected_Component + and then Is_Tag (Entity (Selector_Name (Expr)))) + or else + (Nkind (Expr) = N_Function_Call + and then RTE_Available (RE_Displace) + and then Entity (Name (Expr)) = RTE (RE_Displace)))); + + Anon_Type := Create_Itype (E_Anonymous_Access_Type, Expr); + Set_Directly_Designated_Type (Anon_Type, Typ); + Set_Etype (Anon_Type, Anon_Type); + Set_Can_Never_Be_Null (Anon_Type); + + -- Decorate the size and alignment attributes of the anonymous access + -- type, as required by gigi. + + Layout_Type (Anon_Type); + + if Nkind (Expr) = N_Selected_Component + and then Is_Tag (Entity (Selector_Name (Expr))) + then + Result := + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (Anon_Type, + Make_Attribute_Reference (Loc, + Prefix => Expr, + Attribute_Name => Name_Address))); + else + Result := + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (Anon_Type, Expr)); + end if; + + return Result; + end Convert_Tag_To_Interface; + + ------------------- + -- CPP_Num_Prims -- + ------------------- + + function CPP_Num_Prims (Typ : Entity_Id) return Nat is + CPP_Typ : Entity_Id; + Tag_Comp : Entity_Id; + + begin + if not Is_Tagged_Type (Typ) + or else not Is_CPP_Class (Root_Type (Typ)) + then + return 0; + + else + CPP_Typ := Enclosing_CPP_Parent (Typ); + Tag_Comp := First_Tag_Component (CPP_Typ); + + -- If the number of primitives is already set in the tag component + -- then use it + + if Present (Tag_Comp) + and then DT_Entry_Count (Tag_Comp) /= No_Uint + then + return UI_To_Int (DT_Entry_Count (Tag_Comp)); + + -- Otherwise, count the primitives of the enclosing CPP type + + else + declare + Count : Nat := 0; + Elmt : Elmt_Id; + + begin + Elmt := First_Elmt (Primitive_Operations (CPP_Typ)); + while Present (Elmt) loop + Count := Count + 1; + Next_Elmt (Elmt); + end loop; + + return Count; + end; + end if; + end if; + end CPP_Num_Prims; + + ------------------------------ -- Default_Prim_Op_Position -- ------------------------------ *************** package body Exp_Disp is *** 505,511 **** elsif TSS_Name = TSS_Deep_Finalize then return Uint_10; ! elsif Ada_Version >= Ada_05 then if Chars (E) = Name_uDisp_Asynchronous_Select then return Uint_11; --- 605,611 ---- elsif TSS_Name = TSS_Deep_Finalize then return Uint_10; ! elsif Ada_Version >= Ada_2005 then if Chars (E) = Name_uDisp_Asynchronous_Select then return Uint_11; *************** package body Exp_Disp is *** 577,584 **** -- Local variables ! New_Node : Node_Id; ! SCIL_Node : Node_Id; -- Start of processing for Expand_Dispatching_Call --- 677,685 ---- -- Local variables ! New_Node : Node_Id; ! SCIL_Node : Node_Id; ! SCIL_Related_Node : Node_Id := Call_Node; -- Start of processing for Expand_Dispatching_Call *************** package body Exp_Disp is *** 648,666 **** Typ := Non_Limited_View (Typ); end if; - -- Generate the SCIL node for this dispatching call. The SCIL node for a - -- dispatching call is inserted in the tree before the call is rewriten - -- and expanded because the SCIL node must be found by the SCIL backend - -- BEFORE the expanded nodes associated with the call node are found. - - if Generate_SCIL then - SCIL_Node := Make_SCIL_Dispatching_Call (Sloc (Call_Node)); - Set_SCIL_Related_Node (SCIL_Node, Call_Node); - Set_SCIL_Entity (SCIL_Node, Typ); - Set_SCIL_Target_Prim (SCIL_Node, Subp); - Insert_Action (Call_Node, SCIL_Node); - end if; - if not Is_Limited_Type (Typ) then Eq_Prim_Op := Find_Prim_Op (Typ, Name_Op_Eq); end if; --- 749,754 ---- *************** package body Exp_Disp is *** 840,851 **** New_Call_Name := Unchecked_Convert_To (Subp_Ptr_Typ, New_Node); ! -- Complete decoration of SCIL dispatching node. It must be done after ! -- the new call name is built to reference the nodes that will see the ! -- SCIL backend (because Build_Get_Prim_Op_Address generates an ! -- unchecked type conversion which relocates the controlling tag node). if Generate_SCIL then -- Common case: the controlling tag is the tag of an object -- (for example, obj.tag) --- 928,943 ---- New_Call_Name := Unchecked_Convert_To (Subp_Ptr_Typ, New_Node); ! -- Generate the SCIL node for this dispatching call. Done now because ! -- attribute SCIL_Controlling_Tag must be set after the new call name ! -- is built to reference the nodes that will see the SCIL backend ! -- (because Build_Get_Prim_Op_Address generates an unchecked type ! -- conversion which relocates the controlling tag node). if Generate_SCIL then + SCIL_Node := Make_SCIL_Dispatching_Call (Sloc (Call_Node)); + Set_SCIL_Entity (SCIL_Node, Typ); + Set_SCIL_Target_Prim (SCIL_Node, Subp); -- Common case: the controlling tag is the tag of an object -- (for example, obj.tag) *************** package body Exp_Disp is *** 888,894 **** Parent (Entity (Prefix (Controlling_Tag)))); -- For a direct reference of the tag of the type the SCIL node ! -- references the the internal object declaration containing the tag -- of the type. elsif Nkind (Controlling_Tag) = N_Attribute_Reference --- 980,986 ---- Parent (Entity (Prefix (Controlling_Tag)))); -- For a direct reference of the tag of the type the SCIL node ! -- references the internal object declaration containing the tag -- of the type. elsif Nkind (Controlling_Tag) = N_Attribute_Reference *************** package body Exp_Disp is *** 943,948 **** --- 1035,1042 ---- New_Reference_To (First_Tag_Component (Typ), Loc))), Right_Opnd => New_Call); + + SCIL_Related_Node := Right_Opnd (New_Call); end if; else *************** package body Exp_Disp is *** 952,959 **** --- 1046,1063 ---- Parameter_Associations => New_Params); end if; + -- Register the dispatching call in the call graph nodes table + + Register_CG_Node (Call_Node); + Rewrite (Call_Node, New_Call); + -- Associate the SCIL node of this dispatching call + + if Generate_SCIL then + Set_SCIL_Node (SCIL_Related_Node, SCIL_Node); + end if; + -- Suppress all checks during the analysis of the expanded code -- to avoid the generation of spurious warnings under ZFP run-time. *************** package body Exp_Disp is *** 1100,1114 **** pragma Assert (Iface_Tag /= Empty); -- Keep separate access types to interfaces because one internal ! -- function is used to handle the null value (see following comment) if not Is_Access_Type (Etype (N)) then Rewrite (N, ! Unchecked_Convert_To (Etype (N), Make_Selected_Component (Loc, Prefix => Relocate_Node (Expression (N)), ! Selector_Name => ! New_Occurrence_Of (Iface_Tag, Loc)))); else -- Build internal function to handle the case in which the --- 1204,1221 ---- pragma Assert (Iface_Tag /= Empty); -- Keep separate access types to interfaces because one internal ! -- function is used to handle the null value (see following comments) if not Is_Access_Type (Etype (N)) then + + -- Statically displace the pointer to the object to reference + -- the component containing the secondary dispatch table. + Rewrite (N, ! Convert_Tag_To_Interface (Class_Wide_Type (Iface_Typ), Make_Selected_Component (Loc, Prefix => Relocate_Node (Expression (N)), ! Selector_Name => New_Occurrence_Of (Iface_Tag, Loc)))); else -- Build internal function to handle the case in which the *************** package body Exp_Disp is *** 1148,1155 **** New_Typ_Decl := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('T')), Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, --- 1255,1261 ---- New_Typ_Decl := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'T'), Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, *************** package body Exp_Disp is *** 1190,1199 **** Else_Statements => Stats)); end if; ! Fent := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('F')); ! Func := Make_Subprogram_Body (Loc, Specification => --- 1296,1302 ---- Else_Statements => Stats)); end if; ! Fent := Make_Temporary (Loc, 'F'); Func := Make_Subprogram_Body (Loc, Specification => *************** package body Exp_Disp is *** 1319,1325 **** and then Is_Class_Wide_Type (Formal_Typ) then -- No need to displace the pointer if the type of the actual ! -- coindices with the type of the formal. if Actual_Typ = Formal_Typ then null; --- 1422,1428 ---- and then Is_Class_Wide_Type (Formal_Typ) then -- No need to displace the pointer if the type of the actual ! -- coincides with the type of the formal. if Actual_Typ = Formal_Typ then null; *************** package body Exp_Disp is *** 1335,1340 **** --- 1438,1456 ---- -- the displacement of the pointer. else + -- Normally, expansion of actuals for calls to build-in-place + -- functions happens as part of Expand_Actuals, but in this + -- case the call will be wrapped in a conversion and soon after + -- expanded further to handle the displacement for a class-wide + -- interface conversion, so if this is a BIP call then we need + -- to handle it now. + + if Ada_Version >= Ada_2005 + and then Is_Build_In_Place_Function_Call (Actual) + then + Make_Build_In_Place_Call_In_Anonymous_Context (Actual); + end if; + Conversion := Convert_To (Formal_Typ, Relocate_Node (Actual)); Rewrite (Actual, Conversion); Analyze_And_Resolve (Actual, Formal_Typ); *************** package body Exp_Disp is *** 1464,1473 **** Thunk_Id := Empty; Thunk_Code := Empty; -- In case of primitives that are functions without formals and a -- controlling result there is no need to build the thunk. ! if not Present (First_Formal (Target)) then pragma Assert (Ekind (Target) = E_Function and then Has_Controlling_Result (Target)); return; --- 1580,1594 ---- Thunk_Id := Empty; Thunk_Code := Empty; + -- No thunk needed if the primitive has been eliminated + + if Is_Eliminated (Ultimate_Alias (Prim)) then + return; + -- In case of primitives that are functions without formals and a -- controlling result there is no need to build the thunk. ! elsif not Present (First_Formal (Target)) then pragma Assert (Ekind (Target) = E_Function and then Has_Controlling_Result (Target)); return; *************** package body Exp_Disp is *** 1528,1543 **** Formal := First (Formals); while Present (Formal) loop ! -- Handle concurrent types if Ekind (Target_Formal) = E_In_Parameter and then Ekind (Etype (Target_Formal)) = E_Anonymous_Access_Type then ! Ftyp := Directly_Designated_Type (Etype (Target_Formal)); else ! Ftyp := Etype (Target_Formal); end if; if Is_Concurrent_Type (Ftyp) then Ftyp := Corresponding_Record_Type (Ftyp); end if; --- 1649,1670 ---- Formal := First (Formals); while Present (Formal) loop ! -- If the parent is a constrained discriminated type, then the ! -- primitive operation will have been defined on a first subtype. ! -- For proper matching with controlling type, use base type. if Ekind (Target_Formal) = E_In_Parameter and then Ekind (Etype (Target_Formal)) = E_Anonymous_Access_Type then ! Ftyp := ! Base_Type (Directly_Designated_Type (Etype (Target_Formal))); else ! Ftyp := Base_Type (Etype (Target_Formal)); end if; + -- For concurrent types, the relevant information is found in the + -- Corresponding_Record_Type, rather than the type entity itself. + if Is_Concurrent_Type (Ftyp) then Ftyp := Corresponding_Record_Type (Ftyp); end if; *************** package body Exp_Disp is *** 1553,1561 **** Decl_2 := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('T')), Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, --- 1680,1686 ---- Decl_2 := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'T'), Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, *************** package body Exp_Disp is *** 1580,1588 **** Decl_1 := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('S')), Constant_Present => True, Object_Definition => New_Reference_To (RTE (RE_Storage_Offset), Loc), --- 1705,1711 ---- Decl_1 := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), Constant_Present => True, Object_Definition => New_Reference_To (RTE (RE_Storage_Offset), Loc), *************** package body Exp_Disp is *** 1632,1639 **** Decl_1 := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')), Constant_Present => True, Object_Definition => New_Reference_To (RTE (RE_Storage_Offset), Loc), --- 1755,1761 ---- Decl_1 := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), Constant_Present => True, Object_Definition => New_Reference_To (RTE (RE_Storage_Offset), Loc), *************** package body Exp_Disp is *** 1652,1662 **** Decl_2 := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')), ! Constant_Present => True, ! Object_Definition => New_Reference_To (RTE (RE_Addr_Ptr), Loc), ! Expression => Unchecked_Convert_To (RTE (RE_Addr_Ptr), New_Reference_To (Defining_Identifier (Decl_1), Loc))); --- 1774,1784 ---- Decl_2 := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), ! Constant_Present => True, ! Object_Definition => ! New_Reference_To (RTE (RE_Addr_Ptr), Loc), ! Expression => Unchecked_Convert_To (RTE (RE_Addr_Ptr), New_Reference_To (Defining_Identifier (Decl_1), Loc))); *************** package body Exp_Disp is *** 1664,1670 **** Append_To (Decl, Decl_1); Append_To (Decl, Decl_2); ! -- Reference the new actual. Generate: -- Target_Formal (S2.all) Append_To (Actuals, --- 1786,1792 ---- Append_To (Decl, Decl_1); Append_To (Decl, Decl_2); ! -- Reference the new actual, generate: -- Target_Formal (S2.all) Append_To (Actuals, *************** package body Exp_Disp is *** 1683,1692 **** Next (Formal); end loop; ! Thunk_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); ! Set_Is_Thunk (Thunk_Id); -- Procedure case --- 1805,1811 ---- Next (Formal); end loop; ! Thunk_Id := Make_Temporary (Loc, 'T'); Set_Is_Thunk (Thunk_Id); -- Procedure case *************** package body Exp_Disp is *** 1728,1733 **** --- 1847,1876 ---- end if; end Expand_Interface_Thunk; + -------------------------- + -- Has_CPP_Constructors -- + -------------------------- + + function Has_CPP_Constructors (Typ : Entity_Id) return Boolean is + E : Entity_Id; + + begin + -- Look for the constructor entities + + E := Next_Entity (Typ); + while Present (E) loop + if Ekind (E) = E_Function + and then Is_Constructor (E) + then + return True; + end if; + + Next_Entity (E); + end loop; + + return False; + end Has_CPP_Constructors; + ------------ -- Has_DT -- ------------ *************** package body Exp_Disp is *** 1769,1775 **** or else TSS_Name = TSS_Stream_Output or else (Chars (E) = Name_Op_Eq ! and then Etype (First_Entity (E)) = Etype (Last_Entity (E))) or else Chars (E) = Name_uAssign or else TSS_Name = TSS_Deep_Adjust or else TSS_Name = TSS_Deep_Finalize --- 1912,1918 ---- or else TSS_Name = TSS_Stream_Output or else (Chars (E) = Name_Op_Eq ! and then Etype (First_Formal (E)) = Etype (Last_Formal (E))) or else Chars (E) = Name_uAssign or else TSS_Name = TSS_Deep_Adjust or else TSS_Name = TSS_Deep_Finalize *************** package body Exp_Disp is *** 1811,1817 **** or else Chars (E) = Name_uAlignment or else (Chars (E) = Name_Op_Eq ! and then Etype (First_Entity (E)) = Etype (Last_Entity (E))) or else Chars (E) = Name_uAssign or else TSS_Name = TSS_Deep_Adjust or else TSS_Name = TSS_Deep_Finalize --- 1954,1960 ---- or else Chars (E) = Name_uAlignment or else (Chars (E) = Name_Op_Eq ! and then Etype (First_Formal (E)) = Etype (Last_Formal (E))) or else Chars (E) = Name_uAssign or else TSS_Name = TSS_Deep_Adjust or else TSS_Name = TSS_Deep_Finalize *************** package body Exp_Disp is *** 1830,1852 **** function Is_Predefined_Dispatching_Alias (Prim : Entity_Id) return Boolean is - E : Entity_Id; - begin ! if not Is_Predefined_Dispatching_Operation (Prim) and then Present (Alias (Prim)) ! then ! E := Prim; ! while Present (Alias (E)) loop ! E := Alias (E); ! end loop; ! ! if Is_Predefined_Dispatching_Operation (E) then ! return True; ! end if; ! end if; ! ! return False; end Is_Predefined_Dispatching_Alias; --------------------------------------- --- 1973,1982 ---- function Is_Predefined_Dispatching_Alias (Prim : Entity_Id) return Boolean is begin ! return not Is_Predefined_Dispatching_Operation (Prim) and then Present (Alias (Prim)) ! and then Is_Predefined_Dispatching_Operation (Ultimate_Alias (Prim)); end Is_Predefined_Dispatching_Alias; --------------------------------------- *************** package body Exp_Disp is *** 1855,1861 **** function Is_Predefined_Interface_Primitive (E : Entity_Id) return Boolean is begin ! return Ada_Version >= Ada_05 and then (Chars (E) = Name_uDisp_Asynchronous_Select or else Chars (E) = Name_uDisp_Conditional_Select or else Chars (E) = Name_uDisp_Get_Prim_Op_Kind or else --- 1985,1991 ---- function Is_Predefined_Interface_Primitive (E : Entity_Id) return Boolean is begin ! return Ada_Version >= Ada_2005 and then (Chars (E) = Name_uDisp_Asynchronous_Select or else Chars (E) = Name_uDisp_Conditional_Select or else Chars (E) = Name_uDisp_Get_Prim_Op_Kind or else *************** package body Exp_Disp is *** 1985,1993 **** -- Generate: -- Bnn : Communication_Block; ! Com_Block := ! Make_Defining_Identifier (Loc, New_Internal_Name ('B')); ! Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => --- 2115,2121 ---- -- Generate: -- Bnn : Communication_Block; ! Com_Block := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => *************** package body Exp_Disp is *** 2031,2042 **** Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To ! (RTE (RE_Protected_Entry_Index), Loc), Expression => Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block ! New_Reference_To ( -- Asynchronous_Call ! RTE (RE_Asynchronous_Call), Loc), New_Reference_To (Com_Block, Loc)))); -- comm block --- 2159,2170 ---- Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To ! (RTE (RE_Protected_Entry_Index), Loc), Expression => Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block ! New_Reference_To -- Asynchronous_Call ! (RTE (RE_Asynchronous_Call), Loc), New_Reference_To (Com_Block, Loc)))); -- comm block *************** package body Exp_Disp is *** 2058,2064 **** Obj_Ref, Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_uP), Attribute_Name => Name_Address), New_Reference_To --- 2186,2192 ---- Obj_Ref, Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_uP), Attribute_Name => Name_Address), New_Reference_To *************** package body Exp_Disp is *** 2073,2080 **** Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => ! Make_Identifier (Loc, Name_uB), Expression => Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => --- 2201,2207 ---- Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => Make_Identifier (Loc, Name_uB), Expression => Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => *************** package body Exp_Disp is *** 2104,2123 **** Parameter_Associations => New_List ( Make_Selected_Component (Loc, -- T._task_id ! Prefix => ! Make_Identifier (Loc, Name_uT), ! Selector_Name => ! Make_Identifier (Loc, Name_uTask_Id)), Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => ! Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block ! New_Reference_To ( -- Asynchronous_Call ! RTE (RE_Asynchronous_Call), Loc), Make_Identifier (Loc, Name_uF)))); -- status flag end if; --- 2231,2247 ---- Parameter_Associations => New_List ( Make_Selected_Component (Loc, -- T._task_id ! Prefix => Make_Identifier (Loc, Name_uT), ! Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block ! New_Reference_To -- Asynchronous_Call ! (RTE (RE_Asynchronous_Call), Loc), Make_Identifier (Loc, Name_uF)))); -- status flag end if; *************** package body Exp_Disp is *** 2338,2345 **** -- where Bnn is the name of the communication block used in the -- call to Protected_Entry_Call. ! Blk_Nam := Make_Defining_Identifier (Loc, New_Internal_Name ('B')); ! Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => --- 2462,2468 ---- -- where Bnn is the name of the communication block used in the -- call to Protected_Entry_Call. ! Blk_Nam := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => *************** package body Exp_Disp is *** 2354,2361 **** Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => ! Make_Identifier (Loc, Name_uI), Expression => Make_Function_Call (Loc, Name => --- 2477,2483 ---- Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => Make_Identifier (Loc, Name_uI), Expression => Make_Function_Call (Loc, Name => *************** package body Exp_Disp is *** 2427,2433 **** Obj_Ref, Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_uP), Attribute_Name => Name_Address), New_Reference_To --- 2549,2555 ---- Obj_Ref, Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_uP), Attribute_Name => Name_Address), New_Reference_To *************** package body Exp_Disp is *** 2444,2451 **** Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => ! Make_Identifier (Loc, Name_uF), Expression => Make_Op_Not (Loc, Right_Opnd => --- 2566,2572 ---- Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => Make_Identifier (Loc, Name_uF), Expression => Make_Op_Not (Loc, Right_Opnd => *************** package body Exp_Disp is *** 2477,2496 **** New_List ( Make_Selected_Component (Loc, -- T._task_id ! Prefix => ! Make_Identifier (Loc, Name_uT), ! Selector_Name => ! Make_Identifier (Loc, Name_uTask_Id)), Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => ! Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block ! New_Reference_To ( -- Conditional_Call ! RTE (RE_Conditional_Call), Loc), Make_Identifier (Loc, Name_uF)))); -- status flag end if; --- 2598,2614 ---- New_List ( Make_Selected_Component (Loc, -- T._task_id ! Prefix => Make_Identifier (Loc, Name_uT), ! Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block ! New_Reference_To -- Conditional_Call ! (RTE (RE_Conditional_Call), Loc), Make_Identifier (Loc, Name_uF)))); -- status flag end if; *************** package body Exp_Disp is *** 2705,2714 **** New_Reference_To (RTE (RE_Address), Loc), Expression => Make_Selected_Component (Loc, ! Prefix => ! Make_Identifier (Loc, Name_uT), ! Selector_Name => ! Make_Identifier (Loc, Name_uTask_Id)))); -- A null body is constructed for non-task types --- 2823,2830 ---- New_Reference_To (RTE (RE_Address), Loc), Expression => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uT), ! Selector_Name => Make_Identifier (Loc, Name_uTask_Id)))); -- A null body is constructed for non-task types *************** package body Exp_Disp is *** 2815,2822 **** else Append_To (Stmts, Make_If_Statement (Loc, ! Condition => ! Make_Identifier (Loc, Name_uF), Then_Statements => New_List ( --- 2931,2937 ---- else Append_To (Stmts, Make_If_Statement (Loc, ! Condition => Make_Identifier (Loc, Name_uF), Then_Statements => New_List ( *************** package body Exp_Disp is *** 2842,2848 **** Name_Unchecked_Access, Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uO), Selector_Name => Make_Identifier (Loc, Name_uObject))), --- 2957,2963 ---- Name_Unchecked_Access, Prefix => Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_uO), Selector_Name => Make_Identifier (Loc, Name_uObject))), *************** package body Exp_Disp is *** 2851,2858 **** Subtype_Mark => New_Reference_To ( RTE (RE_Protected_Entry_Index), Loc), ! Expression => ! Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uA)))), -- abort status --- 2966,2972 ---- Subtype_Mark => New_Reference_To ( RTE (RE_Protected_Entry_Index), Loc), ! Expression => Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uA)))), -- abort status *************** package body Exp_Disp is *** 2906,2975 **** Append_To (Stmts, Make_If_Statement (Loc, ! Condition => ! Make_Identifier (Loc, Name_uF), ! Then_Statements => ! New_List ( ! -- Call to Requeue_Protected_To_Task_Entry ! Make_Procedure_Call_Statement (Loc, ! Name => ! New_Reference_To ( ! RTE (RE_Requeue_Protected_To_Task_Entry), Loc), ! Parameter_Associations => ! New_List ( ! Make_Unchecked_Type_Conversion (Loc, -- PEA (P) ! Subtype_Mark => ! New_Reference_To ( ! RTE (RE_Protection_Entries_Access), Loc), ! Expression => ! Make_Identifier (Loc, Name_uP)), ! Make_Selected_Component (Loc, -- O._task_id ! Prefix => ! Make_Identifier (Loc, Name_uO), ! Selector_Name => ! Make_Identifier (Loc, Name_uTask_Id)), ! Make_Unchecked_Type_Conversion (Loc, -- entry index ! Subtype_Mark => ! New_Reference_To ( ! RTE (RE_Task_Entry_Index), Loc), ! Expression => ! Make_Identifier (Loc, Name_uI)), ! Make_Identifier (Loc, Name_uA)))), -- abort status ! Else_Statements => ! New_List ( ! -- Call to Requeue_Task_Entry ! Make_Procedure_Call_Statement (Loc, ! Name => ! New_Reference_To (RTE (RE_Requeue_Task_Entry), Loc), ! Parameter_Associations => ! New_List ( ! Make_Selected_Component (Loc, -- O._task_id ! Prefix => ! Make_Identifier (Loc, Name_uO), ! Selector_Name => ! Make_Identifier (Loc, Name_uTask_Id)), ! Make_Unchecked_Type_Conversion (Loc, -- entry index ! Subtype_Mark => ! New_Reference_To ( ! RTE (RE_Task_Entry_Index), Loc), ! Expression => ! Make_Identifier (Loc, Name_uI)), ! Make_Identifier (Loc, Name_uA)))))); -- abort status end if; -- Even though no declarations are needed in both cases, we allocate --- 3020,3074 ---- Append_To (Stmts, Make_If_Statement (Loc, ! Condition => Make_Identifier (Loc, Name_uF), ! Then_Statements => New_List ( ! -- Call to Requeue_Protected_To_Task_Entry ! Make_Procedure_Call_Statement (Loc, ! Name => ! New_Reference_To ! (RTE (RE_Requeue_Protected_To_Task_Entry), Loc), ! Parameter_Associations => New_List ( ! Make_Unchecked_Type_Conversion (Loc, -- PEA (P) ! Subtype_Mark => ! New_Reference_To ! (RTE (RE_Protection_Entries_Access), Loc), ! Expression => Make_Identifier (Loc, Name_uP)), ! Make_Selected_Component (Loc, -- O._task_id ! Prefix => Make_Identifier (Loc, Name_uO), ! Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), ! Make_Unchecked_Type_Conversion (Loc, -- entry index ! Subtype_Mark => ! New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => Make_Identifier (Loc, Name_uI)), ! Make_Identifier (Loc, Name_uA)))), -- abort status ! Else_Statements => New_List ( ! -- Call to Requeue_Task_Entry ! Make_Procedure_Call_Statement (Loc, ! Name => New_Reference_To (RTE (RE_Requeue_Task_Entry), Loc), ! Parameter_Associations => New_List ( ! Make_Selected_Component (Loc, -- O._task_id ! Prefix => Make_Identifier (Loc, Name_uO), ! Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), ! Make_Unchecked_Type_Conversion (Loc, -- entry index ! Subtype_Mark => ! New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => Make_Identifier (Loc, Name_uI)), ! Make_Identifier (Loc, Name_uA)))))); -- abort status end if; -- Even though no declarations are needed in both cases, we allocate *************** package body Exp_Disp is *** 3191,3198 **** Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => ! Make_Identifier (Loc, Name_uI), Expression => Make_Function_Call (Loc, Name => --- 3290,3296 ---- Append_To (Stmts, Make_Assignment_Statement (Loc, ! Name => Make_Identifier (Loc, Name_uI), Expression => Make_Function_Call (Loc, Name => *************** package body Exp_Disp is *** 3305,3320 **** New_List ( Make_Selected_Component (Loc, -- T._task_id ! Prefix => ! Make_Identifier (Loc, Name_uT), ! Selector_Name => ! Make_Identifier (Loc, Name_uTask_Id)), Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => ! Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block Make_Identifier (Loc, Name_uD), -- delay --- 3403,3415 ---- New_List ( Make_Selected_Component (Loc, -- T._task_id ! Prefix => Make_Identifier (Loc, Name_uT), ! Selector_Name => Make_Identifier (Loc, Name_uTask_Id)), Make_Unchecked_Type_Conversion (Loc, -- entry index Subtype_Mark => New_Reference_To (RTE (RE_Task_Entry_Index), Loc), ! Expression => Make_Identifier (Loc, Name_uI)), Make_Identifier (Loc, Name_uP), -- parameter block Make_Identifier (Loc, Name_uD), -- delay *************** package body Exp_Disp is *** 3584,3596 **** Exporting_Table : constant Boolean := Building_Static_DT (Typ) and then Suffix_Index > 0; ! Iface_DT : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); ! Name_Predef_Prims : constant Name_Id := New_Internal_Name ('R'); ! Predef_Prims : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => Name_Predef_Prims); DT_Constr_List : List_Id; DT_Aggr_List : List_Id; Empty_DT : Boolean := False; --- 3679,3686 ---- Exporting_Table : constant Boolean := Building_Static_DT (Typ) and then Suffix_Index > 0; ! Iface_DT : constant Entity_Id := Make_Temporary (Loc, 'T'); ! Predef_Prims : constant Entity_Id := Make_Temporary (Loc, 'R'); DT_Constr_List : List_Id; DT_Aggr_List : List_Id; Empty_DT : Boolean := False; *************** package body Exp_Disp is *** 3627,3633 **** -- Calculate the number of slots of the dispatch table. If the number -- of primitives of Typ is 0 we reserve a dummy single entry for its ! -- DT because at run-time the pointer to this dummy entry will be -- used as the tag. if Num_Iface_Prims = 0 then --- 3717,3723 ---- -- Calculate the number of slots of the dispatch table. If the number -- of primitives of Typ is 0 we reserve a dummy single entry for its ! -- DT because at run time the pointer to this dummy entry will be -- used as the tag. if Num_Iface_Prims = 0 then *************** package body Exp_Disp is *** 3689,3694 **** --- 3779,3785 ---- if Is_Predefined_Dispatching_Operation (Prim) and then not Is_Abstract_Subprogram (Prim) + and then not Is_Eliminated (Prim) and then not Present (Prim_Table (UI_To_Int (DT_Position (Prim)))) then *************** package body Exp_Disp is *** 3697,3707 **** Alias (Prim); else ! while Present (Alias (Prim)) loop ! Prim := Alias (Prim); ! end loop; ! ! Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code); if Present (Thunk_Id) then Append_To (Result, Thunk_Code); --- 3788,3795 ---- Alias (Prim); else ! Expand_Interface_Thunk ! (Ultimate_Alias (Prim), Thunk_Id, Thunk_Code); if Present (Thunk_Id) then Append_To (Result, Thunk_Code); *************** package body Exp_Disp is *** 3739,3748 **** 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); --- 3827,3834 ---- Decl := Make_Subtype_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), ! Subtype_Indication => New_Reference_To (RTE (RE_Address_Array), Loc)); Append_To (Result, Decl); *************** package body Exp_Disp is *** 3870,3881 **** (Interface_Alias (Prim)) = Iface then Prim_Alias := Interface_Alias (Prim); ! ! E := Prim; ! while Present (Alias (E)) loop ! E := Alias (E); ! end loop; ! Pos := UI_To_Int (DT_Position (Prim_Alias)); if Present (Prim_Table (Pos)) then --- 3956,3962 ---- (Interface_Alias (Prim)) = Iface then Prim_Alias := Interface_Alias (Prim); ! E := Ultimate_Alias (Prim); Pos := UI_To_Int (DT_Position (Prim_Alias)); if Present (Prim_Table (Pos)) then *************** package body Exp_Disp is *** 3903,3909 **** pragma Assert (Count = Nb_Prim); end; ! OSD := Make_Defining_Identifier (Loc, New_Internal_Name ('I')); Append_To (Result, Make_Object_Declaration (Loc, --- 3984,3990 ---- pragma Assert (Count = Nb_Prim); end; ! OSD := Make_Temporary (Loc, 'I'); Append_To (Result, Make_Object_Declaration (Loc, *************** package body Exp_Disp is *** 3916,3936 **** Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Make_Integer_Literal (Loc, Nb_Prim)))), - Expression => Make_Aggregate (Loc, - Component_Associations => New_List ( - Make_Component_Association (Loc, - Choices => New_List ( - New_Occurrence_Of - (RTE_Record_Component (RE_OSD_Num_Prims), Loc)), - Expression => - Make_Integer_Literal (Loc, Nb_Prim)), ! Make_Component_Association (Loc, ! Choices => New_List ( ! New_Occurrence_Of ! (RTE_Record_Component (RE_OSD_Table), Loc)), ! Expression => Make_Aggregate (Loc, ! Component_Associations => OSD_Aggr_List)))))); Append_To (Result, Make_Attribute_Definition_Clause (Loc, --- 3997,4019 ---- Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Make_Integer_Literal (Loc, Nb_Prim)))), ! Expression => ! Make_Aggregate (Loc, ! Component_Associations => New_List ( ! Make_Component_Association (Loc, ! Choices => New_List ( ! New_Occurrence_Of ! (RTE_Record_Component (RE_OSD_Num_Prims), Loc)), ! Expression => ! Make_Integer_Literal (Loc, Nb_Prim)), ! ! Make_Component_Association (Loc, ! Choices => New_List ( ! New_Occurrence_Of ! (RTE_Record_Component (RE_OSD_Table), Loc)), ! Expression => Make_Aggregate (Loc, ! Component_Associations => OSD_Aggr_List)))))); Append_To (Result, Make_Attribute_Definition_Clause (Loc, *************** package body Exp_Disp is *** 3967,4010 **** else declare ! Prim_Table : array (Nat range 1 .. Nb_Prim) of Entity_Id; ! Pos : Nat; ! Thunk_Code : Node_Id; ! Thunk_Id : Entity_Id; begin Prim_Table := (others => Empty); Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); while Present (Prim_Elmt) loop ! Prim := Node (Prim_Elmt); if not Is_Predefined_Dispatching_Operation (Prim) and then Present (Interface_Alias (Prim)) and then not Is_Abstract_Subprogram (Alias (Prim)) ! and then not Is_Imported (Alias (Prim)) and then Find_Dispatching_Type (Interface_Alias (Prim)) = Iface -- Generate the code of the thunk only if the abstract -- interface type is not an immediate ancestor of ! -- Tagged_Type; otherwise the DT associated with the -- interface is the primary DT. and then not Is_Ancestor (Iface, Typ) then if not Build_Thunks then ! Pos := UI_To_Int (DT_Position (Interface_Alias (Prim))); ! Prim_Table (Pos) := Alias (Prim); else Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code); if Present (Thunk_Id) then ! Pos := UI_To_Int (DT_Position (Interface_Alias (Prim))); ! Prim_Table (Pos) := Thunk_Id; Append_To (Result, Thunk_Code); end if; end if; --- 4050,4106 ---- else declare ! CPP_Nb_Prims : constant Nat := CPP_Num_Prims (Typ); ! E : Entity_Id; ! Prim_Pos : Nat; ! Prim_Table : array (Nat range 1 .. Nb_Prim) of Entity_Id; ! Thunk_Code : Node_Id; ! Thunk_Id : Entity_Id; begin Prim_Table := (others => Empty); Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); while Present (Prim_Elmt) loop ! Prim := Node (Prim_Elmt); ! E := Ultimate_Alias (Prim); ! Prim_Pos := UI_To_Int (DT_Position (E)); ! ! -- Do not reference predefined primitives because they are ! -- located in a separate dispatch table; skip abstract and ! -- eliminated primitives; skip primitives located in the C++ ! -- part of the dispatch table because their slot is set by ! -- the IC routine. if not Is_Predefined_Dispatching_Operation (Prim) and then Present (Interface_Alias (Prim)) and then not Is_Abstract_Subprogram (Alias (Prim)) ! and then not Is_Eliminated (Alias (Prim)) ! and then (not Is_CPP_Class (Root_Type (Typ)) ! or else Prim_Pos > CPP_Nb_Prims) and then Find_Dispatching_Type (Interface_Alias (Prim)) = Iface -- Generate the code of the thunk only if the abstract -- interface type is not an immediate ancestor of ! -- Tagged_Type. Otherwise the DT associated with the -- interface is the primary DT. and then not Is_Ancestor (Iface, Typ) then if not Build_Thunks then ! Prim_Pos := UI_To_Int (DT_Position (Interface_Alias (Prim))); ! Prim_Table (Prim_Pos) := Alias (Prim); ! else Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code); if Present (Thunk_Id) then ! Prim_Pos := UI_To_Int (DT_Position (Interface_Alias (Prim))); ! Prim_Table (Prim_Pos) := Thunk_Id; Append_To (Result, Thunk_Code); end if; end if; *************** package body Exp_Disp is *** 4020,4025 **** --- 4116,4122 ---- Make_Attribute_Reference (Loc, Prefix => New_Reference_To (Prim_Table (J), Loc), Attribute_Name => Name_Unrestricted_Access)); + else New_Node := Make_Null (Loc); end if; *************** package body Exp_Disp is *** 4201,4206 **** --- 4298,4305 ---- if Has_Dispatch_Table (Typ) or else No (Access_Disp_Table (Typ)) or else Is_CPP_Class (Typ) + or else Convention (Typ) = Convention_CIL + or else Convention (Typ) = Convention_Java then return Result; *************** package body Exp_Disp is *** 4257,4265 **** -- register the primitives in the slots will be generated later --- when -- each primitive is frozen (see Freeze_Subprogram). ! if Building_Static_DT (Typ) ! and then not Is_CPP_Class (Typ) ! then declare Save : constant Boolean := Freezing_Library_Level_Tagged_Type; Prim : Entity_Id; --- 4356,4362 ---- -- register the primitives in the slots will be generated later --- when -- each primitive is frozen (see Freeze_Subprogram). ! if Building_Static_DT (Typ) then declare Save : constant Boolean := Freezing_Library_Level_Tagged_Type; Prim : Entity_Id; *************** package body Exp_Disp is *** 4272,4278 **** Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); while Present (Prim_Elmt) loop Prim := Node (Prim_Elmt); ! Frnodes := Freeze_Entity (Prim, Loc); declare F : Entity_Id; --- 4369,4375 ---- Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); while Present (Prim_Elmt) loop Prim := Node (Prim_Elmt); ! Frnodes := Freeze_Entity (Prim, Typ); declare F : Entity_Id; *************** package body Exp_Disp is *** 4316,4321 **** --- 4413,4419 ---- AI_Tag_Comp := First_Elmt (Typ_Comps); while Present (AI_Tag_Comp) loop + pragma Assert (Has_Suffix (Node (AI_Tag_Elmt), 'P')); -- Build the secondary table containing pointers to thunks *************** package body Exp_Disp is *** 4330,4368 **** Build_Thunks => True, Result => Result); ! -- Skip secondary dispatch table and secondary dispatch table of ! -- predefined primitives Next_Elmt (AI_Tag_Elmt); Next_Elmt (AI_Tag_Elmt); -- Build the secondary table containing pointers to primitives -- (used to give support to Generic Dispatching Constructors). Make_Secondary_DT ! (Typ => Typ, ! Iface => Base_Type (Related_Type (Node (AI_Tag_Comp))), ! Suffix_Index => -1, ! Num_Iface_Prims => UI_To_Int ! (DT_Entry_Count (Node (AI_Tag_Comp))), ! Iface_DT_Ptr => Node (AI_Tag_Elmt), ! Predef_Prims_Ptr => Node (Next_Elmt (AI_Tag_Elmt)), ! Build_Thunks => False, ! Result => Result); ! -- Skip secondary dispatch table and secondary dispatch table of ! -- predefined primitives Next_Elmt (AI_Tag_Elmt); ! Next_Elmt (AI_Tag_Elmt); Suffix_Index := Suffix_Index + 1; Next_Elmt (AI_Tag_Comp); end loop; end if; ! -- Get the _tag entity and the number of primitives of its dispatch ! -- table. DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ))); Nb_Prim := UI_To_Int (DT_Entry_Count (First_Tag_Component (Typ))); --- 4428,4472 ---- Build_Thunks => True, Result => Result); ! -- Skip secondary dispatch table referencing thunks to predefined ! -- primitives. Next_Elmt (AI_Tag_Elmt); + pragma Assert (Has_Suffix (Node (AI_Tag_Elmt), 'Y')); + + -- Secondary dispatch table referencing user-defined primitives + -- covered by this interface. + Next_Elmt (AI_Tag_Elmt); + pragma Assert (Has_Suffix (Node (AI_Tag_Elmt), 'D')); -- Build the secondary table containing pointers to primitives -- (used to give support to Generic Dispatching Constructors). Make_Secondary_DT ! (Typ => Typ, ! Iface => Base_Type ! (Related_Type (Node (AI_Tag_Comp))), ! Suffix_Index => -1, ! Num_Iface_Prims => UI_To_Int ! (DT_Entry_Count (Node (AI_Tag_Comp))), ! Iface_DT_Ptr => Node (AI_Tag_Elmt), ! Predef_Prims_Ptr => Node (Next_Elmt (AI_Tag_Elmt)), ! Build_Thunks => False, ! Result => Result); ! -- Skip secondary dispatch table referencing predefined primitives Next_Elmt (AI_Tag_Elmt); ! pragma Assert (Has_Suffix (Node (AI_Tag_Elmt), 'Z')); Suffix_Index := Suffix_Index + 1; + Next_Elmt (AI_Tag_Elmt); Next_Elmt (AI_Tag_Comp); end loop; end if; ! -- Get the _tag entity and number of primitives of its dispatch table DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ))); Nb_Prim := UI_To_Int (DT_Entry_Count (First_Tag_Component (Typ))); *************** package body Exp_Disp is *** 4395,4411 **** New_Reference_To (RTE (RE_No_Dispatch_Table_Wrapper), Loc))); - -- Generate a SCIL node for the previous object declaration - -- because it has a null dispatch table. - - if Generate_SCIL then - New_Node := - Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result))); - Set_SCIL_Related_Node (New_Node, Last (Result)); - Set_SCIL_Entity (New_Node, Typ); - Insert_Before (Last (Result), New_Node); - end if; - Append_To (Result, Make_Attribute_Definition_Clause (Loc, Name => New_Reference_To (DT, Loc), --- 4499,4504 ---- *************** package body Exp_Disp is *** 4432,4446 **** (RTE_Record_Component (RE_NDT_Prims_Ptr), Loc)), Attribute_Name => Name_Address)))); -- Generate the SCIL node for the previous object declaration -- because it has a tag initialization. if Generate_SCIL then New_Node := Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result))); - Set_SCIL_Related_Node (New_Node, Last (Result)); Set_SCIL_Entity (New_Node, Typ); ! Insert_Before (Last (Result), New_Node); end if; -- Generate: --- 4525,4541 ---- (RTE_Record_Component (RE_NDT_Prims_Ptr), Loc)), Attribute_Name => Name_Address)))); + Set_Is_Statically_Allocated (DT_Ptr, + Is_Library_Level_Tagged_Type (Typ)); + -- Generate the SCIL node for the previous object declaration -- because it has a tag initialization. if Generate_SCIL then New_Node := Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result))); Set_SCIL_Entity (New_Node, Typ); ! Set_SCIL_Node (Last (Result), New_Node); end if; -- Generate: *************** package body Exp_Disp is *** 4472,4488 **** Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => DT_Constr_List)))); - -- Generate the SCIL node for the previous object declaration - -- because it contains a dispatch table. - - if Generate_SCIL then - New_Node := - Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result))); - Set_SCIL_Related_Node (New_Node, Last (Result)); - Set_SCIL_Entity (New_Node, Typ); - Insert_Before (Last (Result), New_Node); - end if; - Append_To (Result, Make_Attribute_Definition_Clause (Loc, Name => New_Reference_To (DT, Loc), --- 4567,4572 ---- *************** package body Exp_Disp is *** 4509,4523 **** (RTE_Record_Component (RE_Prims_Ptr), Loc)), Attribute_Name => Name_Address)))); -- Generate the SCIL node for the previous object declaration -- because it has a tag initialization. if Generate_SCIL then New_Node := Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result))); - Set_SCIL_Related_Node (New_Node, Last (Result)); Set_SCIL_Entity (New_Node, Typ); ! Insert_Before (Last (Result), New_Node); end if; Append_To (Result, --- 4593,4609 ---- (RTE_Record_Component (RE_Prims_Ptr), Loc)), Attribute_Name => Name_Address)))); + Set_Is_Statically_Allocated (DT_Ptr, + Is_Library_Level_Tagged_Type (Typ)); + -- Generate the SCIL node for the previous object declaration -- because it has a tag initialization. if Generate_SCIL then New_Node := Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result))); Set_SCIL_Entity (New_Node, Typ); ! Set_SCIL_Node (Last (Result), New_Node); end if; Append_To (Result, *************** package body Exp_Disp is *** 4550,4556 **** Object_Definition => New_Reference_To (Standard_String, Loc), Expression => Make_String_Literal (Loc, ! Full_Qualified_Name (First_Subtype (Typ))))); Set_Is_Statically_Allocated (Exname); Set_Is_True_Constant (Exname); --- 4636,4642 ---- Object_Definition => New_Reference_To (Standard_String, Loc), Expression => Make_String_Literal (Loc, ! Fully_Qualified_Name_String (First_Subtype (Typ))))); Set_Is_Statically_Allocated (Exname); Set_Is_True_Constant (Exname); *************** package body Exp_Disp is *** 4575,4580 **** --- 4661,4667 ---- -- External_Tag => Cstring_Ptr!(Exname'Address)) -- HT_Link => HT_Link'Address, -- Transportable => <>, + -- Type_Is_Abstract => <>, -- RC_Offset => <>, -- [ Size_Func => Size_Prim'Access ] -- [ Interfaces_Table => <> ] *************** package body Exp_Disp is *** 4663,4669 **** New_External_Name (Tname, 'A')); Full_Name : constant String_Id := ! Full_Qualified_Name (First_Subtype (Typ)); Str1_Id : String_Id; Str2_Id : String_Id; --- 4750,4756 ---- New_External_Name (Tname, 'A')); Full_Name : constant String_Id := ! Fully_Qualified_Name_String (First_Subtype (Typ)); Str1_Id : String_Id; Str2_Id : String_Id; *************** package body Exp_Disp is *** 4841,4846 **** --- 4928,4949 ---- New_Occurrence_Of (Transportable, Loc)); end; + -- Type_Is_Abstract (Ada 2012: AI05-0173). This functionality is + -- not available in the HIE runtime. + + if RTE_Record_Component_Available (RE_Type_Is_Abstract) then + declare + Type_Is_Abstract : Entity_Id; + + begin + Type_Is_Abstract := + Boolean_Literals (Is_Abstract_Type (Typ)); + + Append_To (TSD_Aggr_List, + New_Occurrence_Of (Type_Is_Abstract, Loc)); + end; + end if; + -- RC_Offset: These are the valid values and their meaning: -- >0: For simple types with controlled components is *************** package body Exp_Disp is *** 4902,4910 **** -- 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))); --- 5005,5018 ---- -- Size_Func if RTE_Record_Component_Available (RE_Size_Func) then ! ! -- Initialize this field to Null_Address if we are not building ! -- static dispatch tables static or if the size function is not ! -- available. In the former case we cannot initialize this field ! -- until the function is frozen and registered in the dispatch ! -- table (see Register_Primitive). ! ! if not Building_Static_DT (Typ) or else not Has_DT (Typ) then Append_To (TSD_Aggr_List, Unchecked_Convert_To (RTE (RE_Size_Ptr), New_Reference_To (RTE (RE_Null_Address), Loc))); *************** package body Exp_Disp is *** 4913,4918 **** --- 5021,5027 ---- declare Prim_Elmt : Elmt_Id; Prim : Entity_Id; + Size_Comp : Node_Id; begin Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); *************** package body Exp_Disp is *** 4920,4939 **** 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; --- 5029,5046 ---- Prim := Node (Prim_Elmt); if Chars (Prim) = Name_uSize then ! Prim := Ultimate_Alias (Prim); if Is_Abstract_Subprogram (Prim) then ! Size_Comp := Unchecked_Convert_To (RTE (RE_Size_Ptr), ! New_Reference_To (RTE (RE_Null_Address), Loc)); else ! Size_Comp := 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; *************** package body Exp_Disp is *** 4941,4946 **** --- 5048,5056 ---- Next_Elmt (Prim_Elmt); end loop; + + pragma Assert (Present (Size_Comp)); + Append_To (TSD_Aggr_List, Size_Comp); end; end if; end if; *************** package body Exp_Disp is *** 4982,4988 **** (Next_Elmt (First_Elmt (Access_Disp_Table (Typ)))); pragma Assert (Has_Thunks (Node (Elmt))); ! while Ekind (Node (Elmt)) = E_Constant and then not Is_Ancestor (Node (AI), Related_Type (Node (Elmt))) loop --- 5092,5098 ---- (Next_Elmt (First_Elmt (Access_Disp_Table (Typ)))); pragma Assert (Has_Thunks (Node (Elmt))); ! while Is_Tag (Node (Elmt)) and then not Is_Ancestor (Node (AI), Related_Type (Node (Elmt))) loop *************** package body Exp_Disp is *** 5042,5048 **** Is_Library_Level_Tagged_Type (Typ)); -- The table of interfaces is not constant; its slots are ! -- filled at run-time by the IP routine using attribute -- 'Position to know the location of the tag components -- (and this attribute cannot be safely used before the -- object is initialized). --- 5152,5158 ---- Is_Library_Level_Tagged_Type (Typ)); -- The table of interfaces is not constant; its slots are ! -- filled at run time by the IP routine using attribute -- 'Position to know the location of the tag components -- (and this attribute cannot be safely used before the -- object is initialized). *************** package body Exp_Disp is *** 5092,5098 **** -- constrained by the number of non-predefined primitive operations. if RTE_Record_Component_Available (RE_SSD) then ! if Ada_Version >= Ada_05 and then Has_DT (Typ) and then Is_Concurrent_Record_Type (Typ) and then Has_Interfaces (Typ) --- 5202,5208 ---- -- constrained by the number of non-predefined primitive operations. if RTE_Record_Component_Available (RE_SSD) then ! if Ada_Version >= Ada_2005 and then Has_DT (Typ) and then Is_Concurrent_Record_Type (Typ) and then Has_Interfaces (Typ) *************** package body Exp_Disp is *** 5287,5303 **** Expression => Make_Aggregate (Loc, Expressions => DT_Aggr_List))); - -- Generate the SCIL node for the previous object declaration - -- because it has a null dispatch table. - - if Generate_SCIL then - New_Node := - Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result))); - Set_SCIL_Related_Node (New_Node, Last (Result)); - Set_SCIL_Entity (New_Node, Typ); - Insert_Before (Last (Result), New_Node); - end if; - Append_To (Result, Make_Attribute_Definition_Clause (Loc, Name => New_Reference_To (DT, Loc), --- 5397,5402 ---- *************** package body Exp_Disp is *** 5379,5392 **** if Is_Predefined_Dispatching_Operation (Prim) and then not Is_Abstract_Subprogram (Prim) and then not Present (Prim_Table (UI_To_Int (DT_Position (Prim)))) then ! E := Prim; ! while Present (Alias (E)) loop ! E := Alias (E); ! end loop; ! pragma Assert (not Is_Abstract_Subprogram (E)); Prim_Table (UI_To_Int (DT_Position (Prim))) := E; end if; --- 5478,5488 ---- if Is_Predefined_Dispatching_Operation (Prim) and then not Is_Abstract_Subprogram (Prim) + and then not Is_Eliminated (Prim) and then not Present (Prim_Table (UI_To_Int (DT_Position (Prim)))) then ! E := Ultimate_Alias (Prim); pragma Assert (not Is_Abstract_Subprogram (E)); Prim_Table (UI_To_Int (DT_Position (Prim))) := E; end if; *************** package body Exp_Disp is *** 5415,5424 **** 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); --- 5511,5518 ---- Decl := Make_Subtype_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'S'), ! Subtype_Indication => New_Reference_To (RTE (RE_Address_Array), Loc)); Append_To (Result, Decl); *************** package body Exp_Disp is *** 5510,5519 **** else declare ! Prim_Table : array (Nat range 1 .. Nb_Prim) of Entity_Id; ! E : Entity_Id; ! Prim : Entity_Id; ! Prim_Elmt : Elmt_Id; begin Prim_Table := (others => Empty); --- 5604,5615 ---- else declare ! CPP_Nb_Prims : constant Nat := CPP_Num_Prims (Typ); ! E : Entity_Id; ! Prim : Entity_Id; ! Prim_Elmt : Elmt_Id; ! Prim_Pos : Nat; ! Prim_Table : array (Nat range 1 .. Nb_Prim) of Entity_Id; begin Prim_Table := (others => Empty); *************** package body Exp_Disp is *** 5525,5549 **** -- Retrieve the ultimate alias of the primitive for proper -- handling of renamings and eliminated primitives. ! E := Ultimate_Alias (Prim); ! if Is_Imported (Prim) ! or else Present (Interface_Alias (Prim)) ! or else Is_Predefined_Dispatching_Operation (Prim) ! or else Is_Eliminated (E) ! then ! null; ! else ! if not Is_Predefined_Dispatching_Operation (E) ! and then not Is_Abstract_Subprogram (E) ! and then not Present (Interface_Alias (E)) ! then ! pragma Assert ! (UI_To_Int (DT_Position (Prim)) <= Nb_Prim); ! Prim_Table (UI_To_Int (DT_Position (Prim))) := E; ! end if; end if; Next_Elmt (Prim_Elmt); --- 5621,5649 ---- -- Retrieve the ultimate alias of the primitive for proper -- handling of renamings and eliminated primitives. ! E := Ultimate_Alias (Prim); ! Prim_Pos := UI_To_Int (DT_Position (E)); ! -- Do not reference predefined primitives because they are ! -- located in a separate dispatch table; skip entities with ! -- attribute Interface_Alias because they are only required ! -- to build secondary dispatch tables; skip abstract and ! -- eliminated primitives; for derivations of CPP types skip ! -- primitives located in the C++ part of the dispatch table ! -- because their slot is initialized by the IC routine. ! if not Is_Predefined_Dispatching_Operation (Prim) ! and then not Is_Predefined_Dispatching_Operation (E) ! and then not Present (Interface_Alias (Prim)) ! and then not Is_Abstract_Subprogram (E) ! and then not Is_Eliminated (E) ! and then (not Is_CPP_Class (Root_Type (Typ)) ! or else Prim_Pos > CPP_Nb_Prims) ! then ! pragma Assert ! (UI_To_Int (DT_Position (Prim)) <= Nb_Prim); ! Prim_Table (UI_To_Int (DT_Position (Prim))) := E; end if; Next_Elmt (Prim_Elmt); *************** package body Exp_Disp is *** 5604,5620 **** Expression => Make_Aggregate (Loc, Expressions => DT_Aggr_List))); - -- Generate the SCIL node for the previous object declaration - -- because it contains a dispatch table. - - if Generate_SCIL then - New_Node := - Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result))); - Set_SCIL_Related_Node (New_Node, Last (Result)); - Set_SCIL_Entity (New_Node, Typ); - Insert_Before (Last (Result), New_Node); - end if; - Append_To (Result, Make_Attribute_Definition_Clause (Loc, Name => New_Reference_To (DT, Loc), --- 5704,5709 ---- *************** package body Exp_Disp is *** 5923,5929 **** -- a limited interface. Skip this step in Ravenscar profile or when -- general dispatching is forbidden. ! if Ada_Version >= Ada_05 and then Is_Concurrent_Record_Type (Typ) and then Has_Interfaces (Typ) and then not Restriction_Active (No_Dispatching_Calls) --- 6012,6018 ---- -- a limited interface. Skip this step in Ravenscar profile or when -- general dispatching is forbidden. ! if Ada_Version >= Ada_2005 and then Is_Concurrent_Record_Type (Typ) and then Has_Interfaces (Typ) and then not Restriction_Active (No_Dispatching_Calls) *************** package body Exp_Disp is *** 5944,5950 **** -- Mark entities containing dispatch tables. Required by the backend to -- handle them properly. ! if not Is_Interface (Typ) then declare Elmt : Elmt_Id; --- 6033,6039 ---- -- Mark entities containing dispatch tables. Required by the backend to -- handle them properly. ! if Has_DT (Typ) then declare Elmt : Elmt_Id; *************** package body Exp_Disp is *** 5976,5981 **** --- 6065,6074 ---- end; end if; + -- Register the tagged type in the call graph nodes table + + Register_CG_Node (Typ); + return Result; end Make_DT; *************** package body Exp_Disp is *** 6083,6088 **** --- 6176,6184 ---- -- Look for primitive overriding an abstract interface subprogram if Present (Interface_Alias (Prim)) + and then not + Is_Ancestor + (Find_Dispatching_Type (Interface_Alias (Prim)), Typ) and then not Examined (UI_To_Int (DT_Position (Alias (Prim)))) then Prim_Pos := DT_Position (Alias (Prim)); *************** package body Exp_Disp is *** 6103,6112 **** -- Retrieve the root of the alias chain ! Prim_Als := Prim; ! while Present (Alias (Prim_Als)) loop ! Prim_Als := Alias (Prim_Als); ! end loop; -- In the case of an entry wrapper, set the entry index --- 6199,6205 ---- -- Retrieve the root of the alias chain ! Prim_Als := Ultimate_Alias (Prim); -- In the case of an entry wrapper, set the entry index *************** package body Exp_Disp is *** 6152,6162 **** -- Import the dispatch table DT of tagged type Tag_Typ. Required to -- generate forward references and statically allocate the table. For -- primary dispatch tables that require no dispatch table generate: -- DT : static aliased constant Non_Dispatch_Table_Wrapper; ! -- $pragma import (ada, DT); -- Otherwise generate: -- DT : static aliased constant Dispatch_Table_Wrapper (Nb_Prim); ! -- $pragma import (ada, DT); --------------- -- Import_DT -- --- 6245,6258 ---- -- Import the dispatch table DT of tagged type Tag_Typ. Required to -- generate forward references and statically allocate the table. For -- primary dispatch tables that require no dispatch table generate: + -- DT : static aliased constant Non_Dispatch_Table_Wrapper; ! -- pragma Import (Ada, DT); ! -- Otherwise generate: + -- DT : static aliased constant Dispatch_Table_Wrapper (Nb_Prim); ! -- pragma Import (Ada, DT); --------------- -- Import_DT -- *************** package body Exp_Disp is *** 6181,6188 **** Get_External_Name (DT, True); Set_Interface_Name (DT, ! Make_String_Literal (Loc, ! Strval => String_From_Name_Buffer)); -- Ensure proper Sprint output of this implicit importation --- 6277,6283 ---- Get_External_Name (DT, True); Set_Interface_Name (DT, ! Make_String_Literal (Loc, Strval => String_From_Name_Buffer)); -- Ensure proper Sprint output of this implicit importation *************** package body Exp_Disp is *** 6194,6202 **** -- No dispatch table required ! if not Is_Secondary_DT ! and then not Has_DT (Tag_Typ) ! then Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => DT, --- 6289,6295 ---- -- No dispatch table required ! if not Is_Secondary_DT and then not Has_DT (Tag_Typ) then Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => DT, *************** package body Exp_Disp is *** 6212,6219 **** Nb_Prim := UI_To_Int (DT_Entry_Count (First_Tag_Component (Tag_Typ))); ! -- If the tagged type has no primitives we add a dummy slot ! -- whose address will be the tag of this type. if Nb_Prim = 0 then DT_Constr_List := --- 6305,6312 ---- Nb_Prim := UI_To_Int (DT_Entry_Count (First_Tag_Component (Tag_Typ))); ! -- If the tagged type has no primitives we add a dummy slot whose ! -- address will be the tag of this type. if Nb_Prim = 0 then DT_Constr_List := *************** package body Exp_Disp is *** 6241,6250 **** Tname : constant Name_Id := Chars (Typ); AI_Tag_Comp : Elmt_Id; ! DT : Node_Id; DT_Ptr : Node_Id; Predef_Prims_Ptr : Node_Id; ! Iface_DT : Node_Id; Iface_DT_Ptr : Node_Id; New_Node : Node_Id; Suffix_Index : Int; --- 6334,6343 ---- Tname : constant Name_Id := Chars (Typ); AI_Tag_Comp : Elmt_Id; ! DT : Node_Id := Empty; DT_Ptr : Node_Id; Predef_Prims_Ptr : Node_Id; ! Iface_DT : Node_Id := Empty; Iface_DT_Ptr : Node_Id; New_Node : Node_Id; Suffix_Index : Int; *************** package body Exp_Disp is *** 6254,6499 **** -- Start of processing for Make_Tags begin ! -- 1) Generate the primary and secondary tag entities ! ! -- Collect the components associated with secondary dispatch tables ! ! if Has_Interfaces (Typ) then ! Collect_Interface_Components (Typ, Typ_Comps); ! end if; -- 1) Generate the primary tag entities -- Primary dispatch table containing user-defined primitives ! DT_Ptr := Make_Defining_Identifier (Loc, ! New_External_Name (Tname, 'P')); ! Set_Etype (DT_Ptr, RTE (RE_Tag)); ! ! -- Primary dispatch table containing predefined primitives ! ! Predef_Prims_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Tname, 'Y')); ! Set_Etype (Predef_Prims_Ptr, RTE (RE_Address)); ! ! -- Import the forward declaration of the Dispatch Table wrapper record ! -- (Make_DT will take care of its exportation) ! if Building_Static_DT (Typ) then ! Set_Dispatch_Table_Wrappers (Typ, New_Elmt_List); ! DT := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Tname, 'T')); ! Import_DT (Typ, DT, Is_Secondary_DT => False); ! if Has_DT (Typ) then Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => DT_Ptr, - Constant_Present => True, Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), Expression => Unchecked_Convert_To (RTE (RE_Tag), ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_Prims_Ptr), Loc)), ! Attribute_Name => Name_Address)))); ! -- Generate the SCIL node for the previous object declaration ! -- because it has a tag initialization. ! if Generate_SCIL then ! New_Node := ! Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result))); ! Set_SCIL_Related_Node (New_Node, Last (Result)); ! Set_SCIL_Entity (New_Node, Typ); ! Insert_Before (Last (Result), New_Node); ! end if; ! Append_To (Result, ! Make_Object_Declaration (Loc, ! Defining_Identifier => Predef_Prims_Ptr, ! Constant_Present => True, ! Object_Definition => New_Reference_To ! (RTE (RE_Address), Loc), ! Expression => ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_Predef_Prims), Loc)), ! Attribute_Name => Name_Address))); ! -- No dispatch table required ! else ! Append_To (Result, ! Make_Object_Declaration (Loc, ! Defining_Identifier => DT_Ptr, ! Constant_Present => True, ! Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), ! Expression => ! Unchecked_Convert_To (RTE (RE_Tag), ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_NDT_Prims_Ptr), Loc)), ! Attribute_Name => Name_Address)))); ! -- Generate the SCIL node for the previous object declaration ! -- because it has a tag initialization. ! if Generate_SCIL then ! New_Node := ! Make_SCIL_Dispatch_Table_Object_Init (Sloc (Last (Result))); ! Set_SCIL_Related_Node (New_Node, Last (Result)); ! Set_SCIL_Entity (New_Node, Typ); ! Insert_Before (Last (Result), New_Node); end if; - end if; ! Set_Is_True_Constant (DT_Ptr); ! Set_Is_Statically_Allocated (DT_Ptr); end if; - pragma Assert (No (Access_Disp_Table (Typ))); - Set_Access_Disp_Table (Typ, New_Elmt_List); - Append_Elmt (DT_Ptr, Access_Disp_Table (Typ)); - Append_Elmt (Predef_Prims_Ptr, Access_Disp_Table (Typ)); - -- 2) Generate the secondary tag entities if Has_Interfaces (Typ) then ! -- Note: The following value of Suffix_Index must be in sync with ! -- the Suffix_Index values of secondary dispatch tables generated ! -- by Make_DT. Suffix_Index := 1; ! -- For each interface type we build an unique external name ! -- associated with its corresponding secondary dispatch table. ! -- This external name will be used to declare an object that ! -- references this secondary dispatch table, value that will be ! -- used for the elaboration of Typ's objects and also for the ! -- elaboration of objects of derivations of Typ that do not ! -- override the primitive operation of this interface type. ! AI_Tag_Comp := First_Elmt (Typ_Comps); ! while Present (AI_Tag_Comp) loop ! Get_Secondary_DT_External_Name ! (Typ, Related_Type (Node (AI_Tag_Comp)), Suffix_Index); ! Typ_Name := Name_Find; ! if Building_Static_DT (Typ) then ! Iface_DT := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name ! (Typ_Name, 'T', Suffix_Index => -1)); ! Import_DT ! (Tag_Typ => Related_Type (Node (AI_Tag_Comp)), ! DT => Iface_DT, ! Is_Secondary_DT => True); ! end if; ! -- Secondary dispatch table referencing thunks to user-defined ! -- primitives covered by this interface. ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'P')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Has_Thunks (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); - if Building_Static_DT (Typ) then Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => Iface_DT_Ptr, - Constant_Present => True, Object_Definition => New_Reference_To (RTE (RE_Interface_Tag), Loc), Expression => Unchecked_Convert_To (RTE (RE_Interface_Tag), ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (Iface_DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_Prims_Ptr), Loc)), ! Attribute_Name => Name_Address)))); ! end if; ! -- Secondary dispatch table referencing thunks to predefined ! -- primitives. ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'Y')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Address)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Has_Thunks (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! -- Secondary dispatch table referencing user-defined primitives ! -- covered by this interface. ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'D')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! -- Secondary dispatch table referencing predefined primitives ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'Z')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Address)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! Next_Elmt (AI_Tag_Comp); ! end loop; end if; -- 3) At the end of Access_Disp_Table, if the type has user-defined --- 6347,6643 ---- -- Start of processing for Make_Tags begin ! pragma Assert (No (Access_Disp_Table (Typ))); ! Set_Access_Disp_Table (Typ, New_Elmt_List); -- 1) Generate the primary tag entities -- Primary dispatch table containing user-defined primitives ! DT_Ptr := Make_Defining_Identifier (Loc, New_External_Name (Tname, 'P')); ! Set_Etype (DT_Ptr, RTE (RE_Tag)); ! Append_Elmt (DT_Ptr, Access_Disp_Table (Typ)); ! -- Minimum decoration ! Set_Ekind (DT_Ptr, E_Variable); ! Set_Related_Type (DT_Ptr, Typ); ! -- For CPP types there is no need to build the dispatch tables since ! -- they are imported from the C++ side. If the CPP type has an IP then ! -- we declare now the variable that will store the copy of the C++ tag. ! -- If the CPP type is an interface, we need the variable as well because ! -- it becomes the pointer to the corresponding secondary table. ! if Is_CPP_Class (Typ) then ! if Has_CPP_Constructors (Typ) or else Is_Interface (Typ) then Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => DT_Ptr, Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), Expression => Unchecked_Convert_To (RTE (RE_Tag), ! New_Reference_To (RTE (RE_Null_Address), Loc)))); ! Set_Is_Statically_Allocated (DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! end if; ! -- Ada types ! else ! -- Primary dispatch table containing predefined primitives ! Predef_Prims_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Tname, 'Y')); ! Set_Etype (Predef_Prims_Ptr, RTE (RE_Address)); ! Append_Elmt (Predef_Prims_Ptr, Access_Disp_Table (Typ)); ! -- Import the forward declaration of the Dispatch Table wrapper ! -- record (Make_DT will take care of exporting it). ! if Building_Static_DT (Typ) then ! Set_Dispatch_Table_Wrappers (Typ, New_Elmt_List); ! DT := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Tname, 'T')); ! ! Import_DT (Typ, DT, Is_Secondary_DT => False); ! ! if Has_DT (Typ) then ! Append_To (Result, ! Make_Object_Declaration (Loc, ! Defining_Identifier => DT_Ptr, ! Constant_Present => True, ! Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), ! Expression => ! Unchecked_Convert_To (RTE (RE_Tag), ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_Prims_Ptr), Loc)), ! Attribute_Name => Name_Address)))); ! ! -- Generate the SCIL node for the previous object declaration ! -- because it has a tag initialization. ! ! if Generate_SCIL then ! New_Node := ! Make_SCIL_Dispatch_Table_Tag_Init (Sloc (Last (Result))); ! Set_SCIL_Entity (New_Node, Typ); ! Set_SCIL_Node (Last (Result), New_Node); ! end if; ! ! Append_To (Result, ! Make_Object_Declaration (Loc, ! Defining_Identifier => Predef_Prims_Ptr, ! Constant_Present => True, ! Object_Definition => New_Reference_To ! (RTE (RE_Address), Loc), ! Expression => ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_Predef_Prims), Loc)), ! Attribute_Name => Name_Address))); ! ! -- No dispatch table required ! ! else ! Append_To (Result, ! Make_Object_Declaration (Loc, ! Defining_Identifier => DT_Ptr, ! Constant_Present => True, ! Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), ! Expression => ! Unchecked_Convert_To (RTE (RE_Tag), ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_NDT_Prims_Ptr), Loc)), ! Attribute_Name => Name_Address)))); end if; ! Set_Is_True_Constant (DT_Ptr); ! Set_Is_Statically_Allocated (DT_Ptr); ! end if; end if; -- 2) Generate the secondary tag entities + -- Collect the components associated with secondary dispatch tables + if Has_Interfaces (Typ) then + Collect_Interface_Components (Typ, Typ_Comps); ! -- For each interface type we build a unique external name associated ! -- with its secondary dispatch table. This name is used to declare an ! -- object that references this secondary dispatch table, whose value ! -- will be used for the elaboration of Typ objects, and also for the ! -- elaboration of objects of types derived from Typ that do not ! -- override the primitives of this interface type. Suffix_Index := 1; ! -- Note: The value of Suffix_Index must be in sync with the ! -- Suffix_Index values of secondary dispatch tables generated ! -- by Make_DT. ! if Is_CPP_Class (Typ) then ! AI_Tag_Comp := First_Elmt (Typ_Comps); ! while Present (AI_Tag_Comp) loop ! Get_Secondary_DT_External_Name ! (Typ, Related_Type (Node (AI_Tag_Comp)), Suffix_Index); ! Typ_Name := Name_Find; ! -- Declare variables that will store the copy of the C++ ! -- secondary tags. ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'P')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); ! Set_Ekind (Iface_DT_Ptr, E_Variable); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Has_Thunks (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => Iface_DT_Ptr, Object_Definition => New_Reference_To (RTE (RE_Interface_Tag), Loc), Expression => Unchecked_Convert_To (RTE (RE_Interface_Tag), ! New_Reference_To (RTE (RE_Null_Address), Loc)))); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Next_Elmt (AI_Tag_Comp); ! end loop; ! -- This is not a CPP_Class type ! else ! AI_Tag_Comp := First_Elmt (Typ_Comps); ! while Present (AI_Tag_Comp) loop ! Get_Secondary_DT_External_Name ! (Typ, Related_Type (Node (AI_Tag_Comp)), Suffix_Index); ! Typ_Name := Name_Find; ! if Building_Static_DT (Typ) then ! Iface_DT := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name ! (Typ_Name, 'T', Suffix_Index => -1)); ! Import_DT ! (Tag_Typ => Related_Type (Node (AI_Tag_Comp)), ! DT => Iface_DT, ! Is_Secondary_DT => True); ! end if; ! -- Secondary dispatch table referencing thunks to user-defined ! -- primitives covered by this interface. ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'P')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Has_Thunks (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! ! if Building_Static_DT (Typ) then ! Append_To (Result, ! Make_Object_Declaration (Loc, ! Defining_Identifier => Iface_DT_Ptr, ! Constant_Present => True, ! Object_Definition => New_Reference_To ! (RTE (RE_Interface_Tag), Loc), ! Expression => ! Unchecked_Convert_To (RTE (RE_Interface_Tag), ! Make_Attribute_Reference (Loc, ! Prefix => ! Make_Selected_Component (Loc, ! Prefix => New_Reference_To (Iface_DT, Loc), ! Selector_Name => ! New_Occurrence_Of ! (RTE_Record_Component (RE_Prims_Ptr), Loc)), ! Attribute_Name => Name_Address)))); ! end if; ! ! -- Secondary dispatch table referencing thunks to predefined ! -- primitives. ! ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'Y')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Address)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Has_Thunks (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! ! -- Secondary dispatch table referencing user-defined primitives ! -- covered by this interface. ! ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'D')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Interface_Tag)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! ! -- Secondary dispatch table referencing predefined primitives ! ! Iface_DT_Ptr := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Typ_Name, 'Z')); ! Set_Etype (Iface_DT_Ptr, RTE (RE_Address)); ! Set_Ekind (Iface_DT_Ptr, E_Constant); ! Set_Is_Tag (Iface_DT_Ptr); ! Set_Is_Statically_Allocated (Iface_DT_Ptr, ! Is_Library_Level_Tagged_Type (Typ)); ! Set_Is_True_Constant (Iface_DT_Ptr); ! Set_Related_Type ! (Iface_DT_Ptr, Related_Type (Node (AI_Tag_Comp))); ! Append_Elmt (Iface_DT_Ptr, Access_Disp_Table (Typ)); ! ! Next_Elmt (AI_Tag_Comp); ! end loop; ! end if; end if; -- 3) At the end of Access_Disp_Table, if the type has user-defined *************** package body Exp_Disp is *** 6555,6560 **** --- 6699,6719 ---- Analyze_List (Result); Set_Suppress_Init_Proc (Base_Type (DT_Prims)); + -- Disable backend optimizations based on assumptions about the + -- aliasing status of objects designated by the access to the + -- dispatch table. Required to handle dispatch tables imported + -- from C++. + + Set_No_Strict_Aliasing (Base_Type (DT_Prims_Acc)); + + -- Add the freezing nodes of these declarations; required to avoid + -- generating these freezing nodes in wrong scopes (for example in + -- the IC routine of a derivation of Typ). + -- What is an "IC routine"? Is "init_proc" meant here??? + + Append_List_To (Result, Freeze_Entity (DT_Prims, Typ)); + Append_List_To (Result, Freeze_Entity (DT_Prims_Acc, Typ)); + -- Mark entity of dispatch table. Required by the back end to -- handle them properly. *************** package body Exp_Disp is *** 6562,6568 **** end; end if; ! Set_Ekind (DT_Ptr, E_Constant); Set_Is_Tag (DT_Ptr); Set_Related_Type (DT_Ptr, Typ); --- 6721,6745 ---- end; end if; ! -- Mark entities of dispatch table. Required by the back end to handle ! -- them properly. ! ! if Present (DT) then ! Set_Is_Dispatch_Table_Entity (DT); ! Set_Is_Dispatch_Table_Entity (Etype (DT)); ! end if; ! ! if Present (Iface_DT) then ! Set_Is_Dispatch_Table_Entity (Iface_DT); ! Set_Is_Dispatch_Table_Entity (Etype (Iface_DT)); ! end if; ! ! if Is_CPP_Class (Root_Type (Typ)) then ! Set_Ekind (DT_Ptr, E_Variable); ! else ! Set_Ekind (DT_Ptr, E_Constant); ! end if; ! Set_Is_Tag (DT_Ptr); Set_Related_Type (DT_Ptr, Typ); *************** package body Exp_Disp is *** 6625,6634 **** begin -- Retrieve the original primitive operation ! Prim_Op := Prim; ! while Present (Alias (Prim_Op)) loop ! Prim_Op := Alias (Prim_Op); ! end loop; if Ekind (Typ) = E_Record_Type and then Present (Corresponding_Concurrent_Type (Typ)) --- 6802,6808 ---- begin -- Retrieve the original primitive operation ! Prim_Op := Ultimate_Alias (Prim); if Ekind (Typ) = E_Record_Type and then Present (Corresponding_Concurrent_Type (Typ)) *************** package body Exp_Disp is *** 6726,6732 **** begin pragma Assert (not Restriction_Active (No_Dispatching_Calls)); ! if not RTE_Available (RE_Tag) then return L; end if; --- 6900,6910 ---- begin pragma Assert (not Restriction_Active (No_Dispatching_Calls)); ! -- Do not register in the dispatch table eliminated primitives ! ! if not RTE_Available (RE_Tag) ! or else Is_Eliminated (Ultimate_Alias (Prim)) ! then return L; end if; *************** package body Exp_Disp is *** 6766,6782 **** else pragma Assert (Pos /= Uint_0 and then Pos <= DT_Entry_Count (Tag)); ! DT_Ptr := Node (First_Elmt (Access_Disp_Table (Tag_Typ))); ! Append_To (L, ! Build_Set_Prim_Op_Address (Loc, ! Typ => Tag_Typ, ! Tag_Node => New_Reference_To (DT_Ptr, Loc), ! Position => Pos, ! Address_Node => ! Unchecked_Convert_To (RTE (RE_Prim_Ptr), ! Make_Attribute_Reference (Loc, ! Prefix => New_Reference_To (Prim, Loc), ! Attribute_Name => Name_Unrestricted_Access)))); end if; -- Ada 2005 (AI-251): Primitive associated with an interface type --- 6944,6967 ---- else pragma Assert (Pos /= Uint_0 and then Pos <= DT_Entry_Count (Tag)); ! -- Skip registration of primitives located in the C++ part of the ! -- dispatch table. Their slot is set by the IC routine. ! ! if not Is_CPP_Class (Root_Type (Tag_Typ)) ! or else Pos > CPP_Num_Prims (Tag_Typ) ! then ! DT_Ptr := Node (First_Elmt (Access_Disp_Table (Tag_Typ))); ! Append_To (L, ! Build_Set_Prim_Op_Address (Loc, ! Typ => Tag_Typ, ! Tag_Node => New_Reference_To (DT_Ptr, Loc), ! Position => Pos, ! Address_Node => ! Unchecked_Convert_To (RTE (RE_Prim_Ptr), ! Make_Attribute_Reference (Loc, ! Prefix => New_Reference_To (Prim, Loc), ! Attribute_Name => Name_Unrestricted_Access)))); ! end if; end if; -- Ada 2005 (AI-251): Primitive associated with an interface type *************** package body Exp_Disp is *** 6791,6796 **** --- 6976,6998 ---- pragma Assert (Is_Interface (Iface_Typ)); + -- No action needed for interfaces that are ancestors of Typ because + -- their primitives are located in the primary dispatch table. + + if Is_Ancestor (Iface_Typ, Tag_Typ) then + return L; + + -- No action needed for primitives located in the C++ part of the + -- dispatch table. Their slot is set by the IC routine. + + elsif Is_CPP_Class (Root_Type (Tag_Typ)) + and then DT_Position (Alias (Prim)) <= CPP_Num_Prims (Tag_Typ) + and then not Is_Predefined_Dispatching_Operation (Prim) + and then not Is_Predefined_Dispatching_Alias (Prim) + then + return L; + end if; + Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code); if not Is_Ancestor (Iface_Typ, Tag_Typ) *************** package body Exp_Disp is *** 7125,7131 **** (Nkind (Parent (Typ)) = N_Private_Extension_Declaration and then Is_Generic_Type (Typ))) and then In_Open_Scopes (Scope (Etype (Typ))) ! and then Typ = Base_Type (Typ) then Handle_Inherited_Private_Subprograms (Typ); end if; --- 7327,7333 ---- (Nkind (Parent (Typ)) = N_Private_Extension_Declaration and then Is_Generic_Type (Typ))) and then In_Open_Scopes (Scope (Etype (Typ))) ! and then Is_Base_Type (Typ) then Handle_Inherited_Private_Subprograms (Typ); end if; *************** package body Exp_Disp is *** 7144,7155 **** Set_DT_Position (Prim, Default_Prim_Op_Position (Prim)); elsif Is_Predefined_Dispatching_Alias (Prim) then ! E := Alias (Prim); ! while Present (Alias (E)) loop ! E := Alias (E); ! end loop; ! ! Set_DT_Position (Prim, Default_Prim_Op_Position (E)); -- Overriding primitives of ancestor abstract interfaces --- 7346,7353 ---- Set_DT_Position (Prim, Default_Prim_Op_Position (Prim)); elsif Is_Predefined_Dispatching_Alias (Prim) then ! Set_DT_Position (Prim, ! Default_Prim_Op_Position (Ultimate_Alias (Prim))); -- Overriding primitives of ancestor abstract interfaces *************** package body Exp_Disp is *** 7191,7197 **** Next_Elmt (Prim_Elmt); end loop; ! -- Third stage: Fix the position of all the new primitives -- Entries associated with primitives covering interfaces -- are handled in a latter round. --- 7389,7395 ---- Next_Elmt (Prim_Elmt); end loop; ! -- Third stage: Fix the position of all the new primitives. -- Entries associated with primitives covering interfaces -- are handled in a latter round. *************** package body Exp_Disp is *** 7311,7327 **** Adjusted := True; end if; ! -- An abstract operation cannot be declared in the private part ! -- for a visible abstract type, because it could never be over- ! -- ridden. For explicit declarations this is checked at the ! -- point of declaration, but for inherited operations it must ! -- be done when building the dispatch table. -- Ada 2005 (AI-251): Primitives associated with interfaces are -- excluded from this check because interfaces must be visible in -- the public and private part (RM 7.3 (7.3/2)) ! if Is_Abstract_Type (Typ) and then Is_Abstract_Subprogram (Prim) and then Present (Alias (Prim)) and then not Is_Interface --- 7509,7529 ---- Adjusted := True; end if; ! -- An abstract operation cannot be declared in the private part for a ! -- visible abstract type, because it can't be overridden outside this ! -- package hierarchy. For explicit declarations this is checked at ! -- the point of declaration, but for inherited operations it must be ! -- done when building the dispatch table. -- Ada 2005 (AI-251): Primitives associated with interfaces are -- excluded from this check because interfaces must be visible in -- the public and private part (RM 7.3 (7.3/2)) ! -- We disable this check in CodePeer mode, to accommodate legacy ! -- Ada code. ! ! if not CodePeer_Mode ! and then Is_Abstract_Type (Typ) and then Is_Abstract_Subprogram (Prim) and then Present (Alias (Prim)) and then not Is_Interface *************** package body Exp_Disp is *** 7386,7399 **** -------------------------- procedure Set_CPP_Constructors (Typ : Entity_Id) is Loc : Source_Ptr; - Init : Entity_Id; E : Entity_Id; Found : Boolean := False; P : Node_Id; Parms : List_Id; begin -- Look for the constructor entities E := Next_Entity (Typ); --- 7588,7702 ---- -------------------------- procedure Set_CPP_Constructors (Typ : Entity_Id) is + + procedure Set_CPP_Constructors_Old (Typ : Entity_Id); + -- For backward compatibility this routine handles CPP constructors + -- of non-tagged types. + + procedure Set_CPP_Constructors_Old (Typ : Entity_Id) is + Loc : Source_Ptr; + Init : Entity_Id; + E : Entity_Id; + Found : Boolean := False; + P : Node_Id; + Parms : List_Id; + + begin + -- Look for the constructor entities + + E := Next_Entity (Typ); + while Present (E) loop + if Ekind (E) = E_Function + and then Is_Constructor (E) + then + -- Create the init procedure + + Found := True; + Loc := Sloc (E); + Init := Make_Defining_Identifier (Loc, + Make_Init_Proc_Name (Typ)); + Parms := + New_List ( + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, Name_X), + Parameter_Type => + New_Reference_To (Typ, Loc))); + + if Present (Parameter_Specifications (Parent (E))) then + P := First (Parameter_Specifications (Parent (E))); + while Present (P) loop + Append_To (Parms, + Make_Parameter_Specification (Loc, + Defining_Identifier => + Make_Defining_Identifier (Loc, + Chars (Defining_Identifier (P))), + Parameter_Type => + New_Copy_Tree (Parameter_Type (P)))); + Next (P); + end loop; + end if; + + Discard_Node ( + Make_Subprogram_Declaration (Loc, + Make_Procedure_Specification (Loc, + Defining_Unit_Name => Init, + Parameter_Specifications => Parms))); + + Set_Init_Proc (Typ, Init); + Set_Is_Imported (Init); + Set_Interface_Name (Init, Interface_Name (E)); + Set_Convention (Init, Convention_C); + Set_Is_Public (Init); + Set_Has_Completion (Init); + end if; + + Next_Entity (E); + end loop; + + -- If there are no constructors, mark the type as abstract since we + -- won't be able to declare objects of that type. + + if not Found then + Set_Is_Abstract_Type (Typ); + end if; + end Set_CPP_Constructors_Old; + + -- Local variables + Loc : Source_Ptr; E : Entity_Id; Found : Boolean := False; P : Node_Id; Parms : List_Id; + Constructor_Decl_Node : Node_Id; + Constructor_Id : Entity_Id; + Wrapper_Id : Entity_Id; + Wrapper_Body_Node : Node_Id; + Actuals : List_Id; + Body_Stmts : List_Id; + Init_Tags_List : List_Id; + begin + pragma Assert (Is_CPP_Class (Typ)); + + -- For backward compatibility the compiler accepts C++ classes + -- imported through non-tagged record types. In such case the + -- wrapper of the C++ constructor is useless because the _tag + -- component is not available. + + -- Example: + -- type Root is limited record ... + -- pragma Import (CPP, Root); + -- function New_Root return Root; + -- pragma CPP_Constructor (New_Root, ... ); + + if not Is_Tagged_Type (Typ) then + Set_CPP_Constructors_Old (Typ); + return; + end if; + -- Look for the constructor entities E := Next_Entity (Typ); *************** package body Exp_Disp is *** 7401,7416 **** if Ekind (E) = E_Function and then Is_Constructor (E) then - -- Create the init procedure - Found := True; Loc := Sloc (E); ! Init := Make_Defining_Identifier (Loc, Make_Init_Proc_Name (Typ)); Parms := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => ! Make_Defining_Identifier (Loc, Name_X), Parameter_Type => New_Reference_To (Typ, Loc))); --- 7704,7719 ---- if Ekind (E) = E_Function and then Is_Constructor (E) then Found := True; Loc := Sloc (E); ! ! -- Generate the declaration of the imported C++ constructor ! Parms := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => ! Make_Defining_Identifier (Loc, Name_uInit), Parameter_Type => New_Reference_To (Typ, Loc))); *************** package body Exp_Disp is *** 7427,7444 **** end loop; end if; ! Discard_Node ( Make_Subprogram_Declaration (Loc, Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Init, ! Parameter_Specifications => Parms))); ! Set_Init_Proc (Typ, Init); ! Set_Is_Imported (Init); ! Set_Interface_Name (Init, Interface_Name (E)); ! Set_Convention (Init, Convention_C); ! Set_Is_Public (Init); ! Set_Has_Completion (Init); end if; Next_Entity (E); --- 7730,7858 ---- end loop; end if; ! Constructor_Id := Make_Temporary (Loc, 'P'); ! ! Constructor_Decl_Node := Make_Subprogram_Declaration (Loc, Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Constructor_Id, ! Parameter_Specifications => Parms)); ! Set_Is_Imported (Constructor_Id); ! Set_Interface_Name (Constructor_Id, Interface_Name (E)); ! Set_Convention (Constructor_Id, Convention_C); ! Set_Is_Public (Constructor_Id); ! Set_Has_Completion (Constructor_Id); ! ! -- Build the wrapper of this constructor ! ! Parms := ! New_List ( ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, Name_uInit), ! Parameter_Type => ! New_Reference_To (Typ, Loc))); ! ! if Present (Parameter_Specifications (Parent (E))) then ! P := First (Parameter_Specifications (Parent (E))); ! while Present (P) loop ! Append_To (Parms, ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! Chars (Defining_Identifier (P))), ! Parameter_Type => New_Copy_Tree (Parameter_Type (P)))); ! Next (P); ! end loop; ! end if; ! ! Body_Stmts := New_List; ! ! -- Invoke the C++ constructor ! ! Actuals := New_List; ! ! P := First (Parms); ! while Present (P) loop ! Append_To (Actuals, ! New_Reference_To (Defining_Identifier (P), Loc)); ! Next (P); ! end loop; ! ! Append_To (Body_Stmts, ! Make_Procedure_Call_Statement (Loc, ! Name => New_Reference_To (Constructor_Id, Loc), ! Parameter_Associations => Actuals)); ! ! -- Initialize copies of C++ primary and secondary tags ! ! Init_Tags_List := New_List; ! ! declare ! Tag_Elmt : Elmt_Id; ! Tag_Comp : Node_Id; ! ! begin ! Tag_Elmt := First_Elmt (Access_Disp_Table (Typ)); ! Tag_Comp := First_Tag_Component (Typ); ! ! while Present (Tag_Elmt) ! and then Is_Tag (Node (Tag_Elmt)) ! loop ! -- Skip the following assertion with primary tags because ! -- Related_Type is not set on primary tag components ! ! pragma Assert (Tag_Comp = First_Tag_Component (Typ) ! or else Related_Type (Node (Tag_Elmt)) ! = Related_Type (Tag_Comp)); ! ! Append_To (Init_Tags_List, ! Make_Assignment_Statement (Loc, ! Name => ! New_Reference_To (Node (Tag_Elmt), Loc), ! Expression => ! Make_Selected_Component (Loc, ! Prefix => ! Make_Identifier (Loc, Name_uInit), ! Selector_Name => ! New_Reference_To (Tag_Comp, Loc)))); ! ! Tag_Comp := Next_Tag_Component (Tag_Comp); ! Next_Elmt (Tag_Elmt); ! end loop; ! end; ! ! Append_To (Body_Stmts, ! Make_If_Statement (Loc, ! Condition => ! Make_Op_Eq (Loc, ! Left_Opnd => ! New_Reference_To ! (Node (First_Elmt (Access_Disp_Table (Typ))), ! Loc), ! Right_Opnd => ! Unchecked_Convert_To (RTE (RE_Tag), ! New_Reference_To (RTE (RE_Null_Address), Loc))), ! Then_Statements => Init_Tags_List)); ! ! Wrapper_Id := Make_Defining_Identifier (Loc, ! Make_Init_Proc_Name (Typ)); ! ! Wrapper_Body_Node := ! Make_Subprogram_Body (Loc, ! Specification => ! Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Wrapper_Id, ! Parameter_Specifications => Parms), ! Declarations => New_List (Constructor_Decl_Node), ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => Body_Stmts, ! Exception_Handlers => No_List)); ! ! Discard_Node (Wrapper_Body_Node); ! Set_Init_Proc (Typ, Wrapper_Id); end if; Next_Entity (E); *************** package body Exp_Disp is *** 7450,7455 **** --- 7864,7880 ---- if not Found then Set_Is_Abstract_Type (Typ); end if; + + -- If the CPP type has constructors then it must import also the default + -- C++ constructor. It is required for default initialization of objects + -- of the type. It is also required to elaborate objects of Ada types + -- that are defined as derivations of this CPP type. + + if Has_CPP_Constructors (Typ) + and then No (Init_Proc (Typ)) + then + Error_Msg_N ("?default constructor must be imported from C++", Typ); + end if; end Set_CPP_Constructors; -------------------------- *************** package body Exp_Disp is *** 7579,7584 **** --- 8004,8020 ---- Write_Str ("(predefined) "); end if; + -- Prefix the name of the primitive with its corresponding tagged + -- type to facilitate seeing inherited primitives. + + if Present (Alias (Prim)) then + Write_Name + (Chars (Find_Dispatching_Type (Ultimate_Alias (Prim)))); + else + Write_Name (Chars (Typ)); + end if; + + Write_Str ("."); Write_Name (Chars (Prim)); -- Indicate if this primitive has an aliased primitive *************** package body Exp_Disp is *** 7588,7594 **** Write_Int (Int (Alias (Prim))); -- If the DTC_Entity attribute is already set we can also output ! -- the name of the interface covered by this primitive (if any) if Present (DTC_Entity (Alias (Prim))) and then Is_Interface (Scope (DTC_Entity (Alias (Prim)))) --- 8024,8030 ---- Write_Int (Int (Alias (Prim))); -- If the DTC_Entity attribute is already set we can also output ! -- the name of the interface covered by this primitive (if any). if Present (DTC_Entity (Alias (Prim))) and then Is_Interface (Scope (DTC_Entity (Alias (Prim)))) *************** package body Exp_Disp is *** 7599,7604 **** --- 8035,8045 ---- if Present (Interface_Alias (Prim)) then Write_Str (", AI_Alias of "); + + if Is_Null_Interface_Primitive (Interface_Alias (Prim)) then + Write_Str ("null primitive "); + end if; + Write_Name (Chars (Find_Dispatching_Type (Interface_Alias (Prim)))); Write_Char (':'); *************** package body Exp_Disp is *** 7634,7639 **** --- 8075,8086 ---- Write_Str (" (eliminated)"); end if; + if Is_Imported (Prim) + and then Convention (Prim) = Convention_CPP + then + Write_Str (" (C++)"); + end if; + Write_Eol; Next_Elmt (Elmt); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_disp.ads gcc-4.6.0/gcc/ada/exp_disp.ads *** gcc-4.5.2/gcc/ada/exp_disp.ads Wed Sep 16 12:25:44 2009 --- gcc-4.6.0/gcc/ada/exp_disp.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Disp is *** 186,191 **** --- 186,222 ---- -- bodies they are added to the end of the list of declarations of the -- package body. + function Convert_Tag_To_Interface + (Typ : Entity_Id; Expr : Node_Id) return Node_Id; + pragma Inline (Convert_Tag_To_Interface); + -- This function is used in class-wide interface conversions; the expanded + -- code generated to convert a tagged object to a class-wide interface type + -- involves referencing the tag component containing the secondary dispatch + -- table associated with the interface. Given the expression Expr that + -- references a tag component, we cannot generate an unchecked conversion + -- to leave the expression decorated with the class-wide interface type Typ + -- because an unchecked conversion cannot be seen as a no-op. An unchecked + -- conversion is conceptually a function call and therefore the RM allows + -- the backend to obtain a copy of the value of the actual object and store + -- it in some other place (like a register); in such case the interface + -- conversion is not equivalent to a displacement of the pointer to the + -- interface and any further displacement fails. Although the functionality + -- of this function is simple and could be done directly, the purpose of + -- this routine is to leave well documented in the sources these + -- occurrences. + + -- If Expr is an N_Selected_Component that references a tag generate: + -- type ityp is non null access Typ; + -- ityp!(Expr'Address).all + + -- if Expr is an N_Function_Call to Ada.Tags.Displace then generate: + -- type ityp is non null access Typ; + -- ityp!(Expr).all + + function CPP_Num_Prims (Typ : Entity_Id) return Nat; + -- Return the number of primitives of the C++ part of the dispatch table. + -- For types that are not derivations of CPP types return 0. + procedure Expand_Dispatching_Call (Call_Node : Node_Id); -- Expand the call to the operation through the dispatch table and perform -- the required tag checks when appropriate. For CPP types tag checks are *************** package Exp_Disp is *** 215,220 **** --- 246,254 ---- -- Otherwise they are set to the defining identifier and the subprogram -- body of the generated thunk. + function Has_CPP_Constructors (Typ : Entity_Id) return Boolean; + -- Returns true if the type has CPP constructors + function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean; -- Ada 2005 (AI-251): Determines if E is a predefined primitive operation *************** package Exp_Disp is *** 306,312 **** -- Ada 2005 (AI-345): Create and populate the auxiliary table in the TSD -- of Typ used for dispatching in asynchronous, conditional and timed -- selects. Generate code to set the primitive operation kinds and entry ! -- indices of primitive operations and primitive wrappers. function Make_Tags (Typ : Entity_Id) return List_Id; -- Generate the entities associated with the primary and secondary tags of --- 340,346 ---- -- Ada 2005 (AI-345): Create and populate the auxiliary table in the TSD -- of Typ used for dispatching in asynchronous, conditional and timed -- selects. Generate code to set the primitive operation kinds and entry ! -- indexes of primitive operations and primitive wrappers. function Make_Tags (Typ : Entity_Id) return List_Id; -- Generate the entities associated with the primary and secondary tags of diff -Nrcpad gcc-4.5.2/gcc/ada/exp_dist.adb gcc-4.6.0/gcc/ada/exp_dist.adb *** gcc-4.5.2/gcc/ada/exp_dist.adb Wed Jul 22 13:24:46 2009 --- gcc-4.6.0/gcc/ada/exp_dist.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Aux; use Sem_Aux; *** 41,46 **** --- 41,47 ---- with Sem_Cat; use Sem_Cat; with Sem_Ch3; use Sem_Ch3; with Sem_Ch8; use Sem_Ch8; + with Sem_Ch12; use Sem_Ch12; with Sem_Dist; use Sem_Dist; with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; *************** package body Exp_Dist is *** 225,233 **** -- 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); -- Add calling stubs to the declarative part function Could_Be_Asynchronous (Spec : Node_Id) return Boolean; --- 226,232 ---- -- 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); -- Add calling stubs to the declarative part function Could_Be_Asynchronous (Spec : Node_Id) return Boolean; *************** package body Exp_Dist is *** 915,941 **** -- since this require separate mechanisms ('Input is a function while -- 'Read is a procedure). --------------------------------------- -- Add_Calling_Stubs_To_Declarations -- --------------------------------------- ! procedure Add_Calling_Stubs_To_Declarations ! (Pkg_Spec : Node_Id; ! Decls : List_Id) ! is Current_Subprogram_Number : Int := First_RCI_Subprogram_Id; -- Subprogram id 0 is reserved for calls received from -- remote access-to-subprogram dereferences. ! Current_Declaration : Node_Id; ! Loc : constant Source_Ptr := Sloc (Pkg_Spec); ! RCI_Instantiation : Node_Id; ! Subp_Stubs : Node_Id; ! Subp_Str : String_Id; ! pragma Warnings (Off, Subp_Str); begin -- The first thing added is an instantiation of the generic package -- System.Partition_Interface.RCI_Locator with the name of this remote -- package. This will act as an interface with the name server to --- 914,1059 ---- -- since this require separate mechanisms ('Input is a function while -- 'Read is a procedure). + generic + with procedure Process_Subprogram_Declaration (Decl : Node_Id); + -- Generate calling or receiving stub for this subprogram declaration + + procedure Build_Package_Stubs (Pkg_Spec : Node_Id); + -- Recursively visit the given RCI Package_Specification, calling + -- Process_Subprogram_Declaration for each remote subprogram. + + ------------------------- + -- Build_Package_Stubs -- + ------------------------- + + procedure Build_Package_Stubs (Pkg_Spec : Node_Id) is + Decls : constant List_Id := Visible_Declarations (Pkg_Spec); + Decl : Node_Id; + + procedure Visit_Nested_Pkg (Nested_Pkg_Decl : Node_Id); + -- Recurse for the given nested package declaration + + ----------------------- + -- Visit_Nested_Spec -- + ----------------------- + + procedure Visit_Nested_Pkg (Nested_Pkg_Decl : Node_Id) is + Nested_Pkg_Spec : constant Node_Id := Specification (Nested_Pkg_Decl); + begin + Push_Scope (Scope_Of_Spec (Nested_Pkg_Spec)); + Build_Package_Stubs (Nested_Pkg_Spec); + Pop_Scope; + end Visit_Nested_Pkg; + + -- Start of processing for Build_Package_Stubs + + begin + Decl := First (Decls); + while Present (Decl) loop + case Nkind (Decl) is + when N_Subprogram_Declaration => + + -- Note: we test Comes_From_Source on Spec, not Decl, because + -- in the case of a subprogram instance, only the specification + -- (not the declaration) is marked as coming from source. + + if Comes_From_Source (Specification (Decl)) then + Process_Subprogram_Declaration (Decl); + end if; + + when N_Package_Declaration => + + -- Case of a nested package or package instantiation coming + -- from source. Note that the anonymous wrapper package for + -- subprogram instances is not flagged Is_Generic_Instance at + -- this point, so there is a distinct circuit to handle them + -- (see case N_Subprogram_Instantiation below). + + declare + Pkg_Ent : constant Entity_Id := + Defining_Unit_Name (Specification (Decl)); + begin + if Comes_From_Source (Decl) + or else + (Is_Generic_Instance (Pkg_Ent) + and then Comes_From_Source + (Get_Package_Instantiation_Node (Pkg_Ent))) + then + Visit_Nested_Pkg (Decl); + end if; + end; + + when N_Subprogram_Instantiation => + + -- The subprogram declaration for an instance of a generic + -- subprogram is wrapped in a package that does not come from + -- source, so we need to explicitly traverse it here. + + if Comes_From_Source (Decl) then + Visit_Nested_Pkg (Instance_Spec (Decl)); + end if; + + when others => + null; + end case; + Next (Decl); + end loop; + end Build_Package_Stubs; + --------------------------------------- -- Add_Calling_Stubs_To_Declarations -- --------------------------------------- ! procedure Add_Calling_Stubs_To_Declarations (Pkg_Spec : Node_Id) is ! Loc : constant Source_Ptr := Sloc (Pkg_Spec); ! Current_Subprogram_Number : Int := First_RCI_Subprogram_Id; -- Subprogram id 0 is reserved for calls received from -- remote access-to-subprogram dereferences. ! RCI_Instantiation : Node_Id; ! procedure Visit_Subprogram (Decl : Node_Id); ! -- Generate calling stub for one remote subprogram ! ! ---------------------- ! -- Visit_Subprogram -- ! ---------------------- ! ! procedure Visit_Subprogram (Decl : Node_Id) is ! Loc : constant Source_Ptr := Sloc (Decl); ! Spec : constant Node_Id := Specification (Decl); ! Subp_Stubs : Node_Id; ! ! Subp_Str : String_Id; ! pragma Warnings (Off, Subp_Str); ! ! begin ! Assign_Subprogram_Identifier ! (Defining_Unit_Name (Spec), Current_Subprogram_Number, Subp_Str); ! ! Subp_Stubs := ! Build_Subprogram_Calling_Stubs ! (Vis_Decl => Decl, ! Subp_Id => ! Build_Subprogram_Id (Loc, Defining_Unit_Name (Spec)), ! Asynchronous => ! Nkind (Spec) = N_Procedure_Specification ! and then Is_Asynchronous (Defining_Unit_Name (Spec))); ! ! Append_To (List_Containing (Decl), Subp_Stubs); ! Analyze (Subp_Stubs); ! ! Current_Subprogram_Number := Current_Subprogram_Number + 1; ! end Visit_Subprogram; ! ! procedure Visit_Spec is new Build_Package_Stubs (Visit_Subprogram); ! ! -- Start of processing for Add_Calling_Stubs_To_Declarations begin + Push_Scope (Scope_Of_Spec (Pkg_Spec)); + -- The first thing added is an instantiation of the generic package -- System.Partition_Interface.RCI_Locator with the name of this remote -- package. This will act as an interface with the name server to *************** package body Exp_Dist is *** 945,993 **** RCI_Instantiation := RCI_Package_Locator (Loc, Pkg_Spec); RCI_Cache := Defining_Unit_Name (RCI_Instantiation); ! Append_To (Decls, RCI_Instantiation); Analyze (RCI_Instantiation); -- For each subprogram declaration visible in the spec, we do build a -- body. We also increment a counter to assign a different Subprogram_Id ! -- to each subprograms. The receiving stubs processing do use the same -- mechanism and will thus assign the same Id and do the correct -- dispatching. Overload_Counter_Table.Reset; PolyORB_Support.Reserve_NamingContext_Methods; ! Current_Declaration := First (Visible_Declarations (Pkg_Spec)); ! while Present (Current_Declaration) loop ! if Nkind (Current_Declaration) = N_Subprogram_Declaration ! and then Comes_From_Source (Current_Declaration) ! then ! Assign_Subprogram_Identifier ! (Defining_Unit_Name (Specification (Current_Declaration)), ! Current_Subprogram_Number, ! Subp_Str); ! ! Subp_Stubs := ! Build_Subprogram_Calling_Stubs ( ! Vis_Decl => Current_Declaration, ! Subp_Id => ! Build_Subprogram_Id (Loc, ! Defining_Unit_Name (Specification (Current_Declaration))), ! Asynchronous => ! Nkind (Specification (Current_Declaration)) = ! N_Procedure_Specification ! and then ! Is_Asynchronous (Defining_Unit_Name (Specification ! (Current_Declaration)))); ! ! Append_To (Decls, Subp_Stubs); ! Analyze (Subp_Stubs); ! ! Current_Subprogram_Number := Current_Subprogram_Number + 1; ! end if; ! Next (Current_Declaration); ! end loop; end Add_Calling_Stubs_To_Declarations; ----------------------------- --- 1063,1083 ---- RCI_Instantiation := RCI_Package_Locator (Loc, Pkg_Spec); RCI_Cache := Defining_Unit_Name (RCI_Instantiation); ! Append_To (Visible_Declarations (Pkg_Spec), RCI_Instantiation); Analyze (RCI_Instantiation); -- For each subprogram declaration visible in the spec, we do build a -- body. We also increment a counter to assign a different Subprogram_Id ! -- to each subprogram. The receiving stubs processing uses the same -- mechanism and will thus assign the same Id and do the correct -- dispatching. Overload_Counter_Table.Reset; PolyORB_Support.Reserve_NamingContext_Methods; ! Visit_Spec (Pkg_Spec); ! Pop_Scope; end Add_Calling_Stubs_To_Declarations; ----------------------------- *************** package body Exp_Dist is *** 1293,1301 **** end if; if not Is_RAS then ! RPC_Receiver := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); Specific_Build_RPC_Receiver_Body (RPC_Receiver => RPC_Receiver, --- 1383,1389 ---- end if; if not Is_RAS then ! RPC_Receiver := Make_Temporary (Loc, 'P'); Specific_Build_RPC_Receiver_Body (RPC_Receiver => RPC_Receiver, *************** package body Exp_Dist is *** 1316,1328 **** end if; -- Build callers, receivers for every primitive operations and a RPC ! -- receiver for this type. ! if Present (Primitive_Operations (Designated_Type)) then Overload_Counter_Table.Reset; Current_Primitive_Elmt := ! First_Elmt (Primitive_Operations (Designated_Type)); while Current_Primitive_Elmt /= No_Elmt loop Current_Primitive := Node (Current_Primitive_Elmt); --- 1404,1420 ---- end if; -- Build callers, receivers for every primitive operations and a RPC ! -- receiver for this type. Note that we use Direct_Primitive_Operations, ! -- not Primitive_Operations, because we really want just the primitives ! -- of the tagged type itself, and in the case of a tagged synchronized ! -- type we do not want to get the primitives of the corresponding ! -- record type). ! if Present (Direct_Primitive_Operations (Designated_Type)) then Overload_Counter_Table.Reset; Current_Primitive_Elmt := ! First_Elmt (Direct_Primitive_Operations (Designated_Type)); while Current_Primitive_Elmt /= No_Elmt loop Current_Primitive := Node (Current_Primitive_Elmt); *************** package body Exp_Dist is *** 1338,1345 **** Is_TSS (Current_Primitive, TSS_Stream_Input) or else Is_TSS (Current_Primitive, TSS_Stream_Output) or else Is_TSS (Current_Primitive, TSS_Stream_Read) or else ! Is_TSS (Current_Primitive, TSS_Stream_Write) or else ! Is_Predefined_Interface_Primitive (Current_Primitive)) and then not Is_Hidden (Current_Primitive) then -- The first thing to do is build an up-to-date copy of the --- 1430,1438 ---- Is_TSS (Current_Primitive, TSS_Stream_Input) or else Is_TSS (Current_Primitive, TSS_Stream_Output) or else Is_TSS (Current_Primitive, TSS_Stream_Read) or else ! Is_TSS (Current_Primitive, TSS_Stream_Write) ! or else ! Is_Predefined_Interface_Primitive (Current_Primitive)) and then not Is_Hidden (Current_Primitive) then -- The first thing to do is build an up-to-date copy of the *************** package body Exp_Dist is *** 1348,1360 **** -- primitive may have been inherited, go back the alias chain -- until the real primitive has been found. ! Current_Primitive_Alias := Current_Primitive; ! while Present (Alias (Current_Primitive_Alias)) loop ! pragma Assert ! (Current_Primitive_Alias ! /= Alias (Current_Primitive_Alias)); ! Current_Primitive_Alias := Alias (Current_Primitive_Alias); ! end loop; -- Copy the spec from the original declaration for the purpose -- of declaring an overriding subprogram: we need to replace --- 1441,1447 ---- -- primitive may have been inherited, go back the alias chain -- until the real primitive has been found. ! Current_Primitive_Alias := Ultimate_Alias (Current_Primitive); -- Copy the spec from the original declaration for the purpose -- of declaring an overriding subprogram: we need to replace *************** package body Exp_Dist is *** 1421,1428 **** RACW_Type => Stub_Elements.RACW_Type, Parent_Primitive => Current_Primitive); ! Current_Receiver := Defining_Unit_Name ( ! Specification (Current_Receiver_Body)); Append_To (Body_Decls, Current_Receiver_Body); --- 1508,1515 ---- RACW_Type => Stub_Elements.RACW_Type, Parent_Primitive => Current_Primitive); ! Current_Receiver := ! Defining_Unit_Name (Specification (Current_Receiver_Body)); Append_To (Body_Decls, Current_Receiver_Body); *************** package body Exp_Dist is *** 1529,1537 **** Param_Assoc : constant List_Id := New_List; Stmts : constant List_Id := New_List; ! RAS_Parameter : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); Is_Function : constant Boolean := Nkind (Type_Def) = N_Access_Function_Definition; --- 1616,1622 ---- Param_Assoc : constant List_Id := New_List; Stmts : constant List_Id := New_List; ! RAS_Parameter : constant Entity_Id := Make_Temporary (Loc, 'P'); Is_Function : constant Boolean := Nkind (Type_Def) = N_Access_Function_Definition; *************** package body Exp_Dist is *** 1897,1904 **** end if; Existing := False; ! Stub_Type := ! Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('S')); Set_Ekind (Stub_Type, E_Record_Type); Set_Is_RACW_Stub_Type (Stub_Type); Stub_Type_Access := --- 1982,1988 ---- end if; Existing := False; ! Stub_Type := Make_Temporary (Loc, 'S'); Set_Ekind (Stub_Type, E_Record_Type); Set_Is_RACW_Stub_Type (Stub_Type); Stub_Type_Access := *************** package body Exp_Dist is *** 2058,2065 **** declare Constant_Object : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('P')); begin Set_Defining_Identifier (Last (Decls), Constant_Object); --- 2142,2149 ---- declare Constant_Object : constant Entity_Id := ! Make_Temporary (Loc, 'P'); ! begin Set_Defining_Identifier (Last (Decls), Constant_Object); *************** package body Exp_Dist is *** 2429,2437 **** -- Start of processing for Build_Subprogram_Calling_Stubs begin ! Subp_Spec := Copy_Specification (Loc, ! Spec => Specification (Vis_Decl), ! New_Name => New_Name); if Locator = Empty then RCI_Locator := RCI_Cache; --- 2513,2522 ---- -- Start of processing for Build_Subprogram_Calling_Stubs begin ! Subp_Spec := ! Copy_Specification (Loc, ! Spec => Specification (Vis_Decl), ! New_Name => New_Name); if Locator = Empty then RCI_Locator := RCI_Cache; *************** package body Exp_Dist is *** 2822,2833 **** procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id) is Spec : constant Node_Id := Specification (Unit_Node); - Decls : constant List_Id := Visible_Declarations (Spec); begin ! Push_Scope (Scope_Of_Spec (Spec)); ! Add_Calling_Stubs_To_Declarations ! (Specification (Unit_Node), Decls); ! Pop_Scope; end Expand_Calling_Stubs_Bodies; ----------------------------------- --- 2907,2914 ---- procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id) is Spec : constant Node_Id := Specification (Unit_Node); begin ! Add_Calling_Stubs_To_Declarations (Spec); end Expand_Calling_Stubs_Bodies; ----------------------------------- *************** package body Exp_Dist is *** 3019,3027 **** Remote_Statements : List_Id; -- Various parts of the procedure ! Pnam : constant Entity_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('R')); Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); pragma Assert (Present (Asynchronous_Flag)); --- 3100,3106 ---- Remote_Statements : List_Id; -- Various parts of the procedure ! Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); pragma Assert (Present (Asynchronous_Flag)); *************** package body Exp_Dist is *** 3063,3078 **** -- 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 --- 3142,3152 ---- -- Prepare local identifiers ! Source_Partition := Make_Temporary (Loc, 'P'); ! Source_Receiver := Make_Temporary (Loc, 'S'); ! Source_Address := Make_Temporary (Loc, 'P'); ! Local_Stub := Make_Temporary (Loc, 'L'); ! Stubbed_Result := Make_Temporary (Loc, 'S'); -- Generate object declarations *************** package body Exp_Dist is *** 3274,3281 **** Remote_Statements : List_Id; Null_Statements : List_Id; ! Pnam : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); begin Build_Stream_Procedure --- 3348,3354 ---- Remote_Statements : List_Id; Null_Statements : List_Id; ! Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); begin Build_Stream_Procedure *************** package body Exp_Dist is *** 3455,3479 **** Proc_Decls : List_Id; Proc_Statements : List_Id; ! Origin : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); -- Additional local variables for the local case ! Proxy_Addr : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); -- Additional local variables for the remote case ! Local_Stub : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); ! ! Stub_Ptr : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); function Set_Field (Field_Name : Name_Id; --- 3528,3543 ---- Proc_Decls : List_Id; Proc_Statements : List_Id; ! Origin : constant Entity_Id := Make_Temporary (Loc, 'P'); -- Additional local variables for the local case ! Proxy_Addr : constant Entity_Id := Make_Temporary (Loc, 'P'); -- Additional local variables for the remote case ! Local_Stub : constant Entity_Id := Make_Temporary (Loc, 'L'); ! Stub_Ptr : constant Entity_Id := Make_Temporary (Loc, 'S'); function Set_Field (Field_Name : Name_Id; *************** package body Exp_Dist is *** 3699,3730 **** Request_Parameter : Node_Id; Pkg_RPC_Receiver : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('H')); Pkg_RPC_Receiver_Statements : List_Id; Pkg_RPC_Receiver_Cases : constant List_Id := New_List; Pkg_RPC_Receiver_Body : Node_Id; -- A Pkg_RPC_Receiver is built to decode the request ! Lookup_RAS_Info : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); ! -- A remote subprogram is created to allow peers to look up ! -- RAS information using subprogram ids. Subp_Id : Entity_Id; Subp_Index : Entity_Id; -- Subprogram_Id as read from the incoming stream ! Current_Declaration : Node_Id; ! Current_Subprogram_Number : Int := First_RCI_Subprogram_Id; ! Current_Stubs : Node_Id; ! ! Subp_Info_Array : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('I')); ! Subp_Info_List : constant List_Id := New_List; Register_Pkg_Actuals : constant List_Id := New_List; --- 3763,3788 ---- Request_Parameter : Node_Id; Pkg_RPC_Receiver : constant Entity_Id := ! Make_Temporary (Loc, 'H'); Pkg_RPC_Receiver_Statements : List_Id; Pkg_RPC_Receiver_Cases : constant List_Id := New_List; Pkg_RPC_Receiver_Body : Node_Id; -- A Pkg_RPC_Receiver is built to decode the request ! Lookup_RAS : Node_Id; ! Lookup_RAS_Info : constant Entity_Id := Make_Temporary (Loc, 'R'); ! -- A remote subprogram is created to allow peers to look up RAS ! -- information using subprogram ids. Subp_Id : Entity_Id; Subp_Index : Entity_Id; -- Subprogram_Id as read from the incoming stream ! Current_Subp_Number : Int := First_RCI_Subprogram_Id; ! Current_Stubs : Node_Id; ! Subp_Info_Array : constant Entity_Id := Make_Temporary (Loc, 'I'); ! Subp_Info_List : constant List_Id := New_List; Register_Pkg_Actuals : constant List_Id := New_List; *************** package body Exp_Dist is *** 3739,3744 **** --- 3797,3805 ---- -- associating Subprogram_Number with the subprogram declared -- by Declaration, for which we have receiving stubs in Stubs. + procedure Visit_Subprogram (Decl : Node_Id); + -- Generate receiving stub for one remote subprogram + --------------------- -- Append_Stubs_To -- --------------------- *************** package body Exp_Dist is *** 3762,3767 **** --- 3823,3898 ---- New_Occurrence_Of (Request_Parameter, Loc)))))); end Append_Stubs_To; + ---------------------- + -- Visit_Subprogram -- + ---------------------- + + procedure Visit_Subprogram (Decl : Node_Id) is + Loc : constant Source_Ptr := Sloc (Decl); + Spec : constant Node_Id := Specification (Decl); + Subp_Def : constant Entity_Id := Defining_Unit_Name (Spec); + + Subp_Val : String_Id; + pragma Warnings (Off, Subp_Val); + + begin + -- Build receiving stub + + Current_Stubs := + Build_Subprogram_Receiving_Stubs + (Vis_Decl => Decl, + Asynchronous => + Nkind (Spec) = N_Procedure_Specification + and then Is_Asynchronous (Subp_Def)); + + Append_To (Decls, Current_Stubs); + Analyze (Current_Stubs); + + -- Build RAS proxy + + Add_RAS_Proxy_And_Analyze (Decls, + Vis_Decl => Decl, + All_Calls_Remote_E => All_Calls_Remote_E, + Proxy_Object_Addr => Proxy_Object_Addr); + + -- Compute distribution identifier + + Assign_Subprogram_Identifier + (Subp_Def, Current_Subp_Number, Subp_Val); + + pragma Assert (Current_Subp_Number = Get_Subprogram_Id (Subp_Def)); + + -- Add subprogram descriptor (RCI_Subp_Info) to the subprograms + -- table for this receiver. This aggregate must be kept consistent + -- with the declaration of RCI_Subp_Info in + -- System.Partition_Interface. + + Append_To (Subp_Info_List, + Make_Component_Association (Loc, + Choices => New_List ( + Make_Integer_Literal (Loc, Current_Subp_Number)), + + Expression => + Make_Aggregate (Loc, + Component_Associations => New_List ( + + -- Addr => + + Make_Component_Association (Loc, + Choices => + New_List (Make_Identifier (Loc, Name_Addr)), + Expression => + New_Occurrence_Of (Proxy_Object_Addr, Loc)))))); + + Append_Stubs_To (Pkg_RPC_Receiver_Cases, + Stubs => Current_Stubs, + Subprogram_Number => Current_Subp_Number); + + Current_Subp_Number := Current_Subp_Number + 1; + end Visit_Subprogram; + + procedure Visit_Spec is new Build_Package_Stubs (Visit_Subprogram); + -- Start of processing for Add_Receiving_Stubs_To_Declarations begin *************** package body Exp_Dist is *** 3821,3832 **** Prefix => Request_Parameter, Selector_Name => Name_Params))))), ! Selector_Name => ! Make_Identifier (Loc, Name_Subp_Id)))))); -- Build a subprogram for RAS information lookups ! Current_Declaration := Make_Subprogram_Declaration (Loc, Specification => Make_Function_Specification (Loc, --- 3952,3962 ---- Prefix => Request_Parameter, Selector_Name => Name_Params))))), ! Selector_Name => Make_Identifier (Loc, Name_Subp_Id)))))); -- Build a subprogram for RAS information lookups ! Lookup_RAS := Make_Subprogram_Declaration (Loc, Specification => Make_Function_Specification (Loc, *************** package body Exp_Dist is *** 3842,3860 **** New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc))), Result_Definition => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc))); ! ! Append_To (Decls, Current_Declaration); ! Analyze (Current_Declaration); Current_Stubs := Build_Subprogram_Receiving_Stubs ! (Vis_Decl => Current_Declaration, Asynchronous => False); Append_To (Decls, Current_Stubs); Analyze (Current_Stubs); Append_Stubs_To (Pkg_RPC_Receiver_Cases, ! Stubs => ! Current_Stubs, Subprogram_Number => 1); -- For each subprogram, the receiving stub will be built and a --- 3972,3988 ---- New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc))), Result_Definition => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc))); ! Append_To (Decls, Lookup_RAS); ! Analyze (Lookup_RAS); Current_Stubs := Build_Subprogram_Receiving_Stubs ! (Vis_Decl => Lookup_RAS, Asynchronous => False); Append_To (Decls, Current_Stubs); Analyze (Current_Stubs); Append_Stubs_To (Pkg_RPC_Receiver_Cases, ! Stubs => Current_Stubs, Subprogram_Number => 1); -- For each subprogram, the receiving stub will be built and a *************** package body Exp_Dist is *** 3867,3951 **** Overload_Counter_Table.Reset; ! Current_Declaration := First (Visible_Declarations (Pkg_Spec)); ! while Present (Current_Declaration) loop ! if Nkind (Current_Declaration) = N_Subprogram_Declaration ! and then Comes_From_Source (Current_Declaration) ! then ! declare ! Loc : constant Source_Ptr := Sloc (Current_Declaration); ! -- While specifically processing Current_Declaration, use ! -- its Sloc as the location of all generated nodes. ! ! Subp_Def : constant Entity_Id := ! Defining_Unit_Name ! (Specification (Current_Declaration)); ! ! Subp_Val : String_Id; ! pragma Warnings (Off, Subp_Val); ! ! begin ! -- Build receiving stub ! ! Current_Stubs := ! Build_Subprogram_Receiving_Stubs ! (Vis_Decl => Current_Declaration, ! Asynchronous => ! Nkind (Specification (Current_Declaration)) = ! N_Procedure_Specification ! and then Is_Asynchronous (Subp_Def)); ! ! Append_To (Decls, Current_Stubs); ! Analyze (Current_Stubs); ! ! -- Build RAS proxy ! ! Add_RAS_Proxy_And_Analyze (Decls, ! Vis_Decl => Current_Declaration, ! All_Calls_Remote_E => All_Calls_Remote_E, ! Proxy_Object_Addr => Proxy_Object_Addr); ! ! -- Compute distribution identifier ! ! Assign_Subprogram_Identifier ! (Subp_Def, ! Current_Subprogram_Number, ! Subp_Val); ! ! pragma Assert ! (Current_Subprogram_Number = Get_Subprogram_Id (Subp_Def)); ! ! -- Add subprogram descriptor (RCI_Subp_Info) to the ! -- subprograms table for this receiver. The aggregate ! -- below must be kept consistent with the declaration ! -- of type RCI_Subp_Info in System.Partition_Interface. ! ! Append_To (Subp_Info_List, ! Make_Component_Association (Loc, ! Choices => New_List ( ! Make_Integer_Literal (Loc, ! Current_Subprogram_Number)), ! ! Expression => ! Make_Aggregate (Loc, ! Component_Associations => New_List ( ! Make_Component_Association (Loc, ! Choices => New_List ( ! Make_Identifier (Loc, Name_Addr)), ! Expression => ! New_Occurrence_Of ( ! Proxy_Object_Addr, Loc)))))); ! ! Append_Stubs_To (Pkg_RPC_Receiver_Cases, ! Stubs => Current_Stubs, ! Subprogram_Number => Current_Subprogram_Number); ! end; ! ! Current_Subprogram_Number := Current_Subprogram_Number + 1; ! end if; ! ! Next (Current_Declaration); ! end loop; -- If we receive an invalid Subprogram_Id, it is best to do nothing -- rather than raising an exception since we do not want someone --- 3995,4001 ---- Overload_Counter_Table.Reset; ! Visit_Spec (Pkg_Spec); -- If we receive an invalid Subprogram_Id, it is best to do nothing -- rather than raising an exception since we do not want someone *************** package body Exp_Dist is *** 4165,4172 **** -- well as the declaration of Result. For a function call, 'Input is -- always used to read the result even if it is constrained. ! Stream_Parameter := ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')); Append_To (Decls, Make_Object_Declaration (Loc, --- 4215,4221 ---- -- well as the declaration of Result. For a function call, 'Input is -- always used to read the result even if it is constrained. ! Stream_Parameter := Make_Temporary (Loc, 'S'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 4182,4189 **** New_List (Make_Integer_Literal (Loc, 0)))))); if not Is_Known_Asynchronous then ! Result_Parameter := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Append_To (Decls, Make_Object_Declaration (Loc, --- 4231,4237 ---- New_List (Make_Integer_Literal (Loc, 0)))))); if not Is_Known_Asynchronous then ! Result_Parameter := Make_Temporary (Loc, 'R'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 4198,4205 **** Constraints => New_List (Make_Integer_Literal (Loc, 0)))))); ! Exception_Return_Parameter := ! Make_Defining_Identifier (Loc, New_Internal_Name ('E')); Append_To (Decls, Make_Object_Declaration (Loc, --- 4246,4252 ---- Constraints => New_List (Make_Integer_Literal (Loc, 0)))))); ! Exception_Return_Parameter := Make_Temporary (Loc, 'E'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 4318,4325 **** -- type and push it in the stream after the regular -- parameters. ! Extra_Parameter := Make_Defining_Identifier ! (Loc, New_Internal_Name ('P')); Append_To (Decls, Make_Object_Declaration (Loc, --- 4365,4371 ---- -- type and push it in the stream after the regular -- parameters. ! Extra_Parameter := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 4556,4562 **** (RPC_Receiver => RPC_Receiver, Request_Parameter => Request); ! Subp_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Subp_Index := Subp_Id; -- Subp_Id may not be a constant, because in the case of the RPC --- 4602,4608 ---- (RPC_Receiver => RPC_Receiver, Request_Parameter => Request); ! Subp_Id := Make_Temporary (Loc, 'P'); Subp_Index := Subp_Id; -- Subp_Id may not be a constant, because in the case of the RPC *************** package body Exp_Dist is *** 4600,4608 **** Controlling_Parameter : Entity_Id) return RPC_Target is Target_Info : RPC_Target (PCS_Kind => Name_GARLIC_DSA); begin ! Target_Info.Partition := ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')); if Present (Controlling_Parameter) then Append_To (Decls, Make_Object_Declaration (Loc, --- 4646,4655 ---- Controlling_Parameter : Entity_Id) return RPC_Target is Target_Info : RPC_Target (PCS_Kind => Name_GARLIC_DSA); + begin ! Target_Info.Partition := Make_Temporary (Loc, 'P'); ! if Present (Controlling_Parameter) then Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 4707,4716 **** begin RPC_Receiver_Decl := Make_Subprogram_Declaration (Loc, ! Build_RPC_Receiver_Specification ( ! RPC_Receiver => Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')), ! Request_Parameter => RPC_Receiver_Request)); end; end if; end Build_Stub_Type; --- 4754,4762 ---- begin RPC_Receiver_Decl := Make_Subprogram_Declaration (Loc, ! Build_RPC_Receiver_Specification ! (RPC_Receiver => Make_Temporary (Loc, 'R'), ! Request_Parameter => RPC_Receiver_Request)); end; end if; end Build_Stub_Type; *************** package body Exp_Dist is *** 4729,4737 **** is Loc : constant Source_Ptr := Sloc (Vis_Decl); ! Request_Parameter : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); -- Formal parameter for receiving stubs: a descriptor for an incoming -- request. --- 4775,4781 ---- is Loc : constant Source_Ptr := Sloc (Vis_Decl); ! Request_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R'); -- Formal parameter for receiving stubs: a descriptor for an incoming -- request. *************** package body Exp_Dist is *** 4784,4791 **** end if; if Dynamically_Asynchronous then ! Dynamic_Async := ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')); else Dynamic_Async := Empty; end if; --- 4828,4834 ---- end if; if Dynamically_Asynchronous then ! Dynamic_Async := Make_Temporary (Loc, 'S'); else Dynamic_Async := Empty; end if; *************** package body Exp_Dist is *** 4830,4838 **** Need_Extra_Constrained : Boolean; -- True when an Extra_Constrained actual is required ! Object : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('P')); Expr : Node_Id := Empty; --- 4873,4879 ---- Need_Extra_Constrained : Boolean; -- True when an Extra_Constrained actual is required ! Object : constant Entity_Id := Make_Temporary (Loc, 'P'); Expr : Node_Id := Empty; *************** package body Exp_Dist is *** 5051,5059 **** declare Etyp : constant Entity_Id := Etype (Result_Definition (Specification (Vis_Decl))); ! Result : constant Node_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); begin Inner_Decls := New_List ( Make_Object_Declaration (Loc, --- 5092,5099 ---- declare Etyp : constant Entity_Id := Etype (Result_Definition (Specification (Vis_Decl))); ! Result : constant Node_Id := Make_Temporary (Loc, 'R'); ! begin Inner_Decls := New_List ( Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 5139,5146 **** -- exception occurrence is copied into the output stream and -- no other output parameter is written. ! Excep_Choice := ! Make_Defining_Identifier (Loc, New_Internal_Name ('E')); Excep_Code := New_List ( Make_Attribute_Reference (Loc, --- 5179,5185 ---- -- exception occurrence is copied into the output stream and -- no other output parameter is written. ! Excep_Choice := Make_Temporary (Loc, 'E'); Excep_Code := New_List ( Make_Attribute_Reference (Loc, *************** package body Exp_Dist is *** 5171,5178 **** Subp_Spec := Make_Procedure_Specification (Loc, ! Defining_Unit_Name => ! Make_Defining_Identifier (Loc, New_Internal_Name ('F')), Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, --- 5210,5216 ---- Subp_Spec := Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Make_Temporary (Loc, 'F'), Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, *************** package body Exp_Dist is *** 5308,5317 **** begin return Make_Subprogram_Body (Loc, ! Specification => Make_Function_Specification (Loc, ! Defining_Unit_Name => ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')), ! Result_Definition => New_Occurrence_Of (Var_Type, Loc)), Declarations => No_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, New_List ( --- 5346,5355 ---- begin return Make_Subprogram_Body (Loc, ! Specification => ! Make_Function_Specification (Loc, ! Defining_Unit_Name => Make_Temporary (Loc, 'S'), ! Result_Definition => New_Occurrence_Of (Var_Type, Loc)), Declarations => No_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, New_List ( *************** package body Exp_Dist is *** 5394,5401 **** -------------------- function Make_Tag_Check (Loc : Source_Ptr; N : Node_Id) return Node_Id is ! Occ : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('E')); begin return Make_Block_Statement (Loc, --- 5432,5438 ---- -------------------- function Make_Tag_Check (Loc : Source_Ptr; N : Node_Id) return Node_Id is ! Occ : constant Entity_Id := Make_Temporary (Loc, 'E'); begin return Make_Block_Statement (Loc, *************** package body Exp_Dist is *** 5587,5593 **** -- Name Make_String_Literal (Loc, ! Full_Qualified_Name (Desig)), -- Handler --- 5624,5630 ---- -- Name Make_String_Literal (Loc, ! Fully_Qualified_Name_String (Desig)), -- Handler *************** package body Exp_Dist is *** 5762,5769 **** Make_Defining_Identifier (Loc, Name_R); -- Various parts of the procedure ! Pnam : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); --- 5799,5805 ---- Make_Defining_Identifier (Loc, Name_R); -- Various parts of the procedure ! Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); *************** package body Exp_Dist is *** 5882,5891 **** RACW_Parameter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_R); ! Reference : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); ! Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); begin Func_Spec := --- 5918,5925 ---- RACW_Parameter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_R); ! Reference : constant Entity_Id := Make_Temporary (Loc, 'R'); ! Any : constant Entity_Id := Make_Temporary (Loc, 'A'); begin Func_Spec := *************** package body Exp_Dist is *** 5936,5942 **** Unchecked_Convert_To (RTE (RE_Address), New_Occurrence_Of (RACW_Parameter, Loc)), Make_String_Literal (Loc, ! Strval => Full_Qualified_Name (Etype (Designated_Type (RACW_Type)))), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), --- 5970,5976 ---- Unchecked_Convert_To (RTE (RE_Address), New_Occurrence_Of (RACW_Parameter, Loc)), Make_String_Literal (Loc, ! Strval => Fully_Qualified_Name_String (Etype (Designated_Type (RACW_Type)))), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), *************** package body Exp_Dist is *** 6074,6081 **** Attr_Decl : Node_Id; 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; --- 6108,6114 ---- Attr_Decl : Node_Id; Statements : constant List_Id := New_List; ! Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); function Stream_Parameter return Node_Id; function Object return Node_Id; *************** package body Exp_Dist is *** 6133,6139 **** Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Address), Object), Make_String_Literal (Loc, ! Strval => Full_Qualified_Name (Etype (Designated_Type (RACW_Type)))), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), --- 6166,6172 ---- Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Address), Object), Make_String_Literal (Loc, ! Strval => Fully_Qualified_Name_String (Etype (Designated_Type (RACW_Type)))), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), *************** package body Exp_Dist is *** 6233,6248 **** Make_Defining_Identifier (Loc, Name_A); -- For the call to Get_Local_Address -- Additional local variables for the remote case - Local_Stub : constant Entity_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('L')); - - Stub_Ptr : constant Entity_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('S')); - function Set_Field (Field_Name : Name_Id; Value : Node_Id) return Node_Id; --- 6266,6275 ---- Make_Defining_Identifier (Loc, Name_A); -- For the call to Get_Local_Address + Local_Stub : constant Entity_Id := Make_Temporary (Loc, 'L'); + Stub_Ptr : constant Entity_Id := Make_Temporary (Loc, 'S'); -- Additional local variables for the remote case function Set_Field (Field_Name : Name_Id; Value : Node_Id) return Node_Id; *************** package body Exp_Dist is *** 6512,6519 **** Make_Aggregate (Loc, Component_Associations => New_List ( Make_Component_Association (Loc, ! Choices => New_List ( ! Make_Identifier (Loc, Name_Ras)), Expression => PolyORB_Support.Helpers.Build_From_Any_Call ( Underlying_RACW_Type (RAS_Type), --- 6539,6545 ---- Make_Aggregate (Loc, Component_Associations => New_List ( Make_Component_Association (Loc, ! Choices => New_List (Make_Identifier (Loc, Name_Ras)), Expression => PolyORB_Support.Helpers.Build_From_Any_Call ( Underlying_RACW_Type (RAS_Type), *************** package body Exp_Dist is *** 6554,6565 **** Func_Spec : Node_Id; ! Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); ! RAS_Parameter : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); RACW_Parameter : constant Node_Id := Make_Selected_Component (Loc, Prefix => RAS_Parameter, --- 6580,6587 ---- Func_Spec : Node_Id; ! Any : constant Entity_Id := Make_Temporary (Loc, 'A'); ! RAS_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R'); RACW_Parameter : constant Node_Id := Make_Selected_Component (Loc, Prefix => RAS_Parameter, *************** package body Exp_Dist is *** 6675,6682 **** Loc : constant Source_Ptr := Sloc (Pkg_Spec); Pkg_RPC_Receiver : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('H')); Pkg_RPC_Receiver_Object : Node_Id; Pkg_RPC_Receiver_Body : Node_Id; Pkg_RPC_Receiver_Decls : List_Id; --- 6697,6703 ---- Loc : constant Source_Ptr := Sloc (Pkg_Spec); Pkg_RPC_Receiver : constant Entity_Id := ! Make_Temporary (Loc, 'H'); Pkg_RPC_Receiver_Object : Node_Id; Pkg_RPC_Receiver_Body : Node_Id; Pkg_RPC_Receiver_Decls : List_Id; *************** package body Exp_Dist is *** 6697,6724 **** -- from the request structure, or the local subprogram address (in -- case of a RAS). ! Is_Local : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); ! Local_Address : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); -- Address of a local subprogram designated by a reference -- corresponding to a RAS. Dispatch_On_Address : constant List_Id := New_List; Dispatch_On_Name : constant List_Id := New_List; ! Current_Declaration : Node_Id; ! Current_Stubs : Node_Id; ! Current_Subprogram_Number : Int := First_RCI_Subprogram_Id; ! ! Subp_Info_Array : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('I')); ! Subp_Info_List : constant List_Id := New_List; Register_Pkg_Actuals : constant List_Id := New_List; --- 6718,6736 ---- -- from the request structure, or the local subprogram address (in -- case of a RAS). ! Is_Local : constant Entity_Id := Make_Temporary (Loc, 'L'); ! Local_Address : constant Entity_Id := Make_Temporary (Loc, 'A'); -- Address of a local subprogram designated by a reference -- corresponding to a RAS. Dispatch_On_Address : constant List_Id := New_List; Dispatch_On_Name : constant List_Id := New_List; ! Current_Subp_Number : Int := First_RCI_Subprogram_Id; ! Subp_Info_Array : constant Entity_Id := Make_Temporary (Loc, 'I'); ! Subp_Info_List : constant List_Id := New_List; Register_Pkg_Actuals : constant List_Id := New_List; *************** package body Exp_Dist is *** 6739,6744 **** --- 6751,6759 ---- -- object, used in the context of calls through remote -- access-to-subprogram types. + procedure Visit_Subprogram (Decl : Node_Id); + -- Generate receiving stub for one remote subprogram + --------------------- -- Append_Stubs_To -- --------------------- *************** package body Exp_Dist is *** 6802,6807 **** --- 6817,6925 ---- Make_Integer_Literal (Loc, Subp_Number))))); end Append_Stubs_To; + ---------------------- + -- Visit_Subprogram -- + ---------------------- + + procedure Visit_Subprogram (Decl : Node_Id) is + Loc : constant Source_Ptr := Sloc (Decl); + Spec : constant Node_Id := Specification (Decl); + Subp_Def : constant Entity_Id := Defining_Unit_Name (Spec); + + Subp_Val : String_Id; + + Subp_Dist_Name : constant Entity_Id := + Make_Defining_Identifier (Loc, + Chars => + New_External_Name + (Related_Id => Chars (Subp_Def), + Suffix => 'D', + Suffix_Index => -1)); + + Current_Stubs : Node_Id; + Proxy_Obj_Addr : Entity_Id; + + begin + -- Build receiving stub + + Current_Stubs := + Build_Subprogram_Receiving_Stubs + (Vis_Decl => Decl, + Asynchronous => Nkind (Spec) = N_Procedure_Specification + and then Is_Asynchronous (Subp_Def)); + + Append_To (Decls, Current_Stubs); + Analyze (Current_Stubs); + + -- Build RAS proxy + + Add_RAS_Proxy_And_Analyze (Decls, + Vis_Decl => Decl, + All_Calls_Remote_E => All_Calls_Remote_E, + Proxy_Object_Addr => Proxy_Obj_Addr); + + -- Compute distribution identifier + + Assign_Subprogram_Identifier + (Subp_Def, Current_Subp_Number, Subp_Val); + + pragma Assert + (Current_Subp_Number = Get_Subprogram_Id (Subp_Def)); + + Append_To (Decls, + Make_Object_Declaration (Loc, + Defining_Identifier => Subp_Dist_Name, + Constant_Present => True, + Object_Definition => + New_Occurrence_Of (Standard_String, Loc), + Expression => + Make_String_Literal (Loc, Subp_Val))); + Analyze (Last (Decls)); + + -- Add subprogram descriptor (RCI_Subp_Info) to the subprograms + -- table for this receiver. The aggregate below must be kept + -- consistent with the declaration of RCI_Subp_Info in + -- System.Partition_Interface. + + Append_To (Subp_Info_List, + Make_Component_Association (Loc, + Choices => + New_List (Make_Integer_Literal (Loc, Current_Subp_Number)), + + Expression => + Make_Aggregate (Loc, + Expressions => New_List ( + + -- Name => + + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Subp_Dist_Name, Loc), + Attribute_Name => Name_Address), + + -- Name_Length => + + Make_Attribute_Reference (Loc, + Prefix => + New_Occurrence_Of (Subp_Dist_Name, Loc), + Attribute_Name => Name_Length), + + -- Addr => + + New_Occurrence_Of (Proxy_Obj_Addr, Loc))))); + + Append_Stubs_To (Pkg_RPC_Receiver_Cases, + Declaration => Decl, + Stubs => Current_Stubs, + Subp_Number => Current_Subp_Number, + Subp_Dist_Name => Subp_Dist_Name, + Subp_Proxy_Addr => Proxy_Obj_Addr); + + Current_Subp_Number := Current_Subp_Number + 1; + end Visit_Subprogram; + + procedure Visit_Spec is new Build_Package_Stubs (Visit_Subprogram); + -- Start of processing for Add_Receiving_Stubs_To_Declarations begin *************** package body Exp_Dist is *** 6862,6972 **** Overload_Counter_Table.Reset; Reserve_NamingContext_Methods; ! Current_Declaration := First (Visible_Declarations (Pkg_Spec)); ! while Present (Current_Declaration) loop ! if Nkind (Current_Declaration) = N_Subprogram_Declaration ! and then Comes_From_Source (Current_Declaration) ! then ! declare ! Loc : constant Source_Ptr := Sloc (Current_Declaration); ! -- While specifically processing Current_Declaration, use ! -- its Sloc as the location of all generated nodes. ! ! Subp_Def : constant Entity_Id := ! Defining_Unit_Name ! (Specification (Current_Declaration)); ! ! Subp_Val : String_Id; ! ! Subp_Dist_Name : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => ! New_External_Name ! (Related_Id => Chars (Subp_Def), ! Suffix => 'D', ! Suffix_Index => -1)); ! ! Proxy_Object_Addr : Entity_Id; ! ! begin ! -- Build receiving stub ! ! Current_Stubs := ! Build_Subprogram_Receiving_Stubs ! (Vis_Decl => Current_Declaration, ! Asynchronous => ! Nkind (Specification (Current_Declaration)) = ! N_Procedure_Specification ! and then Is_Asynchronous (Subp_Def)); ! ! Append_To (Decls, Current_Stubs); ! Analyze (Current_Stubs); ! ! -- Build RAS proxy ! ! Add_RAS_Proxy_And_Analyze (Decls, ! Vis_Decl => Current_Declaration, ! All_Calls_Remote_E => All_Calls_Remote_E, ! Proxy_Object_Addr => Proxy_Object_Addr); ! ! -- Compute distribution identifier ! ! Assign_Subprogram_Identifier ! (Subp_Def, ! Current_Subprogram_Number, ! Subp_Val); ! ! pragma Assert ! (Current_Subprogram_Number = Get_Subprogram_Id (Subp_Def)); ! ! Append_To (Decls, ! Make_Object_Declaration (Loc, ! Defining_Identifier => Subp_Dist_Name, ! Constant_Present => True, ! Object_Definition => ! New_Occurrence_Of (Standard_String, Loc), ! Expression => ! Make_String_Literal (Loc, Subp_Val))); ! Analyze (Last (Decls)); ! ! -- Add subprogram descriptor (RCI_Subp_Info) to the ! -- subprograms table for this receiver. The aggregate ! -- below must be kept consistent with the declaration ! -- of type RCI_Subp_Info in System.Partition_Interface. ! ! Append_To (Subp_Info_List, ! Make_Component_Association (Loc, ! Choices => New_List ( ! Make_Integer_Literal (Loc, Current_Subprogram_Number)), ! ! Expression => ! Make_Aggregate (Loc, ! Expressions => New_List ( ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Occurrence_Of (Subp_Dist_Name, Loc), ! Attribute_Name => Name_Address), ! ! Make_Attribute_Reference (Loc, ! Prefix => ! New_Occurrence_Of (Subp_Dist_Name, Loc), ! Attribute_Name => Name_Length), ! ! New_Occurrence_Of (Proxy_Object_Addr, Loc))))); ! ! Append_Stubs_To (Pkg_RPC_Receiver_Cases, ! Declaration => Current_Declaration, ! Stubs => Current_Stubs, ! Subp_Number => Current_Subprogram_Number, ! Subp_Dist_Name => Subp_Dist_Name, ! Subp_Proxy_Addr => Proxy_Object_Addr); ! end; ! ! Current_Subprogram_Number := Current_Subprogram_Number + 1; ! end if; ! ! Next (Current_Declaration); ! end loop; Append_To (Decls, Make_Object_Declaration (Loc, --- 6980,6986 ---- Overload_Counter_Table.Reset; Reserve_NamingContext_Methods; ! Visit_Spec (Pkg_Spec); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 7073,7080 **** Pkg_RPC_Receiver_Object := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')), Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc)); Append_To (Decls, Pkg_RPC_Receiver_Object); --- 7087,7093 ---- Pkg_RPC_Receiver_Object := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'R'), Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc)); Append_To (Decls, Pkg_RPC_Receiver_Object); *************** package body Exp_Dist is *** 7163,7170 **** is Loc : constant Source_Ptr := Sloc (Nod); ! Request : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); -- The request object constructed by these stubs -- Could we use Name_R instead??? (see GLADE client stubs) --- 7176,7182 ---- is Loc : constant Source_Ptr := Sloc (Nod); ! Request : constant Entity_Id := Make_Temporary (Loc, 'R'); -- The request object constructed by these stubs -- Could we use Name_R instead??? (see GLADE client stubs) *************** package body Exp_Dist is *** 7172,7178 **** (RE : RE_Id; Actuals : List_Id := New_List) return Node_Id; -- Generate a procedure call statement calling RE with the given ! -- actuals. Request is appended to the list. --------------------------- -- Make_Request_RTE_Call -- --- 7184,7190 ---- (RE : RE_Id; Actuals : List_Id := New_List) return Node_Id; -- Generate a procedure call statement calling RE with the given ! -- actuals. Request'Access is appended to the list. --------------------------- -- Make_Request_RTE_Call -- *************** package body Exp_Dist is *** 7183,7189 **** Actuals : List_Id := New_List) return Node_Id is begin ! Append_To (Actuals, New_Occurrence_Of (Request, Loc)); return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE), Loc), --- 7195,7204 ---- Actuals : List_Id := New_List) return Node_Id is begin ! Append_To (Actuals, ! Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Request, Loc), ! Attribute_Name => Name_Access)); return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE), Loc), *************** package body Exp_Dist is *** 7243,7255 **** Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Request, ! Aliased_Present => False, Object_Definition => ! New_Occurrence_Of (RTE (RE_Request_Access), Loc))); ! Result := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); if Is_Function then Result_TC := --- 7258,7268 ---- Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Request, ! Aliased_Present => True, Object_Definition => ! New_Occurrence_Of (RTE (RE_Request), Loc))); ! Result := Make_Temporary (Loc, 'R'); if Is_Function then Result_TC := *************** package body Exp_Dist is *** 7285,7292 **** Expression => Make_Integer_Literal (Loc, 0)))))); if not Is_Known_Asynchronous then ! Exception_Return_Parameter := ! Make_Defining_Identifier (Loc, New_Internal_Name ('E')); Append_To (Decls, Make_Object_Declaration (Loc, --- 7298,7304 ---- Expression => Make_Integer_Literal (Loc, 0)))))); if not Is_Known_Asynchronous then ! Exception_Return_Parameter := Make_Temporary (Loc, 'E'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 7300,7307 **** -- Initialize and fill in arguments list ! Arguments := ! Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Declare_Create_NVList (Loc, Arguments, Decls, Statements); Current_Parameter := First (Ordered_Parameters_List); --- 7312,7318 ---- -- Initialize and fill in arguments list ! Arguments := Make_Temporary (Loc, 'A'); Declare_Create_NVList (Loc, Arguments, Decls, Statements); Current_Parameter := First (Ordered_Parameters_List); *************** package body Exp_Dist is *** 7336,7344 **** Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); ! Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('A')); Actual_Parameter : Node_Id := New_Occurrence_Of ( --- 7347,7353 ---- Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); ! Any : constant Entity_Id := Make_Temporary (Loc, 'A'); Actual_Parameter : Node_Id := New_Occurrence_Of ( *************** package body Exp_Dist is *** 7447,7454 **** declare Extra_Any_Parameter : constant Entity_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('P')); Parameter_Exp : constant Node_Id := Make_Attribute_Reference (Loc, --- 7456,7462 ---- declare Extra_Any_Parameter : constant Entity_Id := ! Make_Temporary (Loc, 'P'); Parameter_Exp : constant Node_Id := Make_Attribute_Reference (Loc, *************** package body Exp_Dist is *** 7486,7498 **** Append_List_To (Statements, Extra_Formal_Statements); Append_To (Statements, ! Make_Request_RTE_Call (RE_Request_Create, New_List ( ! Target_Object, ! Subprogram_Id, ! New_Occurrence_Of (Arguments, Loc), ! New_Occurrence_Of (Result, Loc), ! New_Occurrence_Of ! (RTE (RE_Nil_Exc_List), Loc)))); pragma Assert (not (Is_Known_Non_Asynchronous and Is_Known_Asynchronous)); --- 7494,7509 ---- Append_List_To (Statements, Extra_Formal_Statements); Append_To (Statements, ! Make_Procedure_Call_Statement (Loc, ! Name => ! New_Occurrence_Of (RTE (RE_Request_Setup), Loc), ! Parameter_Associations => New_List ( ! New_Occurrence_Of (Request, Loc), ! Target_Object, ! Subprogram_Id, ! New_Occurrence_Of (Arguments, Loc), ! New_Occurrence_Of (Result, Loc), ! New_Occurrence_Of (RTE (RE_Nil_Exc_List), Loc)))); pragma Assert (not (Is_Known_Non_Asynchronous and Is_Known_Asynchronous)); *************** package body Exp_Dist is *** 7523,7530 **** -- Asynchronous case if not Is_Known_Non_Asynchronous then ! Asynchronous_Statements := ! New_List (Make_Request_RTE_Call (RE_Request_Destroy)); end if; -- Non-asynchronous case --- 7534,7540 ---- -- Asynchronous case if not Is_Known_Non_Asynchronous then ! Asynchronous_Statements := New_List (Make_Null_Statement (Loc)); end if; -- Non-asynchronous case *************** package body Exp_Dist is *** 7541,7550 **** New_Occurrence_Of (Request, Loc)))); if Is_Function then - - Append_To (Non_Asynchronous_Statements, - Make_Request_RTE_Call (RE_Request_Destroy)); - -- If this is a function call, read the value and return it Append_To (Non_Asynchronous_Statements, --- 7551,7556 ---- *************** package body Exp_Dist is *** 7562,7570 **** -- Case of a procedure: deal with IN OUT and OUT formals Append_List_To (Non_Asynchronous_Statements, After_Statements); - - Append_To (Non_Asynchronous_Statements, - Make_Request_RTE_Call (RE_Request_Destroy)); end if; end if; --- 7568,7573 ---- *************** package body Exp_Dist is *** 7595,7603 **** Controlling_Parameter : Entity_Id) return RPC_Target is Target_Info : RPC_Target (PCS_Kind => Name_PolyORB_DSA); ! Target_Reference : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('T')); begin if Present (Controlling_Parameter) then Append_To (Decls, --- 7598,7605 ---- Controlling_Parameter : Entity_Id) return RPC_Target is Target_Info : RPC_Target (PCS_Kind => Name_PolyORB_DSA); ! Target_Reference : constant Entity_Id := Make_Temporary (Loc, 'T'); ! begin if Present (Controlling_Parameter) then Append_To (Decls, *************** package body Exp_Dist is *** 7624,7630 **** else Target_Info.Object := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars (RCI_Locator)), Selector_Name => Make_Identifier (Loc, Name_Get_RCI_Package_Ref)); end if; --- 7626,7633 ---- else Target_Info.Object := Make_Selected_Component (Loc, ! Prefix => ! Make_Identifier (Loc, Chars (RCI_Locator)), Selector_Name => Make_Identifier (Loc, Name_Get_RCI_Package_Ref)); end if; *************** package body Exp_Dist is *** 7666,7673 **** RPC_Receiver_Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')), Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc)); --- 7669,7675 ---- RPC_Receiver_Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'R'), Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc)); *************** package body Exp_Dist is *** 7747,7755 **** is Loc : constant Source_Ptr := Sloc (Vis_Decl); ! Request_Parameter : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); -- Formal parameter for receiving stubs: a descriptor for an incoming -- request. --- 7749,7755 ---- is Loc : constant Source_Ptr := Sloc (Vis_Decl); ! Request_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R'); -- Formal parameter for receiving stubs: a descriptor for an incoming -- request. *************** package body Exp_Dist is *** 7793,7801 **** Build_Ordered_Parameters_List (Specification (Vis_Decl)); ! Arguments : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('A')); -- Name of the named values list used to retrieve parameters Subp_Spec : Node_Id; --- 7793,7799 ---- Build_Ordered_Parameters_List (Specification (Vis_Decl)); ! Arguments : constant Entity_Id := Make_Temporary (Loc, 'A'); -- Name of the named values list used to retrieve parameters Subp_Spec : Node_Id; *************** package body Exp_Dist is *** 7825,7835 **** declare Etyp : Entity_Id; Constrained : Boolean; ! Any : Entity_Id := Empty; ! Object : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); ! Expr : Node_Id := Empty; Is_Controlling_Formal : constant Boolean := Is_RACW_Controlling_Formal --- 7823,7831 ---- declare Etyp : Entity_Id; Constrained : Boolean; ! Any : Entity_Id := Empty; ! Object : constant Entity_Id := Make_Temporary (Loc, 'P'); ! Expr : Node_Id := Empty; Is_Controlling_Formal : constant Boolean := Is_RACW_Controlling_Formal *************** package body Exp_Dist is *** 7865,7873 **** Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); if not Is_First_Controlling_Formal then ! Any := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Append_To (Outer_Decls, Make_Object_Declaration (Loc, --- 7861,7867 ---- Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); if not Is_First_Controlling_Formal then ! Any := Make_Temporary (Loc, 'A'); Append_To (Outer_Decls, Make_Object_Declaration (Loc, *************** package body Exp_Dist is *** 7891,7903 **** if Is_First_Controlling_Formal then declare ! Addr : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Is_Local : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('L')); begin -- Special case: obtain the first controlling formal --- 7885,7894 ---- if Is_First_Controlling_Formal then declare ! Addr : constant Entity_Id := Make_Temporary (Loc, 'A'); Is_Local : constant Entity_Id := ! Make_Temporary (Loc, 'L'); begin -- Special case: obtain the first controlling formal *************** package body Exp_Dist is *** 7922,7928 **** New_Occurrence_Of (RTE (RE_Get_Local_Address), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, ! Prefix => New_Occurrence_Of ( Request_Parameter, Loc), Selector_Name => --- 7913,7919 ---- New_Occurrence_Of (RTE (RE_Get_Local_Address), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, ! Prefix => New_Occurrence_Of ( Request_Parameter, Loc), Selector_Name => *************** package body Exp_Dist is *** 8067,8074 **** (Current_Parameter)); Extra_Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); Formal_Entity : constant Entity_Id := Make_Defining_Identifier (Loc, --- 8058,8064 ---- (Current_Parameter)); Extra_Any : constant Entity_Id := ! Make_Temporary (Loc, 'A'); Formal_Entity : constant Entity_Id := Make_Defining_Identifier (Loc, *************** package body Exp_Dist is *** 8139,8147 **** declare Etyp : constant Entity_Id := Etype (Result_Definition (Specification (Vis_Decl))); ! Result : constant Node_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')); begin Inner_Decls := New_List ( --- 8129,8135 ---- declare Etyp : constant Entity_Id := Etype (Result_Definition (Specification (Vis_Decl))); ! Result : constant Node_Id := Make_Temporary (Loc, 'R'); begin Inner_Decls := New_List ( *************** package body Exp_Dist is *** 8209,8216 **** Subp_Spec := Make_Procedure_Specification (Loc, ! Defining_Unit_Name => ! Make_Defining_Identifier (Loc, New_Internal_Name ('F')), Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, --- 8197,8203 ---- Subp_Spec := Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Make_Temporary (Loc, 'F'), Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, *************** package body Exp_Dist is *** 8297,8303 **** Arry : Entity_Id; -- For 'Range and Etype ! Indices : List_Id; -- For the construction of the innermost element expression with procedure Add_Process_Element --- 8284,8290 ---- Arry : Entity_Id; -- For 'Range and Etype ! Indexes : List_Id; -- For the construction of the innermost element expression with procedure Add_Process_Element *************** package body Exp_Dist is *** 8313,8319 **** Depth : Pos := 1); -- Build nested loop statements that iterate over the elements of an -- array Arry. The statement(s) built by Add_Process_Element are ! -- executed for each element; Indices is the list of indices to be -- used in the construction of the indexed component that denotes the -- current element. Subprogram is the entity for the subprogram for -- which this iterator is generated. The generated statements are --- 8300,8306 ---- Depth : Pos := 1); -- Build nested loop statements that iterate over the elements of an -- array Arry. The statement(s) built by Add_Process_Element are ! -- executed for each element; Indexes is the list of indexes to be -- used in the construction of the indexed component that denotes the -- current element. Subprogram is the entity for the subprogram for -- which this iterator is generated. The generated statements are *************** package body Exp_Dist is *** 8396,8404 **** N : Node_Id; Target : Entity_Id) is ! Strm : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); Expr : Node_Id; Read_Call_List : List_Id; --- 8383,8389 ---- N : Node_Id; Target : Entity_Id) is ! Strm : constant Entity_Id := Make_Temporary (Loc, 'S'); Expr : Node_Id; Read_Call_List : List_Id; *************** package body Exp_Dist is *** 8456,8464 **** else declare ! Temp : constant Entity_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('R')); begin Read_Call_List := New_List; --- 8441,8447 ---- else declare ! Temp : constant Entity_Id := Make_Temporary (Loc, 'R'); begin Read_Call_List := New_List; *************** package body Exp_Dist is *** 8524,8529 **** --- 8507,8521 ---- Fnam := Find_Inherited_TSS (U_Type, TSS_From_Any); + -- For the subtype representing a generic actual type, go to the + -- actual type. + + if Is_Generic_Actual_Type (U_Type) then + U_Type := Underlying_Type (Base_Type (U_Type)); + end if; + + -- For a standard subtype, go to the base type + if Sloc (U_Type) <= Standard_Location then U_Type := Base_Type (U_Type); end if; *************** package body Exp_Dist is *** 8613,8625 **** Decl : Entity_Id; begin - -- For the subtype representing a generic actual type, go - -- to the base type. - - if Is_Generic_Actual_Type (U_Type) then - U_Type := Base_Type (U_Type); - end if; - Build_From_Any_Function (Loc, U_Type, Decl, Fnam); Append_To (Decls, Decl); end; --- 8605,8610 ---- *************** package body Exp_Dist is *** 8659,8667 **** Decls : constant List_Id := New_List; Stms : constant List_Id := New_List; ! Any_Parameter : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('A')); Use_Opaque_Representation : Boolean; --- 8644,8650 ---- Decls : constant List_Id := New_List; Stms : constant List_Id := New_List; ! Any_Parameter : constant Entity_Id := Make_Temporary (Loc, 'A'); Use_Opaque_Representation : Boolean; *************** package body Exp_Dist is *** 8744,8752 **** -- The returned object ! Res : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('R')); Res_Definition : Node_Id := New_Occurrence_Of (Typ, Loc); --- 8727,8733 ---- -- The returned object ! Res : constant Entity_Id := Make_Temporary (Loc, 'R'); Res_Definition : Node_Id := New_Occurrence_Of (Typ, Loc); *************** package body Exp_Dist is *** 8813,8820 **** Choice_List : List_Id; Struct_Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('S')); begin Append_To (Decls, --- 8794,8800 ---- Choice_List : List_Id; Struct_Any : constant Entity_Id := ! Make_Temporary (Loc, 'S'); begin Append_To (Decls, *************** package body Exp_Dist is *** 8871,8877 **** -- Struct_Counter should be reset before -- handling a variant part. Indeed only one -- of the case statement alternatives will be ! -- executed at run-time, so the counter must -- start at 0 for every case statement. Struct_Counter := 0; --- 8851,8857 ---- -- Struct_Counter should be reset before -- handling a variant part. Indeed only one -- of the case statement alternatives will be ! -- executed at run time, so the counter must -- start at 0 for every case statement. Struct_Counter := 0; *************** package body Exp_Dist is *** 9089,9095 **** new Append_Array_Traversal ( Subprogram => Fnam, Arry => Res, ! Indices => New_List, Add_Process_Element => FA_Ary_Add_Process_Element); Res_Subtype_Indication : Node_Id := --- 9069,9075 ---- new Append_Array_Traversal ( Subprogram => Fnam, Arry => Res, ! Indexes => New_List, Add_Process_Element => FA_Ary_Add_Process_Element); Res_Subtype_Indication : Node_Id := *************** package body Exp_Dist is *** 9155,9178 **** Left_Opnd => Make_Op_Add (Loc, Left_Opnd => ! OK_Convert_To ( ! Standard_Long_Integer, ! Make_Identifier (Loc, Lnam)), Right_Opnd => ! OK_Convert_To ( ! Standard_Long_Integer, ! Make_Function_Call (Loc, ! Name => ! New_Occurrence_Of (RTE ( ! RE_Get_Nested_Sequence_Length ! ), Loc), ! Parameter_Associations => ! New_List ( ! New_Occurrence_Of ( ! Any_Parameter, Loc), ! Make_Integer_Literal (Loc, ! Intval => J))))), Right_Opnd => Make_Integer_Literal (Loc, 1)))))); --- 9135,9158 ---- Left_Opnd => Make_Op_Add (Loc, Left_Opnd => ! OK_Convert_To ! (Standard_Long_Integer, ! Make_Identifier (Loc, Lnam)), Right_Opnd => ! OK_Convert_To ! (Standard_Long_Integer, ! Make_Function_Call (Loc, ! Name => ! New_Occurrence_Of (RTE ( ! RE_Get_Nested_Sequence_Length ! ), Loc), ! Parameter_Associations => ! New_List ( ! New_Occurrence_Of ( ! Any_Parameter, Loc), ! Make_Integer_Literal (Loc, ! Intval => J))))), Right_Opnd => Make_Integer_Literal (Loc, 1)))))); *************** package body Exp_Dist is *** 9342,9353 **** Fnam := Find_Inherited_TSS (U_Type, TSS_To_Any); ! -- Check first for Boolean and Character. These are enumeration ! -- types, but we treat them specially, since they may require ! -- special handling in the transfer protocol. However, this ! -- special handling only applies if they have standard ! -- representation, otherwise they are treated like any other ! -- enumeration type. if Sloc (U_Type) <= Standard_Location then U_Type := Base_Type (U_Type); --- 9322,9335 ---- Fnam := Find_Inherited_TSS (U_Type, TSS_To_Any); ! -- For the subtype representing a generic actual type, go to the ! -- actual type. ! ! if Is_Generic_Actual_Type (U_Type) then ! U_Type := Underlying_Type (Base_Type (U_Type)); ! end if; ! ! -- For a standard subtype, go to the base type if Sloc (U_Type) <= Standard_Location then U_Type := Base_Type (U_Type); *************** package body Exp_Dist is *** 9356,9361 **** --- 9338,9350 ---- if Present (Fnam) then null; + -- Check first for Boolean and Character. These are enumeration + -- types, but we treat them specially, since they may require + -- special handling in the transfer protocol. However, this + -- special handling only applies if they have standard + -- representation, otherwise they are treated like any other + -- enumeration type. + elsif U_Type = Standard_Boolean then Lib_RE := RE_TA_B; *************** package body Exp_Dist is *** 9454,9460 **** -- that the expected type of its parameter is U_Type. if Ekind (Fnam) = E_Function ! and then Present (First_Formal (Fnam)) then C_Type := Etype (First_Formal (Fnam)); else --- 9443,9449 ---- -- that the expected type of its parameter is U_Type. if Ekind (Fnam) = E_Function ! and then Present (First_Formal (Fnam)) then C_Type := Etype (First_Formal (Fnam)); else *************** package body Exp_Dist is *** 9482,9495 **** Decls : constant List_Id := New_List; Stms : constant List_Id := New_List; ! Expr_Parameter : constant Entity_Id := ! Make_Defining_Identifier (Loc, Name_E); ! ! Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, Name_A); Any_Decl : Node_Id; - Result_TC : Node_Id := Build_TypeCode_Call (Loc, Typ, Decls); Use_Opaque_Representation : Boolean; -- When True, use stream attributes and represent type as an --- 9471,9481 ---- Decls : constant List_Id := New_List; Stms : constant List_Id := New_List; ! Expr_Parameter : Entity_Id; ! Any : Entity_Id; ! Result_TC : Node_Id; Any_Decl : Node_Id; Use_Opaque_Representation : Boolean; -- When True, use stream attributes and represent type as an *************** package body Exp_Dist is *** 9503,9515 **** if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_To_Any_Function ! (Loc => Loc, Typ => Etype (Typ), Decl => Decl, Fnam => Fnam); return; end if; Fnam := Make_Helper_Function_Name (Loc, Typ, Name_To_Any); Spec := --- 9489,9505 ---- if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_To_Any_Function ! (Loc => Loc, Typ => Etype (Typ), Decl => Decl, Fnam => Fnam); return; end if; + Expr_Parameter := Make_Defining_Identifier (Loc, Name_E); + Any := Make_Defining_Identifier (Loc, Name_A); + Result_TC := Build_TypeCode_Call (Loc, Typ, Decls); + Fnam := Make_Helper_Function_Name (Loc, Typ, Name_To_Any); Spec := *************** package body Exp_Dist is *** 9641,9652 **** Choice_List : List_Id; Union_Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('V')); Struct_Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('S')); function Make_Discriminant_Reference return Node_Id; --- 9631,9640 ---- Choice_List : List_Id; Union_Any : constant Entity_Id := ! Make_Temporary (Loc, 'V'); Struct_Any : constant Entity_Id := ! Make_Temporary (Loc, 'S'); function Make_Discriminant_Reference return Node_Id; *************** package body Exp_Dist is *** 9759,9765 **** -- Struct_Counter should be reset before -- handling a variant part. Indeed only one -- of the case statement alternatives will be ! -- executed at run-time, so the counter must -- start at 0 for every case statement. Struct_Counter := 0; --- 9747,9753 ---- -- Struct_Counter should be reset before -- handling a variant part. Indeed only one -- of the case statement alternatives will be ! -- executed at run time, so the counter must -- start at 0 for every case statement. Struct_Counter := 0; *************** package body Exp_Dist is *** 9865,9872 **** declare Dummy_Any : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('A')); begin Append_To (Decls, --- 9853,9859 ---- declare Dummy_Any : constant Entity_Id := ! Make_Temporary (Loc, 'A'); begin Append_To (Decls, *************** package body Exp_Dist is *** 9958,9964 **** new Append_Array_Traversal ( Subprogram => Fnam, Arry => Expr_Parameter, ! Indices => New_List, Add_Process_Element => TA_Ary_Add_Process_Element); Index : Node_Id; --- 9945,9951 ---- new Append_Array_Traversal ( Subprogram => Fnam, Arry => Expr_Parameter, ! Indexes => New_List, Add_Process_Element => TA_Ary_Add_Process_Element); Index : Node_Id; *************** package body Exp_Dist is *** 10016,10024 **** if Use_Opaque_Representation then declare ! Strm : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); -- Stream used to store data representation produced by -- stream attribute. --- 10003,10009 ---- if Use_Opaque_Representation then declare ! Strm : constant Entity_Id := Make_Temporary (Loc, 'S'); -- Stream used to store data representation produced by -- stream attribute. *************** package body Exp_Dist is *** 10124,10138 **** Fnam := Find_Inherited_TSS (U_Type, TSS_TypeCode); end if; ! if No (Fnam) then ! if Sloc (U_Type) <= Standard_Location then ! -- Do not try to build alias typecodes for subtypes from ! -- Standard. ! U_Type := Base_Type (U_Type); ! end if; if U_Type = Standard_Boolean then Lib_RE := RE_TC_B; --- 10109,10128 ---- Fnam := Find_Inherited_TSS (U_Type, TSS_TypeCode); end if; ! -- For the subtype representing a generic actual type, go to the ! -- actual type. ! if Is_Generic_Actual_Type (U_Type) then ! U_Type := Underlying_Type (Base_Type (U_Type)); ! end if; ! -- For a standard subtype, go to the base type ! ! if Sloc (U_Type) <= Standard_Location then ! U_Type := Base_Type (U_Type); ! end if; + if No (Fnam) then if U_Type = Standard_Boolean then Lib_RE := RE_TC_B; *************** package body Exp_Dist is *** 10639,10647 **** if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_TypeCode_Function (Loc => Loc, ! Typ => Etype (Typ), ! Decl => Decl, ! Fnam => Fnam); return; end if; --- 10629,10637 ---- if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_TypeCode_Function (Loc => Loc, ! Typ => Etype (Typ), ! Decl => Decl, ! Fnam => Fnam); return; end if; *************** package body Exp_Dist is *** 10937,10943 **** Element_Expr : constant Node_Id := Make_Indexed_Component (Loc, New_Occurrence_Of (Arry, Loc), ! Indices); begin Set_Etype (Element_Expr, Component_Type (Typ)); Add_Process_Element (Stmts, --- 10927,10933 ---- Element_Expr : constant Node_Id := Make_Indexed_Component (Loc, New_Occurrence_Of (Arry, Loc), ! Indexes); begin Set_Etype (Element_Expr, Component_Type (Typ)); Add_Process_Element (Stmts, *************** package body Exp_Dist is *** 10949,10955 **** return; end if; ! Append_To (Indices, Make_Identifier (Loc, New_External_Name ('L', Depth))); if not Constrained or else Depth > 1 then --- 10939,10945 ---- return; end if; ! Append_To (Indexes, Make_Identifier (Loc, New_External_Name ('L', Depth))); if not Constrained or else Depth > 1 then *************** package body Exp_Dist is *** 11126,11151 **** begin declare Serial : Nat := 0; ! -- For tagged types, we use a canonical name so that it matches ! -- the primitive spec. For all other cases, we use a serialized ! -- name so that multiple generations of the same procedure do ! -- not clash. begin ! if not Is_Tagged_Type (Typ) then Serial := Increment_Serial_Number; end if; ! -- Use prefixed underscore to avoid potential clash with used -- identifier (we use attribute names for Nam). return Make_Defining_Identifier (Loc, Chars => New_External_Name ! (Related_Id => Nam, ! Suffix => ' ', Suffix_Index => Serial, ! Prefix => '_')); end; end Make_Helper_Function_Name; end Helpers; --- 11116,11144 ---- begin declare Serial : Nat := 0; ! -- For tagged types that aren't frozen yet, generate the helper ! -- under its canonical name so that it matches the primitive ! -- spec. For all other cases, we use a serialized name so that ! -- multiple generations of the same procedure do not clash. begin ! if Is_Tagged_Type (Typ) and then not Is_Frozen (Typ) then ! null; ! else Serial := Increment_Serial_Number; end if; ! -- Use prefixed underscore to avoid potential clash with user -- identifier (we use attribute names for Nam). return Make_Defining_Identifier (Loc, Chars => New_External_Name ! (Related_Id => Nam, ! Suffix => ' ', ! Suffix_Index => Serial, ! Prefix => '_')); end; end Make_Helper_Function_Name; end Helpers; *************** package body Exp_Dist is *** 11192,11200 **** Pkg_Name := String_From_Name_Buffer; Inst := Make_Package_Instantiation (Loc, ! Defining_Unit_Name => ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('R')), Name => New_Occurrence_Of (RTE (RE_RCI_Locator), Loc), --- 11185,11191 ---- Pkg_Name := String_From_Name_Buffer; Inst := Make_Package_Instantiation (Loc, ! Defining_Unit_Name => Make_Temporary (Loc, 'R'), Name => New_Occurrence_Of (RTE (RE_RCI_Locator), Loc), diff -Nrcpad gcc-4.5.2/gcc/ada/exp_dist.ads gcc-4.6.0/gcc/ada/exp_dist.ads *** gcc-4.5.2/gcc/ada/exp_dist.ads Wed Jul 22 13:24:46 2009 --- gcc-4.6.0/gcc/ada/exp_dist.ads Tue Oct 12 13:19:36 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Dist is *** 35,41 **** PCS_Version_Number : constant array (PCS_Names) of Int := (Name_No_DSA => 1, Name_GARLIC_DSA => 1, ! Name_PolyORB_DSA => 3); -- PCS interface version. This is used to check for consistency between the -- compiler used to generate distribution stubs and the PCS implementation. -- It must be incremented whenever a change is made to the generated code --- 35,41 ---- PCS_Version_Number : constant array (PCS_Names) of Int := (Name_No_DSA => 1, Name_GARLIC_DSA => 1, ! Name_PolyORB_DSA => 4); -- PCS interface version. This is used to check for consistency between the -- compiler used to generate distribution stubs and the PCS implementation. -- It must be incremented whenever a change is made to the generated code diff -Nrcpad gcc-4.5.2/gcc/ada/exp_fixd.adb gcc-4.6.0/gcc/ada/exp_fixd.adb *** gcc-4.5.2/gcc/ada/exp_fixd.adb Fri Apr 17 13:06:08 2009 --- gcc-4.6.0/gcc/ada/exp_fixd.adb Thu Jun 17 10:45:18 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Fixd is *** 505,512 **** -- Define quotient and remainder, and set their Etypes, so -- that they can be picked up by Build_xxx routines. ! Qnn := Make_Defining_Identifier (Loc, New_Internal_Name ('S')); ! Rnn := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Set_Etype (Qnn, QR_Typ); Set_Etype (Rnn, QR_Typ); --- 505,512 ---- -- Define quotient and remainder, and set their Etypes, so -- that they can be picked up by Build_xxx routines. ! Qnn := Make_Temporary (Loc, 'S'); ! Rnn := Make_Temporary (Loc, 'R'); Set_Etype (Qnn, QR_Typ); Set_Etype (Rnn, QR_Typ); *************** package body Exp_Fixd is *** 518,525 **** -- Create temporaries for numerator and denominator and set Etypes, -- so that New_Occurrence_Of picks them up for Build_xxx calls. ! Nnn := Make_Defining_Identifier (Loc, New_Internal_Name ('N')); ! Dnn := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); Set_Etype (Nnn, QR_Typ); Set_Etype (Dnn, QR_Typ); --- 518,525 ---- -- Create temporaries for numerator and denominator and set Etypes, -- so that New_Occurrence_Of picks them up for Build_xxx calls. ! Nnn := Make_Temporary (Loc, 'N'); ! Dnn := Make_Temporary (Loc, 'D'); Set_Etype (Nnn, QR_Typ); Set_Etype (Dnn, QR_Typ); *************** package body Exp_Fixd is *** 882,889 **** -- Define quotient and remainder, and set their Etypes, so -- that they can be picked up by Build_xxx routines. ! Qnn := Make_Defining_Identifier (Loc, New_Internal_Name ('S')); ! Rnn := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Set_Etype (Qnn, QR_Typ); Set_Etype (Rnn, QR_Typ); --- 882,889 ---- -- Define quotient and remainder, and set their Etypes, so -- that they can be picked up by Build_xxx routines. ! Qnn := Make_Temporary (Loc, 'S'); ! Rnn := Make_Temporary (Loc, 'R'); Set_Etype (Qnn, QR_Typ); Set_Etype (Rnn, QR_Typ); *************** package body Exp_Fixd is *** 891,898 **** -- Case that we can compute the numerator in 64 bits if QR_Siz <= 64 then ! Nnn := Make_Defining_Identifier (Loc, New_Internal_Name ('N')); ! Dnn := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); -- Set Etypes, so that they can be picked up by New_Occurrence_Of --- 891,898 ---- -- Case that we can compute the numerator in 64 bits if QR_Siz <= 64 then ! Nnn := Make_Temporary (Loc, 'N'); ! Dnn := Make_Temporary (Loc, 'D'); -- Set Etypes, so that they can be picked up by New_Occurrence_Of diff -Nrcpad gcc-4.5.2/gcc/ada/exp_fixd.ads gcc-4.6.0/gcc/ada/exp_fixd.ads *** gcc-4.5.2/gcc/ada/exp_fixd.ads Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/exp_fixd.ads Mon Dec 20 07:26:57 2010 *************** package Exp_Fixd is *** 133,139 **** procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id); -- This routine expands the multiplication between standard integer and a -- fixed-point type. The result type is the same fixed-point type as the ! -- the fixed operand type. N is an N_Op_Multiply node whose result type -- and right operand types are the fixed-point type, and whose left operand -- type is always standard integer. --- 133,139 ---- procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id); -- This routine expands the multiplication between standard integer and a -- fixed-point type. The result type is the same fixed-point type as the ! -- fixed operand type. N is an N_Op_Multiply node whose result type -- and right operand types are the fixed-point type, and whose left operand -- type is always standard integer. diff -Nrcpad gcc-4.5.2/gcc/ada/exp_imgv.adb gcc-4.6.0/gcc/ada/exp_imgv.adb *** gcc-4.5.2/gcc/ada/exp_imgv.adb Fri Apr 17 13:15:47 2009 --- gcc-4.6.0/gcc/ada/exp_imgv.adb Mon Oct 11 09:20:53 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Stringt; use Stringt; *** 43,51 **** --- 43,57 ---- with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uintp; use Uintp; + with Urealp; use Urealp; package body Exp_Imgv is + function Has_Decimal_Small (E : Entity_Id) return Boolean; + -- Applies to all entities. True for a Decimal_Fixed_Point_Type, or an + -- Ordinary_Fixed_Point_Type with a small that is a negative power of ten. + -- Shouldn't this be in einfo.adb or sem_aux.adb??? + ------------------------------------ -- Build_Enumeration_Image_Tables -- ------------------------------------ *************** package body Exp_Imgv is *** 260,272 **** Ins_List : List_Id; -- List of actions to be inserted ! Snn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); ! ! Pnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); begin -- Build declarations of Snn and Pnn to be inserted --- 266,273 ---- Ins_List : List_Id; -- List of actions to be inserted ! Snn : constant Entity_Id := Make_Temporary (Loc, 'S'); ! Pnn : constant Entity_Id := Make_Temporary (Loc, 'P'); begin -- Build declarations of Snn and Pnn to be inserted *************** package body Exp_Imgv is *** 305,312 **** Imid := RE_Image_Boolean; Tent := Rtyp; elsif Rtyp = Standard_Character then ! Imid := RE_Image_Character; Tent := Rtyp; elsif Rtyp = Standard_Wide_Character then --- 306,321 ---- Imid := RE_Image_Boolean; Tent := Rtyp; + -- For standard character, we have to select the version which handles + -- soft hyphen correctly, based on the version of Ada in use (ugly!) + elsif Rtyp = Standard_Character then ! if Ada_Version < Ada_2005 then ! Imid := RE_Image_Character; ! else ! Imid := RE_Image_Character_05; ! end if; ! Tent := Rtyp; elsif Rtyp = Standard_Wide_Character then *************** package body Exp_Imgv is *** 335,341 **** Tent := RTE (RE_Long_Long_Unsigned); end if; ! elsif Is_Decimal_Fixed_Point_Type (Rtyp) then if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then Imid := RE_Image_Decimal; Tent := Standard_Integer; --- 344,350 ---- Tent := RTE (RE_Long_Long_Unsigned); end if; ! elsif Is_Fixed_Point_Type (Rtyp) and then Has_Decimal_Small (Rtyp) then if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then Imid := RE_Image_Decimal; Tent := Standard_Integer; *************** package body Exp_Imgv is *** 358,365 **** if Discard_Names (First_Subtype (Ptyp)) or else No (Lit_Strings (Root_Type (Ptyp))) then ! -- When pragma Discard_Names applies to the first subtype, ! -- then build (Pref'Pos)'Img. Rewrite (N, Make_Attribute_Reference (Loc, --- 367,374 ---- if Discard_Names (First_Subtype (Ptyp)) or else No (Lit_Strings (Root_Type (Ptyp))) then ! -- When pragma Discard_Names applies to the first subtype, build ! -- (Pref'Pos)'Img. Rewrite (N, Make_Attribute_Reference (Loc, *************** package body Exp_Imgv is *** 380,387 **** if Ttyp = Standard_Integer_8 then Imid := RE_Image_Enumeration_8; ! elsif Ttyp = Standard_Integer_16 then Imid := RE_Image_Enumeration_16; else Imid := RE_Image_Enumeration_32; end if; --- 389,398 ---- if Ttyp = Standard_Integer_8 then Imid := RE_Image_Enumeration_8; ! ! elsif Ttyp = Standard_Integer_16 then Imid := RE_Image_Enumeration_16; + else Imid := RE_Image_Enumeration_32; end if; *************** package body Exp_Imgv is *** 454,475 **** Prefix => New_Reference_To (Ptyp, Loc), Attribute_Name => Name_Aft)); -- For decimal, append Scale and also set to do literal conversion elsif Is_Decimal_Fixed_Point_Type (Rtyp) then Append_To (Arg_List, Make_Attribute_Reference (Loc, ! Prefix => New_Reference_To (Ptyp, Loc), Attribute_Name => Name_Scale)); Set_Conversion_OK (First (Arg_List)); Set_Etype (First (Arg_List), Tent); ! -- For Wide_Character, append Ada 2005 indication elsif Rtyp = Standard_Wide_Character then Append_To (Arg_List, ! New_Reference_To (Boolean_Literals (Ada_Version >= Ada_05), Loc)); end if; -- Now append the procedure call to the insert list --- 465,491 ---- Prefix => New_Reference_To (Ptyp, Loc), Attribute_Name => Name_Aft)); + if Has_Decimal_Small (Rtyp) then + Set_Conversion_OK (First (Arg_List)); + Set_Etype (First (Arg_List), Tent); + end if; + -- For decimal, append Scale and also set to do literal conversion elsif Is_Decimal_Fixed_Point_Type (Rtyp) then Append_To (Arg_List, Make_Attribute_Reference (Loc, ! Prefix => New_Reference_To (Ptyp, Loc), Attribute_Name => Name_Scale)); Set_Conversion_OK (First (Arg_List)); Set_Etype (First (Arg_List), Tent); ! -- For Wide_Character, append Ada 2005 indication elsif Rtyp = Standard_Wide_Character then Append_To (Arg_List, ! New_Reference_To (Boolean_Literals (Ada_Version >= Ada_2005), Loc)); end if; -- Now append the procedure call to the insert list *************** package body Exp_Imgv is *** 771,784 **** procedure Expand_Wide_Image_Attribute (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Rtyp : constant Entity_Id := Root_Type (Entity (Prefix (N))); ! ! Rnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); ! ! Lnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); begin Insert_Actions (N, New_List ( --- 787,794 ---- procedure Expand_Wide_Image_Attribute (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Rtyp : constant Entity_Id := Root_Type (Entity (Prefix (N))); ! Rnn : constant Entity_Id := Make_Temporary (Loc, 'S'); ! Lnn : constant Entity_Id := Make_Temporary (Loc, 'P'); begin Insert_Actions (N, New_List ( *************** package body Exp_Imgv is *** 869,881 **** Loc : constant Source_Ptr := Sloc (N); Rtyp : constant Entity_Id := Root_Type (Entity (Prefix (N))); ! Rnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); ! ! Lnn : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); begin Insert_Actions (N, New_List ( --- 879,886 ---- Loc : constant Source_Ptr := Sloc (N); Rtyp : constant Entity_Id := Root_Type (Entity (Prefix (N))); ! Rnn : constant Entity_Id := Make_Temporary (Loc, 'S'); ! Lnn : constant Entity_Id := Make_Temporary (Loc, 'P'); begin Insert_Actions (N, New_List ( *************** package body Exp_Imgv is *** 1254,1257 **** --- 1259,1274 ---- Analyze_And_Resolve (N, Typ); end Expand_Width_Attribute; + ----------------------- + -- Has_Decimal_Small -- + ----------------------- + + function Has_Decimal_Small (E : Entity_Id) return Boolean is + begin + return Is_Decimal_Fixed_Point_Type (E) + or else + (Is_Ordinary_Fixed_Point_Type (E) + and then Ureal_10**Aft_Value (E) * Small_Value (E) = Ureal_1); + end Has_Decimal_Small; + end Exp_Imgv; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_intr.adb gcc-4.6.0/gcc/ada/exp_intr.adb *** gcc-4.5.2/gcc/ada/exp_intr.adb Mon Nov 30 11:55:21 2009 --- gcc-4.6.0/gcc/ada/exp_intr.adb Thu Oct 21 09:52:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Intr is *** 63,68 **** --- 63,72 ---- -- Local Subprograms -- ----------------------- + procedure Expand_Binary_Operator_Call (N : Node_Id); + -- Expand a call to an intrinsic arithmetic operator when the operand + -- types or sizes are not identical. + procedure Expand_Is_Negative (N : Node_Id); -- Expand a call to the intrinsic Is_Negative function *************** package body Exp_Intr is *** 108,113 **** --- 112,178 ---- -- Name_Source_Location - expand string of form file:line -- Name_Enclosing_Entity - expand string with name of enclosing entity + --------------------------------- + -- Expand_Binary_Operator_Call -- + --------------------------------- + + procedure Expand_Binary_Operator_Call (N : Node_Id) is + T1 : constant Entity_Id := Underlying_Type (Etype (Left_Opnd (N))); + T2 : constant Entity_Id := Underlying_Type (Etype (Right_Opnd (N))); + TR : constant Entity_Id := Etype (N); + T3 : Entity_Id; + Res : Node_Id; + + Siz : constant Uint := UI_Max (Esize (T1), Esize (T2)); + -- Maximum of operand sizes + + begin + -- Nothing to do if the operands have the same modular type + + if Base_Type (T1) = Base_Type (T2) + and then Is_Modular_Integer_Type (T1) + then + return; + end if; + + -- Use Unsigned_32 for sizes of 32 or below, else Unsigned_64 + + if Siz > 32 then + T3 := RTE (RE_Unsigned_64); + else + T3 := RTE (RE_Unsigned_32); + end if; + + -- Copy operator node, and reset type and entity fields, for + -- subsequent reanalysis. + + Res := New_Copy (N); + Set_Etype (Res, T3); + + case Nkind (N) is + when N_Op_And => + Set_Entity (Res, Standard_Op_And); + when N_Op_Or => + Set_Entity (Res, Standard_Op_Or); + when N_Op_Xor => + Set_Entity (Res, Standard_Op_Xor); + when others => + raise Program_Error; + end case; + + -- Convert operands to large enough intermediate type + + Set_Left_Opnd (Res, + Unchecked_Convert_To (T3, Relocate_Node (Left_Opnd (N)))); + Set_Right_Opnd (Res, + Unchecked_Convert_To (T3, Relocate_Node (Right_Opnd (N)))); + + -- Analyze and resolve result formed by conversion to target type + + Rewrite (N, Unchecked_Convert_To (TR, Res)); + Analyze_And_Resolve (N, TR); + end Expand_Binary_Operator_Call; + ----------------------------------------- -- Expand_Dispatching_Constructor_Call -- ----------------------------------------- *************** package body Exp_Intr is *** 171,181 **** Iface_Tag := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('V')), ! Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), ! Expression => Make_Function_Call (Loc, Name => New_Reference_To (RTE (RE_Secondary_Tag), Loc), Parameter_Associations => New_List ( --- 236,245 ---- Iface_Tag := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'V'), ! Object_Definition => New_Reference_To (RTE (RE_Tag), Loc), ! Expression => Make_Function_Call (Loc, Name => New_Reference_To (RTE (RE_Secondary_Tag), Loc), Parameter_Associations => New_List ( *************** package body Exp_Intr is *** 325,331 **** -- be referencing it by normal visibility methods. if No (Choice_Parameter (P)) then ! E := Make_Defining_Identifier (Loc, New_Internal_Name ('E')); Set_Choice_Parameter (P, E); Set_Ekind (E, E_Variable); Set_Etype (E, RTE (RE_Exception_Occurrence)); --- 389,395 ---- -- be referencing it by normal visibility methods. if No (Choice_Parameter (P)) then ! E := Make_Temporary (Loc, 'E'); Set_Choice_Parameter (P, E); Set_Ekind (E, E_Variable); Set_Etype (E, RTE (RE_Exception_Occurrence)); *************** package body Exp_Intr is *** 362,372 **** Loc : constant Source_Ptr := Sloc (N); Ent : constant Entity_Id := Entity (Name (N)); Str : constant Node_Id := First_Actual (N); ! Dum : Entity_Id; begin - Dum := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); - Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Dum, --- 426,434 ---- Loc : constant Source_Ptr := Sloc (N); Ent : constant Entity_Id := Entity (Name (N)); Str : constant Node_Id := First_Actual (N); ! Dum : constant Entity_Id := Make_Temporary (Loc, 'D'); begin Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Dum, *************** package body Exp_Intr is *** 490,495 **** --- 552,560 ---- elsif Present (Alias (E)) then Expand_Intrinsic_Call (N, Alias (E)); + elsif Nkind (N) in N_Binary_Op then + Expand_Binary_Operator_Call (N); + -- The only other case is where an external name was specified, -- since this is the only way that an otherwise unrecognized -- name could escape the checking in Sem_Prag. Nothing needs *************** package body Exp_Intr is *** 804,810 **** Rtyp : constant Entity_Id := Underlying_Type (Root_Type (Typ)); Pool : constant Entity_Id := Associated_Storage_Pool (Rtyp); ! Desig_T : constant Entity_Id := Designated_Type (Typ); Gen_Code : Node_Id; Free_Node : Node_Id; Deref : Node_Id; --- 869,875 ---- Rtyp : constant Entity_Id := Underlying_Type (Root_Type (Typ)); Pool : constant Entity_Id := Associated_Storage_Pool (Rtyp); ! Desig_T : constant Entity_Id := Designated_Type (Typ); Gen_Code : Node_Id; Free_Node : Node_Id; Deref : Node_Id; *************** package body Exp_Intr is *** 819,828 **** -- them to the tree, and that can disturb current value settings. begin - if No_Pool_Assigned (Rtyp) then - Error_Msg_N ("?deallocation from empty storage pool!", N); - end if; - -- Nothing to do if we know the argument is null if Known_Null (N) then --- 884,889 ---- *************** package body Exp_Intr is *** 967,972 **** --- 1028,1037 ---- Append_To (Stmts, Free_Node); Set_Storage_Pool (Free_Node, Pool); + -- Attach to tree before analysis of generated subtypes below. + + Set_Parent (Stmts, Parent (N)); + -- Deal with storage pool if Present (Pool) then *************** package body Exp_Intr is *** 1025,1037 **** D_Type := Entity (D_Subtyp); else ! D_Type := Make_Defining_Identifier (Loc, ! New_Internal_Name ('A')); Insert_Action (Deref, Make_Subtype_Declaration (Loc, Defining_Identifier => D_Type, Subtype_Indication => D_Subtyp)); - end if; -- Force freezing at the point of the dereference. For the --- 1090,1100 ---- D_Type := Entity (D_Subtyp); else ! D_Type := Make_Temporary (Loc, 'A'); Insert_Action (Deref, Make_Subtype_Declaration (Loc, Defining_Identifier => D_Type, Subtype_Indication => D_Subtyp)); end if; -- Force freezing at the point of the dereference. For the diff -Nrcpad gcc-4.5.2/gcc/ada/exp_intr.ads gcc-4.6.0/gcc/ada/exp_intr.ads *** gcc-4.5.2/gcc/ada/exp_intr.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/exp_intr.ads Tue Oct 19 10:54:58 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Types; use Types; *** 30,39 **** package Exp_Intr is procedure Expand_Intrinsic_Call (N : Node_Id; E : Entity_Id); ! -- N is either a function call node, or a procedure call statement node ! -- where the corresponding subprogram is intrinsic (i.e. was the subject ! -- of a Import or Interface pragma specifying the subprogram as intrinsic. ! -- The effect is to replace the call with appropriate specialized nodes. ! -- The second argument is the entity for the subprogram spec. end Exp_Intr; --- 30,40 ---- package Exp_Intr is procedure Expand_Intrinsic_Call (N : Node_Id; E : Entity_Id); ! -- N is either a function call node, a procedure call statement node, or ! -- an operator where the corresponding subprogram is intrinsic (i.e. was ! -- the subject of a Import or Interface pragma specifying the subprogram ! -- as intrinsic. The effect is to replace the call with appropriate ! -- specialized nodes. The second argument is the entity for the ! -- subprogram spec. end Exp_Intr; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_pakd.adb gcc-4.6.0/gcc/ada/exp_pakd.adb *** gcc-4.5.2/gcc/ada/exp_pakd.adb Wed Apr 22 09:46:29 2009 --- gcc-4.6.0/gcc/ada/exp_pakd.adb Tue Oct 26 13:00:05 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Pakd is *** 67,89 **** -- For big-endian machines, element zero is at the left hand end -- (high order end) of a bit field. ! -- The shifts that are used to right justify a field therefore differ ! -- in the two cases. For the little-endian case, we can simply use the ! -- bit number (i.e. the element number * element size) as the count for ! -- a right shift. For the big-endian case, we have to subtract the shift ! -- count from an appropriate constant to use in the right shift. We use ! -- rotates instead of shifts (which is necessary in the store case to ! -- preserve other fields), and we expect that the backend will be able ! -- to change the right rotate into a left rotate, avoiding the subtract, ! -- if the architecture provides such an instruction. ---------------------------------------------- -- Entity Tables for Packed Access Routines -- ---------------------------------------------- ! -- For the cases of component size = 3,5-7,9-15,17-31,33-63 we call ! -- library routines. This table is used to obtain the entity for the ! -- proper routine. type E_Array is array (Int range 01 .. 63) of RE_Id; --- 67,88 ---- -- For big-endian machines, element zero is at the left hand end -- (high order end) of a bit field. ! -- The shifts that are used to right justify a field therefore differ in ! -- the two cases. For the little-endian case, we can simply use the bit ! -- number (i.e. the element number * element size) as the count for a right ! -- shift. For the big-endian case, we have to subtract the shift count from ! -- an appropriate constant to use in the right shift. We use rotates ! -- instead of shifts (which is necessary in the store case to preserve ! -- other fields), and we expect that the backend will be able to change the ! -- right rotate into a left rotate, avoiding the subtract, if the machine ! -- architecture provides such an instruction. ---------------------------------------------- -- Entity Tables for Packed Access Routines -- ---------------------------------------------- ! -- For the cases of component size = 3,5-7,9-15,17-31,33-63 we call library ! -- routines. This table provides the entity for the proper routine. type E_Array is array (Int range 01 .. 63) of RE_Id; *************** package body Exp_Pakd is *** 157,166 **** 62 => RE_Bits_62, 63 => RE_Bits_63); ! -- Array of Get routine entities. These are used to obtain an element ! -- from a packed array. The N'th entry is used to obtain elements from ! -- a packed array whose component size is N. RE_Null is used as a null ! -- entry, for the cases where a library routine is not used. Get_Id : constant E_Array := (01 => RE_Null, --- 156,165 ---- 62 => RE_Bits_62, 63 => RE_Bits_63); ! -- Array of Get routine entities. These are used to obtain an element from ! -- a packed array. The N'th entry is used to obtain elements from a packed ! -- array whose component size is N. RE_Null is used as a null entry, for ! -- the cases where a library routine is not used. Get_Id : constant E_Array := (01 => RE_Null, *************** package body Exp_Pakd is *** 228,236 **** 63 => RE_Get_63); -- Array of Get routine entities to be used in the case where the packed ! -- array is itself a component of a packed structure, and therefore may ! -- not be fully aligned. This only affects the even sizes, since for the ! -- odd sizes, we do not get any fixed alignment in any case. GetU_Id : constant E_Array := (01 => RE_Null, --- 227,235 ---- 63 => RE_Get_63); -- Array of Get routine entities to be used in the case where the packed ! -- array is itself a component of a packed structure, and therefore may not ! -- be fully aligned. This only affects the even sizes, since for the odd ! -- sizes, we do not get any fixed alignment in any case. GetU_Id : constant E_Array := (01 => RE_Null, *************** package body Exp_Pakd is *** 297,306 **** 62 => RE_GetU_62, 63 => RE_Get_63); ! -- Array of Set routine entities. These are used to assign an element ! -- of a packed array. The N'th entry is used to assign elements for ! -- a packed array whose component size is N. RE_Null is used as a null ! -- entry, for the cases where a library routine is not used. Set_Id : constant E_Array := (01 => RE_Null, --- 296,305 ---- 62 => RE_GetU_62, 63 => RE_Get_63); ! -- Array of Set routine entities. These are used to assign an element of a ! -- packed array. The N'th entry is used to assign elements for a packed ! -- array whose component size is N. RE_Null is used as a null entry, for ! -- the cases where a library routine is not used. Set_Id : constant E_Array := (01 => RE_Null, *************** package body Exp_Pakd is *** 368,376 **** 63 => RE_Set_63); -- Array of Set routine entities to be used in the case where the packed ! -- array is itself a component of a packed structure, and therefore may ! -- not be fully aligned. This only affects the even sizes, since for the ! -- odd sizes, we do not get any fixed alignment in any case. SetU_Id : constant E_Array := (01 => RE_Null, --- 367,375 ---- 63 => RE_Set_63); -- Array of Set routine entities to be used in the case where the packed ! -- array is itself a component of a packed structure, and therefore may not ! -- be fully aligned. This only affects the even sizes, since for the odd ! -- sizes, we do not get any fixed alignment in any case. SetU_Id : constant E_Array := (01 => RE_Null, *************** package body Exp_Pakd is *** 445,460 **** (Atyp : Entity_Id; N : Node_Id; Subscr : out Node_Id); ! -- Given a constrained array type Atyp, and an indexed component node ! -- N referencing an array object of this type, build an expression of ! -- type Standard.Integer representing the zero-based linear subscript ! -- value. This expression includes any required range checks. procedure Convert_To_PAT_Type (Aexp : Node_Id); -- Given an expression of a packed array type, builds a corresponding -- expression whose type is the implementation type used to represent -- the packed array. Aexp is analyzed and resolved on entry and on exit. function Known_Aligned_Enough (Obj : Node_Id; Csiz : Nat) return Boolean; -- There are two versions of the Set routines, the ones used when the -- object is known to be sufficiently well aligned given the number of --- 444,468 ---- (Atyp : Entity_Id; N : Node_Id; Subscr : out Node_Id); ! -- Given a constrained array type Atyp, and an indexed component node N ! -- referencing an array object of this type, build an expression of type ! -- Standard.Integer representing the zero-based linear subscript value. ! -- This expression includes any required range checks. procedure Convert_To_PAT_Type (Aexp : Node_Id); -- Given an expression of a packed array type, builds a corresponding -- expression whose type is the implementation type used to represent -- the packed array. Aexp is analyzed and resolved on entry and on exit. + procedure Get_Base_And_Bit_Offset + (N : Node_Id; + Base : out Node_Id; + Offset : out Node_Id); + -- Given a node N for a name which involves a packed array reference, + -- return the base object of the reference and build an expression of + -- type Standard.Integer representing the zero-based offset in bits + -- from Base'Address to the first bit of the reference. + function Known_Aligned_Enough (Obj : Node_Id; Csiz : Nat) return Boolean; -- There are two versions of the Set routines, the ones used when the -- object is known to be sufficiently well aligned given the number of *************** package body Exp_Pakd is *** 1134,1149 **** (Len_Bits <= System_Word_Size or else (Len_Bits <= System_Max_Binary_Modulus_Power and then Support_Long_Shifts_On_Target)) - - -- Also test for alignment given. If an alignment is given which - -- is smaller than the natural modular alignment, force the array - -- of bytes representation to accommodate the alignment. - - and then - (No (Alignment_Clause (Typ)) - or else - Alignment (Typ) >= ((Len_Bits + System_Storage_Unit) - / System_Storage_Unit)) then -- We can use the modular type, it has the form: --- 1142,1147 ---- *************** package body Exp_Pakd is *** 1193,1198 **** --- 1191,1204 ---- end if; Install_PAT; + + -- Propagate a given alignment to the modular type. This can + -- cause it to be under-aligned, but that's OK. + + if Present (Alignment_Clause (Typ)) then + Set_Alignment (PAT, Alignment (Typ)); + end if; + return; end if; end if; *************** package body Exp_Pakd is *** 1333,1338 **** --- 1339,1352 ---- Ctyp := Component_Type (Atyp); Csiz := UI_To_Int (Component_Size (Atyp)); + -- We remove side effects, in case the rhs modifies the lhs, because we + -- are about to transform the rhs into an expression that first READS + -- the lhs, so we can do the necessary shifting and masking. Example: + -- "X(2) := F(...);" where F modifies X(3). Otherwise, the side effect + -- will be lost. + + Remove_Side_Effects (Rhs); + -- We convert the right hand side to the proper subtype to ensure -- that an appropriate range check is made (since the normal range -- check from assignment will be lost in the transformations). This *************** package body Exp_Pakd is *** 1349,1358 **** begin Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('T')), ! Object_Definition => New_Occurrence_Of (Ctyp, Loc), ! Expression => New_Copy_Tree (Rhs)); Insert_Actions (N, New_List (Decl)); Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc); --- 1363,1371 ---- begin Decl := Make_Object_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'T', Rhs), ! Object_Definition => New_Occurrence_Of (Ctyp, Loc), ! Expression => New_Copy_Tree (Rhs)); Insert_Actions (N, New_List (Decl)); Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc); *************** package body Exp_Pakd is *** 1375,1380 **** --- 1388,1406 ---- Analyze_And_Resolve (Rhs, Ctyp); end if; + -- For the AAMP target, indexing of certain packed array is passed + -- through to the back end without expansion, because the expansion + -- results in very inefficient code on that target. This allows the + -- GNAAMP back end to generate specialized macros that support more + -- efficient indexing of packed arrays with components having sizes + -- that are small powers of two. + + if AAMP_On_Target + and then (Csiz = 1 or else Csiz = 2 or else Csiz = 4) + then + return; + end if; + -- Case of component size 1,2,4 or any component size for the modular -- case. These are the cases for which we can inline the code. *************** package body Exp_Pakd is *** 1385,1393 **** -- The statement to be generated is: ! -- Obj := atyp!((Obj and Mask1) or (shift_left (rhs, shift))) ! -- where mask1 is obtained by shifting Cmask left Shift bits -- and then complementing the result. -- the "and Mask1" is omitted if rhs is constant and all 1 bits --- 1411,1419 ---- -- The statement to be generated is: ! -- Obj := atyp!((Obj and Mask1) or (shift_left (rhs, Shift))) ! -- where Mask1 is obtained by shifting Cmask left Shift bits -- and then complementing the result. -- the "and Mask1" is omitted if rhs is constant and all 1 bits *************** package body Exp_Pakd is *** 1420,1440 **** Rhs_Val_Known := False; end if; ! -- Some special checks for the case where the right hand value ! -- is known at compile time. Basically we have to take care of ! -- the implicit conversion to the subtype of the component object. if Rhs_Val_Known then ! -- If we have a biased component type then we must manually do ! -- the biasing, since we are taking responsibility in this case ! -- for constructing the exact bit pattern to be used. if Has_Biased_Representation (Ctyp) then Rhs_Val := Rhs_Val - Expr_Rep_Value (Type_Low_Bound (Ctyp)); end if; ! -- For a negative value, we manually convert the twos complement -- value to a corresponding unsigned value, so that the proper -- field width is maintained. If we did not do this, we would -- get too many leading sign bits later on. --- 1446,1466 ---- Rhs_Val_Known := False; end if; ! -- Some special checks for the case where the right hand value is ! -- known at compile time. Basically we have to take care of the ! -- implicit conversion to the subtype of the component object. if Rhs_Val_Known then ! -- If we have a biased component type then we must manually do the ! -- biasing, since we are taking responsibility in this case for ! -- constructing the exact bit pattern to be used. if Has_Biased_Representation (Ctyp) then Rhs_Val := Rhs_Val - Expr_Rep_Value (Type_Low_Bound (Ctyp)); end if; ! -- For a negative value, we manually convert the two's complement -- value to a corresponding unsigned value, so that the proper -- field width is maintained. If we did not do this, we would -- get too many leading sign bits later on. *************** package body Exp_Pakd is *** 1517,1524 **** Rhs := Unchecked_Convert_To (RTE (Bits_Id (Csiz)), Rhs); end if; ! -- Set Etype, since it can be referenced before the ! -- node is completely analyzed. Set_Etype (Rhs, Etyp); --- 1543,1550 ---- Rhs := Unchecked_Convert_To (RTE (Bits_Id (Csiz)), Rhs); end if; ! -- Set Etype, since it can be referenced before the node is ! -- completely analyzed. Set_Etype (Rhs, Etyp); *************** package body Exp_Pakd is *** 1666,1683 **** procedure Expand_Packed_Address_Reference (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Ploc : Source_Ptr; ! Pref : Node_Id; ! Expr : Node_Id; ! Term : Node_Id; ! Atyp : Entity_Id; ! Subscr : Node_Id; begin ! Pref := Prefix (N); ! Expr := Empty; ! ! -- We build up an expression serially that has the form -- outer_object'Address -- + (linear-subscript * component_size for each array reference --- 1692,1702 ---- procedure Expand_Packed_Address_Reference (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); ! Base : Node_Id; ! Offset : Node_Id; begin ! -- We build an expression that has the form -- outer_object'Address -- + (linear-subscript * component_size for each array reference *************** package body Exp_Pakd is *** 1685,1733 **** -- + ... -- + ...) / Storage_Unit; ! -- Some additional conversions are required to deal with the addition ! -- operation, which is not normally visible to generated code. ! ! loop ! Ploc := Sloc (Pref); ! ! if Nkind (Pref) = N_Indexed_Component then ! Convert_To_Actual_Subtype (Prefix (Pref)); ! Atyp := Etype (Prefix (Pref)); ! Compute_Linear_Subscript (Atyp, Pref, Subscr); ! ! Term := ! Make_Op_Multiply (Ploc, ! Left_Opnd => Subscr, ! Right_Opnd => ! Make_Attribute_Reference (Ploc, ! Prefix => New_Occurrence_Of (Atyp, Ploc), ! Attribute_Name => Name_Component_Size)); ! ! elsif Nkind (Pref) = N_Selected_Component then ! Term := ! Make_Attribute_Reference (Ploc, ! Prefix => Selector_Name (Pref), ! Attribute_Name => Name_Bit_Position); ! ! else ! exit; ! end if; ! ! Term := Convert_To (RTE (RE_Integer_Address), Term); ! ! if No (Expr) then ! Expr := Term; ! ! else ! Expr := ! Make_Op_Add (Ploc, ! Left_Opnd => Expr, ! Right_Opnd => Term); ! end if; ! ! Pref := Prefix (Pref); ! end loop; Rewrite (N, Unchecked_Convert_To (RTE (RE_Address), --- 1704,1710 ---- -- + ... -- + ...) / Storage_Unit; ! Get_Base_And_Bit_Offset (Prefix (N), Base, Offset); Rewrite (N, Unchecked_Convert_To (RTE (RE_Address), *************** package body Exp_Pakd is *** 1735,1752 **** Left_Opnd => Unchecked_Convert_To (RTE (RE_Integer_Address), Make_Attribute_Reference (Loc, ! Prefix => Pref, Attribute_Name => Name_Address)), Right_Opnd => ! Make_Op_Divide (Loc, ! Left_Opnd => Expr, ! Right_Opnd => ! Make_Integer_Literal (Loc, System_Storage_Unit))))); Analyze_And_Resolve (N, RTE (RE_Address)); end Expand_Packed_Address_Reference; ------------------------------------ -- Expand_Packed_Boolean_Operator -- ------------------------------------ --- 1712,1758 ---- Left_Opnd => Unchecked_Convert_To (RTE (RE_Integer_Address), Make_Attribute_Reference (Loc, ! Prefix => Base, Attribute_Name => Name_Address)), Right_Opnd => ! Unchecked_Convert_To (RTE (RE_Integer_Address), ! Make_Op_Divide (Loc, ! Left_Opnd => Offset, ! Right_Opnd => ! Make_Integer_Literal (Loc, System_Storage_Unit)))))); Analyze_And_Resolve (N, RTE (RE_Address)); end Expand_Packed_Address_Reference; + --------------------------------- + -- Expand_Packed_Bit_Reference -- + --------------------------------- + + procedure Expand_Packed_Bit_Reference (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + Base : Node_Id; + Offset : Node_Id; + + begin + -- We build an expression that has the form + + -- (linear-subscript * component_size for each array reference + -- + field'Bit_Position for each record field + -- + ... + -- + ...) mod Storage_Unit; + + Get_Base_And_Bit_Offset (Prefix (N), Base, Offset); + + Rewrite (N, + Unchecked_Convert_To (Universal_Integer, + Make_Op_Mod (Loc, + Left_Opnd => Offset, + Right_Opnd => Make_Integer_Literal (Loc, System_Storage_Unit)))); + + Analyze_And_Resolve (N, Universal_Integer); + end Expand_Packed_Bit_Reference; + ------------------------------------ -- Expand_Packed_Boolean_Operator -- ------------------------------------ *************** package body Exp_Pakd is *** 1843,1853 **** else declare ! Result_Ent : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); ! ! E_Id : RE_Id; begin if Nkind (N) = N_Op_And then --- 1849,1856 ---- else declare ! Result_Ent : constant Entity_Id := Make_Temporary (Loc, 'T'); ! E_Id : RE_Id; begin if Nkind (N) = N_Op_And then *************** package body Exp_Pakd is *** 1950,1955 **** --- 1953,1971 ---- Ctyp := Component_Type (Atyp); Csiz := UI_To_Int (Component_Size (Atyp)); + -- For the AAMP target, indexing of certain packed array is passed + -- through to the back end without expansion, because the expansion + -- results in very inefficient code on that target. This allows the + -- GNAAMP back end to generate specialized macros that support more + -- efficient indexing of packed arrays with components having sizes + -- that are small powers of two. + + if AAMP_On_Target + and then (Csiz = 1 or else Csiz = 2 or else Csiz = 4) + then + return; + end if; + -- Case of component size 1,2,4 or any component size for the modular -- case. These are the cases for which we can inline the code. *************** package body Exp_Pakd is *** 1982,1989 **** Set_Parent (Arg, Parent (N)); Analyze_And_Resolve (Arg); ! Rewrite (N, ! RJ_Unchecked_Convert_To (Ctyp, Arg)); -- All other component sizes for non-modular case --- 1998,2004 ---- Set_Parent (Arg, Parent (N)); Analyze_And_Resolve (Arg); ! Rewrite (N, RJ_Unchecked_Convert_To (Ctyp, Arg)); -- All other component sizes for non-modular case *************** package body Exp_Pakd is *** 2160,2173 **** Convert_To_PAT_Type (Opnd); PAT := Etype (Opnd); ! -- For the case where the packed array type is a modular type, ! -- not A expands simply into: ! -- rtyp!(PAT!(A) xor mask) ! -- where PAT is the packed array type, and mask is a mask of all ! -- one bits of length equal to the size of this packed type and ! -- rtyp is the actual subtype of the operand Lit := Make_Integer_Literal (Loc, 2 ** RM_Size (PAT) - 1); Set_Print_In_Hex (Lit); --- 2175,2188 ---- Convert_To_PAT_Type (Opnd); PAT := Etype (Opnd); ! -- For the case where the packed array type is a modular type, "not A" ! -- expands simply into: ! -- Rtyp!(PAT!(A) xor Mask) ! -- where PAT is the packed array type, Mask is a mask of all 1 bits of ! -- length equal to the size of this packed type, and Rtyp is the actual ! -- actual subtype of the operand. Lit := Make_Integer_Literal (Loc, 2 ** RM_Size (PAT) - 1); Set_Print_In_Hex (Lit); *************** package body Exp_Pakd is *** 2185,2214 **** -- System.Bit_Ops.Bit_Not -- (Opnd'Address, ! -- Typ'Length * Typ'Component_Size; -- Result'Address); ! -- where Opnd is the Packed_Bytes{1,2,4} operand and the second ! -- argument is the length of the operand in bits. Then we replace ! -- the expression by a reference to Result. else declare ! Result_Ent : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); begin Insert_Actions (N, New_List ( - Make_Object_Declaration (Loc, Defining_Identifier => Result_Ent, ! Object_Definition => New_Occurrence_Of (Rtyp, Loc)), Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Bit_Not), Loc), Parameter_Associations => New_List ( - Make_Byte_Aligned_Attribute_Reference (Loc, Prefix => Opnd, Attribute_Name => Name_Address), --- 2200,2225 ---- -- System.Bit_Ops.Bit_Not -- (Opnd'Address, ! -- Typ'Length * Typ'Component_Size, -- Result'Address); ! -- where Opnd is the Packed_Bytes{1,2,4} operand and the second argument ! -- is the length of the operand in bits. We then replace the expression ! -- with a reference to Result. else declare ! Result_Ent : constant Entity_Id := Make_Temporary (Loc, 'T'); begin Insert_Actions (N, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Result_Ent, ! Object_Definition => New_Occurrence_Of (Rtyp, Loc)), Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Bit_Not), Loc), Parameter_Associations => New_List ( Make_Byte_Aligned_Attribute_Reference (Loc, Prefix => Opnd, Attribute_Name => Name_Address), *************** package body Exp_Pakd is *** 2225,2242 **** Make_Integer_Literal (Loc, Component_Size (Rtyp))), Make_Byte_Aligned_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Result_Ent, Loc), Attribute_Name => Name_Address))))); ! Rewrite (N, ! New_Occurrence_Of (Result_Ent, Loc)); end; end if; Analyze_And_Resolve (N, Typ, Suppress => All_Checks); - end Expand_Packed_Not; ------------------------------------- -- Involves_Packed_Array_Reference -- ------------------------------------- --- 2236,2315 ---- Make_Integer_Literal (Loc, Component_Size (Rtyp))), Make_Byte_Aligned_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Result_Ent, Loc), Attribute_Name => Name_Address))))); ! Rewrite (N, New_Occurrence_Of (Result_Ent, Loc)); end; end if; Analyze_And_Resolve (N, Typ, Suppress => All_Checks); end Expand_Packed_Not; + ----------------------------- + -- Get_Base_And_Bit_Offset -- + ----------------------------- + + procedure Get_Base_And_Bit_Offset + (N : Node_Id; + Base : out Node_Id; + Offset : out Node_Id) + is + Loc : Source_Ptr; + Term : Node_Id; + Atyp : Entity_Id; + Subscr : Node_Id; + + begin + Base := N; + Offset := Empty; + + -- We build up an expression serially that has the form + + -- linear-subscript * component_size for each array reference + -- + field'Bit_Position for each record field + -- + ... + + loop + Loc := Sloc (Base); + + if Nkind (Base) = N_Indexed_Component then + Convert_To_Actual_Subtype (Prefix (Base)); + Atyp := Etype (Prefix (Base)); + Compute_Linear_Subscript (Atyp, Base, Subscr); + + Term := + Make_Op_Multiply (Loc, + Left_Opnd => Subscr, + Right_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (Atyp, Loc), + Attribute_Name => Name_Component_Size)); + + elsif Nkind (Base) = N_Selected_Component then + Term := + Make_Attribute_Reference (Loc, + Prefix => Selector_Name (Base), + Attribute_Name => Name_Bit_Position); + + else + return; + end if; + + if No (Offset) then + Offset := Term; + + else + Offset := + Make_Op_Add (Loc, + Left_Opnd => Offset, + Right_Opnd => Term); + end if; + + Base := Prefix (Base); + end loop; + end Get_Base_And_Bit_Offset; + ------------------------------------- -- Involves_Packed_Array_Reference -- ------------------------------------- *************** package body Exp_Pakd is *** 2440,2466 **** Source_Siz := UI_To_Int (RM_Size (Source_Typ)); Target_Siz := UI_To_Int (RM_Size (Target_Typ)); ! -- First step, if the source type is not a discrete type, then we ! -- first convert to a modular type of the source length, since ! -- otherwise, on a big-endian machine, we get left-justification. ! -- We do it for little-endian machines as well, because there might ! -- be junk bits that are not cleared if the type is not numeric. if Source_Siz /= Target_Siz ! and then not Is_Discrete_Type (Source_Typ) then Src := Unchecked_Convert_To (RTE (Bits_Id (Source_Siz)), Src); end if; ! -- In the big endian case, if the lengths of the two types differ, ! -- then we must worry about possible left justification in the ! -- conversion, and avoiding that is what this is all about. if Bytes_Big_Endian and then Source_Siz /= Target_Siz then -- Next step. If the target is not a discrete type, then we first ! -- convert to a modular type of the target length, since ! -- otherwise, on a big-endian machine, we get left-justification. if not Is_Discrete_Type (Target_Typ) then Src := Unchecked_Convert_To (RTE (Bits_Id (Target_Siz)), Src); --- 2513,2539 ---- Source_Siz := UI_To_Int (RM_Size (Source_Typ)); Target_Siz := UI_To_Int (RM_Size (Target_Typ)); ! -- First step, if the source type is not a discrete type, then we first ! -- convert to a modular type of the source length, since otherwise, on ! -- a big-endian machine, we get left-justification. We do it for little- ! -- endian machines as well, because there might be junk bits that are ! -- not cleared if the type is not numeric. if Source_Siz /= Target_Siz ! and then not Is_Discrete_Type (Source_Typ) then Src := Unchecked_Convert_To (RTE (Bits_Id (Source_Siz)), Src); end if; ! -- In the big endian case, if the lengths of the two types differ, then ! -- we must worry about possible left justification in the conversion, ! -- and avoiding that is what this is all about. if Bytes_Big_Endian and then Source_Siz /= Target_Siz then -- Next step. If the target is not a discrete type, then we first ! -- convert to a modular type of the target length, since otherwise, ! -- on a big-endian machine, we get left-justification. if not Is_Discrete_Type (Target_Typ) then Src := Unchecked_Convert_To (RTE (Bits_Id (Target_Siz)), Src); *************** package body Exp_Pakd is *** 2476,2491 **** -- Setup_Enumeration_Packed_Array_Reference -- ---------------------------------------------- ! -- All we have to do here is to find the subscripts that correspond ! -- to the index positions that have non-standard enumeration types ! -- and insert a Pos attribute to get the proper subscript value. ! -- Finally the prefix must be uncheck converted to the corresponding ! -- packed array type. ! -- Note that the component type is unchanged, so we do not need to ! -- fiddle with the types (Gigi always automatically takes the packed ! -- array type if it is set, as it will be in this case). procedure Setup_Enumeration_Packed_Array_Reference (N : Node_Id) is Pfx : constant Node_Id := Prefix (N); --- 2549,2564 ---- -- Setup_Enumeration_Packed_Array_Reference -- ---------------------------------------------- ! -- All we have to do here is to find the subscripts that correspond to the ! -- index positions that have non-standard enumeration types and insert a ! -- Pos attribute to get the proper subscript value. ! -- Finally the prefix must be uncheck-converted to the corresponding packed ! -- array type. ! -- Note that the component type is unchanged, so we do not need to fiddle ! -- with the types (Gigi always automatically takes the packed array type if ! -- it is set, as it will be in this case). procedure Setup_Enumeration_Packed_Array_Reference (N : Node_Id) is Pfx : constant Node_Id := Prefix (N); *************** package body Exp_Pakd is *** 2494,2502 **** Expr : Node_Id; begin ! -- If the array is unconstrained, then we replace the array ! -- reference with its actual subtype. This actual subtype will ! -- have a packed array type with appropriate bounds. if not Is_Constrained (Packed_Array_Type (Etype (Pfx))) then Convert_To_Actual_Subtype (Pfx); --- 2567,2575 ---- Expr : Node_Id; begin ! -- If the array is unconstrained, then we replace the array reference ! -- with its actual subtype. This actual subtype will have a packed array ! -- type with appropriate bounds. if not Is_Constrained (Packed_Array_Type (Etype (Pfx))) then Convert_To_Actual_Subtype (Pfx); *************** package body Exp_Pakd is *** 2531,2537 **** Expressions => Exprs)); Analyze_And_Resolve (N, Typ); - end Setup_Enumeration_Packed_Array_Reference; ----------------------------------------- --- 2604,2609 ---- *************** package body Exp_Pakd is *** 2578,2585 **** Compute_Linear_Subscript (Atyp, N, Shift); ! -- If the component size is not 1, then the subscript must be ! -- multiplied by the component size to get the shift count. if Csiz /= 1 then Shift := --- 2650,2657 ---- Compute_Linear_Subscript (Atyp, N, Shift); ! -- If the component size is not 1, then the subscript must be multiplied ! -- by the component size to get the shift count. if Csiz /= 1 then Shift := *************** package body Exp_Pakd is *** 2588,2595 **** Right_Opnd => Shift); end if; ! -- If we have the array case, then this shift count must be broken ! -- down into a byte subscript, and a shift within the byte. if Is_Array_Type (PAT) then --- 2660,2667 ---- Right_Opnd => Shift); end if; ! -- If we have the array case, then this shift count must be broken down ! -- into a byte subscript, and a shift within the byte. if Is_Array_Type (PAT) then *************** package body Exp_Pakd is *** 2625,2633 **** Shift := New_Shift; end; ! -- For the modular integer case, the object to be manipulated is ! -- the entire array, so Obj is unchanged. Note that we will reset ! -- its type to PAT before returning to the caller. else null; --- 2697,2705 ---- Shift := New_Shift; end; ! -- For the modular integer case, the object to be manipulated is the ! -- entire array, so Obj is unchanged. Note that we will reset its type ! -- to PAT before returning to the caller. else null; *************** package body Exp_Pakd is *** 2643,2656 **** -- Here we have the case of 2-bit fields ! -- For the little-endian case, we already have the proper shift ! -- count set, e.g. for element 2, the shift count is 2*2 = 4. ! -- For the big endian case, we have to adjust the shift count, ! -- computing it as (N - F) - shift, where N is the number of bits ! -- in an element of the array used to implement the packed array, ! -- F is the number of bits in a source level array element, and ! -- shift is the count so far computed. if Bytes_Big_Endian then Shift := --- 2715,2727 ---- -- Here we have the case of 2-bit fields ! -- For the little-endian case, we already have the proper shift count ! -- set, e.g. for element 2, the shift count is 2*2 = 4. ! -- For the big endian case, we have to adjust the shift count, computing ! -- it as (N - F) - Shift, where N is the number of bits in an element of ! -- the array used to implement the packed array, F is the number of bits ! -- in a source array element, and Shift is the count so far computed. if Bytes_Big_Endian then Shift := diff -Nrcpad gcc-4.5.2/gcc/ada/exp_pakd.ads gcc-4.6.0/gcc/ada/exp_pakd.ads *** gcc-4.5.2/gcc/ada/exp_pakd.ads Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/exp_pakd.ads Tue Jun 22 10:07:05 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Pakd is *** 272,275 **** --- 272,280 ---- -- the prefix involves a packed array reference. This routine expands the -- necessary code for performing the address reference in this case. + procedure Expand_Packed_Bit_Reference (N : Node_Id); + -- The node N is an attribute reference for the 'Bit reference, where the + -- prefix involves a packed array reference. This routine expands the + -- necessary code for performing the bit reference in this case. + end Exp_Pakd; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_prag.adb gcc-4.6.0/gcc/ada/exp_prag.adb *** gcc-4.5.2/gcc/ada/exp_prag.adb Mon Jul 20 13:48:01 2009 --- gcc-4.6.0/gcc/ada/exp_prag.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Prag is *** 269,276 **** -------------------------- procedure Expand_Pragma_Check (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); Cond : constant Node_Id := Arg2 (N); Nam : constant Name_Id := Chars (Arg1 (N)); Msg : Node_Id; --- 269,276 ---- -------------------------- procedure Expand_Pragma_Check (N : Node_Id) is Cond : constant Node_Id := Arg2 (N); + Loc : constant Source_Ptr := Sloc (Cond); Nam : constant Name_Id := Chars (Arg1 (N)); Msg : Node_Id; *************** package body Exp_Prag is *** 294,300 **** -- where Str is the message if one is present, or the default of -- 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. --- 294,300 ---- -- where Str is the message if one is present, or the default of -- 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. *************** package body Exp_Prag is *** 310,315 **** --- 310,318 ---- -- be able to handle the assert error (which would not be the case if a -- call is made to the Raise_Assert_Failure procedure). + -- We also generate the direct raise if the Suppress_Exception_Locations + -- is active, since we don't want to generate messages in this case. + -- Note that the reason we do not always generate a direct raise is that -- the form in which the procedure is called allows for more efficient -- breakpointing of assertion errors. *************** package body Exp_Prag is *** 320,328 **** -- Case where we generate a direct raise ! if (Debug_Flag_Dot_G or else Restriction_Active (No_Exception_Propagation)) ! and then Present (Find_Local_Handler (RTE (RE_Assert_Failure), N)) then Rewrite (N, Make_If_Statement (Loc, --- 323,332 ---- -- Case where we generate a direct raise ! if ((Debug_Flag_Dot_G or else Restriction_Active (No_Exception_Propagation)) ! and then Present (Find_Local_Handler (RTE (RE_Assert_Failure), N))) ! or else (Opt.Exception_Locations_Suppressed and then No (Arg3 (N))) then Rewrite (N, Make_If_Statement (Loc, *************** package body Exp_Prag is *** 337,365 **** -- Case where we call the procedure else - -- 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. 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 := ! Make_String_Literal (Loc, ! Strval => String_From_Name_Buffer); end if; -- Now rewrite as an if statement --- 341,402 ---- -- Case where we call the procedure else -- If we have a message given, use it if Present (Arg3 (N)) then ! Msg := Get_Pragma_Arg (Arg3 (N)); ! -- Here we have no string, so prepare one else ! declare ! Msg_Loc : constant String := Build_Location_String (Loc); ! ! begin Name_Len := 0; ! -- For Assert, we just use the location ! ! if Nam = Name_Assertion then ! null; ! ! -- For predicate, we generate the string "predicate failed ! -- at yyy". We prefer all lower case for predicate. ! ! elsif Nam = Name_Predicate then ! Add_Str_To_Name_Buffer ("predicate failed at "); ! ! -- For special case of Precondition/Postcondition the string is ! -- "failed xx from yy" where xx is precondition/postcondition ! -- in all lower case. The reason for this different wording is ! -- that the failure is not at the point of occurrence of the ! -- pragma, unlike the other Check cases. ! ! elsif Nam = Name_Precondition ! or else ! Nam = Name_Postcondition ! then ! Get_Name_String (Nam); ! Insert_Str_In_Name_Buffer ("failed ", 1); ! Add_Str_To_Name_Buffer (" from "); ! ! -- For all other checks, the string is "xxx failed at yyy" ! -- where xxx is the check name with current source file casing. ! ! else ! Get_Name_String (Nam); ! Set_Casing (Identifier_Casing (Current_Source_File)); ! Add_Str_To_Name_Buffer (" failed at "); ! end if; ! ! -- In all cases, add location string ! ! Add_Str_To_Name_Buffer (Msg_Loc); ! ! -- Build the message ! ! Msg := Make_String_Literal (Loc, Name_Buffer (1 .. Name_Len)); ! end; end if; -- Now rewrite as an if statement *************** package body Exp_Prag is *** 373,379 **** Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Raise_Assert_Failure), Loc), ! Parameter_Associations => New_List (Msg))))); end if; Analyze (N); --- 410,416 ---- Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Raise_Assert_Failure), Loc), ! Parameter_Associations => New_List (Relocate_Node (Msg)))))); end if; Analyze (N); *************** package body Exp_Prag is *** 392,398 **** then return; 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; --- 429,435 ---- then return; 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; *************** package body Exp_Prag is *** 536,552 **** begin if Present (Call) then declare ! Excep_Internal : constant Node_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('V')); ! ! Export_Pragma : Node_Id; ! Excep_Alias : Node_Id; ! Excep_Object : Node_Id; ! Excep_Image : String_Id; ! Exdata : List_Id; ! Lang_Char : Node_Id; ! Code : Node_Id; begin if Present (Interface_Name (Id)) then --- 573,586 ---- begin if Present (Call) then declare ! Excep_Internal : constant Node_Id := Make_Temporary (Loc, 'V'); ! Export_Pragma : Node_Id; ! Excep_Alias : Node_Id; ! Excep_Object : Node_Id; ! Excep_Image : String_Id; ! Exdata : List_Id; ! Lang_Char : Node_Id; ! Code : Node_Id; begin if Present (Interface_Name (Id)) then *************** package body Exp_Prag is *** 614,641 **** (Loc, Name_Export, New_List ! (Make_Pragma_Argument_Association ! (Sloc => Loc, ! Expression => Make_Identifier (Loc, Name_C)), ! Make_Pragma_Argument_Association ! (Sloc => Loc, ! Expression => ! New_Reference_To (Excep_Internal, Loc)), ! Make_Pragma_Argument_Association ! (Sloc => Loc, ! Expression => ! Make_String_Literal ! (Sloc => Loc, ! Strval => Excep_Image)), ! Make_Pragma_Argument_Association ! (Sloc => Loc, Expression => ! Make_String_Literal ! (Sloc => Loc, ! Strval => Excep_Image)))); Insert_Action (N, Export_Pragma); Analyze (Export_Pragma); --- 648,667 ---- (Loc, Name_Export, New_List ! (Make_Pragma_Argument_Association (Loc, ! Expression => Make_Identifier (Loc, Name_C)), ! Make_Pragma_Argument_Association (Loc, ! Expression => ! New_Reference_To (Excep_Internal, Loc)), ! Make_Pragma_Argument_Association (Loc, ! Expression => ! Make_String_Literal (Loc, Excep_Image)), ! Make_Pragma_Argument_Association (Loc, Expression => ! Make_String_Literal (Loc, Excep_Image)))); Insert_Action (N, Export_Pragma); Analyze (Export_Pragma); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_sel.adb gcc-4.6.0/gcc/ada/exp_sel.adb *** gcc-4.5.2/gcc/ada/exp_sel.adb Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/exp_sel.adb Thu Jun 17 10:45:18 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Sel is *** 83,101 **** (Loc : Source_Ptr; Decls : List_Id) return Entity_Id is ! B : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('B')); ! begin Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => ! B, ! Object_Definition => ! New_Reference_To (Standard_Boolean, Loc), ! Expression => ! New_Reference_To (Standard_False, Loc))); ! return B; end Build_B; --- 83,95 ---- (Loc : Source_Ptr; Decls : List_Id) return Entity_Id is ! B : constant Entity_Id := Make_Temporary (Loc, 'B'); begin Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => B, ! Object_Definition => New_Reference_To (Standard_Boolean, Loc), ! Expression => New_Reference_To (Standard_False, Loc))); return B; end Build_B; *************** package body Exp_Sel is *** 107,123 **** (Loc : Source_Ptr; Decls : List_Id) return Entity_Id is ! C : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('C')); ! begin Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => ! C, ! Object_Definition => ! New_Reference_To (RTE (RE_Prim_Op_Kind), Loc))); ! return C; end Build_C; --- 101,112 ---- (Loc : Source_Ptr; Decls : List_Id) return Entity_Id is ! C : constant Entity_Id := Make_Temporary (Loc, 'C'); begin Append_To (Decls, Make_Object_Declaration (Loc, ! Defining_Identifier => C, ! Object_Definition => New_Reference_To (RTE (RE_Prim_Op_Kind), Loc))); return C; end Build_C; *************** package body Exp_Sel is *** 155,163 **** Decls : List_Id; Obj : Entity_Id) return Entity_Id is ! K : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('K')); ! begin Append_To (Decls, Make_Object_Declaration (Loc, --- 144,150 ---- Decls : List_Id; Obj : Entity_Id) return Entity_Id is ! K : constant Entity_Id := Make_Temporary (Loc, 'K'); begin Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Sel is *** 169,175 **** Name => New_Reference_To (RTE (RE_Get_Tagged_Kind), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Tag), Obj))))); - return K; end Build_K; --- 156,161 ---- *************** package body Exp_Sel is *** 181,196 **** (Loc : Source_Ptr; Decls : List_Id) return Entity_Id is ! S : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); ! begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => S, ! Object_Definition => ! New_Reference_To (Standard_Integer, Loc))); ! return S; end Build_S; --- 167,178 ---- (Loc : Source_Ptr; Decls : List_Id) return Entity_Id is ! S : constant Entity_Id := Make_Temporary (Loc, 'S'); begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => S, ! Object_Definition => New_Reference_To (Standard_Integer, Loc))); return S; end Build_S; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_smem.adb gcc-4.6.0/gcc/ada/exp_smem.adb *** gcc-4.5.2/gcc/ada/exp_smem.adb Wed Apr 15 08:47:44 2009 --- gcc-4.6.0/gcc/ada/exp_smem.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body Exp_Smem is *** 93,99 **** Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Shared_Var_Procs_Instance (E), Loc), ! Selector_Name => Make_Identifier (Loc, Chars => N))); end Build_Shared_Var_Proc_Call; --------------------- --- 93,99 ---- Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Shared_Var_Procs_Instance (E), Loc), ! Selector_Name => Make_Identifier (Loc, N))); end Build_Shared_Var_Proc_Call; --------------------- *************** package body Exp_Smem is *** 270,279 **** return False; else ! if Ekind (Formal) = E_Out_Parameter ! or else ! Ekind (Formal) = E_In_Out_Parameter ! then Insert_Node := Call; return True; else --- 270,276 ---- return False; else ! if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter) then Insert_Node := Call; return True; else diff -Nrcpad gcc-4.5.2/gcc/ada/exp_strm.adb gcc-4.6.0/gcc/ada/exp_strm.adb *** gcc-4.5.2/gcc/ada/exp_strm.adb Thu Apr 9 10:27:10 2009 --- gcc-4.6.0/gcc/ada/exp_strm.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Namet; use Namet; *** 29,34 **** --- 29,36 ---- with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; + with Restrict; use Restrict; + with Rident; use Rident; with Rtsfind; use Rtsfind; with Sem_Aux; use Sem_Aux; with Sem_Util; use Sem_Util; *************** package body Exp_Strm is *** 164,173 **** Object_Definition => New_Occurrence_Of (Etype (Indx), Loc), Expression => Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Input, ! Expressions => New_List (Make_Identifier (Loc, Name_S))))); Append_To (Decls, Make_Object_Declaration (Loc, --- 166,175 ---- Object_Definition => New_Occurrence_Of (Etype (Indx), Loc), Expression => Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Input, ! Expressions => New_List (Make_Identifier (Loc, Name_S))))); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Strm is *** 177,186 **** New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Expression => Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Input, ! Expressions => New_List (Make_Identifier (Loc, Name_S))))); Append_To (Ranges, Make_Range (Loc, --- 179,188 ---- New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Expression => Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Input, ! Expressions => New_List (Make_Identifier (Loc, Name_S))))); Append_To (Ranges, Make_Range (Loc, *************** package body Exp_Strm is *** 258,266 **** Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_First, ! Expressions => New_List ( Make_Integer_Literal (Loc, J)))))); Append_To (Stms, --- 260,268 ---- Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_First, ! Expressions => New_List ( Make_Integer_Literal (Loc, J)))))); Append_To (Stms, *************** package body Exp_Strm is *** 271,279 **** Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Last, ! Expressions => New_List ( Make_Integer_Literal (Loc, J)))))); Next_Index (Indx); --- 273,281 ---- Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Last, ! Expressions => New_List ( Make_Integer_Literal (Loc, J)))))); Next_Index (Indx); *************** package body Exp_Strm is *** 367,373 **** Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Expressions => Exl))); -- The corresponding stream attribute for the component type of the --- 369,375 ---- Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Indexed_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Expressions => Exl))); -- The corresponding stream attribute for the component type of the *************** package body Exp_Strm is *** 405,411 **** Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Range, Expressions => New_List ( --- 407,413 ---- Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Range, Expressions => New_List ( *************** package body Exp_Strm is *** 455,460 **** --- 457,464 ---- Lib_RE : RE_Id; begin + Check_Restriction (No_Default_Stream_Attributes, N); + -- Compute the size of the stream element. This is either the size of -- the first subtype or if given the size of the Stream_Size attribute. *************** package body Exp_Strm is *** 667,672 **** --- 671,678 ---- Libent : Entity_Id; begin + Check_Restriction (No_Default_Stream_Attributes, N); + -- Compute the size of the stream element. This is either the size of -- the first subtype or if given the size of the Stream_Size attribute. *************** package body Exp_Strm is *** 892,898 **** Out_Formal := Make_Selected_Component (Loc, ! Prefix => New_Occurrence_Of (Pnam, Loc), Selector_Name => Make_Identifier (Loc, Name_V)); -- Generate Reads for the discriminants of the type. The discriminants --- 898,904 ---- Out_Formal := Make_Selected_Component (Loc, ! Prefix => New_Occurrence_Of (Pnam, Loc), Selector_Name => Make_Identifier (Loc, Name_V)); -- Generate Reads for the discriminants of the type. The discriminants *************** package body Exp_Strm is *** 975,981 **** Append_To (Constrained_Stms, Make_Assignment_Statement (Loc, ! Name => Out_Formal, Expression => Make_Identifier (Loc, Name_V))); if Is_Unchecked_Union (Typ) then --- 981,987 ---- Append_To (Constrained_Stms, Make_Assignment_Statement (Loc, ! Name => Out_Formal, Expression => Make_Identifier (Loc, Name_V))); if Is_Unchecked_Union (Typ) then *************** package body Exp_Strm is *** 1026,1032 **** else D_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Disc, Loc)); end if; --- 1032,1038 ---- else D_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Disc, Loc)); end if; *************** package body Exp_Strm is *** 1034,1040 **** Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Disc), Loc), Attribute_Name => Name_Write, ! Expressions => New_List ( Make_Identifier (Loc, Name_S), D_Ref))); --- 1040,1046 ---- Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Disc), Loc), Attribute_Name => Name_Write, ! Expressions => New_List ( Make_Identifier (Loc, Name_S), D_Ref))); *************** package body Exp_Strm is *** 1177,1183 **** 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 (Obj_Decl), --- 1183,1189 ---- Set_No_Initialization (Obj_Decl); end if; ! if Ada_Version >= Ada_2005 then Stms := New_List ( Make_Extended_Return_Statement (Loc, Return_Object_Declarations => New_List (Obj_Decl), *************** package body Exp_Strm is *** 1245,1251 **** else Disc_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Disc, Loc)); end if; --- 1251,1257 ---- else Disc_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Disc, Loc)); end if; *************** package body Exp_Strm is *** 1396,1402 **** -- If the enclosing record is an unchecked_union, we use the -- default expressions for the discriminant (it must exist) -- because we cannot generate a reference to it, given that ! -- it is not stored.. if Is_Unchecked_Union (Scope (Entity (Name (VP)))) then D_Ref := --- 1402,1408 ---- -- If the enclosing record is an unchecked_union, we use the -- default expressions for the discriminant (it must exist) -- because we cannot generate a reference to it, given that ! -- it is not stored. if Is_Unchecked_Union (Scope (Entity (Name (VP)))) then D_Ref := *************** package body Exp_Strm is *** 1405,1411 **** else D_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Entity (Name (VP)), Loc)); end if; --- 1411,1417 ---- else D_Ref := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Entity (Name (VP)), Loc)); end if; *************** package body Exp_Strm is *** 1455,1461 **** Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (C, Loc)))); end Make_Field_Attribute; --- 1461,1467 ---- Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (C, Loc)))); end Make_Field_Attribute; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_tss.adb gcc-4.6.0/gcc/ada/exp_tss.adb *** gcc-4.5.2/gcc/ada/exp_tss.adb Mon Jul 20 12:55:43 2009 --- gcc-4.6.0/gcc/ada/exp_tss.adb Tue Aug 10 14:29:36 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Exp_Tss is *** 109,114 **** --- 109,143 ---- Prepend_Elmt (TSS, TSS_Elist (FN)); end Copy_TSS; + ------------------- + -- CPP_Init_Proc -- + ------------------- + + function CPP_Init_Proc (Typ : Entity_Id) return Entity_Id is + FN : constant Node_Id := Freeze_Node (Typ); + Elmt : Elmt_Id; + + begin + if not Is_CPP_Class (Root_Type (Typ)) + or else No (FN) + or else No (TSS_Elist (FN)) + then + return Empty; + + else + Elmt := First_Elmt (TSS_Elist (FN)); + while Present (Elmt) loop + if Is_CPP_Init_Proc (Node (Elmt)) then + return Node (Elmt); + end if; + + Next_Elmt (Elmt); + end loop; + end if; + + return Empty; + end CPP_Init_Proc; + ------------------------ -- Find_Inherited_TSS -- ------------------------ *************** package body Exp_Tss is *** 276,281 **** --- 305,322 ---- return Empty; end Init_Proc; + ---------------------- + -- Is_CPP_Init_Proc -- + ---------------------- + + function Is_CPP_Init_Proc (E : Entity_Id) return Boolean is + C1 : Character; + C2 : Character; + begin + Get_Last_Two_Chars (Chars (E), C1, C2); + return C1 = TSS_CPP_Init_Proc (1) and then C2 = TSS_CPP_Init_Proc (2); + end Is_CPP_Init_Proc; + ------------------ -- Is_Init_Proc -- ------------------ *************** package body Exp_Tss is *** 393,399 **** -- Skip this for Init_Proc with No_Default_Initialization, since the -- Init proc is a dummy void entity in this case to be ignored. ! if Is_Init_Proc (TSS) and then Restriction_Active (No_Default_Initialization) then null; --- 434,440 ---- -- Skip this for Init_Proc with No_Default_Initialization, since the -- Init proc is a dummy void entity in this case to be ignored. ! if (Is_Init_Proc (TSS) or else Is_CPP_Init_Proc (TSS)) and then Restriction_Active (No_Default_Initialization) then null; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_tss.ads gcc-4.6.0/gcc/ada/exp_tss.ads *** gcc-4.5.2/gcc/ada/exp_tss.ads Wed Jul 22 13:24:46 2009 --- gcc-4.6.0/gcc/ada/exp_tss.ads Tue Aug 10 14:29:36 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Tss is *** 84,89 **** --- 84,90 ---- TSS_Composite_Equality : constant TNT := "EQ"; -- Composite Equality TSS_From_Any : constant TNT := "FA"; -- PolyORB/DSA From_Any TSS_Init_Proc : constant TNT := "IP"; -- Initialization Procedure + TSS_CPP_Init_Proc : constant TNT := "IC"; -- Init C++ dispatch tables TSS_RAS_Access : constant TNT := "RA"; -- RAS type access TSS_RAS_Dereference : constant TNT := "RD"; -- RAS type dereference TSS_Rep_To_Pos : constant TNT := "RP"; -- Rep to Pos conversion *************** package Exp_Tss is *** 104,109 **** --- 105,111 ---- TSS_Composite_Equality, TSS_From_Any, TSS_Init_Proc, + TSS_CPP_Init_Proc, TSS_RAS_Access, TSS_RAS_Dereference, TSS_Rep_To_Pos, *************** package Exp_Tss is *** 140,154 **** function Make_Init_Proc_Name (Typ : Entity_Id) return Name_Id; -- Version for init procs, same as Make_TSS_Name (Typ, TSS_Init_Proc) function Is_TSS (E : Entity_Id; Nam : TSS_Name_Type) return Boolean; -- Determines if given entity (E) is the name of a TSS identified by Nam function Is_TSS (N : Name_Id; Nam : TSS_Name_Type) return Boolean; -- Same test applied directly to a Name_Id value - function Is_Init_Proc (E : Entity_Id) return Boolean; - -- Version for init procs, same as Is_TSS (E, TSS_Init_Proc); - ----------------------------------------- -- TSS Data structures and Subprograms -- ----------------------------------------- --- 142,159 ---- function Make_Init_Proc_Name (Typ : Entity_Id) return Name_Id; -- Version for init procs, same as Make_TSS_Name (Typ, TSS_Init_Proc) + function Is_CPP_Init_Proc (E : Entity_Id) return Boolean; + -- Version for CPP init procs, same as Is_TSS (E, TSS_CPP_Init_Proc); + + function Is_Init_Proc (E : Entity_Id) return Boolean; + -- Version for init procs, same as Is_TSS (E, TSS_Init_Proc); + function Is_TSS (E : Entity_Id; Nam : TSS_Name_Type) return Boolean; -- Determines if given entity (E) is the name of a TSS identified by Nam function Is_TSS (N : Name_Id; Nam : TSS_Name_Type) return Boolean; -- Same test applied directly to a Name_Id value ----------------------------------------- -- TSS Data structures and Subprograms -- ----------------------------------------- *************** package Exp_Tss is *** 188,193 **** --- 193,203 ---- -- used to initially install a TSS in the case where the subprogram for the -- TSS has already been created and its declaration processed. + function CPP_Init_Proc (Typ : Entity_Id) return Entity_Id; + -- Obtains the CPP_Init TSS entity the given type. The CPP_Init TSS is a + -- procedure used to initialize the C++ part of the primary and secondary + -- dispatch tables of a tagged type derived from CPP types. + function Init_Proc (Typ : Entity_Id; Ref : Entity_Id := Empty) return Entity_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/exp_util.adb gcc-4.6.0/gcc/ada/exp_util.adb *** gcc-4.5.2/gcc/ada/exp_util.adb Thu Dec 3 15:10:58 2009 --- gcc-4.6.0/gcc/ada/exp_util.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,29 **** --- 24,30 ---- ------------------------------------------------------------------------------ with Atree; use Atree; + with Casing; use Casing; with Checks; use Checks; with Debug; use Debug; with Einfo; use Einfo; *************** with Rident; use Rident; *** 43,50 **** with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch8; use Sem_Ch8; - with Sem_SCIL; use Sem_SCIL; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; --- 44,51 ---- with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch8; use Sem_Ch8; with Sem_Eval; use Sem_Eval; + with Sem_Prag; use Sem_Prag; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; *************** package body Exp_Util is *** 306,316 **** else if No (Actions (Fnode)) then Set_Actions (Fnode, L); - else Append_List (L, Actions (Fnode)); end if; - end if; end Append_Freeze_Actions; --- 307,315 ---- *************** package body Exp_Util is *** 341,349 **** -- local to the init proc for the array type, and is called for each one -- of the components. The constructed image has the form of an indexed -- 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 -- in the loops that call the individual task init proc on each component. -- The generated function has the following structure: --- 340,348 ---- -- local to the init proc for the array type, and is called for each one -- of the components. The constructed image has the form of an indexed -- component, whose prefix is the outer variable of the array type. ! -- The n-dimensional array type has known indexes Index, Index2... -- Id_Ref is an indexed component form created by the enclosing init proc. ! -- Its successive indexes 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: *************** package body Exp_Util is *** 398,411 **** Pos : Entity_Id; -- Running index for substring assignments ! Pref : Entity_Id; -- Name of enclosing variable, prefix of resulting name Res : Entity_Id; -- String to hold result Val : Node_Id; ! -- Value of successive indices Sum : Node_Id; -- Expression to compute total size of string --- 397,410 ---- Pos : Entity_Id; -- Running index for substring assignments ! Pref : constant Entity_Id := Make_Temporary (Loc, 'P'); -- Name of enclosing variable, prefix of resulting name Res : Entity_Id; -- String to hold result Val : Node_Id; ! -- Value of successive indexes Sum : Node_Id; -- Expression to compute total size of string *************** package body Exp_Util is *** 417,424 **** Stats : constant List_Id := New_List; begin - Pref := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); - -- For a dynamic task, the name comes from the target variable. -- For a static one it is a formal of the enclosing init proc. --- 416,421 ---- *************** package body Exp_Util is *** 444,450 **** Val := First (Expressions (Id_Ref)); for J in 1 .. Dims loop ! T := Make_Defining_Identifier (Loc, New_Internal_Name ('T')); Temps (J) := T; Append_To (Decls, --- 441,447 ---- Val := First (Expressions (Id_Ref)); for J in 1 .. Dims loop ! T := Make_Temporary (Loc, 'T'); Temps (J) := T; Append_To (Decls, *************** package body Exp_Util is *** 454,463 **** Expression => Make_Attribute_Reference (Loc, Attribute_Name => Name_Image, ! Prefix => ! New_Occurrence_Of (Etype (Indx), Loc), ! Expressions => New_List ( ! New_Copy_Tree (Val))))); Next_Index (Indx); Next (Val); --- 451,458 ---- Expression => Make_Attribute_Reference (Loc, Attribute_Name => Name_Image, ! Prefix => New_Occurrence_Of (Etype (Indx), Loc), ! Expressions => New_List (New_Copy_Tree (Val))))); Next_Index (Indx); Next (Val); *************** package body Exp_Util is *** 613,619 **** if Restriction_Active (No_Implicit_Heap_Allocations) or else Global_Discard_Names then ! T_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('J')); Name_Len := 0; return --- 608,614 ---- if Restriction_Active (No_Implicit_Heap_Allocations) or else Global_Discard_Names then ! T_Id := Make_Temporary (Loc, 'J'); Name_Len := 0; return *************** package body Exp_Util is *** 697,705 **** Expression => New_Occurrence_Of (Res, Loc))); Spec := Make_Function_Specification (Loc, ! Defining_Unit_Name => ! Make_Defining_Identifier (Loc, New_Internal_Name ('F')), ! Result_Definition => New_Occurrence_Of (Standard_String, Loc)); -- Calls to 'Image use the secondary stack, which must be cleaned -- up after the task name is built. --- 692,699 ---- Expression => New_Occurrence_Of (Res, Loc))); Spec := Make_Function_Specification (Loc, ! Defining_Unit_Name => Make_Temporary (Loc, 'F'), ! Result_Definition => New_Occurrence_Of (Standard_String, Loc)); -- Calls to 'Image use the secondary stack, which must be cleaned -- up after the task name is built. *************** package body Exp_Util is *** 726,740 **** Stats : List_Id) is begin ! Len := Make_Defining_Identifier (Loc, New_Internal_Name ('L')); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Len, ! Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), ! Expression => Sum)); ! Res := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Append_To (Decls, Make_Object_Declaration (Loc, --- 720,734 ---- Stats : List_Id) is begin ! Len := Make_Temporary (Loc, 'L', Sum); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Len, ! Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), ! Expression => Sum)); ! Res := Make_Temporary (Loc, 'R'); Append_To (Decls, Make_Object_Declaration (Loc, *************** package body Exp_Util is *** 750,761 **** Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => New_Occurrence_Of (Len, Loc))))))); ! Pos := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Pos, ! Object_Definition => New_Occurrence_Of (Standard_Integer, Loc))); -- Pos := Prefix'Length; --- 744,755 ---- Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => New_Occurrence_Of (Len, Loc))))))); ! Pos := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Pos, ! Object_Definition => New_Occurrence_Of (Standard_Integer, Loc))); -- Pos := Prefix'Length; *************** package body Exp_Util is *** 765,793 **** Expression => Make_Attribute_Reference (Loc, Attribute_Name => Name_Length, ! Prefix => New_Occurrence_Of (Prefix, Loc), ! Expressions => ! New_List (Make_Integer_Literal (Loc, 1))))); -- Res (1 .. Pos) := Prefix; Append_To (Stats, ! Make_Assignment_Statement (Loc, ! Name => Make_Slice (Loc, ! Prefix => New_Occurrence_Of (Res, Loc), Discrete_Range => Make_Range (Loc, ! Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => New_Occurrence_Of (Pos, Loc))), ! Expression => New_Occurrence_Of (Prefix, Loc))); Append_To (Stats, Make_Assignment_Statement (Loc, ! Name => New_Occurrence_Of (Pos, Loc), Expression => Make_Op_Add (Loc, ! Left_Opnd => New_Occurrence_Of (Pos, Loc), Right_Opnd => Make_Integer_Literal (Loc, 1)))); end Build_Task_Image_Prefix; --- 759,787 ---- Expression => Make_Attribute_Reference (Loc, Attribute_Name => Name_Length, ! Prefix => New_Occurrence_Of (Prefix, Loc), ! Expressions => New_List (Make_Integer_Literal (Loc, 1))))); -- Res (1 .. Pos) := Prefix; Append_To (Stats, ! Make_Assignment_Statement (Loc, ! Name => ! Make_Slice (Loc, ! Prefix => New_Occurrence_Of (Res, Loc), Discrete_Range => Make_Range (Loc, ! Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => New_Occurrence_Of (Pos, Loc))), ! Expression => New_Occurrence_Of (Prefix, Loc))); Append_To (Stats, Make_Assignment_Statement (Loc, ! Name => New_Occurrence_Of (Pos, Loc), Expression => Make_Op_Add (Loc, ! Left_Opnd => New_Occurrence_Of (Pos, Loc), Right_Opnd => Make_Integer_Literal (Loc, 1)))); end Build_Task_Image_Prefix; *************** package body Exp_Util is *** 809,815 **** Res : Entity_Id; -- String to hold result ! Pref : Entity_Id; -- Name of enclosing variable, prefix of resulting name Sum : Node_Id; --- 803,809 ---- Res : Entity_Id; -- String to hold result ! Pref : constant Entity_Id := Make_Temporary (Loc, 'P'); -- Name of enclosing variable, prefix of resulting name Sum : Node_Id; *************** package body Exp_Util is *** 822,831 **** Stats : constant List_Id := New_List; begin ! Pref := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); ! ! -- For a dynamic task, the name comes from the target variable. ! -- For a static one it is a formal of the enclosing init proc. if Dyn then Get_Name_String (Chars (Entity (Prefix (Id_Ref)))); --- 816,823 ---- Stats : constant List_Id := New_List; begin ! -- For a dynamic task, the name comes from the target variable. For a ! -- static one it is a formal of the enclosing init proc. if Dyn then Get_Name_String (Chars (Entity (Prefix (Id_Ref)))); *************** package body Exp_Util is *** 845,859 **** Name => Make_Identifier (Loc, Name_uTask_Name))); end if; ! Sel := Make_Defining_Identifier (Loc, New_Internal_Name ('S')); Get_Name_String (Chars (Selector_Name (Id_Ref))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Sel, ! Object_Definition => New_Occurrence_Of (Standard_String, Loc), ! Expression => Make_String_Literal (Loc, Strval => String_From_Name_Buffer))); --- 837,851 ---- Name => Make_Identifier (Loc, Name_uTask_Name))); end if; ! Sel := Make_Temporary (Loc, 'S'); Get_Name_String (Chars (Selector_Name (Id_Ref))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Sel, ! Object_Definition => New_Occurrence_Of (Standard_String, Loc), ! Expression => Make_String_Literal (Loc, Strval => String_From_Name_Buffer))); *************** package body Exp_Util is *** 914,930 **** ---------------------------------- function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean is ! UT : constant Entity_Id := Underlying_Type (Etype (Comp)); begin -- If no component clause, then everything is fine, since the back end -- never bit-misaligns by default, even if there is a pragma Packed for -- the record. ! if No (Component_Clause (Comp)) then return False; end if; -- It is only array and record types that cause trouble if not Is_Record_Type (UT) --- 906,924 ---- ---------------------------------- function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean is ! UT : Entity_Id; begin -- If no component clause, then everything is fine, since the back end -- never bit-misaligns by default, even if there is a pragma Packed for -- the record. ! if No (Comp) or else No (Component_Clause (Comp)) then return False; end if; + UT := Underlying_Type (Etype (Comp)); + -- It is only array and record types that cause trouble if not Is_Record_Type (UT) *************** package body Exp_Util is *** 1113,1120 **** IR : Node_Id; begin ! -- An itype reference must only be created if this is a local ! -- itype, so that gigi can elaborate it on the proper objstack. if Is_Itype (Typ) and then Scope (Typ) = Current_Scope --- 1107,1114 ---- IR : Node_Id; begin ! -- An itype reference must only be created if this is a local itype, so ! -- that gigi can elaborate it on the proper objstack. if Is_Itype (Typ) and then Scope (Typ) = Current_Scope *************** package body Exp_Util is *** 1224,1237 **** begin -- In general we cannot build the subtype if expansion is disabled, -- because internal entities may not have been defined. However, to ! -- avoid some cascaded errors, we try to continue when the expression ! -- is an array (or string), because it is safe to compute the bounds. ! -- It is in fact required to do so even in a generic context, because ! -- there may be constants that depend on bounds of string literal. if not Expander_Active and then (No (Etype (Exp)) ! or else Base_Type (Etype (Exp)) /= Standard_String) then return; end if; --- 1218,1232 ---- begin -- In general we cannot build the subtype if expansion is disabled, -- because internal entities may not have been defined. However, to ! -- avoid some cascaded errors, we try to continue when the expression is ! -- an array (or string), because it is safe to compute the bounds. It is ! -- in fact required to do so even in a generic context, because there ! -- may be constants that depend on the bounds of a string literal, both ! -- standard string types and more generally arrays of characters. if not Expander_Active and then (No (Etype (Exp)) ! or else not Is_String_Type (Etype (Exp))) then return; end if; *************** package body Exp_Util is *** 1300,1308 **** end if; else ! T := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); Insert_Action (N, Make_Subtype_Declaration (Loc, --- 1295,1301 ---- end if; else ! T := Make_Temporary (Loc, 'T'); Insert_Action (N, Make_Subtype_Declaration (Loc, *************** package body Exp_Util is *** 1366,1374 **** pragma Assert (Is_Class_Wide_Type (Unc_Type)); null; ! -- In Ada95, nothing to be done if the type of the expression is ! -- limited, because in this case the expression cannot be copied, ! -- and its use can only be by reference. -- In Ada2005, the context can be an object declaration whose expression -- is a function that returns in place. If the nominal subtype has --- 1359,1367 ---- pragma Assert (Is_Class_Wide_Type (Unc_Type)); null; ! -- In Ada95 nothing to be done if the type of the expression is limited, ! -- because in this case the expression cannot be copied, and its use can ! -- only be by reference. -- In Ada2005, the context can be an object declaration whose expression -- is a function that returns in place. If the nominal subtype has *************** package body Exp_Util is *** 1496,1502 **** -- Handle access types if Is_Access_Type (Typ) then ! Typ := Directly_Designated_Type (Typ); end if; -- Handle task and protected types implementing interfaces --- 1489,1495 ---- -- Handle access types if Is_Access_Type (Typ) then ! Typ := Designated_Type (Typ); end if; -- Handle task and protected types implementing interfaces *************** package body Exp_Util is *** 1603,1609 **** -- Handle access types if Is_Access_Type (Typ) then ! Typ := Directly_Designated_Type (Typ); end if; -- Handle class-wide types --- 1596,1602 ---- -- Handle access types if Is_Access_Type (Typ) then ! Typ := Designated_Type (Typ); end if; -- Handle class-wide types *************** package body Exp_Util is *** 1679,1685 **** exit when Chars (Op) = Name and then (Name /= Name_Op_Eq ! or else Etype (First_Entity (Op)) = Etype (Last_Entity (Op))); Next_Elmt (Prim); --- 1672,1678 ---- exit when Chars (Op) = Name and then (Name /= Name_Op_Eq ! or else Etype (First_Formal (Op)) = Etype (Last_Formal (Op))); Next_Elmt (Prim); *************** package body Exp_Util is *** 1762,1767 **** --- 1755,1816 ---- Remove_Side_Effects (Exp, Name_Req, Variable_Ref => True); end Force_Evaluation; + --------------------------------- + -- Fully_Qualified_Name_String -- + --------------------------------- + + function Fully_Qualified_Name_String (E : Entity_Id) return String_Id is + procedure Internal_Full_Qualified_Name (E : Entity_Id); + -- Compute recursively the qualified name without NUL at the end, adding + -- it to the currently started string being generated + + ---------------------------------- + -- Internal_Full_Qualified_Name -- + ---------------------------------- + + procedure Internal_Full_Qualified_Name (E : Entity_Id) is + Ent : Entity_Id; + + begin + -- Deal properly with child units + + if Nkind (E) = N_Defining_Program_Unit_Name then + Ent := Defining_Identifier (E); + else + Ent := E; + end if; + + -- Compute qualification recursively (only "Standard" has no scope) + + if Present (Scope (Scope (Ent))) then + Internal_Full_Qualified_Name (Scope (Ent)); + Store_String_Char (Get_Char_Code ('.')); + end if; + + -- Every entity should have a name except some expanded blocks + -- don't bother about those. + + if Chars (Ent) = No_Name then + return; + end if; + + -- Generates the entity name in upper case + + Get_Decoded_Name_String (Chars (Ent)); + Set_All_Upper_Case; + Store_String_Chars (Name_Buffer (1 .. Name_Len)); + return; + end Internal_Full_Qualified_Name; + + -- Start of processing for Full_Qualified_Name + + begin + Start_String; + Internal_Full_Qualified_Name (E); + Store_String_Char (Get_Char_Code (ASCII.NUL)); + return End_String; + end Fully_Qualified_Name_String; + ------------------------ -- Generate_Poll_Call -- ------------------------ *************** package body Exp_Util is *** 1833,1841 **** if Nkind (Cond) = N_And_Then or else Nkind (Cond) = N_Op_And then ! -- Don't ever try to invert a condition that is of the form ! -- of an AND or AND THEN (since we are not doing sufficiently ! -- general processing to allow this). if Sens = False then Op := N_Empty; --- 1882,1890 ---- if Nkind (Cond) = N_And_Then or else Nkind (Cond) = N_Op_And then ! -- Don't ever try to invert a condition that is of the form of an ! -- AND or AND THEN (since we are not doing sufficiently general ! -- processing to allow this). if Sens = False then Op := N_Empty; *************** package body Exp_Util is *** 2012,2021 **** end; -- ELSIF part. Condition is known true within the referenced ! -- ELSIF, known False in any subsequent ELSIF or ELSE part, and ! -- unknown before the ELSE part or after the IF statement. elsif Nkind (CV) = N_Elsif_Part then Stm := Parent (CV); -- Before start of ELSIF part --- 2061,2081 ---- end; -- ELSIF part. Condition is known true within the referenced ! -- ELSIF, known False in any subsequent ELSIF or ELSE part, ! -- and unknown before the ELSE part or after the IF statement. elsif Nkind (CV) = N_Elsif_Part then + + -- if the Elsif_Part had condition_actions, the elsif has been + -- rewritten as a nested if, and the original elsif_part is + -- detached from the tree, so there is no way to obtain useful + -- information on the current value of the variable. + -- Can this be improved ??? + + if No (Parent (CV)) then + return; + end if; + Stm := Parent (CV); -- Before start of ELSIF part *************** package body Exp_Util is *** 2116,2124 **** begin -- Only consider record types ! if Ekind (Typ) /= E_Record_Type ! and then Ekind (Typ) /= E_Record_Subtype ! then return False; end if; --- 2176,2182 ---- begin -- Only consider record types ! if not Ekind_In (Typ, E_Record_Type, E_Record_Subtype) then return False; end if; *************** package body Exp_Util is *** 2129,2137 **** if Ekind (D_Typ) = E_Anonymous_Access_Type and then ! (Is_Controlled (Directly_Designated_Type (D_Typ)) or else ! Is_Concurrent_Type (Directly_Designated_Type (D_Typ))) then return True; end if; --- 2187,2195 ---- if Ekind (D_Typ) = E_Anonymous_Access_Type and then ! (Is_Controlled (Designated_Type (D_Typ)) or else ! Is_Concurrent_Type (Designated_Type (D_Typ))) then return True; end if; *************** package body Exp_Util is *** 2143,2148 **** --- 2201,2237 ---- return False; end Has_Controlled_Coextensions; + ------------------------ + -- Has_Address_Clause -- + ------------------------ + + -- Should this function check the private part in a package ??? + + function Has_Following_Address_Clause (D : Node_Id) return Boolean is + Id : constant Entity_Id := Defining_Identifier (D); + Decl : Node_Id; + + begin + Decl := Next (D); + while Present (Decl) loop + if Nkind (Decl) = N_At_Clause + and then Chars (Identifier (Decl)) = Chars (Id) + then + return True; + + elsif Nkind (Decl) = N_Attribute_Definition_Clause + and then Chars (Decl) = Name_Address + and then Chars (Name (Decl)) = Chars (Id) + then + return True; + end if; + + Next (Decl); + end loop; + + return False; + end Has_Following_Address_Clause; + -------------------- -- Homonym_Number -- -------------------- *************** package body Exp_Util is *** 2356,2367 **** ElseX : constant Node_Id := Next (ThenX); begin ! -- Actions belong to the then expression, temporarily ! -- place them as Then_Actions of the conditional expr. ! -- They will be moved to the proper place later when ! -- the conditional expression is expanded. ! if N = ThenX then if Present (Then_Actions (P)) then Insert_List_After_And_Analyze (Last (Then_Actions (P)), Ins_Actions); --- 2445,2463 ---- ElseX : constant Node_Id := Next (ThenX); begin ! -- If the enclosing expression is already analyzed, as ! -- is the case for nested elaboration checks, insert the ! -- conditional further out. ! if Analyzed (P) then ! null; ! ! -- Actions belong to the then expression, temporarily place ! -- them as Then_Actions of the conditional expr. They will ! -- be moved to the proper place later when the conditional ! -- expression is expanded. ! ! elsif N = ThenX then if Present (Then_Actions (P)) then Insert_List_After_And_Analyze (Last (Then_Actions (P)), Ins_Actions); *************** package body Exp_Util is *** 2397,2402 **** --- 2493,2524 ---- end if; end; + -- Alternative of case expression, we place the action in the + -- Actions field of the case expression alternative, this will + -- be handled when the case expression is expanded. + + when N_Case_Expression_Alternative => + if Present (Actions (P)) then + Insert_List_After_And_Analyze + (Last (Actions (P)), Ins_Actions); + else + Set_Actions (P, Ins_Actions); + Analyze_List (Then_Actions (P)); + end if; + + return; + + -- Case of appearing within an Expressions_With_Actions node. We + -- prepend the actions to the list of actions already there, if + -- the node has not been analyzed yet. Otherwise find insertion + -- location further up the tree. + + when N_Expression_With_Actions => + if not Analyzed (P) then + Prepend_List (Ins_Actions, Actions (P)); + return; + end if; + -- Case of appearing in the condition of a while expression or -- elsif. We insert the actions into the Condition_Actions field. -- They will be moved further out when the while loop or elsif *************** package body Exp_Util is *** 2412,2422 **** else Set_Condition_Actions (P, Ins_Actions); ! -- Set the parent of the insert actions explicitly. ! -- This is not a syntactic field, but we need the ! -- parent field set, in particular so that freeze ! -- can understand that it is dealing with condition ! -- actions, and properly insert the freezing actions. Set_Parent (Ins_Actions, P); Analyze_List (Condition_Actions (P)); --- 2534,2544 ---- else Set_Condition_Actions (P, Ins_Actions); ! -- Set the parent of the insert actions explicitly. This ! -- is not a syntactic field, but we need the parent field ! -- set, in particular so that freeze can understand that ! -- it is dealing with condition actions, and properly ! -- insert the freezing actions. Set_Parent (Ins_Actions, P); Analyze_List (Condition_Actions (P)); *************** package body Exp_Util is *** 2471,2476 **** --- 2593,2599 ---- N_Package_Declaration | N_Package_Instantiation | N_Package_Renaming_Declaration | + N_Parameterized_Expression | N_Private_Extension_Declaration | N_Private_Type_Declaration | N_Procedure_Instantiation | *************** package body Exp_Util is *** 2522,2527 **** --- 2645,2651 ---- -- subsequent use in the back end: within a package spec the -- loop is part of the elaboration procedure and is only -- elaborated during the second pass. + -- If the loop comes from source, or the entity is local to -- the loop itself it must remain within. *************** package body Exp_Util is *** 2544,2553 **** return; end if; ! -- A special case, N_Raise_xxx_Error can act either as a ! -- statement or a subexpression. We tell the difference ! -- by looking at the Etype. It is set to Standard_Void_Type ! -- in the statement case. when N_Raise_xxx_Error => --- 2668,2676 ---- return; end if; ! -- A special case, N_Raise_xxx_Error can act either as a statement ! -- or a subexpression. We tell the difference by looking at the ! -- Etype. It is set to Standard_Void_Type in the statement case. when N_Raise_xxx_Error => *************** package body Exp_Util is *** 2593,2601 **** Decl : Node_Id; begin ! -- Check whether these actions were generated ! -- by a declaration that is part of the loop_ ! -- actions for the component_association. Decl := Assoc_Node; while Present (Decl) loop --- 2716,2724 ---- Decl : Node_Id; begin ! -- Check whether these actions were generated by a ! -- declaration that is part of the loop_ actions ! -- for the component_association. Decl := Assoc_Node; while Present (Decl) loop *************** package body Exp_Util is *** 2652,2657 **** --- 2775,2782 ---- N_Access_To_Object_Definition | N_Aggregate | N_Allocator | + N_Aspect_Specification | + N_Case_Expression | N_Case_Statement_Alternative | N_Character_Literal | N_Compilation_Unit | *************** package body Exp_Util is *** 2703,2708 **** --- 2828,2834 ---- N_Index_Or_Discriminant_Constraint | N_Indexed_Component | N_Integer_Literal | + N_Iterator_Specification | N_Itype_Reference | N_Label | N_Loop_Parameter_Specification | *************** package body Exp_Util is *** 2752,2768 **** N_Push_Program_Error_Label | N_Push_Storage_Error_Label | N_Qualified_Expression | N_Range | N_Range_Constraint | N_Real_Literal | N_Real_Range_Specification | N_Record_Definition | N_Reference | - N_SCIL_Dispatch_Table_Object_Init | N_SCIL_Dispatch_Table_Tag_Init | N_SCIL_Dispatching_Call | N_SCIL_Membership_Test | - N_SCIL_Tag_Init | N_Selected_Component | N_Signed_Integer_Type_Definition | N_Single_Protected_Declaration | --- 2878,2893 ---- N_Push_Program_Error_Label | N_Push_Storage_Error_Label | N_Qualified_Expression | + N_Quantified_Expression | N_Range | N_Range_Constraint | N_Real_Literal | N_Real_Range_Specification | N_Record_Definition | N_Reference | N_SCIL_Dispatch_Table_Tag_Init | N_SCIL_Dispatching_Call | N_SCIL_Membership_Test | N_Selected_Component | N_Signed_Integer_Type_Definition | N_Single_Protected_Declaration | *************** package body Exp_Util is *** 2804,2812 **** if Nkind (Parent (N)) = N_Subunit then ! -- This is the proper body corresponding to a stub. Insertion ! -- must be done at the point of the stub, which is in the decla- ! -- rative part of the parent unit. P := Corresponding_Stub (Parent (N)); --- 2929,2937 ---- if Nkind (Parent (N)) = N_Subunit then ! -- This is the proper body corresponding to a stub. Insertion must ! -- be done at the point of the stub, which is in the declarative ! -- part of the parent unit. P := Corresponding_Stub (Parent (N)); *************** package body Exp_Util is *** 3093,3108 **** end if; end if; -- If the component reference is for a record that has a specified -- alignment, and we either know it is too small, or cannot tell, ! -- then the component may be unaligned ! if Known_Alignment (Etype (P)) ! and then Alignment (Etype (P)) < Ttypes.Maximum_Alignment ! and then M > Alignment (Etype (P)) ! then ! return True; ! end if; -- Case of component clause present which may specify an -- unaligned position. --- 3218,3240 ---- end if; end if; + -- The following code is historical, it used to be present but it + -- is too cautious, because the front-end does not know the proper + -- default alignments for the target. Also, if the alignment is + -- not known, the front end can't know in any case! If a copy is + -- needed, the back-end will take care of it. This whole section + -- including this comment can be removed later ??? + -- If the component reference is for a record that has a specified -- alignment, and we either know it is too small, or cannot tell, ! -- then the component may be unaligned. ! -- if Known_Alignment (Etype (P)) ! -- and then Alignment (Etype (P)) < Ttypes.Maximum_Alignment ! -- and then M > Alignment (Etype (P)) ! -- then ! -- return True; ! -- end if; -- Case of component clause present which may specify an -- unaligned position. *************** package body Exp_Util is *** 3724,3747 **** Sizexpr : Node_Id; begin ! if not Has_Discriminants (Root_Typ) then Constr_Root := Root_Typ; else ! Constr_Root := ! Make_Defining_Identifier (Loc, New_Internal_Name ('R')); -- subtype cstr__n is T (List of discr constraints taken from Exp) Append_To (List_Def, Make_Subtype_Declaration (Loc, Defining_Identifier => Constr_Root, ! Subtype_Indication => ! Make_Subtype_From_Expr (E, Root_Typ))); end if; -- Generate the range subtype declaration ! Range_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('G')); if not Is_Interface (Root_Typ) then --- 3856,3882 ---- Sizexpr : Node_Id; begin ! -- If the root type is already constrained, there are no discriminants ! -- in the expression. ! ! if not Has_Discriminants (Root_Typ) ! or else Is_Constrained (Root_Typ) ! then Constr_Root := Root_Typ; else ! Constr_Root := Make_Temporary (Loc, 'R'); -- subtype cstr__n is T (List of discr constraints taken from Exp) Append_To (List_Def, Make_Subtype_Declaration (Loc, Defining_Identifier => Constr_Root, ! Subtype_Indication => Make_Subtype_From_Expr (E, Root_Typ))); end if; -- Generate the range subtype declaration ! Range_Type := Make_Temporary (Loc, 'G'); if not Is_Interface (Root_Typ) then *************** package body Exp_Util is *** 3790,3796 **** -- subtype str__nn is Storage_Array (rg__x); ! Str_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('S')); Append_To (List_Def, Make_Subtype_Declaration (Loc, Defining_Identifier => Str_Type, --- 3925,3931 ---- -- subtype str__nn is Storage_Array (rg__x); ! Str_Type := Make_Temporary (Loc, 'S'); Append_To (List_Def, Make_Subtype_Declaration (Loc, Defining_Identifier => Str_Type, *************** package body Exp_Util is *** 3807,3813 **** -- E : Str_Type; -- end Equiv_T; ! Equiv_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('T')); Set_Ekind (Equiv_Type, E_Record_Type); Set_Parent_Subtype (Equiv_Type, Constr_Root); --- 3942,3948 ---- -- E : Str_Type; -- end Equiv_T; ! Equiv_Type := Make_Temporary (Loc, 'T'); Set_Ekind (Equiv_Type, E_Record_Type); Set_Parent_Subtype (Equiv_Type, Constr_Root); *************** package body Exp_Util is *** 3832,3840 **** Append_To (Comp_List, Make_Component_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('C')), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, --- 3967,3973 ---- Append_To (Comp_List, Make_Component_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'C'), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, *************** package body Exp_Util is *** 3857,3862 **** --- 3990,4023 ---- return Equiv_Type; end Make_CW_Equivalent_Type; + ------------------------- + -- Make_Invariant_Call -- + ------------------------- + + function Make_Invariant_Call (Expr : Node_Id) return Node_Id is + Loc : constant Source_Ptr := Sloc (Expr); + Typ : constant Entity_Id := Etype (Expr); + + begin + pragma Assert + (Has_Invariants (Typ) and then Present (Invariant_Procedure (Typ))); + + if Check_Enabled (Name_Invariant) + or else + Check_Enabled (Name_Assertion) + then + return + Make_Procedure_Call_Statement (Loc, + Name => + New_Occurrence_Of (Invariant_Procedure (Typ), Loc), + Parameter_Associations => New_List (Relocate_Node (Expr))); + + else + return + Make_Null_Statement (Loc); + end if; + end Make_Invariant_Call; + ------------------------ -- Make_Literal_Range -- ------------------------ *************** package body Exp_Util is *** 3926,3931 **** --- 4087,4133 ---- Make_Integer_Literal (Loc, 0)); end Make_Non_Empty_Check; + ------------------------- + -- Make_Predicate_Call -- + ------------------------- + + function Make_Predicate_Call + (Typ : Entity_Id; + Expr : Node_Id) return Node_Id + is + Loc : constant Source_Ptr := Sloc (Expr); + + begin + pragma Assert (Present (Predicate_Function (Typ))); + + return + Make_Function_Call (Loc, + Name => + New_Occurrence_Of (Predicate_Function (Typ), Loc), + Parameter_Associations => New_List (Relocate_Node (Expr))); + end Make_Predicate_Call; + + -------------------------- + -- Make_Predicate_Check -- + -------------------------- + + function Make_Predicate_Check + (Typ : Entity_Id; + Expr : Node_Id) return Node_Id + is + Loc : constant Source_Ptr := Sloc (Expr); + + begin + return + Make_Pragma (Loc, + Pragma_Identifier => Make_Identifier (Loc, Name_Check), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => Make_Identifier (Loc, Name_Predicate)), + Make_Pragma_Argument_Association (Loc, + Expression => Make_Predicate_Call (Typ, Expr)))); + end Make_Predicate_Check; + ---------------------------- -- Make_Subtype_From_Expr -- ---------------------------- *************** package body Exp_Util is *** 3960,3974 **** -- actual or an explicit subtype. Utyp := Underlying_Type (Base_Type (Unc_Typ)); ! Full_Subtyp := Make_Defining_Identifier (Loc, ! New_Internal_Name ('C')); Full_Exp := ! Unchecked_Convert_To ! (Utyp, Duplicate_Subexpr_No_Checks (E)); Set_Parent (Full_Exp, Parent (E)); ! Priv_Subtyp := ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')); Insert_Action (E, Make_Subtype_Declaration (Loc, --- 4162,4173 ---- -- actual or an explicit subtype. Utyp := Underlying_Type (Base_Type (Unc_Typ)); ! Full_Subtyp := Make_Temporary (Loc, 'C'); Full_Exp := ! Unchecked_Convert_To (Utyp, Duplicate_Subexpr_No_Checks (E)); Set_Parent (Full_Exp, Parent (E)); ! Priv_Subtyp := Make_Temporary (Loc, 'P'); Insert_Action (E, Make_Subtype_Declaration (Loc, *************** package body Exp_Util is *** 3988,3995 **** if Is_Tagged_Type (Priv_Subtyp) then Set_Class_Wide_Type (Base_Type (Priv_Subtyp), Class_Wide_Type (Unc_Typ)); ! Set_Primitive_Operations (Priv_Subtyp, ! Primitive_Operations (Unc_Typ)); end if; Set_Full_View (Priv_Subtyp, Full_Subtyp); --- 4187,4194 ---- if Is_Tagged_Type (Priv_Subtyp) then Set_Class_Wide_Type (Base_Type (Priv_Subtyp), Class_Wide_Type (Unc_Typ)); ! Set_Direct_Primitive_Operations (Priv_Subtyp, ! Direct_Primitive_Operations (Unc_Typ)); end if; Set_Full_View (Priv_Subtyp, Full_Subtyp); *************** package body Exp_Util is *** 4027,4032 **** --- 4226,4245 ---- -- additional intermediate type to handle the assignment). if Expander_Active and then Tagged_Type_Expansion then + + -- If this is the class_wide type of a completion that is + -- a record subtype, set the type of the class_wide type + -- to be the full base type, for use in the expanded code + -- for the equivalent type. Should this be done earlier when + -- the completion is analyzed ??? + + if Is_Private_Type (Etype (Unc_Typ)) + and then + Ekind (Full_View (Etype (Unc_Typ))) = E_Record_Subtype + then + Set_Etype (Unc_Typ, Base_Type (Full_View (Etype (Unc_Typ)))); + end if; + EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E); end if; *************** package body Exp_Util is *** 4089,4094 **** --- 4302,4362 ---- end May_Generate_Large_Temp; ---------------------------- + -- Needs_Constant_Address -- + ---------------------------- + + function Needs_Constant_Address + (Decl : Node_Id; + Typ : Entity_Id) return Boolean + is + begin + + -- If we have no initialization of any kind, then we don't need to + -- place any restrictions on the address clause, because the object + -- will be elaborated after the address clause is evaluated. This + -- happens if the declaration has no initial expression, or the type + -- has no implicit initialization, or the object is imported. + + -- The same holds for all initialized scalar types and all access + -- types. Packed bit arrays of size up to 64 are represented using a + -- modular type with an initialization (to zero) and can be processed + -- like other initialized scalar types. + + -- If the type is controlled, code to attach the object to a + -- finalization chain is generated at the point of declaration, + -- and therefore the elaboration of the object cannot be delayed: + -- the address expression must be a constant. + + if No (Expression (Decl)) + and then not Needs_Finalization (Typ) + and then + (not Has_Non_Null_Base_Init_Proc (Typ) + or else Is_Imported (Defining_Identifier (Decl))) + then + return False; + + elsif (Present (Expression (Decl)) and then Is_Scalar_Type (Typ)) + or else Is_Access_Type (Typ) + or else + (Is_Bit_Packed_Array (Typ) + and then Is_Modular_Integer_Type (Packed_Array_Type (Typ))) + then + return False; + + else + + -- Otherwise, we require the address clause to be constant because + -- the call to the initialization procedure (or the attach code) has + -- to happen at the point of the declaration. + + -- Actually the IP call has been moved to the freeze actions + -- anyway, so maybe we can relax this restriction??? + + return True; + end if; + end Needs_Constant_Address; + + ---------------------------- -- New_Class_Wide_Subtype -- ---------------------------- *************** package body Exp_Util is *** 4344,4349 **** --- 4612,4637 ---- or else Ekind (Entity (Prefix (N))) = E_In_Parameter; end if; + -- If the prefix is an explicit dereference then this construct is a + -- variable reference, which means it is to be considered to have + -- side effects if Variable_Ref is True. + + -- We do NOT exclude dereferences of access-to-constant types because + -- we handle them as constant view of variables. + + -- Exception is an access to an entity that is a constant or an + -- in-parameter. + + elsif Nkind (Prefix (N)) = N_Explicit_Dereference + and then Variable_Ref + then + declare + DDT : constant Entity_Id := + Designated_Type (Etype (Prefix (Prefix (N)))); + begin + return Ekind_In (DDT, E_Constant, E_In_Parameter); + end; + -- The following test is the simplest way of solving a complex -- problem uncovered by BB08-010: Side effect on loop bound that -- is a subcomponent of a global variable: *************** package body Exp_Util is *** 4370,4384 **** function Side_Effect_Free (N : Node_Id) return Boolean is begin ! -- Note on checks that could raise Constraint_Error. Strictly, if ! -- we take advantage of 11.6, these checks do not count as side ! -- effects. However, we would just as soon consider that they are ! -- side effects, since the backend CSE does not work very well on ! -- expressions which can raise Constraint_Error. On the other ! -- 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. -- Special handling for entity names --- 4658,4671 ---- function Side_Effect_Free (N : Node_Id) return Boolean is begin ! -- Note on checks that could raise Constraint_Error. Strictly, if we ! -- take advantage of 11.6, these checks do not count as side effects. ! -- However, we would prefer to consider that they are side effects, ! -- since the backend CSE does not work very well on expressions which ! -- can raise Constraint_Error. On the other hand if we don't 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. -- Special handling for entity names *************** package body Exp_Util is *** 4391,4399 **** -- already rewritten a variable node with a constant as -- a result of an earlier Force_Evaluation call. ! if Ekind (Entity (N)) = E_Constant ! or else Ekind (Entity (N)) = E_In_Parameter ! then return True; -- Functions are not side effect free --- 4678,4684 ---- -- already rewritten a variable node with a constant as -- a result of an earlier Force_Evaluation call. ! if Ekind_In (Entity (N), E_Constant, E_In_Parameter) then return True; -- Functions are not side effect free *************** package body Exp_Util is *** 4427,4437 **** --- 4712,4743 ---- -- some cases, and an assignment can modify the component -- designated by N, so we need to create a temporary for it. + -- The guard testing for Entity being present is needed at least + -- in the case of rewritten predicate expressions, and may be + -- appropriate elsewhere. Obviously we can't go testing the entity + -- field if it does not exist, so it's reasonable to say that this + -- is not the renaming case if it does not exist. + elsif Is_Entity_Name (Original_Node (N)) + and then Present (Entity (Original_Node (N))) and then Is_Renaming_Of_Object (Entity (Original_Node (N))) and then Ekind (Entity (Original_Node (N))) /= E_Constant then return False; + + -- Remove_Side_Effects generates an object renaming declaration to + -- capture the expression of a class-wide expression. In VM targets + -- the frontend performs no expansion for dispatching calls to + -- class-wide types since they are handled by the VM. Hence, we must + -- locate here if this node corresponds to a previous invocation of + -- Remove_Side_Effects to avoid a never ending loop in the frontend. + + elsif VM_Target /= No_VM + and then not Comes_From_Source (N) + and then Nkind (Parent (N)) = N_Object_Renaming_Declaration + and then Is_Class_Wide_Type (Etype (N)) + then + return True; end if; -- For other than entity names and compile time known values, *************** package body Exp_Util is *** 4631,4644 **** 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 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_Volatile_Reference (Exp))) then --- 4937,4951 ---- 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 call, an attribute reference, an ! -- allocator, 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) = N_Allocator or else Nkind (Exp) in N_Op or else (not Name_Req and then Is_Volatile_Reference (Exp))) then *************** package body Exp_Util is *** 4646,4651 **** --- 4953,4970 ---- Set_Etype (Def_Id, Exp_Type); Res := New_Reference_To (Def_Id, Loc); + -- If the expression is a packed reference, it must be reanalyzed + -- and expanded, depending on context. This is the case for actuals + -- where a constraint check may capture the actual before expansion + -- of the call is complete. + + if Nkind (Exp) = N_Indexed_Component + and then Is_Packed (Etype (Prefix (Exp))) + then + Set_Analyzed (Exp, False); + Set_Analyzed (Prefix (Exp), False); + end if; + E := Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, *************** package body Exp_Util is *** 4653,4667 **** Constant_Present => True, Expression => Relocate_Node (Exp)); - -- Check if the previous node relocation requires readjustment of - -- some SCIL Dispatching node. - - if Generate_SCIL - and then Nkind (Exp) = N_Function_Call - then - Adjust_SCIL_Node (Exp, Expression (E)); - end if; - Set_Assignment_OK (E); Insert_Action (Exp, E); --- 4972,4977 ---- *************** package body Exp_Util is *** 4739,4750 **** end if; -- For expressions that denote objects, we can use a renaming scheme. ! -- 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_Volatile_Reference (Exp)) then Def_Id := Make_Temporary (Loc, 'R', Exp); --- 5049,5065 ---- end if; -- For expressions that denote objects, we can use a renaming scheme. ! -- This is needed for correctness in the case of a volatile object ! -- of a non-volatile type because the Make_Reference call of the ! -- "default" approach would generate an illegal access value (an access ! -- value cannot designate such an object - see Analyze_Reference). ! -- We skip using this scheme if we have an object of a volatile type ! -- 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 Treat_As_Volatile (Exp_Type)) then Def_Id := Make_Temporary (Loc, 'R', Exp); *************** package body Exp_Util is *** 4808,4816 **** -- to accommodate functions returning limited objects by reference. if Nkind (Exp) = N_Function_Call ! and then Is_Inherently_Limited_Type (Etype (Exp)) and then Nkind (Parent (Exp)) /= N_Object_Declaration ! and then Ada_Version >= Ada_05 then declare Obj : constant Entity_Id := Make_Temporary (Loc, 'F', Exp); --- 5123,5131 ---- -- to accommodate functions returning limited objects by reference. if Nkind (Exp) = N_Function_Call ! and then Is_Immutably_Limited_Type (Etype (Exp)) and then Nkind (Parent (Exp)) /= N_Object_Declaration ! and then Ada_Version >= Ada_2005 then declare Obj : constant Entity_Id := Make_Temporary (Loc, 'F', Exp); *************** package body Exp_Util is *** 4823,4837 **** Object_Definition => New_Occurrence_Of (Exp_Type, Loc), Expression => Relocate_Node (Exp)); - -- Check if the previous node relocation requires readjustment - -- of some SCIL Dispatching node. - - if Generate_SCIL - and then Nkind (Exp) = N_Function_Call - then - Adjust_SCIL_Node (Exp, Expression (Decl)); - end if; - Insert_Action (Exp, Decl); Set_Etype (Obj, Exp_Type); Rewrite (Exp, New_Occurrence_Of (Obj, Loc)); --- 5138,5143 ---- *************** package body Exp_Util is *** 4839,4845 **** end; end if; ! Ref_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, --- 5145,5151 ---- end; end if; ! Ref_Type := Make_Temporary (Loc, 'A'); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, *************** package body Exp_Util is *** 4890,4905 **** Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, Object_Definition => New_Reference_To (Ref_Type, Loc), Expression => New_Exp)); - - -- Check if the previous node relocation requires readjustment - -- of some SCIL Dispatching node. - - if Generate_SCIL - and then Nkind (Exp) = N_Function_Call - then - Adjust_SCIL_Node (Exp, Prefix (New_Exp)); - end if; end if; -- Preserve the Assignment_OK flag in all copies, since at least --- 5196,5203 ---- Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, Object_Definition => New_Reference_To (Ref_Type, Loc), + Constant_Present => True, Expression => New_Exp)); end if; -- Preserve the Assignment_OK flag in all copies, since at least *************** package body Exp_Util is *** 5290,5296 **** declare CS : constant Boolean := Comes_From_Source (N); begin ! Rewrite (N, Make_Identifier (Sloc (N), Chars => Chars (E))); Set_Entity (N, E); Set_Comes_From_Source (N, CS); Set_Analyzed (N, True); --- 5588,5594 ---- declare CS : constant Boolean := Comes_From_Source (N); begin ! Rewrite (N, Make_Identifier (Sloc (N), Chars (E))); Set_Entity (N, E); Set_Comes_From_Source (N, CS); Set_Analyzed (N, True); diff -Nrcpad gcc-4.5.2/gcc/ada/exp_util.ads gcc-4.6.0/gcc/ada/exp_util.ads *** gcc-4.5.2/gcc/ada/exp_util.ads Mon Jul 20 13:06:01 2009 --- gcc-4.6.0/gcc/ada/exp_util.ads Thu Oct 21 10:33:36 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Exp_Util is *** 403,408 **** --- 403,412 ---- -- Force_Evaluation further guarantees that all evaluations will yield -- the same result. + function Fully_Qualified_Name_String (E : Entity_Id) return String_Id; + -- Generates the string literal corresponding to the fully qualified name + -- of entity E with an ASCII.NUL appended at the end of the name. + procedure Generate_Poll_Call (N : Node_Id); -- If polling is active, then a call to the Poll routine is built, -- and then inserted before the given node N and analyzed. *************** package Exp_Util is *** 444,449 **** --- 448,458 ---- -- Determine whether a record type has anonymous access discriminants with -- a controlled designated type. + function Has_Following_Address_Clause (D : Node_Id) return Boolean; + -- D is the node for an object declaration. This function searches the + -- current declarative part to look for an address clause for the object + -- being declared, and returns True if one is found. + function Homonym_Number (Subp : Entity_Id) return Nat; -- Here subp is the entity for a subprogram. This routine returns the -- homonym number used to disambiguate overloaded subprograms in the same *************** package Exp_Util is *** 553,558 **** --- 562,587 ---- -- and returns True if so. Returns False otherwise. It is an error to call -- this function if N is not of an access type. + function Make_Invariant_Call (Expr : Node_Id) return Node_Id; + -- Expr is an object of a type which Has_Invariants set (and which thus + -- also has an Invariant_Procedure set). If invariants are enabled, this + -- function returns a call to the Invariant procedure passing Expr as the + -- argument, and returns it unanalyzed. If invariants are not enabled, + -- returns a null statement. + + function Make_Predicate_Call + (Typ : Entity_Id; + Expr : Node_Id) return Node_Id; + -- Typ is a type with Predicate_Function set. This routine builds a call to + -- this function passing Expr as the argument, and returns it unanalyzed. + + function Make_Predicate_Check + (Typ : Entity_Id; + Expr : Node_Id) return Node_Id; + -- Typ is a type with Predicate_Function set. This routine builds a Check + -- pragma whose first argument is Predicate, and the second argument is a + -- call to the this predicate function with Expr as the argument. + function Make_Subtype_From_Expr (E : Node_Id; Unc_Typ : Entity_Id) return Node_Id; *************** package Exp_Util is *** 570,575 **** --- 599,611 ---- -- caller has to check whether stack checking is actually enabled in order -- to guide the expansion (typically of a function call). + function Needs_Constant_Address + (Decl : Node_Id; + Typ : Entity_Id) return Boolean; + -- Check whether the expression in an address clause is restricted to + -- consist of constants, when the object has a non-trivial initialization + -- or is controlled. + function Non_Limited_Designated_Type (T : Entity_Id) return Entity_Id; -- An anonymous access type may designate a limited view. Check whether -- non-limited view is available during expansion, to examine components diff -Nrcpad gcc-4.5.2/gcc/ada/exp_vfpt.adb gcc-4.6.0/gcc/ada/exp_vfpt.adb *** gcc-4.5.2/gcc/ada/exp_vfpt.adb Mon May 26 15:51:38 2008 --- gcc-4.6.0/gcc/ada/exp_vfpt.adb Fri Oct 22 09:28:24 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2010, 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- -- *************** with Sem_Res; use Sem_Res; *** 32,43 **** with Sinfo; use Sinfo; with Stand; use Stand; with Tbuild; use Tbuild; - with Ttypef; use Ttypef; with Uintp; use Uintp; with Urealp; use Urealp; package body Exp_VFpt is ---------------------- -- Expand_Vax_Arith -- ---------------------- --- 32,46 ---- with Sinfo; use Sinfo; with Stand; use Stand; with Tbuild; use Tbuild; with Uintp; use Uintp; with Urealp; use Urealp; package body Exp_VFpt is + VAXFF_Digits : constant := 6; + VAXDF_Digits : constant := 9; + VAXGF_Digits : constant := 15; + ---------------------- -- Expand_Vax_Arith -- ---------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/expander.adb gcc-4.6.0/gcc/ada/expander.adb *** gcc-4.5.2/gcc/ada/expander.adb Tue Apr 8 06:57:39 2008 --- gcc-4.6.0/gcc/ada/expander.adb Tue Oct 19 12:29:25 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Expander is *** 163,168 **** --- 163,171 ---- when N_Block_Statement => Expand_N_Block_Statement (N); + when N_Case_Expression => + Expand_N_Case_Expression (N); + when N_Case_Statement => Expand_N_Case_Statement (N); *************** package body Expander is *** 361,366 **** --- 364,372 ---- when N_Qualified_Expression => Expand_N_Qualified_Expression (N); + when N_Quantified_Expression => + Expand_N_Quantified_Expression (N); + when N_Raise_Statement => Expand_N_Raise_Statement (N); *************** package body Expander is *** 470,476 **** Debug_A_Exit ("expanding ", N, " (done)"); end if; - end Expand; --------------------------- --- 476,481 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/fe.h gcc-4.6.0/gcc/ada/fe.h *** gcc-4.5.2/gcc/ada/fe.h Mon Jul 20 13:06:01 2009 --- gcc-4.6.0/gcc/ada/fe.h Tue Oct 19 10:54:58 2010 *************** *** 6,12 **** * * * C Header File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** extern Boolean In_Same_Source_Unit *** 163,168 **** --- 163,169 ---- /* opt: */ #define Global_Discard_Names opt__global_discard_names + #define Exception_Extra_Info opt__exception_extra_info #define Exception_Locations_Suppressed opt__exception_locations_suppressed #define Exception_Mechanism opt__exception_mechanism #define Back_Annotate_Rep_Info opt__back_annotate_rep_info *************** extern Boolean In_Same_Source_Unit *** 170,175 **** --- 171,177 ---- typedef enum {Setjmp_Longjmp, Back_End_Exceptions} Exception_Mechanism_Type; extern Boolean Global_Discard_Names; + extern Boolean Exception_Extra_Info; extern Boolean Exception_Locations_Suppressed; extern Exception_Mechanism_Type Exception_Mechanism; extern Boolean Back_Annotate_Rep_Info; diff -Nrcpad gcc-4.5.2/gcc/ada/fmap.adb gcc-4.6.0/gcc/ada/fmap.adb *** gcc-4.5.2/gcc/ada/fmap.adb Thu Jun 25 09:18:43 2009 --- gcc-4.6.0/gcc/ada/fmap.adb Tue Jun 22 13:26:32 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Output; use Output; *** 29,35 **** --- 29,38 ---- with Table; with Types; use Types; + pragma Warnings (Off); + -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; + pragma Warnings (On); with Unchecked_Conversion; diff -Nrcpad gcc-4.5.2/gcc/ada/freeze.adb gcc-4.6.0/gcc/ada/freeze.adb *** gcc-4.5.2/gcc/ada/freeze.adb Tue Jan 26 10:02:11 2010 --- gcc-4.6.0/gcc/ada/freeze.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Exp_Pakd; use Exp_Pakd; *** 36,41 **** --- 36,42 ---- with Exp_Util; use Exp_Util; with Exp_Tss; use Exp_Tss; with Layout; use Layout; + with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; *************** package body Freeze is *** 100,109 **** procedure Freeze_And_Append (Ent : Entity_Id; ! Loc : Source_Ptr; Result : in out List_Id); -- Freezes Ent using Freeze_Entity, and appends the resulting list of ! -- nodes to Result, modifying Result from No_List if necessary. procedure Freeze_Enumeration_Type (Typ : Entity_Id); -- Freeze enumeration type. The Esize field is set as processing --- 101,111 ---- procedure Freeze_And_Append (Ent : Entity_Id; ! N : Node_Id; Result : in out List_Id); -- Freezes Ent using Freeze_Entity, and appends the resulting list of ! -- nodes to Result, modifying Result from No_List if necessary. N has ! -- the same usage as in Freeze_Entity. procedure Freeze_Enumeration_Type (Typ : Entity_Id); -- Freeze enumeration type. The Esize field is set as processing *************** package body Freeze is *** 137,156 **** procedure Process_Default_Expressions (E : Entity_Id; After : in out Node_Id); ! -- This procedure is called for each subprogram to complete processing ! -- of default expressions at the point where all types are known to be ! -- frozen. The expressions must be analyzed in full, to make sure that ! -- all error processing is done (they have only been pre-analyzed). If ! -- the expression is not an entity or literal, its analysis may generate ! -- code which must not be executed. In that case we build a function ! -- body to hold that code. This wrapper function serves no other purpose ! -- (it used to be called to evaluate the default, but now the default is ! -- inlined at each point of call). procedure Set_Component_Alignment_If_Not_Set (Typ : Entity_Id); ! -- Typ is a record or array type that is being frozen. This routine ! -- sets the default component alignment from the scope stack values ! -- if the alignment is otherwise not specified. procedure Check_Debug_Info_Needed (T : Entity_Id); -- As each entity is frozen, this routine is called to deal with the --- 139,158 ---- procedure Process_Default_Expressions (E : Entity_Id; After : in out Node_Id); ! -- This procedure is called for each subprogram to complete processing of ! -- default expressions at the point where all types are known to be frozen. ! -- The expressions must be analyzed in full, to make sure that all error ! -- processing is done (they have only been pre-analyzed). If the expression ! -- is not an entity or literal, its analysis may generate code which must ! -- not be executed. In that case we build a function body to hold that ! -- code. This wrapper function serves no other purpose (it used to be ! -- called to evaluate the default, but now the default is inlined at each ! -- point of call). procedure Set_Component_Alignment_If_Not_Set (Typ : Entity_Id); ! -- Typ is a record or array type that is being frozen. This routine sets ! -- the default component alignment from the scope stack values if the ! -- alignment is otherwise not specified. procedure Check_Debug_Info_Needed (T : Entity_Id); -- As each entity is frozen, this routine is called to deal with the *************** package body Freeze is *** 161,169 **** -- subsidiary entities have the flag set as required. procedure Undelay_Type (T : Entity_Id); ! -- T is a type of a component that we know to be an Itype. ! -- We don't want this to have a Freeze_Node, so ensure it doesn't. ! -- Do the same for any Full_View or Corresponding_Record_Type. procedure Warn_Overlay (Expr : Node_Id; --- 163,171 ---- -- subsidiary entities have the flag set as required. procedure Undelay_Type (T : Entity_Id); ! -- T is a type of a component that we know to be an Itype. We don't want ! -- this to have a Freeze_Node, so ensure it doesn't. Do the same for any ! -- Full_View or Corresponding_Record_Type. procedure Warn_Overlay (Expr : Node_Id; *************** package body Freeze is *** 203,214 **** New_S : Entity_Id; After : in out Node_Id) is ! Body_Node : constant Node_Id := Build_Renamed_Body (Decl, New_S); begin ! Insert_After (After, Body_Node); ! Mark_Rewrite_Insertion (Body_Node); ! Analyze (Body_Node); ! After := Body_Node; end Build_And_Analyze_Renamed_Body; ------------------------ --- 205,268 ---- New_S : Entity_Id; After : in out Node_Id) is ! Body_Decl : constant Node_Id := Unit_Declaration_Node (New_S); ! Ent : constant Entity_Id := Defining_Entity (Decl); ! Body_Node : Node_Id; ! Renamed_Subp : Entity_Id; ! begin ! -- If the renamed subprogram is intrinsic, there is no need for a ! -- wrapper body: we set the alias that will be called and expanded which ! -- completes the declaration. This transformation is only legal if the ! -- renamed entity has already been elaborated. ! ! -- Note that it is legal for a renaming_as_body to rename an intrinsic ! -- subprogram, as long as the renaming occurs before the new entity ! -- is frozen. See RM 8.5.4 (5). ! ! if Nkind (Body_Decl) = N_Subprogram_Renaming_Declaration ! and then Is_Entity_Name (Name (Body_Decl)) ! then ! Renamed_Subp := Entity (Name (Body_Decl)); ! else ! Renamed_Subp := Empty; ! end if; ! ! if Present (Renamed_Subp) ! and then Is_Intrinsic_Subprogram (Renamed_Subp) ! and then ! (not In_Same_Source_Unit (Renamed_Subp, Ent) ! or else Sloc (Renamed_Subp) < Sloc (Ent)) ! ! -- We can make the renaming entity intrinsic if the renamed function ! -- has an interface name, or if it is one of the shift/rotate ! -- operations known to the compiler. ! ! and then (Present (Interface_Name (Renamed_Subp)) ! or else Chars (Renamed_Subp) = Name_Rotate_Left ! or else Chars (Renamed_Subp) = Name_Rotate_Right ! or else Chars (Renamed_Subp) = Name_Shift_Left ! or else Chars (Renamed_Subp) = Name_Shift_Right ! or else Chars (Renamed_Subp) = Name_Shift_Right_Arithmetic) ! then ! Set_Interface_Name (Ent, Interface_Name (Renamed_Subp)); ! ! if Present (Alias (Renamed_Subp)) then ! Set_Alias (Ent, Alias (Renamed_Subp)); ! else ! Set_Alias (Ent, Renamed_Subp); ! end if; ! ! Set_Is_Intrinsic_Subprogram (Ent); ! Set_Has_Completion (Ent); ! ! else ! Body_Node := Build_Renamed_Body (Decl, New_S); ! Insert_After (After, Body_Node); ! Mark_Rewrite_Insertion (Body_Node); ! Analyze (Body_Node); ! After := Body_Node; ! end if; end Build_And_Analyze_Renamed_Body; ------------------------ *************** package body Freeze is *** 220,231 **** New_S : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (New_S); ! -- We use for the source location of the renamed body, the location ! -- of the spec entity. It might seem more natural to use the location ! -- of the renaming declaration itself, but that would be wrong, since ! -- then the body we create would look as though it was created far ! -- too late, and this could cause problems with elaboration order ! -- analysis, particularly in connection with instantiations. N : constant Node_Id := Unit_Declaration_Node (New_S); Nam : constant Node_Id := Name (N); --- 274,285 ---- New_S : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (New_S); ! -- We use for the source location of the renamed body, the location of ! -- the spec entity. It might seem more natural to use the location of ! -- the renaming declaration itself, but that would be wrong, since then ! -- the body we create would look as though it was created far too late, ! -- and this could cause problems with elaboration order analysis, ! -- particularly in connection with instantiations. N : constant Node_Id := Unit_Declaration_Node (New_S); Nam : constant Node_Id := Name (N); *************** package body Freeze is *** 301,318 **** Call_Name := New_Copy (Name (N)); end if; ! -- The original name may have been overloaded, but ! -- is fully resolved now. Set_Is_Overloaded (Call_Name, False); end if; -- For simple renamings, subsequent calls can be expanded directly as ! -- called to the renamed entity. The body must be generated in any case ! -- for calls they may appear elsewhere. ! if (Ekind (Old_S) = E_Function ! or else Ekind (Old_S) = E_Procedure) and then Nkind (Decl) = N_Subprogram_Declaration then Set_Body_To_Inline (Decl, Old_S); --- 355,370 ---- Call_Name := New_Copy (Name (N)); end if; ! -- Original name may have been overloaded, but is fully resolved now Set_Is_Overloaded (Call_Name, False); end if; -- For simple renamings, subsequent calls can be expanded directly as ! -- calls to the renamed entity. The body must be generated in any case ! -- for calls that may appear elsewhere. ! if Ekind_In (Old_S, E_Function, E_Procedure) and then Nkind (Decl) = N_Subprogram_Declaration then Set_Body_To_Inline (Decl, Old_S); *************** package body Freeze is *** 331,337 **** Form_Type : constant Entity_Id := Etype (First_Formal (Old_S)); begin - -- The controlling formal may be an access parameter, or the -- actual may be an access value, so adjust accordingly. --- 383,388 ---- *************** package body Freeze is *** 380,389 **** if Present (Formal) then O_Formal := First_Formal (Old_S); Param_Spec := First (Parameter_Specifications (Spec)); - while Present (Formal) loop if Is_Entry (Old_S) then - if Nkind (Parameter_Type (Param_Spec)) /= N_Access_Definition then --- 431,438 ---- *************** package body Freeze is *** 446,452 **** Make_Defining_Identifier (Loc, Chars => Chars (New_S))); Param_Spec := First (Parameter_Specifications (Spec)); - while Present (Param_Spec) loop Set_Defining_Identifier (Param_Spec, Make_Defining_Identifier (Loc, --- 495,500 ---- *************** package body Freeze is *** 497,545 **** if Present (Addr) then Expr := Expression (Addr); ! -- If we have no initialization of any kind, then we don't need to ! -- place any restrictions on the address clause, because the object ! -- will be elaborated after the address clause is evaluated. This ! -- happens if the declaration has no initial expression, or the type ! -- has no implicit initialization, or the object is imported. ! ! -- The same holds for all initialized scalar types and all access ! -- types. Packed bit arrays of size up to 64 are represented using a ! -- modular type with an initialization (to zero) and can be processed ! -- like other initialized scalar types. ! ! -- If the type is controlled, code to attach the object to a ! -- finalization chain is generated at the point of declaration, ! -- and therefore the elaboration of the object cannot be delayed: ! -- the address expression must be a constant. ! ! if (No (Expression (Decl)) ! and then not Needs_Finalization (Typ) ! and then ! (not Has_Non_Null_Base_Init_Proc (Typ) ! or else Is_Imported (E))) ! ! or else ! (Present (Expression (Decl)) ! and then Is_Scalar_Type (Typ)) ! ! or else ! Is_Access_Type (Typ) ! ! or else ! (Is_Bit_Packed_Array (Typ) ! and then ! Is_Modular_Integer_Type (Packed_Array_Type (Typ))) ! then ! null; ! ! -- Otherwise, we require the address clause to be constant because ! -- the call to the initialization procedure (or the attach code) has ! -- to happen at the point of the declaration. ! -- Actually the IP call has been moved to the freeze actions ! -- anyway, so maybe we can relax this restriction??? ! ! else Check_Constant_Address_Clause (Expr, E); -- Has_Delayed_Freeze was set on E when the address clause was --- 545,551 ---- if Present (Addr) then Expr := Expression (Addr); ! if Needs_Constant_Address (Decl, Typ) then Check_Constant_Address_Clause (Expr, E); -- Has_Delayed_Freeze was set on E when the address clause was *************** package body Freeze is *** 551,557 **** end if; end if; ! if not Error_Posted (Expr) and then not Needs_Finalization (Typ) then Warn_Overlay (Expr, Typ, Name (Addr)); --- 557,592 ---- end if; end if; ! -- If Rep_Clauses are to be ignored, remove address clause from ! -- list attached to entity, because it may be illegal for gigi, ! -- for example by breaking order of elaboration.. ! ! if Ignore_Rep_Clauses then ! declare ! Rep : Node_Id; ! ! begin ! Rep := First_Rep_Item (E); ! ! if Rep = Addr then ! Set_First_Rep_Item (E, Next_Rep_Item (Addr)); ! ! else ! while Present (Rep) ! and then Next_Rep_Item (Rep) /= Addr ! loop ! Rep := Next_Rep_Item (Rep); ! end loop; ! end if; ! ! if Present (Rep) then ! Set_Next_Rep_Item (Rep, Next_Rep_Item (Addr)); ! end if; ! end; ! ! Rewrite (Addr, Make_Null_Statement (Sloc (E))); ! ! elsif not Error_Posted (Expr) and then not Needs_Finalization (Typ) then Warn_Overlay (Expr, Typ, Name (Addr)); *************** package body Freeze is *** 749,755 **** return False; -- A subtype of a variant record must not have non-static ! -- discriminanted components. elsif T /= Base_Type (T) and then not Static_Discriminated_Components (T) --- 784,790 ---- return False; -- A subtype of a variant record must not have non-static ! -- discriminated components. elsif T /= Base_Type (T) and then not Static_Discriminated_Components (T) *************** package body Freeze is *** 789,795 **** and then Present (Parent (T)) and then Nkind (Parent (T)) = N_Full_Type_Declaration and then Nkind (Type_Definition (Parent (T))) = ! N_Record_Definition and then not Null_Present (Type_Definition (Parent (T))) and then Present (Variant_Part (Component_List (Type_Definition (Parent (T))))) --- 824,830 ---- and then Present (Parent (T)) and then Nkind (Parent (T)) = N_Full_Type_Declaration and then Nkind (Type_Definition (Parent (T))) = ! N_Record_Definition and then not Null_Present (Type_Definition (Parent (T))) and then Present (Variant_Part (Component_List (Type_Definition (Parent (T))))) *************** package body Freeze is *** 801,808 **** if not Is_Constrained (T) and then ! No (Discriminant_Default_Value ! (First_Discriminant (T))) and then Unknown_Esize (T) then return False; --- 836,842 ---- if not Is_Constrained (T) and then ! No (Discriminant_Default_Value (First_Discriminant (T))) and then Unknown_Esize (T) then return False; *************** package body Freeze is *** 1025,1031 **** end if; Comp := First_Component (E); - while Present (Comp) loop if not Is_Type (Comp) and then (Strict_Alignment (Etype (Comp)) --- 1059,1064 ---- *************** package body Freeze is *** 1056,1062 **** -- Do not attempt to analyze case where range was in error ! if Error_Posted (Scalar_Range (E)) then return; end if; --- 1089,1097 ---- -- Do not attempt to analyze case where range was in error ! if No (Scalar_Range (E)) ! or else Error_Posted (Scalar_Range (E)) ! then return; end if; *************** package body Freeze is *** 1145,1154 **** if Nkind_In (Par, N_Object_Declaration, N_Assignment_Statement) and then Comes_From_Source (Par) then ! Temp := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('T')); ! New_N := Make_Object_Declaration (Loc, Defining_Identifier => Temp, --- 1180,1186 ---- if Nkind_In (Par, N_Object_Declaration, N_Assignment_Statement) and then Comes_From_Source (Par) then ! Temp := Make_Temporary (Loc, 'T', E); New_N := Make_Object_Declaration (Loc, Defining_Identifier => Temp, *************** package body Freeze is *** 1177,1183 **** -- as they are generated. procedure Freeze_All (From : Entity_Id; After : in out Node_Id) is - Loc : constant Source_Ptr := Sloc (After); E : Entity_Id; Decl : Node_Id; --- 1209,1214 ---- *************** package body Freeze is *** 1191,1200 **** -- Freeze_All_Ent -- -------------------- ! procedure Freeze_All_Ent ! (From : Entity_Id; ! After : in out Node_Id) ! is E : Entity_Id; Flist : List_Id; Lastn : Node_Id; --- 1222,1228 ---- -- Freeze_All_Ent -- -------------------- ! procedure Freeze_All_Ent (From : Entity_Id; After : in out Node_Id) is E : Entity_Id; Flist : List_Id; Lastn : Node_Id; *************** package body Freeze is *** 1277,1290 **** begin Prim := First_Elmt (Prim_List); - while Present (Prim) loop Subp := Node (Prim); if Comes_From_Source (Subp) and then not Is_Frozen (Subp) then ! Flist := Freeze_Entity (Subp, Loc); Process_Flist; end if; --- 1305,1317 ---- begin Prim := First_Elmt (Prim_List); while Present (Prim) loop Subp := Node (Prim); if Comes_From_Source (Subp) and then not Is_Frozen (Subp) then ! Flist := Freeze_Entity (Subp, After); Process_Flist; end if; *************** package body Freeze is *** 1294,1300 **** end if; if not Is_Frozen (E) then ! Flist := Freeze_Entity (E, Loc); Process_Flist; end if; --- 1321,1327 ---- end if; if not Is_Frozen (E) then ! Flist := Freeze_Entity (E, After); Process_Flist; end if; *************** package body Freeze is *** 1312,1322 **** Bod : constant Node_Id := Next (After); begin ! if (Nkind (Bod) = N_Subprogram_Body ! or else Nkind (Bod) = N_Entry_Body ! or else Nkind (Bod) = N_Package_Body ! or else Nkind (Bod) = N_Protected_Body ! or else Nkind (Bod) = N_Task_Body or else Nkind (Bod) in N_Body_Stub) and then List_Containing (After) = List_Containing (Parent (E)) --- 1339,1349 ---- Bod : constant Node_Id := Next (After); begin ! if (Nkind_In (Bod, N_Subprogram_Body, ! N_Entry_Body, ! N_Package_Body, ! N_Protected_Body, ! N_Task_Body) or else Nkind (Bod) in N_Body_Stub) and then List_Containing (After) = List_Containing (Parent (E)) *************** package body Freeze is *** 1343,1348 **** --- 1370,1378 ---- -- point at which such functions are constructed (after all types that -- might be used in such expressions have been frozen). + -- For subprograms that are renaming_as_body, we create the wrapper + -- bodies as needed. + -- 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 *************** package body Freeze is *** 1383,1393 **** then declare Ent : Entity_Id; begin Ent := First_Entity (E); - while Present (Ent) loop - if Is_Entry (Ent) and then not Default_Expressions_Processed (Ent) then --- 1413,1422 ---- then declare Ent : Entity_Id; + begin Ent := First_Entity (E); while Present (Ent) loop if Is_Entry (Ent) and then not Default_Expressions_Processed (Ent) then *************** package body Freeze is *** 1417,1426 **** procedure Freeze_And_Append (Ent : Entity_Id; ! Loc : Source_Ptr; Result : in out List_Id) is ! L : constant List_Id := Freeze_Entity (Ent, Loc); begin if Is_Non_Empty_List (L) then if Result = No_List then --- 1446,1455 ---- procedure Freeze_And_Append (Ent : Entity_Id; ! N : Node_Id; Result : in out List_Id) is ! L : constant List_Id := Freeze_Entity (Ent, N); begin if Is_Non_Empty_List (L) then if Result = No_List then *************** package body Freeze is *** 1436,1442 **** ------------------- procedure Freeze_Before (N : Node_Id; T : Entity_Id) is ! Freeze_Nodes : constant List_Id := Freeze_Entity (T, Sloc (N)); begin if Is_Non_Empty_List (Freeze_Nodes) then Insert_Actions (N, Freeze_Nodes); --- 1465,1471 ---- ------------------- procedure Freeze_Before (N : Node_Id; T : Entity_Id) is ! Freeze_Nodes : constant List_Id := Freeze_Entity (T, N); begin if Is_Non_Empty_List (Freeze_Nodes) then Insert_Actions (N, Freeze_Nodes); *************** package body Freeze is *** 1447,1453 **** -- Freeze_Entity -- ------------------- ! function Freeze_Entity (E : Entity_Id; Loc : Source_Ptr) return List_Id is Test_E : Entity_Id := E; Comp : Entity_Id; F_Node : Node_Id; --- 1476,1483 ---- -- Freeze_Entity -- ------------------- ! function Freeze_Entity (E : Entity_Id; N : Node_Id) return List_Id is ! Loc : constant Source_Ptr := Sloc (N); Test_E : Entity_Id := E; Comp : Entity_Id; F_Node : Node_Id; *************** package body Freeze is *** 1547,1553 **** -- either a tagged type, or a limited record. if Is_Limited_Type (Rec_Type) ! and then (Ada_Version < Ada_05 or else Is_Tagged_Type (Rec_Type)) then return; --- 1577,1583 ---- -- either a tagged type, or a limited record. if Is_Limited_Type (Rec_Type) ! and then (Ada_Version < Ada_2005 or else Is_Tagged_Type (Rec_Type)) then return; *************** package body Freeze is *** 1776,1782 **** Prev := Empty; while Present (Comp) loop ! -- First handle the (real) component case if Ekind (Comp) = E_Component or else Ekind (Comp) = E_Discriminant --- 1806,1812 ---- Prev := Empty; while Present (Comp) loop ! -- First handle the component case if Ekind (Comp) = E_Component or else Ekind (Comp) = E_Discriminant *************** package body Freeze is *** 1800,1806 **** Undelay_Type (Etype (Comp)); end if; ! Freeze_And_Append (Etype (Comp), Loc, Result); -- Check for error of component clause given for variable -- sized type. We have to delay this test till this point, --- 1830,1836 ---- Undelay_Type (Etype (Comp)); end if; ! Freeze_And_Append (Etype (Comp), N, Result); -- Check for error of component clause given for variable -- sized type. We have to delay this test till this point, *************** package body Freeze is *** 1847,1975 **** Component_Name (Component_Clause (Comp))); end if; end if; - - -- If component clause is present, then deal with the non- - -- default bit order case for Ada 95 mode. The required - -- processing for Ada 2005 mode is handled separately after - -- processing all components. - - -- We only do this processing for the base type, and in - -- fact that's important, since otherwise if there are - -- record subtypes, we could reverse the bits once for - -- each subtype, which would be incorrect. - - if Present (CC) - and then Reverse_Bit_Order (Rec) - and then Ekind (E) = E_Record_Type - and then Ada_Version <= Ada_95 - then - declare - CFB : constant Uint := Component_Bit_Offset (Comp); - CSZ : constant Uint := Esize (Comp); - CLC : constant Node_Id := Component_Clause (Comp); - Pos : constant Node_Id := Position (CLC); - FB : constant Node_Id := First_Bit (CLC); - - Storage_Unit_Offset : constant Uint := - CFB / System_Storage_Unit; - - Start_Bit : constant Uint := - CFB mod System_Storage_Unit; - - begin - -- Cases where field goes over storage unit boundary - - if Start_Bit + CSZ > System_Storage_Unit then - - -- Allow multi-byte field but generate warning - - if Start_Bit mod System_Storage_Unit = 0 - and then CSZ mod System_Storage_Unit = 0 - then - Error_Msg_N - ("multi-byte field specified with non-standard" - & " Bit_Order?", CLC); - - if Bytes_Big_Endian then - Error_Msg_N - ("bytes are not reversed " - & "(component is big-endian)?", CLC); - else - Error_Msg_N - ("bytes are not reversed " - & "(component is little-endian)?", CLC); - end if; - - -- Do not allow non-contiguous field - - else - Error_Msg_N - ("attempt to specify non-contiguous field " - & "not permitted", CLC); - Error_Msg_N - ("\caused by non-standard Bit_Order " - & "specified", CLC); - Error_Msg_N - ("\consider possibility of using " - & "Ada 2005 mode here", CLC); - end if; - - -- Case where field fits in one storage unit - - else - -- Give warning if suspicious component clause - - if Intval (FB) >= System_Storage_Unit - and then Warn_On_Reverse_Bit_Order - then - Error_Msg_N - ("?Bit_Order clause does not affect " & - "byte ordering", Pos); - Error_Msg_Uint_1 := - Intval (Pos) + Intval (FB) / - System_Storage_Unit; - Error_Msg_N - ("?position normalized to ^ before bit " & - "order interpreted", Pos); - end if; - - -- Here is where we fix up the Component_Bit_Offset - -- value to account for the reverse bit order. - -- Some examples of what needs to be done are: - - -- First_Bit .. Last_Bit Component_Bit_Offset - -- old new old new - - -- 0 .. 0 7 .. 7 0 7 - -- 0 .. 1 6 .. 7 0 6 - -- 0 .. 2 5 .. 7 0 5 - -- 0 .. 7 0 .. 7 0 4 - - -- 1 .. 1 6 .. 6 1 6 - -- 1 .. 4 3 .. 6 1 3 - -- 4 .. 7 0 .. 3 4 0 - - -- The general rule is that the first bit is - -- is obtained by subtracting the old ending bit - -- from storage_unit - 1. - - Set_Component_Bit_Offset - (Comp, - (Storage_Unit_Offset * System_Storage_Unit) + - (System_Storage_Unit - 1) - - (Start_Bit + CSZ - 1)); - - Set_Normalized_First_Bit - (Comp, - Component_Bit_Offset (Comp) mod - System_Storage_Unit); - end if; - end; - end if; end; end if; ! -- Gather data for possible Implicit_Packing later if not Is_Scalar_Type (Etype (Comp)) then All_Scalar_Components := False; --- 1877,1888 ---- Component_Name (Component_Clause (Comp))); end if; end if; end; end if; ! -- Gather data for possible Implicit_Packing later. Note that at ! -- this stage we might be dealing with a real component, or with ! -- an implicit subtype declaration. if not Is_Scalar_Type (Etype (Comp)) then All_Scalar_Components := False; *************** package body Freeze is *** 1982,1993 **** -- If the component is an Itype with Delayed_Freeze and is either -- a record or array subtype and its base type has not yet been ! -- frozen, we must remove this from the entity list of this ! -- record and put it on the entity list of the scope of its base ! -- type. Note that we know that this is not the type of a ! -- component since we cleared Has_Delayed_Freeze for it in the ! -- previous loop. Thus this must be the Designated_Type of an ! -- access type, which is the type of a component. if Is_Itype (Comp) and then Is_Type (Scope (Comp)) --- 1895,1906 ---- -- If the component is an Itype with Delayed_Freeze and is either -- a record or array subtype and its base type has not yet been ! -- frozen, we must remove this from the entity list of this record ! -- and put it on the entity list of the scope of its base type. ! -- Note that we know that this is not the type of a component ! -- since we cleared Has_Delayed_Freeze for it in the previous ! -- loop. Thus this must be the Designated_Type of an access type, ! -- which is the type of a component. if Is_Itype (Comp) and then Is_Type (Scope (Comp)) *************** package body Freeze is *** 2076,2088 **** then if Is_Entity_Name (Expression (Alloc)) then Freeze_And_Append ! (Entity (Expression (Alloc)), Loc, Result); elsif Nkind (Expression (Alloc)) = N_Subtype_Indication then Freeze_And_Append (Entity (Subtype_Mark (Expression (Alloc))), ! Loc, Result); end if; elsif Is_Itype (Designated_Type (Etype (Comp))) then --- 1989,2001 ---- then if Is_Entity_Name (Expression (Alloc)) then Freeze_And_Append ! (Entity (Expression (Alloc)), N, Result); elsif Nkind (Expression (Alloc)) = N_Subtype_Indication then Freeze_And_Append (Entity (Subtype_Mark (Expression (Alloc))), ! N, Result); end if; elsif Is_Itype (Designated_Type (Etype (Comp))) then *************** package body Freeze is *** 2090,2096 **** else Freeze_And_Append ! (Designated_Type (Etype (Comp)), Loc, Result); end if; end if; end; --- 2003,2009 ---- else Freeze_And_Append ! (Designated_Type (Etype (Comp)), N, Result); end if; end if; end; *************** package body Freeze is *** 2111,2147 **** then Freeze_And_Append (Designated_Type ! (Component_Type (Etype (Comp))), Loc, Result); end if; Prev := Comp; Next_Entity (Comp); end loop; ! -- Deal with pragma Bit_Order if Reverse_Bit_Order (Rec) and then Base_Type (Rec) = Rec then if not Placed_Component then ADC := Get_Attribute_Definition_Clause (Rec, Attribute_Bit_Order); ! Error_Msg_N ! ("?Bit_Order specification has no effect", ADC); Error_Msg_N ("\?since no component clauses were specified", ADC); ! -- Here is where we do Ada 2005 processing for bit order (the Ada ! -- 95 case was already taken care of above). ! elsif Ada_Version >= Ada_05 then Adjust_Record_For_Reverse_Bit_Order (Rec); end if; end if; -- Set OK_To_Reorder_Components depending on debug flags ! if Rec = Base_Type (Rec) ! and then Convention (Rec) = Convention_Ada ! then if (Has_Discriminants (Rec) and then Debug_Flag_Dot_V) or else (not Has_Discriminants (Rec) and then Debug_Flag_Dot_R) --- 2024,2068 ---- then Freeze_And_Append (Designated_Type ! (Component_Type (Etype (Comp))), N, Result); end if; Prev := Comp; Next_Entity (Comp); end loop; ! -- Deal with pragma Bit_Order setting non-standard bit order if Reverse_Bit_Order (Rec) and then Base_Type (Rec) = Rec then if not Placed_Component then ADC := Get_Attribute_Definition_Clause (Rec, Attribute_Bit_Order); ! Error_Msg_N ("?Bit_Order specification has no effect", ADC); Error_Msg_N ("\?since no component clauses were specified", ADC); ! -- Here is where we do the processing for reversed bit order ! else Adjust_Record_For_Reverse_Bit_Order (Rec); end if; end if; + -- Complete error checking on record representation clause (e.g. + -- overlap of components). This is called after adjusting the + -- record for reverse bit order. + + declare + RRC : constant Node_Id := Get_Record_Representation_Clause (Rec); + begin + if Present (RRC) then + Check_Record_Representation_Clause (RRC); + end if; + end; + -- Set OK_To_Reorder_Components depending on debug flags ! if Is_Base_Type (Rec) and then Convention (Rec) = Convention_Ada then if (Has_Discriminants (Rec) and then Debug_Flag_Dot_V) or else (not Has_Discriminants (Rec) and then Debug_Flag_Dot_R) *************** package body Freeze is *** 2172,2178 **** -- Give warning if redundant constructs warnings on if Warn_On_Redundant_Constructs then ! Error_Msg_N ("?pragma Pack has no effect, no unplaced components", Get_Rep_Pragma (Rec, Name_Pack)); end if; --- 2093,2099 ---- -- Give warning if redundant constructs warnings on if Warn_On_Redundant_Constructs then ! Error_Msg_N -- CODEFIX ("?pragma Pack has no effect, no unplaced components", Get_Rep_Pragma (Rec, Name_Pack)); end if; *************** package body Freeze is *** 2188,2195 **** if Ekind (Rec) = E_Record_Type then if Present (Corresponding_Remote_Type (Rec)) then ! Freeze_And_Append ! (Corresponding_Remote_Type (Rec), Loc, Result); end if; Comp := First_Component (Rec); --- 2109,2115 ---- if Ekind (Rec) = E_Record_Type then if Present (Corresponding_Remote_Type (Rec)) then ! Freeze_And_Append (Corresponding_Remote_Type (Rec), N, Result); end if; Comp := First_Component (Rec); *************** package body Freeze is *** 2240,2246 **** if Is_First_Subtype (Rec) then Comp := First_Component (Rec); - while Present (Comp) loop if Present (Component_Clause (Comp)) and then (Is_Fixed_Point_Type (Etype (Comp)) --- 2160,2165 ---- *************** package body Freeze is *** 2326,2332 **** and then Esize (Rec) >= Scalar_Component_Total_RM_Size -- Never do implicit packing in CodePeer mode since we don't do ! -- any packing ever in this mode (why not???) and then not CodePeer_Mode then --- 2245,2253 ---- and then Esize (Rec) >= Scalar_Component_Total_RM_Size -- Never do implicit packing in CodePeer mode since we don't do ! -- any packing in this mode, since this generates over-complex ! -- code that confuses CodePeer, and in general, CodePeer does not ! -- care about the internal representation of objects. and then not CodePeer_Mode then *************** package body Freeze is *** 2341,2349 **** declare Sz : constant Node_Id := Size_Clause (Rec); begin ! Error_Msg_NE -- CODEFIX ("size given for& too small", Sz, Rec); ! Error_Msg_N -- CODEFIX ("\use explicit pragma Pack " & "or use pragma Implicit_Packing", Sz); end; --- 2262,2270 ---- declare Sz : constant Node_Id := Size_Clause (Rec); begin ! Error_Msg_NE -- CODEFIX ("size given for& too small", Sz, Rec); ! Error_Msg_N -- CODEFIX ("\use explicit pragma Pack " & "or use pragma Implicit_Packing", Sz); end; *************** package body Freeze is *** 2397,2405 **** and then Ekind (Test_E) /= E_Constant then declare ! S : Entity_Id := Current_Scope; begin while Present (S) loop if Is_Overloadable (S) then if Comes_From_Source (S) --- 2318,2327 ---- and then Ekind (Test_E) /= E_Constant then declare ! S : Entity_Id; begin + S := Current_Scope; while Present (S) loop if Is_Overloadable (S) then if Comes_From_Source (S) *************** package body Freeze is *** 2430,2438 **** and then Present (Scope (Test_E)) then declare ! S : Entity_Id := Scope (Test_E); begin while Present (S) loop if Is_Generic_Instance (S) then exit; --- 2352,2361 ---- and then Present (Scope (Test_E)) then declare ! S : Entity_Id; begin + S := Scope (Test_E); while Present (S) loop if Is_Generic_Instance (S) then exit; *************** package body Freeze is *** 2447,2452 **** --- 2370,2401 ---- end; end if; + -- Deal with delayed aspect specifications. At the point of occurrence + -- of the aspect definition, we preanalyzed the argument, to capture + -- the visibility at that point, but the actual analysis of the aspect + -- is required to be delayed to the freeze point, so we evaluate the + -- pragma or attribute definition clause in the tree at this point. + + if Has_Delayed_Aspects (E) then + declare + Ritem : Node_Id; + Aitem : Node_Id; + + begin + Ritem := First_Rep_Item (E); + while Present (Ritem) loop + if Nkind (Ritem) = N_Aspect_Specification then + Aitem := Aspect_Rep_Item (Ritem); + pragma Assert (Is_Delayed_Aspect (Aitem)); + Set_Parent (Aitem, Ritem); + Analyze (Aitem); + end if; + + Next_Rep_Item (Ritem); + end loop; + end; + end if; + -- Here to freeze the entity Result := No_List; *************** package body Freeze is *** 2461,2468 **** -- Skip this if the entity is stubbed, since we don't need a name -- for any stubbed routine. For the case on intrinsics, if no -- external name is specified, then calls will be handled in ! -- Exp_Intr.Expand_Intrinsic_Call, and no name is needed; if ! -- an external name is provided, then Expand_Intrinsic_Call leaves -- calls in place for expansion by GIGI. if (Is_Imported (E) or else Is_Exported (E)) --- 2410,2417 ---- -- Skip this if the entity is stubbed, since we don't need a name -- for any stubbed routine. For the case on intrinsics, if no -- external name is specified, then calls will be handled in ! -- Exp_Intr.Expand_Intrinsic_Call, and no name is needed. If an ! -- external name is provided, then Expand_Intrinsic_Call leaves -- calls in place for expansion by GIGI. if (Is_Imported (E) or else Is_Exported (E)) *************** package body Freeze is *** 2508,2514 **** Formal := First_Formal (E); while Present (Formal) loop F_Type := Etype (Formal); ! Freeze_And_Append (F_Type, Loc, Result); if Is_Private_Type (F_Type) and then Is_Private_Type (Base_Type (F_Type)) --- 2457,2463 ---- Formal := First_Formal (E); while Present (Formal) loop F_Type := Etype (Formal); ! Freeze_And_Append (F_Type, N, Result); if Is_Private_Type (F_Type) and then Is_Private_Type (Base_Type (F_Type)) *************** package body Freeze is *** 2572,2579 **** and then not Has_Size_Clause (F_Type) and then VM_Target = No_VM then ! Error_Msg_N ! ("& is an 8-bit Ada Boolean?", Formal); Error_Msg_N ("\use appropriate corresponding type in C " & "(e.g. char)?", Formal); --- 2521,2527 ---- and then not Has_Size_Clause (F_Type) and then VM_Target = No_VM then ! Error_Msg_N ("& is an 8-bit Ada Boolean?", Formal); Error_Msg_N ("\use appropriate corresponding type in C " & "(e.g. char)?", Formal); *************** package body Freeze is *** 2665,2671 **** if Is_Itype (Etype (Formal)) and then Ekind (F_Type) = E_Subprogram_Type then ! Freeze_And_Append (F_Type, Loc, Result); end if; end if; --- 2613,2619 ---- if Is_Itype (Etype (Formal)) and then Ekind (F_Type) = E_Subprogram_Type then ! Freeze_And_Append (F_Type, N, Result); end if; end if; *************** package body Freeze is *** 2679,2685 **** -- Freeze return type R_Type := Etype (E); ! Freeze_And_Append (R_Type, Loc, Result); -- Check suspicious return type for C function --- 2627,2633 ---- -- Freeze return type R_Type := Etype (E); ! Freeze_And_Append (R_Type, N, Result); -- Check suspicious return type for C function *************** package body Freeze is *** 2753,2759 **** end if; end if; ! -- Give warning for suspicous return of a result of an -- unconstrained array type in a foreign convention -- function. --- 2701,2707 ---- end if; end if; ! -- Give warning for suspicious return of a result of an -- unconstrained array type in a foreign convention -- function. *************** package body Freeze is *** 2792,2798 **** -- Must freeze its parent first if it is a derived subprogram if Present (Alias (E)) then ! Freeze_And_Append (Alias (E), Loc, Result); end if; -- We don't freeze internal subprograms, because we don't normally --- 2740,2746 ---- -- Must freeze its parent first if it is a derived subprogram if Present (Alias (E)) then ! Freeze_And_Append (Alias (E), N, Result); end if; -- We don't freeze internal subprograms, because we don't normally *************** package body Freeze is *** 2816,2822 **** if Present (Etype (E)) and then Ekind (E) /= E_Generic_Function then ! Freeze_And_Append (Etype (E), Loc, Result); end if; -- Special processing for objects created by object declaration --- 2764,2770 ---- if Present (Etype (E)) and then Ekind (E) /= E_Generic_Function then ! Freeze_And_Append (Etype (E), N, Result); end if; -- Special processing for objects created by object declaration *************** package body Freeze is *** 2840,2846 **** Object_Definition (Parent (E))); if Is_CPP_Class (Etype (E)) then ! Error_Msg_NE ("\} may need a cpp_constructor", Object_Definition (Parent (E)), Etype (E)); end if; end if; --- 2788,2795 ---- Object_Definition (Parent (E))); if Is_CPP_Class (Etype (E)) then ! Error_Msg_NE ! ("\} may need a cpp_constructor", Object_Definition (Parent (E)), Etype (E)); end if; end if; *************** package body Freeze is *** 3009,3015 **** else -- We used to check here that a full type must have preelaborable -- initialization if it completes a private type specified with ! -- pragma Preelaborable_Intialization, but that missed cases where -- the types occur within a generic package, since the freezing -- that occurs within a containing scope generally skips traversal -- of a generic unit's declarations (those will be frozen within --- 2958,2964 ---- else -- We used to check here that a full type must have preelaborable -- initialization if it completes a private type specified with ! -- pragma Preelaborable_Initialization, but that missed cases where -- the types occur within a generic package, since the freezing -- that occurs within a containing scope generally skips traversal -- of a generic unit's declarations (those will be frozen within *************** package body Freeze is *** 3120,3126 **** else Error_Msg_NE ("size given for& too small", SZ, E); ! Error_Msg_N ("\use explicit pragma Pack " & "or use pragma Implicit_Packing", SZ); end if; --- 3069,3075 ---- else Error_Msg_NE ("size given for& too small", SZ, E); ! Error_Msg_N -- CODEFIX ("\use explicit pragma Pack " & "or use pragma Implicit_Packing", SZ); end if; *************** package body Freeze is *** 3145,3169 **** end if; -- If ancestor subtype present, freeze that first. Note that this ! -- will also get the base type frozen. Atype := Ancestor_Subtype (E); if Present (Atype) then ! Freeze_And_Append (Atype, Loc, Result); ! -- Otherwise freeze the base type of the entity before freezing ! -- the entity itself (RM 13.14(15)). ! elsif E /= Base_Type (E) then ! Freeze_And_Append (Base_Type (E), Loc, Result); end if; -- For a derived type, freeze its parent type first (RM 13.14(15)) elsif Is_Derived_Type (E) then ! Freeze_And_Append (Etype (E), Loc, Result); ! Freeze_And_Append (First_Subtype (Etype (E)), Loc, Result); end if; -- For array type, freeze index types and component type first --- 3094,3131 ---- end if; -- If ancestor subtype present, freeze that first. Note that this ! -- will also get the base type frozen. Need RM reference ??? Atype := Ancestor_Subtype (E); if Present (Atype) then ! Freeze_And_Append (Atype, N, Result); ! -- No ancestor subtype present ! else ! -- See if we have a nearest ancestor that has a predicate. ! -- That catches the case of derived type with a predicate. ! -- Need RM reference here ??? ! ! Atype := Nearest_Ancestor (E); ! ! if Present (Atype) and then Has_Predicates (Atype) then ! Freeze_And_Append (Atype, N, Result); ! end if; ! ! -- Freeze base type before freezing the entity (RM 13.14(15)) ! ! if E /= Base_Type (E) then ! Freeze_And_Append (Base_Type (E), N, Result); ! end if; end if; -- For a derived type, freeze its parent type first (RM 13.14(15)) elsif Is_Derived_Type (E) then ! Freeze_And_Append (Etype (E), N, Result); ! Freeze_And_Append (First_Subtype (Etype (E)), N, Result); end if; -- For array type, freeze index types and component type first *************** package body Freeze is *** 3171,3188 **** if Is_Array_Type (E) then declare ! Ctyp : constant Entity_Id := Component_Type (E); Non_Standard_Enum : Boolean := False; -- Set true if any of the index types is an enumeration type -- with a non-standard representation. begin ! Freeze_And_Append (Ctyp, Loc, Result); Indx := First_Index (E); while Present (Indx) loop ! Freeze_And_Append (Etype (Indx), Loc, Result); if Is_Enumeration_Type (Etype (Indx)) and then Has_Non_Standard_Rep (Etype (Indx)) --- 3133,3152 ---- if Is_Array_Type (E) then declare ! FS : constant Entity_Id := First_Subtype (E); ! Ctyp : constant Entity_Id := Component_Type (E); ! Clause : Entity_Id; Non_Standard_Enum : Boolean := False; -- Set true if any of the index types is an enumeration type -- with a non-standard representation. begin ! Freeze_And_Append (Ctyp, N, Result); Indx := First_Index (E); while Present (Indx) loop ! Freeze_And_Append (Etype (Indx), N, Result); if Is_Enumeration_Type (Etype (Indx)) and then Has_Non_Standard_Rep (Etype (Indx)) *************** package body Freeze is *** 3224,3231 **** begin if (Is_Packed (E) or else Has_Pragma_Pack (E)) - and then not Has_Atomic_Components (E) and then Known_Static_RM_Size (Ctyp) then Csiz := UI_Max (RM_Size (Ctyp), 1); --- 3188,3195 ---- begin if (Is_Packed (E) or else Has_Pragma_Pack (E)) and then Known_Static_RM_Size (Ctyp) + and then not Has_Component_Size_Clause (E) then Csiz := UI_Max (RM_Size (Ctyp), 1); *************** package body Freeze is *** 3287,3292 **** --- 3251,3257 ---- if Present (Comp_Size_C) and then Has_Pragma_Pack (Ent) + and then Warn_On_Redundant_Constructs then Error_Msg_Sloc := Sloc (Comp_Size_C); Error_Msg_NE *************** package body Freeze is *** 3295,3300 **** --- 3260,3267 ---- Error_Msg_N ("\?explicit component size given#!", Pack_Pragma); + Set_Is_Packed (Base_Type (Ent), False); + Set_Is_Bit_Packed_Array (Base_Type (Ent), False); end if; -- Set component size if not already set by a *************** package body Freeze is *** 3351,3369 **** -- a representation characteristic, and this -- request may be ignored. ! Set_Is_Packed (Base_Type (E), False); ! -- In all other cases, packing is indeed needed else ! Set_Has_Non_Standard_Rep (Base_Type (E)); ! Set_Is_Bit_Packed_Array (Base_Type (E)); ! Set_Is_Packed (Base_Type (E)); end if; end; end if; end; -- Processing that is done only for subtypes else --- 3318,3446 ---- -- a representation characteristic, and this -- request may be ignored. ! Set_Is_Packed (Base_Type (E), False); ! Set_Is_Bit_Packed_Array (Base_Type (E), False); ! if Known_Static_Esize (Component_Type (E)) ! and then Esize (Component_Type (E)) = Csiz ! then ! Set_Has_Non_Standard_Rep ! (Base_Type (E), False); ! end if; ! ! -- In all other cases, packing is indeed needed else ! Set_Has_Non_Standard_Rep (Base_Type (E), True); ! Set_Is_Bit_Packed_Array (Base_Type (E), True); ! Set_Is_Packed (Base_Type (E), True); end if; end; end if; end; + -- Check for Atomic_Components or Aliased with unsuitable + -- packing or explicit component size clause given. + + if (Has_Atomic_Components (E) + or else Has_Aliased_Components (E)) + and then (Has_Component_Size_Clause (E) + or else Is_Packed (E)) + then + Alias_Atomic_Check : declare + + procedure Complain_CS (T : String); + -- Outputs error messages for incorrect CS clause or + -- pragma Pack for aliased or atomic components (T is + -- "aliased" or "atomic"); + + ----------------- + -- Complain_CS -- + ----------------- + + procedure Complain_CS (T : String) is + begin + if Has_Component_Size_Clause (E) then + Clause := + Get_Attribute_Definition_Clause + (FS, Attribute_Component_Size); + + if Known_Static_Esize (Ctyp) then + Error_Msg_N + ("incorrect component size for " + & T & " components", Clause); + Error_Msg_Uint_1 := Esize (Ctyp); + Error_Msg_N + ("\only allowed value is^", Clause); + + else + Error_Msg_N + ("component size cannot be given for " + & T & " components", Clause); + end if; + + else + Error_Msg_N + ("cannot pack " & T & " components", + Get_Rep_Pragma (FS, Name_Pack)); + end if; + + return; + end Complain_CS; + + -- Start of processing for Alias_Atomic_Check + + begin + -- Case where component size has no effect + + if Known_Static_Esize (Ctyp) + and then Known_Static_RM_Size (Ctyp) + and then Esize (Ctyp) = RM_Size (Ctyp) + and then Esize (Ctyp) mod 8 = 0 + then + null; + + elsif Has_Aliased_Components (E) + or else Is_Aliased (Ctyp) + then + Complain_CS ("aliased"); + + elsif Has_Atomic_Components (E) + or else Is_Atomic (Ctyp) + then + Complain_CS ("atomic"); + end if; + end Alias_Atomic_Check; + end if; + + -- Warn for case of atomic type + + Clause := Get_Rep_Pragma (FS, Name_Atomic); + + if Present (Clause) + and then not Addressable (Component_Size (FS)) + then + Error_Msg_NE + ("non-atomic components of type& may not be " + & "accessible by separate tasks?", Clause, E); + + if Has_Component_Size_Clause (E) then + Error_Msg_Sloc := + Sloc + (Get_Attribute_Definition_Clause + (FS, Attribute_Component_Size)); + Error_Msg_N + ("\because of component size clause#?", + Clause); + + elsif Has_Pragma_Pack (E) then + Error_Msg_Sloc := + Sloc (Get_Rep_Pragma (FS, Name_Pack)); + Error_Msg_N + ("\because of pragma Pack#?", Clause); + end if; + end if; + -- Processing that is done only for subtypes else *************** package body Freeze is *** 3398,3406 **** end; end if; ! -- If any of the index types was an enumeration type with ! -- a non-standard rep clause, then we indicate that the ! -- array type is always packed (even if it is not bit packed). if Non_Standard_Enum then Set_Has_Non_Standard_Rep (Base_Type (E)); --- 3475,3483 ---- end; end if; ! -- If any of the index types was an enumeration type with a ! -- non-standard rep clause, then we indicate that the array ! -- type is always packed (even if it is not bit packed). if Non_Standard_Enum then Set_Has_Non_Standard_Rep (Base_Type (E)); *************** package body Freeze is *** 3418,3424 **** and then Ekind (E) /= E_String_Literal_Subtype then Create_Packed_Array_Type (E); ! Freeze_And_Append (Packed_Array_Type (E), Loc, Result); -- Size information of packed array type is copied to the -- array type, since this is really the representation. But --- 3495,3501 ---- and then Ekind (E) /= E_String_Literal_Subtype then Create_Packed_Array_Type (E); ! Freeze_And_Append (Packed_Array_Type (E), N, Result); -- Size information of packed array type is copied to the -- array type, since this is really the representation. But *************** package body Freeze is *** 3461,3467 **** -- frozen as well (RM 13.14(15)) elsif Is_Class_Wide_Type (E) then ! Freeze_And_Append (Root_Type (E), Loc, Result); -- If the base type of the class-wide type is still incomplete, -- the class-wide remains unfrozen as well. This is legal when --- 3538,3544 ---- -- frozen as well (RM 13.14(15)) elsif Is_Class_Wide_Type (E) then ! Freeze_And_Append (Root_Type (E), N, Result); -- If the base type of the class-wide type is still incomplete, -- the class-wide remains unfrozen as well. This is legal when *************** package body Freeze is *** 3501,3507 **** if Ekind (E) = E_Class_Wide_Subtype and then Present (Equivalent_Type (E)) then ! Freeze_And_Append (Equivalent_Type (E), Loc, Result); end if; -- For a record (sub)type, freeze all the component types (RM --- 3578,3584 ---- if Ekind (E) = E_Class_Wide_Subtype and then Present (Equivalent_Type (E)) then ! Freeze_And_Append (Equivalent_Type (E), N, Result); end if; -- For a record (sub)type, freeze all the component types (RM *************** package body Freeze is *** 3525,3537 **** elsif Is_Concurrent_Type (E) then if Present (Corresponding_Record_Type (E)) then Freeze_And_Append ! (Corresponding_Record_Type (E), Loc, Result); end if; Comp := First_Entity (E); while Present (Comp) loop if Is_Type (Comp) then ! Freeze_And_Append (Comp, Loc, Result); elsif (Ekind (Comp)) /= E_Function then if Is_Itype (Etype (Comp)) --- 3602,3614 ---- elsif Is_Concurrent_Type (E) then if Present (Corresponding_Record_Type (E)) then Freeze_And_Append ! (Corresponding_Record_Type (E), N, Result); end if; Comp := First_Entity (E); while Present (Comp) loop if Is_Type (Comp) then ! Freeze_And_Append (Comp, N, Result); elsif (Ekind (Comp)) /= E_Function then if Is_Itype (Etype (Comp)) *************** package body Freeze is *** 3540,3546 **** Undelay_Type (Etype (Comp)); end if; ! Freeze_And_Append (Etype (Comp), Loc, Result); end if; Next_Entity (Comp); --- 3617,3623 ---- Undelay_Type (Etype (Comp)); end if; ! Freeze_And_Append (Etype (Comp), N, Result); end if; Next_Entity (Comp); *************** package body Freeze is *** 3598,3604 **** -- processing is required if Is_Frozen (Full_View (E)) then - Set_Has_Delayed_Freeze (E, False); Set_Freeze_Node (E, Empty); Check_Debug_Info_Needed (E); --- 3675,3680 ---- *************** package body Freeze is *** 3615,3624 **** and then Present (Underlying_Full_View (Full)) then Freeze_And_Append ! (Underlying_Full_View (Full), Loc, Result); end if; ! Freeze_And_Append (Full, Loc, Result); if Has_Delayed_Freeze (E) then F_Node := Freeze_Node (Full); --- 3691,3700 ---- and then Present (Underlying_Full_View (Full)) then Freeze_And_Append ! (Underlying_Full_View (Full), N, Result); end if; ! Freeze_And_Append (Full, N, Result); if Has_Delayed_Freeze (E) then F_Node := Freeze_Node (Full); *************** package body Freeze is *** 3689,3695 **** elsif Ekind (E) = E_Subprogram_Type then Formal := First_Formal (E); - while Present (Formal) loop if Ekind (Etype (Formal)) = E_Incomplete_Type and then No (Full_View (Etype (Formal))) --- 3765,3770 ---- *************** package body Freeze is *** 3697,3709 **** then if Is_Tagged_Type (Etype (Formal)) then null; ! else Error_Msg_NE ("invalid use of incomplete type&", E, Etype (Formal)); end if; end if; ! Freeze_And_Append (Etype (Formal), Loc, Result); Next_Formal (Formal); end loop; --- 3772,3788 ---- then if Is_Tagged_Type (Etype (Formal)) then null; ! ! -- AI05-151: Incomplete types are allowed in access to ! -- subprogram specifications. ! ! elsif Ada_Version < Ada_2012 then Error_Msg_NE ("invalid use of incomplete type&", E, Etype (Formal)); end if; end if; ! Freeze_And_Append (Etype (Formal), N, Result); Next_Formal (Formal); end loop; *************** package body Freeze is *** 3715,3721 **** elsif Is_Access_Protected_Subprogram_Type (E) then if Present (Equivalent_Type (E)) then ! Freeze_And_Append (Equivalent_Type (E), Loc, Result); end if; end if; --- 3794,3800 ---- elsif Is_Access_Protected_Subprogram_Type (E) then if Present (Equivalent_Type (E)) then ! Freeze_And_Append (Equivalent_Type (E), N, Result); end if; end if; *************** package body Freeze is *** 3737,3745 **** -- these till the freeze-point since we need the small and range -- values. We only do these checks for base types ! if Is_Ordinary_Fixed_Point_Type (E) ! and then E = Base_Type (E) ! then if Small_Value (E) < Ureal_2_M_80 then Error_Msg_Name_1 := Name_Small; Error_Msg_N --- 3816,3822 ---- -- these till the freeze-point since we need the small and range -- values. We only do these checks for base types ! if Is_Ordinary_Fixed_Point_Type (E) and then Is_Base_Type (E) then if Small_Value (E) < Ureal_2_M_80 then Error_Msg_Name_1 := Name_Small; Error_Msg_N *************** package body Freeze is *** 3778,3783 **** --- 3855,3882 ---- elsif Is_Access_Type (E) then + -- If a pragma Default_Storage_Pool applies, and this type has no + -- Storage_Pool or Storage_Size clause (which must have occurred + -- before the freezing point), then use the default. This applies + -- only to base types. + + if Present (Default_Pool) + and then Is_Base_Type (E) + and then not Has_Storage_Size_Clause (E) + and then No (Associated_Storage_Pool (E)) + then + -- Case of pragma Default_Storage_Pool (null) + + if Nkind (Default_Pool) = N_Null then + Set_No_Pool_Assigned (E); + + -- Case of pragma Default_Storage_Pool (storage_pool_NAME) + + else + Set_Associated_Storage_Pool (E, Entity (Default_Pool)); + end if; + end if; + -- Check restriction for standard storage pool if No (Associated_Storage_Pool (E)) then *************** package body Freeze is *** 3788,3799 **** -- error in Ada 2005 if there is no pool (see AI-366). if Is_Pure_Unit_Access_Type (E) ! and then (Ada_Version < Ada_05 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); --- 3887,3898 ---- -- error in Ada 2005 if there is no pool (see AI-366). if Is_Pure_Unit_Access_Type (E) ! and then (Ada_Version < Ada_2005 or else not No_Pool_Assigned (E)) then Error_Msg_N ("named access type not allowed in pure unit", E); ! if Ada_Version >= Ada_2005 then Error_Msg_N ("\would be legal if Storage_Size of 0 given?", E); *************** package body Freeze is *** 3832,3837 **** --- 3931,3937 ---- declare Prim_List : constant Elist_Id := Primitive_Operations (E); Prim : Elmt_Id; + begin Prim := First_Elmt (Prim_List); while Present (Prim) loop *************** package body Freeze is *** 3939,3945 **** begin Comp := First_Component (E); - while Present (Comp) loop Typ := Etype (Comp); --- 4039,4044 ---- *************** package body Freeze is *** 3965,3971 **** -- since obviously the first subtype depends on its own base type. if Is_Type (E) then ! Freeze_And_Append (First_Subtype (E), Loc, Result); -- If we just froze a tagged non-class wide record, then freeze the -- corresponding class-wide type. This must be done after the tagged --- 4064,4070 ---- -- since obviously the first subtype depends on its own base type. if Is_Type (E) then ! Freeze_And_Append (First_Subtype (E), N, Result); -- If we just froze a tagged non-class wide record, then freeze the -- corresponding class-wide type. This must be done after the tagged *************** package body Freeze is *** 3976,3982 **** and then not Is_Class_Wide_Type (E) and then Present (Class_Wide_Type (E)) then ! Freeze_And_Append (Class_Wide_Type (E), Loc, Result); end if; end if; --- 4075,4081 ---- and then not Is_Class_Wide_Type (E) and then Present (Class_Wide_Type (E)) then ! Freeze_And_Append (Class_Wide_Type (E), N, Result); end if; end if; *************** package body Freeze is *** 4244,4251 **** -- exiting from the loop when it is appropriate to insert the freeze -- node before the current node P. ! -- Also checks som special exceptions to the freezing rules. These cases ! -- result in a direct return, bypassing the freeze action. P := N; loop --- 4343,4350 ---- -- exiting from the loop when it is appropriate to insert the freeze -- node before the current node P. ! -- Also checks some special exceptions to the freezing rules. These ! -- cases result in a direct return, bypassing the freeze action. P := N; loop *************** package body Freeze is *** 4422,4427 **** --- 4521,4528 ---- N_Entry_Call_Alternative | N_Triggering_Alternative | N_Abortable_Part | + N_And_Then | + N_Or_Else | N_Freeze_Entity => exit when Is_List_Member (P); *************** package body Freeze is *** 4480,4517 **** or else Ekind (Current_Scope) = E_Void then declare ! Loc : constant Source_Ptr := Sloc (Current_Scope); ! Freeze_Nodes : List_Id := No_List; ! Pos : Int := Scope_Stack.Last; begin if Present (Desig_Typ) then ! Freeze_And_Append (Desig_Typ, Loc, Freeze_Nodes); end if; if Present (Typ) then ! Freeze_And_Append (Typ, Loc, Freeze_Nodes); end if; if Present (Nam) then ! Freeze_And_Append (Nam, Loc, Freeze_Nodes); end if; -- The current scope may be that of a constrained component of -- an enclosing record declaration, which is above the current -- scope in the scope stack. ! if Is_Record_Type (Scope (Current_Scope)) then Pos := Pos - 1; end if; if Is_Non_Empty_List (Freeze_Nodes) then if No (Scope_Stack.Table (Pos).Pending_Freeze_Actions) then Scope_Stack.Table (Pos).Pending_Freeze_Actions := ! Freeze_Nodes; else ! Append_List (Freeze_Nodes, Scope_Stack.Table ! (Pos).Pending_Freeze_Actions); end if; end if; end; --- 4581,4622 ---- or else Ekind (Current_Scope) = E_Void then declare ! N : constant Node_Id := Current_Scope; ! Freeze_Nodes : List_Id := No_List; ! Pos : Int := Scope_Stack.Last; begin if Present (Desig_Typ) then ! Freeze_And_Append (Desig_Typ, N, Freeze_Nodes); end if; if Present (Typ) then ! Freeze_And_Append (Typ, N, Freeze_Nodes); end if; if Present (Nam) then ! Freeze_And_Append (Nam, N, Freeze_Nodes); end if; -- The current scope may be that of a constrained component of -- an enclosing record declaration, which is above the current -- scope in the scope stack. + -- If the expression is within a top-level pragma, as for a pre- + -- condition on a library-level subprogram, nothing to do. ! if not Is_Compilation_Unit (Current_Scope) ! and then Is_Record_Type (Scope (Current_Scope)) ! then Pos := Pos - 1; end if; if Is_Non_Empty_List (Freeze_Nodes) then if No (Scope_Stack.Table (Pos).Pending_Freeze_Actions) then Scope_Stack.Table (Pos).Pending_Freeze_Actions := ! Freeze_Nodes; else ! Append_List (Freeze_Nodes, ! Scope_Stack.Table (Pos).Pending_Freeze_Actions); end if; end if; end; *************** package body Freeze is *** 4821,4831 **** -- natural boundary of size. elsif Size_Incl_EP /= Size_Excl_EP ! and then ! (Size_Excl_EP = 8 or else ! Size_Excl_EP = 16 or else ! Size_Excl_EP = 32 or else ! Size_Excl_EP = 64) then Actual_Size := Size_Excl_EP; Actual_Lo := Loval_Excl_EP; --- 4926,4932 ---- -- natural boundary of size. elsif Size_Incl_EP /= Size_Excl_EP ! and then Addressable (Size_Excl_EP) then Actual_Size := Size_Excl_EP; Actual_Lo := Loval_Excl_EP; *************** package body Freeze is *** 5015,5021 **** begin Set_Has_Delayed_Freeze (T); ! L := Freeze_Entity (T, Sloc (N)); if Is_Non_Empty_List (L) then Insert_Actions (N, L); --- 5116,5122 ---- begin Set_Has_Delayed_Freeze (T); ! L := Freeze_Entity (T, N); if Is_Non_Empty_List (L) then Insert_Actions (N, L); *************** package body Freeze is *** 5124,5130 **** end if; F := First_Formal (Designated_Type (Typ)); - while Present (F) loop Ensure_Type_Is_SA (Etype (F)); Next_Formal (F); --- 5225,5230 ---- *************** package body Freeze is *** 5176,5185 **** -- issue an error message saying that this object cannot be imported -- or exported. If it has an address clause it is an overlay in the -- current partition and the static requirement is not relevant. ! if Is_Imported (E) and then No (Address_Clause (E)) then ! Error_Msg_N ! ("& cannot be imported (local type is not constant)", E); -- Otherwise must be exported, something is wrong if compiler -- is marking something as statically allocated which cannot be). --- 5276,5291 ---- -- issue an error message saying that this object cannot be imported -- or exported. If it has an address clause it is an overlay in the -- current partition and the static requirement is not relevant. + -- Do not issue any error message when ignoring rep clauses. ! if Ignore_Rep_Clauses then ! null; ! ! elsif Is_Imported (E) then ! if No (Address_Clause (E)) then ! Error_Msg_N ! ("& cannot be imported (local type is not constant)", E); ! end if; -- Otherwise must be exported, something is wrong if compiler -- is marking something as statically allocated which cannot be). *************** package body Freeze is *** 5402,5408 **** begin Comp := First_Component (T); - while Present (Comp) loop if not Is_Fully_Defined (Etype (Comp)) then return False; --- 5508,5513 ---- *************** package body Freeze is *** 5413,5418 **** --- 5518,5543 ---- return True; end; + -- For the designated type of an access to subprogram, all types in + -- the profile must be fully defined. + + elsif Ekind (T) = E_Subprogram_Type then + declare + F : Entity_Id; + + begin + F := First_Formal (T); + while Present (F) loop + if not Is_Fully_Defined (Etype (F)) then + return False; + end if; + + Next_Formal (F); + end loop; + + return Is_Fully_Defined (Etype (T)); + end; + else return not Is_Private_Type (T) or else Present (Full_View (Base_Type (T))); *************** package body Freeze is *** 5523,5530 **** -- involve secondary stack expansion. else ! Dnam := ! Make_Defining_Identifier (Loc, New_Internal_Name ('D')); Dbody := Make_Subprogram_Body (Loc, --- 5648,5654 ---- -- involve secondary stack expansion. else ! Dnam := Make_Temporary (Loc, 'D'); Dbody := Make_Subprogram_Body (Loc, *************** package body Freeze is *** 5659,5674 **** -- We only give the warning for non-imported entities of a type for -- which a non-null base init proc is defined, or for objects of access ! -- types with implicit null initialization, or when Initialize_Scalars -- applies and the type is scalar or a string type (the latter being -- tested for because predefined String types are initialized by inline ! -- code rather than by an init_proc). if Present (Expr) and then not Is_Imported (Ent) and then (Has_Non_Null_Base_Init_Proc (Typ) or else Is_Access_Type (Typ) ! or else (Init_Or_Norm_Scalars and then (Is_Scalar_Type (Typ) or else Is_String_Type (Typ)))) then --- 5783,5800 ---- -- We only give the warning for non-imported entities of a type for -- which a non-null base init proc is defined, or for objects of access ! -- types with implicit null initialization, or when Normalize_Scalars -- applies and the type is scalar or a string type (the latter being -- tested for because predefined String types are initialized by inline ! -- code rather than by an init_proc). Note that we do not give the ! -- warning for Initialize_Scalars, since we suppressed initialization ! -- in this case. if Present (Expr) and then not Is_Imported (Ent) and then (Has_Non_Null_Base_Init_Proc (Typ) or else Is_Access_Type (Typ) ! or else (Normalize_Scalars and then (Is_Scalar_Type (Typ) or else Is_String_Type (Typ)))) then *************** package body Freeze is *** 5733,5739 **** begin Comp := First_Component (Typ); - while Present (Comp) loop if Nkind (Parent (Comp)) = N_Component_Declaration and then Present (Expression (Parent (Comp))) --- 5859,5864 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/freeze.ads gcc-4.6.0/gcc/ada/freeze.ads *** gcc-4.5.2/gcc/ada/freeze.ads Mon Jul 13 08:12:11 2009 --- gcc-4.6.0/gcc/ada/freeze.ads Mon Oct 11 10:43:04 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Freeze is *** 175,199 **** -- do not allow a size clause if the size would not otherwise be known at -- compile time in any case. ! function Is_Atomic_Aggregate (E : Entity_Id; Typ : Entity_Id) return Boolean; ! -- If an atomic object is initialized with an aggregate or is assigned ! -- an aggregate, we have to prevent a piecemeal access or assignment ! -- to the object, even if the aggregate is to be expanded. We create ! -- a temporary for the aggregate, and assign the temporary instead, ! -- so that the back end can generate an atomic move for it. This is ! -- only done in the context of an object declaration or an assignment. ! -- Function is a noop and returns false in other contexts. ! function Freeze_Entity (E : Entity_Id; Loc : Source_Ptr) return List_Id; ! -- Freeze an entity, and return Freeze nodes, to be inserted at the ! -- point of call. Loc is a source location which corresponds to the ! -- freeze point. This is used in placing warning messages in the ! -- situation where it appears that a type has been frozen too early, ! -- e.g. when a primitive operation is declared after the freezing ! -- point of its tagged type. Returns No_List if no freeze nodes needed. procedure Freeze_All (From : Entity_Id; After : in out Node_Id); -- Before a non-instance body, or at the end of a declarative part --- 175,199 ---- -- do not allow a size clause if the size would not otherwise be known at -- compile time in any case. ! function Is_Atomic_Aggregate (E : Entity_Id; Typ : Entity_Id) return Boolean; ! -- If an atomic object is initialized with an aggregate or is assigned an ! -- aggregate, we have to prevent a piecemeal access or assignment to the ! -- object, even if the aggregate is to be expanded. We create a temporary ! -- for the aggregate, and assign the temporary instead, so that the back ! -- end can generate an atomic move for it. This is only done in the context ! -- of an object declaration or an assignment. Function is a noop and ! -- returns false in other contexts. ! function Freeze_Entity (E : Entity_Id; N : Node_Id) return List_Id; ! -- Freeze an entity, and return Freeze nodes, to be inserted at the point ! -- of call. N is a node whose source location corresponds to the freeze ! -- point. This is used in placing warning messages in the situation where ! -- it appears that a type has been frozen too early, e.g. when a primitive ! -- operation is declared after the freezing point of its tagged type. ! -- Returns No_List if no freeze nodes needed. procedure Freeze_All (From : Entity_Id; After : in out Node_Id); -- Before a non-instance body, or at the end of a declarative part diff -Nrcpad gcc-4.5.2/gcc/ada/frontend.adb gcc-4.6.0/gcc/ada/frontend.adb *** gcc-4.5.2/gcc/ada/frontend.adb Mon Nov 30 12:02:49 2009 --- gcc-4.6.0/gcc/ada/frontend.adb Mon Oct 4 13:27:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Warn; use Sem_Warn; *** 60,65 **** --- 60,66 ---- with Sinfo; use Sinfo; with Sinput; use Sinput; with Sinput.L; use Sinput.L; + with SCIL_LL; use SCIL_LL; with Targparm; use Targparm; with Tbuild; use Tbuild; with Types; use Types; *************** begin *** 89,94 **** --- 90,99 ---- Sem_Warn.Initialize; Prep.Initialize; + if Generate_SCIL then + SCIL_LL.Initialize; + end if; + -- Create package Standard CStand.Create_Standard; *************** begin *** 111,122 **** Prepcomp.Check_Symbols; end if; -- Now that the preprocessing situation is established, we are able to -- load the main source (this is no longer done by Lib.Load.Initialize). Lib.Load.Load_Main_Source; ! -- Return immediately if the main source could not be parsed if Sinput.Main_Source_File = No_Source_File then return; --- 116,132 ---- Prepcomp.Check_Symbols; end if; + -- We set Parsing_Main_Extended_Source true here to cover processing of all + -- the configuration pragma files, as well as the main source unit itself. + + Parsing_Main_Extended_Source := True; + -- Now that the preprocessing situation is established, we are able to -- load the main source (this is no longer done by Lib.Load.Initialize). Lib.Load.Load_Main_Source; ! -- Return immediately if the main source could not be found if Sinput.Main_Source_File = No_Source_File then return; *************** begin *** 156,162 **** if Source_gnat_adc /= No_Source_File then Initialize_Scanner (No_Unit, Source_gnat_adc); Config_Pragmas := Par (Configuration_Pragmas => True); - else Config_Pragmas := Empty_List; end if; --- 166,171 ---- *************** begin *** 225,233 **** Optimize_Alignment := 'T'; end if; ! -- We have now processed the command line switches, and the gnat.adc ! -- file, so this is the point at which we want to capture the values ! -- of the configuration switches (see Opt for further details). Opt.Register_Opt_Config_Switches; --- 234,242 ---- Optimize_Alignment := 'T'; end if; ! -- We have now processed the command line switches, and the configuration ! -- pragma files, so this is the point at which we want to capture the ! -- values of the configuration switches (see Opt for further details). Opt.Register_Opt_Config_Switches; *************** begin *** 248,253 **** --- 257,263 ---- -- semantics in any case). Discard_List (Par (Configuration_Pragmas => False)); + Parsing_Main_Extended_Source := False; -- The main unit is now loaded, and subunits of it can be loaded, -- without reporting spurious loading circularities. *************** begin *** 285,291 **** -- explicit switch turning off Warn_On_Non_Local_Exception, then turn on -- this warning by default if we have encountered an exception handler. ! if Restriction_Active (No_Exception_Propagation) and then not No_Warn_On_Non_Local_Exception and then Exception_Handler_Encountered then --- 295,301 ---- -- explicit switch turning off Warn_On_Non_Local_Exception, then turn on -- this warning by default if we have encountered an exception handler. ! if Restriction_Check_Required (No_Exception_Propagation) and then not No_Warn_On_Non_Local_Exception and then Exception_Handler_Encountered then diff -Nrcpad gcc-4.5.2/gcc/ada/g-altive.ads gcc-4.6.0/gcc/ada/g-altive.ads *** gcc-4.5.2/gcc/ada/g-altive.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/g-altive.ads Mon Dec 20 07:26:57 2010 *************** *** 143,149 **** -- additional facilities. -- The identification of the low level interface is directly inspired by the ! -- the base API organization, basically consisting of a rich set of functions -- around a core of low level primitives mapping to AltiVec instructions. -- See for instance "vec_add" in [PIM-4.4 Generic and Specific AltiVec --- 143,149 ---- -- additional facilities. -- The identification of the low level interface is directly inspired by the ! -- base API organization, basically consisting of a rich set of functions -- around a core of low level primitives mapping to AltiVec instructions. -- See for instance "vec_add" in [PIM-4.4 Generic and Specific AltiVec diff -Nrcpad gcc-4.5.2/gcc/ada/g-calend.ads gcc-4.6.0/gcc/ada/g-calend.ads *** gcc-4.5.2/gcc/ada/g-calend.ads Thu Apr 16 10:44:27 2009 --- gcc-4.6.0/gcc/ada/g-calend.ads Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1999-2010, 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,43 **** -- Second_Duration and Day_Of_Week and Day_In_Year from Calendar.Time. -- Second_Duration precision depends on the target clock precision. -- ! -- GNAT.Calendar provides the same kind of abstraction found in ! -- Ada.Calendar. It provides Split and Time_Of to build and split a Time ! -- data. And it provides accessor functions to get only one of Hour, Minute, ! -- Second, Second_Duration. Other functions are to access more advanced ! -- values like Day_Of_Week, Day_In_Year and Week_In_Year. with Ada.Calendar; with Interfaces.C; --- 33,43 ---- -- Second_Duration and Day_Of_Week and Day_In_Year from Calendar.Time. -- Second_Duration precision depends on the target clock precision. -- ! -- GNAT.Calendar provides the same kind of abstraction found in Ada.Calendar. ! -- It provides Split and Time_Of to build and split a Time data. And it ! -- provides accessor functions to get only one of Hour, Minute, Second, ! -- Second_Duration. Other functions are to access more advanced values like ! -- Day_Of_Week, Day_In_Year and Week_In_Year. with Ada.Calendar; with Interfaces.C; *************** package GNAT.Calendar is *** 46,51 **** --- 46,52 ---- type Day_Name is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); + pragma Ordered (Day_Name); subtype Hour_Number is Natural range 0 .. 23; subtype Minute_Number is Natural range 0 .. 59; diff -Nrcpad gcc-4.5.2/gcc/ada/g-comlin.adb gcc-4.6.0/gcc/ada/g-comlin.adb *** gcc-4.5.2/gcc/ada/g-comlin.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/g-comlin.adb Thu Oct 21 10:19:58 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2010, 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,38 **** -- -- ------------------------------------------------------------------------------ ! with Ada.Unchecked_Deallocation; with Ada.Strings.Unbounded; ! with GNAT.OS_Lib; use GNAT.OS_Lib; package body GNAT.Command_Line is --- 29,41 ---- -- -- ------------------------------------------------------------------------------ ! with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Strings.Unbounded; + with Ada.Text_IO; use Ada.Text_IO; + with Ada.Unchecked_Deallocation; ! with GNAT.Directory_Operations; use GNAT.Directory_Operations; ! with GNAT.OS_Lib; use GNAT.OS_Lib; package body GNAT.Command_Line is *************** package body GNAT.Command_Line is *** 112,117 **** --- 115,145 ---- -- Add a new element to Line. If Before is True, the item is inserted at -- the beginning, else it is appended. + procedure Add + (Config : in out Command_Line_Configuration; + Switch : Switch_Definition); + procedure Add + (Def : in out Alias_Definitions_List; + Alias : Alias_Definition); + -- Add a new element to Def. + + procedure Initialize_Switch_Def + (Def : out Switch_Definition; + Switch : String := ""; + Long_Switch : String := ""; + Help : String := ""; + Section : String := ""); + -- Initialize [Def] with the contents of the other parameters. + -- This also checks consistency of the switch parameters, and will raise + -- Invalid_Switch if they do not match. + + procedure Decompose_Switch + (Switch : String; + Parameter_Type : out Switch_Parameter_Type; + Switch_Last : out Integer); + -- Given a switch definition ("name:" for instance), extracts the type of + -- parameter that is expected, and the name of the switch + function Can_Have_Parameter (S : String) return Boolean; -- True if S can have a parameter *************** package body GNAT.Command_Line is *** 122,130 **** -- Remove any possible trailing '!', ':', '?' and '=' generic ! with procedure Callback (Simple_Switch : String; Parameter : String); procedure For_Each_Simple_Switch ! (Cmd : Command_Line; Switch : String; Parameter : String := ""; Unalias : Boolean := True); --- 150,163 ---- -- Remove any possible trailing '!', ':', '?' and '=' generic ! with procedure Callback ! (Simple_Switch : String; ! Separator : String; ! Parameter : String; ! Index : Integer); -- Index in Config.Switches, or -1 procedure For_Each_Simple_Switch ! (Config : Command_Line_Configuration; ! Section : String; Switch : String; Parameter : String := ""; Unalias : Boolean := True); *************** package body GNAT.Command_Line is *** 161,166 **** --- 194,207 ---- -- Return True if the characters starting at Index in Type_Str are -- equivalent to Substring. + generic + with function Callback (S : String; Index : Integer) return Boolean; + procedure Foreach_Switch + (Config : Command_Line_Configuration; + Section : String); + -- Iterate over all switches defined in Config, for a specific section. + -- Index is set to the index in Config.Switches + -------------- -- Argument -- -------------- *************** package body GNAT.Command_Line is *** 197,203 **** --------------- function Expansion (Iterator : Expansion_Iterator) return String is - use GNAT.Directory_Operations; type Pointer is access all Expansion_Iterator; It : constant Pointer := Iterator'Unrestricted_Access; --- 238,243 ---- *************** package body GNAT.Command_Line is *** 224,232 **** if Current = 1 then return String'(1 .. 0 => ' '); - else - -- Otherwise continue with the directory at the previous level Current := Current - 1; It.Current_Depth := Current; end if; --- 264,273 ---- if Current = 1 then return String'(1 .. 0 => ' '); + -- Otherwise continue with the directory at the previous level + + else Current := Current - 1; It.Current_Depth := Current; end if; *************** package body GNAT.Command_Line is *** 236,243 **** elsif Is_Directory (It.Dir_Name (1 .. It.Levels (Current).Name_Last) & S (1 .. Last)) ! and then S (1 .. Last) /= "." ! and then S (1 .. Last) /= ".." then -- We can go to the next level only if we have not reached the -- maximum depth, --- 277,284 ---- elsif Is_Directory (It.Dir_Name (1 .. It.Levels (Current).Name_Last) & S (1 .. Last)) ! and then S (1 .. Last) /= "." ! and then S (1 .. Last) /= ".." then -- We can go to the next level only if we have not reached the -- maximum depth, *************** package body GNAT.Command_Line is *** 286,291 **** --- 327,355 ---- end loop; end Expansion; + --------------------- + -- Current_Section -- + --------------------- + + function Current_Section + (Parser : Opt_Parser := Command_Line_Parser) return String + is + begin + if Parser.Current_Section = 1 then + return ""; + end if; + + for Index in reverse 1 .. Integer'Min (Parser.Current_Argument - 1, + Parser.Section'Last) + loop + if Parser.Section (Index) = 0 then + return Argument (Parser, Index); + end if; + end loop; + + return ""; + end Current_Section; + ----------------- -- Full_Switch -- ----------------- *************** package body GNAT.Command_Line is *** 333,339 **** Parser.Current_Argument := 1; while Parser.Current_Argument <= Parser.Arg_Count and then Parser.Section (Parser.Current_Argument) /= ! Parser.Current_Section loop Parser.Current_Argument := Parser.Current_Argument + 1; end loop; --- 397,403 ---- Parser.Current_Argument := 1; while Parser.Current_Argument <= Parser.Arg_Count and then Parser.Section (Parser.Current_Argument) /= ! Parser.Current_Section loop Parser.Current_Argument := Parser.Current_Argument + 1; end loop; *************** package body GNAT.Command_Line is *** 344,350 **** elsif Parser.Section (Parser.Current_Argument) = 0 then while Parser.Current_Argument <= Parser.Arg_Count and then Parser.Section (Parser.Current_Argument) /= ! Parser.Current_Section loop Parser.Current_Argument := Parser.Current_Argument + 1; end loop; --- 408,414 ---- elsif Parser.Section (Parser.Current_Argument) = 0 then while Parser.Current_Argument <= Parser.Arg_Count and then Parser.Section (Parser.Current_Argument) /= ! Parser.Current_Section loop Parser.Current_Argument := Parser.Current_Argument + 1; end loop; *************** package body GNAT.Command_Line is *** 394,399 **** --- 458,498 ---- return Argument (Parser, Parser.Current_Argument - 1); end Get_Argument; + ---------------------- + -- Decompose_Switch -- + ---------------------- + + procedure Decompose_Switch + (Switch : String; + Parameter_Type : out Switch_Parameter_Type; + Switch_Last : out Integer) + is + begin + if Switch = "" then + Parameter_Type := Parameter_None; + Switch_Last := Switch'Last; + return; + end if; + + case Switch (Switch'Last) is + when ':' => + Parameter_Type := Parameter_With_Optional_Space; + Switch_Last := Switch'Last - 1; + when '=' => + Parameter_Type := Parameter_With_Space_Or_Equal; + Switch_Last := Switch'Last - 1; + when '!' => + Parameter_Type := Parameter_No_Space; + Switch_Last := Switch'Last - 1; + when '?' => + Parameter_Type := Parameter_Optional; + Switch_Last := Switch'Last - 1; + when others => + Parameter_Type := Parameter_None; + Switch_Last := Switch'Last; + end case; + end Decompose_Switch; + ---------------------------------- -- Find_Longest_Matching_Switch -- ---------------------------------- *************** package body GNAT.Command_Line is *** 407,412 **** --- 506,512 ---- is Index : Natural; Length : Natural := 1; + Last : Natural; P : Switch_Parameter_Type; begin *************** package body GNAT.Command_Line is *** 432,468 **** Length := Length + 1; end loop; if Length = Index + 1 then P := Parameter_None; else ! case Switches (Length - 1) is ! when ':' => ! P := Parameter_With_Optional_Space; ! Length := Length - 1; ! when '=' => ! P := Parameter_With_Space_Or_Equal; ! Length := Length - 1; ! when '!' => ! P := Parameter_No_Space; ! Length := Length - 1; ! when '?' => ! P := Parameter_Optional; ! Length := Length - 1; ! when others => ! P := Parameter_None; ! end case; end if; -- If it is the one we searched, it may be a candidate ! if Arg'First + Length - 1 - Index <= Arg'Last ! and then Switches (Index .. Length - 1) = ! Arg (Arg'First .. Arg'First + Length - 1 - Index) ! and then Length - Index > Switch_Length then Param := P; Index_In_Switches := Index; ! Switch_Length := Length - Index; end if; -- Look for the next switch in Switches --- 532,557 ---- Length := Length + 1; end loop; + -- Length now marks the separator after the current switch + -- Last will mark the last character of the name of the switch + if Length = Index + 1 then P := Parameter_None; + Last := Index; else ! Decompose_Switch (Switches (Index .. Length - 1), P, Last); end if; -- If it is the one we searched, it may be a candidate ! if Arg'First + Last - Index <= Arg'Last ! and then Switches (Index .. Last) = ! Arg (Arg'First .. Arg'First + Last - Index) ! and then Last - Index + 1 > Switch_Length then Param := P; Index_In_Switches := Index; ! Switch_Length := Last - Index + 1; end if; -- Look for the next switch in Switches *************** package body GNAT.Command_Line is *** 601,606 **** --- 690,696 ---- First => Parser.Current_Index, Last => End_Index); Parser.Current_Index := End_Index + 1; + raise Invalid_Switch; end if; *************** package body GNAT.Command_Line is *** 644,650 **** -- If the switch is of the form =xxx if End_Index < Arg'Last then - if Arg (End_Index + 1) = '=' and then End_Index + 1 < Arg'Last then --- 734,739 ---- *************** package body GNAT.Command_Line is *** 681,687 **** end if; when Parameter_No_Space => - if End_Index < Arg'Last then Set_Parameter (Parser.The_Parameter, --- 770,775 ---- *************** package body GNAT.Command_Line is *** 696,702 **** end if; when Parameter_Optional => - if End_Index < Arg'Last then Set_Parameter (Parser.The_Parameter, --- 784,789 ---- *************** package body GNAT.Command_Line is *** 708,714 **** Dummy := Goto_Next_Argument_In_Section (Parser); when Parameter_None => - if Concatenate or else End_Index = Arg'Last then Parser.Current_Index := End_Index + 1; --- 795,800 ---- *************** package body GNAT.Command_Line is *** 1076,1090 **** procedure Define_Alias (Config : in out Command_Line_Configuration; Switch : String; ! Expanded : String) is begin if Config = null then Config := new Command_Line_Configuration_Record; end if; ! Add (Config.Aliases, new String'(Switch)); ! Add (Config.Expansions, new String'(Expanded)); end Define_Alias; ------------------- --- 1162,1180 ---- procedure Define_Alias (Config : in out Command_Line_Configuration; Switch : String; ! Expanded : String; ! Section : String := "") is + Def : Alias_Definition; begin if Config = null then Config := new Command_Line_Configuration_Record; end if; ! Def.Alias := new String'(Switch); ! Def.Expansion := new String'(Expanded); ! Def.Section := new String'(Section); ! Add (Config.Aliases, Def); end Define_Alias; ------------------- *************** package body GNAT.Command_Line is *** 1103,1122 **** Add (Config.Prefixes, new String'(Prefix)); end Define_Prefix; ------------------- -- Define_Switch -- ------------------- procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Switch : String) is begin ! if Config = null then ! Config := new Command_Line_Configuration_Record; end if; ! Add (Config.Switches, new String'(Switch)); end Define_Switch; -------------------- --- 1193,1382 ---- Add (Config.Prefixes, new String'(Prefix)); end Define_Prefix; + --------- + -- Add -- + --------- + + procedure Add (Config : in out Command_Line_Configuration; + Switch : Switch_Definition) + is + procedure Unchecked_Free is new Ada.Unchecked_Deallocation + (Switch_Definitions, Switch_Definitions_List); + Tmp : Switch_Definitions_List; + + begin + if Config = null then + Config := new Command_Line_Configuration_Record; + end if; + + Tmp := Config.Switches; + + if Tmp = null then + Config.Switches := new Switch_Definitions (1 .. 1); + else + Config.Switches := new Switch_Definitions (1 .. Tmp'Length + 1); + Config.Switches (1 .. Tmp'Length) := Tmp.all; + Unchecked_Free (Tmp); + end if; + + Config.Switches (Config.Switches'Last) := Switch; + end Add; + + --------- + -- Add -- + --------- + + procedure Add (Def : in out Alias_Definitions_List; + Alias : Alias_Definition) + is + procedure Unchecked_Free is new Ada.Unchecked_Deallocation + (Alias_Definitions, Alias_Definitions_List); + Tmp : Alias_Definitions_List := Def; + + begin + if Tmp = null then + Def := new Alias_Definitions (1 .. 1); + else + Def := new Alias_Definitions (1 .. Tmp'Length + 1); + Def (1 .. Tmp'Length) := Tmp.all; + Unchecked_Free (Tmp); + end if; + + Def (Def'Last) := Alias; + end Add; + + --------------------------- + -- Initialize_Switch_Def -- + --------------------------- + + procedure Initialize_Switch_Def + (Def : out Switch_Definition; + Switch : String := ""; + Long_Switch : String := ""; + Help : String := ""; + Section : String := "") + is + P1, P2 : Switch_Parameter_Type := Parameter_None; + Last1, Last2 : Integer; + + begin + if Switch /= "" then + Def.Switch := new String'(Switch); + Decompose_Switch (Switch, P1, Last1); + end if; + + if Long_Switch /= "" then + Def.Long_Switch := new String'(Long_Switch); + Decompose_Switch (Long_Switch, P2, Last2); + end if; + + if Switch /= "" and then Long_Switch /= "" then + if (P1 = Parameter_None and then P2 /= P1) + or else (P2 = Parameter_None and then P1 /= P2) + or else (P1 = Parameter_Optional and then P2 /= P1) + or else (P2 = Parameter_Optional and then P2 /= P1) + then + raise Invalid_Switch + with "Inconsistent parameter types for " + & Switch & " and " & Long_Switch; + end if; + end if; + + if Section /= "" then + Def.Section := new String'(Section); + end if; + + if Help /= "" then + Def.Help := new String'(Help); + end if; + end Initialize_Switch_Def; + ------------------- -- Define_Switch -- ------------------- procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := "") is + Def : Switch_Definition; begin ! if Switch /= "" or else Long_Switch /= "" then ! Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section); ! Add (Config, Def); end if; + end Define_Switch; ! ------------------- ! -- Define_Switch -- ! ------------------- ! ! procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Output : access Boolean; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := ""; ! Value : Boolean := True) ! is ! Def : Switch_Definition (Switch_Boolean); ! begin ! if Switch /= "" or else Long_Switch /= "" then ! Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section); ! Def.Boolean_Output := Output.all'Unchecked_Access; ! Def.Boolean_Value := Value; ! Add (Config, Def); ! end if; ! end Define_Switch; ! ! ------------------- ! -- Define_Switch -- ! ------------------- ! ! procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Output : access Integer; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := ""; ! Initial : Integer := 0; ! Default : Integer := 1) ! is ! Def : Switch_Definition (Switch_Integer); ! begin ! if Switch /= "" or else Long_Switch /= "" then ! Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section); ! Def.Integer_Output := Output.all'Unchecked_Access; ! Def.Integer_Default := Default; ! Def.Integer_Initial := Initial; ! Add (Config, Def); ! end if; ! end Define_Switch; ! ! ------------------- ! -- Define_Switch -- ! ------------------- ! ! procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Output : access GNAT.Strings.String_Access; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := "") ! is ! Def : Switch_Definition (Switch_String); ! begin ! if Switch /= "" or else Long_Switch /= "" then ! Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section); ! Def.String_Output := Output.all'Unchecked_Access; ! Add (Config, Def); ! end if; end Define_Switch; -------------------- *************** package body GNAT.Command_Line is *** 1135,1171 **** Add (Config.Sections, new String'(Section)); end Define_Section; ------------------ -- Get_Switches -- ------------------ function Get_Switches (Config : Command_Line_Configuration; ! Switch_Char : Character) ! return String is Ret : Ada.Strings.Unbounded.Unbounded_String; ! use type Ada.Strings.Unbounded.Unbounded_String; begin ! if Config = null or else Config.Switches = null then return ""; end if; ! for J in Config.Switches'Range loop ! if Config.Switches (J) (Config.Switches (J)'First) = Switch_Char then ! Ret := ! Ret & " " & ! Config.Switches (J) ! (Config.Switches (J)'First + 1 .. Config.Switches (J)'Last); ! else ! Ret := Ret & " " & Config.Switches (J).all; ! end if; ! end loop; ! return Ada.Strings.Unbounded.To_String (Ret); end Get_Switches; ----------------------- -- Set_Configuration -- ----------------------- --- 1395,1506 ---- Add (Config.Sections, new String'(Section)); end Define_Section; + -------------------- + -- Foreach_Switch -- + -------------------- + + procedure Foreach_Switch + (Config : Command_Line_Configuration; + Section : String) + is + begin + if Config /= null and then Config.Switches /= null then + for J in Config.Switches'Range loop + if (Section = "" and then Config.Switches (J).Section = null) + or else + (Config.Switches (J).Section /= null + and then Config.Switches (J).Section.all = Section) + then + exit when Config.Switches (J).Switch /= null + and then not Callback (Config.Switches (J).Switch.all, J); + + exit when Config.Switches (J).Long_Switch /= null + and then + not Callback (Config.Switches (J).Long_Switch.all, J); + end if; + end loop; + end if; + end Foreach_Switch; + ------------------ -- Get_Switches -- ------------------ function Get_Switches (Config : Command_Line_Configuration; ! Switch_Char : Character := '-'; ! Section : String := "") return String is Ret : Ada.Strings.Unbounded.Unbounded_String; ! use Ada.Strings.Unbounded; ! ! function Add_Switch (S : String; Index : Integer) return Boolean; ! -- Add a switch to Ret ! ! ---------------- ! -- Add_Switch -- ! ---------------- ! ! function Add_Switch (S : String; Index : Integer) return Boolean is ! pragma Unreferenced (Index); ! begin ! if S = "*" then ! Ret := "*" & Ret; -- Always first ! elsif S (S'First) = Switch_Char then ! Append (Ret, " " & S (S'First + 1 .. S'Last)); ! else ! Append (Ret, " " & S); ! end if; ! return True; ! end Add_Switch; ! ! Tmp : Boolean; ! pragma Unreferenced (Tmp); ! ! procedure Foreach is new Foreach_Switch (Add_Switch); ! ! -- Start of processing for Get_Switches begin ! if Config = null then return ""; end if; ! Foreach (Config, Section => Section); ! -- Adding relevant aliases ! ! if Config.Aliases /= null then ! for A in Config.Aliases'Range loop ! if Config.Aliases (A).Section.all = Section then ! Tmp := Add_Switch (Config.Aliases (A).Alias.all, -1); ! end if; ! end loop; ! end if; ! ! return To_String (Ret); end Get_Switches; + ------------------------ + -- Section_Delimiters -- + ------------------------ + + function Section_Delimiters + (Config : Command_Line_Configuration) return String + is + use Ada.Strings.Unbounded; + Result : Unbounded_String; + + begin + if Config /= null and then Config.Sections /= null then + for S in Config.Sections'Range loop + Append (Result, " " & Config.Sections (S).all); + end loop; + end if; + + return To_String (Result); + end Section_Delimiters; + ----------------------- -- Set_Configuration -- ----------------------- *************** package body GNAT.Command_Line is *** 1183,1189 **** ----------------------- function Get_Configuration ! (Cmd : Command_Line) return Command_Line_Configuration is begin return Cmd.Config; end Get_Configuration; --- 1518,1525 ---- ----------------------- function Get_Configuration ! (Cmd : Command_Line) return Command_Line_Configuration ! is begin return Cmd.Config; end Get_Configuration; *************** package body GNAT.Command_Line is *** 1264,1299 **** if not Is_Section then if Section = null then ! ! -- Work around some weird cases: some switches may ! -- expect parameters, but have the same value as ! -- longer switches: -gnaty3 (-gnaty, parameter=3) and ! -- -gnatya (-gnatya, no parameter). ! ! -- So we are calling add_switch here with parameter ! -- attached. This will be anyway correctly handled by ! -- Add_Switch if -gnaty3 is actually provided. ! ! if Separator (Parser) = ASCII.NUL then ! Add_Switch ! (Cmd, Sw & Parameter (Parser), "", ASCII.NUL); ! else ! Add_Switch ! (Cmd, Sw, Parameter (Parser), Separator (Parser)); ! end if; else ! if Separator (Parser) = ASCII.NUL then ! Add_Switch ! (Cmd, Sw & Parameter (Parser), "", ! Separator (Parser), ! Section.all); ! else ! Add_Switch ! (Cmd, Sw, ! Parameter (Parser), ! Separator (Parser), ! Section.all); ! end if; end if; end if; end; --- 1600,1610 ---- if not Is_Section then if Section = null then ! Add_Switch (Cmd, Sw, Parameter (Parser)); else ! Add_Switch ! (Cmd, Sw, Parameter (Parser), ! Section => Section.all); end if; end if; end; *************** package body GNAT.Command_Line is *** 1310,1321 **** if Section = null then Add_Switch ! (Cmd, Switch_Char & Full_Switch (Parser), ! Separator => Separator (Parser)); else Add_Switch (Cmd, Switch_Char & Full_Switch (Parser), - Separator => Separator (Parser), Section => Section.all); end if; end; --- 1621,1630 ---- if Section = null then Add_Switch ! (Cmd, Switch_Char & Full_Switch (Parser)); else Add_Switch (Cmd, Switch_Char & Full_Switch (Parser), Section => Section.all); end if; end; *************** package body GNAT.Command_Line is *** 1332,1338 **** function Looking_At (Type_Str : String; Index : Natural; ! Substring : String) return Boolean is begin return Index + Substring'Length - 1 <= Type_Str'Last and then Type_Str (Index .. Index + Substring'Length - 1) = Substring; --- 1641,1648 ---- function Looking_At (Type_Str : String; Index : Natural; ! Substring : String) return Boolean ! is begin return Index + Substring'Length - 1 <= Type_Str'Last and then Type_Str (Index .. Index + Substring'Length - 1) = Substring; *************** package body GNAT.Command_Line is *** 1397,1403 **** ---------------------------- procedure For_Each_Simple_Switch ! (Cmd : Command_Line; Switch : String; Parameter : String := ""; Unalias : Boolean := True) --- 1707,1714 ---- ---------------------------- procedure For_Each_Simple_Switch ! (Config : Command_Line_Configuration; ! Section : String; Switch : String; Parameter : String := ""; Unalias : Boolean := True) *************** package body GNAT.Command_Line is *** 1407,1412 **** --- 1718,1734 ---- Group : String) return Boolean; -- Perform the analysis of a group of switches + Found_In_Config : Boolean := False; + function Is_In_Config + (Config_Switch : String; Index : Integer) return Boolean; + -- If Switch is the same as Config_Switch, run the callback and sets + -- Found_In_Config to True + + function Starts_With + (Config_Switch : String; Index : Integer) return Boolean; + -- if Switch starts with Config_Switch, sets Found_In_Config to True. + -- The return value is for the Foreach_Switch iterator + -------------------- -- Group_Analysis -- -------------------- *************** package body GNAT.Command_Line is *** 1418,1505 **** Idx : Natural; Found : Boolean; ! begin ! Idx := Group'First; ! while Idx <= Group'Last loop ! Found := False; ! for S in Cmd.Config.Switches'Range loop ! declare ! Sw : constant String := ! Actual_Switch ! (Cmd.Config.Switches (S).all); ! Full : constant String := ! Prefix & Group (Idx .. Group'Last); ! Last : Natural; ! Param : Natural; ! begin ! if Sw'Length >= Prefix'Length ! -- Verify that sw starts with Prefix ! and then Looking_At (Sw, Sw'First, Prefix) ! -- Verify that the group starts with sw ! and then Looking_At (Full, Full'First, Sw) ! then ! Last := Idx + Sw'Length - Prefix'Length - 1; ! Param := Last + 1; ! if Can_Have_Parameter (Cmd.Config.Switches (S).all) then ! -- Include potential parameter to the recursive call. ! -- Only numbers are allowed. ! while Last < Group'Last ! and then Group (Last + 1) in '0' .. '9' ! loop ! Last := Last + 1; ! end loop; ! end if; ! if not Require_Parameter (Cmd.Config.Switches (S).all) ! or else Last >= Param ! then ! if Idx = Group'First ! and then Last = Group'Last ! and then Last < Param ! then ! -- The group only concerns a single switch. Do not ! -- perform recursive call. ! -- Note that we still perform a recursive call if ! -- a parameter is detected in the switch, as this ! -- is a way to correctly identify such a parameter ! -- in aliases. ! return False; ! end if; ! Found := True; ! -- Recursive call, using the detected parameter if any ! if Last >= Param then ! For_Each_Simple_Switch ! (Cmd, ! Prefix & Group (Idx .. Param - 1), ! Group (Param .. Last)); ! else ! For_Each_Simple_Switch ! (Cmd, Prefix & Group (Idx .. Last), ""); ! end if; ! Idx := Last + 1; ! exit; ! end if; end if; ! end; ! end loop; if not Found then ! For_Each_Simple_Switch (Cmd, Prefix & Group (Idx), ""); Idx := Idx + 1; end if; end loop; --- 1740,1842 ---- Idx : Natural; Found : Boolean; ! function Analyze_Simple_Switch ! (Switch : String; Index : Integer) return Boolean; ! --------------------------- ! -- Analyze_Simple_Switch -- ! --------------------------- ! function Analyze_Simple_Switch ! (Switch : String; Index : Integer) return Boolean ! is ! pragma Unreferenced (Index); ! Full : constant String := Prefix & Group (Idx .. Group'Last); ! Sw : constant String := Actual_Switch (Switch); ! Last : Natural; ! Param : Natural; ! begin ! if Sw'Length >= Prefix'Length ! -- Verify that sw starts with Prefix ! and then Looking_At (Sw, Sw'First, Prefix) ! -- Verify that the group starts with sw ! and then Looking_At (Full, Full'First, Sw) ! then ! Last := Idx + Sw'Length - Prefix'Length - 1; ! Param := Last + 1; ! if Can_Have_Parameter (Switch) then ! -- Include potential parameter to the recursive call. ! -- Only numbers are allowed. ! while Last < Group'Last ! and then Group (Last + 1) in '0' .. '9' ! loop ! Last := Last + 1; ! end loop; ! end if; ! if not Require_Parameter (Switch) ! or else Last >= Param ! then ! if Idx = Group'First ! and then Last = Group'Last ! and then Last < Param ! then ! -- The group only concerns a single switch. Do not ! -- perform recursive call. ! -- Note that we still perform a recursive call if ! -- a parameter is detected in the switch, as this ! -- is a way to correctly identify such a parameter ! -- in aliases. ! return False; ! end if; ! Found := True; ! -- Recursive call, using the detected parameter if any ! ! if Last >= Param then ! For_Each_Simple_Switch ! (Config, ! Section, ! Prefix & Group (Idx .. Param - 1), ! Group (Param .. Last)); ! else ! For_Each_Simple_Switch ! (Config, Section, Prefix & Group (Idx .. Last), ""); end if; ! ! Idx := Last + 1; ! return False; ! end if; ! end if; ! return True; ! end Analyze_Simple_Switch; ! ! procedure Foreach is new Foreach_Switch (Analyze_Simple_Switch); ! ! -- Start of processing for Group_Analysis ! ! begin ! Idx := Group'First; ! while Idx <= Group'Last loop ! Found := False; ! ! Foreach (Config, Section); if not Found then ! For_Each_Simple_Switch ! (Config, Section, Prefix & Group (Idx), ""); Idx := Idx + 1; end if; end loop; *************** package body GNAT.Command_Line is *** 1507,1534 **** return True; end Group_Analysis; begin -- First determine if the switch corresponds to one belonging to the -- configuration. If so, run callback and exit. ! if Cmd.Config /= null and then Cmd.Config.Switches /= null then ! for S in Cmd.Config.Switches'Range loop ! declare ! Config_Switch : String renames Cmd.Config.Switches (S).all; ! begin ! if Actual_Switch (Config_Switch) = Switch ! and then ! ((Can_Have_Parameter (Config_Switch) ! and then Parameter /= "") ! or else ! (not Require_Parameter (Config_Switch) ! and then Parameter = "")) ! then ! Callback (Switch, Parameter); ! return; ! end if; ! end; ! end loop; end if; -- If adding a switch that can in fact be expanded through aliases, --- 1844,1979 ---- return True; end Group_Analysis; + ------------------ + -- Is_In_Config -- + ------------------ + + function Is_In_Config + (Config_Switch : String; Index : Integer) return Boolean + is + Last : Natural; + P : Switch_Parameter_Type; + + begin + Decompose_Switch (Config_Switch, P, Last); + + if Config_Switch (Config_Switch'First .. Last) = Switch then + case P is + when Parameter_None => + if Parameter = "" then + Callback (Switch, "", "", Index => Index); + Found_In_Config := True; + return False; + end if; + + when Parameter_With_Optional_Space => + if Parameter /= "" then + Callback (Switch, " ", Parameter, Index => Index); + Found_In_Config := True; + return False; + end if; + + when Parameter_With_Space_Or_Equal => + if Parameter /= "" then + Callback (Switch, "=", Parameter, Index => Index); + Found_In_Config := True; + return False; + end if; + + when Parameter_No_Space => + if Parameter /= "" then + Callback (Switch, "", Parameter, Index); + Found_In_Config := True; + return False; + end if; + + when Parameter_Optional => + Callback (Switch, "", Parameter, Index); + Found_In_Config := True; + return False; + end case; + end if; + + return True; + end Is_In_Config; + + ----------------- + -- Starts_With -- + ----------------- + + function Starts_With + (Config_Switch : String; Index : Integer) return Boolean + is + Last : Natural; + Param : Natural; + P : Switch_Parameter_Type; + + begin + -- This function is called when we believe the parameter was + -- specified as part of the switch, instead of separately. Thus we + -- look in the config to find all possible switches. + + Decompose_Switch (Config_Switch, P, Last); + + if Looking_At + (Switch, Switch'First, Config_Switch (Config_Switch'First .. Last)) + then + -- Set first char of Param, and last char of Switch + + Param := Switch'First + Last; + Last := Switch'First + Last - Config_Switch'First; + + case P is + + -- None is already handled in Is_In_Config + + when Parameter_None => + null; + + when Parameter_With_Space_Or_Equal => + if Param <= Switch'Last + and then + (Switch (Param) = ' ' or else Switch (Param) = '=') + then + Callback (Switch (Switch'First .. Last), + "=", Switch (Param + 1 .. Switch'Last), Index); + Found_In_Config := True; + return False; + end if; + + when Parameter_With_Optional_Space => + if Param <= Switch'Last and then Switch (Param) = ' ' then + Param := Param + 1; + end if; + + Callback (Switch (Switch'First .. Last), + " ", Switch (Param .. Switch'Last), Index); + Found_In_Config := True; + return False; + + when Parameter_No_Space | Parameter_Optional => + Callback (Switch (Switch'First .. Last), + "", Switch (Param .. Switch'Last), Index); + Found_In_Config := True; + return False; + end case; + end if; + return True; + end Starts_With; + + procedure Foreach_In_Config is new Foreach_Switch (Is_In_Config); + procedure Foreach_Starts_With is new Foreach_Switch (Starts_With); + + -- Start of processing for For_Each_Simple_Switch + begin -- First determine if the switch corresponds to one belonging to the -- configuration. If so, run callback and exit. ! Foreach_In_Config (Config, Section); ! ! if Found_In_Config then ! return; end if; -- If adding a switch that can in fact be expanded through aliases, *************** package body GNAT.Command_Line is *** 1540,1552 **** -- be checked for a common prefix and split into simple switches. if Unalias ! and then Cmd.Config /= null ! and then Cmd.Config.Aliases /= null then ! for A in Cmd.Config.Aliases'Range loop ! if Cmd.Config.Aliases (A).all = Switch and then Parameter = "" then For_Each_Simple_Switch ! (Cmd, Cmd.Config.Expansions (A).all, ""); return; end if; end loop; --- 1985,2000 ---- -- be checked for a common prefix and split into simple switches. if Unalias ! and then Config /= null ! and then Config.Aliases /= null then ! for A in Config.Aliases'Range loop ! if Config.Aliases (A).Section.all = Section ! and then Config.Aliases (A).Alias.all = Switch ! and then Parameter = "" ! then For_Each_Simple_Switch ! (Config, Section, Config.Aliases (A).Expansion.all, ""); return; end if; end loop; *************** package body GNAT.Command_Line is *** 1555,1587 **** -- If adding a switch grouping several switches, add each of the simple -- switches instead. ! if Cmd.Config /= null and then Cmd.Config.Prefixes /= null then ! for P in Cmd.Config.Prefixes'Range loop ! if Switch'Length > Cmd.Config.Prefixes (P)'Length + 1 and then Looking_At ! (Switch, Switch'First, Cmd.Config.Prefixes (P).all) then -- Alias expansion will be done recursively ! if Cmd.Config.Switches = null then ! for S in Switch'First + Cmd.Config.Prefixes (P)'Length .. Switch'Last loop For_Each_Simple_Switch ! (Cmd, Cmd.Config.Prefixes (P).all & Switch (S), ""); end loop; return; elsif Group_Analysis ! (Cmd.Config.Prefixes (P).all, Switch ! (Switch'First + Cmd.Config.Prefixes (P)'Length ! .. Switch'Last)) then -- Recursive calls already done on each switch of the group: -- Return without executing Callback. - return; end if; end if; --- 2003,2034 ---- -- If adding a switch grouping several switches, add each of the simple -- switches instead. ! if Config /= null and then Config.Prefixes /= null then ! for P in Config.Prefixes'Range loop ! if Switch'Length > Config.Prefixes (P)'Length + 1 and then Looking_At ! (Switch, Switch'First, Config.Prefixes (P).all) then -- Alias expansion will be done recursively ! if Config.Switches = null then ! for S in Switch'First + Config.Prefixes (P)'Length .. Switch'Last loop For_Each_Simple_Switch ! (Config, Section, ! Config.Prefixes (P).all & Switch (S), ""); end loop; return; elsif Group_Analysis ! (Config.Prefixes (P).all, Switch ! (Switch'First + Config.Prefixes (P)'Length .. Switch'Last)) then -- Recursive calls already done on each switch of the group: -- Return without executing Callback. return; end if; end if; *************** package body GNAT.Command_Line is *** 1589,1640 **** end if; -- Test if added switch is a known switch with parameter attached if Parameter = "" ! and then Cmd.Config /= null ! and then Cmd.Config.Switches /= null then ! for S in Cmd.Config.Switches'Range loop ! declare ! Sw : constant String := ! Actual_Switch (Cmd.Config.Switches (S).all); ! Last : Natural; ! Param : Natural; ! ! begin ! -- Verify that switch starts with Sw ! -- What if the "verification" fails??? ! ! if Switch'Length >= Sw'Length ! and then Looking_At (Switch, Switch'First, Sw) ! then ! Param := Switch'First + Sw'Length - 1; ! Last := Param; ! ! if Can_Have_Parameter (Cmd.Config.Switches (S).all) then ! while Last < Switch'Last ! and then Switch (Last + 1) in '0' .. '9' ! loop ! Last := Last + 1; ! end loop; ! end if; ! ! -- If full Switch is a known switch with attached parameter ! -- then we use this parameter in the callback. ! ! if Last = Switch'Last then ! Callback ! (Switch (Switch'First .. Param), ! Switch (Param + 1 .. Last)); ! return; ! ! end if; ! end if; ! end; ! end loop; end if; ! Callback (Switch, Parameter); end For_Each_Simple_Switch; ---------------- --- 2036,2059 ---- end if; -- Test if added switch is a known switch with parameter attached + -- instead of being specified separately if Parameter = "" ! and then Config /= null ! and then Config.Switches /= null then ! Found_In_Config := False; ! Foreach_Starts_With (Config, Section); ! if Found_In_Config then ! return; ! end if; end if; ! -- The switch is invalid in the config, but we still want to report it. ! -- The config could, for instance, include "*" to specify it accepts ! -- all switches. ! ! Callback (Switch, " ", Parameter, Index => -1); end For_Each_Simple_Switch; ---------------- *************** package body GNAT.Command_Line is *** 1652,1659 **** Success : Boolean; pragma Unreferenced (Success); begin ! Add_Switch ! (Cmd, Switch, Parameter, Separator, Section, Add_Before, Success); end Add_Switch; ---------------- --- 2071,2078 ---- Success : Boolean; pragma Unreferenced (Success); begin ! Add_Switch (Cmd, Switch, Parameter, Separator, ! Section, Add_Before, Success); end Add_Switch; ---------------- *************** package body GNAT.Command_Line is *** 1669,1675 **** Add_Before : Boolean := False; Success : out Boolean) is ! procedure Add_Simple_Switch (Simple : String; Param : String); -- Add a new switch that has had all its aliases expanded, and switches -- ungrouped. We know there are no more aliases in Switches. --- 2088,2100 ---- Add_Before : Boolean := False; Success : out Boolean) is ! pragma Unreferenced (Separator); -- ??? Should be removed eventually ! ! procedure Add_Simple_Switch ! (Simple : String; ! Separator : String; ! Param : String; ! Index : Integer); -- Add a new switch that has had all its aliases expanded, and switches -- ungrouped. We know there are no more aliases in Switches. *************** package body GNAT.Command_Line is *** 1677,1701 **** -- Add_Simple_Switch -- ----------------------- ! procedure Add_Simple_Switch (Simple : String; Param : String) is begin if Cmd.Expanded = null then Cmd.Expanded := new Argument_List'(1 .. 1 => new String'(Simple)); if Param /= "" then ! Cmd.Params := new Argument_List' ! (1 .. 1 => new String'(Separator & Param)); ! else Cmd.Params := new Argument_List'(1 .. 1 => null); end if; if Section = "" then Cmd.Sections := new Argument_List'(1 .. 1 => null); - else ! Cmd.Sections := new Argument_List' ! (1 .. 1 => new String'(Section)); end if; else --- 2102,2138 ---- -- Add_Simple_Switch -- ----------------------- ! procedure Add_Simple_Switch ! (Simple : String; ! Separator : String; ! Param : String; ! Index : Integer) ! is ! pragma Unreferenced (Index); ! Sep : Character; ! begin + if Separator = "" then + Sep := ASCII.NUL; + else + Sep := Separator (Separator'First); + end if; + if Cmd.Expanded = null then Cmd.Expanded := new Argument_List'(1 .. 1 => new String'(Simple)); if Param /= "" then ! Cmd.Params := ! new Argument_List'(1 .. 1 => new String'(Sep & Param)); else Cmd.Params := new Argument_List'(1 .. 1 => null); end if; if Section = "" then Cmd.Sections := new Argument_List'(1 .. 1 => null); else ! Cmd.Sections := ! new Argument_List'(1 .. 1 => new String'(Section)); end if; else *************** package body GNAT.Command_Line is *** 1707,1713 **** ((Cmd.Params (C) = null and then Param = "") or else (Cmd.Params (C) /= null ! and then Cmd.Params (C).all = Separator & Param)) and then ((Cmd.Sections (C) = null and then Section = "") or else --- 2144,2150 ---- ((Cmd.Params (C) = null and then Param = "") or else (Cmd.Params (C) /= null ! and then Cmd.Params (C).all = Sep & Param)) and then ((Cmd.Sections (C) = null and then Section = "") or else *************** package body GNAT.Command_Line is *** 1726,1734 **** if Param /= "" then Add (Cmd.Params, ! new String'(Separator & Param), Add_Before); - else Add (Cmd.Params, --- 2163,2170 ---- if Param /= "" then Add (Cmd.Params, ! new String'(Sep & Param), Add_Before); else Add (Cmd.Params, *************** package body GNAT.Command_Line is *** 1751,1763 **** end Add_Simple_Switch; procedure Add_Simple_Switches is ! new For_Each_Simple_Switch (Add_Simple_Switch); -- Start of processing for Add_Switch begin Success := False; ! Add_Simple_Switches (Cmd, Switch, Parameter); Free (Cmd.Coalesce); end Add_Switch; --- 2187,2216 ---- end Add_Simple_Switch; procedure Add_Simple_Switches is ! new For_Each_Simple_Switch (Add_Simple_Switch); ! ! -- Local Variables ! ! Section_Valid : Boolean := False; -- Start of processing for Add_Switch begin + if Section /= "" and then Cmd.Config /= null then + for S in Cmd.Config.Sections'Range loop + if Section = Cmd.Config.Sections (S).all then + Section_Valid := True; + exit; + end if; + end loop; + + if not Section_Valid then + raise Invalid_Section; + end if; + end if; + Success := False; ! Add_Simple_Switches (Cmd.Config, Section, Switch, Parameter); Free (Cmd.Coalesce); end Add_Switch; *************** package body GNAT.Command_Line is *** 1843,1858 **** Section : String := ""; Success : out Boolean) is ! procedure Remove_Simple_Switch (Simple : String; Param : String); -- Removes a simple switch, with no aliasing or grouping -------------------------- -- Remove_Simple_Switch -- -------------------------- ! procedure Remove_Simple_Switch (Simple : String; Param : String) is C : Integer; ! pragma Unreferenced (Param); begin if Cmd.Expanded /= null then --- 2296,2314 ---- Section : String := ""; Success : out Boolean) is ! procedure Remove_Simple_Switch ! (Simple, Separator, Param : String; Index : Integer); -- Removes a simple switch, with no aliasing or grouping -------------------------- -- Remove_Simple_Switch -- -------------------------- ! procedure Remove_Simple_Switch ! (Simple, Separator, Param : String; Index : Integer) ! is C : Integer; ! pragma Unreferenced (Param, Separator, Index); begin if Cmd.Expanded /= null then *************** package body GNAT.Command_Line is *** 1890,1896 **** begin Success := False; ! Remove_Simple_Switches (Cmd, Switch, "", Unalias => not Has_Parameter); Free (Cmd.Coalesce); end Remove_Switch; --- 2346,2353 ---- begin Success := False; ! Remove_Simple_Switches ! (Cmd.Config, Section, Switch, "", Unalias => not Has_Parameter); Free (Cmd.Coalesce); end Remove_Switch; *************** package body GNAT.Command_Line is *** 1904,1917 **** Parameter : String; Section : String := "") is ! procedure Remove_Simple_Switch (Simple : String; Param : String); -- Removes a simple switch, with no aliasing or grouping -------------------------- -- Remove_Simple_Switch -- -------------------------- ! procedure Remove_Simple_Switch (Simple : String; Param : String) is C : Integer; begin --- 2361,2378 ---- Parameter : String; Section : String := "") is ! procedure Remove_Simple_Switch ! (Simple, Separator, Param : String; Index : Integer); -- Removes a simple switch, with no aliasing or grouping -------------------------- -- Remove_Simple_Switch -- -------------------------- ! procedure Remove_Simple_Switch ! (Simple, Separator, Param : String; Index : Integer) ! is ! pragma Unreferenced (Separator, Index); C : Integer; begin *************** package body GNAT.Command_Line is *** 1954,1965 **** end Remove_Simple_Switch; procedure Remove_Simple_Switches is ! new For_Each_Simple_Switch (Remove_Simple_Switch); -- Start of processing for Remove_Switch begin ! Remove_Simple_Switches (Cmd, Switch, Parameter); Free (Cmd.Coalesce); end Remove_Switch; --- 2415,2426 ---- end Remove_Simple_Switch; procedure Remove_Simple_Switches is ! new For_Each_Simple_Switch (Remove_Simple_Switch); -- Start of processing for Remove_Switch begin ! Remove_Simple_Switches (Cmd.Config, Section, Switch, Parameter); Free (Cmd.Coalesce); end Remove_Switch; *************** package body GNAT.Command_Line is *** 2060,2069 **** Free (Result (C)); ! else ! -- We changed section: we put the grouped switches to the ! -- first place, on continue with the new section. Result (First) := new String' (Cmd.Config.Prefixes (P).all & --- 2521,2530 ---- Free (Result (C)); ! -- We changed section: we put the grouped switches to the first ! -- place, on continue with the new section. + else Result (First) := new String' (Cmd.Config.Prefixes (P).all & *************** package body GNAT.Command_Line is *** 2099,2115 **** Found : Boolean; First : Natural; ! procedure Check_Cb (Switch : String; Param : String); ! -- Comment required ??? ! procedure Remove_Cb (Switch : String; Param : String); ! -- Comment required ??? -------------- -- Check_Cb -- -------------- ! procedure Check_Cb (Switch : String; Param : String) is begin if Found then for E in Result'Range loop --- 2560,2584 ---- Found : Boolean; First : Natural; ! procedure Check_Cb (Switch, Separator, Param : String; Index : Integer); ! -- Checks whether the command line contains [Switch]. ! -- Sets the global variable [Found] appropriately. ! -- This will be called for each simple switch that make up an alias, to ! -- know whether the alias should be applied. ! procedure Remove_Cb (Switch, Separator, Param : String; Index : Integer); ! -- Remove the simple switch [Switch] from the command line, since it is ! -- part of a simpler alias -------------- -- Check_Cb -- -------------- ! procedure Check_Cb ! (Switch, Separator, Param : String; Index : Integer) ! is ! pragma Unreferenced (Separator, Index); ! begin if Found then for E in Result'Range loop *************** package body GNAT.Command_Line is *** 2132,2150 **** -- Remove_Cb -- --------------- ! procedure Remove_Cb (Switch : String; Param : String) is begin for E in Result'Range loop if Result (E) /= null and then (Params (E) = null ! or else Params (E) (Params (E)'First + 1 ! .. Params (E)'Last) = Param) and then Result (E).all = Switch then if First > E then First := E; end if; Free (Result (E)); Free (Params (E)); return; --- 2601,2623 ---- -- Remove_Cb -- --------------- ! procedure Remove_Cb (Switch, Separator, Param : String; Index : Integer) ! is ! pragma Unreferenced (Separator, Index); ! begin for E in Result'Range loop if Result (E) /= null and then (Params (E) = null ! or else Params (E) (Params (E)'First + 1 ! .. Params (E)'Last) = Param) and then Result (E).all = Switch then if First > E then First := E; end if; + Free (Result (E)); Free (Params (E)); return; *************** package body GNAT.Command_Line is *** 2171,2182 **** -- then check whether the expanded command line has all of them. Found := True; ! Check_All (Cmd, Cmd.Config.Expansions (A).all); if Found then First := Integer'Last; ! Remove_All (Cmd, Cmd.Config.Expansions (A).all); ! Result (First) := new String'(Cmd.Config.Aliases (A).all); end if; end loop; end Alias_Switches; --- 2644,2659 ---- -- then check whether the expanded command line has all of them. Found := True; ! Check_All (Cmd.Config, ! Switch => Cmd.Config.Aliases (A).Expansion.all, ! Section => Cmd.Config.Aliases (A).Section.all); if Found then First := Integer'Last; ! Remove_All (Cmd.Config, ! Switch => Cmd.Config.Aliases (A).Expansion.all, ! Section => Cmd.Config.Aliases (A).Section.all); ! Result (First) := new String'(Cmd.Config.Aliases (A).Alias.all); end if; end loop; end Alias_Switches; *************** package body GNAT.Command_Line is *** 2243,2248 **** --- 2720,2727 ---- end if; end loop; end loop; + + Unchecked_Free (Sections_List); end Sort_Sections; ----------- *************** package body GNAT.Command_Line is *** 2252,2258 **** procedure Start (Cmd : in out Command_Line; Iter : in out Command_Line_Iterator; ! Expanded : Boolean) is begin if Cmd.Expanded = null then --- 2731,2737 ---- procedure Start (Cmd : in out Command_Line; Iter : in out Command_Line_Iterator; ! Expanded : Boolean := False) is begin if Cmd.Expanded = null then *************** package body GNAT.Command_Line is *** 2274,2279 **** --- 2753,2759 ---- Cmd.Coalesce (E) := new String'(Cmd.Expanded (E).all); end loop; + Free (Cmd.Coalesce_Sections); Cmd.Coalesce_Sections := new Argument_List (Cmd.Sections'Range); for E in Cmd.Sections'Range loop Cmd.Coalesce_Sections (E) := *************** package body GNAT.Command_Line is *** 2281,2286 **** --- 2761,2767 ---- else new String'(Cmd.Sections (E).all)); end loop; + Free (Cmd.Coalesce_Params); Cmd.Coalesce_Params := new Argument_List (Cmd.Params'Range); for E in Cmd.Params'Range loop Cmd.Coalesce_Params (E) := *************** package body GNAT.Command_Line is *** 2439,2451 **** ---------- procedure Free (Config : in out Command_Line_Configuration) is begin if Config /= null then - Free (Config.Aliases); - Free (Config.Expansions); Free (Config.Prefixes); Free (Config.Sections); ! Free (Config.Switches); Unchecked_Free (Config); end if; end Free; --- 2920,2956 ---- ---------- procedure Free (Config : in out Command_Line_Configuration) is + procedure Unchecked_Free is new Ada.Unchecked_Deallocation + (Switch_Definitions, Switch_Definitions_List); + procedure Unchecked_Free is new Ada.Unchecked_Deallocation + (Alias_Definitions, Alias_Definitions_List); begin if Config /= null then Free (Config.Prefixes); Free (Config.Sections); ! Free (Config.Usage); ! Free (Config.Help); ! ! if Config.Aliases /= null then ! for A in Config.Aliases'Range loop ! Free (Config.Aliases (A).Alias); ! Free (Config.Aliases (A).Expansion); ! Free (Config.Aliases (A).Section); ! end loop; ! Unchecked_Free (Config.Aliases); ! end if; ! ! if Config.Switches /= null then ! for S in Config.Switches'Range loop ! Free (Config.Switches (S).Switch); ! Free (Config.Switches (S).Long_Switch); ! Free (Config.Switches (S).Help); ! Free (Config.Switches (S).Section); ! end loop; ! ! Unchecked_Free (Config.Switches); ! end if; ! Unchecked_Free (Config); end if; end Free; *************** package body GNAT.Command_Line is *** 2458,2464 **** --- 2963,3432 ---- begin Free (Cmd.Expanded); Free (Cmd.Coalesce); + Free (Cmd.Coalesce_Sections); + Free (Cmd.Coalesce_Params); Free (Cmd.Params); + Free (Cmd.Sections); end Free; + --------------- + -- Set_Usage -- + --------------- + + procedure Set_Usage + (Config : in out Command_Line_Configuration; + Usage : String := "[switches] [arguments]"; + Help : String := "") + is + begin + if Config = null then + Config := new Command_Line_Configuration_Record; + end if; + + Free (Config.Usage); + Config.Usage := new String'(Usage); + Config.Help := new String'(Help); + end Set_Usage; + + ------------------ + -- Display_Help -- + ------------------ + + procedure Display_Help (Config : Command_Line_Configuration) is + function Switch_Name + (Def : Switch_Definition; + Section : String) return String; + -- Return the "-short, --long=ARG" string for Def. + -- Returns "" if the switch is not in the section. + + function Param_Name + (P : Switch_Parameter_Type; + Name : String := "ARG") return String; + -- Return the display for a switch parameter + + procedure Display_Section_Help (Section : String); + -- Display the help for a specific section ("" is the default section) + + -------------------------- + -- Display_Section_Help -- + -------------------------- + + procedure Display_Section_Help (Section : String) is + Max_Len : Natural := 0; + begin + -- ??? Special display for "*" + + New_Line; + + if Section /= "" then + Put_Line ("Switches after " & Section); + end if; + + -- Compute size of the switches column + + for S in Config.Switches'Range loop + Max_Len := Natural'Max + (Max_Len, Switch_Name (Config.Switches (S), Section)'Length); + end loop; + + if Config.Aliases /= null then + for A in Config.Aliases'Range loop + if Config.Aliases (A).Section.all = Section then + Max_Len := Natural'Max + (Max_Len, Config.Aliases (A).Alias'Length); + end if; + end loop; + end if; + + -- Display the switches + + for S in Config.Switches'Range loop + declare + N : constant String := + Switch_Name (Config.Switches (S), Section); + begin + if N /= "" then + Put (" "); + Put (N); + Put ((1 .. Max_Len - N'Length + 1 => ' ')); + + if Config.Switches (S).Help /= null then + Put (Config.Switches (S).Help.all); + end if; + + New_Line; + end if; + end; + end loop; + + -- Display the aliases + + if Config.Aliases /= null then + for A in Config.Aliases'Range loop + if Config.Aliases (A).Section.all = Section then + Put (" "); + Put (Config.Aliases (A).Alias.all); + Put ((1 .. Max_Len - Config.Aliases (A).Alias'Length + 1 + => ' ')); + Put ("Equivalent to " & Config.Aliases (A).Expansion.all); + New_Line; + end if; + end loop; + end if; + end Display_Section_Help; + + ---------------- + -- Param_Name -- + ---------------- + + function Param_Name + (P : Switch_Parameter_Type; + Name : String := "ARG") return String + is + begin + case P is + when Parameter_None => + return ""; + + when Parameter_With_Optional_Space => + return " " & To_Upper (Name); + + when Parameter_With_Space_Or_Equal => + return "=" & To_Upper (Name); + + when Parameter_No_Space => + return To_Upper (Name); + + when Parameter_Optional => + return '[' & To_Upper (Name) & ']'; + end case; + end Param_Name; + + ----------------- + -- Switch_Name -- + ----------------- + + function Switch_Name + (Def : Switch_Definition; + Section : String) return String + is + use Ada.Strings.Unbounded; + Result : Unbounded_String; + P1, P2 : Switch_Parameter_Type; + Last1, Last2 : Integer := 0; + + begin + if (Section = "" and then Def.Section = null) + or else (Def.Section /= null and then Def.Section.all = Section) + then + if Def.Switch /= null + and then Def.Switch.all = "*" + then + return "[any switch]"; + end if; + + if Def.Switch /= null then + Decompose_Switch (Def.Switch.all, P1, Last1); + Append (Result, Def.Switch (Def.Switch'First .. Last1)); + + if Def.Long_Switch /= null then + Decompose_Switch (Def.Long_Switch.all, P2, Last2); + Append (Result, ", " + & Def.Long_Switch (Def.Long_Switch'First .. Last2)); + Append (Result, Param_Name (P2, "ARG")); + + else + Append (Result, Param_Name (P1, "ARG")); + end if; + + else -- Long_Switch necessarily not null + Decompose_Switch (Def.Long_Switch.all, P2, Last2); + Append (Result, + Def.Long_Switch (Def.Long_Switch'First .. Last2)); + Append (Result, Param_Name (P2, "ARG")); + end if; + end if; + + return To_String (Result); + end Switch_Name; + + -- Start of processing for Display_Help + + begin + if Config = null then + return; + end if; + + if Config.Usage /= null then + Put_Line ("Usage: " + & Base_Name + (Ada.Command_Line.Command_Name) & " " & Config.Usage.all); + else + Put_Line ("Usage: " & Base_Name (Ada.Command_Line.Command_Name) + & " [switches] [arguments]"); + end if; + + if Config.Help /= null and then Config.Help.all /= "" then + Put_Line (Config.Help.all); + end if; + + Display_Section_Help (""); + + if Config.Sections /= null and then Config.Switches /= null then + for S in Config.Sections'Range loop + Display_Section_Help (Config.Sections (S).all); + end loop; + end if; + end Display_Help; + + ------------ + -- Getopt -- + ------------ + + procedure Getopt + (Config : Command_Line_Configuration; + Callback : Switch_Handler := null; + Parser : Opt_Parser := Command_Line_Parser) + is + Getopt_Switches : String_Access; + C : Character := ASCII.NUL; + + Empty_Name : aliased constant String := ""; + Current_Section : Integer := -1; + Section_Name : not null access constant String := Empty_Name'Access; + + procedure Simple_Callback + (Simple_Switch : String; + Separator : String; + Parameter : String; + Index : Integer); + -- Needs comments ??? + + procedure Do_Callback (Switch, Parameter : String; Index : Integer); + + ----------------- + -- Do_Callback -- + ----------------- + + procedure Do_Callback (Switch, Parameter : String; Index : Integer) is + begin + -- Do automatic handling when possible + + if Index /= -1 then + case Config.Switches (Index).Typ is + when Switch_Untyped => + null; -- no automatic handling + + when Switch_Boolean => + Config.Switches (Index).Boolean_Output.all := + Config.Switches (Index).Boolean_Value; + return; + + when Switch_Integer => + begin + if Parameter = "" then + Config.Switches (Index).Integer_Output.all := + Config.Switches (Index).Integer_Default; + else + Config.Switches (Index).Integer_Output.all := + Integer'Value (Parameter); + end if; + exception + when Constraint_Error => + raise Invalid_Parameter + with "Expected integer parameter for '" + & Switch & "'"; + end; + + when Switch_String => + Free (Config.Switches (Index).String_Output.all); + Config.Switches (Index).String_Output.all := + new String'(Parameter); + end case; + end if; + + -- Otherwise calls the user callback if one was defined + + if Callback /= null then + Callback (Switch => Switch, + Parameter => Parameter, + Section => Section_Name.all); + end if; + end Do_Callback; + + procedure For_Each_Simple + is new For_Each_Simple_Switch (Simple_Callback); + + --------------------- + -- Simple_Callback -- + --------------------- + + procedure Simple_Callback + (Simple_Switch : String; + Separator : String; + Parameter : String; + Index : Integer) + is + pragma Unreferenced (Separator); + begin + Do_Callback (Switch => Simple_Switch, + Parameter => Parameter, + Index => Index); + end Simple_Callback; + + -- Start of processing for Getopt + + begin + -- Initialize sections + + if Config.Sections = null then + Config.Sections := new Argument_List'(1 .. 0 => null); + end if; + + Internal_Initialize_Option_Scan + (Parser => Parser, + Switch_Char => Parser.Switch_Character, + Stop_At_First_Non_Switch => Parser.Stop_At_First, + Section_Delimiters => Section_Delimiters (Config)); + + Getopt_Switches := new String' + (Get_Switches (Config, Parser.Switch_Character, Section_Name.all) + & " h -help"); + + -- Initialize output values for automatically handled switches + + for S in Config.Switches'Range loop + case Config.Switches (S).Typ is + when Switch_Untyped => + null; -- Nothing to do + + when Switch_Boolean => + Config.Switches (S).Boolean_Output.all := + not Config.Switches (S).Boolean_Value; + + when Switch_Integer => + Config.Switches (S).Integer_Output.all := + Config.Switches (S).Integer_Initial; + + when Switch_String => + Config.Switches (S).String_Output.all := new String'(""); + end case; + end loop; + + -- For all sections, and all switches within those sections + + loop + C := Getopt (Switches => Getopt_Switches.all, + Concatenate => True, + Parser => Parser); + + if C = '*' then + -- Full_Switch already includes the leading '-' + + Do_Callback (Switch => Full_Switch (Parser), + Parameter => Parameter (Parser), + Index => -1); + + elsif C /= ASCII.NUL then + if Full_Switch (Parser) = "h" + or else Full_Switch (Parser) = "-help" + then + Display_Help (Config); + raise Exit_From_Command_Line; + end if; + + -- Do switch expansion if needed + For_Each_Simple + (Config, + Section => Section_Name.all, + Switch => Parser.Switch_Character & Full_Switch (Parser), + Parameter => Parameter (Parser)); + + else + if Current_Section = -1 then + Current_Section := Config.Sections'First; + else + Current_Section := Current_Section + 1; + end if; + + exit when Current_Section > Config.Sections'Last; + + Section_Name := Config.Sections (Current_Section); + Goto_Section (Section_Name.all, Parser); + + Free (Getopt_Switches); + Getopt_Switches := new String' + (Get_Switches + (Config, Parser.Switch_Character, Section_Name.all)); + end if; + end loop; + + Free (Getopt_Switches); + + exception + when Invalid_Switch => + Free (Getopt_Switches); + + -- Message inspired by "ls" on Unix + + Put_Line (Standard_Error, + Base_Name (Ada.Command_Line.Command_Name) + & ": unrecognized option '" + & Parser.Switch_Character & Full_Switch (Parser) + & "'"); + Put_Line (Standard_Error, + "Try `" + & Base_Name (Ada.Command_Line.Command_Name) + & " --help` for more information."); + + raise; + + when others => + Free (Getopt_Switches); + raise; + end Getopt; + + ----------- + -- Build -- + ----------- + + procedure Build + (Line : in out Command_Line; + Args : out GNAT.OS_Lib.Argument_List_Access; + Expanded : Boolean := False; + Switch_Char : Character := '-') + is + Iter : Command_Line_Iterator; + Count : Natural := 0; + + begin + Start (Line, Iter, Expanded => Expanded); + while Has_More (Iter) loop + if Is_New_Section (Iter) then + Count := Count + 1; + end if; + + Count := Count + 1; + Next (Iter); + end loop; + + Args := new Argument_List (1 .. Count); + Count := Args'First; + + Start (Line, Iter, Expanded => Expanded); + while Has_More (Iter) loop + if Is_New_Section (Iter) then + Args (Count) := new String' + (Switch_Char & Current_Section (Iter)); + Count := Count + 1; + end if; + + Args (Count) := new String'(Current_Switch (Iter) + & Current_Separator (Iter) + & Current_Parameter (Iter)); + Count := Count + 1; + Next (Iter); + end loop; + end Build; + end GNAT.Command_Line; diff -Nrcpad gcc-4.5.2/gcc/ada/g-comlin.ads gcc-4.6.0/gcc/ada/g-comlin.ads *** gcc-4.5.2/gcc/ada/g-comlin.ads Mon Nov 30 09:52:34 2009 --- gcc-4.6.0/gcc/ada/g-comlin.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1999-2010, 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,52 **** -- High level package for command line parsing and manipulation ! -- Parsing the command line ! -- ======================== -- This package provides an interface for parsing command line arguments, -- when they are either read from Ada.Command_Line or read from a string list. -- As shown in the example below, one should first retrieve the switches -- (special command line arguments starting with '-' by default) and their -- parameters, and then the rest of the command line arguments. ! ! -- This package is flexible enough to accommodate various needs: optional ! -- switch parameters, various characters to separate a switch and its ! -- parameter, whether to stop the parsing at the first non-switch argument ! -- encountered, etc. ! -- begin -- loop -- case Getopt ("a b: ad") is -- Accepts '-a', '-ad', or '-b argument' --- 33,56 ---- -- High level package for command line parsing and manipulation ! ---------------------------------------- ! -- Simple Parsing of the Command Line -- ! ---------------------------------------- -- This package provides an interface for parsing command line arguments, -- when they are either read from Ada.Command_Line or read from a string list. -- As shown in the example below, one should first retrieve the switches -- (special command line arguments starting with '-' by default) and their -- parameters, and then the rest of the command line arguments. ! -- ! -- While it may appear easy to parse the command line arguments with ! -- Ada.Command_Line, there are in fact lots of special cases to handle in some ! -- applications. Those are fully managed by GNAT.Command_Line. Among these are ! -- switches with optional parameters, grouping switches (for instance "-ab" ! -- might mean the same as "-a -b"), various characters to separate a switch ! -- and its parameter (or none: "-a 1" and "-a1" are generally the same, which ! -- can introduce confusion with grouped switches),... ! -- -- begin -- loop -- case Getopt ("a b: ad") is -- Accepts '-a', '-ad', or '-b argument' *************** *** 59,66 **** -- Put_Line ("Got ad"); -- end if; ! -- when 'b' => ! -- Put_Line ("Got b + " & Parameter); -- when others => -- raise Program_Error; -- cannot occur! --- 63,69 ---- -- Put_Line ("Got ad"); -- end if; ! -- when 'b' => Put_Line ("Got b + " & Parameter); -- when others => -- raise Program_Error; -- cannot occur! *************** *** 81,86 **** --- 84,93 ---- -- when Invalid_Parameter => Put_Line ("No parameter for " & Full_Switch); -- end; + -------------- + -- Sections -- + -------------- + -- A more complicated example would involve the use of sections for the -- switches, as for instance in gnatmake. The same command line is used to -- provide switches for several tools. Each tool recognizes its switches by *************** *** 106,117 **** -- end loop; -- end; ! -- The example above have shown how to parse the command line when the ! -- arguments are read directly from Ada.Command_Line. However, these arguments ! -- can also be read from a list of strings. This can be useful in several ! -- contexts, either because your system does not support Ada.Command_Line, or ! -- because you are manipulating other tools and creating their command line by ! -- hand, or for any other reason. -- To create the list of strings, it is recommended to use -- GNAT.OS_Lib.Argument_String_To_List. --- 113,128 ---- -- end loop; -- end; ! ------------------------------- ! -- Parsing a List of Strings -- ! ------------------------------- ! ! -- The examples above show how to parse the command line when the arguments ! -- are read directly from Ada.Command_Line. However, these arguments can also ! -- be read from a list of strings. This can be useful in several contexts, ! -- either because your system does not support Ada.Command_Line, or because ! -- you are manipulating other tools and creating their command lines by hand, ! -- or for any other reason. -- To create the list of strings, it is recommended to use -- GNAT.OS_Lib.Argument_String_To_List. *************** *** 132,149 **** -- end loop; -- Free (Parser); -- end; - -- - -- Creating and manipulating the command line - -- =========================================== ! -- This package provides mechanisms to create and modify command lines by ! -- adding or removing arguments from them. The resulting command line is kept ! -- as short as possible by coalescing arguments whenever possible. ! -- Complex command lines can thus be constructed, for example from an GUI ! -- (although this package does not by itself depend upon any specific GUI ! -- toolkit). For instance, if you are configuring the command line to use ! -- when spawning a tool with the following characteristics: -- * Specifying -gnatwa is the same as specifying -gnatwu -gnatwv, but -- shorter and more readable --- 143,157 ---- -- end loop; -- Free (Parser); -- end; ! ------------------------------------------- ! -- High-Level Command Line Configuration -- ! ------------------------------------------- ! -- As shown above, the code is still relatively low-level. For instance, there ! -- is no way to indicate which switches are related (thus if "-l" and "--long" ! -- should have the same effect, your code will need to test for both cases). ! -- Likewise, it is difficult to handle more advanced constructs, like: -- * Specifying -gnatwa is the same as specifying -gnatwu -gnatwv, but -- shorter and more readable *************** *** 153,175 **** -- Of course, this can be combined with the above and -gnatwacd is the -- same as -gnatwc -gnatwd -gnatwu -gnatwv ! -- * The switch -T is the same as -gnatwAB ! -- * A switch -foo takes one mandatory parameter ! -- These properties can be configured through this package with the following ! -- calls: -- Config : Command_Line_Configuration; -- Define_Prefix (Config, "-gnatw"); - -- Define_Alias (Config, "-gnatwa", "-gnatwuv"); -- Define_Alias (Config, "-T", "-gnatwAB"); ! -- Using this configuration, one can then construct a command line for the ! -- tool with: -- Cmd : Command_Line; ! -- Set_Configuration (Cmd, Config); -- Add_Switch (Cmd, "-bar"); -- Add_Switch (Cmd, "-gnatwu"); -- Add_Switch (Cmd, "-gnatwv"); -- will be grouped with the above --- 161,241 ---- -- Of course, this can be combined with the above and -gnatwacd is the -- same as -gnatwc -gnatwd -gnatwu -gnatwv ! -- * The switch -T is the same as -gnatwAB (same as -gnatwA -gnatwB) ! -- With the above form of Getopt, you would receive "-gnatwa", "-T" or ! -- "-gnatwcd" in the examples above, and thus you require additional manual ! -- parsing of the switch. ! -- Instead, this package provides the type Command_Line_Configuration, which ! -- stores all the knowledge above. For instance: -- Config : Command_Line_Configuration; + -- Define_Alias (Config, "-gnatwa", "-gnatwu -gnatwv"); -- Define_Prefix (Config, "-gnatw"); -- Define_Alias (Config, "-T", "-gnatwAB"); ! -- You then need to specify all possible switches in your application by ! -- calling Define_Switch, for instance: ! ! -- Define_Switch (Config, "-gnatwu", Help => "warn on unused entities"); ! -- Define_Switch (Config, "-gnatwv", Help => "warn on unassigned var"); ! -- ... ! ! -- Specifying the help message is optional, but makes it easy to then call ! -- the function ! -- Display_Help (Config); ! -- that will display a properly formatted help message for your application, ! -- listing all possible switches. That way you have a single place in which ! -- to maintain the list of switches and their meaning, rather than maintaining ! -- both the string to pass to Getopt and a subprogram to display the help. ! -- Both will properly stay synchronized. ! ! -- Once you have this Config, you just have to call ! -- Getopt (Config, Callback'Access); ! -- to parse the command line. The Callback will be called for each switch ! -- found on the command line (in the case of our example, that is "-gnatwu" ! -- and then "-gnatwv", not "-gnatwa" itself). This simplifies command line ! -- parsing a lot. ! ! -- In fact, this can be further automated for the most command case where the ! -- parameter passed to a switch is stored in a variable in the application. ! -- When a switch is defined, you only have to indicate where to store the ! -- value, and let Getopt do the rest. For instance: ! ! -- Optimization : aliased Integer; ! -- Verbose : aliased Boolean; ! -- ! -- Define_Switch (Config, Verbose'Access, ! -- "-v", Long_Switch => "--verbose", ! -- Help => "Output extra verbose information"); ! -- Define_Switch (Config, Optimization'Access, ! -- "-O?", Help => "Optimization level"); ! -- ! -- Getopt (Config); -- No callback ! ! -- Since all switches are handled automatically, we don't even need to pass ! -- a callback to Getopt. Once getopt has been called, the two variables ! -- Optimization and Verbose have been properly initialized, either to the ! -- default value or to the value found on the command line. ! ! ------------------------------------------------ ! -- Creating and Manipulating the Command Line -- ! ------------------------------------------------ ! ! -- This package provides mechanisms to create and modify command lines by ! -- adding or removing arguments from them. The resulting command line is kept ! -- as short as possible by coalescing arguments whenever possible. ! ! -- Complex command lines can thus be constructed, for example from a GUI ! -- (although this package does not by itself depend upon any specific GUI ! -- toolkit). ! ! -- Using the configuration defined earlier, one can then construct a command ! -- line for the tool with: -- Cmd : Command_Line; ! -- Set_Configuration (Cmd, Config); -- Config created earlier -- Add_Switch (Cmd, "-bar"); -- Add_Switch (Cmd, "-gnatwu"); -- Add_Switch (Cmd, "-gnatwv"); -- will be grouped with the above *************** *** 204,249 **** -- This is done by passing an extra argument to Add_Switch, as in: ! -- Add_Switch (Cmd, "-foo", "arg1"); -- This ensures that "arg1" will always be treated as the argument to -foo, -- and will not be grouped with other parts of the command line. - -- Parsing the command line with grouped arguments - -- =============================================== - - -- The command line construction facility can also be used in conjunction with - -- Getopt to interpret a command line. For example when implementing the tool - -- described above, you would do a first loop with Getopt to pass the switches - -- and their arguments, and create a temporary representation of the command - -- line as a Command_Line object. Finally, you can query each individual - -- switch from that object. For instance: - - -- declare - -- Cmd : Command_Line; - -- Iter : Command_Line_Iterator; - - -- begin - -- while Getopt ("foo: gnatw! T bar") /= ASCII.NUL loop - -- Add_Switch (Cmd, Full_Switch, Parameter); - -- end loop; - - -- Start (Cmd, Iter, Expanded => True); - -- while Has_More (Iter) loop - -- if Current_Switch (Iter) = "-gnatwu" then .. - -- elsif Current_Switch (Iter) = "-gnatwv" then ... - -- end if; - -- Next (Iter); - -- end loop; - - -- The above means that your tool does not have to handle on its own whether - -- the user passed -gnatwa (in which case -gnatwu was indeed selected), or - -- just -gnatwu, or a combination of -gnatw switches as in -gnatwuv. - with Ada.Command_Line; with GNAT.Directory_Operations; with GNAT.OS_Lib; with GNAT.Regexp; package GNAT.Command_Line is --- 270,286 ---- -- This is done by passing an extra argument to Add_Switch, as in: ! -- Add_Switch (Cmd, "-foo", Parameter => "arg1"); -- This ensures that "arg1" will always be treated as the argument to -foo, -- and will not be grouped with other parts of the command line. with Ada.Command_Line; + with GNAT.Directory_Operations; with GNAT.OS_Lib; with GNAT.Regexp; + with GNAT.Strings; package GNAT.Command_Line is *************** package GNAT.Command_Line is *** 298,304 **** -- as a switch (returned by getopt), otherwise it will be considered -- as a normal argument (returned by Get_Argument). -- ! -- If SECTION_DELIMITERS is set, then every following subprogram -- (Getopt and Get_Argument) will only operate within a section, which -- is delimited by any of these delimiters or the end of the command line. -- --- 335,341 ---- -- as a switch (returned by getopt), otherwise it will be considered -- as a normal argument (returned by Get_Argument). -- ! -- If Section_Delimiters is set, then every following subprogram -- (Getopt and Get_Argument) will only operate within a section, which -- is delimited by any of these delimiters or the end of the command line. -- *************** package GNAT.Command_Line is *** 306,314 **** -- Initialize_Option_Scan (Section_Delimiters => "largs bargs cargs"); -- -- Arguments on command line : my_application -c -bargs -d -e -largs -f ! -- This line is made of three section, the first one is the default one -- and includes only the '-c' switch, the second one is between -bargs ! -- and -largs and includes '-d -e' and the last one includes '-f' procedure Free (Parser : in out Opt_Parser); -- Free the memory used by the parser. Calling this is not mandatory for --- 343,351 ---- -- Initialize_Option_Scan (Section_Delimiters => "largs bargs cargs"); -- -- Arguments on command line : my_application -c -bargs -d -e -largs -f ! -- This line contains three sections, the first one is the default one -- and includes only the '-c' switch, the second one is between -bargs ! -- and -largs and includes '-d -e' and the last one includes '-f'. procedure Free (Parser : in out Opt_Parser); -- Free the memory used by the parser. Calling this is not mandatory for *************** package GNAT.Command_Line is *** 317,332 **** procedure Goto_Section (Name : String := ""; Parser : Opt_Parser := Command_Line_Parser); ! -- Change the current section. The next Getopt of Get_Argument will start -- looking at the beginning of the section. An empty name ("") refers to -- the first section between the program name and the first section ! -- delimiter. If the section does not exist, then Invalid_Section is ! -- raised. function Full_Switch (Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Returns the full name of the last switch found (Getopt only returns ! -- the first character) function Getopt (Switches : String; --- 354,376 ---- procedure Goto_Section (Name : String := ""; Parser : Opt_Parser := Command_Line_Parser); ! -- Change the current section. The next Getopt or Get_Argument will start -- looking at the beginning of the section. An empty name ("") refers to -- the first section between the program name and the first section ! -- delimiter. If the section does not exist in Section_Delimiters, then ! -- Invalid_Section is raised. If the section does not appear on the command ! -- line, then it is treated as an empty section. function Full_Switch (Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Returns the full name of the last switch found (Getopt only returns the ! -- first character). Does not include the Switch_Char ('-' by default), ! -- unless the "*" option of Getopt is used (see below). ! ! function Current_Section ! (Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Return the name of the current section. ! -- The list of valid sections is defined through Initialize_Option_Scan function Getopt (Switches : String; *************** package GNAT.Command_Line is *** 336,348 **** -- switch character followed by a character within Switches, casing being -- significant). The result returned is the first character of the switch -- that is located. If there are no more switches in the current section, ! -- returns ASCII.NUL. If Concatenate is True (by default), the switches ! -- does not need to be separated by spaces (they can be concatenated if ! -- they do not require an argument, e.g. -ab is the same as two separate ! -- arguments -a -b). -- ! -- Switches is a string of all the possible switches, separated by a ! -- space. A switch can be followed by one of the following characters: -- -- ':' The switch requires a parameter. There can optionally be a space -- on the command line between the switch and its parameter. --- 380,392 ---- -- switch character followed by a character within Switches, casing being -- significant). The result returned is the first character of the switch -- that is located. If there are no more switches in the current section, ! -- returns ASCII.NUL. If Concatenate is True (the default), the switches do ! -- not need to be separated by spaces (they can be concatenated if they do ! -- not require an argument, e.g. -ab is the same as two separate arguments ! -- -a -b). -- ! -- Switches is a string of all the possible switches, separated by ! -- spaces. A switch can be followed by one of the following characters: -- -- ':' The switch requires a parameter. There can optionally be a space -- on the command line between the switch and its parameter. *************** package GNAT.Command_Line is *** 389,402 **** -- Example -- Getopt ("* a b") -- If the command line is '-a -c toto.o -b', Getopt will return ! -- successively 'a', '*', '*' and 'b'. When '*' is returned, ! -- Full_Switch returns the corresponding item on the command line. -- -- When Getopt encounters an invalid switch, it raises the exception -- Invalid_Switch and sets Full_Switch to return the invalid switch. -- When Getopt cannot find the parameter associated with a switch, it -- raises Invalid_Parameter, and sets Full_Switch to return the invalid ! -- switch character. -- -- Note: in case of ambiguity, e.g. switches a ab abc, then the longest -- matching switch is returned. --- 433,446 ---- -- Example -- Getopt ("* a b") -- If the command line is '-a -c toto.o -b', Getopt will return ! -- successively 'a', '*', '*' and 'b', with Full_Switch returning ! -- "a", "-c", "toto.o", and "b". -- -- When Getopt encounters an invalid switch, it raises the exception -- Invalid_Switch and sets Full_Switch to return the invalid switch. -- When Getopt cannot find the parameter associated with a switch, it -- raises Invalid_Parameter, and sets Full_Switch to return the invalid ! -- switch. -- -- Note: in case of ambiguity, e.g. switches a ab abc, then the longest -- matching switch is returned. *************** package GNAT.Command_Line is *** 416,448 **** function Get_Argument (Do_Expansion : Boolean := False; Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Returns the next element on the command line which is not a switch. ! -- This function should not be called before Getopt has returned ! -- ASCII.NUL. -- ! -- If Expansion is True, then the parameter on the command line will be ! -- considered as a filename with wild cards, and will be expanded. The ! -- matching file names will be returned one at a time. When there are no ! -- more arguments on the command line, this function returns an empty ! -- string. This is useful in non-Unix systems for obtaining normal ! -- expansion of wild card references. function Parameter (Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Returns the parameter associated with the last switch returned by ! -- Getopt. If no parameter was associated with the last switch, or no ! -- previous call has been made to Get_Argument, raises Invalid_Parameter. ! -- If the last switch was associated with an optional argument and this ! -- argument was not found on the command line, Parameter returns an empty ! -- string. function Separator (Parser : Opt_Parser := Command_Line_Parser) return Character; -- The separator that was between the switch and its parameter. This is ! -- of little use in general, only if you want to know exactly what was on ! -- the command line. This is in general a single character, set to ! -- ASCII.NUL if the switch and the parameter were concatenated. A space is ! -- returned if the switch and its argument were in two separate arguments. type Expansion_Iterator is limited private; -- Type used during expansion of file names --- 460,508 ---- function Get_Argument (Do_Expansion : Boolean := False; Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Returns the next element on the command line that is not a switch. This ! -- function should not be called before Getopt has returned ASCII.NUL. -- ! -- If Do_Expansion is True, then the parameter on the command line will ! -- be considered as a filename with wild cards, and will be expanded. The ! -- matching file names will be returned one at a time. This is useful in ! -- non-Unix systems for obtaining normal expansion of wild card references. ! -- When there are no more arguments on the command line, this function ! -- returns an empty string. function Parameter (Parser : Opt_Parser := Command_Line_Parser) return String; ! -- Returns parameter associated with the last switch returned by Getopt. ! -- If no parameter was associated with the last switch, or no previous call ! -- has been made to Get_Argument, raises Invalid_Parameter. If the last ! -- switch was associated with an optional argument and this argument was ! -- not found on the command line, Parameter returns an empty string. function Separator (Parser : Opt_Parser := Command_Line_Parser) return Character; -- The separator that was between the switch and its parameter. This is ! -- useful if you want to know exactly what was on the command line. This ! -- is in general a single character, set to ASCII.NUL if the switch and ! -- the parameter were concatenated. A space is returned if the switch and ! -- its argument were in two separate arguments. ! ! Invalid_Section : exception; ! -- Raised when an invalid section is selected by Goto_Section ! ! Invalid_Switch : exception; ! -- Raised when an invalid switch is detected in the command line ! ! Invalid_Parameter : exception; ! -- Raised when a parameter is missing, or an attempt is made to obtain a ! -- parameter for a switch that does not allow a parameter ! ! ----------------------------------------- ! -- Expansion of command line arguments -- ! ----------------------------------------- ! -- These subprograms take care of of expanding globbing patterns on the ! -- command line. On Unix, such expansion is done by the shell before your ! -- application is called. But on Windows you must do this expansion ! -- yourself. type Expansion_Iterator is limited private; -- Type used during expansion of file names *************** package GNAT.Command_Line is *** 462,557 **** -- Subdirectories of Directory will also be searched, up to one -- hundred levels deep. -- ! -- When Start_Expansion has been called, function Expansion should be ! -- called repeatedly until it returns an empty string, before -- Start_Expansion can be called again with the same Expansion_Iterator -- variable. function Expansion (Iterator : Expansion_Iterator) return String; -- Returns the next file in the directory matching the parameters given -- to Start_Expansion and updates Iterator to point to the next entry. ! -- Returns an empty string when there is no more file in the directory ! -- and its subdirectories. -- -- If Expansion is called again after an empty string has been returned, -- then the exception GNAT.Directory_Operations.Directory_Error is raised. - Invalid_Section : exception; - -- Raised when an invalid section is selected by Goto_Section - - Invalid_Switch : exception; - -- Raised when an invalid switch is detected in the command line - - Invalid_Parameter : exception; - -- Raised when a parameter is missing, or an attempt is made to obtain a - -- parameter for a switch that does not allow a parameter - ----------------- -- Configuring -- ----------------- type Command_Line_Configuration is private; procedure Define_Alias (Config : in out Command_Line_Configuration; Switch : String; ! Expanded : String); -- Indicates that whenever Switch appears on the command line, it should -- be expanded as Expanded. For instance, for the GNAT compiler switches, -- we would define "-gnatwa" as an alias for "-gnatwcfijkmopruvz", ie some -- default warnings to be activated. -- ! -- Likewise, in some context you could define "--verbose" as an alias for ! -- ("-v", "--full"), ie two switches. procedure Define_Prefix ! (Config : in out Command_Line_Configuration; ! Prefix : String); -- Indicates that all switches starting with the given prefix should be ! -- grouped. For instance, for the GNAT compiler we would define "-gnatw" ! -- as a prefix, so that "-gnatwu -gnatwv" can be grouped into "-gnatwuv" ! -- It is assume that the remaining of the switch ("uv") is a set of ! -- characters whose order is irrelevant. In fact, this package will sort ! -- them alphabetically. procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Switch : String); -- Indicates a new switch. The format of this switch follows the getopt -- format (trailing ':', '?', etc for defining a switch with parameters). -- The switches defined in the command_line_configuration object are used -- when ungrouping switches with more that one character after the prefix. ! procedure Define_Section ! (Config : in out Command_Line_Configuration; ! Section : String); ! -- Indicates a new switch section. Every switch belonging to the same ! -- section are ordered together, preceded by the section. They are placed ! -- at the end of the command line (as in 'gnatmake somefile.adb -cargs -g') function Get_Switches (Config : Command_Line_Configuration; ! Switch_Char : Character) return String; ! -- Get the switches list as expected by getopt. This list is built using ! -- all switches defined previously via Define_Switch above. procedure Free (Config : in out Command_Line_Configuration); -- Free the memory used by Config ! ------------- ! -- Editing -- ! ------------- type Command_Line is private; procedure Set_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; --- 522,776 ---- -- Subdirectories of Directory will also be searched, up to one -- hundred levels deep. -- ! -- When Start_Expansion has been called, function Expansion should ! -- be called repeatedly until it returns an empty string, before -- Start_Expansion can be called again with the same Expansion_Iterator -- variable. function Expansion (Iterator : Expansion_Iterator) return String; -- Returns the next file in the directory matching the parameters given -- to Start_Expansion and updates Iterator to point to the next entry. ! -- Returns an empty string when there are no more files. -- -- If Expansion is called again after an empty string has been returned, -- then the exception GNAT.Directory_Operations.Directory_Error is raised. ----------------- -- Configuring -- ----------------- + -- The following subprograms are used to manipulate a command line + -- represented as a string (for instance "-g -O2"), as well as parsing + -- the switches from such a string. They provide high-level configurations + -- to define aliases (a switch is equivalent to one or more other switches) + -- or grouping of switches ("-gnatyac" is equivalent to "-gnatya" and + -- "-gnatyc"). + + -- See the top of this file for examples on how to use these subprograms + type Command_Line_Configuration is private; + procedure Define_Section + (Config : in out Command_Line_Configuration; + Section : String); + -- Indicates a new switch section. All switches belonging to the same + -- section are ordered together, preceded by the section. They are placed + -- at the end of the command line (as in "gnatmake somefile.adb -cargs -g") + -- + -- The section name should not include the leading '-'. So for instance in + -- the case of gnatmake we would use: + -- + -- Define_Section (Config, "cargs"); + -- Define_Section (Config, "bargs"); + procedure Define_Alias (Config : in out Command_Line_Configuration; Switch : String; ! Expanded : String; ! Section : String := ""); -- Indicates that whenever Switch appears on the command line, it should -- be expanded as Expanded. For instance, for the GNAT compiler switches, -- we would define "-gnatwa" as an alias for "-gnatwcfijkmopruvz", ie some -- default warnings to be activated. -- ! -- This expansion is only done within the specified section, which must ! -- have been defined first through a call to [Define_Section]. procedure Define_Prefix ! (Config : in out Command_Line_Configuration; ! Prefix : String); -- Indicates that all switches starting with the given prefix should be ! -- grouped. For instance, for the GNAT compiler we would define "-gnatw" as ! -- a prefix, so that "-gnatwu -gnatwv" can be grouped into "-gnatwuv" It is ! -- assumed that the remainder of the switch ("uv") is a set of characters ! -- whose order is irrelevant. In fact, this package will sort them ! -- alphabetically. procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := ""); -- Indicates a new switch. The format of this switch follows the getopt -- format (trailing ':', '?', etc for defining a switch with parameters). + -- + -- Switch should also start with the leading '-' (or any other characters). + -- They should all start with the same character, though. If this + -- character is not '-', you will need to call Initialize_Option_Scan to + -- set the proper character for the parser. + -- -- The switches defined in the command_line_configuration object are used -- when ungrouping switches with more that one character after the prefix. + -- + -- Switch and Long_Switch (when specified) are aliases and can be used + -- interchangeably. There is no check that they both take an argument or + -- both take no argument. + -- Switch can be set to "*" to indicate that any switch is supported (in + -- which case Getopt will return '*', see its documentation). + -- + -- Help is used by the Display_Help procedure to describe the supported + -- switches. + -- + -- In_Section indicates in which section the switch is valid (you need to + -- first define the section through a call to Define_Section). ! procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Output : access Boolean; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := ""; ! Value : Boolean := True); ! -- See Define_Switch for a description of the parameters. ! -- When the switch is found on the command line, Getopt will set ! -- Output.all to Value. ! -- Output is always initially set to "not Value", so that if the switch is ! -- not found on the command line, Output still has a valid value. ! -- The switch must not take any parameter. ! -- Output must exist at least as long as Config, otherwise erroneous memory ! -- access may happen. ! ! procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Output : access Integer; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := ""; ! Initial : Integer := 0; ! Default : Integer := 1); ! -- See Define_Switch for a description of the parameters. ! -- When the switch is found on the command line, Getopt will set ! -- Output.all to the value of the switch's parameter. If the parameter is ! -- not an integer, Invalid_Parameter is raised. ! -- Output is always initialized to Initial. If the switch has an optional ! -- argument which isn't specified by the user, then Output will be set to ! -- Default. ! ! procedure Define_Switch ! (Config : in out Command_Line_Configuration; ! Output : access GNAT.Strings.String_Access; ! Switch : String := ""; ! Long_Switch : String := ""; ! Help : String := ""; ! Section : String := ""); ! -- Set Output to the value of the switch's parameter when the switch is ! -- found on the command line. ! -- Output is always initialized to the empty string. ! ! procedure Set_Usage ! (Config : in out Command_Line_Configuration; ! Usage : String := "[switches] [arguments]"; ! Help : String := ""); ! -- Defines the general format of the call to the application, and a short ! -- help text. These are both displayed by Display_Help ! ! procedure Display_Help (Config : Command_Line_Configuration); ! -- Display the help for the tool (ie its usage, and its supported switches) function Get_Switches (Config : Command_Line_Configuration; ! Switch_Char : Character := '-'; ! Section : String := "") return String; ! -- Get the switches list as expected by Getopt, for a specific section of ! -- the command line. This list is built using all switches defined ! -- previously via Define_Switch above. ! ! function Section_Delimiters ! (Config : Command_Line_Configuration) return String; ! -- Return a string suitable for use in Initialize_Option_Scan procedure Free (Config : in out Command_Line_Configuration); -- Free the memory used by Config ! type Switch_Handler is access procedure ! (Switch : String; ! Parameter : String; ! Section : String); ! -- Called when a switch is found on the command line. ! -- [Switch] includes any leading '-' that was specified in Define_Switch. ! -- This is slightly different from the functional version of Getopt above, ! -- for which Full_Switch omits the first leading '-'. ! ! Exit_From_Command_Line : exception; ! -- Emitted when the program should exit. ! -- This is called when Getopt below has seen -h, --help or an invalid ! -- switch. ! ! procedure Getopt ! (Config : Command_Line_Configuration; ! Callback : Switch_Handler := null; ! Parser : Opt_Parser := Command_Line_Parser); ! -- Similar to the standard Getopt function. ! -- For each switch found on the command line, this calls Callback. ! -- ! -- The list of valid switches are the ones from the configuration. The ! -- switches that were declared through Define_Switch with an Output ! -- parameter are never returned (and result in a modification of the Output ! -- variable). This function will in fact never call [Callback] if all ! -- switches were handled automatically and there is nothing left to do. ! -- ! -- This procedure automatically adds -h and --help to the valid switches, ! -- to display the help message and raises Exit_From_Command_Line. ! -- If an invalid switch is specified on the command line, this procedure ! -- will display an error message and raises Invalid_Switch again. ! -- ! -- This function automatically expands switches: ! -- * If Define_Prefix was called (for instance "-gnaty") and the user ! -- specifies "-gnatycb" on the command line, then Getopt returns ! -- "-gnatyc" and "-gnatyb" separately. ! -- * If Define_Alias was called (for instance "-gnatya = -gnatycb") then ! -- the latter is returned (in this case it also expands -gnaty as per ! -- the above. ! -- The goal is to make handling as easy as possible by leaving as much ! -- work as possible to this package. ! -- ! -- As opposed to the standard Getopt, this one will analyze all sections ! -- as defined by Define_Section, and automatically jump from one section to ! -- the next. ! ! ------------------------------ ! -- Generating command lines -- ! ------------------------------ ! ! -- Once the command line configuration has been created, you can build your ! -- own command line. This will be done in general because you need to spawn ! -- external tools from your application. ! ! -- Although it could be done by concatenating strings, the following ! -- subprograms will properly take care of grouping switches when possible, ! -- so as to keep the command line as short as possible. They also provide a ! -- way to remove a switch from an existing command line. ! ! -- For instance: ! -- declare ! -- Config : Command_Line_Configuration; ! -- Line : Command_Line; ! -- Args : Argument_List_Access; ! -- begin ! -- Define_Switch (Config, "-gnatyc"); ! -- Define_Switch (Config, ...); -- for all valid switches ! -- Define_Prefix (Config, "-gnaty"); ! -- ! -- Set_Configuration (Line, Config); ! -- Add_Switch (Line, "-O2"); ! -- Add_Switch (Line, "-gnatyc"); ! -- Add_Switch (Line, "-gnatyd"); ! -- ! -- Build (Line, Args); ! -- -- Args is now ["-O2", "-gnatycd"] ! -- end; type Command_Line is private; procedure Set_Configuration (Cmd : in out Command_Line; Config : Command_Line_Configuration); function Get_Configuration (Cmd : Command_Line) return Command_Line_Configuration; ! -- Set or retrieve the configuration used for that command line procedure Set_Command_Line (Cmd : in out Command_Line; *************** package GNAT.Command_Line is *** 562,568 **** -- version with Switches. -- -- The parsing of Switches is done through calls to Getopt, by passing ! -- Getopt_Description as an argument. (a "*" is automatically prepended so -- that all switches and command line arguments are accepted). -- -- To properly handle switches that take parameters, you should document --- 781,787 ---- -- version with Switches. -- -- The parsing of Switches is done through calls to Getopt, by passing ! -- Getopt_Description as an argument. (A "*" is automatically prepended so -- that all switches and command line arguments are accepted). -- -- To properly handle switches that take parameters, you should document *************** package GNAT.Command_Line is *** 571,578 **** -- Command_Line_Iterator (which might be fine depending on your -- application). -- ! -- If the command line has sections (such as -bargs -largs -cargs), then ! -- they should be listed in the Sections parameter (as "-bargs -cargs") -- -- This function can be used to reset Cmd by passing an empty string. --- 790,797 ---- -- Command_Line_Iterator (which might be fine depending on your -- application). -- ! -- If the command line has sections (such as -bargs -cargs), then they ! -- should be listed in the Sections parameter (as "-bargs -cargs"). -- -- This function can be used to reset Cmd by passing an empty string. *************** package GNAT.Command_Line is *** 600,615 **** -- to pass "--check=full" to Remove_Switch as well. -- -- A Switch with a parameter will never be grouped with another switch to ! -- avoid ambiguities as to who the parameter applies to. ! -- ! -- Separator is the character that goes between the switches and its ! -- parameter on the command line. If it is set to ASCII.NUL, then no ! -- separator is applied, and they are concatenated -- -- If the switch is part of a section, then it should be specified so that -- the switch is correctly placed in the command line, and the section -- added if not already present. For example, to add the -g switch into the ! -- -cargs section, you need to call (Cmd, "-g", Section => "-cargs") -- -- Add_Before allows insertion of the switch at the beginning of the -- command line. --- 819,836 ---- -- to pass "--check=full" to Remove_Switch as well. -- -- A Switch with a parameter will never be grouped with another switch to ! -- avoid ambiguities as to what the parameter applies to. -- -- If the switch is part of a section, then it should be specified so that -- the switch is correctly placed in the command line, and the section -- added if not already present. For example, to add the -g switch into the ! -- -cargs section, you need to call (Cmd, "-g", Section => "-cargs"). ! -- ! -- [Separator] is ignored, and kept for backward compatibility only. ! -- ??? It might be removed in future versions. ! -- ! -- Invalid_Section is raised if Section was not defined in the ! -- configuration of the command line. -- -- Add_Before allows insertion of the switch at the beginning of the -- command line. *************** package GNAT.Command_Line is *** 667,682 **** -- Remove a switch with a specific parameter. If Parameter is the empty -- string, then only a switch with no parameter will be removed. --------------- -- Iteration -- --------------- type Command_Line_Iterator is private; procedure Start (Cmd : in out Command_Line; Iter : in out Command_Line_Iterator; ! Expanded : Boolean); -- Start iterating over the command line arguments. If Expanded is true, -- then the arguments are not grouped and no alias is used. For instance, -- "-gnatwv" and "-gnatwu" would be returned instead of "-gnatwuv". --- 888,908 ---- -- Remove a switch with a specific parameter. If Parameter is the empty -- string, then only a switch with no parameter will be removed. + procedure Free (Cmd : in out Command_Line); + -- Free the memory used by Cmd + --------------- -- Iteration -- --------------- + -- When a command line was created with the above, you can then iterate + -- over its contents using the following iterator. type Command_Line_Iterator is private; procedure Start (Cmd : in out Command_Line; Iter : in out Command_Line_Iterator; ! Expanded : Boolean := False); -- Start iterating over the command line arguments. If Expanded is true, -- then the arguments are not grouped and no alias is used. For instance, -- "-gnatwv" and "-gnatwu" would be returned instead of "-gnatwuv". *************** package GNAT.Command_Line is *** 703,710 **** procedure Next (Iter : in out Command_Line_Iterator); -- Move to the next switch ! procedure Free (Cmd : in out Command_Line); ! -- Free the memory used by Cmd private --- 929,945 ---- procedure Next (Iter : in out Command_Line_Iterator); -- Move to the next switch ! procedure Build ! (Line : in out Command_Line; ! Args : out GNAT.OS_Lib.Argument_List_Access; ! Expanded : Boolean := False; ! Switch_Char : Character := '-'); ! -- This is a wrapper using the Command_Line_Iterator. It provides a simple ! -- way to get all switches (grouped as much as possible), and possibly ! -- create an Opt_Parser. ! -- ! -- Args must be freed by the caller. ! -- Expanded has the same meaning as in Start. private *************** private *** 800,812 **** end record; Command_Line_Parser_Data : aliased Opt_Parser_Data ! (Ada.Command_Line.Argument_Count); -- The internal data used when parsing the command line type Opt_Parser is access all Opt_Parser_Data; Command_Line_Parser : constant Opt_Parser := Command_Line_Parser_Data'Access; type Command_Line_Configuration_Record is record Prefixes : GNAT.OS_Lib.Argument_List_Access; -- The list of prefixes --- 1035,1084 ---- end record; Command_Line_Parser_Data : aliased Opt_Parser_Data ! (Ada.Command_Line.Argument_Count); -- The internal data used when parsing the command line type Opt_Parser is access all Opt_Parser_Data; Command_Line_Parser : constant Opt_Parser := Command_Line_Parser_Data'Access; + type Switch_Type is (Switch_Untyped, + Switch_Boolean, + Switch_Integer, + Switch_String); + + type Switch_Definition (Typ : Switch_Type := Switch_Untyped) is record + Switch : GNAT.OS_Lib.String_Access; + Long_Switch : GNAT.OS_Lib.String_Access; + Section : GNAT.OS_Lib.String_Access; + Help : GNAT.OS_Lib.String_Access; + + case Typ is + when Switch_Untyped => + null; + when Switch_Boolean => + Boolean_Output : access Boolean; + Boolean_Value : Boolean; -- will set Output to that value + when Switch_Integer => + Integer_Output : access Integer; + Integer_Initial : Integer; + Integer_Default : Integer; + when Switch_String => + String_Output : access GNAT.Strings.String_Access; + end case; + end record; + type Switch_Definitions is array (Natural range <>) of Switch_Definition; + type Switch_Definitions_List is access all Switch_Definitions; + -- [Switch] includes the leading '-' + + type Alias_Definition is record + Alias : GNAT.OS_Lib.String_Access; + Expansion : GNAT.OS_Lib.String_Access; + Section : GNAT.OS_Lib.String_Access; + end record; + type Alias_Definitions is array (Natural range <>) of Alias_Definition; + type Alias_Definitions_List is access all Alias_Definitions; + type Command_Line_Configuration_Record is record Prefixes : GNAT.OS_Lib.Argument_List_Access; -- The list of prefixes *************** private *** 814,824 **** Sections : GNAT.OS_Lib.Argument_List_Access; -- The list of sections ! Aliases : GNAT.OS_Lib.Argument_List_Access; ! Expansions : GNAT.OS_Lib.Argument_List_Access; ! -- The aliases (Both arrays have the same bounds) ! ! Switches : GNAT.OS_Lib.Argument_List_Access; -- List of expected switches (Used when expanding switch groups) end record; type Command_Line_Configuration is access Command_Line_Configuration_Record; --- 1086,1095 ---- Sections : GNAT.OS_Lib.Argument_List_Access; -- The list of sections ! Aliases : Alias_Definitions_List; ! Usage : GNAT.OS_Lib.String_Access; ! Help : GNAT.OS_Lib.String_Access; ! Switches : Switch_Definitions_List; -- List of expected switches (Used when expanding switch groups) end record; type Command_Line_Configuration is access Command_Line_Configuration_Record; diff -Nrcpad gcc-4.5.2/gcc/ada/g-comver.adb gcc-4.6.0/gcc/ada/g-comver.adb *** gcc-4.5.2/gcc/ada/g-comver.adb Thu Apr 9 12:10:15 2009 --- gcc-4.6.0/gcc/ada/g-comver.adb Fri Dec 3 04:48:56 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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,48 **** package body GNAT.Compiler_Version is ! Ver_Len_Max : constant := 64; -- This is logically a reference to Gnatvsn.Ver_Len_Max but we cannot -- import this directly since run-time units cannot WITH compiler units. Ver_Prefix : constant String := "GNAT Version: "; ! -- Prefix generated by binder GNAT_Version : constant String (1 .. Ver_Len_Max + Ver_Prefix'Length); pragma Import (C, GNAT_Version, "__gnat_version"); --- 37,49 ---- package body GNAT.Compiler_Version is ! Ver_Len_Max : constant := 256; -- This is logically a reference to Gnatvsn.Ver_Len_Max but we cannot -- import this directly since run-time units cannot WITH compiler units. Ver_Prefix : constant String := "GNAT Version: "; ! -- This is logically a reference to Gnatvsn.Ver_Prefix but we cannot ! -- import this directly since run-time units cannot WITH compiler units. GNAT_Version : constant String (1 .. Ver_Len_Max + Ver_Prefix'Length); pragma Import (C, GNAT_Version, "__gnat_version"); diff -Nrcpad gcc-4.5.2/gcc/ada/g-dirope.adb gcc-4.6.0/gcc/ada/g-dirope.adb *** gcc-4.5.2/gcc/ada/g-dirope.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/g-dirope.adb Fri Oct 8 10:04:58 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body GNAT.Directory_Operations i *** 719,729 **** Recursive : Boolean := False) is C_Dir_Name : constant String := Dir_Name & ASCII.NUL; - Current_Dir : constant Dir_Name_Str := Get_Current_Dir; Last : Integer; Str : String (1 .. Filename_Max); Success : Boolean; ! Working_Dir : Dir_Type; begin -- Remove the directory only if it is empty --- 719,728 ---- Recursive : Boolean := False) is C_Dir_Name : constant String := Dir_Name & ASCII.NUL; Last : Integer; Str : String (1 .. Filename_Max); Success : Boolean; ! Current_Dir : Dir_Type; begin -- Remove the directory only if it is empty *************** package body GNAT.Directory_Operations i *** 736,786 **** -- Remove directory and all files and directories that it may contain else ! -- Substantial comments needed. See RH for revision 1.50 ??? ! ! begin ! Change_Dir (Dir_Name); ! Open (Working_Dir, "."); ! ! loop ! Read (Working_Dir, Str, Last); ! exit when Last = 0; ! if GNAT.OS_Lib.Is_Directory (Str (1 .. Last)) then ! if Str (1 .. Last) /= "." ! and then ! Str (1 .. Last) /= ".." ! then ! Remove_Dir (Str (1 .. Last), True); ! end if; ! else ! GNAT.OS_Lib.Delete_File (Str (1 .. Last), Success); ! if not Success then ! Change_Dir (Current_Dir); ! raise Directory_Error; ! end if; end if; - end loop; ! Change_Dir (Current_Dir); ! Close (Working_Dir); ! Remove_Dir (Dir_Name); ! ! exception ! when others => ! ! -- An exception occurred. We must make sure the current working ! -- directory is unchanged. ! ! Change_Dir (Current_Dir); ! -- What if the Change_Dir raises an exception itself, shouldn't ! -- that be protected? ??? ! raise; ! end; end if; end Remove_Dir; --- 735,774 ---- -- Remove directory and all files and directories that it may contain else ! Open (Current_Dir, Dir_Name); ! loop ! Read (Current_Dir, Str, Last); ! exit when Last = 0; ! if GNAT.OS_Lib.Is_Directory ! (Dir_Name & Dir_Separator & Str (1 .. Last)) ! then ! if Str (1 .. Last) /= "." ! and then ! Str (1 .. Last) /= ".." ! then ! -- Recursive call to remove a subdirectory and all its ! -- files. ! Remove_Dir ! (Dir_Name & Dir_Separator & Str (1 .. Last), ! True); end if; ! else ! GNAT.OS_Lib.Delete_File ! (Dir_Name & Dir_Separator & Str (1 .. Last), ! Success); ! if not Success then ! raise Directory_Error; ! end if; ! end if; ! end loop; ! Close (Current_Dir); ! Remove_Dir (Dir_Name); end if; end Remove_Dir; diff -Nrcpad gcc-4.5.2/gcc/ada/g-dirope.ads gcc-4.6.0/gcc/ada/g-dirope.ads *** gcc-4.5.2/gcc/ada/g-dirope.ads Tue Apr 8 06:57:39 2008 --- gcc-4.6.0/gcc/ada/g-dirope.ads Tue Jun 22 17:04:37 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package GNAT.Directory_Operations is *** 209,216 **** -- Recognize both forms described above. -- -- System_Default ! -- Uses either UNIX on Unix and OpenVMS systems, or DOS on Windows and ! -- OS/2 depending on the running environment. --------------- -- Iterators -- --- 209,216 ---- -- Recognize both forms described above. -- -- System_Default ! -- Uses either UNIX on Unix and OpenVMS systems, or DOS on Windows, ! -- depending on the running environment. What about other OS's??? --------------- -- Iterators -- diff -Nrcpad gcc-4.5.2/gcc/ada/g-excact.ads gcc-4.6.0/gcc/ada/g-excact.ads *** gcc-4.5.2/gcc/ada/g-excact.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/g-excact.ads Mon Dec 20 07:26:57 2010 *************** with Ada.Exceptions; use Ada.Exceptions; *** 54,60 **** package GNAT.Exception_Actions is type Exception_Action is access ! procedure (Occurence : Exception_Occurrence); -- General callback type whenever an exception is raised. The callback -- procedure must not propagate an exception (execution of the program -- is erroneous if such an exception is propagated). --- 54,60 ---- package GNAT.Exception_Actions is type Exception_Action is access ! procedure (Occurrence : Exception_Occurrence); -- General callback type whenever an exception is raised. The callback -- procedure must not propagate an exception (execution of the program -- is erroneous if such an exception is propagated). diff -Nrcpad gcc-4.5.2/gcc/ada/g-expect-vms.adb gcc-4.6.0/gcc/ada/g-expect-vms.adb *** gcc-4.5.2/gcc/ada/g-expect-vms.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/g-expect-vms.adb Tue Jun 22 07:26:02 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package body GNAT.Expect is *** 50,55 **** --- 50,60 ---- Save_Output : File_Descriptor; Save_Error : File_Descriptor; + Expect_Process_Died : constant Expect_Match := -100; + Expect_Internal_Error : constant Expect_Match := -101; + -- Additional possible outputs of Expect_Internal. These are not visible in + -- the spec because the user will never see them. + procedure Expect_Internal (Descriptors : in out Array_Of_Pd; Result : out Expect_Match; *************** package body GNAT.Expect is *** 57,67 **** Full_Buffer : Boolean); -- Internal function used to read from the process Descriptor. -- ! -- Three outputs are possible: -- Result=Expect_Timeout, if no output was available before the timeout -- expired. -- Result=Expect_Full_Buffer, if Full_Buffer is True and some characters -- had to be discarded from the internal buffer of Descriptor. -- Result=, indicates how many characters were added to the -- internal buffer. These characters are from indexes -- Descriptor.Buffer_Index - Result + 1 .. Descriptor.Buffer_Index --- 62,75 ---- Full_Buffer : Boolean); -- Internal function used to read from the process Descriptor. -- ! -- Several outputs are possible: -- Result=Expect_Timeout, if no output was available before the timeout -- expired. -- Result=Expect_Full_Buffer, if Full_Buffer is True and some characters -- had to be discarded from the internal buffer of Descriptor. + -- Result=Express_Process_Died if one of the processes was terminated. + -- That process's Input_Fd is set to Invalid_FD + -- Result=Express_Internal_Error -- Result=, indicates how many characters were added to the -- internal buffer. These characters are from indexes -- Descriptor.Buffer_Index - Result + 1 .. Descriptor.Buffer_Index *************** package body GNAT.Expect is *** 209,215 **** Status : out Integer) is begin ! Close (Descriptor.Input_Fd); if Descriptor.Error_Fd /= Descriptor.Output_Fd then Close (Descriptor.Error_Fd); --- 217,225 ---- Status : out Integer) is begin ! if Descriptor.Input_Fd /= Invalid_FD then ! Close (Descriptor.Input_Fd); ! end if; if Descriptor.Error_Fd /= Descriptor.Output_Fd then Close (Descriptor.Error_Fd); *************** package body GNAT.Expect is *** 331,340 **** Expect_Internal (Descriptors, N, Timeout_Tmp, Full_Buffer); ! if N = Expect_Timeout or else N = Expect_Full_Buffer then ! Result := N; ! return; ! end if; -- Calculate the timeout for the next turn --- 341,357 ---- Expect_Internal (Descriptors, N, Timeout_Tmp, Full_Buffer); ! case N is ! when Expect_Internal_Error | Expect_Process_Died => ! raise Process_Died; ! ! when Expect_Timeout | Expect_Full_Buffer => ! Result := N; ! return; ! ! when others => ! null; -- See below ! end case; -- Calculate the timeout for the next turn *************** package body GNAT.Expect is *** 478,487 **** Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! if N = Expect_Timeout or else N = Expect_Full_Buffer then ! Result := N; ! return; ! end if; end loop; end Expect; --- 495,511 ---- Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! case N is ! when Expect_Internal_Error | Expect_Process_Died => ! raise Process_Died; ! ! when Expect_Timeout | Expect_Full_Buffer => ! Result := N; ! return; ! ! when others => ! null; -- Continue ! end case; end loop; end Expect; *************** package body GNAT.Expect is *** 500,506 **** for J in Descriptors'Range loop Descriptors (J) := Regexps (J).Descriptor; ! Reinitialize_Buffer (Regexps (J).Descriptor.all); end loop; loop --- 524,533 ---- for J in Descriptors'Range loop Descriptors (J) := Regexps (J).Descriptor; ! ! if Descriptors (J) /= null then ! Reinitialize_Buffer (Regexps (J).Descriptor.all); ! end if; end loop; loop *************** package body GNAT.Expect is *** 511,535 **** -- checking the regexps). for J in Regexps'Range loop ! Match (Regexps (J).Regexp.all, ! Regexps (J).Descriptor.Buffer ! (1 .. Regexps (J).Descriptor.Buffer_Index), ! Matched); ! if Matched (0) /= No_Match then ! Result := Expect_Match (J); ! Regexps (J).Descriptor.Last_Match_Start := Matched (0).First; ! Regexps (J).Descriptor.Last_Match_End := Matched (0).Last; ! return; end if; end loop; Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! if N = Expect_Timeout or else N = Expect_Full_Buffer then ! Result := N; ! return; ! end if; end loop; end Expect; --- 538,573 ---- -- checking the regexps). for J in Regexps'Range loop ! if Regexps (J).Regexp /= null ! and then Regexps (J).Descriptor /= null ! then ! Match (Regexps (J).Regexp.all, ! Regexps (J).Descriptor.Buffer ! (1 .. Regexps (J).Descriptor.Buffer_Index), ! Matched); ! if Matched (0) /= No_Match then ! Result := Expect_Match (J); ! Regexps (J).Descriptor.Last_Match_Start := Matched (0).First; ! Regexps (J).Descriptor.Last_Match_End := Matched (0).Last; ! return; ! end if; end if; end loop; Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! case N is ! when Expect_Internal_Error | Expect_Process_Died => ! raise Process_Died; ! ! when Expect_Timeout | Expect_Full_Buffer => ! Result := N; ! return; ! ! when others => ! null; -- Continue ! end case; end loop; end Expect; *************** package body GNAT.Expect is *** 549,569 **** N : Integer; type File_Descriptor_Array is ! array (Descriptors'Range) of File_Descriptor; Fds : aliased File_Descriptor_Array; ! type Integer_Array is array (Descriptors'Range) of Integer; Is_Set : aliased Integer_Array; begin for J in Descriptors'Range loop ! Fds (J) := Descriptors (J).Output_Fd; ! if Descriptors (J).Buffer_Size = 0 then ! Buffer_Size := Integer'Max (Buffer_Size, 4096); ! else ! Buffer_Size := ! Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size); end if; end loop; --- 587,616 ---- N : Integer; type File_Descriptor_Array is ! array (0 .. Descriptors'Length - 1) of File_Descriptor; Fds : aliased File_Descriptor_Array; + Fds_Count : Natural := 0; ! Fds_To_Descriptor : array (Fds'Range) of Integer; ! -- Maps file descriptor entries from Fds to entries in Descriptors. ! -- They do not have the same index when entries in Descriptors are null. ! ! type Integer_Array is array (Fds'Range) of Integer; Is_Set : aliased Integer_Array; begin for J in Descriptors'Range loop ! if Descriptors (J) /= null then ! Fds (Fds'First + Fds_Count) := Descriptors (J).Output_Fd; ! Fds_To_Descriptor (Fds'First + Fds_Count) := J; ! Fds_Count := Fds_Count + 1; ! if Descriptors (J).Buffer_Size = 0 then ! Buffer_Size := Integer'Max (Buffer_Size, 4096); ! else ! Buffer_Size := ! Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size); ! end if; end if; end loop; *************** package body GNAT.Expect is *** 572,590 **** -- Buffer used for input. This is allocated only once, not for -- every iteration of the loop begin -- Loop until we match or we have a timeout loop Num_Descriptors := ! Poll (Fds'Address, Fds'Length, Timeout, Is_Set'Address); case Num_Descriptors is -- Error? when -1 => ! raise Process_Died; -- Timeout? --- 619,641 ---- -- Buffer used for input. This is allocated only once, not for -- every iteration of the loop + D : Integer; + -- Index in Descriptors + begin -- Loop until we match or we have a timeout loop Num_Descriptors := ! Poll (Fds'Address, Fds_Count, Timeout, Is_Set'Address); case Num_Descriptors is -- Error? when -1 => ! Result := Expect_Internal_Error; ! return; -- Timeout? *************** package body GNAT.Expect is *** 595,609 **** -- Some input when others => ! for J in Descriptors'Range loop ! if Is_Set (J) = 1 then ! Buffer_Size := Descriptors (J).Buffer_Size; if Buffer_Size = 0 then Buffer_Size := 4096; end if; ! N := Read (Descriptors (J).Output_Fd, Buffer'Address, Buffer_Size); -- Error or End of file --- 646,662 ---- -- Some input when others => ! for F in Fds'Range loop ! if Is_Set (F) = 1 then ! D := Fds_To_Descriptor (F); ! ! Buffer_Size := Descriptors (D).Buffer_Size; if Buffer_Size = 0 then Buffer_Size := 4096; end if; ! N := Read (Descriptors (D).Output_Fd, Buffer'Address, Buffer_Size); -- Error or End of file *************** package body GNAT.Expect is *** 611,653 **** if N <= 0 then -- ??? Note that ddd tries again up to three times -- in that case. See LiterateA.C:174 ! raise Process_Died; else -- If there is no limit to the buffer size ! if Descriptors (J).Buffer_Size = 0 then declare ! Tmp : String_Access := Descriptors (J).Buffer; begin if Tmp /= null then ! Descriptors (J).Buffer := new String (1 .. Tmp'Length + N); ! Descriptors (J).Buffer (1 .. Tmp'Length) := Tmp.all; ! Descriptors (J).Buffer (Tmp'Length + 1 .. Tmp'Length + N) := Buffer (1 .. N); Free (Tmp); ! Descriptors (J).Buffer_Index := ! Descriptors (J).Buffer'Last; else ! Descriptors (J).Buffer := new String (1 .. N); ! Descriptors (J).Buffer.all := Buffer (1 .. N); ! Descriptors (J).Buffer_Index := N; end if; end; else -- Add what we read to the buffer ! if Descriptors (J).Buffer_Index + N > ! Descriptors (J).Buffer_Size then -- If the user wants to know when we have -- read more than the buffer can contain. --- 664,709 ---- if N <= 0 then -- ??? Note that ddd tries again up to three times -- in that case. See LiterateA.C:174 ! ! Descriptors (D).Input_Fd := Invalid_FD; ! Result := Expect_Process_Died; ! return; else -- If there is no limit to the buffer size ! if Descriptors (D).Buffer_Size = 0 then declare ! Tmp : String_Access := Descriptors (D).Buffer; begin if Tmp /= null then ! Descriptors (D).Buffer := new String (1 .. Tmp'Length + N); ! Descriptors (D).Buffer (1 .. Tmp'Length) := Tmp.all; ! Descriptors (D).Buffer (Tmp'Length + 1 .. Tmp'Length + N) := Buffer (1 .. N); Free (Tmp); ! Descriptors (D).Buffer_Index := ! Descriptors (D).Buffer'Last; else ! Descriptors (D).Buffer := new String (1 .. N); ! Descriptors (D).Buffer.all := Buffer (1 .. N); ! Descriptors (D).Buffer_Index := N; end if; end; else -- Add what we read to the buffer ! if Descriptors (D).Buffer_Index + N > ! Descriptors (D).Buffer_Size then -- If the user wants to know when we have -- read more than the buffer can contain. *************** package body GNAT.Expect is *** 660,692 **** -- Keep as much as possible from the buffer, -- and forget old characters. ! Descriptors (J).Buffer ! (1 .. Descriptors (J).Buffer_Size - N) := ! Descriptors (J).Buffer ! (N - Descriptors (J).Buffer_Size + ! Descriptors (J).Buffer_Index + 1 .. ! Descriptors (J).Buffer_Index); ! Descriptors (J).Buffer_Index := ! Descriptors (J).Buffer_Size - N; end if; -- Keep what we read in the buffer ! Descriptors (J).Buffer ! (Descriptors (J).Buffer_Index + 1 .. ! Descriptors (J).Buffer_Index + N) := Buffer (1 .. N); ! Descriptors (J).Buffer_Index := ! Descriptors (J).Buffer_Index + N; end if; -- Call each of the output filter with what we -- read. Call_Filters ! (Descriptors (J).all, Buffer (1 .. N), Output); ! Result := Expect_Match (N); return; end if; end if; --- 716,748 ---- -- Keep as much as possible from the buffer, -- and forget old characters. ! Descriptors (D).Buffer ! (1 .. Descriptors (D).Buffer_Size - N) := ! Descriptors (D).Buffer ! (N - Descriptors (D).Buffer_Size + ! Descriptors (D).Buffer_Index + 1 .. ! Descriptors (D).Buffer_Index); ! Descriptors (D).Buffer_Index := ! Descriptors (D).Buffer_Size - N; end if; -- Keep what we read in the buffer ! Descriptors (D).Buffer ! (Descriptors (D).Buffer_Index + 1 .. ! Descriptors (D).Buffer_Index + N) := Buffer (1 .. N); ! Descriptors (D).Buffer_Index := ! Descriptors (D).Buffer_Index + N; end if; -- Call each of the output filter with what we -- read. Call_Filters ! (Descriptors (D).all, Buffer (1 .. N), Output); ! Result := Expect_Match (D); return; end if; end if; *************** package body GNAT.Expect is *** 715,720 **** --- 771,795 ---- (Descriptor.Last_Match_Start .. Descriptor.Last_Match_End); end Expect_Out_Match; + ------------------------ + -- First_Dead_Process -- + ------------------------ + + function First_Dead_Process + (Regexp : Multiprocess_Regexp_Array) return Natural + is + begin + for R in Regexp'Range loop + if Regexp (R).Descriptor /= null + and then Regexp (R).Descriptor.Input_Fd = GNAT.OS_Lib.Invalid_FD + then + return R; + end if; + end loop; + + return 0; + end First_Dead_Process; + ----------- -- Flush -- ----------- *************** package body GNAT.Expect is *** 770,775 **** --- 845,862 ---- end loop; end Flush; + ---------- + -- Free -- + ---------- + + procedure Free (Regexp : in out Multiprocess_Regexp) is + procedure Unchecked_Free is new Ada.Unchecked_Deallocation + (Process_Descriptor'Class, Process_Descriptor_Access); + begin + Unchecked_Free (Regexp.Descriptor); + Free (Regexp.Regexp); + end Free; + ------------------------ -- Get_Command_Output -- ------------------------ *************** package body GNAT.Expect is *** 897,902 **** --- 984,998 ---- return Descriptor.Pid; end Get_Pid; + ----------------- + -- Has_Process -- + ----------------- + + function Has_Process (Regexp : Multiprocess_Regexp_Array) return Boolean is + begin + return Regexp /= (Regexp'Range => (null, null)); + end Has_Process; + --------------- -- Interrupt -- --------------- *************** package body GNAT.Expect is *** 1023,1028 **** --- 1119,1131 ---- Expect_Internal (Descriptors, Result, Timeout => 0, Full_Buffer => False); + + if Result = Expect_Internal_Error + or else Result = Expect_Process_Died + then + raise Process_Died; + end if; + Descriptor.Last_Match_End := Descriptor.Buffer_Index; -- Empty the buffer diff -Nrcpad gcc-4.5.2/gcc/ada/g-expect.adb gcc-4.6.0/gcc/ada/g-expect.adb *** gcc-4.5.2/gcc/ada/g-expect.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/g-expect.adb Mon Jun 21 14:23:35 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2010, 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- -- *************** package body GNAT.Expect is *** 45,50 **** --- 45,55 ---- type Array_Of_Pd is array (Positive range <>) of Process_Descriptor_Access; + Expect_Process_Died : constant Expect_Match := -100; + Expect_Internal_Error : constant Expect_Match := -101; + -- Additional possible outputs of Expect_Internal. These are not visible in + -- the spec because the user will never see them. + procedure Expect_Internal (Descriptors : in out Array_Of_Pd; Result : out Expect_Match; *************** package body GNAT.Expect is *** 52,62 **** Full_Buffer : Boolean); -- Internal function used to read from the process Descriptor. -- ! -- Three outputs are possible: -- Result=Expect_Timeout, if no output was available before the timeout -- expired. -- Result=Expect_Full_Buffer, if Full_Buffer is True and some characters -- had to be discarded from the internal buffer of Descriptor. -- Result=, indicates how many characters were added to the -- internal buffer. These characters are from indexes -- Descriptor.Buffer_Index - Result + 1 .. Descriptor.Buffer_Index --- 57,70 ---- Full_Buffer : Boolean); -- Internal function used to read from the process Descriptor. -- ! -- Several outputs are possible: -- Result=Expect_Timeout, if no output was available before the timeout -- expired. -- Result=Expect_Full_Buffer, if Full_Buffer is True and some characters -- had to be discarded from the internal buffer of Descriptor. + -- Result=Express_Process_Died if one of the processes was terminated. + -- That process's Input_Fd is set to Invalid_FD + -- Result=Express_Internal_Error -- Result=, indicates how many characters were added to the -- internal buffer. These characters are from indexes -- Descriptor.Buffer_Index - Result + 1 .. Descriptor.Buffer_Index *************** package body GNAT.Expect is *** 211,217 **** Next_Filter : Filter_List; begin ! Close (Descriptor.Input_Fd); if Descriptor.Error_Fd /= Descriptor.Output_Fd then Close (Descriptor.Error_Fd); --- 219,227 ---- Next_Filter : Filter_List; begin ! if Descriptor.Input_Fd /= Invalid_FD then ! Close (Descriptor.Input_Fd); ! end if; if Descriptor.Error_Fd /= Descriptor.Output_Fd then Close (Descriptor.Error_Fd); *************** package body GNAT.Expect is *** 344,353 **** Expect_Internal (Descriptors, N, Timeout_Tmp, Full_Buffer); ! if N = Expect_Timeout or else N = Expect_Full_Buffer then ! Result := N; ! return; ! end if; -- Calculate the timeout for the next turn --- 354,370 ---- Expect_Internal (Descriptors, N, Timeout_Tmp, Full_Buffer); ! case N is ! when Expect_Internal_Error | Expect_Process_Died => ! raise Process_Died; ! ! when Expect_Timeout | Expect_Full_Buffer => ! Result := N; ! return; ! ! when others => ! null; -- See below ! end case; -- Calculate the timeout for the next turn *************** package body GNAT.Expect is *** 493,502 **** Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! if N = Expect_Timeout or else N = Expect_Full_Buffer then ! Result := N; ! return; ! end if; end loop; end Expect; --- 510,526 ---- Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! case N is ! when Expect_Internal_Error | Expect_Process_Died => ! raise Process_Died; ! ! when Expect_Timeout | Expect_Full_Buffer => ! Result := N; ! return; ! ! when others => ! null; -- Continue ! end case; end loop; end Expect; *************** package body GNAT.Expect is *** 515,521 **** for J in Descriptors'Range loop Descriptors (J) := Regexps (J).Descriptor; ! Reinitialize_Buffer (Regexps (J).Descriptor.all); end loop; loop --- 539,548 ---- for J in Descriptors'Range loop Descriptors (J) := Regexps (J).Descriptor; ! ! if Descriptors (J) /= null then ! Reinitialize_Buffer (Regexps (J).Descriptor.all); ! end if; end loop; loop *************** package body GNAT.Expect is *** 526,550 **** -- checking the regexps). for J in Regexps'Range loop ! Match (Regexps (J).Regexp.all, ! Regexps (J).Descriptor.Buffer ! (1 .. Regexps (J).Descriptor.Buffer_Index), ! Matched); ! if Matched (0) /= No_Match then ! Result := Expect_Match (J); ! Regexps (J).Descriptor.Last_Match_Start := Matched (0).First; ! Regexps (J).Descriptor.Last_Match_End := Matched (0).Last; ! return; end if; end loop; Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! if N = Expect_Timeout or else N = Expect_Full_Buffer then ! Result := N; ! return; ! end if; end loop; end Expect; --- 553,588 ---- -- checking the regexps). for J in Regexps'Range loop ! if Regexps (J).Regexp /= null ! and then Regexps (J).Descriptor /= null ! then ! Match (Regexps (J).Regexp.all, ! Regexps (J).Descriptor.Buffer ! (1 .. Regexps (J).Descriptor.Buffer_Index), ! Matched); ! if Matched (0) /= No_Match then ! Result := Expect_Match (J); ! Regexps (J).Descriptor.Last_Match_Start := Matched (0).First; ! Regexps (J).Descriptor.Last_Match_End := Matched (0).Last; ! return; ! end if; end if; end loop; Expect_Internal (Descriptors, N, Timeout, Full_Buffer); ! case N is ! when Expect_Internal_Error | Expect_Process_Died => ! raise Process_Died; ! ! when Expect_Timeout | Expect_Full_Buffer => ! Result := N; ! return; ! ! when others => ! null; -- Continue ! end case; end loop; end Expect; *************** package body GNAT.Expect is *** 564,584 **** N : Integer; type File_Descriptor_Array is ! array (Descriptors'Range) of File_Descriptor; Fds : aliased File_Descriptor_Array; ! type Integer_Array is array (Descriptors'Range) of Integer; Is_Set : aliased Integer_Array; begin for J in Descriptors'Range loop ! Fds (J) := Descriptors (J).Output_Fd; ! if Descriptors (J).Buffer_Size = 0 then ! Buffer_Size := Integer'Max (Buffer_Size, 4096); ! else ! Buffer_Size := ! Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size); end if; end loop; --- 602,631 ---- N : Integer; type File_Descriptor_Array is ! array (0 .. Descriptors'Length - 1) of File_Descriptor; Fds : aliased File_Descriptor_Array; + Fds_Count : Natural := 0; ! Fds_To_Descriptor : array (Fds'Range) of Integer; ! -- Maps file descriptor entries from Fds to entries in Descriptors. ! -- They do not have the same index when entries in Descriptors are null. ! ! type Integer_Array is array (Fds'Range) of Integer; Is_Set : aliased Integer_Array; begin for J in Descriptors'Range loop ! if Descriptors (J) /= null then ! Fds (Fds'First + Fds_Count) := Descriptors (J).Output_Fd; ! Fds_To_Descriptor (Fds'First + Fds_Count) := J; ! Fds_Count := Fds_Count + 1; ! if Descriptors (J).Buffer_Size = 0 then ! Buffer_Size := Integer'Max (Buffer_Size, 4096); ! else ! Buffer_Size := ! Integer'Max (Buffer_Size, Descriptors (J).Buffer_Size); ! end if; end if; end loop; *************** package body GNAT.Expect is *** 587,605 **** -- Buffer used for input. This is allocated only once, not for -- every iteration of the loop begin -- Loop until we match or we have a timeout loop Num_Descriptors := ! Poll (Fds'Address, Fds'Length, Timeout, Is_Set'Address); case Num_Descriptors is -- Error? when -1 => ! raise Process_Died; -- Timeout? --- 634,656 ---- -- Buffer used for input. This is allocated only once, not for -- every iteration of the loop + D : Integer; + -- Index in Descriptors + begin -- Loop until we match or we have a timeout loop Num_Descriptors := ! Poll (Fds'Address, Fds_Count, Timeout, Is_Set'Address); case Num_Descriptors is -- Error? when -1 => ! Result := Expect_Internal_Error; ! return; -- Timeout? *************** package body GNAT.Expect is *** 610,624 **** -- Some input when others => ! for J in Descriptors'Range loop ! if Is_Set (J) = 1 then ! Buffer_Size := Descriptors (J).Buffer_Size; if Buffer_Size = 0 then Buffer_Size := 4096; end if; ! N := Read (Descriptors (J).Output_Fd, Buffer'Address, Buffer_Size); -- Error or End of file --- 661,677 ---- -- Some input when others => ! for F in Fds'Range loop ! if Is_Set (F) = 1 then ! D := Fds_To_Descriptor (F); ! ! Buffer_Size := Descriptors (D).Buffer_Size; if Buffer_Size = 0 then Buffer_Size := 4096; end if; ! N := Read (Descriptors (D).Output_Fd, Buffer'Address, Buffer_Size); -- Error or End of file *************** package body GNAT.Expect is *** 626,668 **** if N <= 0 then -- ??? Note that ddd tries again up to three times -- in that case. See LiterateA.C:174 ! raise Process_Died; else -- If there is no limit to the buffer size ! if Descriptors (J).Buffer_Size = 0 then declare ! Tmp : String_Access := Descriptors (J).Buffer; begin if Tmp /= null then ! Descriptors (J).Buffer := new String (1 .. Tmp'Length + N); ! Descriptors (J).Buffer (1 .. Tmp'Length) := Tmp.all; ! Descriptors (J).Buffer (Tmp'Length + 1 .. Tmp'Length + N) := Buffer (1 .. N); Free (Tmp); ! Descriptors (J).Buffer_Index := ! Descriptors (J).Buffer'Last; else ! Descriptors (J).Buffer := new String (1 .. N); ! Descriptors (J).Buffer.all := Buffer (1 .. N); ! Descriptors (J).Buffer_Index := N; end if; end; else -- Add what we read to the buffer ! if Descriptors (J).Buffer_Index + N > ! Descriptors (J).Buffer_Size then -- If the user wants to know when we have -- read more than the buffer can contain. --- 679,724 ---- if N <= 0 then -- ??? Note that ddd tries again up to three times -- in that case. See LiterateA.C:174 ! ! Descriptors (D).Input_Fd := Invalid_FD; ! Result := Expect_Process_Died; ! return; else -- If there is no limit to the buffer size ! if Descriptors (D).Buffer_Size = 0 then declare ! Tmp : String_Access := Descriptors (D).Buffer; begin if Tmp /= null then ! Descriptors (D).Buffer := new String (1 .. Tmp'Length + N); ! Descriptors (D).Buffer (1 .. Tmp'Length) := Tmp.all; ! Descriptors (D).Buffer (Tmp'Length + 1 .. Tmp'Length + N) := Buffer (1 .. N); Free (Tmp); ! Descriptors (D).Buffer_Index := ! Descriptors (D).Buffer'Last; else ! Descriptors (D).Buffer := new String (1 .. N); ! Descriptors (D).Buffer.all := Buffer (1 .. N); ! Descriptors (D).Buffer_Index := N; end if; end; else -- Add what we read to the buffer ! if Descriptors (D).Buffer_Index + N > ! Descriptors (D).Buffer_Size then -- If the user wants to know when we have -- read more than the buffer can contain. *************** package body GNAT.Expect is *** 675,707 **** -- Keep as much as possible from the buffer, -- and forget old characters. ! Descriptors (J).Buffer ! (1 .. Descriptors (J).Buffer_Size - N) := ! Descriptors (J).Buffer ! (N - Descriptors (J).Buffer_Size + ! Descriptors (J).Buffer_Index + 1 .. ! Descriptors (J).Buffer_Index); ! Descriptors (J).Buffer_Index := ! Descriptors (J).Buffer_Size - N; end if; -- Keep what we read in the buffer ! Descriptors (J).Buffer ! (Descriptors (J).Buffer_Index + 1 .. ! Descriptors (J).Buffer_Index + N) := Buffer (1 .. N); ! Descriptors (J).Buffer_Index := ! Descriptors (J).Buffer_Index + N; end if; -- Call each of the output filter with what we -- read. Call_Filters ! (Descriptors (J).all, Buffer (1 .. N), Output); ! Result := Expect_Match (N); return; end if; end if; --- 731,763 ---- -- Keep as much as possible from the buffer, -- and forget old characters. ! Descriptors (D).Buffer ! (1 .. Descriptors (D).Buffer_Size - N) := ! Descriptors (D).Buffer ! (N - Descriptors (D).Buffer_Size + ! Descriptors (D).Buffer_Index + 1 .. ! Descriptors (D).Buffer_Index); ! Descriptors (D).Buffer_Index := ! Descriptors (D).Buffer_Size - N; end if; -- Keep what we read in the buffer ! Descriptors (D).Buffer ! (Descriptors (D).Buffer_Index + 1 .. ! Descriptors (D).Buffer_Index + N) := Buffer (1 .. N); ! Descriptors (D).Buffer_Index := ! Descriptors (D).Buffer_Index + N; end if; -- Call each of the output filter with what we -- read. Call_Filters ! (Descriptors (D).all, Buffer (1 .. N), Output); ! Result := Expect_Match (D); return; end if; end if; *************** package body GNAT.Expect is *** 730,735 **** --- 786,809 ---- (Descriptor.Last_Match_Start .. Descriptor.Last_Match_End); end Expect_Out_Match; + ------------------------ + -- First_Dead_Process -- + ------------------------ + + function First_Dead_Process + (Regexp : Multiprocess_Regexp_Array) return Natural is + begin + for R in Regexp'Range loop + if Regexp (R).Descriptor /= null + and then Regexp (R).Descriptor.Input_Fd = GNAT.OS_Lib.Invalid_FD + then + return R; + end if; + end loop; + + return 0; + end First_Dead_Process; + ----------- -- Flush -- ----------- *************** package body GNAT.Expect is *** 785,790 **** --- 859,876 ---- end loop; end Flush; + ---------- + -- Free -- + ---------- + + procedure Free (Regexp : in out Multiprocess_Regexp) is + procedure Unchecked_Free is new Ada.Unchecked_Deallocation + (Process_Descriptor'Class, Process_Descriptor_Access); + begin + Unchecked_Free (Regexp.Descriptor); + Free (Regexp.Regexp); + end Free; + ------------------------ -- Get_Command_Output -- ------------------------ *************** package body GNAT.Expect is *** 915,920 **** --- 1001,1015 ---- return Descriptor.Pid; end Get_Pid; + ----------------- + -- Has_Process -- + ----------------- + + function Has_Process (Regexp : Multiprocess_Regexp_Array) return Boolean is + begin + return Regexp /= (Regexp'Range => (null, null)); + end Has_Process; + --------------- -- Interrupt -- --------------- *************** package body GNAT.Expect is *** 1136,1141 **** --- 1231,1243 ---- Expect_Internal (Descriptors, Result, Timeout => 0, Full_Buffer => False); + + if Result = Expect_Internal_Error + or else Result = Expect_Process_Died + then + raise Process_Died; + end if; + Descriptor.Last_Match_End := Descriptor.Buffer_Index; -- Empty the buffer diff -Nrcpad gcc-4.5.2/gcc/ada/g-expect.ads gcc-4.6.0/gcc/ada/g-expect.ads *** gcc-4.5.2/gcc/ada/g-expect.ads Wed May 6 08:11:41 2009 --- gcc-4.6.0/gcc/ada/g-expect.ads Fri Sep 10 15:14:10 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2010, 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- -- *************** package GNAT.Expect is *** 180,195 **** -- till Expect matches), but this is slower. -- -- If Err_To_Out is True, then the standard error of the spawned process is ! -- connected to the standard output. This is the only way to get the ! -- Except subprograms to also match on output on standard error. -- -- Invalid_Process is raised if the process could not be spawned. procedure Close (Descriptor : in out Process_Descriptor); ! -- Terminate the process and close the pipes to it. It implicitly ! -- does the 'wait' command required to clean up the process table. ! -- This also frees the buffer associated with the process id. Raise ! -- Invalid_Process if the process id is invalid. procedure Close (Descriptor : in out Process_Descriptor; --- 180,198 ---- -- till Expect matches), but this is slower. -- -- If Err_To_Out is True, then the standard error of the spawned process is ! -- connected to the standard output. This is the only way to get the Except ! -- subprograms to also match on output on standard error. -- -- Invalid_Process is raised if the process could not be spawned. + -- + -- For information about spawning processes from tasking programs, see the + -- "NOTE: Spawn in tasking programs" in System.OS_Lib (s-os_lib.ads). procedure Close (Descriptor : in out Process_Descriptor); ! -- Terminate the process and close the pipes to it. It implicitly does the ! -- 'wait' command required to clean up the process table. This also frees ! -- the buffer associated with the process id. Raise Invalid_Process if the ! -- process id is invalid. procedure Close (Descriptor : in out Process_Descriptor; *************** package GNAT.Expect is *** 247,254 **** (Descriptor : Process_Descriptor'Class; Str : String; User_Data : System.Address := System.Null_Address); ! -- Function called every time new characters are read from or written ! -- to the process. -- -- Str is a string of all these characters. -- --- 250,257 ---- (Descriptor : Process_Descriptor'Class; Str : String; User_Data : System.Address := System.Null_Address); ! -- Function called every time new characters are read from or written to ! -- the process. -- -- Str is a string of all these characters. -- *************** package GNAT.Expect is *** 301,309 **** Empty_Buffer : Boolean := False); -- Send a string to the file descriptor. -- ! -- The string is not formatted in any way, except if Add_LF is True, ! -- in which case an ASCII.LF is added at the end, so that Str is ! -- recognized as a command by the external process. -- -- If Empty_Buffer is True, any input waiting from the process (or in the -- buffer) is first discarded before the command is sent. The output --- 304,312 ---- Empty_Buffer : Boolean := False); -- Send a string to the file descriptor. -- ! -- The string is not formatted in any way, except if Add_LF is True, in ! -- which case an ASCII.LF is added at the end, so that Str is recognized ! -- as a command by the external process. -- -- If Empty_Buffer is True, any input waiting from the process (or in the -- buffer) is first discarded before the command is sent. The output *************** package GNAT.Expect is *** 330,337 **** Regexp : String; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Wait till a string matching Fd can be read from Fd, and return 1 ! -- if a match was found. -- -- It consumes all the characters read from Fd until a match found, and -- then sets the return values for the subprograms Expect_Out and --- 333,340 ---- Regexp : String; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Wait till a string matching Fd can be read from Fd, and return 1 if a ! -- match was found. -- -- It consumes all the characters read from Fd until a match found, and -- then sets the return values for the subprograms Expect_Out and *************** package GNAT.Expect is *** 402,416 **** type Regexp_Array is array (Positive range <>) of GNAT.OS_Lib.String_Access; type Pattern_Matcher_Access is access all GNAT.Regpat.Pattern_Matcher; ! type Compiled_Regexp_Array is array (Positive range <>) ! of Pattern_Matcher_Access; function "+" ! (P : GNAT.Regpat.Pattern_Matcher) ! return Pattern_Matcher_Access; ! -- Allocate some memory for the pattern matcher. ! -- This is only a convenience function to help create the array of ! -- compiled regular expressions. procedure Expect (Descriptor : in out Process_Descriptor; --- 405,417 ---- type Regexp_Array is array (Positive range <>) of GNAT.OS_Lib.String_Access; type Pattern_Matcher_Access is access all GNAT.Regpat.Pattern_Matcher; ! type Compiled_Regexp_Array is ! array (Positive range <>) of Pattern_Matcher_Access; function "+" ! (P : GNAT.Regpat.Pattern_Matcher) return Pattern_Matcher_Access; ! -- Allocate some memory for the pattern matcher. This is only a convenience ! -- function to help create the array of compiled regular expressions. procedure Expect (Descriptor : in out Process_Descriptor; *************** package GNAT.Expect is *** 441,446 **** --- 442,448 ---- Full_Buffer : Boolean := False); -- Same as above, except that you can also access the parenthesis -- groups inside the matching regular expression. + -- -- The first index in Matched must be 0, or Constraint_Error will be -- raised. The index 0 contains the indexes for the whole string that was -- matched, the index 1 contains the indexes for the first parentheses *************** package GNAT.Expect is *** 453,461 **** Matched : out GNAT.Regpat.Match_Array; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Same as above, but with precompiled regular expressions. ! -- The first index in Matched must be 0, or Constraint_Error will be ! -- raised. ------------------------------------------- -- Working on the output (multi-process) -- --- 455,462 ---- Matched : out GNAT.Regpat.Match_Array; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Same as above, but with precompiled regular expressions. The first index ! -- in Matched must be 0, or Constraint_Error will be raised. ------------------------------------------- -- Working on the output (multi-process) -- *************** package GNAT.Expect is *** 465,472 **** Descriptor : Process_Descriptor_Access; Regexp : Pattern_Matcher_Access; end record; ! type Multiprocess_Regexp_Array is array (Positive range <>) ! of Multiprocess_Regexp; procedure Expect (Result : out Expect_Match; --- 466,488 ---- Descriptor : Process_Descriptor_Access; Regexp : Pattern_Matcher_Access; end record; ! ! type Multiprocess_Regexp_Array is ! array (Positive range <>) of Multiprocess_Regexp; ! ! procedure Free (Regexp : in out Multiprocess_Regexp); ! -- Free the memory occupied by Regexp ! ! function Has_Process (Regexp : Multiprocess_Regexp_Array) return Boolean; ! -- Return True if at least one entry in Regexp is non-null, ie there is ! -- still at least one process to monitor ! ! function First_Dead_Process ! (Regexp : Multiprocess_Regexp_Array) return Natural; ! -- Find the first entry in Regexp that corresponds to a dead process that ! -- wasn't Free-d yet. This function is called in general when Expect ! -- (below) raises the exception Process_Died. This returns 0 if no process ! -- has died yet. procedure Expect (Result : out Expect_Match; *************** package GNAT.Expect is *** 474,488 **** Matched : out GNAT.Regpat.Match_Array; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Same as above, but for multi processes procedure Expect (Result : out Expect_Match; Regexps : Multiprocess_Regexp_Array; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Same as the previous one, but for multiple processes. ! -- This procedure finds the first regexp that match the associated process. ------------------------ -- Getting the output -- --- 490,526 ---- Matched : out GNAT.Regpat.Match_Array; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Same as above, but for multi processes. Any of the entries in ! -- Regexps can have a null Descriptor or Regexp. Such entries will ! -- simply be ignored. Therefore when a process terminates, you can ! -- simply reset its entry. ! -- ! -- The expect loop would therefore look like: ! -- ! -- Processes : Multiprocess_Regexp_Array (...) := ...; ! -- R : Natural; ! -- ! -- while Has_Process (Processes) loop ! -- begin ! -- Expect (Result, Processes, Timeout => -1); ! -- ... process output of process Result (output, full buffer,...) ! -- ! -- exception ! -- when Process_Died => ! -- -- Free memory ! -- R := First_Dead_Process (Processes); ! -- Close (Processes (R).Descriptor.all, Status); ! -- Free (Processes (R)); ! -- end; ! -- end loop; procedure Expect (Result : out Expect_Match; Regexps : Multiprocess_Regexp_Array; Timeout : Integer := 10_000; Full_Buffer : Boolean := False); ! -- Same as the previous one, but for multiple processes. This procedure ! -- finds the first regexp that match the associated process. ------------------------ -- Getting the output -- *************** package GNAT.Expect is *** 494,501 **** -- Discard all output waiting from the process. -- -- This output is simply discarded, and no filter is called. This output ! -- will also not be visible by the next call to Expect, nor will any ! -- output currently buffered. -- -- Timeout is the delay for which we wait for output to be available from -- the process. If 0, we only get what is immediately available. --- 532,539 ---- -- Discard all output waiting from the process. -- -- This output is simply discarded, and no filter is called. This output ! -- will also not be visible by the next call to Expect, nor will any output ! -- currently buffered. -- -- Timeout is the delay for which we wait for output to be available from -- the process. If 0, we only get what is immediately available. *************** package GNAT.Expect is *** 503,515 **** function Expect_Out (Descriptor : Process_Descriptor) return String; -- Return the string matched by the last Expect call. -- ! -- The returned string is in fact the concatenation of all the strings ! -- read from the file descriptor up to, and including, the characters ! -- that matched the regular expression. -- ! -- For instance, with an input "philosophic", and a regular expression ! -- "hi" in the call to expect, the strings returned the first and second ! -- time would be respectively "phi" and "losophi". function Expect_Out_Match (Descriptor : Process_Descriptor) return String; -- Return the string matched by the last Expect call. --- 541,553 ---- function Expect_Out (Descriptor : Process_Descriptor) return String; -- Return the string matched by the last Expect call. -- ! -- The returned string is in fact the concatenation of all the strings read ! -- from the file descriptor up to, and including, the characters that ! -- matched the regular expression. -- ! -- For instance, with an input "philosophic", and a regular expression "hi" ! -- in the call to expect, the strings returned the first and second time ! -- would be respectively "phi" and "losophi". function Expect_Out_Match (Descriptor : Process_Descriptor) return String; -- Return the string matched by the last Expect call. *************** private *** 573,582 **** Pipe3 : in out Pipe_Type; Cmd : String; Args : System.Address); ! -- Finish the set up of the pipes while in the child process ! -- This also spawns the child process (based on Cmd). ! -- On systems that support fork, this procedure is executed inside the ! -- newly created process. type Process_Descriptor is tagged record Pid : aliased Process_Id := Invalid_Pid; --- 611,619 ---- Pipe3 : in out Pipe_Type; Cmd : String; Args : System.Address); ! -- Finish the set up of the pipes while in the child process This also ! -- spawns the child process (based on Cmd). On systems that support fork, ! -- this procedure is executed inside the newly created process. type Process_Descriptor is tagged record Pid : aliased Process_Id := Invalid_Pid; *************** private *** 604,610 **** Args : System.Address); pragma Import (C, Portable_Execvp, "__gnat_expect_portable_execvp"); -- Executes, in a portable way, the command Cmd (full path must be ! -- specified), with the given Args. Args must be an array of string -- pointers. Note that the first element in Args must be the executable -- name, and the last element must be a null pointer. The returned value -- in Pid is the process ID, or zero if not supported on the platform. --- 641,647 ---- Args : System.Address); pragma Import (C, Portable_Execvp, "__gnat_expect_portable_execvp"); -- Executes, in a portable way, the command Cmd (full path must be ! -- specified), with the given Args, which must be an array of string -- pointers. Note that the first element in Args must be the executable -- name, and the last element must be a null pointer. The returned value -- in Pid is the process ID, or zero if not supported on the platform. diff -Nrcpad gcc-4.5.2/gcc/ada/g-htable.ads gcc-4.6.0/gcc/ada/g-htable.ads *** gcc-4.5.2/gcc/ada/g-htable.ads Wed Jul 15 09:42:04 2009 --- gcc-4.6.0/gcc/ada/g-htable.ads Mon Oct 11 10:43:04 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2010, 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- -- *************** package GNAT.HTable is *** 111,116 **** --- 111,130 ---- -- -- same function since the last call to Get_First or No_Element if -- -- there is no such element. If there is no call to 'Set' in between -- -- Get_Next calls, all the elements of the HTable will be traversed. + + -- procedure Get_First (K : out Key; E : out Element); + -- -- This version of the iterator returns a key/element pair. A non- + -- -- specified entry is returned, and there is no guarantee that two + -- -- calls to this procedure will return the same element. + + -- procedure Get_Next (K : out Key; E : out Element); + -- -- This version of the iterator returns a key/element pair. It + -- -- returns a non-specified element that has not been returned since + -- -- the last call to Get_First. If there is no remaining element, + -- -- then E is set to No_Element, and the value in K is undefined. + -- -- If there is no call to Set in between Get_Next calls, all the + -- -- elements of the HTable will be traversed. + -- end Simple_HTable; ------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/g-mbdira.adb gcc-4.6.0/gcc/ada/g-mbdira.adb *** gcc-4.5.2/gcc/ada/g-mbdira.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/g-mbdira.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,282 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- G N A T . M B B S _ D I S C R E T E _ R A N D O M -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Calendar; + + with Interfaces; use Interfaces; + + package body GNAT.MBBS_Discrete_Random is + + package Calendar renames Ada.Calendar; + + Fits_In_32_Bits : constant Boolean := + Rst'Size < 31 + or else (Rst'Size = 31 + and then Rst'Pos (Rst'First) < 0); + -- This is set True if we do not need more than 32 bits in the result. If + -- we need 64-bits, we will only use the meaningful 48 bits of any 64-bit + -- number generated, since if more than 48 bits are required, we split the + -- computation into two separate parts, since the algorithm does not behave + -- above 48 bits. + + -- The way this expression works is that obviously if the size is 31 bits, + -- it fits in 32 bits. In the 32-bit case, it fits in 32-bit signed if the + -- range has negative values. It is too conservative in the case that the + -- programmer has set a size greater than the default, e.g. a size of 33 + -- for an integer type with a range of 1..10, but an over-conservative + -- result is OK. The important thing is that the value is only True if + -- we know the result will fit in 32-bits signed. If the value is False + -- when it could be True, the behavior will be correct, just a bit less + -- efficient than it could have been in some unusual cases. + -- + -- One might assume that we could get a more accurate result by testing + -- the lower and upper bounds of the type Rst against the bounds of 32-bit + -- Integer. However, there is no easy way to do that. Why? Because in the + -- relatively rare case where this expression has to be evaluated at run + -- time rather than compile time (when the bounds are dynamic), we need a + -- type to use for the computation. But the possible range of upper bound + -- values for Rst (remembering the possibility of 64-bit modular types) is + -- from -2**63 to 2**64-1, and no run-time type has a big enough range. + + ----------------------- + -- Local Subprograms -- + ----------------------- + + function Square_Mod_N (X, N : Int) return Int; + pragma Inline (Square_Mod_N); + -- Computes X**2 mod N avoiding intermediate overflow + + ----------- + -- Image -- + ----------- + + function Image (Of_State : State) return String is + begin + return Int'Image (Of_State.X1) & + ',' & + Int'Image (Of_State.X2) & + ',' & + Int'Image (Of_State.Q); + end Image; + + ------------ + -- Random -- + ------------ + + function Random (Gen : Generator) return Rst is + S : State renames Gen.Writable.Self.Gen_State; + Temp : Int; + TF : Flt; + + begin + -- Check for flat range here, since we are typically run with checks + -- off, note that in practice, this condition will usually be static + -- so we will not actually generate any code for the normal case. + + if Rst'Last < Rst'First then + raise Constraint_Error; + end if; + + -- Continue with computation if non-flat range + + S.X1 := Square_Mod_N (S.X1, S.P); + S.X2 := Square_Mod_N (S.X2, S.Q); + Temp := S.X2 - S.X1; + + -- Following duplication is not an error, it is a loop unwinding! + + if Temp < 0 then + Temp := Temp + S.Q; + end if; + + if Temp < 0 then + Temp := Temp + S.Q; + end if; + + TF := Offs + (Flt (Temp) * Flt (S.P) + Flt (S.X1)) * S.Scl; + + -- Pathological, but there do exist cases where the rounding implicit + -- in calculating the scale factor will cause rounding to 'Last + 1. + -- In those cases, returning 'First results in the least bias. + + if TF >= Flt (Rst'Pos (Rst'Last)) + 0.5 then + return Rst'First; + + elsif not Fits_In_32_Bits then + return Rst'Val (Interfaces.Integer_64 (TF)); + + else + return Rst'Val (Int (TF)); + end if; + end Random; + + ----------- + -- Reset -- + ----------- + + procedure Reset (Gen : Generator; Initiator : Integer) is + S : State renames Gen.Writable.Self.Gen_State; + X1, X2 : Int; + + begin + X1 := 2 + Int (Initiator) mod (K1 - 3); + X2 := 2 + Int (Initiator) mod (K2 - 3); + + for J in 1 .. 5 loop + X1 := Square_Mod_N (X1, K1); + X2 := Square_Mod_N (X2, K2); + end loop; + + -- Eliminate effects of small Initiators + + S := + (X1 => X1, + X2 => X2, + P => K1, + Q => K2, + FP => K1F, + Scl => Scal); + end Reset; + + ----------- + -- Reset -- + ----------- + + procedure Reset (Gen : Generator) is + S : State renames Gen.Writable.Self.Gen_State; + Now : constant Calendar.Time := Calendar.Clock; + X1 : Int; + X2 : Int; + + begin + X1 := Int (Calendar.Year (Now)) * 12 * 31 + + Int (Calendar.Month (Now) * 31) + + Int (Calendar.Day (Now)); + + X2 := Int (Calendar.Seconds (Now) * Duration (1000.0)); + + X1 := 2 + X1 mod (K1 - 3); + X2 := 2 + X2 mod (K2 - 3); + + -- Eliminate visible effects of same day starts + + for J in 1 .. 5 loop + X1 := Square_Mod_N (X1, K1); + X2 := Square_Mod_N (X2, K2); + end loop; + + S := + (X1 => X1, + X2 => X2, + P => K1, + Q => K2, + FP => K1F, + Scl => Scal); + + end Reset; + + ----------- + -- Reset -- + ----------- + + procedure Reset (Gen : Generator; From_State : State) is + begin + Gen.Writable.Self.Gen_State := From_State; + end Reset; + + ---------- + -- Save -- + ---------- + + procedure Save (Gen : Generator; To_State : out State) is + begin + To_State := Gen.Gen_State; + end Save; + + ------------------ + -- Square_Mod_N -- + ------------------ + + function Square_Mod_N (X, N : Int) return Int is + begin + return Int ((Integer_64 (X) ** 2) mod (Integer_64 (N))); + end Square_Mod_N; + + ----------- + -- Value -- + ----------- + + function Value (Coded_State : String) return State is + Last : constant Natural := Coded_State'Last; + Start : Positive := Coded_State'First; + Stop : Positive := Coded_State'First; + Outs : State; + + begin + while Stop <= Last and then Coded_State (Stop) /= ',' loop + Stop := Stop + 1; + end loop; + + if Stop > Last then + raise Constraint_Error; + end if; + + Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1)); + Start := Stop + 1; + + loop + Stop := Stop + 1; + exit when Stop > Last or else Coded_State (Stop) = ','; + end loop; + + if Stop > Last then + raise Constraint_Error; + end if; + + Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1)); + Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last)); + Outs.P := Outs.Q * 2 + 1; + Outs.FP := Flt (Outs.P); + Outs.Scl := (RstL - RstF + 1.0) / (Flt (Outs.P) * Flt (Outs.Q)); + + -- Now do *some* sanity checks + + if Outs.Q < 31 + or else Outs.X1 not in 2 .. Outs.P - 1 + or else Outs.X2 not in 2 .. Outs.Q - 1 + then + raise Constraint_Error; + end if; + + return Outs; + end Value; + + end GNAT.MBBS_Discrete_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/g-mbdira.ads gcc-4.6.0/gcc/ada/g-mbdira.ads *** gcc-4.5.2/gcc/ada/g-mbdira.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/g-mbdira.ads Tue Jun 22 17:29:41 2010 *************** *** 0 **** --- 1,123 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- G N A T . M B B S _ D I S C R E T E _ R A N D O M -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 1992-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- The implementation used in this package was contributed by Robert + -- Eachus. It is based on the work of L. Blum, M. Blum, and M. Shub, SIAM + -- Journal of Computing, Vol 15. No 2, May 1986. The particular choices for P + -- and Q chosen here guarantee a period of 562,085,314,430,582 (about 2**49), + -- and the generated sequence has excellent randomness properties. For further + -- details, see the paper "Fast Generation of Trustworthy Random Numbers", by + -- Robert Eachus, which describes both the algorithm and the efficient + -- implementation approach used here. + + -- Formerly, this package was Ada.Numerics.Discrete_Random. It is retained + -- here in part to allow users to reconstruct number sequences generated + -- by previous versions. + + with Interfaces; + + generic + type Result_Subtype is (<>); + + package GNAT.MBBS_Discrete_Random is + + -- The algorithm used here is reliable from a required statistical point of + -- view only up to 48 bits. We try to behave reasonably in the case of + -- larger types, but we can't guarantee the required properties. So + -- generate a warning for these (slightly) dubious cases. + + pragma Compile_Time_Warning + (Result_Subtype'Size > 48, + "statistical properties not guaranteed for size > 48"); + + -- Basic facilities + + type Generator is limited private; + + function Random (Gen : Generator) return Result_Subtype; + + procedure Reset (Gen : Generator); + procedure Reset (Gen : Generator; Initiator : Integer); + + -- Advanced facilities + + type State is private; + + procedure Save (Gen : Generator; To_State : out State); + procedure Reset (Gen : Generator; From_State : State); + + Max_Image_Width : constant := 80; + + function Image (Of_State : State) return String; + function Value (Coded_State : String) return State; + + private + subtype Int is Interfaces.Integer_32; + subtype Rst is Result_Subtype; + + -- We prefer to use 14 digits for Flt, but some targets are more limited + + type Flt is digits Positive'Min (14, Long_Long_Float'Digits); + + RstF : constant Flt := Flt (Rst'Pos (Rst'First)); + RstL : constant Flt := Flt (Rst'Pos (Rst'Last)); + + Offs : constant Flt := RstF - 0.5; + + K1 : constant := 94_833_359; + K1F : constant := 94_833_359.0; + K2 : constant := 47_416_679; + K2F : constant := 47_416_679.0; + Scal : constant Flt := (RstL - RstF + 1.0) / (K1F * K2F); + + type State is record + X1 : Int := Int (2999 ** 2); + X2 : Int := Int (1439 ** 2); + P : Int := K1; + Q : Int := K2; + FP : Flt := K1F; + Scl : Flt := Scal; + end record; + + type Writable_Access (Self : access Generator) is limited null record; + -- Auxiliary type to make Generator a self-referential type + + type Generator is limited record + Writable : Writable_Access (Generator'Access); + -- This self reference allows functions to modify Generator arguments + Gen_State : State; + end record; + + end GNAT.MBBS_Discrete_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/g-mbflra.adb gcc-4.6.0/gcc/ada/g-mbflra.adb *** gcc-4.5.2/gcc/ada/g-mbflra.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/g-mbflra.adb Tue Jun 22 17:17:57 2010 *************** *** 0 **** --- 1,314 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- G N A T . M B B S _ F L O A T _ R A N D O M -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Ada.Calendar; + + package body GNAT.MBBS_Float_Random is + + ------------------------- + -- Implementation Note -- + ------------------------- + + -- The design of this spec is a bit awkward, as a result of Ada 95 not + -- permitting in-out parameters for function formals (most naturally + -- Generator values would be passed this way). In pure Ada 95, the only + -- solution would be to add a self-referential component to the generator + -- allowing access to the generator object from inside the function. This + -- would work because the generator is limited, which prevents any copy. + + -- This is a bit heavy, so what we do is to use Unrestricted_Access to + -- get a pointer to the state in the passed Generator. This works because + -- Generator is a limited type and will thus always be passed by reference. + + package Calendar renames Ada.Calendar; + + type Pointer is access all State; + + ----------------------- + -- Local Subprograms -- + ----------------------- + + procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int); + + function Euclid (P, Q : Int) return Int; + + function Square_Mod_N (X, N : Int) return Int; + + ------------ + -- Euclid -- + ------------ + + procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int) is + + XT : Int := 1; + YT : Int := 0; + + procedure Recur + (P, Q : Int; -- a (i-1), a (i) + X, Y : Int; -- x (i), y (i) + XP, YP : in out Int; -- x (i-1), y (i-1) + GCD : out Int); + + procedure Recur + (P, Q : Int; + X, Y : Int; + XP, YP : in out Int; + GCD : out Int) + is + Quo : Int := P / Q; -- q <-- |_ a (i-1) / a (i) _| + XT : Int := X; -- x (i) + YT : Int := Y; -- y (i) + + begin + if P rem Q = 0 then -- while does not divide + GCD := Q; + XP := X; + YP := Y; + else + Recur (Q, P - Q * Quo, XP - Quo * X, YP - Quo * Y, XT, YT, Quo); + + -- a (i) <== a (i) + -- a (i+1) <-- a (i-1) - q*a (i) + -- x (i+1) <-- x (i-1) - q*x (i) + -- y (i+1) <-- y (i-1) - q*y (i) + -- x (i) <== x (i) + -- y (i) <== y (i) + + XP := XT; + YP := YT; + GCD := Quo; + end if; + end Recur; + + -- Start of processing for Euclid + + begin + Recur (P, Q, 0, 1, XT, YT, GCD); + X := XT; + Y := YT; + end Euclid; + + function Euclid (P, Q : Int) return Int is + X, Y, GCD : Int; + pragma Unreferenced (Y, GCD); + begin + Euclid (P, Q, X, Y, GCD); + return X; + end Euclid; + + ----------- + -- Image -- + ----------- + + function Image (Of_State : State) return String is + begin + return Int'Image (Of_State.X1) & ',' & Int'Image (Of_State.X2) + & ',' & + Int'Image (Of_State.P) & ',' & Int'Image (Of_State.Q); + end Image; + + ------------ + -- Random -- + ------------ + + function Random (Gen : Generator) return Uniformly_Distributed is + Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; + + begin + Genp.X1 := Square_Mod_N (Genp.X1, Genp.P); + Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q); + return + Float ((Flt (((Genp.X2 - Genp.X1) * Genp.X) + mod Genp.Q) * Flt (Genp.P) + + Flt (Genp.X1)) * Genp.Scl); + end Random; + + ----------- + -- Reset -- + ----------- + + -- Version that works from given initiator value + + procedure Reset (Gen : Generator; Initiator : Integer) is + Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; + X1, X2 : Int; + + begin + X1 := 2 + Int (Initiator) mod (K1 - 3); + X2 := 2 + Int (Initiator) mod (K2 - 3); + + -- Eliminate effects of small initiators + + for J in 1 .. 5 loop + X1 := Square_Mod_N (X1, K1); + X2 := Square_Mod_N (X2, K2); + end loop; + + Genp.all := + (X1 => X1, + X2 => X2, + P => K1, + Q => K2, + X => 1, + Scl => Scal); + end Reset; + + -- Version that works from specific saved state + + procedure Reset (Gen : Generator; From_State : State) is + Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; + + begin + Genp.all := From_State; + end Reset; + + -- Version that works from calendar + + procedure Reset (Gen : Generator) is + Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; + Now : constant Calendar.Time := Calendar.Clock; + X1, X2 : Int; + + begin + X1 := Int (Calendar.Year (Now)) * 12 * 31 + + Int (Calendar.Month (Now)) * 31 + + Int (Calendar.Day (Now)); + + X2 := Int (Calendar.Seconds (Now) * Duration (1000.0)); + + X1 := 2 + X1 mod (K1 - 3); + X2 := 2 + X2 mod (K2 - 3); + + -- Eliminate visible effects of same day starts + + for J in 1 .. 5 loop + X1 := Square_Mod_N (X1, K1); + X2 := Square_Mod_N (X2, K2); + end loop; + + Genp.all := + (X1 => X1, + X2 => X2, + P => K1, + Q => K2, + X => 1, + Scl => Scal); + + end Reset; + + ---------- + -- Save -- + ---------- + + procedure Save (Gen : Generator; To_State : out State) is + begin + To_State := Gen.Gen_State; + end Save; + + ------------------ + -- Square_Mod_N -- + ------------------ + + function Square_Mod_N (X, N : Int) return Int is + Temp : constant Flt := Flt (X) * Flt (X); + Div : Int; + + begin + Div := Int (Temp / Flt (N)); + Div := Int (Temp - Flt (Div) * Flt (N)); + + if Div < 0 then + return Div + N; + else + return Div; + end if; + end Square_Mod_N; + + ----------- + -- Value -- + ----------- + + function Value (Coded_State : String) return State is + Last : constant Natural := Coded_State'Last; + Start : Positive := Coded_State'First; + Stop : Positive := Coded_State'First; + Outs : State; + + begin + while Stop <= Last and then Coded_State (Stop) /= ',' loop + Stop := Stop + 1; + end loop; + + if Stop > Last then + raise Constraint_Error; + end if; + + Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1)); + Start := Stop + 1; + + loop + Stop := Stop + 1; + exit when Stop > Last or else Coded_State (Stop) = ','; + end loop; + + if Stop > Last then + raise Constraint_Error; + end if; + + Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1)); + Start := Stop + 1; + + loop + Stop := Stop + 1; + exit when Stop > Last or else Coded_State (Stop) = ','; + end loop; + + if Stop > Last then + raise Constraint_Error; + end if; + + Outs.P := Int'Value (Coded_State (Start .. Stop - 1)); + Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last)); + Outs.X := Euclid (Outs.P, Outs.Q); + Outs.Scl := 1.0 / (Flt (Outs.P) * Flt (Outs.Q)); + + -- Now do *some* sanity checks + + if Outs.Q < 31 or else Outs.P < 31 + or else Outs.X1 not in 2 .. Outs.P - 1 + or else Outs.X2 not in 2 .. Outs.Q - 1 + then + raise Constraint_Error; + end if; + + return Outs; + end Value; + end GNAT.MBBS_Float_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/g-mbflra.ads gcc-4.6.0/gcc/ada/g-mbflra.ads *** gcc-4.5.2/gcc/ada/g-mbflra.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/g-mbflra.ads Tue Jun 22 15:32:18 2010 *************** *** 0 **** --- 1,103 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- G N A T . M B B S _ F L O A T _ R A N D O M -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 1992-2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- The implementation used in this package was contributed by + -- Robert Eachus. It is based on the work of L. Blum, M. Blum, and + -- M. Shub, SIAM Journal of Computing, Vol 15. No 2, May 1986. The + -- particular choices for P and Q chosen here guarantee a period of + -- 562,085,314,430,582 (about 2**49), and the generated sequence has + -- excellent randomness properties. For further details, see the + -- paper "Fast Generation of Trustworthy Random Numbers", by Robert + -- Eachus, which describes both the algorithm and the efficient + -- implementation approach used here. + + -- Formerly, this package was Ada.Numerics.Float_Random. It is retained + -- here in part to allow users to reconstruct number sequences generated + -- by previous versions. + + with Interfaces; + + package GNAT.MBBS_Float_Random is + + -- Basic facilities + + type Generator is limited private; + + subtype Uniformly_Distributed is Float range 0.0 .. 1.0; + + function Random (Gen : Generator) return Uniformly_Distributed; + + procedure Reset (Gen : Generator); + procedure Reset (Gen : Generator; Initiator : Integer); + + -- Advanced facilities + + type State is private; + + procedure Save (Gen : Generator; To_State : out State); + procedure Reset (Gen : Generator; From_State : State); + + Max_Image_Width : constant := 80; + + function Image (Of_State : State) return String; + function Value (Coded_State : String) return State; + + private + type Int is new Interfaces.Integer_32; + + -- We prefer to use 14 digits for Flt, but some targets are more limited + + type Flt is digits Positive'Min (14, Long_Long_Float'Digits); + + K1 : constant := 94_833_359; + K1F : constant := 94_833_359.0; + K2 : constant := 47_416_679; + K2F : constant := 47_416_679.0; + Scal : constant := 1.0 / (K1F * K2F); + + type State is record + X1 : Int := 2999 ** 2; -- Square mod p + X2 : Int := 1439 ** 2; -- Square mod q + P : Int := K1; + Q : Int := K2; + X : Int := 1; + Scl : Flt := Scal; + end record; + + type Generator is limited record + Gen_State : State; + end record; + + end GNAT.MBBS_Float_Random; diff -Nrcpad gcc-4.5.2/gcc/ada/g-pehage.adb gcc-4.6.0/gcc/ada/g-pehage.adb *** gcc-4.5.2/gcc/ada/g-pehage.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/g-pehage.adb Fri Sep 10 09:11:44 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** *** 31,37 **** -- -- ------------------------------------------------------------------------------ ! with Ada.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Heap_Sort_G; with GNAT.OS_Lib; use GNAT.OS_Lib; --- 31,39 ---- -- -- ------------------------------------------------------------------------------ ! with Ada.IO_Exceptions; use Ada.IO_Exceptions; ! with Ada.Characters.Handling; use Ada.Characters.Handling; ! with Ada.Directories; with GNAT.Heap_Sort_G; with GNAT.OS_Lib; use GNAT.OS_Lib; *************** package body GNAT.Perfect_Hash_Generator *** 143,148 **** --- 145,153 ---- -- Return a string which includes string Str or integer Int preceded by -- leading spaces if required by width W. + function Trim_Trailing_Nuls (Str : String) return String; + -- Return Str with trailing NUL characters removed + Output : File_Descriptor renames GNAT.OS_Lib.Standout; -- Shortcuts *************** package body GNAT.Perfect_Hash_Generator *** 213,218 **** --- 218,229 ---- procedure Put_Vertex_Table (File : File_Descriptor; Title : String); -- Output a title and a vertex table + function Ada_File_Base_Name (Pkg_Name : String) return String; + -- Return the base file name (i.e. without .ads/.adb extension) for an + -- Ada source file containing the named package, using the standard GNAT + -- file-naming convention. For example, if Pkg_Name is "Parent.Child", we + -- return "parent-child". + ---------------------------------- -- Character Position Selection -- ---------------------------------- *************** package body GNAT.Perfect_Hash_Generator *** 494,504 **** --- 505,533 ---- return True; end Acyclic; + ------------------------ + -- Ada_File_Base_Name -- + ------------------------ + + function Ada_File_Base_Name (Pkg_Name : String) return String is + begin + -- Convert to lower case, then replace '.' with '-' + + return Result : String := To_Lower (Pkg_Name) do + for J in Result'Range loop + if Result (J) = '.' then + Result (J) := '-'; + end if; + end loop; + end return; + end Ada_File_Base_Name; + --------- -- Add -- --------- procedure Add (C : Character) is + pragma Assert (C /= ASCII.NUL); begin Line (Last + 1) := C; Last := Last + 1; *************** package body GNAT.Perfect_Hash_Generator *** 511,516 **** --- 540,550 ---- procedure Add (S : String) is Len : constant Natural := S'Length; begin + for J in S'Range loop + pragma Assert (S (J) /= ASCII.NUL); + null; + end loop; + Line (Last + 1 .. Last + Len) := S; Last := Last + Len; end Add; *************** package body GNAT.Perfect_Hash_Generator *** 519,528 **** -- Allocate -- -------------- ! function Allocate (N : Natural; S : Natural := 1) return Table_Id is L : constant Integer := IT.Last; begin IT.Set_Last (L + N * S); return L + 1; end Allocate; --- 553,570 ---- -- Allocate -- -------------- ! function Allocate (N : Natural; S : Natural := 1) return Table_Id is L : constant Integer := IT.Last; begin IT.Set_Last (L + N * S); + + -- Initialize, so debugging printouts don't trip over uninitialized + -- components. + + for J in L + 1 .. IT.Last loop + IT.Table (J) := -1; + end loop; + return L + 1; end Allocate; *************** package body GNAT.Perfect_Hash_Generator *** 864,869 **** --- 906,916 ---- procedure Finalize is begin + if Verbose then + Put (Output, "Finalize"); + New_Line (Output); + end if; + -- Deallocate all the WT components (both initial and reduced -- ones) to avoid memory leaks. *************** package body GNAT.Perfect_Hash_Generator *** 1137,1146 **** procedure Initialize (Seed : Natural; K_To_V : Float := Default_K_To_V; ! Optim : Optimization := CPU_Time; Tries : Positive := Default_Tries) is begin -- Deallocate the part of the table concerning the reduced words. -- Initial words are already present in the table. We may have reduced -- words already there because a previous computation failed. We are --- 1184,1198 ---- procedure Initialize (Seed : Natural; K_To_V : Float := Default_K_To_V; ! Optim : Optimization := Memory_Space; Tries : Positive := Default_Tries) is begin + if Verbose then + Put (Output, "Initialize"); + New_Line (Output); + end if; + -- Deallocate the part of the table concerning the reduced words. -- Initial words are already present in the table. We may have reduced -- words already there because a previous computation failed. We are *************** package body GNAT.Perfect_Hash_Generator *** 1221,1226 **** --- 1273,1288 ---- Len : constant Natural := Value'Length; begin + if Verbose then + Put (Output, "Inserting """ & Value & """"); + New_Line (Output); + end if; + + for J in Value'Range loop + pragma Assert (Value (J) /= ASCII.NUL); + null; + end loop; + WT.Set_Last (NK); WT.Table (NK) := New_Word (Value); NK := NK + 1; *************** package body GNAT.Perfect_Hash_Generator *** 1369,1376 **** -- Produce -- ------------- ! procedure Produce (Pkg_Name : String := Default_Pkg_Name) is ! File : File_Descriptor; Status : Boolean; -- For call to Close --- 1431,1441 ---- -- Produce -- ------------- ! procedure Produce ! (Pkg_Name : String := Default_Pkg_Name; ! Use_Stdout : Boolean := False) ! is ! File : File_Descriptor := Standout; Status : Boolean; -- For call to Close *************** package body GNAT.Perfect_Hash_Generator *** 1462,1488 **** L : Natural; P : Natural; ! PLen : constant Natural := Pkg_Name'Length; ! FName : String (1 .. PLen + 4); -- Start of processing for Produce begin - FName (1 .. PLen) := Pkg_Name; - for J in 1 .. PLen loop - if FName (J) in 'A' .. 'Z' then - FName (J) := Character'Val (Character'Pos (FName (J)) - - Character'Pos ('A') - + Character'Pos ('a')); ! elsif FName (J) = '.' then ! FName (J) := '-'; ! end if; ! end loop; ! FName (PLen + 1 .. PLen + 4) := ".ads"; ! File := Create_File (FName, Binary); Put (File, "package "); Put (File, Pkg_Name); --- 1527,1553 ---- L : Natural; P : Natural; ! FName : String := Ada_File_Base_Name (Pkg_Name) & ".ads"; ! -- Initially, the name of the spec file, then modified to be the name of ! -- the body file. Not used if Use_Stdout is True. -- Start of processing for Produce begin ! if Verbose and then not Use_Stdout then ! Put (Output, ! "Producing " & Ada.Directories.Current_Directory & "/" & FName); ! New_Line (Output); ! end if; ! if not Use_Stdout then ! File := Create_File (FName, Binary); ! if File = Invalid_FD then ! raise Program_Error with "cannot create: " & FName; ! end if; ! end if; Put (File, "package "); Put (File, Pkg_Name); *************** package body GNAT.Perfect_Hash_Generator *** 1494,1508 **** Put (File, Pkg_Name); Put (File, ";"); New_Line (File); - Close (File, Status); ! if not Status then ! raise Device_Error; end if; ! FName (PLen + 4) := 'b'; ! File := Create_File (FName, Binary); Put (File, "with Interfaces; use Interfaces;"); New_Line (File); --- 1559,1585 ---- Put (File, Pkg_Name); Put (File, ";"); New_Line (File); ! if not Use_Stdout then ! Close (File, Status); ! ! if not Status then ! raise Device_Error; ! end if; end if; ! if not Use_Stdout then ! -- Set to body file name ! ! FName (FName'Last) := 'b'; ! ! File := Create_File (FName, Binary); ! ! if File = Invalid_FD then ! raise Program_Error with "cannot create: " & FName; ! end if; ! end if; Put (File, "with Interfaces; use Interfaces;"); New_Line (File); *************** package body GNAT.Perfect_Hash_Generator *** 1540,1578 **** New_Line (File); ! if Opt = CPU_Time then ! Put_Int_Matrix ! (File, ! Array_Img ("T1", Type_Img (NV), ! Range_Img (0, T1_Len - 1), ! Range_Img (0, T2_Len - 1, Type_Img (256))), ! T1, T1_Len, T2_Len); ! else ! Put_Int_Matrix ! (File, ! Array_Img ("T1", Type_Img (NV), ! Range_Img (0, T1_Len - 1)), ! T1, T1_Len, 0); ! end if; New_Line (File); ! if Opt = CPU_Time then ! Put_Int_Matrix ! (File, ! Array_Img ("T2", Type_Img (NV), ! Range_Img (0, T1_Len - 1), ! Range_Img (0, T2_Len - 1, Type_Img (256))), ! T2, T1_Len, T2_Len); ! else ! Put_Int_Matrix ! (File, ! Array_Img ("T2", Type_Img (NV), ! Range_Img (0, T1_Len - 1)), ! T2, T1_Len, 0); ! end if; New_Line (File); --- 1617,1657 ---- New_Line (File); ! case Opt is ! when CPU_Time => ! Put_Int_Matrix ! (File, ! Array_Img ("T1", Type_Img (NV), ! Range_Img (0, T1_Len - 1), ! Range_Img (0, T2_Len - 1, Type_Img (256))), ! T1, T1_Len, T2_Len); ! when Memory_Space => ! Put_Int_Matrix ! (File, ! Array_Img ("T1", Type_Img (NV), ! Range_Img (0, T1_Len - 1)), ! T1, T1_Len, 0); ! end case; New_Line (File); ! case Opt is ! when CPU_Time => ! Put_Int_Matrix ! (File, ! Array_Img ("T2", Type_Img (NV), ! Range_Img (0, T1_Len - 1), ! Range_Img (0, T2_Len - 1, Type_Img (256))), ! T2, T1_Len, T2_Len); ! when Memory_Space => ! Put_Int_Matrix ! (File, ! Array_Img ("T2", Type_Img (NV), ! Range_Img (0, T1_Len - 1)), ! T2, T1_Len, 0); ! end case; New_Line (File); *************** package body GNAT.Perfect_Hash_Generator *** 1594,1604 **** Put (File, " J : "); ! if Opt = CPU_Time then ! Put (File, Type_Img (256)); ! else ! Put (File, "Natural"); ! end if; Put (File, ";"); New_Line (File); --- 1673,1684 ---- Put (File, " J : "); ! case Opt is ! when CPU_Time => ! Put (File, Type_Img (256)); ! when Memory_Space => ! Put (File, "Natural"); ! end case; Put (File, ";"); New_Line (File); *************** package body GNAT.Perfect_Hash_Generator *** 1611,1621 **** New_Line (File); Put (File, " J := "); ! if Opt = CPU_Time then ! Put (File, "C"); ! else ! Put (File, "Character'Pos"); ! end if; Put (File, " (S (P (K) + F));"); New_Line (File); --- 1691,1702 ---- New_Line (File); Put (File, " J := "); ! case Opt is ! when CPU_Time => ! Put (File, "C"); ! when Memory_Space => ! Put (File, "Character'Pos"); ! end case; Put (File, " (S (P (K) + F));"); New_Line (File); *************** package body GNAT.Perfect_Hash_Generator *** 1670,1679 **** Put (File, Pkg_Name); Put (File, ";"); New_Line (File); - Close (File, Status); ! if not Status then ! raise Device_Error; end if; end Produce; --- 1751,1763 ---- Put (File, Pkg_Name); Put (File, ";"); New_Line (File); ! if not Use_Stdout then ! Close (File, Status); ! ! if not Status then ! raise Device_Error; ! end if; end if; end Produce; *************** package body GNAT.Perfect_Hash_Generator *** 1684,1689 **** --- 1768,1778 ---- procedure Put (File : File_Descriptor; Str : String) is Len : constant Natural := Str'Length; begin + for J in Str'Range loop + pragma Assert (Str (J) /= ASCII.NUL); + null; + end loop; + if Write (File, Str'Address, Len) /= Len then raise Program_Error; end if; *************** package body GNAT.Perfect_Hash_Generator *** 1726,1738 **** Last := 0; end if; ! if Last + Len + 3 > Max then Flush; end if; if Last = 0 then ! Line (Last + 1 .. Last + 5) := " "; ! Last := Last + 5; if F1 <= L1 then if C1 = F1 and then C2 = F2 then --- 1815,1826 ---- Last := 0; end if; ! if Last + Len + 3 >= Max then Flush; end if; if Last = 0 then ! Add (" "); if F1 <= L1 then if C1 = F1 and then C2 = F2 then *************** package body GNAT.Perfect_Hash_Generator *** 1759,1766 **** Add (' '); end if; ! Line (Last + 1 .. Last + Len) := S; ! Last := Last + Len; if C2 = L2 then Add (')'); --- 1847,1853 ---- Add (' '); end if; ! Add (S); if C2 = L2 then Add (')'); *************** package body GNAT.Perfect_Hash_Generator *** 1827,1833 **** K := Get_Key (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2); ! Put (File, WT.Table (Initial (J)).all, F1, L1, J, 1, 3, 3); end loop; end Put_Initial_Keys; --- 1914,1921 ---- K := Get_Key (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2); ! Put (File, Trim_Trailing_Nuls (WT.Table (Initial (J)).all), ! F1, L1, J, 1, 3, 3); end loop; end Put_Initial_Keys; *************** package body GNAT.Perfect_Hash_Generator *** 1908,1914 **** K := Get_Key (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2); ! Put (File, WT.Table (Reduced (J)).all, F1, L1, J, 1, 3, 3); end loop; end Put_Reduced_Keys; --- 1996,2003 ---- K := Get_Key (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2); ! Put (File, Trim_Trailing_Nuls (WT.Table (Reduced (J)).all), ! F1, L1, J, 1, 3, 3); end loop; end Put_Reduced_Keys; *************** package body GNAT.Perfect_Hash_Generator *** 2295,2301 **** Same_Keys_Sets_Table (J).First .. Same_Keys_Sets_Table (J).Last loop ! Put (Output, WT.Table (Reduced (K)).all); New_Line (Output); end loop; Put (Output, "--"); --- 2384,2391 ---- Same_Keys_Sets_Table (J).First .. Same_Keys_Sets_Table (J).Last loop ! Put (Output, ! Trim_Trailing_Nuls (WT.Table (Reduced (K)).all)); New_Line (Output); end loop; Put (Output, "--"); *************** package body GNAT.Perfect_Hash_Generator *** 2428,2451 **** R : Natural; begin ! if Opt = CPU_Time then ! for J in 0 .. T1_Len - 1 loop ! exit when Word (J + 1) = ASCII.NUL; ! R := Get_Table (Table, J, Get_Used_Char (Word (J + 1))); ! S := (S + R) mod NV; ! end loop; ! else ! for J in 0 .. T1_Len - 1 loop ! exit when Word (J + 1) = ASCII.NUL; ! R := Get_Table (Table, J, 0); ! S := (S + R * Character'Pos (Word (J + 1))) mod NV; ! end loop; ! end if; return S; end Sum; --------------- -- Type_Size -- --------------- --- 2518,2557 ---- R : Natural; begin ! case Opt is ! when CPU_Time => ! for J in 0 .. T1_Len - 1 loop ! exit when Word (J + 1) = ASCII.NUL; ! R := Get_Table (Table, J, Get_Used_Char (Word (J + 1))); ! S := (S + R) mod NV; ! end loop; ! when Memory_Space => ! for J in 0 .. T1_Len - 1 loop ! exit when Word (J + 1) = ASCII.NUL; ! R := Get_Table (Table, J, 0); ! S := (S + R * Character'Pos (Word (J + 1))) mod NV; ! end loop; ! end case; return S; end Sum; + ------------------------ + -- Trim_Trailing_Nuls -- + ------------------------ + + function Trim_Trailing_Nuls (Str : String) return String is + begin + for J in reverse Str'Range loop + if Str (J) /= ASCII.NUL then + return Str (Str'First .. J); + end if; + end loop; + + return Str; + end Trim_Trailing_Nuls; + --------------- -- Type_Size -- --------------- diff -Nrcpad gcc-4.5.2/gcc/ada/g-pehage.ads gcc-4.6.0/gcc/ada/g-pehage.ads *** gcc-4.5.2/gcc/ada/g-pehage.ads Tue Apr 7 16:22:41 2009 --- gcc-4.6.0/gcc/ada/g-pehage.ads Fri Sep 10 09:31:02 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package GNAT.Perfect_Hash_Generators is *** 86,93 **** -- number of tries. type Optimization is (Memory_Space, CPU_Time); ! Default_Optimization : constant Optimization := CPU_Time; ! -- Optimize either the memory space or the execution time Verbose : Boolean := False; -- Output the status of the algorithm. For instance, the tables, the random --- 86,94 ---- -- number of tries. type Optimization is (Memory_Space, CPU_Time); ! -- Optimize either the memory space or the execution time. Note: in ! -- practice, the optimization mode has little effect on speed. The tables ! -- are somewhat smaller with Memory_Space. Verbose : Boolean := False; -- Output the status of the algorithm. For instance, the tables, the random *************** package GNAT.Perfect_Hash_Generators is *** 97,103 **** procedure Initialize (Seed : Natural; K_To_V : Float := Default_K_To_V; ! Optim : Optimization := CPU_Time; Tries : Positive := Default_Tries); -- Initialize the generator and its internal structures. Set the ratio of -- vertices over keys in the random graphs. This value has to be greater --- 98,104 ---- procedure Initialize (Seed : Natural; K_To_V : Float := Default_K_To_V; ! Optim : Optimization := Memory_Space; Tries : Positive := Default_Tries); -- Initialize the generator and its internal structures. Set the ratio of -- vertices over keys in the random graphs. This value has to be greater *************** package GNAT.Perfect_Hash_Generators is *** 116,122 **** -- Deallocate the internal structures and the words table procedure Insert (Value : String); ! -- Insert a new word in the table Too_Many_Tries : exception; -- Raised after Tries unsuccessful runs --- 117,123 ---- -- Deallocate the internal structures and the words table procedure Insert (Value : String); ! -- Insert a new word into the table. ASCII.NUL characters are not allowed. Too_Many_Tries : exception; -- Raised after Tries unsuccessful runs *************** package GNAT.Perfect_Hash_Generators is *** 124,138 **** procedure Compute (Position : String := Default_Position); -- Compute the hash function. Position allows to define selection of -- character positions used in the word hash function. Positions can be ! -- separated by commas and range like x-y may be used. Character '$' -- represents the final character of a word. With an empty position, the -- generator automatically produces positions to reduce the memory usage. ! -- Raise Too_Many_Tries in case that the algorithm does not succeed in less ! -- than Tries attempts (see Initialize). ! procedure Produce (Pkg_Name : String := Default_Pkg_Name); -- Generate the hash function package Pkg_Name. This package includes the ! -- minimal perfect Hash function. -- The routines and structures defined below allow producing the hash -- function using a different way from the procedure above. The procedure --- 125,146 ---- procedure Compute (Position : String := Default_Position); -- Compute the hash function. Position allows to define selection of -- character positions used in the word hash function. Positions can be ! -- separated by commas and ranges like x-y may be used. Character '$' -- represents the final character of a word. With an empty position, the -- generator automatically produces positions to reduce the memory usage. ! -- Raise Too_Many_Tries if the algorithm does not succeed within Tries ! -- attempts (see Initialize). ! procedure Produce ! (Pkg_Name : String := Default_Pkg_Name; ! Use_Stdout : Boolean := False); -- Generate the hash function package Pkg_Name. This package includes the ! -- minimal perfect Hash function. The output is normally placed in the ! -- current directory, in files X.ads and X.adb, where X is the standard ! -- GNAT file name for a package named Pkg_Name. If Use_Stdout is True, the ! -- output goes to standard output, and no files are written. ! ! ---------------------------------------------------------------- -- The routines and structures defined below allow producing the hash -- function using a different way from the procedure above. The procedure diff -Nrcpad gcc-4.5.2/gcc/ada/g-sechas.ads gcc-4.6.0/gcc/ada/g-sechas.ads *** gcc-4.5.2/gcc/ada/g-sechas.ads Mon Jan 25 16:24:20 2010 --- gcc-4.6.0/gcc/ada/g-sechas.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This package provides common suporting code for a family of secure -- hash functions (including MD5 and the FIPS PUB 180-3 functions SHA-1, -- SHA-224, SHA-256, SHA-384 and SHA-512). --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package provides common supporting code for a family of secure -- hash functions (including MD5 and the FIPS PUB 180-3 functions SHA-1, -- SHA-224, SHA-256, SHA-384 and SHA-512). diff -Nrcpad gcc-4.5.2/gcc/ada/g-sehash.ads gcc-4.6.0/gcc/ada/g-sehash.ads *** gcc-4.5.2/gcc/ada/g-sehash.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-sehash.ads Mon Dec 20 07:26:57 2010 *************** *** 30,36 **** ------------------------------------------------------------------------------ -- This package provides supporting code for implementation of the SHA-1 ! -- secure hash function as decsribed in FIPS PUB 180-3. The complete text -- of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf --- 30,36 ---- ------------------------------------------------------------------------------ -- This package provides supporting code for implementation of the SHA-1 ! -- secure hash function as described in FIPS PUB 180-3. The complete text -- of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf diff -Nrcpad gcc-4.5.2/gcc/ada/g-sercom-linux.adb gcc-4.6.0/gcc/ada/g-sercom-linux.adb *** gcc-4.5.2/gcc/ada/g-sercom-linux.adb Tue Dec 1 09:52:51 2009 --- gcc-4.6.0/gcc/ada/g-sercom-linux.adb Thu Jun 17 12:26:10 2010 *************** package body GNAT.Serial_Communications *** 158,165 **** Buffer : out Stream_Element_Array; Last : out Stream_Element_Offset) is ! Len : constant int := Buffer'Length; ! Res : int; begin if Port.H = null then --- 158,165 ---- Buffer : out Stream_Element_Array; Last : out Stream_Element_Offset) is ! Len : constant size_t := Buffer'Length; ! Res : ssize_t; begin if Port.H = null then *************** package body GNAT.Serial_Communications *** 264,271 **** (Port : in out Serial_Port; Buffer : Stream_Element_Array) is ! Len : constant int := Buffer'Length; ! Res : int; begin if Port.H = null then --- 264,271 ---- (Port : in out Serial_Port; Buffer : Stream_Element_Array) is ! Len : constant size_t := Buffer'Length; ! Res : ssize_t; begin if Port.H = null then *************** package body GNAT.Serial_Communications *** 273,283 **** end if; Res := write (int (Port.H.all), Buffer'Address, Len); - pragma Assert (Res = Len); if Res = -1 then Raise_Error ("write failed"); end if; end Write; ----------- --- 273,284 ---- end if; Res := write (int (Port.H.all), Buffer'Address, Len); if Res = -1 then Raise_Error ("write failed"); end if; + + pragma Assert (size_t (Res) = Len); end Write; ----------- diff -Nrcpad gcc-4.5.2/gcc/ada/g-sha1.ads gcc-4.6.0/gcc/ada/g-sha1.ads *** gcc-4.5.2/gcc/ada/g-sha1.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-sha1.ads Mon Dec 20 07:26:57 2010 *************** *** 31,37 **** -- -- ------------------------------------------------------------------------------ ! -- This package implaments the SHA-1 secure hash function as decsribed in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf --- 31,37 ---- -- -- ------------------------------------------------------------------------------ ! -- This package implements the SHA-1 secure hash function as described in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf diff -Nrcpad gcc-4.5.2/gcc/ada/g-sha224.ads gcc-4.6.0/gcc/ada/g-sha224.ads *** gcc-4.5.2/gcc/ada/g-sha224.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-sha224.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This package implaments the SHA-224 secure hash function as decsribed in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package implements the SHA-224 secure hash function as described in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf diff -Nrcpad gcc-4.5.2/gcc/ada/g-sha256.ads gcc-4.6.0/gcc/ada/g-sha256.ads *** gcc-4.5.2/gcc/ada/g-sha256.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-sha256.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This package implaments the SHA-256 secure hash function as decsribed in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package implements the SHA-256 secure hash function as described in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf diff -Nrcpad gcc-4.5.2/gcc/ada/g-sha384.ads gcc-4.6.0/gcc/ada/g-sha384.ads *** gcc-4.5.2/gcc/ada/g-sha384.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-sha384.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This package implaments the SHA-384 secure hash function as decsribed in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package implements the SHA-384 secure hash function as described in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf diff -Nrcpad gcc-4.5.2/gcc/ada/g-sha512.ads gcc-4.6.0/gcc/ada/g-sha512.ads *** gcc-4.5.2/gcc/ada/g-sha512.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-sha512.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This package implaments the SHA-512 secure hash function as decsribed in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package implements the SHA-512 secure hash function as described in -- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf diff -Nrcpad gcc-4.5.2/gcc/ada/g-shsh32.ads gcc-4.6.0/gcc/ada/g-shsh32.ads *** gcc-4.5.2/gcc/ada/g-shsh32.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-shsh32.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This pacakge provides support for the 32-bit FIPS PUB 180-3 functions -- SHA-224 and SHA-256. -- This is an internal unit and should not be used directly in applications. --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package provides support for the 32-bit FIPS PUB 180-3 functions -- SHA-224 and SHA-256. -- This is an internal unit and should not be used directly in applications. diff -Nrcpad gcc-4.5.2/gcc/ada/g-shsh64.ads gcc-4.6.0/gcc/ada/g-shsh64.ads *** gcc-4.5.2/gcc/ada/g-shsh64.ads Mon Nov 30 15:51:15 2009 --- gcc-4.6.0/gcc/ada/g-shsh64.ads Mon Dec 20 07:26:57 2010 *************** *** 29,35 **** -- -- ------------------------------------------------------------------------------ ! -- This pacakge provides support for the 64-bit FIPS PUB 180-3 functions -- SHA-384 and SHA-512. -- This is an internal unit and should not be used directly in applications. --- 29,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package provides support for the 64-bit FIPS PUB 180-3 functions -- SHA-384 and SHA-512. -- This is an internal unit and should not be used directly in applications. diff -Nrcpad gcc-4.5.2/gcc/ada/g-socket.adb gcc-4.6.0/gcc/ada/g-socket.adb *** gcc-4.5.2/gcc/ada/g-socket.adb Tue Dec 1 09:52:51 2009 --- gcc-4.6.0/gcc/ada/g-socket.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Interfaces.C.Strings; *** 40,46 **** with GNAT.Sockets.Thin_Common; use GNAT.Sockets.Thin_Common; with GNAT.Sockets.Thin; use GNAT.Sockets.Thin; - with GNAT.Sockets.Thin.Task_Safe_NetDB; use GNAT.Sockets.Thin.Task_Safe_NetDB; with GNAT.Sockets.Linker_Options; pragma Warnings (Off, GNAT.Sockets.Linker_Options); --- 40,45 ---- *************** pragma Warnings (Off, GNAT.Sockets.Linke *** 49,54 **** --- 48,54 ---- with System; use System; with System.Communication; use System.Communication; with System.CRTL; use System.CRTL; + with System.Task_Lock; package body GNAT.Sockets is *************** package body GNAT.Sockets is *** 59,64 **** --- 59,65 ---- ENOERROR : constant := 0; Netdb_Buffer_Size : constant := SOSC.Need_Netdb_Buffer * 1024; + Need_Netdb_Lock : constant Boolean := SOSC.Need_Netdb_Lock /= 0; -- The network database functions gethostbyname, gethostbyaddr, -- getservbyname and getservbyport can either be guaranteed task safe by -- the operating system, or else return data through a user-provided buffer *************** package body GNAT.Sockets is *** 155,172 **** function Is_IP_Address (Name : String) return Boolean; -- Return true when Name is an IP address in standard dot notation function To_In_Addr (Addr : Inet_Addr_Type) return In_Addr; procedure To_Inet_Addr (Addr : In_Addr; Result : out Inet_Addr_Type); -- Conversion functions ! function To_Host_Entry (E : Hostent) return Host_Entry_Type; -- Conversion function function To_Service_Entry (E : Servent_Access) return Service_Entry_Type; -- Conversion function function To_Timeval (Val : Timeval_Duration) return Timeval; -- Separate Val in seconds and microseconds --- 156,184 ---- function Is_IP_Address (Name : String) return Boolean; -- Return true when Name is an IP address in standard dot notation + procedure Netdb_Lock; + pragma Inline (Netdb_Lock); + procedure Netdb_Unlock; + pragma Inline (Netdb_Unlock); + -- Lock/unlock operation used to protect netdb access for platforms that + -- require such protection. + function To_In_Addr (Addr : Inet_Addr_Type) return In_Addr; procedure To_Inet_Addr (Addr : In_Addr; Result : out Inet_Addr_Type); -- Conversion functions ! function To_Host_Entry (E : Hostent_Access) return Host_Entry_Type; -- Conversion function function To_Service_Entry (E : Servent_Access) return Service_Entry_Type; -- Conversion function + function Value (S : System.Address) return String; + -- Same as Interfaces.C.Strings.Value but taking a System.Address (on VMS, + -- chars_ptr is a 32-bit pointer, and here we need a 64-bit version). + function To_Timeval (Val : Timeval_Duration) return Timeval; -- Separate Val in seconds and microseconds *************** package body GNAT.Sockets is *** 261,267 **** function Is_Open (S : Selector_Type) return Boolean; -- Return True for an "open" Selector_Type object, i.e. one for which ! -- Create_Selector has been called and Close_Selector has not been called. --------- -- "+" -- --- 273,280 ---- function Is_Open (S : Selector_Type) return Boolean; -- Return True for an "open" Selector_Type object, i.e. one for which ! -- Create_Selector has been called and Close_Selector has not been called, ! -- or the null selector. --------- -- "+" -- *************** package body GNAT.Sockets is *** 282,287 **** --- 295,304 ---- begin if not Is_Open (Selector) then raise Program_Error with "closed selector"; + + elsif Selector.Is_Null then + raise Program_Error with "null selector"; + end if; -- Send one byte to unblock select system call *************** package body GNAT.Sockets is *** 453,459 **** -------------------- procedure Check_Selector ! (Selector : in out Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; Status : out Selector_Status; --- 470,476 ---- -------------------- procedure Check_Selector ! (Selector : Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; Status : out Selector_Status; *************** package body GNAT.Sockets is *** 470,476 **** -------------------- procedure Check_Selector ! (Selector : in out Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; E_Socket_Set : in out Socket_Set_Type; --- 487,493 ---- -------------------- procedure Check_Selector ! (Selector : Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; E_Socket_Set : in out Socket_Set_Type; *************** package body GNAT.Sockets is *** 479,485 **** is Res : C.int; Last : C.int; ! RSig : constant Socket_Type := Selector.R_Sig_Socket; TVal : aliased Timeval; TPtr : Timeval_Access; --- 496,502 ---- is Res : C.int; Last : C.int; ! RSig : Socket_Type := No_Socket; TVal : aliased Timeval; TPtr : Timeval_Access; *************** package body GNAT.Sockets is *** 499,507 **** TPtr := TVal'Unchecked_Access; end if; ! -- Add read signalling socket ! Set (R_Socket_Set, RSig); Last := C.int'Max (C.int'Max (C.int (R_Socket_Set.Last), C.int (W_Socket_Set.Last)), --- 516,527 ---- TPtr := TVal'Unchecked_Access; end if; ! -- Add read signalling socket, if present ! if not Selector.Is_Null then ! RSig := Selector.R_Sig_Socket; ! Set (R_Socket_Set, RSig); ! end if; Last := C.int'Max (C.int'Max (C.int (R_Socket_Set.Last), C.int (W_Socket_Set.Last)), *************** package body GNAT.Sockets is *** 528,534 **** -- If Select was resumed because of read signalling socket, read this -- data and remove socket from set. ! if Is_Set (R_Socket_Set, RSig) then Clear (R_Socket_Set, RSig); Res := Signalling_Fds.Read (C.int (RSig)); --- 548,554 ---- -- If Select was resumed because of read signalling socket, read this -- data and remove socket from set. ! if RSig /= No_Socket and then Is_Set (R_Socket_Set, RSig) then Clear (R_Socket_Set, RSig); Res := Signalling_Fds.Read (C.int (RSig)); *************** package body GNAT.Sockets is *** 573,582 **** procedure Close_Selector (Selector : in out Selector_Type) is begin ! if not Is_Open (Selector) then ! ! -- Selector already in closed state: nothing to do return; end if; --- 593,601 ---- procedure Close_Selector (Selector : in out Selector_Type) is begin ! -- Nothing to do if selector already in closed state + if Selector.Is_Null or else not Is_Open (Selector) then return; end if; *************** package body GNAT.Sockets is *** 891,903 **** Err : aliased C.int; begin ! if Safe_Gethostbyaddr (HA'Address, HA'Size / 8, SOSC.AF_INET, Res'Access, Buf'Address, Buflen, Err'Access) /= 0 then Raise_Host_Error (Integer (Err)); end if; ! return To_Host_Entry (Res); end Get_Host_By_Address; ---------------------- --- 910,929 ---- Err : aliased C.int; begin ! Netdb_Lock; ! ! if C_Gethostbyaddr (HA'Address, HA'Size / 8, SOSC.AF_INET, Res'Access, Buf'Address, Buflen, Err'Access) /= 0 then + Netdb_Unlock; Raise_Host_Error (Integer (Err)); end if; ! return H : constant Host_Entry_Type := ! To_Host_Entry (Res'Unchecked_Access) ! do ! Netdb_Unlock; ! end return; end Get_Host_By_Address; ---------------------- *************** package body GNAT.Sockets is *** 920,932 **** Err : aliased C.int; begin ! if Safe_Gethostbyname (HN, Res'Access, Buf'Address, Buflen, Err'Access) /= 0 then Raise_Host_Error (Integer (Err)); end if; ! return To_Host_Entry (Res); end; end Get_Host_By_Name; --- 946,965 ---- Err : aliased C.int; begin ! Netdb_Lock; ! ! if C_Gethostbyname (HN, Res'Access, Buf'Address, Buflen, Err'Access) /= 0 then + Netdb_Unlock; Raise_Host_Error (Integer (Err)); end if; ! return H : constant Host_Entry_Type := ! To_Host_Entry (Res'Unchecked_Access) ! do ! Netdb_Unlock; ! end return; end; end Get_Host_By_Name; *************** package body GNAT.Sockets is *** 965,977 **** Res : aliased Servent; begin ! if Safe_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then raise Service_Error with "Service not found"; end if; -- Translate from the C format to the API format ! return To_Service_Entry (Res'Unchecked_Access); end Get_Service_By_Name; ------------------------- --- 998,1017 ---- Res : aliased Servent; begin ! Netdb_Lock; ! ! if C_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then ! Netdb_Unlock; raise Service_Error with "Service not found"; end if; -- Translate from the C format to the API format ! return S : constant Service_Entry_Type := ! To_Service_Entry (Res'Unchecked_Access) ! do ! Netdb_Unlock; ! end return; end Get_Service_By_Name; ------------------------- *************** package body GNAT.Sockets is *** 988,1003 **** Res : aliased Servent; begin ! if Safe_Getservbyport (C.int (Short_To_Network (C.unsigned_short (Port))), SP, Res'Access, Buf'Address, Buflen) /= 0 then raise Service_Error with "Service not found"; end if; -- Translate from the C format to the API format ! return To_Service_Entry (Res'Unchecked_Access); end Get_Service_By_Port; --------------------- --- 1028,1050 ---- Res : aliased Servent; begin ! Netdb_Lock; ! ! if C_Getservbyport (C.int (Short_To_Network (C.unsigned_short (Port))), SP, Res'Access, Buf'Address, Buflen) /= 0 then + Netdb_Unlock; raise Service_Error with "Service not found"; end if; -- Translate from the C format to the API format ! return S : constant Service_Entry_Type := ! To_Service_Entry (Res'Unchecked_Access) ! do ! Netdb_Unlock; ! end return; end Get_Service_By_Port; --------------------- *************** package body GNAT.Sockets is *** 1282,1288 **** use Interfaces.C.Strings; Img : aliased char_array := To_C (Image); - Cp : constant chars_ptr := To_Chars_Ptr (Img'Unchecked_Access); Addr : aliased C.int; Res : C.int; Result : Inet_Addr_Type; --- 1329,1334 ---- *************** package body GNAT.Sockets is *** 1295,1301 **** Raise_Socket_Error (SOSC.EINVAL); end if; ! Res := Inet_Pton (SOSC.AF_INET, Cp, Addr'Address); if Res < 0 then Raise_Socket_Error (Socket_Errno); --- 1341,1347 ---- Raise_Socket_Error (SOSC.EINVAL); end if; ! Res := Inet_Pton (SOSC.AF_INET, Img'Address, Addr'Address); if Res < 0 then Raise_Socket_Error (Socket_Errno); *************** package body GNAT.Sockets is *** 1386,1399 **** function Is_Open (S : Selector_Type) return Boolean is begin ! -- Either both controlling socket descriptors are valid (case of an ! -- open selector) or neither (case of a closed selector). ! pragma Assert ((S.R_Sig_Socket /= No_Socket) ! = ! (S.W_Sig_Socket /= No_Socket)); ! return S.R_Sig_Socket /= No_Socket; end Is_Open; ------------ --- 1432,1450 ---- function Is_Open (S : Selector_Type) return Boolean is begin ! if S.Is_Null then ! return True; ! else ! -- Either both controlling socket descriptors are valid (case of an ! -- open selector) or neither (case of a closed selector). ! pragma Assert ((S.R_Sig_Socket /= No_Socket) ! = ! (S.W_Sig_Socket /= No_Socket)); ! ! return S.R_Sig_Socket /= No_Socket; ! end if; end Is_Open; ------------ *************** package body GNAT.Sockets is *** 1438,1443 **** --- 1489,1516 ---- end if; end Narrow; + ---------------- + -- Netdb_Lock -- + ---------------- + + procedure Netdb_Lock is + begin + if Need_Netdb_Lock then + System.Task_Lock.Lock; + end if; + end Netdb_Lock; + + ------------------ + -- Netdb_Unlock -- + ------------------ + + procedure Netdb_Unlock is + begin + if Need_Netdb_Lock then + System.Task_Lock.Unlock; + end if; + end Netdb_Unlock; + -------------------------------- -- Normalize_Empty_Socket_Set -- -------------------------------- *************** package body GNAT.Sockets is *** 1748,1802 **** return Resource_Temporarily_Unavailable; end if; pragma Warnings (On); - case Error_Value is - when ENOERROR => return Success; - when EACCES => return Permission_Denied; - when EADDRINUSE => return Address_Already_In_Use; - when EADDRNOTAVAIL => return Cannot_Assign_Requested_Address; - when EAFNOSUPPORT => return - Address_Family_Not_Supported_By_Protocol; - when EALREADY => return Operation_Already_In_Progress; - when EBADF => return Bad_File_Descriptor; - when ECONNABORTED => return Software_Caused_Connection_Abort; - when ECONNREFUSED => return Connection_Refused; - when ECONNRESET => return Connection_Reset_By_Peer; - when EDESTADDRREQ => return Destination_Address_Required; - when EFAULT => return Bad_Address; - when EHOSTDOWN => return Host_Is_Down; - when EHOSTUNREACH => return No_Route_To_Host; - when EINPROGRESS => return Operation_Now_In_Progress; - when EINTR => return Interrupted_System_Call; - when EINVAL => return Invalid_Argument; - when EIO => return Input_Output_Error; - when EISCONN => return Transport_Endpoint_Already_Connected; - when ELOOP => return Too_Many_Symbolic_Links; - when EMFILE => return Too_Many_Open_Files; - when EMSGSIZE => return Message_Too_Long; - when ENAMETOOLONG => return File_Name_Too_Long; - when ENETDOWN => return Network_Is_Down; - when ENETRESET => return - Network_Dropped_Connection_Because_Of_Reset; - when ENETUNREACH => return Network_Is_Unreachable; - when ENOBUFS => return No_Buffer_Space_Available; - when ENOPROTOOPT => return Protocol_Not_Available; - when ENOTCONN => return Transport_Endpoint_Not_Connected; - when ENOTSOCK => return Socket_Operation_On_Non_Socket; - when EOPNOTSUPP => return Operation_Not_Supported; - when EPFNOSUPPORT => return Protocol_Family_Not_Supported; - when EPIPE => return Broken_Pipe; - when EPROTONOSUPPORT => return Protocol_Not_Supported; - when EPROTOTYPE => return Protocol_Wrong_Type_For_Socket; - when ESHUTDOWN => return - Cannot_Send_After_Transport_Endpoint_Shutdown; - when ESOCKTNOSUPPORT => return Socket_Type_Not_Supported; - when ETIMEDOUT => return Connection_Timed_Out; - when ETOOMANYREFS => return Too_Many_References; - when EWOULDBLOCK => return Resource_Temporarily_Unavailable; - - when others => return Cannot_Resolve_Error; - end case; end Resolve_Error; ----------------------- --- 1821,1919 ---- return Resource_Temporarily_Unavailable; end if; + -- This is not a case statement because if a particular error + -- number constant is not defined, s-oscons-tmplt.c defines + -- it to -1. If multiple constants are not defined, they + -- would each be -1 and result in a "duplicate value in case" error. + -- + -- But we have to leave warnings off because the compiler is also + -- smart enough to note that when two errnos have the same value, + -- the second if condition is useless. + if Error_Value = ENOERROR then + return Success; + elsif Error_Value = EACCES then + return Permission_Denied; + elsif Error_Value = EADDRINUSE then + return Address_Already_In_Use; + elsif Error_Value = EADDRNOTAVAIL then + return Cannot_Assign_Requested_Address; + elsif Error_Value = EAFNOSUPPORT then + return Address_Family_Not_Supported_By_Protocol; + elsif Error_Value = EALREADY then + return Operation_Already_In_Progress; + elsif Error_Value = EBADF then + return Bad_File_Descriptor; + elsif Error_Value = ECONNABORTED then + return Software_Caused_Connection_Abort; + elsif Error_Value = ECONNREFUSED then + return Connection_Refused; + elsif Error_Value = ECONNRESET then + return Connection_Reset_By_Peer; + elsif Error_Value = EDESTADDRREQ then + return Destination_Address_Required; + elsif Error_Value = EFAULT then + return Bad_Address; + elsif Error_Value = EHOSTDOWN then + return Host_Is_Down; + elsif Error_Value = EHOSTUNREACH then + return No_Route_To_Host; + elsif Error_Value = EINPROGRESS then + return Operation_Now_In_Progress; + elsif Error_Value = EINTR then + return Interrupted_System_Call; + elsif Error_Value = EINVAL then + return Invalid_Argument; + elsif Error_Value = EIO then + return Input_Output_Error; + elsif Error_Value = EISCONN then + return Transport_Endpoint_Already_Connected; + elsif Error_Value = ELOOP then + return Too_Many_Symbolic_Links; + elsif Error_Value = EMFILE then + return Too_Many_Open_Files; + elsif Error_Value = EMSGSIZE then + return Message_Too_Long; + elsif Error_Value = ENAMETOOLONG then + return File_Name_Too_Long; + elsif Error_Value = ENETDOWN then + return Network_Is_Down; + elsif Error_Value = ENETRESET then + return Network_Dropped_Connection_Because_Of_Reset; + elsif Error_Value = ENETUNREACH then + return Network_Is_Unreachable; + elsif Error_Value = ENOBUFS then + return No_Buffer_Space_Available; + elsif Error_Value = ENOPROTOOPT then + return Protocol_Not_Available; + elsif Error_Value = ENOTCONN then + return Transport_Endpoint_Not_Connected; + elsif Error_Value = ENOTSOCK then + return Socket_Operation_On_Non_Socket; + elsif Error_Value = EOPNOTSUPP then + return Operation_Not_Supported; + elsif Error_Value = EPFNOSUPPORT then + return Protocol_Family_Not_Supported; + elsif Error_Value = EPIPE then + return Broken_Pipe; + elsif Error_Value = EPROTONOSUPPORT then + return Protocol_Not_Supported; + elsif Error_Value = EPROTOTYPE then + return Protocol_Wrong_Type_For_Socket; + elsif Error_Value = ESHUTDOWN then + return Cannot_Send_After_Transport_Endpoint_Shutdown; + elsif Error_Value = ESOCKTNOSUPPORT then + return Socket_Type_Not_Supported; + elsif Error_Value = ETIMEDOUT then + return Connection_Timed_Out; + elsif Error_Value = ETOOMANYREFS then + return Too_Many_References; + elsif Error_Value = EWOULDBLOCK then + return Resource_Temporarily_Unavailable; + else + return Cannot_Resolve_Error; + end if; pragma Warnings (On); end Resolve_Error; ----------------------- *************** package body GNAT.Sockets is *** 2202,2208 **** end loop; -- For an empty array, we have First > Max, and hence Index >= Max (no ! -- error, the loop above is never executed). After a succesful send, -- Index = Max. The only remaining case, Index < Max, is therefore -- always an actual send failure. --- 2319,2325 ---- end loop; -- For an empty array, we have First > Max, and hence Index >= Max (no ! -- error, the loop above is never executed). After a successful send, -- Index = Max. The only remaining case, Index < Max, is therefore -- always an actual send failure. *************** package body GNAT.Sockets is *** 2233,2286 **** -- To_Host_Entry -- ------------------- ! function To_Host_Entry (E : Hostent) return Host_Entry_Type is use type C.size_t; ! Official : constant String := ! C.Strings.Value (E.H_Name); ! ! Aliases : constant Chars_Ptr_Array := ! Chars_Ptr_Pointers.Value (E.H_Aliases); ! -- H_Aliases points to a list of name aliases. The list is terminated by ! -- a NULL pointer. ! Addresses : constant In_Addr_Access_Array := ! In_Addr_Access_Pointers.Value (E.H_Addr_List); ! -- H_Addr_List points to a list of binary addresses (in network byte ! -- order). The list is terminated by a NULL pointer. ! -- ! -- H_Length is not used because it is currently only set to 4. -- H_Addrtype is always AF_INET - Result : Host_Entry_Type - (Aliases_Length => Aliases'Length - 1, - Addresses_Length => Addresses'Length - 1); - -- The last element is a null pointer - - Source : C.size_t; - Target : Natural; - begin ! Result.Official := To_Name (Official); ! ! Source := Aliases'First; ! Target := Result.Aliases'First; ! while Target <= Result.Aliases_Length loop ! Result.Aliases (Target) := ! To_Name (C.Strings.Value (Aliases (Source))); ! Source := Source + 1; ! Target := Target + 1; end loop; ! Source := Addresses'First; ! Target := Result.Addresses'First; ! while Target <= Result.Addresses_Length loop ! To_Inet_Addr (Addresses (Source).all, Result.Addresses (Target)); ! Source := Source + 1; ! Target := Target + 1; end loop; ! return Result; end To_Host_Entry; ---------------- --- 2350,2398 ---- -- To_Host_Entry -- ------------------- ! function To_Host_Entry (E : Hostent_Access) return Host_Entry_Type is use type C.size_t; + use C.Strings; ! Aliases_Count, Addresses_Count : Natural; ! -- H_Length is not used because it is currently only set to 4 -- H_Addrtype is always AF_INET begin ! Aliases_Count := 0; ! while Hostent_H_Alias (E, C.int (Aliases_Count)) /= Null_Address loop ! Aliases_Count := Aliases_Count + 1; end loop; ! Addresses_Count := 0; ! while Hostent_H_Addr (E, C.int (Addresses_Count)) /= Null_Address loop ! Addresses_Count := Addresses_Count + 1; end loop; ! return Result : Host_Entry_Type ! (Aliases_Length => Aliases_Count, ! Addresses_Length => Addresses_Count) ! do ! Result.Official := To_Name (Value (Hostent_H_Name (E))); ! ! for J in Result.Aliases'Range loop ! Result.Aliases (J) := ! To_Name (Value (Hostent_H_Alias ! (E, C.int (J - Result.Aliases'First)))); ! end loop; ! ! for J in Result.Addresses'Range loop ! declare ! Addr : In_Addr; ! for Addr'Address use ! Hostent_H_Addr (E, C.int (J - Result.Addresses'First)); ! pragma Import (Ada, Addr); ! begin ! To_Inet_Addr (Addr, Result.Addresses (J)); ! end; ! end loop; ! end return; end To_Host_Entry; ---------------- *************** package body GNAT.Sockets is *** 2354,2393 **** ---------------------- function To_Service_Entry (E : Servent_Access) return Service_Entry_Type is use type C.size_t; ! Official : constant String := C.Strings.Value (Servent_S_Name (E)); ! ! Aliases : constant Chars_Ptr_Array := ! Chars_Ptr_Pointers.Value (Servent_S_Aliases (E)); ! -- S_Aliases points to a list of name aliases. The list is ! -- terminated by a NULL pointer. ! ! Protocol : constant String := C.Strings.Value (Servent_S_Proto (E)); ! ! Result : Service_Entry_Type (Aliases_Length => Aliases'Length - 1); ! -- The last element is a null pointer ! ! Source : C.size_t; ! Target : Natural; begin ! Result.Official := To_Name (Official); ! ! Source := Aliases'First; ! Target := Result.Aliases'First; ! while Target <= Result.Aliases_Length loop ! Result.Aliases (Target) := ! To_Name (C.Strings.Value (Aliases (Source))); ! Source := Source + 1; ! Target := Target + 1; end loop; ! Result.Port := ! Port_Type (Network_To_Short (C.unsigned_short (Servent_S_Port (E)))); ! Result.Protocol := To_Name (Protocol); ! return Result; end To_Service_Entry; --------------- --- 2466,2495 ---- ---------------------- function To_Service_Entry (E : Servent_Access) return Service_Entry_Type is + use C.Strings; use type C.size_t; ! Aliases_Count : Natural; begin ! Aliases_Count := 0; ! while Servent_S_Alias (E, C.int (Aliases_Count)) /= Null_Address loop ! Aliases_Count := Aliases_Count + 1; end loop; ! return Result : Service_Entry_Type (Aliases_Length => Aliases_Count) do ! Result.Official := To_Name (Value (Servent_S_Name (E))); ! for J in Result.Aliases'Range loop ! Result.Aliases (J) := ! To_Name (Value (Servent_S_Alias ! (E, C.int (J - Result.Aliases'First)))); ! end loop; ! ! Result.Protocol := To_Name (Value (Servent_S_Proto (E))); ! Result.Port := ! Port_Type (Network_To_Short (Servent_S_Port (E))); ! end return; end To_Service_Entry; --------------- *************** package body GNAT.Sockets is *** 2425,2430 **** --- 2527,2551 ---- end To_Timeval; ----------- + -- Value -- + ----------- + + function Value (S : System.Address) return String is + Str : String (1 .. Positive'Last); + for Str'Address use S; + pragma Import (Ada, Str); + + Terminator : Positive := Str'First; + + begin + while Str (Terminator) /= ASCII.NUL loop + Terminator := Terminator + 1; + end loop; + + return Str (1 .. Terminator - 1); + end Value; + + ----------- -- Write -- ----------- diff -Nrcpad gcc-4.5.2/gcc/ada/g-socket.ads gcc-4.6.0/gcc/ada/g-socket.ads *** gcc-4.5.2/gcc/ada/g-socket.ads Tue Dec 1 09:52:51 2009 --- gcc-4.6.0/gcc/ada/g-socket.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package GNAT.Sockets is *** 61,67 **** -- Sockets are designed to provide a consistent communication facility -- 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' --- 61,67 ---- -- Sockets are designed to provide a consistent communication facility -- between applications. This package provides an Ada binding to 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' *************** package GNAT.Sockets is *** 422,427 **** --- 422,432 ---- type Selector_Access is access all Selector_Type; -- Selector objects are used to wait for i/o events to occur on sockets + Null_Selector : constant Selector_Type; + -- The Null_Selector can be used in place of a normal selector without + -- having to call Create_Selector if the use of Abort_Selector is not + -- required. + -- Timeval_Duration is a subtype of Standard.Duration because the full -- range of Standard.Duration cannot be represented in the equivalent C -- structure. Moreover, negative values are not allowed to avoid system *************** package GNAT.Sockets is *** 459,466 **** type Family_Type is (Family_Inet, Family_Inet6); -- Address family (or protocol family) identifies the communication domain ! -- and groups protocols with similar address formats. IPv6 will soon be ! -- supported. type Mode_Type is (Socket_Stream, Socket_Datagram); -- Stream sockets provide connection-oriented byte streams. Datagram --- 464,470 ---- type Family_Type is (Family_Inet, Family_Inet6); -- Address family (or protocol family) identifies the communication domain ! -- and groups protocols with similar address formats. type Mode_Type is (Socket_Stream, Socket_Datagram); -- Stream sockets provide connection-oriented byte streams. Datagram *************** package GNAT.Sockets is *** 474,486 **** -- more data can be transmitted. Neither transmission nor reception can be -- performed with Shut_Read_Write. ! type Port_Type is new Natural; ! -- Classical port definition. No_Port provides a special value to ! -- denote uninitialized port. Any_Port provides a special value ! -- enabling all ports. Any_Port : constant Port_Type; ! No_Port : constant Port_Type; type Inet_Addr_Type (Family : Family_Type := Family_Inet) is private; -- An Internet address depends on an address family (IPv4 contains 4 octets --- 478,491 ---- -- more data can be transmitted. Neither transmission nor reception can be -- performed with Shut_Read_Write. ! type Port_Type is range 0 .. 16#ffff#; ! -- TCP/UDP port number Any_Port : constant Port_Type; ! -- All ports ! ! No_Port : constant Port_Type; ! -- Uninitialized port number type Inet_Addr_Type (Family : Family_Type := Family_Inet) is private; -- An Internet address depends on an address family (IPv4 contains 4 octets *************** package GNAT.Sockets is *** 665,697 **** -- with a socket. Options may exist at multiple protocol levels in the -- communication stack. Socket_Level is the uppermost socket level. ! type Level_Type is ( ! Socket_Level, ! IP_Protocol_For_IP_Level, ! IP_Protocol_For_UDP_Level, ! IP_Protocol_For_TCP_Level); -- There are several options available to manipulate sockets. Each option -- has a name and several values available. Most of the time, the value is -- a boolean to enable or disable this option. ! type Option_Name is ( ! Keep_Alive, -- Enable sending of keep-alive messages ! Reuse_Address, -- Allow bind to reuse local address ! Broadcast, -- Enable datagram sockets to recv/send broadcasts ! Send_Buffer, -- Set/get the maximum socket send buffer in bytes ! Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes ! Linger, -- Shutdown wait for msg to be sent or timeout occur ! Error, -- Get and clear the pending socket error ! No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY) ! Add_Membership, -- Join a multicast group ! Drop_Membership, -- Leave a multicast group ! Multicast_If, -- Set default out interface for multicast packets ! Multicast_TTL, -- Set the time-to-live of sent multicast packets ! Multicast_Loop, -- Sent multicast packets are looped to local socket ! Receive_Packet_Info, -- Receive low level packet info as ancillary data ! Send_Timeout, -- Set timeout value for output ! Receive_Timeout); -- Set timeout value for input type Option_Type (Name : Option_Name := Keep_Alive) is record case Name is --- 670,702 ---- -- with a socket. Options may exist at multiple protocol levels in the -- communication stack. Socket_Level is the uppermost socket level. ! type Level_Type is ! (Socket_Level, ! IP_Protocol_For_IP_Level, ! IP_Protocol_For_UDP_Level, ! IP_Protocol_For_TCP_Level); -- There are several options available to manipulate sockets. Each option -- has a name and several values available. Most of the time, the value is -- a boolean to enable or disable this option. ! type Option_Name is ! (Keep_Alive, -- Enable sending of keep-alive messages ! Reuse_Address, -- Allow bind to reuse local address ! Broadcast, -- Enable datagram sockets to recv/send broadcasts ! Send_Buffer, -- Set/get the maximum socket send buffer in bytes ! Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes ! Linger, -- Shutdown wait for msg to be sent or timeout occur ! Error, -- Get and clear the pending socket error ! No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY) ! Add_Membership, -- Join a multicast group ! Drop_Membership, -- Leave a multicast group ! Multicast_If, -- Set default out interface for multicast packets ! Multicast_TTL, -- Set the time-to-live of sent multicast packets ! Multicast_Loop, -- Sent multicast packets are looped to local socket ! Receive_Packet_Info, -- Receive low level packet info as ancillary data ! Send_Timeout, -- Set timeout value for output ! Receive_Timeout); -- Set timeout value for input type Option_Type (Name : Option_Name := Keep_Alive) is record case Name is *************** package GNAT.Sockets is *** 741,748 **** -- socket options in that they are not specific to sockets but are -- available for any device. ! type Request_Name is ( ! Non_Blocking_IO, -- Cause a caller not to wait on blocking operations. N_Bytes_To_Read); -- Return the number of bytes available to read type Request_Type (Name : Request_Name := Non_Blocking_IO) is record --- 746,753 ---- -- socket options in that they are not specific to sockets but are -- available for any device. ! type Request_Name is ! (Non_Blocking_IO, -- Cause a caller not to wait on blocking operations N_Bytes_To_Read); -- Return the number of bytes available to read type Request_Type (Name : Request_Name := Non_Blocking_IO) is record *************** package GNAT.Sockets is *** 971,978 **** Count : out Ada.Streams.Stream_Element_Count; Flags : Request_Flag_Type := No_Request_Flag); -- Transmit data gathered from the set of vector elements Vector to a ! -- socket. Count is set to the count of transmitted stream elements. ! -- Flags allow control over transmission. procedure Set_Socket_Option (Socket : Socket_Type; --- 976,983 ---- Count : out Ada.Streams.Stream_Element_Count; Flags : Request_Flag_Type := No_Request_Flag); -- Transmit data gathered from the set of vector elements Vector to a ! -- socket. Count is set to the count of transmitted stream elements. Flags ! -- allow control over transmission. procedure Set_Socket_Option (Socket : Socket_Type; *************** package GNAT.Sockets is *** 983,992 **** procedure Shutdown_Socket (Socket : Socket_Type; How : Shutmode_Type := Shut_Read_Write); ! -- Shutdown a connected socket. If How is Shut_Read, further receives will ! -- be disallowed. If How is Shut_Write, further sends will be disallowed. ! -- If how is Shut_Read_Write, further sends and receives will be ! -- disallowed. type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; -- Same interface as Ada.Streams.Stream_IO --- 988,996 ---- procedure Shutdown_Socket (Socket : Socket_Type; How : Shutmode_Type := Shut_Read_Write); ! -- Shutdown a connected socket. If How is Shut_Read further receives will ! -- be disallowed. If How is Shut_Write further sends will be disallowed. ! -- If How is Shut_Read_Write further sends and receives will be disallowed. type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; -- Same interface as Ada.Streams.Stream_IO *************** package GNAT.Sockets is *** 1006,1014 **** procedure Free is new Ada.Unchecked_Deallocation (Ada.Streams.Root_Stream_Type'Class, Stream_Access); ! -- Destroy a stream created by one of the Stream functions above, ! -- releasing the corresponding resources. The user is responsible for ! -- calling this subprogram when the stream is not needed anymore. type Socket_Set_Type is limited private; -- This type allows to manipulate sets of sockets. It allows to wait for --- 1010,1018 ---- procedure Free is new Ada.Unchecked_Deallocation (Ada.Streams.Root_Stream_Type'Class, Stream_Access); ! -- Destroy a stream created by one of the Stream functions above, releasing ! -- the corresponding resources. The user is responsible for calling this ! -- subprogram when the stream is not needed anymore. type Socket_Set_Type is limited private; -- This type allows to manipulate sets of sockets. It allows to wait for *************** package GNAT.Sockets is *** 1054,1074 **** -- can block the full process (not just the calling thread). -- -- Check_Selector provides the very same behaviour. The only difference is ! -- that it does not watch for exception events. Note that on some ! -- platforms it is kept process blocking on purpose. The timeout parameter ! -- allows the user to have the behaviour he wants. Abort_Selector allows ! -- to safely abort a blocked Check_Selector call. A special socket ! -- is opened by Create_Selector and included in each call to ! -- Check_Selector. Abort_Selector causes an event to occur on this ! -- descriptor in order to unblock Check_Selector. Note that each call to ! -- Abort_Selector will cause exactly one call to Check_Selector to return ! -- with Aborted status. The special socket created by Create_Selector is ! -- closed when Close_Selector is called. -- A typical case where it is useful to abort a Check_Selector operation is -- the situation where a change to the monitored sockets set must be made. procedure Create_Selector (Selector : out Selector_Type); ! -- Create a new selector procedure Close_Selector (Selector : in out Selector_Type); -- Close Selector and all internal descriptors associated; deallocate any --- 1058,1080 ---- -- can block the full process (not just the calling thread). -- -- Check_Selector provides the very same behaviour. The only difference is ! -- that it does not watch for exception events. Note that on some platforms ! -- it is kept process blocking on purpose. The timeout parameter allows the ! -- user to have the behaviour he wants. Abort_Selector allows to safely ! -- abort a blocked Check_Selector call. A special socket is opened by ! -- Create_Selector and included in each call to Check_Selector. ! -- ! -- Abort_Selector causes an event to occur on this descriptor in order to ! -- unblock Check_Selector. Note that each call to Abort_Selector will cause ! -- exactly one call to Check_Selector to return with Aborted status. The ! -- special socket created by Create_Selector is closed when Close_Selector ! -- is called. ! -- -- A typical case where it is useful to abort a Check_Selector operation is -- the situation where a change to the monitored sockets set must be made. procedure Create_Selector (Selector : out Selector_Type); ! -- Initialize (open) a new selector procedure Close_Selector (Selector : in out Selector_Type); -- Close Selector and all internal descriptors associated; deallocate any *************** package GNAT.Sockets is *** 1078,1084 **** -- already closed. procedure Check_Selector ! (Selector : in out Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; Status : out Selector_Status; --- 1084,1090 ---- -- already closed. procedure Check_Selector ! (Selector : Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; Status : out Selector_Status; *************** package GNAT.Sockets is *** 1089,1103 **** -- R_Socket_Set or W_Socket_Set. Status is set to Expired if no socket was -- ready after a Timeout expiration. Status is set to Aborted if an abort -- signal has been received while checking socket status. -- Note that two different Socket_Set_Type objects must be passed as -- R_Socket_Set and W_Socket_Set (even if they denote the same set of -- Sockets), or some event may be lost. ! -- Socket_Error is raised when the select(2) system call returns an ! -- error condition, or when a read error occurs on the signalling socket ! -- used for the implementation of Abort_Selector. procedure Check_Selector ! (Selector : in out Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; E_Socket_Set : in out Socket_Set_Type; --- 1095,1111 ---- -- R_Socket_Set or W_Socket_Set. Status is set to Expired if no socket was -- ready after a Timeout expiration. Status is set to Aborted if an abort -- signal has been received while checking socket status. + -- -- Note that two different Socket_Set_Type objects must be passed as -- R_Socket_Set and W_Socket_Set (even if they denote the same set of -- Sockets), or some event may be lost. ! -- ! -- Socket_Error is raised when the select(2) system call returns an error ! -- condition, or when a read error occurs on the signalling socket used for ! -- the implementation of Abort_Selector. procedure Check_Selector ! (Selector : Selector_Type; R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; E_Socket_Set : in out Socket_Set_Type; *************** package GNAT.Sockets is *** 1109,1115 **** -- different objects. procedure Abort_Selector (Selector : Selector_Type); ! -- Send an abort signal to the selector type Fd_Set is private; -- ??? This type must not be used directly, it needs to be visible because --- 1117,1124 ---- -- different objects. procedure Abort_Selector (Selector : Selector_Type); ! -- Send an abort signal to the selector. The Selector may not be the ! -- Null_Selector. type Fd_Set is private; -- ??? This type must not be used directly, it needs to be visible because *************** private *** 1125,1138 **** type Socket_Type is new Integer; No_Socket : constant Socket_Type := -1; ! type Selector_Type is limited record ! R_Sig_Socket : Socket_Type := No_Socket; ! W_Sig_Socket : Socket_Type := No_Socket; ! -- Signalling sockets used to abort a select operation end record; pragma Volatile (Selector_Type); type Fd_Set is new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_fd_set); for Fd_Set'Alignment use Interfaces.C.long'Alignment; --- 1134,1161 ---- type Socket_Type is new Integer; No_Socket : constant Socket_Type := -1; ! -- A selector is either a null selector, which is always "open" and can ! -- never be aborted, or a regular selector, which is created "closed", ! -- becomes "open" when Create_Selector is called, and "closed" again when ! -- Close_Selector is called. ! ! type Selector_Type (Is_Null : Boolean := False) is limited record ! case Is_Null is ! when True => ! null; ! ! when False => ! R_Sig_Socket : Socket_Type := No_Socket; ! W_Sig_Socket : Socket_Type := No_Socket; ! -- Signalling sockets used to abort a select operation ! ! end case; end record; pragma Volatile (Selector_Type); + Null_Selector : constant Selector_Type := (Is_Null => True); + type Fd_Set is new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_fd_set); for Fd_Set'Alignment use Interfaces.C.long'Alignment; diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi-mingw.adb gcc-4.6.0/gcc/ada/g-socthi-mingw.adb *** gcc-4.5.2/gcc/ada/g-socthi-mingw.adb Wed Jul 15 09:47:20 2009 --- gcc-4.6.0/gcc/ada/g-socthi-mingw.adb Tue Jun 22 09:46:58 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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,44 **** -- This version is for NT ! with Interfaces.C.Strings; use Interfaces.C.Strings; ! with System; use System; package body GNAT.Sockets.Thin is --- 37,47 ---- -- This version is for NT ! with Ada.Streams; use Ada.Streams; ! with Ada.Unchecked_Conversion; ! with Interfaces.C.Strings; use Interfaces.C.Strings; ! with System; use System; ! with System.Storage_Elements; use System.Storage_Elements; package body GNAT.Sockets.Thin is *************** package body GNAT.Sockets.Thin is *** 269,276 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is Res : C.int; Count : C.int := 0; --- 272,285 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is + use type C.size_t; + + Fill : constant Boolean := + (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0; + -- Is the MSG_WAITALL flag set? If so we need to fully fill all vectors + Res : C.int; Count : C.int := 0; *************** package body GNAT.Sockets.Thin is *** 281,305 **** for Iovec'Address use MH.Msg_Iov; pragma Import (Ada, Iovec); begin -- Windows does not provide an implementation of recvmsg(). The spec for -- WSARecvMsg() is incompatible with the data types we define, and is ! -- not available in all versions of Windows. So, we use C_Recv instead. ! for J in Iovec'Range loop ! Res := C_Recv ! (S, ! Iovec (J).Base.all'Address, ! C.int (Iovec (J).Length), ! Flags); if Res < 0 then ! return ssize_t (Res); else Count := Count + Res; end if; end loop; ! return ssize_t (Count); end C_Recvmsg; -------------- --- 290,370 ---- for Iovec'Address use MH.Msg_Iov; pragma Import (Ada, Iovec); + Iov_Index : Integer; + Current_Iovec : Vector_Element; + + function To_Access is new Ada.Unchecked_Conversion + (System.Address, Stream_Element_Reference); + pragma Warnings (Off, Stream_Element_Reference); + + Req : Request_Type (Name => N_Bytes_To_Read); + begin -- Windows does not provide an implementation of recvmsg(). The spec for -- WSARecvMsg() is incompatible with the data types we define, and is ! -- available starting with Windows Vista and Server 2008 only. So, ! -- we use C_Recv instead. ! -- Check how much data are available ! ! Control_Socket (Socket_Type (S), Req); ! ! -- Fill the vectors ! ! Iov_Index := -1; ! Current_Iovec := (Base => null, Length => 0); ! ! loop ! if Current_Iovec.Length = 0 then ! Iov_Index := Iov_Index + 1; ! exit when Iov_Index > Integer (Iovec'Last); ! Current_Iovec := Iovec (SOSC.Msg_Iovlen_T (Iov_Index)); ! end if; ! ! Res := ! C_Recv ! (S, ! Current_Iovec.Base.all'Address, ! C.int (Current_Iovec.Length), ! Flags); if Res < 0 then ! return System.CRTL.ssize_t (Res); ! ! elsif Res = 0 and then not Fill then ! exit; ! else + pragma Assert (Stream_Element_Count (Res) <= Current_Iovec.Length); + Count := Count + Res; + Current_Iovec.Length := + Current_Iovec.Length - Stream_Element_Count (Res); + Current_Iovec.Base := + To_Access (Current_Iovec.Base.all'Address + + Storage_Offset (Res)); + + -- If all the data that was initially available read, do not + -- attempt to receive more, since this might block, or merge data + -- from successive datagrams for a datagram-oriented socket. We + -- still try to receive more if we need to fill all vectors + -- (MSG_WAITALL flag is set). + + exit when Natural (Count) >= Req.Size + and then + + -- Either we are not in fill mode + + (not Fill + + -- Or else last vector filled + + or else (Interfaces.C.size_t (Iov_Index) = Iovec'Last + and then Current_Iovec.Length = 0)); end if; end loop; ! ! return System.CRTL.ssize_t (Count); end C_Recvmsg; -------------- *************** package body GNAT.Sockets.Thin is *** 322,329 **** Last : aliased C.int; begin ! -- Asynchronous connection failures are notified in the exception fd set ! -- instead of the write fd set. To ensure POSIX compatibility, copy -- write fd set into exception fd set. Once select() returns, check any -- socket present in the exception fd set and peek at incoming -- out-of-band data. If the test is not successful, and the socket is --- 387,394 ---- Last : aliased C.int; begin ! -- Asynchronous connection failures are notified in the exception fd ! -- set instead of the write fd set. To ensure POSIX compatibility, copy -- write fd set into exception fd set. Once select() returns, check any -- socket present in the exception fd set and peek at incoming -- out-of-band data. If the test is not successful, and the socket is *************** package body GNAT.Sockets.Thin is *** 369,378 **** -- Check out-of-band data ! Length := C_Recvfrom ! (S, Buffer'Address, 1, Flag, ! From => System.Null_Address, ! Fromlen => Fromlen'Unchecked_Access); -- Is Fromlen necessary if From is Null_Address??? -- If the signal is not an out-of-band data, then it --- 434,444 ---- -- Check out-of-band data ! Length := ! C_Recvfrom ! (S, Buffer'Address, 1, Flag, ! From => System.Null_Address, ! Fromlen => Fromlen'Unchecked_Access); -- Is Fromlen necessary if From is Null_Address??? -- If the signal is not an out-of-band data, then it *************** package body GNAT.Sockets.Thin is *** 404,411 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is Res : C.int; Count : C.int := 0; --- 470,479 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is + use type C.size_t; + Res : C.int; Count : C.int := 0; *************** package body GNAT.Sockets.Thin is *** 419,443 **** begin -- Windows does not provide an implementation of sendmsg(). The spec for -- WSASendMsg() is incompatible with the data types we define, and is ! -- not available in all versions of Windows. So, we'll use C_Sendto ! -- instead. for J in Iovec'Range loop ! Res := C_Sendto ! (S, ! Iovec (J).Base.all'Address, ! C.int (Iovec (J).Length), ! Flags => Flags, ! To => MH.Msg_Name, ! Tolen => C.int (MH.Msg_Namelen)); if Res < 0 then ! return ssize_t (Res); else Count := Count + Res; end if; end loop; ! return ssize_t (Count); end C_Sendmsg; -------------- --- 487,517 ---- begin -- Windows does not provide an implementation of sendmsg(). The spec for -- WSASendMsg() is incompatible with the data types we define, and is ! -- available starting with Windows Vista and Server 2008 only. So ! -- use C_Sendto instead. for J in Iovec'Range loop ! Res := ! C_Sendto ! (S, ! Iovec (J).Base.all'Address, ! C.int (Iovec (J).Length), ! Flags => Flags, ! To => MH.Msg_Name, ! Tolen => C.int (MH.Msg_Namelen)); if Res < 0 then ! return System.CRTL.ssize_t (Res); else Count := Count + Res; end if; + + -- Exit now if the buffer is not fully transmitted + + exit when Stream_Element_Count (Res) < Iovec (J).Length; end loop; ! ! return System.CRTL.ssize_t (Count); end C_Sendmsg; -------------- *************** package body GNAT.Sockets.Thin is *** 459,471 **** package body Host_Error_Messages is -- On Windows, socket and host errors share the same code space, and ! -- error messages are provided by Socket_Error_Message. The default ! -- separate body for Host_Error_Messages is therefore not used in ! -- this case. function Host_Error_Message (H_Errno : Integer) return C.Strings.chars_ptr ! renames Socket_Error_Message; end Host_Error_Messages; --- 533,544 ---- package body Host_Error_Messages is -- On Windows, socket and host errors share the same code space, and ! -- error messages are provided by Socket_Error_Message, so the default ! -- separate body for Host_Error_Messages is not used in this case. function Host_Error_Message (H_Errno : Integer) return C.Strings.chars_ptr ! renames Socket_Error_Message; end Host_Error_Messages; diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi-mingw.ads gcc-4.6.0/gcc/ada/g-socthi-mingw.ads *** gcc-4.5.2/gcc/ada/g-socthi-mingw.ads Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi-mingw.ads Thu Jun 17 12:26:10 2010 *************** with Interfaces.C.Strings; *** 42,47 **** --- 42,48 ---- with GNAT.Sockets.Thin_Common; with System; + with System.CRTL; package GNAT.Sockets.Thin is *************** package GNAT.Sockets.Thin is *** 49,58 **** package C renames Interfaces.C; ! use type C.size_t; ! type ssize_t is range -(2 ** (C.size_t'Size - 1)) ! .. +(2 ** (C.size_t'Size - 1) - 1); ! -- Signed type of the same size as size_t function Socket_Errno return Integer; -- Returns last socket error number --- 50,56 ---- package C renames Interfaces.C; ! use type System.CRTL.ssize_t; function Socket_Errno return Integer; -- Returns last socket error number *************** package GNAT.Sockets.Thin is *** 146,152 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Select (Nfds : C.int; --- 144,150 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Select (Nfds : C.int; *************** package GNAT.Sockets.Thin is *** 158,164 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Sendto (S : C.int; --- 156,162 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Sendto (S : C.int; diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi-vms.adb gcc-4.6.0/gcc/ada/g-socthi-vms.adb *** gcc-4.5.2/gcc/ada/g-socthi-vms.adb Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi-vms.adb Thu Jun 17 12:26:10 2010 *************** package body GNAT.Sockets.Thin is *** 292,298 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is Res : C.int; --- 292,298 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is Res : C.int; *************** package body GNAT.Sockets.Thin is *** 314,320 **** GNAT_Msg := Msghdr (VMS_Msg); ! return ssize_t (Res); end C_Recvmsg; --------------- --- 314,320 ---- GNAT_Msg := Msghdr (VMS_Msg); ! return System.CRTL.ssize_t (Res); end C_Recvmsg; --------------- *************** package body GNAT.Sockets.Thin is *** 324,330 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is Res : C.int; --- 324,330 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is Res : C.int; *************** package body GNAT.Sockets.Thin is *** 346,352 **** GNAT_Msg := Msghdr (VMS_Msg); ! return ssize_t (Res); end C_Sendmsg; -------------- --- 346,352 ---- GNAT_Msg := Msghdr (VMS_Msg); ! return System.CRTL.ssize_t (Res); end C_Sendmsg; -------------- diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi-vms.ads gcc-4.6.0/gcc/ada/g-socthi-vms.ads *** gcc-4.5.2/gcc/ada/g-socthi-vms.ads Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi-vms.ads Thu Jun 17 12:26:10 2010 *************** with GNAT.OS_Lib; *** 43,48 **** --- 43,49 ---- with GNAT.Sockets.Thin_Common; with System; + with System.CRTL; package GNAT.Sockets.Thin is *************** package GNAT.Sockets.Thin is *** 52,61 **** package C renames Interfaces.C; ! use type C.size_t; ! type ssize_t is range -(2 ** (C.size_t'Size - 1)) ! .. +(2 ** (C.size_t'Size - 1) - 1); ! -- Signed type of the same size as size_t function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number --- 53,59 ---- package C renames Interfaces.C; ! use type System.CRTL.ssize_t; function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number *************** package GNAT.Sockets.Thin is *** 149,155 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Select (Nfds : C.int; --- 147,153 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Select (Nfds : C.int; *************** package GNAT.Sockets.Thin is *** 161,167 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Sendto (S : C.int; --- 159,165 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Sendto (S : C.int; diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi-vxworks.adb gcc-4.6.0/gcc/ada/g-socthi-vxworks.adb *** gcc-4.5.2/gcc/ada/g-socthi-vxworks.adb Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi-vxworks.adb Thu Jun 17 12:26:10 2010 *************** package body GNAT.Sockets.Thin is *** 309,315 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is Res : C.int; --- 309,315 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is Res : C.int; *************** package body GNAT.Sockets.Thin is *** 323,329 **** delay Quantum; end loop; ! return ssize_t (Res); end C_Recvmsg; --------------- --- 323,329 ---- delay Quantum; end loop; ! return System.CRTL.ssize_t (Res); end C_Recvmsg; --------------- *************** package body GNAT.Sockets.Thin is *** 333,339 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is Res : C.int; --- 333,339 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is Res : C.int; *************** package body GNAT.Sockets.Thin is *** 347,353 **** delay Quantum; end loop; ! return ssize_t (Res); end C_Sendmsg; -------------- --- 347,353 ---- delay Quantum; end loop; ! return System.CRTL.ssize_t (Res); end C_Sendmsg; -------------- diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi-vxworks.ads gcc-4.6.0/gcc/ada/g-socthi-vxworks.ads *** gcc-4.5.2/gcc/ada/g-socthi-vxworks.ads Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi-vxworks.ads Thu Jun 17 12:26:10 2010 *************** with GNAT.OS_Lib; *** 43,48 **** --- 43,49 ---- with GNAT.Sockets.Thin_Common; with System; + with System.CRTL; package GNAT.Sockets.Thin is *************** package GNAT.Sockets.Thin is *** 50,59 **** package C renames Interfaces.C; ! use type C.size_t; ! type ssize_t is range -(2 ** (C.size_t'Size - 1)) ! .. +(2 ** (C.size_t'Size - 1) - 1); ! -- Signed type of the same size as size_t function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number --- 51,57 ---- package C renames Interfaces.C; ! use type System.CRTL.ssize_t; function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number *************** package GNAT.Sockets.Thin is *** 147,153 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Select (Nfds : C.int; --- 145,151 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Select (Nfds : C.int; *************** package GNAT.Sockets.Thin is *** 159,165 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Sendto (S : C.int; --- 157,163 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Sendto (S : C.int; diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi.adb gcc-4.6.0/gcc/ada/g-socthi.adb *** gcc-4.5.2/gcc/ada/g-socthi.adb Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi.adb Thu Jun 17 12:26:10 2010 *************** package body GNAT.Sockets.Thin is *** 95,107 **** function Syscall_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; pragma Import (C, Syscall_Recvmsg, "recvmsg"); function Syscall_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; pragma Import (C, Syscall_Sendmsg, "sendmsg"); function Syscall_Sendto --- 95,107 ---- function Syscall_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; pragma Import (C, Syscall_Recvmsg, "recvmsg"); function Syscall_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; pragma Import (C, Syscall_Sendmsg, "sendmsg"); function Syscall_Sendto *************** package body GNAT.Sockets.Thin is *** 307,321 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is ! Res : ssize_t; begin loop Res := Syscall_Recvmsg (S, Msg, Flags); exit when SOSC.Thread_Blocking_IO ! or else Res /= ssize_t (Failure) or else Non_Blocking_Socket (S) or else Errno /= SOSC.EWOULDBLOCK; delay Quantum; --- 307,321 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is ! Res : System.CRTL.ssize_t; begin loop Res := Syscall_Recvmsg (S, Msg, Flags); exit when SOSC.Thread_Blocking_IO ! or else Res /= System.CRTL.ssize_t (Failure) or else Non_Blocking_Socket (S) or else Errno /= SOSC.EWOULDBLOCK; delay Quantum; *************** package body GNAT.Sockets.Thin is *** 331,345 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t is ! Res : ssize_t; begin loop Res := Syscall_Sendmsg (S, Msg, Flags); exit when SOSC.Thread_Blocking_IO ! or else Res /= ssize_t (Failure) or else Non_Blocking_Socket (S) or else Errno /= SOSC.EWOULDBLOCK; delay Quantum; --- 331,345 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t is ! Res : System.CRTL.ssize_t; begin loop Res := Syscall_Sendmsg (S, Msg, Flags); exit when SOSC.Thread_Blocking_IO ! or else Res /= System.CRTL.ssize_t (Failure) or else Non_Blocking_Socket (S) or else Errno /= SOSC.EWOULDBLOCK; delay Quantum; diff -Nrcpad gcc-4.5.2/gcc/ada/g-socthi.ads gcc-4.6.0/gcc/ada/g-socthi.ads *** gcc-4.5.2/gcc/ada/g-socthi.ads Mon Nov 30 09:31:28 2009 --- gcc-4.6.0/gcc/ada/g-socthi.ads Thu Jun 17 12:26:10 2010 *************** with GNAT.OS_Lib; *** 43,48 **** --- 43,49 ---- with GNAT.Sockets.Thin_Common; with System; + with System.CRTL; package GNAT.Sockets.Thin is *************** package GNAT.Sockets.Thin is *** 54,63 **** package C renames Interfaces.C; ! use type C.size_t; ! type ssize_t is range -(2 ** (C.size_t'Size - 1)) ! .. +(2 ** (C.size_t'Size - 1) - 1); ! -- Signed type of the same size as size_t function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number --- 55,61 ---- package C renames Interfaces.C; ! use type System.CRTL.ssize_t; function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number *************** package GNAT.Sockets.Thin is *** 148,154 **** function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Select (Nfds : C.int; --- 146,152 ---- function C_Recvmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Select (Nfds : C.int; *************** package GNAT.Sockets.Thin is *** 160,166 **** function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return ssize_t; function C_Sendto (S : C.int; --- 158,164 ---- function C_Sendmsg (S : C.int; Msg : System.Address; ! Flags : C.int) return System.CRTL.ssize_t; function C_Sendto (S : C.int; diff -Nrcpad gcc-4.5.2/gcc/ada/g-sothco.ads gcc-4.6.0/gcc/ada/g-sothco.ads *** gcc-4.5.2/gcc/ada/g-sothco.ads Mon Nov 30 10:38:23 2009 --- gcc-4.6.0/gcc/ada/g-sothco.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2010, 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- -- *************** with Ada.Unchecked_Conversion; *** 38,44 **** with Interfaces.C; with Interfaces.C.Pointers; - with Interfaces.C.Strings; package GNAT.Sockets.Thin_Common is --- 38,43 ---- *************** package GNAT.Sockets.Thin_Common is *** 200,217 **** pragma Inline (Set_Address); -- Set Sin.Sin_Addr to Address --------------------- -- Service entries -- --------------------- - type Chars_Ptr_Array is array (C.size_t range <>) of - aliased C.Strings.chars_ptr; - - package Chars_Ptr_Pointers is - new C.Pointers (C.size_t, C.Strings.chars_ptr, Chars_Ptr_Array, - C.Strings.Null_Ptr); - -- Arrays of C (char *) - type Servent is new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_servent); for Servent'Alignment use 8; --- 199,243 ---- pragma Inline (Set_Address); -- Set Sin.Sin_Addr to Address + ------------------ + -- Host entries -- + ------------------ + + type Hostent is new + System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_hostent); + for Hostent'Alignment use 8; + -- Host entry. This is an opaque type used only via the following + -- accessor functions, because 'struct hostent' has different layouts on + -- different platforms. + + type Hostent_Access is access all Hostent; + pragma Convention (C, Hostent_Access); + -- Access to host entry + + -- Note: the hostent and servent accessors that return char* + -- values are compiled with GCC, and on VMS they always return + -- 64-bit pointers, so we can't use C.Strings.chars_ptr, which + -- on VMS is 32 bits. + + function Hostent_H_Name + (E : Hostent_Access) return System.Address; + + function Hostent_H_Alias + (E : Hostent_Access; I : C.int) return System.Address; + + function Hostent_H_Addrtype + (E : Hostent_Access) return C.int; + + function Hostent_H_Length + (E : Hostent_Access) return C.int; + + function Hostent_H_Addr + (E : Hostent_Access; Index : C.int) return System.Address; + --------------------- -- Service entries -- --------------------- type Servent is new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_servent); for Servent'Alignment use 8; *************** package GNAT.Sockets.Thin_Common is *** 224,273 **** -- Access to service entry function Servent_S_Name ! (E : Servent_Access) return C.Strings.chars_ptr; ! function Servent_S_Aliases ! (E : Servent_Access) return Chars_Ptr_Pointers.Pointer; function Servent_S_Port ! (E : Servent_Access) return C.int; function Servent_S_Proto ! (E : Servent_Access) return C.Strings.chars_ptr; ! ! procedure Servent_Set_S_Name ! (E : Servent_Access; ! S_Name : C.Strings.chars_ptr); ! procedure Servent_Set_S_Aliases ! (E : Servent_Access; ! S_Aliases : Chars_Ptr_Pointers.Pointer); ! procedure Servent_Set_S_Port ! (E : Servent_Access; ! S_Port : C.int); ! procedure Servent_Set_S_Proto ! (E : Servent_Access; ! S_Proto : C.Strings.chars_ptr); ! ------------------ ! -- Host entries -- ! ------------------ ! type Hostent is record ! H_Name : C.Strings.chars_ptr; ! H_Aliases : Chars_Ptr_Pointers.Pointer; ! H_Addrtype : SOSC.H_Addrtype_T; ! H_Length : SOSC.H_Length_T; ! H_Addr_List : In_Addr_Access_Pointers.Pointer; ! end record; ! pragma Convention (C, Hostent); ! -- Host entry ! type Hostent_Access is access all Hostent; ! pragma Convention (C, Hostent_Access); ! -- Access to host entry ------------------------------------ -- Scatter/gather vector handling -- --- 250,311 ---- -- Access to service entry function Servent_S_Name ! (E : Servent_Access) return System.Address; ! function Servent_S_Alias ! (E : Servent_Access; Index : C.int) return System.Address; function Servent_S_Port ! (E : Servent_Access) return C.unsigned_short; function Servent_S_Proto ! (E : Servent_Access) return System.Address; ! ------------------ ! -- NetDB access -- ! ------------------ ! -- There are three possible situations for the following NetDB access ! -- functions: ! -- - inherently thread safe (case of data returned in a thread specific ! -- buffer); ! -- - thread safe using user-provided buffer; ! -- - thread unsafe. ! -- ! -- In the first and third cases, the Buf and Buflen are ignored. In the ! -- second case, the caller must provide a buffer large enough to ! -- accommodate the returned data. In the third case, the caller must ensure ! -- that these functions are called within a critical section. ! function C_Gethostbyname ! (Name : C.char_array; ! Ret : not null access Hostent; ! Buf : System.Address; ! Buflen : C.int; ! H_Errnop : not null access C.int) return C.int; ! function C_Gethostbyaddr ! (Addr : System.Address; ! Addr_Len : C.int; ! Addr_Type : C.int; ! Ret : not null access Hostent; ! Buf : System.Address; ! Buflen : C.int; ! H_Errnop : not null access C.int) return C.int; ! function C_Getservbyname ! (Name : C.char_array; ! Proto : C.char_array; ! Ret : not null access Servent; ! Buf : System.Address; ! Buflen : C.int) return C.int; ! function C_Getservbyport ! (Port : C.int; ! Proto : C.char_array; ! Ret : not null access Servent; ! Buf : System.Address; ! Buflen : C.int) return C.int; ------------------------------------ -- Scatter/gather vector handling -- *************** package GNAT.Sockets.Thin_Common is *** 339,350 **** Read_End : constant := 0; Write_End : constant := 1; ! -- Indices into an Fd_Pair value providing access to each of the connected -- file descriptors. function Inet_Pton (Af : C.int; ! Cp : C.Strings.chars_ptr; Inp : System.Address) return C.int; function C_Ioctl --- 377,388 ---- Read_End : constant := 0; Write_End : constant := 1; ! -- Indexes into an Fd_Pair value providing access to each of the connected -- file descriptors. function Inet_Pton (Af : C.int; ! Cp : System.Address; Inp : System.Address) return C.int; function C_Ioctl *************** private *** 362,373 **** pragma Import (C, C_Ioctl, "__gnat_socket_ioctl"); pragma Import (C, Inet_Pton, SOSC.Inet_Pton_Linkname); ! pragma Import (C, Servent_S_Name, "__gnat_servent_s_name"); ! pragma Import (C, Servent_S_Aliases, "__gnat_servent_s_aliases"); ! pragma Import (C, Servent_S_Port, "__gnat_servent_s_port"); pragma Import (C, Servent_S_Proto, "__gnat_servent_s_proto"); ! pragma Import (C, Servent_Set_S_Name, "__gnat_servent_set_s_name"); ! pragma Import (C, Servent_Set_S_Aliases, "__gnat_servent_set_s_aliases"); ! pragma Import (C, Servent_Set_S_Port, "__gnat_servent_set_s_port"); ! pragma Import (C, Servent_Set_S_Proto, "__gnat_servent_set_s_proto"); end GNAT.Sockets.Thin_Common; --- 400,419 ---- pragma Import (C, C_Ioctl, "__gnat_socket_ioctl"); pragma Import (C, Inet_Pton, SOSC.Inet_Pton_Linkname); ! pragma Import (C, C_Gethostbyname, "__gnat_gethostbyname"); ! pragma Import (C, C_Gethostbyaddr, "__gnat_gethostbyaddr"); ! pragma Import (C, C_Getservbyname, "__gnat_getservbyname"); ! pragma Import (C, C_Getservbyport, "__gnat_getservbyport"); ! ! pragma Import (C, Servent_S_Name, "__gnat_servent_s_name"); ! pragma Import (C, Servent_S_Alias, "__gnat_servent_s_alias"); ! pragma Import (C, Servent_S_Port, "__gnat_servent_s_port"); pragma Import (C, Servent_S_Proto, "__gnat_servent_s_proto"); ! ! pragma Import (C, Hostent_H_Name, "__gnat_hostent_h_name"); ! pragma Import (C, Hostent_H_Alias, "__gnat_hostent_h_alias"); ! pragma Import (C, Hostent_H_Addrtype, "__gnat_hostent_h_addrtype"); ! pragma Import (C, Hostent_H_Length, "__gnat_hostent_h_length"); ! pragma Import (C, Hostent_H_Addr, "__gnat_hostent_h_addr"); ! end GNAT.Sockets.Thin_Common; diff -Nrcpad gcc-4.5.2/gcc/ada/g-spipat.adb gcc-4.6.0/gcc/ada/g-spipat.adb *** gcc-4.5.2/gcc/ada/g-spipat.adb Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/g-spipat.adb Fri Jun 18 12:29:49 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- *************** package body GNAT.Spitbol.Patterns is *** 2793,2801 **** (Subject : VString; Pat : Pattern) return Boolean is ! S : String_Access; L : Natural; - Start : Natural; Stop : Natural; pragma Unreferenced (Stop); --- 2793,2800 ---- (Subject : VString; Pat : Pattern) return Boolean is ! S : Big_String_Access; L : Natural; Start : Natural; Stop : Natural; pragma Unreferenced (Stop); *************** package body GNAT.Spitbol.Patterns is *** 2838,2844 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 2837,2843 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 2867,2873 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 2866,2872 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 2892,2898 **** (Subject : VString; Pat : Pattern) is ! S : String_Access; L : Natural; Start : Natural; --- 2891,2897 ---- (Subject : VString; Pat : Pattern) is ! S : Big_String_Access; L : Natural; Start : Natural; *************** package body GNAT.Spitbol.Patterns is *** 2933,2939 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 2932,2938 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 2958,2964 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 2957,2963 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 2980,2986 **** Pat : PString) return Boolean is Pat_Len : constant Natural := Pat'Length; ! S : String_Access; L : Natural; begin --- 2979,2985 ---- Pat : PString) return Boolean is Pat_Len : constant Natural := Pat'Length; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3038,3044 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 3037,3043 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3067,3073 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 3066,3072 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3092,3098 **** (Subject : VString; Pat : PString) is ! S : String_Access; L : Natural; Start : Natural; --- 3091,3097 ---- (Subject : VString; Pat : PString) is ! S : Big_String_Access; L : Natural; Start : Natural; *************** package body GNAT.Spitbol.Patterns is *** 3133,3139 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 3132,3138 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3158,3164 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 3157,3163 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3182,3188 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 3181,3187 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3213,3219 **** is Start : Natural; Stop : Natural; ! S : String_Access; L : Natural; begin --- 3212,3218 ---- is Start : Natural; Stop : Natural; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3362,3368 **** (Result : in out Match_Result; Replace : VString) is ! S : String_Access; L : Natural; begin --- 3361,3367 ---- (Result : in out Match_Result; Replace : VString) is ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3955,3961 **** when PC_Any_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 3954,3960 ---- when PC_Any_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 3975,3981 **** when PC_Any_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 3974,3980 ---- when PC_Any_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4142,4148 **** when PC_Break_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 4141,4147 ---- when PC_Break_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4163,4169 **** when PC_Break_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 4162,4168 ---- when PC_Break_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4210,4216 **** when PC_BreakX_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 4209,4215 ---- when PC_BreakX_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4231,4237 **** when PC_BreakX_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 4230,4236 ---- when PC_BreakX_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4376,4382 **** when PC_NotAny_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 4375,4381 ---- when PC_NotAny_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4397,4403 **** when PC_NotAny_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 4396,4402 ---- when PC_NotAny_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4440,4446 **** when PC_NSpan_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 4439,4445 ---- when PC_NSpan_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4459,4465 **** when PC_NSpan_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 4458,4464 ---- when PC_NSpan_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4682,4688 **** when PC_Span_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; P : Natural; --- 4681,4687 ---- when PC_Span_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; P : Natural; *************** package body GNAT.Spitbol.Patterns is *** 4708,4714 **** when PC_Span_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; P : Natural; --- 4707,4713 ---- when PC_Span_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; P : Natural; *************** package body GNAT.Spitbol.Patterns is *** 4809,4815 **** when PC_String_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 4808,4814 ---- when PC_String_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 4829,4835 **** when PC_String_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 4828,4834 ---- when PC_String_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5354,5360 **** when PC_Any_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 5353,5359 ---- when PC_Any_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5376,5382 **** when PC_Any_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 5375,5381 ---- when PC_Any_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5563,5569 **** when PC_Break_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 5562,5568 ---- when PC_Break_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5585,5591 **** when PC_Break_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 5584,5590 ---- when PC_Break_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5637,5643 **** when PC_BreakX_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 5636,5642 ---- when PC_BreakX_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5659,5665 **** when PC_BreakX_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 5658,5664 ---- when PC_BreakX_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5826,5832 **** when PC_NotAny_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 5825,5831 ---- when PC_NotAny_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5848,5854 **** when PC_NotAny_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 5847,5853 ---- when PC_NotAny_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5896,5902 **** when PC_NSpan_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 5895,5901 ---- when PC_NSpan_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 5916,5922 **** when PC_NSpan_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 5915,5921 ---- when PC_NSpan_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 6172,6178 **** when PC_Span_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; P : Natural; --- 6171,6177 ---- when PC_Span_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; P : Natural; *************** package body GNAT.Spitbol.Patterns is *** 6199,6205 **** when PC_Span_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; P : Natural; --- 6198,6204 ---- when PC_Span_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; P : Natural; *************** package body GNAT.Spitbol.Patterns is *** 6314,6320 **** when PC_String_VF => declare U : constant VString := Node.VF.all; ! S : String_Access; L : Natural; begin --- 6313,6319 ---- when PC_String_VF => declare U : constant VString := Node.VF.all; ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol.Patterns is *** 6335,6341 **** when PC_String_VP => declare U : constant VString := Node.VP.all; ! S : String_Access; L : Natural; begin --- 6334,6340 ---- when PC_String_VP => declare U : constant VString := Node.VP.all; ! S : Big_String_Access; L : Natural; begin diff -Nrcpad gcc-4.5.2/gcc/ada/g-spitbo.adb gcc-4.6.0/gcc/ada/g-spitbo.adb *** gcc-4.5.2/gcc/ada/g-spitbo.adb Mon Jun 22 12:24:57 2009 --- gcc-4.6.0/gcc/ada/g-spitbo.adb Fri Jun 18 12:29:49 2010 *************** package body GNAT.Spitbol is *** 135,141 **** ------- function N (Str : VString) return Integer is ! S : String_Access; L : Natural; begin Get_String (Str, S, L); --- 135,141 ---- ------- function N (Str : VString) return Integer is ! S : Big_String_Access; L : Natural; begin Get_String (Str, S, L); *************** package body GNAT.Spitbol is *** 147,153 **** -------------------- function Reverse_String (Str : VString) return VString is ! S : String_Access; L : Natural; begin --- 147,153 ---- -------------------- function Reverse_String (Str : VString) return VString is ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol is *** 177,183 **** end Reverse_String; procedure Reverse_String (Str : in out VString) is ! S : String_Access; L : Natural; begin --- 177,183 ---- end Reverse_String; procedure Reverse_String (Str : in out VString) is ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol is *** 191,197 **** Result (J) := S (L + 1 - J); end loop; ! Set_String (Str, Result); end; end Reverse_String; --- 191,197 ---- Result (J) := S (L + 1 - J); end loop; ! Set_Unbounded_String (Str, Result); end; end Reverse_String; *************** package body GNAT.Spitbol is *** 284,290 **** Start : Positive; Len : Natural) return VString is ! S : String_Access; L : Natural; begin --- 284,290 ---- Start : Positive; Len : Natural) return VString is ! S : Big_String_Access; L : Natural; begin *************** package body GNAT.Spitbol is *** 413,419 **** if Elmt.Name /= null then loop ! Set_String (TA (P).Name, Elmt.Name.all); TA (P).Value := Elmt.Value; P := P + 1; Elmt := Elmt.Next; --- 413,419 ---- if Elmt.Name /= null then loop ! Set_Unbounded_String (TA (P).Name, Elmt.Name.all); TA (P).Value := Elmt.Value; P := P + 1; Elmt := Elmt.Next; *************** package body GNAT.Spitbol is *** 458,464 **** end Delete; procedure Delete (T : in out Table; Name : VString) is ! S : String_Access; L : Natural; begin Get_String (Name, S, L); --- 458,464 ---- end Delete; procedure Delete (T : in out Table; Name : VString) is ! S : Big_String_Access; L : Natural; begin Get_String (Name, S, L); *************** package body GNAT.Spitbol is *** 584,590 **** end Get; function Get (T : Table; Name : VString) return Value_Type is ! S : String_Access; L : Natural; begin Get_String (Name, S, L); --- 584,590 ---- end Get; function Get (T : Table; Name : VString) return Value_Type is ! S : Big_String_Access; L : Natural; begin Get_String (Name, S, L); *************** package body GNAT.Spitbol is *** 625,631 **** end Present; function Present (T : Table; Name : VString) return Boolean is ! S : String_Access; L : Natural; begin Get_String (Name, S, L); --- 625,631 ---- end Present; function Present (T : Table; Name : VString) return Boolean is ! S : Big_String_Access; L : Natural; begin Get_String (Name, S, L); *************** package body GNAT.Spitbol is *** 661,667 **** --------- procedure Set (T : in out Table; Name : VString; Value : Value_Type) is ! S : String_Access; L : Natural; begin Get_String (Name, S, L); --- 661,667 ---- --------- procedure Set (T : in out Table; Name : VString; Value : Value_Type) is ! S : Big_String_Access; L : Natural; begin Get_String (Name, S, L); diff -Nrcpad gcc-4.5.2/gcc/ada/g-sttsne-dummy.ads gcc-4.6.0/gcc/ada/g-sttsne-dummy.ads *** gcc-4.5.2/gcc/ada/g-sttsne-dummy.ads Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/g-sttsne-dummy.ads Thu Jan 1 00:00:00 1970 *************** *** 1,39 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B -- - -- -- - -- S p e c -- - -- -- - -- 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- -- - -- 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 is a placeholder for the sockets binding for platforms where - -- it is not implemented. - - package GNAT.Sockets.Thin.Task_Safe_NetDB is - pragma Unimplemented_Unit; - end GNAT.Sockets.Thin.Task_Safe_NetDB; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/g-sttsne-locking.adb gcc-4.6.0/gcc/ada/g-sttsne-locking.adb *** gcc-4.5.2/gcc/ada/g-sttsne-locking.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/g-sttsne-locking.adb Thu Jan 1 00:00:00 1970 *************** *** 1,460 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B -- - -- -- - -- B o d y -- - -- -- - -- Copyright (C) 2007-2009, 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- -- - -- 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 version is used on VMS and LynxOS - - with GNAT.Task_Lock; - - with Interfaces.C; use Interfaces.C; - - package body GNAT.Sockets.Thin.Task_Safe_NetDB is - - -- The Safe_GetXXXbyYYY routines wrap the Nonreentrant_ versions using the - -- task lock, and copy the relevant data structures (under the lock) into - -- the result. The Nonreentrant_ versions are expected to be in the parent - -- package GNAT.Sockets.Thin (on platforms that use this version of - -- Task_Safe_NetDB). - - procedure Copy_Host_Entry - (Source_Hostent : Hostent; - Target_Hostent : out Hostent; - Target_Buffer : System.Address; - Target_Buffer_Length : C.int; - Result : out C.int); - -- Copy all the information from Source_Hostent into Target_Hostent, - -- using Target_Buffer to store associated data. - -- 0 is returned on success, -1 on failure (in case the provided buffer - -- is too small for the associated data). - - procedure Copy_Service_Entry - (Source_Servent : Servent_Access; - Target_Servent : Servent_Access; - Target_Buffer : System.Address; - Target_Buffer_Length : C.int; - Result : out C.int); - -- Copy all the information from Source_Servent into Target_Servent, - -- using Target_Buffer to store associated data. - -- 0 is returned on success, -1 on failure (in case the provided buffer - -- is too small for the associated data). - - procedure Store_Name - (Name : char_array; - Storage : in out char_array; - Storage_Index : in out size_t; - Stored_Name : out C.Strings.chars_ptr); - -- Store the given Name at the first available location in Storage - -- (indicated by Storage_Index, which is updated afterwards), and return - -- the address of that location in Stored_Name. - -- (Supporting routine for the two below). - - --------------------- - -- Copy_Host_Entry -- - --------------------- - - procedure Copy_Host_Entry - (Source_Hostent : Hostent; - Target_Hostent : out Hostent; - Target_Buffer : System.Address; - Target_Buffer_Length : C.int; - Result : out C.int) - is - use type C.Strings.chars_ptr; - - Names_Length : size_t; - - Source_Aliases : Chars_Ptr_Array - renames Chars_Ptr_Pointers.Value - (Source_Hostent.H_Aliases, Terminator => C.Strings.Null_Ptr); - -- Null-terminated list of aliases (last element of this array is - -- Null_Ptr). - - Source_Addresses : In_Addr_Access_Array - renames In_Addr_Access_Pointers.Value - (Source_Hostent.H_Addr_List, Terminator => null); - - begin - Result := -1; - Names_Length := C.Strings.Strlen (Source_Hostent.H_Name) + 1; - - for J in Source_Aliases'Range loop - if Source_Aliases (J) /= C.Strings.Null_Ptr then - Names_Length := - Names_Length + C.Strings.Strlen (Source_Aliases (J)) + 1; - end if; - end loop; - - declare - type In_Addr_Array is array (Source_Addresses'Range) - of aliased In_Addr; - - type Netdb_Host_Data is record - Aliases_List : aliased Chars_Ptr_Array (Source_Aliases'Range); - Names : aliased char_array (1 .. Names_Length); - - Addresses_List : aliased In_Addr_Access_Array - (In_Addr_Array'Range); - Addresses : In_Addr_Array; - -- ??? This assumes support only for Inet family - - end record; - - Netdb_Data : Netdb_Host_Data; - pragma Import (Ada, Netdb_Data); - for Netdb_Data'Address use Target_Buffer; - - Names_Index : size_t := Netdb_Data.Names'First; - -- Index of first available location in Netdb_Data.Names - - begin - if Netdb_Data'Size / 8 > Target_Buffer_Length then - return; - end if; - - -- Copy host name - - Store_Name - (C.Strings.Value (Source_Hostent.H_Name), - Netdb_Data.Names, Names_Index, - Target_Hostent.H_Name); - - -- Copy aliases (null-terminated string pointer array) - - Target_Hostent.H_Aliases := - Netdb_Data.Aliases_List - (Netdb_Data.Aliases_List'First)'Unchecked_Access; - for J in Netdb_Data.Aliases_List'Range loop - if J = Netdb_Data.Aliases_List'Last then - Netdb_Data.Aliases_List (J) := C.Strings.Null_Ptr; - else - Store_Name - (C.Strings.Value (Source_Aliases (J)), - Netdb_Data.Names, Names_Index, - Netdb_Data.Aliases_List (J)); - end if; - end loop; - - -- Copy address type and length - - Target_Hostent.H_Addrtype := Source_Hostent.H_Addrtype; - Target_Hostent.H_Length := Source_Hostent.H_Length; - - -- Copy addresses - - Target_Hostent.H_Addr_List := - Netdb_Data.Addresses_List - (Netdb_Data.Addresses_List'First)'Unchecked_Access; - - for J in Netdb_Data.Addresses'Range loop - if J = Netdb_Data.Addresses'Last then - Netdb_Data.Addresses_List (J) := null; - else - Netdb_Data.Addresses_List (J) := - Netdb_Data.Addresses (J)'Unchecked_Access; - - Netdb_Data.Addresses (J) := Source_Addresses (J).all; - end if; - end loop; - end; - - Result := 0; - end Copy_Host_Entry; - - ------------------------ - -- Copy_Service_Entry -- - ------------------------ - - procedure Copy_Service_Entry - (Source_Servent : Servent_Access; - Target_Servent : Servent_Access; - Target_Buffer : System.Address; - Target_Buffer_Length : C.int; - Result : out C.int) - is - use type C.Strings.chars_ptr; - - Names_Length : size_t; - - Source_Aliases : Chars_Ptr_Array - renames Chars_Ptr_Pointers.Value - (Servent_S_Aliases (Source_Servent), - Terminator => C.Strings.Null_Ptr); - -- Null-terminated list of aliases (last element of this array is - -- Null_Ptr). - - begin - Result := -1; - Names_Length := C.Strings.Strlen (Servent_S_Name (Source_Servent)) + 1 + - C.Strings.Strlen (Servent_S_Proto (Source_Servent)) + 1; - - for J in Source_Aliases'Range loop - if Source_Aliases (J) /= C.Strings.Null_Ptr then - Names_Length := - Names_Length + C.Strings.Strlen (Source_Aliases (J)) + 1; - end if; - end loop; - - declare - type Netdb_Service_Data is record - Aliases_List : aliased Chars_Ptr_Array (Source_Aliases'Range); - Names : aliased char_array (1 .. Names_Length); - end record; - - Netdb_Data : Netdb_Service_Data; - pragma Import (Ada, Netdb_Data); - for Netdb_Data'Address use Target_Buffer; - - Names_Index : size_t := Netdb_Data.Names'First; - -- Index of first available location in Netdb_Data.Names - - Stored_Name : C.Strings.chars_ptr; - - begin - if Netdb_Data'Size / 8 > Target_Buffer_Length then - return; - end if; - - -- Copy service name - - Store_Name - (C.Strings.Value (Servent_S_Name (Source_Servent)), - Netdb_Data.Names, Names_Index, - Stored_Name); - Servent_Set_S_Name (Target_Servent, Stored_Name); - - -- Copy aliases (null-terminated string pointer array) - - Servent_Set_S_Aliases - (Target_Servent, - Netdb_Data.Aliases_List - (Netdb_Data.Aliases_List'First)'Unchecked_Access); - - -- Copy port number - - Servent_Set_S_Port (Target_Servent, Servent_S_Port (Source_Servent)); - - -- Copy protocol name - - Store_Name - (C.Strings.Value (Servent_S_Proto (Source_Servent)), - Netdb_Data.Names, Names_Index, - Stored_Name); - Servent_Set_S_Proto (Target_Servent, Stored_Name); - - for J in Netdb_Data.Aliases_List'Range loop - if J = Netdb_Data.Aliases_List'Last then - Netdb_Data.Aliases_List (J) := C.Strings.Null_Ptr; - else - Store_Name - (C.Strings.Value (Source_Aliases (J)), - Netdb_Data.Names, Names_Index, - Netdb_Data.Aliases_List (J)); - end if; - end loop; - end; - - Result := 0; - end Copy_Service_Entry; - - ------------------------ - -- Safe_Gethostbyaddr -- - ------------------------ - - function Safe_Gethostbyaddr - (Addr : System.Address; - Addr_Len : C.int; - Addr_Type : C.int; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int - is - HE : Hostent_Access; - Result : C.int; - begin - Result := -1; - GNAT.Task_Lock.Lock; - HE := Nonreentrant_Gethostbyaddr (Addr, Addr_Len, Addr_Type); - - if HE = null then - H_Errnop.all := C.int (Host_Errno); - goto Unlock_Return; - end if; - - -- Now copy the data to the user-provided buffer - - Copy_Host_Entry - (Source_Hostent => HE.all, - Target_Hostent => Ret.all, - Target_Buffer => Buf, - Target_Buffer_Length => Buflen, - Result => Result); - - <> - GNAT.Task_Lock.Unlock; - return Result; - end Safe_Gethostbyaddr; - - ------------------------ - -- Safe_Gethostbyname -- - ------------------------ - - function Safe_Gethostbyname - (Name : C.char_array; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int - is - HE : Hostent_Access; - Result : C.int; - begin - Result := -1; - GNAT.Task_Lock.Lock; - HE := Nonreentrant_Gethostbyname (Name); - - if HE = null then - H_Errnop.all := C.int (Host_Errno); - goto Unlock_Return; - end if; - - -- Now copy the data to the user-provided buffer - - Copy_Host_Entry - (Source_Hostent => HE.all, - Target_Hostent => Ret.all, - Target_Buffer => Buf, - Target_Buffer_Length => Buflen, - Result => Result); - - <> - GNAT.Task_Lock.Unlock; - return Result; - end Safe_Gethostbyname; - - ------------------------ - -- Safe_Getservbyname -- - ------------------------ - - function Safe_Getservbyname - (Name : C.char_array; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int - is - SE : Servent_Access; - Result : C.int; - begin - Result := -1; - GNAT.Task_Lock.Lock; - SE := Nonreentrant_Getservbyname (Name, Proto); - - if SE = null then - goto Unlock_Return; - end if; - - -- Now copy the data to the user-provided buffer. We convert Ret to - -- type Servent_Access using the .all'Unchecked_Access trick to avoid - -- an accessibility check. Ret could be pointing to a nested variable, - -- and we don't want to raise an exception in that case. - - Copy_Service_Entry - (Source_Servent => SE, - Target_Servent => Ret.all'Unchecked_Access, - Target_Buffer => Buf, - Target_Buffer_Length => Buflen, - Result => Result); - - <> - GNAT.Task_Lock.Unlock; - return Result; - end Safe_Getservbyname; - - ------------------------ - -- Safe_Getservbyport -- - ------------------------ - - function Safe_Getservbyport - (Port : C.int; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int - is - SE : Servent_Access; - Result : C.int; - - begin - Result := -1; - GNAT.Task_Lock.Lock; - SE := Nonreentrant_Getservbyport (Port, Proto); - - if SE = null then - goto Unlock_Return; - end if; - - -- Now copy the data to the user-provided buffer. See Safe_Getservbyname - -- for comment regarding .all'Unchecked_Access. - - Copy_Service_Entry - (Source_Servent => SE, - Target_Servent => Ret.all'Unchecked_Access, - Target_Buffer => Buf, - Target_Buffer_Length => Buflen, - Result => Result); - - <> - GNAT.Task_Lock.Unlock; - return Result; - end Safe_Getservbyport; - - ---------------- - -- Store_Name -- - ---------------- - - procedure Store_Name - (Name : char_array; - Storage : in out char_array; - Storage_Index : in out size_t; - Stored_Name : out C.Strings.chars_ptr) - is - First : constant C.size_t := Storage_Index; - Last : constant C.size_t := Storage_Index + Name'Length - 1; - begin - Storage (First .. Last) := Name; - Stored_Name := C.Strings.To_Chars_Ptr - (Storage (First .. Last)'Unrestricted_Access); - Storage_Index := Last + 1; - end Store_Name; - - end GNAT.Sockets.Thin.Task_Safe_NetDB; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/g-sttsne-locking.ads gcc-4.6.0/gcc/ada/g-sttsne-locking.ads *** gcc-4.5.2/gcc/ada/g-sttsne-locking.ads Thu Dec 13 10:40:58 2007 --- gcc-4.6.0/gcc/ada/g-sttsne-locking.ads Thu Jan 1 00:00:00 1970 *************** *** 1,75 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B -- - -- -- - -- S p e c -- - -- -- - -- Copyright (C) 2007, 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- -- - -- 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 version is used on VMS, LynxOS, and VxWorks. There are two versions of - -- the body: one for VMS and LynxOS, the other for VxWorks. - - -- This package should not be directly with'ed by an application - - package GNAT.Sockets.Thin.Task_Safe_NetDB is - - ---------------------------------------- - -- Reentrant network databases access -- - ---------------------------------------- - - function Safe_Gethostbyname - (Name : C.char_array; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int; - - function Safe_Gethostbyaddr - (Addr : System.Address; - Addr_Len : C.int; - Addr_Type : C.int; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int; - - function Safe_Getservbyname - (Name : C.char_array; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int; - - function Safe_Getservbyport - (Port : C.int; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int; - - end GNAT.Sockets.Thin.Task_Safe_NetDB; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/g-sttsne-vxworks.adb gcc-4.6.0/gcc/ada/g-sttsne-vxworks.adb *** gcc-4.5.2/gcc/ada/g-sttsne-vxworks.adb Mon Apr 20 09:38:27 2009 --- gcc-4.6.0/gcc/ada/g-sttsne-vxworks.adb Thu Jan 1 00:00:00 1970 *************** *** 1,204 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B -- - -- -- - -- B o d y -- - -- -- - -- 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- -- - -- 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 version is used on VxWorks. Note that the corresponding spec is in - -- g-sttsne-locking.ads. - - with Ada.Unchecked_Conversion; - with Interfaces.C; use Interfaces.C; - - package body GNAT.Sockets.Thin.Task_Safe_NetDB is - - -- The following additional data is returned by Safe_Gethostbyname - -- and Safe_Getostbyaddr in the user provided buffer. - - type Netdb_Host_Data (Name_Length : C.size_t) is record - Address : aliased In_Addr; - Addr_List : aliased In_Addr_Access_Array (0 .. 1); - Name : aliased C.char_array (0 .. Name_Length); - end record; - - Alias_Access : constant Chars_Ptr_Pointers.Pointer := - new C.Strings.chars_ptr'(C.Strings.Null_Ptr); - -- Constant used to create a Hostent record manually - - ------------------------ - -- Safe_Gethostbyaddr -- - ------------------------ - - function Safe_Gethostbyaddr - (Addr : System.Address; - Addr_Len : C.int; - Addr_Type : C.int; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int - is - type int_Access is access int; - function To_Pointer is - new Ada.Unchecked_Conversion (System.Address, int_Access); - - function VxWorks_hostGetByAddr - (Addr : C.int; Buf : System.Address) return C.int; - pragma Import (C, VxWorks_hostGetByAddr, "hostGetByAddr"); - - Netdb_Data : Netdb_Host_Data (Name_Length => Max_Name_Length); - pragma Import (Ada, Netdb_Data); - for Netdb_Data'Address use Buf; - - begin - pragma Assert (Addr_Type = SOSC.AF_INET); - pragma Assert (Addr_Len = In_Addr'Size / 8); - - -- Check that provided buffer is sufficiently large to hold the - -- data we want to return. - - if Netdb_Data'Size / 8 > Buflen then - H_Errnop.all := SOSC.ERANGE; - return -1; - end if; - - if VxWorks_hostGetByAddr (To_Pointer (Addr).all, - Netdb_Data.Name'Address) - /= SOSC.OK - then - H_Errnop.all := C.int (Host_Errno); - return -1; - end if; - - Netdb_Data.Address := To_In_Addr (To_Pointer (Addr).all); - Netdb_Data.Addr_List := - (0 => Netdb_Data.Address'Unchecked_Access, - 1 => null); - - Ret.H_Name := C.Strings.To_Chars_Ptr - (Netdb_Data.Name'Unrestricted_Access); - Ret.H_Aliases := Alias_Access; - Ret.H_Addrtype := SOSC.AF_INET; - Ret.H_Length := 4; - Ret.H_Addr_List := - Netdb_Data.Addr_List (Netdb_Data.Addr_List'First)'Unchecked_Access; - return 0; - end Safe_Gethostbyaddr; - - ------------------------ - -- Safe_Gethostbyname -- - ------------------------ - - function Safe_Gethostbyname - (Name : C.char_array; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int - is - function VxWorks_hostGetByName - (Name : C.char_array) return C.int; - pragma Import (C, VxWorks_hostGetByName, "hostGetByName"); - - Addr : C.int; - - begin - Addr := VxWorks_hostGetByName (Name); - if Addr = SOSC.ERROR then - H_Errnop.all := C.int (Host_Errno); - return -1; - end if; - - declare - Netdb_Data : Netdb_Host_Data (Name_Length => Name'Length); - pragma Import (Ada, Netdb_Data); - for Netdb_Data'Address use Buf; - - begin - -- Check that provided buffer is sufficiently large to hold the - -- data we want to return. - - if Netdb_Data'Size / 8 > Buflen then - H_Errnop.all := SOSC.ERANGE; - return -1; - end if; - - Netdb_Data.Address := To_In_Addr (Addr); - Netdb_Data.Addr_List := - (0 => Netdb_Data.Address'Unchecked_Access, - 1 => null); - Netdb_Data.Name (Netdb_Data.Name'First .. Name'Length - 1) := Name; - - Ret.H_Name := C.Strings.To_Chars_Ptr - (Netdb_Data.Name'Unrestricted_Access); - Ret.H_Aliases := Alias_Access; - Ret.H_Addrtype := SOSC.AF_INET; - Ret.H_Length := 4; - Ret.H_Addr_List := - Netdb_Data.Addr_List (Netdb_Data.Addr_List'First)'Unchecked_Access; - end; - return 0; - end Safe_Gethostbyname; - - ------------------------ - -- Safe_Getservbyname -- - ------------------------ - - function Safe_Getservbyname - (Name : C.char_array; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int - is - pragma Unreferenced (Name, Proto, Ret, Buf, Buflen); - begin - -- Not available under VxWorks - return -1; - end Safe_Getservbyname; - - ------------------------ - -- Safe_Getservbyport -- - ------------------------ - - function Safe_Getservbyport - (Port : C.int; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int - is - pragma Unreferenced (Port, Proto, Ret, Buf, Buflen); - begin - -- Not available under VxWorks - return -1; - end Safe_Getservbyport; - - end GNAT.Sockets.Thin.Task_Safe_NetDB; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/g-sttsne.ads gcc-4.6.0/gcc/ada/g-sttsne.ads *** gcc-4.5.2/gcc/ada/g-sttsne.ads Thu Dec 13 10:40:58 2007 --- gcc-4.6.0/gcc/ada/g-sttsne.ads Thu Jan 1 00:00:00 1970 *************** *** 1,83 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T . S O C K E T S . T H I N . T A S K _ S A F E _ N E T D B -- - -- -- - -- S p e c -- - -- -- - -- Copyright (C) 2007, 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- -- - -- 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 exports reentrant NetDB subprograms. This is the default - -- version, used on most platforms. The routines are implemented by importing - -- from C; see gsocket.h for details. Different versions are provided on - -- platforms where this functionality is implemented in Ada. - - -- This package should not be directly with'ed by an application - - package GNAT.Sockets.Thin.Task_Safe_NetDB is - - ---------------------------------------- - -- Reentrant network databases access -- - ---------------------------------------- - - function Safe_Gethostbyname - (Name : C.char_array; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int; - - function Safe_Gethostbyaddr - (Addr : System.Address; - Addr_Len : C.int; - Addr_Type : C.int; - Ret : not null access Hostent; - Buf : System.Address; - Buflen : C.int; - H_Errnop : not null access C.int) return C.int; - - function Safe_Getservbyname - (Name : C.char_array; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int; - - function Safe_Getservbyport - (Port : C.int; - Proto : C.char_array; - Ret : not null access Servent; - Buf : System.Address; - Buflen : C.int) return C.int; - - private - pragma Import (C, Safe_Gethostbyname, "__gnat_safe_gethostbyname"); - pragma Import (C, Safe_Gethostbyaddr, "__gnat_safe_gethostbyaddr"); - pragma Import (C, Safe_Getservbyname, "__gnat_safe_getservbyname"); - pragma Import (C, Safe_Getservbyport, "__gnat_safe_getservbyport"); - - end GNAT.Sockets.Thin.Task_Safe_NetDB; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/g-trasym-vms-ia64.adb gcc-4.6.0/gcc/ada/g-trasym-vms-ia64.adb *** gcc-4.5.2/gcc/ada/g-trasym-vms-ia64.adb Fri Apr 17 13:07:12 2009 --- gcc-4.6.0/gcc/ada/g-trasym-vms-ia64.adb Mon Oct 18 09:37:14 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** with System.Traceback_Entries; *** 39,47 **** package body GNAT.Traceback.Symbolic is - pragma Warnings (Off); -- ??? needs comment - pragma Linker_Options ("--for-linker=sys$library:trace.exe"); - use System; use System.Aux_DEC; use System.Traceback_Entries; --- 39,44 ---- *************** package body GNAT.Traceback.Symbolic is *** 67,82 **** subtype Cond_Value_Type is Unsigned_Longword; ! function Symbolize ! (Current_PC : Address; ! Filename_Dsc : Address; ! Library_Dsc : Address; ! Record_Number : Address; ! Image_Dsc : Address; ! Module_Dsc : Address; ! Routine_Dsc : Address; ! Line_Number : Address; ! Relative_PC : Address) return Cond_Value_Type; pragma Import (C, Symbolize, "TBK$I64_SYMBOLIZE"); function Decode_Ada_Name (Encoded_Name : String) return String; --- 64,108 ---- subtype Cond_Value_Type is Unsigned_Longword; ! -- TBK_API_PARAM as defined in TBKDEF ! ! type Tbk_Api_Param is record ! Length : Unsigned_Word; ! T_Type : Unsigned_Byte; ! Version : Unsigned_Byte; ! Reserveda : Unsigned_Longword; ! Faulting_Pc : Address; ! Faulting_Fp : Address; ! Filename_Desc : Address; ! Library_Module_Desc : Address; ! Record_Number : Address; ! Image_Desc : Address; ! Module_Desc : Address; ! Routine_Desc : Address; ! Listing_Lineno : Address; ! Rel_Pc : Address; ! Image_Base_Addr : Address; ! Module_Base_Addr : Address; ! Malloc_Rtn : Address; ! Free_Rtn : Address; ! Symbolize_Flags : Address; ! Reserved0 : Unsigned_Quadword; ! Reserved1 : Unsigned_Quadword; ! Reserved2 : Unsigned_Quadword; ! end record; ! pragma Convention (C, Tbk_Api_Param); ! ! K_Version : constant Unsigned_Byte := 1; ! -- Current API version ! ! K_Length : constant Unsigned_Word := 152; ! -- Length of the parameter ! ! pragma Compile_Time_Error (Tbk_Api_Param'Size = K_Length * 8, ! "Bad length for tbk_api_param"); ! -- Sanity check ! ! function Symbolize (Param : Address) return Cond_Value_Type; pragma Import (C, Symbolize, "TBK$I64_SYMBOLIZE"); function Decode_Ada_Name (Encoded_Name : String) return String; *************** package body GNAT.Traceback.Symbolic is *** 173,192 **** ------------------------ function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is Status : Cond_Value_Type; ! Filename_Name : Var_String; ! Filename_Dsc : Descriptor64; ! Library_Name : Var_String; ! Library_Dsc : Descriptor64; ! Record_Number : Integer_64; Image_Name : Var_String; Image_Dsc : Descriptor64; Module_Name : Var_String; Module_Dsc : Descriptor64; Routine_Name : Var_String; Routine_Dsc : Descriptor64; ! Line_Number : Integer_64; ! Relative_PC : Integer_64; Res : String (1 .. 256 * Traceback'Length); Len : Integer; --- 199,214 ---- ------------------------ function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is + Param : Tbk_Api_Param; Status : Cond_Value_Type; ! Record_Number : Unsigned_Longword; Image_Name : Var_String; Image_Dsc : Descriptor64; Module_Name : Var_String; Module_Dsc : Descriptor64; Routine_Name : Var_String; Routine_Dsc : Descriptor64; ! Line_Number : Unsigned_Longword; Res : String (1 .. 256 * Traceback'Length); Len : Integer; *************** package body GNAT.Traceback.Symbolic is *** 201,268 **** System.Soft_Links.Lock_Task.all; ! Setup_Descriptor64_Vs (Filename_Dsc, Filename_Name'Address); ! Setup_Descriptor64_Vs (Library_Dsc, Library_Name'Address); Setup_Descriptor64_Vs (Image_Dsc, Image_Name'Address); Setup_Descriptor64_Vs (Module_Dsc, Module_Name'Address); Setup_Descriptor64_Vs (Routine_Dsc, Routine_Name'Address); for J in Traceback'Range loop ! Status := Symbolize ! (PC_For (Traceback (J)), ! Filename_Dsc'Address, ! Library_Dsc'Address, ! Record_Number'Address, ! Image_Dsc'Address, ! Module_Dsc'Address, ! Routine_Dsc'Address, ! Line_Number'Address, ! Relative_PC'Address); ! declare ! First : Integer := Len + 1; ! Last : Integer := First + 80 - 1; ! Pos : Integer; ! Routine_Name_D : String := ! Decode_Ada_Name ! (Routine_Name.Buf ! (1 .. Natural (Routine_Name.Curlen))); ! begin ! Res (First .. Last) := (others => ' '); ! Res (First .. First + Natural (Image_Name.Curlen) - 1) := ! Image_Name.Buf (1 .. Natural (Image_Name.Curlen)); ! Res (First + 10 .. ! First + 10 + Natural (Module_Name.Curlen) - 1) := ! Module_Name.Buf (1 .. Natural (Module_Name.Curlen)); ! Res (First + 30 .. ! First + 30 + Routine_Name_D'Length - 1) := ! Routine_Name_D; ! -- If routine name doesn't fit 20 characters, output ! -- the line number on next line at 50th position ! if Routine_Name_D'Length > 20 then ! Pos := First + 30 + Routine_Name_D'Length; ! Res (Pos) := ASCII.LF; ! Last := Pos + 80; ! Res (Pos + 1 .. Last) := (others => ' '); ! Pos := Pos + 51; ! else ! Pos := First + 50; end if; ! Res (Pos .. ! Pos + Integer_64'Image (Line_Number)'Length - 1) := ! Integer_64'Image (Line_Number); ! Res (Last) := ASCII.LF; ! Len := Last; ! end; end loop; System.Soft_Links.Unlock_Task.all; --- 223,336 ---- System.Soft_Links.Lock_Task.all; ! -- Initialize descriptors ! Setup_Descriptor64_Vs (Image_Dsc, Image_Name'Address); Setup_Descriptor64_Vs (Module_Dsc, Module_Name'Address); Setup_Descriptor64_Vs (Routine_Dsc, Routine_Name'Address); for J in Traceback'Range loop ! -- Initialize fields in case they are not written ! Record_Number := 0; ! Line_Number := 0; ! Image_Name.Curlen := 0; ! Module_Name.Curlen := 0; ! Routine_Name.Curlen := 0; ! -- Symbolize ! Param := (Length => K_Length, ! T_Type => 0, ! Version => K_Version, ! Reserveda => 0, ! Faulting_Pc => PC_For (Traceback (J)), ! Faulting_Fp => 0, ! Filename_Desc => Null_Address, ! Library_Module_Desc => Null_Address, ! Record_Number => Record_Number'Address, ! Image_Desc => Image_Dsc'Address, ! Module_Desc => Module_Dsc'Address, ! Routine_Desc => Routine_Dsc'Address, ! Listing_Lineno => Line_Number'Address, ! Rel_Pc => Null_Address, ! Image_Base_Addr => Null_Address, ! Module_Base_Addr => Null_Address, ! Malloc_Rtn => Null_Address, ! Free_Rtn => Null_Address, ! Symbolize_Flags => Null_Address, ! Reserved0 => (0, 0), ! Reserved1 => (0, 0), ! Reserved2 => (0, 0)); ! Status := Symbolize (Param'Address); ! -- Check for success (marked by bit 0) ! if (Status rem 2) = 1 then ! -- Success ! if Line_Number = 0 then ! ! -- As GCC doesn't emit source file correlation, use record ! -- number of line number is not set ! ! Line_Number := Record_Number; end if; ! declare ! First : constant Integer := Len + 1; ! Last : Integer := First + 80 - 1; ! Pos : Integer; ! Routine_Name_D : constant String := ! Decode_Ada_Name ! (Routine_Name.Buf ! (1 .. Natural (Routine_Name.Curlen))); ! ! Lineno : constant String := ! Unsigned_Longword'Image (Line_Number); ! ! begin ! Res (First .. Last) := (others => ' '); ! ! Res (First .. First + Natural (Image_Name.Curlen) - 1) := ! Image_Name.Buf (1 .. Natural (Image_Name.Curlen)); ! ! Res (First + 10 .. ! First + 10 + Natural (Module_Name.Curlen) - 1) := ! Module_Name.Buf (1 .. Natural (Module_Name.Curlen)); ! ! Res (First + 30 .. ! First + 30 + Routine_Name_D'Length - 1) := ! Routine_Name_D; ! ! -- If routine name doesn't fit 20 characters, output the line ! -- number on next line at 50th position. ! ! if Routine_Name_D'Length > 20 then ! Pos := First + 30 + Routine_Name_D'Length; ! Res (Pos) := ASCII.LF; ! Last := Pos + 80; ! Res (Pos + 1 .. Last) := (others => ' '); ! Pos := Pos + 51; ! else ! Pos := First + 50; ! end if; ! ! Res (Pos .. Pos + Lineno'Length - 1) := Lineno; ! ! Res (Last) := ASCII.LF; ! Len := Last; ! end; ! ! -- Failure (bit 0 clear) ! ! else ! Res (Len + 1 .. Len + 6) := "ERROR" & ASCII.LF; ! Len := Len + 6; ! end if; end loop; System.Soft_Links.Unlock_Task.all; diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/Make-lang.in gcc-4.6.0/gcc/ada/gcc-interface/Make-lang.in *** gcc-4.5.2/gcc/ada/gcc-interface/Make-lang.in Fri Apr 2 19:54:46 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/Make-lang.in Wed Jan 26 11:53:51 2011 *************** GNAT_ADA_OBJS = \ *** 126,131 **** --- 126,132 ---- ada/ada.o \ ada/ali.o \ ada/alloc.o \ + ada/aspects.o \ ada/atree.o \ ada/butil.o \ ada/casing.o \ *************** GNAT_ADA_OBJS = \ *** 144,149 **** --- 145,151 ---- ada/exp_aggr.o \ ada/exp_atag.o \ ada/exp_attr.o \ + ada/exp_cg.o \ ada/exp_ch11.o \ ada/exp_ch12.o \ ada/exp_ch13.o \ *************** GNAT_ADA_OBJS = \ *** 263,268 **** --- 265,271 ---- ada/s-wchcon.o \ ada/s-wchjis.o \ ada/scans.o \ + ada/scil_ll.o \ ada/scn.o \ ada/scng.o \ ada/scos.o \ *************** GNAT_ADA_OBJS = \ *** 325,331 **** ada/tree_io.o \ ada/treepr.o \ ada/treeprs.o \ - ada/ttypef.o \ ada/ttypes.o \ ada/types.o \ ada/uintp.o \ --- 328,333 ---- *************** GNATBIND_OBJS = \ *** 363,368 **** --- 365,371 ---- ada/ali-util.o \ ada/ali.o \ ada/alloc.o \ + ada/aspects.o \ ada/atree.o \ ada/bcheck.o \ ada/binde.o \ *************** GNATBIND_OBJS = \ *** 439,445 **** --- 442,450 ---- ada/s-wchjis.o \ ada/scng.o \ ada/scans.o \ + ada/scil_ll.o \ ada/sdefault.o \ + ada/sem_aux.o \ ada/sinfo.o \ ada/sinput.o \ ada/sinput-c.o \ *************** ada/doctools/xgnatugn$(build_exeext): ad *** 561,575 **** $(CP) $^ ada/doctools cd ada/doctools && $(GNATMAKE) -q xgnatugn ! # Note that doc/gnat_ugn.texi does not depend on xgnatugn ! # being built so we can distribute a pregenerated doc/gnat_ugn.info doc/gnat_ugn.texi: $(srcdir)/ada/gnat_ugn.texi $(srcdir)/ada/ug_words \ ! $(gcc_docdir)/include/gcc-common.texi gcc-vers.texi ! $(MAKE) ada/doctools/xgnatugn$(build_exeext) ada/doctools/xgnatugn unw $(srcdir)/ada/gnat_ugn.texi \ $(srcdir)/ada/ug_words doc/gnat_ugn.texi doc/gnat_ugn.info: doc/gnat_ugn.texi \ $(gcc_docdir)/include/fdl.texi $(gcc_docdir)/include/gcc-common.texi \ gcc-vers.texi --- 566,584 ---- $(CP) $^ ada/doctools cd ada/doctools && $(GNATMAKE) -q xgnatugn ! # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on ! # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info doc/gnat_ugn.texi: $(srcdir)/ada/gnat_ugn.texi $(srcdir)/ada/ug_words \ ! doc/projects.texi $(gcc_docdir)/include/gcc-common.texi gcc-vers.texi ada/doctools/xgnatugn unw $(srcdir)/ada/gnat_ugn.texi \ $(srcdir)/ada/ug_words doc/gnat_ugn.texi + doc/projects.texi: $(srcdir)/ada/projects.texi + $(MAKE) ada/doctools/xgnatugn$(build_exeext) + ada/doctools/xgnatugn unw $(srcdir)/ada/projects.texi \ + $(srcdir)/ada/ug_words doc/projects.texi + doc/gnat_ugn.info: doc/gnat_ugn.texi \ $(gcc_docdir)/include/fdl.texi $(gcc_docdir)/include/gcc-common.texi \ gcc-vers.texi *************** ada.install-common: *** 831,854 **** # -if [ -f gnat1$(exeext) ] ; \ then \ ! if [ -f gnatsym$(exeext) ] ; \ then \ $(RM) $(DESTDIR)$(bindir)/gnatsym$(exeext); \ $(INSTALL_PROGRAM) gnatsym$(exeext) $(DESTDIR)$(bindir)/gnatsym$(exeext); \ fi ; \ fi # - # Gnatlbr is only used on VMS. - # - -if [ -f gnat1$(exeext) ] ; \ - then \ - if [ -f gnatlbr$(exeext) ] ; \ - then \ - $(RM) $(DESTDIR)$(bindir)/gnatlbr$(exeext); \ - $(INSTALL_PROGRAM) gnatlbr$(exeext) $(DESTDIR)$(bindir)/gnatlbr$(exeext); \ - fi ; \ - fi - # # Gnatdll is only used on Windows. # -if [ -f gnat1$(exeext) ] ; \ --- 840,855 ---- # -if [ -f gnat1$(exeext) ] ; \ then \ ! if [ -f gnatsym-cross$(exeext) ] ; \ then \ + $(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatsym$(exeext); \ + $(INSTALL_PROGRAM) gnatsym-cross$(exeext) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatsym$(exeext); \ + else \ $(RM) $(DESTDIR)$(bindir)/gnatsym$(exeext); \ $(INSTALL_PROGRAM) gnatsym$(exeext) $(DESTDIR)$(bindir)/gnatsym$(exeext); \ fi ; \ fi # # Gnatdll is only used on Windows. # -if [ -f gnat1$(exeext) ] ; \ *************** ada.uninstall: *** 893,899 **** -$(RM) $(DESTDIR)$(bindir)/gnatfind$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatdll$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatkr$(exeext) - -$(RM) $(DESTDIR)$(bindir)/gnatlbr$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatlink$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatls$(exeext) -$(RM) $(DESTDIR)$(bindir)/gnatmake$(exeext) --- 894,899 ---- *************** ada.uninstall: *** 908,914 **** -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatfind$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatdll$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatkr$(exeext) - -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatlbr$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatlink$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatls$(exeext) -$(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatmake$(exeext) --- 908,913 ---- *************** ada.uninstall: *** 923,929 **** -$(RM) $(DESTDIR)$(tooldir)/bin/gnatfind$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatdll$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatkr$(exeext) - -$(RM) $(DESTDIR)$(tooldir)/bin/gnatlbr$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatlink$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatls$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatmake$(exeext) --- 922,927 ---- *************** ada.uninstall: *** 932,939 **** -$(RM) $(DESTDIR)$(tooldir)/bin/gnatxref$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatclean$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatsym$(exeext) ! # Gnatlbr and Gnatchop are only used on VMS ! -$(RM) $(DESTDIR)$(bindir)/gnatlbr$(exeext) $(DESTDIR)$(bindir)/gnatchop$(exeext) # Clean hooks: # A lot of the ancillary files are deleted by the main makefile. --- 930,937 ---- -$(RM) $(DESTDIR)$(tooldir)/bin/gnatxref$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatclean$(exeext) -$(RM) $(DESTDIR)$(tooldir)/bin/gnatsym$(exeext) ! # Gnatchop is only used on VMS ! -$(RM) $(DESTDIR)$(bindir)/gnatchop$(exeext) # Clean hooks: # A lot of the ancillary files are deleted by the main makefile. *************** ada.distclean: *** 960,967 **** -$(RM) gnatxref$(exeext) -$(RM) gnatclean$(exeext) -$(RM) gnatsym$(exeext) - # Gnatlbr is only used on VMS - -$(RM) gnatlbr$(exeext) -$(RM) ada/rts/* -$(RMDIR) ada/rts -$(RM) ada/tools/* --- 958,963 ---- *************** ada/final.o : ada/final.c $(CONFIG_H) *** 1193,1199 **** ada/link.o : ada/link.c ! ada/targext.o : ada/targext.c $(SYSTEM_H) coretypes.h $(TM_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) --- 1189,1195 ---- ada/link.o : ada/link.c ! ada/targext.o : ada/targext.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) *************** ada/cuintp.o : ada/gcc-interface/cuintp. *** 1225,1241 **** $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ! $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(TARGET_H) $(EXPR_H) \ ! $(TREE_INLINE_H) ada/gcc-interface/ada.h ada/types.h ada/atree.h \ ada/elists.h ada/namet.h ada/nlists.h ada/repinfo.h ada/snames.h \ ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h $(ADA_TREE_H) \ ada/gcc-interface/gigi.h gt-ada-decl.h $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ! $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(EXPR_H) libfuncs.h \ ! $(FLAGS_H) debug.h $(CGRAPH_H) $(OPTABS_H) toplev.h except.h langhooks.h \ ! $(LANGHOOKS_DEF_H) opts.h options.h $(TREE_INLINE_H) \ ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \ ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \ ada/sinfo.h ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \ --- 1221,1237 ---- $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ! $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(TARGET_H) $(TREE_INLINE_H) \ ! ada/gcc-interface/ada.h ada/types.h ada/atree.h \ ada/elists.h ada/namet.h ada/nlists.h ada/repinfo.h ada/snames.h \ ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h $(ADA_TREE_H) \ ada/gcc-interface/gigi.h gt-ada-decl.h $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ! $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(FUNCTION_H) \ ! $(FLAGS_H) debug.h toplev.h langhooks.h \ ! $(LANGHOOKS_DEF_H) $(OPTS_H) $(OPTIONS_H) $(TREE_INLINE_H) $(PLUGIN_H) \ ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \ ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \ ada/sinfo.h ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \ *************** ada/targtyps.o : ada/gcc-interface/targt *** 1250,1266 **** $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ! $(TM_H) $(TREE_H) $(FLAGS_H) $(EXPR_H) output.h tree-iterator.h \ $(GIMPLE_H) ada/gcc-interface/ada.h ada/adadecode.h ada/types.h \ ada/atree.h ada/elists.h ada/namet.h ada/nlists.h ada/snames.h \ ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h ada/einfo.h \ ! $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-trans.h $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/utils.o : ada/gcc-interface/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(RTL_H) output.h debug.h convert.h \ ! $(TARGET_H) function.h langhooks.h pointer-set.h $(CGRAPH_H) \ ! $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h $(GIMPLE_H) \ ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/elists.h ada/namet.h \ ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h \ $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-utils.h gtype-ada.h --- 1246,1263 ---- $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ! $(TM_H) $(TREE_H) $(FLAGS_H) output.h tree-iterator.h \ $(GIMPLE_H) ada/gcc-interface/ada.h ada/adadecode.h ada/types.h \ ada/atree.h ada/elists.h ada/namet.h ada/nlists.h ada/snames.h \ ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h ada/einfo.h \ ! ada/gcc-interface/gadaint.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \ ! gt-ada-trans.h $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/utils.o : ada/gcc-interface/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(RTL_H) output.h debug.h convert.h \ ! $(TARGET_H) function.h langhooks.h $(CGRAPH_H) \ ! $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h \ ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/elists.h ada/namet.h \ ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h \ $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-utils.h gtype-ada.h *************** ada/ada.o : ada/ada.ads ada/system.ads *** 1314,1337 **** ada/ali-util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/ali.ads ada/ali-util.ads ada/ali-util.adb \ ! ada/alloc.ads ada/atree.ads ada/atree.adb ada/binderr.ads \ ! ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/err_vars.ads ada/gnat.ads ada/g-htable.ads ada/gnatvsn.ads \ ! ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/namet.adb \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads \ ! ada/rident.ads ada/scans.ads ada/scng.ads ada/scng.adb ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/sinput-c.ads \ ! ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ! ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \ ! ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \ ! ada/s-htable.ads ada/s-htable.adb 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-strhas.ads ada/s-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-utf_32.ads ada/s-utf_32.adb ada/s-wchcon.ads \ ! ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \ ! ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/urealp.adb ada/widechar.ads ada/ali.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ada/ali.ads ada/ali.adb ada/alloc.ads ada/butil.ads ada/casing.ads \ --- 1311,1335 ---- ada/ali-util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/ali.ads ada/ali-util.ads ada/ali-util.adb \ ! ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \ ! ada/binderr.ads ada/casing.ads ada/csets.ads ada/debug.ads \ ! ada/einfo.ads ada/einfo.adb ada/err_vars.ads ada/gnat.ads \ ! ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \ ! ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads \ ! ada/osint.ads ada/output.ads ada/rident.ads ada/scans.ads ada/scng.ads \ ! ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ! ada/sinput-c.ads ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \ ! ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb 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-strhas.ads ada/s-string.ads \ ! ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-utf_32.adb \ ! ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ ! ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \ ! ada/widechar.ads ada/ali.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ada/ali.ads ada/ali.adb ada/alloc.ads ada/butil.ads ada/casing.ads \ *************** ada/ali.o : ada/ada.ads ada/a-except.ads *** 1348,1380 **** ada/alloc.o : ada/alloc.ads ada/system.ads ada/atree.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/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \ ! ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/back_end.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/back_end.ads ada/back_end.adb ada/casing.ads ada/debug.ads \ ! ada/einfo.ads ada/einfo.adb ada/elists.ads ada/fname.ads ada/gnat.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/osint-c.ads \ ! ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/switch.ads ada/switch-c.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-stoele.ads ada/s-stoele.adb \ ! 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/widechar.ads ada/bcheck.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/ali.ads ada/ali-util.ads ada/ali-util.adb \ --- 1346,1393 ---- ada/alloc.o : ada/alloc.ads ada/system.ads + ada/aspects.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \ + ada/atree.ads ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ + ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/namet.ads \ + ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/system.ads \ + ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-imenne.ads \ + ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \ + ada/s-strhas.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/unchconv.ads ada/unchdeal.ads \ + ada/urealp.ads + ada/atree.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-imenne.ads \ ! ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/back_end.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/back_end.ads ada/back_end.adb ada/casing.ads \ ! ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ ! ada/gnat.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/osint-c.ads ada/output.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ ! ada/stand.ads ada/stringt.ads ada/switch.ads ada/switch-c.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-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/widechar.ads ada/bcheck.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/ali.ads ada/ali-util.ads ada/ali-util.adb \ *************** ada/casing.o : ada/ada.ads ada/a-except. *** 1458,1507 **** ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads ada/checks.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dist.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb 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/inline.ads \ ! ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \ ! ada/lib-load.ads ada/lib-sort.adb 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/rtsfind.adb ada/sem.ads ada/sem_aux.ads ada/sem_cat.ads \ ! ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \ ! ada/sem_scil.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/sprint.ads 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 ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ada/s-stoele.adb 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/tbuild.ads ada/tbuild.adb 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/urealp.adb \ ! ada/validsw.ads ! ! ada/comperr.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/comperr.ads ada/comperr.adb ada/debug.ads \ ! ada/einfo.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads ada/output.adb \ ! ada/rident.ads ada/sdefault.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads ada/sprint.ads ada/system.ads \ ! ada/s-exctab.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-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/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/csets.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/csets.ads \ ada/csets.adb ada/hostparm.ads ada/opt.ads ada/system.ads \ --- 1471,1523 ---- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads ada/checks.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \ ! ada/exp_dist.ads ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/exp_util.adb 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/inline.ads ada/interfac.ads ada/itypes.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 ada/restrict.adb ada/rident.ads \ ! ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads ada/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \ ! ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb 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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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/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/comperr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/comperr.ads ada/comperr.adb \ ! ada/debug.ads ada/einfo.ads ada/err_vars.ads ada/errout.ads \ ! ada/erroutc.ads ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads \ ! ada/output.adb ada/rident.ads ada/sdefault.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \ ! ada/system.ads ada/s-exctab.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-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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/csets.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/csets.ads \ ada/csets.adb ada/hostparm.ads ada/opt.ads ada/system.ads \ *************** ada/csets.o : ada/ada.ads ada/a-unccon.a *** 1509,1566 **** ada/s-wchcon.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/cstand.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/cstand.ads \ ! ada/cstand.adb ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/interfac.ads ada/layout.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/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_aux.ads \ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_mech.ads \ ! ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \ ! ada/sem_util.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/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-secsta.ads ada/s-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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/ttypef.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/urealp.adb \ ! ada/widechar.ads ada/debug.o : ada/debug.ads ada/debug.adb ada/system.ads ada/debug_a.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/debug_a.ads ada/debug_a.adb \ ! ada/einfo.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads ada/system.ads ada/s-exctab.ads \ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ ada/s-stalib.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/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ! ! ada/einfo.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/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads ada/snames.adb ada/stand.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-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/elists.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/elists.ads \ --- 1525,1582 ---- ada/s-wchcon.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/cstand.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads \ ! ada/cstand.ads ada/cstand.adb ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/exp_ch11.ads ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/interfac.ads ada/layout.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/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_aux.ads \ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_mech.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/sinput.adb \ ! ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \ ! ada/styleg.ads ada/styleg.adb 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-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ ! ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/urealp.adb ada/widechar.ads ada/debug.o : ada/debug.ads ada/debug.adb ada/system.ads ada/debug_a.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \ ! ada/debug_a.adb ada/einfo.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/system.ads \ ! ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ ! ada/s-parame.ads ada/s-stalib.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/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ! ! ada/einfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/snames.adb \ ! ada/stand.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-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/urealp.adb ada/elists.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/elists.ads \ *************** ada/err_vars.o : ada/ada.ads ada/a-excep *** 1581,1680 **** ada/unchconv.ads ada/unchdeal.ads ada/errout.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/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/err_vars.ads ada/errout.ads ada/errout.adb ada/erroutc.ads \ ! ada/fname.ads ada/gnat.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/output.ads ada/scans.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ ! ada/stand.ads ada/stringt.ads ada/stylesw.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-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/widechar.ads - ada/erroutc.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/err_vars.ads \ - ada/erroutc.ads ada/erroutc.adb ada/hostparm.ads ada/interfac.ads \ - ada/namet.ads ada/namet.adb ada/nlists.ads ada/opt.ads ada/output.ads \ - ada/output.adb ada/rident.ads ada/sinfo.ads ada/sinput.ads \ - ada/sinput.adb ada/snames.ads ada/system.ads ada/s-exctab.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-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/types.ads \ - ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ - ada/widechar.ads - ada/eval_fat.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/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ada/eval_fat.adb ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \ ! ada/output.ads ada/rident.ads ada/sem_util.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.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-stalib.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/ttypef.ads ada/types.ads ada/uintp.ads \ ! ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ! ada/urealp.adb ada/exp_aggr.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_aggr.adb ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_ch9.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.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/inline.ads ada/interfac.ads ada/itypes.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 \ ! ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \ ! ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \ ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \ ! ada/sem_scil.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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.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-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/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_atag.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/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_atag.ads ada/exp_atag.adb ada/exp_dist.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/fname.ads ada/fname-uf.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/lib.ads \ ! ada/lib-load.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_aux.ads ada/sem_ch7.ads ada/sem_dist.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 \ --- 1597,1692 ---- ada/unchconv.ads ada/unchdeal.ads ada/errout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/err_vars.ads ada/errout.ads ada/errout.adb \ ! ada/erroutc.ads ada/fname.ads ada/gnat.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/output.ads ada/scans.ads \ ! ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/stylesw.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-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/widechar.ads ! ! ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/err_vars.ads ada/erroutc.ads ada/erroutc.adb ada/hostparm.ads \ ! ada/interfac.ads ada/namet.ads ada/namet.adb ada/nlists.ads ada/opt.ads \ ! ada/output.ads ada/output.adb ada/rident.ads ada/sinfo.ads \ ! ada/sinput.ads ada/sinput.adb ada/snames.ads ada/system.ads \ ! ada/s-exctab.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-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/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \ ada/urealp.ads ada/widechar.ads ada/eval_fat.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/einfo.ads \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ada/eval_fat.adb ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/namet.ads ada/opt.ads ada/output.ads ada/rident.ads ada/snames.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-memory.ads \ ! ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-stalib.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/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/exp_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads ada/exp_aggr.ads ada/exp_aggr.adb ada/exp_ch11.ads \ ! ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads ada/exp_dist.ads \ ! ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/expander.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/inline.ads ada/interfac.ads ada/itypes.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 ada/restrict.adb ada/rident.ads \ ! ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads ada/sem.ads \ ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb 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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.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-string.ads ada/s-traent.ads ada/s-unstyp.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/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_atag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.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_atag.ads ada/exp_atag.adb \ ! ada/exp_disp.ads ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/fname.ads ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/lib.ads ada/lib-load.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_aux.ads ada/sem_aux.adb \ ! ada/sem_ch7.ads ada/sem_disp.ads ada/sem_dist.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/exp_atag.o : ada/ada.ads ada/a-excep *** 1686,1754 **** ada/unchdeal.ads ada/urealp.ads ada/exp_attr.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/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_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads \ ! ada/exp_disp.ads ada/exp_dist.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_aux.ads ada/sem_ch6.ads \ ! ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \ ! ada/sem_res.ads ada/sem_scil.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/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-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 \ ! ada/casing.ads ada/casing.adb 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_ch11.ads ada/exp_ch11.adb \ ! ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \ ! ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.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_aux.ads ada/sem_ch8.ads ada/sem_res.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-rident.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/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/exp_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 \ ! ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/exp_ch12.ads ada/exp_ch12.adb ada/exp_tss.ads \ ! ada/exp_util.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.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/rident.ads ada/rtsfind.ads ada/sem_aux.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-stalib.ads ada/s-string.ads ada/s-traent.ads \ --- 1698,1783 ---- ada/unchdeal.ads ada/urealp.ads ada/exp_attr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/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_ch11.ads \ ! ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_ch9.ads ada/exp_disp.ads ada/exp_dist.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/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch6.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_disp.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/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/stylesw.ads ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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_cg.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/exp_cg.ads ada/exp_cg.adb \ + ada/exp_dbug.ads ada/exp_disp.ads ada/exp_tss.ads ada/gnat.ads \ + ada/g-htable.ads ada/hostparm.ads ada/lib.ads ada/namet.ads \ + ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \ + ada/sem_aux.ads ada/sem_aux.adb ada/sem_disp.ads ada/sem_type.ads \ + ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ + ada/snames.ads ada/stand.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-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/exp_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/casing.adb 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_ch11.ads \ ! ada/exp_ch11.adb ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/fname.ads ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.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_aux.ads ada/sem_ch8.ads ada/sem_res.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-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-string.ads ada/s-traent.ads ada/s-unstyp.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/exp_ch12.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/elists.ads ada/exp_ch12.ads ada/exp_ch12.adb \ ! ada/exp_tss.ads ada/exp_util.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.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/rident.ads ada/rtsfind.ads ada/sem_aux.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-stalib.ads ada/s-string.ads ada/s-traent.ads \ *************** ada/exp_ch12.o : ada/ada.ads ada/a-excep *** 1758,1770 **** ada/urealp.ads ada/exp_ch13.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/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/exp_ch13.ads ada/exp_ch13.adb ada/exp_ch3.ads \ ! ada/exp_ch6.ads ada/exp_imgv.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \ ! ada/output.ads ada/rtsfind.ads ada/sem.ads ada/sem_ch7.ads \ ada/sem_ch8.ads ada/sem_eval.ads ada/sem_util.ads ada/sinfo.ads \ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \ --- 1787,1799 ---- ada/urealp.ads ada/exp_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/elists.ads ada/exp_ch13.ads ada/exp_ch13.adb \ ! ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_imgv.ads ada/exp_tss.ads \ ! ada/exp_util.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ ! ada/opt.ads ada/output.ads ada/rtsfind.ads ada/sem.ads ada/sem_ch7.ads \ ada/sem_ch8.ads ada/sem_eval.ads ada/sem_util.ads ada/sinfo.ads \ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \ *************** ada/exp_ch13.o : ada/ada.ads ada/a-excep *** 1772,2073 **** ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/exp_ch2.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_ch2.ads ada/exp_ch2.adb ada/exp_smem.ads ada/exp_tss.ads \ ! ada/exp_util.ads ada/exp_vfpt.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/rtsfind.ads \ ! ada/sem.ads ada/sem_eval.ads ada/sem_res.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/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-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \ ! ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/exp_ch3.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_atag.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch3.adb ada/exp_ch4.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads ada/exp_dist.ads \ ! ada/exp_pakd.ads ada/exp_smem.ads ada/exp_strm.ads ada/exp_tss.ads \ ! ada/exp_tss.adb ada/exp_util.ads ada/exp_util.adb ada/fname.ads \ ! ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/itypes.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_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads \ ! ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \ ! ada/sem_mech.ads ada/sem_res.ads ada/sem_scil.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/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-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/tbuild.ads ada/tbuild.adb 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/exp_ch4.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_atag.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch4.adb ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads ada/exp_fixd.ads \ ! ada/exp_pakd.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/hostparm.ads \ ! ada/inline.ads ada/itypes.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_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \ ! ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_eval.ads \ ! ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.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/sprint.ads ada/stand.ads \ ! ada/stringt.ads ada/stringt.adb ada/system.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-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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/tbuild.ads \ ! ada/tbuild.adb 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/urealp.adb ada/validsw.ads ! ! ada/exp_ch5.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_atag.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch4.ads ada/exp_ch5.ads ada/exp_ch5.adb ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_dbug.ads ada/exp_disp.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ada/g-htable.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_aux.ads ada/sem_cat.ads \ ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \ ! ada/sem_scil.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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-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/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_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 \ ! ada/casing.ads ada/checks.ads ada/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_atag.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch6.adb \ ! ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_dbug.ads ada/exp_disp.ads \ ! ada/exp_dist.ads ada/exp_intr.ads ada/exp_pakd.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/hostparm.ads ada/inline.ads \ ! ada/interfac.ads ada/itypes.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 \ ! ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \ ! ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch12.ads ada/sem_ch13.ads \ ! ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_mech.ads \ ! ada/sem_res.ads ada/sem_scil.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/snames.ads ada/sprint.ads ada/stand.ads \ ! ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-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/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_ch7.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/debug.ads ada/einfo.ads ada/einfo.adb \ - ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ - ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \ - ada/exp_ch7.adb ada/exp_ch9.ads ada/exp_dbug.ads ada/exp_disp.ads \ - ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ - 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/inline.ads ada/itypes.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/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_aux.ads ada/sem_ch3.ads ada/sem_ch7.ads ada/sem_ch8.ads \ - ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.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-rident.ads ada/s-soflin.ads \ - ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ 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/tbuild.ads \ ada/tbuild.adb 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/exp_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 \ ! ada/casing.ads ada/checks.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_aggr.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch8.ads \ ! ada/exp_ch8.adb ada/exp_dbug.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/exp_util.adb ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/itypes.ads \ ! ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \ ! ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \ ! ada/rtsfind.ads ada/sem.ads ada/sem_aux.ads ada/sem_ch8.ads \ ! ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads ada/sem_type.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-rident.ads ada/s-stalib.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/tbuild.ads \ ! ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \ ! ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ! ada/validsw.ads ! ada/exp_ch9.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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_ch11.ads \ ! ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads \ ! ada/exp_ch9.adb ada/exp_dbug.ads ada/exp_disp.ads ada/exp_sel.ads \ ! ada/exp_smem.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \ ! ada/gnat.ads ada/g-htable.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_aux.ads ada/sem_ch11.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_elab.ads ada/sem_eval.ads ada/sem_res.ads \ ! ada/sem_scil.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/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-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/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_code.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/eval_fat.ads ada/exp_ch11.ads ada/exp_code.ads \ ! ada/exp_code.adb ada/exp_disp.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/nmake.adb 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_aux.ads \ ! ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.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/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ ! ada/styleg.adb 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-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/exp_dbug.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/exp_dbug.ads ada/exp_dbug.adb ada/gnat.ads ada/g-htable.ads \ ada/hostparm.ads ada/interfac.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/sem_aux.ads 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-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ada/urealp.adb ada/widechar.ads ada/exp_disp.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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_atag.ads \ ! ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dbug.ads \ ! ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads ada/exp_tss.adb \ ! ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \ ! ada/layout.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_aux.ads ada/sem_ch6.ads \ ! ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \ ! ada/sem_res.ads ada/sem_scil.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/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-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 \ --- 1801,2108 ---- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/exp_ch2.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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_ch2.ads ada/exp_ch2.adb ada/exp_smem.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_vfpt.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \ ! ada/rtsfind.ads ada/sem.ads ada/sem_eval.ads ada/sem_res.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/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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ ! ada/table.adb ada/tbuild.ads ada/tree_io.ads ada/types.ads \ ! ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/exp_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_atag.ads ada/exp_cg.ads ada/exp_ch11.ads \ ! ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch3.adb ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_dbug.ads \ ! ada/exp_disp.ads ada/exp_disp.adb ada/exp_dist.ads ada/exp_pakd.ads \ ! ada/exp_smem.ads ada/exp_strm.ads ada/exp_tss.ads ada/exp_tss.adb \ ! ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/inline.ads ada/itypes.ads ada/layout.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/scil_ll.ads \ ! ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb \ ! ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_mech.ads \ ! ada/sem_prag.ads ada/sem_res.ads ada/sem_scil.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/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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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/uintp.ads \ ! ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/validsw.ads ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads ada/exp_aggr.ads ada/exp_atag.ads ada/exp_ch11.ads \ ! ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch4.adb \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads \ ! ada/exp_fixd.ads ada/exp_intr.ads ada/exp_pakd.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/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/par_sco.ads ada/restrict.ads ada/restrict.adb \ ! ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scil_ll.ads \ ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \ ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb 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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.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-string.ads ada/s-traent.ads ada/s-unstyp.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/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/exp_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ! ada/exp_ch5.ads ada/exp_ch5.adb ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_dbug.ads ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads \ ! ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.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/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb \ ! 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/snames.ads ada/sprint.ads ada/stand.ads \ ! ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ ! ada/styleg.adb ada/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/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_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads ada/exp_aggr.ads ada/exp_atag.ads ada/exp_cg.ads \ ! ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch6.adb ada/exp_ch7.ads ada/exp_ch9.ads \ ! ada/exp_dbug.ads ada/exp_disp.ads ada/exp_disp.adb ada/exp_dist.ads \ ! ada/exp_intr.ads ada/exp_pakd.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/hostparm.ads ada/inline.ads ada/interfac.ads \ ! ada/itypes.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/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/rtsfind.adb ada/scans.ads \ ! ada/scil_ll.ads ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_aux.adb ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch3.ads \ ! ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_mech.ads ada/sem_prag.ads \ ! ada/sem_res.ads ada/sem_scil.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/snames.ads ada/sprint.ads ada/stand.ads \ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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/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_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.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_aggr.ads ada/exp_ch11.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch7.adb ada/exp_ch9.ads ada/exp_dbug.ads \ ! ada/exp_disp.ads ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/exp_util.adb 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/inline.ads ada/itypes.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/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_aux.ads ada/sem_ch3.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads \ ! ada/sem_type.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-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-string.ads ada/s-traent.ads \ ! ada/s-unstyp.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/uintp.ads ada/uintp.adb ada/uname.ads \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ! ! ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.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_aggr.ads ada/exp_ch4.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch8.ads ada/exp_ch8.adb ada/exp_dbug.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/freeze.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/inline.ads ada/itypes.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/rident.ads ada/rtsfind.ads ada/sem.ads \ ! ada/sem_aux.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_prag.ads \ ! ada/sem_res.ads ada/sem_type.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-rident.ads ada/s-stalib.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/tbuild.ads ada/tree_io.ads ada/ttypes.ads \ ! ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ! ! ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \ ! ada/exp_ch11.ads ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_ch9.ads ada/exp_ch9.adb ada/exp_dbug.ads ada/exp_disp.ads \ ! ada/exp_sel.ads ada/exp_smem.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/exp_util.adb ada/fname.ads ada/fname-uf.ads ada/freeze.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-htable.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/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_aux.adb ada/sem_ch11.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_elab.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/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/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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/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_code.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/eval_fat.ads ada/exp_ch11.ads \ ! ada/exp_code.ads ada/exp_code.adb ada/exp_disp.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/nmake.adb ada/opt.ads \ ! ada/output.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb \ ! 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/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.ads ada/s-carun8.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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/exp_dbug.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/exp_dbug.ads ada/exp_dbug.adb ada/gnat.ads ada/g-htable.ads \ ada/hostparm.ads ada/interfac.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/rident.ads ada/sem_aux.ads 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-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-string.ads ada/s-traent.ads ada/s-unstyp.ads \ ! ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \ ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ada/urealp.adb ada/widechar.ads ada/exp_disp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \ ! ada/exp_atag.ads ada/exp_cg.ads ada/exp_ch11.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_dbug.ads ada/exp_disp.ads ada/exp_disp.adb \ ! ada/exp_tss.ads ada/exp_tss.adb ada/exp_util.ads ada/exp_util.adb \ ! ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/inline.ads \ ! ada/interfac.ads ada/itypes.ads ada/layout.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/scil_ll.ads ada/sem.ads ada/sem_attr.ads \ ! ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch6.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_disp.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/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/stylesw.ads ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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/exp_disp.o : ada/ada.ads ada/a-excep *** 2075,2238 **** ada/widechar.ads ada/exp_dist.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/exp_atag.ads ada/exp_disp.ads ada/exp_dist.ads \ ! ada/exp_dist.adb ada/exp_strm.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/fname.ads ada/get_targ.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/nmake.adb ada/opt.ads ada/output.ads \ ! ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/sem.ads \ ! ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch8.ads \ ! ada/sem_dist.ads 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/stringt.adb ada/system.ads ada/s-exctab.ads \ ! ada/s-htable.ads ada/s-htable.adb 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-strhas.ads ada/s-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads ada/tbuild.adb 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/exp_fixd.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/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/eval_fat.ads ada/exp_fixd.ads ada/exp_fixd.adb ada/exp_tss.ads \ ! ada/exp_util.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.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/rtsfind.ads ada/sem.ads \ ! ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_eval.ads ada/sem_eval.adb 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/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-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \ ! ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ! ada/exp_imgv.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_dist.ads ada/exp_imgv.ads ada/exp_imgv.adb \ ! 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-htable.ads \ ! ada/hostparm.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \ ! ada/lib-load.ads ada/lib-sort.adb 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_aux.ads ada/sem_ch7.ads ada/sem_dist.ads \ ! ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads 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 ada/s-stache.ads ada/s-stalib.ads \ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads ada/tbuild.adb 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/exp_intr.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/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_ch11.ads \ ! ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads \ ! ada/exp_fixd.ads ada/exp_intr.ads ada/exp_intr.adb ada/exp_tss.ads \ ! ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \ ! ada/lib.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/sem.ads \ ! ada/sem_aux.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \ ! ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb 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-secsta.ads ada/s-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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/tbuild.ads \ ! ada/tbuild.adb 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/urealp.adb ada/validsw.ads \ ada/widechar.ads ! ada/exp_pakd.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/checks.adb ada/debug.ads \ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads \ ! ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_dbug.ads ada/exp_pakd.ads ada/exp_pakd.adb \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/freeze.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/inline.ads ada/itypes.ads ada/layout.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/rident.ads ada/rtsfind.ads \ ! ada/sem.ads ada/sem_aux.ads ada/sem_ch13.ads ada/sem_ch3.ads \ ! ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.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/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-soflin.ads ada/s-stache.ads \ ! ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/tbuild.ads ada/tbuild.adb \ ! ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \ ! ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ! ada/validsw.ads ! ! ada/exp_prag.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/casing.adb ada/csets.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/exp_ch11.ads ada/exp_prag.ads ada/exp_prag.adb ada/exp_tss.ads \ ! ada/exp_util.ads ada/expander.ads ada/fname.ads ada/fname-uf.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.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_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 ada/s-stache.ads \ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/tbuild.ads 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/exp_sel.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/exp_sel.ads ada/exp_sel.adb ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.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/rident.ads ada/rtsfind.ads ada/sem_aux.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-stalib.ads ada/s-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \ ! ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/exp_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 \ ! ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/exp_ch9.ads ada/exp_smem.ads ada/exp_smem.adb ada/exp_tss.ads \ ada/exp_util.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ --- 2110,2282 ---- ada/widechar.ads ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/exp_atag.ads ada/exp_disp.ads \ ! ada/exp_dist.ads ada/exp_dist.adb ada/exp_strm.ads ada/exp_tss.ads \ ! ada/exp_util.ads ada/fname.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/inline.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/nmake.adb ada/opt.ads \ ! ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \ ! ada/sem.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads \ ! ada/sem_ch12.ads ada/sem_ch3.ads ada/sem_ch8.ads ada/sem_dist.ads \ ! 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/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \ ! ada/s-htable.adb 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-strhas.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \ ! ada/tbuild.adb 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/exp_fixd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/eval_fat.ads ada/exp_ch11.ads \ ! ada/exp_disp.ads ada/exp_fixd.ads ada/exp_fixd.adb ada/exp_tss.ads \ ! ada/exp_util.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.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/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb \ ! 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/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.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-string.ads ada/s-traent.ads \ ada/s-unstyp.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/urealp.adb \ ada/widechar.ads ! ada/exp_imgv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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_dist.ads ada/exp_imgv.ads \ ! ada/exp_imgv.adb 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-htable.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \ ! ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb 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_aux.ads ada/sem_ch7.ads \ ! ada/sem_dist.ads ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads 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 ada/s-stache.ads \ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ ! ada/table.adb ada/tbuild.ads ada/tbuild.adb 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/urealp.adb ! ! ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.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_ch11.ads ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_code.ads ada/exp_fixd.ads ada/exp_intr.ads ada/exp_intr.adb \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \ ! ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \ ! ada/itypes.ads ada/lib.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/sem.ads ada/sem_aux.ads ada/sem_ch8.ads ada/sem_eval.ads \ ! ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ! 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-secsta.ads \ ! ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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/tbuild.ads ada/tbuild.adb 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/urealp.adb \ ! ada/validsw.ads ada/widechar.ads ! ! ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dbug.ads ada/exp_pakd.ads \ ! ada/exp_pakd.adb ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/inline.ads ada/itypes.ads ada/layout.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/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_aux.ads \ ! ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch8.ads ada/sem_eval.ads \ ! ada/sem_prag.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/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-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \ ! ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ! ! ada/exp_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/casing.adb ada/csets.ads ada/debug.ads \ ! ada/einfo.ads ada/einfo.adb ada/err_vars.ads ada/errout.ads \ ! ada/erroutc.ads ada/exp_ch11.ads ada/exp_prag.ads ada/exp_prag.adb \ ! ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \ ! ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.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_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-secsta.ads \ ! ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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/tbuild.ads 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/exp_sel.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/exp_sel.ads ada/exp_sel.adb ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.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/rident.ads ada/rtsfind.ads \ ! ada/sem_aux.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-stalib.ads \ ! ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ ! ada/table.ads ada/table.adb ada/tbuild.ads ada/tbuild.adb \ ! ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/exp_smem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/exp_ch9.ads ada/exp_smem.ads ada/exp_smem.adb ada/exp_tss.ads \ ada/exp_util.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ *************** ada/exp_smem.o : ada/ada.ads ada/a-excep *** 2247,2260 **** ada/unchdeal.ads ada/urealp.ads ada/exp_strm.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/exp_strm.ads ada/exp_strm.adb ada/exp_tss.ads ada/get_targ.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.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/rident.ads \ ! ada/rtsfind.ads ada/sem_aux.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-rident.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \ --- 2291,2304 ---- ada/unchdeal.ads ada/urealp.ads ada/exp_strm.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/exp_strm.ads ada/exp_strm.adb ada/exp_tss.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.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/rident.ads ada/rtsfind.ads ada/sem_aux.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-rident.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \ *************** ada/exp_strm.o : ada/ada.ads ada/a-excep *** 2264,2317 **** ada/unchdeal.ads ada/urealp.ads ada/exp_tss.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/exp_tss.adb ada/exp_util.ads ada/fname.ads \ ! ada/fname-uf.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/nmake.ads ada/opt.ads ada/output.ads \ ! ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \ ! ada/sem_aux.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-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-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/widechar.ads ! ! ada/exp_util.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/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/eval_fat.ads ada/exp_aggr.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/fname.ads ada/fname-uf.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/inline.ads \ ! ada/itypes.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/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_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.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/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 ada/s-stache.ads \ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/tbuild.ads ada/tbuild.adb \ ! 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/urealp.adb ada/validsw.ads ada/exp_vfpt.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/exp_vfpt.ads ada/exp_vfpt.adb ada/gnat.ads ada/g-htable.ads \ ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/rtsfind.ads \ --- 2308,2367 ---- ada/unchdeal.ads ada/urealp.ads ada/exp_tss.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/exp_tss.adb ada/exp_util.ads \ ! ada/fname.ads ada/fname-uf.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/nmake.ads ada/opt.ads \ ! ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \ ! ada/rtsfind.ads ada/sem_aux.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-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-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/widechar.ads ! ! ada/exp_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/casing.adb 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/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/exp_util.adb 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/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/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_eval.ads ada/sem_eval.adb 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/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ ! ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/exp_vfpt.ads ada/exp_vfpt.adb ada/gnat.ads ada/g-htable.ads \ ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/rtsfind.ads \ *************** ada/exp_vfpt.o : ada/ada.ads ada/a-excep *** 2320,2347 **** 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-string.ads ada/s-traent.ads \ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads ada/tree_io.ads ada/ttypef.ads ada/types.ads \ ! ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/urealp.adb ada/expander.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/debug_a.ads ada/debug_a.adb \ ! ada/einfo.ads ada/elists.ads ada/err_vars.ads ada/errout.ads \ ! ada/erroutc.ads ada/exp_aggr.ads ada/exp_attr.ads ada/exp_ch11.ads \ ! ada/exp_ch12.ads ada/exp_ch13.ads ada/exp_ch2.ads ada/exp_ch3.ads \ ! ada/exp_ch4.ads ada/exp_ch5.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_ch8.ads ada/exp_ch9.ads ada/exp_prag.ads ada/expander.ads \ ! ada/expander.adb ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rtsfind.ads \ ! ada/sem.ads ada/sem_ch8.ads ada/sem_util.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/system.ads \ ! ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ ! ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/fmap.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/fmap.ads ada/fmap.adb \ --- 2370,2397 ---- 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-string.ads ada/s-traent.ads \ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \ ! ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ! ada/urealp.adb ada/expander.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \ ! ada/debug_a.adb ada/einfo.ads ada/elists.ads ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_attr.ads \ ! ada/exp_ch11.ads ada/exp_ch12.ads ada/exp_ch13.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch5.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch8.ads ada/exp_ch9.ads ada/exp_prag.ads \ ! ada/expander.ads ada/expander.adb ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \ ! ada/rtsfind.ads ada/sem.ads ada/sem_ch8.ads ada/sem_util.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \ ! ada/s-os_lib.ads ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads \ ! ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/fmap.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/fmap.ads ada/fmap.adb \ *************** ada/fname.o : ada/ada.ads ada/a-except.a *** 2375,2416 **** ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/freeze.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/debug_a.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_ch11.ads ada/exp_ch3.ads ada/exp_ch6.ads \ ada/exp_ch7.ads ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads \ ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \ ada/freeze.ads ada/freeze.adb ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \ ! ada/itypes.ads ada/layout.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/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_aux.ads ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch4.ads \ ! ada/sem_ch6.ads ada/sem_ch7.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_intr.ads ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads \ ! ada/sem_res.adb ada/sem_scil.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/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.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-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/frontend.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/cstand.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_dbug.ads \ ada/fmap.ads ada/fname.ads ada/fname-uf.ads ada/frontend.ads \ ada/frontend.adb ada/gnat.ads ada/g-dyntab.ads ada/g-dyntab.adb \ --- 2425,2466 ---- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/freeze.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \ ada/debug_a.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_ch11.ads ada/exp_ch3.ads ada/exp_ch6.ads \ ada/exp_ch7.ads ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads \ ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \ ada/freeze.ads ada/freeze.adb ada/get_targ.ads ada/gnat.ads \ ! ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/inline.ads \ ! ada/interfac.ads ada/itypes.ads ada/layout.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/rident.ads \ ! ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem_aggr.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \ ! ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch7.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_intr.ads ada/sem_mech.ads ada/sem_prag.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/sinfo-cn.ads ada/sinput.ads ada/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.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-string.ads ada/s-traent.ads ada/s-unstyp.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/frontend.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads \ ! ada/cstand.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_dbug.ads \ ada/fmap.ads ada/fname.ads ada/fname-uf.ads ada/frontend.ads \ ada/frontend.adb ada/gnat.ads ada/g-dyntab.ads ada/g-dyntab.adb \ *************** ada/frontend.o : ada/ada.ads ada/a-excep *** 2420,2439 **** ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \ ada/osint.ads ada/output.ads ada/par.ads ada/prep.ads ada/prepcomp.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_aux.ads ada/sem_ch8.ads ada/sem_elab.ads ada/sem_prag.ads \ ! ada/sem_scil.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/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-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 \ ada/system.ads --- 2470,2490 ---- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \ ada/osint.ads ada/output.ads ada/par.ads ada/prep.ads ada/prepcomp.ads \ ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \ ! ada/scans.ads ada/scil_ll.ads ada/scn.ads ada/scng.ads ada/scng.adb \ ! ada/sem.ads ada/sem_aux.ads ada/sem_ch8.ads ada/sem_elab.ads \ ! ada/sem_prag.ads ada/sem_scil.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/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-secsta.ads ada/s-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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 \ ada/system.ads *************** ada/get_targ.o : ada/ada.ads ada/a-uncco *** 2467,2502 **** ada/gnat.o : ada/gnat.ads ada/system.ads ada/gnat1drv.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/back_end.ads ada/casing.ads ada/comperr.ads ada/csets.ads \ ! ada/debug.ads ada/debug_a.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/expander.ads ada/fmap.ads \ ! ada/fname.ads ada/fname-uf.ads ada/frontend.ads ada/get_targ.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/g-table.ads \ ! ada/g-table.adb ada/gnat1drv.ads ada/gnat1drv.adb ada/gnatvsn.ads \ ! ada/hlo.ads ada/hostparm.ads ada/inline.ads ada/lib.ads ada/lib.adb \ ! ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-writ.ads \ ! ada/lib-xref.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/opt.ads ada/osint.ads ada/output.ads ada/par_sco.ads \ ! ada/prepcomp.ads ada/repinfo.ads ada/restrict.ads ada/rident.ads \ ! ada/rtsfind.ads ada/scos.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \ ! ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \ ! ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \ ! ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \ ! ada/sem_elim.ads ada/sem_eval.ads ada/sem_prag.ads ada/sem_type.ads \ ! ada/sem_util.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/stylesw.ads ada/system.ads \ ! ada/s-assert.ads ada/s-bitops.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-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_gen.ads ada/tree_io.ads \ ! ada/treepr.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/usage.ads ada/validsw.ads ada/widechar.ads ada/gnatbind.o : ada/ada.ads ada/a-comlin.ads ada/a-clrefi.ads \ ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads ada/ali.ads \ --- 2518,2554 ---- ada/gnat.o : ada/gnat.ads ada/system.ads ada/gnat1drv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/back_end.ads ada/casing.ads ada/comperr.ads \ ! ada/csets.ads ada/debug.ads ada/debug_a.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_cg.ads ada/exp_tss.ads ada/expander.ads \ ! ada/fmap.ads ada/fname.ads ada/fname-uf.ads ada/frontend.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \ ! ada/g-table.ads ada/g-table.adb ada/gnat1drv.ads ada/gnat1drv.adb \ ! ada/gnatvsn.ads ada/hlo.ads ada/hostparm.ads ada/inline.ads ada/lib.ads \ ! ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \ ! ada/lib-writ.ads ada/lib-xref.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/opt.ads ada/osint.ads ada/output.ads \ ! ada/par_sco.ads ada/prepcomp.ads ada/repinfo.ads ada/restrict.ads \ ! ada/rident.ads ada/rtsfind.ads ada/scos.ads ada/sem.ads ada/sem.adb \ ! ada/sem_attr.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \ ! ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \ ! ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ ! ada/sem_ch9.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_prag.ads \ ! ada/sem_type.ads ada/sem_util.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/stylesw.ads \ ! ada/system.ads ada/s-assert.ads ada/s-bitops.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-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_gen.ads \ ! ada/tree_io.ads ada/treepr.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/usage.ads ada/validsw.ads \ ! ada/widechar.ads ada/gnatbind.o : ada/ada.ads ada/a-comlin.ads ada/a-clrefi.ads \ ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads ada/ali.ads \ *************** ada/gnatvsn.o : ada/ada.ads ada/a-unccon *** 2519,2536 **** ada/gnatvsn.adb ada/system.ads ada/s-secsta.ads ada/s-stoele.ads \ ada/s-stoele.adb ! ada/hlo.o : ada/ada.ads ada/a-unccon.ads ada/hlo.ads ada/hlo.adb \ ! ada/hostparm.ads ada/output.ads ada/system.ads ada/s-exctab.ads \ ! ada/s-stalib.ads ada/s-unstyp.ads ada/types.ads ada/unchconv.ads \ ! ada/unchdeal.ads ada/hostparm.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \ ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \ ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/impunit.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/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ ada/fname-uf.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \ ada/hostparm.ads ada/impunit.ads ada/impunit.adb ada/interfac.ads \ --- 2571,2588 ---- ada/gnatvsn.adb ada/system.ads ada/s-secsta.ads ada/s-stoele.ads \ ada/s-stoele.adb ! ada/hlo.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/hlo.ads \ ! ada/hlo.adb ada/hostparm.ads ada/output.ads ada/system.ads \ ! ada/s-exctab.ads ada/s-os_lib.ads ada/s-stalib.ads ada/s-string.ads \ ! ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/hostparm.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \ ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \ ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/impunit.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ ada/fname-uf.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \ ada/hostparm.ads ada/impunit.ads ada/impunit.adb ada/interfac.ads \ *************** ada/impunit.o : ada/ada.ads ada/a-except *** 2546,2598 **** ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/inline.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_ch7.ads ada/exp_tss.ads ada/fname.ads ada/fname-uf.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/inline.ads ada/inline.adb 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_aux.ads \ ! ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch8.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-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/instpar.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/gnatvsn.ads \ ! ada/hostparm.ads ada/instpar.ads ada/instpar.adb ada/interfac.ads \ ! ada/namet.ads ada/nlists.ads ada/opt.ads ada/output.ads \ ! ada/sdefault.ads ada/sinfo.ads ada/sinput.ads ada/sinput.adb \ ! ada/sinput-l.ads ada/snames.ads ada/system.ads ada/s-carun8.ads \ ! ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.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-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/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/widechar.ads ada/interfac.o : ada/interfac.ads ada/system.ads ada/itypes.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/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/itypes.ads ada/itypes.adb \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \ ! ada/output.ads ada/rident.ads ada/sem.ads ada/sem_util.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.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-stalib.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/types.ads ada/uintp.ads ada/uintp.adb \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/krunch.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \ ada/krunch.ads ada/krunch.adb ada/system.ads ada/s-exctab.ads \ --- 2598,2651 ---- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/inline.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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_ch7.ads ada/exp_tss.ads ada/fname.ads \ ! ada/fname-uf.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/inline.ads ada/inline.adb 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_aux.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch8.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-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/instpar.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/gnatvsn.ads ada/hostparm.ads ada/instpar.ads ada/instpar.adb \ ! ada/interfac.ads ada/namet.ads ada/nlists.ads ada/opt.ads \ ! ada/output.ads ada/sdefault.ads ada/sinfo.ads ada/sinput.ads \ ! ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/system.ads \ ! ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.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-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/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/interfac.o : ada/interfac.ads ada/system.ads ada/itypes.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/itypes.ads \ ! ada/itypes.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads ada/sem.ads \ ! ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/snames.ads ada/stand.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-stalib.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/types.ads \ ! ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/krunch.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \ ada/krunch.ads ada/krunch.adb ada/system.ads ada/s-exctab.ads \ *************** ada/krunch.o : ada/ada.ads ada/a-unccon. *** 2600,2745 **** ada/unchdeal.ads ada/layout.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_ch11.ads ada/exp_ch3.ads ada/exp_disp.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/fname.ads ada/freeze.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/interfac.ads ada/layout.ads ada/layout.adb 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/repinfo.ads ada/repinfo.adb 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_attr.ads ada/sem_aux.ads ada/sem_ch13.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads ada/sem_res.ads \ ! ada/sem_scil.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/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-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/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/lib-load.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/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/fname.ads ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib-load.ads \ ! ada/lib-load.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads ada/osint-c.ads \ ! ada/output.ads ada/par.ads ada/restrict.ads ada/rident.ads \ ! ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem_aux.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ! ada/sinput-l.ads ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/style.ads ada/styleg.ads ada/styleg.adb 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-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/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/lib-util.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/lib.ads ada/lib-util.ads ada/lib-util.adb ada/namet.ads ada/opt.ads \ ! ada/osint.ads ada/osint-c.ads ada/output.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-stoele.ads ada/s-stoele.adb 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/lib-writ.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/ali.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ ! ada/casing.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/fname.ads ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads \ ! ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \ ! ada/lib-util.ads ada/lib-util.adb ada/lib-writ.ads ada/lib-writ.adb \ ! ada/lib-xref.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads ada/osint-c.ads \ ! ada/output.ads ada/par.ads ada/par_sco.ads ada/restrict.ads \ ! ada/rident.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \ ! ada/sem_aux.ads 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/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.ads ada/s-casuti.ads ada/s-carun8.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-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/tbuild.ads ada/tbuild.adb ada/tree_io.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/lib-xref.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/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/gnat.ads ada/g-hesorg.ads ada/g-hesorg.adb \ ! ada/g-htable.ads ada/hostparm.ads ada/lib.ads ada/lib-util.ads \ ! ada/lib-util.adb ada/lib-xref.ads ada/lib-xref.adb ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/osint.ads \ ! ada/osint-c.ads ada/output.ads ada/restrict.ads ada/rident.ads \ ! ada/sem.ads ada/sem_aux.ads ada/sem_prag.ads ada/sem_util.ads \ ! ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb 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-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/widechar.ads ! ! ada/lib.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/fname.ads ada/gnat.ads ada/g-hesorg.ads \ ! ada/g-hesorg.adb 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/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ! 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-secsta.ads ada/s-stalib.ads \ ada/s-stoele.ads ada/s-stoele.adb 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/widechar.ads ! ada/live.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/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/live.ads \ ! ada/live.adb ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \ ! ada/opt.ads ada/output.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-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/namet-sp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \ ! ada/g-u3spch.ads ada/hostparm.ads ada/namet.ads ada/namet-sp.ads \ ! ada/namet-sp.adb ada/opt.ads ada/output.ads ada/system.ads \ ! ada/s-carun8.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \ ! ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-wchcnv.ads ada/s-wchcon.ads ada/table.ads \ ! ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \ ! ada/unchconv.ads ada/unchdeal.ads ada/namet.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 \ --- 2653,2806 ---- ada/unchdeal.ads ada/layout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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_ch11.ads ada/exp_ch3.ads \ ! ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \ ! ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/interfac.ads ada/layout.ads ada/layout.adb \ ! 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/repinfo.ads ada/repinfo.adb ada/restrict.ads ada/rident.ads \ ! ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem_attr.ads \ ! ada/sem_aux.ads ada/sem_ch13.ads 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/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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/lib-load.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.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/fname.ads ada/fname-uf.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-load.ads \ ! ada/lib-load.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads \ ! ada/osint-c.ads ada/output.ads ada/par.ads ada/restrict.ads \ ! ada/rident.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \ ! ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-secsta.ads \ ! ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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/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/lib-util.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/lib.ads ada/lib-util.ads ada/lib-util.adb ada/namet.ads ada/opt.ads \ ! ada/osint.ads ada/osint-c.ads ada/output.ads ada/stringt.ads \ ! ada/stringt.adb ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \ ! ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/types.adb ada/uintp.ads \ ! ada/unchconv.ads ada/unchdeal.ads ada/lib-writ.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/ali.ads ada/alloc.ads ada/aspects.ads \ ! ada/atree.ads ada/atree.adb ada/casing.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/fname.ads ada/fname-uf.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads \ ! ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \ ! ada/lib-list.adb ada/lib-sort.adb ada/lib-util.ads ada/lib-util.adb \ ! ada/lib-writ.ads ada/lib-writ.adb ada/lib-xref.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \ ! ada/osint.ads ada/osint-c.ads ada/output.ads ada/par.ads \ ! ada/par_sco.ads ada/restrict.ads ada/rident.ads ada/scans.ads \ ! ada/scn.ads ada/scng.ads ada/scng.adb ada/sem_aux.ads 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/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \ ! ada/s-casuti.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-secsta.ads ada/s-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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/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/lib-xref.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.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/fname.ads ada/gnat.ads \ ! ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads ada/hostparm.ads \ ! ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \ ! ada/lib-util.ads ada/lib-util.adb ada/lib-xref.ads ada/lib-xref.adb \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \ ! ada/osint.ads ada/osint-c.ads ada/output.ads ada/restrict.ads \ ! ada/rident.ads ada/sem.ads ada/sem_aux.ads ada/sem_aux.adb \ ! ada/sem_prag.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb 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-secsta.ads ada/s-stalib.ads \ ada/s-stoele.ads ada/s-stoele.adb 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/widechar.ads ! ada/lib.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ! ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \ ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/fname.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-hesorg.adb 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/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb 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-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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/widechar.ads ! ! ada/live.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! 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/live.ads ada/live.adb ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.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-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/namet-sp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \ ! ada/g-u3spch.ads ada/hostparm.ads ada/interfac.ads ada/namet.ads \ ! ada/namet.adb ada/namet-sp.ads ada/namet-sp.adb ada/opt.ads \ ! ada/output.ads ada/system.ads ada/s-carun8.ads ada/s-exctab.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcnv.ads ada/s-wchcon.ads \ ! ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \ ! ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads ada/namet.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/namet.o : ada/ada.ads ada/a-except.a *** 2752,2774 **** ada/unchdeal.ads ada/widechar.ads ada/nlists.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/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \ ! ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/nmake.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/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ ! ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \ ! ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ ada/s-stalib.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/unchconv.ads ada/unchdeal.ads \ --- 2813,2835 ---- ada/unchdeal.ads ada/widechar.ads ada/nlists.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-imenne.ads \ ! ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/nmake.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nmake.ads \ ! ada/nmake.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads ada/stand.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-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/unchconv.ads ada/unchdeal.ads \ *************** ada/output.o : ada/ada.ads ada/a-except. *** 2826,2879 **** ada/unchdeal.ads ada/par.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/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/fname.ads \ ! ada/fname-uf.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \ ! ada/g-speche.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \ ! ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \ ! ada/namet.ads ada/namet.adb ada/namet-sp.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads \ ! ada/output.ads ada/par.ads ada/par.adb ada/par-ch10.adb \ ! ada/par-ch11.adb ada/par-ch12.adb ada/par-ch13.adb ada/par-ch2.adb \ ! ada/par-ch3.adb ada/par-ch4.adb ada/par-ch5.adb ada/par-ch6.adb \ ! ada/par-ch7.adb ada/par-ch8.adb ada/par-ch9.adb ada/par-endh.adb \ ! ada/par-labl.adb ada/par-load.adb ada/par-prag.adb ada/par-sync.adb \ ! ada/par-tchk.adb ada/par-util.adb ada/par_sco.ads ada/restrict.ads \ ! ada/rident.ads ada/scans.ads ada/scans.adb ada/scn.ads ada/scng.ads \ ! ada/scng.adb ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb ada/sinput-l.ads \ ! 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/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \ ! ada/s-crc32.adb 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-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/tbuild.ads ada/tbuild.adb \ ! ada/tree_io.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/par_sco.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/fname.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads \ ! ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/lib.ads \ ! ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-util.ads \ ! ada/lib-util.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/opt.ads ada/osint.ads ada/osint-c.ads ada/output.ads \ ada/par_sco.ads ada/par_sco.adb ada/put_scos.ads ada/put_scos.adb \ ada/scos.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \ ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-imenne.ads \ ! ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb ada/s-strhas.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/widechar.ads ada/prep.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/csets.ads \ --- 2887,2941 ---- ada/unchdeal.ads ada/par.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ! ada/alloc.ads ada/aspects.ads ada/aspects.adb ada/atree.ads \ ! ada/atree.adb ada/casing.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/fname.ads ada/fname-uf.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/g-speche.ads \ ! ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \ ! ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/namet.ads \ ! ada/namet.adb ada/namet-sp.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads ada/output.ads \ ! ada/par.ads ada/par.adb ada/par-ch10.adb ada/par-ch11.adb \ ! ada/par-ch12.adb ada/par-ch13.adb ada/par-ch2.adb ada/par-ch3.adb \ ! ada/par-ch4.adb ada/par-ch5.adb ada/par-ch6.adb ada/par-ch7.adb \ ! ada/par-ch8.adb ada/par-ch9.adb ada/par-endh.adb ada/par-labl.adb \ ! ada/par-load.adb ada/par-prag.adb ada/par-sync.adb ada/par-tchk.adb \ ! ada/par-util.adb ada/par_sco.ads ada/restrict.ads ada/rident.ads \ ! ada/scans.ads ada/scans.adb ada/scn.ads ada/scng.ads ada/scng.adb \ ! ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \ ! ada/sinput.ads ada/sinput.adb ada/sinput-l.ads 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/stylesw.ads \ ! ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \ ! 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-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/tbuild.ads ada/tbuild.adb ada/tree_io.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/par_sco.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/fname.ads ada/gnat.ads ada/g-hesorg.ads ada/g-hesorg.adb \ ! ada/g-htable.ads ada/g-table.ads ada/g-table.adb ada/hostparm.ads \ ! ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \ ! ada/lib-util.ads ada/lib-util.adb ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/osint.ads ada/osint-c.ads ada/output.ads \ ada/par_sco.ads ada/par_sco.adb ada/put_scos.ads ada/put_scos.adb \ ada/scos.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \ ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb 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-strhas.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/widechar.ads ada/prep.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/csets.ads \ *************** ada/prep.o : ada/ada.ads ada/a-except.ad *** 2890,2897 **** ada/unchdeal.ads ada/urealp.ads ada/prepcomp.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/csets.ads ada/debug.ads ada/einfo.ads \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads ada/hostparm.ads \ ada/interfac.ads ada/lib.ads ada/lib-writ.ads ada/namet.ads \ --- 2952,2959 ---- ada/unchdeal.ads ada/urealp.ads ada/prepcomp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads ada/hostparm.ads \ ada/interfac.ads ada/lib.ads ada/lib-writ.ads ada/namet.ads \ *************** ada/put_scos.o : ada/ada.ads ada/a-uncco *** 2914,2975 **** ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/repinfo.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/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/opt.ads ada/output.ads ada/output.adb \ ! ada/repinfo.ads ada/repinfo.adb ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/sinput.adb 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-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/widechar.ads ! ! ada/restrict.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/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ ! ada/fname-uf.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/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \ ! ada/rident.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/sinput.adb 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-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/widechar.ads ada/rident.o : ada/rident.ads ada/system.ads ada/s-rident.ads ada/rtsfind.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/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_dist.ads ada/fname.ads ada/fname-uf.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-load.ads ada/lib-sort.adb 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/rident.ads ada/rtsfind.ads \ ! ada/rtsfind.adb ada/sem.ads ada/sem_ch7.ads ada/sem_dist.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-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-string.ads ada/s-traent.ads \ ! ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ ! ada/tbuild.ads 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/s-addope.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \ ada/s-addope.ads ada/s-addope.adb --- 2976,3039 ---- ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! 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/opt.ads ada/output.ads ada/output.adb ada/repinfo.ads \ ! ada/repinfo.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/sinput.adb 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-secsta.ads \ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ada/s-stoele.adb 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/widechar.ads + ada/restrict.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ + ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ + ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ + ada/fname-uf.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/restrict.ads ada/restrict.adb ada/rident.ads ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/sinput.adb 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-secsta.ads ada/s-soflin.ads \ + ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ + 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/widechar.ads + ada/rident.o : ada/rident.ads ada/system.ads ada/s-rident.ads ada/rtsfind.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.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_dist.ads ada/fname.ads \ ! ada/fname-uf.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-load.ads ada/lib-sort.adb 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/rident.ads \ ! ada/rtsfind.ads ada/rtsfind.adb ada/sem.ads ada/sem_ch7.ads \ ! ada/sem_dist.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-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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ ! ada/table.adb ada/tbuild.ads 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/s-addope.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \ ada/s-addope.ads ada/s-addope.adb *************** ada/s-assert.o : ada/ada.ads ada/a-excep *** 2980,2987 **** ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ada/s-stoele.adb ada/s-traent.ads ! ada/s-bitops.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \ ! ada/s-bitops.ads ada/s-bitops.adb ada/s-unstyp.ads ada/s-carun8.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \ ada/s-addope.ads ada/s-addope.adb ada/s-carun8.ads ada/s-carun8.adb --- 3044,3052 ---- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ada/s-stoele.adb ada/s-traent.ads ! ada/s-bitops.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/system.ads ada/s-bitops.ads ada/s-bitops.adb ada/s-parame.ads \ ! ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-carun8.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \ ada/s-addope.ads ada/s-addope.adb ada/s-carun8.ads ada/s-carun8.adb *************** ada/scans.o : ada/ada.ads ada/a-except.a *** 3127,3138 **** ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/scn.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/csets.ads \ ! ada/debug.ads ada/einfo.ads ada/err_vars.ads ada/errout.ads \ ! ada/erroutc.ads ada/gnat.ads ada/g-byorma.ads ada/g-htable.ads \ ! ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/namet.adb \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ada/restrict.ads ada/rident.ads ada/scans.ads ada/scn.ads ada/scn.adb \ ada/scng.ads ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/sinput.adb ada/snames.ads ada/stringt.ads ada/stringt.adb \ --- 3192,3215 ---- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads + ada/scil_ll.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ + ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ + ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \ + ada/opt.ads ada/output.ads ada/scil_ll.ads ada/scil_ll.adb \ + ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \ + ada/system.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \ + ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads + ada/scn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ! ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \ ! ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ! ada/g-byorma.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \ ! ada/namet.ads ada/namet.adb ada/nlists.ads ada/opt.ads ada/output.ads \ ada/restrict.ads ada/rident.ads ada/scans.ads ada/scn.ads ada/scn.adb \ ada/scng.ads ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/sinput.adb ada/snames.ads ada/stringt.ads ada/stringt.adb \ *************** ada/scos.o : ada/ada.ads ada/a-unccon.ad *** 3165,3184 **** ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/sem.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/debug_a.ads ada/debug_a.adb 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/expander.ads ada/fname.ads \ ! ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hlo.ads \ ! ada/hostparm.ads ada/inline.ads ada/lib.ads ada/lib.adb \ ! ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \ ! ada/restrict.ads ada/rident.ads ada/sem.ads ada/sem.adb \ ! ada/sem_attr.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \ ! ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch2.adb ada/sem_ch3.ads \ ! ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_prag.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-carun8.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-stalib.ads ada/s-string.ads \ --- 3242,3262 ---- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/sem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ! ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \ ! ada/casing.ads ada/debug.ads ada/debug_a.ads ada/debug_a.adb \ ! 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/expander.ads ada/fname.ads ada/gnat.ads ada/g-hesorg.ads \ ! ada/g-htable.ads ada/hlo.ads ada/hostparm.ads ada/inline.ads \ ! ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \ ! ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \ ! ada/nmake.ads ada/opt.ads ada/output.ads ada/restrict.ads \ ! ada/rident.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \ ! ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \ ! ada/sem_ch2.ads ada/sem_ch2.adb ada/sem_ch3.ads ada/sem_ch4.ads \ ! ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ ! ada/sem_ch9.ads ada/sem_prag.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-carun8.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-stalib.ads ada/s-string.ads \ *************** ada/sem.o : ada/ada.ads ada/a-except.ads *** 3188,3275 **** ada/urealp.ads ada/sem_aggr.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.ads \ ! ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.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/namet-sp.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/scans.ads ada/scn.ads ada/scng.ads \ ! ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_aggr.adb \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \ ! ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_scil.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/snames.ads \ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ada/style.ads ada/styleg.ads ada/styleg.adb 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-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/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.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.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/checks.adb ada/csets.ads ada/debug.ads ada/debug_a.ads \ ! ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads \ ! ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.ads \ ! ada/fname.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/itypes.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/scans.ads ada/sdefault.ads ada/sem.ads ada/sem_aggr.ads \ ! ada/sem_attr.ads ada/sem_attr.adb ada/sem_aux.ads ada/sem_cat.ads \ ! ada/sem_ch10.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_res.ads ada/sem_res.adb ada/sem_scil.ads \ ! ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ ! ada/snames.adb ada/sprint.ads ada/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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/ttypef.ads \ ! ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.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/atree.ads ada/atree.adb \ ! ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/output.ads ada/sem_aux.ads \ ! ada/sem_aux.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/snames.ads ada/stand.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-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_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/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads ada/hostparm.ads \ ada/interfac.ads ada/namet.ads ada/namet.adb ada/nlists.ads \ --- 3266,3355 ---- ada/urealp.ads ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \ ! ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \ ! ada/gnat.ads ada/g-htable.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/namet-sp.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/scans.ads \ ! ada/sem.ads ada/sem_aggr.ads ada/sem_aggr.adb ada/sem_attr.ads \ ! ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads \ ! ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \ ! ada/sem_eval.adb 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/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.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-string.ads ada/s-traent.ads \ ! ada/s-unstyp.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/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.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \ ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads ada/alloc.ads \ ! ada/aspects.ads ada/atree.ads ada/atree.adb ada/casing.ads \ ! ada/checks.ads ada/checks.adb ada/csets.ads ada/debug.ads \ ! ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads \ ! ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/expander.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/sdefault.ads ada/sem.ads ada/sem_aggr.ads \ ! ada/sem_attr.ads ada/sem_attr.adb ada/sem_aux.ads ada/sem_aux.adb \ ! ada/sem_cat.ads ada/sem_ch10.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_prag.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/sinfo-cn.ads \ ! ada/sinput.ads ada/sinput.adb ada/snames.ads ada/snames.adb \ ! ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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_aux.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/sem_aux.ads ada/sem_aux.adb ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads ada/stand.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-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_case.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads ada/hostparm.ads \ ada/interfac.ads ada/namet.ads ada/namet.adb ada/nlists.ads \ *************** ada/sem_case.o : ada/ada.ads ada/a-excep *** 3286,3431 **** ada/urealp.ads ada/widechar.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/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_ch11.ads ada/exp_disp.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_aux.ads \ ! ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.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/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-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_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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_disp.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/par_sco.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_attr.ads ada/sem_aux.ads \ ada/sem_ch10.ads ada/sem_ch10.adb ada/sem_ch3.ads ada/sem_ch6.ads \ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \ ! ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_scil.ads \ ! ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \ ! ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads 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/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-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_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 \ ! ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_code.ads \ ! ada/fname.ads ada/gnat.ads ada/g-htable.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/par_sco.ads ada/restrict.ads ada/rident.ads ada/rtsfind.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-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 \ ! 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_ch11.ads ada/exp_disp.ads \ ! ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.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/inline.ads ada/interfac.ads ada/itypes.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 \ ! ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \ ! ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_attr.ads \ ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads \ ada/sem_ch12.adb ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \ ada/sem_ch7.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_res.ads \ ! ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \ ! ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \ ! ada/sinput.ads ada/sinput-l.ads ada/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \ ! ada/s-exctab.adb ada/s-htable.ads ada/s-htable.adb 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-strhas.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/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/widechar.ads ada/sem_ch13.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_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/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_aux.ads ada/sem_ch13.ads ada/sem_ch13.adb \ ! ada/sem_ch3.ads 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 ada/s-stoele.ads ada/s-stoele.adb \ ! 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/tbuild.ads \ ! ada/tbuild.adb 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/urealp.adb ada/sem_ch2.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/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ada/restrict.ads ada/rident.ads ada/sem_ch2.ads ada/sem_ch2.adb \ ada/sem_ch8.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/snames.ads ada/stand.ads ada/system.ads ada/s-carun8.ads \ --- 3366,3514 ---- ada/urealp.ads ada/widechar.ads ada/sem_cat.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_disp.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/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \ ! ada/sem_cat.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/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/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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_ch10.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_disp.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/par_sco.ads \ ! ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \ ! ada/scans.ads ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ada/sem_ch10.ads ada/sem_ch10.adb ada/sem_ch3.ads ada/sem_ch6.ads \ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.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/sinfo-cn.ads 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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/exp_code.ads ada/fname.ads ada/gnat.ads ada/g-htable.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/par_sco.ads ada/restrict.ads ada/rident.ads \ ! ada/rtsfind.ads ada/sem.ads ada/sem_aux.ads ada/sem_ch11.ads \ ! ada/sem_ch11.adb ada/sem_ch13.ads 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-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/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_disp.ads ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads \ ! ada/expander.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/inline.ads ada/interfac.ads ada/itypes.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 ada/rident.ads ada/rtsfind.ads \ ! ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem_attr.ads \ ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads \ ada/sem_ch12.adb ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \ ada/sem_ch7.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_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/sinfo-cn.ads ada/sinput.ads \ ! ada/sinput-l.ads ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \ ! ada/s-htable.adb 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-strhas.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/tbuild.ads ada/tbuild.adb 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/urealp.adb \ ! ada/widechar.ads ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \ ! 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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ! ada/exp_ch11.ads ada/exp_disp.ads ada/exp_dist.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-hesorg.adb \ ! ada/g-htable.ads ada/hostparm.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 ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \ ! ada/scans.ads ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch3.ads \ ! ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb 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/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ ! ada/styleg.adb ada/stylesw.ads ada/system.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-string.ads ada/s-traent.ads ada/s-unstyp.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/uintp.ads ada/uintp.adb ada/uname.ads \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \ ! ada/widechar.ads ada/sem_ch2.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ada/restrict.ads ada/rident.ads ada/sem_ch2.ads ada/sem_ch2.adb \ ada/sem_ch8.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/snames.ads ada/stand.ads ada/system.ads ada/s-carun8.ads \ *************** ada/sem_ch2.o : ada/ada.ads ada/a-except *** 3436,3512 **** ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_ch3.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/checks.adb 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/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch3.ads \ ! ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads \ ! ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads ada/exp_tss.ads \ ! ada/exp_util.ads ada/exp_util.adb 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/inline.ads ada/interfac.ads ada/itypes.ads \ ! ada/layout.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/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_aux.ads ada/sem_case.ads ada/sem_case.adb \ ! ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch13.ads ada/sem_ch3.ads \ ! ada/sem_ch3.adb ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads ada/sem_eval.ads \ ! ada/sem_eval.adb ada/sem_mech.ads ada/sem_res.ads ada/sem_scil.ads \ ! ada/sem_smem.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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-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/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_ch4.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/debug_a.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_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/expander.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/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/namet-sp.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/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \ ! ada/sem_aggr.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_ch4.adb \ 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_intr.ads \ ! ada/sem_res.ads ada/sem_res.adb ada/sem_scil.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/snames.ads ada/stand.ads \ ! ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-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/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/sem_ch5.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/checks.adb ada/csets.ads \ ! ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \ ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads ada/exp_disp.ads \ --- 3519,3596 ---- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! 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/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads \ ! ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_ch9.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb 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/inline.ads \ ! ada/interfac.ads ada/itypes.ads ada/layout.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/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_case.ads \ ! ada/sem_case.adb ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch13.ads \ ! ada/sem_ch3.ads ada/sem_ch3.adb ada/sem_ch6.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads \ ! ada/sem_eval.ads ada/sem_eval.adb ada/sem_mech.ads ada/sem_prag.ads \ ! ada/sem_res.ads ada/sem_smem.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/snames.ads ada/sprint.ads ada/stand.ads \ ! ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ ! ada/styleg.adb ada/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/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_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \ ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \ ! ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.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/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/namet-sp.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/scans.ads \ ! ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads ada/sem_ch13.ads \ ! ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch4.adb ada/sem_ch5.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_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/sinfo-cn.ads 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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \ ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads ada/exp_disp.ads \ *************** ada/sem_ch5.o : ada/ada.ads ada/a-except *** 3516,3643 **** 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/par_sco.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_aux.ads \ ! ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads ada/sem_ch13.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_elim.ads ada/sem_eval.ads ada/sem_eval.adb \ ! ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb ada/sem_scil.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/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-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 \ ! 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_ch11.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads ada/exp_tss.ads \ ! ada/exp_util.ads ada/expander.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/inline.ads ada/interfac.ads \ ! ada/itypes.ads ada/layout.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_aux.ads ada/sem_cat.ads \ ! ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch3.ads ada/sem_ch4.ads \ ! ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch6.adb ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads ada/sem_eval.ads \ ! ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_scil.ads \ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb 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/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-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/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_ch7.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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_dbug.ads \ ! ada/exp_disp.ads ada/exp_dist.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/inline.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/nmake.adb 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_aux.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_prag.ads ada/sem_res.ads \ ! ada/sem_scil.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/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-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 \ ! ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \ ada/debug_a.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_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/expander.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/impunit.ads ada/inline.ads \ ! ada/interfac.ads ada/itypes.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/namet-sp.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/scans.ads \ ! ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch12.ads \ ! ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \ ! ada/sem_ch8.ads ada/sem_ch8.adb ada/sem_disp.ads ada/sem_dist.ads \ ! ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads \ ! ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads \ ! ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinfo-cn.ads 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/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-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_ch9.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/checks.adb ada/csets.ads \ ! ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \ ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads \ --- 3600,3725 ---- 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/par_sco.ads ada/restrict.ads ada/rident.ads \ ! ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem_aggr.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_case.ads ada/sem_case.adb \ ! ada/sem_cat.ads ada/sem_ch13.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_elim.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/sinfo-cn.ads 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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/expander.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/inline.ads \ ! ada/interfac.ads ada/itypes.ads ada/layout.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/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads \ ! ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch3.ads \ ! ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch6.adb \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads \ ! ada/sem_eval.ads ada/sem_mech.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/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/stylesw.ads ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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/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_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_dbug.ads ada/exp_disp.ads ada/exp_dist.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/inline.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/nmake.adb \ ! ada/opt.ads ada/output.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \ ! ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \ ! ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch13.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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \ ada/debug_a.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_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads \ ! ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.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/itypes.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/namet-sp.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/scans.ads \ ! ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_cat.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch3.ads \ ! ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \ ! ada/sem_ch8.adb ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \ ! ada/sem_elim.ads ada/sem_eval.ads 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/sinfo-cn.ads \ ! 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/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \ ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_disp.ads \ *************** ada/sem_ch9.o : ada/ada.ads ada/a-except *** 3647,3706 **** 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_aggr.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_ch5.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_ch9.ads \ ! ada/sem_ch9.adb ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \ ! ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads ada/sem_res.ads \ ! ada/sem_res.adb ada/sem_scil.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/sprint.ads \ ! ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \ ! ada/styleg.adb 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-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_disp.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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_atag.ads \ ! ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_dbug.ads \ ! ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads ada/exp_util.ads \ ! ada/exp_util.adb ada/fname.ads ada/fname-uf.ads ada/freeze.ads \ ! ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/inline.ads ada/interfac.ads ada/itypes.ads ada/layout.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_aux.ads ada/sem_ch3.ads ada/sem_ch6.ads \ ! ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_disp.adb \ ! ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.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/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-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_dist.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/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_dist.ads \ ada/exp_tss.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ --- 3729,3787 ---- 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/sem.ads ada/sem_aggr.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_ch5.ads ada/sem_ch6.ads \ ! ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_ch9.adb ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \ ! 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/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \ ! ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.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-string.ads ada/s-traent.ads \ ! ada/s-unstyp.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_disp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \ ! ada/exp_atag.ads ada/exp_cg.ads ada/exp_ch11.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_dbug.ads ada/exp_disp.ads ada/exp_disp.adb \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \ ! ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \ ! ada/itypes.ads ada/layout.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/scil_ll.ads ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_aux.adb ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_disp.adb 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/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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_dist.ads \ ada/exp_tss.ads ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \ *************** ada/sem_dist.o : ada/ada.ads ada/a-excep *** 3717,3770 **** ada/urealp.ads ada/sem_elab.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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_disp.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/expander.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/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 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_aux.ads ada/sem_cat.ads \ ! ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads \ ! ada/sem_elab.adb ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.ads \ ! ada/sem_type.ads ada/sem_util.ads ada/sem_util.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/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-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/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/sem_elim.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/err_vars.ads ada/errout.ads ada/erroutc.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_elim.ads ada/sem_elim.adb ada/sem_prag.ads \ ! ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \ ! ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ ! ada/s-stalib.ads ada/s-strhas.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/widechar.ads ada/sem_eval.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/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \ --- 3798,3852 ---- ada/urealp.ads ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.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/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 ada/restrict.adb \ ! ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch7.ads \ ! ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads ada/sem_elab.adb \ ! 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/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.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-string.ads ada/s-traent.ads \ ! ada/s-unstyp.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/uintp.ads ada/uintp.adb ada/uname.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.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_aux.ads ada/sem_aux.adb ada/sem_elim.ads \ ! ada/sem_elim.adb ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ ! ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \ ! ada/s-htable.ads ada/s-htable.adb 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-strhas.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/widechar.ads ada/sem_eval.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \ ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \ *************** ada/sem_eval.o : ada/ada.ads ada/a-excep *** 3774,3818 **** 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/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_aux.ads ada/sem_cat.ads ada/sem_ch13.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_res.ads ada/sem_res.adb \ ! ada/sem_scil.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/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \ ! ada/style.ads ada/styleg.ads ada/styleg.adb 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-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/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/widechar.ads ada/sem_intr.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/err_vars.ads ada/errout.ads ada/erroutc.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/rident.ads ada/sem_eval.ads ada/sem_intr.ads ada/sem_intr.adb \ ! ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/snames.ads 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-stalib.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/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_mech.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/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \ --- 3856,3901 ---- 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/rident.ads ada/rtsfind.ads ada/scans.ads \ ! ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads \ ! ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch13.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_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/sinfo-cn.ads 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/stylesw.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-string.ads ada/s-traent.ads ada/s-unstyp.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/uintp.ads ada/uintp.adb ada/uname.ads \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \ ! ada/widechar.ads ada/sem_intr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.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/rident.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_eval.ads \ ! ada/sem_intr.ads ada/sem_intr.adb ada/sem_util.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads 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-stalib.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/types.ads \ ! ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/sem_mech.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \ *************** ada/sem_mech.o : ada/ada.ads ada/a-excep *** 3827,3834 **** ada/urealp.ads ada/sem_prag.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/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \ --- 3910,3917 ---- ada/urealp.ads ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \ ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads \ *************** ada/sem_prag.o : ada/ada.ads ada/a-excep *** 3839,3913 **** ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \ ada/lib-writ.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \ ada/namet-sp.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/scans.ads \ ! ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \ ! ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch12.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_scil.ads 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/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-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 \ ! ada/casing.ads ada/checks.ads ada/checks.adb ada/csets.ads \ ! ada/debug.ads ada/debug_a.ads ada/debug_a.adb ada/einfo.ads \ ! ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads \ ! ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads ada/exp_ch6.ads \ ! ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads \ ! ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.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/inline.ads ada/interfac.ads ada/itypes.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 \ ! ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \ ! 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_aux.ads ada/sem_cat.ads \ ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \ ada/sem_ch7.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_res.ads ada/sem_res.adb ada/sem_scil.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/sprint.ads ada/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! 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-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_scil.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/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rtsfind.ads \ ! ada/sem.ads ada/sem_aux.ads ada/sem_scil.ads ada/sem_scil.adb \ ! ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/snames.ads ada/stand.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-string.ads ada/s-traent.ads \ --- 3922,3995 ---- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \ ada/lib-writ.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \ ada/namet-sp.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \ ! ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \ ! ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \ ! ada/scans.ads ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \ ! ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch12.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/stylesw.ads \ ! ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \ ! ada/csets.ads ada/debug.ads ada/debug_a.ads ada/debug_a.adb \ ! ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ! ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \ ! ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads \ ! ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \ ! ada/expander.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/inline.ads ada/interfac.ads ada/itypes.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 ada/restrict.adb ada/rident.ads \ ! ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads ada/sem.ads \ ada/sem_aggr.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_ch7.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_prag.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/sinfo-cn.ads 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/stylesw.ads ada/system.ads ada/s-carun8.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-string.ads ada/s-traent.ads ada/s-unstyp.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_scil.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/rtsfind.ads ada/scil_ll.ads ada/sem_aux.ads ada/sem_scil.ads \ ! ada/sem_scil.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ada/snames.ads ada/stand.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-string.ads ada/s-traent.ads \ *************** ada/sem_scil.o : ada/ada.ads ada/a-excep *** 3916,3923 **** ada/unchconv.ads ada/unchdeal.ads ada/urealp.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 \ ! ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ada/nlists.adb ada/opt.ads ada/output.ads ada/sem_aux.ads \ --- 3998,4005 ---- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_smem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ada/nlists.adb ada/opt.ads ada/output.ads ada/sem_aux.ads \ *************** ada/sem_smem.o : ada/ada.ads ada/a-excep *** 3930,4047 **** ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_type.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/elists.adb ada/err_vars.ads \ ! ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_disp.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/inline.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_aux.ads ada/sem_ch12.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_res.ads \ ! ada/sem_scil.ads ada/sem_type.ads ada/sem_type.adb 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/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-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_util.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/casing.adb 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/eval_fat.ads \ ! ada/exp_ch11.ads ada/exp_disp.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/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_attr.ads \ ! ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ! ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \ ! ada/sem_scil.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/stand.ads ada/stringt.ads \ ! ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ ! ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \ ! ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \ 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-strhas.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/widechar.ads ada/sem_vfpt.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/cstand.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/rident.ads \ ! ada/sem_vfpt.ads ada/sem_vfpt.adb ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/snames.ads ada/stand.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-stalib.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/ttypef.ads ada/types.ads ada/uintp.ads ada/uintp.adb \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_warn.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_ch11.ads ada/exp_code.ads ada/exp_disp.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/par_sco.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_aux.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_eval.ads ada/sem_res.ads ada/sem_scil.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/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-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 \ ! ada/casing.ads ada/debug.ads ada/einfo.ads ada/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/sinfo.ads ada/sinfo-cn.ads ada/sinfo-cn.adb ada/sinput.ads \ ! ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-imenne.ads \ ! ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sinfo.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/gnat.ads \ ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \ ada/sinput.ads ada/snames.ads ada/system.ads ada/s-exctab.ads \ --- 4012,4127 ---- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_type.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \ ! ada/exp_disp.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/inline.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/sem.ads ada/sem_attr.ads \ ada/sem_aux.ads ada/sem_ch12.ads ada/sem_ch6.ads ada/sem_ch8.ads \ ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_res.ads \ ! ada/sem_type.ads ada/sem_type.adb 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/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/elists.adb \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \ ! ada/exp_ch11.ads ada/exp_disp.ads ada/exp_dist.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/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 \ ! ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \ ! ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \ ! ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \ ! ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb 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/stand.ads ada/stringt.ads ada/stringt.adb \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \ 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-strhas.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/tbuild.ads \ ! ada/tbuild.adb 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/urealp.adb ada/widechar.ads ada/sem_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/cstand.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/gnat.ads ada/g-htable.ads ada/hostparm.ads \ ! ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/rident.ads ada/sem_vfpt.ads ada/sem_vfpt.adb ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.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-stalib.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/types.ads ada/uintp.ads ada/uintp.adb \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/sem_warn.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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_ch11.ads ada/exp_code.ads \ ! ada/exp_disp.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/par_sco.ads ada/rident.ads \ ! ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem_attr.ads \ ! ada/sem_aux.ads 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/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/stylesw.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-string.ads \ ! ada/s-traent.ads ada/s-unstyp.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/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/opt.ads \ ! ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \ ! ada/sinfo-cn.adb ada/sinput.ads ada/snames.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-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/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/sinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/gnat.ads \ ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \ ada/sinput.ads ada/snames.ads ada/system.ads ada/s-exctab.ads \ *************** ada/sinput-d.o : ada/ada.ads ada/a-excep *** 4071,4106 **** ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/sinput-l.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/csets.ads ada/debug.ads ada/einfo.ads \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ ada/gnat.ads ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads \ ! ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads ada/prep.ads \ ! ada/prepcomp.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \ ! ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput-l.ads \ ! ada/sinput-l.adb ada/snames.ads ada/stringt.ads ada/style.ads \ ! ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \ ! ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-imenne.ads \ ! ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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/tree_io.ads \ ! ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/widechar.ads ada/sinput.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/hostparm.ads \ ! ada/interfac.ads ada/namet.ads ada/namet.adb ada/nlists.ads \ ! ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/sinput.adb ada/snames.ads ada/system.ads \ ! ada/s-exctab.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-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/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/widechar.ads ada/snames.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 \ --- 4151,4186 ---- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/sinput-l.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \ ada/gnat.ads ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads \ ! ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/namet.ads \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads \ ! ada/prep.ads ada/prepcomp.ads ada/scans.ads ada/scn.ads ada/scng.ads \ ! ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ! ada/sinput-l.ads ada/sinput-l.adb ada/snames.ads ada/stringt.ads \ ! ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \ ! ada/system.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.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-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/tree_io.ads ada/types.ads ada/uintp.ads \ ! ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/sinput.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \ ! ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/namet.adb \ ! ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ ! ada/system.ads ada/s-exctab.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-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/unchconv.ads \ ! ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/snames.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/snames.o : ada/ada.ads ada/a-except. *** 4113,4135 **** ada/unchdeal.ads ada/widechar.ads ada/sprint.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/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! 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/nmake.ads ada/opt.ads ada/output.ads \ ! ada/output.adb ada/rtsfind.ads ada/sem_eval.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-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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-unccon.ads ada/a-uncdea.ads ada/stand.ads \ ada/stand.adb ada/system.ads ada/s-exctab.ads ada/s-os_lib.ads \ --- 4193,4216 ---- ada/unchdeal.ads ada/widechar.ads ada/sprint.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb 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/nmake.ads ada/opt.ads \ ! ada/output.ads ada/output.adb ada/rtsfind.ads ada/sem_eval.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-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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-unccon.ads ada/a-uncdea.ads ada/stand.ads \ ada/stand.adb ada/system.ads ada/s-exctab.ads ada/s-os_lib.ads \ *************** ada/stringt.o : ada/ada.ads ada/a-except *** 4146,4165 **** ada/unchconv.ads ada/unchdeal.ads ada/style.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/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \ ! ada/g-htable.ads ada/hostparm.ads ada/interfac.ads ada/namet.ads \ ! ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ ! ada/scans.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \ ! ada/snames.ads ada/stand.ads ada/style.ads ada/style.adb ada/styleg.ads \ ! ada/styleg.adb ada/stylesw.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-stalib.ads ada/s-stoele.ads \ ! ada/s-stoele.adb 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/widechar.ads ada/styleg.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 \ --- 4227,4246 ---- ada/unchconv.ads ada/unchdeal.ads ada/style.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ ! ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \ ! ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads \ ! ada/output.ads ada/scans.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb ada/snames.ads ada/stand.ads ada/style.ads ada/style.adb \ ! ada/styleg.ads ada/styleg.adb ada/stylesw.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-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/widechar.ads ada/styleg.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/targparm.o : ada/ada.ads ada/a-excep *** 4231,4241 **** ada/widechar.ads ada/tbuild.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/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/nmake.ads ada/nmake.adb \ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \ ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ --- 4312,4322 ---- ada/widechar.ads ada/tbuild.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.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/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/nmake.ads ada/nmake.adb \ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \ ada/sem_aux.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ *************** ada/tbuild.o : ada/ada.ads ada/a-except. *** 4246,4256 **** ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ ada/table.ads ada/table.adb 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/tree_gen.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/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/sem_aux.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \ --- 4327,4338 ---- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ ada/table.ads ada/table.adb 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/urealp.adb \ ! ada/widechar.ads ada/tree_gen.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/casing.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/sem_aux.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \ *************** ada/tree_gen.o : ada/ada.ads ada/a-excep *** 4263,4278 **** 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-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 \ --- 4345,4361 ---- 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/aspects.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-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 \ *************** ada/tree_io.o : ada/ada.ads ada/a-except *** 4283,4304 **** ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/treepr.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/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! ada/elists.ads ada/elists.adb 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/opt.ads ada/output.ads ada/output.adb \ ! ada/sem_mech.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb 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-soflin.ads \ ! ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ! 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/treepr.adb ada/treeprs.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/treeprs.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 \ --- 4366,4387 ---- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/treepr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ ! ada/einfo.adb ada/elists.ads ada/elists.adb 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/opt.ads ada/output.ads ada/output.adb \ ! ada/scil_ll.ads ada/sem_mech.ads ada/sinfo.ads ada/sinfo.adb \ ! ada/sinput.ads ada/sinput.adb 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-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ ! ada/s-stoele.ads ada/s-stoele.adb 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/treepr.adb ada/treeprs.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/treeprs.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/treeprs.o : ada/ada.ads ada/a-except *** 4309,4316 **** ada/treeprs.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \ ada/unchdeal.ads ada/urealp.ads - ada/ttypef.o : ada/system.ads ada/ttypef.ads - ada/ttypes.o : ada/ada.ads ada/a-unccon.ads ada/get_targ.ads \ ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \ ada/ttypes.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads --- 4392,4397 ---- *************** ada/uintp.o : ada/ada.ads ada/a-except.a *** 4332,4350 **** ada/unchdeal.ads ada/uname.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/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/opt.ads ada/output.ads ada/sinfo.ads \ ! ada/sinfo.adb ada/sinput.ads ada/sinput.adb 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-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/uname.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ ! ada/widechar.ads ada/urealp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \ --- 4413,4432 ---- ada/unchdeal.ads ada/uname.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ! ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ! ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \ ! 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/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ ! ada/sinput.adb 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-secsta.ads \ ! ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb 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/uname.adb ada/unchconv.ads ada/unchdeal.ads \ ! ada/urealp.ads ada/widechar.ads ada/urealp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \ diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/Makefile.in gcc-4.6.0/gcc/ada/gcc-interface/Makefile.in *** gcc-4.5.2/gcc/ada/gcc-interface/Makefile.in Sun Jul 11 09:15:12 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/Makefile.in Tue Feb 8 22:55:57 2011 *************** GNATLINK_OBJS = gnatlink.o \ *** 296,302 **** sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \ types.o validsw.o widechar.o ! GNATMAKE_OBJS = a-except.o ali.o ali-util.o s-casuti.o \ alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o\ erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \ gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \ --- 296,302 ---- sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \ types.o validsw.o widechar.o ! GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o \ alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o\ erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \ gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \ *************** GNATMAKE_OBJS = a-except.o ali.o ali-uti *** 309,315 **** scans.o scng.o sdefault.o sfn_scan.o s-purexc.o s-htable.o sinfo.o sinput.o \ sinput-c.o sinput-p.o snames.o stand.o stringt.o styleg.o stylesw.o system.o \ validsw.o switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o \ ! uintp.o uname.o urealp.o usage.o widechar.o \ $(EXTRA_GNATMAKE_OBJS) # Convert the target variable into a space separated list of architecture, --- 309,315 ---- scans.o scng.o sdefault.o sfn_scan.o s-purexc.o s-htable.o sinfo.o sinput.o \ sinput-c.o sinput-p.o snames.o stand.o stringt.o styleg.o stylesw.o system.o \ validsw.o switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o \ ! uintp.o uname.o urealp.o usage.o widechar.o scil_ll.o \ $(EXTRA_GNATMAKE_OBJS) # Convert the target variable into a space separated list of architecture, *************** MLIB_TGT = mlib-tgt *** 380,386 **** # to LIBGNAT_TARGET_PAIRS. GNATRTL_SOCKETS_OBJS = g-soccon$(objext) g-socket$(objext) g-socthi$(objext) \ ! g-soliop$(objext) g-sothco$(objext) g-sttsne$(objext) DUMMY_SOCKETS_TARGET_PAIRS = \ g-socket.adb $(RTSDIR)/s.ads $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads $(MAKE) $(FLAGS_TO_PASS) \ --- 2648,2655 ---- $(GNATLIB_SHARED) gnatlib-sjlj: ! $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" \ ! THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR) sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads $(MAKE) $(FLAGS_TO_PASS) \ *************** gnatlib-sjlj: *** 2647,2653 **** TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib gnatlib-zcx: ! $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" ../stamp-gnatlib1-$(RTSDIR) sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads $(MAKE) $(FLAGS_TO_PASS) \ --- 2662,2669 ---- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib gnatlib-zcx: ! $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \ ! THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR) sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads $(MAKE) $(FLAGS_TO_PASS) \ *************** s-tasdeb.o : s-tasdeb.adb s-tasdeb.ads *** 2707,2721 **** $< $(OUTPUT_OPTION) # force no function reordering on a-except.o because of the exclusion bounds ! # mechanism (see the source file for more detailed information). However we ! # can do that only when building the runtime (not the compiler) because the ! # -fno-toplevel-reorder option exists only in GCC 4.2 and above. - ifneq (,$(findstring xgcc,$(CC))) NO_REORDER_ADAFLAGS=-fno-toplevel-reorder - else - NO_REORDER_ADAFLAGS= - endif # force debugging information on a-except.o so that it is always # possible to set conditional breakpoints on exceptions. --- 2723,2731 ---- $< $(OUTPUT_OPTION) # force no function reordering on a-except.o because of the exclusion bounds ! # mechanism (see the source file for more detailed information). NO_REORDER_ADAFLAGS=-fno-toplevel-reorder # force debugging information on a-except.o so that it is always # possible to set conditional breakpoints on exceptions. *************** errno.o : errno.c *** 2749,2756 **** exit.o : adaint.h exit.c expect.o : expect.c final.o : final.c - gmem.o : gmem.c link.o : link.c mkdir.o : mkdir.c socket.o : socket.c gsocket.h sysdep.o : sysdep.c --- 2759,2766 ---- exit.o : adaint.h exit.c expect.o : expect.c final.o : final.c link.o : link.c + locales.o : locales.c mkdir.o : mkdir.c socket.o : socket.c gsocket.h sysdep.o : sysdep.c *************** tracebak.o : tracebak.c tb-alvms.c tb-a *** 2786,2804 **** .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 force: - - # Gnatlbr, Vms_help, and Gnat.hlp are only used on VMS - - ../../gnatlbr$(exeext): ../../prefix.o - $(GNATMAKE) -c $(ADA_INCLUDES) gnatlbr --GCC="$(CC) $(ALL_ADAFLAGS)" - $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlbr - $(GNATLINK) -v gnatlbr -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) - - ../../vms_help$(exeext): - $(GNATMAKE) -c $(ADA_INCLUDES) vms_help --GCC="$(CC) $(ALL_ADAFLAGS)" - $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vms_help - $(GNATLINK) -v vms_help -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) - - ../../gnat.hlp: ../../vms_help$(exeext) - ../../vms_help$(exeext) $(fsrcdir)/ada/gnat.help_in \ - $(fsrcdir)/ada/vms_data.ads ../../gnat.hlp --- 2796,2798 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/ada-tree.def gcc-4.6.0/gcc/ada/gcc-interface/ada-tree.def *** gcc-4.5.2/gcc/ada/gcc-interface/ada-tree.def Wed Apr 22 08:34:09 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/ada-tree.def Fri Apr 16 11:54:51 2010 *************** DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_ *** 61,72 **** just returning the inner statement. */ DEFTREECODE (STMT_STMT, "stmt_stmt", tcc_statement, 1) ! /* A loop. LOOP_STMT_TOP_COND and LOOP_STMT_BOT_COND are the tests to exit a ! loop at the top and bottom respectively. LOOP_STMT_UPDATE is the statement ! to update the loop iterator at the continue point. LOOP_STMT_BODY are the ! statements in the body of the loop. LOOP_STMT_LABEL points to the ! LABEL_DECL of the end label of the loop. */ ! DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 5) /* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if true, will cause the loop to be exited. If no condition is specified, --- 61,71 ---- just returning the inner statement. */ DEFTREECODE (STMT_STMT, "stmt_stmt", tcc_statement, 1) ! /* A loop. LOOP_STMT_COND is the test to exit the loop. LOOP_STMT_UPDATE ! is the statement to update the loop iteration variable at the continue ! point. LOOP_STMT_BODY are the statements in the body of the loop. And ! LOOP_STMT_LABEL points to the LABEL_DECL of the end label of the loop. */ ! DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 4) /* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if true, will cause the loop to be exited. If no condition is specified, diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/ada-tree.h gcc-4.6.0/gcc/ada/gcc-interface/ada-tree.h *** gcc-4.5.2/gcc/ada/gcc-interface/ada-tree.h Fri Oct 16 20:07:52 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/ada-tree.h Sun Oct 10 11:26:16 2010 *************** *** 6,12 **** * * * C Header File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** union GTY((desc ("0"), *** 32,63 **** desc ("tree_node_structure (&%h)"))) generic; }; ! /* Ada uses the lang_decl and lang_type fields to hold a tree. */ ! struct GTY(()) lang_type { tree t; }; ! struct GTY(()) lang_decl { tree t; }; /* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */ #define GET_TYPE_LANG_SPECIFIC(NODE) \ (TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE) ! #define SET_TYPE_LANG_SPECIFIC(NODE, X) \ ! do { \ ! tree tmp = (X); \ ! if (!TYPE_LANG_SPECIFIC (NODE)) \ ! TYPE_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_type); \ ! TYPE_LANG_SPECIFIC (NODE)->t = tmp; \ } while (0) /* Macros to get and set the tree in DECL_LANG_SPECIFIC. */ #define GET_DECL_LANG_SPECIFIC(NODE) \ (DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE) ! #define SET_DECL_LANG_SPECIFIC(NODE, X) \ ! do { \ ! tree tmp = (X); \ ! if (!DECL_LANG_SPECIFIC (NODE)) \ ! DECL_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_decl); \ ! DECL_LANG_SPECIFIC (NODE)->t = tmp; \ } while (0) --- 32,69 ---- desc ("tree_node_structure (&%h)"))) generic; }; ! /* Ada uses the lang_decl and lang_type fields to hold a tree. ! ! FIXME: the variable_size annotation here is needed because these types are ! variable-sized in some other front-ends. Due to gengtype deficiency, the ! GTY options of such types have to agree across all front-ends. */ ! struct GTY((variable_size)) lang_type { tree t; }; ! struct GTY((variable_size)) lang_decl { tree t; }; /* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */ #define GET_TYPE_LANG_SPECIFIC(NODE) \ (TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE) ! #define SET_TYPE_LANG_SPECIFIC(NODE, X) \ ! do { \ ! tree tmp = (X); \ ! if (!TYPE_LANG_SPECIFIC (NODE)) \ ! TYPE_LANG_SPECIFIC (NODE) \ ! = ggc_alloc_lang_type (sizeof (struct lang_type)); \ ! TYPE_LANG_SPECIFIC (NODE)->t = tmp; \ } while (0) /* Macros to get and set the tree in DECL_LANG_SPECIFIC. */ #define GET_DECL_LANG_SPECIFIC(NODE) \ (DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE) ! #define SET_DECL_LANG_SPECIFIC(NODE, X) \ ! do { \ ! tree tmp = (X); \ ! if (!DECL_LANG_SPECIFIC (NODE)) \ ! DECL_LANG_SPECIFIC (NODE) \ ! = ggc_alloc_lang_decl (sizeof (struct lang_decl)); \ ! DECL_LANG_SPECIFIC (NODE)->t = tmp; \ } while (0) *************** do { \ *** 90,96 **** /* For FUNCTION_TYPE, nonzero if this denotes a function returning an unconstrained array or record. */ ! #define TYPE_RETURNS_UNCONSTRAINED_P(NODE) \ TYPE_LANG_FLAG_1 (FUNCTION_TYPE_CHECK (NODE)) /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this denotes --- 96,102 ---- /* For FUNCTION_TYPE, nonzero if this denotes a function returning an unconstrained array or record. */ ! #define TYPE_RETURN_UNCONSTRAINED_P(NODE) \ TYPE_LANG_FLAG_1 (FUNCTION_TYPE_CHECK (NODE)) /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this denotes *************** do { \ *** 102,110 **** front-end. */ #define TYPE_EXTRA_SUBTYPE_P(NODE) TYPE_LANG_FLAG_2 (NODE) - /* Nonzero for composite types if this is a by-reference type. */ - #define TYPE_BY_REFERENCE_P(NODE) TYPE_LANG_FLAG_2 (NODE) - /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is the type for an object whose type includes its template in addition to its value (only true for RECORD_TYPE). */ --- 108,113 ---- *************** do { \ *** 135,142 **** #define TYPE_CONVENTION_FORTRAN_P(NODE) \ TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE)) ! /* For FUNCTION_TYPEs, nonzero if the function returns by reference. */ ! #define TYPE_RETURNS_BY_REF_P(NODE) \ TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE)) /* For VOID_TYPE, ENUMERAL_TYPE, UNION_TYPE, and RECORD_TYPE, nonzero if this --- 138,147 ---- #define TYPE_CONVENTION_FORTRAN_P(NODE) \ TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE)) ! /* For FUNCTION_TYPEs, nonzero if the function returns by direct reference, ! i.e. the callee returns a pointer to a memory location it has allocated ! and the caller only needs to dereference the pointer. */ ! #define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \ TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE)) /* For VOID_TYPE, ENUMERAL_TYPE, UNION_TYPE, and RECORD_TYPE, nonzero if this *************** do { \ *** 148,158 **** || TREE_CODE (NODE) == UNION_TYPE || TREE_CODE (NODE) == ENUMERAL_TYPE) \ && TYPE_DUMMY_P (NODE)) - /* For FUNCTION_TYPEs, nonzero if function returns by being passed a pointer - to a place to store its result. */ - #define TYPE_RETURNS_BY_TARGET_PTR_P(NODE) \ - TYPE_LANG_FLAG_5 (FUNCTION_TYPE_CHECK (NODE)) - /* For an INTEGER_TYPE, nonzero if TYPE_ACTUAL_BOUNDS is present. */ #define TYPE_HAS_ACTUAL_BOUNDS_P(NODE) \ TYPE_LANG_FLAG_5 (INTEGER_TYPE_CHECK (NODE)) --- 153,158 ---- *************** do { \ *** 328,341 **** been elaborated and TREE_READONLY is not set on it. */ #define DECL_READONLY_ONCE_ELAB(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)) ! /* Nonzero if this decl is always used by reference; i.e., an INDIRECT_REF is needed to access the object. */ #define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE) /* Nonzero in a FIELD_DECL that is a dummy built for some internal reason. */ #define DECL_INTERNAL_P(NODE) DECL_LANG_FLAG_3 (FIELD_DECL_CHECK (NODE)) ! /* Nonzero if this decl is a PARM_DECL for an Ada array being passed to a foreign convention subprogram. */ #define DECL_BY_COMPONENT_PTR_P(NODE) DECL_LANG_FLAG_3 (PARM_DECL_CHECK (NODE)) --- 328,349 ---- been elaborated and TREE_READONLY is not set on it. */ #define DECL_READONLY_ONCE_ELAB(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)) ! /* Nonzero in a CONST_DECL if its value is (essentially) the address of a ! constant CONSTRUCTOR. */ ! #define DECL_CONST_ADDRESS_P(NODE) DECL_LANG_FLAG_0 (CONST_DECL_CHECK (NODE)) ! ! /* Nonzero in a PARM_DECL if it is always used by double reference, i.e. a ! pair of INDIRECT_REFs is needed to access the object. */ ! #define DECL_BY_DOUBLE_REF_P(NODE) DECL_LANG_FLAG_0 (PARM_DECL_CHECK (NODE)) ! ! /* Nonzero in a DECL if it is always used by reference, i.e. an INDIRECT_REF is needed to access the object. */ #define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE) /* Nonzero in a FIELD_DECL that is a dummy built for some internal reason. */ #define DECL_INTERNAL_P(NODE) DECL_LANG_FLAG_3 (FIELD_DECL_CHECK (NODE)) ! /* Nonzero in a PARM_DECL if it is made for an Ada array being passed to a foreign convention subprogram. */ #define DECL_BY_COMPONENT_PTR_P(NODE) DECL_LANG_FLAG_3 (PARM_DECL_CHECK (NODE)) *************** do { \ *** 343,349 **** #define DECL_ELABORATION_PROC_P(NODE) \ DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (NODE)) ! /* Nonzero if this is a decl for a pointer that points to something which is readonly. Used mostly for fat pointers. */ #define DECL_POINTS_TO_READONLY_P(NODE) DECL_LANG_FLAG_4 (NODE) --- 351,357 ---- #define DECL_ELABORATION_PROC_P(NODE) \ DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (NODE)) ! /* Nonzero in a DECL if it is made for a pointer that points to something which is readonly. Used mostly for fat pointers. */ #define DECL_POINTS_TO_READONLY_P(NODE) DECL_LANG_FLAG_4 (NODE) *************** do { \ *** 372,377 **** --- 380,399 ---- #define SET_DECL_ORIGINAL_FIELD(NODE, X) \ SET_DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE), X) + /* Set DECL_ORIGINAL_FIELD of FIELD1 to (that of) FIELD2. */ + #define SET_DECL_ORIGINAL_FIELD_TO_FIELD(FIELD1, FIELD2) \ + SET_DECL_ORIGINAL_FIELD ((FIELD1), \ + DECL_ORIGINAL_FIELD (FIELD2) \ + ? DECL_ORIGINAL_FIELD (FIELD2) : (FIELD2)) + + /* Return true if FIELD1 and FIELD2 represent the same field. */ + #define SAME_FIELD_P(FIELD1, FIELD2) \ + ((FIELD1) == (FIELD2) \ + || DECL_ORIGINAL_FIELD (FIELD1) == (FIELD2) \ + || (FIELD1) == DECL_ORIGINAL_FIELD (FIELD2) \ + || (DECL_ORIGINAL_FIELD (FIELD1) \ + && (DECL_ORIGINAL_FIELD (FIELD1) == DECL_ORIGINAL_FIELD (FIELD2)))) + /* In a VAR_DECL, points to the object being renamed if the VAR_DECL is a renaming pointer, otherwise 0. Note that this object is guaranteed to be protected against multiple evaluations. */ *************** do { \ *** 405,414 **** (STATEMENT_CLASS_P (NODE) && TREE_CODE (NODE) >= STMT_STMT) #define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0) ! #define LOOP_STMT_TOP_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0) ! #define LOOP_STMT_BOT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 1) ! #define LOOP_STMT_UPDATE(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 2) ! #define LOOP_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 3) ! #define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 4) #define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0) #define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1) --- 427,454 ---- (STATEMENT_CLASS_P (NODE) && TREE_CODE (NODE) >= STMT_STMT) #define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0) ! ! #define LOOP_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0) ! #define LOOP_STMT_UPDATE(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 1) ! #define LOOP_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 2) ! #define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 3) ! ! /* A loop statement is conceptually made up of 6 sub-statements: ! ! loop: ! TOP_CONDITION ! TOP_UPDATE ! BODY ! BOTTOM_CONDITION ! BOTTOM_UPDATE ! GOTO loop ! ! However, only 4 of them can exist for a given loop, the pair of conditions ! and the pair of updates being mutually exclusive. The default setting is ! TOP_CONDITION and BOTTOM_UPDATE and the following couple of flags are used ! to toggle the individual settings. */ ! #define LOOP_STMT_BOTTOM_COND_P(NODE) TREE_LANG_FLAG_0 (LOOP_STMT_CHECK (NODE)) ! #define LOOP_STMT_TOP_UPDATE_P(NODE) TREE_LANG_FLAG_1 (LOOP_STMT_CHECK (NODE)) ! #define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0) #define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1) diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/cuintp.c gcc-4.6.0/gcc/ada/gcc-interface/cuintp.c *** gcc-4.5.2/gcc/ada/gcc-interface/cuintp.c Thu Apr 23 10:44:00 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/cuintp.c Fri Apr 16 10:16:52 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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- * *************** UI_To_gnu (Uint Input, tree type) *** 106,112 **** The base integer precision must be superior than 16. */ if (TREE_CODE (comp_type) != REAL_TYPE ! && TYPE_PRECISION (comp_type) < TYPE_PRECISION (long_integer_type_node)) { comp_type = long_integer_type_node; gcc_assert (TYPE_PRECISION (comp_type) > 16); --- 106,113 ---- The base integer precision must be superior than 16. */ if (TREE_CODE (comp_type) != REAL_TYPE ! && TYPE_PRECISION (comp_type) ! < TYPE_PRECISION (long_integer_type_node)) { comp_type = long_integer_type_node; gcc_assert (TYPE_PRECISION (comp_type) > 16); *************** UI_To_gnu (Uint Input, tree type) *** 141,143 **** --- 142,202 ---- return gnu_ret; } + + /* Similar to UI_From_Int, but take a GCC INTEGER_CST. We use UI_From_Int + when possible, i.e. for a 32-bit signed value, to take advantage of its + built-in caching mechanism. For values of larger magnitude, we compute + digits into a vector and call Vector_To_Uint. */ + + Uint + UI_From_gnu (tree Input) + { + tree gnu_type = TREE_TYPE (Input), gnu_base, gnu_temp; + /* UI_Base is defined so that 5 Uint digits is sufficient to hold the + largest possible signed 64-bit value. */ + const int Max_For_Dint = 5; + int v[Max_For_Dint], i; + Vector_Template temp; + Int_Vector vec; + + #if HOST_BITS_PER_WIDE_INT == 64 + /* On 64-bit hosts, host_integerp tells whether the input fits in a + signed 64-bit integer. Then a truncation tells whether it fits + in a signed 32-bit integer. */ + if (host_integerp (Input, 0)) + { + HOST_WIDE_INT hw_input = TREE_INT_CST_LOW (Input); + if (hw_input == (int) hw_input) + return UI_From_Int (hw_input); + } + else + return No_Uint; + #else + /* On 32-bit hosts, host_integerp tells whether the input fits in a + signed 32-bit integer. Then a sign test tells whether it fits + in a signed 64-bit integer. */ + if (host_integerp (Input, 0)) + return UI_From_Int (TREE_INT_CST_LOW (Input)); + else if (TREE_INT_CST_HIGH (Input) < 0 + && TYPE_UNSIGNED (gnu_type) + && !(TREE_CODE (gnu_type) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (gnu_type))) + return No_Uint; + #endif + + gnu_base = build_int_cst (gnu_type, UI_Base); + gnu_temp = Input; + + for (i = Max_For_Dint - 1; i >= 0; i--) + { + v[i] = tree_low_cst (fold_build1 (ABS_EXPR, gnu_type, + fold_build2 (TRUNC_MOD_EXPR, gnu_type, + gnu_temp, gnu_base)), + 0); + gnu_temp = fold_build2 (TRUNC_DIV_EXPR, gnu_type, gnu_temp, gnu_base); + } + + temp.Low_Bound = 1, temp.High_Bound = Max_For_Dint; + vec.Array = v, vec.Bounds = &temp; + return Vector_To_Uint (vec, tree_int_cst_sgn (Input) < 0); + } diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/decl.c gcc-4.6.0/gcc/ada/gcc-interface/decl.c *** gcc-4.5.2/gcc/ada/gcc-interface/decl.c Sun Sep 19 14:03:55 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/decl.c Tue Jan 4 11:33:39 2011 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2011, 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,38 **** #include "toplev.h" #include "ggc.h" #include "target.h" - #include "expr.h" #include "tree-inline.h" #include "ada.h" --- 32,37 ---- *************** *** 51,91 **** #include "ada-tree.h" #include "gigi.h" ! #ifndef MAX_FIXED_MODE_SIZE ! #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode) ! #endif ! ! /* Convention_Stdcall should be processed in a specific way on Windows targets ! only. The macro below is a helper to avoid having to check for a Windows ! specific attribute throughout this unit. */ #if TARGET_DLLIMPORT_DECL_ATTRIBUTES #define Has_Stdcall_Convention(E) (Convention (E) == Convention_Stdcall) #else ! #define Has_Stdcall_Convention(E) (0) #endif ! /* Stack realignment for functions with foreign conventions is provided on a ! per back-end basis now, as it is handled by the prologue expanders and not ! as part of the function's body any more. It might be requested by way of a ! dedicated function type attribute on the targets that support it. ! ! We need a way to avoid setting the attribute on the targets that don't ! support it and use FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN for this purpose. ! ! It is defined on targets where the circuitry is available, and indicates ! whether the realignment is needed for 'main'. We use this to decide for ! foreign subprograms as well. ! ! It is not defined on targets where the circuitry is not implemented, and ! we just never set the attribute in these cases. ! Whether it is defined on all targets that would need it in theory is ! not entirely clear. We currently trust the base GCC settings for this ! purpose. */ ! #ifndef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN ! #define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN 0 #endif struct incomplete --- 50,84 ---- #include "ada-tree.h" #include "gigi.h" ! /* Convention_Stdcall should be processed in a specific way on 32 bits ! Windows targets only. The macro below is a helper to avoid having to ! check for a Windows specific attribute throughout this unit. */ #if TARGET_DLLIMPORT_DECL_ATTRIBUTES + #ifdef TARGET_64BIT + #define Has_Stdcall_Convention(E) \ + (!TARGET_64BIT && Convention (E) == Convention_Stdcall) + #else #define Has_Stdcall_Convention(E) (Convention (E) == Convention_Stdcall) + #endif #else ! #define Has_Stdcall_Convention(E) 0 #endif ! /* Stack realignment is necessary for functions with foreign conventions when ! the ABI doesn't mandate as much as what the compiler assumes - that is, up ! to PREFERRED_STACK_BOUNDARY. ! Such realignment can be requested with a dedicated function type attribute ! on the targets that support it. We define FOREIGN_FORCE_REALIGN_STACK to ! characterize the situations where the attribute should be set. We rely on ! compiler configuration settings for 'main' to decide. */ ! #ifdef MAIN_STACK_BOUNDARY ! #define FOREIGN_FORCE_REALIGN_STACK \ ! (MAIN_STACK_BOUNDARY < PREFERRED_STACK_BOUNDARY) ! #else ! #define FOREIGN_FORCE_REALIGN_STACK 0 #endif struct incomplete *************** static struct incomplete *defer_limited_ *** 109,114 **** --- 102,132 ---- static int defer_finalize_level = 0; static VEC (tree,heap) *defer_finalize_list; + typedef struct subst_pair_d { + tree discriminant; + tree replacement; + } subst_pair; + + DEF_VEC_O(subst_pair); + DEF_VEC_ALLOC_O(subst_pair,heap); + + typedef struct variant_desc_d { + /* The type of the variant. */ + tree type; + + /* The associated field. */ + tree field; + + /* The value of the qualifier. */ + tree qual; + + /* The record associated with this variant. */ + tree record; + } variant_desc; + + DEF_VEC_O(variant_desc); + DEF_VEC_ALLOC_O(variant_desc,heap); + /* A hash table used to cache the result of annotate_value. */ static GTY ((if_marked ("tree_int_map_marked_p"), param_is (struct tree_int_map))) htab_t annotate_value_cache; *************** static void prepend_attributes (Entity_I *** 129,134 **** --- 147,154 ---- static tree elaborate_expression (Node_Id, Entity_Id, tree, bool, bool, bool); static bool is_variable_size (tree); static tree elaborate_expression_1 (tree, Entity_Id, tree, bool, bool); + static tree elaborate_expression_2 (tree, Entity_Id, tree, bool, bool, + unsigned int); static tree make_packable_type (tree, bool); static tree gnat_to_gnu_component_type (Entity_Id, bool, bool); static tree gnat_to_gnu_param (Entity_Id, Mechanism_Type, Entity_Id, bool, *************** static bool same_discriminant_p (Entity_ *** 138,163 **** static bool array_type_has_nonaliased_component (tree, Entity_Id); static bool compile_time_known_address_p (Node_Id); static bool cannot_be_superflat_p (Node_Id); static void components_to_record (tree, Node_Id, tree, int, bool, tree *, bool, bool, bool, bool, bool); static Uint annotate_value (tree); static void annotate_rep (Entity_Id, tree); static tree build_position_list (tree, bool, tree, tree, unsigned int, tree); ! static tree build_subst_list (Entity_Id, Entity_Id, bool); ! static tree build_variant_list (tree, tree, tree); static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool); static void set_rm_size (Uint, tree, Entity_Id); 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, tree); ! static tree create_field_decl_from (tree, tree, tree, tree, tree, tree); static tree get_rep_part (tree); static tree get_variant_part (tree); ! static tree create_variant_part_from (tree, tree, tree, tree, tree); ! static void copy_and_substitute_in_size (tree, tree, tree); static void rest_of_type_decl_compilation_no_defer (tree); /* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada entity, return the equivalent GCC tree for that entity (a ..._DECL node) --- 158,199 ---- static bool array_type_has_nonaliased_component (tree, Entity_Id); static bool compile_time_known_address_p (Node_Id); static bool cannot_be_superflat_p (Node_Id); + static bool constructor_address_p (tree); static void components_to_record (tree, Node_Id, tree, int, bool, tree *, bool, bool, bool, bool, bool); static Uint annotate_value (tree); static void annotate_rep (Entity_Id, tree); static tree build_position_list (tree, bool, tree, tree, unsigned int, tree); ! static VEC(subst_pair,heap) *build_subst_list (Entity_Id, Entity_Id, bool); ! static VEC(variant_desc,heap) *build_variant_list (tree, ! VEC(subst_pair,heap) *, ! VEC(variant_desc,heap) *); static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool); static void set_rm_size (Uint, tree, Entity_Id); 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 tree create_field_decl_from (tree, tree, tree, tree, tree, ! VEC(subst_pair,heap) *); static tree get_rep_part (tree); static tree get_variant_part (tree); ! static tree create_variant_part_from (tree, VEC(variant_desc,heap) *, tree, ! tree, VEC(subst_pair,heap) *); ! static void copy_and_substitute_in_size (tree, tree, VEC(subst_pair,heap) *); static void rest_of_type_decl_compilation_no_defer (tree); + static void finish_fat_pointer_type (tree, tree); + + /* The relevant constituents of a subprogram binding to a GCC builtin. Used + to pass around calls performing profile compatibility checks. */ + + typedef struct { + Entity_Id gnat_entity; /* The Ada subprogram entity. */ + tree ada_fntype; /* The corresponding GCC type node. */ + tree btin_fntype; /* The GCC builtin function type node. */ + } intrin_binding_t; + + static bool intrin_profiles_compatible_p (intrin_binding_t *); /* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada entity, return the equivalent GCC tree for that entity (a ..._DECL node) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 181,186 **** --- 217,227 ---- const Entity_Kind kind = Ekind (gnat_entity); /* True if this is a type. */ const bool is_type = IN (kind, Type_Kind); + /* True if debug info is requested for this entity. */ + const bool debug_info_p = Needs_Debug_Info (gnat_entity); + /* True if this entity is to be considered as imported. */ + const bool imported_p + = (Is_Imported (gnat_entity) && No (Address_Clause (gnat_entity))); /* For a type, contains the equivalent GNAT node to be used in gigi. */ Entity_Id gnat_equiv_type = Empty; /* Temporary used to walk the GNAT tree. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 205,216 **** bool maybe_present = false; /* True if we made GNU_DECL and its type here. */ bool this_made_decl = false; - /* True if debug info is requested for this entity. */ - bool debug_info_p = (Needs_Debug_Info (gnat_entity) - || debug_info_level == DINFO_LEVEL_VERBOSE); - /* True if this entity is to be considered as imported. */ - bool imported_p = (Is_Imported (gnat_entity) - && No (Address_Clause (gnat_entity))); /* Size and alignment of the GCC node, if meaningful. */ unsigned int esize = 0, align = 0; /* Contains the list of attributes directly attached to the entity. */ --- 246,251 ---- *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 327,336 **** another compilation unit) public entities, show we are at global level for the purpose of computing scopes. Don't do this for components or discriminants since the relevant test is whether or not the record is ! being defined. */ if (!definition && kind != E_Component && kind != E_Discriminant && Is_Public (gnat_entity) && !Is_Statically_Allocated (gnat_entity)) force_global++, this_global = true; --- 362,373 ---- another compilation unit) public entities, show we are at global level for the purpose of computing scopes. Don't do this for components or discriminants since the relevant test is whether or not the record is ! being defined. Don't do this for constants either as we'll look into ! their defining expression in the local context. */ if (!definition && kind != E_Component && kind != E_Discriminant + && kind != E_Constant && Is_Public (gnat_entity) && !Is_Statically_Allocated (gnat_entity)) force_global++, this_global = true; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 391,408 **** } /* If we have an external constant that we are not defining, get the ! expression that is was defined to represent. We may throw that ! expression away later if it is not a constant. Do not retrieve the ! expression if it is an aggregate or allocator, because in complex ! instantiation contexts it may not be expanded */ if (!definition - && Present (Expression (Declaration_Node (gnat_entity))) && !No_Initialization (Declaration_Node (gnat_entity)) ! && (Nkind (Expression (Declaration_Node (gnat_entity))) ! != N_Aggregate) ! && (Nkind (Expression (Declaration_Node (gnat_entity))) ! != N_Allocator)) ! gnu_expr = gnat_to_gnu (Expression (Declaration_Node (gnat_entity))); /* Ignore deferred constant definitions without address clause since they are processed fully in the front-end. If No_Initialization --- 428,464 ---- } /* If we have an external constant that we are not defining, get the ! expression that is was defined to represent. We may throw it away ! later if it is not a constant. But do not retrieve the expression ! if it is an allocator because the designated type might be dummy ! at this point. */ if (!definition && !No_Initialization (Declaration_Node (gnat_entity)) ! && Present (Expression (Declaration_Node (gnat_entity))) ! && Nkind (Expression (Declaration_Node (gnat_entity))) ! != N_Allocator) ! { ! bool went_into_elab_proc = false; ! ! /* The expression may contain N_Expression_With_Actions nodes and ! thus object declarations from other units. In this case, even ! though the expression will eventually be discarded since not a ! constant, the declarations would be stuck either in the global ! varpool or in the current scope. Therefore we force the local ! context and create a fake scope that we'll zap at the end. */ ! if (!current_function_decl) ! { ! current_function_decl = get_elaboration_procedure (); ! went_into_elab_proc = true; ! } ! gnat_pushlevel (); ! ! gnu_expr = gnat_to_gnu (Expression (Declaration_Node (gnat_entity))); ! ! gnat_zaplevel (); ! if (went_into_elab_proc) ! current_function_decl = NULL_TREE; ! } /* Ignore deferred constant definitions without address clause since they are processed fully in the front-end. If No_Initialization *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 442,448 **** the regular processing take place, which leaves us with a regular exception data object for VMS exceptions too. The condition code mapping is taken care of by the front end and the bitmasking by the ! runtime library. */ goto object; case E_Discriminant: --- 498,504 ---- the regular processing take place, which leaves us with a regular exception data object for VMS exceptions too. The condition code mapping is taken care of by the front end and the bitmasking by the ! run-time library. */ goto object; case E_Discriminant: *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 548,557 **** case E_Out_Parameter: case E_Variable: ! /* Simple variables, loop variables, Out parameters, and exceptions. */ object: { - bool used_by_ref = false; bool const_flag = ((kind == E_Constant || kind == E_Variable) && Is_True_Constant (gnat_entity) --- 604,612 ---- case E_Out_Parameter: case E_Variable: ! /* Simple variables, loop variables, Out parameters and exceptions. */ object: { bool const_flag = ((kind == E_Constant || kind == E_Variable) && Is_True_Constant (gnat_entity) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 559,568 **** && (((Nkind (Declaration_Node (gnat_entity)) == N_Object_Declaration) && Present (Expression (Declaration_Node (gnat_entity)))) ! || Present (Renamed_Object (gnat_entity)))); bool inner_const_flag = const_flag; bool static_p = Is_Statically_Allocated (gnat_entity); bool mutable_p = false; tree gnu_ext_name = NULL_TREE; tree renamed_obj = NULL_TREE; tree gnu_object_size; --- 614,625 ---- && (((Nkind (Declaration_Node (gnat_entity)) == N_Object_Declaration) && Present (Expression (Declaration_Node (gnat_entity)))) ! || Present (Renamed_Object (gnat_entity)) ! || imported_p)); bool inner_const_flag = const_flag; bool static_p = Is_Statically_Allocated (gnat_entity); bool mutable_p = false; + bool used_by_ref = false; tree gnu_ext_name = NULL_TREE; tree renamed_obj = NULL_TREE; tree gnu_object_size; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 579,596 **** /* Get the type after elaborating the renamed object. */ gnu_type = gnat_to_gnu_type (Etype (gnat_entity)); ! /* For a debug renaming declaration, build a pure debug entity. */ if (Present (Debug_Renaming_Link (gnat_entity))) { ! rtx addr; gnu_decl = build_decl (input_location, VAR_DECL, gnu_entity_name, gnu_type); ! /* The (MEM (CONST (0))) pattern is prescribed by STABS. */ ! if (global_bindings_p ()) ! addr = gen_rtx_CONST (VOIDmode, const0_rtx); ! else ! addr = stack_pointer_rtx; ! SET_DECL_RTL (gnu_decl, gen_rtx_MEM (Pmode, addr)); gnat_pushdecl (gnu_decl, gnat_entity); break; } --- 636,660 ---- /* Get the type after elaborating the renamed object. */ gnu_type = gnat_to_gnu_type (Etype (gnat_entity)); ! /* If this is a standard exception definition, then use the standard ! exception type. This is necessary to make sure that imported and ! exported views of exceptions are properly merged in LTO mode. */ ! if (TREE_CODE (TYPE_NAME (gnu_type)) == TYPE_DECL ! && DECL_NAME (TYPE_NAME (gnu_type)) == exception_data_name_id) ! gnu_type = except_type_node; ! ! /* For a debug renaming declaration, build a debug-only entity. */ if (Present (Debug_Renaming_Link (gnat_entity))) { ! /* Force a non-null value to make sure the symbol is retained. */ ! tree value = build1 (INDIRECT_REF, gnu_type, ! build1 (NOP_EXPR, ! build_pointer_type (gnu_type), ! integer_minus_one_node)); gnu_decl = build_decl (input_location, VAR_DECL, gnu_entity_name, gnu_type); ! SET_DECL_VALUE_EXPR (gnu_decl, value); ! DECL_HAS_VALUE_EXPR_P (gnu_decl) = 1; gnat_pushdecl (gnu_decl, gnat_entity); break; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 604,612 **** if (kind == E_Loop_Parameter) gnu_type = get_base_type (gnu_type); ! /* Reject non-renamed objects whose types are unconstrained arrays or ! any object whose type is a dummy type or VOID_TYPE. */ ! if ((TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE && No (Renamed_Object (gnat_entity))) || TYPE_IS_DUMMY_P (gnu_type) --- 668,675 ---- if (kind == E_Loop_Parameter) gnu_type = get_base_type (gnu_type); ! /* Reject non-renamed objects whose type is an unconstrained array or ! any object whose type is a dummy type or void. */ if ((TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE && No (Renamed_Object (gnat_entity))) || TYPE_IS_DUMMY_P (gnu_type) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 626,631 **** --- 689,695 ---- gcc_assert (Present (Alignment (gnat_entity))); align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); + /* No point in changing the type if there is an address clause as the final type of the object will be a reference type. */ if (Present (Address_Clause (gnat_entity))) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 636,646 **** false, false, definition, true); } ! /* If we are defining the object, see if it has a Size value and ! validate it if so. If we are not defining the object and a Size ! clause applies, simply retrieve the value. We don't want to ignore ! the clause and it is expected to have been validated already. Then ! get the new type, if any. */ if (definition) gnu_size = validate_size (Esize (gnat_entity), gnu_type, gnat_entity, VAR_DECL, false, --- 700,710 ---- false, false, definition, true); } ! /* If we are defining the object, see if it has a Size and validate it ! if so. If we are not defining the object and a Size clause applies, ! simply retrieve the value. We don't want to ignore the clause and ! it is expected to have been validated already. Then get the new ! type, if any. */ if (definition) gnu_size = validate_size (Esize (gnat_entity), gnu_type, gnat_entity, VAR_DECL, false, *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 659,666 **** } /* If this object has self-referential size, it must be a record with ! a default value. We are supposed to allocate an object of the ! maximum size in this case unless it is a constant with an initializing expression, in which case we can get the size from that. Note that the resulting size may still be a variable, so this may end up with an indirect allocation. */ --- 723,730 ---- } /* If this object has self-referential size, it must be a record with ! a default discriminant. We are supposed to allocate an object of ! the maximum size in this case, unless it is a constant with an initializing expression, in which case we can get the size from that. Note that the resulting size may still be a variable, so this may end up with an indirect allocation. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 707,714 **** } } ! /* If the size is zero bytes, make it one byte since some linkers have ! trouble with zero-sized objects. If the object will have a template, that will make it nonzero so don't bother. Also avoid doing that for an object renaming or an object with an address clause, as we would lose useful information on the view size --- 771,778 ---- } } ! /* If the size is zero byte, make it one byte since some linkers have ! troubles with zero-sized objects. If the object will have a template, that will make it nonzero so don't bother. Also avoid doing that for an object renaming or an object with an address clause, as we would lose useful information on the view size *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 739,744 **** --- 803,809 ---- && kind != E_Out_Parameter && Is_Composite_Type (Etype (gnat_entity)) && !Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) + && !Is_Exported (gnat_entity) && !imported_p && No (Renamed_Object (gnat_entity)) && No (Address_Clause (gnat_entity)))) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 774,780 **** ??? Note that we ignore Has_Volatile_Components on objects; it's not at all clear what to do in that case. */ - if (Has_Atomic_Components (gnat_entity)) { tree gnu_inner = (TREE_CODE (gnu_type) == ARRAY_TYPE --- 839,844 ---- *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 789,798 **** /* Now check if the type of the object allows atomic access. Note that we must test the type, even if this object has size and ! alignment to allow such access, because we will be going ! inside the padded record to assign to the object. We could fix ! this by always copying via an intermediate value, but it's not ! clear it's worth the effort. */ if (Is_Atomic (gnat_entity)) check_ok_for_atomic (gnu_type, gnat_entity, false); --- 853,862 ---- /* Now check if the type of the object allows atomic access. Note that we must test the type, even if this object has size and ! alignment to allow such access, because we will be going inside ! the padded record to assign to the object. We could fix this by ! always copying via an intermediate value, but it's not clear it's ! worth the effort. */ if (Is_Atomic (gnat_entity)) check_ok_for_atomic (gnu_type, gnat_entity, false); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 808,814 **** gnu_type = build_unc_object_type_from_ptr (gnu_fat, gnu_type, concat_name (gnu_entity_name, ! "UNC")); } #ifdef MINIMUM_ATOMIC_ALIGNMENT --- 872,879 ---- gnu_type = build_unc_object_type_from_ptr (gnu_fat, gnu_type, concat_name (gnu_entity_name, ! "UNC"), ! debug_info_p); } #ifdef MINIMUM_ATOMIC_ALIGNMENT *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 889,915 **** that for the renaming. At the global level, we can only do this if we know no SAVE_EXPRs need be made, because the expression we return might be used in arbitrary conditional ! branches so we must force the SAVE_EXPRs evaluation ! immediately and this requires a function context. */ if (!Materialize_Entity (gnat_entity) ! && (!global_bindings_p () || (staticp (gnu_expr) && !TREE_SIDE_EFFECTS (gnu_expr)))) { maybe_stable_expr ! = maybe_stabilize_reference (gnu_expr, true, &stable); if (stable) { /* ??? No DECL_EXPR is created so we need to mark the expression manually lest it is shared. */ ! if (global_bindings_p ()) MARK_VISITED (maybe_stable_expr); gnu_decl = maybe_stable_expr; save_gnu_tree (gnat_entity, gnu_decl, true); saved = true; annotate_object (gnat_entity, gnu_type, NULL_TREE, ! false); break; } --- 954,983 ---- that for the renaming. At the global level, we can only do this if we know no SAVE_EXPRs need be made, because the expression we return might be used in arbitrary conditional ! branches so we must force the evaluation of the SAVE_EXPRs ! immediately and this requires a proper function context. ! Note that an external constant is at the global level. */ if (!Materialize_Entity (gnat_entity) ! && (!((!definition && kind == E_Constant) ! || global_bindings_p ()) || (staticp (gnu_expr) && !TREE_SIDE_EFFECTS (gnu_expr)))) { maybe_stable_expr ! = gnat_stabilize_reference (gnu_expr, true, &stable); if (stable) { /* ??? No DECL_EXPR is created so we need to mark the expression manually lest it is shared. */ ! if ((!definition && kind == E_Constant) ! || global_bindings_p ()) MARK_VISITED (maybe_stable_expr); gnu_decl = maybe_stable_expr; save_gnu_tree (gnat_entity, gnu_decl, true); saved = true; annotate_object (gnat_entity, gnu_type, NULL_TREE, ! false, false); break; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 973,979 **** else { maybe_stable_expr ! = maybe_stabilize_reference (gnu_expr, true, &stable); if (stable) renamed_obj = maybe_stable_expr; --- 1041,1047 ---- else { maybe_stable_expr ! = gnat_stabilize_reference (gnu_expr, true, &stable); if (stable) renamed_obj = maybe_stable_expr; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 982,989 **** as we have a VAR_DECL for the pointer we make. */ } ! gnu_expr ! = build_unary_op (ADDR_EXPR, gnu_type, maybe_stable_expr); gnu_size = NULL_TREE; used_by_ref = true; --- 1050,1057 ---- as we have a VAR_DECL for the pointer we make. */ } ! gnu_expr = build_unary_op (ADDR_EXPR, gnu_type, ! maybe_stable_expr); gnu_size = NULL_TREE; used_by_ref = true; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 996,1003 **** and disallow any optimizations for such a non-constant object. */ if ((Treat_As_Volatile (gnat_entity) || (!const_flag && (Is_Exported (gnat_entity) ! || Is_Imported (gnat_entity) || Present (Address_Clause (gnat_entity))))) && !TYPE_VOLATILE (gnu_type)) gnu_type = build_qualified_type (gnu_type, --- 1064,1072 ---- and disallow any optimizations for such a non-constant object. */ if ((Treat_As_Volatile (gnat_entity) || (!const_flag + && gnu_type != except_type_node && (Is_Exported (gnat_entity) ! || imported_p || Present (Address_Clause (gnat_entity))))) && !TYPE_VOLATILE (gnu_type)) gnu_type = build_qualified_type (gnu_type, *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1024,1039 **** = TYPE_PADDING_P (gnu_type) ? TYPE_FIELDS (TREE_TYPE (TYPE_FIELDS (gnu_type))) : TYPE_FIELDS (gnu_type); ! ! gnu_expr ! = gnat_build_constructor ! (gnu_type, ! tree_cons ! (template_field, ! build_template (TREE_TYPE (template_field), ! TREE_TYPE (TREE_CHAIN (template_field)), ! NULL_TREE), ! NULL_TREE)); } /* Convert the expression to the type of the object except in the --- 1093,1104 ---- = TYPE_PADDING_P (gnu_type) ? TYPE_FIELDS (TREE_TYPE (TYPE_FIELDS (gnu_type))) : TYPE_FIELDS (gnu_type); ! VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 1); ! tree t = build_template (TREE_TYPE (template_field), ! TREE_TYPE (DECL_CHAIN (template_field)), ! NULL_TREE); ! CONSTRUCTOR_APPEND_ELT (v, template_field, t); ! gnu_expr = gnat_build_constructor (gnu_type, v); } /* Convert the expression to the type of the object except in the *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1050,1061 **** (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type)))))) gnu_expr = convert (gnu_type, gnu_expr); ! /* If this is a pointer and it does not have an initializing ! expression, initialize it to NULL, unless the object is ! imported. */ if (definition && (POINTER_TYPE_P (gnu_type) || TYPE_IS_FAT_POINTER_P (gnu_type)) ! && !Is_Imported (gnat_entity) && !gnu_expr) gnu_expr = integer_zero_node; /* If we are defining the object and it has an Address clause, we must --- 1115,1126 ---- (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type)))))) gnu_expr = convert (gnu_type, gnu_expr); ! /* If this is a pointer that doesn't have an initializing expression, ! initialize it to NULL, unless the object is imported. */ if (definition && (POINTER_TYPE_P (gnu_type) || TYPE_IS_FAT_POINTER_P (gnu_type)) ! && !gnu_expr ! && !Is_Imported (gnat_entity)) gnu_expr = integer_zero_node; /* If we are defining the object and it has an Address clause, we must *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1065,1074 **** effects in this case. */ if (definition && Present (Address_Clause (gnat_entity))) { tree gnu_address = present_gnu_tree (gnat_entity) ! ? get_gnu_tree (gnat_entity) ! : gnat_to_gnu (Expression (Address_Clause (gnat_entity))); save_gnu_tree (gnat_entity, NULL_TREE, false); --- 1130,1139 ---- effects in this case. */ if (definition && Present (Address_Clause (gnat_entity))) { + Node_Id gnat_expr = Expression (Address_Clause (gnat_entity)); tree gnu_address = present_gnu_tree (gnat_entity) ! ? get_gnu_tree (gnat_entity) : gnat_to_gnu (gnat_expr); save_gnu_tree (gnat_entity, NULL_TREE, false); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1081,1089 **** = build_reference_type_for_mode (gnu_type, ptr_mode, true); gnu_address = convert (gnu_type, gnu_address); used_by_ref = true; ! const_flag = !Is_Public (gnat_entity) ! || compile_time_known_address_p (Expression (Address_Clause ! (gnat_entity))); /* If this is a deferred constant, the initializer is attached to the full view. */ --- 1146,1154 ---- = build_reference_type_for_mode (gnu_type, ptr_mode, true); gnu_address = convert (gnu_type, gnu_address); used_by_ref = true; ! const_flag ! = !Is_Public (gnat_entity) ! || compile_time_known_address_p (gnat_expr); /* If this is a deferred constant, the initializer is attached to the full view. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1154,1172 **** If the object's size overflows, make an allocator too, so that Storage_Error gets raised. Note that we will never free such memory, so we presume it never will get allocated. */ - if (!allocatable_size_p (TYPE_SIZE_UNIT (gnu_type), ! global_bindings_p () || !definition || static_p) ! || (gnu_size ! && ! allocatable_size_p (gnu_size, ! global_bindings_p () || !definition ! || static_p))) { gnu_type = build_reference_type (gnu_type); gnu_size = NULL_TREE; used_by_ref = true; - const_flag = true; /* In case this was a aliased object whose nominal subtype is unconstrained, the pointer above will be a thin pointer and --- 1219,1236 ---- If the object's size overflows, make an allocator too, so that Storage_Error gets raised. Note that we will never free such memory, so we presume it never will get allocated. */ if (!allocatable_size_p (TYPE_SIZE_UNIT (gnu_type), ! global_bindings_p () ! || !definition || static_p) ! || (gnu_size && !allocatable_size_p (gnu_size, ! global_bindings_p () ! || !definition ! || static_p))) { gnu_type = build_reference_type (gnu_type); gnu_size = NULL_TREE; used_by_ref = true; /* In case this was a aliased object whose nominal subtype is unconstrained, the pointer above will be a thin pointer and *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1180,1187 **** If we are elaborating a mutable object, tell build_allocator to ignore a possibly simpler size from the initializer, if any, as we must allocate the maximum possible size in this case. */ ! ! if (definition) { tree gnu_alloc_type = TREE_TYPE (gnu_type); --- 1244,1250 ---- If we are elaborating a mutable object, tell build_allocator to ignore a possibly simpler size from the initializer, if any, as we must allocate the maximum possible size in this case. */ ! if (definition && !imported_p) { tree gnu_alloc_type = TREE_TYPE (gnu_type); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1189,1195 **** && TYPE_CONTAINS_TEMPLATE_P (gnu_alloc_type)) { gnu_alloc_type ! = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_alloc_type))); if (TREE_CODE (gnu_expr) == CONSTRUCTOR && 1 == VEC_length (constructor_elt, --- 1252,1258 ---- && TYPE_CONTAINS_TEMPLATE_P (gnu_alloc_type)) { gnu_alloc_type ! = TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_alloc_type))); if (TREE_CODE (gnu_expr) == CONSTRUCTOR && 1 == VEC_length (constructor_elt, *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1199,1217 **** gnu_expr = build_component_ref (gnu_expr, NULL_TREE, ! TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (gnu_expr))), false); } if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST ! && TREE_OVERFLOW (TYPE_SIZE_UNIT (gnu_alloc_type)) ! && !Is_Imported (gnat_entity)) ! post_error ("?Storage_Error will be raised at run-time!", gnat_entity); gnu_expr = build_allocator (gnu_alloc_type, gnu_expr, gnu_type, Empty, Empty, gnat_entity, mutable_p); } else { --- 1262,1280 ---- gnu_expr = build_component_ref (gnu_expr, NULL_TREE, ! DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (gnu_expr))), false); } if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST ! && TREE_OVERFLOW (TYPE_SIZE_UNIT (gnu_alloc_type))) ! post_error ("?`Storage_Error` will be raised at run time!", gnat_entity); gnu_expr = build_allocator (gnu_alloc_type, gnu_expr, gnu_type, Empty, Empty, gnat_entity, mutable_p); + const_flag = true; } else { *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1290,1299 **** || Is_Exported (gnat_entity))))) gnu_ext_name = create_concat_name (gnat_entity, NULL); ! /* If this is constant initialized to a static constant and the ! object has an aggregate type, force it to be statically ! allocated. This will avoid an initialization copy. */ ! if (!static_p && const_flag && gnu_expr && TREE_CONSTANT (gnu_expr) && AGGREGATE_TYPE_P (gnu_type) && host_integerp (TYPE_SIZE_UNIT (gnu_type), 1) --- 1353,1362 ---- || Is_Exported (gnat_entity))))) gnu_ext_name = create_concat_name (gnat_entity, NULL); ! /* If this is an aggregate constant initialized to a constant, force it ! to be statically allocated. This saves an initialization copy. */ ! if (!static_p ! && const_flag && gnu_expr && TREE_CONSTANT (gnu_expr) && AGGREGATE_TYPE_P (gnu_type) && host_integerp (TYPE_SIZE_UNIT (gnu_type), 1) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1302,1364 **** (TREE_TYPE (TYPE_FIELDS (gnu_type))), 1))) static_p = true; ! gnu_decl = create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type, ! gnu_expr, const_flag, ! Is_Public (gnat_entity), ! imported_p || !definition, ! static_p, attr_list, gnat_entity); DECL_BY_REF_P (gnu_decl) = used_by_ref; DECL_POINTS_TO_READONLY_P (gnu_decl) = used_by_ref && inner_const_flag; - if (TREE_CODE (gnu_decl) == VAR_DECL && renamed_obj) - { - SET_DECL_RENAMED_OBJECT (gnu_decl, renamed_obj); - if (global_bindings_p ()) - { - DECL_RENAMING_GLOBAL_P (gnu_decl) = 1; - record_global_renaming_pointer (gnu_decl); - } - } - - if (definition && DECL_SIZE_UNIT (gnu_decl) - && get_block_jmpbuf_decl () - && (TREE_CODE (DECL_SIZE_UNIT (gnu_decl)) != INTEGER_CST - || (flag_stack_check == GENERIC_STACK_CHECK - && compare_tree_int (DECL_SIZE_UNIT (gnu_decl), - STACK_CHECK_MAX_VAR_SIZE) > 0))) - add_stmt_with_node (build_call_1_expr - (update_setjmp_buf_decl, - build_unary_op (ADDR_EXPR, NULL_TREE, - get_block_jmpbuf_decl ())), - gnat_entity); ! /* If we are defining an Out parameter and we're not optimizing, ! create a fake PARM_DECL for debugging purposes and make it ! point to the VAR_DECL. Suppress debug info for the latter ! but make sure it will still live on the stack so it can be ! accessed from within the debugger through the PARM_DECL. */ ! if (kind == E_Out_Parameter && definition && !optimize) { tree param = create_param_decl (gnu_entity_name, gnu_type, false); gnat_pushdecl (param, gnat_entity); SET_DECL_VALUE_EXPR (param, gnu_decl); DECL_HAS_VALUE_EXPR_P (param) = 1; ! if (debug_info_p) ! debug_info_p = false; ! else ! DECL_IGNORED_P (param) = 1; TREE_ADDRESSABLE (gnu_decl) = 1; } ! /* If this is a public constant or we're not optimizing and we're not ! making a VAR_DECL for it, make one just for export or debugger use. ! Likewise if the address is taken or if either the object or type is ! aliased. Make an external declaration for a reference, unless this ! is a Standard entity since there no real symbol at the object level ! for these. */ if (TREE_CODE (gnu_decl) == CONST_DECL && (definition || Sloc (gnat_entity) > Standard_Location) ! && ((Is_Public (gnat_entity) && No (Address_Clause (gnat_entity))) ! || !optimize || Address_Taken (gnat_entity) || Is_Aliased (gnat_entity) || Is_Aliased (Etype (gnat_entity)))) --- 1365,1419 ---- (TREE_TYPE (TYPE_FIELDS (gnu_type))), 1))) static_p = true; ! /* Now create the variable or the constant and set various flags. */ ! gnu_decl ! = create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type, ! gnu_expr, const_flag, Is_Public (gnat_entity), ! imported_p || !definition, static_p, attr_list, ! gnat_entity); DECL_BY_REF_P (gnu_decl) = used_by_ref; DECL_POINTS_TO_READONLY_P (gnu_decl) = used_by_ref && inner_const_flag; ! /* If we are defining an Out parameter and optimization isn't enabled, ! create a fake PARM_DECL for debugging purposes and make it point to ! the VAR_DECL. Suppress debug info for the latter but make sure it ! will live on the stack so that it can be accessed from within the ! debugger through the PARM_DECL. */ ! if (kind == E_Out_Parameter && definition && !optimize && debug_info_p) { tree param = create_param_decl (gnu_entity_name, gnu_type, false); gnat_pushdecl (param, gnat_entity); SET_DECL_VALUE_EXPR (param, gnu_decl); DECL_HAS_VALUE_EXPR_P (param) = 1; ! DECL_IGNORED_P (gnu_decl) = 1; TREE_ADDRESSABLE (gnu_decl) = 1; } ! /* If this is a renaming pointer, attach the renamed object to it and ! register it if we are at the global level. Note that an external ! constant is at the global level. */ ! if (TREE_CODE (gnu_decl) == VAR_DECL && renamed_obj) ! { ! SET_DECL_RENAMED_OBJECT (gnu_decl, renamed_obj); ! if ((!definition && kind == E_Constant) || global_bindings_p ()) ! { ! DECL_RENAMING_GLOBAL_P (gnu_decl) = 1; ! record_global_renaming_pointer (gnu_decl); ! } ! } ! ! /* If this is a constant and we are defining it or it generates a real ! symbol at the object level and we are referencing it, we may want ! or need to have a true variable to represent it: ! - if optimization isn't enabled, for debugging purposes, ! - if the constant is public and not overlaid on something else, ! - if its address is taken, ! - if either itself or its type is aliased. */ if (TREE_CODE (gnu_decl) == CONST_DECL && (definition || Sloc (gnat_entity) > Standard_Location) ! && ((!optimize && debug_info_p) ! || (Is_Public (gnat_entity) ! && No (Address_Clause (gnat_entity))) || Address_Taken (gnat_entity) || Is_Aliased (gnat_entity) || Is_Aliased (Etype (gnat_entity)))) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1372,1388 **** SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var); /* As debugging information will be generated for the variable, ! do not generate information for the constant. */ ! DECL_IGNORED_P (gnu_decl) = 1; } ! /* If this is declared in a block that contains a block with an ! exception handler, we must force this variable in memory to ! suppress an invalid optimization. */ ! if (Has_Nested_Block_With_Handler (Scope (gnat_entity)) ! && Exception_Mechanism != Back_End_Exceptions) TREE_ADDRESSABLE (gnu_decl) = 1; /* Back-annotate Esize and Alignment of the object if not already known. Note that we pick the values of the type, not those of the object, to shield ourselves from low-level platform-dependent --- 1427,1473 ---- SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var); /* As debugging information will be generated for the variable, ! do not generate debugging information for the constant. */ ! if (debug_info_p) ! DECL_IGNORED_P (gnu_decl) = 1; ! else ! DECL_IGNORED_P (gnu_corr_var) = 1; } ! /* If this is a constant, even if we don't need a true variable, we ! may need to avoid returning the initializer in every case. That ! can happen for the address of a (constant) constructor because, ! upon dereferencing it, the constructor will be reinjected in the ! tree, which may not be valid in every case; see lvalue_required_p ! for more details. */ ! if (TREE_CODE (gnu_decl) == CONST_DECL) ! DECL_CONST_ADDRESS_P (gnu_decl) = constructor_address_p (gnu_expr); ! ! /* If this object is declared in a block that contains a block with an ! exception handler, and we aren't using the GCC exception mechanism, ! we must force this variable in memory in order to avoid an invalid ! optimization. */ ! if (Exception_Mechanism != Back_End_Exceptions ! && Has_Nested_Block_With_Handler (Scope (gnat_entity))) TREE_ADDRESSABLE (gnu_decl) = 1; + /* If we are defining an object with variable size or an object with + fixed size that will be dynamically allocated, and we are using the + setjmp/longjmp exception mechanism, update the setjmp buffer. */ + if (definition + && Exception_Mechanism == Setjmp_Longjmp + && get_block_jmpbuf_decl () + && DECL_SIZE_UNIT (gnu_decl) + && (TREE_CODE (DECL_SIZE_UNIT (gnu_decl)) != INTEGER_CST + || (flag_stack_check == GENERIC_STACK_CHECK + && compare_tree_int (DECL_SIZE_UNIT (gnu_decl), + STACK_CHECK_MAX_VAR_SIZE) > 0))) + add_stmt_with_node (build_call_1_expr + (update_setjmp_buf_decl, + build_unary_op (ADDR_EXPR, NULL_TREE, + get_block_jmpbuf_decl ())), + gnat_entity); + /* Back-annotate Esize and Alignment of the object if not already known. Note that we pick the values of the type, not those of the object, to shield ourselves from low-level platform-dependent *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1391,1397 **** type of the object and not on the object directly, and makes it possible to support all confirming representation clauses. */ annotate_object (gnat_entity, TREE_TYPE (gnu_decl), gnu_object_size, ! used_by_ref); } break; --- 1476,1482 ---- type of the object and not on the object directly, and makes it possible to support all confirming representation clauses. */ annotate_object (gnat_entity, TREE_TYPE (gnu_decl), gnu_object_size, ! used_by_ref, false); } break; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1458,1464 **** /* Note that the bounds are updated at the end of this function to avoid an infinite recursion since they refer to the type. */ } ! break; case E_Signed_Integer_Type: case E_Ordinary_Fixed_Point_Type: --- 1543,1549 ---- /* Note that the bounds are updated at the end of this function to avoid an infinite recursion since they refer to the type. */ } ! goto discrete_type; case E_Signed_Integer_Type: case E_Ordinary_Fixed_Point_Type: *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1466,1472 **** /* For integer types, just make a signed type the appropriate number of bits. */ gnu_type = make_signed_type (esize); ! break; case E_Modular_Integer_Type: { --- 1551,1557 ---- /* For integer types, just make a signed type the appropriate number of bits. */ gnu_type = make_signed_type (esize); ! goto discrete_type; case E_Modular_Integer_Type: { *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1505,1511 **** gnu_type = gnu_subtype; } } ! break; case E_Signed_Integer_Subtype: case E_Enumeration_Subtype: --- 1590,1596 ---- gnu_type = gnu_subtype; } } ! goto discrete_type; case E_Signed_Integer_Subtype: case E_Enumeration_Subtype: *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1594,1599 **** --- 1679,1698 ---- gnat_to_gnu_type (Original_Array_Type (gnat_entity))); + discrete_type: + + /* We have to handle clauses that under-align the type specially. */ + if ((Present (Alignment_Clause (gnat_entity)) + || (Is_Packed_Array_Type (gnat_entity) + && Present + (Alignment_Clause (Original_Array_Type (gnat_entity))))) + && UI_Is_In_Int_Range (Alignment (gnat_entity))) + { + align = UI_To_Int (Alignment (gnat_entity)) * BITS_PER_UNIT; + if (align >= TYPE_ALIGN (gnu_type)) + align = 0; + } + /* If the type we are dealing with represents a bit-packed array, we need to have the bits left justified on big-endian targets and right justified on little-endian targets. We also need to *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1606,1644 **** { tree gnu_field_type, gnu_field; ! /* Set the RM size before wrapping up the type. */ SET_TYPE_RM_SIZE (gnu_type, UI_To_gnu (RM_Size (gnat_entity), bitsizetype)); TYPE_PACKED_ARRAY_TYPE_P (gnu_type) = 1; gnu_field_type = gnu_type; gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "JM"); - - /* Propagate the alignment of the modular type to the record. - This means that bit-packed arrays have "ceil" alignment for - their size, which may seem counter-intuitive but makes it - possible to easily overlay them on modular types. */ - TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_field_type); TYPE_PACKED (gnu_type) = 1; ! /* Create a stripped-down declaration of the original type, mainly ! for debugging. */ ! create_type_decl (gnu_entity_name, gnu_field_type, NULL, true, ! debug_info_p, gnat_entity); ! /* Don't notify the field as "addressable", since we won't be taking ! it's address and it would prevent create_field_decl from making a ! bitfield. */ ! gnu_field = create_field_decl (get_identifier ("OBJECT"), ! gnu_field_type, gnu_type, 1, 0, 0, 0); /* Do not emit debug info until after the parallel type is added. */ ! finish_record_type (gnu_type, gnu_field, 0, false); TYPE_JUSTIFIED_MODULAR_P (gnu_type) = 1; - relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY); - if (debug_info_p) { /* Make the original array type a parallel type. */ --- 1705,1751 ---- { tree gnu_field_type, gnu_field; ! /* Set the RM size before wrapping up the original type. */ SET_TYPE_RM_SIZE (gnu_type, UI_To_gnu (RM_Size (gnat_entity), bitsizetype)); TYPE_PACKED_ARRAY_TYPE_P (gnu_type) = 1; + + /* Create a stripped-down declaration, mainly for debugging. */ + create_type_decl (gnu_entity_name, gnu_type, NULL, true, + debug_info_p, gnat_entity); + + /* Now save it and build the enclosing record type. */ gnu_field_type = gnu_type; gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "JM"); TYPE_PACKED (gnu_type) = 1; + TYPE_SIZE (gnu_type) = TYPE_SIZE (gnu_field_type); + TYPE_SIZE_UNIT (gnu_type) = TYPE_SIZE_UNIT (gnu_field_type); + SET_TYPE_ADA_SIZE (gnu_type, TYPE_RM_SIZE (gnu_field_type)); ! /* Propagate the alignment of the modular type to the record type, ! unless there is an alignment clause that under-aligns the type. ! This means that bit-packed arrays are given "ceil" alignment for ! their size by default, which may seem counter-intuitive but makes ! it possible to overlay them on modular types easily. */ ! TYPE_ALIGN (gnu_type) ! = align > 0 ? align : TYPE_ALIGN (gnu_field_type); ! relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY); ! ! /* Don't declare the field as addressable since we won't be taking ! its address and this would prevent create_field_decl from making ! a bitfield. */ ! gnu_field ! = create_field_decl (get_identifier ("OBJECT"), gnu_field_type, ! gnu_type, NULL_TREE, bitsize_zero_node, 1, 0); /* Do not emit debug info until after the parallel type is added. */ ! finish_record_type (gnu_type, gnu_field, 2, false); ! compute_record_mode (gnu_type); TYPE_JUSTIFIED_MODULAR_P (gnu_type) = 1; if (debug_info_p) { /* Make the original array type a parallel type. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1654,1698 **** /* If the type we are dealing with has got a smaller alignment than the natural one, we need to wrap it up in a record type and under-align the latter. We reuse the padding machinery for this purpose. */ ! else if (Present (Alignment_Clause (gnat_entity)) ! && UI_Is_In_Int_Range (Alignment (gnat_entity)) ! && (align = UI_To_Int (Alignment (gnat_entity)) * BITS_PER_UNIT) ! && align < TYPE_ALIGN (gnu_type)) { tree gnu_field_type, gnu_field; /* Set the RM size before wrapping up the type. */ SET_TYPE_RM_SIZE (gnu_type, UI_To_gnu (RM_Size (gnat_entity), bitsizetype)); gnu_field_type = gnu_type; gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "PAD"); - - TYPE_ALIGN (gnu_type) = align; TYPE_PACKED (gnu_type) = 1; ! /* Create a stripped-down declaration of the original type, mainly ! for debugging. */ ! create_type_decl (gnu_entity_name, gnu_field_type, NULL, true, ! debug_info_p, gnat_entity); ! ! /* Don't notify the field as "addressable", since we won't be taking ! it's address and it would prevent create_field_decl from making a ! bitfield. */ ! gnu_field = create_field_decl (get_identifier ("OBJECT"), ! gnu_field_type, gnu_type, 1, 0, 0, 0); ! finish_record_type (gnu_type, gnu_field, 0, debug_info_p); TYPE_PADDING_P (gnu_type) = 1; - - relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY); } - /* Otherwise reset the alignment lest we computed it above. */ - else - align = 0; - break; case E_Floating_Point_Type: --- 1761,1802 ---- /* If the type we are dealing with has got a smaller alignment than the natural one, we need to wrap it up in a record type and under-align the latter. We reuse the padding machinery for this purpose. */ ! else if (align > 0) { tree gnu_field_type, gnu_field; /* Set the RM size before wrapping up the type. */ SET_TYPE_RM_SIZE (gnu_type, UI_To_gnu (RM_Size (gnat_entity), bitsizetype)); + + /* Create a stripped-down declaration, mainly for debugging. */ + create_type_decl (gnu_entity_name, gnu_type, NULL, true, + debug_info_p, gnat_entity); + + /* Now save it and build the enclosing record type. */ gnu_field_type = gnu_type; gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "PAD"); TYPE_PACKED (gnu_type) = 1; + TYPE_SIZE (gnu_type) = TYPE_SIZE (gnu_field_type); + TYPE_SIZE_UNIT (gnu_type) = TYPE_SIZE_UNIT (gnu_field_type); + SET_TYPE_ADA_SIZE (gnu_type, TYPE_RM_SIZE (gnu_field_type)); + TYPE_ALIGN (gnu_type) = align; + relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY); ! /* Don't declare the field as addressable since we won't be taking ! its address and this would prevent create_field_decl from making ! a bitfield. */ ! gnu_field ! = create_field_decl (get_identifier ("F"), gnu_field_type, ! gnu_type, NULL_TREE, bitsize_zero_node, 1, 0); ! finish_record_type (gnu_type, gnu_field, 2, debug_info_p); ! compute_record_mode (gnu_type); TYPE_PADDING_P (gnu_type) = 1; } break; case E_Floating_Point_Type: *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1795,1802 **** tree gnu_template_reference; tree gnu_ptr_template = build_pointer_type (gnu_template_type); tree gnu_fat_type = make_node (RECORD_TYPE); ! tree *gnu_index_types = (tree *) alloca (ndim * sizeof (tree)); ! tree *gnu_temp_fields = (tree *) alloca (ndim * sizeof (tree)); tree gnu_max_size = size_one_node, gnu_max_size_unit, tem; int index; --- 1899,1906 ---- tree gnu_template_reference; tree gnu_ptr_template = build_pointer_type (gnu_template_type); tree gnu_fat_type = make_node (RECORD_TYPE); ! tree *gnu_index_types = XALLOCAVEC (tree, ndim); ! tree *gnu_temp_fields = XALLOCAVEC (tree, ndim); tree gnu_max_size = size_one_node, gnu_max_size_unit, tem; int index; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1816,1845 **** /* Build the fat pointer type. Use a "void *" object instead of a pointer to the array type since we don't have the array type yet (it will reference the fat pointer via the bounds). */ ! tem = chainon (chainon (NULL_TREE, ! create_field_decl (get_identifier ("P_ARRAY"), ! ptr_void_type_node, ! gnu_fat_type, 0, ! NULL_TREE, NULL_TREE, 0)), ! create_field_decl (get_identifier ("P_BOUNDS"), ! gnu_ptr_template, ! gnu_fat_type, 0, ! NULL_TREE, NULL_TREE, 0)); ! ! /* Make sure we can put this into a register. */ ! TYPE_ALIGN (gnu_fat_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE); ! ! /* Do not emit debug info for this record type since the types of its ! fields are still incomplete at this point. */ ! finish_record_type (gnu_fat_type, tem, 0, false); ! TYPE_FAT_POINTER_P (gnu_fat_type) = 1; /* Build a reference to the template from a PLACEHOLDER_EXPR that is the fat pointer. This will be used to access the individual fields once we build them. */ tem = build3 (COMPONENT_REF, gnu_ptr_template, build0 (PLACEHOLDER_EXPR, gnu_fat_type), ! TREE_CHAIN (TYPE_FIELDS (gnu_fat_type)), NULL_TREE); gnu_template_reference = build_unary_op (INDIRECT_REF, gnu_template_type, tem); TREE_READONLY (gnu_template_reference) = 1; --- 1920,1939 ---- /* Build the fat pointer type. Use a "void *" object instead of a pointer to the array type since we don't have the array type yet (it will reference the fat pointer via the bounds). */ ! tem ! = create_field_decl (get_identifier ("P_ARRAY"), ptr_void_type_node, ! gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0); ! TREE_CHAIN (tem) ! = create_field_decl (get_identifier ("P_BOUNDS"), gnu_ptr_template, ! gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0); ! finish_fat_pointer_type (gnu_fat_type, tem); /* Build a reference to the template from a PLACEHOLDER_EXPR that is the fat pointer. This will be used to access the individual fields once we build them. */ tem = build3 (COMPONENT_REF, gnu_ptr_template, build0 (PLACEHOLDER_EXPR, gnu_fat_type), ! DECL_CHAIN (TYPE_FIELDS (gnu_fat_type)), NULL_TREE); gnu_template_reference = build_unary_op (INDIRECT_REF, gnu_template_type, tem); TREE_READONLY (gnu_template_reference) = 1; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1855,1909 **** char field_name[16]; tree gnu_index_base_type = get_unpadded_type (Base_Type (Etype (gnat_index))); ! tree gnu_low_field, gnu_high_field, gnu_low, gnu_high, gnu_max; /* Make the FIELD_DECLs for the low and high bounds of this type and then make extractions of these fields from the template. */ sprintf (field_name, "LB%d", index); ! gnu_low_field = create_field_decl (get_identifier (field_name), ! gnu_index_base_type, ! gnu_template_type, 0, ! NULL_TREE, NULL_TREE, 0); Sloc_to_locus (Sloc (gnat_entity), ! &DECL_SOURCE_LOCATION (gnu_low_field)); field_name[0] = 'U'; ! gnu_high_field = create_field_decl (get_identifier (field_name), ! gnu_index_base_type, ! gnu_template_type, 0, ! NULL_TREE, NULL_TREE, 0); Sloc_to_locus (Sloc (gnat_entity), ! &DECL_SOURCE_LOCATION (gnu_high_field)); ! gnu_temp_fields[index] = chainon (gnu_low_field, gnu_high_field); /* We can't use build_component_ref here since the template type isn't complete yet. */ ! gnu_low = build3 (COMPONENT_REF, gnu_index_base_type, ! gnu_template_reference, gnu_low_field, ! NULL_TREE); ! gnu_high = build3 (COMPONENT_REF, gnu_index_base_type, ! gnu_template_reference, gnu_high_field, ! NULL_TREE); ! TREE_READONLY (gnu_low) = TREE_READONLY (gnu_high) = 1; ! /* Compute the size of this dimension. */ ! gnu_max ! = build3 (COND_EXPR, gnu_index_base_type, ! build2 (GE_EXPR, integer_type_node, gnu_high, gnu_low), ! gnu_high, ! build2 (MINUS_EXPR, gnu_index_base_type, ! gnu_low, fold_convert (gnu_index_base_type, ! integer_one_node))); /* Make a range type with the new range in the Ada base type. Then make an index type with the size range in sizetype. */ gnu_index_types[index] ! = create_index_type (convert (sizetype, gnu_low), ! convert (sizetype, gnu_max), create_range_type (gnu_index_base_type, ! gnu_low, gnu_high), gnat_entity); /* Update the maximum size of the array in elements. */ --- 1949,2007 ---- char field_name[16]; tree gnu_index_base_type = get_unpadded_type (Base_Type (Etype (gnat_index))); ! tree gnu_lb_field, gnu_hb_field, gnu_orig_min, gnu_orig_max; ! tree gnu_min, gnu_max, gnu_high; /* Make the FIELD_DECLs for the low and high bounds of this type and then make extractions of these fields from the template. */ sprintf (field_name, "LB%d", index); ! gnu_lb_field = create_field_decl (get_identifier (field_name), ! gnu_index_base_type, ! gnu_template_type, NULL_TREE, ! NULL_TREE, 0, 0); Sloc_to_locus (Sloc (gnat_entity), ! &DECL_SOURCE_LOCATION (gnu_lb_field)); field_name[0] = 'U'; ! gnu_hb_field = create_field_decl (get_identifier (field_name), ! gnu_index_base_type, ! gnu_template_type, NULL_TREE, ! NULL_TREE, 0, 0); Sloc_to_locus (Sloc (gnat_entity), ! &DECL_SOURCE_LOCATION (gnu_hb_field)); ! gnu_temp_fields[index] = chainon (gnu_lb_field, gnu_hb_field); /* We can't use build_component_ref here since the template type isn't complete yet. */ ! gnu_orig_min = build3 (COMPONENT_REF, gnu_index_base_type, ! gnu_template_reference, gnu_lb_field, ! NULL_TREE); ! gnu_orig_max = build3 (COMPONENT_REF, gnu_index_base_type, ! gnu_template_reference, gnu_hb_field, ! NULL_TREE); ! TREE_READONLY (gnu_orig_min) = TREE_READONLY (gnu_orig_max) = 1; ! gnu_min = convert (sizetype, gnu_orig_min); ! gnu_max = convert (sizetype, gnu_orig_max); ! ! /* Compute the size of this dimension. See the E_Array_Subtype ! case below for the rationale. */ ! gnu_high ! = build3 (COND_EXPR, sizetype, ! build2 (GE_EXPR, boolean_type_node, ! gnu_orig_max, gnu_orig_min), ! gnu_max, ! size_binop (MINUS_EXPR, gnu_min, size_one_node)); /* Make a range type with the new range in the Ada base type. Then make an index type with the size range in sizetype. */ gnu_index_types[index] ! = create_index_type (gnu_min, gnu_high, create_range_type (gnu_index_base_type, ! gnu_orig_min, ! gnu_orig_max), gnat_entity); /* Update the maximum size of the array in elements. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1944,1950 **** /* Now make the array of arrays and update the pointer to the array in the fat pointer. Note that it is the first field. */ ! tem = gnat_to_gnu_component_type (gnat_entity, definition, debug_info_p); /* If Component_Size is not already specified, annotate it with the --- 2042,2048 ---- /* Now make the array of arrays and update the pointer to the array in the fat pointer. Note that it is the first field. */ ! tem = gnat_to_gnu_component_type (gnat_entity, definition, debug_info_p); /* If Component_Size is not already specified, annotate it with the *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1967,1973 **** /* Now build the array type. */ for (index = ndim - 1; index >= 0; index--) { ! tem = build_array_type (tem, gnu_index_types[index]); TYPE_MULTI_ARRAY_P (tem) = (index > 0); if (array_type_has_nonaliased_component (tem, gnat_entity)) TYPE_NONALIASED_COMPONENT (tem) = 1; --- 2065,2071 ---- /* Now build the array type. */ for (index = ndim - 1; index >= 0; index--) { ! tem = build_nonshared_array_type (tem, gnu_index_types[index]); TYPE_MULTI_ARRAY_P (tem) = (index > 0); if (array_type_has_nonaliased_component (tem, gnat_entity)) TYPE_NONALIASED_COMPONENT (tem) = 1; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 1998,2004 **** SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_type); /* If the maximum size doesn't overflow, use it. */ ! if (gnu_max_size && TREE_CODE (gnu_max_size) == INTEGER_CST && !TREE_OVERFLOW (gnu_max_size) && TREE_CODE (gnu_max_size_unit) == INTEGER_CST --- 2096,2102 ---- SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_type); /* If the maximum size doesn't overflow, use it. */ ! if (gnu_max_size && TREE_CODE (gnu_max_size) == INTEGER_CST && !TREE_OVERFLOW (gnu_max_size) && TREE_CODE (gnu_max_size_unit) == INTEGER_CST *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2024,2034 **** gnu_fat_type, NULL, true, debug_info_p, gnat_entity); ! /* Create the type to be used as what a thin pointer designates: an ! record type for the object and its template with the field offsets ! shifted to have the template at a negative offset. */ tem = build_unc_object_type (gnu_template_type, tem, ! create_concat_name (gnat_name, "XUT")); shift_unc_components_for_thin_pointers (tem); SET_TYPE_UNCONSTRAINED_ARRAY (tem, gnu_type); --- 2122,2133 ---- gnu_fat_type, NULL, true, debug_info_p, gnat_entity); ! /* Create the type to be used as what a thin pointer designates: ! a record type for the object and its template with the fields ! shifted to have the template at a negative offset. */ tem = build_unc_object_type (gnu_template_type, tem, ! create_concat_name (gnat_name, "XUT"), ! debug_info_p); shift_unc_components_for_thin_pointers (tem); SET_TYPE_UNCONSTRAINED_ARRAY (tem, gnu_type); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2061,2067 **** = (Convention (gnat_entity) == Convention_Fortran); const int ndim = Number_Dimensions (gnat_entity); tree gnu_base_type = gnu_type; ! tree *gnu_index_types = (tree *) alloca (ndim * sizeof (tree)); tree gnu_max_size = size_one_node, gnu_max_size_unit; bool need_index_type_struct = false; int index; --- 2160,2166 ---- = (Convention (gnat_entity) == Convention_Fortran); const int ndim = Number_Dimensions (gnat_entity); tree gnu_base_type = gnu_type; ! tree *gnu_index_types = XALLOCAVEC (tree, ndim); tree gnu_max_size = size_one_node, gnu_max_size_unit; bool need_index_type_struct = false; int index; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2078,2091 **** gnat_base_index = Next_Index (gnat_base_index)) { tree gnu_index_type = get_unpadded_type (Etype (gnat_index)); - const int prec_comp - = compare_tree_int (TYPE_RM_SIZE (gnu_index_type), - TYPE_PRECISION (sizetype)); - const bool subrange_p = (prec_comp < 0) - || (prec_comp == 0 - && TYPE_UNSIGNED (gnu_index_type) - == TYPE_UNSIGNED (sizetype)); - const bool wider_p = (prec_comp > 0); tree gnu_orig_min = TYPE_MIN_VALUE (gnu_index_type); tree gnu_orig_max = TYPE_MAX_VALUE (gnu_index_type); tree gnu_min = convert (sizetype, gnu_orig_min); --- 2177,2182 ---- *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2094,2100 **** = get_unpadded_type (Etype (gnat_base_index)); tree gnu_base_orig_min = TYPE_MIN_VALUE (gnu_base_index_type); tree gnu_base_orig_max = TYPE_MAX_VALUE (gnu_base_index_type); ! tree gnu_high, gnu_low; /* See if the base array type is already flat. If it is, we are probably compiling an ACATS test but it will cause the --- 2185,2191 ---- = get_unpadded_type (Etype (gnat_base_index)); tree gnu_base_orig_min = TYPE_MIN_VALUE (gnu_base_index_type); tree gnu_base_orig_max = TYPE_MAX_VALUE (gnu_base_index_type); ! tree gnu_high; /* See if the base array type is already flat. If it is, we are probably compiling an ACATS test but it will cause the *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2110,2117 **** /* Similarly, if one of the values overflows in sizetype and the range is null, use 1..0 for the sizetype bounds. */ ! else if (!subrange_p ! && TREE_CODE (gnu_min) == INTEGER_CST && TREE_CODE (gnu_max) == INTEGER_CST && (TREE_OVERFLOW (gnu_min) || TREE_OVERFLOW (gnu_max)) && tree_int_cst_lt (gnu_orig_max, gnu_orig_min)) --- 2201,2207 ---- /* Similarly, if one of the values overflows in sizetype and the range is null, use 1..0 for the sizetype bounds. */ ! else if (TREE_CODE (gnu_min) == INTEGER_CST && TREE_CODE (gnu_max) == INTEGER_CST && (TREE_OVERFLOW (gnu_min) || TREE_OVERFLOW (gnu_max)) && tree_int_cst_lt (gnu_orig_max, gnu_orig_min)) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2124,2131 **** /* If the minimum and maximum values both overflow in sizetype, but the difference in the original type does not overflow in sizetype, ignore the overflow indication. */ ! else if (!subrange_p ! && TREE_CODE (gnu_min) == INTEGER_CST && TREE_CODE (gnu_max) == INTEGER_CST && TREE_OVERFLOW (gnu_min) && TREE_OVERFLOW (gnu_max) && !TREE_OVERFLOW --- 2214,2220 ---- /* If the minimum and maximum values both overflow in sizetype, but the difference in the original type does not overflow in sizetype, ignore the overflow indication. */ ! else if (TREE_CODE (gnu_min) == INTEGER_CST && TREE_CODE (gnu_max) == INTEGER_CST && TREE_OVERFLOW (gnu_min) && TREE_OVERFLOW (gnu_max) && !TREE_OVERFLOW *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2144,2200 **** deal with the "superflat" case. There are three ways to do this. If we can prove that the array can never be superflat, we can just use the high bound of the index type. */ ! else if (Nkind (gnat_index) == N_Range ! && cannot_be_superflat_p (gnat_index)) gnu_high = gnu_max; ! /* Otherwise, if we can prove that the low bound minus one and ! the high bound cannot overflow, we can just use the expression ! MAX (hb, lb - 1). Similarly, if we can prove that the high ! bound plus one and the low bound cannot overflow, we can use ! the high bound as-is and MIN (hb + 1, lb) for the low bound. ! Otherwise, we have to fall back to the most general expression ! (hb >= lb) ? hb : lb - 1. Note that the comparison must be ! done in the original index type, to avoid any overflow during ! the conversion. */ ! else { ! gnu_high = size_binop (MINUS_EXPR, gnu_min, size_one_node); ! gnu_low = size_binop (PLUS_EXPR, gnu_max, size_one_node); ! ! /* If gnu_high is a constant that has overflowed, the low ! bound is the smallest integer so cannot be the maximum. ! If gnu_low is a constant that has overflowed, the high ! bound is the highest integer so cannot be the minimum. */ ! if ((TREE_CODE (gnu_high) == INTEGER_CST ! && TREE_OVERFLOW (gnu_high)) ! || (TREE_CODE (gnu_low) == INTEGER_CST ! && TREE_OVERFLOW (gnu_low))) ! gnu_high = gnu_max; ! ! /* If the index type is a subrange and gnu_high a constant ! that hasn't overflowed, we can use the maximum. */ ! else if (subrange_p && TREE_CODE (gnu_high) == INTEGER_CST) ! gnu_high = size_binop (MAX_EXPR, gnu_max, gnu_high); ! ! /* If the index type is a subrange and gnu_low a constant ! that hasn't overflowed, we can use the minimum. */ ! else if (subrange_p && TREE_CODE (gnu_low) == INTEGER_CST) ! { ! gnu_high = gnu_max; ! gnu_min = size_binop (MIN_EXPR, gnu_min, gnu_low); ! } ! ! else ! gnu_high ! = build_cond_expr (sizetype, ! build_binary_op (GE_EXPR, ! integer_type_node, ! gnu_orig_max, ! gnu_orig_min), ! gnu_max, gnu_high); } gnu_index_types[index] = create_index_type (gnu_min, gnu_high, gnu_index_type, gnat_entity); --- 2233,2281 ---- deal with the "superflat" case. There are three ways to do this. If we can prove that the array can never be superflat, we can just use the high bound of the index type. */ ! else if ((Nkind (gnat_index) == N_Range ! && cannot_be_superflat_p (gnat_index)) ! /* Packed Array Types are never superflat. */ ! || Is_Packed_Array_Type (gnat_entity)) gnu_high = gnu_max; ! /* Otherwise, if the high bound is constant but the low bound is ! not, we use the expression (hb >= lb) ? lb : hb + 1 for the ! lower bound. Note that the comparison must be done in the ! original type to avoid any overflow during the conversion. */ ! else if (TREE_CODE (gnu_max) == INTEGER_CST ! && TREE_CODE (gnu_min) != INTEGER_CST) { ! gnu_high = gnu_max; ! gnu_min ! = build_cond_expr (sizetype, ! build_binary_op (GE_EXPR, ! boolean_type_node, ! gnu_orig_max, ! gnu_orig_min), ! gnu_min, ! size_binop (PLUS_EXPR, gnu_max, ! size_one_node)); } + /* Finally we use (hb >= lb) ? hb : lb - 1 for the upper bound + in all the other cases. Note that, here as well as above, + the condition used in the comparison must be equivalent to + the condition (length != 0). This is relied upon in order + to optimize array comparisons in compare_arrays. */ + else + gnu_high + = build_cond_expr (sizetype, + build_binary_op (GE_EXPR, + boolean_type_node, + gnu_orig_max, + gnu_orig_min), + gnu_max, + size_binop (MINUS_EXPR, gnu_min, + size_one_node)); + + /* Reuse the index type for the range type. Then make an index + type with the size range in sizetype. */ gnu_index_types[index] = create_index_type (gnu_min, gnu_high, gnu_index_type, gnat_entity); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2264,2270 **** && TREE_CODE (TREE_TYPE (gnu_index_type)) != INTEGER_TYPE) || TYPE_BIASED_REPRESENTATION_P (gnu_index_type) ! || wider_p) need_index_type_struct = true; } --- 2345,2352 ---- && TREE_CODE (TREE_TYPE (gnu_index_type)) != INTEGER_TYPE) || TYPE_BIASED_REPRESENTATION_P (gnu_index_type) ! || compare_tree_int (rm_size (gnu_index_type), ! TYPE_PRECISION (sizetype)) > 0) need_index_type_struct = true; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2316,2322 **** /* Now build the array type. */ for (index = ndim - 1; index >= 0; index --) { ! gnu_type = build_array_type (gnu_type, gnu_index_types[index]); TYPE_MULTI_ARRAY_P (gnu_type) = (index > 0); if (array_type_has_nonaliased_component (gnu_type, gnat_entity)) TYPE_NONALIASED_COMPONENT (gnu_type) = 1; --- 2398,2405 ---- /* Now build the array type. */ for (index = ndim - 1; index >= 0; index --) { ! gnu_type = build_nonshared_array_type (gnu_type, ! gnu_index_types[index]); TYPE_MULTI_ARRAY_P (gnu_type) = (index > 0); if (array_type_has_nonaliased_component (gnu_type, gnat_entity)) TYPE_NONALIASED_COMPONENT (gnu_type) = 1; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2331,2365 **** inner dimensions. */ if (global_bindings_p () && ndim > 1) { ! tree gnu_str_name = get_identifier ("ST"); tree gnu_arr_type; for (gnu_arr_type = TREE_TYPE (gnu_type); TREE_CODE (gnu_arr_type) == ARRAY_TYPE; gnu_arr_type = TREE_TYPE (gnu_arr_type), ! gnu_str_name = concat_name (gnu_str_name, "ST")) { tree eltype = TREE_TYPE (gnu_arr_type); TYPE_SIZE (gnu_arr_type) = elaborate_expression_1 (TYPE_SIZE (gnu_arr_type), ! gnat_entity, gnu_str_name, definition, false); /* ??? For now, store the size as a multiple of the alignment of the element type in bytes so that we can see the alignment from the tree. */ TYPE_SIZE_UNIT (gnu_arr_type) ! = build_binary_op ! (MULT_EXPR, sizetype, ! elaborate_expression_1 ! (build_binary_op (EXACT_DIV_EXPR, sizetype, ! TYPE_SIZE_UNIT (gnu_arr_type), ! size_int (TYPE_ALIGN (eltype) ! / BITS_PER_UNIT)), ! gnat_entity, concat_name (gnu_str_name, "A_U"), ! definition, false), ! size_int (TYPE_ALIGN (eltype) / BITS_PER_UNIT)); /* ??? create_type_decl is not invoked on the inner types so the MULT_EXPR node built above will never be marked. */ --- 2414,2443 ---- inner dimensions. */ if (global_bindings_p () && ndim > 1) { ! tree gnu_st_name = get_identifier ("ST"); tree gnu_arr_type; for (gnu_arr_type = TREE_TYPE (gnu_type); TREE_CODE (gnu_arr_type) == ARRAY_TYPE; gnu_arr_type = TREE_TYPE (gnu_arr_type), ! gnu_st_name = concat_name (gnu_st_name, "ST")) { tree eltype = TREE_TYPE (gnu_arr_type); TYPE_SIZE (gnu_arr_type) = elaborate_expression_1 (TYPE_SIZE (gnu_arr_type), ! gnat_entity, gnu_st_name, definition, false); /* ??? For now, store the size as a multiple of the alignment of the element type in bytes so that we can see the alignment from the tree. */ TYPE_SIZE_UNIT (gnu_arr_type) ! = elaborate_expression_2 (TYPE_SIZE_UNIT (gnu_arr_type), ! gnat_entity, ! concat_name (gnu_st_name, "A_U"), ! definition, false, ! TYPE_ALIGN (eltype)); /* ??? create_type_decl is not invoked on the inner types so the MULT_EXPR node built above will never be marked. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2393,2401 **** /* Make sure to reference the types themselves, and not just their names, as the debugger may fall back on them. */ gnu_field = create_field_decl (gnu_index_name, gnu_index, ! gnu_bound_rec, ! 0, NULL_TREE, NULL_TREE, 0); ! TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; } --- 2471,2479 ---- /* Make sure to reference the types themselves, and not just their names, as the debugger may fall back on them. */ gnu_field = create_field_decl (gnu_index_name, gnu_index, ! gnu_bound_rec, NULL_TREE, ! NULL_TREE, 0, 0); ! DECL_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2567,2574 **** gnat_entity); gnu_type ! = build_array_type (gnat_to_gnu_type (Component_Type (gnat_entity)), ! gnu_index_type); if (array_type_has_nonaliased_component (gnu_type, gnat_entity)) TYPE_NONALIASED_COMPONENT (gnu_type) = 1; relate_alias_sets (gnu_type, gnu_string_type, ALIAS_SET_COPY); --- 2645,2653 ---- gnat_entity); gnu_type ! = build_nonshared_array_type (gnat_to_gnu_type ! (Component_Type (gnat_entity)), ! gnu_index_type); if (array_type_has_nonaliased_component (gnu_type, gnat_entity)) TYPE_NONALIASED_COMPONENT (gnu_type) = 1; relate_alias_sets (gnu_type, gnu_string_type, ALIAS_SET_COPY); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2825,2837 **** /* ...and reference the _Parent field of this record. */ gnu_field ! = create_field_decl (get_identifier ! (Get_Name_String (Name_uParent)), ! gnu_parent, gnu_type, 0, has_rep ? TYPE_SIZE (gnu_parent) : NULL_TREE, has_rep ! ? bitsize_zero_node : NULL_TREE, 1); DECL_INTERNAL_P (gnu_field) = 1; TREE_OPERAND (gnu_get_parent, 1) = gnu_field; TYPE_FIELDS (gnu_type) = gnu_field; --- 2904,2916 ---- /* ...and reference the _Parent field of this record. */ gnu_field ! = create_field_decl (parent_name_id, ! gnu_parent, gnu_type, has_rep ? TYPE_SIZE (gnu_parent) : NULL_TREE, has_rep ! ? bitsize_zero_node : NULL_TREE, ! 0, 1); DECL_INTERNAL_P (gnu_field) = 1; TREE_OPERAND (gnu_get_parent, 1) = gnu_field; TYPE_FIELDS (gnu_type) = gnu_field; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2865,2871 **** if (!is_unchecked_union) { ! TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; } } --- 2944,2950 ---- if (!is_unchecked_union) { ! DECL_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; } } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2876,2885 **** false, all_rep, is_unchecked_union, debug_info_p, false); ! /* If it is a tagged record force the type to BLKmode to insure that ! these objects will always be put in memory. Likewise for limited ! record types. */ ! if (Is_Tagged_Type (gnat_entity) || Is_Limited_Record (gnat_entity)) SET_TYPE_MODE (gnu_type, BLKmode); /* We used to remove the associations of the discriminants and _Parent --- 2955,2963 ---- false, all_rep, is_unchecked_union, debug_info_p, false); ! /* If it is passed by reference, force BLKmode to ensure that objects ! of this type will always be put in memory. */ ! if (Is_By_Reference_Type (gnat_entity)) SET_TYPE_MODE (gnu_type, BLKmode); /* We used to remove the associations of the discriminants and _Parent *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2901,2906 **** --- 2979,2999 ---- && Is_Itype (Etype (gnat_temp)) && !present_gnu_tree (gnat_temp)) gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, 0); + + /* If this is a record type associated with an exception definition, + equate its fields to those of the standard exception type. This + will make it possible to convert between them. */ + if (gnu_entity_name == exception_data_name_id) + { + tree gnu_std_field; + for (gnu_field = TYPE_FIELDS (gnu_type), + gnu_std_field = TYPE_FIELDS (except_type_node); + gnu_field; + gnu_field = DECL_CHAIN (gnu_field), + gnu_std_field = DECL_CHAIN (gnu_std_field)) + SET_DECL_ORIGINAL_FIELD_TO_FIELD (gnu_field, gnu_std_field); + gcc_assert (!gnu_std_field); + } } break; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2956,2961 **** --- 3049,3068 ---- break; } + /* If this is a record subtype associated with a dispatch table, + strip the suffix. This is necessary to make sure 2 different + subtypes associated with the imported and exported views of a + dispatch table are properly merged in LTO mode. */ + if (Is_Dispatch_Table_Entity (gnat_entity)) + { + char *p; + Get_Encoded_Name (gnat_entity); + p = strchr (Name_Buffer, '_'); + gcc_assert (p); + strcpy (p+2, "dtS"); + gnu_entity_name = get_identifier (Name_Buffer); + } + /* When the subtype has discriminants and these discriminants affect the initial shape it has inherited, factor them in. But for an Unchecked_Union (it must be an Itype), just return the type. *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 2970,2981 **** && Present (Discriminant_Constraint (gnat_entity)) && Stored_Constraint (gnat_entity) != No_Elist) { ! tree gnu_subst_list = build_subst_list (gnat_entity, gnat_base_type, definition); tree gnu_unpad_base_type, gnu_rep_part, gnu_variant_part, t; ! tree gnu_variant_list, gnu_pos_list, gnu_field_list = NULL_TREE; bool selected_variant = false; Entity_Id gnat_field; gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = gnu_entity_name; --- 3077,3089 ---- && Present (Discriminant_Constraint (gnat_entity)) && Stored_Constraint (gnat_entity) != No_Elist) { ! VEC(subst_pair,heap) *gnu_subst_list = build_subst_list (gnat_entity, gnat_base_type, definition); tree gnu_unpad_base_type, gnu_rep_part, gnu_variant_part, t; ! tree gnu_pos_list, gnu_field_list = NULL_TREE; bool selected_variant = false; Entity_Id gnat_field; + VEC(variant_desc,heap) *gnu_variant_list; gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = gnu_entity_name; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3003,3017 **** union for the variants that are still relevant. */ if (gnu_variant_part) { gnu_variant_list = build_variant_list (TREE_TYPE (gnu_variant_part), ! gnu_subst_list, NULL_TREE); /* If all the qualifiers are unconditionally true, the innermost variant is statically selected. */ selected_variant = true; ! for (t = gnu_variant_list; t; t = TREE_CHAIN (t)) ! if (!integer_onep (TREE_VEC_ELT (TREE_VALUE (t), 1))) { selected_variant = false; break; --- 3111,3129 ---- union for the variants that are still relevant. */ if (gnu_variant_part) { + variant_desc *v; + unsigned ix; + gnu_variant_list = build_variant_list (TREE_TYPE (gnu_variant_part), ! gnu_subst_list, NULL); /* If all the qualifiers are unconditionally true, the innermost variant is statically selected. */ selected_variant = true; ! FOR_EACH_VEC_ELT_REVERSE (variant_desc, gnu_variant_list, ! ix, v) ! if (!integer_onep (v->qual)) { selected_variant = false; break; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3019,3038 **** /* Otherwise, create the new variants. */ if (!selected_variant) ! for (t = gnu_variant_list; t; t = TREE_CHAIN (t)) { ! tree old_variant = TREE_PURPOSE (t); tree new_variant = make_node (RECORD_TYPE); TYPE_NAME (new_variant) = DECL_NAME (TYPE_NAME (old_variant)); copy_and_substitute_in_size (new_variant, old_variant, gnu_subst_list); ! TREE_VEC_ELT (TREE_VALUE (t), 2) = new_variant; } } else { ! gnu_variant_list = NULL_TREE; selected_variant = false; } --- 3131,3151 ---- /* Otherwise, create the new variants. */ if (!selected_variant) ! FOR_EACH_VEC_ELT_REVERSE (variant_desc, gnu_variant_list, ! ix, v) { ! tree old_variant = v->type; tree new_variant = make_node (RECORD_TYPE); TYPE_NAME (new_variant) = DECL_NAME (TYPE_NAME (old_variant)); copy_and_substitute_in_size (new_variant, old_variant, gnu_subst_list); ! v->record = new_variant; } } else { ! gnu_variant_list = NULL; selected_variant = false; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3115,3127 **** gnu_cont_type = gnu_type; else { ! t = purpose_member (gnu_context, gnu_variant_list); if (t) { if (selected_variant) gnu_cont_type = gnu_type; else ! gnu_cont_type = TREE_VEC_ELT (TREE_VALUE (t), 2); } else /* The front-end may pass us "ghost" components if --- 3228,3250 ---- gnu_cont_type = gnu_type; else { ! variant_desc *v; ! unsigned ix; ! ! t = NULL_TREE; ! FOR_EACH_VEC_ELT_REVERSE (variant_desc, ! gnu_variant_list, ix, v) ! if (v->type == gnu_context) ! { ! t = v->type; ! break; ! } if (t) { if (selected_variant) gnu_cont_type = gnu_type; else ! gnu_cont_type = v->record; } else /* The front-end may pass us "ghost" components if *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3139,3145 **** /* Put it in one of the new variants directly. */ if (gnu_cont_type != gnu_type) { ! TREE_CHAIN (gnu_field) = TYPE_FIELDS (gnu_cont_type); TYPE_FIELDS (gnu_cont_type) = gnu_field; } --- 3262,3268 ---- /* Put it in one of the new variants directly. */ if (gnu_cont_type != gnu_type) { ! DECL_CHAIN (gnu_field) = TYPE_FIELDS (gnu_cont_type); TYPE_FIELDS (gnu_cont_type) = gnu_field; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3163,3169 **** the other fields. */ else { ! TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; if (!gnu_last) gnu_last = gnu_field; --- 3286,3292 ---- the other fields. */ else { ! DECL_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; if (!gnu_last) gnu_last = gnu_field; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3180,3186 **** = create_variant_part_from (gnu_variant_part, gnu_variant_list, gnu_type, gnu_pos_list, gnu_subst_list); ! TREE_CHAIN (new_variant_part) = gnu_field_list; gnu_field_list = new_variant_part; } --- 3303,3309 ---- = create_variant_part_from (gnu_variant_part, gnu_variant_list, gnu_type, gnu_pos_list, gnu_subst_list); ! DECL_CHAIN (new_variant_part) = gnu_field_list; gnu_field_list = new_variant_part; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3200,3207 **** finish_record_type (gnu_type, gnu_field_list, 2, false); /* See the E_Record_Type case for the rationale. */ ! if (Is_Tagged_Type (gnat_entity) ! || Is_Limited_Record (gnat_entity)) SET_TYPE_MODE (gnu_type, BLKmode); else compute_record_mode (gnu_type); --- 3323,3329 ---- finish_record_type (gnu_type, gnu_field_list, 2, false); /* See the E_Record_Type case for the rationale. */ ! if (Is_By_Reference_Type (gnat_entity)) SET_TYPE_MODE (gnu_type, BLKmode); else compute_record_mode (gnu_type); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3230,3237 **** build_reference_type (gnu_unpad_base_type), gnu_subtype_marker, ! 0, NULL_TREE, ! NULL_TREE, 0), 0, true); add_parallel_type (TYPE_STUB_DECL (gnu_type), --- 3352,3359 ---- build_reference_type (gnu_unpad_base_type), gnu_subtype_marker, ! NULL_TREE, NULL_TREE, ! 0, 0), 0, true); add_parallel_type (TYPE_STUB_DECL (gnu_type), *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3240,3250 **** if (definition && TREE_CODE (gnu_size_unit) != INTEGER_CST && !CONTAINS_PLACEHOLDER_P (gnu_size_unit)) ! create_var_decl (create_concat_name (gnat_entity, "XVZ"), ! NULL_TREE, sizetype, gnu_size_unit, false, ! false, false, false, NULL, gnat_entity); } /* Now we can finalize it. */ rest_of_record_type_compilation (gnu_type); } --- 3362,3378 ---- if (definition && TREE_CODE (gnu_size_unit) != INTEGER_CST && !CONTAINS_PLACEHOLDER_P (gnu_size_unit)) ! TYPE_SIZE_UNIT (gnu_subtype_marker) ! = create_var_decl (create_concat_name (gnat_entity, ! "XVZ"), ! NULL_TREE, sizetype, gnu_size_unit, ! false, false, false, false, NULL, ! gnat_entity); } + VEC_free (variant_desc, heap, gnu_variant_list); + VEC_free (subst_pair, heap, gnu_subst_list); + /* Now we can finalize it. */ rest_of_record_type_compilation (gnu_type); } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3321,3333 **** case E_Anonymous_Access_Type: case E_General_Access_Type: { Entity_Id gnat_desig_type = Directly_Designated_Type (gnat_entity); Entity_Id gnat_desig_equiv = Gigi_Equivalent_Type (gnat_desig_type); bool is_from_limited_with = (IN (Ekind (gnat_desig_equiv), Incomplete_Kind) && From_With_Type (gnat_desig_equiv)); ! ! /* Get the "full view" of this entity. If this is an incomplete entity from a limited with, treat its non-limited view as the full view. Otherwise, if this is an incomplete or private type, use the full view. In the former case, we might point to a private type, --- 3449,3462 ---- case E_Anonymous_Access_Type: case E_General_Access_Type: { + /* The designated type and its equivalent type for gigi. */ Entity_Id gnat_desig_type = Directly_Designated_Type (gnat_entity); Entity_Id gnat_desig_equiv = Gigi_Equivalent_Type (gnat_desig_type); + /* Whether it comes from a limited with. */ bool is_from_limited_with = (IN (Ekind (gnat_desig_equiv), Incomplete_Kind) && From_With_Type (gnat_desig_equiv)); ! /* The "full view" of the designated type. If this is an incomplete entity from a limited with, treat its non-limited view as the full view. Otherwise, if this is an incomplete or private type, use the full view. In the former case, we might point to a private type, *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3335,3341 **** actual type used for the representation, so this takes a total of three steps. */ Entity_Id gnat_desig_full_direct_first ! = (is_from_limited_with ? Non_Limited_View (gnat_desig_equiv) : (IN (Ekind (gnat_desig_equiv), Incomplete_Or_Private_Kind) ? Full_View (gnat_desig_equiv) : Empty)); Entity_Id gnat_desig_full_direct --- 3464,3471 ---- actual type used for the representation, so this takes a total of three steps. */ Entity_Id gnat_desig_full_direct_first ! = (is_from_limited_with ! ? Non_Limited_View (gnat_desig_equiv) : (IN (Ekind (gnat_desig_equiv), Incomplete_Or_Private_Kind) ? Full_View (gnat_desig_equiv) : Empty)); Entity_Id gnat_desig_full_direct *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3346,3372 **** : gnat_desig_full_direct_first); Entity_Id gnat_desig_full = Gigi_Equivalent_Type (gnat_desig_full_direct); ! ! /* This the type actually used to represent the designated type, ! either gnat_desig_full or gnat_desig_equiv. */ Entity_Id gnat_desig_rep; - /* True if this is a pointer to an unconstrained array. */ bool is_unconstrained_array; - /* We want to know if we'll be seeing the freeze node for any incomplete type we may be pointing to. */ bool in_main_unit = (Present (gnat_desig_full) ? In_Extended_Main_Code_Unit (gnat_desig_full) : In_Extended_Main_Code_Unit (gnat_desig_type)); - /* True if we make a dummy type here. */ - bool got_fat_p = false; - /* True if the dummy is a fat pointer. */ bool made_dummy = false; ! tree gnu_desig_type = NULL_TREE; enum machine_mode p_mode = mode_for_size (esize, MODE_INT, 0); if (!targetm.valid_pointer_mode (p_mode)) p_mode = ptr_mode; --- 3476,3500 ---- : gnat_desig_full_direct_first); Entity_Id gnat_desig_full = Gigi_Equivalent_Type (gnat_desig_full_direct); ! /* The type actually used to represent the designated type, either ! gnat_desig_full or gnat_desig_equiv. */ Entity_Id gnat_desig_rep; /* True if this is a pointer to an unconstrained array. */ bool is_unconstrained_array; /* We want to know if we'll be seeing the freeze node for any incomplete type we may be pointing to. */ bool in_main_unit = (Present (gnat_desig_full) ? In_Extended_Main_Code_Unit (gnat_desig_full) : In_Extended_Main_Code_Unit (gnat_desig_type)); /* True if we make a dummy type here. */ bool made_dummy = false; ! /* True if the dummy type is a fat pointer. */ ! bool got_fat_p = false; ! /* The mode to be used for the pointer type. */ enum machine_mode p_mode = mode_for_size (esize, MODE_INT, 0); + /* The GCC type used for the designated type. */ + tree gnu_desig_type = NULL_TREE; if (!targetm.valid_pointer_mode (p_mode)) p_mode = ptr_mode; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3379,3400 **** issues. This can lose some code efficiency, but there is no alternative. */ if (Ekind (gnat_desig_equiv) == E_Array_Subtype ! && ! Is_Constrained (gnat_desig_equiv)) gnat_desig_equiv = Etype (gnat_desig_equiv); if (Present (gnat_desig_full) && ((Ekind (gnat_desig_full) == E_Array_Subtype ! && ! Is_Constrained (gnat_desig_full)) || (Ekind (gnat_desig_full) == E_Record_Subtype && Ekind (Etype (gnat_desig_full)) == E_Record_Type))) gnat_desig_full = Etype (gnat_desig_full); ! /* Now set the type that actually marks the representation of ! the designated type and also flag whether we have a unconstrained ! array. */ ! gnat_desig_rep = gnat_desig_full ? gnat_desig_full : gnat_desig_equiv; is_unconstrained_array ! = (Is_Array_Type (gnat_desig_rep) ! && ! Is_Constrained (gnat_desig_rep)); /* If we are pointing to an incomplete type whose completion is an unconstrained array, make a fat pointer type. The two types in our --- 3507,3527 ---- issues. This can lose some code efficiency, but there is no alternative. */ if (Ekind (gnat_desig_equiv) == E_Array_Subtype ! && !Is_Constrained (gnat_desig_equiv)) gnat_desig_equiv = Etype (gnat_desig_equiv); if (Present (gnat_desig_full) && ((Ekind (gnat_desig_full) == E_Array_Subtype ! && !Is_Constrained (gnat_desig_full)) || (Ekind (gnat_desig_full) == E_Record_Subtype && Ekind (Etype (gnat_desig_full)) == E_Record_Type))) gnat_desig_full = Etype (gnat_desig_full); ! /* Set the type that's actually the representation of the designated ! type and also flag whether we have a unconstrained array. */ ! gnat_desig_rep ! = Present (gnat_desig_full) ? gnat_desig_full : gnat_desig_equiv; is_unconstrained_array ! = Is_Array_Type (gnat_desig_rep) && !Is_Constrained (gnat_desig_rep); /* If we are pointing to an incomplete type whose completion is an unconstrained array, make a fat pointer type. The two types in our *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3405,3438 **** if (is_unconstrained_array && (Present (gnat_desig_full) || (present_gnu_tree (gnat_desig_equiv) ! && TYPE_IS_DUMMY_P (TREE_TYPE ! (get_gnu_tree (gnat_desig_equiv)))) ! || (No (gnat_desig_full) && ! in_main_unit && defer_incomplete_level != 0 ! && ! present_gnu_tree (gnat_desig_equiv)) ! || (in_main_unit && is_from_limited_with ! && Present (Freeze_Node (gnat_desig_rep))))) { - tree gnu_old; - if (present_gnu_tree (gnat_desig_rep)) ! gnu_old = TREE_TYPE (get_gnu_tree (gnat_desig_rep)); else { ! gnu_old = make_dummy_type (gnat_desig_rep); ! /* Show the dummy we get will be a fat pointer. */ got_fat_p = made_dummy = true; } ! /* If the call above got something that has a pointer, that ! pointer is our type. This could have happened either ! because the type was elaborated or because somebody ! else executed the code below. */ ! gnu_type = TYPE_POINTER_TO (gnu_old); if (!gnu_type) { ! tree gnu_template_type = make_node (ENUMERAL_TYPE); tree gnu_ptr_template = build_pointer_type (gnu_template_type); tree gnu_array_type = make_node (ENUMERAL_TYPE); tree gnu_ptr_array = build_pointer_type (gnu_array_type); --- 3532,3562 ---- if (is_unconstrained_array && (Present (gnat_desig_full) || (present_gnu_tree (gnat_desig_equiv) ! && TYPE_IS_DUMMY_P ! (TREE_TYPE (get_gnu_tree (gnat_desig_equiv)))) ! || (!in_main_unit && defer_incomplete_level != 0 ! && !present_gnu_tree (gnat_desig_equiv)) ! || (in_main_unit ! && is_from_limited_with ! && Present (Freeze_Node (gnat_desig_equiv))))) { if (present_gnu_tree (gnat_desig_rep)) ! gnu_desig_type = TREE_TYPE (get_gnu_tree (gnat_desig_rep)); else { ! gnu_desig_type = make_dummy_type (gnat_desig_rep); /* Show the dummy we get will be a fat pointer. */ got_fat_p = made_dummy = true; } ! /* If the call above got something that has a pointer, the pointer ! is our type. This could have happened either because the type ! was elaborated or because somebody else executed the code. */ ! gnu_type = TYPE_POINTER_TO (gnu_desig_type); if (!gnu_type) { ! tree gnu_template_type = make_node (RECORD_TYPE); tree gnu_ptr_template = build_pointer_type (gnu_template_type); tree gnu_array_type = make_node (ENUMERAL_TYPE); tree gnu_ptr_array = build_pointer_type (gnu_array_type); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3447,3479 **** TYPE_DUMMY_P (gnu_array_type) = 1; gnu_type = make_node (RECORD_TYPE); ! SET_TYPE_UNCONSTRAINED_ARRAY (gnu_type, gnu_old); ! TYPE_POINTER_TO (gnu_old) = gnu_type; - Sloc_to_locus (Sloc (gnat_entity), &input_location); fields ! = chainon (chainon (NULL_TREE, ! create_field_decl ! (get_identifier ("P_ARRAY"), ! gnu_ptr_array, ! gnu_type, 0, 0, 0, 0)), ! create_field_decl (get_identifier ("P_BOUNDS"), ! gnu_ptr_template, ! gnu_type, 0, 0, 0, 0)); ! ! /* Make sure we can place this into a register. */ ! TYPE_ALIGN (gnu_type) ! = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE); ! TYPE_FAT_POINTER_P (gnu_type) = 1; ! ! /* Do not emit debug info for this record type since the types ! of its fields are incomplete. */ ! finish_record_type (gnu_type, fields, 0, false); ! TYPE_OBJECT_RECORD_TYPE (gnu_old) = make_node (RECORD_TYPE); ! TYPE_NAME (TYPE_OBJECT_RECORD_TYPE (gnu_old)) = create_concat_name (gnat_desig_equiv, "XUT"); ! TYPE_DUMMY_P (TYPE_OBJECT_RECORD_TYPE (gnu_old)) = 1; } } --- 3571,3599 ---- TYPE_DUMMY_P (gnu_array_type) = 1; gnu_type = make_node (RECORD_TYPE); ! /* Build a stub DECL to trigger the special processing for fat ! pointer types in gnat_pushdecl. */ ! TYPE_NAME (gnu_type) ! = create_type_stub_decl ! (create_concat_name (gnat_desig_equiv, "XUP"), gnu_type); ! SET_TYPE_UNCONSTRAINED_ARRAY (gnu_type, gnu_desig_type); ! TYPE_POINTER_TO (gnu_desig_type) = gnu_type; fields ! = create_field_decl (get_identifier ("P_ARRAY"), ! gnu_ptr_array, gnu_type, ! NULL_TREE, NULL_TREE, 0, 0); ! DECL_CHAIN (fields) ! = create_field_decl (get_identifier ("P_BOUNDS"), ! gnu_ptr_template, gnu_type, ! NULL_TREE, NULL_TREE, 0, 0); ! finish_fat_pointer_type (gnu_type, fields); ! TYPE_OBJECT_RECORD_TYPE (gnu_desig_type) ! = make_node (RECORD_TYPE); ! TYPE_NAME (TYPE_OBJECT_RECORD_TYPE (gnu_desig_type)) = create_concat_name (gnat_desig_equiv, "XUT"); ! TYPE_DUMMY_P (TYPE_OBJECT_RECORD_TYPE (gnu_desig_type)) = 1; } } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3482,3516 **** && present_gnu_tree (gnat_desig_full)) gnu_desig_type = TREE_TYPE (get_gnu_tree (gnat_desig_full)); ! /* Get the type of the thing we are to point to and build a pointer ! to it. If it is a reference to an incomplete or private type with a full view that is a record, make a dummy type node and get the actual type later when we have verified it is safe. */ ! else if ((! in_main_unit ! && ! present_gnu_tree (gnat_desig_equiv) && Present (gnat_desig_full) ! && ! present_gnu_tree (gnat_desig_full) && Is_Record_Type (gnat_desig_full)) ! /* Likewise if we are pointing to a record or array and we ! are to defer elaborating incomplete types. We do this ! since this access type may be the full view of some ! private type. Note that the unconstrained array case is ! handled above. */ ! || ((! in_main_unit || imported_p) && defer_incomplete_level != 0 ! && ! present_gnu_tree (gnat_desig_equiv) ! && ((Is_Record_Type (gnat_desig_rep) ! || Is_Array_Type (gnat_desig_rep)))) /* If this is a reference from a limited_with type back to our ! main unit and there's a Freeze_Node for it, either we have already processed the declaration and made the dummy type, in which case we just reuse the latter, or we have not yet, in which case we make the dummy type and it will be reused ! when the declaration is processed. In both cases, the ! pointer eventually created below will be automatically ! adjusted when the Freeze_Node is processed. Note that the unconstrained array case is handled above. */ ! || (in_main_unit && is_from_limited_with && Present (Freeze_Node (gnat_desig_rep)))) { gnu_desig_type = make_dummy_type (gnat_desig_equiv); --- 3602,3636 ---- && present_gnu_tree (gnat_desig_full)) gnu_desig_type = TREE_TYPE (get_gnu_tree (gnat_desig_full)); ! /* Get the type of the thing we are to point to and build a pointer to ! it. If it is a reference to an incomplete or private type with a full view that is a record, make a dummy type node and get the actual type later when we have verified it is safe. */ ! else if ((!in_main_unit ! && !present_gnu_tree (gnat_desig_equiv) && Present (gnat_desig_full) ! && !present_gnu_tree (gnat_desig_full) && Is_Record_Type (gnat_desig_full)) ! /* Likewise if we are pointing to a record or array and we are ! to defer elaborating incomplete types. We do this as this ! access type may be the full view of a private type. Note ! that the unconstrained array case is handled above. */ ! || ((!in_main_unit || imported_p) && defer_incomplete_level != 0 ! && !present_gnu_tree (gnat_desig_equiv) ! && (Is_Record_Type (gnat_desig_rep) ! || Is_Array_Type (gnat_desig_rep))) /* If this is a reference from a limited_with type back to our ! main unit and there's a freeze node for it, either we have already processed the declaration and made the dummy type, in which case we just reuse the latter, or we have not yet, in which case we make the dummy type and it will be reused ! when the declaration is finally processed. In both cases, ! the pointer eventually created below will be automatically ! adjusted when the freeze node is processed. Note that the unconstrained array case is handled above. */ ! || (in_main_unit ! && is_from_limited_with && Present (Freeze_Node (gnat_desig_rep)))) { gnu_desig_type = make_dummy_type (gnat_desig_equiv); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3526,3538 **** TREE_TYPE (gnu_type) = TYPE_POINTER_TO (gnu_type) = gnu_type; } ! /* If expansion is disabled, the equivalent type of a concurrent ! type is absent, so build a dummy pointer type. */ else if (type_annotate_only && No (gnat_desig_equiv)) gnu_type = ptr_void_type_node; ! /* Finally, handle the straightforward case where we can just ! elaborate our designated type and point to it. */ else gnu_desig_type = gnat_to_gnu_type (gnat_desig_equiv); --- 3646,3658 ---- TREE_TYPE (gnu_type) = TYPE_POINTER_TO (gnu_type) = gnu_type; } ! /* If expansion is disabled, the equivalent type of a concurrent type ! is absent, so build a dummy pointer type. */ else if (type_annotate_only && No (gnat_desig_equiv)) gnu_type = ptr_void_type_node; ! /* Finally, handle the default case where we can just elaborate our ! designated type. */ else gnu_desig_type = gnat_to_gnu_type (gnat_desig_equiv); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3544,3554 **** break; } ! /* If we have a GCC type for the designated type, possibly modify it ! if we are pointing only to constant objects and then make a pointer ! to it. Don't do this for unconstrained arrays. */ ! if (!gnu_type && gnu_desig_type) { if (Is_Access_Constant (gnat_entity) && TREE_CODE (gnu_desig_type) != UNCONSTRAINED_ARRAY_TYPE) { --- 3664,3674 ---- break; } ! /* If we have not done it yet, build the pointer type the usual way. */ ! if (!gnu_type) { + /* Modify the designated type if we are pointing only to constant + objects, but don't do it for unconstrained arrays. */ if (Is_Access_Constant (gnat_entity) && TREE_CODE (gnu_desig_type) != UNCONSTRAINED_ARRAY_TYPE) { *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3587,3603 **** No_Strict_Aliasing (gnat_entity)); } ! /* If we are not defining this object and we made a dummy pointer, save our current definition, evaluate the actual type, and replace the tentative type we made with the actual one. If we are to defer ! actually looking up the actual type, make an entry in the ! deferred list. If this is from a limited with, we have to defer ! to the end of the current spec in two cases: first if the ! designated type is in the current unit and second if the access ! type is. */ ! if ((! in_main_unit || is_from_limited_with) && made_dummy) { ! tree gnu_old_type = TYPE_IS_FAT_POINTER_P (gnu_type) ? TYPE_UNCONSTRAINED_ARRAY (gnu_type) : TREE_TYPE (gnu_type); --- 3707,3726 ---- No_Strict_Aliasing (gnat_entity)); } ! /* If we are not defining this object and we have made a dummy pointer, save our current definition, evaluate the actual type, and replace the tentative type we made with the actual one. If we are to defer ! actually looking up the actual type, make an entry in the deferred ! list. If this is from a limited with, we have to defer to the end ! of the current spec in two cases: first if the designated type is ! in the current unit and second if the access type itself is. */ ! if ((!in_main_unit || is_from_limited_with) && made_dummy) { ! bool is_from_limited_with_in_main_unit ! = (is_from_limited_with ! && (in_main_unit ! || In_Extended_Main_Code_Unit (gnat_entity))); ! tree gnu_old_desig_type = TYPE_IS_FAT_POINTER_P (gnu_type) ? TYPE_UNCONSTRAINED_ARRAY (gnu_type) : TREE_TYPE (gnu_type); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3616,3652 **** save_gnu_tree (gnat_entity, gnu_decl, false); saved = true; ! if (defer_incomplete_level == 0 ! && ! (is_from_limited_with ! && (in_main_unit ! || In_Extended_Main_Code_Unit (gnat_entity)))) ! update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_type), ! gnat_to_gnu_type (gnat_desig_equiv)); ! ! /* Note that the call to gnat_to_gnu_type here might have ! updated gnu_old_type directly, in which case it is not a ! dummy type any more when we get into update_pointer_to. ! This may happen for instance when the designated type is a ! record type, because their elaboration starts with an ! initial node from make_dummy_type, which may yield the same ! node as the one we got. ! Besides, variants of this non-dummy type might have been ! created along the way. update_pointer_to is expected to ! properly take care of those situations. */ else { ! struct incomplete *p ! = (struct incomplete *) xmalloc (sizeof ! (struct incomplete)); struct incomplete **head ! = (is_from_limited_with ! && (in_main_unit ! || In_Extended_Main_Code_Unit (gnat_entity)) ? &defer_limited_with : &defer_incomplete_list); ! ! p->old_type = gnu_old_type; p->full_type = gnat_desig_equiv; p->next = *head; *head = p; --- 3739,3766 ---- save_gnu_tree (gnat_entity, gnu_decl, false); saved = true; ! /* Note that the call to gnat_to_gnu_type on gnat_desig_equiv might ! update gnu_old_desig_type directly, in which case it will not be ! a dummy type any more when we get into update_pointer_to. ! This can happen e.g. when the designated type is a record type, ! because their elaboration starts with an initial node from ! make_dummy_type, which may be the same node as the one we got. ! Besides, variants of this non-dummy type might have been created ! along the way. update_pointer_to is expected to properly take ! care of those situations. */ ! if (defer_incomplete_level == 0 ! && !is_from_limited_with_in_main_unit) ! update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type), ! gnat_to_gnu_type (gnat_desig_equiv)); else { ! struct incomplete *p = XNEW (struct incomplete); struct incomplete **head ! = (is_from_limited_with_in_main_unit ? &defer_limited_with : &defer_incomplete_list); ! p->old_type = gnu_old_desig_type; p->full_type = gnat_desig_equiv; p->next = *head; *head = p; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3661,3667 **** gnu_type = ptr_void_type_node; else { ! /* The runtime representation is the equivalent type. */ gnu_type = gnat_to_gnu_type (gnat_equiv_type); maybe_present = true; } --- 3775,3781 ---- gnu_type = ptr_void_type_node; else { ! /* The run-time representation is the equivalent type. */ gnu_type = gnat_to_gnu_type (gnat_equiv_type); maybe_present = true; } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3723,3731 **** /* Subprogram Entities ! The following access functions are defined for subprograms (functions ! or procedures): First_Formal The first formal parameter. Is_Imported Indicates that the subprogram has appeared in an INTERFACE or IMPORT pragma. For now we --- 3837,3845 ---- /* Subprogram Entities ! The following access functions are defined for subprograms: + Etype Return type or Standard_Void_Type. First_Formal The first formal parameter. Is_Imported Indicates that the subprogram has appeared in an INTERFACE or IMPORT pragma. For now we *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3733,3742 **** Is_Exported Likewise but for an EXPORT pragma. Is_Inlined True if the subprogram is to be inlined. - In addition for function subprograms we have: - - Etype Return type of the function. - Each parameter is first checked by calling must_pass_by_ref on its type to determine if it is passed by reference. For parameters which are copied in, if they are Ada In Out or Out parameters, their return --- 3847,3852 ---- *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3769,3795 **** case E_Function: case E_Procedure: { /* The first GCC parameter declaration (a PARM_DECL node). The PARM_DECL nodes are chained through the TREE_CHAIN field, so this actually is the head of this parameter list. */ tree gnu_param_list = NULL_TREE; /* Likewise for the stub associated with an exported procedure. */ tree gnu_stub_param_list = NULL_TREE; - /* The type returned by a function. If the subprogram is a procedure - this type should be void_type_node. */ - tree gnu_return_type = void_type_node; - /* List of fields in return type of procedure with copy-in copy-out - parameters. */ - tree gnu_field_list = NULL_TREE; /* Non-null for subprograms containing parameters passed by copy-in copy-out (Ada In Out or Out parameters not passed by reference), ! in which case it is the list of nodes used to specify the values of ! the in out/out parameters that are returned as a record upon procedure return. The TREE_PURPOSE of an element of this list is a field of the record and the TREE_VALUE is the PARM_DECL corresponding to that field. This list will be saved in the TYPE_CI_CO_LIST field of the FUNCTION_TYPE node we create. */ ! tree gnu_return_list = NULL_TREE; /* If an import pragma asks to map this subprogram to a GCC builtin, this is the builtin DECL node. */ tree gnu_builtin_decl = NULL_TREE; --- 3879,3906 ---- case E_Function: case E_Procedure: { + /* The type returned by a function or else Standard_Void_Type for a + procedure. */ + Entity_Id gnat_return_type = Etype (gnat_entity); + tree gnu_return_type; /* The first GCC parameter declaration (a PARM_DECL node). The PARM_DECL nodes are chained through the TREE_CHAIN field, so this actually is the head of this parameter list. */ tree gnu_param_list = NULL_TREE; /* Likewise for the stub associated with an exported procedure. */ tree gnu_stub_param_list = NULL_TREE; /* Non-null for subprograms containing parameters passed by copy-in copy-out (Ada In Out or Out parameters not passed by reference), ! in which case it is the list of nodes used to specify the values ! of the In Out/Out parameters that are returned as a record upon procedure return. The TREE_PURPOSE of an element of this list is a field of the record and the TREE_VALUE is the PARM_DECL corresponding to that field. This list will be saved in the TYPE_CI_CO_LIST field of the FUNCTION_TYPE node we create. */ ! tree gnu_cico_list = NULL_TREE; ! /* List of fields in return type of procedure with copy-in copy-out ! parameters. */ ! tree gnu_field_list = NULL_TREE; /* If an import pragma asks to map this subprogram to a GCC builtin, this is the builtin DECL node. */ tree gnu_builtin_decl = NULL_TREE; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3801,3807 **** bool public_flag = Is_Public (gnat_entity) || imported_p; bool extern_flag = (Is_Public (gnat_entity) && !definition) || imported_p; - /* The semantics of "pure" in Ada essentially matches that of "const" in the back-end. In particular, both properties are orthogonal to the "nothrow" property if the EH circuitry is explicit in the --- 3912,3917 ---- *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3813,3824 **** bool const_flag = (Exception_Mechanism == Back_End_Exceptions && Is_Pure (gnat_entity)); - bool volatile_flag = No_Return (gnat_entity); ! bool returns_by_ref = false; ! bool returns_unconstrained = false; ! bool returns_by_target_ptr = false; ! bool has_copy_in_out = false; bool has_stub = false; int parmnum; --- 3923,3932 ---- bool const_flag = (Exception_Mechanism == Back_End_Exceptions && Is_Pure (gnat_entity)); bool volatile_flag = No_Return (gnat_entity); ! bool return_by_direct_ref_p = false; ! bool return_by_invisi_ref_p = false; ! bool return_unconstrained_p = false; bool has_stub = false; int parmnum; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3839,3846 **** if (Ekind (Alias (gnat_entity)) == E_Enumeration_Literal) gnat_to_gnu_entity (Etype (Alias (gnat_entity)), NULL_TREE, 0); ! gnu_decl = gnat_to_gnu_entity (Alias (gnat_entity), ! gnu_expr, 0); /* Elaborate any Itypes in the parameters of this entity. */ for (gnat_temp = First_Formal_With_Extras (gnat_entity); --- 3947,3953 ---- if (Ekind (Alias (gnat_entity)) == E_Enumeration_Literal) gnat_to_gnu_entity (Etype (Alias (gnat_entity)), NULL_TREE, 0); ! gnu_decl = gnat_to_gnu_entity (Alias (gnat_entity), gnu_expr, 0); /* Elaborate any Itypes in the parameters of this entity. */ for (gnat_temp = First_Formal_With_Extras (gnat_entity); *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 3853,3963 **** } /* If this subprogram is expectedly bound to a GCC builtin, fetch the ! corresponding DECL node. ! We still want the parameter associations to take place because the ! proper generation of calls depends on it (a GNAT parameter without ! a corresponding GCC tree has a very specific meaning), so we don't ! just break here. */ ! if (Convention (gnat_entity) == Convention_Intrinsic) ! gnu_builtin_decl = builtin_decl_for (gnu_ext_name); /* ??? What if we don't find the builtin node above ? warn ? err ? In the current state we neither warn nor err, and calls will just be handled as for regular subprograms. */ ! if (kind == E_Function || kind == E_Subprogram_Type) ! gnu_return_type = gnat_to_gnu_type (Etype (gnat_entity)); ! ! /* If this function returns by reference, make the actual ! return type of this function the pointer and mark the decl. */ ! if (Returns_By_Ref (gnat_entity)) { ! returns_by_ref = true; ! gnu_return_type = build_pointer_type (gnu_return_type); ! } ! /* If the Mechanism is By_Reference, ensure the return type uses ! the machine's by-reference mechanism, which may not the same ! as above (e.g., it might be by passing a fake parameter). */ ! else if (kind == E_Function ! && Mechanism (gnat_entity) == By_Reference) ! { ! TREE_ADDRESSABLE (gnu_return_type) = 1; ! /* We expect this bit to be reset by gigi shortly, so can avoid a ! type node copy here. This actually also prevents troubles with ! the generation of debug information for the function, because ! we might have issued such info for this type already, and would ! be attaching a distinct type node to the function if we made a ! copy here. */ ! } ! /* If we are supposed to return an unconstrained array, ! actually return a fat pointer and make a note of that. Return ! a pointer to an unconstrained record of variable size. */ ! else if (TREE_CODE (gnu_return_type) == UNCONSTRAINED_ARRAY_TYPE) ! { ! gnu_return_type = TREE_TYPE (gnu_return_type); ! returns_unconstrained = true; ! } ! /* If the type requires a transient scope, the result is allocated ! on the secondary stack, so the result type of the function is ! just a pointer. */ ! else if (Requires_Transient_Scope (Etype (gnat_entity))) ! { ! gnu_return_type = build_pointer_type (gnu_return_type); ! returns_unconstrained = true; ! } ! /* If the type is a padded type and the underlying type would not ! be passed by reference or this function has a foreign convention, ! return the underlying type. */ ! else if (TYPE_IS_PADDING_P (gnu_return_type) ! && (!default_pass_by_ref (TREE_TYPE ! (TYPE_FIELDS (gnu_return_type))) ! || Has_Foreign_Convention (gnat_entity))) ! gnu_return_type = TREE_TYPE (TYPE_FIELDS (gnu_return_type)); ! /* If the return type has a non-constant size, we convert the function ! into a procedure and its caller will pass a pointer to an object as ! the first parameter when we call the function. This can happen for ! an unconstrained type with a maximum size or a constrained type with ! a size not known at compile time. */ ! if (TYPE_SIZE_UNIT (gnu_return_type) ! && !TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_return_type))) ! { ! returns_by_target_ptr = true; ! gnu_param_list ! = create_param_decl (get_identifier ("TARGET"), ! build_reference_type (gnu_return_type), ! true); ! gnu_return_type = void_type_node; ! } ! /* If the return type has a size that overflows, we cannot have ! a function that returns that type. This usage doesn't make ! sense anyway, so give an error here. */ ! if (TYPE_SIZE_UNIT (gnu_return_type) ! && TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_return_type)) ! && TREE_OVERFLOW (TYPE_SIZE_UNIT (gnu_return_type))) ! { ! post_error ("cannot return type whose size overflows", ! gnat_entity); ! gnu_return_type = copy_node (gnu_return_type); ! TYPE_SIZE (gnu_return_type) = bitsize_zero_node; ! TYPE_SIZE_UNIT (gnu_return_type) = size_zero_node; ! TYPE_MAIN_VARIANT (gnu_return_type) = gnu_return_type; ! TYPE_NEXT_VARIANT (gnu_return_type) = NULL_TREE; ! } ! /* Look at all our parameters and get the type of ! each. While doing this, build a copy-out structure if ! we need one. */ ! /* Loop over the parameters and get their associated GCC tree. ! While doing this, build a copy-out structure if we need one. */ for (gnat_param = First_Formal_With_Extras (gnat_entity), parmnum = 0; Present (gnat_param); gnat_param = Next_Formal_With_Extras (gnat_param), parmnum++) --- 3960,4073 ---- } /* If this subprogram is expectedly bound to a GCC builtin, fetch the ! corresponding DECL node. Proper generation of calls later on need ! proper parameter associations so we don't "break;" here. */ ! if (Convention (gnat_entity) == Convention_Intrinsic ! && Present (Interface_Name (gnat_entity))) ! { ! gnu_builtin_decl = builtin_decl_for (gnu_ext_name); ! /* Inability to find the builtin decl most often indicates a ! genuine mistake, but imports of unregistered intrinsics are ! sometimes issued on purpose to allow hooking in alternate ! bodies. We post a warning conditioned on Wshadow in this case, ! to let developers be notified on demand without risking false ! positives with common default sets of options. */ ! ! if (gnu_builtin_decl == NULL_TREE && warn_shadow) ! post_error ("?gcc intrinsic not found for&!", gnat_entity); ! } /* ??? What if we don't find the builtin node above ? warn ? err ? In the current state we neither warn nor err, and calls will just be handled as for regular subprograms. */ ! /* Look into the return type and get its associated GCC tree. If it ! is not void, compute various flags for the subprogram type. */ ! if (Ekind (gnat_return_type) == E_Void) ! gnu_return_type = void_type_node; ! else { ! gnu_return_type = gnat_to_gnu_type (gnat_return_type); ! /* If this function returns by reference, make the actual return ! type the pointer type and make a note of that. */ ! if (Returns_By_Ref (gnat_entity)) ! { ! gnu_return_type = build_pointer_type (gnu_return_type); ! return_by_direct_ref_p = true; ! } ! /* If we are supposed to return an unconstrained array type, make ! the actual return type the fat pointer type. */ ! else if (TREE_CODE (gnu_return_type) == UNCONSTRAINED_ARRAY_TYPE) ! { ! gnu_return_type = TREE_TYPE (gnu_return_type); ! return_unconstrained_p = true; ! } ! /* Likewise, if the return type requires a transient scope, the ! return value will be allocated on the secondary stack so the ! actual return type is the pointer type. */ ! else if (Requires_Transient_Scope (gnat_return_type)) ! { ! gnu_return_type = build_pointer_type (gnu_return_type); ! return_unconstrained_p = true; ! } ! /* If the Mechanism is By_Reference, ensure this function uses the ! target's by-invisible-reference mechanism, which may not be the ! same as above (e.g. it might be passing an extra parameter). */ ! else if (kind == E_Function ! && Mechanism (gnat_entity) == By_Reference) ! return_by_invisi_ref_p = true; ! /* Likewise, if the return type is itself By_Reference. */ ! else if (TREE_ADDRESSABLE (gnu_return_type)) ! return_by_invisi_ref_p = true; ! /* If the type is a padded type and the underlying type would not ! be passed by reference or the function has a foreign convention, ! return the underlying type. */ ! else if (TYPE_IS_PADDING_P (gnu_return_type) ! && (!default_pass_by_ref ! (TREE_TYPE (TYPE_FIELDS (gnu_return_type))) ! || Has_Foreign_Convention (gnat_entity))) ! gnu_return_type = TREE_TYPE (TYPE_FIELDS (gnu_return_type)); ! /* If the return type is unconstrained, that means it must have a ! maximum size. Use the padded type as the effective return type. ! And ensure the function uses the target's by-invisible-reference ! mechanism to avoid copying too much data when it returns. */ ! if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_return_type))) ! { ! gnu_return_type ! = maybe_pad_type (gnu_return_type, ! max_size (TYPE_SIZE (gnu_return_type), ! true), ! 0, gnat_entity, false, false, false, true); ! return_by_invisi_ref_p = true; ! } ! /* If the return type has a size that overflows, we cannot have ! a function that returns that type. This usage doesn't make ! sense anyway, so give an error here. */ ! if (TYPE_SIZE_UNIT (gnu_return_type) ! && TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_return_type)) ! && TREE_OVERFLOW (TYPE_SIZE_UNIT (gnu_return_type))) ! { ! post_error ("cannot return type whose size overflows", ! gnat_entity); ! gnu_return_type = copy_node (gnu_return_type); ! TYPE_SIZE (gnu_return_type) = bitsize_zero_node; ! TYPE_SIZE_UNIT (gnu_return_type) = size_zero_node; ! TYPE_MAIN_VARIANT (gnu_return_type) = gnu_return_type; ! TYPE_NEXT_VARIANT (gnu_return_type) = NULL_TREE; ! } ! } ! /* Loop over the parameters and get their associated GCC tree. While ! doing this, build a copy-in copy-out structure if we need one. */ for (gnat_param = First_Formal_With_Extras (gnat_entity), parmnum = 0; Present (gnat_param); gnat_param = Next_Formal_With_Extras (gnat_param), parmnum++) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4019,4024 **** --- 4129,4139 ---- gnu_param = NULL_TREE; } + /* The failure of this assertion will very likely come from an + order of elaboration issue for the type of the parameter. */ + gcc_assert (kind == E_Subprogram_Type + || !TYPE_IS_DUMMY_P (gnu_param_type)); + if (gnu_param) { /* If it's an exported subprogram, we build a parameter list *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4058,4079 **** if (copy_in_copy_out) { ! if (!has_copy_in_out) { ! gcc_assert (TREE_CODE (gnu_return_type) == VOID_TYPE); ! gnu_return_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_return_type) = get_identifier ("RETURN"); ! has_copy_in_out = true; } ! gnu_field = create_field_decl (gnu_param_name, gnu_param_type, ! gnu_return_type, 0, 0, 0, 0); Sloc_to_locus (Sloc (gnat_param), &DECL_SOURCE_LOCATION (gnu_field)); ! TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; ! gnu_return_list = tree_cons (gnu_field, gnu_param, ! gnu_return_list); } } --- 4173,4215 ---- if (copy_in_copy_out) { ! if (!gnu_cico_list) { ! tree gnu_new_ret_type = make_node (RECORD_TYPE); ! ! /* If this is a function, we also need a field for the ! return value to be placed. */ ! if (TREE_CODE (gnu_return_type) != VOID_TYPE) ! { ! gnu_field ! = create_field_decl (get_identifier ("RETVAL"), ! gnu_return_type, ! gnu_new_ret_type, NULL_TREE, ! NULL_TREE, 0, 0); ! Sloc_to_locus (Sloc (gnat_entity), ! &DECL_SOURCE_LOCATION (gnu_field)); ! gnu_field_list = gnu_field; ! gnu_cico_list ! = tree_cons (gnu_field, void_type_node, NULL_TREE); ! } ! ! gnu_return_type = gnu_new_ret_type; TYPE_NAME (gnu_return_type) = get_identifier ("RETURN"); ! /* Set a default alignment to speed up accesses. */ ! TYPE_ALIGN (gnu_return_type) ! = get_mode_alignment (ptr_mode); } ! gnu_field ! = create_field_decl (gnu_param_name, gnu_param_type, ! gnu_return_type, NULL_TREE, NULL_TREE, ! 0, 0); Sloc_to_locus (Sloc (gnat_param), &DECL_SOURCE_LOCATION (gnu_field)); ! DECL_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; ! gnu_cico_list ! = tree_cons (gnu_field, gnu_param, gnu_cico_list); } } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4086,4093 **** /* If we have a CICO list but it has only one entry, we convert this function into a function that simply returns that one object. */ ! if (list_length (gnu_return_list) == 1) ! gnu_return_type = TREE_TYPE (TREE_PURPOSE (gnu_return_list)); if (Has_Stdcall_Convention (gnat_entity)) prepend_one_attribute_to --- 4222,4229 ---- /* If we have a CICO list but it has only one entry, we convert this function into a function that simply returns that one object. */ ! if (list_length (gnu_cico_list) == 1) ! gnu_return_type = TREE_TYPE (TREE_PURPOSE (gnu_cico_list)); if (Has_Stdcall_Convention (gnat_entity)) prepend_one_attribute_to *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4095,4107 **** get_identifier ("stdcall"), NULL_TREE, gnat_entity); ! /* If we are on a target where stack realignment is needed for 'main' ! to honor GCC's implicit expectations (stack alignment greater than ! what the base ABI guarantees), ensure we do the same for foreign ! convention subprograms as they might be used as callbacks from code ! breaking such expectations. Note that this applies to task entry ! points in particular. */ ! if (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN && Has_Foreign_Convention (gnat_entity)) prepend_one_attribute_to (&attr_list, ATTR_MACHINE_ATTRIBUTE, --- 4231,4240 ---- get_identifier ("stdcall"), NULL_TREE, gnat_entity); ! /* If we should request stack realignment for a foreign convention ! subprogram, do so. Note that this applies to task entry points in ! particular. */ ! if (FOREIGN_FORCE_REALIGN_STACK && Has_Foreign_Convention (gnat_entity)) prepend_one_attribute_to (&attr_list, ATTR_MACHINE_ATTRIBUTE, *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4112,4133 **** gnu_param_list = nreverse (gnu_param_list); if (has_stub) gnu_stub_param_list = nreverse (gnu_stub_param_list); ! gnu_return_list = nreverse (gnu_return_list); ! if (Ekind (gnat_entity) == E_Function) ! Set_Mechanism (gnat_entity, ! (returns_by_ref || returns_unconstrained ! ? By_Reference : By_Copy)); gnu_type = create_subprog_type (gnu_return_type, gnu_param_list, ! gnu_return_list, returns_unconstrained, ! 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, returns_by_target_ptr); /* A subprogram (something that doesn't return anything) shouldn't be considered const since there would be no reason for such a --- 4245,4269 ---- gnu_param_list = nreverse (gnu_param_list); if (has_stub) gnu_stub_param_list = nreverse (gnu_stub_param_list); ! gnu_cico_list = nreverse (gnu_cico_list); ! if (kind == E_Function) ! Set_Mechanism (gnat_entity, return_unconstrained_p ! || return_by_direct_ref_p ! || return_by_invisi_ref_p ! ? By_Reference : By_Copy); gnu_type = create_subprog_type (gnu_return_type, gnu_param_list, ! gnu_cico_list, return_unconstrained_p, ! return_by_direct_ref_p, ! return_by_invisi_ref_p); if (has_stub) gnu_stub_type = create_subprog_type (gnu_return_type, gnu_stub_param_list, ! gnu_cico_list, return_unconstrained_p, ! return_by_direct_ref_p, ! return_by_invisi_ref_p); /* A subprogram (something that doesn't return anything) shouldn't be considered const since there would be no reason for such a *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4142,4149 **** | (TYPE_QUAL_CONST * const_flag) | (TYPE_QUAL_VOLATILE * volatile_flag)); - Sloc_to_locus (Sloc (gnat_entity), &input_location); - if (has_stub) gnu_stub_type = build_qualified_type (gnu_stub_type, --- 4278,4283 ---- *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4151,4171 **** | (TYPE_QUAL_CONST * const_flag) | (TYPE_QUAL_VOLATILE * volatile_flag)); ! /* If we have a builtin decl for that function, check the signatures ! compatibilities. If the signatures are compatible, use the builtin ! decl. If they are not, we expect the checker predicate to have ! posted the appropriate errors, and just continue with what we have ! so far. */ if (gnu_builtin_decl) { ! tree gnu_builtin_type = TREE_TYPE (gnu_builtin_decl); ! if (compatible_signatures_p (gnu_type, gnu_builtin_type)) ! { ! gnu_decl = gnu_builtin_decl; ! gnu_type = gnu_builtin_type; ! break; ! } } /* If there was no specified Interface_Name and the external and --- 4285,4309 ---- | (TYPE_QUAL_CONST * const_flag) | (TYPE_QUAL_VOLATILE * volatile_flag)); ! /* If we have a builtin decl for that function, use it. Check if the ! profiles are compatible and warn if they are not. The checker is ! expected to post extra diagnostics in this case. */ if (gnu_builtin_decl) { ! intrin_binding_t inb; ! inb.gnat_entity = gnat_entity; ! inb.ada_fntype = gnu_type; ! inb.btin_fntype = TREE_TYPE (gnu_builtin_decl); ! ! if (!intrin_profiles_compatible_p (&inb)) ! post_error ! ("?profile of& doesn''t match the builtin it binds!", ! gnat_entity); ! ! gnu_decl = gnu_builtin_decl; ! gnu_type = TREE_TYPE (gnu_builtin_decl); ! break; } /* If there was no specified Interface_Name and the external and *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4259,4266 **** full view, whichever is present. This is used in all the tests below. */ Entity_Id full_view ! = (IN (Ekind (gnat_entity), Incomplete_Kind) ! && From_With_Type (gnat_entity)) ? Non_Limited_View (gnat_entity) : Present (Full_View (gnat_entity)) ? Full_View (gnat_entity) --- 4397,4403 ---- full view, whichever is present. This is used in all the tests below. */ Entity_Id full_view ! = (IN (kind, Incomplete_Kind) && From_With_Type (gnat_entity)) ? Non_Limited_View (gnat_entity) : Present (Full_View (gnat_entity)) ? Full_View (gnat_entity) *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4315,4323 **** break; } - /* Simple class_wide types are always viewed as their root_type - by Gigi unless an Equivalent_Type is specified. */ case E_Class_Wide_Type: gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, 0); maybe_present = true; break; --- 4452,4459 ---- break; } case E_Class_Wide_Type: + /* Class-wide types are always transformed into their root type. */ gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, 0); maybe_present = true; break; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4326,4336 **** case E_Task_Subtype: case E_Protected_Type: case E_Protected_Subtype: if (type_annotate_only && No (gnat_equiv_type)) gnu_type = void_type_node; else ! gnu_type = gnat_to_gnu_type (gnat_equiv_type); ! maybe_present = true; break; --- 4462,4472 ---- case E_Task_Subtype: case E_Protected_Type: case E_Protected_Subtype: + /* Concurrent types are always transformed into their record type. */ if (type_annotate_only && No (gnat_equiv_type)) gnu_type = void_type_node; else ! gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, 0); maybe_present = true; break; *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4363,4374 **** handling alignment and possible padding. */ if (is_type && (!gnu_decl || this_made_decl)) { if (Is_Tagged_Type (gnat_entity) || Is_Class_Wide_Equivalent_Type (gnat_entity)) TYPE_ALIGN_OK (gnu_type) = 1; ! if (AGGREGATE_TYPE_P (gnu_type) && Is_By_Reference_Type (gnat_entity)) ! TYPE_BY_REFERENCE_P (gnu_type) = 1; /* ??? Don't set the size for a String_Literal since it is either confirming or we don't handle it properly (if the low bound is --- 4499,4516 ---- handling alignment and possible padding. */ if (is_type && (!gnu_decl || this_made_decl)) { + /* Tell the middle-end that objects of tagged types are guaranteed to + be properly aligned. This is necessary because conversions to the + class-wide type are translated into conversions to the root type, + which can be less aligned than some of its derived types. */ if (Is_Tagged_Type (gnat_entity) || Is_Class_Wide_Equivalent_Type (gnat_entity)) TYPE_ALIGN_OK (gnu_type) = 1; ! /* If the type is passed by reference, objects of this type must be ! fully addressable and cannot be copied. */ ! if (Is_By_Reference_Type (gnat_entity)) ! TREE_ADDRESSABLE (gnu_type) = 1; /* ??? Don't set the size for a String_Literal since it is either confirming or we don't handle it properly (if the low bound is *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4465,4509 **** && !TREE_CONSTANT (TYPE_SIZE (gnu_type)) && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) { ! if (TREE_CODE (gnu_type) == RECORD_TYPE ! && operand_equal_p (TYPE_ADA_SIZE (gnu_type), ! TYPE_SIZE (gnu_type), 0)) ! { ! TYPE_SIZE (gnu_type) ! = elaborate_expression_1 (TYPE_SIZE (gnu_type), ! gnat_entity, get_identifier ("SIZE"), ! definition, false); ! SET_TYPE_ADA_SIZE (gnu_type, TYPE_SIZE (gnu_type)); ! } ! else { ! TYPE_SIZE (gnu_type) ! = elaborate_expression_1 (TYPE_SIZE (gnu_type), ! gnat_entity, get_identifier ("SIZE"), ! definition, false); ! /* ??? For now, store the size as a multiple of the alignment ! in bytes so that we can see the alignment from the tree. */ ! TYPE_SIZE_UNIT (gnu_type) ! = build_binary_op ! (MULT_EXPR, sizetype, ! elaborate_expression_1 ! (build_binary_op (EXACT_DIV_EXPR, sizetype, ! TYPE_SIZE_UNIT (gnu_type), ! size_int (TYPE_ALIGN (gnu_type) ! / BITS_PER_UNIT)), ! gnat_entity, get_identifier ("SIZE_A_UNIT"), ! definition, false), ! size_int (TYPE_ALIGN (gnu_type) / BITS_PER_UNIT)); ! if (TREE_CODE (gnu_type) == RECORD_TYPE) ! SET_TYPE_ADA_SIZE ! (gnu_type, ! elaborate_expression_1 (TYPE_ADA_SIZE (gnu_type), ! gnat_entity, ! get_identifier ("RM_SIZE"), ! definition, false)); ! } } /* If this is a record type or subtype, call elaborate_expression_1 on --- 4607,4698 ---- && !TREE_CONSTANT (TYPE_SIZE (gnu_type)) && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) { ! tree size = TYPE_SIZE (gnu_type); ! ! TYPE_SIZE (gnu_type) ! = elaborate_expression_1 (size, gnat_entity, ! get_identifier ("SIZE"), ! definition, false); ! ! /* ??? For now, store the size as a multiple of the alignment in ! bytes so that we can see the alignment from the tree. */ ! TYPE_SIZE_UNIT (gnu_type) ! = elaborate_expression_2 (TYPE_SIZE_UNIT (gnu_type), gnat_entity, ! get_identifier ("SIZE_A_UNIT"), ! definition, false, ! TYPE_ALIGN (gnu_type)); ! ! /* ??? gnu_type may come from an existing type so the MULT_EXPR node ! may not be marked by the call to create_type_decl below. */ ! MARK_VISITED (TYPE_SIZE_UNIT (gnu_type)); ! ! if (TREE_CODE (gnu_type) == RECORD_TYPE) { ! tree variant_part = get_variant_part (gnu_type); ! tree ada_size = TYPE_ADA_SIZE (gnu_type); ! if (variant_part) ! { ! tree union_type = TREE_TYPE (variant_part); ! tree offset = DECL_FIELD_OFFSET (variant_part); ! /* If the position of the variant part is constant, subtract ! it from the size of the type of the parent to get the new ! size. This manual CSE reduces the data size. */ ! if (TREE_CODE (offset) == INTEGER_CST) ! { ! tree bitpos = DECL_FIELD_BIT_OFFSET (variant_part); ! TYPE_SIZE (union_type) ! = size_binop (MINUS_EXPR, TYPE_SIZE (gnu_type), ! bit_from_pos (offset, bitpos)); ! TYPE_SIZE_UNIT (union_type) ! = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (gnu_type), ! byte_from_pos (offset, bitpos)); ! } ! else ! { ! TYPE_SIZE (union_type) ! = elaborate_expression_1 (TYPE_SIZE (union_type), ! gnat_entity, ! get_identifier ("VSIZE"), ! definition, false); ! ! /* ??? For now, store the size as a multiple of the ! alignment in bytes so that we can see the alignment ! from the tree. */ ! TYPE_SIZE_UNIT (union_type) ! = elaborate_expression_2 (TYPE_SIZE_UNIT (union_type), ! gnat_entity, ! get_identifier ! ("VSIZE_A_UNIT"), ! definition, false, ! TYPE_ALIGN (union_type)); ! ! /* ??? For now, store the offset as a multiple of the ! alignment in bytes so that we can see the alignment ! from the tree. */ ! DECL_FIELD_OFFSET (variant_part) ! = elaborate_expression_2 (offset, ! gnat_entity, ! get_identifier ("VOFFSET"), ! definition, false, ! DECL_OFFSET_ALIGN ! (variant_part)); ! } ! ! DECL_SIZE (variant_part) = TYPE_SIZE (union_type); ! DECL_SIZE_UNIT (variant_part) = TYPE_SIZE_UNIT (union_type); ! } ! ! if (operand_equal_p (ada_size, size, 0)) ! ada_size = TYPE_SIZE (gnu_type); ! else ! ada_size ! = elaborate_expression_1 (ada_size, gnat_entity, ! get_identifier ("RM_SIZE"), ! definition, false); ! SET_TYPE_ADA_SIZE (gnu_type, ada_size); ! } } /* If this is a record type or subtype, call elaborate_expression_1 on *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4517,4546 **** { tree gnu_field = get_gnu_tree (gnat_temp); ! /* ??? Unfortunately, GCC needs to be able to prove the ! alignment of this offset and if it's a variable, it can't. ! In GCC 3.4, we'll use DECL_OFFSET_ALIGN in some way, but ! right now, we have to put in an explicit multiply and ! divide by that value. */ if (!CONTAINS_PLACEHOLDER_P (DECL_FIELD_OFFSET (gnu_field))) { ! DECL_FIELD_OFFSET (gnu_field) ! = build_binary_op ! (MULT_EXPR, sizetype, ! elaborate_expression_1 ! (build_binary_op (EXACT_DIV_EXPR, sizetype, ! DECL_FIELD_OFFSET (gnu_field), ! size_int (DECL_OFFSET_ALIGN (gnu_field) ! / BITS_PER_UNIT)), ! gnat_temp, get_identifier ("OFFSET"), ! definition, false), ! size_int (DECL_OFFSET_ALIGN (gnu_field) / BITS_PER_UNIT)); ! /* ??? The context of gnu_field is not necessarily gnu_type so ! the MULT_EXPR node built above may not be marked by the call ! to create_type_decl below. */ ! if (global_bindings_p ()) ! MARK_VISITED (DECL_FIELD_OFFSET (gnu_field)); } } --- 4706,4727 ---- { tree gnu_field = get_gnu_tree (gnat_temp); ! /* ??? For now, store the offset as a multiple of the alignment ! in bytes so that we can see the alignment from the tree. */ if (!CONTAINS_PLACEHOLDER_P (DECL_FIELD_OFFSET (gnu_field))) { ! DECL_FIELD_OFFSET (gnu_field) ! = elaborate_expression_2 (DECL_FIELD_OFFSET (gnu_field), ! gnat_temp, ! get_identifier ("OFFSET"), ! definition, false, ! DECL_OFFSET_ALIGN (gnu_field)); ! /* ??? The context of gnu_field is not necessarily gnu_type ! so the MULT_EXPR node built above may not be marked by ! the call to create_type_decl below. */ ! if (global_bindings_p ()) ! MARK_VISITED (DECL_FIELD_OFFSET (gnu_field)); } } *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4672,4722 **** if (Unknown_Esize (gnat_entity) && TYPE_SIZE (gnu_type)) { - /* If the size is self-referential, we annotate the maximum - value of that size. */ tree gnu_size = TYPE_SIZE (gnu_type); if (CONTAINS_PLACEHOLDER_P (gnu_size)) gnu_size = max_size (gnu_size, true); - Set_Esize (gnat_entity, annotate_value (gnu_size)); - if (type_annotate_only && Is_Tagged_Type (gnat_entity)) { ! /* In this mode the tag and the parent components are not ! generated by the front-end, so the sizes must be adjusted ! explicitly now. */ ! int size_offset, new_size; if (Is_Derived_Type (gnat_entity)) { ! size_offset ! = UI_To_Int (Esize (Etype (Base_Type (gnat_entity)))); Set_Alignment (gnat_entity, Alignment (Etype (Base_Type (gnat_entity)))); } else ! size_offset = POINTER_SIZE; ! new_size = UI_To_Int (Esize (gnat_entity)) + size_offset; ! Set_Esize (gnat_entity, ! UI_From_Int (((new_size + (POINTER_SIZE - 1)) ! / POINTER_SIZE) * POINTER_SIZE)); ! Set_RM_Size (gnat_entity, Esize (gnat_entity)); } } if (Unknown_RM_Size (gnat_entity) && rm_size (gnu_type)) Set_RM_Size (gnat_entity, annotate_value (rm_size (gnu_type))); } ! if (!Comes_From_Source (gnat_entity) && DECL_P (gnu_decl)) ! DECL_ARTIFICIAL (gnu_decl) = 1; ! if (!debug_info_p && DECL_P (gnu_decl) ! && TREE_CODE (gnu_decl) != FUNCTION_DECL ! && No (Renamed_Object (gnat_entity))) ! DECL_IGNORED_P (gnu_decl) = 1; /* If we haven't already, associate the ..._DECL node that we just made with the input GNAT entity node. */ --- 4853,4909 ---- if (Unknown_Esize (gnat_entity) && TYPE_SIZE (gnu_type)) { tree gnu_size = TYPE_SIZE (gnu_type); + /* If the size is self-referential, annotate the maximum value. */ if (CONTAINS_PLACEHOLDER_P (gnu_size)) gnu_size = max_size (gnu_size, true); if (type_annotate_only && Is_Tagged_Type (gnat_entity)) { ! /* In this mode, the tag and the parent components are not ! generated by the front-end so the sizes must be adjusted. */ ! tree pointer_size = bitsize_int (POINTER_SIZE), offset; ! Uint uint_size; if (Is_Derived_Type (gnat_entity)) { ! offset = UI_To_gnu (Esize (Etype (Base_Type (gnat_entity))), ! bitsizetype); Set_Alignment (gnat_entity, Alignment (Etype (Base_Type (gnat_entity)))); } else ! offset = pointer_size; ! gnu_size = size_binop (PLUS_EXPR, gnu_size, offset); ! gnu_size = size_binop (MULT_EXPR, pointer_size, ! size_binop (CEIL_DIV_EXPR, ! gnu_size, ! pointer_size)); ! uint_size = annotate_value (gnu_size); ! Set_Esize (gnat_entity, uint_size); ! Set_RM_Size (gnat_entity, uint_size); } + else + Set_Esize (gnat_entity, annotate_value (gnu_size)); } if (Unknown_RM_Size (gnat_entity) && rm_size (gnu_type)) Set_RM_Size (gnat_entity, annotate_value (rm_size (gnu_type))); } ! /* If we really have a ..._DECL node, set a couple of flags on it. But we ! cannot do that if we are reusing the ..._DECL node made for a renamed ! object, since the predicates don't apply to it but to GNAT_ENTITY. */ ! if (DECL_P (gnu_decl) && !(Present (Renamed_Object (gnat_entity)) && saved)) ! { ! if (!Comes_From_Source (gnat_entity)) ! DECL_ARTIFICIAL (gnu_decl) = 1; ! if (!debug_info_p && TREE_CODE (gnu_decl) != FUNCTION_DECL) ! DECL_IGNORED_P (gnu_decl) = 1; ! } /* If we haven't already, associate the ..._DECL node that we just made with the input GNAT entity node. */ *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 4802,4808 **** unsigned int i; tree t; ! for (i = 0; VEC_iterate (tree, defer_finalize_list, i, t); i++) rest_of_type_decl_compilation_no_defer (t); VEC_free (tree, heap, defer_finalize_list); --- 4989,4995 ---- unsigned int i; tree t; ! FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t) rest_of_type_decl_compilation_no_defer (t); VEC_free (tree, heap, defer_finalize_list); *************** rest_of_type_decl_compilation (tree decl *** 4893,4899 **** { /* 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, decl); else rest_of_type_decl_compilation_no_defer (decl); --- 5080,5086 ---- { /* We need to defer finalizing the type if incomplete types are being deferred or if they are being processed. */ ! if (defer_incomplete_level != 0 || defer_finalize_level != 0) VEC_safe_push (tree, heap, defer_finalize_list, decl); else rest_of_type_decl_compilation_no_defer (decl); *************** rest_of_type_decl_compilation_no_defer ( *** 4923,4928 **** --- 5110,5137 ---- } } + /* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST, + finish constructing the record type as a fat pointer type. */ + + static void + finish_fat_pointer_type (tree record_type, tree field_list) + { + /* Make sure we can put it into a register. */ + TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE); + + /* Show what it really is. */ + TYPE_FAT_POINTER_P (record_type) = 1; + + /* Do not emit debug info for it since the types of its fields may still be + incomplete at this point. */ + finish_record_type (record_type, field_list, 0, false); + + /* Force type_contains_placeholder_p to return true on it. Although the + PLACEHOLDER_EXPRs are referenced only indirectly, this isn't a pointer + type but the representation of the unconstrained array. */ + TYPE_CONTAINS_PLACEHOLDER_INTERNAL (record_type) = 2; + } + /* Finalize any From_With_Type incomplete types. We do this after processing our compilation unit and after processing its spec, if this is a body. */ *************** gnat_to_gnu_param (Entity_Id gnat_param, *** 5099,5105 **** bool in_param = (Ekind (gnat_param) == E_In_Parameter); /* The parameter can be indirectly modified if its address is taken. */ bool ro_param = in_param && !Address_Taken (gnat_param); ! bool by_return = false, by_component_ptr = false, by_ref = false; tree gnu_param; /* Copy-return is used only for the first parameter of a valued procedure. --- 5308,5315 ---- bool in_param = (Ekind (gnat_param) == E_In_Parameter); /* The parameter can be indirectly modified if its address is taken. */ bool ro_param = in_param && !Address_Taken (gnat_param); ! bool by_return = false, by_component_ptr = false; ! bool by_ref = false, by_double_ref = false; tree gnu_param; /* Copy-return is used only for the first parameter of a valued procedure. *************** gnat_to_gnu_param (Entity_Id gnat_param, *** 5141,5146 **** --- 5351,5362 ---- gnu_param_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_param_type)))); + /* For GCC builtins, pass Address integer types as (void *) */ + if (Convention (gnat_subprog) == Convention_Intrinsic + && Present (Interface_Name (gnat_subprog)) + && Is_Descendent_Of_Address (Etype (gnat_param))) + gnu_param_type = ptr_void_type_node; + /* VMS descriptors are themselves passed by reference. */ if (mech == By_Short_Descriptor || (mech == By_Descriptor && TARGET_ABI_OPEN_VMS && !TARGET_MALLOC64)) *************** gnat_to_gnu_param (Entity_Id gnat_param, *** 5210,5215 **** --- 5426,5444 ---- { gnu_param_type = build_reference_type (gnu_param_type); by_ref = true; + + /* In some ABIs, e.g. SPARC 32-bit, fat pointer types are themselves + passed by reference. Pass them by explicit reference, this will + generate more debuggable code at -O0. */ + if (TYPE_IS_FAT_POINTER_P (gnu_param_type) + && targetm.calls.pass_by_reference (NULL, + TYPE_MODE (gnu_param_type), + gnu_param_type, + true)) + { + gnu_param_type = build_reference_type (gnu_param_type); + by_double_ref = true; + } } /* Pass In Out or Out parameters using copy-in copy-out mechanism. */ *************** gnat_to_gnu_param (Entity_Id gnat_param, *** 5252,5257 **** --- 5481,5487 ---- gnu_param = create_param_decl (gnu_param_name, gnu_param_type, ro_param || by_ref || by_component_ptr); DECL_BY_REF_P (gnu_param) = by_ref; + DECL_BY_DOUBLE_REF_P (gnu_param) = by_double_ref; DECL_BY_COMPONENT_PTR_P (gnu_param) = by_component_ptr; DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor || mech == By_Short_Descriptor); *************** compile_time_known_address_p (Node_Id gn *** 5333,5348 **** return Compile_Time_Known_Value (gnat_address); } ! /* Return true if GNAT_RANGE, a N_Range node, cannot be superflat, i.e. ! cannot verify HB < LB-1 when LB and HB are the low and high bounds. */ static bool cannot_be_superflat_p (Node_Id gnat_range) { Node_Id gnat_lb = Low_Bound (gnat_range), gnat_hb = High_Bound (gnat_range); Node_Id scalar_range; ! ! tree gnu_lb, gnu_hb; /* If the low bound is not constant, try to find an upper bound. */ while (Nkind (gnat_lb) != N_Integer_Literal --- 5563,5577 ---- return Compile_Time_Known_Value (gnat_address); } ! /* Return true if GNAT_RANGE, a N_Range node, cannot be superflat, i.e. if the ! inequality HB >= LB-1 is true. LB and HB are the low and high bounds. */ static bool cannot_be_superflat_p (Node_Id gnat_range) { Node_Id gnat_lb = Low_Bound (gnat_range), gnat_hb = High_Bound (gnat_range); Node_Id scalar_range; ! tree gnu_lb, gnu_hb, gnu_lb_minus_one; /* If the low bound is not constant, try to find an upper bound. */ while (Nkind (gnat_lb) != N_Integer_Literal *************** cannot_be_superflat_p (Node_Id gnat_rang *** 5362,5380 **** || Nkind (scalar_range) == N_Range)) gnat_hb = Low_Bound (scalar_range); ! if (!(Nkind (gnat_lb) == N_Integer_Literal ! && Nkind (gnat_hb) == N_Integer_Literal)) return false; ! gnu_lb = UI_To_gnu (Intval (gnat_lb), bitsizetype); ! gnu_hb = UI_To_gnu (Intval (gnat_hb), bitsizetype); /* If the low bound is the smallest integer, nothing can be smaller. */ ! gnu_lb = size_binop (MINUS_EXPR, gnu_lb, bitsize_one_node); ! if (TREE_OVERFLOW (gnu_lb)) return true; ! return (tree_int_cst_lt (gnu_hb, gnu_lb) == 0); } /* Given GNAT_ENTITY, elaborate all expressions that are required to --- 5591,5627 ---- || Nkind (scalar_range) == N_Range)) gnat_hb = Low_Bound (scalar_range); ! /* If we have failed to find constant bounds, punt. */ ! if (Nkind (gnat_lb) != N_Integer_Literal ! || Nkind (gnat_hb) != N_Integer_Literal) return false; ! /* We need at least a signed 64-bit type to catch most cases. */ ! gnu_lb = UI_To_gnu (Intval (gnat_lb), sbitsizetype); ! gnu_hb = UI_To_gnu (Intval (gnat_hb), sbitsizetype); ! if (TREE_OVERFLOW (gnu_lb) || TREE_OVERFLOW (gnu_hb)) ! return false; /* If the low bound is the smallest integer, nothing can be smaller. */ ! gnu_lb_minus_one = size_binop (MINUS_EXPR, gnu_lb, sbitsize_one_node); ! if (TREE_OVERFLOW (gnu_lb_minus_one)) return true; ! return !tree_int_cst_lt (gnu_hb, gnu_lb_minus_one); ! } ! ! /* Return true if GNU_EXPR is (essentially) the address of a CONSTRUCTOR. */ ! ! static bool ! constructor_address_p (tree gnu_expr) ! { ! while (TREE_CODE (gnu_expr) == NOP_EXPR ! || TREE_CODE (gnu_expr) == CONVERT_EXPR ! || TREE_CODE (gnu_expr) == NON_LVALUE_EXPR) ! gnu_expr = TREE_OPERAND (gnu_expr, 0); ! ! return (TREE_CODE (gnu_expr) == ADDR_EXPR ! && TREE_CODE (TREE_OPERAND (gnu_expr, 0)) == CONSTRUCTOR); } /* Given GNAT_ENTITY, elaborate all expressions that are required to *************** prepend_attributes (Entity_Id gnat_entit *** 5706,5736 **** } } - /* Called when we need to protect a variable object using a SAVE_EXPR. */ - - tree - maybe_variable (tree gnu_operand) - { - if (TREE_CONSTANT (gnu_operand) - || TREE_READONLY (gnu_operand) - || TREE_CODE (gnu_operand) == SAVE_EXPR - || TREE_CODE (gnu_operand) == NULL_EXPR) - return gnu_operand; - - if (TREE_CODE (gnu_operand) == UNCONSTRAINED_ARRAY_REF) - { - tree gnu_result - = build1 (UNCONSTRAINED_ARRAY_REF, TREE_TYPE (gnu_operand), - variable_size (TREE_OPERAND (gnu_operand, 0))); - - TREE_READONLY (gnu_result) = TREE_STATIC (gnu_result) - = TYPE_READONLY (TREE_TYPE (TREE_TYPE (gnu_operand))); - return gnu_result; - } - - return variable_size (gnu_operand); - } - /* Given a GNAT tree GNAT_EXPR, for an expression which is a value within a type definition (either a bound or a discriminant value) for GNAT_ENTITY, return the GCC tree to use for that expression. GNU_NAME is the suffix --- 5953,5958 ---- *************** elaborate_expression_1 (tree gnu_expr, E *** 5826,5839 **** IDENTIFIER_POINTER (gnu_name)), NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, !need_debug, Is_Public (gnat_entity), ! !definition, false, NULL, gnat_entity); /* We only need to use this variable if we are in global context since GCC can do the right thing in the local case. */ if (expr_global && expr_variable) return gnu_decl; ! return expr_variable ? maybe_variable (gnu_expr) : gnu_expr; } /* Create a record type that contains a SIZE bytes long field of TYPE with a --- 6048,6078 ---- IDENTIFIER_POINTER (gnu_name)), NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, !need_debug, Is_Public (gnat_entity), ! !definition, expr_global, NULL, gnat_entity); /* We only need to use this variable if we are in global context since GCC can do the right thing in the local case. */ if (expr_global && expr_variable) return gnu_decl; ! return expr_variable ? gnat_save_expr (gnu_expr) : gnu_expr; ! } ! ! /* Similar, but take an alignment factor and make it explicit in the tree. */ ! ! static tree ! elaborate_expression_2 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name, ! bool definition, bool need_debug, unsigned int align) ! { ! tree unit_align = size_int (align / BITS_PER_UNIT); ! return ! size_binop (MULT_EXPR, ! elaborate_expression_1 (size_binop (EXACT_DIV_EXPR, ! gnu_expr, ! unit_align), ! gnat_entity, gnu_name, definition, ! need_debug), ! unit_align); } /* Create a record type that contains a SIZE bytes long field of TYPE with a *************** make_aligning_type (tree type, unsigned *** 5848,5854 **** /* We will be crafting a record type with one field at a position set to be the next multiple of ALIGN past record'address + room bytes. We use a record placeholder to express record'address. */ - tree record_type = make_node (RECORD_TYPE); tree record = build0 (PLACEHOLDER_EXPR, record_type); --- 6087,6092 ---- *************** make_aligning_type (tree type, unsigned *** 5868,5874 **** Every length is in sizetype bytes there, except "pos" which has to be set as a bit position in the GCC tree for the record. */ - tree room_st = size_int (room); tree vblock_addr_st = size_binop (PLUS_EXPR, record_addr_st, room_st); tree voffset_st, pos, field; --- 6106,6111 ---- *************** make_aligning_type (tree type, unsigned *** 5877,5895 **** if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); ! ! TYPE_NAME (record_type) = concat_name (name, "_ALIGN"); /* Compute VOFFSET and then POS. The next byte position multiple of some alignment after some address is obtained by "and"ing the alignment minus 1 with the two's complement of the address. */ - voffset_st = size_binop (BIT_AND_EXPR, ! size_diffop (size_zero_node, vblock_addr_st), ! ssize_int ((align / BITS_PER_UNIT) - 1)); /* POS = (ROOM + VOFFSET) * BIT_PER_UNIT, in bitsizetype. */ - pos = size_binop (MULT_EXPR, convert (bitsizetype, size_binop (PLUS_EXPR, room_st, voffset_st)), --- 6114,6130 ---- if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); ! name = concat_name (name, "ALIGN"); ! TYPE_NAME (record_type) = name; /* Compute VOFFSET and then POS. The next byte position multiple of some alignment after some address is obtained by "and"ing the alignment minus 1 with the two's complement of the address. */ voffset_st = size_binop (BIT_AND_EXPR, ! fold_build1 (NEGATE_EXPR, sizetype, vblock_addr_st), ! size_int ((align / BITS_PER_UNIT) - 1)); /* POS = (ROOM + VOFFSET) * BIT_PER_UNIT, in bitsizetype. */ pos = size_binop (MULT_EXPR, convert (bitsizetype, size_binop (PLUS_EXPR, room_st, voffset_st)), *************** make_aligning_type (tree type, unsigned *** 5908,5916 **** consequences on the alignment computation, and create_field_decl would make one without this special argument, for instance because of the complex position expression. */ ! ! field = create_field_decl (get_identifier ("F"), type, record_type, ! 1, size, pos, -1); TYPE_FIELDS (record_type) = field; TYPE_ALIGN (record_type) = base_align; --- 6143,6150 ---- consequences on the alignment computation, and create_field_decl would make one without this special argument, for instance because of the complex position expression. */ ! field = create_field_decl (get_identifier ("F"), type, record_type, size, ! pos, 1, -1); TYPE_FIELDS (record_type) = field; TYPE_ALIGN (record_type) = base_align; *************** make_aligning_type (tree type, unsigned *** 5926,5933 **** size_int (room + align / BITS_PER_UNIT)); SET_TYPE_MODE (record_type, BLKmode); - relate_alias_sets (record_type, type, ALIAS_SET_COPY); return record_type; } --- 6160,6171 ---- size_int (room + align / BITS_PER_UNIT)); SET_TYPE_MODE (record_type, BLKmode); relate_alias_sets (record_type, type, ALIAS_SET_COPY); + + /* Declare it now since it will never be declared otherwise. This is + necessary to ensure that its subtrees are properly marked. */ + create_type_decl (name, record_type, NULL, true, false, Empty); + return record_type; } *************** make_packable_type (tree type, bool in_r *** 6004,6010 **** /* Now copy the fields, keeping the position and size as we don't want to change the layout by propagating the packedness downwards. */ for (old_field = TYPE_FIELDS (type); old_field; ! old_field = TREE_CHAIN (old_field)) { tree new_field_type = TREE_TYPE (old_field); tree new_field, new_size; --- 6242,6248 ---- /* Now copy the fields, keeping the position and size as we don't want to change the layout by propagating the packedness downwards. */ for (old_field = TYPE_FIELDS (type); old_field; ! old_field = DECL_CHAIN (old_field)) { tree new_field_type = TREE_TYPE (old_field); tree new_field, new_size; *************** make_packable_type (tree type, bool in_r *** 6019,6025 **** /* However, for the last field in a not already packed record type that is of an aggregate type, we need to use the RM size in the packable version of the record type, see finish_record_type. */ ! if (!TREE_CHAIN (old_field) && !TYPE_PACKED (type) && (TREE_CODE (new_field_type) == RECORD_TYPE || TREE_CODE (new_field_type) == UNION_TYPE --- 6257,6263 ---- /* However, for the last field in a not already packed record type that is of an aggregate type, we need to use the RM size in the packable version of the record type, see finish_record_type. */ ! if (!DECL_CHAIN (old_field) && !TYPE_PACKED (type) && (TREE_CODE (new_field_type) == RECORD_TYPE || TREE_CODE (new_field_type) == UNION_TYPE *************** make_packable_type (tree type, bool in_r *** 6031,6050 **** else new_size = DECL_SIZE (old_field); ! new_field = create_field_decl (DECL_NAME (old_field), new_field_type, ! new_type, TYPE_PACKED (type), new_size, ! bit_position (old_field), ! !DECL_NONADDRESSABLE_P (old_field)); DECL_INTERNAL_P (new_field) = DECL_INTERNAL_P (old_field); ! SET_DECL_ORIGINAL_FIELD ! (new_field, (DECL_ORIGINAL_FIELD (old_field) ! ? DECL_ORIGINAL_FIELD (old_field) : old_field)); ! if (TREE_CODE (new_type) == QUAL_UNION_TYPE) DECL_QUALIFIER (new_field) = DECL_QUALIFIER (old_field); ! TREE_CHAIN (new_field) = field_list; field_list = new_field; } --- 6269,6286 ---- else new_size = DECL_SIZE (old_field); ! new_field ! = create_field_decl (DECL_NAME (old_field), new_field_type, new_type, ! new_size, bit_position (old_field), ! TYPE_PACKED (type), ! !DECL_NONADDRESSABLE_P (old_field)); DECL_INTERNAL_P (new_field) = DECL_INTERNAL_P (old_field); ! SET_DECL_ORIGINAL_FIELD_TO_FIELD (new_field, old_field); if (TREE_CODE (new_type) == QUAL_UNION_TYPE) DECL_QUALIFIER (new_field) = DECL_QUALIFIER (old_field); ! DECL_CHAIN (new_field) = field_list; field_list = new_field; } *************** maybe_pad_type (tree type, tree size, un *** 6201,6208 **** } /* Now create the field with the original size. */ ! field = create_field_decl (get_identifier ("F"), type, record, 0, ! orig_size, bitsize_zero_node, 1); DECL_INTERNAL_P (field) = 1; /* Do not emit debug info until after the auxiliary record is built. */ --- 6437,6444 ---- } /* Now create the field with the original size. */ ! field = create_field_decl (get_identifier ("F"), type, record, orig_size, ! bitsize_zero_node, 0, 1); DECL_INTERNAL_P (field) = 1; /* Do not emit debug info until after the auxiliary record is built. */ *************** maybe_pad_type (tree type, tree size, un *** 6235,6250 **** finish_record_type (marker, create_field_decl (orig_name, build_reference_type (type), ! marker, 0, NULL_TREE, NULL_TREE, ! 0), 0, true); add_parallel_type (TYPE_STUB_DECL (record), marker); if (definition && size && TREE_CODE (size) != INTEGER_CST) ! create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype, ! TYPE_SIZE_UNIT (record), false, false, false, ! false, NULL, gnat_entity); } rest_of_record_type_compilation (record); --- 6471,6487 ---- finish_record_type (marker, create_field_decl (orig_name, build_reference_type (type), ! marker, NULL_TREE, NULL_TREE, ! 0, 0), 0, true); add_parallel_type (TYPE_STUB_DECL (record), marker); if (definition && size && TREE_CODE (size) != INTEGER_CST) ! TYPE_SIZE_UNIT (marker) ! = create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype, ! TYPE_SIZE_UNIT (record), false, false, false, ! false, NULL, gnat_entity); } rest_of_record_type_compilation (record); *************** maybe_pad_type (tree type, tree size, un *** 6262,6271 **** if (Present (gnat_entity) && size && TREE_CODE (size) != MAX_EXPR && !operand_equal_p (size, orig_size, 0) && !(TREE_CODE (size) == INTEGER_CST && TREE_CODE (orig_size) == INTEGER_CST ! && tree_int_cst_lt (size, orig_size))) { Node_Id gnat_error_node = Empty; --- 6499,6511 ---- if (Present (gnat_entity) && size && TREE_CODE (size) != MAX_EXPR + && TREE_CODE (size) != COND_EXPR && !operand_equal_p (size, orig_size, 0) && !(TREE_CODE (size) == INTEGER_CST && TREE_CODE (orig_size) == INTEGER_CST ! && (TREE_OVERFLOW (size) ! || TREE_OVERFLOW (orig_size) ! || tree_int_cst_lt (size, orig_size)))) { Node_Id gnat_error_node = Empty; *************** choices_to_gnu (tree operand, Node_Id ch *** 6317,6329 **** low = gnat_to_gnu (Low_Bound (choice)); high = gnat_to_gnu (High_Bound (choice)); - /* There's no good type to use here, so we might as well use - integer_type_node. */ this_test ! = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node, ! build_binary_op (GE_EXPR, integer_type_node, operand, low), ! build_binary_op (LE_EXPR, integer_type_node, operand, high)); break; --- 6557,6567 ---- low = gnat_to_gnu (Low_Bound (choice)); high = gnat_to_gnu (High_Bound (choice)); this_test ! = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, ! build_binary_op (GE_EXPR, boolean_type_node, operand, low), ! build_binary_op (LE_EXPR, boolean_type_node, operand, high)); break; *************** choices_to_gnu (tree operand, Node_Id ch *** 6334,6343 **** high = gnat_to_gnu (High_Bound (gnat_temp)); this_test ! = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node, ! build_binary_op (GE_EXPR, integer_type_node, operand, low), ! build_binary_op (LE_EXPR, integer_type_node, operand, high)); break; --- 6572,6581 ---- high = gnat_to_gnu (High_Bound (gnat_temp)); this_test ! = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, ! build_binary_op (GE_EXPR, boolean_type_node, operand, low), ! build_binary_op (LE_EXPR, boolean_type_node, operand, high)); break; *************** choices_to_gnu (tree operand, Node_Id ch *** 6355,6364 **** high = TYPE_MAX_VALUE (type); this_test ! = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node, ! build_binary_op (GE_EXPR, integer_type_node, operand, low), ! build_binary_op (LE_EXPR, integer_type_node, operand, high)); break; } --- 6593,6602 ---- high = TYPE_MAX_VALUE (type); this_test ! = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, ! build_binary_op (GE_EXPR, boolean_type_node, operand, low), ! build_binary_op (LE_EXPR, boolean_type_node, operand, high)); break; } *************** choices_to_gnu (tree operand, Node_Id ch *** 6368,6374 **** case N_Character_Literal: case N_Integer_Literal: single = gnat_to_gnu (choice); ! this_test = build_binary_op (EQ_EXPR, integer_type_node, operand, single); break; --- 6606,6612 ---- case N_Character_Literal: case N_Integer_Literal: single = gnat_to_gnu (choice); ! this_test = build_binary_op (EQ_EXPR, boolean_type_node, operand, single); break; *************** choices_to_gnu (tree operand, Node_Id ch *** 6380,6387 **** gcc_unreachable (); } ! result = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, ! result, this_test); } return result; --- 6618,6625 ---- gcc_unreachable (); } ! result = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, result, ! this_test); } return result; *************** gnat_to_gnu_field (Entity_Id gnat_field, *** 6662,6670 **** || !TYPE_CONTAINS_TEMPLATE_P (gnu_field_type)); /* Now create the decl for the field. */ ! gnu_field = create_field_decl (gnu_field_id, gnu_field_type, gnu_record_type, ! packed, gnu_size, gnu_pos, ! Is_Aliased (gnat_field)); Sloc_to_locus (Sloc (gnat_field), &DECL_SOURCE_LOCATION (gnu_field)); TREE_THIS_VOLATILE (gnu_field) = Treat_As_Volatile (gnat_field); --- 6900,6908 ---- || !TYPE_CONTAINS_TEMPLATE_P (gnu_field_type)); /* Now create the decl for the field. */ ! gnu_field ! = create_field_decl (gnu_field_id, gnu_field_type, gnu_record_type, ! gnu_size, gnu_pos, packed, Is_Aliased (gnat_field)); Sloc_to_locus (Sloc (gnat_field), &DECL_SOURCE_LOCATION (gnu_field)); TREE_THIS_VOLATILE (gnu_field) = Treat_As_Volatile (gnat_field); *************** is_variable_size (tree type) *** 6695,6701 **** && TREE_CODE (type) != QUAL_UNION_TYPE) return false; ! for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) if (is_variable_size (TREE_TYPE (field))) return true; --- 6933,6939 ---- && TREE_CODE (type) != QUAL_UNION_TYPE) return false; ! for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (is_variable_size (TREE_TYPE (field))) return true; *************** components_to_record (tree gnu_record_ty *** 6793,6806 **** fields except for the _Tag or _Parent field. */ else if (gnat_name == Name_uController && gnu_last) { ! TREE_CHAIN (gnu_field) = TREE_CHAIN (gnu_last); ! TREE_CHAIN (gnu_last) = gnu_field; } /* If this is a regular field, put it after the other fields. */ else { ! TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; if (!gnu_last) gnu_last = gnu_field; --- 7031,7044 ---- fields except for the _Tag or _Parent field. */ else if (gnat_name == Name_uController && gnu_last) { ! DECL_CHAIN (gnu_field) = DECL_CHAIN (gnu_last); ! DECL_CHAIN (gnu_last) = gnu_field; } /* If this is a regular field, put it after the other fields. */ else { ! DECL_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; if (!gnu_last) gnu_last = gnu_field; *************** components_to_record (tree gnu_record_ty *** 6899,6905 **** use this field directly to match the layout of C unions. */ if (unchecked_union && TYPE_FIELDS (gnu_variant_type) ! && !TREE_CHAIN (TYPE_FIELDS (gnu_variant_type))) gnu_field = TYPE_FIELDS (gnu_variant_type); else { --- 7137,7143 ---- use this field directly to match the layout of C unions. */ if (unchecked_union && TYPE_FIELDS (gnu_variant_type) ! && !DECL_CHAIN (TYPE_FIELDS (gnu_variant_type))) gnu_field = TYPE_FIELDS (gnu_variant_type); else { *************** components_to_record (tree gnu_record_ty *** 6916,6929 **** create_type_decl (TYPE_NAME (gnu_variant_type), gnu_variant_type, NULL, true, debug_info_p, gnat_component_list); ! gnu_field = create_field_decl (gnu_inner_name, gnu_variant_type, ! gnu_union_type, field_packed, ! (all_rep_and_size ! ? TYPE_SIZE (gnu_variant_type) ! : 0), ! (all_rep_and_size ! ? bitsize_zero_node : 0), ! 0); DECL_INTERNAL_P (gnu_field) = 1; --- 7154,7167 ---- create_type_decl (TYPE_NAME (gnu_variant_type), gnu_variant_type, NULL, true, debug_info_p, gnat_component_list); ! gnu_field ! = create_field_decl (gnu_inner_name, gnu_variant_type, ! gnu_union_type, ! all_rep_and_size ! ? TYPE_SIZE (gnu_variant_type) : 0, ! all_rep_and_size ! ? bitsize_zero_node : 0, ! field_packed, 0); DECL_INTERNAL_P (gnu_field) = 1; *************** components_to_record (tree gnu_record_ty *** 6931,6937 **** DECL_QUALIFIER (gnu_field) = gnu_qual; } ! TREE_CHAIN (gnu_field) = gnu_variant_list; gnu_variant_list = gnu_field; } --- 7169,7175 ---- DECL_QUALIFIER (gnu_field) = gnu_qual; } ! DECL_CHAIN (gnu_field) = gnu_variant_list; gnu_variant_list = gnu_field; } *************** components_to_record (tree gnu_record_ty *** 6970,6981 **** gnu_union_field = create_field_decl (gnu_var_name, gnu_union_type, gnu_record_type, - union_field_packed, all_rep ? TYPE_SIZE (gnu_union_type) : 0, ! all_rep ? bitsize_zero_node : 0, 0); DECL_INTERNAL_P (gnu_union_field) = 1; ! TREE_CHAIN (gnu_union_field) = gnu_field_list; gnu_field_list = gnu_union_field; } } --- 7208,7219 ---- gnu_union_field = create_field_decl (gnu_var_name, gnu_union_type, gnu_record_type, all_rep ? TYPE_SIZE (gnu_union_type) : 0, ! all_rep ? bitsize_zero_node : 0, ! union_field_packed, 0); DECL_INTERNAL_P (gnu_union_field) = 1; ! DECL_CHAIN (gnu_union_field) = gnu_field_list; gnu_field_list = gnu_union_field; } } *************** components_to_record (tree gnu_record_ty *** 6990,7005 **** gnu_last = NULL_TREE; for (gnu_field = gnu_field_list; gnu_field; gnu_field = gnu_next) { ! gnu_next = TREE_CHAIN (gnu_field); if (DECL_FIELD_OFFSET (gnu_field)) { if (!gnu_last) gnu_field_list = gnu_next; else ! TREE_CHAIN (gnu_last) = gnu_next; ! TREE_CHAIN (gnu_field) = gnu_our_rep_list; gnu_our_rep_list = gnu_field; } else --- 7228,7243 ---- gnu_last = NULL_TREE; for (gnu_field = gnu_field_list; gnu_field; gnu_field = gnu_next) { ! gnu_next = DECL_CHAIN (gnu_field); if (DECL_FIELD_OFFSET (gnu_field)) { if (!gnu_last) gnu_field_list = gnu_next; else ! DECL_CHAIN (gnu_last) = gnu_next; ! DECL_CHAIN (gnu_field) = gnu_our_rep_list; gnu_our_rep_list = gnu_field; } else *************** components_to_record (tree gnu_record_ty *** 7019,7029 **** tree gnu_rep_type = (gnu_field_list ? make_node (RECORD_TYPE) : gnu_record_type); int i, len = list_length (gnu_our_rep_list); ! tree *gnu_arr = (tree *) alloca (sizeof (tree) * len); for (gnu_field = gnu_our_rep_list, i = 0; gnu_field; ! gnu_field = TREE_CHAIN (gnu_field), i++) gnu_arr[i] = gnu_field; qsort (gnu_arr, len, sizeof (tree), compare_field_bitpos); --- 7257,7267 ---- tree gnu_rep_type = (gnu_field_list ? make_node (RECORD_TYPE) : gnu_record_type); int i, len = list_length (gnu_our_rep_list); ! tree *gnu_arr = XALLOCAVEC (tree, len); for (gnu_field = gnu_our_rep_list, i = 0; gnu_field; ! gnu_field = DECL_CHAIN (gnu_field), i++) gnu_arr[i] = gnu_field; qsort (gnu_arr, len, sizeof (tree), compare_field_bitpos); *************** components_to_record (tree gnu_record_ty *** 7033,7039 **** gnu_our_rep_list = NULL_TREE; for (i = len - 1; i >= 0; i--) { ! TREE_CHAIN (gnu_arr[i]) = gnu_our_rep_list; gnu_our_rep_list = gnu_arr[i]; DECL_CONTEXT (gnu_arr[i]) = gnu_rep_type; } --- 7271,7277 ---- gnu_our_rep_list = NULL_TREE; for (i = len - 1; i >= 0; i--) { ! DECL_CHAIN (gnu_arr[i]) = gnu_our_rep_list; gnu_our_rep_list = gnu_arr[i]; DECL_CONTEXT (gnu_arr[i]) = gnu_rep_type; } *************** components_to_record (tree gnu_record_ty *** 7043,7049 **** finish_record_type (gnu_rep_type, gnu_our_rep_list, 1, debug_info_p); gnu_field = create_field_decl (get_identifier ("REP"), gnu_rep_type, ! gnu_record_type, 0, NULL_TREE, NULL_TREE, 1); DECL_INTERNAL_P (gnu_field) = 1; gnu_field_list = chainon (gnu_field_list, gnu_field); } --- 7281,7287 ---- finish_record_type (gnu_rep_type, gnu_our_rep_list, 1, debug_info_p); gnu_field = create_field_decl (get_identifier ("REP"), gnu_rep_type, ! gnu_record_type, NULL_TREE, NULL_TREE, 0, 1); DECL_INTERNAL_P (gnu_field) = 1; gnu_field_list = chainon (gnu_field_list, gnu_field); } *************** components_to_record (tree gnu_record_ty *** 7068,7079 **** static Uint annotate_value (tree gnu_size) { - int len = TREE_CODE_LENGTH (TREE_CODE (gnu_size)); TCode tcode; Node_Ref_Or_Val ops[3], ret; - int i; - int size; struct tree_int_map **h = NULL; /* See if we've already saved the value for this node. */ if (EXPR_P (gnu_size)) --- 7306,7315 ---- static Uint annotate_value (tree gnu_size) { TCode tcode; Node_Ref_Or_Val ops[3], ret; struct tree_int_map **h = NULL; + int i; /* See if we've already saved the value for this node. */ if (EXPR_P (gnu_size)) *************** annotate_value (tree gnu_size) *** 7100,7145 **** if (TREE_OVERFLOW (gnu_size)) return No_Uint; ! /* This may have come from a conversion from some smaller type, ! so ensure this is in bitsizetype. */ gnu_size = convert (bitsizetype, gnu_size); ! /* For negative values, use NEGATE_EXPR of the supplied value. */ ! if (tree_int_cst_sgn (gnu_size) < 0) { ! /* The ridiculous code below is to handle the case of the largest ! negative integer. */ ! tree negative_size = size_diffop (bitsize_zero_node, gnu_size); ! bool adjust = false; ! tree temp; ! ! if (TREE_OVERFLOW (negative_size)) ! { ! negative_size ! = size_binop (MINUS_EXPR, bitsize_zero_node, ! size_binop (PLUS_EXPR, gnu_size, ! bitsize_one_node)); ! adjust = true; ! } ! ! temp = build1 (NEGATE_EXPR, bitsizetype, negative_size); ! if (adjust) ! temp = build2 (MINUS_EXPR, bitsizetype, temp, bitsize_one_node); ! ! return annotate_value (temp); } ! if (!host_integerp (gnu_size, 1)) ! return No_Uint; ! ! size = tree_low_cst (gnu_size, 1); ! ! /* This peculiar test is to make sure that the size fits in an int ! on machines where HOST_WIDE_INT is not "int". */ ! if (tree_low_cst (gnu_size, 1) == size) ! return UI_From_Int (size); ! else ! return No_Uint; case COMPONENT_REF: /* The only case we handle here is a simple discriminant reference. */ --- 7336,7356 ---- if (TREE_OVERFLOW (gnu_size)) return No_Uint; ! /* This may come from a conversion from some smaller type, so ensure ! this is in bitsizetype. */ gnu_size = convert (bitsizetype, gnu_size); ! /* For a negative value, build NEGATE_EXPR of the opposite. Such values ! appear in expressions containing aligning patterns. Note that, since ! sizetype is sign-extended but nonetheless unsigned, we don't directly ! use tree_int_cst_sgn. */ ! if (TREE_INT_CST_HIGH (gnu_size) < 0) { ! tree op_size = fold_build1 (NEGATE_EXPR, bitsizetype, gnu_size); ! return annotate_value (build1 (NEGATE_EXPR, bitsizetype, op_size)); } ! return UI_From_gnu (gnu_size); case COMPONENT_REF: /* The only case we handle here is a simple discriminant reference. */ *************** annotate_value (tree gnu_size) *** 7204,7210 **** for (i = 0; i < 3; i++) ops[i] = No_Uint; ! for (i = 0; i < len; i++) { ops[i] = annotate_value (TREE_OPERAND (gnu_size, i)); if (ops[i] == No_Uint) --- 7415,7421 ---- for (i = 0; i < 3; i++) ops[i] = No_Uint; ! for (i = 0; i < TREE_CODE_LENGTH (TREE_CODE (gnu_size)); i++) { ops[i] = annotate_value (TREE_OPERAND (gnu_size, i)); if (ops[i] == No_Uint) *************** annotate_value (tree gnu_size) *** 7216,7222 **** /* Save the result in the cache. */ if (h) { ! *h = GGC_NEW (struct tree_int_map); (*h)->base.from = gnu_size; (*h)->to = ret; } --- 7427,7433 ---- /* Save the result in the cache. */ if (h) { ! *h = ggc_alloc_tree_int_map (); (*h)->base.from = gnu_size; (*h)->to = ret; } *************** annotate_value (tree gnu_size) *** 7227,7239 **** /* Given GNAT_ENTITY, an object (constant, variable, parameter, exception) and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null. ! BY_REF is true if the object is used by reference. */ void ! annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, bool by_ref) { if (by_ref) { if (TYPE_IS_FAT_POINTER_P (gnu_type)) gnu_type = TYPE_UNCONSTRAINED_ARRAY (gnu_type); else --- 7438,7455 ---- /* Given GNAT_ENTITY, an object (constant, variable, parameter, exception) and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null. ! BY_REF is true if the object is used by reference and BY_DOUBLE_REF is ! true if the object is used by double reference. */ void ! annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, bool by_ref, ! bool by_double_ref) { if (by_ref) { + if (by_double_ref) + gnu_type = TREE_TYPE (gnu_type); + if (TYPE_IS_FAT_POINTER_P (gnu_type)) gnu_type = TYPE_UNCONSTRAINED_ARRAY (gnu_type); else *************** annotate_object (Entity_Id gnat_entity, *** 7244,7250 **** { if (TREE_CODE (gnu_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_type)) ! size = TYPE_SIZE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_type)))); else if (!size) size = TYPE_SIZE (gnu_type); --- 7460,7466 ---- { if (TREE_CODE (gnu_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_type)) ! size = TYPE_SIZE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_type)))); else if (!size) size = TYPE_SIZE (gnu_type); *************** annotate_object (Entity_Id gnat_entity, *** 7257,7265 **** UI_From_Int (TYPE_ALIGN (gnu_type) / BITS_PER_UNIT)); } ! /* Return first element of field list whose TREE_PURPOSE is ELEM or whose ! DECL_ORIGINAL_FIELD of TREE_PURPOSE is ELEM. Return NULL_TREE if there ! is no such element in the list. */ static tree purpose_member_field (const_tree elem, tree list) --- 7473,7480 ---- UI_From_Int (TYPE_ALIGN (gnu_type) / BITS_PER_UNIT)); } ! /* Return first element of field list whose TREE_PURPOSE is the same as ELEM. ! Return NULL_TREE if there is no such element in the list. */ static tree purpose_member_field (const_tree elem, tree list) *************** purpose_member_field (const_tree elem, t *** 7267,7273 **** while (list) { tree field = TREE_PURPOSE (list); ! if (elem == field || elem == DECL_ORIGINAL_FIELD (field)) return list; list = TREE_CHAIN (list); } --- 7482,7488 ---- while (list) { tree field = TREE_PURPOSE (list); ! if (SAME_FIELD_P (field, elem)) return list; list = TREE_CHAIN (list); } *************** build_position_list (tree gnu_type, bool *** 7361,7367 **** for (gnu_field = TYPE_FIELDS (gnu_type); gnu_field; ! gnu_field = TREE_CHAIN (gnu_field)) { tree gnu_our_bitpos = size_binop (PLUS_EXPR, gnu_bitpos, DECL_FIELD_BIT_OFFSET (gnu_field)); --- 7576,7582 ---- for (gnu_field = TYPE_FIELDS (gnu_type); gnu_field; ! gnu_field = DECL_CHAIN (gnu_field)) { tree gnu_our_bitpos = size_binop (PLUS_EXPR, gnu_bitpos, DECL_FIELD_BIT_OFFSET (gnu_field)); *************** build_position_list (tree gnu_type, bool *** 7398,7414 **** return gnu_list; } ! /* Return a TREE_LIST describing the substitutions needed to reflect the discriminant substitutions from GNAT_TYPE to GNAT_SUBTYPE. They can ! be in any order. TREE_PURPOSE gives the tree for the discriminant and ! TREE_VALUE is the replacement value. They are in the form of operands ! to SUBSTITUTE_IN_EXPR. DEFINITION is true if this is for a definition ! of GNAT_SUBTYPE. */ ! static tree build_subst_list (Entity_Id gnat_subtype, Entity_Id gnat_type, bool definition) { ! tree gnu_list = NULL_TREE; Entity_Id gnat_discrim; Node_Id gnat_value; --- 7613,7628 ---- return gnu_list; } ! /* Return a VEC describing the substitutions needed to reflect the discriminant substitutions from GNAT_TYPE to GNAT_SUBTYPE. They can ! be in any order. The values in an element of the VEC are in the form ! of operands to SUBSTITUTE_IN_EXPR. DEFINITION is true if this is for ! a definition of GNAT_SUBTYPE. */ ! static VEC(subst_pair,heap) * build_subst_list (Entity_Id gnat_subtype, Entity_Id gnat_type, bool definition) { ! VEC(subst_pair,heap) *gnu_vec = NULL; Entity_Id gnat_discrim; Node_Id gnat_value; *************** build_subst_list (Entity_Id gnat_subtype *** 7421,7475 **** if (!Is_Access_Type (Etype (Node (gnat_value)))) { tree gnu_field = gnat_to_gnu_field_decl (gnat_discrim); ! gnu_list = tree_cons (gnu_field, ! convert (TREE_TYPE (gnu_field), ! elaborate_expression ! (Node (gnat_value), gnat_subtype, ! get_entity_name (gnat_discrim), ! definition, true, false)), ! gnu_list); } ! return gnu_list; } ! /* Scan all fields in QUAL_UNION_TYPE and return a TREE_LIST describing the ! variants of QUAL_UNION_TYPE that are still relevant after applying the ! substitutions described in SUBST_LIST. TREE_PURPOSE is the type of the ! variant and TREE_VALUE is a TREE_VEC containing the field, the new value ! of the qualifier and NULL_TREE respectively. GNU_LIST is a pre-existing ! list to be chained to the newly created entries. */ ! static tree ! build_variant_list (tree qual_union_type, tree subst_list, tree gnu_list) { tree gnu_field; for (gnu_field = TYPE_FIELDS (qual_union_type); gnu_field; ! gnu_field = TREE_CHAIN (gnu_field)) { ! tree t, qual = DECL_QUALIFIER (gnu_field); ! for (t = subst_list; t; t = TREE_CHAIN (t)) ! qual = SUBSTITUTE_IN_EXPR (qual, TREE_PURPOSE (t), TREE_VALUE (t)); /* If the new qualifier is not unconditionally false, its variant may still be accessed. */ if (!integer_zerop (qual)) { tree variant_type = TREE_TYPE (gnu_field), variant_subpart; ! tree v = make_tree_vec (3); ! TREE_VEC_ELT (v, 0) = gnu_field; ! TREE_VEC_ELT (v, 1) = qual; ! TREE_VEC_ELT (v, 2) = NULL_TREE; ! gnu_list = tree_cons (variant_type, v, gnu_list); /* Recurse on the variant subpart of the variant, if any. */ variant_subpart = get_variant_part (variant_type); if (variant_subpart) ! gnu_list = build_variant_list (TREE_TYPE (variant_subpart), ! subst_list, gnu_list); /* If the new qualifier is unconditionally true, the subsequent variants cannot be accessed. */ --- 7635,7694 ---- if (!Is_Access_Type (Etype (Node (gnat_value)))) { tree gnu_field = gnat_to_gnu_field_decl (gnat_discrim); ! tree replacement = convert (TREE_TYPE (gnu_field), ! elaborate_expression ! (Node (gnat_value), gnat_subtype, ! get_entity_name (gnat_discrim), ! definition, true, false)); ! subst_pair *s = VEC_safe_push (subst_pair, heap, gnu_vec, NULL); ! s->discriminant = gnu_field; ! s->replacement = replacement; } ! return gnu_vec; } ! /* Scan all fields in QUAL_UNION_TYPE and return a VEC describing the ! variants of QUAL_UNION_TYPE that are still relevant after applying ! the substitutions described in SUBST_LIST. VARIANT_LIST is a ! pre-existing VEC onto which newly created entries should be ! pushed. */ ! static VEC(variant_desc,heap) * ! build_variant_list (tree qual_union_type, VEC(subst_pair,heap) *subst_list, ! VEC(variant_desc,heap) *variant_list) { tree gnu_field; for (gnu_field = TYPE_FIELDS (qual_union_type); gnu_field; ! gnu_field = DECL_CHAIN (gnu_field)) { ! tree qual = DECL_QUALIFIER (gnu_field); ! unsigned ix; ! subst_pair *s; ! FOR_EACH_VEC_ELT_REVERSE (subst_pair, subst_list, ix, s) ! qual = SUBSTITUTE_IN_EXPR (qual, s->discriminant, s->replacement); /* If the new qualifier is not unconditionally false, its variant may still be accessed. */ if (!integer_zerop (qual)) { + variant_desc *v; tree variant_type = TREE_TYPE (gnu_field), variant_subpart; ! ! v = VEC_safe_push (variant_desc, heap, variant_list, NULL); ! v->type = variant_type; ! v->field = gnu_field; ! v->qual = qual; ! v->record = NULL_TREE; /* Recurse on the variant subpart of the variant, if any. */ variant_subpart = get_variant_part (variant_type); if (variant_subpart) ! variant_list = build_variant_list (TREE_TYPE (variant_subpart), ! subst_list, variant_list); /* If the new qualifier is unconditionally true, the subsequent variants cannot be accessed. */ *************** build_variant_list (tree qual_union_type *** 7478,7484 **** } } ! return gnu_list; } /* UINT_SIZE is a Uint giving the specified size for an object of GNU_TYPE --- 7697,7703 ---- } } ! return variant_list; } /* UINT_SIZE is a Uint giving the specified size for an object of GNU_TYPE *************** validate_size (Uint uint_size, tree gnu_ *** 7498,7510 **** Node_Id gnat_error_node; tree type_size, size; ! if (kind == VAR_DECL ! /* If a type needs strict alignment, a component of this type in ! a packed record cannot be packed and thus uses the type size. */ ! || (kind == TYPE_DECL && Strict_Alignment (gnat_object))) ! type_size = TYPE_SIZE (gnu_type); ! else ! type_size = rm_size (gnu_type); /* Find the node to use for errors. */ if ((Ekind (gnat_object) == E_Component --- 7717,7729 ---- Node_Id gnat_error_node; tree type_size, size; ! /* Return 0 if no size was specified. */ ! if (uint_size == No_Uint) ! return NULL_TREE; ! ! /* Ignore a negative size since that corresponds to our back-annotation. */ ! if (UI_Lt (uint_size, Uint_0)) ! return NULL_TREE; /* Find the node to use for errors. */ if ((Ekind (gnat_object) == E_Component *************** validate_size (Uint uint_size, tree gnu_ *** 7516,7540 **** else gnat_error_node = gnat_object; - /* Return 0 if no size was specified, either because Esize was not Present - or the specified size was zero. */ - if (No (uint_size) || uint_size == No_Uint) - return NULL_TREE; - /* Get the size as a tree. Issue an error if a size was specified but cannot be represented in sizetype. */ size = UI_To_gnu (uint_size, bitsizetype); if (TREE_OVERFLOW (size)) { ! post_error_ne (component_p ? "component size of & is too large" ! : "size of & is too large", ! gnat_error_node, gnat_object); return NULL_TREE; } ! /* Ignore a negative size since that corresponds to our back-annotation. ! Also ignore a zero size if it is not permitted. */ ! if (tree_int_cst_sgn (size) < 0 || (integer_zerop (size) && !zero_ok)) return NULL_TREE; /* The size of objects is always a multiple of a byte. */ --- 7735,7756 ---- else gnat_error_node = gnat_object; /* Get the size as a tree. Issue an error if a size was specified but cannot be represented in sizetype. */ size = UI_To_gnu (uint_size, bitsizetype); if (TREE_OVERFLOW (size)) { ! if (component_p) ! post_error_ne ("component size of & is too large", gnat_error_node, ! gnat_object); ! else ! post_error_ne ("size of & is too large", gnat_error_node, ! gnat_object); return NULL_TREE; } ! /* Ignore a zero size if it is not permitted. */ ! if (!zero_ok && integer_zerop (size)) return NULL_TREE; /* The size of objects is always a multiple of a byte. */ *************** validate_size (Uint uint_size, tree gnu_ *** 7564,7569 **** --- 7780,7793 ---- && TYPE_CONTAINS_TEMPLATE_P (gnu_type)) size = size_binop (PLUS_EXPR, DECL_SIZE (TYPE_FIELDS (gnu_type)), size); + if (kind == VAR_DECL + /* If a type needs strict alignment, a component of this type in + a packed record cannot be packed and thus uses the type size. */ + || (kind == TYPE_DECL && Strict_Alignment (gnat_object))) + type_size = TYPE_SIZE (gnu_type); + else + type_size = rm_size (gnu_type); + /* Modify the size of the type to be that of the maximum size if it has a discriminant. */ if (type_size && CONTAINS_PLACEHOLDER_P (type_size)) *************** validate_size (Uint uint_size, tree gnu_ *** 7573,7585 **** by the smallest integral mode that's valid for pointers. */ if (TREE_CODE (gnu_type) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (gnu_type)) { ! enum machine_mode p_mode; ! ! for (p_mode = GET_CLASS_NARROWEST_MODE (MODE_INT); ! !targetm.valid_pointer_mode (p_mode); ! p_mode = GET_MODE_WIDER_MODE (p_mode)) ! ; ! type_size = bitsize_int (GET_MODE_BITSIZE (p_mode)); } --- 7797,7805 ---- by the smallest integral mode that's valid for pointers. */ if (TREE_CODE (gnu_type) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (gnu_type)) { ! enum machine_mode p_mode = GET_CLASS_NARROWEST_MODE (MODE_INT); ! while (!targetm.valid_pointer_mode (p_mode)) ! p_mode = GET_MODE_WIDER_MODE (p_mode); type_size = bitsize_int (GET_MODE_BITSIZE (p_mode)); } *************** validate_size (Uint uint_size, tree gnu_ *** 7594,7615 **** ("component size for& too small{, minimum allowed is ^}", gnat_error_node, gnat_object, type_size); else ! post_error_ne_tree ("size for& too small{, minimum allowed is ^}", ! gnat_error_node, gnat_object, type_size); ! ! if (kind == VAR_DECL && !component_p ! && TREE_CODE (rm_size (gnu_type)) == INTEGER_CST ! && !tree_int_cst_lt (size, rm_size (gnu_type))) ! post_error_ne_tree_2 ! ("\\size of ^ is not a multiple of alignment (^ bits)", ! gnat_error_node, gnat_object, rm_size (gnu_type), ! TYPE_ALIGN (gnu_type)); ! ! else if (INTEGRAL_TYPE_P (gnu_type)) ! post_error_ne ("\\size would be legal if & were not aliased!", ! gnat_error_node, gnat_object); ! return NULL_TREE; } return size; --- 7814,7824 ---- ("component size for& too small{, minimum allowed is ^}", gnat_error_node, gnat_object, type_size); else ! post_error_ne_tree ! ("size for& too small{, minimum allowed is ^}", ! gnat_error_node, gnat_object, type_size); ! size = NULL_TREE; } return size; *************** validate_size (Uint uint_size, tree gnu_ *** 7621,7636 **** static void set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) { /* Only issue an error if a Value_Size clause was explicitly given. Otherwise, we'd be duplicating an error on the Size clause. */ ! Node_Id gnat_attr_node = Get_Attribute_Definition_Clause (gnat_entity, Attr_Value_Size); - tree old_size = rm_size (gnu_type), size; - - /* Do nothing if no size was specified, either because RM size was not - Present or if the specified size was zero. */ - if (No (uint_size) || uint_size == No_Uint) - return; /* Get the size as a tree. Issue an error if a size was specified but cannot be represented in sizetype. */ --- 7830,7850 ---- static void set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) { + Node_Id gnat_attr_node; + tree old_size, size; + + /* Do nothing if no size was specified. */ + if (uint_size == No_Uint) + return; + + /* Ignore a negative size since that corresponds to our back-annotation. */ + if (UI_Lt (uint_size, Uint_0)) + return; + /* Only issue an error if a Value_Size clause was explicitly given. Otherwise, we'd be duplicating an error on the Size clause. */ ! gnat_attr_node = Get_Attribute_Definition_Clause (gnat_entity, Attr_Value_Size); /* Get the size as a tree. Issue an error if a size was specified but cannot be represented in sizetype. */ *************** set_rm_size (Uint uint_size, tree gnu_ty *** 7643,7659 **** return; } ! /* Ignore a negative size since that corresponds to our back-annotation. ! Also ignore a zero size unless a Value_Size clause exists, or a size ! clause exists, or this is an integer type, in which case the front-end ! will have always set it. */ ! if (tree_int_cst_sgn (size) < 0 ! || (integer_zerop (size) ! && No (gnat_attr_node) ! && !Has_Size_Clause (gnat_entity) ! && !Is_Discrete_Or_Fixed_Point_Type (gnat_entity))) return; /* If the old size is self-referential, get the maximum size. */ if (CONTAINS_PLACEHOLDER_P (old_size)) old_size = max_size (old_size, true); --- 7857,7873 ---- return; } ! /* Ignore a zero size unless a Value_Size clause exists, or a size clause ! exists, or this is an integer type, in which case the front-end will ! have always set it. */ ! if (No (gnat_attr_node) ! && integer_zerop (size) ! && !Has_Size_Clause (gnat_entity) ! && !Is_Discrete_Or_Fixed_Point_Type (gnat_entity)) return; + old_size = rm_size (gnu_type); + /* If the old size is self-referential, get the maximum size. */ if (CONTAINS_PLACEHOLDER_P (old_size)) old_size = max_size (old_size, true); *************** set_rm_size (Uint uint_size, tree gnu_ty *** 7667,7673 **** && TYPE_PACKED_ARRAY_TYPE_P (gnu_type)) && !(TYPE_IS_PADDING_P (gnu_type) && TREE_CODE (TREE_TYPE (TYPE_FIELDS (gnu_type))) == ARRAY_TYPE ! && TYPE_PACKED_ARRAY_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_type)))) && tree_int_cst_lt (size, old_size))) { if (Present (gnat_attr_node)) --- 7881,7888 ---- && TYPE_PACKED_ARRAY_TYPE_P (gnu_type)) && !(TYPE_IS_PADDING_P (gnu_type) && TREE_CODE (TREE_TYPE (TYPE_FIELDS (gnu_type))) == ARRAY_TYPE ! && TYPE_PACKED_ARRAY_TYPE_P ! (TREE_TYPE (TYPE_FIELDS (gnu_type)))) && tree_int_cst_lt (size, old_size))) { if (Present (gnat_attr_node)) *************** make_type_from_size (tree type, tree siz *** 7744,7757 **** SET_TYPE_RM_MAX_VALUE (new_type, convert (TREE_TYPE (new_type), TYPE_MAX_VALUE (type))); ! /* Propagate the name to avoid creating a fake subrange type. */ ! if (TYPE_NAME (type)) ! { ! if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) ! TYPE_NAME (new_type) = DECL_NAME (TYPE_NAME (type)); ! else ! TYPE_NAME (new_type) = TYPE_NAME (type); ! } TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p; SET_TYPE_RM_SIZE (new_type, bitsize_int (size)); return new_type; --- 7959,7967 ---- SET_TYPE_RM_MAX_VALUE (new_type, convert (TREE_TYPE (new_type), TYPE_MAX_VALUE (type))); ! /* Copy the name to show that it's essentially the same type and ! not a subrange type. */ ! TYPE_NAME (new_type) = TYPE_NAME (type); TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p; SET_TYPE_RM_SIZE (new_type, bitsize_int (size)); return new_type; *************** check_ok_for_atomic (tree object, Entity *** 7966,7997 **** gnat_error_point, gnat_entity); } - /* Check if FTYPE1 and FTYPE2, two potentially different function type nodes, - have compatible signatures so that a call using one type may be safely - issued if the actual target function type is the other. Return 1 if it is - the case, 0 otherwise, and post errors on the incompatibilities. ! This is used when an Ada subprogram is mapped onto a GCC builtin, to ensure ! that calls to the subprogram will have arguments suitable for the later ! underlying builtin expansion. */ ! static int ! compatible_signatures_p (tree ftype1, tree ftype2) { ! /* As of now, we only perform very trivial tests and consider it's the ! programmer's responsibility to ensure the type correctness in the Ada ! declaration, as in the regular Import cases. ! Mismatches typically result in either error messages from the builtin ! expander, internal compiler errors, or in a real call sequence. This ! should be refined to issue diagnostics helping error detection and ! correction. */ ! /* Almost fake test, ensuring a use of each argument. */ ! if (ftype1 == ftype2) ! return 1; ! return 1; } /* Return a FIELD_DECL node modeled on OLD_FIELD. FIELD_TYPE is its type --- 8176,8329 ---- gnat_error_point, gnat_entity); } ! /* Helper for the intrin compatibility checks family. Evaluate whether ! two types are definitely incompatible. */ ! static bool ! intrin_types_incompatible_p (tree t1, tree t2) { ! enum tree_code code; ! if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) ! return false; ! if (TYPE_MODE (t1) != TYPE_MODE (t2)) ! return true; ! if (TREE_CODE (t1) != TREE_CODE (t2)) ! return true; ! ! code = TREE_CODE (t1); ! ! switch (code) ! { ! case INTEGER_TYPE: ! case REAL_TYPE: ! return TYPE_PRECISION (t1) != TYPE_PRECISION (t2); ! ! case POINTER_TYPE: ! case REFERENCE_TYPE: ! /* Assume designated types are ok. We'd need to account for char * and ! void * variants to do better, which could rapidly get messy and isn't ! clearly worth the effort. */ ! return false; ! ! default: ! break; ! } ! ! return false; ! } ! ! /* Helper for intrin_profiles_compatible_p, to perform compatibility checks ! on the Ada/builtin argument lists for the INB binding. */ ! ! static bool ! intrin_arglists_compatible_p (intrin_binding_t * inb) ! { ! tree ada_args = TYPE_ARG_TYPES (inb->ada_fntype); ! tree btin_args = TYPE_ARG_TYPES (inb->btin_fntype); ! ! /* Sequence position of the last argument we checked. */ ! int argpos = 0; ! ! while (ada_args != 0 || btin_args != 0) ! { ! tree ada_type, btin_type; ! ! /* If one list is shorter than the other, they fail to match. */ ! if (ada_args == 0 || btin_args == 0) ! return false; ! ! ada_type = TREE_VALUE (ada_args); ! btin_type = TREE_VALUE (btin_args); ! ! /* If we're done with the Ada args and not with the internal builtin ! args, or the other way around, complain. */ ! if (ada_type == void_type_node ! && btin_type != void_type_node) ! { ! post_error ("?Ada arguments list too short!", inb->gnat_entity); ! return false; ! } ! ! if (btin_type == void_type_node ! && ada_type != void_type_node) ! { ! post_error_ne_num ("?Ada arguments list too long ('> ^)!", ! inb->gnat_entity, inb->gnat_entity, argpos); ! return false; ! } ! ! /* Otherwise, check that types match for the current argument. */ ! argpos ++; ! if (intrin_types_incompatible_p (ada_type, btin_type)) ! { ! post_error_ne_num ("?intrinsic binding type mismatch on argument ^!", ! inb->gnat_entity, inb->gnat_entity, argpos); ! return false; ! } ! ! ada_args = TREE_CHAIN (ada_args); ! btin_args = TREE_CHAIN (btin_args); ! } ! ! return true; ! } ! ! /* Helper for intrin_profiles_compatible_p, to perform compatibility checks ! on the Ada/builtin return values for the INB binding. */ ! ! static bool ! intrin_return_compatible_p (intrin_binding_t * inb) ! { ! tree ada_return_type = TREE_TYPE (inb->ada_fntype); ! tree btin_return_type = TREE_TYPE (inb->btin_fntype); ! ! /* Accept function imported as procedure, common and convenient. */ ! if (VOID_TYPE_P (ada_return_type) ! && !VOID_TYPE_P (btin_return_type)) ! return true; ! ! /* Check return types compatibility otherwise. Note that this ! handles void/void as well. */ ! if (intrin_types_incompatible_p (btin_return_type, ada_return_type)) ! { ! post_error ("?intrinsic binding type mismatch on return value!", ! inb->gnat_entity); ! return false; ! } ! ! return true; ! } ! ! /* Check and return whether the Ada and gcc builtin profiles bound by INB are ! compatible. Issue relevant warnings when they are not. ! ! This is intended as a light check to diagnose the most obvious cases, not ! as a full fledged type compatibility predicate. It is the programmer's ! responsibility to ensure correctness of the Ada declarations in Imports, ! especially when binding straight to a compiler internal. */ ! ! static bool ! intrin_profiles_compatible_p (intrin_binding_t * inb) ! { ! /* Check compatibility on return values and argument lists, each responsible ! for posting warnings as appropriate. Ensure use of the proper sloc for ! this purpose. */ ! ! bool arglists_compatible_p, return_compatible_p; ! location_t saved_location = input_location; ! ! Sloc_to_locus (Sloc (inb->gnat_entity), &input_location); ! ! return_compatible_p = intrin_return_compatible_p (inb); ! arglists_compatible_p = intrin_arglists_compatible_p (inb); ! ! input_location = saved_location; ! ! return return_compatible_p && arglists_compatible_p; } /* Return a FIELD_DECL node modeled on OLD_FIELD. FIELD_TYPE is its type *************** compatible_signatures_p (tree ftype1, tr *** 8002,8017 **** static tree create_field_decl_from (tree old_field, tree field_type, tree record_type, ! tree size, tree pos_list, tree subst_list) { tree t = TREE_VALUE (purpose_member (old_field, pos_list)); tree pos = TREE_VEC_ELT (t, 0), bitpos = TREE_VEC_ELT (t, 2); unsigned int offset_align = tree_low_cst (TREE_VEC_ELT (t, 1), 1); tree new_pos, new_field; if (CONTAINS_PLACEHOLDER_P (pos)) ! for (t = subst_list; t; t = TREE_CHAIN (t)) ! pos = SUBSTITUTE_IN_EXPR (pos, TREE_PURPOSE (t), TREE_VALUE (t)); /* If the position is now a constant, we can set it as the position of the field when we make it. Otherwise, we need to deal with it specially. */ --- 8334,8352 ---- static tree create_field_decl_from (tree old_field, tree field_type, tree record_type, ! tree size, tree pos_list, ! VEC(subst_pair,heap) *subst_list) { tree t = TREE_VALUE (purpose_member (old_field, pos_list)); tree pos = TREE_VEC_ELT (t, 0), bitpos = TREE_VEC_ELT (t, 2); unsigned int offset_align = tree_low_cst (TREE_VEC_ELT (t, 1), 1); tree new_pos, new_field; + unsigned ix; + subst_pair *s; if (CONTAINS_PLACEHOLDER_P (pos)) ! FOR_EACH_VEC_ELT_REVERSE (subst_pair, subst_list, ix, s) ! pos = SUBSTITUTE_IN_EXPR (pos, s->discriminant, s->replacement); /* If the position is now a constant, we can set it as the position of the field when we make it. Otherwise, we need to deal with it specially. */ *************** create_field_decl_from (tree old_field, *** 8022,8028 **** new_field = create_field_decl (DECL_NAME (old_field), field_type, record_type, ! DECL_PACKED (old_field), size, new_pos, !DECL_NONADDRESSABLE_P (old_field)); if (!new_pos) --- 8357,8363 ---- new_field = create_field_decl (DECL_NAME (old_field), field_type, record_type, ! size, new_pos, DECL_PACKED (old_field), !DECL_NONADDRESSABLE_P (old_field)); if (!new_pos) *************** create_field_decl_from (tree old_field, *** 8039,8046 **** } DECL_INTERNAL_P (new_field) = DECL_INTERNAL_P (old_field); ! t = DECL_ORIGINAL_FIELD (old_field); ! SET_DECL_ORIGINAL_FIELD (new_field, t ? t : old_field); DECL_DISCRIMINANT_NUMBER (new_field) = DECL_DISCRIMINANT_NUMBER (old_field); TREE_THIS_VOLATILE (new_field) = TREE_THIS_VOLATILE (old_field); --- 8374,8380 ---- } DECL_INTERNAL_P (new_field) = DECL_INTERNAL_P (old_field); ! SET_DECL_ORIGINAL_FIELD_TO_FIELD (new_field, old_field); DECL_DISCRIMINANT_NUMBER (new_field) = DECL_DISCRIMINANT_NUMBER (old_field); TREE_THIS_VOLATILE (new_field) = TREE_THIS_VOLATILE (old_field); *************** get_variant_part (tree record_type) *** 8072,8078 **** tree field; /* The variant part is the only internal field that is a qualified union. */ ! for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field)) if (DECL_INTERNAL_P (field) && TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE) return field; --- 8406,8412 ---- tree field; /* The variant part is the only internal field that is a qualified union. */ ! for (field = TYPE_FIELDS (record_type); field; field = DECL_CHAIN (field)) if (DECL_INTERNAL_P (field) && TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE) return field; *************** get_variant_part (tree record_type) *** 8087,8100 **** layout. */ static tree ! create_variant_part_from (tree old_variant_part, tree variant_list, ! tree record_type, tree pos_list, tree subst_list) { tree offset = DECL_FIELD_OFFSET (old_variant_part); - tree bitpos = DECL_FIELD_BIT_OFFSET (old_variant_part); tree old_union_type = TREE_TYPE (old_variant_part); ! tree new_union_type, new_variant_part, t; tree union_field_list = NULL_TREE; /* First create the type of the variant part from that of the old one. */ new_union_type = make_node (QUAL_UNION_TYPE); --- 8421,8437 ---- layout. */ static tree ! create_variant_part_from (tree old_variant_part, ! VEC(variant_desc,heap) *variant_list, ! tree record_type, tree pos_list, ! VEC(subst_pair,heap) *subst_list) { tree offset = DECL_FIELD_OFFSET (old_variant_part); tree old_union_type = TREE_TYPE (old_variant_part); ! tree new_union_type, new_variant_part; tree union_field_list = NULL_TREE; + variant_desc *v; + unsigned ix; /* First create the type of the variant part from that of the old one. */ new_union_type = make_node (QUAL_UNION_TYPE); *************** create_variant_part_from (tree old_varia *** 8103,8110 **** /* If the position of the variant part is constant, subtract it from the size of the type of the parent to get the new size. This manual CSE reduces the code size when not optimizing. */ ! if (TREE_CODE (offset) == INTEGER_CST && TREE_CODE (bitpos) == INTEGER_CST) { tree first_bit = bit_from_pos (offset, bitpos); TYPE_SIZE (new_union_type) = size_binop (MINUS_EXPR, TYPE_SIZE (record_type), first_bit); --- 8440,8448 ---- /* If the position of the variant part is constant, subtract it from the size of the type of the parent to get the new size. This manual CSE reduces the code size when not optimizing. */ ! if (TREE_CODE (offset) == INTEGER_CST) { + tree bitpos = DECL_FIELD_BIT_OFFSET (old_variant_part); tree first_bit = bit_from_pos (offset, bitpos); TYPE_SIZE (new_union_type) = size_binop (MINUS_EXPR, TYPE_SIZE (record_type), first_bit); *************** create_variant_part_from (tree old_varia *** 8121,8129 **** copy_and_substitute_in_size (new_union_type, old_union_type, subst_list); /* Now finish up the new variants and populate the union type. */ ! for (t = variant_list; t; t = TREE_CHAIN (t)) { ! tree old_field = TREE_VEC_ELT (TREE_VALUE (t), 0), new_field; tree old_variant, old_variant_subpart, new_variant, field_list; /* Skip variants that don't belong to this nesting level. */ --- 8459,8467 ---- copy_and_substitute_in_size (new_union_type, old_union_type, subst_list); /* Now finish up the new variants and populate the union type. */ ! FOR_EACH_VEC_ELT_REVERSE (variant_desc, variant_list, ix, v) { ! tree old_field = v->field, new_field; tree old_variant, old_variant_subpart, new_variant, field_list; /* Skip variants that don't belong to this nesting level. */ *************** create_variant_part_from (tree old_varia *** 8131,8149 **** continue; /* Retrieve the list of fields already added to the new variant. */ ! new_variant = TREE_VEC_ELT (TREE_VALUE (t), 2); field_list = TYPE_FIELDS (new_variant); /* If the old variant had a variant subpart, we need to create a new variant subpart and add it to the field list. */ ! old_variant = TREE_PURPOSE (t); old_variant_subpart = get_variant_part (old_variant); if (old_variant_subpart) { tree new_variant_subpart = create_variant_part_from (old_variant_subpart, variant_list, new_variant, pos_list, subst_list); ! TREE_CHAIN (new_variant_subpart) = field_list; field_list = new_variant_subpart; } --- 8469,8487 ---- continue; /* Retrieve the list of fields already added to the new variant. */ ! new_variant = v->record; field_list = TYPE_FIELDS (new_variant); /* If the old variant had a variant subpart, we need to create a new variant subpart and add it to the field list. */ ! old_variant = v->type; old_variant_subpart = get_variant_part (old_variant); if (old_variant_subpart) { tree new_variant_subpart = create_variant_part_from (old_variant_subpart, variant_list, new_variant, pos_list, subst_list); ! DECL_CHAIN (new_variant_subpart) = field_list; field_list = new_variant_subpart; } *************** create_variant_part_from (tree old_varia *** 8158,8166 **** = create_field_decl_from (old_field, new_variant, new_union_type, TYPE_SIZE (new_variant), pos_list, subst_list); ! DECL_QUALIFIER (new_field) = TREE_VEC_ELT (TREE_VALUE (t), 1); DECL_INTERNAL_P (new_field) = 1; ! TREE_CHAIN (new_field) = union_field_list; union_field_list = new_field; } --- 8496,8504 ---- = create_field_decl_from (old_field, new_variant, new_union_type, TYPE_SIZE (new_variant), pos_list, subst_list); ! DECL_QUALIFIER (new_field) = v->qual; DECL_INTERNAL_P (new_field) = 1; ! DECL_CHAIN (new_field) = union_field_list; union_field_list = new_field; } *************** create_variant_part_from (tree old_varia *** 8181,8187 **** statically selected while outer ones are not; in this case, the list of fields of the inner variant is not flattened and we end up with a qualified union with a single member. Drop the useless container. */ ! if (!TREE_CHAIN (union_field_list)) { DECL_CONTEXT (union_field_list) = record_type; DECL_FIELD_OFFSET (union_field_list) --- 8519,8525 ---- statically selected while outer ones are not; in this case, the list of fields of the inner variant is not flattened and we end up with a qualified union with a single member. Drop the useless container. */ ! if (!DECL_CHAIN (union_field_list)) { DECL_CONTEXT (union_field_list) = record_type; DECL_FIELD_OFFSET (union_field_list) *************** create_variant_part_from (tree old_varia *** 8201,8209 **** in SUBST_LIST. */ static void ! copy_and_substitute_in_size (tree new_type, tree old_type, tree subst_list) { ! tree t; TYPE_SIZE (new_type) = TYPE_SIZE (old_type); TYPE_SIZE_UNIT (new_type) = TYPE_SIZE_UNIT (old_type); --- 8539,8549 ---- in SUBST_LIST. */ static void ! copy_and_substitute_in_size (tree new_type, tree old_type, ! VEC(subst_pair,heap) *subst_list) { ! unsigned ix; ! subst_pair *s; TYPE_SIZE (new_type) = TYPE_SIZE (old_type); TYPE_SIZE_UNIT (new_type) = TYPE_SIZE_UNIT (old_type); *************** copy_and_substitute_in_size (tree new_ty *** 8212,8236 **** relate_alias_sets (new_type, old_type, ALIAS_SET_COPY); if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (new_type))) ! for (t = subst_list; t; t = TREE_CHAIN (t)) TYPE_SIZE (new_type) = SUBSTITUTE_IN_EXPR (TYPE_SIZE (new_type), ! TREE_PURPOSE (t), ! TREE_VALUE (t)); if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE_UNIT (new_type))) ! for (t = subst_list; t; t = TREE_CHAIN (t)) TYPE_SIZE_UNIT (new_type) = SUBSTITUTE_IN_EXPR (TYPE_SIZE_UNIT (new_type), ! TREE_PURPOSE (t), ! TREE_VALUE (t)); if (CONTAINS_PLACEHOLDER_P (TYPE_ADA_SIZE (new_type))) ! for (t = subst_list; t; t = TREE_CHAIN (t)) SET_TYPE_ADA_SIZE (new_type, SUBSTITUTE_IN_EXPR (TYPE_ADA_SIZE (new_type), ! TREE_PURPOSE (t), ! TREE_VALUE (t))); /* Finalize the size. */ TYPE_SIZE (new_type) = variable_size (TYPE_SIZE (new_type)); --- 8552,8573 ---- relate_alias_sets (new_type, old_type, ALIAS_SET_COPY); if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (new_type))) ! FOR_EACH_VEC_ELT_REVERSE (subst_pair, subst_list, ix, s) TYPE_SIZE (new_type) = SUBSTITUTE_IN_EXPR (TYPE_SIZE (new_type), ! s->discriminant, s->replacement); if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE_UNIT (new_type))) ! FOR_EACH_VEC_ELT_REVERSE (subst_pair, subst_list, ix, s) TYPE_SIZE_UNIT (new_type) = SUBSTITUTE_IN_EXPR (TYPE_SIZE_UNIT (new_type), ! s->discriminant, s->replacement); if (CONTAINS_PLACEHOLDER_P (TYPE_ADA_SIZE (new_type))) ! FOR_EACH_VEC_ELT_REVERSE (subst_pair, subst_list, ix, s) SET_TYPE_ADA_SIZE (new_type, SUBSTITUTE_IN_EXPR (TYPE_ADA_SIZE (new_type), ! s->discriminant, s->replacement)); /* Finalize the size. */ TYPE_SIZE (new_type) = variable_size (TYPE_SIZE (new_type)); *************** substitute_in_type (tree t, tree f, tree *** 8306,8315 **** return build_complex_type (nt); - case OFFSET_TYPE: - case METHOD_TYPE: case FUNCTION_TYPE: - case LANG_TYPE: /* These should never show up here. */ gcc_unreachable (); --- 8643,8649 ---- *************** substitute_in_type (tree t, tree f, tree *** 8321,8327 **** if (component == TREE_TYPE (t) && domain == TYPE_DOMAIN (t)) return t; ! nt = build_array_type (component, domain); TYPE_ALIGN (nt) = TYPE_ALIGN (t); TYPE_USER_ALIGN (nt) = TYPE_USER_ALIGN (t); SET_TYPE_MODE (nt, TYPE_MODE (t)); --- 8655,8661 ---- if (component == TREE_TYPE (t) && domain == TYPE_DOMAIN (t)) return t; ! nt = build_nonshared_array_type (component, domain); TYPE_ALIGN (nt) = TYPE_ALIGN (t); TYPE_USER_ALIGN (nt) = TYPE_USER_ALIGN (t); SET_TYPE_MODE (nt, TYPE_MODE (t)); *************** substitute_in_type (tree t, tree f, tree *** 8346,8352 **** nt = copy_type (t); TYPE_FIELDS (nt) = NULL_TREE; ! for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field)) { tree new_field = copy_node (field), new_n; --- 8680,8686 ---- nt = copy_type (t); TYPE_FIELDS (nt) = NULL_TREE; ! for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field)) { tree new_field = copy_node (field), new_n; *************** substitute_in_type (tree t, tree f, tree *** 8376,8386 **** } DECL_CONTEXT (new_field) = nt; ! SET_DECL_ORIGINAL_FIELD (new_field, ! (DECL_ORIGINAL_FIELD (field) ! ? DECL_ORIGINAL_FIELD (field) : field)); ! TREE_CHAIN (new_field) = TYPE_FIELDS (nt); TYPE_FIELDS (nt) = new_field; } --- 8710,8718 ---- } DECL_CONTEXT (new_field) = nt; ! SET_DECL_ORIGINAL_FIELD_TO_FIELD (new_field, field); ! DECL_CHAIN (new_field) = TYPE_FIELDS (nt); TYPE_FIELDS (nt) = new_field; } *************** rm_size (tree gnu_type) *** 8414,8420 **** && TYPE_CONTAINS_TEMPLATE_P (gnu_type)) return size_binop (PLUS_EXPR, ! rm_size (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_type)))), DECL_SIZE (TYPE_FIELDS (gnu_type))); /* For record types, we store the size explicitly. */ --- 8746,8752 ---- && TYPE_CONTAINS_TEMPLATE_P (gnu_type)) return size_binop (PLUS_EXPR, ! rm_size (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_type)))), DECL_SIZE (TYPE_FIELDS (gnu_type))); /* For record types, we store the size explicitly. */ diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/gadaint.h gcc-4.6.0/gcc/ada/gcc-interface/gadaint.h *** gcc-4.5.2/gcc/ada/gcc-interface/gadaint.h Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/gcc-interface/gadaint.h Wed Apr 14 08:14:54 2010 *************** *** 0 **** --- 1,35 ---- + /**************************************************************************** + * * + * GNAT COMPILER COMPONENTS * + * * + * G A D A I N T * + * * + * C Header File * + * * + * Copyright (C) 2010, 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 see * + * . * + * * + * GNAT was originally developed by the GNAT team at New York University. * + * Extensive contributions were provided by Ada Core Technologies Inc. * + * * + ****************************************************************************/ + + /* This file contains the declarations of adaint.c material used in gigi. + It should be used in lieu of adaint.h in gigi because the latter drags + a lot of stuff on Windows and this pollutes the namespace of macros. */ + + #ifndef GCC_ADAINT_H + #define GCC_ADAINT_H + + extern char *__gnat_to_canonical_file_spec (char *); + + #endif /* GCC_ADAINT_H */ diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/gigi.h gcc-4.6.0/gcc/ada/gcc-interface/gigi.h *** gcc-4.5.2/gcc/ada/gcc-interface/gigi.h Tue Nov 24 20:25:58 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/gigi.h Thu Feb 3 13:19:38 2011 *************** *** 6,12 **** * * * C Header File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2011, 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- * *************** extern void rest_of_type_decl_compilatio *** 57,68 **** /* Start a new statement group chained to the previous group. */ extern void start_stmt_group (void); ! /* Add GNU_STMT to the current BLOCK_STMT node. */ extern void add_stmt (tree gnu_stmt); ! /* Similar, but set the location of GNU_STMT to that of GNAT_NODE. */ extern void add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node); /* Return code corresponding to the current code group. It is normally a STATEMENT_LIST, but may also be a BIND_EXPR or TRY_FINALLY_EXPR if BLOCK or cleanups were set. */ --- 57,75 ---- /* Start a new statement group chained to the previous group. */ extern void start_stmt_group (void); ! /* Add GNU_STMT to the current statement group. If it is an expression with ! no effects, it is ignored. */ extern void add_stmt (tree gnu_stmt); ! /* Similar, but the statement is always added, regardless of side-effects. */ ! extern void add_stmt_force (tree gnu_stmt); ! ! /* Like add_stmt, but set the location of GNU_STMT to that of GNAT_NODE. */ extern void add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node); + /* Similar, but the statement is always added, regardless of side-effects. */ + extern void add_stmt_with_node_force (tree gnu_stmt, Node_Id gnat_node); + /* Return code corresponding to the current code group. It is normally a STATEMENT_LIST, but may also be a BIND_EXPR or TRY_FINALLY_EXPR if BLOCK or cleanups were set. */ *************** extern void mark_visited (tree t); *** 85,91 **** #define MARK_VISITED(EXP) \ do { \ ! if((EXP) && !TREE_CONSTANT (EXP)) \ mark_visited (EXP); \ } while (0) --- 92,98 ---- #define MARK_VISITED(EXP) \ do { \ ! if((EXP) && !CONSTANT_CLASS_P (EXP)) \ mark_visited (EXP); \ } while (0) *************** extern void mark_out_of_scope (Entity_Id *** 112,120 **** /* Get the unpadded version of a GNAT type. */ extern tree get_unpadded_type (Entity_Id gnat_entity); - /* Called when we need to protect a variable object using a save_expr. */ - extern tree maybe_variable (tree gnu_operand); - /* Create a record type that contains a SIZE bytes long field of TYPE with a starting bit position so that it is aligned to ALIGN bits, and leaving at least ROOM bytes free before the field. BASE_ALIGN is the alignment the --- 119,124 ---- *************** extern tree choices_to_gnu (tree operand *** 142,150 **** /* Given GNAT_ENTITY, an object (constant, variable, parameter, exception) and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null. ! BY_REF is true if the object is used by reference. */ extern void annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, ! bool by_ref); /* Given a type T, a FIELD_DECL F, and a replacement value R, return a new type with all size expressions that contain F updated by replacing F --- 146,155 ---- /* Given GNAT_ENTITY, an object (constant, variable, parameter, exception) and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null. ! BY_REF is true if the object is used by reference and BY_DOUBLE_REF is ! true if the object is used by double reference. */ extern void annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, ! bool by_ref, bool by_double_ref); /* Given a type T, a FIELD_DECL F, and a replacement value R, return a new type with all size expressions that contain F updated by replacing F *************** extern tree create_concat_name (Entity_I *** 171,182 **** the name followed by "___" and the specified suffix. */ extern tree concat_name (tree gnu_name, const char *suffix); ! /* If true, then gigi is being called on an analyzed but unexpanded tree, and ! the only purpose of the call is to properly annotate types with ! representation information. */ extern bool type_annotate_only; ! /* Current file name without path */ extern const char *ref_filename; /* This structure must be kept synchronized with Call_Back_End. */ --- 176,193 ---- the name followed by "___" and the specified suffix. */ extern tree concat_name (tree gnu_name, const char *suffix); ! /* Highest number in the front-end node table. */ ! extern int max_gnat_nodes; ! ! /* Current node being treated, in case abort called. */ ! extern Node_Id error_gnat_node; ! ! /* True when gigi is being called on an analyzed but unexpanded ! tree, and the only purpose of the call is to properly annotate ! types with representation information. */ extern bool type_annotate_only; ! /* Current file name without path. */ extern const char *ref_filename; /* This structure must be kept synchronized with Call_Back_End. */ *************** struct File_Info_Type *** 187,197 **** }; /* This is the main program of the back-end. It sets up all the table ! structures and then generates code. ! ! ??? Needs parameter descriptions */ ! ! extern void gigi (Node_Id gnat_root, int max_gnat_node, int number_name, struct Node *nodes_ptr, Node_Id *next_node_ptr, Node_Id *prev_node_ptr, struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr, --- 198,206 ---- }; /* This is the main program of the back-end. It sets up all the table ! structures and then generates code. */ ! extern void gigi (Node_Id gnat_root, int max_gnat_node, ! int number_name ATTRIBUTE_UNUSED, struct Node *nodes_ptr, Node_Id *next_node_ptr, Node_Id *prev_node_ptr, struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr, *************** extern void gigi (Node_Id gnat_root, int *** 202,207 **** --- 211,217 ---- struct File_Info_Type *file_info_ptr, Entity_Id standard_boolean, Entity_Id standard_integer, + Entity_Id standard_character, Entity_Id standard_long_long_float, Entity_Id standard_exception_type, Int gigi_operating_mode); *************** extern bool Sloc_to_locus (Source_Ptr Sl *** 231,280 **** /* Post an error message. MSG is the error message, properly annotated. NODE is the node at which to post the error and the node to use for the ! "&" substitution. */ extern void post_error (const char *msg, Node_Id node); ! /* Similar, but NODE is the node at which to post the error and ENT ! is the node to use for the "&" substitution. */ extern void post_error_ne (const char *msg, Node_Id node, Entity_Id ent); ! /* Similar, but NODE is the node at which to post the error, ENT is the node ! to use for the "&" substitution, and N is the number to use for the ^. */ extern void post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, ! int n); ! /* Similar to post_error_ne_num, but T is a GCC tree representing the number ! to write. If the tree represents a constant that fits within a ! host integer, the text inside curly brackets in MSG will be output ! (presumably including a '^'). Otherwise that text will not be output ! and the text inside square brackets will be output instead. */ extern void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t); ! /* Similar to post_error_ne_tree, except that NUM is a second ! integer to write in the message. */ extern void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t, int num); - /* Protect EXP from multiple evaluation. This may make a SAVE_EXPR. */ - extern tree protect_multiple_eval (tree exp); - /* Return a label to branch to for the exception type in KIND or NULL_TREE if none. */ extern tree get_exception_label (char kind); ! /* Current node being treated, in case gigi_abort or Check_Elaboration_Code ! called. */ ! extern Node_Id error_gnat_node; ! ! /* This is equivalent to stabilize_reference in tree.c, but we know how to ! handle our own nodes and we take extra arguments. FORCE says whether to ! force evaluation of everything. We set SUCCESS to true unless we walk ! through something we don't know how to stabilize. */ ! extern tree maybe_stabilize_reference (tree ref, bool force, bool *success); ! ! /* Highest number in the front-end node table. */ ! extern int max_gnat_nodes; /* If nonzero, pretend we are allocating at global level. */ extern int force_global; --- 241,274 ---- /* Post an error message. MSG is the error message, properly annotated. NODE is the node at which to post the error and the node to use for the ! '&' substitution. */ extern void post_error (const char *msg, Node_Id node); ! /* Similar to post_error, but NODE is the node at which to post the error and ! ENT is the node to use for the '&' substitution. */ extern void post_error_ne (const char *msg, Node_Id node, Entity_Id ent); ! /* Similar to post_error_ne, but NUM is the number to use for the '^'. */ extern void post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, ! int num); ! /* Similar to post_error_ne, but T is a GCC tree representing the number to ! write. If T represents a constant, the text inside curly brackets in ! MSG will be output (presumably including a '^'). Otherwise it will not ! be output and the text inside square brackets will be output instead. */ extern void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t); ! /* Similar to post_error_ne_tree, but NUM is a second integer to write. */ extern void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t, int num); /* Return a label to branch to for the exception type in KIND or NULL_TREE if none. */ extern tree get_exception_label (char kind); ! /* Return the decl for the current elaboration procedure. */ ! extern tree get_elaboration_procedure (void); /* If nonzero, pretend we are allocating at global level. */ extern int force_global; *************** extern int double_float_alignment; *** 288,332 **** types whose size is greater or equal to 64 bits, or 0 if this alignment is not specifically capped. */ extern int double_scalar_alignment; - - /* Standard data type sizes. Most of these are not used. */ - - #ifndef CHAR_TYPE_SIZE - #define CHAR_TYPE_SIZE BITS_PER_UNIT - #endif - - #ifndef SHORT_TYPE_SIZE - #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) - #endif - - #ifndef INT_TYPE_SIZE - #define INT_TYPE_SIZE BITS_PER_WORD - #endif - - #ifndef LONG_TYPE_SIZE - #define LONG_TYPE_SIZE BITS_PER_WORD - #endif - - #ifndef LONG_LONG_TYPE_SIZE - #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) - #endif - - #ifndef FLOAT_TYPE_SIZE - #define FLOAT_TYPE_SIZE BITS_PER_WORD - #endif - - #ifndef DOUBLE_TYPE_SIZE - #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) - #endif - - #ifndef LONG_DOUBLE_TYPE_SIZE - #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) - #endif - - /* The choice of SIZE_TYPE here is very problematic. We need a signed - type whose bit width is Pmode. Assume "long" is such a type here. */ - #undef SIZE_TYPE - #define SIZE_TYPE "long int" /* Data structures used to represent attributes. */ --- 282,287 ---- *************** enum standard_datatypes *** 374,382 **** /* 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. */ --- 329,343 ---- /* Type declaration node <==> typedef virtual void *T() */ ADT_fdesc_type, ! /* Null pointer for above type. */ ADT_null_fdesc, + /* Value 1 in signed bitsizetype. */ + ADT_sbitsize_one_node, + + /* Value BITS_PER_UNIT in signed bitsizetype. */ + ADT_sbitsize_unit_node, + /* 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. */ *************** enum standard_datatypes *** 386,394 **** /* Likewise for freeing memory. */ ADT_free_decl, ! /* Function decl node for 64-bit multiplication with overflow checking */ ADT_mulv64_decl, /* Types and decls used by our temporary exception mechanism. See init_gigi_decls for details. */ ADT_jmpbuf_type, --- 347,361 ---- /* Likewise for freeing memory. */ ADT_free_decl, ! /* Function decl node for 64-bit multiplication with overflow checking. */ ADT_mulv64_decl, + /* Identifier for the name of the _Parent field in tagged record types. */ + ADT_parent_name_id, + + /* Identifier for the name of the Exception_Data type. */ + ADT_exception_data_name_id, + /* Types and decls used by our temporary exception mechanism. See init_gigi_decls for details. */ ADT_jmpbuf_type, *************** enum standard_datatypes *** 406,413 **** --- 373,392 ---- ADT_all_others_decl, ADT_LAST}; + /* Define kind of exception information associated with raise statements. */ + enum exception_info_kind + { + /* Simple exception information: file:line. */ + exception_simple, + /* Range exception information: file:line + index, first, last. */ + exception_range, + /* Column exception information: file:line:column. */ + exception_column + }; + extern GTY(()) tree gnat_std_decls[(int) ADT_LAST]; extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; + extern GTY(()) tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1]; #define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type] #define except_type_node gnat_std_decls[(int) ADT_except_type] *************** extern GTY(()) tree gnat_raise_decls[(in *** 416,425 **** --- 395,408 ---- #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 sbitsize_one_node gnat_std_decls[(int) ADT_sbitsize_one_node] + #define sbitsize_unit_node gnat_std_decls[(int) ADT_sbitsize_unit_node] #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 mulv64_decl gnat_std_decls[(int) ADT_mulv64_decl] + #define parent_name_id gnat_std_decls[(int) ADT_parent_name_id] + #define exception_data_name_id gnat_std_decls[(int) ADT_exception_data_name_id] #define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type] #define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type] #define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl] *************** extern int global_bindings_p (void); *** 443,448 **** --- 426,432 ---- /* Enter and exit a new binding level. */ extern void gnat_pushlevel (void); extern void gnat_poplevel (void); + extern void gnat_zaplevel (void); /* Set SUPERCONTEXT of the BLOCK for the current binding level to FNDECL and point FNDECL to this BLOCK. */ *************** extern tree get_block_jmpbuf_decl (void) *** 458,464 **** and uses GNAT_NODE for location information. */ extern void gnat_pushdecl (tree decl, Node_Id gnat_node); - extern void gnat_init_decl_processing (void); extern void gnat_init_gcc_eh (void); extern void gnat_install_builtins (void); --- 442,447 ---- *************** extern tree gnat_signed_type (tree type_ *** 484,489 **** --- 467,475 ---- transparently converted to each other. */ extern int gnat_types_compatible_p (tree t1, tree t2); + /* Return true if T, a FUNCTION_TYPE, has the specified list of flags. */ + extern bool fntype_same_flags_p (const_tree, tree, bool, bool, bool); + /* 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 *************** extern void rest_of_record_type_compilat *** 542,563 **** /* Append PARALLEL_TYPE on the chain of parallel types for decl. */ extern void add_parallel_type (tree decl, tree parallel_type); ! /* Return the parallel type associated to a type, if any. */ ! extern tree get_parallel_type (tree type); ! ! /* Returns a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the ! subprogram. If it is void_type_node, then we are dealing with a procedure, ! 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_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_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_by_target_ptr); /* Return a copy of TYPE, but safe to modify in any way. */ extern tree copy_type (tree type); --- 528,546 ---- /* Append PARALLEL_TYPE on the chain of parallel types for decl. */ extern void add_parallel_type (tree decl, tree parallel_type); ! /* Return a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the ! subprogram. If it is VOID_TYPE, then we are dealing with a procedure, ! otherwise we are dealing with a function. PARAM_DECL_LIST is a list of ! PARM_DECL nodes that are the subprogram parameters. CICO_LIST is the ! copy-in/copy-out list to be stored into the TYPE_CICO_LIST field. ! RETURN_UNCONSTRAINED_P is true if the function returns an unconstrained ! object. RETURN_BY_DIRECT_REF_P is true if the function returns by direct ! reference. RETURN_BY_INVISI_REF_P is true if the function returns by ! invisible reference. */ extern tree create_subprog_type (tree return_type, tree param_decl_list, ! tree cico_list, bool return_unconstrained_p, ! bool return_by_direct_ref_p, ! bool return_by_invisi_ref_p); /* Return a copy of TYPE, but safe to modify in any way. */ extern tree copy_type (tree type); *************** create_var_decl_1 (tree var_name, tree a *** 633,641 **** const_flag, public_flag, extern_flag, \ static_flag, false, attr_list, gnat_node) - /* Given a DECL and ATTR_LIST, apply the listed attributes. */ - extern void process_attributes (tree decl, struct attrib *attr_list); - /* Record DECL as a global renaming pointer. */ extern void record_global_renaming_pointer (tree decl); --- 616,621 ---- *************** extern void record_global_renaming_point *** 643,657 **** extern void invalidate_global_renaming_pointers (void); /* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is ! its type and RECORD_TYPE is the type of the enclosing record. PACKED is ! 1 if the enclosing record is packed, -1 if it has Component_Alignment of ! Storage_Unit. If SIZE is nonzero, it is the specified size of the field. ! If POS is nonzero, it is the bit position. If ADDRESSABLE is nonzero, it means we are allowed to take the address of the field; if it is negative, we should not make a bitfield, which is used by make_aligning_type. */ extern tree create_field_decl (tree field_name, tree field_type, ! tree record_type, int packed, tree size, ! tree pos, int addressable); /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter, PARAM_TYPE is its type. READONLY is true if the parameter is --- 623,637 ---- extern void invalidate_global_renaming_pointers (void); /* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is ! its type and RECORD_TYPE is the type of the enclosing record. If SIZE is ! nonzero, it is the specified size of the field. If POS is nonzero, it is ! the bit position. PACKED is 1 if the enclosing record is packed, -1 if it ! has Component_Alignment of Storage_Unit. If ADDRESSABLE is nonzero, it means we are allowed to take the address of the field; if it is negative, we should not make a bitfield, which is used by make_aligning_type. */ extern tree create_field_decl (tree field_name, tree field_type, ! tree record_type, tree size, tree pos, ! int packed, int addressable); /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter, PARAM_TYPE is its type. READONLY is true if the parameter is *************** extern tree build_vms_descriptor32 (tree *** 706,724 **** and the GNAT node GNAT_SUBPROG. */ extern void build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog); ! /* Build a type to be used to represent an aliased object whose nominal ! type is an unconstrained array. This consists of a RECORD_TYPE containing ! a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ! ARRAY_TYPE. If ARRAY_TYPE is that of the unconstrained array, this ! is used to represent an arbitrary unconstrained object. Use NAME ! as the name of the record. */ extern tree build_unc_object_type (tree template_type, tree object_type, ! tree name); /* Same as build_unc_object_type, but taking a thin or fat pointer type instead of the template type. */ extern tree build_unc_object_type_from_ptr (tree thin_fat_ptr_type, ! tree object_type, tree name); /* Shift the component offsets within an unconstrained object TYPE to make it suitable for use as a designated type for thin pointers. */ --- 686,705 ---- and the GNAT node GNAT_SUBPROG. */ extern void build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog); ! /* Build a type to be used to represent an aliased object whose nominal type ! is an unconstrained array. This consists of a RECORD_TYPE containing a ! field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE. ! If ARRAY_TYPE is that of an unconstrained array, this is used to represent ! an arbitrary unconstrained object. Use NAME as the name of the record. ! DEBUG_INFO_P is true if we need to write debug information for the type. */ extern tree build_unc_object_type (tree template_type, tree object_type, ! tree name, bool debug_info_p); /* Same as build_unc_object_type, but taking a thin or fat pointer type instead of the template type. */ extern tree build_unc_object_type_from_ptr (tree thin_fat_ptr_type, ! tree object_type, tree name, ! bool debug_info_p); /* Shift the component offsets within an unconstrained object TYPE to make it suitable for use as a designated type for thin pointers. */ *************** extern tree build_unary_op (enum tree_co *** 803,810 **** extern tree build_cond_expr (tree result_type, tree condition_operand, tree true_operand, tree false_operand); /* Similar, but for RETURN_EXPR. */ ! extern tree build_return_expr (tree result_decl, tree ret_val); /* Build a CALL_EXPR to call FUNDECL with one argument, ARG. Return the CALL_EXPR. */ --- 784,796 ---- extern tree build_cond_expr (tree result_type, tree condition_operand, tree true_operand, tree false_operand); + /* Similar, but for COMPOUND_EXPR. */ + + extern tree build_compound_expr (tree result_type, tree stmt_operand, + tree expr_operand); + /* Similar, but for RETURN_EXPR. */ ! extern tree build_return_expr (tree ret_obj, tree ret_val); /* Build a CALL_EXPR to call FUNDECL with one argument, ARG. Return the CALL_EXPR. */ *************** extern tree build_call_0_expr (tree fund *** 828,836 **** (N_Raise_{Constraint,Storage,Program}_Error). */ extern tree build_call_raise (int msg, Node_Id gnat_node, char kind); ! /* Return a CONSTRUCTOR of TYPE whose list is LIST. This is not the same as build_constructor in the language-independent tree.c. */ ! extern tree gnat_build_constructor (tree type, tree list); /* Return a COMPONENT_REF to access a field that is given by COMPONENT, an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL, --- 814,832 ---- (N_Raise_{Constraint,Storage,Program}_Error). */ extern tree build_call_raise (int msg, Node_Id gnat_node, char kind); ! /* Similar to build_call_raise, for an index or range check exception as ! determined by MSG, with extra information generated of the form ! "INDEX out of range FIRST..LAST". */ ! extern tree build_call_raise_range (int msg, Node_Id gnat_node, ! tree index, tree first, tree last); ! ! /* Similar to build_call_raise, with extra information about the column ! where the check failed. */ ! extern tree build_call_raise_column (int msg, Node_Id gnat_node); ! ! /* Return a CONSTRUCTOR of TYPE whose elements are V. This is not the same as build_constructor in the language-independent tree.c. */ ! extern tree gnat_build_constructor (tree type, VEC(constructor_elt,gc) *v); /* Return a COMPONENT_REF to access a field that is given by COMPONENT, an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL, *************** extern tree build_allocator (tree type, *** 865,879 **** Entity_Id gnat_proc, Entity_Id gnat_pool, Node_Id gnat_node, bool); ! /* Fill in a VMS descriptor for EXPR and return a constructor for it. ! GNAT_FORMAL is how we find the descriptor record. GNAT_ACTUAL is how ! we derive the source location on a C_E */ ! extern tree fill_vms_descriptor (tree expr, Entity_Id gnat_formal, Node_Id gnat_actual); ! /* Indicate that we need to make the address of EXPR_NODE and it therefore ! should not be allocated in a register. Return true if successful. */ ! extern bool gnat_mark_addressable (tree expr_node); /* Implementation of the builtin_function langhook. */ extern tree gnat_builtin_function (tree decl); --- 861,889 ---- Entity_Id gnat_proc, Entity_Id gnat_pool, Node_Id gnat_node, bool); ! /* Fill in a VMS descriptor of GNU_TYPE for GNU_EXPR and return the result. ! GNAT_ACTUAL is the actual parameter for which the descriptor is built. */ ! extern tree fill_vms_descriptor (tree gnu_type, tree gnu_expr, Node_Id gnat_actual); ! /* Indicate that we need to take the address of T and that it therefore ! should not be allocated in a register. Returns true if successful. */ ! extern bool gnat_mark_addressable (tree t); ! ! /* Save EXP for later use or reuse. This is equivalent to save_expr in tree.c ! but we know how to handle our own nodes. */ ! extern tree gnat_save_expr (tree exp); ! ! /* Protect EXP for immediate reuse. This is a variant of gnat_save_expr that ! is optimized under the assumption that EXP's value doesn't change before ! its subsequent reuse(s) except through its potential reevaluation. */ ! extern tree gnat_protect_expr (tree exp); ! ! /* This is equivalent to stabilize_reference in tree.c but we know how to ! handle our own nodes and we take extra arguments. FORCE says whether to ! force evaluation of everything. We set SUCCESS to true unless we walk ! through something we don't know how to stabilize. */ ! extern tree gnat_stabilize_reference (tree ref, bool force, bool *success); /* Implementation of the builtin_function langhook. */ extern tree gnat_builtin_function (tree decl); *************** extern bool default_pass_by_ref (tree gn *** 891,910 **** if it should be passed by reference. */ extern bool must_pass_by_ref (tree gnu_type); - /* This function is called by the front end to enumerate all the supported - modes for the machine. We pass a function which is called back with - the following integer parameters: - - FLOAT_P nonzero if this represents a floating-point mode - COMPLEX_P nonzero is this represents a complex mode - COUNT count of number of items, nonzero for vector mode - PRECISION number of bits in data representation - MANTISSA number of bits in mantissa, if FP and known, else zero. - SIZE number of bits used to store data - ALIGN number of bits to which mode is aligned. */ - extern void enumerate_modes (void (*f) (int, int, int, int, int, int, - unsigned int)); - /* Return the size of the FP mode with precision PREC. */ extern int fp_prec_to_size (int prec); --- 901,906 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/lang-specs.h gcc-4.6.0/gcc/ada/gcc-interface/lang-specs.h *** gcc-4.5.2/gcc/ada/gcc-interface/lang-specs.h Tue Jun 30 19:20:24 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/lang-specs.h Tue Aug 3 09:42:46 2010 *************** *** 6,12 **** * * * C Header File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** *** 36,46 **** %{nostdinc*} %{nostdlib*}\ -dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} \ ! %{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{d*} %{f*}\ %{coverage:-fprofile-arcs -ftest-coverage} " - #if CONFIG_DUAL_EXCEPTIONS - "%{fRTS=sjlj:-fsjlj} " - #endif "%{gnatea:-gnatez} %{g*&m*} " #if defined(TARGET_VXWORKS_RTP) "%{fRTS=rtp:-mrtp} " --- 36,43 ---- %{nostdinc*} %{nostdlib*}\ -dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} \ ! %{O*} %{W*} %{w} %{p} %{pg:-p} %{d*} %{f*}\ %{coverage:-fprofile-arcs -ftest-coverage} " "%{gnatea:-gnatez} %{g*&m*} " #if defined(TARGET_VXWORKS_RTP) "%{fRTS=rtp:-mrtp} " diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/lang.opt gcc-4.6.0/gcc/ada/gcc-interface/lang.opt *** gcc-4.5.2/gcc/ada/gcc-interface/lang.opt Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/lang.opt Fri Dec 3 15:11:42 2010 *************** *** 1,5 **** ; Options for the Ada front end. ! ; Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc. ; ; This file is part of GCC. ; --- 1,5 ---- ; Options for the Ada front end. ! ; Copyright (C) 2003, 2007, 2008, 2010 Free Software Foundation, Inc. ; ; This file is part of GCC. ; *************** *** 25,30 **** --- 25,48 ---- Language Ada + -all-warnings + Ada Alias(Wall) + + -include-barrier + Ada Alias(I, -) + + -include-directory + Ada Separate Alias(I) + + -include-directory= + Ada Joined Alias(I) + + -no-standard-includes + Ada Alias(nostdinc) + + -no-standard-libraries + Ada Alias(nostdlib) + I Ada Joined Separate ; Documented for C *************** Woverlength-strings *** 65,70 **** --- 83,91 ---- Ada ; Documented for C + k8 + Driver + nostdinc Ada RejectNegative ; Don't look for source files *************** fRTS= *** 83,92 **** Ada Joined RejectNegative ; Selects the runtime - gdwarf+ - Ada - ; Explicit request for dwarf debug info with GNAT specific extensions. - gant Ada Joined Undocumented ; Catches typos --- 104,109 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/misc.c gcc-4.6.0/gcc/ada/gcc-interface/misc.c *** gcc-4.5.2/gcc/ada/gcc-interface/misc.c Fri Oct 16 20:07:52 2009 --- gcc-4.6.0/gcc/ada/gcc-interface/misc.c Mon Feb 14 19:16:34 2011 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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,32 **** * * ****************************************************************************/ - /* This file contains parts of the compiler that are required for interfacing - with GCC but otherwise do nothing and parts of Gigi that need to know - about RTL. */ - #include "config.h" #include "system.h" #include "coretypes.h" --- 23,28 ---- *************** *** 34,53 **** #include "tree.h" #include "diagnostic.h" #include "target.h" - #include "expr.h" - #include "libfuncs.h" #include "ggc.h" #include "flags.h" #include "debug.h" - #include "cgraph.h" - #include "optabs.h" #include "toplev.h" - #include "except.h" #include "langhooks.h" #include "langhooks-def.h" #include "opts.h" #include "options.h" ! #include "tree-inline.h" #include "ada.h" #include "adadecode.h" --- 30,45 ---- #include "tree.h" #include "diagnostic.h" #include "target.h" #include "ggc.h" #include "flags.h" #include "debug.h" #include "toplev.h" #include "langhooks.h" #include "langhooks-def.h" #include "opts.h" #include "options.h" ! #include "plugin.h" ! #include "function.h" /* For pass_by_reference. */ #include "ada.h" #include "adadecode.h" *************** *** 64,149 **** #include "ada-tree.h" #include "gigi.h" ! static bool gnat_init (void); ! static unsigned int gnat_init_options (unsigned int, const char **); ! static int gnat_handle_option (size_t, const char *, int); ! static bool gnat_post_options (const char **); ! static alias_set_type gnat_get_alias_set (tree); ! static void gnat_print_decl (FILE *, tree, int); ! static void gnat_print_type (FILE *, tree, int); ! static const char *gnat_printable_name (tree, int); ! static const char *gnat_dwarf_name (tree, int); ! static tree gnat_return_tree (tree); ! static int gnat_eh_type_covers (tree, tree); ! static void gnat_parse_file (int); ! static void internal_error_function (const char *, va_list *); ! static tree gnat_type_max_size (const_tree); ! static void gnat_get_subrange_bounds (const_tree, tree *, tree *); ! static tree gnat_eh_personality (void); ! ! /* Definitions for our language-specific hooks. */ ! ! #undef LANG_HOOKS_NAME ! #define LANG_HOOKS_NAME "GNU Ada" ! #undef LANG_HOOKS_IDENTIFIER_SIZE ! #define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) ! #undef LANG_HOOKS_INIT ! #define LANG_HOOKS_INIT gnat_init ! #undef LANG_HOOKS_INIT_OPTIONS ! #define LANG_HOOKS_INIT_OPTIONS gnat_init_options ! #undef LANG_HOOKS_HANDLE_OPTION ! #define LANG_HOOKS_HANDLE_OPTION gnat_handle_option ! #undef LANG_HOOKS_POST_OPTIONS ! #define LANG_HOOKS_POST_OPTIONS gnat_post_options ! #undef LANG_HOOKS_PARSE_FILE ! #define LANG_HOOKS_PARSE_FILE gnat_parse_file ! #undef LANG_HOOKS_HASH_TYPES ! #define LANG_HOOKS_HASH_TYPES false ! #undef LANG_HOOKS_GETDECLS ! #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v ! #undef LANG_HOOKS_PUSHDECL ! #define LANG_HOOKS_PUSHDECL gnat_return_tree ! #undef LANG_HOOKS_WRITE_GLOBALS ! #define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations ! #undef LANG_HOOKS_GET_ALIAS_SET ! #define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set ! #undef LANG_HOOKS_PRINT_DECL ! #define LANG_HOOKS_PRINT_DECL gnat_print_decl ! #undef LANG_HOOKS_PRINT_TYPE ! #define LANG_HOOKS_PRINT_TYPE gnat_print_type ! #undef LANG_HOOKS_TYPE_MAX_SIZE ! #define LANG_HOOKS_TYPE_MAX_SIZE gnat_type_max_size ! #undef LANG_HOOKS_DECL_PRINTABLE_NAME ! #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name ! #undef LANG_HOOKS_DWARF_NAME ! #define LANG_HOOKS_DWARF_NAME gnat_dwarf_name ! #undef LANG_HOOKS_GIMPLIFY_EXPR ! #define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr ! #undef LANG_HOOKS_TYPE_FOR_MODE ! #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_GET_SUBRANGE_BOUNDS ! #define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds ! #undef LANG_HOOKS_ATTRIBUTE_TABLE ! #define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table ! #undef LANG_HOOKS_BUILTIN_FUNCTION ! #define LANG_HOOKS_BUILTIN_FUNCTION gnat_builtin_function ! #undef LANG_HOOKS_EH_PERSONALITY ! #define LANG_HOOKS_EH_PERSONALITY gnat_eh_personality ! ! struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; ! ! /* How much we want of our DWARF extensions. Some of our dwarf+ extensions ! are incompatible with regular GDB versions, so we must make sure to only ! produce them on explicit request. This is eventually reflected into the ! use_gnu_debug_info_extensions common flag for later processing. */ ! static int gnat_dwarf_extensions = 0; ! /* Command-line argc and argv. These variables are global ! since they are imported in back_end.adb. */ unsigned int save_argc; const char **save_argv; --- 56,66 ---- #include "ada-tree.h" #include "gigi.h" ! /* This symbol needs to be defined for the front-end. */ ! void *callgraph_info_file = NULL; ! /* Command-line argc and argv. These variables are global since they are ! imported in back_end.adb. */ unsigned int save_argc; const char **save_argv; *************** extern int gnat_argc; *** 152,166 **** extern char **gnat_argv; /* Declare functions we use as part of startup. */ ! extern void __gnat_initialize (void *); ! extern void __gnat_install_SEH_handler (void *); ! extern void adainit (void); ! extern void _ada_gnat1drv (void); /* The parser for the language. For us, we process the GNAT tree. */ static void ! gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) { int seh[2]; --- 69,83 ---- extern char **gnat_argv; /* Declare functions we use as part of startup. */ ! extern void __gnat_initialize (void *); ! extern void __gnat_install_SEH_handler (void *); ! extern void adainit (void); ! extern void _ada_gnat1drv (void); /* The parser for the language. For us, we process the GNAT tree. */ static void ! gnat_parse_file (void) { int seh[2]; *************** gnat_parse_file (int set_yydebug ATTRIBU *** 181,223 **** /* Decode all the language specific options that cannot be decoded by GCC. The option decoding phase of GCC calls this routine on the flags that ! it cannot decode. Return the number of consecutive arguments from ARGV ! that have been successfully decoded or 0 on failure. */ ! static int ! gnat_handle_option (size_t scode, const char *arg, int value) { - const struct cl_option *option = &cl_options[scode]; enum opt_code code = (enum opt_code) scode; - char *q; - - if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE))) - { - error ("missing argument to \"-%s\"", option->opt_text); - return 1; - } switch (code) { - case OPT_I: - q = XNEWVEC (char, sizeof("-I") + strlen (arg)); - strcpy (q, "-I"); - strcat (q, arg); - gnat_argv[gnat_argc] = q; - gnat_argc++; - break; - case OPT_Wall: warn_unused = value; ! ! /* We save the value of warn_uninitialized, since if they put ! -Wuninitialized on the command line, we need to generate a ! warning about not using it without also specifying -O. */ ! if (warn_uninitialized != 1) ! warn_uninitialized = (value ? 2 : 0); break; - /* These are used in the GCC Makefile. */ case OPT_Wmissing_prototypes: case OPT_Wstrict_prototypes: case OPT_Wwrite_strings: --- 98,119 ---- /* Decode all the language specific options that cannot be decoded by GCC. The option decoding phase of GCC calls this routine on the flags that ! are marked as Ada-specific. Return true on success or false on failure. */ ! static bool ! gnat_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, int value, ! int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, ! const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { enum opt_code code = (enum opt_code) scode; switch (code) { case OPT_Wall: warn_unused = value; ! warn_uninitialized = value; break; case OPT_Wmissing_prototypes: case OPT_Wstrict_prototypes: case OPT_Wwrite_strings: *************** gnat_handle_option (size_t scode, const *** 226,240 **** case OPT_Wold_style_definition: case OPT_Wmissing_format_attribute: case OPT_Woverlength_strings: ! break; ! ! /* This is handled by the front-end. */ ! case OPT_nostdinc: ! break; ! ! case OPT_nostdlib: ! gnat_argv[gnat_argc] = xstrdup ("-nostdlib"); ! gnat_argc++; break; case OPT_feliminate_unused_debug_types: --- 122,128 ---- case OPT_Wold_style_definition: case OPT_Wmissing_format_attribute: case OPT_Woverlength_strings: ! /* These are used in the GCC Makefile. */ break; case OPT_feliminate_unused_debug_types: *************** gnat_handle_option (size_t scode, const *** 245,308 **** flag_eliminate_unused_debug_types = -value; break; - case OPT_fRTS_: - gnat_argv[gnat_argc] = xstrdup ("-fRTS"); - gnat_argc++; - break; - case OPT_gant: warning (0, "%<-gnat%> misspelled as %<-gant%>"); /* ... fall through ... */ case OPT_gnat: - /* Recopy the switches without the 'gnat' prefix. */ - gnat_argv[gnat_argc] = XNEWVEC (char, strlen (arg) + 2); - gnat_argv[gnat_argc][0] = '-'; - strcpy (gnat_argv[gnat_argc] + 1, arg); - gnat_argc++; - break; - case OPT_gnatO: ! gnat_argv[gnat_argc] = xstrdup ("-O"); ! gnat_argc++; ! gnat_argv[gnat_argc] = xstrdup (arg); ! gnat_argc++; ! break; ! ! case OPT_gdwarfplus: ! gnat_dwarf_extensions = 1; break; default: gcc_unreachable (); } ! return 1; } ! /* Initialize for option processing. */ static unsigned int ! gnat_init_options (unsigned int argc, const char **argv) { ! /* Initialize gnat_argv with save_argv size. */ ! gnat_argv = (char **) xmalloc ((argc + 1) * sizeof (argv[0])); ! gnat_argv[0] = xstrdup (argv[0]); /* name of the command */ ! gnat_argc = 1; ! save_argc = argc; ! save_argv = argv; /* Uninitialized really means uninitialized in Ada. */ ! flag_zero_initialized_in_bss = 0; ! return CL_Ada; } /* Post-switch processing. */ ! bool gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) { /* Excess precision other than "fast" requires front-end --- 133,235 ---- flag_eliminate_unused_debug_types = -value; break; case OPT_gant: warning (0, "%<-gnat%> misspelled as %<-gant%>"); /* ... fall through ... */ case OPT_gnat: case OPT_gnatO: ! case OPT_fRTS_: ! case OPT_I: ! case OPT_nostdinc: ! case OPT_nostdlib: ! /* These are handled by the front-end. */ break; default: gcc_unreachable (); } ! return true; } ! /* Return language mask for option processing. */ static unsigned int ! gnat_option_lang_mask (void) { ! return CL_Ada; ! } ! /* Initialize options structure OPTS. */ + static void + gnat_init_options_struct (struct gcc_options *opts) + { /* Uninitialized really means uninitialized in Ada. */ ! opts->x_flag_zero_initialized_in_bss = 0; ! } ! /* Initialize for option processing. */ ! ! static void ! gnat_init_options (unsigned int decoded_options_count, ! struct cl_decoded_option *decoded_options) ! { ! /* Reconstruct an argv array for use of back_end.adb. ! ! ??? back_end.adb should not rely on this; instead, it should work with ! decoded options without such reparsing, to ensure consistency in how ! options are decoded. */ ! unsigned int i; ! ! save_argv = XNEWVEC (const char *, 2 * decoded_options_count + 1); ! save_argc = 0; ! for (i = 0; i < decoded_options_count; i++) ! { ! size_t num_elements = decoded_options[i].canonical_option_num_elements; ! ! if (decoded_options[i].errors ! || decoded_options[i].opt_index == OPT_SPECIAL_unknown ! || num_elements == 0) ! continue; ! ! /* Deal with -I- specially since it must be a single switch. */ ! if (decoded_options[i].opt_index == OPT_I ! && num_elements == 2 ! && decoded_options[i].canonical_option[1][0] == '-' ! && decoded_options[i].canonical_option[1][1] == '\0') ! save_argv[save_argc++] = "-I-"; ! else ! { ! gcc_assert (num_elements >= 1 && num_elements <= 2); ! save_argv[save_argc++] = decoded_options[i].canonical_option[0]; ! if (num_elements >= 2) ! save_argv[save_argc++] = decoded_options[i].canonical_option[1]; ! } ! } ! save_argv[save_argc] = NULL; ! ! gnat_argv = (char **) xmalloc (sizeof (save_argv[0])); ! gnat_argv[0] = xstrdup (save_argv[0]); /* name of the command */ ! gnat_argc = 1; } + /* Ada code requires variables for these settings rather than elements + of the global_options structure. */ + #undef optimize + #undef optimize_size + #undef flag_compare_debug + #undef flag_stack_check + int optimize; + int optimize_size; + int flag_compare_debug; + enum stack_check_type flag_stack_check = NO_STACK_CHECK; + /* Post-switch processing. */ ! static bool gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) { /* Excess precision other than "fast" requires front-end *************** gnat_post_options (const char **pfilenam *** 326,335 **** else flag_eliminate_unused_debug_types = 0; ! /* Reflect the explicit request of DWARF extensions into the common ! flag for use by later passes. */ ! if (write_symbols == DWARF2_DEBUG) ! use_gnu_debug_info_extensions = gnat_dwarf_extensions > 0; return false; } --- 253,262 ---- else flag_eliminate_unused_debug_types = 0; ! optimize = global_options.x_optimize; ! optimize_size = global_options.x_optimize_size; ! flag_compare_debug = global_options.x_flag_compare_debug; ! flag_stack_check = global_options.x_flag_stack_check; return false; } *************** gnat_post_options (const char **pfilenam *** 337,343 **** /* Here is the function to handle the compiler error processing in GCC. */ static void ! internal_error_function (const char *msgid, va_list *ap) { text_info tinfo; char *buffer, *p, *loc; --- 264,271 ---- /* Here is the function to handle the compiler error processing in GCC. */ static void ! internal_error_function (diagnostic_context *context, ! const char *msgid, va_list *ap) { text_info tinfo; char *buffer, *p, *loc; *************** internal_error_function (const char *msg *** 345,361 **** Fat_Pointer fp, fp_loc; expanded_location s; /* Reset the pretty-printer. */ ! pp_clear_output_area (global_dc->printer); /* Format the message into the pretty-printer. */ tinfo.format_spec = msgid; tinfo.args_ptr = ap; tinfo.err_no = errno; ! pp_format_verbatim (global_dc->printer, &tinfo); /* Extract a (writable) pointer to the formatted text. */ ! buffer = xstrdup (pp_formatted_text (global_dc->printer)); /* Go up to the first newline. */ for (p = buffer; *p; p++) --- 273,292 ---- Fat_Pointer fp, fp_loc; expanded_location s; + /* Warn if plugins present. */ + warn_if_plugins (); + /* Reset the pretty-printer. */ ! pp_clear_output_area (context->printer); /* Format the message into the pretty-printer. */ tinfo.format_spec = msgid; tinfo.args_ptr = ap; tinfo.err_no = errno; ! pp_format_verbatim (context->printer, &tinfo); /* Extract a (writable) pointer to the formatted text. */ ! buffer = xstrdup (pp_formatted_text (context->printer)); /* Go up to the first newline. */ for (p = buffer; *p; p++) *************** internal_error_function (const char *msg *** 371,377 **** fp.Array = buffer; s = expand_location (input_location); ! if (flag_show_column && s.column != 0) asprintf (&loc, "%s:%d:%d", s.file, s.line, s.column); else asprintf (&loc, "%s:%d", s.file, s.line); --- 302,308 ---- fp.Array = buffer; s = expand_location (input_location); ! if (context->show_column && s.column != 0) asprintf (&loc, "%s:%d:%d", s.file, s.line, s.column); else asprintf (&loc, "%s:%d", s.file, s.line); *************** internal_error_function (const char *msg *** 389,411 **** static bool gnat_init (void) { ! /* Performs whatever initialization steps needed by the language-dependent ! lexical analyzer. */ ! gnat_init_decl_processing (); ! /* Add the input filename as the last argument. */ ! if (main_input_filename) ! { ! gnat_argv[gnat_argc] = xstrdup (main_input_filename); ! gnat_argc++; ! gnat_argv[gnat_argc] = NULL; ! } ! global_dc->internal_error = &internal_error_function; /* Show that REFERENCE_TYPEs are internal and should be Pmode. */ internal_reference_types (); return true; } --- 320,361 ---- static bool gnat_init (void) { ! /* Do little here, most of the standard declarations are set up after the ! front-end has been run. Use the same `char' as C, this doesn't really ! matter since we'll use the explicit `unsigned char' for Character. */ ! build_common_tree_nodes (flag_signed_char); ! /* In Ada, we use the unsigned type corresponding to the width of Pmode as ! SIZETYPE. In most cases when ptr_mode and Pmode differ, C will use the ! width of ptr_mode for SIZETYPE, but we get better code using the width ! of Pmode. Note that, although we manipulate negative offsets for some ! internal constructs and rely on compile time overflow detection in size ! computations, using unsigned types for SIZETYPEs is fine since they are ! treated specially by the middle-end, in particular sign-extended. */ ! size_type_node = gnat_type_for_mode (Pmode, 1); ! set_sizetype (size_type_node); ! TYPE_NAME (sizetype) = get_identifier ("size_type"); ! /* In Ada, we use an unsigned 8-bit type for the default boolean type. */ ! boolean_type_node = make_unsigned_type (8); ! TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE); ! SET_TYPE_RM_MAX_VALUE (boolean_type_node, ! build_int_cst (boolean_type_node, 1)); ! SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1)); ! ! build_common_tree_nodes_2 (0); ! sbitsize_one_node = sbitsize_int (1); ! sbitsize_unit_node = sbitsize_int (BITS_PER_UNIT); ! boolean_true_node = TYPE_MAX_VALUE (boolean_type_node); ! ! ptr_void_type_node = build_pointer_type (void_type_node); /* Show that REFERENCE_TYPEs are internal and should be Pmode. */ internal_reference_types (); + /* Register our internal error function. */ + global_dc->internal_error = &internal_error_function; + return true; } *************** gnat_init_gcc_eh (void) *** 434,445 **** right exception regions. */ using_eh_for_cleanups (); ! lang_eh_type_covers = gnat_eh_type_covers; ! ! /* Turn on -fexceptions and -fnon-call-exceptions. The first one triggers ! the generation of the necessary exception runtime tables. The second one ! is useful for two reasons: 1/ we map some asynchronous signals like SEGV ! to exceptions, so we need to ensure that the insns which can lead to such signals are correctly attached to the exception region they pertain to, 2/ Some calls to pure subprograms are handled as libcall blocks and then marked as "cannot trap" if the flag is not set (see emit_libcall_block). --- 384,393 ---- right exception regions. */ using_eh_for_cleanups (); ! /* Turn on -fexceptions and -fnon-call-exceptions. The first one triggers ! the generation of the necessary exception tables. The second one is ! useful for two reasons: 1/ we map some asynchronous signals like SEGV to ! exceptions, so we need to ensure that the insns which can lead to such signals are correctly attached to the exception region they pertain to, 2/ Some calls to pure subprograms are handled as libcall blocks and then marked as "cannot trap" if the flag is not set (see emit_libcall_block). *************** gnat_init_gcc_eh (void) *** 449,454 **** --- 397,403 ---- flag_non_call_exceptions = 1; init_eh (); + #ifdef DWARF2_UNWIND_INFO if (!dwarf2out_frame_initialized && dwarf2out_do_frame ()) dwarf2out_frame_init (); *************** static const char * *** 550,556 **** gnat_printable_name (tree decl, int verbosity) { const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl)); ! char *ada_name = (char *) ggc_alloc (strlen (coded_name) * 2 + 60); __gnat_decode (coded_name, ada_name, 0); --- 499,505 ---- gnat_printable_name (tree decl, int verbosity) { const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl)); ! char *ada_name = (char *) ggc_alloc_atomic (strlen (coded_name) * 2 + 60); __gnat_decode (coded_name, ada_name, 0); *************** gnat_dwarf_name (tree decl, int verbosit *** 572,577 **** --- 521,540 ---- return (const char *) IDENTIFIER_POINTER (DECL_NAME (decl)); } + /* Return true if types T1 and T2 are identical for type hashing purposes. + Called only after doing all language independent checks. At present, + this function is only called when both types are FUNCTION_TYPE. */ + + static bool + gnat_type_hash_eq (const_tree t1, const_tree t2) + { + gcc_assert (TREE_CODE (t1) == FUNCTION_TYPE); + return fntype_same_flags_p (t1, TYPE_CI_CO_LIST (t2), + TYPE_RETURN_UNCONSTRAINED_P (t2), + TYPE_RETURN_BY_DIRECT_REF_P (t2), + TREE_ADDRESSABLE (t2)); + } + /* Do nothing (return the tree node passed). */ static tree *************** gnat_return_tree (tree t) *** 580,599 **** return t; } - /* Return true if type A catches type B. Callback for flow analysis from - the exception handling part of the back-end. */ - - static int - gnat_eh_type_covers (tree a, tree b) - { - /* a catches b if they represent the same exception id or if a - is an "others". - - ??? integer_zero_node for "others" is hardwired in too many places - currently. */ - return (a == b || a == integer_zero_node); - } - /* Get the alias set corresponding to a type or expression. */ static alias_set_type --- 543,548 ---- *************** gnat_get_subrange_bounds (const_tree gnu *** 660,667 **** *highval = TYPE_MAX_VALUE (gnu_type); } ! /* GNU_TYPE is a type. Determine if it should be passed by reference by ! default. */ bool default_pass_by_ref (tree gnu_type) --- 609,616 ---- *highval = TYPE_MAX_VALUE (gnu_type); } ! /* GNU_TYPE is the type of a subprogram parameter. Determine if it should be ! passed by reference by default. */ bool default_pass_by_ref (tree gnu_type) *************** default_pass_by_ref (tree gnu_type) *** 673,679 **** is an In Out parameter, but it's probably best to err on the side of passing more things by reference. */ ! if (pass_by_reference (NULL, TYPE_MODE (gnu_type), gnu_type, 1)) return true; if (targetm.calls.return_in_memory (gnu_type, NULL_TREE)) --- 622,628 ---- is an In Out parameter, but it's probably best to err on the side of passing more things by reference. */ ! if (pass_by_reference (NULL, TYPE_MODE (gnu_type), gnu_type, true)) return true; if (targetm.calls.return_in_memory (gnu_type, NULL_TREE)) *************** default_pass_by_ref (tree gnu_type) *** 688,695 **** return false; } ! /* GNU_TYPE is the type of a subprogram parameter. Determine from the type if ! it should be passed by reference. */ bool must_pass_by_ref (tree gnu_type) --- 637,644 ---- return false; } ! /* GNU_TYPE is the type of a subprogram parameter. Determine if it must be ! passed by reference. */ bool must_pass_by_ref (tree gnu_type) *************** must_pass_by_ref (tree gnu_type) *** 700,789 **** and does not produce compatibility problems with C, since C does not have such objects. */ return (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE ! || (AGGREGATE_TYPE_P (gnu_type) && TYPE_BY_REFERENCE_P (gnu_type)) || (TYPE_SIZE (gnu_type) && TREE_CODE (TYPE_SIZE (gnu_type)) != INTEGER_CST)); } - /* This function is called by the front end to enumerate all the supported - modes for the machine. We pass a function which is called back with - the following integer parameters: - - FLOAT_P nonzero if this represents a floating-point mode - COMPLEX_P nonzero is this represents a complex mode - COUNT count of number of items, nonzero for vector mode - PRECISION number of bits in data representation - MANTISSA number of bits in mantissa, if FP and known, else zero. - SIZE number of bits used to store data - ALIGN number of bits to which mode is aligned. */ - - void - enumerate_modes (void (*f) (int, int, int, int, int, int, unsigned int)) - { - int iloop; - - for (iloop = 0; iloop < NUM_MACHINE_MODES; iloop++) - { - enum machine_mode i = (enum machine_mode) iloop; - enum machine_mode j; - bool float_p = 0; - bool complex_p = 0; - bool vector_p = 0; - bool skip_p = 0; - int mantissa = 0; - enum machine_mode inner_mode = i; - - switch (GET_MODE_CLASS (i)) - { - case MODE_INT: - break; - case MODE_FLOAT: - float_p = 1; - break; - case MODE_COMPLEX_INT: - complex_p = 1; - inner_mode = GET_MODE_INNER (i); - break; - case MODE_COMPLEX_FLOAT: - float_p = 1; - complex_p = 1; - inner_mode = GET_MODE_INNER (i); - break; - case MODE_VECTOR_INT: - vector_p = 1; - inner_mode = GET_MODE_INNER (i); - break; - case MODE_VECTOR_FLOAT: - float_p = 1; - vector_p = 1; - inner_mode = GET_MODE_INNER (i); - break; - default: - skip_p = 1; - } - - /* Skip this mode if it's one the front end doesn't need to know about - (e.g., the CC modes) or if there is no add insn for that mode (or - any wider mode), meaning it is not supported by the hardware. If - this a complex or vector mode, we care about the inner mode. */ - for (j = inner_mode; j != VOIDmode; j = GET_MODE_WIDER_MODE (j)) - if (optab_handler (add_optab, j)->insn_code != CODE_FOR_nothing) - break; - - if (float_p) - { - const struct real_format *fmt = REAL_MODE_FORMAT (inner_mode); - - mantissa = fmt->p; - } - - if (!skip_p && j != VOIDmode) - (*f) (float_p, complex_p, vector_p ? GET_MODE_NUNITS (i) : 0, - GET_MODE_BITSIZE (i), mantissa, - GET_MODE_SIZE (i) * BITS_PER_UNIT, GET_MODE_ALIGNMENT (i)); - } - } - /* Return the size of the FP mode with precision PREC. */ int --- 649,659 ---- and does not produce compatibility problems with C, since C does not have such objects. */ return (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE ! || TREE_ADDRESSABLE (gnu_type) || (TYPE_SIZE (gnu_type) && TREE_CODE (TYPE_SIZE (gnu_type)) != INTEGER_CST)); } /* Return the size of the FP mode with precision PREC. */ int *************** fp_size_to_prec (int size) *** 816,831 **** static GTY(()) tree gnat_eh_personality_decl; static tree gnat_eh_personality (void) { if (!gnat_eh_personality_decl) ! gnat_eh_personality_decl ! = build_personality_function (USING_SJLJ_EXCEPTIONS ! ? "__gnat_eh_personality_sj" ! : "__gnat_eh_personality"); ! return gnat_eh_personality_decl; } #include "gt-ada-misc.h" --- 686,760 ---- static GTY(()) tree gnat_eh_personality_decl; + /* Return the GNAT personality function decl. */ + static tree gnat_eh_personality (void) { if (!gnat_eh_personality_decl) ! gnat_eh_personality_decl = build_personality_function ("gnat"); return gnat_eh_personality_decl; } + /* Definitions for our language-specific hooks. */ + + #undef LANG_HOOKS_NAME + #define LANG_HOOKS_NAME "GNU Ada" + #undef LANG_HOOKS_IDENTIFIER_SIZE + #define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) + #undef LANG_HOOKS_INIT + #define LANG_HOOKS_INIT gnat_init + #undef LANG_HOOKS_OPTION_LANG_MASK + #define LANG_HOOKS_OPTION_LANG_MASK gnat_option_lang_mask + #undef LANG_HOOKS_INIT_OPTIONS_STRUCT + #define LANG_HOOKS_INIT_OPTIONS_STRUCT gnat_init_options_struct + #undef LANG_HOOKS_INIT_OPTIONS + #define LANG_HOOKS_INIT_OPTIONS gnat_init_options + #undef LANG_HOOKS_HANDLE_OPTION + #define LANG_HOOKS_HANDLE_OPTION gnat_handle_option + #undef LANG_HOOKS_POST_OPTIONS + #define LANG_HOOKS_POST_OPTIONS gnat_post_options + #undef LANG_HOOKS_PARSE_FILE + #define LANG_HOOKS_PARSE_FILE gnat_parse_file + #undef LANG_HOOKS_TYPE_HASH_EQ + #define LANG_HOOKS_TYPE_HASH_EQ gnat_type_hash_eq + #undef LANG_HOOKS_GETDECLS + #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v + #undef LANG_HOOKS_PUSHDECL + #define LANG_HOOKS_PUSHDECL gnat_return_tree + #undef LANG_HOOKS_WRITE_GLOBALS + #define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations + #undef LANG_HOOKS_GET_ALIAS_SET + #define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set + #undef LANG_HOOKS_PRINT_DECL + #define LANG_HOOKS_PRINT_DECL gnat_print_decl + #undef LANG_HOOKS_PRINT_TYPE + #define LANG_HOOKS_PRINT_TYPE gnat_print_type + #undef LANG_HOOKS_TYPE_MAX_SIZE + #define LANG_HOOKS_TYPE_MAX_SIZE gnat_type_max_size + #undef LANG_HOOKS_DECL_PRINTABLE_NAME + #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name + #undef LANG_HOOKS_DWARF_NAME + #define LANG_HOOKS_DWARF_NAME gnat_dwarf_name + #undef LANG_HOOKS_GIMPLIFY_EXPR + #define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr + #undef LANG_HOOKS_TYPE_FOR_MODE + #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_GET_SUBRANGE_BOUNDS + #define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds + #undef LANG_HOOKS_ATTRIBUTE_TABLE + #define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table + #undef LANG_HOOKS_BUILTIN_FUNCTION + #define LANG_HOOKS_BUILTIN_FUNCTION gnat_builtin_function + #undef LANG_HOOKS_EH_PERSONALITY + #define LANG_HOOKS_EH_PERSONALITY gnat_eh_personality + #undef LANG_HOOKS_DEEP_UNSHARING + #define LANG_HOOKS_DEEP_UNSHARING true + + struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; + #include "gt-ada-misc.h" diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/targtyps.c gcc-4.6.0/gcc/ada/gcc-interface/targtyps.c *** gcc-4.5.2/gcc/ada/gcc-interface/targtyps.c Sat Nov 27 18:47:06 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/targtyps.c Sat Nov 27 18:46:49 2010 *************** *** 6,12 **** * * * Body * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * Body * * * ! * Copyright (C) 1992-2010, 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- * diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/trans.c gcc-4.6.0/gcc/ada/gcc-interface/trans.c *** gcc-4.5.2/gcc/ada/gcc-interface/trans.c Sun Sep 19 14:55:41 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/trans.c Thu Feb 3 13:19:38 2011 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2011, 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,37 **** #include "tm.h" #include "tree.h" #include "flags.h" - #include "expr.h" #include "ggc.h" #include "output.h" #include "tree-iterator.h" #include "gimple.h" --- 29,37 ---- #include "tm.h" #include "tree.h" #include "flags.h" #include "ggc.h" #include "output.h" + #include "libfuncs.h" /* For set_stack_check_libfunc. */ #include "tree-iterator.h" #include "gimple.h" *************** *** 49,54 **** --- 49,55 ---- #include "fe.h" #include "sinfo.h" #include "einfo.h" + #include "gadaint.h" #include "ada-tree.h" #include "gigi.h" *************** *** 63,68 **** --- 64,76 ---- #define TARGET_ABI_OPEN_VMS 0 #endif + /* In configurations where blocks have no end_locus attached, just + sink assignments into a dummy global. */ + #ifndef BLOCK_SOURCE_END_LOCATION + static location_t block_end_locus_sink; + #define BLOCK_SOURCE_END_LOCATION(BLOCK) block_end_locus_sink + #endif + /* For efficient float-to-int rounding, it is necessary to know whether floating-point arithmetic may use wider intermediate results. When FP_ARITH_MAY_WIDEN is not defined, be conservative and only assume *************** *** 75,85 **** #endif #endif ! extern char *__gnat_to_canonical_file_spec (char *); ! ! int max_gnat_nodes; ! int number_names; ! int number_files; struct Node *Nodes_Ptr; Node_Id *Next_Node_Ptr; Node_Id *Prev_Node_Ptr; --- 83,89 ---- #endif #endif ! /* Pointers to front-end tables accessed through macros. */ struct Node *Nodes_Ptr; Node_Id *Next_Node_Ptr; Node_Id *Prev_Node_Ptr; *************** struct String_Entry *Strings_Ptr; *** 89,102 **** Char_Code *String_Chars_Ptr; struct List_Header *List_Headers_Ptr; ! /* Current filename without path. */ ! const char *ref_filename; /* True when gigi is being called on an analyzed but unexpanded tree, and the only purpose of the call is to properly annotate types with representation information. */ bool type_annotate_only; /* When not optimizing, we cache the 'First, 'Last and 'Length attributes of unconstrained array IN parameters to avoid emitting a great deal of redundant instructions to recompute them each time. */ --- 93,112 ---- Char_Code *String_Chars_Ptr; struct List_Header *List_Headers_Ptr; ! /* Highest number in the front-end node table. */ ! int max_gnat_nodes; ! ! /* Current node being treated, in case abort called. */ ! Node_Id error_gnat_node; /* True when gigi is being called on an analyzed but unexpanded tree, and the only purpose of the call is to properly annotate types with representation information. */ bool type_annotate_only; + /* Current filename without path. */ + const char *ref_filename; + /* When not optimizing, we cache the 'First, 'Last and 'Length attributes of unconstrained array IN parameters to avoid emitting a great deal of redundant instructions to recompute them each time. */ *************** struct GTY((chain_next ("%h.next"))) ela *** 150,206 **** static GTY(()) struct elab_info *elab_info_list; ! /* Free list of TREE_LIST nodes used for stacks. */ ! static GTY((deletable)) tree gnu_stack_free_list; ! ! /* List of TREE_LIST nodes representing a stack of exception pointer ! variables. TREE_VALUE is the VAR_DECL that stores the address of ! the raised exception. Nonzero means we are in an exception ! handler. Not used in the zero-cost case. */ ! static GTY(()) tree gnu_except_ptr_stack; ! /* List of TREE_LIST nodes used to store the current elaboration procedure ! decl. TREE_VALUE is the decl. */ ! static GTY(()) tree gnu_elab_proc_stack; ! /* Variable that stores a list of labels to be used as a goto target instead of ! a return in some functions. See processing for N_Subprogram_Body. */ ! static GTY(()) tree gnu_return_label_stack; ! /* List of TREE_LIST nodes representing a stack of LOOP_STMT nodes. ! TREE_VALUE of each entry is the label of the corresponding LOOP_STMT. */ ! static GTY(()) tree gnu_loop_label_stack; ! /* List of TREE_LIST nodes representing labels for switch statements. ! TREE_VALUE of each entry is the label at the end of the switch. */ ! static GTY(()) tree gnu_switch_label_stack; ! /* List of TREE_LIST nodes containing the stacks for N_{Push,Pop}_*_Label. */ ! static GTY(()) tree gnu_constraint_error_label_stack; ! static GTY(()) tree gnu_storage_error_label_stack; ! static GTY(()) tree gnu_program_error_label_stack; /* Map GNAT tree codes to GCC tree codes for simple expressions. */ static enum tree_code gnu_codes[Number_Node_Kinds]; - /* Current node being treated, in case abort called. */ - Node_Id error_gnat_node; - static void init_code_table (void); static void Compilation_Unit_to_gnu (Node_Id); static void record_code_position (Node_Id); static void insert_code_for (Node_Id); static void add_cleanup (tree, Node_Id); - static tree unshare_save_expr (tree *, int *, void *); static void add_stmt_list (List_Id); ! static void push_exception_label_stack (tree *, Entity_Id); static tree build_stmt_group (List_Id, bool); - static void push_stack (tree *, tree, tree); - static void pop_stack (tree *); static enum gimplify_status gnat_gimplify_stmt (tree *); static void elaborate_all_entities (Node_Id); static void process_freeze_entity (Node_Id); - static void process_inlined_subprograms (Node_Id); static void process_decls (List_Id, List_Id, Node_Id, bool, bool); static tree emit_range_check (tree, Node_Id, Node_Id); static tree emit_index_check (tree, tree, tree, tree, Node_Id); --- 160,203 ---- static GTY(()) struct elab_info *elab_info_list; ! /* Stack of exception pointer variables. Each entry is the VAR_DECL ! that stores the address of the raised exception. Nonzero means we ! are in an exception handler. Not used in the zero-cost case. */ ! static GTY(()) VEC(tree,gc) *gnu_except_ptr_stack; ! /* Stack for storing the current elaboration procedure decl. */ ! static GTY(()) VEC(tree,gc) *gnu_elab_proc_stack; ! /* Stack of labels to be used as a goto target instead of a return in ! some functions. See processing for N_Subprogram_Body. */ ! static GTY(()) VEC(tree,gc) *gnu_return_label_stack; ! /* Stack of variable for the return value of a function with copy-in/copy-out ! parameters. See processing for N_Subprogram_Body. */ ! static GTY(()) VEC(tree,gc) *gnu_return_var_stack; ! /* Stack of LOOP_STMT nodes. */ ! static GTY(()) VEC(tree,gc) *gnu_loop_label_stack; ! /* The stacks for N_{Push,Pop}_*_Label. */ ! static GTY(()) VEC(tree,gc) *gnu_constraint_error_label_stack; ! static GTY(()) VEC(tree,gc) *gnu_storage_error_label_stack; ! static GTY(()) VEC(tree,gc) *gnu_program_error_label_stack; /* Map GNAT tree codes to GCC tree codes for simple expressions. */ static enum tree_code gnu_codes[Number_Node_Kinds]; static void init_code_table (void); static void Compilation_Unit_to_gnu (Node_Id); static void record_code_position (Node_Id); static void insert_code_for (Node_Id); static void add_cleanup (tree, Node_Id); static void add_stmt_list (List_Id); ! static void push_exception_label_stack (VEC(tree,gc) **, Entity_Id); static tree build_stmt_group (List_Id, bool); static enum gimplify_status gnat_gimplify_stmt (tree *); static void elaborate_all_entities (Node_Id); static void process_freeze_entity (Node_Id); static void process_decls (List_Id, List_Id, Node_Id, bool, bool); static tree emit_range_check (tree, Node_Id, Node_Id); static tree emit_index_check (tree, tree, tree, tree, Node_Id); *************** static tree emit_check (tree, tree, int, *** 208,223 **** static tree build_unary_op_trapv (enum tree_code, tree, tree, Node_Id); static tree build_binary_op_trapv (enum tree_code, tree, tree, tree, Node_Id); static tree convert_with_check (Entity_Id, tree, bool, bool, bool, Node_Id); ! static bool smaller_packable_type_p (tree, tree); static bool addressable_p (tree, tree); static tree assoc_to_constructor (Entity_Id, Node_Id, tree); static tree extract_values (tree, tree); static tree pos_to_constructor (Node_Id, tree, Entity_Id); static tree maybe_implicit_deref (tree); - static tree gnat_stabilize_reference (tree, bool); - static tree gnat_stabilize_reference_1 (tree, bool); static void set_expr_location_from_node (tree, Node_Id); ! static int lvalue_required_p (Node_Id, tree, bool, bool); /* Hooks for debug info back-ends, only supported and used in a restricted set of configurations. */ --- 205,221 ---- static tree build_unary_op_trapv (enum tree_code, tree, tree, Node_Id); static tree build_binary_op_trapv (enum tree_code, tree, tree, tree, Node_Id); static tree convert_with_check (Entity_Id, tree, bool, bool, bool, Node_Id); ! static bool smaller_form_type_p (tree, tree); static bool addressable_p (tree, tree); static tree assoc_to_constructor (Entity_Id, Node_Id, tree); static tree extract_values (tree, tree); static tree pos_to_constructor (Node_Id, tree, Entity_Id); static tree maybe_implicit_deref (tree); static void set_expr_location_from_node (tree, Node_Id); ! static bool set_end_locus_from_node (tree, Node_Id); ! static void set_gnu_expr_location_from_node (tree, Node_Id); ! static int lvalue_required_p (Node_Id, tree, bool, bool, bool); ! static tree build_raise_check (int, tree, enum exception_info_kind); /* Hooks for debug info back-ends, only supported and used in a restricted set of configurations. */ *************** static const char *decode_name (const ch *** 228,240 **** structures and then generates code. */ void ! gigi (Node_Id gnat_root, int max_gnat_node, int number_name, struct Node *nodes_ptr, Node_Id *next_node_ptr, Node_Id *prev_node_ptr, struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr, struct String_Entry *strings_ptr, Char_Code *string_chars_ptr, struct List_Header *list_headers_ptr, Nat number_file, ! struct File_Info_Type *file_info_ptr, Entity_Id standard_boolean, ! Entity_Id standard_integer, Entity_Id standard_long_long_float, Entity_Id standard_exception_type, Int gigi_operating_mode) { Entity_Id gnat_literal; --- 226,239 ---- structures and then generates code. */ void ! gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, struct Node *nodes_ptr, Node_Id *next_node_ptr, Node_Id *prev_node_ptr, struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr, struct String_Entry *strings_ptr, Char_Code *string_chars_ptr, struct List_Header *list_headers_ptr, Nat number_file, ! struct File_Info_Type *file_info_ptr, ! Entity_Id standard_boolean, Entity_Id standard_integer, ! Entity_Id standard_character, Entity_Id standard_long_long_float, Entity_Id standard_exception_type, Int gigi_operating_mode) { Entity_Id gnat_literal; *************** gigi (Node_Id gnat_root, int max_gnat_no *** 244,251 **** int i; max_gnat_nodes = max_gnat_node; ! number_names = number_name; ! number_files = number_file; Nodes_Ptr = nodes_ptr; Next_Node_Ptr = next_node_ptr; Prev_Node_Ptr = prev_node_ptr; --- 243,249 ---- int i; max_gnat_nodes = max_gnat_node; ! Nodes_Ptr = nodes_ptr; Next_Node_Ptr = next_node_ptr; Prev_Node_Ptr = prev_node_ptr; *************** gigi (Node_Id gnat_root, int max_gnat_no *** 264,270 **** t = create_concat_name (Defining_Entity (Unit (gnat_root)), NULL); first_global_object_name = ggc_strdup (IDENTIFIER_POINTER (t)); ! for (i = 0; i < number_files; i++) { /* Use the identifier table to make a permanent copy of the filename as the name table gets reallocated after Gigi returns but before all the --- 262,268 ---- t = create_concat_name (Defining_Entity (Unit (gnat_root)), NULL); first_global_object_name = ggc_strdup (IDENTIFIER_POINTER (t)); ! for (i = 0; i < number_file; i++) { /* Use the identifier table to make a permanent copy of the filename as the name table gets reallocated after Gigi returns but before all the *************** gigi (Node_Id gnat_root, int max_gnat_no *** 301,343 **** TYPE_SIZE_UNIT (void_type_node) = size_zero_node; } - /* If the GNU type extensions to DWARF are available, setup the hooks. */ - #if defined (DWARF2_DEBUGGING_INFO) && defined (DWARF2_GNU_TYPE_EXTENSIONS) - /* We condition the name demangling and the generation of type encoding - strings on -gdwarf+ and always set descriptive types on. */ - if (use_gnu_debug_info_extensions) - { - dwarf2out_set_type_encoding_func (extract_encoding); - dwarf2out_set_demangle_name_func (decode_name); - } - dwarf2out_set_descriptive_type_func (get_parallel_type); - #endif - /* Enable GNAT stack checking method if needed */ if (!Stack_Check_Probes_On_Target) ! set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check")); /* Retrieve alignment settings. */ double_float_alignment = get_target_double_float_alignment (); double_scalar_alignment = get_target_double_scalar_alignment (); ! /* Record the builtin types. Define `integer' and `unsigned char' first so ! that dbx will output them first. */ record_builtin_type ("integer", integer_type_node); ! record_builtin_type ("unsigned char", char_type_node); ! record_builtin_type ("long integer", long_integer_type_node); ! unsigned_type_node = gnat_type_for_size (INT_TYPE_SIZE, 1); ! record_builtin_type ("unsigned int", unsigned_type_node); ! record_builtin_type (SIZE_TYPE, sizetype); record_builtin_type ("boolean", boolean_type_node); record_builtin_type ("void", void_type_node); /* Save the type we made for integer as the type for Standard.Integer. */ ! save_gnu_tree (Base_Type (standard_integer), TYPE_NAME (integer_type_node), false); ! /* Save the type we made for boolean as the type for Standard.Boolean. */ ! save_gnu_tree (Base_Type (standard_boolean), TYPE_NAME (boolean_type_node), false); gnat_literal = First_Literal (Base_Type (standard_boolean)); t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node); --- 299,332 ---- TYPE_SIZE_UNIT (void_type_node) = size_zero_node; } /* Enable GNAT stack checking method if needed */ if (!Stack_Check_Probes_On_Target) ! set_stack_check_libfunc ("_gnat_stack_check"); /* Retrieve alignment settings. */ double_float_alignment = get_target_double_float_alignment (); double_scalar_alignment = get_target_double_scalar_alignment (); ! /* Record the builtin types. Define `integer' and `character' first so that ! dbx will output them first. */ record_builtin_type ("integer", integer_type_node); ! record_builtin_type ("character", unsigned_char_type_node); record_builtin_type ("boolean", boolean_type_node); record_builtin_type ("void", void_type_node); /* Save the type we made for integer as the type for Standard.Integer. */ ! save_gnu_tree (Base_Type (standard_integer), ! TYPE_NAME (integer_type_node), false); ! /* Likewise for character as the type for Standard.Character. */ ! save_gnu_tree (Base_Type (standard_character), ! TYPE_NAME (unsigned_char_type_node), ! false); ! ! /* Likewise for boolean as the type for Standard.Boolean. */ ! save_gnu_tree (Base_Type (standard_boolean), ! TYPE_NAME (boolean_type_node), false); gnat_literal = First_Literal (Base_Type (standard_boolean)); t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node); *************** gigi (Node_Id gnat_root, int max_gnat_no *** 359,365 **** void_ftype = build_function_type (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); ! /* Now declare runtime functions. */ t = tree_cons (NULL_TREE, void_type_node, NULL_TREE); /* malloc is a function declaration tree for a function to allocate --- 348,354 ---- void_ftype = build_function_type (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); ! /* Now declare run-time functions. */ t = tree_cons (NULL_TREE, void_type_node, NULL_TREE); /* malloc is a function declaration tree for a function to allocate *************** gigi (Node_Id gnat_root, int max_gnat_no *** 398,403 **** --- 387,399 ---- int64_type, NULL_TREE), NULL_TREE, false, true, true, NULL, Empty); + /* Name of the _Parent field in tagged record types. */ + parent_name_id = get_identifier (Get_Name_String (Name_uParent)); + + /* Name of the Exception_Data type defined in System.Standard_Library. */ + exception_data_name_id + = get_identifier ("system__standard_library__exception_data"); + /* Make the types and functions used for exception processing. */ jmpbuf_type = build_array_type (gnat_type_for_mode (Pmode, 0), *************** gigi (Node_Id gnat_root, int max_gnat_no *** 411,418 **** (get_identifier ("system__soft_links__get_jmpbuf_address_soft"), NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), NULL_TREE, false, true, true, NULL, Empty); ! /* Avoid creating superfluous edges to __builtin_setjmp receivers. */ ! DECL_PURE_P (get_jmpbuf_decl) = 1; set_jmpbuf_decl = create_subprog_decl --- 407,413 ---- (get_identifier ("system__soft_links__get_jmpbuf_address_soft"), NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), NULL_TREE, false, true, true, NULL, Empty); ! DECL_IGNORED_P (get_jmpbuf_decl) = 1; set_jmpbuf_decl = create_subprog_decl *************** gigi (Node_Id gnat_root, int max_gnat_no *** 421,426 **** --- 416,422 ---- build_function_type (void_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), NULL_TREE, false, true, true, NULL, Empty); + DECL_IGNORED_P (set_jmpbuf_decl) = 1; /* setjmp returns an integer and has one operand, which is a pointer to a jmpbuf. */ *************** gigi (Node_Id gnat_root, int max_gnat_no *** 430,436 **** build_function_type (integer_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), NULL_TREE, false, true, true, NULL, Empty); - DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP; --- 426,431 ---- *************** gigi (Node_Id gnat_root, int max_gnat_no *** 442,448 **** build_function_type (void_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), NULL_TREE, false, true, true, NULL, Empty); - DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF; --- 437,442 ---- *************** gigi (Node_Id gnat_root, int max_gnat_no *** 454,459 **** --- 448,454 ---- ptr_void_type_node, t)), NULL_TREE, false, true, true, NULL, Empty); + DECL_IGNORED_P (begin_handler_decl) = 1; end_handler_decl = create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE, *************** gigi (Node_Id gnat_root, int max_gnat_no *** 462,467 **** --- 457,463 ---- ptr_void_type_node, t)), NULL_TREE, false, true, true, NULL, Empty); + DECL_IGNORED_P (end_handler_decl) = 1; /* If in no exception handlers mode, all raise statements are redirected to __gnat_last_chance_handler. No need to redefine raise_nodefer_decl since *************** gigi (Node_Id gnat_root, int max_gnat_no *** 473,519 **** (get_identifier ("__gnat_last_chance_handler"), NULL_TREE, build_function_type (void_type_node, tree_cons (NULL_TREE, ! build_pointer_type (char_type_node), tree_cons (NULL_TREE, integer_type_node, t))), NULL_TREE, false, true, true, NULL, Empty); ! for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) gnat_raise_decls[i] = decl; } else - /* Otherwise, make one decl for each exception reason. */ - for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) - { - char name[17]; - - sprintf (name, "__gnat_rcheck_%.2d", i); - gnat_raise_decls[i] - = create_subprog_decl - (get_identifier (name), NULL_TREE, - build_function_type (void_type_node, - tree_cons (NULL_TREE, - build_pointer_type - (char_type_node), - tree_cons (NULL_TREE, - integer_type_node, - t))), - NULL_TREE, false, true, true, NULL, Empty); - } - - for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) { ! TREE_THIS_VOLATILE (gnat_raise_decls[i]) = 1; ! TREE_SIDE_EFFECTS (gnat_raise_decls[i]) = 1; ! TREE_TYPE (gnat_raise_decls[i]) ! = build_qualified_type (TREE_TYPE (gnat_raise_decls[i]), ! TYPE_QUAL_VOLATILE); } ! /* Set the types that GCC and Gigi use from the front end. We would ! like to do this for char_type_node, but it needs to correspond to ! the C char type. */ exception_type = gnat_to_gnu_entity (Base_Type (standard_exception_type), NULL_TREE, 0); except_type_node = TREE_TYPE (exception_type); --- 469,502 ---- (get_identifier ("__gnat_last_chance_handler"), NULL_TREE, build_function_type (void_type_node, tree_cons (NULL_TREE, ! build_pointer_type ! (unsigned_char_type_node), tree_cons (NULL_TREE, integer_type_node, t))), NULL_TREE, false, true, true, NULL, Empty); ! TREE_THIS_VOLATILE (decl) = 1; ! TREE_SIDE_EFFECTS (decl) = 1; ! TREE_TYPE (decl) ! = build_qualified_type (TREE_TYPE (decl), TYPE_QUAL_VOLATILE); for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) gnat_raise_decls[i] = decl; } else { ! /* Otherwise, make one decl for each exception reason. */ ! for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) ! gnat_raise_decls[i] = build_raise_check (i, t, exception_simple); ! for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls_ext); i++) ! gnat_raise_decls_ext[i] ! = build_raise_check (i, t, ! i == CE_Index_Check_Failed ! || i == CE_Range_Check_Failed ! || i == CE_Invalid_Data ! ? exception_range : exception_column); } ! /* Set the types that GCC and Gigi use from the front end. */ exception_type = gnat_to_gnu_entity (Base_Type (standard_exception_type), NULL_TREE, 0); except_type_node = TREE_TYPE (exception_type); *************** gigi (Node_Id gnat_root, int max_gnat_no *** 525,532 **** NULL_TREE, build_function_type (build_pointer_type (except_type_node), NULL_TREE), NULL_TREE, false, true, true, NULL, Empty); - /* Avoid creating superfluous edges to __builtin_setjmp receivers. */ - DECL_PURE_P (get_excptr_decl) = 1; raise_nodefer_decl = create_subprog_decl --- 508,513 ---- *************** gigi (Node_Id gnat_root, int max_gnat_no *** 548,570 **** if (TARGET_VTABLE_USES_DESCRIPTORS) { tree null_node = fold_convert (ptr_void_ftype, null_pointer_node); ! 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_node, null_list); } finish_record_type (fdesc_type_node, nreverse (field_list), 0, false); record_builtin_type ("descriptor", fdesc_type_node); ! null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_list); } long_long_float_type --- 529,560 ---- if (TARGET_VTABLE_USES_DESCRIPTORS) { tree null_node = fold_convert (ptr_void_ftype, null_pointer_node); ! tree field_list = NULL_TREE; int j; + VEC(constructor_elt,gc) *null_vec = NULL; + constructor_elt *elt; fdesc_type_node = make_node (RECORD_TYPE); + VEC_safe_grow (constructor_elt, gc, null_vec, + TARGET_VTABLE_USES_DESCRIPTORS); + elt = (VEC_address (constructor_elt,null_vec) + + TARGET_VTABLE_USES_DESCRIPTORS - 1); for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; j++) { ! tree field ! = create_field_decl (NULL_TREE, ptr_void_ftype, fdesc_type_node, ! NULL_TREE, NULL_TREE, 0, 1); TREE_CHAIN (field) = field_list; field_list = field; ! elt->index = field; ! elt->value = null_node; ! elt--; } finish_record_type (fdesc_type_node, nreverse (field_list), 0, false); record_builtin_type ("descriptor", fdesc_type_node); ! null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_vec); } long_long_float_type *************** gigi (Node_Id gnat_root, int max_gnat_no *** 588,599 **** others_decl = create_var_decl (get_identifier ("OTHERS"), get_identifier ("__gnat_others_value"), ! integer_type_node, 0, 1, 0, 1, 1, 0, Empty); all_others_decl = create_var_decl (get_identifier ("ALL_OTHERS"), get_identifier ("__gnat_all_others_value"), ! integer_type_node, 0, 1, 0, 1, 1, 0, Empty); main_identifier_node = get_identifier ("main"); --- 578,591 ---- others_decl = create_var_decl (get_identifier ("OTHERS"), get_identifier ("__gnat_others_value"), ! integer_type_node, NULL_TREE, true, false, true, false, ! NULL, Empty); all_others_decl = create_var_decl (get_identifier ("ALL_OTHERS"), get_identifier ("__gnat_all_others_value"), ! integer_type_node, NULL_TREE, true, false, true, false, ! NULL, Empty); main_identifier_node = get_identifier ("main"); *************** gigi (Node_Id gnat_root, int max_gnat_no *** 601,611 **** user available facilities for Intrinsic imports. */ gnat_install_builtins (); ! gnu_except_ptr_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ! gnu_constraint_error_label_stack ! = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ! gnu_storage_error_label_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ! gnu_program_error_label_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); /* Process any Pragma Ident for the main unit. */ #ifdef ASM_OUTPUT_IDENT --- 593,602 ---- user available facilities for Intrinsic imports. */ gnat_install_builtins (); ! VEC_safe_push (tree, gc, gnu_except_ptr_stack, NULL_TREE); ! VEC_safe_push (tree, gc, gnu_constraint_error_label_stack, NULL_TREE); ! VEC_safe_push (tree, gc, gnu_storage_error_label_stack, NULL_TREE); ! VEC_safe_push (tree, gc, gnu_program_error_label_stack, NULL_TREE); /* Process any Pragma Ident for the main unit. */ #ifdef ASM_OUTPUT_IDENT *************** gigi (Node_Id gnat_root, int max_gnat_no *** 620,626 **** gnat_init_gcc_eh (); /* Now translate the compilation unit proper. */ - start_stmt_group (); Compilation_Unit_to_gnu (gnat_root); /* Finally see if we have any elaboration procedures to deal with. */ --- 611,616 ---- *************** gigi (Node_Id gnat_root, int max_gnat_no *** 628,643 **** { tree gnu_body = DECL_SAVED_TREE (info->elab_proc), gnu_stmts; - /* Unshare SAVE_EXPRs between subprograms. These are not unshared by - the gimplifier for obvious reasons, but it turns out that we need to - unshare them for the global level because of SAVE_EXPRs made around - checks for global objects and around allocators for global objects - of variable size, in order to prevent node sharing in the underlying - expression. Note that this implicitly assumes that the SAVE_EXPR - nodes themselves are not shared between subprograms, which would be - an upstream bug for which we would not change the outcome. */ - walk_tree_without_duplicates (&gnu_body, unshare_save_expr, NULL); - /* We should have a BIND_EXPR but it may not have any statements in it. If it doesn't have any, we have nothing to do except for setting the flag on the GNAT node. Otherwise, process the function as others. */ --- 618,623 ---- *************** gigi (Node_Id gnat_root, int max_gnat_no *** 657,667 **** error_gnat_node = Empty; } /* Return a positive value if an lvalue is required for GNAT_NODE. GNU_TYPE is the type that will be used for GNAT_NODE in the translated GNU tree. CONSTANT indicates whether the underlying object represented by GNAT_NODE ! is constant in the Ada sense, ALIASED whether it is aliased (but the latter ! doesn't affect the outcome if CONSTANT is not true). The function climbs up the GNAT tree starting from the node and returns 1 upon encountering a node that effectively requires an lvalue downstream. --- 637,745 ---- error_gnat_node = Empty; } + /* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given + CHECK (if EXTENDED is false), or __gnat_rcheck_xx_ext (if EXTENDED is + true). */ + + static tree + build_raise_check (int check, tree void_tree, enum exception_info_kind kind) + { + char name[21]; + tree result; + + if (kind != exception_simple) + { + sprintf (name, "__gnat_rcheck_%.2d_ext", check); + result + = create_subprog_decl + (get_identifier (name), NULL_TREE, + build_function_type + (void_type_node, + tree_cons + (NULL_TREE, build_pointer_type (unsigned_char_type_node), + tree_cons (NULL_TREE, integer_type_node, + tree_cons (NULL_TREE, integer_type_node, + kind == exception_column + ? void_tree + : tree_cons (NULL_TREE, integer_type_node, + tree_cons (NULL_TREE, + integer_type_node, + void_tree)))))), + NULL_TREE, false, true, true, NULL, Empty); + } + else + { + sprintf (name, "__gnat_rcheck_%.2d", check); + result + = create_subprog_decl + (get_identifier (name), NULL_TREE, + build_function_type + (void_type_node, + tree_cons + (NULL_TREE, build_pointer_type (unsigned_char_type_node), + tree_cons (NULL_TREE, integer_type_node, void_tree))), + NULL_TREE, false, true, true, NULL, Empty); + } + + TREE_THIS_VOLATILE (result) = 1; + TREE_SIDE_EFFECTS (result) = 1; + TREE_TYPE (result) + = build_qualified_type (TREE_TYPE (result), TYPE_QUAL_VOLATILE); + + return result; + } + + /* Return a positive value if an lvalue is required for GNAT_NODE, which is + an N_Attribute_Reference. */ + + static int + lvalue_required_for_attribute_p (Node_Id gnat_node) + { + switch (Get_Attribute_Id (Attribute_Name (gnat_node))) + { + case Attr_Pos: + case Attr_Val: + case Attr_Pred: + case Attr_Succ: + case Attr_First: + case Attr_Last: + case Attr_Range_Length: + case Attr_Length: + case Attr_Object_Size: + case Attr_Value_Size: + case Attr_Component_Size: + case Attr_Max_Size_In_Storage_Elements: + case Attr_Min: + case Attr_Max: + case Attr_Null_Parameter: + case Attr_Passed_By_Reference: + case Attr_Mechanism_Code: + return 0; + + case Attr_Address: + case Attr_Access: + case Attr_Unchecked_Access: + case Attr_Unrestricted_Access: + case Attr_Code_Address: + case Attr_Pool_Address: + case Attr_Size: + case Attr_Alignment: + case Attr_Bit_Position: + case Attr_Position: + case Attr_First_Bit: + case Attr_Last_Bit: + case Attr_Bit: + default: + return 1; + } + } + /* Return a positive value if an lvalue is required for GNAT_NODE. GNU_TYPE is the type that will be used for GNAT_NODE in the translated GNU tree. CONSTANT indicates whether the underlying object represented by GNAT_NODE ! is constant in the Ada sense. If it is, ADDRESS_OF_CONSTANT indicates ! whether its value is the address of a constant and ALIASED whether it is ! aliased. If it isn't, ADDRESS_OF_CONSTANT and ALIASED are ignored. The function climbs up the GNAT tree starting from the node and returns 1 upon encountering a node that effectively requires an lvalue downstream. *************** gigi (Node_Id gnat_root, int max_gnat_no *** 670,676 **** static int lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, ! bool aliased) { Node_Id gnat_parent = Parent (gnat_node), gnat_temp; --- 748,754 ---- static int lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, ! bool address_of_constant, bool aliased) { Node_Id gnat_parent = Parent (gnat_node), gnat_temp; *************** lvalue_required_p (Node_Id gnat_node, tr *** 680,702 **** return 1; case N_Attribute_Reference: ! { ! unsigned char id = Get_Attribute_Id (Attribute_Name (gnat_parent)); ! return id == Attr_Address ! || id == Attr_Access ! || id == Attr_Unchecked_Access ! || id == Attr_Unrestricted_Access ! || id == Attr_Bit_Position ! || id == Attr_Position ! || id == Attr_First_Bit ! || id == Attr_Last_Bit ! || id == Attr_Bit; ! } case N_Parameter_Association: case N_Function_Call: case N_Procedure_Call_Statement: ! return (must_pass_by_ref (gnu_type) || default_pass_by_ref (gnu_type)); case N_Indexed_Component: /* Only the array expression can require an lvalue. */ --- 758,772 ---- return 1; case N_Attribute_Reference: ! return lvalue_required_for_attribute_p (gnat_parent); case N_Parameter_Association: case N_Function_Call: case N_Procedure_Call_Statement: ! /* If the parameter is by reference, an lvalue is required. */ ! return (!constant ! || must_pass_by_ref (gnu_type) ! || default_pass_by_ref (gnu_type)); case N_Indexed_Component: /* Only the array expression can require an lvalue. */ *************** lvalue_required_p (Node_Id gnat_node, tr *** 721,731 **** return 0; aliased |= Has_Aliased_Components (Etype (gnat_node)); ! return lvalue_required_p (gnat_parent, gnu_type, constant, aliased); case N_Selected_Component: aliased |= Is_Aliased (Entity (Selector_Name (gnat_parent))); ! return lvalue_required_p (gnat_parent, gnu_type, constant, aliased); case N_Object_Renaming_Declaration: /* We need to make a real renaming only if the constant object is --- 791,803 ---- return 0; aliased |= Has_Aliased_Components (Etype (gnat_node)); ! return lvalue_required_p (gnat_parent, gnu_type, constant, ! address_of_constant, aliased); case N_Selected_Component: aliased |= Is_Aliased (Entity (Selector_Name (gnat_parent))); ! return lvalue_required_p (gnat_parent, gnu_type, constant, ! address_of_constant, aliased); case N_Object_Renaming_Declaration: /* We need to make a real renaming only if the constant object is *************** lvalue_required_p (Node_Id gnat_node, tr *** 743,764 **** case N_Object_Declaration: /* We cannot use a constructor if this is an atomic object because the actual assignment might end up being done component-wise. */ ! return Is_Composite_Type (Underlying_Type (Etype (gnat_node))) ! && Is_Atomic (Defining_Entity (gnat_parent)); case N_Assignment_Statement: /* We cannot use a constructor if the LHS is an atomic object because the actual assignment might end up being done component-wise. */ ! return (Name (gnat_parent) == gnat_node || (Is_Composite_Type (Underlying_Type (Etype (gnat_node))) && Is_Atomic (Entity (Name (gnat_parent))))); case N_Unchecked_Type_Conversion: ! /* Returning 0 is very likely correct but we get better code if we ! go through the conversion. */ ! return lvalue_required_p (gnat_parent, ! get_unpadded_type (Etype (gnat_parent)), ! constant, aliased); default: return 0; --- 815,867 ---- case N_Object_Declaration: /* We cannot use a constructor if this is an atomic object because the actual assignment might end up being done component-wise. */ ! return (!constant ! ||(Is_Composite_Type (Underlying_Type (Etype (gnat_node))) ! && Is_Atomic (Defining_Entity (gnat_parent))) ! /* We don't use a constructor if this is a class-wide object ! because the effective type of the object is the equivalent ! type of the class-wide subtype and it smashes most of the ! data into an array of bytes to which we cannot convert. */ ! || Ekind ((Etype (Defining_Entity (gnat_parent)))) ! == E_Class_Wide_Subtype); case N_Assignment_Statement: /* We cannot use a constructor if the LHS is an atomic object because the actual assignment might end up being done component-wise. */ ! return (!constant ! || Name (gnat_parent) == gnat_node || (Is_Composite_Type (Underlying_Type (Etype (gnat_node))) && Is_Atomic (Entity (Name (gnat_parent))))); case N_Unchecked_Type_Conversion: ! if (!constant) ! return 1; ! ! /* ... fall through ... */ ! ! case N_Type_Conversion: ! case N_Qualified_Expression: ! /* We must look through all conversions because we may need to bypass ! an intermediate conversion that is meant to be purely formal. */ ! return lvalue_required_p (gnat_parent, ! get_unpadded_type (Etype (gnat_parent)), ! constant, address_of_constant, aliased); ! ! case N_Allocator: ! /* We should only reach here through the N_Qualified_Expression case. ! Force an lvalue for composite types since a block-copy to the newly ! allocated area of memory is made. */ ! return Is_Composite_Type (Underlying_Type (Etype (gnat_node))); ! ! case N_Explicit_Dereference: ! /* We look through dereferences for address of constant because we need ! to handle the special cases listed above. */ ! if (constant && address_of_constant) ! return lvalue_required_p (gnat_parent, ! get_unpadded_type (Etype (gnat_parent)), ! true, false, true); ! ! /* ... fall through ... */ default: return 0; *************** Identifier_to_gnu (Node_Id gnat_node, tr *** 861,874 **** 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 short-circuit here since Volatile constants must bei imported per C.6. */ ! if (Ekind (gnat_temp) == E_Constant && Is_Scalar_Type (gnat_temp_type) && !Is_Imported (gnat_temp) && Present (Address_Clause (gnat_temp))) { require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true, ! Is_Aliased (gnat_temp)); use_constant_initializer = !require_lvalue; } --- 964,978 ---- 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 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) && Present (Address_Clause (gnat_temp))) { require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true, ! false, Is_Aliased (gnat_temp)); use_constant_initializer = !require_lvalue; } *************** Identifier_to_gnu (Node_Id gnat_node, tr *** 884,910 **** else gnu_result = gnat_to_gnu_entity (gnat_temp, NULL_TREE, 0); - /* If we are in an exception handler, force this variable into memory to - ensure optimization does not remove stores that appear redundant but are - actually needed in case an exception occurs. - - ??? Note that we need not do this if the variable is declared within the - handler, only if it is referenced in the handler and declared in an - enclosing block, but we have no way of testing that right now. - - ??? We used to essentially set the TREE_ADDRESSABLE flag on the variable - here, but it can now be removed by the Tree aliasing machinery if the - address of the variable is never taken. All we can do is to make the - variable volatile, which might incur the generation of temporaries just - to access the memory in some circumstances. This can be avoided for - variables of non-constant size because they are automatically allocated - to memory. There might be no way of allocating a proper temporary for - them in any case. We only do this for SJLJ though. */ - if (TREE_VALUE (gnu_except_ptr_stack) - && TREE_CODE (gnu_result) == VAR_DECL - && TREE_CODE (DECL_SIZE_UNIT (gnu_result)) == INTEGER_CST) - TREE_THIS_VOLATILE (gnu_result) = TREE_SIDE_EFFECTS (gnu_result) = 1; - /* Some objects (such as parameters passed by reference, globals of variable size, and renamed objects) actually represent the address of the object. In that case, we must do the dereference. Likewise, --- 988,993 ---- *************** Identifier_to_gnu (Node_Id gnat_node, tr *** 914,935 **** || (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (gnu_result)))) { ! bool ro = DECL_POINTS_TO_READONLY_P (gnu_result); tree renamed_obj; if (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (gnu_result)) ! gnu_result ! = build_unary_op (INDIRECT_REF, NULL_TREE, ! convert (build_pointer_type (gnu_result_type), ! gnu_result)); /* If it's a renaming pointer and we are at the right binding level, we can reference the renamed object directly, since the renamed expression has been protected against multiple evaluations. */ else if (TREE_CODE (gnu_result) == VAR_DECL ! && (renamed_obj = DECL_RENAMED_OBJECT (gnu_result)) != 0 ! && (! DECL_RENAMING_GLOBAL_P (gnu_result) || global_bindings_p ())) gnu_result = renamed_obj; --- 997,1030 ---- || (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (gnu_result)))) { ! const bool read_only = DECL_POINTS_TO_READONLY_P (gnu_result); tree renamed_obj; if (TREE_CODE (gnu_result) == PARM_DECL + && DECL_BY_DOUBLE_REF_P (gnu_result)) + { + gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); + if (TREE_CODE (gnu_result) == INDIRECT_REF) + TREE_THIS_NOTRAP (gnu_result) = 1; + } + + if (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (gnu_result)) ! { ! gnu_result ! = build_unary_op (INDIRECT_REF, NULL_TREE, ! convert (build_pointer_type (gnu_result_type), ! gnu_result)); ! if (TREE_CODE (gnu_result) == INDIRECT_REF) ! TREE_THIS_NOTRAP (gnu_result) = 1; ! } /* If it's a renaming pointer and we are at the right binding level, we can reference the renamed object directly, since the renamed expression has been protected against multiple evaluations. */ else if (TREE_CODE (gnu_result) == VAR_DECL ! && (renamed_obj = DECL_RENAMED_OBJECT (gnu_result)) ! && (!DECL_RENAMING_GLOBAL_P (gnu_result) || global_bindings_p ())) gnu_result = renamed_obj; *************** Identifier_to_gnu (Node_Id gnat_node, tr *** 940,948 **** DECL_INITIAL (gnu_result)); else ! gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); ! TREE_READONLY (gnu_result) = TREE_STATIC (gnu_result) = ro; } /* The GNAT tree has the type of a function as the type of its result. Also --- 1035,1048 ---- DECL_INITIAL (gnu_result)); else ! { ! gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); ! if (TREE_CODE (gnu_result) == INDIRECT_REF) ! TREE_THIS_NOTRAP (gnu_result) = 1; ! } ! if (read_only) ! TREE_READONLY (gnu_result) = 1; } /* The GNAT tree has the type of a function as the type of its result. Also *************** Identifier_to_gnu (Node_Id gnat_node, tr *** 956,985 **** gnu_result_type = TREE_TYPE (TYPE_FIELDS (gnu_result_type)); } ! /* If we have a constant declaration and its initializer at hand, ! try to return the latter to avoid the need to call fold in lots ! of places and the need of elaboration code if this Id is used as ! an initializer itself. */ if (TREE_CONSTANT (gnu_result) && DECL_P (gnu_result) && DECL_INITIAL (gnu_result)) { ! tree object ! = (TREE_CODE (gnu_result) == CONST_DECL ! ? DECL_CONST_CORRESPONDING_VAR (gnu_result) : gnu_result); ! /* If there is a corresponding variable, we only want to return ! the CST value if an lvalue is not required. Evaluate this ! now if we have not already done so. */ ! if (object && require_lvalue < 0) ! require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true, ! Is_Aliased (gnat_temp)); ! if (!object || !require_lvalue) gnu_result = unshare_expr (DECL_INITIAL (gnu_result)); } *gnu_result_type_p = gnu_result_type; return gnu_result; } --- 1056,1090 ---- gnu_result_type = TREE_TYPE (TYPE_FIELDS (gnu_result_type)); } ! /* If we have a constant declaration and its initializer, try to return the ! latter to avoid the need to call fold in lots of places and the need for ! elaboration code if this identifier is used as an initializer itself. */ if (TREE_CONSTANT (gnu_result) && DECL_P (gnu_result) && DECL_INITIAL (gnu_result)) { ! bool constant_only = (TREE_CODE (gnu_result) == CONST_DECL ! && !DECL_CONST_CORRESPONDING_VAR (gnu_result)); ! bool address_of_constant = (TREE_CODE (gnu_result) == CONST_DECL ! && DECL_CONST_ADDRESS_P (gnu_result)); ! /* If there is a (corresponding) variable or this is the address of a ! constant, we only want to return the initializer if an lvalue isn't ! required. Evaluate this now if we have not already done so. */ ! if ((!constant_only || address_of_constant) && require_lvalue < 0) ! require_lvalue ! = lvalue_required_p (gnat_node, gnu_result_type, true, ! address_of_constant, Is_Aliased (gnat_temp)); ! /* ??? We need to unshare the initializer if the object is external ! as such objects are not marked for unsharing if we are not at the ! global level. This should be fixed in add_decl_expr. */ ! if ((constant_only && !address_of_constant) || !require_lvalue) gnu_result = unshare_expr (DECL_INITIAL (gnu_result)); } *gnu_result_type_p = gnu_result_type; + return gnu_result; } *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1127,1136 **** if (Do_Range_Check (First (Expressions (gnat_node)))) { ! gnu_expr = protect_multiple_eval (gnu_expr); gnu_expr = emit_check ! (build_binary_op (EQ_EXPR, integer_type_node, gnu_expr, attribute == Attr_Pred ? TYPE_MIN_VALUE (gnu_result_type) --- 1232,1241 ---- if (Do_Range_Check (First (Expressions (gnat_node)))) { ! gnu_expr = gnat_protect_expr (gnu_expr); gnu_expr = emit_check ! (build_binary_op (EQ_EXPR, boolean_type_node, gnu_expr, attribute == Attr_Pred ? TYPE_MIN_VALUE (gnu_result_type) *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1163,1172 **** 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)); --- 1268,1279 ---- else if (TARGET_VTABLE_USES_DESCRIPTORS && Is_Dispatch_Table_Entity (Etype (gnat_node))) { ! tree gnu_field, t; /* Descriptors can only be built here for top-level functions. */ bool build_descriptor = (global_bindings_p () != 0); int i; + VEC(constructor_elt,gc) *gnu_vec = NULL; + constructor_elt *elt; gnu_result_type = get_unpadded_type (Etype (gnat_node)); *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1181,1186 **** --- 1288,1297 ---- gnu_result = build1 (INDIRECT_REF, gnu_result_type, gnu_result); } + VEC_safe_grow (constructor_elt, gc, gnu_vec, + TARGET_VTABLE_USES_DESCRIPTORS); + elt = (VEC_address (constructor_elt, gnu_vec) + + TARGET_VTABLE_USES_DESCRIPTORS - 1); for (gnu_field = TYPE_FIELDS (gnu_result_type), i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; gnu_field = TREE_CHAIN (gnu_field), i++) *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1195,1204 **** 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; } --- 1306,1317 ---- t = build3 (COMPONENT_REF, ptr_void_ftype, gnu_result, gnu_field, NULL_TREE); ! elt->index = gnu_field; ! elt->value = t; ! elt--; } ! gnu_result = gnat_build_constructor (gnu_result_type, gnu_vec); break; } *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1272,1287 **** if (TREE_CODE (gnu_obj_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_obj_type)) { ! tree gnu_char_ptr_type = build_pointer_type (char_type_node); tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type)); - tree gnu_byte_offset - = convert (sizetype, - size_diffop (size_zero_node, gnu_pos)); - gnu_byte_offset = fold_build1 (NEGATE_EXPR, sizetype, gnu_byte_offset); - gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr); gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type, ! gnu_ptr, gnu_byte_offset); } gnu_result = convert (gnu_result_type, gnu_ptr); --- 1385,1396 ---- if (TREE_CODE (gnu_obj_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_obj_type)) { ! tree gnu_char_ptr_type ! = build_pointer_type (unsigned_char_type_node); tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type)); gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr); gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type, ! gnu_ptr, gnu_pos); } gnu_result = convert (gnu_result_type, gnu_ptr); *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1365,1371 **** gnu_type = build_unc_object_type_from_ptr (gnu_ptr_type, gnu_actual_obj_type, ! get_identifier ("SIZE")); } gnu_result = TYPE_SIZE (gnu_type); --- 1474,1481 ---- gnu_type = build_unc_object_type_from_ptr (gnu_ptr_type, gnu_actual_obj_type, ! get_identifier ("SIZE"), ! false); } gnu_result = TYPE_SIZE (gnu_type); *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1376,1392 **** else gnu_result = rm_size (gnu_type); - gcc_assert (gnu_result); - /* Deal with a self-referential size by returning the maximum size for ! a type and by qualifying the size with the object for 'Size of an ! object. */ if (CONTAINS_PLACEHOLDER_P (gnu_result)) { ! if (TREE_CODE (gnu_prefix) != TYPE_DECL) ! gnu_result = substitute_placeholder_in_expr (gnu_result, gnu_expr); ! else gnu_result = max_size (gnu_result, true); } /* If the type contains a template, subtract its size. */ --- 1486,1499 ---- else gnu_result = rm_size (gnu_type); /* Deal with a self-referential size by returning the maximum size for ! a type and by qualifying the size with the object otherwise. */ if (CONTAINS_PLACEHOLDER_P (gnu_result)) { ! if (TREE_CODE (gnu_prefix) == TYPE_DECL) gnu_result = max_size (gnu_result, true); + else + gnu_result = substitute_placeholder_in_expr (gnu_result, gnu_expr); } /* If the type contains a template, subtract its size. */ *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1395,1405 **** gnu_result = size_binop (MINUS_EXPR, gnu_result, DECL_SIZE (TYPE_FIELDS (gnu_type))); ! gnu_result_type = get_unpadded_type (Etype (gnat_node)); ! if (attribute == Attr_Max_Size_In_Storage_Elements) ! gnu_result = fold_build2 (CEIL_DIV_EXPR, bitsizetype, ! gnu_result, bitsize_unit_node); break; case Attr_Alignment: --- 1502,1512 ---- gnu_result = size_binop (MINUS_EXPR, gnu_result, DECL_SIZE (TYPE_FIELDS (gnu_type))); ! /* For 'Max_Size_In_Storage_Elements, adjust the unit. */ if (attribute == Attr_Max_Size_In_Storage_Elements) ! gnu_result = size_binop (CEIL_DIV_EXPR, gnu_result, bitsize_unit_node); ! ! gnu_result_type = get_unpadded_type (Etype (gnat_node)); break; case Attr_Alignment: *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1526,1538 **** and the dimension in the cache and create a new one on failure. */ if (!optimize && Present (gnat_param)) { ! for (i = 0; VEC_iterate (parm_attr, f_parm_attr_cache, i, pa); i++) if (pa->id == gnat_param && pa->dim == Dimension) break; if (!pa) { ! pa = GGC_CNEW (struct parm_attr_d); pa->id = gnat_param; pa->dim = Dimension; VEC_safe_push (parm_attr, gc, f_parm_attr_cache, pa); --- 1633,1645 ---- and the dimension in the cache and create a new one on failure. */ if (!optimize && Present (gnat_param)) { ! FOR_EACH_VEC_ELT (parm_attr, f_parm_attr_cache, i, pa) if (pa->id == gnat_param && pa->dim == Dimension) break; if (!pa) { ! pa = ggc_alloc_cleared_parm_attr_d (); pa->id = gnat_param; pa->dim = Dimension; VEC_safe_push (parm_attr, gc, f_parm_attr_cache, pa); *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1597,1603 **** gnu_result = build_cond_expr (comp_type, build_binary_op (GE_EXPR, ! integer_type_node, hb, lb), gnu_result, convert (comp_type, integer_zero_node)); --- 1704,1710 ---- gnu_result = build_cond_expr (comp_type, build_binary_op (GE_EXPR, ! boolean_type_node, hb, lb), gnu_result, convert (comp_type, integer_zero_node)); *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1610,1622 **** gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix); /* Cache the expression we have just computed. Since we want to do it ! at runtime, we force the use of a SAVE_EXPR and let the gimplifier ! create the temporary. */ if (pa) { gnu_result = build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result); - TREE_SIDE_EFFECTS (gnu_result) = 1; if (attribute == Attr_First) pa->first = gnu_result; else if (attribute == Attr_Last) --- 1717,1730 ---- gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix); /* Cache the expression we have just computed. Since we want to do it ! at run time, we force the use of a SAVE_EXPR and let the gimplifier ! create the temporary in the outermost binding level. We will make ! sure in Subprogram_Body_to_gnu that it is evaluated on all possible ! paths by forcing its evaluation on entry of the function. */ if (pa) { gnu_result = build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result); if (attribute == Attr_First) pa->first = gnu_result; else if (attribute == Attr_Last) *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1831,1838 **** example in AARM 11.6(5.e). */ if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix) && !Is_Entity_Name (Prefix (gnat_node))) ! gnu_result = fold_build2 (COMPOUND_EXPR, TREE_TYPE (gnu_result), ! gnu_prefix, gnu_result); *gnu_result_type_p = gnu_result_type; return gnu_result; --- 1939,1946 ---- example in AARM 11.6(5.e). */ if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix) && !Is_Entity_Name (Prefix (gnat_node))) ! gnu_result = build_compound_expr (TREE_TYPE (gnu_result), gnu_prefix, ! gnu_result); *gnu_result_type_p = gnu_result_type; return gnu_result; *************** Attribute_to_gnu (Node_Id gnat_node, tre *** 1844,1852 **** static tree Case_Statement_to_gnu (Node_Id gnat_node) { ! tree gnu_result; ! tree gnu_expr; Node_Id gnat_when; gnu_expr = gnat_to_gnu (Expression (gnat_node)); gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr); --- 1952,1961 ---- static tree Case_Statement_to_gnu (Node_Id gnat_node) { ! tree gnu_result, gnu_expr, gnu_label; Node_Id gnat_when; + location_t end_locus; + bool may_fallthru = false; gnu_expr = gnat_to_gnu (Expression (gnat_node)); gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr); *************** Case_Statement_to_gnu (Node_Id gnat_node *** 1857,1864 **** is parenthesized. This still has the Etype of the name, but since it is not a name, para 7 does not apply, and we need to go to the base type. This is the only case where parenthesization affects the dynamic ! semantics (i.e. the range of possible values at runtime that is covered ! by the others alternative. Another exception is if the subtype of the expression is non-static. In that case, we also have to use the base type. */ --- 1966,1973 ---- is parenthesized. This still has the Etype of the name, but since it is not a name, para 7 does not apply, and we need to go to the base type. This is the only case where parenthesization affects the dynamic ! semantics (i.e. the range of possible values at run time that is covered ! by the others alternative). Another exception is if the subtype of the expression is non-static. In that case, we also have to use the base type. */ *************** Case_Statement_to_gnu (Node_Id gnat_node *** 1869,1884 **** /* We build a SWITCH_EXPR that contains the code with interspersed CASE_LABEL_EXPRs for each label. */ ! ! push_stack (&gnu_switch_label_stack, NULL_TREE, ! create_artificial_label (input_location)); start_stmt_group (); for (gnat_when = First_Non_Pragma (Alternatives (gnat_node)); Present (gnat_when); gnat_when = Next_Non_Pragma (gnat_when)) { Node_Id gnat_choice; - int choices_added = 0; /* First compile all the different case choices for the current WHEN alternative. */ --- 1978,1995 ---- /* We build a SWITCH_EXPR that contains the code with interspersed CASE_LABEL_EXPRs for each label. */ ! if (!Sloc_to_locus (Sloc (gnat_node) + UI_To_Int (End_Span (gnat_node)), ! &end_locus)) ! end_locus = input_location; ! gnu_label = create_artificial_label (end_locus); start_stmt_group (); + for (gnat_when = First_Non_Pragma (Alternatives (gnat_node)); Present (gnat_when); gnat_when = Next_Non_Pragma (gnat_when)) { + bool choices_added_p = false; Node_Id gnat_choice; /* First compile all the different case choices for the current WHEN alternative. */ *************** Case_Statement_to_gnu (Node_Id gnat_node *** 1929,1935 **** } /* If the case value is a subtype that raises Constraint_Error at ! run-time because of a wrong bound, then gnu_low or gnu_high is not translated into an INTEGER_CST. In such a case, we need to ensure that the when statement is not added in the tree, otherwise it will crash the gimplifier. */ --- 2040,2046 ---- } /* If the case value is a subtype that raises Constraint_Error at ! run time because of a wrong bound, then gnu_low or gnu_high is not translated into an INTEGER_CST. In such a case, we need to ensure that the when statement is not added in the tree, otherwise it will crash the gimplifier. */ *************** Case_Statement_to_gnu (Node_Id gnat_node *** 1941,1996 **** gnu_low, gnu_high, create_artificial_label (input_location)), gnat_choice); ! choices_added++; } } /* Push a binding level here in case variables are declared as we want them to be local to this set of statements instead of to the block containing the Case statement. */ ! if (choices_added > 0) { ! add_stmt (build_stmt_group (Statements (gnat_when), true)); ! add_stmt (build1 (GOTO_EXPR, void_type_node, ! TREE_VALUE (gnu_switch_label_stack))); } } ! /* Now emit a definition of the label all the cases branched to. */ ! add_stmt (build1 (LABEL_EXPR, void_type_node, ! TREE_VALUE (gnu_switch_label_stack))); gnu_result = build3 (SWITCH_EXPR, TREE_TYPE (gnu_expr), gnu_expr, end_stmt_group (), NULL_TREE); - pop_stack (&gnu_switch_label_stack); return gnu_result; } /* Subroutine of gnat_to_gnu to translate gnat_node, an N_Loop_Statement, to a GCC tree, which is returned. */ static tree Loop_Statement_to_gnu (Node_Id gnat_node) { ! /* ??? It would be nice to use "build" here, but there's no build5. */ ! tree gnu_loop_stmt = build_nt (LOOP_STMT, NULL_TREE, NULL_TREE, ! NULL_TREE, NULL_TREE, NULL_TREE); ! tree gnu_loop_var = NULL_TREE; ! Node_Id gnat_iter_scheme = Iteration_Scheme (gnat_node); ! tree gnu_cond_expr = NULL_TREE; tree gnu_result; ! TREE_TYPE (gnu_loop_stmt) = void_type_node; ! TREE_SIDE_EFFECTS (gnu_loop_stmt) = 1; ! LOOP_STMT_LABEL (gnu_loop_stmt) = create_artificial_label (input_location); set_expr_location_from_node (gnu_loop_stmt, gnat_node); Sloc_to_locus (Sloc (End_Label (gnat_node)), ! &DECL_SOURCE_LOCATION (LOOP_STMT_LABEL (gnu_loop_stmt))); ! /* Save the end label of this LOOP_STMT in a stack so that the corresponding N_Exit_Statement can find it. */ ! push_stack (&gnu_loop_label_stack, NULL_TREE, ! LOOP_STMT_LABEL (gnu_loop_stmt)); /* Set the condition under which the loop must keep going. For the case "LOOP .... END LOOP;" the condition is always true. */ --- 2052,2170 ---- gnu_low, gnu_high, create_artificial_label (input_location)), gnat_choice); ! choices_added_p = true; } } /* Push a binding level here in case variables are declared as we want them to be local to this set of statements instead of to the block containing the Case statement. */ ! if (choices_added_p) { ! tree group = build_stmt_group (Statements (gnat_when), true); ! bool group_may_fallthru = block_may_fallthru (group); ! add_stmt (group); ! if (group_may_fallthru) ! { ! tree stmt = build1 (GOTO_EXPR, void_type_node, gnu_label); ! SET_EXPR_LOCATION (stmt, end_locus); ! add_stmt (stmt); ! may_fallthru = true; ! } } } ! /* Now emit a definition of the label the cases branch to, if any. */ ! if (may_fallthru) ! add_stmt (build1 (LABEL_EXPR, void_type_node, gnu_label)); gnu_result = build3 (SWITCH_EXPR, TREE_TYPE (gnu_expr), gnu_expr, end_stmt_group (), NULL_TREE); return gnu_result; } + /* Return true if VAL (of type TYPE) can equal the minimum value if MAX is + false, or the maximum value if MAX is true, of TYPE. */ + + static bool + can_equal_min_or_max_val_p (tree val, tree type, bool max) + { + tree min_or_max_val = (max ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type)); + + if (TREE_CODE (min_or_max_val) != INTEGER_CST) + return true; + + if (TREE_CODE (val) == NOP_EXPR) + val = (max + ? TYPE_MAX_VALUE (TREE_TYPE (TREE_OPERAND (val, 0))) + : TYPE_MIN_VALUE (TREE_TYPE (TREE_OPERAND (val, 0)))); + + if (TREE_CODE (val) != INTEGER_CST) + return true; + + return tree_int_cst_equal (val, min_or_max_val) == 1; + } + + /* Return true if VAL (of type TYPE) can equal the minimum value of TYPE. + If REVERSE is true, minimum value is taken as maximum value. */ + + static inline bool + can_equal_min_val_p (tree val, tree type, bool reverse) + { + return can_equal_min_or_max_val_p (val, type, reverse); + } + + /* Return true if VAL (of type TYPE) can equal the maximum value of TYPE. + If REVERSE is true, maximum value is taken as minimum value. */ + + static inline bool + can_equal_max_val_p (tree val, tree type, bool reverse) + { + return can_equal_min_or_max_val_p (val, type, !reverse); + } + + /* Return true if VAL1 can be lower than VAL2. */ + + static bool + can_be_lower_p (tree val1, tree val2) + { + if (TREE_CODE (val1) == NOP_EXPR) + val1 = TYPE_MIN_VALUE (TREE_TYPE (TREE_OPERAND (val1, 0))); + + if (TREE_CODE (val1) != INTEGER_CST) + return true; + + if (TREE_CODE (val2) == NOP_EXPR) + val2 = TYPE_MAX_VALUE (TREE_TYPE (TREE_OPERAND (val2, 0))); + + if (TREE_CODE (val2) != INTEGER_CST) + return true; + + return tree_int_cst_lt (val1, val2); + } + /* Subroutine of gnat_to_gnu to translate gnat_node, an N_Loop_Statement, to a GCC tree, which is returned. */ static tree Loop_Statement_to_gnu (Node_Id gnat_node) { ! const Node_Id gnat_iter_scheme = Iteration_Scheme (gnat_node); ! tree gnu_loop_stmt = build4 (LOOP_STMT, void_type_node, NULL_TREE, ! NULL_TREE, NULL_TREE, NULL_TREE); ! tree gnu_loop_label = create_artificial_label (input_location); ! tree gnu_loop_var = NULL_TREE, gnu_cond_expr = NULL_TREE; tree gnu_result; ! /* Set location information for statement and end label. */ set_expr_location_from_node (gnu_loop_stmt, gnat_node); Sloc_to_locus (Sloc (End_Label (gnat_node)), ! &DECL_SOURCE_LOCATION (gnu_loop_label)); ! LOOP_STMT_LABEL (gnu_loop_stmt) = gnu_loop_label; ! /* Save the end label of this LOOP_STMT in a stack so that a corresponding N_Exit_Statement can find it. */ ! VEC_safe_push (tree, gc, gnu_loop_label_stack, gnu_loop_label); /* Set the condition under which the loop must keep going. For the case "LOOP .... END LOOP;" the condition is always true. */ *************** Loop_Statement_to_gnu (Node_Id gnat_node *** 1999,2009 **** /* For the case "WHILE condition LOOP ..... END LOOP;" it's immediate. */ else if (Present (Condition (gnat_iter_scheme))) ! LOOP_STMT_TOP_COND (gnu_loop_stmt) = gnat_to_gnu (Condition (gnat_iter_scheme)); ! /* Otherwise we have an iteration scheme and the condition is given by ! the bounds of the subtype of the iteration variable. */ else { Node_Id gnat_loop_spec = Loop_Parameter_Specification (gnat_iter_scheme); --- 2173,2183 ---- /* For the case "WHILE condition LOOP ..... END LOOP;" it's immediate. */ else if (Present (Condition (gnat_iter_scheme))) ! LOOP_STMT_COND (gnu_loop_stmt) = gnat_to_gnu (Condition (gnat_iter_scheme)); ! /* Otherwise we have an iteration scheme and the condition is given by the ! bounds of the subtype of the iteration variable. */ else { Node_Id gnat_loop_spec = Loop_Parameter_Specification (gnat_iter_scheme); *************** Loop_Statement_to_gnu (Node_Id gnat_node *** 2012,2104 **** tree gnu_type = get_unpadded_type (gnat_type); tree gnu_low = TYPE_MIN_VALUE (gnu_type); tree gnu_high = TYPE_MAX_VALUE (gnu_type); - tree gnu_first, gnu_last, gnu_limit; - enum tree_code update_code, end_code; tree gnu_base_type = get_base_type (gnu_type); ! /* We must disable modulo reduction for the loop variable, if any, in order for the loop comparison to be effective. */ ! if (Reverse_Present (gnat_loop_spec)) { gnu_first = gnu_high; gnu_last = gnu_low; update_code = MINUS_NOMOD_EXPR; ! end_code = GE_EXPR; ! gnu_limit = TYPE_MIN_VALUE (gnu_base_type); } else { gnu_first = gnu_low; gnu_last = gnu_high; update_code = PLUS_NOMOD_EXPR; ! end_code = LE_EXPR; ! gnu_limit = TYPE_MAX_VALUE (gnu_base_type); } ! /* We know the loop variable will not overflow if GNU_LAST is a constant ! and is not equal to GNU_LIMIT. If it might overflow, we have to move ! the limit test to the end of the loop. In that case, we have to test ! for an empty loop outside the loop. */ ! if (TREE_CODE (gnu_last) != INTEGER_CST ! || TREE_CODE (gnu_limit) != INTEGER_CST ! || tree_int_cst_equal (gnu_last, gnu_limit)) { ! gnu_cond_expr ! = build3 (COND_EXPR, void_type_node, ! build_binary_op (LE_EXPR, integer_type_node, ! gnu_low, gnu_high), ! NULL_TREE, alloc_stmt_list ()); ! set_expr_location_from_node (gnu_cond_expr, gnat_loop_spec); } /* Open a new nesting level that will surround the loop to declare the ! loop index variable. */ start_stmt_group (); gnat_pushlevel (); ! /* Declare the loop index and set it to its initial value. */ gnu_loop_var = gnat_to_gnu_entity (gnat_loop_var, gnu_first, 1); if (DECL_BY_REF_P (gnu_loop_var)) gnu_loop_var = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_loop_var); ! /* The loop variable might be a padded type, so use `convert' to get a ! reference to the inner variable if so. */ ! gnu_loop_var = convert (get_base_type (gnu_type), gnu_loop_var); ! /* Set either the top or bottom exit condition as appropriate depending ! on whether or not we know an overflow cannot occur. */ ! if (gnu_cond_expr) ! LOOP_STMT_BOT_COND (gnu_loop_stmt) ! = build_binary_op (NE_EXPR, integer_type_node, ! gnu_loop_var, gnu_last); ! else ! LOOP_STMT_TOP_COND (gnu_loop_stmt) ! = build_binary_op (end_code, integer_type_node, ! gnu_loop_var, gnu_last); LOOP_STMT_UPDATE (gnu_loop_stmt) ! = build_binary_op (MODIFY_EXPR, NULL_TREE, ! gnu_loop_var, ! build_binary_op (update_code, ! TREE_TYPE (gnu_loop_var), ! gnu_loop_var, ! convert (TREE_TYPE (gnu_loop_var), ! integer_one_node))); set_expr_location_from_node (LOOP_STMT_UPDATE (gnu_loop_stmt), gnat_iter_scheme); } /* If the loop was named, have the name point to this loop. In this case, ! the association is not a ..._DECL node, but the end label from this ! LOOP_STMT. */ if (Present (Identifier (gnat_node))) ! save_gnu_tree (Entity (Identifier (gnat_node)), ! LOOP_STMT_LABEL (gnu_loop_stmt), true); /* Make the loop body into its own block, so any allocated storage will be released every iteration. This is needed for stack allocation. */ LOOP_STMT_BODY (gnu_loop_stmt) = build_stmt_group (Statements (gnat_node), true); /* If we declared a variable, then we are in a statement group for that declaration. Add the LOOP_STMT to it and make that the "loop". */ --- 2186,2368 ---- tree gnu_type = get_unpadded_type (gnat_type); tree gnu_low = TYPE_MIN_VALUE (gnu_type); tree gnu_high = TYPE_MAX_VALUE (gnu_type); tree gnu_base_type = get_base_type (gnu_type); + tree gnu_one_node = convert (gnu_base_type, integer_one_node); + tree gnu_first, gnu_last; + enum tree_code update_code, test_code, shift_code; + bool reverse = Reverse_Present (gnat_loop_spec), fallback = false; ! /* We must disable modulo reduction for the iteration variable, if any, in order for the loop comparison to be effective. */ ! if (reverse) { gnu_first = gnu_high; gnu_last = gnu_low; update_code = MINUS_NOMOD_EXPR; ! test_code = GE_EXPR; ! shift_code = PLUS_NOMOD_EXPR; } else { gnu_first = gnu_low; gnu_last = gnu_high; update_code = PLUS_NOMOD_EXPR; ! test_code = LE_EXPR; ! shift_code = MINUS_NOMOD_EXPR; } ! /* We use two different strategies to translate the loop, depending on ! whether optimization is enabled. ! ! If it is, we try to generate the canonical form of loop expected by ! the loop optimizer, which is the do-while form: ! ! ENTRY_COND ! loop: ! TOP_UPDATE ! BODY ! BOTTOM_COND ! GOTO loop ! ! This makes it possible to bypass loop header copying and to turn the ! BOTTOM_COND into an inequality test. This should catch (almost) all ! loops with constant starting point. If we cannot, we try to generate ! the default form, which is: ! ! loop: ! TOP_COND ! BODY ! BOTTOM_UPDATE ! GOTO loop ! ! It will be rotated during loop header copying and an entry test added ! to yield the do-while form. This should catch (almost) all loops with ! constant ending point. If we cannot, we generate the fallback form: ! ! ENTRY_COND ! loop: ! BODY ! BOTTOM_COND ! BOTTOM_UPDATE ! GOTO loop ! ! which works in all cases but for which loop header copying will copy ! the BOTTOM_COND, thus adding a third conditional branch. ! ! If optimization is disabled, loop header copying doesn't come into ! play and we try to generate the loop forms with the less conditional ! branches directly. First, the default form, it should catch (almost) ! all loops with constant ending point. Then, if we cannot, we try to ! generate the shifted form: ! ! loop: ! TOP_COND ! TOP_UPDATE ! BODY ! GOTO loop ! ! which should catch loops with constant starting point. Otherwise, if ! we cannot, we generate the fallback form. */ ! ! if (optimize) { ! /* We can use the do-while form if GNU_FIRST-1 doesn't overflow. */ ! if (!can_equal_min_val_p (gnu_first, gnu_base_type, reverse)) ! { ! gnu_first = build_binary_op (shift_code, gnu_base_type, ! gnu_first, gnu_one_node); ! LOOP_STMT_TOP_UPDATE_P (gnu_loop_stmt) = 1; ! LOOP_STMT_BOTTOM_COND_P (gnu_loop_stmt) = 1; ! } ! ! /* Otherwise, we can use the default form if GNU_LAST+1 doesn't. */ ! else if (!can_equal_max_val_p (gnu_last, gnu_base_type, reverse)) ! ; ! ! /* Otherwise, use the fallback form. */ ! else ! fallback = true; ! } ! else ! { ! /* We can use the default form if GNU_LAST+1 doesn't overflow. */ ! if (!can_equal_max_val_p (gnu_last, gnu_base_type, reverse)) ! ; ! ! /* Otherwise, we can use the shifted form if neither GNU_FIRST-1 nor ! GNU_LAST-1 does. */ ! else if (!can_equal_min_val_p (gnu_first, gnu_base_type, reverse) ! && !can_equal_min_val_p (gnu_last, gnu_base_type, reverse)) ! { ! gnu_first = build_binary_op (shift_code, gnu_base_type, ! gnu_first, gnu_one_node); ! gnu_last = build_binary_op (shift_code, gnu_base_type, ! gnu_last, gnu_one_node); ! LOOP_STMT_TOP_UPDATE_P (gnu_loop_stmt) = 1; ! } ! ! /* Otherwise, use the fallback form. */ ! else ! fallback = true; ! } ! ! if (fallback) ! LOOP_STMT_BOTTOM_COND_P (gnu_loop_stmt) = 1; ! ! /* If we use the BOTTOM_COND, we can turn the test into an inequality ! test but we may have to add ENTRY_COND to protect the empty loop. */ ! if (LOOP_STMT_BOTTOM_COND_P (gnu_loop_stmt)) ! { ! test_code = NE_EXPR; ! if (can_be_lower_p (gnu_high, gnu_low)) ! { ! gnu_cond_expr ! = build3 (COND_EXPR, void_type_node, ! build_binary_op (LE_EXPR, boolean_type_node, ! gnu_low, gnu_high), ! NULL_TREE, alloc_stmt_list ()); ! set_expr_location_from_node (gnu_cond_expr, gnat_loop_spec); ! } } /* Open a new nesting level that will surround the loop to declare the ! iteration variable. */ start_stmt_group (); gnat_pushlevel (); ! /* Declare the iteration variable and set it to its initial value. */ gnu_loop_var = gnat_to_gnu_entity (gnat_loop_var, gnu_first, 1); if (DECL_BY_REF_P (gnu_loop_var)) gnu_loop_var = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_loop_var); ! /* Do all the arithmetics in the base type. */ ! gnu_loop_var = convert (gnu_base_type, gnu_loop_var); ! /* Set either the top or bottom exit condition. */ ! LOOP_STMT_COND (gnu_loop_stmt) ! = build_binary_op (test_code, boolean_type_node, gnu_loop_var, ! gnu_last); + /* Set either the top or bottom update statement and give it the source + location of the iteration for better coverage info. */ LOOP_STMT_UPDATE (gnu_loop_stmt) ! = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_loop_var, ! build_binary_op (update_code, gnu_base_type, ! gnu_loop_var, gnu_one_node)); set_expr_location_from_node (LOOP_STMT_UPDATE (gnu_loop_stmt), gnat_iter_scheme); } /* If the loop was named, have the name point to this loop. In this case, ! the association is not a DECL node, but the end label of the loop. */ if (Present (Identifier (gnat_node))) ! save_gnu_tree (Entity (Identifier (gnat_node)), gnu_loop_label, true); /* Make the loop body into its own block, so any allocated storage will be released every iteration. This is needed for stack allocation. */ LOOP_STMT_BODY (gnu_loop_stmt) = build_stmt_group (Statements (gnat_node), true); + TREE_SIDE_EFFECTS (gnu_loop_stmt) = 1; /* If we declared a variable, then we are in a statement group for that declaration. Add the LOOP_STMT to it and make that the "loop". */ *************** Loop_Statement_to_gnu (Node_Id gnat_node *** 2120,2126 **** else gnu_result = gnu_loop_stmt; ! pop_stack (&gnu_loop_label_stack); return gnu_result; } --- 2384,2390 ---- else gnu_result = gnu_loop_stmt; ! VEC_pop (tree, gnu_loop_label_stack); return gnu_result; } *************** establish_gnat_vms_condition_handler (vo *** 2155,2161 **** gnat_vms_condition_handler_decl = create_subprog_decl (get_identifier ("__gnat_handle_vms_condition"), NULL_TREE, ! build_function_type_list (integer_type_node, ptr_void_type_node, ptr_void_type_node, NULL_TREE), --- 2419,2425 ---- gnat_vms_condition_handler_decl = create_subprog_decl (get_identifier ("__gnat_handle_vms_condition"), NULL_TREE, ! build_function_type_list (boolean_type_node, ptr_void_type_node, ptr_void_type_node, NULL_TREE), *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2196,2204 **** ? Corresponding_Spec (gnat_node) : Defining_Entity (gnat_node)); /* The FUNCTION_DECL node corresponding to the subprogram spec. */ tree gnu_subprog_decl; ! /* The FUNCTION_TYPE node corresponding to the subprogram spec. */ tree gnu_subprog_type; tree gnu_cico_list; tree gnu_result; VEC(parm_attr,gc) *cache; --- 2460,2473 ---- ? Corresponding_Spec (gnat_node) : Defining_Entity (gnat_node)); /* The FUNCTION_DECL node corresponding to the subprogram spec. */ tree gnu_subprog_decl; ! /* Its RESULT_DECL node. */ ! tree gnu_result_decl; ! /* Its FUNCTION_TYPE node. */ tree gnu_subprog_type; + /* The TYPE_CI_CO_LIST of its FUNCTION_TYPE node, if any. */ tree gnu_cico_list; + /* The entry in the CI_CO_LIST that represents a function return, if any. */ + tree gnu_return_var_elmt = NULL_TREE; tree gnu_result; VEC(parm_attr,gc) *cache; *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2219,2226 **** = gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, Acts_As_Spec (gnat_node) && !present_gnu_tree (gnat_subprog_id)); ! gnu_subprog_type = TREE_TYPE (gnu_subprog_decl); /* Propagate the debug mode. */ if (!Needs_Debug_Info (gnat_subprog_id)) --- 2488,2508 ---- = gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, Acts_As_Spec (gnat_node) && !present_gnu_tree (gnat_subprog_id)); ! gnu_result_decl = DECL_RESULT (gnu_subprog_decl); gnu_subprog_type = TREE_TYPE (gnu_subprog_decl); + gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type); + if (gnu_cico_list) + gnu_return_var_elmt = value_member (void_type_node, gnu_cico_list); + + /* If the function returns by invisible reference, make it explicit in the + function body. See gnat_to_gnu_entity, E_Subprogram_Type case. + Handle the explicit case here and the copy-in/copy-out case below. */ + if (TREE_ADDRESSABLE (gnu_subprog_type) && !gnu_return_var_elmt) + { + TREE_TYPE (gnu_result_decl) + = build_reference_type (TREE_TYPE (gnu_result_decl)); + relayout_decl (gnu_result_decl); + } /* Propagate the debug mode. */ if (!Needs_Debug_Info (gnat_subprog_id)) *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2233,2254 **** /* Initialize the information structure for the function. */ allocate_struct_function (gnu_subprog_decl, false); DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language ! = GGC_CNEW (struct language_function); begin_subprog_body (gnu_subprog_decl); /* If there are In Out or Out parameters, we need to ensure that the return statement properly copies them out. We do this by making a new block and converting any return into a goto to a label at the end of the block. */ - gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type); if (gnu_cico_list) { ! push_stack (&gnu_return_label_stack, NULL_TREE, ! create_artificial_label (input_location)); start_stmt_group (); gnat_pushlevel (); /* See whether there are parameters for which we don't have a GCC tree yet. These must be Out parameters. Make a VAR_DECL for them and put it into TYPE_CI_CO_LIST, which must contain an empty entry too. --- 2515,2560 ---- /* Initialize the information structure for the function. */ allocate_struct_function (gnu_subprog_decl, false); DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language ! = ggc_alloc_cleared_language_function (); ! set_cfun (NULL); begin_subprog_body (gnu_subprog_decl); /* If there are In Out or Out parameters, we need to ensure that the return statement properly copies them out. We do this by making a new block and converting any return into a goto to a label at the end of the block. */ if (gnu_cico_list) { ! tree gnu_return_var = NULL_TREE; ! ! VEC_safe_push (tree, gc, gnu_return_label_stack, ! create_artificial_label (input_location)); start_stmt_group (); gnat_pushlevel (); + /* If this is a function with In Out or Out parameters, we also need a + variable for the return value to be placed. */ + if (gnu_return_var_elmt) + { + tree gnu_return_type + = TREE_TYPE (TREE_PURPOSE (gnu_return_var_elmt)); + + /* If the function returns by invisible reference, make it + explicit in the function body. See gnat_to_gnu_entity, + E_Subprogram_Type case. */ + if (TREE_ADDRESSABLE (gnu_subprog_type)) + gnu_return_type = build_reference_type (gnu_return_type); + + gnu_return_var + = create_var_decl (get_identifier ("RETVAL"), NULL_TREE, + gnu_return_type, NULL_TREE, false, false, + false, false, NULL, gnat_subprog_id); + TREE_VALUE (gnu_return_var_elmt) = gnu_return_var; + } + + VEC_safe_push (tree, gc, gnu_return_var_stack, gnu_return_var); + /* See whether there are parameters for which we don't have a GCC tree yet. These must be Out parameters. Make a VAR_DECL for them and put it into TYPE_CI_CO_LIST, which must contain an empty entry too. *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2273,2279 **** } } else ! push_stack (&gnu_return_label_stack, NULL_TREE, NULL_TREE); /* Get a tree corresponding to the code for the subprogram. */ start_stmt_group (); --- 2579,2585 ---- } } else ! VEC_safe_push (tree, gc, gnu_return_label_stack, NULL_TREE); /* Get a tree corresponding to the code for the subprogram. */ start_stmt_group (); *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2303,2308 **** --- 2609,2639 ---- gnat_poplevel (); gnu_result = end_stmt_group (); + /* If we populated the parameter attributes cache, we need to make sure that + the cached expressions are evaluated on all the possible paths leading to + their uses. So we force their evaluation on entry of the function. */ + cache = DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language->parm_attr_cache; + if (cache) + { + struct parm_attr_d *pa; + int i; + + start_stmt_group (); + + FOR_EACH_VEC_ELT (parm_attr, cache, i, pa) + { + if (pa->first) + add_stmt_with_node_force (pa->first, gnat_node); + if (pa->last) + add_stmt_with_node_force (pa->last, gnat_node); + if (pa->length) + add_stmt_with_node_force (pa->length, gnat_node); + } + + add_stmt (gnu_result); + gnu_result = end_stmt_group (); + } + /* If we are dealing with a return from an Ada procedure with parameters passed by copy-in/copy-out, we need to return a record containing the final values of these parameters. If the list contains only one entry, *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2321,2379 **** add_stmt (gnu_result); add_stmt (build1 (LABEL_EXPR, void_type_node, ! TREE_VALUE (gnu_return_label_stack))); if (list_length (gnu_cico_list) == 1) gnu_retval = TREE_VALUE (gnu_cico_list); else ! gnu_retval = gnat_build_constructor (TREE_TYPE (gnu_subprog_type), ! gnu_cico_list); ! ! if (DECL_P (gnu_retval) && DECL_BY_REF_P (gnu_retval)) ! gnu_retval = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_retval); ! add_stmt_with_node ! (build_return_expr (DECL_RESULT (gnu_subprog_decl), gnu_retval), ! End_Label (Handled_Statement_Sequence (gnat_node))); gnat_poplevel (); gnu_result = end_stmt_group (); } ! pop_stack (&gnu_return_label_stack); ! ! /* If we populated the parameter attributes cache, we need to make sure ! that the cached expressions are evaluated on all possible paths. */ ! cache = DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language->parm_attr_cache; ! if (cache) ! { ! struct parm_attr_d *pa; ! int i; ! ! start_stmt_group (); ! ! for (i = 0; VEC_iterate (parm_attr, cache, i, pa); i++) ! { ! if (pa->first) ! add_stmt_with_node (pa->first, gnat_node); ! if (pa->last) ! add_stmt_with_node (pa->last, gnat_node); ! if (pa->length) ! add_stmt_with_node (pa->length, gnat_node); ! } ! ! add_stmt (gnu_result); ! gnu_result = end_stmt_group (); ! } ! ! /* Set the end location. */ ! Sloc_to_locus ! ((Present (End_Label (Handled_Statement_Sequence (gnat_node))) ! ? Sloc (End_Label (Handled_Statement_Sequence (gnat_node))) ! : Sloc (gnat_node)), ! &DECL_STRUCT_FUNCTION (gnu_subprog_decl)->function_end_locus); end_subprog_body (gnu_result); /* Finally annotate the parameters and disconnect the trees for parameters that we have turned into variables since they are now unusable. */ for (gnat_param = First_Formal_With_Extras (gnat_subprog_id); --- 2652,2681 ---- add_stmt (gnu_result); add_stmt (build1 (LABEL_EXPR, void_type_node, ! VEC_last (tree, gnu_return_label_stack))); if (list_length (gnu_cico_list) == 1) gnu_retval = TREE_VALUE (gnu_cico_list); else ! gnu_retval = build_constructor_from_list (TREE_TYPE (gnu_subprog_type), ! gnu_cico_list); ! add_stmt_with_node (build_return_expr (gnu_result_decl, gnu_retval), ! End_Label (Handled_Statement_Sequence (gnat_node))); gnat_poplevel (); gnu_result = end_stmt_group (); } ! VEC_pop (tree, gnu_return_label_stack); end_subprog_body (gnu_result); + /* Attempt setting the end_locus of our GCC body tree, typically a + BIND_EXPR or STATEMENT_LIST, then the end_locus of our GCC subprogram + declaration tree. */ + set_end_locus_from_node (gnu_result, gnat_node); + set_end_locus_from_node (gnu_subprog_decl, gnat_node); + /* Finally annotate the parameters and disconnect the trees for parameters that we have turned into variables since they are now unusable. */ for (gnat_param = First_Formal_With_Extras (gnat_subprog_id); *************** Subprogram_Body_to_gnu (Node_Id gnat_nod *** 2381,2545 **** gnat_param = Next_Formal_With_Extras (gnat_param)) { tree gnu_param = get_gnu_tree (gnat_param); annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE, ! DECL_BY_REF_P (gnu_param)); ! if (TREE_CODE (gnu_param) == VAR_DECL) save_gnu_tree (gnat_param, NULL_TREE, false); } if (DECL_FUNCTION_STUB (gnu_subprog_decl)) build_function_stub (gnu_subprog_decl, gnat_subprog_id); mark_out_of_scope (Defining_Unit_Name (Specification (gnat_node))); } /* Subroutine of gnat_to_gnu to translate gnat_node, either an N_Function_Call or an N_Procedure_Call_Statement, to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer to where we should place the result type. ! If GNU_TARGET is non-null, this must be a function call and the result ! of the call is to be placed into that object. */ static tree call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) { - tree gnu_result; /* The GCC node corresponding to the GNAT subprogram name. This can either be a FUNCTION_DECL node if we are dealing with a standard subprogram call, or an indirect reference expression (an INDIRECT_REF node) pointing to a subprogram. */ ! tree gnu_subprog_node = gnat_to_gnu (Name (gnat_node)); /* The FUNCTION_TYPE node giving the GCC type of the subprogram. */ ! tree gnu_subprog_type = TREE_TYPE (gnu_subprog_node); ! tree gnu_subprog_addr = build_unary_op (ADDR_EXPR, NULL_TREE, ! gnu_subprog_node); Entity_Id gnat_formal; Node_Id gnat_actual; ! tree gnu_actual_list = NULL_TREE; tree gnu_name_list = NULL_TREE; tree gnu_before_list = NULL_TREE; tree gnu_after_list = NULL_TREE; ! tree gnu_subprog_call; gcc_assert (TREE_CODE (gnu_subprog_type) == FUNCTION_TYPE); ! /* If we are calling a stubbed function, make this into a raise of ! Program_Error. Elaborate all our args first. */ ! if (TREE_CODE (gnu_subprog_node) == FUNCTION_DECL ! && DECL_STUBBED_P (gnu_subprog_node)) { for (gnat_actual = First_Actual (gnat_node); Present (gnat_actual); gnat_actual = Next_Actual (gnat_actual)) add_stmt (gnat_to_gnu (gnat_actual)); ! { ! tree call_expr ! = build_call_raise (PE_Stubbed_Subprogram_Called, gnat_node, ! N_Raise_Program_Error); ! ! if (Nkind (gnat_node) == N_Function_Call && !gnu_target) ! { ! *gnu_result_type_p = TREE_TYPE (gnu_subprog_type); ! return build1 (NULL_EXPR, *gnu_result_type_p, call_expr); ! } ! else ! return call_expr; ! } ! } ! ! /* If we are calling by supplying a pointer to a target, set up that pointer ! as the first argument. Use GNU_TARGET if one was passed; otherwise, make ! a target by building a variable and use the maximum size of the type if ! it has self-referential size. */ ! if (TYPE_RETURNS_BY_TARGET_PTR_P (gnu_subprog_type)) ! { ! tree gnu_ret_type ! = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (gnu_subprog_type))); ! ! if (!gnu_target) { ! tree gnu_obj_type; ! ! if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_ret_type))) ! gnu_obj_type ! = maybe_pad_type (gnu_ret_type, ! max_size (TYPE_SIZE (gnu_ret_type), true), ! 0, Etype (Name (gnat_node)), false, false, ! false, true); ! else ! gnu_obj_type = gnu_ret_type; ! ! /* ??? We may be about to create a static temporary if we happen to ! be at the global binding level. That's a regression from what ! the 3.x back-end would generate in the same situation, but we ! don't have a mechanism in Gigi for creating automatic variables ! in the elaboration routines. */ ! gnu_target ! = create_var_decl (create_tmp_var_name ("LR"), NULL, gnu_obj_type, ! NULL, false, false, false, false, NULL, ! gnat_node); } ! gnu_actual_list ! = tree_cons (NULL_TREE, ! build_unary_op (ADDR_EXPR, NULL_TREE, ! unchecked_convert (gnu_ret_type, ! gnu_target, ! false)), ! NULL_TREE); ! } /* The only way we can be making a call via an access type is if Name is an explicit dereference. In that case, get the list of formal args from the ! type the access type is pointing to. Otherwise, get the formals from entity being called. */ if (Nkind (Name (gnat_node)) == N_Explicit_Dereference) gnat_formal = First_Formal_With_Extras (Etype (Name (gnat_node))); else if (Nkind (Name (gnat_node)) == N_Attribute_Reference) /* Assume here that this must be 'Elab_Body or 'Elab_Spec. */ ! gnat_formal = 0; else gnat_formal = First_Formal_With_Extras (Entity (Name (gnat_node))); ! /* Create the list of the actual parameters as GCC expects it, namely a chain ! of TREE_LIST nodes in which the TREE_VALUE field of each node is a ! parameter-expression and the TREE_PURPOSE field is null. Skip Out ! parameters not passed by reference and don't need to be copied in. */ for (gnat_actual = First_Actual (gnat_node); Present (gnat_actual); gnat_formal = Next_Formal_With_Extras (gnat_formal), gnat_actual = Next_Actual (gnat_actual)) { ! tree gnu_formal ! = (present_gnu_tree (gnat_formal) ! ? get_gnu_tree (gnat_formal) : NULL_TREE); tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal)); ! /* We must suppress conversions that can cause the creation of a ! temporary in the Out or In Out case because we need the real ! object in this case, either to pass its address if it's passed ! by reference or as target of the back copy done after the call ! if it uses the copy-in copy-out mechanism. We do it in the In ! case too, except for an unchecked conversion because it alone ! can cause the actual to be misaligned and the addressability ! test is applied to the real object. */ bool suppress_type_conversion = ((Nkind (gnat_actual) == N_Unchecked_Type_Conversion && Ekind (gnat_formal) != E_In_Parameter) || (Nkind (gnat_actual) == N_Type_Conversion && Is_Composite_Type (Underlying_Type (Etype (gnat_formal))))); ! Node_Id gnat_name = (suppress_type_conversion ! ? Expression (gnat_actual) : gnat_actual); tree gnu_name = gnat_to_gnu (gnat_name), gnu_name_type; tree gnu_actual; /* If it's possible we may need to use this expression twice, make sure ! that any side-effects are handled via SAVE_EXPRs. Likewise if we need to force side-effects before the call. ??? This is more conservative than we need since we don't need to do this for pass-by-ref with no conversion. */ if (Ekind (gnat_formal) != E_In_Parameter) ! gnu_name = gnat_stabilize_reference (gnu_name, true); /* If we are passing a non-addressable parameter by reference, pass the address of a copy. In the Out or In Out case, set up to copy back --- 2683,2850 ---- gnat_param = Next_Formal_With_Extras (gnat_param)) { tree gnu_param = get_gnu_tree (gnat_param); + bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL); + annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE, ! DECL_BY_REF_P (gnu_param), ! !is_var_decl && DECL_BY_DOUBLE_REF_P (gnu_param)); ! ! if (is_var_decl) save_gnu_tree (gnat_param, NULL_TREE, false); } if (DECL_FUNCTION_STUB (gnu_subprog_decl)) build_function_stub (gnu_subprog_decl, gnat_subprog_id); + if (gnu_return_var_elmt) + TREE_VALUE (gnu_return_var_elmt) = void_type_node; + mark_out_of_scope (Defining_Unit_Name (Specification (gnat_node))); } + + /* Create a temporary variable with PREFIX and initialize it with GNU_INIT. + Put the initialization statement into GNU_INIT_STMT and annotate it with + the SLOC of GNAT_NODE. Return the temporary variable. */ + + static tree + create_init_temporary (const char *prefix, tree gnu_init, tree *gnu_init_stmt, + Node_Id gnat_node) + { + tree gnu_temp = create_var_decl (create_tmp_var_name (prefix), NULL_TREE, + TREE_TYPE (gnu_init), NULL_TREE, false, + false, false, false, NULL, Empty); + DECL_ARTIFICIAL (gnu_temp) = 1; + DECL_IGNORED_P (gnu_temp) = 1; + + *gnu_init_stmt = build_binary_op (INIT_EXPR, NULL_TREE, gnu_temp, gnu_init); + set_expr_location_from_node (*gnu_init_stmt, gnat_node); + + return gnu_temp; + } + /* Subroutine of gnat_to_gnu to translate gnat_node, either an N_Function_Call or an N_Procedure_Call_Statement, to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer to where we should place the result type. ! If GNU_TARGET is non-null, this must be a function call on the RHS of a ! N_Assignment_Statement and the result is to be placed into that object. */ static tree call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) { /* The GCC node corresponding to the GNAT subprogram name. This can either be a FUNCTION_DECL node if we are dealing with a standard subprogram call, or an indirect reference expression (an INDIRECT_REF node) pointing to a subprogram. */ ! tree gnu_subprog = gnat_to_gnu (Name (gnat_node)); /* The FUNCTION_TYPE node giving the GCC type of the subprogram. */ ! tree gnu_subprog_type = TREE_TYPE (gnu_subprog); ! tree gnu_subprog_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_subprog); Entity_Id gnat_formal; Node_Id gnat_actual; ! VEC(tree,gc) *gnu_actual_vec = NULL; tree gnu_name_list = NULL_TREE; tree gnu_before_list = NULL_TREE; tree gnu_after_list = NULL_TREE; ! tree gnu_call, gnu_result; ! bool returning_value = (Nkind (gnat_node) == N_Function_Call && !gnu_target); ! bool pushed_binding_level = false; ! bool went_into_elab_proc = false; gcc_assert (TREE_CODE (gnu_subprog_type) == FUNCTION_TYPE); ! /* If we are calling a stubbed function, raise Program_Error, but Elaborate ! all our args first. */ ! if (TREE_CODE (gnu_subprog) == FUNCTION_DECL && DECL_STUBBED_P (gnu_subprog)) { + tree call_expr = build_call_raise (PE_Stubbed_Subprogram_Called, + gnat_node, N_Raise_Program_Error); + for (gnat_actual = First_Actual (gnat_node); Present (gnat_actual); gnat_actual = Next_Actual (gnat_actual)) add_stmt (gnat_to_gnu (gnat_actual)); ! if (returning_value) { ! *gnu_result_type_p = TREE_TYPE (gnu_subprog_type); ! return build1 (NULL_EXPR, TREE_TYPE (gnu_subprog_type), call_expr); } ! return call_expr; } /* The only way we can be making a call via an access type is if Name is an explicit dereference. In that case, get the list of formal args from the ! type the access type is pointing to. Otherwise, get the formals from the entity being called. */ if (Nkind (Name (gnat_node)) == N_Explicit_Dereference) gnat_formal = First_Formal_With_Extras (Etype (Name (gnat_node))); else if (Nkind (Name (gnat_node)) == N_Attribute_Reference) /* Assume here that this must be 'Elab_Body or 'Elab_Spec. */ ! gnat_formal = Empty; else gnat_formal = First_Formal_With_Extras (Entity (Name (gnat_node))); ! /* If we are translating a statement, push a new binding level that will ! surround it to declare the temporaries created for the call. Likewise ! if we'll be returning a value and also have copy-in/copy-out parameters, ! as we need to create statements to fetch their value after the call. ! ! ??? We could do that unconditionally, but the middle-end doesn't seem ! to be prepared to handle the construct in nested contexts. */ ! if (!returning_value || TYPE_CI_CO_LIST (gnu_subprog_type)) ! { ! start_stmt_group (); ! gnat_pushlevel (); ! pushed_binding_level = true; ! } ! ! /* The lifetime of the temporaries created for the call ends with the call ! so we can give them the scope of the elaboration routine at top level. */ ! if (!current_function_decl) ! { ! current_function_decl = get_elaboration_procedure (); ! went_into_elab_proc = true; ! } ! ! /* Create the list of the actual parameters as GCC expects it, namely a ! chain of TREE_LIST nodes in which the TREE_VALUE field of each node ! is an expression and the TREE_PURPOSE field is null. But skip Out ! parameters not passed by reference and that need not be copied in. */ for (gnat_actual = First_Actual (gnat_node); Present (gnat_actual); gnat_formal = Next_Formal_With_Extras (gnat_formal), gnat_actual = Next_Actual (gnat_actual)) { ! tree gnu_formal = present_gnu_tree (gnat_formal) ! ? get_gnu_tree (gnat_formal) : NULL_TREE; tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal)); ! /* In the Out or In Out case, we must suppress conversions that yield ! an lvalue but can nevertheless cause the creation of a temporary, ! because we need the real object in this case, either to pass its ! address if it's passed by reference or as target of the back copy ! done after the call if it uses the copy-in copy-out mechanism. ! We do it in the In case too, except for an unchecked conversion ! because it alone can cause the actual to be misaligned and the ! addressability test is applied to the real object. */ bool suppress_type_conversion = ((Nkind (gnat_actual) == N_Unchecked_Type_Conversion && Ekind (gnat_formal) != E_In_Parameter) || (Nkind (gnat_actual) == N_Type_Conversion && Is_Composite_Type (Underlying_Type (Etype (gnat_formal))))); ! Node_Id gnat_name = suppress_type_conversion ! ? Expression (gnat_actual) : gnat_actual; tree gnu_name = gnat_to_gnu (gnat_name), gnu_name_type; tree gnu_actual; /* If it's possible we may need to use this expression twice, make sure ! that any side-effects are handled via SAVE_EXPRs; likewise if we need to force side-effects before the call. ??? This is more conservative than we need since we don't need to do this for pass-by-ref with no conversion. */ if (Ekind (gnat_formal) != E_In_Parameter) ! gnu_name = gnat_stabilize_reference (gnu_name, true, NULL); /* If we are passing a non-addressable parameter by reference, pass the address of a copy. In the Out or In Out case, set up to copy back *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2552,2571 **** && (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name))) && !addressable_p (gnu_name, gnu_name_type)) { ! tree gnu_copy = gnu_name; ! /* If the type is by_reference, a copy is not allowed. */ ! if (Is_By_Reference_Type (Etype (gnat_formal))) ! post_error ! ("misaligned actual cannot be passed by reference", gnat_actual); ! /* For users of Starlet we issue a warning because the ! interface apparently assumes that by-ref parameters ! outlive the procedure invocation. The code still ! will not work as intended, but we cannot do much ! better since other low-level parts of the back-end ! would allocate temporaries at will because of the ! misalignment if we did not do so here. */ else if (Is_Valued_Procedure (Entity (Name (gnat_node)))) { post_error --- 2857,2881 ---- && (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name))) && !addressable_p (gnu_name, gnu_name_type)) { ! bool in_param = (Ekind (gnat_formal) == E_In_Parameter); ! tree gnu_orig = gnu_name, gnu_temp, gnu_stmt; ! /* Do not issue warnings for CONSTRUCTORs since this is not a copy ! but sort of an instantiation for them. */ ! if (TREE_CODE (gnu_name) == CONSTRUCTOR) ! ; ! /* If the type is passed by reference, a copy is not allowed. */ ! else if (TREE_ADDRESSABLE (gnu_formal_type)) ! post_error ("misaligned actual cannot be passed by reference", ! gnat_actual); ! ! /* For users of Starlet we issue a warning because the interface ! apparently assumes that by-ref parameters outlive the procedure ! invocation. The code still will not work as intended, but we ! cannot do much better since low-level parts of the back-end ! would allocate temporaries at will because of the misalignment ! if we did not do so here. */ else if (Is_Valued_Procedure (Entity (Name (gnat_node)))) { post_error *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2584,2622 **** && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_name_type))) ; ! /* Otherwise remove unpadding from the object and reset the copy. */ else if (TREE_CODE (gnu_name) == COMPONENT_REF && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_name, 0)))) ! gnu_name = gnu_copy = TREE_OPERAND (gnu_name, 0); ! /* Otherwise convert to the nominal type of the object if it's ! a record type. There are several cases in which we need to ! make the temporary using this type instead of the actual type ! of the object if they are distinct, because the expectations ! of the callee would otherwise not be met: - if it's a justified modular type, ! - if the actual type is a smaller packable version of it. */ ! else if (TREE_CODE (gnu_name_type) == RECORD_TYPE ! && (TYPE_JUSTIFIED_MODULAR_P (gnu_name_type) ! || smaller_packable_type_p (TREE_TYPE (gnu_name), ! gnu_name_type))) gnu_name = convert (gnu_name_type, gnu_name); ! /* Make a SAVE_EXPR to both properly account for potential side ! effects and handle the creation of a temporary copy. Special ! code in gnat_gimplify_expr ensures that the same temporary is ! used as the object and copied back after the call if needed. */ ! gnu_name = build1 (SAVE_EXPR, TREE_TYPE (gnu_name), gnu_name); ! TREE_SIDE_EFFECTS (gnu_name) = 1; ! /* Set up to move the copy back to the original. */ ! if (Ekind (gnat_formal) != E_In_Parameter) { ! tree stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_copy, ! gnu_name); ! set_expr_location_from_node (stmt, gnat_node); ! append_to_statement_list (stmt, &gnu_after_list); } } --- 2894,2949 ---- && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_name_type))) ; ! /* Otherwise remove the unpadding from all the objects. */ else if (TREE_CODE (gnu_name) == COMPONENT_REF && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_name, 0)))) ! gnu_orig = gnu_name = TREE_OPERAND (gnu_name, 0); ! /* Otherwise convert to the nominal type of the object if needed. ! There are several cases in which we need to make the temporary ! using this type instead of the actual type of the object when ! they are distinct, because the expectations of the callee would ! otherwise not be met: - if it's a justified modular type, ! - if the actual type is a smaller form of it, ! - if it's a smaller form of the actual type. */ ! else if ((TREE_CODE (gnu_name_type) == RECORD_TYPE ! && (TYPE_JUSTIFIED_MODULAR_P (gnu_name_type) ! || smaller_form_type_p (TREE_TYPE (gnu_name), ! gnu_name_type))) ! || (INTEGRAL_TYPE_P (gnu_name_type) ! && smaller_form_type_p (gnu_name_type, ! TREE_TYPE (gnu_name)))) gnu_name = convert (gnu_name_type, gnu_name); ! /* If we haven't pushed a binding level and this is an In Out or Out ! parameter, push a new one. This is needed to wrap the copy-back ! statements we'll be making below. */ ! if (!pushed_binding_level && !in_param) ! { ! start_stmt_group (); ! gnat_pushlevel (); ! pushed_binding_level = true; ! } ! /* Create an explicit temporary holding the copy. This ensures that ! its lifetime is as narrow as possible around a statement. */ ! gnu_temp ! = create_init_temporary ("A", gnu_name, &gnu_stmt, gnat_actual); ! ! /* But initialize it on the fly like for an implicit temporary as ! we aren't necessarily dealing with a statement. */ ! gnu_name = build_compound_expr (TREE_TYPE (gnu_name), gnu_stmt, ! gnu_temp); ! ! /* Set up to move the copy back to the original if needed. */ ! if (!in_param) { ! gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig, ! gnu_temp); ! set_expr_location_from_node (gnu_stmt, gnat_node); ! append_to_statement_list (gnu_stmt, &gnu_after_list); } } *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2627,2674 **** So do it here for the part we will use as an input, if any. */ if (Ekind (gnat_formal) != E_Out_Parameter && TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual))) ! gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)), ! gnu_actual); ! ! /* Do any needed conversions for the actual and make sure that it is ! in range of the formal's type. */ ! if (suppress_type_conversion) ! { ! /* Put back the conversion we suppressed above in the computation ! of the real object. Note that we treat a conversion between ! aggregate types as if it is an unchecked conversion here. */ ! gnu_actual ! = unchecked_convert (gnat_to_gnu_type (Etype (gnat_actual)), ! gnu_actual, ! (Nkind (gnat_actual) ! == N_Unchecked_Type_Conversion) ! && No_Truncation (gnat_actual)); ! if (Ekind (gnat_formal) != E_Out_Parameter ! && Do_Range_Check (gnat_actual)) ! gnu_actual = emit_range_check (gnu_actual, Etype (gnat_formal), ! gnat_actual); ! } else ! { ! if (Ekind (gnat_formal) != E_Out_Parameter ! && Do_Range_Check (gnat_actual)) ! gnu_actual = emit_range_check (gnu_actual, Etype (gnat_formal), ! gnat_actual); ! ! /* We may have suppressed a conversion to the Etype of the actual ! since the parent is a procedure call. So put it back here. ! ??? We use the reverse order compared to the case above because ! of an awkward interaction with the check and actually don't put ! back the conversion at all if a check is emitted. This is also ! done for the conversion to the formal's type just below. */ ! if (TREE_CODE (gnu_actual) != SAVE_EXPR) ! gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)), ! gnu_actual); ! } ! if (TREE_CODE (gnu_actual) != SAVE_EXPR) ! gnu_actual = convert (gnu_formal_type, gnu_actual); /* Unless this is an In parameter, we must remove any justified modular building from GNU_NAME to get an lvalue. */ --- 2954,2980 ---- So do it here for the part we will use as an input, if any. */ if (Ekind (gnat_formal) != E_Out_Parameter && TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual))) ! gnu_actual ! = convert (get_unpadded_type (Etype (gnat_actual)), gnu_actual); ! /* Put back the conversion we suppressed above in the computation of the ! real object. And even if we didn't suppress any conversion there, we ! may have suppressed a conversion to the Etype of the actual earlier, ! since the parent is a procedure call, so put it back here. */ ! if (suppress_type_conversion ! && Nkind (gnat_actual) == N_Unchecked_Type_Conversion) ! gnu_actual ! = unchecked_convert (gnat_to_gnu_type (Etype (gnat_actual)), ! gnu_actual, No_Truncation (gnat_actual)); else ! gnu_actual ! = convert (gnat_to_gnu_type (Etype (gnat_actual)), gnu_actual); ! /* Make sure that the actual is in range of the formal's type. */ ! if (Ekind (gnat_formal) != E_Out_Parameter ! && Do_Range_Check (gnat_actual)) ! gnu_actual ! = emit_range_check (gnu_actual, Etype (gnat_formal), gnat_actual); /* Unless this is an In parameter, we must remove any justified modular building from GNU_NAME to get an lvalue. */ *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2676,2688 **** && TREE_CODE (gnu_name) == CONSTRUCTOR && TREE_CODE (TREE_TYPE (gnu_name)) == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (TREE_TYPE (gnu_name))) ! gnu_name = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_name))), ! gnu_name); /* If we have not saved a GCC object for the formal, it means it is an ! Out parameter not passed by reference and that does not need to be ! copied in. Otherwise, look at the PARM_DECL to see if it is passed by ! reference. */ if (gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL && DECL_BY_REF_P (gnu_formal)) --- 2982,2993 ---- && TREE_CODE (gnu_name) == CONSTRUCTOR && TREE_CODE (TREE_TYPE (gnu_name)) == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (TREE_TYPE (gnu_name))) ! gnu_name ! = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_name))), gnu_name); /* If we have not saved a GCC object for the formal, it means it is an ! Out parameter not passed by reference and that need not be copied in. ! Otherwise, first see if the parameter is passed by reference. */ if (gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL && DECL_BY_REF_P (gnu_formal)) *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2695,2702 **** gnu_actual = gnu_name; /* If we have a padded type, be sure we've removed padding. */ ! if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual)) ! && TREE_CODE (gnu_actual) != SAVE_EXPR) gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)), gnu_actual); --- 3000,3006 ---- gnu_actual = gnu_name; /* If we have a padded type, be sure we've removed padding. */ ! if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual))) gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)), gnu_actual); *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2708,2723 **** and takes its address. */ if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (gnu_actual)) - && TREE_CODE (gnu_actual) != SAVE_EXPR && Is_Constr_Subt_For_UN_Aliased (Etype (gnat_actual)) && Is_Array_Type (Etype (gnat_actual))) gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)), gnu_actual); } /* The symmetry of the paths to the type of an entity is broken here since arguments don't know that they will be passed by ref. */ gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal)); gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); } else if (gnu_formal --- 3012,3038 ---- and takes its address. */ if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (gnu_actual)) && Is_Constr_Subt_For_UN_Aliased (Etype (gnat_actual)) && Is_Array_Type (Etype (gnat_actual))) gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)), gnu_actual); } + /* There is no need to convert the actual to the formal's type before + taking its address. The only exception is for unconstrained array + types because of the way we build fat pointers. */ + else if (TREE_CODE (gnu_formal_type) == UNCONSTRAINED_ARRAY_TYPE) + gnu_actual = convert (gnu_formal_type, gnu_actual); + /* The symmetry of the paths to the type of an entity is broken here since arguments don't know that they will be passed by ref. */ gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal)); + + if (DECL_BY_DOUBLE_REF_P (gnu_formal)) + gnu_actual + = build_unary_op (ADDR_EXPR, TREE_TYPE (gnu_formal_type), + gnu_actual); + gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); } else if (gnu_formal *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2740,2889 **** possibility that the ARRAY_REF might return a constant and we'd be getting the wrong address. Neither approach is exactly correct, but this is the most likely to work in all cases. */ ! gnu_actual = convert (gnu_formal_type, ! build_unary_op (ADDR_EXPR, NULL_TREE, ! gnu_actual)); } else if (gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL && DECL_BY_DESCRIPTOR_P (gnu_formal)) { ! /* If arg is 'Null_Parameter, pass zero descriptor. */ if ((TREE_CODE (gnu_actual) == INDIRECT_REF || TREE_CODE (gnu_actual) == UNCONSTRAINED_ARRAY_REF) && TREE_PRIVATE (gnu_actual)) ! gnu_actual = convert (DECL_ARG_TYPE (get_gnu_tree (gnat_formal)), ! integer_zero_node); else gnu_actual = build_unary_op (ADDR_EXPR, NULL_TREE, ! fill_vms_descriptor (gnu_actual, ! gnat_formal, ! gnat_actual)); } else { ! tree gnu_actual_size = TYPE_SIZE (TREE_TYPE (gnu_actual)); if (Ekind (gnat_formal) != E_In_Parameter) gnu_name_list = tree_cons (NULL_TREE, gnu_name, gnu_name_list); ! if (!gnu_formal || TREE_CODE (gnu_formal) != PARM_DECL) ! continue; /* If this is 'Null_Parameter, pass a zero even though we are dereferencing it. */ ! else if (TREE_CODE (gnu_actual) == INDIRECT_REF ! && TREE_PRIVATE (gnu_actual) ! && host_integerp (gnu_actual_size, 1) ! && 0 >= compare_tree_int (gnu_actual_size, ! BITS_PER_WORD)) gnu_actual = unchecked_convert (DECL_ARG_TYPE (gnu_formal), convert (gnat_type_for_size ! (tree_low_cst (gnu_actual_size, 1), ! 1), integer_zero_node), false); else gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual); } ! gnu_actual_list = tree_cons (NULL_TREE, gnu_actual, gnu_actual_list); ! } ! ! gnu_subprog_call = build_call_list (TREE_TYPE (gnu_subprog_type), ! gnu_subprog_addr, ! nreverse (gnu_actual_list)); ! set_expr_location_from_node (gnu_subprog_call, gnat_node); ! ! /* If we return by passing a target, the result is the target after the ! call. We must not emit the call directly here because this might be ! evaluated as part of an expression with conditions to control whether ! the call should be emitted or not. */ ! if (TYPE_RETURNS_BY_TARGET_PTR_P (gnu_subprog_type)) ! { ! /* 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 expression might ! end up wrapped into an outer SAVE_EXPR later on, which would incur a ! pointless temporary copy of the whole object. ! ! What we do instead is build a COMPOUND_EXPR returning the address of ! the target, and then dereference. Wrapping the COMPOUND_EXPR into a ! SAVE_EXPR later on then only incurs a pointer copy. */ ! ! tree gnu_result_type ! = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (gnu_subprog_type))); ! ! /* Build and return ! (result_type) *[gnu_subprog_call (&gnu_target, ...), &gnu_target] */ ! ! tree gnu_target_address ! = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_target); ! set_expr_location_from_node (gnu_target_address, gnat_node); ! ! gnu_result ! = build2 (COMPOUND_EXPR, TREE_TYPE (gnu_target_address), ! gnu_subprog_call, gnu_target_address); ! ! gnu_result ! = unchecked_convert (gnu_result_type, ! build_unary_op (INDIRECT_REF, NULL_TREE, ! gnu_result), ! false); ! ! *gnu_result_type_p = gnu_result_type; ! return gnu_result; } ! /* If it is a function call, the result is the call expression unless ! a target is specified, in which case we copy the result into the target ! and return the assignment statement. */ ! else if (Nkind (gnat_node) == N_Function_Call) ! { ! gnu_result = gnu_subprog_call; ! ! /* If the function returns an unconstrained array or by reference, ! we have to de-dereference the pointer. */ ! if (TYPE_RETURNS_UNCONSTRAINED_P (gnu_subprog_type) ! || TYPE_RETURNS_BY_REF_P (gnu_subprog_type)) ! gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); ! ! if (gnu_target) ! gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE, ! gnu_target, gnu_result); ! else ! *gnu_result_type_p = get_unpadded_type (Etype (gnat_node)); ! ! return gnu_result; ! } ! /* If this is the case where the GNAT tree contains a procedure call ! but the Ada procedure has copy in copy out parameters, the special ! parameter passing mechanism must be used. */ ! else if (TYPE_CI_CO_LIST (gnu_subprog_type) != NULL_TREE) { ! /* List of FIELD_DECLs associated with the PARM_DECLs of the copy ! in copy out parameters. */ ! tree scalar_return_list = TYPE_CI_CO_LIST (gnu_subprog_type); ! int length = list_length (scalar_return_list); if (length > 1) { ! tree gnu_name; - gnu_subprog_call = save_expr (gnu_subprog_call); gnu_name_list = nreverse (gnu_name_list); - - /* If any of the names had side-effects, ensure they are all - evaluated before the call. */ - for (gnu_name = gnu_name_list; gnu_name; - gnu_name = TREE_CHAIN (gnu_name)) - if (TREE_SIDE_EFFECTS (TREE_VALUE (gnu_name))) - append_to_statement_list (TREE_VALUE (gnu_name), - &gnu_before_list); } if (Nkind (Name (gnat_node)) == N_Explicit_Dereference) gnat_formal = First_Formal_With_Extras (Etype (Name (gnat_node))); else --- 3055,3149 ---- possibility that the ARRAY_REF might return a constant and we'd be getting the wrong address. Neither approach is exactly correct, but this is the most likely to work in all cases. */ ! gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); } else if (gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL && DECL_BY_DESCRIPTOR_P (gnu_formal)) { ! gnu_actual = convert (gnu_formal_type, gnu_actual); ! ! /* If this is 'Null_Parameter, pass a zero descriptor. */ if ((TREE_CODE (gnu_actual) == INDIRECT_REF || TREE_CODE (gnu_actual) == UNCONSTRAINED_ARRAY_REF) && TREE_PRIVATE (gnu_actual)) ! gnu_actual ! = convert (DECL_ARG_TYPE (gnu_formal), integer_zero_node); else gnu_actual = build_unary_op (ADDR_EXPR, NULL_TREE, ! fill_vms_descriptor ! (TREE_TYPE (TREE_TYPE (gnu_formal)), ! gnu_actual, gnat_actual)); } else { ! tree gnu_size; if (Ekind (gnat_formal) != E_In_Parameter) gnu_name_list = tree_cons (NULL_TREE, gnu_name, gnu_name_list); ! if (!(gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL)) ! { ! /* Make sure side-effects are evaluated before the call. */ ! if (TREE_SIDE_EFFECTS (gnu_name)) ! append_to_statement_list (gnu_name, &gnu_before_list); ! continue; ! } ! ! gnu_actual = convert (gnu_formal_type, gnu_actual); /* If this is 'Null_Parameter, pass a zero even though we are dereferencing it. */ ! if (TREE_CODE (gnu_actual) == INDIRECT_REF ! && TREE_PRIVATE (gnu_actual) ! && (gnu_size = TYPE_SIZE (TREE_TYPE (gnu_actual))) ! && TREE_CODE (gnu_size) == INTEGER_CST ! && compare_tree_int (gnu_size, BITS_PER_WORD) <= 0) gnu_actual = unchecked_convert (DECL_ARG_TYPE (gnu_formal), convert (gnat_type_for_size ! (TREE_INT_CST_LOW (gnu_size), 1), integer_zero_node), false); else gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual); } ! VEC_safe_push (tree, gc, gnu_actual_vec, gnu_actual); } ! gnu_call = build_call_vec (TREE_TYPE (gnu_subprog_type), gnu_subprog_addr, ! gnu_actual_vec); ! set_expr_location_from_node (gnu_call, gnat_node); ! /* If this is a subprogram with copy-in/copy-out parameters, we need to ! unpack the valued returned from the function into the In Out or Out ! parameters. We deal with the function return (if this is an Ada ! function) below. */ ! if (TYPE_CI_CO_LIST (gnu_subprog_type)) { ! /* List of FIELD_DECLs associated with the PARM_DECLs of the copy-in/ ! copy-out parameters. */ ! tree gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type); ! const int length = list_length (gnu_cico_list); + /* The call sequence must contain one and only one call, even though the + function is pure. Save the result into a temporary if needed. */ if (length > 1) { ! tree gnu_stmt; ! gnu_call ! = create_init_temporary ("R", gnu_call, &gnu_stmt, gnat_node); ! append_to_statement_list (gnu_stmt, &gnu_before_list); gnu_name_list = nreverse (gnu_name_list); } + /* The first entry is for the actual return value if this is a + function, so skip it. */ + if (TREE_VALUE (gnu_cico_list) == void_type_node) + gnu_cico_list = TREE_CHAIN (gnu_cico_list); + if (Nkind (Name (gnat_node)) == N_Explicit_Dereference) gnat_formal = First_Formal_With_Extras (Etype (Name (gnat_node))); else *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2893,2899 **** Present (gnat_actual); gnat_formal = Next_Formal_With_Extras (gnat_formal), gnat_actual = Next_Actual (gnat_actual)) ! /* If we are dealing with a copy in copy out parameter, we must retrieve its value from the record returned in the call. */ if (!(present_gnu_tree (gnat_formal) && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL --- 3153,3159 ---- Present (gnat_actual); gnat_formal = Next_Formal_With_Extras (gnat_formal), gnat_actual = Next_Actual (gnat_actual)) ! /* If we are dealing with a copy-in/copy-out parameter, we must retrieve its value from the record returned in the call. */ if (!(present_gnu_tree (gnat_formal) && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2908,2917 **** either the result of the function if there is only a single such parameter or the appropriate field from the record returned. */ tree gnu_result ! = length == 1 ? gnu_subprog_call ! : build_component_ref (gnu_subprog_call, NULL_TREE, ! TREE_PURPOSE (scalar_return_list), ! false); /* If the actual is a conversion, get the inner expression, which will be the real destination, and convert the result to the --- 3168,3177 ---- either the result of the function if there is only a single such parameter or the appropriate field from the record returned. */ tree gnu_result ! = length == 1 ! ? gnu_call ! : build_component_ref (gnu_call, NULL_TREE, ! TREE_PURPOSE (gnu_cico_list), false); /* If the actual is a conversion, get the inner expression, which will be the real destination, and convert the result to the *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2921,2929 **** /* If the result is a padded type, remove the padding. */ if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_result))) ! gnu_result = convert (TREE_TYPE (TYPE_FIELDS ! (TREE_TYPE (gnu_result))), ! gnu_result); /* If the actual is a type conversion, the real target object is denoted by the inner Expression and we need to convert the --- 3181,3189 ---- /* If the result is a padded type, remove the padding. */ if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_result))) ! gnu_result ! = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), ! gnu_result); /* If the actual is a type conversion, the real target object is denoted by the inner Expression and we need to convert the *************** call_to_gnu (Node_Id gnat_node, tree *gn *** 2964,2988 **** gnu_result = convert (TREE_TYPE (gnu_actual), gnu_result); } - /* Undo wrapping of boolean rvalues. */ - if (TREE_CODE (gnu_actual) == NE_EXPR - && TREE_CODE (get_base_type (TREE_TYPE (gnu_actual))) - == BOOLEAN_TYPE - && integer_zerop (TREE_OPERAND (gnu_actual, 1))) - gnu_actual = TREE_OPERAND (gnu_actual, 0); gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_actual, gnu_result); set_expr_location_from_node (gnu_result, gnat_node); append_to_statement_list (gnu_result, &gnu_before_list); ! scalar_return_list = TREE_CHAIN (scalar_return_list); gnu_name_list = TREE_CHAIN (gnu_name_list); } } else ! append_to_statement_list (gnu_subprog_call, &gnu_before_list); ! append_to_statement_list (gnu_after_list, &gnu_before_list); ! return gnu_before_list; } /* Subroutine of gnat_to_gnu to translate gnat_node, an --- 3224,3329 ---- gnu_result = convert (TREE_TYPE (gnu_actual), gnu_result); } gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_actual, gnu_result); set_expr_location_from_node (gnu_result, gnat_node); append_to_statement_list (gnu_result, &gnu_before_list); ! gnu_cico_list = TREE_CHAIN (gnu_cico_list); gnu_name_list = TREE_CHAIN (gnu_name_list); } + } + + /* If this is a function call, the result is the call expression unless a + target is specified, in which case we copy the result into the target + and return the assignment statement. */ + if (Nkind (gnat_node) == N_Function_Call) + { + tree gnu_result_type = TREE_TYPE (gnu_subprog_type); + + /* If this is a function with copy-in/copy-out parameters, extract the + return value from it and update the return type. */ + if (TYPE_CI_CO_LIST (gnu_subprog_type)) + { + tree gnu_elmt = value_member (void_type_node, + TYPE_CI_CO_LIST (gnu_subprog_type)); + gnu_call = build_component_ref (gnu_call, NULL_TREE, + TREE_PURPOSE (gnu_elmt), false); + gnu_result_type = TREE_TYPE (gnu_call); } + + /* If the function returns an unconstrained array or by direct reference, + we have to dereference the pointer. */ + if (TYPE_RETURN_UNCONSTRAINED_P (gnu_subprog_type) + || TYPE_RETURN_BY_DIRECT_REF_P (gnu_subprog_type)) + gnu_call = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_call); + + if (gnu_target) + { + Node_Id gnat_parent = Parent (gnat_node); + enum tree_code op_code; + + /* If range check is needed, emit code to generate it. */ + if (Do_Range_Check (gnat_node)) + gnu_call + = emit_range_check (gnu_call, Etype (Name (gnat_parent)), + gnat_parent); + + /* ??? If the return type has non-constant size, then force the + return slot optimization as we would not be able to generate + a temporary. Likewise if it was unconstrained as we would + copy too much data. That's what has been done historically. */ + if (!TREE_CONSTANT (TYPE_SIZE (gnu_result_type)) + || (TYPE_IS_PADDING_P (gnu_result_type) + && CONTAINS_PLACEHOLDER_P + (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_result_type)))))) + op_code = INIT_EXPR; + else + op_code = MODIFY_EXPR; + + gnu_call + = build_binary_op (op_code, NULL_TREE, gnu_target, gnu_call); + set_expr_location_from_node (gnu_call, gnat_parent); + append_to_statement_list (gnu_call, &gnu_before_list); + } + else + *gnu_result_type_p = get_unpadded_type (Etype (gnat_node)); + } + + /* Otherwise, if this is a procedure call statement without copy-in/copy-out + parameters, the result is just the call statement. */ + else if (!TYPE_CI_CO_LIST (gnu_subprog_type)) + append_to_statement_list (gnu_call, &gnu_before_list); + + if (went_into_elab_proc) + current_function_decl = NULL_TREE; + + /* If we have pushed a binding level, the result is the statement group. + Otherwise it's just the call expression. */ + if (pushed_binding_level) + { + /* If we need a value and haven't created the call statement, do so. */ + if (returning_value && !TYPE_CI_CO_LIST (gnu_subprog_type)) + { + tree gnu_stmt; + gnu_call + = create_init_temporary ("R", gnu_call, &gnu_stmt, gnat_node); + append_to_statement_list (gnu_stmt, &gnu_before_list); + } + append_to_statement_list (gnu_after_list, &gnu_before_list); + add_stmt (gnu_before_list); + gnat_poplevel (); + gnu_result = end_stmt_group (); + } else ! return gnu_call; ! /* If we need a value, make a COMPOUND_EXPR to return it; otherwise, ! return the result. Deal specially with UNCONSTRAINED_ARRAY_REF. */ ! if (returning_value) ! gnu_result = build_compound_expr (TREE_TYPE (gnu_call), gnu_result, ! gnu_call); ! ! return gnu_result; } /* Subroutine of gnat_to_gnu to translate gnat_node, an *************** Handled_Sequence_Of_Statements_to_gnu (N *** 3035,3042 **** gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE, jmpbuf_ptr_type, build_call_0_expr (get_jmpbuf_decl), ! false, false, false, false, NULL, ! gnat_node); DECL_ARTIFICIAL (gnu_jmpsave_decl) = 1; /* The __builtin_setjmp receivers will immediately reinstall it. Now --- 3376,3383 ---- gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE, jmpbuf_ptr_type, build_call_0_expr (get_jmpbuf_decl), ! false, false, false, false, ! NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpsave_decl) = 1; /* The __builtin_setjmp receivers will immediately reinstall it. Now *************** Handled_Sequence_Of_Statements_to_gnu (N *** 3045,3052 **** it is uninitialized, although they will never be actually taken. */ TREE_NO_WARNING (gnu_jmpsave_decl) = 1; gnu_jmpbuf_decl = create_var_decl (get_identifier ("JMP_BUF"), ! NULL_TREE, jmpbuf_type, ! NULL_TREE, false, false, false, false, NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpbuf_decl) = 1; --- 3386,3393 ---- it is uninitialized, although they will never be actually taken. */ TREE_NO_WARNING (gnu_jmpsave_decl) = 1; gnu_jmpbuf_decl = create_var_decl (get_identifier ("JMP_BUF"), ! NULL_TREE, jmpbuf_type, NULL_TREE, ! false, false, false, false, NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpbuf_decl) = 1; *************** Handled_Sequence_Of_Statements_to_gnu (N *** 3097,3108 **** start_stmt_group (); gnat_pushlevel (); ! push_stack (&gnu_except_ptr_stack, NULL_TREE, ! create_var_decl (get_identifier ("EXCEPT_PTR"), ! NULL_TREE, ! build_pointer_type (except_type_node), ! build_call_0_expr (get_excptr_decl), false, ! false, false, false, NULL, gnat_node)); /* Generate code for each handler. The N_Exception_Handler case does the real work and returns a COND_EXPR for each handler, which we chain --- 3438,3449 ---- start_stmt_group (); gnat_pushlevel (); ! VEC_safe_push (tree, gc, gnu_except_ptr_stack, ! create_var_decl (get_identifier ("EXCEPT_PTR"), NULL_TREE, ! build_pointer_type (except_type_node), ! build_call_0_expr (get_excptr_decl), ! false, false, false, false, ! NULL, gnat_node)); /* Generate code for each handler. The N_Exception_Handler case does the real work and returns a COND_EXPR for each handler, which we chain *************** Handled_Sequence_Of_Statements_to_gnu (N *** 3126,3132 **** /* If none of the exception handlers did anything, re-raise but do not defer abortion. */ gnu_expr = build_call_1_expr (raise_nodefer_decl, ! TREE_VALUE (gnu_except_ptr_stack)); set_expr_location_from_node (gnu_expr, Present (End_Label (gnat_node)) ? End_Label (gnat_node) : gnat_node); --- 3467,3473 ---- /* If none of the exception handlers did anything, re-raise but do not defer abortion. */ gnu_expr = build_call_1_expr (raise_nodefer_decl, ! VEC_last (tree, gnu_except_ptr_stack)); set_expr_location_from_node (gnu_expr, Present (End_Label (gnat_node)) ? End_Label (gnat_node) : gnat_node); *************** Handled_Sequence_Of_Statements_to_gnu (N *** 3138,3144 **** /* End the binding level dedicated to the exception handlers and get the whole statement group. */ ! pop_stack (&gnu_except_ptr_stack); gnat_poplevel (); gnu_handler = end_stmt_group (); --- 3479,3485 ---- /* End the binding level dedicated to the exception handlers and get the whole statement group. */ ! VEC_pop (tree, gnu_except_ptr_stack); gnat_poplevel (); gnu_handler = end_stmt_group (); *************** Exception_Handler_to_gnu_sjlj (Node_Id g *** 3216,3228 **** else this_choice = build_binary_op ! (EQ_EXPR, integer_type_node, convert (integer_type_node, build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, ! TREE_VALUE (gnu_except_ptr_stack)), get_identifier ("not_handled_by_others"), NULL_TREE, false)), integer_zero_node); --- 3557,3569 ---- else this_choice = build_binary_op ! (EQ_EXPR, boolean_type_node, convert (integer_type_node, build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, ! VEC_last (tree, gnu_except_ptr_stack)), get_identifier ("not_handled_by_others"), NULL_TREE, false)), integer_zero_node); *************** Exception_Handler_to_gnu_sjlj (Node_Id g *** 3243,3250 **** this_choice = build_binary_op ! (EQ_EXPR, integer_type_node, TREE_VALUE (gnu_except_ptr_stack), ! convert (TREE_TYPE (TREE_VALUE (gnu_except_ptr_stack)), build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr))); /* If this is the distinguished exception "Non_Ada_Error" (and we are --- 3584,3592 ---- this_choice = build_binary_op ! (EQ_EXPR, boolean_type_node, ! VEC_last (tree, gnu_except_ptr_stack), ! convert (TREE_TYPE (VEC_last (tree, gnu_except_ptr_stack)), build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr))); /* If this is the distinguished exception "Non_Ada_Error" (and we are *************** Exception_Handler_to_gnu_sjlj (Node_Id g *** 3255,3267 **** tree gnu_comp = build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, ! TREE_VALUE (gnu_except_ptr_stack)), get_identifier ("lang"), NULL_TREE, false); this_choice = build_binary_op ! (TRUTH_ORIF_EXPR, integer_type_node, ! build_binary_op (EQ_EXPR, integer_type_node, gnu_comp, build_int_cst (TREE_TYPE (gnu_comp), 'V')), this_choice); } --- 3597,3609 ---- tree gnu_comp = build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, ! VEC_last (tree, gnu_except_ptr_stack)), get_identifier ("lang"), NULL_TREE, false); this_choice = build_binary_op ! (TRUTH_ORIF_EXPR, boolean_type_node, ! build_binary_op (EQ_EXPR, boolean_type_node, gnu_comp, build_int_cst (TREE_TYPE (gnu_comp), 'V')), this_choice); } *************** Exception_Handler_to_gnu_sjlj (Node_Id g *** 3269,3275 **** else gcc_unreachable (); ! gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, gnu_choice, this_choice); } --- 3611,3617 ---- else gcc_unreachable (); ! gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_choice, this_choice); } *************** Exception_Handler_to_gnu_zcx (Node_Id gn *** 3293,3303 **** handler can catch, with special cases for others and all others cases. Each exception type is actually identified by a pointer to the exception ! id, or to a dummy object for "others" and "all others". ! ! Care should be taken to ensure that the control flow impact of "others" ! and "all others" is known to GCC. lang_eh_type_covers is doing the trick ! currently. */ for (gnat_temp = First (Exception_Choices (gnat_node)); gnat_temp; gnat_temp = Next (gnat_temp)) { --- 3635,3641 ---- handler can catch, with special cases for others and all others cases. Each exception type is actually identified by a pointer to the exception ! id, or to a dummy object for "others" and "all others". */ for (gnat_temp = First (Exception_Choices (gnat_node)); gnat_temp; gnat_temp = Next (gnat_temp)) { *************** Exception_Handler_to_gnu_zcx (Node_Id gn *** 3364,3371 **** 1, integer_zero_node); gnu_incoming_exc_ptr = create_var_decl (get_identifier ("EXPTR"), NULL_TREE, ptr_type_node, gnu_current_exc_ptr, ! false, false, false, false, NULL, ! gnat_node); add_stmt_with_node (build_call_1_expr (begin_handler_decl, gnu_incoming_exc_ptr), --- 3702,3709 ---- 1, integer_zero_node); gnu_incoming_exc_ptr = create_var_decl (get_identifier ("EXPTR"), NULL_TREE, ptr_type_node, gnu_current_exc_ptr, ! false, false, false, false, ! NULL, gnat_node); add_stmt_with_node (build_call_1_expr (begin_handler_decl, gnu_incoming_exc_ptr), *************** Exception_Handler_to_gnu_zcx (Node_Id gn *** 3385,3410 **** static void Compilation_Unit_to_gnu (Node_Id gnat_node) { /* Make the decl for the elaboration procedure. */ - bool body_p = (Defining_Entity (Unit (gnat_node)), - Nkind (Unit (gnat_node)) == N_Package_Body - || Nkind (Unit (gnat_node)) == N_Subprogram_Body); - Entity_Id gnat_unit_entity = Defining_Entity (Unit (gnat_node)); tree gnu_elab_proc_decl = create_subprog_decl ! (create_concat_name (gnat_unit_entity, ! body_p ? "elabb" : "elabs"), ! NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, ! gnat_unit_entity); struct elab_info *info; ! push_stack (&gnu_elab_proc_stack, NULL_TREE, gnu_elab_proc_decl); ! DECL_ELABORATION_PROC_P (gnu_elab_proc_decl) = 1; allocate_struct_function (gnu_elab_proc_decl, false); - Sloc_to_locus (Sloc (gnat_unit_entity), &cfun->function_end_locus); set_cfun (NULL); /* For a body, first process the spec if there is one. */ if (Nkind (Unit (gnat_node)) == N_Package_Body || (Nkind (Unit (gnat_node)) == N_Subprogram_Body --- 3723,3751 ---- static void Compilation_Unit_to_gnu (Node_Id gnat_node) { + const Node_Id gnat_unit = Unit (gnat_node); + const bool body_p = (Nkind (gnat_unit) == N_Package_Body + || Nkind (gnat_unit) == N_Subprogram_Body); + const Entity_Id gnat_unit_entity = Defining_Entity (gnat_unit); /* Make the decl for the elaboration procedure. */ tree gnu_elab_proc_decl = create_subprog_decl ! (create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"), ! NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, gnat_unit); struct elab_info *info; ! VEC_safe_push (tree, gc, gnu_elab_proc_stack, gnu_elab_proc_decl); DECL_ELABORATION_PROC_P (gnu_elab_proc_decl) = 1; + + /* Initialize the information structure for the function. */ allocate_struct_function (gnu_elab_proc_decl, false); set_cfun (NULL); + current_function_decl = NULL_TREE; + + start_stmt_group (); + gnat_pushlevel (); + /* For a body, first process the spec if there is one. */ if (Nkind (Unit (gnat_node)) == N_Package_Body || (Nkind (Unit (gnat_node)) == N_Subprogram_Body *************** Compilation_Unit_to_gnu (Node_Id gnat_no *** 3414,3420 **** finalize_from_with_types (); } ! process_inlined_subprograms (gnat_node); if (type_annotate_only && gnat_node == Cunit (Main_Unit)) { --- 3755,3788 ---- finalize_from_with_types (); } ! /* If we can inline, generate code for all the inlined subprograms. */ ! if (optimize) ! { ! Entity_Id gnat_entity; ! ! for (gnat_entity = First_Inlined_Subprogram (gnat_node); ! Present (gnat_entity); ! gnat_entity = Next_Inlined_Subprogram (gnat_entity)) ! { ! Node_Id gnat_body = Parent (Declaration_Node (gnat_entity)); ! ! if (Nkind (gnat_body) != N_Subprogram_Body) ! { ! /* ??? This really should always be present. */ ! if (No (Corresponding_Body (gnat_body))) ! continue; ! gnat_body ! = Parent (Declaration_Node (Corresponding_Body (gnat_body))); ! } ! ! if (Present (gnat_body)) ! { ! /* Define the entity first so we set DECL_EXTERNAL. */ ! gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); ! add_stmt (gnat_to_gnu (gnat_body)); ! } ! } ! } if (type_annotate_only && gnat_node == Cunit (Main_Unit)) { *************** Compilation_Unit_to_gnu (Node_Id gnat_no *** 3437,3446 **** /* Save away what we've made so far and record this potential elaboration procedure. */ ! info = (struct elab_info *) ggc_alloc (sizeof (struct elab_info)); set_current_block_context (gnu_elab_proc_decl); gnat_poplevel (); DECL_SAVED_TREE (gnu_elab_proc_decl) = end_stmt_group (); info->next = elab_info_list; info->elab_proc = gnu_elab_proc_decl; info->gnat_node = gnat_node; --- 3805,3817 ---- /* Save away what we've made so far and record this potential elaboration procedure. */ ! info = ggc_alloc_elab_info (); set_current_block_context (gnu_elab_proc_decl); gnat_poplevel (); DECL_SAVED_TREE (gnu_elab_proc_decl) = end_stmt_group (); + + set_end_locus_from_node (gnu_elab_proc_decl, gnat_unit); + info->next = elab_info_list; info->elab_proc = gnu_elab_proc_decl; info->gnat_node = gnat_node; *************** Compilation_Unit_to_gnu (Node_Id gnat_no *** 3448,3454 **** /* Generate elaboration code for this unit, if necessary, and say whether we did or not. */ ! pop_stack (&gnu_elab_proc_stack); /* Invalidate the global renaming pointers. This is necessary because stabilization of the renamed entities may create SAVE_EXPRs which --- 3819,3825 ---- /* Generate elaboration code for this unit, if necessary, and say whether we did or not. */ ! VEC_pop (tree, gnu_elab_proc_stack); /* Invalidate the global renaming pointers. This is necessary because stabilization of the renamed entities may create SAVE_EXPRs which *************** unchecked_conversion_nop (Node_Id gnat_n *** 3469,3475 **** could de facto ensure type consistency and this should be preserved. */ if (!(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)) return false; --- 3840,3847 ---- could de facto ensure type consistency and this should be preserved. */ if (!(Nkind (Parent (gnat_node)) == N_Assignment_Statement && Name (Parent (gnat_node)) == gnat_node) ! && !((Nkind (Parent (gnat_node)) == N_Procedure_Call_Statement ! || Nkind (Parent (gnat_node)) == N_Function_Call) && Name (Parent (gnat_node)) != gnat_node)) return false; *************** unchecked_conversion_nop (Node_Id gnat_n *** 3487,3497 **** if (to_type == from_type) return true; ! /* For an array type, the conversion to the PAT is a no-op. */ if (Ekind (from_type) == E_Array_Subtype && to_type == Packed_Array_Type (from_type)) return true; return false; } --- 3859,3874 ---- if (to_type == from_type) return true; ! /* For an array subtype, the conversion to the PAT is a no-op. */ if (Ekind (from_type) == E_Array_Subtype && to_type == Packed_Array_Type (from_type)) return true; + /* For a record subtype, the conversion to the type is a no-op. */ + if (Ekind (from_type) == E_Record_Subtype + && to_type == Etype (from_type)) + return true; + return false; } *************** gnat_to_gnu (Node_Id gnat_node) *** 3533,3539 **** N_Raise_Constraint_Error)); if ((IN (kind, N_Statement_Other_Than_Procedure_Call) - && !IN (kind, N_SCIL_Node) && kind != N_Null_Statement) || kind == N_Procedure_Call_Statement || kind == N_Label --- 3910,3915 ---- *************** gnat_to_gnu (Node_Id gnat_node) *** 3541,3554 **** || kind == N_Handled_Sequence_Of_Statements || (IN (kind, N_Raise_xxx_Error) && Ekind (Etype (gnat_node)) == E_Void)) { /* If this is a statement and we are at top level, it must be part of ! the elaboration procedure, so mark us as being in that procedure ! and push our context. */ if (!current_function_decl) { ! current_function_decl = TREE_VALUE (gnu_elab_proc_stack); ! start_stmt_group (); ! gnat_pushlevel (); went_into_elab_proc = true; } --- 3917,3929 ---- || kind == N_Handled_Sequence_Of_Statements || (IN (kind, N_Raise_xxx_Error) && Ekind (Etype (gnat_node)) == E_Void)) { + tree current_elab_proc = get_elaboration_procedure (); + /* If this is a statement and we are at top level, it must be part of ! the elaboration procedure, so mark us as being in that procedure. */ if (!current_function_decl) { ! current_function_decl = current_elab_proc; went_into_elab_proc = true; } *************** gnat_to_gnu (Node_Id gnat_node) *** 3559,3565 **** every nested real statement instead. This also avoids triggering spurious errors on dummy (empty) sequences created by the front-end for package bodies in some cases. */ ! if (current_function_decl == TREE_VALUE (gnu_elab_proc_stack) && kind != N_Handled_Sequence_Of_Statements) Check_Elaboration_Code_Allowed (gnat_node); } --- 3934,3940 ---- every nested real statement instead. This also avoids triggering spurious errors on dummy (empty) sequences created by the front-end for package bodies in some cases. */ ! if (current_function_decl == current_elab_proc && kind != N_Handled_Sequence_Of_Statements) Check_Elaboration_Code_Allowed (gnat_node); } *************** gnat_to_gnu (Node_Id gnat_node) *** 3722,3745 **** String_Id gnat_string = Strval (gnat_node); int length = String_Length (gnat_string); int i; - tree gnu_list = NULL_TREE; tree gnu_idx = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type)); for (i = 0; i < length; i++) { ! gnu_list ! = tree_cons (gnu_idx, ! build_int_cst (TREE_TYPE (gnu_result_type), ! Get_String_Char (gnat_string, ! i + 1)), ! gnu_list); gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, integer_one_node, 0); } ! gnu_result ! = gnat_build_constructor (gnu_result_type, nreverse (gnu_list)); } break; --- 4097,4117 ---- String_Id gnat_string = Strval (gnat_node); int length = String_Length (gnat_string); int i; tree gnu_idx = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type)); + VEC(constructor_elt,gc) *gnu_vec + = VEC_alloc (constructor_elt, gc, length); for (i = 0; i < length; i++) { ! tree t = build_int_cst (TREE_TYPE (gnu_result_type), ! Get_String_Char (gnat_string, i + 1)); + CONSTRUCTOR_APPEND_ELT (gnu_vec, gnu_idx, t); gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, integer_one_node, 0); } ! gnu_result = gnat_build_constructor (gnu_result_type, gnu_vec); } break; *************** gnat_to_gnu (Node_Id gnat_node) *** 3790,3804 **** is frozen. */ if (Present (Freeze_Node (gnat_temp))) { ! if ((Is_Public (gnat_temp) || global_bindings_p ()) ! && !TREE_CONSTANT (gnu_expr)) gnu_expr = create_var_decl (create_concat_name (gnat_temp, "init"), ! NULL_TREE, TREE_TYPE (gnu_expr), ! gnu_expr, false, Is_Public (gnat_temp), ! false, false, NULL, gnat_temp); else ! gnu_expr = maybe_variable (gnu_expr); save_gnu_tree (gnat_node, gnu_expr, true); } --- 4162,4177 ---- is frozen. */ if (Present (Freeze_Node (gnat_temp))) { ! if (TREE_CONSTANT (gnu_expr)) ! ; ! else if (global_bindings_p ()) gnu_expr = create_var_decl (create_concat_name (gnat_temp, "init"), ! NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, ! false, false, false, false, ! NULL, gnat_temp); else ! gnu_expr = gnat_save_expr (gnu_expr); save_gnu_tree (gnat_node, gnu_expr, true); } *************** gnat_to_gnu (Node_Id gnat_node) *** 3897,3903 **** ndim++, gnu_type = TREE_TYPE (gnu_type)) ; ! gnat_expr_array = (Node_Id *) alloca (ndim * sizeof (Node_Id)); if (TYPE_CONVENTION_FORTRAN_P (TREE_TYPE (gnu_array_object))) for (i = ndim - 1, gnat_temp = First (Expressions (gnat_node)); --- 4270,4276 ---- ndim++, gnu_type = TREE_TYPE (gnu_type)) ; ! gnat_expr_array = XALLOCAVEC (Node_Id, ndim); if (TYPE_CONVENTION_FORTRAN_P (TREE_TYPE (gnu_array_object))) for (i = ndim - 1, gnat_temp = First (Expressions (gnat_node)); *************** gnat_to_gnu (Node_Id gnat_node) *** 3962,3982 **** (TYPE_MAX_VALUE (gnu_base_index_type), gnu_result); tree gnu_expr_l, gnu_expr_h, gnu_expr_type; ! gnu_min_expr = protect_multiple_eval (gnu_min_expr); ! gnu_max_expr = protect_multiple_eval (gnu_max_expr); /* Derive a good type to convert everything to. */ gnu_expr_type = get_base_type (gnu_index_type); /* Test whether the minimum slice value is too small. */ ! gnu_expr_l = build_binary_op (LT_EXPR, integer_type_node, convert (gnu_expr_type, gnu_min_expr), convert (gnu_expr_type, gnu_base_min_expr)); /* Test whether the maximum slice value is too large. */ ! gnu_expr_h = build_binary_op (GT_EXPR, integer_type_node, convert (gnu_expr_type, gnu_max_expr), convert (gnu_expr_type, --- 4335,4355 ---- (TYPE_MAX_VALUE (gnu_base_index_type), gnu_result); tree gnu_expr_l, gnu_expr_h, gnu_expr_type; ! gnu_min_expr = gnat_protect_expr (gnu_min_expr); ! gnu_max_expr = gnat_protect_expr (gnu_max_expr); /* Derive a good type to convert everything to. */ gnu_expr_type = get_base_type (gnu_index_type); /* Test whether the minimum slice value is too small. */ ! gnu_expr_l = build_binary_op (LT_EXPR, boolean_type_node, convert (gnu_expr_type, gnu_min_expr), convert (gnu_expr_type, gnu_base_min_expr)); /* Test whether the maximum slice value is too large. */ ! gnu_expr_h = build_binary_op (GT_EXPR, boolean_type_node, convert (gnu_expr_type, gnu_max_expr), convert (gnu_expr_type, *************** gnat_to_gnu (Node_Id gnat_node) *** 3985,3991 **** /* Build a slice index check that returns the low bound, assuming the slice is not empty. */ gnu_expr = emit_check ! (build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, gnu_expr_l, gnu_expr_h), gnu_min_expr, CE_Index_Check_Failed, gnat_node); --- 4358,4364 ---- /* Build a slice index check that returns the low bound, assuming the slice is not empty. */ gnu_expr = emit_check ! (build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_expr_l, gnu_expr_h), gnu_min_expr, CE_Index_Check_Failed, gnat_node); *************** gnat_to_gnu (Node_Id gnat_node) *** 4065,4076 **** ? Designated_Type (Etype (Prefix (gnat_node))) : Etype (Prefix (gnat_node)))) ! gnu_prefix = gnat_stabilize_reference (gnu_prefix, false); gnu_result = build_component_ref (gnu_prefix, NULL_TREE, gnu_field, (Nkind (Parent (gnat_node)) ! == N_Attribute_Reference)); } gcc_assert (gnu_result); --- 4438,4451 ---- ? Designated_Type (Etype (Prefix (gnat_node))) : Etype (Prefix (gnat_node)))) ! gnu_prefix = gnat_stabilize_reference (gnu_prefix, false, NULL); gnu_result = build_component_ref (gnu_prefix, NULL_TREE, gnu_field, (Nkind (Parent (gnat_node)) ! == N_Attribute_Reference) ! && lvalue_required_for_attribute_p ! (Parent (gnat_node))); } gcc_assert (gnu_result); *************** gnat_to_gnu (Node_Id gnat_node) *** 4080,4100 **** case N_Attribute_Reference: { ! /* The attribute designator (like an enumeration value). */ ! int attribute = Get_Attribute_Id (Attribute_Name (gnat_node)); ! /* The Elab_Spec and Elab_Body attributes are special in that ! Prefix is a unit, not an object with a GCC equivalent. Similarly ! for Elaborated, since that variable isn't otherwise known. */ ! if (attribute == Attr_Elab_Body || attribute == Attr_Elab_Spec) ! return (create_subprog_decl ! (create_concat_name (Entity (Prefix (gnat_node)), ! attribute == Attr_Elab_Body ! ? "elabb" : "elabs"), ! NULL_TREE, void_ftype, NULL_TREE, false, true, true, NULL, ! gnat_node)); ! gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attribute); } break; --- 4455,4474 ---- case N_Attribute_Reference: { ! /* The attribute designator. */ ! const int attr = Get_Attribute_Id (Attribute_Name (gnat_node)); ! /* The Elab_Spec and Elab_Body attributes are special in that Prefix ! is a unit, not an object with a GCC equivalent. */ ! if (attr == Attr_Elab_Spec || attr == Attr_Elab_Body) ! return ! create_subprog_decl (create_concat_name ! (Entity (Prefix (gnat_node)), ! attr == Attr_Elab_Body ? "elabb" : "elabs"), ! NULL_TREE, void_ftype, NULL_TREE, false, ! true, true, NULL, gnat_node); ! gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attr); } break; *************** gnat_to_gnu (Node_Id gnat_node) *** 4126,4132 **** gnu_aggr_type = TYPE_REPRESENTATIVE_ARRAY (gnu_result_type); if (Null_Record_Present (gnat_node)) ! gnu_result = gnat_build_constructor (gnu_aggr_type, NULL_TREE); else if (TREE_CODE (gnu_aggr_type) == RECORD_TYPE || TREE_CODE (gnu_aggr_type) == UNION_TYPE) --- 4500,4506 ---- gnu_aggr_type = TYPE_REPRESENTATIVE_ARRAY (gnu_result_type); if (Null_Record_Present (gnat_node)) ! gnu_result = gnat_build_constructor (gnu_aggr_type, NULL); else if (TREE_CODE (gnu_aggr_type) == RECORD_TYPE || TREE_CODE (gnu_aggr_type) == UNION_TYPE) *************** gnat_to_gnu (Node_Id gnat_node) *** 4253,4259 **** else { tree t1, t2; ! gnu_obj = protect_multiple_eval (gnu_obj); t1 = build_binary_op (GE_EXPR, gnu_result_type, gnu_obj, gnu_low); if (EXPR_P (t1)) set_expr_location_from_node (t1, gnat_node); --- 4627,4633 ---- else { tree t1, t2; ! gnu_obj = gnat_protect_expr (gnu_obj); t1 = build_binary_op (GE_EXPR, gnu_result_type, gnu_obj, gnu_low); if (EXPR_P (t1)) set_expr_location_from_node (t1, gnat_node); *************** gnat_to_gnu (Node_Id gnat_node) *** 4265,4271 **** } if (kind == N_Not_In) ! gnu_result = invert_truthvalue (gnu_result); } break; --- 4639,4646 ---- } if (kind == N_Not_In) ! gnu_result ! = invert_truthvalue_loc (EXPR_LOCATION (gnu_result), gnu_result); } break; *************** gnat_to_gnu (Node_Id gnat_node) *** 4315,4320 **** --- 4690,4696 ---- { enum tree_code code = gnu_codes[kind]; bool ignore_lhs_overflow = false; + location_t saved_location = input_location; tree gnu_type; gnu_lhs = gnat_to_gnu (Left_Opnd (gnat_node)); *************** gnat_to_gnu (Node_Id gnat_node) *** 4406,4412 **** gnu_result = build_binary_op_trapv (code, gnu_type, gnu_lhs, gnu_rhs, gnat_node); else ! gnu_result = build_binary_op (code, gnu_type, gnu_lhs, gnu_rhs); /* If this is a logical shift with the shift count not verified, we must return zero if it is too large. We cannot compensate --- 4782,4793 ---- gnu_result = build_binary_op_trapv (code, gnu_type, gnu_lhs, gnu_rhs, gnat_node); else ! { ! /* Some operations, e.g. comparisons of arrays, generate complex ! trees that need to be annotated while they are being built. */ ! input_location = saved_location; ! gnu_result = build_binary_op (code, gnu_type, gnu_lhs, gnu_rhs); ! } /* If this is a logical shift with the shift count not verified, we must return zero if it is too large. We cannot compensate *************** gnat_to_gnu (Node_Id gnat_node) *** 4416,4422 **** gnu_result = build_cond_expr (gnu_type, ! build_binary_op (GE_EXPR, integer_type_node, gnu_rhs, convert (TREE_TYPE (gnu_rhs), TYPE_SIZE (gnu_type))), --- 4797,4803 ---- gnu_result = build_cond_expr (gnu_type, ! build_binary_op (GE_EXPR, boolean_type_node, gnu_rhs, convert (TREE_TYPE (gnu_rhs), TYPE_SIZE (gnu_type))), *************** gnat_to_gnu (Node_Id gnat_node) *** 4544,4557 **** break; case N_Null_Statement: ! gnu_result = alloc_stmt_list (); break; case N_Assignment_Statement: /* Get the LHS and RHS of the statement and convert any reference to an ! unconstrained array into a reference to the underlying array. ! If we are not to do range checking and the RHS is an N_Function_Call, ! pass the LHS to the call function. */ gnu_lhs = maybe_unconstrained_array (gnat_to_gnu (Name (gnat_node))); /* If the type has a size that overflows, convert this into raise of --- 4925,4951 ---- break; case N_Null_Statement: ! /* When not optimizing, turn null statements from source into gotos to ! the next statement that the middle-end knows how to preserve. */ ! if (!optimize && Comes_From_Source (gnat_node)) ! { ! tree stmt, label = create_label_decl (NULL_TREE); ! start_stmt_group (); ! stmt = build1 (GOTO_EXPR, void_type_node, label); ! set_expr_location_from_node (stmt, gnat_node); ! add_stmt (stmt); ! stmt = build1 (LABEL_EXPR, void_type_node, label); ! set_expr_location_from_node (stmt, gnat_node); ! add_stmt (stmt); ! gnu_result = end_stmt_group (); ! } ! else ! gnu_result = alloc_stmt_list (); break; case N_Assignment_Statement: /* Get the LHS and RHS of the statement and convert any reference to an ! unconstrained array into a reference to the underlying array. */ gnu_lhs = maybe_unconstrained_array (gnat_to_gnu (Name (gnat_node))); /* If the type has a size that overflows, convert this into raise of *************** gnat_to_gnu (Node_Id gnat_node) *** 4560,4569 **** && TREE_OVERFLOW (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs)))) gnu_result = build_call_raise (SE_Object_Too_Large, gnat_node, N_Raise_Storage_Error); ! else if (Nkind (Expression (gnat_node)) == N_Function_Call ! && !Do_Range_Check (Expression (gnat_node))) ! gnu_result = call_to_gnu (Expression (gnat_node), ! &gnu_result_type, gnu_lhs); else { gnu_rhs --- 4954,4962 ---- && TREE_OVERFLOW (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs)))) gnu_result = build_call_raise (SE_Object_Too_Large, gnat_node, N_Raise_Storage_Error); ! else if (Nkind (Expression (gnat_node)) == N_Function_Call) ! gnu_result ! = call_to_gnu (Expression (gnat_node), &gnu_result_type, gnu_lhs); else { gnu_rhs *************** gnat_to_gnu (Node_Id gnat_node) *** 4664,4784 **** ? gnat_to_gnu (Condition (gnat_node)) : NULL_TREE), (Present (Name (gnat_node)) ? get_gnu_tree (Entity (Name (gnat_node))) ! : TREE_VALUE (gnu_loop_label_stack))); break; case N_Return_Statement: { ! /* The gnu function type of the subprogram currently processed. */ ! tree gnu_subprog_type = TREE_TYPE (current_function_decl); ! /* The return value from the subprogram. */ ! tree gnu_ret_val = NULL_TREE; ! /* The place to put the return value. */ ! tree gnu_lhs; ! ! /* If we are dealing with a "return;" from an Ada procedure with ! parameters passed by copy in copy out, we need to return a record ! containing the final values of these parameters. If the list ! contains only one entry, return just that entry. ! ! For a full description of the copy in copy out parameter mechanism, ! see the part of the gnat_to_gnu_entity routine dealing with the ! translation of subprograms. ! ! But if we have a return label defined, convert this into ! a branch to that label. */ ! ! if (TREE_VALUE (gnu_return_label_stack)) ! { ! gnu_result = build1 (GOTO_EXPR, void_type_node, ! TREE_VALUE (gnu_return_label_stack)); ! break; ! } ! else if (TYPE_CI_CO_LIST (gnu_subprog_type)) { ! gnu_lhs = DECL_RESULT (current_function_decl); ! if (list_length (TYPE_CI_CO_LIST (gnu_subprog_type)) == 1) ! gnu_ret_val = TREE_VALUE (TYPE_CI_CO_LIST (gnu_subprog_type)); ! else ! gnu_ret_val ! = gnat_build_constructor (TREE_TYPE (gnu_subprog_type), ! TYPE_CI_CO_LIST (gnu_subprog_type)); ! } ! ! /* If the Ada subprogram is a function, we just need to return the ! expression. If the subprogram returns an unconstrained ! array, we have to allocate a new version of the result and ! return it. If we return by reference, return a pointer. */ ! else if (Present (Expression (gnat_node))) ! { ! /* If the current function returns by target pointer and we ! are doing a call, pass that target to the call. */ ! if (TYPE_RETURNS_BY_TARGET_PTR_P (gnu_subprog_type) ! && Nkind (Expression (gnat_node)) == N_Function_Call) { ! gnu_lhs ! = build_unary_op (INDIRECT_REF, NULL_TREE, ! DECL_ARGUMENTS (current_function_decl)); ! gnu_result = call_to_gnu (Expression (gnat_node), ! &gnu_result_type, gnu_lhs); } - else - { - gnu_ret_val = gnat_to_gnu (Expression (gnat_node)); ! if (TYPE_RETURNS_BY_TARGET_PTR_P (gnu_subprog_type)) ! /* The original return type was unconstrained so dereference ! the TARGET pointer in the actual return value's type. */ ! gnu_lhs ! = build_unary_op (INDIRECT_REF, TREE_TYPE (gnu_ret_val), ! DECL_ARGUMENTS (current_function_decl)); ! else ! gnu_lhs = DECL_RESULT (current_function_decl); ! /* Do not remove the padding from GNU_RET_VAL if the inner ! type is self-referential since we want to allocate the fixed ! size in that case. */ ! if (TREE_CODE (gnu_ret_val) == COMPONENT_REF ! && TYPE_IS_PADDING_P ! (TREE_TYPE (TREE_OPERAND (gnu_ret_val, 0))) ! && CONTAINS_PLACEHOLDER_P ! (TYPE_SIZE (TREE_TYPE (gnu_ret_val)))) ! gnu_ret_val = TREE_OPERAND (gnu_ret_val, 0); ! if (TYPE_RETURNS_BY_REF_P (gnu_subprog_type) ! || By_Ref (gnat_node)) ! gnu_ret_val ! = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_ret_val); ! else if (TYPE_RETURNS_UNCONSTRAINED_P (gnu_subprog_type)) ! { ! gnu_ret_val = maybe_unconstrained_array (gnu_ret_val); ! 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); ! } } } else ! /* If the Ada subprogram is a regular procedure, just return. */ ! gnu_lhs = NULL_TREE; ! if (TYPE_RETURNS_BY_TARGET_PTR_P (gnu_subprog_type)) { ! if (gnu_ret_val) ! gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE, ! gnu_lhs, gnu_ret_val); ! add_stmt_with_node (gnu_result, gnat_node); ! gnu_lhs = NULL_TREE; } ! gnu_result = build_return_expr (gnu_lhs, gnu_ret_val); } break; --- 5057,5156 ---- ? gnat_to_gnu (Condition (gnat_node)) : NULL_TREE), (Present (Name (gnat_node)) ? get_gnu_tree (Entity (Name (gnat_node))) ! : VEC_last (tree, gnu_loop_label_stack))); break; case N_Return_Statement: { ! tree gnu_ret_val, gnu_ret_obj; ! /* If the subprogram is a function, we must return the expression. */ ! if (Present (Expression (gnat_node))) { ! tree gnu_subprog_type = TREE_TYPE (current_function_decl); ! tree gnu_ret_type = TREE_TYPE (gnu_subprog_type); ! tree gnu_result_decl = DECL_RESULT (current_function_decl); ! gnu_ret_val = gnat_to_gnu (Expression (gnat_node)); ! /* If this function has copy-in/copy-out parameters, get the real ! variable and type for the return. See Subprogram_to_gnu. */ ! if (TYPE_CI_CO_LIST (gnu_subprog_type)) { ! gnu_result_decl = VEC_last (tree, gnu_return_var_stack); ! gnu_ret_type = TREE_TYPE (gnu_result_decl); } ! /* Do not remove the padding from GNU_RET_VAL if the inner type is ! self-referential since we want to allocate the fixed size. */ ! if (TREE_CODE (gnu_ret_val) == COMPONENT_REF ! && TYPE_IS_PADDING_P ! (TREE_TYPE (TREE_OPERAND (gnu_ret_val, 0))) ! && CONTAINS_PLACEHOLDER_P ! (TYPE_SIZE (TREE_TYPE (gnu_ret_val)))) ! gnu_ret_val = TREE_OPERAND (gnu_ret_val, 0); ! /* If the subprogram returns by direct reference, return a pointer ! to the return value. */ ! if (TYPE_RETURN_BY_DIRECT_REF_P (gnu_subprog_type) ! || By_Ref (gnat_node)) ! gnu_ret_val = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_ret_val); ! /* Otherwise, if it returns an unconstrained array, we have to ! allocate a new version of the result and return it. */ ! else if (TYPE_RETURN_UNCONSTRAINED_P (gnu_subprog_type)) ! { ! gnu_ret_val = maybe_unconstrained_array (gnu_ret_val); ! gnu_ret_val = build_allocator (TREE_TYPE (gnu_ret_val), ! gnu_ret_val, gnu_ret_type, ! Procedure_To_Call (gnat_node), ! Storage_Pool (gnat_node), ! gnat_node, false); ! } ! /* If the subprogram returns by invisible reference, dereference ! the pointer it is passed using the type of the return value ! and build the copy operation manually. This ensures that we ! don't copy too much data, for example if the return type is ! unconstrained with a maximum size. */ ! if (TREE_ADDRESSABLE (gnu_subprog_type)) ! { ! gnu_ret_obj ! = build_unary_op (INDIRECT_REF, TREE_TYPE (gnu_ret_val), ! gnu_result_decl); ! gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE, ! gnu_ret_obj, gnu_ret_val); ! add_stmt_with_node (gnu_result, gnat_node); ! gnu_ret_val = NULL_TREE; ! gnu_ret_obj = gnu_result_decl; } + + /* Otherwise, build a regular return. */ + else + gnu_ret_obj = gnu_result_decl; } else ! { ! gnu_ret_val = NULL_TREE; ! gnu_ret_obj = NULL_TREE; ! } ! /* If we have a return label defined, convert this into a branch to ! that label. The return proper will be handled elsewhere. */ ! if (VEC_last (tree, gnu_return_label_stack)) { ! if (gnu_ret_obj) ! add_stmt (build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_ret_obj, ! gnu_ret_val)); ! ! gnu_result = build1 (GOTO_EXPR, void_type_node, ! VEC_last (tree, gnu_return_label_stack)); ! /* When not optimizing, make sure the return is preserved. */ ! if (!optimize && Comes_From_Source (gnat_node)) ! DECL_ARTIFICIAL (VEC_last (tree, gnu_return_label_stack)) = 0; ! break; } ! gnu_result = build_return_expr (gnu_ret_obj, gnu_ret_val); } break; *************** gnat_to_gnu (Node_Id gnat_node) *** 4806,4815 **** case N_Abstract_Subprogram_Declaration: /* This subprogram doesn't exist for code generation purposes, but we have to elaborate the types of any parameters and result, unless ! they are imported types (nothing to generate in this case). */ ! /* Process the parameter types first. */ for (gnat_temp = First_Formal_With_Extras (Defining_Entity (Specification (gnat_node))); --- 5178,5191 ---- case N_Abstract_Subprogram_Declaration: /* This subprogram doesn't exist for code generation purposes, but we have to elaborate the types of any parameters and result, unless ! they are imported types (nothing to generate in this case). ! The parameter list may contain types with freeze nodes, e.g. not null ! subtypes, so the subprogram itself may carry a freeze node, in which ! case its elaboration must be deferred. */ + /* Process the parameter types first. */ + if (No (Freeze_Node (Defining_Entity (Specification (gnat_node))))) for (gnat_temp = First_Formal_With_Extras (Defining_Entity (Specification (gnat_node))); *************** gnat_to_gnu (Node_Id gnat_node) *** 4819,4827 **** && !From_With_Type (Etype (gnat_temp))) gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, 0); - /* Then the result type, set to Standard_Void_Type for procedures. */ - { Entity_Id gnat_temp_type = Etype (Defining_Entity (Specification (gnat_node))); --- 5195,5201 ---- *************** gnat_to_gnu (Node_Id gnat_node) *** 4912,4923 **** /*********************************************************/ case N_Compilation_Unit: ! ! /* This is not called for the main unit, which is handled in function ! gigi above. */ ! start_stmt_group (); ! gnat_pushlevel (); ! Compilation_Unit_to_gnu (gnat_node); gnu_result = alloc_stmt_list (); break; --- 5286,5292 ---- /*********************************************************/ case N_Compilation_Unit: ! /* This is not called for the main unit on which gigi is invoked. */ Compilation_Unit_to_gnu (gnat_node); gnu_result = alloc_stmt_list (); break; *************** gnat_to_gnu (Node_Id gnat_node) *** 4977,4994 **** break; case N_Pop_Constraint_Error_Label: ! gnu_constraint_error_label_stack ! = TREE_CHAIN (gnu_constraint_error_label_stack); break; case N_Pop_Storage_Error_Label: ! gnu_storage_error_label_stack ! = TREE_CHAIN (gnu_storage_error_label_stack); break; case N_Pop_Program_Error_Label: ! gnu_program_error_label_stack ! = TREE_CHAIN (gnu_program_error_label_stack); break; /******************************/ --- 5346,5360 ---- break; case N_Pop_Constraint_Error_Label: ! VEC_pop (tree, gnu_constraint_error_label_stack); break; case N_Pop_Storage_Error_Label: ! VEC_pop (tree, gnu_storage_error_label_stack); break; case N_Pop_Program_Error_Label: ! VEC_pop (tree, gnu_program_error_label_stack); break; /******************************/ *************** gnat_to_gnu (Node_Id gnat_node) *** 5087,5094 **** noutputs = list_length (gnu_outputs); gnu_inputs = nreverse (gnu_inputs); ninputs = list_length (gnu_inputs); ! oconstraints ! = (const char **) alloca (noutputs * sizeof (const char *)); for (i = 0, tail = gnu_outputs; tail; ++i, tail = TREE_CHAIN (tail)) { --- 5453,5459 ---- noutputs = list_length (gnu_outputs); gnu_inputs = nreverse (gnu_inputs); ninputs = list_length (gnu_inputs); ! oconstraints = XALLOCAVEC (const char *, noutputs); for (i = 0, tail = gnu_outputs; tail; ++i, tail = TREE_CHAIN (tail)) { *************** gnat_to_gnu (Node_Id gnat_node) *** 5150,5155 **** --- 5515,5533 ---- /* Added Nodes */ /****************/ + case N_Expression_With_Actions: + gnu_result_type = get_unpadded_type (Etype (gnat_node)); + /* This construct doesn't define a scope so we don't wrap the statement + list in a BIND_EXPR; however, we wrap it in a SAVE_EXPR to protect it + from unsharing. */ + gnu_result = build_stmt_group (Actions (gnat_node), false); + gnu_result = build1 (SAVE_EXPR, void_type_node, gnu_result); + TREE_SIDE_EFFECTS (gnu_result) = 1; + gnu_expr = gnat_to_gnu (Expression (gnat_node)); + gnu_result + = build_compound_expr (TREE_TYPE (gnu_expr), gnu_result, gnu_expr); + break; + case N_Freeze_Entity: start_stmt_group (); process_freeze_entity (gnat_node); *************** gnat_to_gnu (Node_Id gnat_node) *** 5204,5210 **** gnu_actual_obj_type = build_unc_object_type_from_ptr (gnu_ptr_type, gnu_actual_obj_type, ! get_identifier ("DEALLOC")); } else gnu_actual_obj_type = gnu_obj_type; --- 5582,5589 ---- gnu_actual_obj_type = build_unc_object_type_from_ptr (gnu_ptr_type, gnu_actual_obj_type, ! get_identifier ("DEALLOC"), ! false); } else gnu_actual_obj_type = gnu_obj_type; *************** gnat_to_gnu (Node_Id gnat_node) *** 5214,5229 **** if (TREE_CODE (gnu_obj_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_obj_type)) { ! tree gnu_char_ptr_type = build_pointer_type (char_type_node); tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type)); - tree gnu_byte_offset - = convert (sizetype, - size_diffop (size_zero_node, gnu_pos)); - gnu_byte_offset = fold_build1 (NEGATE_EXPR, sizetype, gnu_byte_offset); - gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr); gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type, ! gnu_ptr, gnu_byte_offset); } gnu_result --- 5593,5604 ---- if (TREE_CODE (gnu_obj_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_obj_type)) { ! tree gnu_char_ptr_type ! = build_pointer_type (unsigned_char_type_node); tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type)); gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr); gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type, ! gnu_ptr, gnu_pos); } gnu_result *************** gnat_to_gnu (Node_Id gnat_node) *** 5237,5266 **** case N_Raise_Constraint_Error: case N_Raise_Program_Error: case N_Raise_Storage_Error: ! if (type_annotate_only) ! { ! gnu_result = alloc_stmt_list (); ! break; ! } ! gnu_result_type = get_unpadded_type (Etype (gnat_node)); ! gnu_result ! = build_call_raise (UI_To_Int (Reason (gnat_node)), gnat_node, kind); ! /* If the type is VOID, this is a statement, so we need to ! generate the code for the call. Handle a Condition, if there ! is one. */ ! if (TREE_CODE (gnu_result_type) == VOID_TYPE) ! { ! set_expr_location_from_node (gnu_result, gnat_node); ! if (Present (Condition (gnat_node))) gnu_result = build3 (COND_EXPR, void_type_node, ! gnat_to_gnu (Condition (gnat_node)), gnu_result, alloc_stmt_list ()); ! } ! else ! gnu_result = build1 (NULL_EXPR, gnu_result_type, gnu_result); break; case N_Validate_Unchecked_Conversion: --- 5612,5693 ---- case N_Raise_Constraint_Error: case N_Raise_Program_Error: case N_Raise_Storage_Error: ! { ! const int reason = UI_To_Int (Reason (gnat_node)); ! const Node_Id cond = Condition (gnat_node); ! bool handled = false; ! if (type_annotate_only) ! { ! gnu_result = alloc_stmt_list (); ! break; ! } ! gnu_result_type = get_unpadded_type (Etype (gnat_node)); ! if (Exception_Extra_Info ! && !No_Exception_Handlers_Set () ! && !get_exception_label (kind) ! && TREE_CODE (gnu_result_type) == VOID_TYPE ! && Present (cond)) ! { ! if (reason == CE_Access_Check_Failed) ! { ! gnu_result = build_call_raise_column (reason, gnat_node); ! handled = true; ! } ! else if ((reason == CE_Index_Check_Failed ! || reason == CE_Range_Check_Failed ! || reason == CE_Invalid_Data) ! && Nkind (cond) == N_Op_Not ! && Nkind (Right_Opnd (cond)) == N_In ! && Nkind (Right_Opnd (Right_Opnd (cond))) == N_Range) ! { ! Node_Id op = Right_Opnd (cond); /* N_In node */ ! Node_Id index = Left_Opnd (op); ! Node_Id type = Etype (index); ! ! if (Is_Type (type) ! && Known_Esize (type) ! && UI_To_Int (Esize (type)) <= 32) ! { ! Node_Id right_op = Right_Opnd (op); ! gnu_result ! = build_call_raise_range ! (reason, gnat_node, ! gnat_to_gnu (index), /* index */ ! gnat_to_gnu (Low_Bound (right_op)), /* first */ ! gnat_to_gnu (High_Bound (right_op))); /* last */ ! handled = true; ! } ! } ! } ! ! if (handled) ! { ! set_expr_location_from_node (gnu_result, gnat_node); gnu_result = build3 (COND_EXPR, void_type_node, ! gnat_to_gnu (cond), gnu_result, alloc_stmt_list ()); ! } ! else ! { ! gnu_result = build_call_raise (reason, gnat_node, kind); ! ! /* If the type is VOID, this is a statement, so we need to generate ! the code for the call. Handle a Condition, if there is one. */ ! if (TREE_CODE (gnu_result_type) == VOID_TYPE) ! { ! set_expr_location_from_node (gnu_result, gnat_node); ! if (Present (cond)) ! gnu_result = build3 (COND_EXPR, void_type_node, ! gnat_to_gnu (cond), ! gnu_result, alloc_stmt_list ()); ! } ! else ! gnu_result = build1 (NULL_EXPR, gnu_result_type, gnu_result); ! } ! } break; case N_Validate_Unchecked_Conversion: *************** gnat_to_gnu (Node_Id gnat_node) *** 5344,5390 **** gnu_result = alloc_stmt_list (); break; - case N_SCIL_Dispatch_Table_Object_Init: - case N_SCIL_Dispatch_Table_Tag_Init: - case N_SCIL_Dispatching_Call: - case N_SCIL_Membership_Test: - case N_SCIL_Tag_Init: - /* SCIL nodes require no processing for GCC. */ - gnu_result = alloc_stmt_list (); - break; - - case N_Raise_Statement: - case N_Function_Specification: - case N_Procedure_Specification: - case N_Op_Concat: - case N_Component_Association: - case N_Task_Body: default: ! gcc_assert (type_annotate_only); gnu_result = alloc_stmt_list (); } ! /* If we pushed our level as part of processing the elaboration routine, ! pop it back now. */ if (went_into_elab_proc) ! { ! add_stmt (gnu_result); ! gnat_poplevel (); ! gnu_result = end_stmt_group (); ! current_function_decl = NULL_TREE; ! } ! /* Set the location information on the result if it is a real expression. ! References can be reused for multiple GNAT nodes and they would get ! the location information of their last use. Note that we may have no result if we tried to build a CALL_EXPR node to a procedure with no side-effects and optimization is enabled. */ ! if (gnu_result ! && EXPR_P (gnu_result) ! && TREE_CODE (gnu_result) != NOP_EXPR ! && !REFERENCE_CLASS_P (gnu_result) ! && !EXPR_HAS_LOCATION (gnu_result)) ! set_expr_location_from_node (gnu_result, gnat_node); /* If we're supposed to return something of void_type, it means we have something we're elaborating for effect, so just return. */ --- 5771,5810 ---- gnu_result = alloc_stmt_list (); break; default: ! /* SCIL nodes require no processing for GCC. Other nodes should only ! be present when annotating types. */ ! gcc_assert (IN (kind, N_SCIL_Node) || type_annotate_only); gnu_result = alloc_stmt_list (); } ! /* If we pushed the processing of the elaboration routine, pop it back. */ if (went_into_elab_proc) ! current_function_decl = NULL_TREE; ! /* When not optimizing, turn boolean rvalues B into B != false tests ! so that the code just below can put the location information of the ! reference to B on the inequality operator for better debug info. */ ! if (!optimize ! && TREE_CODE (gnu_result) != INTEGER_CST ! && (kind == N_Identifier ! || kind == N_Expanded_Name ! || kind == N_Explicit_Dereference ! || kind == N_Function_Call ! || kind == N_Indexed_Component ! || kind == N_Selected_Component) ! && TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE ! && !lvalue_required_p (gnat_node, gnu_result_type, false, false, false)) ! gnu_result = build_binary_op (NE_EXPR, gnu_result_type, ! convert (gnu_result_type, gnu_result), ! convert (gnu_result_type, ! boolean_false_node)); ! ! /* Set the location information on the result. Note that we may have no result if we tried to build a CALL_EXPR node to a procedure with no side-effects and optimization is enabled. */ ! if (gnu_result && EXPR_P (gnu_result)) ! set_gnu_expr_location_from_node (gnu_result, gnat_node); /* If we're supposed to return something of void_type, it means we have something we're elaborating for effect, so just return. */ *************** gnat_to_gnu (Node_Id gnat_node) *** 5394,5400 **** /* If the result is a constant that overflowed, raise Constraint_Error. */ if (TREE_CODE (gnu_result) == INTEGER_CST && TREE_OVERFLOW (gnu_result)) { ! post_error ("Constraint_Error will be raised at run-time?", gnat_node); gnu_result = build1 (NULL_EXPR, gnu_result_type, build_call_raise (CE_Overflow_Check_Failed, gnat_node, --- 5814,5820 ---- /* If the result is a constant that overflowed, raise Constraint_Error. */ if (TREE_CODE (gnu_result) == INTEGER_CST && TREE_OVERFLOW (gnu_result)) { ! post_error ("?`Constraint_Error` will be raised at run time", gnat_node); gnu_result = build1 (NULL_EXPR, gnu_result_type, build_call_raise (CE_Overflow_Check_Failed, gnat_node, *************** gnat_to_gnu (Node_Id gnat_node) *** 5407,5413 **** if (TREE_SIDE_EFFECTS (gnu_result) && (TREE_CODE (gnu_result_type) == UNCONSTRAINED_ARRAY_TYPE || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type)))) ! gnu_result = gnat_stabilize_reference (gnu_result, false); /* Now convert the result to the result type, unless we are in one of the following cases: --- 5827,5833 ---- if (TREE_SIDE_EFFECTS (gnu_result) && (TREE_CODE (gnu_result_type) == UNCONSTRAINED_ARRAY_TYPE || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type)))) ! gnu_result = gnat_stabilize_reference (gnu_result, false, NULL); /* Now convert the result to the result type, unless we are in one of the following cases: *************** gnat_to_gnu (Node_Id gnat_node) *** 5510,5522 **** label to push onto the stack. */ static void ! push_exception_label_stack (tree *gnu_stack, Entity_Id gnat_label) { tree gnu_label = (Present (gnat_label) ? gnat_to_gnu_entity (gnat_label, NULL_TREE, 0) : NULL_TREE); ! *gnu_stack = tree_cons (NULL_TREE, gnu_label, *gnu_stack); } /* Record the current code position in GNAT_NODE. */ --- 5930,5942 ---- label to push onto the stack. */ static void ! push_exception_label_stack (VEC(tree,gc) **gnu_stack, Entity_Id gnat_label) { tree gnu_label = (Present (gnat_label) ? gnat_to_gnu_entity (gnat_label, NULL_TREE, 0) : NULL_TREE); ! VEC_safe_push (tree, gc, *gnu_stack, gnu_label); } /* Record the current code position in GNAT_NODE. */ *************** start_stmt_group (void) *** 5550,5563 **** if (group) stmt_group_free_list = group->previous; else ! group = (struct stmt_group *) ggc_alloc (sizeof (struct stmt_group)); group->previous = current_stmt_group; group->stmt_list = group->block = group->cleanups = NULL_TREE; current_stmt_group = group; } ! /* Add GNU_STMT to the current statement group. */ void add_stmt (tree gnu_stmt) --- 5970,5984 ---- if (group) stmt_group_free_list = group->previous; else ! group = ggc_alloc_stmt_group (); group->previous = current_stmt_group; group->stmt_list = group->block = group->cleanups = NULL_TREE; current_stmt_group = group; } ! /* Add GNU_STMT to the current statement group. If it is an expression with ! no effects, it is ignored. */ void add_stmt (tree gnu_stmt) *************** add_stmt (tree gnu_stmt) *** 5565,5571 **** append_to_statement_list (gnu_stmt, ¤t_stmt_group->stmt_list); } ! /* Similar, but set the location of GNU_STMT to that of GNAT_NODE. */ void add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node) --- 5986,6000 ---- append_to_statement_list (gnu_stmt, ¤t_stmt_group->stmt_list); } ! /* Similar, but the statement is always added, regardless of side-effects. */ ! ! void ! add_stmt_force (tree gnu_stmt) ! { ! append_to_statement_list_force (gnu_stmt, ¤t_stmt_group->stmt_list); ! } ! ! /* Like add_stmt, but set the location of GNU_STMT to that of GNAT_NODE. */ void add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node) *************** add_stmt_with_node (tree gnu_stmt, Node_ *** 5575,5580 **** --- 6004,6019 ---- add_stmt (gnu_stmt); } + /* Similar, but the statement is always added, regardless of side-effects. */ + + void + add_stmt_with_node_force (tree gnu_stmt, Node_Id gnat_node) + { + if (Present (gnat_node)) + set_expr_location_from_node (gnu_stmt, gnat_node); + add_stmt_force (gnu_stmt); + } + /* Add a declaration statement for GNU_DECL to the current statement group. Get SLOC from Entity_Id. */ *************** add_decl_expr (tree gnu_decl, Entity_Id *** 5619,5625 **** || TREE_CODE (type) == QUAL_UNION_TYPE)) MARK_VISITED (TYPE_ADA_SIZE (type)); } ! else add_stmt_with_node (gnu_stmt, gnat_entity); /* If this is a variable and an initializer is attached to it, it must be --- 6058,6064 ---- || TREE_CODE (type) == QUAL_UNION_TYPE)) MARK_VISITED (TYPE_ADA_SIZE (type)); } ! else if (!DECL_EXTERNAL (gnu_decl)) add_stmt_with_node (gnu_stmt, gnat_entity); /* If this is a variable and an initializer is attached to it, it must be *************** add_decl_expr (tree gnu_decl, Entity_Id *** 5638,5644 **** else t = gnu_decl; ! gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, t, gnu_init); DECL_INITIAL (gnu_decl) = NULL_TREE; if (TREE_READONLY (gnu_decl)) --- 6077,6083 ---- else t = gnu_decl; ! gnu_stmt = build_binary_op (INIT_EXPR, NULL_TREE, t, gnu_init); DECL_INITIAL (gnu_decl) = NULL_TREE; if (TREE_READONLY (gnu_decl)) *************** mark_visited (tree t) *** 5682,5701 **** walk_tree (&t, mark_visited_r, NULL, NULL); } - /* Utility function to unshare expressions wrapped up in a SAVE_EXPR. */ - - static tree - unshare_save_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) - { - tree t = *tp; - - if (TREE_CODE (t) == SAVE_EXPR) - TREE_OPERAND (t, 0) = unshare_expr (TREE_OPERAND (t, 0)); - - return NULL_TREE; - } - /* Add GNU_CLEANUP, a cleanup action, to the current code group and set its location to that of GNAT_NODE if present. */ --- 6121,6126 ---- *************** build_stmt_group (List_Id gnat_list, boo *** 5780,5816 **** return end_stmt_group (); } - /* Push and pop routines for stacks. We keep a free list around so we - don't waste tree nodes. */ - - static void - push_stack (tree *gnu_stack_ptr, tree gnu_purpose, tree gnu_value) - { - tree gnu_node = gnu_stack_free_list; - - if (gnu_node) - { - gnu_stack_free_list = TREE_CHAIN (gnu_node); - TREE_CHAIN (gnu_node) = *gnu_stack_ptr; - TREE_PURPOSE (gnu_node) = gnu_purpose; - TREE_VALUE (gnu_node) = gnu_value; - } - else - gnu_node = tree_cons (gnu_purpose, gnu_value, *gnu_stack_ptr); - - *gnu_stack_ptr = gnu_node; - } - - static void - pop_stack (tree *gnu_stack_ptr) - { - tree gnu_node = *gnu_stack_ptr; - - *gnu_stack_ptr = TREE_CHAIN (gnu_node); - TREE_CHAIN (gnu_node) = gnu_stack_free_list; - gnu_stack_free_list = gnu_node; - } - /* Generate GIMPLE in place for the expression at *EXPR_P. */ int --- 6205,6210 ---- *************** gnat_gimplify_expr (tree *expr_p, gimple *** 5851,5896 **** case ADDR_EXPR: op = TREE_OPERAND (expr, 0); ! /* If we are taking the address of a constant CONSTRUCTOR, force it to ! be put into static memory. We know it's going to be readonly given ! the semantics we have and it's required to be in static memory when ! the reference is in an elaboration procedure. */ if (TREE_CODE (op) == CONSTRUCTOR && TREE_CONSTANT (op)) { ! tree new_var = create_tmp_var (TREE_TYPE (op), "C"); ! TREE_ADDRESSABLE (new_var) = 1; ! ! TREE_READONLY (new_var) = 1; ! TREE_STATIC (new_var) = 1; ! DECL_INITIAL (new_var) = op; ! ! TREE_OPERAND (expr, 0) = new_var; ! recompute_tree_invariant_for_addr_expr (expr); return GS_ALL_DONE; } ! /* If we are taking the address of a SAVE_EXPR, we are typically dealing ! with a misaligned argument to be passed by reference in a subprogram ! call. We cannot let the common gimplifier code perform the creation ! of the temporary and its initialization because, in order to ensure ! that the final copy operation is a store and since the temporary made ! for a SAVE_EXPR is not addressable, it may create another temporary, ! addressable this time, which would break the back copy mechanism for ! an IN OUT parameter. */ ! if (TREE_CODE (op) == SAVE_EXPR && !SAVE_EXPR_RESOLVED_P (op)) { ! tree mod, val = TREE_OPERAND (op, 0); ! tree new_var = create_tmp_var (TREE_TYPE (op), "S"); TREE_ADDRESSABLE (new_var) = 1; ! mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, val); ! if (EXPR_HAS_LOCATION (val)) ! SET_EXPR_LOCATION (mod, EXPR_LOCATION (val)); gimplify_and_add (mod, pre_p); - ggc_free (mod); - - TREE_OPERAND (op, 0) = new_var; - SAVE_EXPR_RESOLVED_P (op) = 1; TREE_OPERAND (expr, 0) = new_var; recompute_tree_invariant_for_addr_expr (expr); --- 6245,6272 ---- case ADDR_EXPR: op = TREE_OPERAND (expr, 0); ! /* If we are taking the address of a constant CONSTRUCTOR, make sure it ! is put into static memory. We know that it's going to be read-only ! given the semantics we have and it must be in static memory when the ! reference is in an elaboration procedure. */ if (TREE_CODE (op) == CONSTRUCTOR && TREE_CONSTANT (op)) { ! tree addr = build_fold_addr_expr (tree_output_constant_def (op)); ! *expr_p = fold_convert (TREE_TYPE (expr), addr); return GS_ALL_DONE; } ! /* Otherwise, if we are taking the address of a non-constant CONSTRUCTOR ! or of a call, explicitly create the local temporary. That's required ! if the type is passed by reference. */ ! if (TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR) { ! tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C"); TREE_ADDRESSABLE (new_var) = 1; + gimple_add_tmp_var (new_var); ! mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, op); gimplify_and_add (mod, pre_p); TREE_OPERAND (expr, 0) = new_var; recompute_tree_invariant_for_addr_expr (expr); *************** gnat_gimplify_stmt (tree *stmt_p) *** 5961,6003 **** case LOOP_STMT: { tree gnu_start_label = create_artificial_label (input_location); tree gnu_end_label = LOOP_STMT_LABEL (stmt); tree t; /* Set to emit the statements of the loop. */ *stmt_p = NULL_TREE; ! /* We first emit the start label and then a conditional jump to ! the end label if there's a top condition, then the body of the ! loop, then a conditional branch to the end label, then the update, ! if any, and finally a jump to the start label and the definition ! of the end label. */ append_to_statement_list (build1 (LABEL_EXPR, void_type_node, gnu_start_label), stmt_p); ! if (LOOP_STMT_TOP_COND (stmt)) ! append_to_statement_list (build3 (COND_EXPR, void_type_node, ! LOOP_STMT_TOP_COND (stmt), ! alloc_stmt_list (), ! build1 (GOTO_EXPR, ! void_type_node, ! gnu_end_label)), ! stmt_p); append_to_statement_list (LOOP_STMT_BODY (stmt), stmt_p); ! if (LOOP_STMT_BOT_COND (stmt)) ! append_to_statement_list (build3 (COND_EXPR, void_type_node, ! LOOP_STMT_BOT_COND (stmt), ! alloc_stmt_list (), ! build1 (GOTO_EXPR, ! void_type_node, ! gnu_end_label)), ! stmt_p); ! if (LOOP_STMT_UPDATE (stmt)) ! append_to_statement_list (LOOP_STMT_UPDATE (stmt), stmt_p); t = build1 (GOTO_EXPR, void_type_node, gnu_start_label); SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (gnu_end_label)); --- 6337,6379 ---- case LOOP_STMT: { tree gnu_start_label = create_artificial_label (input_location); + tree gnu_cond = LOOP_STMT_COND (stmt); + tree gnu_update = LOOP_STMT_UPDATE (stmt); tree gnu_end_label = LOOP_STMT_LABEL (stmt); tree t; + /* Build the condition expression from the test, if any. */ + if (gnu_cond) + gnu_cond + = build3 (COND_EXPR, void_type_node, gnu_cond, alloc_stmt_list (), + build1 (GOTO_EXPR, void_type_node, gnu_end_label)); + /* Set to emit the statements of the loop. */ *stmt_p = NULL_TREE; ! /* We first emit the start label and then a conditional jump to the ! end label if there's a top condition, then the update if it's at ! the top, then the body of the loop, then a conditional jump to ! the end label if there's a bottom condition, then the update if ! it's at the bottom, and finally a jump to the start label and the ! definition of the end label. */ append_to_statement_list (build1 (LABEL_EXPR, void_type_node, gnu_start_label), stmt_p); ! if (gnu_cond && !LOOP_STMT_BOTTOM_COND_P (stmt)) ! append_to_statement_list (gnu_cond, stmt_p); ! ! if (gnu_update && LOOP_STMT_TOP_UPDATE_P (stmt)) ! append_to_statement_list (gnu_update, stmt_p); append_to_statement_list (LOOP_STMT_BODY (stmt), stmt_p); ! if (gnu_cond && LOOP_STMT_BOTTOM_COND_P (stmt)) ! append_to_statement_list (gnu_cond, stmt_p); ! if (gnu_update && !LOOP_STMT_TOP_UPDATE_P (stmt)) ! append_to_statement_list (gnu_update, stmt_p); t = build1 (GOTO_EXPR, void_type_node, gnu_start_label); SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (gnu_end_label)); *************** elaborate_all_entities (Node_Id gnat_nod *** 6092,6183 **** elaborate_all_entities (Library_Unit (gnat_node)); } ! /* Do the processing of N_Freeze_Entity, GNAT_NODE. */ static void process_freeze_entity (Node_Id gnat_node) { ! Entity_Id gnat_entity = Entity (gnat_node); ! tree gnu_old; ! tree gnu_new; ! tree gnu_init ! = (Nkind (Declaration_Node (gnat_entity)) == N_Object_Declaration ! && present_gnu_tree (Declaration_Node (gnat_entity))) ! ? get_gnu_tree (Declaration_Node (gnat_entity)) : NULL_TREE; ! /* If this is a package, need to generate code for the package. */ ! if (Ekind (gnat_entity) == E_Package) { insert_code_for ! (Parent (Corresponding_Body ! (Parent (Declaration_Node (gnat_entity))))); return; } ! /* Check for old definition after the above call. This Freeze_Node ! might be for one its Itypes. */ gnu_old ! = present_gnu_tree (gnat_entity) ? get_gnu_tree (gnat_entity) : 0; ! /* If this entity has an Address representation clause, GNU_OLD is the address, so discard it here. */ if (Present (Address_Clause (gnat_entity))) ! gnu_old = 0; ! ! /* Don't do anything for class-wide types as they are always transformed ! into their root type. */ ! if (Ekind (gnat_entity) == E_Class_Wide_Type) ! return; /* Don't do anything for subprograms that may have been elaborated before ! their freeze nodes. This can happen, for example because of an inner call ! in an instance body, or a previous compilation of a spec for inlining ! purposes. */ if (gnu_old && ((TREE_CODE (gnu_old) == FUNCTION_DECL ! && (Ekind (gnat_entity) == E_Function ! || Ekind (gnat_entity) == E_Procedure)) ! || (gnu_old ! && TREE_CODE (TREE_TYPE (gnu_old)) == FUNCTION_TYPE ! && Ekind (gnat_entity) == E_Subprogram_Type))) return; /* If we have a non-dummy type old tree, we have nothing to do, except aborting if this is the public view of a private type whose full view was not delayed, as this node was never delayed as it should have been. We let this happen for concurrent types and their Corresponding_Record_Type, ! however, because each might legitimately be elaborated before it's own freeze node, e.g. while processing the other. */ if (gnu_old && !(TREE_CODE (gnu_old) == TYPE_DECL && TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old)))) { ! gcc_assert ((IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity)) && No (Freeze_Node (Full_View (gnat_entity)))) || Is_Concurrent_Type (gnat_entity) ! || (IN (Ekind (gnat_entity), Record_Kind) && Is_Concurrent_Record_Type (gnat_entity))); return; } /* Reset the saved tree, if any, and elaborate the object or type for real. ! If there is a full declaration, elaborate it and copy the type to ! GNAT_ENTITY. Likewise if this is the record subtype corresponding to ! a class wide type or subtype. */ if (gnu_old) { save_gnu_tree (gnat_entity, NULL_TREE, false); ! if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) ! && Present (Full_View (gnat_entity)) ! && present_gnu_tree (Full_View (gnat_entity))) ! save_gnu_tree (Full_View (gnat_entity), NULL_TREE, false); ! if (Present (Class_Wide_Type (gnat_entity)) ! && Class_Wide_Type (gnat_entity) != gnat_entity) save_gnu_tree (Class_Wide_Type (gnat_entity), NULL_TREE, false); } ! if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity))) { gnu_new = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, 1); --- 6468,6552 ---- elaborate_all_entities (Library_Unit (gnat_node)); } ! /* Do the processing of GNAT_NODE, an N_Freeze_Entity. */ static void process_freeze_entity (Node_Id gnat_node) { ! const Entity_Id gnat_entity = Entity (gnat_node); ! const Entity_Kind kind = Ekind (gnat_entity); ! tree gnu_old, gnu_new; ! /* If this is a package, we need to generate code for the package. */ ! if (kind == E_Package) { insert_code_for ! (Parent (Corresponding_Body ! (Parent (Declaration_Node (gnat_entity))))); return; } ! /* Don't do anything for class-wide types as they are always transformed ! into their root type. */ ! if (kind == E_Class_Wide_Type) ! return; ! ! /* Check for an old definition. This freeze node might be for an Itype. */ gnu_old ! = present_gnu_tree (gnat_entity) ? get_gnu_tree (gnat_entity) : NULL_TREE; ! /* If this entity has an address representation clause, GNU_OLD is the address, so discard it here. */ if (Present (Address_Clause (gnat_entity))) ! gnu_old = NULL_TREE; /* Don't do anything for subprograms that may have been elaborated before ! their freeze nodes. This can happen, for example, because of an inner ! call in an instance body or because of previous compilation of a spec ! for inlining purposes. */ if (gnu_old && ((TREE_CODE (gnu_old) == FUNCTION_DECL ! && (kind == E_Function || kind == E_Procedure)) ! || (TREE_CODE (TREE_TYPE (gnu_old)) == FUNCTION_TYPE ! && kind == E_Subprogram_Type))) return; /* If we have a non-dummy type old tree, we have nothing to do, except aborting if this is the public view of a private type whose full view was not delayed, as this node was never delayed as it should have been. We let this happen for concurrent types and their Corresponding_Record_Type, ! however, because each might legitimately be elaborated before its own freeze node, e.g. while processing the other. */ if (gnu_old && !(TREE_CODE (gnu_old) == TYPE_DECL && TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old)))) { ! gcc_assert ((IN (kind, Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity)) && No (Freeze_Node (Full_View (gnat_entity)))) || Is_Concurrent_Type (gnat_entity) ! || (IN (kind, Record_Kind) && Is_Concurrent_Record_Type (gnat_entity))); return; } /* Reset the saved tree, if any, and elaborate the object or type for real. ! If there is a full view, elaborate it and use the result. And, if this ! is the root type of a class-wide type, reuse it for the latter. */ if (gnu_old) { save_gnu_tree (gnat_entity, NULL_TREE, false); ! if (IN (kind, Incomplete_Or_Private_Kind) ! && Present (Full_View (gnat_entity)) ! && present_gnu_tree (Full_View (gnat_entity))) ! save_gnu_tree (Full_View (gnat_entity), NULL_TREE, false); ! if (IN (kind, Type_Kind) ! && Present (Class_Wide_Type (gnat_entity)) ! && Root_Type (Class_Wide_Type (gnat_entity)) == gnat_entity) save_gnu_tree (Class_Wide_Type (gnat_entity), NULL_TREE, false); } ! if (IN (kind, Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity))) { gnu_new = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, 1); *************** process_freeze_entity (Node_Id gnat_node *** 6193,6208 **** Set_RM_Size (gnat_entity, RM_Size (Full_View (gnat_entity))); /* The above call may have defined this entity (the simplest example ! of this is when we have a private enumeral type since the bounds ! will have the public view. */ if (!present_gnu_tree (gnat_entity)) ! save_gnu_tree (gnat_entity, gnu_new, false); ! if (Present (Class_Wide_Type (gnat_entity)) ! && Class_Wide_Type (gnat_entity) != gnat_entity) ! save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, false); } else ! gnu_new = gnat_to_gnu_entity (gnat_entity, gnu_init, 1); /* If we've made any pointers to the old version of this type, we have to update them. */ --- 6562,6586 ---- Set_RM_Size (gnat_entity, RM_Size (Full_View (gnat_entity))); /* The above call may have defined this entity (the simplest example ! of this is when we have a private enumeral type since the bounds ! will have the public view). */ if (!present_gnu_tree (gnat_entity)) ! save_gnu_tree (gnat_entity, gnu_new, false); } else ! { ! tree gnu_init ! = (Nkind (Declaration_Node (gnat_entity)) == N_Object_Declaration ! && present_gnu_tree (Declaration_Node (gnat_entity))) ! ? get_gnu_tree (Declaration_Node (gnat_entity)) : NULL_TREE; ! ! gnu_new = gnat_to_gnu_entity (gnat_entity, gnu_init, 1); ! } ! ! if (IN (kind, Type_Kind) ! && Present (Class_Wide_Type (gnat_entity)) ! && Root_Type (Class_Wide_Type (gnat_entity)) == gnat_entity) ! save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, false); /* If we've made any pointers to the old version of this type, we have to update them. */ *************** process_freeze_entity (Node_Id gnat_node *** 6211,6252 **** TREE_TYPE (gnu_new)); } - /* Process the list of inlined subprograms of GNAT_NODE, which is an - N_Compilation_Unit. */ - - static void - process_inlined_subprograms (Node_Id gnat_node) - { - Entity_Id gnat_entity; - Node_Id gnat_body; - - /* If we can inline, generate Gimple for all the inlined subprograms. - Define the entity first so we set DECL_EXTERNAL. */ - if (optimize > 0) - for (gnat_entity = First_Inlined_Subprogram (gnat_node); - Present (gnat_entity); - gnat_entity = Next_Inlined_Subprogram (gnat_entity)) - { - gnat_body = Parent (Declaration_Node (gnat_entity)); - - if (Nkind (gnat_body) != N_Subprogram_Body) - { - /* ??? This really should always be Present. */ - if (No (Corresponding_Body (gnat_body))) - continue; - - gnat_body - = Parent (Declaration_Node (Corresponding_Body (gnat_body))); - } - - if (Present (gnat_body)) - { - gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); - add_stmt (gnat_to_gnu (gnat_body)); - } - } - } - /* Elaborate decls in the lists GNAT_DECLS and GNAT_DECLS2, if present. We make two passes, one to elaborate anything other than bodies (but we declare a function if there was no spec). The second pass --- 6589,6594 ---- *************** build_unary_op_trapv (enum tree_code cod *** 6386,6394 **** { gcc_assert (code == NEGATE_EXPR || code == ABS_EXPR); ! operand = protect_multiple_eval (operand); ! return emit_check (build_binary_op (EQ_EXPR, integer_type_node, operand, TYPE_MIN_VALUE (gnu_type)), build_unary_op (code, gnu_type, operand), CE_Overflow_Check_Failed, gnat_node); --- 6728,6736 ---- { gcc_assert (code == NEGATE_EXPR || code == ABS_EXPR); ! operand = gnat_protect_expr (operand); ! return emit_check (build_binary_op (EQ_EXPR, boolean_type_node, operand, TYPE_MIN_VALUE (gnu_type)), build_unary_op (code, gnu_type, operand), CE_Overflow_Check_Failed, gnat_node); *************** static tree *** 6405,6412 **** build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left, tree right, Node_Id gnat_node) { ! tree lhs = protect_multiple_eval (left); ! tree rhs = protect_multiple_eval (right); tree type_max = TYPE_MAX_VALUE (gnu_type); tree type_min = TYPE_MIN_VALUE (gnu_type); tree gnu_expr; --- 6747,6754 ---- build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left, tree right, Node_Id gnat_node) { ! tree lhs = gnat_protect_expr (left); ! tree rhs = gnat_protect_expr (right); tree type_max = TYPE_MAX_VALUE (gnu_type); tree type_min = TYPE_MIN_VALUE (gnu_type); tree gnu_expr; *************** build_binary_op_trapv (enum tree_code co *** 6432,6439 **** } rhs_lt_zero = tree_expr_nonnegative_p (rhs) ! ? integer_zero_node ! : build_binary_op (LT_EXPR, integer_type_node, rhs, zero); /* ??? Should use more efficient check for operand_equal_p (lhs, rhs, 0) */ --- 6774,6781 ---- } rhs_lt_zero = tree_expr_nonnegative_p (rhs) ! ? boolean_false_node ! : build_binary_op (LT_EXPR, boolean_type_node, rhs, zero); /* ??? Should use more efficient check for operand_equal_p (lhs, rhs, 0) */ *************** build_binary_op_trapv (enum tree_code co *** 6469,6478 **** convert (wide_type, rhs)); tree check = build_binary_op ! (TRUTH_ORIF_EXPR, integer_type_node, ! build_binary_op (LT_EXPR, integer_type_node, wide_result, convert (wide_type, type_min)), ! build_binary_op (GT_EXPR, integer_type_node, wide_result, convert (wide_type, type_max))); tree result = convert (gnu_type, wide_result); --- 6811,6820 ---- convert (wide_type, rhs)); tree check = build_binary_op ! (TRUTH_ORIF_EXPR, boolean_type_node, ! build_binary_op (LT_EXPR, boolean_type_node, wide_result, convert (wide_type, type_min)), ! build_binary_op (GT_EXPR, boolean_type_node, wide_result, convert (wide_type, type_max))); tree result = convert (gnu_type, wide_result); *************** build_binary_op_trapv (enum tree_code co *** 6495,6503 **** /* Overflow when (rhs < 0) ^ (wrapped_expr < lhs)), for addition or when (rhs < 0) ^ (wrapped_expr > lhs) for subtraction. */ tree check = build_binary_op ! (TRUTH_XOR_EXPR, integer_type_node, rhs_lt_zero, build_binary_op (code == PLUS_EXPR ? LT_EXPR : GT_EXPR, ! integer_type_node, wrapped_expr, lhs)); return emit_check (check, result, CE_Overflow_Check_Failed, gnat_node); --- 6837,6845 ---- /* Overflow when (rhs < 0) ^ (wrapped_expr < lhs)), for addition or when (rhs < 0) ^ (wrapped_expr > lhs) for subtraction. */ tree check = build_binary_op ! (TRUTH_XOR_EXPR, boolean_type_node, rhs_lt_zero, build_binary_op (code == PLUS_EXPR ? LT_EXPR : GT_EXPR, ! boolean_type_node, wrapped_expr, lhs)); return emit_check (check, result, CE_Overflow_Check_Failed, gnat_node); *************** build_binary_op_trapv (enum tree_code co *** 6508,6531 **** { case PLUS_EXPR: /* When rhs >= 0, overflow when lhs > type_max - rhs. */ ! check_pos = build_binary_op (GT_EXPR, integer_type_node, lhs, build_binary_op (MINUS_EXPR, gnu_type, type_max, rhs)), /* When rhs < 0, overflow when lhs < type_min - rhs. */ ! check_neg = build_binary_op (LT_EXPR, integer_type_node, lhs, build_binary_op (MINUS_EXPR, gnu_type, type_min, rhs)); break; case MINUS_EXPR: /* When rhs >= 0, overflow when lhs < type_min + rhs. */ ! check_pos = build_binary_op (LT_EXPR, integer_type_node, lhs, build_binary_op (PLUS_EXPR, gnu_type, type_min, rhs)), /* When rhs < 0, overflow when lhs > type_max + rhs. */ ! check_neg = build_binary_op (GT_EXPR, integer_type_node, lhs, build_binary_op (PLUS_EXPR, gnu_type, type_max, rhs)); break; --- 6850,6873 ---- { case PLUS_EXPR: /* When rhs >= 0, overflow when lhs > type_max - rhs. */ ! check_pos = build_binary_op (GT_EXPR, boolean_type_node, lhs, build_binary_op (MINUS_EXPR, gnu_type, type_max, rhs)), /* When rhs < 0, overflow when lhs < type_min - rhs. */ ! check_neg = build_binary_op (LT_EXPR, boolean_type_node, lhs, build_binary_op (MINUS_EXPR, gnu_type, type_min, rhs)); break; case MINUS_EXPR: /* When rhs >= 0, overflow when lhs < type_min + rhs. */ ! check_pos = build_binary_op (LT_EXPR, boolean_type_node, lhs, build_binary_op (PLUS_EXPR, gnu_type, type_min, rhs)), /* When rhs < 0, overflow when lhs > type_max + rhs. */ ! check_neg = build_binary_op (GT_EXPR, boolean_type_node, lhs, build_binary_op (PLUS_EXPR, gnu_type, type_max, rhs)); break; *************** build_binary_op_trapv (enum tree_code co *** 6533,6539 **** case MULT_EXPR: /* The check here is designed to be efficient if the rhs is constant, but it will work for any rhs by using integer division. ! Four different check expressions determine wether X * C overflows, depending on C. C == 0 => false C > 0 => X > type_max / C || X < type_min / C --- 6875,6881 ---- case MULT_EXPR: /* The check here is designed to be efficient if the rhs is constant, but it will work for any rhs by using integer division. ! Four different check expressions determine whether X * C overflows, depending on C. C == 0 => false C > 0 => X > type_max / C || X < type_min / C *************** build_binary_op_trapv (enum tree_code co *** 6543,6561 **** tmp1 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs); tmp2 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs); ! check_pos = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node, ! build_binary_op (NE_EXPR, integer_type_node, zero, rhs), ! build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, ! build_binary_op (GT_EXPR, integer_type_node, lhs, tmp1), ! build_binary_op (LT_EXPR, integer_type_node, lhs, tmp2))); ! check_neg = fold_build3 (COND_EXPR, integer_type_node, ! build_binary_op (EQ_EXPR, integer_type_node, rhs, ! build_int_cst (gnu_type, -1)), ! build_binary_op (EQ_EXPR, integer_type_node, lhs, type_min), ! build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, ! build_binary_op (GT_EXPR, integer_type_node, lhs, tmp2), ! build_binary_op (LT_EXPR, integer_type_node, lhs, tmp1))); break; default: --- 6885,6915 ---- tmp1 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs); tmp2 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs); ! check_pos ! = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, ! build_binary_op (NE_EXPR, boolean_type_node, zero, ! rhs), ! build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, ! build_binary_op (GT_EXPR, ! boolean_type_node, ! lhs, tmp1), ! build_binary_op (LT_EXPR, ! boolean_type_node, ! lhs, tmp2))); ! check_neg ! = fold_build3 (COND_EXPR, boolean_type_node, ! build_binary_op (EQ_EXPR, boolean_type_node, rhs, ! build_int_cst (gnu_type, -1)), ! build_binary_op (EQ_EXPR, boolean_type_node, lhs, ! type_min), ! build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, ! build_binary_op (GT_EXPR, ! boolean_type_node, ! lhs, tmp2), ! build_binary_op (LT_EXPR, ! boolean_type_node, ! lhs, tmp1))); break; default: *************** build_binary_op_trapv (enum tree_code co *** 6569,6576 **** if (TREE_CONSTANT (gnu_expr)) return gnu_expr; ! check = fold_build3 (COND_EXPR, integer_type_node, ! rhs_lt_zero, check_neg, check_pos); return emit_check (check, gnu_expr, CE_Overflow_Check_Failed, gnat_node); } --- 6923,6930 ---- if (TREE_CONSTANT (gnu_expr)) return gnu_expr; ! check = fold_build3 (COND_EXPR, boolean_type_node, rhs_lt_zero, check_neg, ! check_pos); return emit_check (check, gnu_expr, CE_Overflow_Check_Failed, gnat_node); } *************** emit_range_check (tree gnu_expr, Entity_ *** 6602,6622 **** return gnu_expr; /* Checked expressions must be evaluated only once. */ ! gnu_expr = protect_multiple_eval (gnu_expr); ! /* 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 NaNs are not considered to be in range in the float case. */ return emit_check ! (build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, invert_truthvalue ! (build_binary_op (GE_EXPR, integer_type_node, convert (gnu_compare_type, gnu_expr), convert (gnu_compare_type, gnu_low))), invert_truthvalue ! (build_binary_op (LE_EXPR, integer_type_node, convert (gnu_compare_type, gnu_expr), convert (gnu_compare_type, gnu_high)))), --- 6956,6975 ---- return gnu_expr; /* Checked expressions must be evaluated only once. */ ! gnu_expr = gnat_protect_expr (gnu_expr); ! /* Note that the form of the check is (not (expr >= lo)) or (not (expr <= hi)) 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, boolean_type_node, invert_truthvalue ! (build_binary_op (GE_EXPR, boolean_type_node, convert (gnu_compare_type, gnu_expr), convert (gnu_compare_type, gnu_low))), invert_truthvalue ! (build_binary_op (LE_EXPR, boolean_type_node, convert (gnu_compare_type, gnu_expr), convert (gnu_compare_type, gnu_high)))), *************** emit_index_check (tree gnu_array_object, *** 6642,6648 **** tree gnu_expr_check; /* Checked expressions must be evaluated only once. */ ! gnu_expr = protect_multiple_eval (gnu_expr); /* Must do this computation in the base type in case the expression's type is an unsigned subtypes. */ --- 6995,7001 ---- tree gnu_expr_check; /* Checked expressions must be evaluated only once. */ ! gnu_expr = gnat_protect_expr (gnu_expr); /* Must do this computation in the base type in case the expression's type is an unsigned subtypes. */ *************** emit_index_check (tree gnu_array_object, *** 6653,6667 **** gnu_low = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_low, gnu_array_object); gnu_high = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_high, gnu_array_object); - /* There's no good type to use here, so we might as well use - integer_type_node. */ return emit_check ! (build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, ! build_binary_op (LT_EXPR, integer_type_node, gnu_expr_check, convert (TREE_TYPE (gnu_expr_check), gnu_low)), ! build_binary_op (GT_EXPR, integer_type_node, gnu_expr_check, convert (TREE_TYPE (gnu_expr_check), gnu_high))), --- 7006,7018 ---- gnu_low = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_low, gnu_array_object); gnu_high = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_high, gnu_array_object); return emit_check ! (build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, ! build_binary_op (LT_EXPR, boolean_type_node, gnu_expr_check, convert (TREE_TYPE (gnu_expr_check), gnu_low)), ! build_binary_op (GT_EXPR, boolean_type_node, gnu_expr_check, convert (TREE_TYPE (gnu_expr_check), gnu_high))), *************** convert_with_check (Entity_Id gnat_type, *** 6733,6739 **** && !(FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_basetype))) { /* Ensure GNU_EXPR only gets evaluated once. */ ! tree gnu_input = protect_multiple_eval (gnu_result); tree gnu_cond = integer_zero_node; tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype); tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype); --- 7084,7090 ---- && !(FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_basetype))) { /* Ensure GNU_EXPR only gets evaluated once. */ ! tree gnu_input = gnat_protect_expr (gnu_result); tree gnu_cond = integer_zero_node; tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype); tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype); *************** convert_with_check (Entity_Id gnat_type, *** 6774,6780 **** : 1)) gnu_cond = invert_truthvalue ! (build_binary_op (GE_EXPR, integer_type_node, gnu_input, convert (gnu_in_basetype, gnu_out_lb))); --- 7125,7131 ---- : 1)) gnu_cond = invert_truthvalue ! (build_binary_op (GE_EXPR, boolean_type_node, gnu_input, convert (gnu_in_basetype, gnu_out_lb))); *************** convert_with_check (Entity_Id gnat_type, *** 6785,6793 **** TREE_REAL_CST (gnu_in_lb)) : 1)) gnu_cond ! = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, gnu_cond, invert_truthvalue ! (build_binary_op (LE_EXPR, integer_type_node, gnu_input, convert (gnu_in_basetype, gnu_out_ub)))); --- 7136,7144 ---- TREE_REAL_CST (gnu_in_lb)) : 1)) gnu_cond ! = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_cond, invert_truthvalue ! (build_binary_op (LE_EXPR, boolean_type_node, gnu_input, convert (gnu_in_basetype, gnu_out_ub)))); *************** convert_with_check (Entity_Id gnat_type, *** 6803,6809 **** && !truncatep) { REAL_VALUE_TYPE half_minus_pred_half, pred_half; ! tree gnu_conv, gnu_zero, gnu_comp, gnu_saved_result, calc_type; tree gnu_pred_half, gnu_add_pred_half, gnu_subtract_pred_half; const struct real_format *fmt; --- 7154,7160 ---- && !truncatep) { REAL_VALUE_TYPE half_minus_pred_half, pred_half; ! tree gnu_conv, gnu_zero, gnu_comp, calc_type; tree gnu_pred_half, gnu_add_pred_half, gnu_subtract_pred_half; const struct real_format *fmt; *************** convert_with_check (Entity_Id gnat_type, *** 6826,6839 **** gnu_pred_half = build_real (calc_type, pred_half); /* If the input is strictly negative, subtract this value ! and otherwise add it from the input. For 0.5, the result is exactly between 1.0 and the machine number preceding 1.0 ! (for calc_type). Since the last bit of 1.0 is even, this 0.5 will round to 1.0, while all other number with an absolute ! value less than 0.5 round to 0.0. For larger numbers exactly halfway between integers, rounding will always be correct as the true mathematical result will be closer to the higher ! integer compared to the lower one. So, this constant works for all floating-point numbers. The reason to use the same constant with subtract/add instead --- 7177,7190 ---- gnu_pred_half = build_real (calc_type, pred_half); /* If the input is strictly negative, subtract this value ! and otherwise add it from the input. For 0.5, the result is exactly between 1.0 and the machine number preceding 1.0 ! (for calc_type). Since the last bit of 1.0 is even, this 0.5 will round to 1.0, while all other number with an absolute ! value less than 0.5 round to 0.0. For larger numbers exactly halfway between integers, rounding will always be correct as the true mathematical result will be closer to the higher ! integer compared to the lower one. So, this constant works for all floating-point numbers. The reason to use the same constant with subtract/add instead *************** convert_with_check (Entity_Id gnat_type, *** 6842,6857 **** conversion of the input to the calc_type (if necessary). */ gnu_zero = convert (gnu_in_basetype, integer_zero_node); ! gnu_saved_result = save_expr (gnu_result); ! gnu_conv = convert (calc_type, gnu_saved_result); ! gnu_comp = build2 (GE_EXPR, integer_type_node, ! gnu_saved_result, gnu_zero); gnu_add_pred_half ! = build2 (PLUS_EXPR, calc_type, gnu_conv, gnu_pred_half); gnu_subtract_pred_half ! = build2 (MINUS_EXPR, calc_type, gnu_conv, gnu_pred_half); ! gnu_result = build3 (COND_EXPR, calc_type, gnu_comp, ! gnu_add_pred_half, gnu_subtract_pred_half); } if (TREE_CODE (gnu_base_type) == INTEGER_TYPE --- 7193,7208 ---- conversion of the input to the calc_type (if necessary). */ gnu_zero = convert (gnu_in_basetype, integer_zero_node); ! gnu_result = gnat_protect_expr (gnu_result); ! gnu_conv = convert (calc_type, gnu_result); ! gnu_comp ! = fold_build2 (GE_EXPR, boolean_type_node, gnu_result, gnu_zero); gnu_add_pred_half ! = fold_build2 (PLUS_EXPR, calc_type, gnu_conv, gnu_pred_half); gnu_subtract_pred_half ! = fold_build2 (MINUS_EXPR, calc_type, gnu_conv, gnu_pred_half); ! gnu_result = fold_build3 (COND_EXPR, calc_type, gnu_comp, ! gnu_add_pred_half, gnu_subtract_pred_half); } if (TREE_CODE (gnu_base_type) == INTEGER_TYPE *************** convert_with_check (Entity_Id gnat_type, *** 6861,6870 **** else gnu_result = convert (gnu_base_type, gnu_result); ! /* Finally, do the range check if requested. Note that if the ! result type is a modular type, the range check is actually ! an overflow check. */ ! if (rangep || (TREE_CODE (gnu_base_type) == INTEGER_TYPE && TYPE_MODULAR_P (gnu_base_type) && overflowp)) --- 7212,7219 ---- else gnu_result = convert (gnu_base_type, gnu_result); ! /* Finally, do the range check if requested. Note that if the result type ! is a modular type, the range check is actually an overflow check. */ if (rangep || (TREE_CODE (gnu_base_type) == INTEGER_TYPE && TYPE_MODULAR_P (gnu_base_type) && overflowp)) *************** convert_with_check (Entity_Id gnat_type, *** 6873,6900 **** return convert (gnu_type, gnu_result); } ! /* Return true if TYPE is a smaller packable version of RECORD_TYPE. */ static bool ! smaller_packable_type_p (tree type, tree record_type) { ! tree size, rsize; /* We're not interested in variants here. */ ! if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (record_type)) return false; /* Like a variant, a packable version keeps the original TYPE_NAME. */ ! if (TYPE_NAME (type) != TYPE_NAME (record_type)) return false; size = TYPE_SIZE (type); ! rsize = TYPE_SIZE (record_type); ! if (!(TREE_CODE (size) == INTEGER_CST && TREE_CODE (rsize) == INTEGER_CST)) return false; ! return tree_int_cst_lt (size, rsize) != 0; } /* Return true if GNU_EXPR can be directly addressed. This is the case --- 7222,7249 ---- return convert (gnu_type, gnu_result); } ! /* Return true if TYPE is a smaller form of ORIG_TYPE. */ static bool ! smaller_form_type_p (tree type, tree orig_type) { ! tree size, osize; /* We're not interested in variants here. */ ! if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig_type)) return false; /* Like a variant, a packable version keeps the original TYPE_NAME. */ ! if (TYPE_NAME (type) != TYPE_NAME (orig_type)) return false; size = TYPE_SIZE (type); ! osize = TYPE_SIZE (orig_type); ! if (!(TREE_CODE (size) == INTEGER_CST && TREE_CODE (osize) == INTEGER_CST)) return false; ! return tree_int_cst_lt (size, osize) != 0; } /* Return true if GNU_EXPR can be directly addressed. This is the case *************** smaller_packable_type_p (tree type, tree *** 6951,6971 **** that Gigi must make sure that such operations cannot be applied to non-BLKmode bit-fields. ! The second goal is achieved by means of the addressable_p predicate ! and by inserting SAVE_EXPRs around trees deemed non-addressable. ! They will be turned during gimplification into proper temporaries ! whose address will be used in lieu of that of the original tree. */ static bool addressable_p (tree gnu_expr, tree gnu_type) { ! /* The size of the real type of the object must not be smaller than ! that of the expected type, otherwise an indirect access in the ! latter type would be larger than the object. Only records need ! to be considered in practice. */ if (gnu_type && TREE_CODE (gnu_type) == RECORD_TYPE ! && smaller_packable_type_p (TREE_TYPE (gnu_expr), gnu_type)) return false; switch (TREE_CODE (gnu_expr)) --- 7300,7329 ---- that Gigi must make sure that such operations cannot be applied to non-BLKmode bit-fields. ! The second goal is achieved by means of the addressable_p predicate, ! which computes whether a temporary must be inserted by Gigi when the ! address of a tree is requested; if so, the address of the temporary ! will be used in lieu of that of the original tree and some glue code ! generated to connect everything together. */ static bool addressable_p (tree gnu_expr, tree gnu_type) { ! /* For an integral type, the size of the actual type of the object may not ! be greater than that of the expected type, otherwise an indirect access ! in the latter type wouldn't correctly set all the bits of the object. */ ! if (gnu_type ! && INTEGRAL_TYPE_P (gnu_type) ! && smaller_form_type_p (gnu_type, TREE_TYPE (gnu_expr))) ! return false; ! ! /* The size of the actual type of the object may not be smaller than that ! of the expected type, otherwise an indirect access in the latter type ! would be larger than the object. But only record types need to be ! considered in practice for this case. */ if (gnu_type && TREE_CODE (gnu_type) == RECORD_TYPE ! && smaller_form_type_p (TREE_TYPE (gnu_expr), gnu_type)) return false; switch (TREE_CODE (gnu_expr)) *************** addressable_p (tree gnu_expr, tree gnu_t *** 6980,6990 **** case UNCONSTRAINED_ARRAY_REF: case INDIRECT_REF: return true; - case CONSTRUCTOR: case STRING_CST: case INTEGER_CST: case NULL_EXPR: case SAVE_EXPR: case CALL_EXPR: --- 7338,7356 ---- case UNCONSTRAINED_ARRAY_REF: case INDIRECT_REF: + /* Taking the address of a dereference yields the original pointer. */ return true; case STRING_CST: case INTEGER_CST: + /* Taking the address yields a pointer to the constant pool. */ + return true; + + case CONSTRUCTOR: + /* Taking the address of a static constructor yields a pointer to the + tree constant pool. */ + return TREE_STATIC (gnu_expr) ? true : false; + case NULL_EXPR: case SAVE_EXPR: case CALL_EXPR: *************** addressable_p (tree gnu_expr, tree gnu_t *** 6998,7003 **** --- 7364,7373 ---- force a temporary to be created by the middle-end. */ return true; + case COMPOUND_EXPR: + /* The address of a compound expression is that of its 2nd operand. */ + return addressable_p (TREE_OPERAND (gnu_expr, 1), gnu_type); + case COND_EXPR: /* We accept &COND_EXPR as soon as both operands are addressable and expect the outcome to be the address of the selected operand. */ *************** static tree *** 7205,7213 **** pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type, Entity_Id gnat_component_type) { - tree gnu_expr_list = NULL_TREE; tree gnu_index = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_array_type)); tree gnu_expr; for ( ; Present (gnat_expr); gnat_expr = Next (gnat_expr)) { --- 7575,7583 ---- pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type, Entity_Id gnat_component_type) { tree gnu_index = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_array_type)); tree gnu_expr; + VEC(constructor_elt,gc) *gnu_expr_vec = NULL; for ( ; Present (gnat_expr); gnat_expr = Next (gnat_expr)) { *************** pos_to_constructor (Node_Id gnat_expr, t *** 7230,7243 **** gnu_expr = emit_range_check (gnu_expr, gnat_component_type, Empty); } ! gnu_expr_list ! = tree_cons (gnu_index, convert (TREE_TYPE (gnu_array_type), gnu_expr), ! gnu_expr_list); gnu_index = int_const_binop (PLUS_EXPR, gnu_index, integer_one_node, 0); } ! return gnat_build_constructor (gnu_array_type, nreverse (gnu_expr_list)); } /* Subroutine of assoc_to_constructor: VALUES is a list of field associations, --- 7600,7612 ---- gnu_expr = emit_range_check (gnu_expr, gnat_component_type, Empty); } ! CONSTRUCTOR_APPEND_ELT (gnu_expr_vec, gnu_index, ! convert (TREE_TYPE (gnu_array_type), gnu_expr)); gnu_index = int_const_binop (PLUS_EXPR, gnu_index, integer_one_node, 0); } ! return gnat_build_constructor (gnu_array_type, gnu_expr_vec); } /* Subroutine of assoc_to_constructor: VALUES is a list of field associations, *************** pos_to_constructor (Node_Id gnat_expr, t *** 7248,7257 **** static tree extract_values (tree values, tree record_type) { - tree result = NULL_TREE; tree field, tem; ! for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field)) { tree value = 0; --- 7617,7626 ---- static tree extract_values (tree values, tree record_type) { tree field, tem; + VEC(constructor_elt,gc) *v = NULL; ! for (field = TYPE_FIELDS (record_type); field; field = DECL_CHAIN (field)) { tree value = 0; *************** extract_values (tree values, tree record *** 7283,7292 **** if (!value) continue; ! result = tree_cons (field, value, result); } ! return gnat_build_constructor (record_type, nreverse (result)); } /* EXP is to be treated as an array or record. Handle the cases when it is --- 7652,7661 ---- if (!value) continue; ! CONSTRUCTOR_APPEND_ELT (v, field, value); } ! return gnat_build_constructor (record_type, v); } /* EXP is to be treated as an array or record. Handle the cases when it is *************** maybe_implicit_deref (tree exp) *** 7307,7571 **** return exp; } - /* Protect EXP from multiple evaluation. This may make a SAVE_EXPR. */ - - tree - protect_multiple_eval (tree exp) - { - tree type = TREE_TYPE (exp); - - /* If EXP has no side effects, we theoritically don't need to do anything. - However, we may be recursively passed more and more complex expressions - involving checks which will be reused multiple times and eventually be - unshared for gimplification; in order to avoid a complexity explosion - at that point, we protect any expressions more complex than a simple - arithmetic expression. */ - if (!TREE_SIDE_EFFECTS (exp) - && (CONSTANT_CLASS_P (exp) - || !EXPRESSION_CLASS_P (skip_simple_arithmetic (exp)))) - return exp; - - /* If this is a conversion, protect what's inside the conversion. - Similarly, if we're indirectly referencing something, we only - need to protect the address since the data itself can't change - in these situations. */ - if (TREE_CODE (exp) == NON_LVALUE_EXPR - || CONVERT_EXPR_P (exp) - || TREE_CODE (exp) == VIEW_CONVERT_EXPR - || TREE_CODE (exp) == INDIRECT_REF - || TREE_CODE (exp) == UNCONSTRAINED_ARRAY_REF) - return build1 (TREE_CODE (exp), type, - protect_multiple_eval (TREE_OPERAND (exp, 0))); - - /* If this is a fat pointer or something that can be placed into a - register, just make a SAVE_EXPR. */ - if (TYPE_IS_FAT_POINTER_P (type) || TYPE_MODE (type) != BLKmode) - return save_expr (exp); - - /* Otherwise, reference, protect the address and dereference. */ - return - build_unary_op (INDIRECT_REF, type, - save_expr (build_unary_op (ADDR_EXPR, - build_reference_type (type), - exp))); - } - - /* This is equivalent to stabilize_reference in tree.c, but we know how to - handle our own nodes and we take extra arguments. FORCE says whether to - force evaluation of everything. We set SUCCESS to true unless we walk - through something we don't know how to stabilize. */ - - tree - maybe_stabilize_reference (tree ref, bool force, bool *success) - { - tree type = TREE_TYPE (ref); - enum tree_code code = TREE_CODE (ref); - tree result; - - /* Assume we'll success unless proven otherwise. */ - *success = true; - - switch (code) - { - case CONST_DECL: - case VAR_DECL: - case PARM_DECL: - case RESULT_DECL: - /* No action is needed in this case. */ - return ref; - - case ADDR_EXPR: - CASE_CONVERT: - case FLOAT_EXPR: - case FIX_TRUNC_EXPR: - case VIEW_CONVERT_EXPR: - result - = build1 (code, type, - maybe_stabilize_reference (TREE_OPERAND (ref, 0), force, - success)); - break; - - case INDIRECT_REF: - case UNCONSTRAINED_ARRAY_REF: - result = build1 (code, type, - gnat_stabilize_reference_1 (TREE_OPERAND (ref, 0), - force)); - break; - - case COMPONENT_REF: - result = build3 (COMPONENT_REF, type, - maybe_stabilize_reference (TREE_OPERAND (ref, 0), force, - success), - TREE_OPERAND (ref, 1), NULL_TREE); - break; - - case BIT_FIELD_REF: - result = build3 (BIT_FIELD_REF, type, - maybe_stabilize_reference (TREE_OPERAND (ref, 0), force, - success), - gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1), - force), - gnat_stabilize_reference_1 (TREE_OPERAND (ref, 2), - force)); - break; - - case ARRAY_REF: - case ARRAY_RANGE_REF: - result = build4 (code, type, - maybe_stabilize_reference (TREE_OPERAND (ref, 0), force, - success), - gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1), - force), - NULL_TREE, NULL_TREE); - break; - - case COMPOUND_EXPR: - result = gnat_stabilize_reference_1 (ref, force); - break; - - case CALL_EXPR: - /* This generates better code than the scheme in protect_multiple_eval - because large objects will be returned via invisible reference in - most ABIs so the temporary will directly be filled by the callee. */ - result = gnat_stabilize_reference_1 (ref, force); - break; - - case CONSTRUCTOR: - /* Constructors with 1 element are used extensively to formally - convert objects to special wrapping types. */ - if (TREE_CODE (type) == RECORD_TYPE - && VEC_length (constructor_elt, CONSTRUCTOR_ELTS (ref)) == 1) - { - tree index - = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ref), 0)->index; - tree value - = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ref), 0)->value; - result - = build_constructor_single (type, index, - gnat_stabilize_reference_1 (value, - force)); - } - else - { - *success = false; - return ref; - } - break; - - case ERROR_MARK: - ref = error_mark_node; - - /* ... fall through to failure ... */ - - /* If arg isn't a kind of lvalue we recognize, make no change. - Caller should recognize the error for an invalid lvalue. */ - default: - *success = false; - return ref; - } - - TREE_READONLY (result) = TREE_READONLY (ref); - - /* TREE_THIS_VOLATILE and TREE_SIDE_EFFECTS attached to the initial - expression may not be sustained across some paths, such as the way via - build1 for INDIRECT_REF. We re-populate those flags here for the general - case, which is consistent with the GCC version of this routine. - - Special care should be taken regarding TREE_SIDE_EFFECTS, because some - paths introduce side effects where there was none initially (e.g. calls - to save_expr), and we also want to keep track of that. */ - - TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (ref); - TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (ref); - - return result; - } - - /* Wrapper around maybe_stabilize_reference, for common uses without - lvalue restrictions and without need to examine the success - indication. */ - - static tree - gnat_stabilize_reference (tree ref, bool force) - { - bool dummy; - return maybe_stabilize_reference (ref, force, &dummy); - } - - /* Similar to stabilize_reference_1 in tree.c, but supports an extra - arg to force a SAVE_EXPR for everything. */ - - static tree - gnat_stabilize_reference_1 (tree e, bool force) - { - enum tree_code code = TREE_CODE (e); - tree type = TREE_TYPE (e); - tree result; - - /* We cannot ignore const expressions because it might be a reference - to a const array but whose index contains side-effects. But we can - ignore things that are actual constant or that already have been - handled by this function. */ - - if (TREE_CONSTANT (e) || code == SAVE_EXPR) - return e; - - switch (TREE_CODE_CLASS (code)) - { - case tcc_exceptional: - case tcc_type: - case tcc_declaration: - case tcc_comparison: - case tcc_statement: - case tcc_expression: - case tcc_reference: - case tcc_vl_exp: - /* If this is a COMPONENT_REF of a fat pointer, save the entire - fat pointer. This may be more efficient, but will also allow - us to more easily find the match for the PLACEHOLDER_EXPR. */ - if (code == COMPONENT_REF - && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (e, 0)))) - result = build3 (COMPONENT_REF, type, - gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), - force), - TREE_OPERAND (e, 1), TREE_OPERAND (e, 2)); - else if (TREE_SIDE_EFFECTS (e) || force) - return save_expr (e); - else - return e; - break; - - case tcc_constant: - /* Constants need no processing. In fact, we should never reach - here. */ - return e; - - case tcc_binary: - /* Recursively stabilize each operand. */ - result = build2 (code, type, - gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), force), - gnat_stabilize_reference_1 (TREE_OPERAND (e, 1), - force)); - break; - - case tcc_unary: - /* Recursively stabilize each operand. */ - result = build1 (code, type, - gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), - force)); - break; - - default: - gcc_unreachable (); - } - - TREE_READONLY (result) = TREE_READONLY (e); - - TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e); - TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (e); - return result; - } - /* Convert SLOC into LOCUS. Return true if SLOC corresponds to a source code location and false if it doesn't. In the former case, set the Gigi global variable REF_FILENAME to the simple debug file name as given by sinput. */ --- 7676,7681 ---- *************** set_expr_location_from_node (tree node, *** 7615,7620 **** --- 7725,7764 ---- SET_EXPR_LOCATION (node, locus); } + + /* More elaborate version of set_expr_location_from_node to be used in more + general contexts, for example the result of the translation of a generic + GNAT node. */ + + static void + set_gnu_expr_location_from_node (tree node, Node_Id gnat_node) + { + /* Set the location information on the node if it is a real expression. + References can be reused for multiple GNAT nodes and they would get + the location information of their last use. Also make sure not to + overwrite an existing location as it is probably more precise. */ + + switch (TREE_CODE (node)) + { + CASE_CONVERT: + case NON_LVALUE_EXPR: + break; + + case COMPOUND_EXPR: + if (EXPR_P (TREE_OPERAND (node, 1))) + set_gnu_expr_location_from_node (TREE_OPERAND (node, 1), gnat_node); + + /* ... fall through ... */ + + default: + if (!REFERENCE_CLASS_P (node) && !EXPR_HAS_LOCATION (node)) + { + set_expr_location_from_node (node, gnat_node); + set_end_locus_from_node (node, gnat_node); + } + break; + } + } /* Return a colon-separated list of encodings contained in encoded Ada name. */ *************** set_expr_location_from_node (tree node, *** 7622,7628 **** static const char * extract_encoding (const char *name) { ! char *encoding = GGC_NEWVEC (char, strlen (name)); get_encoding (name, encoding); return encoding; } --- 7766,7772 ---- static const char * extract_encoding (const char *name) { ! char *encoding = (char *) ggc_alloc_atomic (strlen (name)); get_encoding (name, encoding); return encoding; } *************** extract_encoding (const char *name) *** 7632,7645 **** static const char * decode_name (const char *name) { ! char *decoded = GGC_NEWVEC (char, strlen (name) * 2 + 60); __gnat_decode (name, decoded, 0); return decoded; } /* Post an error message. MSG is the error message, properly annotated. NODE is the node at which to post the error and the node to use for the ! "&" substitution. */ void post_error (const char *msg, Node_Id node) --- 7776,7789 ---- static const char * decode_name (const char *name) { ! char *decoded = (char *) ggc_alloc_atomic (strlen (name) * 2 + 60); __gnat_decode (name, decoded, 0); return decoded; } /* Post an error message. MSG is the error message, properly annotated. NODE is the node at which to post the error and the node to use for the ! '&' substitution. */ void post_error (const char *msg, Node_Id node) *************** post_error (const char *msg, Node_Id nod *** 7653,7660 **** Error_Msg_N (fp, node); } ! /* Similar, but NODE is the node at which to post the error and ENT ! is the node to use for the "&" substitution. */ void post_error_ne (const char *msg, Node_Id node, Entity_Id ent) --- 7797,7804 ---- Error_Msg_N (fp, node); } ! /* Similar to post_error, but NODE is the node at which to post the error and ! ENT is the node to use for the '&' substitution. */ void post_error_ne (const char *msg, Node_Id node, Entity_Id ent) *************** post_error_ne (const char *msg, Node_Id *** 7668,7723 **** Error_Msg_NE (fp, node, ent); } ! /* Similar, but NODE is the node at which to post the error, ENT is the node ! to use for the "&" substitution, and N is the number to use for the ^. */ void ! post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, int n) { ! String_Template temp; ! Fat_Pointer fp; ! temp.Low_Bound = 1, temp.High_Bound = strlen (msg); ! fp.Array = msg, fp.Bounds = &temp; ! Error_Msg_Uint_1 = UI_From_Int (n); ! if (Present (node)) ! Error_Msg_NE (fp, node, ent); } ! /* Similar to post_error_ne_num, but T is a GCC tree representing the ! number to write. If the tree represents a constant that fits within ! a host integer, the text inside curly brackets in MSG will be output ! (presumably including a '^'). Otherwise that text will not be output ! and the text inside square brackets will be output instead. */ void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t) { ! char *newmsg = XALLOCAVEC (char, strlen (msg) + 1); ! String_Template temp = {1, 0}; ! Fat_Pointer fp; char start_yes, end_yes, start_no, end_no; const char *p; char *q; ! fp.Array = newmsg, fp.Bounds = &temp; ! ! if (host_integerp (t, 1) ! #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_INT ! && ! compare_tree_int ! (t, (((unsigned HOST_WIDE_INT) 1 << (HOST_BITS_PER_INT - 1)) - 1)) < 0 ! #endif ! ) { ! Error_Msg_Uint_1 = UI_From_Int (tree_low_cst (t, 1)); start_yes = '{', end_yes = '}', start_no = '[', end_no = ']'; } else start_yes = '[', end_yes = ']', start_no = '{', end_no = '}'; ! for (p = msg, q = newmsg; *p; p++) { if (*p == start_yes) for (p++; *p != end_yes; p++) --- 7812,7903 ---- Error_Msg_NE (fp, node, ent); } ! /* Similar to post_error_ne, but NUM is the number to use for the '^'. */ void ! post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, int num) { ! Error_Msg_Uint_1 = UI_From_Int (num); ! post_error_ne (msg, node, ent); ! } ! /* Set the end_locus information for GNU_NODE, if any, from an explicit end ! location associated with GNAT_NODE or GNAT_NODE itself, whichever makes ! most sense. Return true if a sensible assignment was performed. */ ! static bool ! set_end_locus_from_node (tree gnu_node, Node_Id gnat_node) ! { ! Node_Id gnat_end_label = Empty; ! location_t end_locus; ! ! /* Pick the GNAT node of which we'll take the sloc to assign to the GCC node ! end_locus when there is one. We consider only GNAT nodes with a possible ! End_Label attached. If the End_Label actually was unassigned, fallback ! on the orginal node. We'd better assign an explicit sloc associated with ! the outer construct in any case. */ ! ! switch (Nkind (gnat_node)) ! { ! case N_Package_Body: ! case N_Subprogram_Body: ! case N_Block_Statement: ! gnat_end_label = End_Label (Handled_Statement_Sequence (gnat_node)); ! break; ! ! case N_Package_Declaration: ! gnat_end_label = End_Label (Specification (gnat_node)); ! break; ! ! default: ! return false; ! } ! ! gnat_node = Present (gnat_end_label) ? gnat_end_label : gnat_node; ! ! /* Some expanded subprograms have neither an End_Label nor a Sloc ! attached. Notify that to callers. */ ! ! if (!Sloc_to_locus (Sloc (gnat_node), &end_locus)) ! return false; ! ! switch (TREE_CODE (gnu_node)) ! { ! case BIND_EXPR: ! BLOCK_SOURCE_END_LOCATION (BIND_EXPR_BLOCK (gnu_node)) = end_locus; ! return true; ! ! case FUNCTION_DECL: ! DECL_STRUCT_FUNCTION (gnu_node)->function_end_locus = end_locus; ! return true; ! ! default: ! return false; ! } } ! /* Similar to post_error_ne, but T is a GCC tree representing the number to ! write. If T represents a constant, the text inside curly brackets in ! MSG will be output (presumably including a '^'). Otherwise it will not ! be output and the text inside square brackets will be output instead. */ void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t) { ! char *new_msg = XALLOCAVEC (char, strlen (msg) + 1); char start_yes, end_yes, start_no, end_no; const char *p; char *q; ! if (TREE_CODE (t) == INTEGER_CST) { ! Error_Msg_Uint_1 = UI_From_gnu (t); start_yes = '{', end_yes = '}', start_no = '[', end_no = ']'; } else start_yes = '[', end_yes = ']', start_no = '{', end_no = '}'; ! for (p = msg, q = new_msg; *p; p++) { if (*p == start_yes) for (p++; *p != end_yes; p++) *************** post_error_ne_tree (const char *msg, Nod *** 7731,7743 **** *q = 0; ! temp.High_Bound = strlen (newmsg); ! if (Present (node)) ! Error_Msg_NE (fp, node, ent); } ! /* Similar to post_error_ne_tree, except that NUM is a second ! integer to write in the message. */ void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t, --- 7911,7920 ---- *q = 0; ! post_error_ne (new_msg, node, ent); } ! /* Similar to post_error_ne_tree, but NUM is a second integer to write. */ void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t, *************** tree *** 7787,7799 **** get_exception_label (char kind) { if (kind == N_Raise_Constraint_Error) ! return TREE_VALUE (gnu_constraint_error_label_stack); else if (kind == N_Raise_Storage_Error) ! return TREE_VALUE (gnu_storage_error_label_stack); else if (kind == N_Raise_Program_Error) ! return TREE_VALUE (gnu_program_error_label_stack); else return NULL_TREE; } #include "gt-ada-trans.h" --- 7964,7984 ---- get_exception_label (char kind) { if (kind == N_Raise_Constraint_Error) ! return VEC_last (tree, gnu_constraint_error_label_stack); else if (kind == N_Raise_Storage_Error) ! return VEC_last (tree, gnu_storage_error_label_stack); else if (kind == N_Raise_Program_Error) ! return VEC_last (tree, gnu_program_error_label_stack); else return NULL_TREE; } + /* Return the decl for the current elaboration procedure. */ + + tree + get_elaboration_procedure (void) + { + return VEC_last (tree, gnu_elab_proc_stack); + } + #include "gt-ada-trans.h" diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/utils.c gcc-4.6.0/gcc/ada/gcc-interface/utils.c *** gcc-4.5.2/gcc/ada/gcc-interface/utils.c Sun Sep 19 14:55:41 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/utils.c Thu Feb 3 13:19:38 2011 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2011, 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,49 **** #include "tree.h" #include "flags.h" #include "toplev.h" ! #include "rtl.h" #include "output.h" #include "ggc.h" #include "debug.h" #include "convert.h" #include "target.h" - #include "function.h" #include "langhooks.h" - #include "pointer-set.h" #include "cgraph.h" #include "tree-dump.h" #include "tree-inline.h" #include "tree-iterator.h" - #include "gimple.h" #include "ada.h" #include "types.h" --- 30,46 ---- #include "tree.h" #include "flags.h" #include "toplev.h" ! #include "diagnostic-core.h" #include "output.h" #include "ggc.h" #include "debug.h" #include "convert.h" #include "target.h" #include "langhooks.h" #include "cgraph.h" #include "tree-dump.h" #include "tree-inline.h" #include "tree-iterator.h" #include "ada.h" #include "types.h" *************** tree gnat_std_decls[(int) ADT_LAST]; *** 82,87 **** --- 79,87 ---- /* Functions to call for each of the possible raise reasons. */ tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; + /* Likewise, but with extra info for each of the possible raise reasons. */ + tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1]; + /* Forward declarations for handlers of attributes. */ static tree handle_const_attribute (tree *, tree, tree, int, bool *); static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *); *************** static tree handle_novops_attribute (tre *** 90,95 **** --- 90,96 ---- static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *); static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *); + static tree handle_leaf_attribute (tree *, tree, tree, int, bool *); static tree handle_malloc_attribute (tree *, tree, tree, int, bool *); static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *); static tree handle_vector_size_attribute (tree *, tree, tree, int, bool *); *************** const struct attribute_spec gnat_interna *** 111,116 **** --- 112,118 ---- { "nonnull", 0, -1, false, true, true, handle_nonnull_attribute }, { "sentinel", 0, 1, false, true, true, handle_sentinel_attribute }, { "noreturn", 0, 0, true, false, false, handle_noreturn_attribute }, + { "leaf", 0, 0, true, false, false, handle_leaf_attribute }, { "malloc", 0, 0, true, false, false, handle_malloc_attribute }, { "type generic", 0, 0, false, true, true, handle_type_generic_attribute }, *************** static tree split_plus (tree, tree *); *** 201,229 **** static tree float_type_for_precision (int, enum machine_mode); static tree convert_to_fat_pointer (tree, tree); static tree convert_to_thin_pointer (tree, tree); - static tree make_descriptor_field (const char *,tree, tree, tree); static bool potential_alignment_gap (tree, tree, tree); /* Initialize the association of GNAT nodes to GCC trees. */ void init_gnat_to_gnu (void) { ! associate_gnat_to_gnu ! = (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree)); } ! /* GNAT_ENTITY is a GNAT tree node for an entity. GNU_DECL is the GCC tree ! which is to be associated with GNAT_ENTITY. Such GCC tree node is always ! a ..._DECL node. If NO_CHECK is true, the latter check is suppressed. ! If GNU_DECL is zero, a previous association is to be reset. */ void save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check) { /* Check that GNAT_ENTITY is not already defined and that it is being set ! to something which is a decl. Raise gigi 401 if not. Usually, this means GNAT_ENTITY is defined twice, but occasionally is due to some Gigi problem. */ gcc_assert (!(gnu_decl --- 203,230 ---- static tree float_type_for_precision (int, enum machine_mode); static tree convert_to_fat_pointer (tree, tree); static tree convert_to_thin_pointer (tree, tree); static bool potential_alignment_gap (tree, tree, tree); + static void process_attributes (tree, struct attrib *); /* Initialize the association of GNAT nodes to GCC trees. */ void init_gnat_to_gnu (void) { ! associate_gnat_to_gnu = ggc_alloc_cleared_vec_tree (max_gnat_nodes); } ! /* GNAT_ENTITY is a GNAT tree node for an entity. Associate GNU_DECL, a GCC ! tree node, with GNAT_ENTITY. If GNU_DECL is not a ..._DECL node, abort. ! If NO_CHECK is true, the latter check is suppressed. ! If GNU_DECL is zero, reset a previous association. */ void save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check) { /* Check that GNAT_ENTITY is not already defined and that it is being set ! to something which is a decl. If that is not the case, this usually means GNAT_ENTITY is defined twice, but occasionally is due to some Gigi problem. */ gcc_assert (!(gnu_decl *************** save_gnu_tree (Entity_Id gnat_entity, tr *** 233,241 **** SET_GNU_TREE (gnat_entity, gnu_decl); } ! /* GNAT_ENTITY is a GNAT tree node for a defining identifier. ! Return the ..._DECL node that was associated with it. If there is no tree ! node associated with GNAT_ENTITY, abort. In some cases, such as delayed elaboration or expressions that need to be elaborated only once, GNAT_ENTITY is really not an entity. */ --- 234,241 ---- SET_GNU_TREE (gnat_entity, gnu_decl); } ! /* GNAT_ENTITY is a GNAT tree node for an entity. Return the GCC tree node ! that was associated with it. If there is no such tree node, abort. In some cases, such as delayed elaboration or expressions that need to be elaborated only once, GNAT_ENTITY is really not an entity. */ *************** present_gnu_tree (Entity_Id gnat_entity) *** 260,267 **** void init_dummy_type (void) { ! dummy_node_table ! = (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree)); } /* Make a dummy type corresponding to GNAT_TYPE. */ --- 260,266 ---- void init_dummy_type (void) { ! dummy_node_table = ggc_alloc_cleared_vec_tree (max_gnat_nodes); } /* Make a dummy type corresponding to GNAT_TYPE. */ *************** make_dummy_type (Entity_Id gnat_type) *** 294,301 **** TYPE_DUMMY_P (gnu_type) = 1; TYPE_STUB_DECL (gnu_type) = create_type_stub_decl (TYPE_NAME (gnu_type), gnu_type); ! if (AGGREGATE_TYPE_P (gnu_type)) ! TYPE_BY_REFERENCE_P (gnu_type) = Is_By_Reference_Type (gnat_type); SET_DUMMY_NODE (gnat_underlying, gnu_type); --- 293,300 ---- TYPE_DUMMY_P (gnu_type) = 1; TYPE_STUB_DECL (gnu_type) = create_type_stub_decl (TYPE_NAME (gnu_type), gnu_type); ! if (Is_By_Reference_Type (gnat_type)) ! TREE_ADDRESSABLE (gnu_type) = 1; SET_DUMMY_NODE (gnat_underlying, gnu_type); *************** global_bindings_p (void) *** 310,316 **** return ((force_global || !current_function_decl) ? -1 : 0); } ! /* Enter a new binding level. */ void gnat_pushlevel (void) --- 309,315 ---- return ((force_global || !current_function_decl) ? -1 : 0); } ! /* Enter a new binding level. */ void gnat_pushlevel (void) *************** gnat_pushlevel (void) *** 324,332 **** free_binding_level = free_binding_level->chain; } else ! newlevel ! = (struct gnat_binding_level *) ! ggc_alloc (sizeof (struct gnat_binding_level)); /* Use a free BLOCK, if any; otherwise, allocate one. */ if (free_block_chain) --- 323,329 ---- free_binding_level = free_binding_level->chain; } else ! newlevel = ggc_alloc_gnat_binding_level (); /* Use a free BLOCK, if any; otherwise, allocate one. */ if (free_block_chain) *************** gnat_pushlevel (void) *** 342,352 **** if (current_binding_level) BLOCK_SUPERCONTEXT (newlevel->block) = current_binding_level->block; ! BLOCK_VARS (newlevel->block) = BLOCK_SUBBLOCKS (newlevel->block) = NULL_TREE; TREE_USED (newlevel->block) = 1; ! /* Add this level to the front of the chain (stack) of levels that are ! active. */ newlevel->chain = current_binding_level; newlevel->jmpbuf_decl = NULL_TREE; current_binding_level = newlevel; --- 339,349 ---- if (current_binding_level) BLOCK_SUPERCONTEXT (newlevel->block) = current_binding_level->block; ! BLOCK_VARS (newlevel->block) = NULL_TREE; ! BLOCK_SUBBLOCKS (newlevel->block) = NULL_TREE; TREE_USED (newlevel->block) = 1; ! /* Add this level to the front of the chain (stack) of active levels. */ newlevel->chain = current_binding_level; newlevel->jmpbuf_decl = NULL_TREE; current_binding_level = newlevel; *************** set_current_block_context (tree fndecl) *** 360,365 **** --- 357,363 ---- { BLOCK_SUPERCONTEXT (current_binding_level->block) = fndecl; DECL_INITIAL (fndecl) = current_binding_level->block; + set_block_for_group (current_binding_level->block); } /* Set the jmpbuf_decl for the current binding level to DECL. */ *************** get_block_jmpbuf_decl (void) *** 378,384 **** return current_binding_level->jmpbuf_decl; } ! /* Exit a binding level. Set any BLOCK into the current code group. */ void gnat_poplevel (void) --- 376,382 ---- return current_binding_level->jmpbuf_decl; } ! /* Exit a binding level. Set any BLOCK into the current code group. */ void gnat_poplevel (void) *************** gnat_poplevel (void) *** 387,397 **** tree block = level->block; BLOCK_VARS (block) = nreverse (BLOCK_VARS (block)); ! BLOCK_SUBBLOCKS (block) = nreverse (BLOCK_SUBBLOCKS (block)); /* If this is a function-level BLOCK don't do anything. Otherwise, if there are no variables free the block and merge its subblocks into those of its ! parent block. Otherwise, add it to the list of its parent. */ if (TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL) ; else if (BLOCK_VARS (block) == NULL_TREE) --- 385,395 ---- tree block = level->block; BLOCK_VARS (block) = nreverse (BLOCK_VARS (block)); ! BLOCK_SUBBLOCKS (block) = blocks_nreverse (BLOCK_SUBBLOCKS (block)); /* If this is a function-level BLOCK don't do anything. Otherwise, if there are no variables free the block and merge its subblocks into those of its ! parent block. Otherwise, add it to the list of its parent. */ if (TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL) ; else if (BLOCK_VARS (block) == NULL_TREE) *************** gnat_poplevel (void) *** 416,421 **** --- 414,435 ---- free_binding_level = level; } + /* Exit a binding level and discard the associated BLOCK. */ + + void + gnat_zaplevel (void) + { + struct gnat_binding_level *level = current_binding_level; + tree block = level->block; + + BLOCK_CHAIN (block) = free_block_chain; + free_block_chain = block; + + /* Free this binding structure. */ + current_binding_level = level->chain; + level->chain = free_binding_level; + free_binding_level = level; + } /* Records a ..._DECL node DECL as belonging to the current lexical scope and uses GNAT_NODE for location information and propagating flags. */ *************** gnat_pushdecl (tree decl, Node_Id gnat_n *** 446,458 **** add_decl_expr (decl, gnat_node); /* Put the declaration on the list. The list of declarations is in reverse ! order. The list will be reversed later. Put global variables in the ! globals list and builtin functions in a dedicated list to speed up ! further lookups. Don't put TYPE_DECLs for UNCONSTRAINED_ARRAY_TYPE into ! the list, as they will cause trouble with the debugger and aren't needed ! anyway. */ ! if (TREE_CODE (decl) != TYPE_DECL ! || TREE_CODE (TREE_TYPE (decl)) != UNCONSTRAINED_ARRAY_TYPE) { if (global_bindings_p ()) { --- 460,471 ---- add_decl_expr (decl, gnat_node); /* Put the declaration on the list. The list of declarations is in reverse ! order. The list will be reversed later. Put global declarations in the ! globals list and local ones in the current block. But skip TYPE_DECLs ! for UNCONSTRAINED_ARRAY_TYPE in both cases, as they will cause trouble ! with the debugger and aren't needed anyway. */ ! if (!(TREE_CODE (decl) == TYPE_DECL ! && TREE_CODE (TREE_TYPE (decl)) == UNCONSTRAINED_ARRAY_TYPE)) { if (global_bindings_p ()) { *************** gnat_pushdecl (tree decl, Node_Id gnat_n *** 461,469 **** if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)) VEC_safe_push (tree, gc, builtin_decls, decl); } ! else { ! TREE_CHAIN (decl) = BLOCK_VARS (current_binding_level->block); BLOCK_VARS (current_binding_level->block) = decl; } } --- 474,482 ---- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)) VEC_safe_push (tree, gc, builtin_decls, decl); } ! else if (!DECL_EXTERNAL (decl)) { ! DECL_CHAIN (decl) = BLOCK_VARS (current_binding_level->block); BLOCK_VARS (current_binding_level->block) = decl; } } *************** gnat_pushdecl (tree decl, Node_Id gnat_n *** 509,548 **** } } - /* Do little here. Set up the standard declarations later after the - front end has been run. */ - - void - gnat_init_decl_processing (void) - { - /* Make the binding_level structure for global names. */ - current_function_decl = 0; - current_binding_level = 0; - free_binding_level = 0; - gnat_pushlevel (); - - build_common_tree_nodes (true, true); - - /* In Ada, we use a signed type for SIZETYPE. Use the signed type - corresponding to the width of Pmode. In most cases when ptr_mode - and Pmode differ, C will use the width of ptr_mode for SIZETYPE. - But we get far better code using the width of Pmode. */ - size_type_node = gnat_type_for_mode (Pmode, 0); - set_sizetype (size_type_node); - - /* In Ada, we use an unsigned 8-bit type for the default boolean type. */ - boolean_type_node = make_unsigned_type (8); - TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE); - SET_TYPE_RM_MAX_VALUE (boolean_type_node, - build_int_cst (boolean_type_node, 1)); - SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1)); - - build_common_tree_nodes_2 (0); - boolean_true_node = TYPE_MAX_VALUE (boolean_type_node); - - ptr_void_type_node = build_pointer_type (void_type_node); - } - /* Record TYPE as a builtin type for Ada. NAME is the name of the type. */ void --- 522,527 ---- *************** finish_record_type (tree record_type, tr *** 592,601 **** if (rep_level > 0) { TYPE_ALIGN (record_type) = MAX (BITS_PER_UNIT, TYPE_ALIGN (record_type)); - SET_TYPE_MODE (record_type, BLKmode); if (!had_size_unit) TYPE_SIZE_UNIT (record_type) = size_zero_node; if (!had_size) TYPE_SIZE (record_type) = bitsize_zero_node; --- 571,580 ---- if (rep_level > 0) { TYPE_ALIGN (record_type) = MAX (BITS_PER_UNIT, TYPE_ALIGN (record_type)); if (!had_size_unit) TYPE_SIZE_UNIT (record_type) = size_zero_node; + if (!had_size) TYPE_SIZE (record_type) = bitsize_zero_node; *************** finish_record_type (tree record_type, tr *** 625,631 **** if (code == QUAL_UNION_TYPE) field_list = nreverse (field_list); ! for (field = field_list; field; field = TREE_CHAIN (field)) { tree type = TREE_TYPE (field); tree pos = bit_position (field); --- 604,610 ---- if (code == QUAL_UNION_TYPE) field_list = nreverse (field_list); ! for (field = field_list; field; field = DECL_CHAIN (field)) { tree type = TREE_TYPE (field); tree pos = bit_position (field); *************** rest_of_record_type_compilation (tree re *** 777,783 **** enum tree_code code = TREE_CODE (record_type); bool var_size = false; ! for (field = field_list; field; field = TREE_CHAIN (field)) { /* We need to make an XVE/XVU record if any field has variable size, whether or not the record does. For example, if we have a union, --- 756,762 ---- enum tree_code code = TREE_CODE (record_type); bool var_size = false; ! for (field = field_list; field; field = DECL_CHAIN (field)) { /* We need to make an XVE/XVU record if any field has variable size, whether or not the record does. For example, if we have a union, *************** rest_of_record_type_compilation (tree re *** 831,837 **** /* Now scan all the fields, replacing each field with a new field corresponding to the new encoding. */ for (old_field = TYPE_FIELDS (record_type); old_field; ! old_field = TREE_CHAIN (old_field)) { tree field_type = TREE_TYPE (old_field); tree field_name = DECL_NAME (old_field); --- 810,816 ---- /* Now scan all the fields, replacing each field with a new field corresponding to the new encoding. */ for (old_field = TYPE_FIELDS (record_type); old_field; ! old_field = DECL_CHAIN (old_field)) { tree field_type = TREE_TYPE (old_field); tree field_name = DECL_NAME (old_field); *************** rest_of_record_type_compilation (tree re *** 868,878 **** align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); /* An offset which is a bitwise AND with a negative power of 2 ! means an alignment corresponding to this power of 2. */ offset = remove_conversions (offset, true); if (TREE_CODE (offset) == BIT_AND_EXPR && host_integerp (TREE_OPERAND (offset, 1), 0) ! && tree_int_cst_sgn (TREE_OPERAND (offset, 1)) < 0) { unsigned int pow = - tree_low_cst (TREE_OPERAND (offset, 1), 0); --- 847,859 ---- align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); /* An offset which is a bitwise AND with a negative power of 2 ! means an alignment corresponding to this power of 2. Note ! that, as sizetype is sign-extended but nonetheless unsigned, ! we don't directly use tree_int_cst_sgn. */ offset = remove_conversions (offset, true); if (TREE_CODE (offset) == BIT_AND_EXPR && host_integerp (TREE_OPERAND (offset, 1), 0) ! && TREE_INT_CST_HIGH (TREE_OPERAND (offset, 1)) < 0) { unsigned int pow = - tree_low_cst (TREE_OPERAND (offset, 1), 0); *************** rest_of_record_type_compilation (tree re *** 942,951 **** field_name = concat_name (field_name, suffix); } ! new_field = create_field_decl (field_name, field_type, ! new_record_type, 0, ! DECL_SIZE (old_field), pos, 0); ! TREE_CHAIN (new_field) = TYPE_FIELDS (new_record_type); TYPE_FIELDS (new_record_type) = new_field; /* If old_field is a QUAL_UNION_TYPE, take its size as being --- 923,932 ---- field_name = concat_name (field_name, suffix); } ! new_field ! = create_field_decl (field_name, field_type, new_record_type, ! DECL_SIZE (old_field), pos, 0, 0); ! DECL_CHAIN (new_field) = TYPE_FIELDS (new_record_type); TYPE_FIELDS (new_record_type) = new_field; /* If old_field is a QUAL_UNION_TYPE, take its size as being *************** add_parallel_type (tree decl, tree paral *** 983,999 **** SET_DECL_PARALLEL_TYPE (d, parallel_type); } - /* Return the parallel type associated to a type, if any. */ - - tree - get_parallel_type (tree type) - { - if (TYPE_STUB_DECL (type)) - return DECL_PARALLEL_TYPE (TYPE_STUB_DECL (type)); - else - return NULL_TREE; - } - /* Utility function of above to merge LAST_SIZE, the previous size of a record with FIRST_BIT and SIZE that describe a field. SPECIAL is true if this represents a QUAL_UNION_TYPE in which case we must look for COND_EXPRs and --- 964,969 ---- *************** split_plus (tree in, tree *pvar) *** 1092,1149 **** return bitsize_zero_node; } ! /* Return a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the ! subprogram. If it is void_type_node, then we are dealing with a procedure, ! 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 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_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 ! input list of PARM_DECL nodes. */ ! tree param_type_list = NULL; ! tree param_decl; ! tree type; ! for (param_decl = param_decl_list; param_decl; ! param_decl = TREE_CHAIN (param_decl)) ! param_type_list = tree_cons (NULL_TREE, TREE_TYPE (param_decl), ! param_type_list); /* The list of the function parameter types has to be terminated by the void type to signal to the back-end that we are not dealing with a variable ! parameter subprogram, but that the subprogram has a fixed number of ! parameters. */ param_type_list = tree_cons (NULL_TREE, void_type_node, param_type_list); ! /* The list of argument types has been created in reverse ! so nreverse it. */ param_type_list = nreverse (param_type_list); type = build_function_type (return_type, param_type_list); ! /* TYPE may have been shared since GCC hashes types. If it has a CICO_LIST ! or the new type should, make a copy of TYPE. Likewise for ! RETURNS_UNCONSTRAINED and RETURNS_BY_REF. */ ! if (TYPE_CI_CO_LIST (type) || cico_list ! || TYPE_RETURNS_UNCONSTRAINED_P (type) != returns_unconstrained ! || TYPE_RETURNS_BY_REF_P (type) != returns_by_ref ! || TYPE_RETURNS_BY_TARGET_PTR_P (type) != returns_by_target_ptr) ! type = copy_type (type); - TYPE_CI_CO_LIST (type) = cico_list; - TYPE_RETURNS_UNCONSTRAINED_P (type) = returns_unconstrained; - TYPE_RETURNS_BY_REF_P (type) = returns_by_ref; - TYPE_RETURNS_BY_TARGET_PTR_P (type) = returns_by_target_ptr; return type; } --- 1062,1113 ---- return bitsize_zero_node; } ! /* Return a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the ! subprogram. If it is VOID_TYPE, then we are dealing with a procedure, ! otherwise we are dealing with a function. PARAM_DECL_LIST is a list of ! PARM_DECL nodes that are the subprogram parameters. CICO_LIST is the ! copy-in/copy-out list to be stored into the TYPE_CICO_LIST field. ! RETURN_UNCONSTRAINED_P is true if the function returns an unconstrained ! object. RETURN_BY_DIRECT_REF_P is true if the function returns by direct ! reference. RETURN_BY_INVISI_REF_P is true if the function returns by ! invisible reference. */ tree create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, ! bool return_unconstrained_p, bool return_by_direct_ref_p, ! bool return_by_invisi_ref_p) { /* 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 input list of PARM_DECL nodes. */ ! tree param_type_list = NULL_TREE; ! tree t, type; ! for (t = param_decl_list; t; t = DECL_CHAIN (t)) ! param_type_list = tree_cons (NULL_TREE, TREE_TYPE (t), param_type_list); /* The list of the function parameter types has to be terminated by the void type to signal to the back-end that we are not dealing with a variable ! parameter subprogram, but that it has a fixed number of parameters. */ param_type_list = tree_cons (NULL_TREE, void_type_node, param_type_list); ! /* The list of argument types has been created in reverse so reverse it. */ param_type_list = nreverse (param_type_list); type = build_function_type (return_type, param_type_list); ! /* TYPE may have been shared since GCC hashes types. If it has a different ! CICO_LIST, make a copy. Likewise for the various flags. */ ! if (!fntype_same_flags_p (type, cico_list, return_unconstrained_p, ! return_by_direct_ref_p, return_by_invisi_ref_p)) ! { ! type = copy_type (type); ! TYPE_CI_CO_LIST (type) = cico_list; ! TYPE_RETURN_UNCONSTRAINED_P (type) = return_unconstrained_p; ! TYPE_RETURN_BY_DIRECT_REF_P (type) = return_by_direct_ref_p; ! TREE_ADDRESSABLE (type) = return_by_invisi_ref_p; ! } return type; } *************** tree *** 1191,1207 **** create_index_type (tree min, tree max, tree index, Node_Id gnat_node) { /* First build a type for the desired range. */ ! tree type = build_index_2_type (min, max); ! ! /* If this type has the TYPE_INDEX_TYPE we want, return it. */ ! if (TYPE_INDEX_TYPE (type) == index) ! return type; ! ! /* Otherwise, if TYPE_INDEX_TYPE is set, make a copy. Note that we have ! no way of sharing these types, but that's only a small hole. */ ! if (TYPE_INDEX_TYPE (type)) ! type = copy_type (type); SET_TYPE_INDEX_TYPE (type, index); create_type_decl (NULL_TREE, type, NULL, true, false, gnat_node); --- 1155,1163 ---- create_index_type (tree min, tree max, tree index, Node_Id gnat_node) { /* First build a type for the desired range. */ ! tree type = build_nonshared_range_type (sizetype, min, max); + /* Then set the index type. */ SET_TYPE_INDEX_TYPE (type, index); create_type_decl (NULL_TREE, type, NULL, true, false, gnat_node); *************** create_range_type (tree type, tree min, *** 1220,1245 **** type = sizetype; /* First build a type with the base range. */ ! range_type ! = build_range_type (type, TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type)); ! ! min = convert (type, min); ! max = convert (type, max); ! ! /* If this type has the TYPE_RM_{MIN,MAX}_VALUE we want, return it. */ ! if (TYPE_RM_MIN_VALUE (range_type) ! && TYPE_RM_MAX_VALUE (range_type) ! && operand_equal_p (TYPE_RM_MIN_VALUE (range_type), min, 0) ! && operand_equal_p (TYPE_RM_MAX_VALUE (range_type), max, 0)) ! return range_type; ! ! /* Otherwise, if TYPE_RM_{MIN,MAX}_VALUE is set, make a copy. */ ! if (TYPE_RM_MIN_VALUE (range_type) || TYPE_RM_MAX_VALUE (range_type)) ! range_type = copy_type (range_type); /* Then set the actual range. */ ! SET_TYPE_RM_MIN_VALUE (range_type, min); ! SET_TYPE_RM_MAX_VALUE (range_type, max); return range_type; } --- 1176,1187 ---- type = sizetype; /* First build a type with the base range. */ ! range_type = build_nonshared_range_type (type, TYPE_MIN_VALUE (type), ! TYPE_MAX_VALUE (type)); /* Then set the actual range. */ ! SET_TYPE_RM_MIN_VALUE (range_type, convert (type, min)); ! SET_TYPE_RM_MAX_VALUE (range_type, convert (type, max)); return range_type; } *************** create_type_decl (tree type_name, tree t *** 1289,1295 **** --- 1231,1240 ---- TYPE_DECL, type_name, type); DECL_ARTIFICIAL (type_decl) = artificial_p; + + /* Add this decl to the current binding level. */ gnat_pushdecl (type_decl, gnat_node); + process_attributes (type_decl, attr_list); /* If we're naming the type, equate the TYPE_STUB_DECL to the name. *************** create_var_decl_1 (tree var_name, tree a *** 1403,1439 **** && !have_global_bss_p ()) DECL_COMMON (var_decl) = 1; ! /* If it's public and not external, always allocate storage for it. ! At the global binding level we need to allocate static storage for the ! variable if and only if it's not external. If we are not at the top level ! we allocate automatic storage unless requested not to. */ TREE_STATIC (var_decl) ! = !extern_flag && (public_flag || static_flag || global_bindings_p ()); /* For an external constant whose initializer is not absolute, do not emit debug info. In DWARF this would mean a global relocation in a read-only ! section which runs afoul of the PE-COFF runtime relocation mechanism. */ if (extern_flag && constant_p && initializer_constant_valid_p (var_init, TREE_TYPE (var_init)) != null_pointer_node) DECL_IGNORED_P (var_decl) = 1; - if (TREE_CODE (var_decl) == VAR_DECL) - { - if (asm_name) - SET_DECL_ASSEMBLER_NAME (var_decl, asm_name); - process_attributes (var_decl, attr_list); - } - /* Add this decl to the current binding level. */ gnat_pushdecl (var_decl, gnat_node); if (TREE_SIDE_EFFECTS (var_decl)) TREE_ADDRESSABLE (var_decl) = 1; ! if (TREE_CODE (var_decl) != CONST_DECL) { if (global_bindings_p ()) rest_of_decl_compilation (var_decl, true, 0); } --- 1348,1379 ---- && !have_global_bss_p ()) DECL_COMMON (var_decl) = 1; ! /* At the global binding level, we need to allocate static storage for the ! variable if it isn't external. Otherwise, we allocate automatic storage ! unless requested not to. */ TREE_STATIC (var_decl) ! = !extern_flag && (static_flag || global_bindings_p ()); /* For an external constant whose initializer is not absolute, do not emit debug info. In DWARF this would mean a global relocation in a read-only ! section which runs afoul of the PE-COFF run-time relocation mechanism. */ if (extern_flag && constant_p && initializer_constant_valid_p (var_init, TREE_TYPE (var_init)) != null_pointer_node) DECL_IGNORED_P (var_decl) = 1; /* Add this decl to the current binding level. */ gnat_pushdecl (var_decl, gnat_node); if (TREE_SIDE_EFFECTS (var_decl)) TREE_ADDRESSABLE (var_decl) = 1; ! if (TREE_CODE (var_decl) == VAR_DECL) { + if (asm_name) + SET_DECL_ASSEMBLER_NAME (var_decl, asm_name); + process_attributes (var_decl, attr_list); if (global_bindings_p ()) rest_of_decl_compilation (var_decl, true, 0); } *************** aggregate_type_contains_array_p (tree ty *** 1455,1461 **** case QUAL_UNION_TYPE: { tree field; ! for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) if (AGGREGATE_TYPE_P (TREE_TYPE (field)) && aggregate_type_contains_array_p (TREE_TYPE (field))) return true; --- 1395,1401 ---- case QUAL_UNION_TYPE: { tree field; ! for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (AGGREGATE_TYPE_P (TREE_TYPE (field)) && aggregate_type_contains_array_p (TREE_TYPE (field))) return true; *************** aggregate_type_contains_array_p (tree ty *** 1471,1486 **** } /* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is ! its type and RECORD_TYPE is the type of the enclosing record. PACKED is ! 1 if the enclosing record is packed, -1 if it has Component_Alignment of ! Storage_Unit. If SIZE is nonzero, it is the specified size of the field. ! If POS is nonzero, it is the bit position. If ADDRESSABLE is nonzero, it means we are allowed to take the address of the field; if it is negative, we should not make a bitfield, which is used by make_aligning_type. */ tree create_field_decl (tree field_name, tree field_type, tree record_type, ! int packed, tree size, tree pos, int addressable) { tree field_decl = build_decl (input_location, FIELD_DECL, field_name, field_type); --- 1411,1426 ---- } /* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is ! its type and RECORD_TYPE is the type of the enclosing record. If SIZE is ! nonzero, it is the specified size of the field. If POS is nonzero, it is ! the bit position. PACKED is 1 if the enclosing record is packed, -1 if it ! has Component_Alignment of Storage_Unit. If ADDRESSABLE is nonzero, it means we are allowed to take the address of the field; if it is negative, we should not make a bitfield, which is used by make_aligning_type. */ tree create_field_decl (tree field_name, tree field_type, tree record_type, ! tree size, tree pos, int packed, int addressable) { tree field_decl = build_decl (input_location, FIELD_DECL, field_name, field_type); *************** create_param_decl (tree param_name, tree *** 1653,1665 **** /* Given a DECL and ATTR_LIST, process the listed attributes. */ ! void process_attributes (tree decl, struct attrib *attr_list) { for (; attr_list; attr_list = attr_list->next) switch (attr_list->type) { case ATTR_MACHINE_ATTRIBUTE: decl_attributes (&decl, tree_cons (attr_list->name, attr_list->args, NULL_TREE), ATTR_FLAG_TYPE_IN_PLACE); --- 1593,1606 ---- /* Given a DECL and ATTR_LIST, process the listed attributes. */ ! static void process_attributes (tree decl, struct attrib *attr_list) { for (; attr_list; attr_list = attr_list->next) switch (attr_list->type) { case ATTR_MACHINE_ATTRIBUTE: + input_location = DECL_SOURCE_LOCATION (decl); decl_attributes (&decl, tree_cons (attr_list->name, attr_list->args, NULL_TREE), ATTR_FLAG_TYPE_IN_PLACE); *************** invalidate_global_renaming_pointers (voi *** 1728,1734 **** unsigned int i; tree iter; ! for (i = 0; VEC_iterate(tree, global_renaming_pointers, i, iter); i++) SET_DECL_RENAMED_OBJECT (iter, NULL_TREE); VEC_free (tree, gc, global_renaming_pointers); --- 1669,1675 ---- unsigned int i; tree iter; ! FOR_EACH_VEC_ELT (tree, global_renaming_pointers, i, iter) SET_DECL_RENAMED_OBJECT (iter, NULL_TREE); VEC_free (tree, gc, global_renaming_pointers); *************** create_subprog_decl (tree subprog_name, *** 1825,1833 **** bool public_flag, bool extern_flag, struct attrib *attr_list, Node_Id gnat_node) { ! tree return_type = TREE_TYPE (subprog_type); ! tree subprog_decl = build_decl (input_location, ! FUNCTION_DECL, subprog_name, subprog_type); /* If this is a non-inline function nested inside an inlined external function, we cannot honor both requests without cloning the nested --- 1766,1775 ---- bool public_flag, bool extern_flag, struct attrib *attr_list, Node_Id gnat_node) { ! tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name, ! subprog_type); ! tree result_decl = build_decl (input_location, RESULT_DECL, NULL_TREE, ! TREE_TYPE (subprog_type)); /* If this is a non-inline function nested inside an inlined external function, we cannot honor both requests without cloning the nested *************** create_subprog_decl (tree subprog_name, *** 1842,1870 **** DECL_EXTERNAL (subprog_decl) = extern_flag; TREE_PUBLIC (subprog_decl) = public_flag; - TREE_STATIC (subprog_decl) = 1; TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type); TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type); TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type); DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag; DECL_ARGUMENTS (subprog_decl) = param_decl_list; - DECL_RESULT (subprog_decl) = build_decl (input_location, - RESULT_DECL, 0, return_type); - DECL_ARTIFICIAL (DECL_RESULT (subprog_decl)) = 1; - DECL_IGNORED_P (DECL_RESULT (subprog_decl)) = 1; ! /* TREE_ADDRESSABLE is set on the result type to request the use of the ! target by-reference return mechanism. This is not supported all the ! way down to RTL expansion with GCC 4, which ICEs on temporary creation ! attempts with such a type and expects DECL_BY_REFERENCE to be set on ! the RESULT_DECL instead - see gnat_genericize for more details. */ ! if (TREE_ADDRESSABLE (TREE_TYPE (DECL_RESULT (subprog_decl)))) ! { ! tree result_decl = DECL_RESULT (subprog_decl); ! ! TREE_ADDRESSABLE (TREE_TYPE (result_decl)) = 0; ! DECL_BY_REFERENCE (result_decl) = 1; ! } if (asm_name) { --- 1784,1799 ---- DECL_EXTERNAL (subprog_decl) = extern_flag; TREE_PUBLIC (subprog_decl) = public_flag; TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type); TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type); TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type); DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag; DECL_ARGUMENTS (subprog_decl) = param_decl_list; ! DECL_ARTIFICIAL (result_decl) = 1; ! DECL_IGNORED_P (result_decl) = 1; ! DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (subprog_type); ! DECL_RESULT (subprog_decl) = result_decl; if (asm_name) { *************** create_subprog_decl (tree subprog_name, *** 1880,1890 **** DECL_NAME (subprog_decl) = main_identifier_node; } - process_attributes (subprog_decl, attr_list); - /* Add this decl to the current binding level. */ gnat_pushdecl (subprog_decl, gnat_node); /* Output the assembler code and/or RTL for the declaration. */ rest_of_decl_compilation (subprog_decl, global_bindings_p (), 0); --- 1809,1819 ---- DECL_NAME (subprog_decl) = main_identifier_node; } /* Add this decl to the current binding level. */ gnat_pushdecl (subprog_decl, gnat_node); + process_attributes (subprog_decl, attr_list); + /* Output the assembler code and/or RTL for the declaration. */ rest_of_decl_compilation (subprog_decl, global_bindings_p (), 0); *************** begin_subprog_body (tree subprog_decl) *** 1900,1913 **** { tree param_decl; - current_function_decl = subprog_decl; announce_function (subprog_decl); /* Enter a new binding level and show that all the parameters belong to this function. */ gnat_pushlevel (); for (param_decl = DECL_ARGUMENTS (subprog_decl); param_decl; ! param_decl = TREE_CHAIN (param_decl)) DECL_CONTEXT (param_decl) = subprog_decl; make_decl_rtl (subprog_decl); --- 1829,1847 ---- { tree param_decl; announce_function (subprog_decl); + /* This function is being defined. */ + TREE_STATIC (subprog_decl) = 1; + + current_function_decl = subprog_decl; + /* Enter a new binding level and show that all the parameters belong to this function. */ gnat_pushlevel (); + for (param_decl = DECL_ARGUMENTS (subprog_decl); param_decl; ! param_decl = DECL_CHAIN (param_decl)) DECL_CONTEXT (param_decl) = subprog_decl; make_decl_rtl (subprog_decl); *************** begin_subprog_body (tree subprog_decl) *** 1918,2080 **** get_pending_sizes (); } - - /* Helper for the genericization callback. Return a dereference of VAL - if it is of a reference type. */ - - static tree - convert_from_reference (tree val) - { - tree value_type, ref; - - if (TREE_CODE (TREE_TYPE (val)) != REFERENCE_TYPE) - return val; - - value_type = TREE_TYPE (TREE_TYPE (val)); - ref = build1 (INDIRECT_REF, value_type, val); - - /* See if what we reference is CONST or VOLATILE, which requires - looking into array types to get to the component type. */ - - while (TREE_CODE (value_type) == ARRAY_TYPE) - value_type = TREE_TYPE (value_type); - - TREE_READONLY (ref) - = (TYPE_QUALS (value_type) & TYPE_QUAL_CONST); - TREE_THIS_VOLATILE (ref) - = (TYPE_QUALS (value_type) & TYPE_QUAL_VOLATILE); - - TREE_SIDE_EFFECTS (ref) - = (TREE_THIS_VOLATILE (ref) || TREE_SIDE_EFFECTS (val)); - - return ref; - } - - /* Helper for the genericization callback. Returns true if T denotes - a RESULT_DECL with DECL_BY_REFERENCE set. */ - - static inline bool - is_byref_result (tree t) - { - return (TREE_CODE (t) == RESULT_DECL && DECL_BY_REFERENCE (t)); - } - - - /* Tree walking callback for gnat_genericize. Currently ... - - o Adjust references to the function's DECL_RESULT if it is marked - DECL_BY_REFERENCE and so has had its type turned into a reference - type at the end of the function compilation. */ - - static tree - gnat_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) - { - /* This implementation is modeled after what the C++ front-end is - doing, basis of the downstream passes behavior. */ - - tree stmt = *stmt_p; - struct pointer_set_t *p_set = (struct pointer_set_t*) data; - - /* If we have a direct mention of the result decl, dereference. */ - if (is_byref_result (stmt)) - { - *stmt_p = convert_from_reference (stmt); - *walk_subtrees = 0; - return NULL; - } - - /* Otherwise, no need to walk the same tree twice. */ - if (pointer_set_contains (p_set, stmt)) - { - *walk_subtrees = 0; - return NULL_TREE; - } - - /* If we are taking the address of what now is a reference, just get the - reference value. */ - if (TREE_CODE (stmt) == ADDR_EXPR - && is_byref_result (TREE_OPERAND (stmt, 0))) - { - *stmt_p = convert (TREE_TYPE (stmt), TREE_OPERAND (stmt, 0)); - *walk_subtrees = 0; - } - - /* Don't dereference an by-reference RESULT_DECL inside a RETURN_EXPR. */ - else if (TREE_CODE (stmt) == RETURN_EXPR - && TREE_OPERAND (stmt, 0) - && is_byref_result (TREE_OPERAND (stmt, 0))) - *walk_subtrees = 0; - - /* Don't look inside trees that cannot embed references of interest. */ - else if (IS_TYPE_OR_DECL_P (stmt)) - *walk_subtrees = 0; - - pointer_set_insert (p_set, *stmt_p); - - return NULL; - } - - /* Perform lowering of Ada trees to GENERIC. In particular: - - o Turn a DECL_BY_REFERENCE RESULT_DECL into a real by-reference decl - and adjust all the references to this decl accordingly. */ - - static void - gnat_genericize (tree fndecl) - { - /* Prior to GCC 4, an explicit By_Reference result mechanism for a function - was handled by simply setting TREE_ADDRESSABLE on the result type. - Everything required to actually pass by invisible ref using the target - mechanism (e.g. extra parameter) was handled at RTL expansion time. - - This doesn't work with GCC 4 any more for several reasons. First, the - gimplification process might need the creation of temporaries of this - 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 explicitly accounted for by the front-end in the function body. - - We achieve the complete transformation in two steps: - - 1/ create_subprog_decl performs early attribute tweaks: it clears - TREE_ADDRESSABLE from the result type and sets DECL_BY_REFERENCE on - the result decl. The former ensures that the bit isn't set in the GCC - tree saved for the function, so prevents ICEs on temporary creation. - The latter we use here to trigger the rest of the processing. - - 2/ This function performs the type transformation on the result decl - and adjusts all the references to this decl from the function body - accordingly. - - Clearing TREE_ADDRESSABLE from the type differs from the C++ front-end - 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 explicitly. */ - - struct pointer_set_t *p_set; - tree decl_result = DECL_RESULT (fndecl); - - if (!DECL_BY_REFERENCE (decl_result)) - return; - - /* 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 - trees should be visited again or not. */ - - p_set = pointer_set_create (); - - TREE_TYPE (decl_result) = build_reference_type (TREE_TYPE (decl_result)); - TREE_ADDRESSABLE (decl_result) = 0; - relayout_decl (decl_result); - - walk_tree (&DECL_SAVED_TREE (fndecl), gnat_genericize_r, p_set, NULL); - - pointer_set_destroy (p_set); - } - /* Finish the definition of the current subprogram BODY and finalize it. */ void --- 1852,1857 ---- *************** end_subprog_body (tree body) *** 2104,2110 **** DECL_SAVED_TREE (fndecl) = body; current_function_decl = DECL_CONTEXT (fndecl); - set_cfun (NULL); /* We cannot track the location of errors past this point. */ error_gnat_node = Empty; --- 1881,1886 ---- *************** end_subprog_body (tree body) *** 2113,2121 **** if (type_annotate_only) return; - /* Perform the required pre-gimplification transformations on the tree. */ - gnat_genericize (fndecl); - /* Dump functions before gimplification. */ dump_function (TDI_original, fndecl); --- 1889,1894 ---- *************** gnat_types_compatible_p (tree t1, tree t *** 2293,2309 **** && TYPE_PRECISION (TREE_TYPE (t1)) == TYPE_PRECISION (TREE_TYPE (t2))) return 1; ! /* 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) && (TYPE_DOMAIN (t1) == TYPE_DOMAIN (t2) || (TYPE_DOMAIN (t1) && TYPE_DOMAIN (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 --- 2066,2084 ---- && TYPE_PRECISION (TREE_TYPE (t1)) == TYPE_PRECISION (TREE_TYPE (t2))) return 1; ! /* Array types are also compatible if they are constrained and have the same ! domain(s) and the same component type. */ if (code == ARRAY_TYPE && (TYPE_DOMAIN (t1) == TYPE_DOMAIN (t2) || (TYPE_DOMAIN (t1) && TYPE_DOMAIN (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))))) ! && (TREE_TYPE (t1) == TREE_TYPE (t2) ! || (TREE_CODE (TREE_TYPE (t1)) == ARRAY_TYPE ! && gnat_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))))) return 1; /* Padding record types are also compatible if they pad the same *************** gnat_types_compatible_p (tree t1, tree t *** 2316,2321 **** --- 2091,2108 ---- return 0; } + + /* Return true if T, a FUNCTION_TYPE, has the specified list of flags. */ + + bool + fntype_same_flags_p (const_tree t, tree cico_list, bool return_unconstrained_p, + bool return_by_direct_ref_p, bool return_by_invisi_ref_p) + { + return TYPE_CI_CO_LIST (t) == cico_list + && TYPE_RETURN_UNCONSTRAINED_P (t) == return_unconstrained_p + && TYPE_RETURN_BY_DIRECT_REF_P (t) == return_by_direct_ref_p + && TREE_ADDRESSABLE (t) == return_by_invisi_ref_p; + } /* 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 *************** max_size (tree exp, bool max_p) *** 2345,2351 **** n = call_expr_nargs (exp); gcc_assert (n > 0); ! argarray = (tree *) alloca (n * sizeof (tree)); for (i = 0; i < n; i++) argarray[i] = max_size (CALL_EXPR_ARG (exp, i), max_p); return build_call_array (type, CALL_EXPR_FN (exp), n, argarray); --- 2132,2138 ---- n = call_expr_nargs (exp); gcc_assert (n > 0); ! argarray = XALLOCAVEC (tree, n); for (i = 0; i < n; i++) argarray[i] = max_size (CALL_EXPR_ARG (exp, i), max_p); return build_call_array (type, CALL_EXPR_FN (exp), n, argarray); *************** max_size (tree exp, bool max_p) *** 2383,2404 **** if (code == COMPOUND_EXPR) return max_size (TREE_OPERAND (exp, 1), max_p); - /* Calculate "(A ? B : C) - D" as "A ? B - D : C - D" which - may provide a tighter bound on max_size. */ - if (code == MINUS_EXPR - && TREE_CODE (TREE_OPERAND (exp, 0)) == COND_EXPR) - { - tree lhs = fold_build2 (MINUS_EXPR, type, - TREE_OPERAND (TREE_OPERAND (exp, 0), 1), - TREE_OPERAND (exp, 1)); - tree rhs = fold_build2 (MINUS_EXPR, type, - TREE_OPERAND (TREE_OPERAND (exp, 0), 2), - TREE_OPERAND (exp, 1)); - return fold_build2 (max_p ? MAX_EXPR : MIN_EXPR, type, - max_size (lhs, max_p), - max_size (rhs, max_p)); - } - { tree lhs = max_size (TREE_OPERAND (exp, 0), max_p); tree rhs = max_size (TREE_OPERAND (exp, 1), --- 2170,2175 ---- *************** max_size (tree exp, bool max_p) *** 2408,2415 **** In that case, if one side overflows, return the other. sizetype is signed, but we know sizes are non-negative. Likewise, handle a MINUS_EXPR or PLUS_EXPR with the LHS ! overflowing or the maximum possible value and the RHS ! a variable. */ if (max_p && code == MIN_EXPR && TREE_CODE (rhs) == INTEGER_CST --- 2179,2185 ---- In that case, if one side overflows, return the other. sizetype is signed, but we know sizes are non-negative. Likewise, handle a MINUS_EXPR or PLUS_EXPR with the LHS ! overflowing and the RHS a variable. */ if (max_p && code == MIN_EXPR && TREE_CODE (rhs) == INTEGER_CST *************** max_size (tree exp, bool max_p) *** 2421,2429 **** && TREE_OVERFLOW (lhs)) return rhs; else if ((code == MINUS_EXPR || code == PLUS_EXPR) ! && ((TREE_CODE (lhs) == INTEGER_CST ! && TREE_OVERFLOW (lhs)) ! || operand_equal_p (lhs, TYPE_MAX_VALUE (type), 0)) && !TREE_CONSTANT (rhs)) return lhs; else --- 2191,2198 ---- && TREE_OVERFLOW (lhs)) return rhs; else if ((code == MINUS_EXPR || code == PLUS_EXPR) ! && TREE_CODE (lhs) == INTEGER_CST ! && TREE_OVERFLOW (lhs) && !TREE_CONSTANT (rhs)) return lhs; else *************** max_size (tree exp, bool max_p) *** 2454,2460 **** tree build_template (tree template_type, tree array_type, tree expr) { ! tree template_elts = NULL_TREE; tree bound_list = NULL_TREE; tree field; --- 2223,2229 ---- tree build_template (tree template_type, tree array_type, tree expr) { ! VEC(constructor_elt,gc) *template_elts = NULL; tree bound_list = NULL_TREE; tree field; *************** build_template (tree template_type, tree *** 2477,2483 **** (bound_list ? (bound_list = TREE_CHAIN (bound_list)) : (array_type = TREE_TYPE (array_type))), ! field = TREE_CHAIN (TREE_CHAIN (field))) { tree bounds, min, max; --- 2246,2252 ---- (bound_list ? (bound_list = TREE_CHAIN (bound_list)) : (array_type = TREE_TYPE (array_type))), ! field = DECL_CHAIN (DECL_CHAIN (field))) { tree bounds, min, max; *************** build_template (tree template_type, tree *** 2496,2535 **** gcc_unreachable (); min = convert (TREE_TYPE (field), TYPE_MIN_VALUE (bounds)); ! max = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MAX_VALUE (bounds)); /* If either MIN or MAX involve a PLACEHOLDER_EXPR, we must substitute it from OBJECT. */ min = SUBSTITUTE_PLACEHOLDER_IN_EXPR (min, expr); max = SUBSTITUTE_PLACEHOLDER_IN_EXPR (max, expr); ! template_elts = tree_cons (TREE_CHAIN (field), max, ! tree_cons (field, min, template_elts)); } ! return gnat_build_constructor (template_type, nreverse (template_elts)); } ! /* Build a 32bit VMS descriptor from a Mechanism_Type, which must specify ! a descriptor type, and the GCC type of an object. Each FIELD_DECL ! in the type contains in its DECL_INITIAL the expression to use when ! a constructor is made for the type. GNAT_ENTITY is an entity used ! to print out an error message if the mechanism cannot be applied to ! an object of that type and also for the name. */ tree build_vms_descriptor32 (tree type, Mechanism_Type mech, Entity_Id gnat_entity) { tree record_type = make_node (RECORD_TYPE); ! tree pointer32_type; ! tree field_list = 0; ! int klass; ! int dtype = 0; ! tree inner_type; ! int ndim; ! int i; tree *idx_arr; - tree tem; /* If TYPE is an unconstrained array, use the underlying array type. */ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) --- 2265,2316 ---- gcc_unreachable (); min = convert (TREE_TYPE (field), TYPE_MIN_VALUE (bounds)); ! max = convert (TREE_TYPE (DECL_CHAIN (field)), TYPE_MAX_VALUE (bounds)); /* If either MIN or MAX involve a PLACEHOLDER_EXPR, we must substitute it from OBJECT. */ min = SUBSTITUTE_PLACEHOLDER_IN_EXPR (min, expr); max = SUBSTITUTE_PLACEHOLDER_IN_EXPR (max, expr); ! CONSTRUCTOR_APPEND_ELT (template_elts, field, min); ! CONSTRUCTOR_APPEND_ELT (template_elts, DECL_CHAIN (field), max); } ! return gnat_build_constructor (template_type, template_elts); } ! /* Helper routine to make a descriptor field. FIELD_LIST is the list of decls ! being built; the new decl is chained on to the front of the list. */ ! ! static tree ! make_descriptor_field (const char *name, tree type, tree rec_type, ! tree initial, tree field_list) ! { ! tree field ! = create_field_decl (get_identifier (name), type, rec_type, NULL_TREE, ! NULL_TREE, 0, 0); ! ! DECL_INITIAL (field) = initial; ! DECL_CHAIN (field) = field_list; ! return field; ! } ! ! /* Build a 32-bit VMS descriptor from a Mechanism_Type, which must specify a ! descriptor type, and the GCC type of an object. Each FIELD_DECL in the ! type contains in its DECL_INITIAL the expression to use when a constructor ! is made for the type. GNAT_ENTITY is an entity used to print out an error ! message if the mechanism cannot be applied to an object of that type and ! also for the name. */ tree build_vms_descriptor32 (tree type, Mechanism_Type mech, Entity_Id gnat_entity) { tree record_type = make_node (RECORD_TYPE); ! tree pointer32_type, pointer64_type; ! tree field_list = NULL_TREE; ! int klass, ndim, i, dtype = 0; ! tree inner_type, tem; tree *idx_arr; /* If TYPE is an unconstrained array, use the underlying array type. */ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) *************** build_vms_descriptor32 (tree type, Mecha *** 2546,2552 **** ndim++, inner_type = TREE_TYPE (inner_type)) ; ! idx_arr = (tree *) alloca (ndim * sizeof (tree)); if (mech != By_Descriptor_NCA && mech != By_Short_Descriptor_NCA && TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type)) --- 2327,2333 ---- ndim++, inner_type = TREE_TYPE (inner_type)) ; ! idx_arr = XALLOCAVEC (tree, ndim); if (mech != By_Descriptor_NCA && mech != By_Short_Descriptor_NCA && TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type)) *************** build_vms_descriptor32 (tree type, Mecha *** 2654,2690 **** break; } ! /* Make the type for a descriptor for VMS. The first four fields ! are the same for all types. */ ! field_list ! = chainon (field_list, ! make_descriptor_field ! ("LENGTH", gnat_type_for_size (16, 1), record_type, ! size_in_bytes ((mech == By_Descriptor_A || ! mech == By_Short_Descriptor_A) ! ? inner_type : type))); ! ! field_list = chainon (field_list, ! make_descriptor_field ("DTYPE", ! gnat_type_for_size (8, 1), ! record_type, size_int (dtype))); ! field_list = chainon (field_list, ! make_descriptor_field ("CLASS", ! gnat_type_for_size (8, 1), ! record_type, size_int (klass))); - /* Of course this will crash at run-time if the address space is not - within the low 32 bits, but there is nothing else we can do. */ pointer32_type = build_pointer_type_for_mode (type, SImode, false); field_list ! = chainon (field_list, ! make_descriptor_field ! ("POINTER", pointer32_type, record_type, ! build_unary_op (ADDR_EXPR, ! pointer32_type, ! build0 (PLACEHOLDER_EXPR, type)))); switch (mech) { --- 2435,2472 ---- break; } ! /* Make the type for a descriptor for VMS. The first four fields are the ! same for all types. */ field_list ! = make_descriptor_field ("LENGTH", gnat_type_for_size (16, 1), record_type, ! size_in_bytes ((mech == By_Descriptor_A ! || mech == By_Short_Descriptor_A) ! ? inner_type : type), ! field_list); ! field_list ! = make_descriptor_field ("DTYPE", gnat_type_for_size (8, 1), record_type, ! size_int (dtype), field_list); ! field_list ! = make_descriptor_field ("CLASS", gnat_type_for_size (8, 1), record_type, ! size_int (klass), field_list); pointer32_type = build_pointer_type_for_mode (type, SImode, false); + pointer64_type = build_pointer_type_for_mode (type, DImode, false); + + /* Ensure that only 32-bit pointers are passed in 32-bit descriptors. Note + that we cannot build a template call to the CE routine as it would get a + wrong source location; instead we use a second placeholder for it. */ + tem = build_unary_op (ADDR_EXPR, pointer64_type, + build0 (PLACEHOLDER_EXPR, type)); + tem = build3 (COND_EXPR, pointer32_type, + build_binary_op (GE_EXPR, boolean_type_node, tem, + build_int_cstu (pointer64_type, 0x80000000)), + build0 (PLACEHOLDER_EXPR, void_type_node), + convert (pointer32_type, tem)); field_list ! = make_descriptor_field ("POINTER", pointer32_type, record_type, tem, ! field_list); switch (mech) { *************** build_vms_descriptor32 (tree type, Mecha *** 2697,2754 **** case By_Descriptor_SB: case By_Short_Descriptor_SB: field_list ! = chainon (field_list, ! make_descriptor_field ! ("SB_L1", gnat_type_for_size (32, 1), record_type, ! TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MIN_VALUE (TYPE_DOMAIN (type)) : size_zero_node)); field_list ! = chainon (field_list, ! make_descriptor_field ! ("SB_U1", gnat_type_for_size (32, 1), record_type, ! TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MAX_VALUE (TYPE_DOMAIN (type)) : size_zero_node)); break; case By_Descriptor_A: case By_Short_Descriptor_A: case By_Descriptor_NCA: case By_Short_Descriptor_NCA: ! field_list = chainon (field_list, ! make_descriptor_field ("SCALE", ! gnat_type_for_size (8, 1), ! record_type, ! size_zero_node)); ! field_list = chainon (field_list, ! make_descriptor_field ("DIGITS", ! gnat_type_for_size (8, 1), ! record_type, ! size_zero_node)); field_list ! = chainon (field_list, ! make_descriptor_field ! ("AFLAGS", gnat_type_for_size (8, 1), record_type, ! size_int ((mech == By_Descriptor_NCA || ! mech == By_Short_Descriptor_NCA) ! ? 0 ! /* Set FL_COLUMN, FL_COEFF, and FL_BOUNDS. */ ! : (TREE_CODE (type) == ARRAY_TYPE ! && TYPE_CONVENTION_FORTRAN_P (type) ! ? 224 : 192)))); ! field_list = chainon (field_list, ! make_descriptor_field ("DIMCT", ! gnat_type_for_size (8, 1), ! record_type, ! size_int (ndim))); ! field_list = chainon (field_list, ! make_descriptor_field ("ARSIZE", ! gnat_type_for_size (32, 1), ! record_type, ! size_in_bytes (type))); /* Now build a pointer to the 0,0,0... element. */ tem = build0 (PLACEHOLDER_EXPR, type); --- 2479,2533 ---- case By_Descriptor_SB: case By_Short_Descriptor_SB: field_list ! = make_descriptor_field ("SB_L1", gnat_type_for_size (32, 1), ! record_type, ! (TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MIN_VALUE (TYPE_DOMAIN (type)) ! : size_zero_node), ! field_list); field_list ! = make_descriptor_field ("SB_U1", gnat_type_for_size (32, 1), ! record_type, ! (TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MAX_VALUE (TYPE_DOMAIN (type)) ! : size_zero_node), ! field_list); break; case By_Descriptor_A: case By_Short_Descriptor_A: case By_Descriptor_NCA: case By_Short_Descriptor_NCA: ! field_list ! = make_descriptor_field ("SCALE", gnat_type_for_size (8, 1), ! record_type, size_zero_node, field_list); ! field_list ! = make_descriptor_field ("DIGITS", gnat_type_for_size (8, 1), ! record_type, size_zero_node, field_list); field_list ! = make_descriptor_field ("AFLAGS", gnat_type_for_size (8, 1), ! record_type, ! size_int ((mech == By_Descriptor_NCA ! || mech == By_Short_Descriptor_NCA) ! ? 0 ! /* Set FL_COLUMN, FL_COEFF, and ! FL_BOUNDS. */ ! : (TREE_CODE (type) == ARRAY_TYPE ! && TYPE_CONVENTION_FORTRAN_P ! (type) ! ? 224 : 192)), ! field_list); ! field_list ! = make_descriptor_field ("DIMCT", gnat_type_for_size (8, 1), ! record_type, size_int (ndim), field_list); ! field_list ! = make_descriptor_field ("ARSIZE", gnat_type_for_size (32, 1), ! record_type, size_in_bytes (type), ! field_list); /* Now build a pointer to the 0,0,0... element. */ tem = build0 (PLACEHOLDER_EXPR, type); *************** build_vms_descriptor32 (tree type, Mecha *** 2759,2773 **** NULL_TREE, NULL_TREE); field_list ! = chainon (field_list, ! make_descriptor_field ! ("A0", ! build_pointer_type_for_mode (inner_type, SImode, false), ! record_type, ! build1 (ADDR_EXPR, ! build_pointer_type_for_mode (inner_type, SImode, ! false), ! tem))); /* Next come the addressing coefficients. */ tem = size_one_node; --- 2538,2546 ---- NULL_TREE, NULL_TREE); field_list ! = make_descriptor_field ("A0", pointer32_type, record_type, ! build1 (ADDR_EXPR, pointer32_type, tem), ! field_list); /* Next come the addressing coefficients. */ tem = size_one_node; *************** build_vms_descriptor32 (tree type, Mecha *** 2786,2795 **** mech == By_Short_Descriptor_NCA) ? 'S' : 'M'); fname[1] = '0' + i, fname[2] = 0; field_list ! = chainon (field_list, ! make_descriptor_field (fname, ! gnat_type_for_size (32, 1), ! record_type, idx_length)); if (mech == By_Descriptor_NCA || mech == By_Short_Descriptor_NCA) tem = idx_length; --- 2559,2566 ---- mech == By_Short_Descriptor_NCA) ? 'S' : 'M'); fname[1] = '0' + i, fname[2] = 0; field_list ! = make_descriptor_field (fname, gnat_type_for_size (32, 1), ! record_type, idx_length, field_list); if (mech == By_Descriptor_NCA || mech == By_Short_Descriptor_NCA) tem = idx_length; *************** build_vms_descriptor32 (tree type, Mecha *** 2802,2818 **** fname[0] = 'L', fname[1] = '0' + i, fname[2] = 0; field_list ! = chainon (field_list, ! make_descriptor_field ! (fname, gnat_type_for_size (32, 1), record_type, ! TYPE_MIN_VALUE (idx_arr[i]))); fname[0] = 'U'; field_list ! = chainon (field_list, ! make_descriptor_field ! (fname, gnat_type_for_size (32, 1), record_type, ! TYPE_MAX_VALUE (idx_arr[i]))); } break; --- 2573,2587 ---- fname[0] = 'L', fname[1] = '0' + i, fname[2] = 0; field_list ! = make_descriptor_field (fname, gnat_type_for_size (32, 1), ! record_type, TYPE_MIN_VALUE (idx_arr[i]), ! field_list); fname[0] = 'U'; field_list ! = make_descriptor_field (fname, gnat_type_for_size (32, 1), ! record_type, TYPE_MAX_VALUE (idx_arr[i]), ! field_list); } break; *************** build_vms_descriptor32 (tree type, Mecha *** 2821,2850 **** } TYPE_NAME (record_type) = create_concat_name (gnat_entity, "DESC"); ! finish_record_type (record_type, field_list, 0, false); return record_type; } ! /* Build a 64bit VMS descriptor from a Mechanism_Type, which must specify ! a descriptor type, and the GCC type of an object. Each FIELD_DECL ! in the type contains in its DECL_INITIAL the expression to use when ! a constructor is made for the type. GNAT_ENTITY is an entity used ! to print out an error message if the mechanism cannot be applied to ! an object of that type and also for the name. */ tree build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity) { ! tree record64_type = make_node (RECORD_TYPE); tree pointer64_type; ! tree field_list64 = 0; ! int klass; ! int dtype = 0; ! tree inner_type; ! int ndim; ! int i; tree *idx_arr; - tree tem; /* If TYPE is an unconstrained array, use the underlying array type. */ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) --- 2590,2615 ---- } TYPE_NAME (record_type) = create_concat_name (gnat_entity, "DESC"); ! finish_record_type (record_type, nreverse (field_list), 0, false); return record_type; } ! /* Build a 64-bit VMS descriptor from a Mechanism_Type, which must specify a ! descriptor type, and the GCC type of an object. Each FIELD_DECL in the ! type contains in its DECL_INITIAL the expression to use when a constructor ! is made for the type. GNAT_ENTITY is an entity used to print out an error ! message if the mechanism cannot be applied to an object of that type and ! also for the name. */ tree build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity) { ! tree record_type = make_node (RECORD_TYPE); tree pointer64_type; ! tree field_list = NULL_TREE; ! int klass, ndim, i, dtype = 0; ! tree inner_type, tem; tree *idx_arr; /* If TYPE is an unconstrained array, use the underlying array type. */ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) *************** build_vms_descriptor (tree type, Mechani *** 2861,2867 **** ndim++, inner_type = TREE_TYPE (inner_type)) ; ! idx_arr = (tree *) alloca (ndim * sizeof (tree)); if (mech != By_Descriptor_NCA && TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type)) --- 2626,2632 ---- ndim++, inner_type = TREE_TYPE (inner_type)) ; ! idx_arr = XALLOCAVEC (tree, ndim); if (mech != By_Descriptor_NCA && TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type)) *************** build_vms_descriptor (tree type, Mechani *** 2964,3006 **** break; } ! /* Make the type for a 64bit descriptor for VMS. The first six fields are the same for all types. */ ! ! field_list64 = chainon (field_list64, ! make_descriptor_field ("MBO", ! gnat_type_for_size (16, 1), ! record64_type, size_int (1))); ! ! field_list64 = chainon (field_list64, ! make_descriptor_field ("DTYPE", ! gnat_type_for_size (8, 1), ! record64_type, size_int (dtype))); ! field_list64 = chainon (field_list64, ! make_descriptor_field ("CLASS", ! gnat_type_for_size (8, 1), ! record64_type, size_int (klass))); ! ! field_list64 = chainon (field_list64, ! make_descriptor_field ("MBMO", ! gnat_type_for_size (32, 1), ! record64_type, ssize_int (-1))); ! ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! ("LENGTH", gnat_type_for_size (64, 1), record64_type, ! size_in_bytes (mech == By_Descriptor_A ? inner_type : type))); pointer64_type = build_pointer_type_for_mode (type, DImode, false); ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! ("POINTER", pointer64_type, record64_type, ! build_unary_op (ADDR_EXPR, ! pointer64_type, ! build0 (PLACEHOLDER_EXPR, type)))); switch (mech) { --- 2729,2762 ---- break; } ! /* Make the type for a 64-bit descriptor for VMS. The first six fields are the same for all types. */ ! field_list ! = make_descriptor_field ("MBO", gnat_type_for_size (16, 1), ! record_type, size_int (1), field_list); ! field_list ! = make_descriptor_field ("DTYPE", gnat_type_for_size (8, 1), ! record_type, size_int (dtype), field_list); ! field_list ! = make_descriptor_field ("CLASS", gnat_type_for_size (8, 1), ! record_type, size_int (klass), field_list); ! field_list ! = make_descriptor_field ("MBMO", gnat_type_for_size (32, 1), ! record_type, ssize_int (-1), field_list); ! field_list ! = make_descriptor_field ("LENGTH", gnat_type_for_size (64, 1), ! record_type, ! size_in_bytes (mech == By_Descriptor_A ! ? inner_type : type), ! field_list); pointer64_type = build_pointer_type_for_mode (type, DImode, false); ! field_list ! = make_descriptor_field ("POINTER", pointer64_type, record_type, ! build_unary_op (ADDR_EXPR, pointer64_type, ! build0 (PLACEHOLDER_EXPR, type)), ! field_list); switch (mech) { *************** build_vms_descriptor (tree type, Mechani *** 3009,3069 **** break; case By_Descriptor_SB: ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! ("SB_L1", gnat_type_for_size (64, 1), record64_type, ! TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MIN_VALUE (TYPE_DOMAIN (type)) : size_zero_node)); ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! ("SB_U1", gnat_type_for_size (64, 1), record64_type, ! TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MAX_VALUE (TYPE_DOMAIN (type)) : size_zero_node)); break; case By_Descriptor_A: case By_Descriptor_NCA: ! field_list64 = chainon (field_list64, ! make_descriptor_field ("SCALE", ! gnat_type_for_size (8, 1), ! record64_type, ! size_zero_node)); ! field_list64 = chainon (field_list64, ! make_descriptor_field ("DIGITS", ! gnat_type_for_size (8, 1), ! record64_type, ! size_zero_node)); ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! ("AFLAGS", gnat_type_for_size (8, 1), record64_type, ! size_int (mech == By_Descriptor_NCA ! ? 0 ! /* Set FL_COLUMN, FL_COEFF, and FL_BOUNDS. */ ! : (TREE_CODE (type) == ARRAY_TYPE ! && TYPE_CONVENTION_FORTRAN_P (type) ! ? 224 : 192)))); ! field_list64 = chainon (field_list64, ! make_descriptor_field ("DIMCT", ! gnat_type_for_size (8, 1), ! record64_type, ! size_int (ndim))); ! field_list64 = chainon (field_list64, ! make_descriptor_field ("MBZ", ! gnat_type_for_size (32, 1), ! record64_type, ! size_int (0))); ! field_list64 = chainon (field_list64, ! make_descriptor_field ("ARSIZE", ! gnat_type_for_size (64, 1), ! record64_type, ! size_in_bytes (type))); /* Now build a pointer to the 0,0,0... element. */ tem = build0 (PLACEHOLDER_EXPR, type); --- 2765,2819 ---- break; case By_Descriptor_SB: ! field_list ! = make_descriptor_field ("SB_L1", gnat_type_for_size (64, 1), ! record_type, ! (TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MIN_VALUE (TYPE_DOMAIN (type)) ! : size_zero_node), ! field_list); ! field_list ! = make_descriptor_field ("SB_U1", gnat_type_for_size (64, 1), ! record_type, ! (TREE_CODE (type) == ARRAY_TYPE ! ? TYPE_MAX_VALUE (TYPE_DOMAIN (type)) ! : size_zero_node), ! field_list); break; case By_Descriptor_A: case By_Descriptor_NCA: ! field_list ! = make_descriptor_field ("SCALE", gnat_type_for_size (8, 1), ! record_type, size_zero_node, field_list); ! field_list ! = make_descriptor_field ("DIGITS", gnat_type_for_size (8, 1), ! record_type, size_zero_node, field_list); ! dtype = (mech == By_Descriptor_NCA ! ? 0 ! /* Set FL_COLUMN, FL_COEFF, and ! FL_BOUNDS. */ ! : (TREE_CODE (type) == ARRAY_TYPE ! && TYPE_CONVENTION_FORTRAN_P (type) ! ? 224 : 192)); ! field_list ! = make_descriptor_field ("AFLAGS", gnat_type_for_size (8, 1), ! record_type, size_int (dtype), ! field_list); ! field_list ! = make_descriptor_field ("DIMCT", gnat_type_for_size (8, 1), ! record_type, size_int (ndim), field_list); ! field_list ! = make_descriptor_field ("MBZ", gnat_type_for_size (32, 1), ! record_type, size_int (0), field_list); ! field_list ! = make_descriptor_field ("ARSIZE", gnat_type_for_size (64, 1), ! record_type, size_in_bytes (type), ! field_list); /* Now build a pointer to the 0,0,0... element. */ tem = build0 (PLACEHOLDER_EXPR, type); *************** build_vms_descriptor (tree type, Mechani *** 3073,3088 **** convert (TYPE_DOMAIN (inner_type), size_zero_node), NULL_TREE, NULL_TREE); ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! ("A0", ! build_pointer_type_for_mode (inner_type, DImode, false), ! record64_type, ! build1 (ADDR_EXPR, ! build_pointer_type_for_mode (inner_type, DImode, ! false), ! tem))); /* Next come the addressing coefficients. */ tem = size_one_node; --- 2823,2832 ---- convert (TYPE_DOMAIN (inner_type), size_zero_node), NULL_TREE, NULL_TREE); ! field_list ! = make_descriptor_field ("A0", pointer64_type, record_type, ! build1 (ADDR_EXPR, pointer64_type, tem), ! field_list); /* Next come the addressing coefficients. */ tem = size_one_node; *************** build_vms_descriptor (tree type, Mechani *** 3099,3109 **** fname[0] = (mech == By_Descriptor_NCA ? 'S' : 'M'); fname[1] = '0' + i, fname[2] = 0; ! field_list64 ! = chainon (field_list64, ! make_descriptor_field (fname, ! gnat_type_for_size (64, 1), ! record64_type, idx_length)); if (mech == By_Descriptor_NCA) tem = idx_length; --- 2843,2851 ---- fname[0] = (mech == By_Descriptor_NCA ? 'S' : 'M'); fname[1] = '0' + i, fname[2] = 0; ! field_list ! = make_descriptor_field (fname, gnat_type_for_size (64, 1), ! record_type, idx_length, field_list); if (mech == By_Descriptor_NCA) tem = idx_length; *************** build_vms_descriptor (tree type, Mechani *** 3115,3132 **** char fname[3]; fname[0] = 'L', fname[1] = '0' + i, fname[2] = 0; ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! (fname, gnat_type_for_size (64, 1), record64_type, ! TYPE_MIN_VALUE (idx_arr[i]))); fname[0] = 'U'; ! field_list64 ! = chainon (field_list64, ! make_descriptor_field ! (fname, gnat_type_for_size (64, 1), record64_type, ! TYPE_MAX_VALUE (idx_arr[i]))); } break; --- 2857,2872 ---- char fname[3]; fname[0] = 'L', fname[1] = '0' + i, fname[2] = 0; ! field_list ! = make_descriptor_field (fname, gnat_type_for_size (64, 1), ! record_type, ! TYPE_MIN_VALUE (idx_arr[i]), field_list); fname[0] = 'U'; ! field_list ! = make_descriptor_field (fname, gnat_type_for_size (64, 1), ! record_type, ! TYPE_MAX_VALUE (idx_arr[i]), field_list); } break; *************** build_vms_descriptor (tree type, Mechani *** 3134,3155 **** post_error ("unsupported descriptor type for &", gnat_entity); } ! TYPE_NAME (record64_type) = create_concat_name (gnat_entity, "DESC64"); ! finish_record_type (record64_type, field_list64, 0, false); ! return record64_type; } ! /* Utility routine for above code to make a field. */ ! static tree ! make_descriptor_field (const char *name, tree type, ! tree rec_type, tree initial) { ! tree field ! = create_field_decl (get_identifier (name), type, rec_type, 0, 0, 0, 0); ! DECL_INITIAL (field) = initial; ! return field; } /* Convert GNU_EXPR, a pointer to a 64bit VMS descriptor, to GNU_TYPE, a --- 2874,2914 ---- post_error ("unsupported descriptor type for &", gnat_entity); } ! TYPE_NAME (record_type) = create_concat_name (gnat_entity, "DESC64"); ! finish_record_type (record_type, nreverse (field_list), 0, false); ! return record_type; } ! /* Fill in a VMS descriptor of GNU_TYPE for GNU_EXPR and return the result. ! GNAT_ACTUAL is the actual parameter for which the descriptor is built. */ ! tree ! fill_vms_descriptor (tree gnu_type, tree gnu_expr, Node_Id gnat_actual) { ! VEC(constructor_elt,gc) *v = NULL; ! tree field; ! gnu_expr = maybe_unconstrained_array (gnu_expr); ! gnu_expr = gnat_protect_expr (gnu_expr); ! gnat_mark_addressable (gnu_expr); ! ! /* We may need to substitute both GNU_EXPR and a CALL_EXPR to the raise CE ! routine in case we have a 32-bit descriptor. */ ! gnu_expr = build2 (COMPOUND_EXPR, void_type_node, ! build_call_raise (CE_Range_Check_Failed, gnat_actual, ! N_Raise_Constraint_Error), ! gnu_expr); ! ! for (field = TYPE_FIELDS (gnu_type); field; field = DECL_CHAIN (field)) ! { ! tree value ! = convert (TREE_TYPE (field), ! SUBSTITUTE_PLACEHOLDER_IN_EXPR (DECL_INITIAL (field), ! gnu_expr)); ! CONSTRUCTOR_APPEND_ELT (v, field, value); ! } ! ! return gnat_build_constructor (gnu_type, v); } /* Convert GNU_EXPR, a pointer to a 64bit VMS descriptor, to GNU_TYPE, a *************** convert_vms_descriptor64 (tree gnu_type, *** 3162,3174 **** tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); /* The CLASS field is the 3rd field in the descriptor. */ ! tree klass = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (desc_type))); /* The POINTER field is the 6th field in the descriptor. */ ! tree pointer64 = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (klass))); /* Retrieve the value of the POINTER field. */ tree gnu_expr64 ! = build3 (COMPONENT_REF, TREE_TYPE (pointer64), desc, pointer64, NULL_TREE); if (POINTER_TYPE_P (gnu_type)) return convert (gnu_type, gnu_expr64); --- 2921,2933 ---- tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); /* The CLASS field is the 3rd field in the descriptor. */ ! tree klass = DECL_CHAIN (DECL_CHAIN (TYPE_FIELDS (desc_type))); /* The POINTER field is the 6th field in the descriptor. */ ! tree pointer = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (klass))); /* Retrieve the value of the POINTER field. */ tree gnu_expr64 ! = build3 (COMPONENT_REF, TREE_TYPE (pointer), desc, pointer, NULL_TREE); if (POINTER_TYPE_P (gnu_type)) return convert (gnu_type, gnu_expr64); *************** convert_vms_descriptor64 (tree gnu_type, *** 3184,3191 **** /* See the head comment of build_vms_descriptor. */ int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass)); tree lfield, ufield; ! /* Convert POINTER to the type of the P_ARRAY field. */ gnu_expr64 = convert (p_array_type, gnu_expr64); switch (iklass) --- 2943,2951 ---- /* See the head comment of build_vms_descriptor. */ int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass)); tree lfield, ufield; + VEC(constructor_elt,gc) *v; ! /* Convert POINTER to the pointer-to-array type. */ gnu_expr64 = convert (p_array_type, gnu_expr64); switch (iklass) *************** convert_vms_descriptor64 (tree gnu_type, *** 3193,3206 **** case 1: /* Class S */ case 15: /* Class SB */ /* Build {1, LENGTH} template; LENGTH64 is the 5th field. */ ! t = TREE_CHAIN (TREE_CHAIN (klass)); t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ! t = tree_cons (min_field, ! convert (TREE_TYPE (min_field), integer_one_node), ! tree_cons (max_field, ! convert (TREE_TYPE (max_field), t), ! NULL_TREE)); ! template_tree = gnat_build_constructor (template_type, t); template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template_tree); /* For class S, we are done. */ --- 2953,2967 ---- case 1: /* Class S */ case 15: /* Class SB */ /* Build {1, LENGTH} template; LENGTH64 is the 5th field. */ ! v = VEC_alloc (constructor_elt, gc, 2); ! t = DECL_CHAIN (DECL_CHAIN (klass)); t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ! CONSTRUCTOR_APPEND_ELT (v, min_field, ! convert (TREE_TYPE (min_field), ! integer_one_node)); ! CONSTRUCTOR_APPEND_ELT (v, max_field, ! convert (TREE_TYPE (max_field), t)); ! template_tree = gnat_build_constructor (template_type, v); template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template_tree); /* For class S, we are done. */ *************** convert_vms_descriptor64 (tree gnu_type, *** 3210,3233 **** /* Test that we really have a SB descriptor, like DEC Ada. */ t = build3 (COMPONENT_REF, TREE_TYPE (klass), desc, klass, NULL); u = convert (TREE_TYPE (klass), DECL_INITIAL (klass)); ! u = build_binary_op (EQ_EXPR, integer_type_node, t, u); /* If so, there is already a template in the descriptor and it is located right after the POINTER field. The fields are 64bits so they must be repacked. */ ! t = TREE_CHAIN (pointer64); lfield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); lfield = convert (TREE_TYPE (TYPE_FIELDS (template_type)), lfield); t = TREE_CHAIN (t); ufield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ufield = convert ! (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (template_type))), ufield); /* Build the template in the form of a constructor. */ ! t = tree_cons (TYPE_FIELDS (template_type), lfield, ! tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)), ! ufield, NULL_TREE)); ! template_tree = gnat_build_constructor (template_type, t); /* Otherwise use the {1, LENGTH} template we build above. */ template_addr = build3 (COND_EXPR, p_bounds_type, u, --- 2971,2995 ---- /* Test that we really have a SB descriptor, like DEC Ada. */ t = build3 (COMPONENT_REF, TREE_TYPE (klass), desc, klass, NULL); u = convert (TREE_TYPE (klass), DECL_INITIAL (klass)); ! u = build_binary_op (EQ_EXPR, boolean_type_node, t, u); /* If so, there is already a template in the descriptor and it is located right after the POINTER field. The fields are 64bits so they must be repacked. */ ! t = TREE_CHAIN (pointer); lfield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); lfield = convert (TREE_TYPE (TYPE_FIELDS (template_type)), lfield); t = TREE_CHAIN (t); ufield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ufield = convert ! (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (template_type))), ufield); /* Build the template in the form of a constructor. */ ! v = VEC_alloc (constructor_elt, gc, 2); ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (template_type), lfield); ! CONSTRUCTOR_APPEND_ELT (v, TREE_CHAIN (TYPE_FIELDS (template_type)), ! ufield); ! template_tree = gnat_build_constructor (template_type, v); /* Otherwise use the {1, LENGTH} template we build above. */ template_addr = build3 (COND_EXPR, p_bounds_type, u, *************** convert_vms_descriptor64 (tree gnu_type, *** 3239,3245 **** case 4: /* Class A */ /* The AFLAGS field is the 3rd field after the pointer in the descriptor. */ ! t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (pointer64))); aflags = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); /* The DIMCT field is the next field in the descriptor after aflags. */ --- 3001,3007 ---- case 4: /* Class A */ /* The AFLAGS field is the 3rd field after the pointer in the descriptor. */ ! t = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (pointer))); aflags = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); /* The DIMCT field is the next field in the descriptor after aflags. */ *************** convert_vms_descriptor64 (tree gnu_type, *** 3248,3266 **** /* Raise CONSTRAINT_ERROR if either more than 1 dimension or FL_COEFF or FL_BOUNDS not set. */ u = build_int_cst (TREE_TYPE (aflags), 192); ! u = build_binary_op (TRUTH_OR_EXPR, integer_type_node, ! build_binary_op (NE_EXPR, integer_type_node, dimct, convert (TREE_TYPE (dimct), size_one_node)), ! build_binary_op (NE_EXPR, integer_type_node, build2 (BIT_AND_EXPR, TREE_TYPE (aflags), aflags, u), u)); /* There is already a template in the descriptor and it is located in block 3. The fields are 64bits so they must be repacked. */ ! t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t))))); lfield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); lfield = convert (TREE_TYPE (TYPE_FIELDS (template_type)), lfield); --- 3010,3028 ---- /* Raise CONSTRAINT_ERROR if either more than 1 dimension or FL_COEFF or FL_BOUNDS not set. */ u = build_int_cst (TREE_TYPE (aflags), 192); ! u = build_binary_op (TRUTH_OR_EXPR, boolean_type_node, ! build_binary_op (NE_EXPR, boolean_type_node, dimct, convert (TREE_TYPE (dimct), size_one_node)), ! build_binary_op (NE_EXPR, boolean_type_node, build2 (BIT_AND_EXPR, TREE_TYPE (aflags), aflags, u), u)); /* There is already a template in the descriptor and it is located in block 3. The fields are 64bits so they must be repacked. */ ! t = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (t))))); lfield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); lfield = convert (TREE_TYPE (TYPE_FIELDS (template_type)), lfield); *************** convert_vms_descriptor64 (tree gnu_type, *** 3268,3280 **** t = TREE_CHAIN (t); ufield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ufield = convert ! (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (template_type))), ufield); /* Build the template in the form of a constructor. */ ! t = tree_cons (TYPE_FIELDS (template_type), lfield, ! tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)), ! ufield, NULL_TREE)); ! template_tree = gnat_build_constructor (template_type, t); template_tree = build3 (COND_EXPR, template_type, u, build_call_raise (CE_Length_Check_Failed, Empty, N_Raise_Constraint_Error), --- 3030,3043 ---- t = TREE_CHAIN (t); ufield = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ufield = convert ! (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (template_type))), ufield); /* Build the template in the form of a constructor. */ ! v = VEC_alloc (constructor_elt, gc, 2); ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (template_type), lfield); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (template_type)), ! ufield); ! template_tree = gnat_build_constructor (template_type, v); template_tree = build3 (COND_EXPR, template_type, u, build_call_raise (CE_Length_Check_Failed, Empty, N_Raise_Constraint_Error), *************** convert_vms_descriptor64 (tree gnu_type, *** 3291,3300 **** } /* Build the fat pointer in the form of a constructor. */ ! t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr64, ! tree_cons (TREE_CHAIN (TYPE_FIELDS (gnu_type)), ! template_addr, NULL_TREE)); ! return gnat_build_constructor (gnu_type, t); } else --- 3054,3064 ---- } /* Build the fat pointer in the form of a constructor. */ ! v = VEC_alloc (constructor_elt, gc, 2); ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (gnu_type), gnu_expr64); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (gnu_type)), ! template_addr); ! return gnat_build_constructor (gnu_type, v); } else *************** convert_vms_descriptor32 (tree gnu_type, *** 3311,3319 **** tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); /* The CLASS field is the 3rd field in the descriptor. */ ! tree klass = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (desc_type))); /* The POINTER field is the 4th field in the descriptor. */ ! tree pointer = TREE_CHAIN (klass); /* Retrieve the value of the POINTER field. */ tree gnu_expr32 --- 3075,3083 ---- tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); /* The CLASS field is the 3rd field in the descriptor. */ ! tree klass = DECL_CHAIN (DECL_CHAIN (TYPE_FIELDS (desc_type))); /* The POINTER field is the 4th field in the descriptor. */ ! tree pointer = DECL_CHAIN (klass); /* Retrieve the value of the POINTER field. */ tree gnu_expr32 *************** convert_vms_descriptor32 (tree gnu_type, *** 3332,3339 **** tree template_tree, template_addr, aflags, dimct, t, u; /* See the head comment of build_vms_descriptor. */ int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass)); ! /* Convert POINTER to the type of the P_ARRAY field. */ gnu_expr32 = convert (p_array_type, gnu_expr32); switch (iklass) --- 3096,3104 ---- tree template_tree, template_addr, aflags, dimct, t, u; /* See the head comment of build_vms_descriptor. */ int iklass = TREE_INT_CST_LOW (DECL_INITIAL (klass)); + VEC(constructor_elt,gc) *v; ! /* Convert POINTER to the pointer-to-array type. */ gnu_expr32 = convert (p_array_type, gnu_expr32); switch (iklass) *************** convert_vms_descriptor32 (tree gnu_type, *** 3341,3354 **** case 1: /* Class S */ case 15: /* Class SB */ /* Build {1, LENGTH} template; LENGTH is the 1st field. */ t = TYPE_FIELDS (desc_type); t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ! t = tree_cons (min_field, ! convert (TREE_TYPE (min_field), integer_one_node), ! tree_cons (max_field, ! convert (TREE_TYPE (max_field), t), ! NULL_TREE)); ! template_tree = gnat_build_constructor (template_type, t); template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template_tree); /* For class S, we are done. */ --- 3106,3120 ---- case 1: /* Class S */ case 15: /* Class SB */ /* Build {1, LENGTH} template; LENGTH is the 1st field. */ + v = VEC_alloc (constructor_elt, gc, 2); t = TYPE_FIELDS (desc_type); t = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); ! CONSTRUCTOR_APPEND_ELT (v, min_field, ! convert (TREE_TYPE (min_field), ! integer_one_node)); ! CONSTRUCTOR_APPEND_ELT (v, max_field, ! convert (TREE_TYPE (max_field), t)); ! template_tree = gnat_build_constructor (template_type, v); template_addr = build_unary_op (ADDR_EXPR, NULL_TREE, template_tree); /* For class S, we are done. */ *************** convert_vms_descriptor32 (tree gnu_type, *** 3358,3364 **** /* Test that we really have a SB descriptor, like DEC Ada. */ t = build3 (COMPONENT_REF, TREE_TYPE (klass), desc, klass, NULL); u = convert (TREE_TYPE (klass), DECL_INITIAL (klass)); ! u = build_binary_op (EQ_EXPR, integer_type_node, t, u); /* If so, there is already a template in the descriptor and it is located right after the POINTER field. */ t = TREE_CHAIN (pointer); --- 3124,3130 ---- /* Test that we really have a SB descriptor, like DEC Ada. */ t = build3 (COMPONENT_REF, TREE_TYPE (klass), desc, klass, NULL); u = convert (TREE_TYPE (klass), DECL_INITIAL (klass)); ! u = build_binary_op (EQ_EXPR, boolean_type_node, t, u); /* If so, there is already a template in the descriptor and it is located right after the POINTER field. */ t = TREE_CHAIN (pointer); *************** convert_vms_descriptor32 (tree gnu_type, *** 3373,3379 **** case 4: /* Class A */ /* The AFLAGS field is the 7th field in the descriptor. */ ! t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (pointer))); aflags = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); /* The DIMCT field is the 8th field in the descriptor. */ t = TREE_CHAIN (t); --- 3139,3145 ---- case 4: /* Class A */ /* The AFLAGS field is the 7th field in the descriptor. */ ! t = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (pointer))); aflags = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); /* The DIMCT field is the 8th field in the descriptor. */ t = TREE_CHAIN (t); *************** convert_vms_descriptor32 (tree gnu_type, *** 3381,3399 **** /* Raise CONSTRAINT_ERROR if either more than 1 dimension or FL_COEFF or FL_BOUNDS not set. */ u = build_int_cst (TREE_TYPE (aflags), 192); ! u = build_binary_op (TRUTH_OR_EXPR, integer_type_node, ! build_binary_op (NE_EXPR, integer_type_node, dimct, convert (TREE_TYPE (dimct), size_one_node)), ! build_binary_op (NE_EXPR, integer_type_node, build2 (BIT_AND_EXPR, TREE_TYPE (aflags), aflags, u), u)); /* There is already a template in the descriptor and it is located at the start of block 3 (12th field). */ ! t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t)))); template_tree = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); template_tree = build3 (COND_EXPR, TREE_TYPE (t), u, --- 3147,3165 ---- /* Raise CONSTRAINT_ERROR if either more than 1 dimension or FL_COEFF or FL_BOUNDS not set. */ u = build_int_cst (TREE_TYPE (aflags), 192); ! u = build_binary_op (TRUTH_OR_EXPR, boolean_type_node, ! build_binary_op (NE_EXPR, boolean_type_node, dimct, convert (TREE_TYPE (dimct), size_one_node)), ! build_binary_op (NE_EXPR, boolean_type_node, build2 (BIT_AND_EXPR, TREE_TYPE (aflags), aflags, u), u)); /* There is already a template in the descriptor and it is located at the start of block 3 (12th field). */ ! t = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (t)))); template_tree = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); template_tree = build3 (COND_EXPR, TREE_TYPE (t), u, *************** convert_vms_descriptor32 (tree gnu_type, *** 3412,3422 **** } /* Build the fat pointer in the form of a constructor. */ ! t = tree_cons (TYPE_FIELDS (gnu_type), gnu_expr32, ! tree_cons (TREE_CHAIN (TYPE_FIELDS (gnu_type)), ! template_addr, NULL_TREE)); ! return gnat_build_constructor (gnu_type, t); } else --- 3178,3189 ---- } /* Build the fat pointer in the form of a constructor. */ ! v = VEC_alloc (constructor_elt, gc, 2); ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (gnu_type), gnu_expr32); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (gnu_type)), ! template_addr); ! return gnat_build_constructor (gnu_type, v); } else *************** convert_vms_descriptor32 (tree gnu_type, *** 3425,3465 **** /* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit) ! pointer type of GNU_EXPR. GNAT_SUBPROG is the subprogram to which the ! VMS descriptor is passed. */ static tree convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type, ! Entity_Id gnat_subprog) { tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); tree mbo = TYPE_FIELDS (desc_type); const char *mbostr = IDENTIFIER_POINTER (DECL_NAME (mbo)); ! tree mbmo = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (mbo))); ! tree is64bit, gnu_expr32, gnu_expr64; /* If the field name is not MBO, it must be 32-bit and no alternate. Otherwise primary must be 64-bit and alternate 32-bit. */ if (strcmp (mbostr, "MBO") != 0) ! return convert_vms_descriptor32 (gnu_type, gnu_expr, gnat_subprog); /* Build the test for 64-bit descriptor. */ mbo = build3 (COMPONENT_REF, TREE_TYPE (mbo), desc, mbo, NULL_TREE); mbmo = build3 (COMPONENT_REF, TREE_TYPE (mbmo), desc, mbmo, NULL_TREE); is64bit ! = build_binary_op (TRUTH_ANDIF_EXPR, integer_type_node, ! build_binary_op (EQ_EXPR, integer_type_node, convert (integer_type_node, mbo), integer_one_node), ! build_binary_op (EQ_EXPR, integer_type_node, convert (integer_type_node, mbmo), integer_minus_one_node)); /* Build the 2 possible end results. */ ! gnu_expr64 = convert_vms_descriptor64 (gnu_type, gnu_expr, gnat_subprog); gnu_expr = fold_convert (gnu_expr_alt_type, gnu_expr); ! gnu_expr32 = convert_vms_descriptor32 (gnu_type, gnu_expr, gnat_subprog); return build3 (COND_EXPR, gnu_type, is64bit, gnu_expr64, gnu_expr32); } --- 3192,3247 ---- /* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit) ! pointer type of GNU_EXPR. BY_REF is true if the result is to be used by ! reference. GNAT_SUBPROG is the subprogram to which the VMS descriptor is ! passed. */ static tree convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type, ! bool by_ref, Entity_Id gnat_subprog) { tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); tree mbo = TYPE_FIELDS (desc_type); const char *mbostr = IDENTIFIER_POINTER (DECL_NAME (mbo)); ! tree mbmo = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (mbo))); ! tree real_type, is64bit, gnu_expr32, gnu_expr64; ! ! if (by_ref) ! real_type = TREE_TYPE (gnu_type); ! else ! real_type = gnu_type; /* If the field name is not MBO, it must be 32-bit and no alternate. Otherwise primary must be 64-bit and alternate 32-bit. */ if (strcmp (mbostr, "MBO") != 0) ! { ! tree ret = convert_vms_descriptor32 (real_type, gnu_expr, gnat_subprog); ! if (by_ref) ! ret = build_unary_op (ADDR_EXPR, gnu_type, ret); ! return ret; ! } /* Build the test for 64-bit descriptor. */ mbo = build3 (COMPONENT_REF, TREE_TYPE (mbo), desc, mbo, NULL_TREE); mbmo = build3 (COMPONENT_REF, TREE_TYPE (mbmo), desc, mbmo, NULL_TREE); is64bit ! = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, ! build_binary_op (EQ_EXPR, boolean_type_node, convert (integer_type_node, mbo), integer_one_node), ! build_binary_op (EQ_EXPR, boolean_type_node, convert (integer_type_node, mbmo), integer_minus_one_node)); /* Build the 2 possible end results. */ ! gnu_expr64 = convert_vms_descriptor64 (real_type, gnu_expr, gnat_subprog); ! if (by_ref) ! gnu_expr64 = build_unary_op (ADDR_EXPR, gnu_type, gnu_expr64); gnu_expr = fold_convert (gnu_expr_alt_type, gnu_expr); ! gnu_expr32 = convert_vms_descriptor32 (real_type, gnu_expr, gnat_subprog); ! if (by_ref) ! gnu_expr32 = build_unary_op (ADDR_EXPR, gnu_type, gnu_expr32); return build3 (COND_EXPR, gnu_type, is64bit, gnu_expr64, gnu_expr32); } *************** void *** 3471,3481 **** build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) { tree gnu_subprog_type, gnu_subprog_addr, gnu_subprog_call; ! tree gnu_stub_param, gnu_param_list, gnu_arg_types, gnu_param; tree gnu_stub_decl = DECL_FUNCTION_STUB (gnu_subprog); gnu_subprog_type = TREE_TYPE (gnu_subprog); - gnu_param_list = NULL_TREE; /* Initialize the information structure for the function. */ allocate_struct_function (gnu_stub_decl, false); --- 3253,3263 ---- build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) { tree gnu_subprog_type, gnu_subprog_addr, gnu_subprog_call; ! tree gnu_subprog_param, gnu_stub_param, gnu_param; tree gnu_stub_decl = DECL_FUNCTION_STUB (gnu_subprog); + VEC(tree,gc) *gnu_param_vec = NULL; gnu_subprog_type = TREE_TYPE (gnu_subprog); /* Initialize the information structure for the function. */ allocate_struct_function (gnu_stub_decl, false); *************** build_function_stub (tree gnu_subprog, E *** 3489,3517 **** /* Loop over the parameters of the stub and translate any of them passed by descriptor into a by reference one. */ for (gnu_stub_param = DECL_ARGUMENTS (gnu_stub_decl), ! gnu_arg_types = TYPE_ARG_TYPES (gnu_subprog_type); gnu_stub_param; gnu_stub_param = TREE_CHAIN (gnu_stub_param), ! gnu_arg_types = TREE_CHAIN (gnu_arg_types)) { if (DECL_BY_DESCRIPTOR_P (gnu_stub_param)) ! gnu_param ! = convert_vms_descriptor (TREE_VALUE (gnu_arg_types), ! gnu_stub_param, ! DECL_PARM_ALT_TYPE (gnu_stub_param), ! gnat_subprog); else gnu_param = gnu_stub_param; ! gnu_param_list = tree_cons (NULL_TREE, gnu_param, gnu_param_list); } /* Invoke the internal subprogram. */ gnu_subprog_addr = build1 (ADDR_EXPR, build_pointer_type (gnu_subprog_type), gnu_subprog); ! gnu_subprog_call = build_call_list (TREE_TYPE (gnu_subprog_type), ! gnu_subprog_addr, ! nreverse (gnu_param_list)); /* Propagate the return value, if any. */ if (VOID_TYPE_P (TREE_TYPE (gnu_subprog_type))) --- 3271,3302 ---- /* Loop over the parameters of the stub and translate any of them passed by descriptor into a by reference one. */ for (gnu_stub_param = DECL_ARGUMENTS (gnu_stub_decl), ! gnu_subprog_param = DECL_ARGUMENTS (gnu_subprog); gnu_stub_param; gnu_stub_param = TREE_CHAIN (gnu_stub_param), ! gnu_subprog_param = TREE_CHAIN (gnu_subprog_param)) { if (DECL_BY_DESCRIPTOR_P (gnu_stub_param)) ! { ! gcc_assert (DECL_BY_REF_P (gnu_subprog_param)); ! gnu_param ! = convert_vms_descriptor (TREE_TYPE (gnu_subprog_param), ! gnu_stub_param, ! DECL_PARM_ALT_TYPE (gnu_stub_param), ! DECL_BY_DOUBLE_REF_P (gnu_subprog_param), ! gnat_subprog); ! } else gnu_param = gnu_stub_param; ! VEC_safe_push (tree, gc, gnu_param_vec, gnu_param); } /* Invoke the internal subprogram. */ gnu_subprog_addr = build1 (ADDR_EXPR, build_pointer_type (gnu_subprog_type), gnu_subprog); ! gnu_subprog_call = build_call_vec (TREE_TYPE (gnu_subprog_type), ! gnu_subprog_addr, gnu_param_vec); /* Propagate the return value, if any. */ if (VOID_TYPE_P (TREE_TYPE (gnu_subprog_type))) *************** build_function_stub (tree gnu_subprog, E *** 3524,3551 **** end_subprog_body (end_stmt_group ()); } ! /* Build a type to be used to represent an aliased object whose nominal ! type is an unconstrained array. This consists of a RECORD_TYPE containing ! a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ! ARRAY_TYPE. If ARRAY_TYPE is that of the unconstrained array, this ! is used to represent an arbitrary unconstrained object. Use NAME ! as the name of the record. */ tree ! build_unc_object_type (tree template_type, tree object_type, tree name) { tree type = make_node (RECORD_TYPE); ! tree template_field = create_field_decl (get_identifier ("BOUNDS"), ! template_type, type, 0, 0, 0, 1); ! tree array_field = create_field_decl (get_identifier ("ARRAY"), object_type, ! type, 0, 0, 0, 1); TYPE_NAME (type) = name; TYPE_CONTAINS_TEMPLATE_P (type) = 1; ! finish_record_type (type, ! chainon (chainon (NULL_TREE, template_field), ! array_field), ! 0, true); return type; } --- 3309,3341 ---- end_subprog_body (end_stmt_group ()); } ! /* Build a type to be used to represent an aliased object whose nominal type ! is an unconstrained array. This consists of a RECORD_TYPE containing a ! field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE. ! If ARRAY_TYPE is that of an unconstrained array, this is used to represent ! an arbitrary unconstrained object. Use NAME as the name of the record. ! DEBUG_INFO_P is true if we need to write debug information for the type. */ tree ! build_unc_object_type (tree template_type, tree object_type, tree name, ! bool debug_info_p) { tree type = make_node (RECORD_TYPE); ! tree template_field ! = create_field_decl (get_identifier ("BOUNDS"), template_type, type, ! NULL_TREE, NULL_TREE, 0, 1); ! tree array_field ! = create_field_decl (get_identifier ("ARRAY"), object_type, type, ! NULL_TREE, NULL_TREE, 0, 1); TYPE_NAME (type) = name; TYPE_CONTAINS_TEMPLATE_P (type) = 1; ! DECL_CHAIN (template_field) = array_field; ! finish_record_type (type, template_field, 0, true); ! ! /* Declare it now since it will never be declared otherwise. This is ! necessary to ensure that its subtrees are properly marked. */ ! create_type_decl (name, type, NULL, true, debug_info_p, Empty); return type; } *************** build_unc_object_type (tree template_typ *** 3554,3560 **** tree build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type, ! tree name) { tree template_type; --- 3344,3350 ---- tree build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type, ! tree name, bool debug_info_p) { tree template_type; *************** build_unc_object_type_from_ptr (tree thi *** 3562,3570 **** template_type = (TYPE_IS_FAT_POINTER_P (thin_fat_ptr_type) ! ? TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (thin_fat_ptr_type)))) : TREE_TYPE (TYPE_FIELDS (TREE_TYPE (thin_fat_ptr_type)))); ! return build_unc_object_type (template_type, object_type, name); } /* Shift the component offsets within an unconstrained object TYPE to make it --- 3352,3362 ---- template_type = (TYPE_IS_FAT_POINTER_P (thin_fat_ptr_type) ! ? TREE_TYPE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (thin_fat_ptr_type)))) : TREE_TYPE (TYPE_FIELDS (TREE_TYPE (thin_fat_ptr_type)))); ! ! return ! build_unc_object_type (template_type, object_type, name, debug_info_p); } /* Shift the component offsets within an unconstrained object TYPE to make it *************** shift_unc_components_for_thin_pointers ( *** 3579,3585 **** that COMPONENT_REFs on (*thin_ptr) designate the proper location. */ tree bounds_field = TYPE_FIELDS (type); ! tree array_field = TREE_CHAIN (TYPE_FIELDS (type)); DECL_FIELD_OFFSET (bounds_field) = size_binop (MINUS_EXPR, size_zero_node, byte_position (array_field)); --- 3371,3377 ---- that COMPONENT_REFs on (*thin_ptr) designate the proper location. */ tree bounds_field = TYPE_FIELDS (type); ! tree array_field = DECL_CHAIN (TYPE_FIELDS (type)); DECL_FIELD_OFFSET (bounds_field) = size_binop (MINUS_EXPR, size_zero_node, byte_position (array_field)); *************** update_pointer_to (tree old_type, tree n *** 3597,3610 **** { tree ptr = TYPE_POINTER_TO (old_type); tree ref = TYPE_REFERENCE_TO (old_type); ! tree ptr1, ref1; ! tree type; /* If this is the main variant, process all the other variants first. */ if (TYPE_MAIN_VARIANT (old_type) == old_type) ! for (type = TYPE_NEXT_VARIANT (old_type); type; ! type = TYPE_NEXT_VARIANT (type)) ! update_pointer_to (type, new_type); /* If no pointers and no references, we are done. */ if (!ptr && !ref) --- 3389,3400 ---- { tree ptr = TYPE_POINTER_TO (old_type); tree ref = TYPE_REFERENCE_TO (old_type); ! tree t; /* If this is the main variant, process all the other variants first. */ if (TYPE_MAIN_VARIANT (old_type) == old_type) ! for (t = TYPE_NEXT_VARIANT (old_type); t; t = TYPE_NEXT_VARIANT (t)) ! update_pointer_to (t, new_type); /* If no pointers and no references, we are done. */ if (!ptr && !ref) *************** update_pointer_to (tree old_type, tree n *** 3640,3686 **** /* Otherwise, first handle the simple case. */ if (TREE_CODE (new_type) != UNCONSTRAINED_ARRAY_TYPE) { ! TYPE_POINTER_TO (new_type) = ptr; ! TYPE_REFERENCE_TO (new_type) = ref; for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr)) ! for (ptr1 = TYPE_MAIN_VARIANT (ptr); ptr1; ! ptr1 = TYPE_NEXT_VARIANT (ptr1)) ! TREE_TYPE (ptr1) = new_type; for (; ref; ref = TYPE_NEXT_REF_TO (ref)) ! for (ref1 = TYPE_MAIN_VARIANT (ref); ref1; ! ref1 = TYPE_NEXT_VARIANT (ref1)) ! TREE_TYPE (ref1) = new_type; } ! /* Now deal with the unconstrained array case. In this case the "pointer" ! is actually a RECORD_TYPE where both fields are pointers to dummy nodes. Turn them into pointers to the correct types using update_pointer_to. */ - else if (!TYPE_IS_FAT_POINTER_P (ptr)) - gcc_unreachable (); - else { tree new_obj_rec = TYPE_OBJECT_RECORD_TYPE (new_type); ! tree array_field = TYPE_FIELDS (ptr); ! tree bounds_field = TREE_CHAIN (TYPE_FIELDS (ptr)); ! tree new_ptr = TYPE_POINTER_TO (new_type); ! tree new_ref; ! tree var; /* Make pointers to the dummy template point to the real template. */ update_pointer_to (TREE_TYPE (TREE_TYPE (bounds_field)), ! TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (new_ptr))))); ! /* The references to the template bounds present in the array type ! are made through a PLACEHOLDER_EXPR of type NEW_PTR. Since we ! are updating PTR to make it a full replacement for NEW_PTR as ! pointer to NEW_TYPE, we must rework the PLACEHOLDER_EXPR so as ! to make it of type PTR. */ new_ref = build3 (COMPONENT_REF, TREE_TYPE (bounds_field), ! build0 (PLACEHOLDER_EXPR, ptr), bounds_field, NULL_TREE); /* Create the new array for the new PLACEHOLDER_EXPR and make pointers --- 3430,3510 ---- /* Otherwise, first handle the simple case. */ if (TREE_CODE (new_type) != UNCONSTRAINED_ARRAY_TYPE) { ! tree new_ptr, new_ref; + /* If pointer or reference already points to new type, nothing to do. + This can happen as update_pointer_to can be invoked multiple times + on the same couple of types because of the type variants. */ + if ((ptr && TREE_TYPE (ptr) == new_type) + || (ref && TREE_TYPE (ref) == new_type)) + return; + + /* Chain PTR and its variants at the end. */ + new_ptr = TYPE_POINTER_TO (new_type); + if (new_ptr) + { + while (TYPE_NEXT_PTR_TO (new_ptr)) + new_ptr = TYPE_NEXT_PTR_TO (new_ptr); + TYPE_NEXT_PTR_TO (new_ptr) = ptr; + } + else + TYPE_POINTER_TO (new_type) = ptr; + + /* Now adjust them. */ for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr)) ! for (t = TYPE_MAIN_VARIANT (ptr); t; t = TYPE_NEXT_VARIANT (t)) ! TREE_TYPE (t) = new_type; ! TYPE_POINTER_TO (old_type) = NULL_TREE; ! ! /* Chain REF and its variants at the end. */ ! new_ref = TYPE_REFERENCE_TO (new_type); ! if (new_ref) ! { ! while (TYPE_NEXT_REF_TO (new_ref)) ! new_ref = TYPE_NEXT_REF_TO (new_ref); ! TYPE_NEXT_REF_TO (new_ref) = ref; ! } ! else ! TYPE_REFERENCE_TO (new_type) = ref; + /* Now adjust them. */ for (; ref; ref = TYPE_NEXT_REF_TO (ref)) ! for (t = TYPE_MAIN_VARIANT (ref); t; t = TYPE_NEXT_VARIANT (t)) ! TREE_TYPE (t) = new_type; ! TYPE_REFERENCE_TO (old_type) = NULL_TREE; } ! /* Now deal with the unconstrained array case. In this case the pointer ! is actually a record where both fields are pointers to dummy nodes. Turn them into pointers to the correct types using update_pointer_to. */ else { + tree new_ptr = TYPE_MAIN_VARIANT (TYPE_POINTER_TO (new_type)); tree new_obj_rec = TYPE_OBJECT_RECORD_TYPE (new_type); ! tree array_field, bounds_field, new_ref, last = NULL_TREE; ! ! gcc_assert (TYPE_IS_FAT_POINTER_P (ptr)); ! ! /* If PTR already points to new type, nothing to do. This can happen ! since update_pointer_to can be invoked multiple times on the same ! couple of types because of the type variants. */ ! if (TYPE_UNCONSTRAINED_ARRAY (ptr) == new_type) ! return; ! ! array_field = TYPE_FIELDS (ptr); ! bounds_field = DECL_CHAIN (array_field); /* Make pointers to the dummy template point to the real template. */ update_pointer_to (TREE_TYPE (TREE_TYPE (bounds_field)), ! TREE_TYPE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (new_ptr))))); ! /* The references to the template bounds present in the array type use ! the bounds field of NEW_PTR through a PLACEHOLDER_EXPR. Since we ! are going to merge PTR in NEW_PTR, we must rework these references ! to use the bounds field of PTR instead. */ new_ref = build3 (COMPONENT_REF, TREE_TYPE (bounds_field), ! build0 (PLACEHOLDER_EXPR, new_ptr), bounds_field, NULL_TREE); /* Create the new array for the new PLACEHOLDER_EXPR and make pointers *************** update_pointer_to (tree old_type, tree n *** 3688,3731 **** update_pointer_to (TREE_TYPE (TREE_TYPE (array_field)), substitute_in_type (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))), ! TREE_CHAIN (TYPE_FIELDS (new_ptr)), new_ref)); ! /* Make PTR the pointer to NEW_TYPE. */ ! TYPE_POINTER_TO (new_type) = TYPE_REFERENCE_TO (new_type) ! = TREE_TYPE (new_type) = ptr; ! /* And show the original pointer NEW_PTR to the debugger. This is the ! counterpart of the equivalent processing in gnat_pushdecl when the ! unconstrained array type is frozen after access types to it. Note ! that update_pointer_to can be invoked multiple times on the same ! couple of types because of the type variants. */ ! if (TYPE_NAME (ptr) ! && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL ! && !DECL_ORIGINAL_TYPE (TYPE_NAME (ptr))) { ! DECL_ORIGINAL_TYPE (TYPE_NAME (ptr)) = new_ptr; ! DECL_ARTIFICIAL (TYPE_NAME (ptr)) = 0; } - for (var = TYPE_MAIN_VARIANT (ptr); var; var = TYPE_NEXT_VARIANT (var)) - SET_TYPE_UNCONSTRAINED_ARRAY (var, new_type); /* Now handle updating the allocation record, what the thin pointer points to. Update all pointers from the old record into the new one, update the type of the array field, and recompute the size. */ update_pointer_to (TYPE_OBJECT_RECORD_TYPE (old_type), new_obj_rec); ! ! TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (new_obj_rec))) = TREE_TYPE (TREE_TYPE (array_field)); /* The size recomputation needs to account for alignment constraints, so we let layout_type work it out. This will reset the field offsets to what they would be in a regular record, so we shift them back to what we want them to be for a thin pointer designated type afterwards. */ ! DECL_SIZE (TYPE_FIELDS (new_obj_rec)) = 0; ! DECL_SIZE (TREE_CHAIN (TYPE_FIELDS (new_obj_rec))) = 0; ! TYPE_SIZE (new_obj_rec) = 0; layout_type (new_obj_rec); - shift_unc_components_for_thin_pointers (new_obj_rec); /* We are done, at last. */ --- 3512,3561 ---- update_pointer_to (TREE_TYPE (TREE_TYPE (array_field)), substitute_in_type (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))), ! DECL_CHAIN (TYPE_FIELDS (new_ptr)), new_ref)); ! /* Merge PTR in NEW_PTR. */ ! DECL_FIELD_CONTEXT (array_field) = new_ptr; ! DECL_FIELD_CONTEXT (bounds_field) = new_ptr; ! for (t = new_ptr; t; last = t, t = TYPE_NEXT_VARIANT (t)) ! TYPE_FIELDS (t) = TYPE_FIELDS (ptr); ! TYPE_ALIAS_SET (new_ptr) = TYPE_ALIAS_SET (ptr); ! /* Chain PTR and its variants at the end. */ ! TYPE_NEXT_VARIANT (last) = TYPE_MAIN_VARIANT (ptr); ! ! /* Now adjust them. */ ! for (t = TYPE_MAIN_VARIANT (ptr); t; t = TYPE_NEXT_VARIANT (t)) { ! TYPE_MAIN_VARIANT (t) = new_ptr; ! SET_TYPE_UNCONSTRAINED_ARRAY (t, new_type); ! ! /* And show the original pointer NEW_PTR to the debugger. This is ! the counterpart of the special processing for fat pointer types ! in gnat_pushdecl, but when the unconstrained array type is only ! frozen after access types to it. */ ! if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL) ! { ! DECL_ORIGINAL_TYPE (TYPE_NAME (t)) = new_ptr; ! DECL_ARTIFICIAL (TYPE_NAME (t)) = 0; ! } } /* Now handle updating the allocation record, what the thin pointer points to. Update all pointers from the old record into the new one, update the type of the array field, and recompute the size. */ update_pointer_to (TYPE_OBJECT_RECORD_TYPE (old_type), new_obj_rec); ! TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (new_obj_rec))) = TREE_TYPE (TREE_TYPE (array_field)); /* The size recomputation needs to account for alignment constraints, so we let layout_type work it out. This will reset the field offsets to what they would be in a regular record, so we shift them back to what we want them to be for a thin pointer designated type afterwards. */ ! DECL_SIZE (TYPE_FIELDS (new_obj_rec)) = NULL_TREE; ! DECL_SIZE (DECL_CHAIN (TYPE_FIELDS (new_obj_rec))) = NULL_TREE; ! TYPE_SIZE (new_obj_rec) = NULL_TREE; layout_type (new_obj_rec); shift_unc_components_for_thin_pointers (new_obj_rec); /* We are done, at last. */ *************** update_pointer_to (tree old_type, tree n *** 3739,3768 **** static tree convert_to_fat_pointer (tree type, tree expr) { ! tree template_type = TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (type)))); tree p_array_type = TREE_TYPE (TYPE_FIELDS (type)); tree etype = TREE_TYPE (expr); tree template_tree; /* If EXPR is null, make a fat pointer that contains null pointers to the template and array. */ if (integer_zerop (expr)) ! return ! gnat_build_constructor ! (type, ! tree_cons (TYPE_FIELDS (type), ! convert (p_array_type, expr), ! tree_cons (TREE_CHAIN (TYPE_FIELDS (type)), ! convert (build_pointer_type (template_type), ! expr), ! NULL_TREE))); /* If EXPR is a thin pointer, make template and data from the record.. */ else if (TYPE_IS_THIN_POINTER_P (etype)) { tree fields = TYPE_FIELDS (TREE_TYPE (etype)); ! expr = save_expr (expr); if (TREE_CODE (expr) == ADDR_EXPR) expr = TREE_OPERAND (expr, 0); else --- 3569,3598 ---- static tree convert_to_fat_pointer (tree type, tree expr) { ! tree template_type = TREE_TYPE (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (type)))); tree p_array_type = TREE_TYPE (TYPE_FIELDS (type)); tree etype = TREE_TYPE (expr); tree template_tree; + VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2); /* If EXPR is null, make a fat pointer that contains null pointers to the template and array. */ if (integer_zerop (expr)) ! { ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type), ! convert (p_array_type, expr)); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (type)), ! convert (build_pointer_type (template_type), ! expr)); ! return gnat_build_constructor (type, v); ! } /* If EXPR is a thin pointer, make template and data from the record.. */ else if (TYPE_IS_THIN_POINTER_P (etype)) { tree fields = TYPE_FIELDS (TREE_TYPE (etype)); ! expr = gnat_protect_expr (expr); if (TREE_CODE (expr) == ADDR_EXPR) expr = TREE_OPERAND (expr, 0); else *************** convert_to_fat_pointer (tree type, tree *** 3771,3777 **** template_tree = build_component_ref (expr, NULL_TREE, fields, false); expr = build_unary_op (ADDR_EXPR, NULL_TREE, build_component_ref (expr, NULL_TREE, ! TREE_CHAIN (fields), false)); } /* Otherwise, build the constructor for the template. */ --- 3601,3607 ---- template_tree = build_component_ref (expr, NULL_TREE, fields, false); expr = build_unary_op (ADDR_EXPR, NULL_TREE, build_component_ref (expr, NULL_TREE, ! DECL_CHAIN (fields), false)); } /* Otherwise, build the constructor for the template. */ *************** convert_to_fat_pointer (tree type, tree *** 3790,3804 **** Note that the call to "build_template" above is still fine because it will only refer to the provided TEMPLATE_TYPE in this case. */ ! return ! gnat_build_constructor ! (type, ! tree_cons (TYPE_FIELDS (type), ! convert (p_array_type, expr), ! tree_cons (TREE_CHAIN (TYPE_FIELDS (type)), ! build_unary_op (ADDR_EXPR, NULL_TREE, ! template_tree), ! NULL_TREE))); } /* Convert to a thin pointer type, TYPE. The only thing we know how to convert --- 3620,3631 ---- Note that the call to "build_template" above is still fine because it will only refer to the provided TEMPLATE_TYPE in this case. */ ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type), ! convert (p_array_type, expr)); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (type)), ! build_unary_op (ADDR_EXPR, NULL_TREE, ! template_tree)); ! return gnat_build_constructor (type, v); } /* Convert to a thin pointer type, TYPE. The only thing we know how to convert *************** convert_to_thin_pointer (tree type, tree *** 3831,3842 **** tree convert (tree type, tree expr) { - enum tree_code code = TREE_CODE (type); tree etype = TREE_TYPE (expr); enum tree_code ecode = TREE_CODE (etype); ! /* If EXPR is already the right type, we are done. */ ! if (type == etype) return expr; /* If both input and output have padding and are of variable size, do this --- 3658,3669 ---- tree convert (tree type, tree expr) { tree etype = TREE_TYPE (expr); enum tree_code ecode = TREE_CODE (etype); + enum tree_code code = TREE_CODE (type); ! /* If the expression is already of the right type, we are done. */ ! if (etype == type) return expr; /* If both input and output have padding and are of variable size, do this *************** convert (tree type, tree expr) *** 3855,3860 **** --- 3682,3689 ---- constructor to build the record, unless a variable size is involved. */ else if (code == RECORD_TYPE && TYPE_PADDING_P (type)) { + VEC(constructor_elt,gc) *v; + /* If we previously converted from another type and our type is of variable size, remove the conversion to avoid the need for variable-sized temporaries. Likewise for a conversion between *************** convert (tree type, tree expr) *** 3883,3894 **** /* If the inner type is of self-referential size and the expression type is a record, do this as an unchecked conversion. But first pad the expression if possible to have the same size on both sides. */ ! if (TREE_CODE (etype) == RECORD_TYPE && CONTAINS_PLACEHOLDER_P (DECL_SIZE (TYPE_FIELDS (type)))) { ! if (TREE_CONSTANT (TYPE_SIZE (etype))) expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, Empty, ! false, false, false, true), expr); return unchecked_convert (type, expr, false); } --- 3712,3724 ---- /* If the inner type is of self-referential size and the expression type is a record, do this as an unchecked conversion. But first pad the expression if possible to have the same size on both sides. */ ! if (ecode == RECORD_TYPE && CONTAINS_PLACEHOLDER_P (DECL_SIZE (TYPE_FIELDS (type)))) { ! if (TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST) expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, Empty, ! false, false, false, true), ! expr); return unchecked_convert (type, expr, false); } *************** convert (tree type, tree expr) *** 3896,3902 **** final conversion as an unchecked conversion, again to avoid the need for some variable-sized temporaries. If valid, this conversion is very likely purely technical and without real effects. */ ! if (TREE_CODE (etype) == ARRAY_TYPE && TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == ARRAY_TYPE && !TREE_CONSTANT (TYPE_SIZE (etype)) && !TREE_CONSTANT (TYPE_SIZE (type))) --- 3726,3732 ---- final conversion as an unchecked conversion, again to avoid the need for some variable-sized temporaries. If valid, this conversion is very likely purely technical and without real effects. */ ! if (ecode == ARRAY_TYPE && TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == ARRAY_TYPE && !TREE_CONSTANT (TYPE_SIZE (etype)) && !TREE_CONSTANT (TYPE_SIZE (type))) *************** convert (tree type, tree expr) *** 3905,3917 **** expr), false); ! return ! gnat_build_constructor (type, ! tree_cons (TYPE_FIELDS (type), ! convert (TREE_TYPE ! (TYPE_FIELDS (type)), ! expr), ! NULL_TREE)); } /* If the input type has padding, remove it and convert to the output type. --- 3735,3744 ---- expr), false); ! v = VEC_alloc (constructor_elt, gc, 1); ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type), ! convert (TREE_TYPE (TYPE_FIELDS (type)), expr)); ! return gnat_build_constructor (type, v); } /* If the input type has padding, remove it and convert to the output type. *************** convert (tree type, tree expr) *** 3962,3982 **** type and then build the template. */ if (code == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (type)) { ! tree obj_type = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (type))); /* If the source already has a template, get a reference to the associated array only, as we are going to rebuild a template for the target type anyway. */ expr = maybe_unconstrained_array (expr); ! return ! gnat_build_constructor ! (type, ! tree_cons (TYPE_FIELDS (type), ! build_template (TREE_TYPE (TYPE_FIELDS (type)), ! obj_type, NULL_TREE), ! tree_cons (TREE_CHAIN (TYPE_FIELDS (type)), ! convert (obj_type, expr), NULL_TREE))); } /* There are some special cases of expressions that we process --- 3789,3808 ---- type and then build the template. */ if (code == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (type)) { ! tree obj_type = TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (type))); ! VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2); /* If the source already has a template, get a reference to the associated array only, as we are going to rebuild a template for the target type anyway. */ expr = maybe_unconstrained_array (expr); ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type), ! build_template (TREE_TYPE (TYPE_FIELDS (type)), ! obj_type, NULL_TREE)); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (type)), ! convert (obj_type, expr)); ! return gnat_build_constructor (type, v); } /* There are some special cases of expressions that we process *************** convert (tree type, tree expr) *** 4027,4037 **** return expr; } ! /* Likewise for a conversion between original and packable version, but ! we have to work harder in order to preserve type consistency. */ if (code == ecode && code == RECORD_TYPE ! && TYPE_NAME (type) == TYPE_NAME (etype)) { VEC(constructor_elt,gc) *e = CONSTRUCTOR_ELTS (expr); unsigned HOST_WIDE_INT len = VEC_length (constructor_elt, e); --- 3853,3866 ---- return expr; } ! /* Likewise for a conversion between original and packable version, or ! conversion between types of the same size and with the same list of ! fields, but we have to work harder to preserve type consistency. */ if (code == ecode && code == RECORD_TYPE ! && (TYPE_NAME (type) == TYPE_NAME (etype) ! || tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (etype)))) ! { VEC(constructor_elt,gc) *e = CONSTRUCTOR_ELTS (expr); unsigned HOST_WIDE_INT len = VEC_length (constructor_elt, e); *************** convert (tree type, tree expr) *** 4046,4069 **** FOR_EACH_CONSTRUCTOR_ELT(e, idx, index, value) { ! constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL); ! /* We expect only simple constructors. Otherwise, punt. */ ! if (!(index == efield || index == DECL_ORIGINAL_FIELD (efield))) break; elt->index = field; elt->value = convert (TREE_TYPE (field), value); /* If packing has made this field a bitfield and the input value couldn't be emitted statically any more, we need to clear TREE_CONSTANT on our output. */ ! if (!clear_constant && TREE_CONSTANT (expr) && !CONSTRUCTOR_BITFIELD_P (efield) && CONSTRUCTOR_BITFIELD_P (field) && !initializer_constant_valid_for_bitfield_p (value)) clear_constant = true; ! efield = TREE_CHAIN (efield); ! field = TREE_CHAIN (field); } /* If we have been able to match and convert all the input fields --- 3875,3903 ---- FOR_EACH_CONSTRUCTOR_ELT(e, idx, index, value) { ! constructor_elt *elt; ! /* We expect only simple constructors. */ ! if (!SAME_FIELD_P (index, efield)) ! break; ! /* The field must be the same. */ ! if (!SAME_FIELD_P (efield, field)) break; + elt = VEC_quick_push (constructor_elt, v, NULL); elt->index = field; elt->value = convert (TREE_TYPE (field), value); /* If packing has made this field a bitfield and the input value couldn't be emitted statically any more, we need to clear TREE_CONSTANT on our output. */ ! if (!clear_constant ! && TREE_CONSTANT (expr) && !CONSTRUCTOR_BITFIELD_P (efield) && CONSTRUCTOR_BITFIELD_P (field) && !initializer_constant_valid_for_bitfield_p (value)) clear_constant = true; ! efield = DECL_CHAIN (efield); ! field = DECL_CHAIN (field); } /* If we have been able to match and convert all the input fields *************** convert (tree type, tree expr) *** 4075,4081 **** TREE_TYPE (expr) = type; CONSTRUCTOR_ELTS (expr) = v; if (clear_constant) ! TREE_CONSTANT (expr) = TREE_STATIC (expr) = false; return expr; } } --- 3909,3915 ---- TREE_TYPE (expr) = type; CONSTRUCTOR_ELTS (expr) = v; if (clear_constant) ! TREE_CONSTANT (expr) = TREE_STATIC (expr) = 0; return expr; } } *************** convert (tree type, tree expr) *** 4130,4139 **** case UNCONSTRAINED_ARRAY_REF: /* Convert this to the type of the inner array by getting the address of the array from the template. */ expr = build_unary_op (INDIRECT_REF, NULL_TREE, ! build_component_ref (TREE_OPERAND (expr, 0), ! get_identifier ("P_ARRAY"), ! NULL_TREE, false)); etype = TREE_TYPE (expr); ecode = TREE_CODE (etype); break; --- 3964,3975 ---- case UNCONSTRAINED_ARRAY_REF: /* Convert this to the type of the inner array by getting the address of the array from the template. */ + expr = TREE_OPERAND (expr, 0); expr = build_unary_op (INDIRECT_REF, NULL_TREE, ! build_component_ref (expr, NULL_TREE, ! TYPE_FIELDS ! (TREE_TYPE (expr)), ! false)); etype = TREE_TYPE (expr); ecode = TREE_CODE (etype); break; *************** convert (tree type, tree expr) *** 4174,4198 **** } break; - case INDIRECT_REF: - /* If both types are record types, just convert the pointer and - make a new INDIRECT_REF. - - ??? Disable this for now since it causes problems with the - code in build_binary_op for MODIFY_EXPR which wants to - strip off conversions. But that code really is a mess and - we need to do this a much better way some time. */ - if (0 - && (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) - && (TREE_CODE (etype) == RECORD_TYPE - || TREE_CODE (etype) == UNION_TYPE) - && !TYPE_IS_FAT_POINTER_P (type) && !TYPE_IS_FAT_POINTER_P (etype)) - return build_unary_op (INDIRECT_REF, NULL_TREE, - convert (build_pointer_type (type), - TREE_OPERAND (expr, 0))); - break; - default: break; } --- 4010,4015 ---- *************** convert (tree type, tree expr) *** 4213,4222 **** etype))) return build1 (VIEW_CONVERT_EXPR, type, expr); /* In all other cases of related types, make a NOP_EXPR. */ ! else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype) ! || (code == INTEGER_CST && ecode == INTEGER_CST ! && (type == TREE_TYPE (etype) || etype == TREE_TYPE (type)))) return fold_convert (type, expr); switch (code) --- 4030,4050 ---- etype))) return build1 (VIEW_CONVERT_EXPR, type, expr); + /* If we are converting between tagged types, try to upcast properly. */ + else if (ecode == RECORD_TYPE && code == RECORD_TYPE + && TYPE_ALIGN_OK (etype) && TYPE_ALIGN_OK (type)) + { + tree child_etype = etype; + do { + tree field = TYPE_FIELDS (child_etype); + if (DECL_NAME (field) == parent_name_id && TREE_TYPE (field) == type) + return build_component_ref (expr, NULL_TREE, field, false); + child_etype = TREE_TYPE (field); + } while (TREE_CODE (child_etype) == RECORD_TYPE); + } + /* In all other cases of related types, make a NOP_EXPR. */ ! else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)) return fold_convert (type, expr); switch (code) *************** convert (tree type, tree expr) *** 4275,4283 **** tree bit_diff = size_diffop (bit_position (TYPE_FIELDS (TREE_TYPE (etype))), bit_position (TYPE_FIELDS (TREE_TYPE (type)))); ! tree byte_diff = size_binop (CEIL_DIV_EXPR, bit_diff, ! sbitsize_int (BITS_PER_UNIT)); ! expr = build1 (NOP_EXPR, type, expr); TREE_CONSTANT (expr) = TREE_CONSTANT (TREE_OPERAND (expr, 0)); if (integer_zerop (byte_diff)) --- 4103,4110 ---- tree bit_diff = size_diffop (bit_position (TYPE_FIELDS (TREE_TYPE (etype))), bit_position (TYPE_FIELDS (TREE_TYPE (type)))); ! tree byte_diff ! = size_binop (CEIL_DIV_EXPR, bit_diff, sbitsize_unit_node); expr = build1 (NOP_EXPR, type, expr); TREE_CONSTANT (expr) = TREE_CONSTANT (TREE_OPERAND (expr, 0)); if (integer_zerop (byte_diff)) *************** convert (tree type, tree expr) *** 4295,4302 **** /* If converting fat pointer to normal pointer, get the pointer to the array and then convert it. */ else if (TYPE_IS_FAT_POINTER_P (etype)) ! expr = build_component_ref (expr, get_identifier ("P_ARRAY"), ! NULL_TREE, false); return fold (convert_to_pointer (type, expr)); --- 4122,4129 ---- /* If converting fat pointer to normal pointer, get the pointer to the array and then convert it. */ else if (TYPE_IS_FAT_POINTER_P (etype)) ! expr ! = build_component_ref (expr, NULL_TREE, TYPE_FIELDS (etype), false); return fold (convert_to_pointer (type, expr)); *************** convert (tree type, tree expr) *** 4305,4315 **** case RECORD_TYPE: if (TYPE_JUSTIFIED_MODULAR_P (type) && !AGGREGATE_TYPE_P (etype)) ! return ! gnat_build_constructor ! (type, tree_cons (TYPE_FIELDS (type), ! convert (TREE_TYPE (TYPE_FIELDS (type)), expr), ! NULL_TREE)); /* ... fall through ... */ --- 4132,4145 ---- case RECORD_TYPE: if (TYPE_JUSTIFIED_MODULAR_P (type) && !AGGREGATE_TYPE_P (etype)) ! { ! VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 1); ! ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type), ! convert (TREE_TYPE (TYPE_FIELDS (type)), ! expr)); ! return gnat_build_constructor (type, v); ! } /* ... fall through ... */ *************** remove_conversions (tree exp, bool true_ *** 4407,4413 **** } /* If EXP's type is an UNCONSTRAINED_ARRAY_TYPE, return an expression that ! refers to the underlying array. If its type has TYPE_CONTAINS_TEMPLATE_P, likewise return an expression pointing to the underlying array. */ tree --- 4237,4243 ---- } /* If EXP's type is an UNCONSTRAINED_ARRAY_TYPE, return an expression that ! refers to the underlying array. If it has TYPE_CONTAINS_TEMPLATE_P, likewise return an expression pointing to the underlying array. */ tree *************** maybe_unconstrained_array (tree exp) *** 4421,4433 **** case UNCONSTRAINED_ARRAY_TYPE: if (code == UNCONSTRAINED_ARRAY_REF) { new_exp = build_unary_op (INDIRECT_REF, NULL_TREE, ! build_component_ref (TREE_OPERAND (exp, 0), ! get_identifier ("P_ARRAY"), ! NULL_TREE, false)); ! TREE_READONLY (new_exp) = TREE_STATIC (new_exp) ! = TREE_READONLY (exp); return new_exp; } --- 4251,4264 ---- case UNCONSTRAINED_ARRAY_TYPE: if (code == UNCONSTRAINED_ARRAY_REF) { + new_exp = TREE_OPERAND (exp, 0); new_exp = build_unary_op (INDIRECT_REF, NULL_TREE, ! build_component_ref (new_exp, NULL_TREE, ! TYPE_FIELDS ! (TREE_TYPE (new_exp)), ! false)); ! TREE_READONLY (new_exp) = TREE_READONLY (exp); return new_exp; } *************** maybe_unconstrained_array (tree exp) *** 4447,4460 **** && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (new_exp))) return build_component_ref (new_exp, NULL_TREE, ! TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (new_exp))), ! 0); } else if (TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (exp))) return build_component_ref (exp, NULL_TREE, ! TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (exp))), 0); break; default: --- 4278,4292 ---- && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (new_exp))) return build_component_ref (new_exp, NULL_TREE, ! DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (new_exp))), ! false); } else if (TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (exp))) return build_component_ref (exp, NULL_TREE, ! DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (exp))), ! false); break; default: *************** tree *** 4533,4561 **** unchecked_convert (tree type, tree expr, bool notrunc_p) { tree etype = TREE_TYPE (expr); ! /* If the expression is already the right type, we are done. */ if (etype == type) return expr; /* If both types types are integral just do a normal conversion. Likewise for a conversion to an unconstrained array. */ if ((((INTEGRAL_TYPE_P (type) ! && !(TREE_CODE (type) == INTEGER_TYPE ! && TYPE_VAX_FLOATING_POINT_P (type))) || (POINTER_TYPE_P (type) && ! TYPE_IS_THIN_POINTER_P (type)) ! || (TREE_CODE (type) == RECORD_TYPE ! && TYPE_JUSTIFIED_MODULAR_P (type))) && ((INTEGRAL_TYPE_P (etype) ! && !(TREE_CODE (etype) == INTEGER_TYPE ! && TYPE_VAX_FLOATING_POINT_P (etype))) || (POINTER_TYPE_P (etype) && !TYPE_IS_THIN_POINTER_P (etype)) ! || (TREE_CODE (etype) == RECORD_TYPE ! && TYPE_JUSTIFIED_MODULAR_P (etype)))) ! || TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) { ! if (TREE_CODE (etype) == INTEGER_TYPE ! && TYPE_BIASED_REPRESENTATION_P (etype)) { tree ntype = copy_type (etype); TYPE_BIASED_REPRESENTATION_P (ntype) = 0; --- 4365,4391 ---- unchecked_convert (tree type, tree expr, bool notrunc_p) { tree etype = TREE_TYPE (expr); + enum tree_code ecode = TREE_CODE (etype); + enum tree_code code = TREE_CODE (type); + int c; ! /* If the expression is already of the right type, we are done. */ if (etype == type) return expr; /* If both types types are integral just do a normal conversion. Likewise for a conversion to an unconstrained array. */ if ((((INTEGRAL_TYPE_P (type) ! && !(code == INTEGER_TYPE && TYPE_VAX_FLOATING_POINT_P (type))) || (POINTER_TYPE_P (type) && ! TYPE_IS_THIN_POINTER_P (type)) ! || (code == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (type))) && ((INTEGRAL_TYPE_P (etype) ! && !(ecode == INTEGER_TYPE && TYPE_VAX_FLOATING_POINT_P (etype))) || (POINTER_TYPE_P (etype) && !TYPE_IS_THIN_POINTER_P (etype)) ! || (ecode == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (etype)))) ! || code == UNCONSTRAINED_ARRAY_TYPE) { ! if (ecode == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (etype)) { tree ntype = copy_type (etype); TYPE_BIASED_REPRESENTATION_P (ntype) = 0; *************** unchecked_convert (tree type, tree expr, *** 4563,4570 **** expr = build1 (NOP_EXPR, ntype, expr); } ! if (TREE_CODE (type) == INTEGER_TYPE ! && TYPE_BIASED_REPRESENTATION_P (type)) { tree rtype = copy_type (type); TYPE_BIASED_REPRESENTATION_P (rtype) = 0; --- 4393,4399 ---- expr = build1 (NOP_EXPR, ntype, expr); } ! if (code == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)) { tree rtype = copy_type (type); TYPE_BIASED_REPRESENTATION_P (rtype) = 0; *************** unchecked_convert (tree type, tree expr, *** 4579,4622 **** /* If we are converting to an integral type whose precision is not equal to its size, first unchecked convert to a record that contains an object of the output type. Then extract the field. */ ! else if (INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type)))) { tree rec_type = make_node (RECORD_TYPE); ! tree field = create_field_decl (get_identifier ("OBJ"), type, ! rec_type, 1, 0, 0, 0); TYPE_FIELDS (rec_type) = field; layout_type (rec_type); expr = unchecked_convert (rec_type, expr, notrunc_p); ! expr = build_component_ref (expr, NULL_TREE, field, 0); } /* Similarly if we are converting from an integral type whose precision is not equal to its size. */ ! else if (INTEGRAL_TYPE_P (etype) && TYPE_RM_SIZE (etype) ! && 0 != compare_tree_int (TYPE_RM_SIZE (etype), ! GET_MODE_BITSIZE (TYPE_MODE (etype)))) { tree rec_type = make_node (RECORD_TYPE); ! tree field ! = create_field_decl (get_identifier ("OBJ"), etype, rec_type, ! 1, 0, 0, 0); TYPE_FIELDS (rec_type) = field; layout_type (rec_type); ! expr = gnat_build_constructor (rec_type, build_tree_list (field, expr)); expr = unchecked_convert (type, expr, notrunc_p); } /* We have a special case when we are converting between two unconstrained array types. In that case, take the address, convert the fat pointer types, and dereference. */ ! else if (TREE_CODE (etype) == UNCONSTRAINED_ARRAY_TYPE ! && TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) expr = build_unary_op (INDIRECT_REF, NULL_TREE, build1 (VIEW_CONVERT_EXPR, TREE_TYPE (type), build_unary_op (ADDR_EXPR, NULL_TREE, --- 4408,4485 ---- /* If we are converting to an integral type whose precision is not equal to its size, first unchecked convert to a record that contains an object of the output type. Then extract the field. */ ! else if (INTEGRAL_TYPE_P (type) ! && TYPE_RM_SIZE (type) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type)))) { tree rec_type = make_node (RECORD_TYPE); ! tree field = create_field_decl (get_identifier ("OBJ"), type, rec_type, ! NULL_TREE, NULL_TREE, 1, 0); TYPE_FIELDS (rec_type) = field; layout_type (rec_type); expr = unchecked_convert (rec_type, expr, notrunc_p); ! expr = build_component_ref (expr, NULL_TREE, field, false); } /* Similarly if we are converting from an integral type whose precision is not equal to its size. */ ! else if (INTEGRAL_TYPE_P (etype) ! && TYPE_RM_SIZE (etype) ! && 0 != compare_tree_int (TYPE_RM_SIZE (etype), ! GET_MODE_BITSIZE (TYPE_MODE (etype)))) { tree rec_type = make_node (RECORD_TYPE); ! tree field = create_field_decl (get_identifier ("OBJ"), etype, rec_type, ! NULL_TREE, NULL_TREE, 1, 0); ! VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 1); TYPE_FIELDS (rec_type) = field; layout_type (rec_type); ! CONSTRUCTOR_APPEND_ELT (v, field, expr); ! expr = gnat_build_constructor (rec_type, v); expr = unchecked_convert (type, expr, notrunc_p); } + /* If we are converting from a scalar type to a type with a different size, + we need to pad to have the same size on both sides. + + ??? We cannot do it unconditionally because unchecked conversions are + used liberally by the front-end to implement polymorphism, e.g. in: + + S191s : constant ada__tags__addr_ptr := ada__tags__addr_ptr!(S190s); + return p___size__4 (p__object!(S191s.all)); + + so we skip all expressions that are references. */ + else if (!REFERENCE_CLASS_P (expr) + && !AGGREGATE_TYPE_P (etype) + && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST + && (c = tree_int_cst_compare (TYPE_SIZE (etype), TYPE_SIZE (type)))) + { + if (c < 0) + { + expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, Empty, + false, false, false, true), + expr); + expr = unchecked_convert (type, expr, notrunc_p); + } + else + { + tree rec_type = maybe_pad_type (type, TYPE_SIZE (etype), 0, Empty, + false, false, false, true); + expr = unchecked_convert (rec_type, expr, notrunc_p); + expr = build_component_ref (expr, NULL_TREE, TYPE_FIELDS (rec_type), + false); + } + } + /* We have a special case when we are converting between two unconstrained array types. In that case, take the address, convert the fat pointer types, and dereference. */ ! else if (ecode == code && code == UNCONSTRAINED_ARRAY_TYPE) expr = build_unary_op (INDIRECT_REF, NULL_TREE, build1 (VIEW_CONVERT_EXPR, TREE_TYPE (type), build_unary_op (ADDR_EXPR, NULL_TREE, *************** unchecked_convert (tree type, tree expr, *** 4624,4631 **** /* Another special case is when we are converting to a vector type from its representative array type; this a regular conversion. */ ! else if (TREE_CODE (type) == VECTOR_TYPE ! && TREE_CODE (etype) == ARRAY_TYPE && gnat_types_compatible_p (TYPE_REPRESENTATIVE_ARRAY (type), etype)) expr = convert (type, expr); --- 4487,4494 ---- /* Another special case is when we are converting to a vector type from its representative array type; this a regular conversion. */ ! else if (code == VECTOR_TYPE ! && ecode == ARRAY_TYPE && gnat_types_compatible_p (TYPE_REPRESENTATIVE_ARRAY (type), etype)) expr = convert (type, expr); *************** unchecked_convert (tree type, tree expr, *** 4634,4639 **** --- 4497,4503 ---- { expr = maybe_unconstrained_array (expr); etype = TREE_TYPE (expr); + ecode = TREE_CODE (etype); if (can_fold_for_view_convert_p (expr)) expr = fold_build1 (VIEW_CONVERT_EXPR, type, expr); else *************** unchecked_convert (tree type, tree expr, *** 4646,4653 **** is a biased type or if both the input and output are unsigned. */ if (!notrunc_p && INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) ! && !(TREE_CODE (type) == INTEGER_TYPE ! && TYPE_BIASED_REPRESENTATION_P (type)) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type))) && !(INTEGRAL_TYPE_P (etype) --- 4510,4516 ---- is a biased type or if both the input and output are unsigned. */ if (!notrunc_p && INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) ! && !(code == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type))) && !(INTEGRAL_TYPE_P (etype) *************** unchecked_convert (tree type, tree expr, *** 4658,4665 **** 0)) && !(TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype))) { ! tree base_type = gnat_type_for_mode (TYPE_MODE (type), ! TYPE_UNSIGNED (type)); tree shift_expr = convert (base_type, size_binop (MINUS_EXPR, --- 4521,4528 ---- 0)) && !(TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype))) { ! tree base_type ! = gnat_type_for_mode (TYPE_MODE (type), TYPE_UNSIGNED (type)); tree shift_expr = convert (base_type, size_binop (MINUS_EXPR, *************** builtin_decl_for (tree name) *** 4845,4851 **** unsigned i; tree decl; ! for (i = 0; VEC_iterate(tree, builtin_decls, i, decl); i++) if (DECL_NAME (decl) == name) return decl; --- 4708,4714 ---- unsigned i; tree decl; ! FOR_EACH_VEC_ELT (tree, builtin_decls, i, decl) if (DECL_NAME (decl) == name) return decl; *************** build_void_list_node (void) *** 4910,4916 **** static tree builtin_type_for_size (int size, bool unsignedp) { ! tree type = lang_hooks.types.type_for_size (size, unsignedp); return type ? type : error_mark_node; } --- 4773,4779 ---- static tree builtin_type_for_size (int size, bool unsignedp) { ! tree type = gnat_type_for_size (size, unsignedp); return type ? type : error_mark_node; } *************** builtin_type_for_size (int size, bool un *** 4920,4926 **** static void install_builtin_elementary_types (void) { ! signed_size_type_node = size_type_node; pid_type_node = integer_type_node; void_list_node = build_void_list_node (); --- 4783,4789 ---- static void install_builtin_elementary_types (void) { ! signed_size_type_node = gnat_signed_type (size_type_node); pid_type_node = integer_type_node; void_list_node = build_void_list_node (); *************** handle_nonnull_attribute (tree *node, tr *** 5230,5236 **** will have the correct types when we actually check them later. */ if (!args) { ! if (!TYPE_ARG_TYPES (type)) { error ("nonnull attribute without arguments on a non-prototype"); *no_add_attrs = true; --- 5093,5099 ---- will have the correct types when we actually check them later. */ if (!args) { ! if (!prototype_p (type)) { error ("nonnull attribute without arguments on a non-prototype"); *no_add_attrs = true; *************** handle_nonnull_attribute (tree *node, tr *** 5266,5272 **** if (!argument || TREE_CODE (TREE_VALUE (argument)) == VOID_TYPE) { ! error ("nonnull argument with out-of-range operand number (argument %lu, operand %lu)", (unsigned long) attr_arg_num, (unsigned long) arg_num); *no_add_attrs = true; return NULL_TREE; --- 5129,5136 ---- if (!argument || TREE_CODE (TREE_VALUE (argument)) == VOID_TYPE) { ! error ("nonnull argument with out-of-range operand number " ! "(argument %lu, operand %lu)", (unsigned long) attr_arg_num, (unsigned long) arg_num); *no_add_attrs = true; return NULL_TREE; *************** handle_nonnull_attribute (tree *node, tr *** 5274,5280 **** if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE) { ! error ("nonnull argument references non-pointer operand (argument %lu, operand %lu)", (unsigned long) attr_arg_num, (unsigned long) arg_num); *no_add_attrs = true; return NULL_TREE; --- 5138,5145 ---- if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE) { ! error ("nonnull argument references non-pointer operand " ! "(argument %lu, operand %lu)", (unsigned long) attr_arg_num, (unsigned long) arg_num); *no_add_attrs = true; return NULL_TREE; *************** handle_sentinel_attribute (tree *node, t *** 5293,5299 **** { tree params = TYPE_ARG_TYPES (*node); ! if (!params) { warning (OPT_Wattributes, "%qs attribute requires prototypes with named arguments", --- 5158,5164 ---- { tree params = TYPE_ARG_TYPES (*node); ! if (!prototype_p (*node)) { warning (OPT_Wattributes, "%qs attribute requires prototypes with named arguments", *************** handle_noreturn_attribute (tree *node, t *** 5364,5369 **** --- 5229,5256 ---- return NULL_TREE; } + /* Handle a "leaf" attribute; arguments as in + struct attribute_spec.handler. */ + + static tree + handle_leaf_attribute (tree *node, tree name, + tree ARG_UNUSED (args), + int ARG_UNUSED (flags), bool *no_add_attrs) + { + if (TREE_CODE (*node) != FUNCTION_DECL) + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + if (!TREE_PUBLIC (*node)) + { + warning (OPT_Wattributes, "%qE attribute has no effect", name); + *no_add_attrs = true; + } + + return NULL_TREE; + } + /* Handle a "malloc" attribute; arguments as in struct attribute_spec.handler. */ *************** handle_vector_size_attribute (tree *node *** 5454,5462 **** while (POINTER_TYPE_P (type) || TREE_CODE (type) == FUNCTION_TYPE ! || TREE_CODE (type) == METHOD_TYPE ! || TREE_CODE (type) == ARRAY_TYPE ! || TREE_CODE (type) == OFFSET_TYPE) type = TREE_TYPE (type); /* Get the mode of the type being modified. */ --- 5341,5347 ---- while (POINTER_TYPE_P (type) || TREE_CODE (type) == FUNCTION_TYPE ! || TREE_CODE (type) == ARRAY_TYPE) type = TREE_TYPE (type); /* Get the mode of the type being modified. */ *************** handle_vector_size_attribute (tree *node *** 5499,5505 **** new_type = build_vector_type (type, nunits); /* Build back pointers if needed. */ ! *node = lang_hooks.types.reconstruct_complex_type (*node, new_type); return NULL_TREE; } --- 5384,5390 ---- new_type = build_vector_type (type, nunits); /* Build back pointers if needed. */ ! *node = reconstruct_complex_type (*node, new_type); return NULL_TREE; } diff -Nrcpad gcc-4.5.2/gcc/ada/gcc-interface/utils2.c gcc-4.6.0/gcc/ada/gcc-interface/utils2.c *** gcc-4.5.2/gcc/ada/gcc-interface/utils2.c Sat Feb 27 14:27:27 2010 --- gcc-4.6.0/gcc/ada/gcc-interface/utils2.c Thu Feb 3 13:19:38 2011 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2011, 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,35 **** #include "coretypes.h" #include "tm.h" #include "tree.h" - #include "ggc.h" #include "flags.h" #include "output.h" #include "tree-inline.h" --- 28,35 ---- #include "coretypes.h" #include "tm.h" #include "tree.h" #include "flags.h" + #include "ggc.h" #include "output.h" #include "tree-inline.h" *************** *** 48,60 **** #include "ada-tree.h" #include "gigi.h" - static tree find_common_type (tree, tree); - static bool contains_save_expr_p (tree); - static tree contains_null_expr (tree); - static tree compare_arrays (tree, tree, tree); - static tree nonbinary_modular_operation (enum tree_code, tree, tree, tree); - static tree build_simple_component_ref (tree, tree, tree, bool); - /* Return the base type of TYPE. */ tree --- 48,53 ---- *************** find_common_type (tree t1, tree t2) *** 233,440 **** return NULL_TREE; } ! /* See if EXP contains a SAVE_EXPR in a position where we would ! normally put it. ! ! ??? This is a real kludge, but is probably the best approach short ! of some very general solution. */ ! ! static bool ! contains_save_expr_p (tree exp) ! { ! switch (TREE_CODE (exp)) ! { ! case SAVE_EXPR: ! return true; ! ! case ADDR_EXPR: case INDIRECT_REF: ! case COMPONENT_REF: ! CASE_CONVERT: case VIEW_CONVERT_EXPR: ! return contains_save_expr_p (TREE_OPERAND (exp, 0)); ! ! case CONSTRUCTOR: ! { ! tree value; ! unsigned HOST_WIDE_INT ix; ! ! FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), ix, value) ! if (contains_save_expr_p (value)) ! return true; ! return false; ! } ! ! default: ! return false; ! } ! } ! ! /* See if EXP contains a NULL_EXPR in an expression we use for sizes. Return ! it if so. This is used to detect types whose sizes involve computations ! that are known to raise Constraint_Error. */ ! ! static tree ! contains_null_expr (tree exp) ! { ! tree tem; ! ! if (TREE_CODE (exp) == NULL_EXPR) ! return exp; ! ! switch (TREE_CODE_CLASS (TREE_CODE (exp))) ! { ! case tcc_unary: ! return contains_null_expr (TREE_OPERAND (exp, 0)); ! ! case tcc_comparison: ! case tcc_binary: ! tem = contains_null_expr (TREE_OPERAND (exp, 0)); ! if (tem) ! return tem; ! ! return contains_null_expr (TREE_OPERAND (exp, 1)); ! ! case tcc_expression: ! switch (TREE_CODE (exp)) ! { ! case SAVE_EXPR: ! return contains_null_expr (TREE_OPERAND (exp, 0)); ! ! case COND_EXPR: ! tem = contains_null_expr (TREE_OPERAND (exp, 0)); ! if (tem) ! return tem; ! ! tem = contains_null_expr (TREE_OPERAND (exp, 1)); ! if (tem) ! return tem; ! ! return contains_null_expr (TREE_OPERAND (exp, 2)); ! ! default: ! return 0; ! } ! ! default: ! return 0; ! } ! } ! ! /* Return an expression tree representing an equality comparison of ! A1 and A2, two objects of ARRAY_TYPE. The returned expression should ! be of type RESULT_TYPE ! Two arrays are equal in one of two ways: (1) if both have zero length ! in some dimension (not necessarily the same dimension) or (2) if the ! lengths in each dimension are equal and the data is equal. We perform the ! length tests in as efficient a manner as possible. */ static tree ! compare_arrays (tree result_type, tree a1, tree a2) { tree t1 = TREE_TYPE (a1); tree t2 = TREE_TYPE (a2); ! tree result = convert (result_type, integer_one_node); ! tree a1_is_null = convert (result_type, integer_zero_node); ! tree a2_is_null = convert (result_type, integer_zero_node); bool length_zero_p = false; /* Process each dimension separately and compare the lengths. If any ! dimension has a size known to be zero, set SIZE_ZERO_P to 1 to ! suppress the comparison of the data. */ while (TREE_CODE (t1) == ARRAY_TYPE && TREE_CODE (t2) == ARRAY_TYPE) { tree lb1 = TYPE_MIN_VALUE (TYPE_DOMAIN (t1)); tree ub1 = TYPE_MAX_VALUE (TYPE_DOMAIN (t1)); tree lb2 = TYPE_MIN_VALUE (TYPE_DOMAIN (t2)); tree ub2 = TYPE_MAX_VALUE (TYPE_DOMAIN (t2)); ! tree bt = get_base_type (TREE_TYPE (lb1)); ! tree length1 = fold_build2 (MINUS_EXPR, bt, ub1, lb1); ! tree length2 = fold_build2 (MINUS_EXPR, bt, ub2, lb2); ! tree nbt; ! tree tem; tree comparison, this_a1_is_null, this_a2_is_null; /* If the length of the first array is a constant, swap our operands ! unless the length of the second array is the constant zero. ! Note that we have set the `length' values to the length - 1. */ ! if (TREE_CODE (length1) == INTEGER_CST ! && !integer_zerop (fold_build2 (PLUS_EXPR, bt, length2, ! convert (bt, integer_one_node)))) { tem = a1, a1 = a2, a2 = tem; tem = t1, t1 = t2, t2 = tem; tem = lb1, lb1 = lb2, lb2 = tem; tem = ub1, ub1 = ub2, ub2 = tem; tem = length1, length1 = length2, length2 = tem; tem = a1_is_null, a1_is_null = a2_is_null, a2_is_null = tem; } ! /* If the length of this dimension in the second array is the constant ! zero, we can just go inside the original bounds for the first ! array and see if last < first. */ ! if (integer_zerop (fold_build2 (PLUS_EXPR, bt, length2, ! convert (bt, integer_one_node)))) { ! tree ub = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); ! tree lb = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); ! comparison = build_binary_op (LT_EXPR, result_type, ub, lb); comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); ! length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); - length_zero_p = true; this_a1_is_null = comparison; ! this_a2_is_null = convert (result_type, integer_one_node); } ! /* If the length is some other constant value, we know that the ! this dimension in the first array cannot be superflat, so we ! can just use its length from the actual stored bounds. */ else if (TREE_CODE (length2) == INTEGER_CST) { ub1 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); lb1 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); ub2 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t2))); lb2 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t2))); ! nbt = get_base_type (TREE_TYPE (ub1)); comparison ! = build_binary_op (EQ_EXPR, result_type, ! build_binary_op (MINUS_EXPR, nbt, ub1, lb1), ! build_binary_op (MINUS_EXPR, nbt, ub2, lb2)); ! ! /* Note that we know that UB2 and LB2 are constant and hence ! cannot contain a PLACEHOLDER_EXPR. */ ! comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); ! length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); ! this_a1_is_null = build_binary_op (LT_EXPR, result_type, ub1, lb1); ! this_a2_is_null = convert (result_type, integer_zero_node); } ! /* Otherwise compare the computed lengths. */ else { length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); length2 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length2, a2); comparison ! = build_binary_op (EQ_EXPR, result_type, length1, length2); ! this_a1_is_null ! = build_binary_op (LT_EXPR, result_type, length1, ! convert (bt, integer_zero_node)); ! this_a2_is_null ! = build_binary_op (LT_EXPR, result_type, length2, ! convert (bt, integer_zero_node)); } result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, comparison); a1_is_null = build_binary_op (TRUTH_ORIF_EXPR, result_type, this_a1_is_null, a1_is_null); a2_is_null = build_binary_op (TRUTH_ORIF_EXPR, result_type, this_a2_is_null, a2_is_null); --- 226,376 ---- return NULL_TREE; } ! /* Return an expression tree representing an equality comparison of A1 and A2, ! two objects of type ARRAY_TYPE. The result should be of type RESULT_TYPE. ! Two arrays are equal in one of two ways: (1) if both have zero length in ! some dimension (not necessarily the same dimension) or (2) if the lengths ! in each dimension are equal and the data is equal. We perform the length ! tests in as efficient a manner as possible. */ static tree ! compare_arrays (location_t loc, tree result_type, tree a1, tree a2) { + tree result = convert (result_type, boolean_true_node); + tree a1_is_null = convert (result_type, boolean_false_node); + tree a2_is_null = convert (result_type, boolean_false_node); tree t1 = TREE_TYPE (a1); tree t2 = TREE_TYPE (a2); ! bool a1_side_effects_p = TREE_SIDE_EFFECTS (a1); ! bool a2_side_effects_p = TREE_SIDE_EFFECTS (a2); bool length_zero_p = false; + /* If either operand has side-effects, they have to be evaluated only once + in spite of the multiple references to the operand in the comparison. */ + if (a1_side_effects_p) + a1 = gnat_protect_expr (a1); + + if (a2_side_effects_p) + a2 = gnat_protect_expr (a2); + /* Process each dimension separately and compare the lengths. If any ! dimension has a length known to be zero, set LENGTH_ZERO_P to true ! in order to suppress the comparison of the data at the end. */ while (TREE_CODE (t1) == ARRAY_TYPE && TREE_CODE (t2) == ARRAY_TYPE) { tree lb1 = TYPE_MIN_VALUE (TYPE_DOMAIN (t1)); tree ub1 = TYPE_MAX_VALUE (TYPE_DOMAIN (t1)); tree lb2 = TYPE_MIN_VALUE (TYPE_DOMAIN (t2)); tree ub2 = TYPE_MAX_VALUE (TYPE_DOMAIN (t2)); ! tree length1 = size_binop (PLUS_EXPR, size_binop (MINUS_EXPR, ub1, lb1), ! size_one_node); ! tree length2 = size_binop (PLUS_EXPR, size_binop (MINUS_EXPR, ub2, lb2), ! size_one_node); tree comparison, this_a1_is_null, this_a2_is_null; /* If the length of the first array is a constant, swap our operands ! unless the length of the second array is the constant zero. */ ! if (TREE_CODE (length1) == INTEGER_CST && !integer_zerop (length2)) { + tree tem; + bool btem; + tem = a1, a1 = a2, a2 = tem; tem = t1, t1 = t2, t2 = tem; tem = lb1, lb1 = lb2, lb2 = tem; tem = ub1, ub1 = ub2, ub2 = tem; tem = length1, length1 = length2, length2 = tem; tem = a1_is_null, a1_is_null = a2_is_null, a2_is_null = tem; + btem = a1_side_effects_p, a1_side_effects_p = a2_side_effects_p, + a2_side_effects_p = btem; } ! /* If the length of the second array is the constant zero, we can just ! use the original stored bounds for the first array and see whether ! last < first holds. */ ! if (integer_zerop (length2)) { ! length_zero_p = true; ! ub1 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); ! lb1 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); ! ! comparison = fold_build2_loc (loc, LT_EXPR, result_type, ub1, lb1); comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); ! if (EXPR_P (comparison)) ! SET_EXPR_LOCATION (comparison, loc); this_a1_is_null = comparison; ! this_a2_is_null = convert (result_type, boolean_true_node); } ! /* Otherwise, if the length is some other constant value, we know that ! this dimension in the second array cannot be superflat, so we can ! just use its length computed from the actual stored bounds. */ else if (TREE_CODE (length2) == INTEGER_CST) { + tree bt; + ub1 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); lb1 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); + /* Note that we know that UB2 and LB2 are constant and hence + cannot contain a PLACEHOLDER_EXPR. */ ub2 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t2))); lb2 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t2))); ! bt = get_base_type (TREE_TYPE (ub1)); comparison ! = fold_build2_loc (loc, EQ_EXPR, result_type, ! build_binary_op (MINUS_EXPR, bt, ub1, lb1), ! build_binary_op (MINUS_EXPR, bt, ub2, lb2)); comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); ! if (EXPR_P (comparison)) ! SET_EXPR_LOCATION (comparison, loc); ! this_a1_is_null ! = fold_build2_loc (loc, LT_EXPR, result_type, ub1, lb1); ! ! this_a2_is_null = convert (result_type, boolean_false_node); } ! /* Otherwise, compare the computed lengths. */ else { length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); length2 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length2, a2); comparison ! = fold_build2_loc (loc, EQ_EXPR, result_type, length1, length2); ! /* If the length expression is of the form (cond ? val : 0), assume ! that cond is equivalent to (length != 0). That's guaranteed by ! construction of the array types in gnat_to_gnu_entity. */ ! if (TREE_CODE (length1) == COND_EXPR ! && integer_zerop (TREE_OPERAND (length1, 2))) ! this_a1_is_null ! = invert_truthvalue_loc (loc, TREE_OPERAND (length1, 0)); ! else ! this_a1_is_null = fold_build2_loc (loc, EQ_EXPR, result_type, ! length1, size_zero_node); ! ! /* Likewise for the second array. */ ! if (TREE_CODE (length2) == COND_EXPR ! && integer_zerop (TREE_OPERAND (length2, 2))) ! this_a2_is_null ! = invert_truthvalue_loc (loc, TREE_OPERAND (length2, 0)); ! else ! this_a2_is_null = fold_build2_loc (loc, EQ_EXPR, result_type, ! length2, size_zero_node); } + /* Append expressions for this dimension to the final expressions. */ result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, comparison); a1_is_null = build_binary_op (TRUTH_ORIF_EXPR, result_type, this_a1_is_null, a1_is_null); + a2_is_null = build_binary_op (TRUTH_ORIF_EXPR, result_type, this_a2_is_null, a2_is_null); *************** compare_arrays (tree result_type, tree a *** 442,459 **** t2 = TREE_TYPE (t2); } ! /* Unless the size of some bound is known to be zero, compare the data in the array. */ if (!length_zero_p) { tree type = find_common_type (TREE_TYPE (a1), TREE_TYPE (a2)); if (type) ! a1 = convert (type, a1), a2 = convert (type, a2); ! result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, ! fold_build2 (EQ_EXPR, result_type, a1, a2)); } /* The result is also true if both sizes are zero. */ --- 378,400 ---- t2 = TREE_TYPE (t2); } ! /* Unless the length of some dimension is known to be zero, compare the data in the array. */ if (!length_zero_p) { tree type = find_common_type (TREE_TYPE (a1), TREE_TYPE (a2)); + tree comparison; if (type) ! { ! a1 = convert (type, a1), ! a2 = convert (type, a2); ! } ! comparison = fold_build2_loc (loc, EQ_EXPR, result_type, a1, a2); + result + = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, comparison); } /* The result is also true if both sizes are zero. */ *************** compare_arrays (tree result_type, tree a *** 462,475 **** a1_is_null, a2_is_null), result); ! /* If either operand contains SAVE_EXPRs, they have to be evaluated before ! starting the comparison above since the place it would be otherwise ! evaluated would be wrong. */ ! ! if (contains_save_expr_p (a1)) result = build2 (COMPOUND_EXPR, result_type, a1, result); ! if (contains_save_expr_p (a2)) result = build2 (COMPOUND_EXPR, result_type, a2, result); return result; --- 403,415 ---- a1_is_null, a2_is_null), result); ! /* If either operand has side-effects, they have to be evaluated before ! starting the comparison above since the place they would be otherwise ! evaluated could be wrong. */ ! if (a1_side_effects_p) result = build2 (COMPOUND_EXPR, result_type, a1, result); ! if (a2_side_effects_p) result = build2 (COMPOUND_EXPR, result_type, a2, result); return result; *************** nonbinary_modular_operation (enum tree_c *** 547,555 **** /* For subtraction, add the modulus back if we are negative. */ else if (op_code == MINUS_EXPR) { ! result = save_expr (result); result = fold_build3 (COND_EXPR, op_type, ! fold_build2 (LT_EXPR, integer_type_node, result, convert (op_type, integer_zero_node)), fold_build2 (PLUS_EXPR, op_type, result, modulus), result); --- 487,495 ---- /* For subtraction, add the modulus back if we are negative. */ else if (op_code == MINUS_EXPR) { ! result = gnat_protect_expr (result); result = fold_build3 (COND_EXPR, op_type, ! fold_build2 (LT_EXPR, boolean_type_node, result, convert (op_type, integer_zero_node)), fold_build2 (PLUS_EXPR, op_type, result, modulus), result); *************** nonbinary_modular_operation (enum tree_c *** 558,566 **** /* For the other operations, subtract the modulus if we are >= it. */ else { ! result = save_expr (result); result = fold_build3 (COND_EXPR, op_type, ! fold_build2 (GE_EXPR, integer_type_node, result, modulus), fold_build2 (MINUS_EXPR, op_type, result, modulus), --- 498,506 ---- /* For the other operations, subtract the modulus if we are >= it. */ else { ! result = gnat_protect_expr (result); result = fold_build3 (COND_EXPR, op_type, ! fold_build2 (GE_EXPR, boolean_type_node, result, modulus), fold_build2 (MINUS_EXPR, op_type, result, modulus), *************** build_binary_op (enum tree_code op_code, *** 609,614 **** --- 549,555 ---- switch (op_code) { + case INIT_EXPR: case MODIFY_EXPR: /* If there were integral or pointer conversions on the LHS, remove them; we'll be putting them back below if needed. Likewise for *************** build_binary_op (enum tree_code op_code, *** 773,788 **** modulus = NULL_TREE; break; case GE_EXPR: case LE_EXPR: case GT_EXPR: case LT_EXPR: - gcc_assert (!POINTER_TYPE_P (left_type)); - - /* ... fall through ... */ - case EQ_EXPR: case NE_EXPR: /* If either operand is a NULL_EXPR, just return a new one. */ if (TREE_CODE (left_operand) == NULL_EXPR) return build2 (op_code, result_type, --- 714,741 ---- modulus = NULL_TREE; break; + case TRUTH_ANDIF_EXPR: + case TRUTH_ORIF_EXPR: + case TRUTH_AND_EXPR: + case TRUTH_OR_EXPR: + case TRUTH_XOR_EXPR: + #ifdef ENABLE_CHECKING + gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); + #endif + operation_type = left_base_type; + left_operand = convert (operation_type, left_operand); + right_operand = convert (operation_type, right_operand); + break; + case GE_EXPR: case LE_EXPR: case GT_EXPR: case LT_EXPR: case EQ_EXPR: case NE_EXPR: + #ifdef ENABLE_CHECKING + gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); + #endif /* If either operand is a NULL_EXPR, just return a new one. */ if (TREE_CODE (left_operand) == NULL_EXPR) return build2 (op_code, result_type, *************** build_binary_op (enum tree_code op_code, *** 824,833 **** || (TREE_CODE (right_type) == INTEGER_TYPE && TYPE_HAS_ACTUAL_BOUNDS_P (right_type)))) { ! result = compare_arrays (result_type, left_operand, right_operand); ! if (op_code == NE_EXPR) ! result = invert_truthvalue (result); else gcc_assert (op_code == EQ_EXPR); --- 777,786 ---- || (TREE_CODE (right_type) == INTEGER_TYPE && TYPE_HAS_ACTUAL_BOUNDS_P (right_type)))) { ! result = compare_arrays (input_location, ! result_type, left_operand, right_operand); if (op_code == NE_EXPR) ! result = invert_truthvalue_loc (EXPR_LOCATION (result), result); else gcc_assert (op_code == EQ_EXPR); *************** build_binary_op (enum tree_code op_code, *** 899,911 **** modulus = NULL_TREE; break; - case PREINCREMENT_EXPR: - case PREDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - /* These operations are not used anymore. */ - gcc_unreachable (); - case LSHIFT_EXPR: case RSHIFT_EXPR: case LROTATE_EXPR: --- 852,857 ---- *************** build_binary_op (enum tree_code op_code, *** 1003,1016 **** result = fold_build2 (op_code, operation_type, left_operand, right_operand); ! TREE_SIDE_EFFECTS (result) |= has_side_effects; ! TREE_CONSTANT (result) ! |= (TREE_CONSTANT (left_operand) & TREE_CONSTANT (right_operand) ! && op_code != ARRAY_REF && op_code != ARRAY_RANGE_REF); ! if ((op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF) ! && TYPE_VOLATILE (operation_type)) ! TREE_THIS_VOLATILE (result) = 1; /* If we are working with modular types, perform the MOD operation if something above hasn't eliminated the need for it. */ --- 949,967 ---- result = fold_build2 (op_code, operation_type, left_operand, right_operand); ! if (TREE_CONSTANT (result)) ! ; ! else if (op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF) ! { ! TREE_THIS_NOTRAP (result) = 1; ! if (TYPE_VOLATILE (operation_type)) ! TREE_THIS_VOLATILE (result) = 1; ! } ! else ! TREE_CONSTANT (result) ! |= (TREE_CONSTANT (left_operand) && TREE_CONSTANT (right_operand)); ! TREE_SIDE_EFFECTS (result) |= has_side_effects; /* If we are working with modular types, perform the MOD operation if something above hasn't eliminated the need for it. */ *************** build_unary_op (enum tree_code op_code, *** 1058,1065 **** break; case TRUTH_NOT_EXPR: ! gcc_assert (result_type == base_type); ! result = invert_truthvalue (operand); break; case ATTR_ADDR_EXPR: --- 1009,1023 ---- break; case TRUTH_NOT_EXPR: ! #ifdef ENABLE_CHECKING ! gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); ! #endif ! result = invert_truthvalue_loc (EXPR_LOCATION (operand), operand); ! /* When not optimizing, fold the result as invert_truthvalue_loc ! doesn't fold the result of comparisons. This is intended to undo ! the trick used for boolean rvalues in gnat_to_gnu. */ ! if (!optimize) ! result = fold (result); break; case ATTR_ADDR_EXPR: *************** build_unary_op (enum tree_code op_code, *** 1100,1112 **** TREE_TYPE (result) = type = build_pointer_type (type); break; case ARRAY_REF: case ARRAY_RANGE_REF: case COMPONENT_REF: case BIT_FIELD_REF: ! /* If this is for 'Address, find the address of the prefix and ! add the offset to the field. Otherwise, do this the normal ! way. */ if (op_code == ATTR_ADDR_EXPR) { HOST_WIDE_INT bitsize; --- 1058,1085 ---- TREE_TYPE (result) = type = build_pointer_type (type); break; + case COMPOUND_EXPR: + /* Fold a compound expression if it has unconstrained array type + since the middle-end cannot handle it. But we don't it in the + general case because it may introduce aliasing issues if the + first operand is an indirect assignment and the second operand + the corresponding address, e.g. for an allocator. */ + if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) + { + result = build_unary_op (ADDR_EXPR, result_type, + TREE_OPERAND (operand, 1)); + result = build2 (COMPOUND_EXPR, TREE_TYPE (result), + TREE_OPERAND (operand, 0), result); + break; + } + goto common; + case ARRAY_REF: case ARRAY_RANGE_REF: case COMPONENT_REF: case BIT_FIELD_REF: ! /* If this is for 'Address, find the address of the prefix and add ! the offset to the field. Otherwise, do this the normal way. */ if (op_code == ATTR_ADDR_EXPR) { HOST_WIDE_INT bitsize; *************** build_unary_op (enum tree_code op_code, *** 1133,1143 **** if (!offset) offset = size_zero_node; - if (bitpos % BITS_PER_UNIT != 0) - post_error - ("taking address of object not aligned on storage unit?", - error_gnat_node); - offset = size_binop (PLUS_EXPR, offset, size_int (bitpos / BITS_PER_UNIT)); --- 1106,1111 ---- *************** build_unary_op (enum tree_code op_code, *** 1212,1232 **** operand = convert (type, operand); } - if (type != error_mark_node) - operation_type = build_pointer_type (type); - gnat_mark_addressable (operand); ! result = fold_build1 (ADDR_EXPR, operation_type, operand); } TREE_CONSTANT (result) = staticp (operand) || TREE_CONSTANT (operand); break; case INDIRECT_REF: ! /* If we want to refer to an entire unconstrained array, ! make up an expression to do so. This will never survive to ! the backend. If TYPE is a thin pointer, first convert the ! operand to a fat pointer. */ if (TYPE_IS_THIN_POINTER_P (type) && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))) { --- 1180,1196 ---- operand = convert (type, operand); } gnat_mark_addressable (operand); ! result = build_fold_addr_expr (operand); } TREE_CONSTANT (result) = staticp (operand) || TREE_CONSTANT (operand); break; case INDIRECT_REF: ! /* If we want to refer to an unconstrained array, use the appropriate ! expression to do so. This will never survive down to the back-end. ! But if TYPE is a thin pointer, first convert to a fat pointer. */ if (TYPE_IS_THIN_POINTER_P (type) && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))) { *************** build_unary_op (enum tree_code op_code, *** 1240,1254 **** { result = build1 (UNCONSTRAINED_ARRAY_REF, TYPE_UNCONSTRAINED_ARRAY (type), operand); ! TREE_READONLY (result) = TREE_STATIC (result) = TYPE_READONLY (TYPE_UNCONSTRAINED_ARRAY (type)); } else if (TREE_CODE (operand) == ADDR_EXPR) result = TREE_OPERAND (operand, 0); else { ! result = fold_build1 (op_code, TREE_TYPE (type), operand); TREE_READONLY (result) = TYPE_READONLY (TREE_TYPE (type)); } --- 1204,1221 ---- { result = build1 (UNCONSTRAINED_ARRAY_REF, TYPE_UNCONSTRAINED_ARRAY (type), operand); ! TREE_READONLY (result) = TYPE_READONLY (TYPE_UNCONSTRAINED_ARRAY (type)); } + + /* If we are dereferencing an ADDR_EXPR, return its operand. */ else if (TREE_CODE (operand) == ADDR_EXPR) result = TREE_OPERAND (operand, 0); + /* Otherwise, build and fold the indirect reference. */ else { ! result = build_fold_indirect_ref (operand); TREE_READONLY (result) = TYPE_READONLY (TREE_TYPE (type)); } *************** build_unary_op (enum tree_code op_code, *** 1301,1307 **** result = fold_build3 (COND_EXPR, operation_type, fold_build2 (NE_EXPR, ! integer_type_node, operand, convert (operation_type, --- 1268,1274 ---- result = fold_build3 (COND_EXPR, operation_type, fold_build2 (NE_EXPR, ! boolean_type_node, operand, convert (operation_type, *************** build_cond_expr (tree result_type, tree *** 1366,1373 **** true_operand = convert (result_type, true_operand); false_operand = convert (result_type, false_operand); ! /* If the result type is unconstrained, take the address of the operands ! and then dereference our result. */ if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) { --- 1333,1341 ---- true_operand = convert (result_type, true_operand); false_operand = convert (result_type, false_operand); ! /* If the result type is unconstrained, take the address of the operands and ! then dereference the result. Likewise if the result type is passed by ! reference, but this is natively handled in the gimplifier. */ if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) { *************** build_cond_expr (tree result_type, tree *** 1397,1441 **** return result; } ! /* Similar, but for RETURN_EXPR. If RESULT_DECL is non-zero, build ! a RETURN_EXPR around the assignment of RET_VAL to RESULT_DECL. ! If RESULT_DECL is zero, build a bare RETURN_EXPR. */ tree ! build_return_expr (tree result_decl, tree ret_val) { ! tree result_expr; ! if (result_decl) { ! /* The gimplifier explicitly enforces the following invariant: ! RETURN_EXPR ! | ! MODIFY_EXPR ! / \ ! / \ ! RESULT_DECL ... ! As a consequence, type-homogeneity dictates that we use the type ! of the RESULT_DECL as the operation type. */ ! tree operation_type = TREE_TYPE (result_decl); ! /* Convert the right operand to the operation type. Note that ! it's the same transformation as in the MODIFY_EXPR case of ! build_binary_op with the additional guarantee that the type ! cannot involve a placeholder, since otherwise the function ! would use the "target pointer" return mechanism. */ if (operation_type != TREE_TYPE (ret_val)) ret_val = convert (operation_type, ret_val); ! result_expr ! = build2 (MODIFY_EXPR, operation_type, result_decl, ret_val); } else ! result_expr = NULL_TREE; return build1 (RETURN_EXPR, void_type_node, result_expr); } --- 1365,1431 ---- return result; } ! /* Similar, but for COMPOUND_EXPR. */ tree ! build_compound_expr (tree result_type, tree stmt_operand, tree expr_operand) { ! bool addr_p = false; ! tree result; ! /* If the result type is unconstrained, take the address of the operand and ! then dereference the result. Likewise if the result type is passed by ! reference, but this is natively handled in the gimplifier. */ ! if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE ! || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) { ! result_type = build_pointer_type (result_type); ! expr_operand = build_unary_op (ADDR_EXPR, result_type, expr_operand); ! addr_p = true; ! } ! result = fold_build2 (COMPOUND_EXPR, result_type, stmt_operand, ! expr_operand); ! if (addr_p) ! result = build_unary_op (INDIRECT_REF, NULL_TREE, result); ! return result; ! } ! /* Similar, but for RETURN_EXPR. If RET_VAL is non-null, build a RETURN_EXPR ! around the assignment of RET_VAL to RET_OBJ. Otherwise just build a bare ! RETURN_EXPR around RESULT_OBJ, which may be null in this case. */ ! tree ! build_return_expr (tree ret_obj, tree ret_val) ! { ! tree result_expr; ! ! if (ret_val) ! { ! /* The gimplifier explicitly enforces the following invariant: + RETURN_EXPR + | + MODIFY_EXPR + / \ + / \ + RET_OBJ ... + + As a consequence, type consistency dictates that we use the type + of the RET_OBJ as the operation type. */ + tree operation_type = TREE_TYPE (ret_obj); + + /* Convert the right operand to the operation type. Note that it's the + same transformation as in the MODIFY_EXPR case of build_binary_op, + with the assumption that the type cannot involve a placeholder. */ if (operation_type != TREE_TYPE (ret_val)) ret_val = convert (operation_type, ret_val); ! result_expr = build2 (MODIFY_EXPR, operation_type, ret_obj, ret_val); } else ! result_expr = ret_obj; return build1 (RETURN_EXPR, void_type_node, result_expr); } *************** build_call_raise (int msg, Node_Id gnat_ *** 1540,1554 **** = (gnat_node != Empty && Sloc (gnat_node) != No_Location) ? Get_Logical_Line_Number (Sloc(gnat_node)) : input_line; ! TREE_TYPE (filename) ! = build_array_type (char_type_node, build_index_type (size_int (len))); return build_call_2_expr (fndecl, ! build1 (ADDR_EXPR, build_pointer_type (char_type_node), filename), build_int_cst (NULL_TREE, line_number)); } /* qsort comparer for the bit positions of two constructor elements for record components. */ --- 1530,1652 ---- = (gnat_node != Empty && Sloc (gnat_node) != No_Location) ? Get_Logical_Line_Number (Sloc(gnat_node)) : input_line; ! TREE_TYPE (filename) = build_array_type (unsigned_char_type_node, ! build_index_type (size_int (len))); return build_call_2_expr (fndecl, ! build1 (ADDR_EXPR, ! build_pointer_type (unsigned_char_type_node), filename), build_int_cst (NULL_TREE, line_number)); } + + /* Similar to build_call_raise, for an index or range check exception as + determined by MSG, with extra information generated of the form + "INDEX out of range FIRST..LAST". */ + + tree + build_call_raise_range (int msg, Node_Id gnat_node, + tree index, tree first, tree last) + { + tree call; + tree fndecl = gnat_raise_decls_ext[msg]; + tree filename; + int line_number, column_number; + const char *str; + int len; + + str + = (Debug_Flag_NN || Exception_Locations_Suppressed) + ? "" + : (gnat_node != Empty && Sloc (gnat_node) != No_Location) + ? IDENTIFIER_POINTER + (get_identifier (Get_Name_String + (Debug_Source_Name + (Get_Source_File_Index (Sloc (gnat_node)))))) + : ref_filename; + + len = strlen (str); + filename = build_string (len, str); + if (gnat_node != Empty && Sloc (gnat_node) != No_Location) + { + line_number = Get_Logical_Line_Number (Sloc (gnat_node)); + column_number = Get_Column_Number (Sloc (gnat_node)); + } + else + { + line_number = input_line; + column_number = 0; + } + + TREE_TYPE (filename) = build_array_type (unsigned_char_type_node, + build_index_type (size_int (len))); + + call = build_call_nary (TREE_TYPE (TREE_TYPE (fndecl)), + build_unary_op (ADDR_EXPR, NULL_TREE, fndecl), + 6, + build1 (ADDR_EXPR, + build_pointer_type (unsigned_char_type_node), + filename), + build_int_cst (NULL_TREE, line_number), + build_int_cst (NULL_TREE, column_number), + convert (integer_type_node, index), + convert (integer_type_node, first), + convert (integer_type_node, last)); + TREE_SIDE_EFFECTS (call) = 1; + return call; + } + + /* Similar to build_call_raise, with extra information about the column + where the check failed. */ + + tree + build_call_raise_column (int msg, Node_Id gnat_node) + { + tree fndecl = gnat_raise_decls_ext[msg]; + tree call; + tree filename; + int line_number, column_number; + const char *str; + int len; + + str + = (Debug_Flag_NN || Exception_Locations_Suppressed) + ? "" + : (gnat_node != Empty && Sloc (gnat_node) != No_Location) + ? IDENTIFIER_POINTER + (get_identifier (Get_Name_String + (Debug_Source_Name + (Get_Source_File_Index (Sloc (gnat_node)))))) + : ref_filename; + + len = strlen (str); + filename = build_string (len, str); + if (gnat_node != Empty && Sloc (gnat_node) != No_Location) + { + line_number = Get_Logical_Line_Number (Sloc (gnat_node)); + column_number = Get_Column_Number (Sloc (gnat_node)); + } + else + { + line_number = input_line; + column_number = 0; + } + + TREE_TYPE (filename) = build_array_type (unsigned_char_type_node, + build_index_type (size_int (len))); + + call = build_call_nary (TREE_TYPE (TREE_TYPE (fndecl)), + build_unary_op (ADDR_EXPR, NULL_TREE, fndecl), + 3, + build1 (ADDR_EXPR, + build_pointer_type (unsigned_char_type_node), + filename), + build_int_cst (NULL_TREE, line_number), + build_int_cst (NULL_TREE, column_number)); + TREE_SIDE_EFFECTS (call) = 1; + return call; + } /* qsort comparer for the bit positions of two constructor elements for record components. */ *************** build_call_raise (int msg, Node_Id gnat_ *** 1556,1589 **** static int compare_elmt_bitpos (const PTR rt1, const PTR rt2) { ! const_tree const elmt1 = * (const_tree const *) rt1; ! const_tree const elmt2 = * (const_tree const *) rt2; ! const_tree const field1 = TREE_PURPOSE (elmt1); ! const_tree const field2 = TREE_PURPOSE (elmt2); const int ret = tree_int_cst_compare (bit_position (field1), bit_position (field2)); return ret ? ret : (int) (DECL_UID (field1) - DECL_UID (field2)); } ! /* Return a CONSTRUCTOR of TYPE whose list is LIST. */ tree ! gnat_build_constructor (tree type, tree list) { bool allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST); bool side_effects = false; ! tree elmt, result; ! int n_elmts; /* Scan the elements to see if they are all constant or if any has side effects, to let us set global flags on the resulting constructor. Count the elements along the way for possible sorting purposes below. */ ! for (n_elmts = 0, elmt = list; elmt; elmt = TREE_CHAIN (elmt), n_elmts ++) { - tree obj = TREE_PURPOSE (elmt); - tree val = TREE_VALUE (elmt); - /* The predicate must be in keeping with output_constructor. */ if (!TREE_CONSTANT (val) || (TREE_CODE (type) == RECORD_TYPE --- 1654,1684 ---- static int compare_elmt_bitpos (const PTR rt1, const PTR rt2) { ! const constructor_elt * const elmt1 = (const constructor_elt * const) rt1; ! const constructor_elt * const elmt2 = (const constructor_elt * const) rt2; ! const_tree const field1 = elmt1->index; ! const_tree const field2 = elmt2->index; const int ret = tree_int_cst_compare (bit_position (field1), bit_position (field2)); return ret ? ret : (int) (DECL_UID (field1) - DECL_UID (field2)); } ! /* Return a CONSTRUCTOR of TYPE whose elements are V. */ tree ! gnat_build_constructor (tree type, VEC(constructor_elt,gc) *v) { bool allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST); bool side_effects = false; ! tree result, obj, val; ! unsigned int n_elmts; /* Scan the elements to see if they are all constant or if any has side effects, to let us set global flags on the resulting constructor. Count the elements along the way for possible sorting purposes below. */ ! FOR_EACH_CONSTRUCTOR_ELT (v, n_elmts, obj, val) { /* The predicate must be in keeping with output_constructor. */ if (!TREE_CONSTANT (val) || (TREE_CODE (type) == RECORD_TYPE *************** gnat_build_constructor (tree type, tree *** 1594,1633 **** if (TREE_SIDE_EFFECTS (val)) side_effects = true; - - /* Propagate an NULL_EXPR from the size of the type. We won't ever - be executing the code we generate here in that case, but handle it - specially to avoid the compiler blowing up. */ - if (TREE_CODE (type) == RECORD_TYPE - && (result = contains_null_expr (DECL_SIZE (obj))) != NULL_TREE) - return build1 (NULL_EXPR, type, TREE_OPERAND (result, 0)); } /* For record types with constant components only, sort field list by increasing bit position. This is necessary to ensure the constructor can be output as static data. */ if (allconstant && TREE_CODE (type) == RECORD_TYPE && n_elmts > 1) ! { ! /* Fill an array with an element tree per index, and ask qsort to order ! them according to what a bitpos comparison function says. */ ! tree *gnu_arr = (tree *) alloca (sizeof (tree) * n_elmts); ! int i; ! ! for (i = 0, elmt = list; elmt; elmt = TREE_CHAIN (elmt), i++) ! gnu_arr[i] = elmt; ! ! qsort (gnu_arr, n_elmts, sizeof (tree), compare_elmt_bitpos); ! ! /* Then reconstruct the list from the sorted array contents. */ ! list = NULL_TREE; ! for (i = n_elmts - 1; i >= 0; i--) ! { ! TREE_CHAIN (gnu_arr[i]) = list; ! list = gnu_arr[i]; ! } ! } ! result = build_constructor_from_list (type, list); TREE_CONSTANT (result) = TREE_STATIC (result) = allconstant; TREE_SIDE_EFFECTS (result) = side_effects; TREE_READONLY (result) = TYPE_READONLY (type) || allconstant; --- 1689,1703 ---- if (TREE_SIDE_EFFECTS (val)) side_effects = true; } /* For record types with constant components only, sort field list by increasing bit position. This is necessary to ensure the constructor can be output as static data. */ if (allconstant && TREE_CODE (type) == RECORD_TYPE && n_elmts > 1) ! VEC_qsort (constructor_elt, v, compare_elmt_bitpos); ! result = build_constructor (type, v); TREE_CONSTANT (result) = TREE_STATIC (result) = allconstant; TREE_SIDE_EFFECTS (result) = side_effects; TREE_READONLY (result) = TYPE_READONLY (type) || allconstant; *************** build_simple_component_ref (tree record_ *** 1665,1697 **** if (!field) return NULL_TREE; ! /* If this field is not in the specified record, see if we can find ! something in the record whose original field is the same as this one. */ if (DECL_CONTEXT (field) != record_type) - /* Check if there is a field with name COMPONENT in the record. */ { tree new_field; /* First loop thru normal components. */ - for (new_field = TYPE_FIELDS (record_type); new_field; ! new_field = TREE_CHAIN (new_field)) ! if (field == new_field ! || DECL_ORIGINAL_FIELD (new_field) == field ! || new_field == DECL_ORIGINAL_FIELD (field) ! || (DECL_ORIGINAL_FIELD (field) ! && (DECL_ORIGINAL_FIELD (field) ! == DECL_ORIGINAL_FIELD (new_field)))) break; /* Next, loop thru DECL_INTERNAL_P components if we haven't found the component in the first search. Doing this search in 2 steps is required to avoiding hidden homonymous fields in the _Parent field. */ - if (!new_field) for (new_field = TYPE_FIELDS (record_type); new_field; ! new_field = TREE_CHAIN (new_field)) if (DECL_INTERNAL_P (new_field)) { tree field_ref --- 1735,1774 ---- if (!field) return NULL_TREE; ! /* If this field is not in the specified record, see if we can find a field ! in the specified record whose original field is the same as this one. */ if (DECL_CONTEXT (field) != record_type) { tree new_field; /* First loop thru normal components. */ for (new_field = TYPE_FIELDS (record_type); new_field; ! new_field = DECL_CHAIN (new_field)) ! if (SAME_FIELD_P (field, new_field)) break; + /* Next, see if we're looking for an inherited component in an extension. + If so, look thru the extension directly. */ + if (!new_field + && TREE_CODE (record_variable) == VIEW_CONVERT_EXPR + && TYPE_ALIGN_OK (record_type) + && TREE_CODE (TREE_TYPE (TREE_OPERAND (record_variable, 0))) + == RECORD_TYPE + && TYPE_ALIGN_OK (TREE_TYPE (TREE_OPERAND (record_variable, 0)))) + { + ref = build_simple_component_ref (TREE_OPERAND (record_variable, 0), + NULL_TREE, field, no_fold_p); + if (ref) + return ref; + } + /* Next, loop thru DECL_INTERNAL_P components if we haven't found the component in the first search. Doing this search in 2 steps is required to avoiding hidden homonymous fields in the _Parent field. */ if (!new_field) for (new_field = TYPE_FIELDS (record_type); new_field; ! new_field = DECL_CHAIN (new_field)) if (DECL_INTERNAL_P (new_field)) { tree field_ref *************** maybe_wrap_malloc (tree data_size, tree *** 1872,1884 **** tree malloc_ptr; ! /* On VMS, if 64-bit memory is disabled or pointers are 64-bit and the ! allocator size is 32-bit or Convention C, allocate 32-bit memory. */ if (TARGET_ABI_OPEN_VMS ! && (!TARGET_MALLOC64 ! || (POINTER_SIZE == 64 ! && (UI_To_Int (Esize (Etype (gnat_node))) == 32 ! || Convention (Etype (gnat_node)) == Convention_C)))) malloc_ptr = build_call_1_expr (malloc32_decl, size_to_malloc); else malloc_ptr = build_call_1_expr (malloc_decl, size_to_malloc); --- 1949,1961 ---- tree malloc_ptr; ! /* On VMS, if pointers are 64-bit and the allocator size is 32-bit or ! Convention C, allocate 32-bit memory. */ if (TARGET_ABI_OPEN_VMS ! && POINTER_SIZE == 64 ! && Nkind (gnat_node) == N_Allocator ! && (UI_To_Int (Esize (Etype (gnat_node))) == 32 ! || Convention (Etype (gnat_node)) == Convention_C)) malloc_ptr = build_call_1_expr (malloc32_decl, size_to_malloc); else malloc_ptr = build_call_1_expr (malloc_decl, size_to_malloc); *************** maybe_wrap_malloc (tree data_size, tree *** 1887,1893 **** { /* Latch malloc's return value and get a pointer to the aligning field first. */ ! tree storage_ptr = save_expr (malloc_ptr); tree aligning_record_addr = convert (build_pointer_type (aligning_type), storage_ptr); --- 1964,1970 ---- { /* Latch malloc's return value and get a pointer to the aligning field first. */ ! tree storage_ptr = gnat_protect_expr (malloc_ptr); tree aligning_record_addr = convert (build_pointer_type (aligning_type), storage_ptr); *************** maybe_wrap_malloc (tree data_size, tree *** 1897,1903 **** tree aligning_field = build_component_ref (aligning_record, NULL_TREE, ! TYPE_FIELDS (aligning_type), 0); tree aligning_field_addr = build_unary_op (ADDR_EXPR, NULL_TREE, aligning_field); --- 1974,1980 ---- tree aligning_field = build_component_ref (aligning_record, NULL_TREE, ! TYPE_FIELDS (aligning_type), false); tree aligning_field_addr = build_unary_op (ADDR_EXPR, NULL_TREE, aligning_field); *************** build_allocator (tree type, tree init, t *** 2032,2042 **** { tree storage_type = build_unc_object_type_from_ptr (result_type, type, ! get_identifier ("ALLOC")); tree template_type = TREE_TYPE (TYPE_FIELDS (storage_type)); tree storage_ptr_type = build_pointer_type (storage_type); tree storage; - tree template_cons = NULL_TREE; size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_SIZE_UNIT (storage_type), init); --- 2109,2118 ---- { tree storage_type = build_unc_object_type_from_ptr (result_type, type, ! get_identifier ("ALLOC"), false); tree template_type = TREE_TYPE (TYPE_FIELDS (storage_type)); tree storage_ptr_type = build_pointer_type (storage_type); tree storage; size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_SIZE_UNIT (storage_type), init); *************** build_allocator (tree type, tree init, t *** 2048,2054 **** storage = build_call_alloc_dealloc (NULL_TREE, size, storage_type, gnat_proc, gnat_pool, gnat_node); ! storage = convert (storage_ptr_type, protect_multiple_eval (storage)); if (TYPE_IS_PADDING_P (type)) { --- 2124,2130 ---- storage = build_call_alloc_dealloc (NULL_TREE, size, storage_type, gnat_proc, gnat_pool, gnat_node); ! storage = convert (storage_ptr_type, gnat_protect_expr (storage)); if (TYPE_IS_PADDING_P (type)) { *************** build_allocator (tree type, tree init, t *** 2063,2074 **** bounds. */ if (init) { ! template_cons = tree_cons (TREE_CHAIN (TYPE_FIELDS (storage_type)), ! init, NULL_TREE); ! template_cons = tree_cons (TYPE_FIELDS (storage_type), ! build_template (template_type, type, ! init), ! template_cons); return convert (result_type, --- 2139,2150 ---- bounds. */ if (init) { ! VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2); ! ! CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (storage_type), ! build_template (template_type, type, init)); ! CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (storage_type)), ! init); return convert (result_type, *************** build_allocator (tree type, tree init, t *** 2077,2083 **** (MODIFY_EXPR, storage_type, build_unary_op (INDIRECT_REF, NULL_TREE, convert (storage_ptr_type, storage)), ! gnat_build_constructor (storage_type, template_cons)), convert (storage_ptr_type, storage))); } else --- 2153,2159 ---- (MODIFY_EXPR, storage_type, build_unary_op (INDIRECT_REF, NULL_TREE, convert (storage_ptr_type, storage)), ! gnat_build_constructor (storage_type, v)), convert (storage_ptr_type, storage))); } else *************** build_allocator (tree type, tree init, t *** 2088,2094 **** build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, convert (storage_ptr_type, storage)), ! NULL_TREE, TYPE_FIELDS (storage_type), 0), build_template (template_type, type, NULL_TREE)), convert (result_type, convert (storage_ptr_type, storage))); } --- 2164,2170 ---- build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, convert (storage_ptr_type, storage)), ! NULL_TREE, TYPE_FIELDS (storage_type), false), build_template (template_type, type, NULL_TREE)), convert (result_type, convert (storage_ptr_type, storage))); } *************** build_allocator (tree type, tree init, t *** 2122,2133 **** gnat_proc, gnat_pool, gnat_node)); ! /* If we have an initial value, put the new address into a SAVE_EXPR, assign ! the value, and return the address. Do this with a COMPOUND_EXPR. */ ! if (init) { ! result = save_expr (result); result = build2 (COMPOUND_EXPR, TREE_TYPE (result), build_binary_op --- 2198,2208 ---- gnat_proc, gnat_pool, gnat_node)); ! /* If we have an initial value, protect the new address, assign the value ! and return the address with a COMPOUND_EXPR. */ if (init) { ! result = gnat_protect_expr (result); result = build2 (COMPOUND_EXPR, TREE_TYPE (result), build_binary_op *************** build_allocator (tree type, tree init, t *** 2141,2205 **** return convert (result_type, result); } ! /* Fill in a VMS descriptor for EXPR and return a constructor for it. ! GNAT_FORMAL is how we find the descriptor record. GNAT_ACTUAL is ! how we derive the source location to raise C_E on an out of range ! pointer. */ ! ! tree ! fill_vms_descriptor (tree expr, Entity_Id gnat_formal, Node_Id gnat_actual) ! { ! tree field; ! tree parm_decl = get_gnu_tree (gnat_formal); ! tree const_list = NULL_TREE; ! tree record_type = TREE_TYPE (TREE_TYPE (parm_decl)); ! int do_range_check = ! strcmp ("MBO", ! IDENTIFIER_POINTER (DECL_NAME (TYPE_FIELDS (record_type)))); ! ! expr = maybe_unconstrained_array (expr); ! gnat_mark_addressable (expr); ! ! for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field)) ! { ! tree conexpr = convert (TREE_TYPE (field), ! SUBSTITUTE_PLACEHOLDER_IN_EXPR ! (DECL_INITIAL (field), expr)); ! ! /* Check to ensure that only 32bit pointers are passed in ! 32bit descriptors */ ! if (do_range_check && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (field)), "POINTER") == 0) ! { ! tree pointer64type = ! build_pointer_type_for_mode (void_type_node, DImode, false); ! tree addr64expr = build_unary_op (ADDR_EXPR, pointer64type, expr); ! tree malloc64low = ! build_int_cstu (long_integer_type_node, 0x80000000); ! ! add_stmt (build3 (COND_EXPR, void_type_node, ! build_binary_op (GE_EXPR, long_integer_type_node, ! convert (long_integer_type_node, ! addr64expr), ! malloc64low), ! build_call_raise (CE_Range_Check_Failed, gnat_actual, ! N_Raise_Constraint_Error), ! NULL_TREE)); ! } ! const_list = tree_cons (field, conexpr, const_list); ! } ! ! return gnat_build_constructor (record_type, nreverse (const_list)); ! } ! ! /* Indicate that we need to make the address of EXPR_NODE and it therefore should not be allocated in a register. Returns true if successful. */ bool ! gnat_mark_addressable (tree expr_node) { ! while (1) ! switch (TREE_CODE (expr_node)) { case ADDR_EXPR: case COMPONENT_REF: --- 2216,2229 ---- return convert (result_type, result); } ! /* Indicate that we need to take the address of T and that it therefore should not be allocated in a register. Returns true if successful. */ bool ! gnat_mark_addressable (tree t) { ! while (true) ! switch (TREE_CODE (t)) { case ADDR_EXPR: case COMPONENT_REF: *************** gnat_mark_addressable (tree expr_node) *** 2210,2237 **** case VIEW_CONVERT_EXPR: case NON_LVALUE_EXPR: CASE_CONVERT: ! expr_node = TREE_OPERAND (expr_node, 0); break; case CONSTRUCTOR: ! TREE_ADDRESSABLE (expr_node) = 1; return true; case VAR_DECL: case PARM_DECL: case RESULT_DECL: ! TREE_ADDRESSABLE (expr_node) = 1; return true; case FUNCTION_DECL: ! TREE_ADDRESSABLE (expr_node) = 1; return true; case CONST_DECL: ! return (DECL_CONST_CORRESPONDING_VAR (expr_node) ! && (gnat_mark_addressable ! (DECL_CONST_CORRESPONDING_VAR (expr_node)))); default: return true; } } --- 2234,2568 ---- case VIEW_CONVERT_EXPR: case NON_LVALUE_EXPR: CASE_CONVERT: ! t = TREE_OPERAND (t, 0); ! break; ! ! case COMPOUND_EXPR: ! t = TREE_OPERAND (t, 1); break; case CONSTRUCTOR: ! TREE_ADDRESSABLE (t) = 1; return true; case VAR_DECL: case PARM_DECL: case RESULT_DECL: ! TREE_ADDRESSABLE (t) = 1; return true; case FUNCTION_DECL: ! TREE_ADDRESSABLE (t) = 1; return true; case CONST_DECL: ! return DECL_CONST_CORRESPONDING_VAR (t) ! && gnat_mark_addressable (DECL_CONST_CORRESPONDING_VAR (t)); ! default: return true; } } + + /* Save EXP for later use or reuse. This is equivalent to save_expr in tree.c + but we know how to handle our own nodes. */ + + tree + gnat_save_expr (tree exp) + { + tree type = TREE_TYPE (exp); + enum tree_code code = TREE_CODE (exp); + + if (TREE_CONSTANT (exp) || code == SAVE_EXPR || code == NULL_EXPR) + return exp; + + if (code == UNCONSTRAINED_ARRAY_REF) + { + tree t = build1 (code, type, gnat_save_expr (TREE_OPERAND (exp, 0))); + TREE_READONLY (t) = TYPE_READONLY (type); + return t; + } + + /* If this is a COMPONENT_REF of a fat pointer, save the entire fat pointer. + This may be more efficient, but will also allow us to more easily find + the match for the PLACEHOLDER_EXPR. */ + if (code == COMPONENT_REF + && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (exp, 0)))) + return build3 (code, type, gnat_save_expr (TREE_OPERAND (exp, 0)), + TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2)); + + return save_expr (exp); + } + + /* Protect EXP for immediate reuse. This is a variant of gnat_save_expr that + is optimized under the assumption that EXP's value doesn't change before + its subsequent reuse(s) except through its potential reevaluation. */ + + tree + gnat_protect_expr (tree exp) + { + tree type = TREE_TYPE (exp); + enum tree_code code = TREE_CODE (exp); + + if (TREE_CONSTANT (exp) || code == SAVE_EXPR || code == NULL_EXPR) + return exp; + + /* If EXP has no side effects, we theoretically don't need to do anything. + However, we may be recursively passed more and more complex expressions + involving checks which will be reused multiple times and eventually be + unshared for gimplification; in order to avoid a complexity explosion + at that point, we protect any expressions more complex than a simple + arithmetic expression. */ + if (!TREE_SIDE_EFFECTS (exp)) + { + tree inner = skip_simple_arithmetic (exp); + if (!EXPR_P (inner) || REFERENCE_CLASS_P (inner)) + return exp; + } + + /* If this is a conversion, protect what's inside the conversion. */ + if (code == NON_LVALUE_EXPR + || CONVERT_EXPR_CODE_P (code) + || code == VIEW_CONVERT_EXPR) + return build1 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0))); + + /* If we're indirectly referencing something, we only need to protect the + address since the data itself can't change in these situations. */ + if (code == INDIRECT_REF || code == UNCONSTRAINED_ARRAY_REF) + { + tree t = build1 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0))); + TREE_READONLY (t) = TYPE_READONLY (type); + return t; + } + + /* If this is a COMPONENT_REF of a fat pointer, save the entire fat pointer. + This may be more efficient, but will also allow us to more easily find + the match for the PLACEHOLDER_EXPR. */ + if (code == COMPONENT_REF + && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (exp, 0)))) + return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)), + TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2)); + + /* If this is a fat pointer or something that can be placed in a register, + just make a SAVE_EXPR. Likewise for a CALL_EXPR as large objects are + returned via invisible reference in most ABIs so the temporary will + directly be filled by the callee. */ + if (TYPE_IS_FAT_POINTER_P (type) + || TYPE_MODE (type) != BLKmode + || code == CALL_EXPR) + return save_expr (exp); + + /* Otherwise reference, protect the address and dereference. */ + return + build_unary_op (INDIRECT_REF, type, + save_expr (build_unary_op (ADDR_EXPR, + build_reference_type (type), + exp))); + } + + /* This is equivalent to stabilize_reference_1 in tree.c but we take an extra + argument to force evaluation of everything. */ + + static tree + gnat_stabilize_reference_1 (tree e, bool force) + { + enum tree_code code = TREE_CODE (e); + tree type = TREE_TYPE (e); + tree result; + + /* We cannot ignore const expressions because it might be a reference + to a const array but whose index contains side-effects. But we can + ignore things that are actual constant or that already have been + handled by this function. */ + if (TREE_CONSTANT (e) || code == SAVE_EXPR) + return e; + + switch (TREE_CODE_CLASS (code)) + { + case tcc_exceptional: + case tcc_declaration: + case tcc_comparison: + case tcc_expression: + case tcc_reference: + case tcc_vl_exp: + /* If this is a COMPONENT_REF of a fat pointer, save the entire + fat pointer. This may be more efficient, but will also allow + us to more easily find the match for the PLACEHOLDER_EXPR. */ + if (code == COMPONENT_REF + && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (e, 0)))) + result + = build3 (code, type, + gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), force), + TREE_OPERAND (e, 1), TREE_OPERAND (e, 2)); + /* If the expression has side-effects, then encase it in a SAVE_EXPR + so that it will only be evaluated once. */ + /* The tcc_reference and tcc_comparison classes could be handled as + below, but it is generally faster to only evaluate them once. */ + else if (TREE_SIDE_EFFECTS (e) || force) + return save_expr (e); + else + return e; + break; + + case tcc_binary: + /* Recursively stabilize each operand. */ + result + = build2 (code, type, + gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), force), + gnat_stabilize_reference_1 (TREE_OPERAND (e, 1), force)); + break; + + case tcc_unary: + /* Recursively stabilize each operand. */ + result + = build1 (code, type, + gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), force)); + break; + + default: + gcc_unreachable (); + } + + /* See similar handling in gnat_stabilize_reference. */ + TREE_READONLY (result) = TREE_READONLY (e); + TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (e); + TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e); + + if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF) + TREE_THIS_NOTRAP (result) = TREE_THIS_NOTRAP (e); + + return result; + } + + /* This is equivalent to stabilize_reference in tree.c but we know how to + handle our own nodes and we take extra arguments. FORCE says whether to + force evaluation of everything. We set SUCCESS to true unless we walk + through something we don't know how to stabilize. */ + + tree + gnat_stabilize_reference (tree ref, bool force, bool *success) + { + tree type = TREE_TYPE (ref); + enum tree_code code = TREE_CODE (ref); + tree result; + + /* Assume we'll success unless proven otherwise. */ + if (success) + *success = true; + + switch (code) + { + case CONST_DECL: + case VAR_DECL: + case PARM_DECL: + case RESULT_DECL: + /* No action is needed in this case. */ + return ref; + + case ADDR_EXPR: + CASE_CONVERT: + case FLOAT_EXPR: + case FIX_TRUNC_EXPR: + case VIEW_CONVERT_EXPR: + result + = build1 (code, type, + gnat_stabilize_reference (TREE_OPERAND (ref, 0), force, + success)); + break; + + case INDIRECT_REF: + case UNCONSTRAINED_ARRAY_REF: + result = build1 (code, type, + gnat_stabilize_reference_1 (TREE_OPERAND (ref, 0), + force)); + break; + + case COMPONENT_REF: + result = build3 (COMPONENT_REF, type, + gnat_stabilize_reference (TREE_OPERAND (ref, 0), force, + success), + TREE_OPERAND (ref, 1), NULL_TREE); + break; + + case BIT_FIELD_REF: + result = build3 (BIT_FIELD_REF, type, + gnat_stabilize_reference (TREE_OPERAND (ref, 0), force, + success), + gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1), + force), + gnat_stabilize_reference_1 (TREE_OPERAND (ref, 2), + force)); + break; + + case ARRAY_REF: + case ARRAY_RANGE_REF: + result = build4 (code, type, + gnat_stabilize_reference (TREE_OPERAND (ref, 0), force, + success), + gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1), + force), + NULL_TREE, NULL_TREE); + break; + + case CALL_EXPR: + result = gnat_stabilize_reference_1 (ref, force); + break; + + case COMPOUND_EXPR: + result = build2 (COMPOUND_EXPR, type, + gnat_stabilize_reference (TREE_OPERAND (ref, 0), force, + success), + gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1), + force)); + break; + + case CONSTRUCTOR: + /* Constructors with 1 element are used extensively to formally + convert objects to special wrapping types. */ + if (TREE_CODE (type) == RECORD_TYPE + && VEC_length (constructor_elt, CONSTRUCTOR_ELTS (ref)) == 1) + { + tree index + = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ref), 0)->index; + tree value + = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ref), 0)->value; + result + = build_constructor_single (type, index, + gnat_stabilize_reference_1 (value, + force)); + } + else + { + if (success) + *success = false; + return ref; + } + break; + + case ERROR_MARK: + ref = error_mark_node; + + /* ... fall through to failure ... */ + + /* If arg isn't a kind of lvalue we recognize, make no change. + Caller should recognize the error for an invalid lvalue. */ + default: + if (success) + *success = false; + return ref; + } + + /* TREE_THIS_VOLATILE and TREE_SIDE_EFFECTS set on the initial expression + may not be sustained across some paths, such as the way via build1 for + INDIRECT_REF. We reset those flags here in the general case, which is + consistent with the GCC version of this routine. + + Special care should be taken regarding TREE_SIDE_EFFECTS, because some + paths introduce side-effects where there was none initially (e.g. if a + SAVE_EXPR is built) and we also want to keep track of that. */ + TREE_READONLY (result) = TREE_READONLY (ref); + TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (ref); + TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (ref); + + return result; + } diff -Nrcpad gcc-4.5.2/gcc/ada/get_scos.adb gcc-4.6.0/gcc/ada/get_scos.adb *** gcc-4.5.2/gcc/ada/get_scos.adb Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/get_scos.adb Thu Jun 17 07:42:04 2010 *************** procedure Get_SCOs is *** 54,60 **** -- value read. Data_Error is raised for overflow (value greater than -- Int'Last), or if the initial character is not a digit. ! procedure Get_Sloc_Range (Loc1, Loc2 : out Source_Location); -- Skips initial spaces, then reads a source location range in the form -- line:col-line:col and places the two source locations in Loc1 and Loc2. -- Raises Data_Error if format does not match this requirement. --- 54,65 ---- -- value read. Data_Error is raised for overflow (value greater than -- Int'Last), or if the initial character is not a digit. ! procedure Get_Source_Location (Loc : out Source_Location); ! -- Reads a source location in the form line:col and places the source ! -- location in Loc. Raises Data_Error if the format does not match this ! -- requirement. Note that initial spaces are not skipped. ! ! procedure Get_Source_Location_Range (Loc1, Loc2 : out Source_Location); -- Skips initial spaces, then reads a source location range in the form -- line:col-line:col and places the two source locations in Loc1 and Loc2. -- Raises Data_Error if format does not match this requirement. *************** procedure Get_SCOs is *** 129,159 **** raise Data_Error; end Get_Int; ! -------------------- ! -- Get_Sloc_Range -- ! -------------------- ! procedure Get_Sloc_Range (Loc1, Loc2 : out Source_Location) is pragma Unsuppress (Range_Check); - begin ! Skip_Spaces; ! ! Loc1.Line := Logical_Line_Number (Get_Int); ! Check (':'); ! Loc1.Col := Column_Number (Get_Int); ! ! Check ('-'); ! ! Loc2.Line := Logical_Line_Number (Get_Int); Check (':'); ! Loc2.Col := Column_Number (Get_Int); ! exception when Constraint_Error => raise Data_Error; ! end Get_Sloc_Range; -------------- -- Skip_EOL -- -------------- --- 134,165 ---- raise Data_Error; end Get_Int; ! ------------------------- ! -- Get_Source_Location -- ! ------------------------- ! procedure Get_Source_Location (Loc : out Source_Location) is pragma Unsuppress (Range_Check); begin ! Loc.Line := Logical_Line_Number (Get_Int); Check (':'); ! Loc.Col := Column_Number (Get_Int); exception when Constraint_Error => raise Data_Error; ! end Get_Source_Location; + ------------------------------- + -- Get_Source_Location_Range -- + ------------------------------- + + procedure Get_Source_Location_Range (Loc1, Loc2 : out Source_Location) is + begin + Skip_Spaces; + Get_Source_Location (Loc1); + Check ('-'); + Get_Source_Location (Loc2); + end Get_Source_Location_Range; -------------- -- Skip_EOL -- -------------- *************** begin *** 222,229 **** -- Scan out dependency number and file name declare ! Ptr : String_Ptr := new String (1 .. 32768); ! N : Integer; begin Skip_Spaces; --- 228,235 ---- -- Scan out dependency number and file name declare ! Ptr : String_Ptr := new String (1 .. 32768); ! N : Integer; begin Skip_Spaces; *************** begin *** 250,263 **** -- Statement entry ! when 'S' => declare Typ : Character; Key : Character; begin Skip_Spaces; ! Key := 'S'; loop Typ := Nextc; --- 256,286 ---- -- Statement entry ! when 'S' | 's' => declare Typ : Character; Key : Character; begin + -- If continuation, reset Last indication in last entry + -- stored for previous CS or cs line, and start with key + -- set to s for continuations. + + if C = 's' then + SCO_Table.Table (SCO_Table.Last).Last := False; + Key := 's'; + + -- CS case (first line, so start with key set to S) + + else + Key := 'S'; + end if; + + -- Initialize to scan items on one line + Skip_Spaces; ! ! -- Loop through items on one line loop Typ := Nextc; *************** begin *** 268,274 **** Skipc; end if; ! Get_Sloc_Range (Loc1, Loc2); Add_SCO (C1 => Key, --- 291,297 ---- Skipc; end if; ! Get_Source_Location_Range (Loc1, Loc2); Add_SCO (C1 => Key, *************** begin *** 287,346 **** when 'I' | 'E' | 'P' | 'W' | 'X' => Dtyp := C; Skip_Spaces; - C := Getc; ! -- Case of simple condition - if C = 'c' or else C = 't' or else C = 'f' then - Cond := C; - Get_Sloc_Range (Loc1, Loc2); Add_SCO (C1 => Dtyp, ! C2 => Cond, ! From => Loc1, ! To => Loc2, ! Last => True); ! -- Complex expression ! else ! Add_SCO (C1 => Dtyp, Last => False); ! -- Loop through terms in complex expression ! while C /= CR and then C /= LF loop ! if C = 'c' or else C = 't' or else C = 'f' then ! Cond := C; ! Skipc; ! Get_Sloc_Range (Loc1, Loc2); ! Add_SCO ! (C2 => Cond, ! From => Loc1, ! To => Loc2, ! Last => False); ! elsif C = '!' or else ! C = '^' or else ! C = '&' or else ! C = '|' ! then ! Skipc; ! Add_SCO (C1 => C, Last => False); ! elsif C = ' ' then ! Skip_Spaces; ! else ! raise Data_Error; ! end if; ! C := Nextc; ! end loop; ! -- Reset Last indication to True for last entry ! SCO_Table.Table (SCO_Table.Last).Last := True; ! end if; when others => raise Data_Error; --- 310,390 ---- when 'I' | 'E' | 'P' | 'W' | 'X' => Dtyp := C; Skip_Spaces; ! -- Output header ! ! declare ! Loc : Source_Location; ! C2v : Character; ! ! begin ! -- Acquire location information ! ! if Dtyp = 'X' then ! Loc := No_Source_Location; ! else ! Get_Source_Location (Loc); ! end if; ! ! -- C2 is a space except for pragmas where it is 'e' since ! -- clearly the pragma is enabled if it was written out. ! ! if C = 'P' then ! C2v := 'e'; ! else ! C2v := ' '; ! end if; Add_SCO (C1 => Dtyp, ! C2 => C2v, ! From => Loc, ! To => No_Source_Location, ! Last => False); ! end; ! -- Loop through terms in complex expression ! C := Nextc; ! while C /= CR and then C /= LF loop ! if C = 'c' or else C = 't' or else C = 'f' then ! Cond := C; ! Skipc; ! Get_Source_Location_Range (Loc1, Loc2); ! Add_SCO ! (C2 => Cond, ! From => Loc1, ! To => Loc2, ! Last => False); ! elsif C = '!' or else ! C = '&' or else ! C = '|' ! then ! Skipc; ! declare ! Loc : Source_Location; ! begin ! Get_Source_Location (Loc); ! Add_SCO (C1 => C, From => Loc, Last => False); ! end; ! elsif C = ' ' then ! Skip_Spaces; ! else ! raise Data_Error; ! end if; ! C := Nextc; ! end loop; ! -- Reset Last indication to True for last entry ! SCO_Table.Table (SCO_Table.Last).Last := True; ! -- No other SCO lines are possible when others => raise Data_Error; diff -Nrcpad gcc-4.5.2/gcc/ada/gmem.c gcc-4.6.0/gcc/ada/gmem.c *** gcc-4.5.2/gcc/ada/gmem.c Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/gmem.c Thu Jan 1 00:00:00 1970 *************** *** 1,217 **** - /**************************************************************************** - * * - * GNATMEM COMPONENTS * - * * - * G M E M * - * * - * C Implementation File * - * * - * Copyright (C) 2000-2009, 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. * - * * - * As a special exception under Section 7 of GPL version 3, you are granted * - * additional permissions described in the GCC Runtime Library Exception, * - * version 3.1, as published by the Free Software Foundation. * - * * - * You should have received a copy of the GNU General Public License and * - * a copy of the GCC Runtime Library Exception along with this program; * - * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see * - * . * - * * - * GNAT was originally developed by the GNAT team at New York University. * - * Extensive contributions were provided by Ada Core Technologies Inc. * - * * - ****************************************************************************/ - - /* This unit reads the allocation tracking log produced by augmented - __gnat_malloc and __gnat_free procedures (see file memtrack.adb) and - provides GNATMEM tool with gdb-compliant output. The output is - processed by GNATMEM to detect dynamic memory allocation errors. - - See GNATMEM section in GNAT User's Guide for more information. - - NOTE: This capability is currently supported on the following targets: - - DEC Unix - GNU/Linux x86 - Solaris (sparc and x86) (*) - Windows 98/95/NT (x86) - Alpha OpenVMS - - (*) on these targets, the compilation must be done with -funwind-tables to - be able to build the stack backtrace. - - */ - - #ifdef VMS - #include - #define xstrdup32(S) strcpy ((__char_ptr32) _malloc32 (strlen (S) + 1), S) - #else - #define xstrdup32(S) S - #endif - - #include - - static FILE *gmemfile; - - /* tb_len is the number of call level supported by this module */ - #define tb_len 200 - static void * tracebk [tb_len]; - static int cur_tb_len, cur_tb_pos; - - #define LOG_EOF '*' - #define LOG_ALLOC 'A' - #define LOG_DEALL 'D' - - struct struct_storage_elmt { - char Elmt; - void * Address; - size_t Size; - long long Timestamp; - }; - - static void - __gnat_convert_addresses (void *addrs[], int n_addrs, void *buf, int *len); - /* Place in BUF a string representing the symbolic translation of N_ADDRS raw - addresses provided in ADDRS. LEN is filled with the result length. - - This is a GNAT specific interface to the libaddr2line convert_addresses - routine. The latter examines debug info from a provided executable file - name to perform the translation into symbolic form of an input sequence of - raw binary addresses. It attempts to open the file from the provided name - "as is", so an absolute path must be provided to ensure the file is - always found. We compute this name once, at initialization time. */ - - static const char * exename = 0; - - extern void convert_addresses (const char * , void *[], int, void *, int *); - extern char *__gnat_locate_exec_on_path (char *); - /* ??? Both of these extern functions are prototyped in adaint.h, which - also refers to "time_t" hence needs complex extra header inclusions to - be satisfied on every target. */ - - static void - __gnat_convert_addresses (void *addrs[], int n_addrs, void *buf, int *len) - { - if (exename != 0) - convert_addresses (exename, addrs, n_addrs, buf, len); - else - *len = 0; - } - - /* reads backtrace information from gmemfile placing them in tracebk - array. cur_tb_len is the size of this array - */ - - static void - gmem_read_backtrace (void) - { - fread (&cur_tb_len, sizeof (int), 1, gmemfile); - fread (tracebk, sizeof (void *), cur_tb_len, gmemfile); - cur_tb_pos = 0; - } - - /* initialize gmem feature from the dumpname file. It returns t0 timestamp - if the dumpname has been generated by GMEM (instrumented malloc/free) - and 0 if not. - */ - - long long __gnat_gmem_initialize (char *dumpname) - { - char header [10]; - long long t0; - - gmemfile = fopen (dumpname, "rb"); - fread (header, 10, 1, gmemfile); - - /* check for GMEM magic-tag */ - if (memcmp (header, "GMEM DUMP\n", 10)) - { - fclose (gmemfile); - return 0; - } - - fread (&t0, sizeof (long long), 1, gmemfile); - - return t0; - } - - /* initialize addr2line library */ - - void __gnat_gmem_a2l_initialize (char *exearg) - { - /* Resolve the executable filename to use in later invocations of - 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 - write an alloc/free information in buf to be processed by gnatmem */ - - void - __gnat_gmem_read_next (struct struct_storage_elmt *buf) - { - void *addr; - size_t size; - int j; - - j = fgetc (gmemfile); - if (j == EOF) - { - fclose (gmemfile); - buf->Elmt = LOG_EOF; - } - else - { - switch (j) - { - case 'A' : - buf->Elmt = LOG_ALLOC; - fread (&(buf->Address), sizeof (void *), 1, gmemfile); - fread (&(buf->Size), sizeof (size_t), 1, gmemfile); - fread (&(buf->Timestamp), sizeof (long long), 1, gmemfile); - break; - case 'D' : - buf->Elmt = LOG_DEALL; - fread (&(buf->Address), sizeof (void *), 1, gmemfile); - fread (&(buf->Timestamp), sizeof (long long), 1, gmemfile); - break; - default: - puts ("GNATMEM dump file corrupt"); - __gnat_os_exit (1); - } - - gmem_read_backtrace (); - } - } - - /* Read the next frame from the current traceback, and move the cursor to the - next frame */ - - void __gnat_gmem_read_next_frame (void** addr) - { - if (cur_tb_pos >= cur_tb_len) { - *addr = NULL; - } else { - *addr = (void*)*(tracebk + cur_tb_pos); - ++cur_tb_pos; - } - } - - /* Converts addr into a symbolic traceback, and stores the result in buf - with a format suitable for gnatmem */ - - void __gnat_gmem_symbolic (void * addr, char* buf, int* length) - { - void * addresses [] = { addr }; - - __gnat_convert_addresses (addresses, 1, buf, length); - } --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gnat-style.texi gcc-4.6.0/gcc/ada/gnat-style.texi *** gcc-4.5.2/gcc/ada/gnat-style.texi Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/gnat-style.texi Sun Jun 13 14:36:24 2010 *************** *** 17,23 **** Copyright @copyright{} 1992-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 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts and with no Back-Cover Texts. A copy of the license is included in the section entitled --- 17,23 ---- Copyright @copyright{} 1992-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.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts and with no Back-Cover Texts. A copy of the license is included in the section entitled diff -Nrcpad gcc-4.5.2/gcc/ada/gnat1drv.adb gcc-4.6.0/gcc/ada/gnat1drv.adb *** gcc-4.5.2/gcc/ada/gnat1drv.adb Tue Dec 1 09:52:51 2009 --- gcc-4.6.0/gcc/ada/gnat1drv.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Csets; use Csets; *** 30,35 **** --- 30,36 ---- with Debug; use Debug; with Elists; with Errout; use Errout; + with Exp_CG; with Fmap; with Fname; use Fname; with Fname.UF; use Fname.UF; *************** with Par_SCO; *** 49,54 **** --- 50,56 ---- with Prepcomp; with Repinfo; use Repinfo; with Restrict; + with Rident; use Rident; with Rtsfind; with SCOs; with Sem; *************** procedure Gnat1drv is *** 121,126 **** --- 123,135 ---- Generate_SCIL := True; end if; + -- Disable CodePeer_Mode in Check_Syntax, since we need front-end + -- expansion. + + if Operating_Mode = Check_Syntax then + CodePeer_Mode := False; + end if; + -- Set ASIS mode if -gnatt and -gnatc are set if Operating_Mode = Check_Semantics and then Tree_Output then *************** procedure Gnat1drv is *** 134,143 **** Inline_Active := False; ! -- Turn off SCIL generation in ASIS mode, since SCIL requires front- ! -- end expansion. Generate_SCIL := False; end if; -- SCIL mode needs to disable front-end inlining since the generated --- 143,153 ---- Inline_Active := False; ! -- Turn off SCIL generation and CodePeer mode in semantics mode, ! -- since SCIL requires front-end expansion. Generate_SCIL := False; + CodePeer_Mode := False; end if; -- SCIL mode needs to disable front-end inlining since the generated *************** procedure Gnat1drv is *** 149,155 **** Front_End_Inlining := False; end if; ! -- Tune settings for optimal SCIL generation in CodePeer_Mode if CodePeer_Mode then --- 159,165 ---- Front_End_Inlining := False; end if; ! -- Tune settings for optimal SCIL generation in CodePeer mode if CodePeer_Mode then *************** procedure Gnat1drv is *** 158,179 **** Front_End_Inlining := False; Inline_Active := False; - -- Turn off ASIS mode: incompatible with front-end expansion - - ASIS_Mode := False; - -- Disable front-end optimizations, to keep the tree as close to the -- source code as possible, and also to avoid inconsistencies between -- trees when using different optimization switches. Optimization_Level := 0; ! -- Disable specific expansions for Restrictions pragmas to avoid ! -- tree inconsistencies between compilations with different pragmas ! -- that will cause different SCIL files to be generated for the ! -- same Ada spec. ! Treat_Restrictions_As_Warnings := True; -- Suppress overflow, division by zero and access checks since they -- are handled implicitly by CodePeer. --- 168,190 ---- Front_End_Inlining := False; Inline_Active := False; -- Disable front-end optimizations, to keep the tree as close to the -- source code as possible, and also to avoid inconsistencies between -- trees when using different optimization switches. Optimization_Level := 0; ! -- Enable some restrictions systematically to simplify the generated ! -- code (and ease analysis). Note that restriction checks are also ! -- disabled in CodePeer mode, see Restrict.Check_Restriction, and ! -- user specified Restrictions pragmas are ignored, see ! -- Sem_Prag.Process_Restrictions_Or_Restriction_Warnings. ! Restrict.Restrictions.Set (No_Initialize_Scalars) := True; ! Restrict.Restrictions.Set (No_Task_Hierarchy) := True; ! Restrict.Restrictions.Set (No_Abort_Statements) := True; ! Restrict.Restrictions.Set (Max_Asynchronous_Select_Nesting) := True; ! Restrict.Restrictions.Value (Max_Asynchronous_Select_Nesting) := 0; -- Suppress overflow, division by zero and access checks since they -- are handled implicitly by CodePeer. *************** procedure Gnat1drv is *** 201,207 **** Debug_Generated_Code := False; ! -- Turn cross-referencing on in case it was disabled (by e.g. -gnatD) -- Do we really need to spend time generating xref in CodePeer -- mode??? Consider setting Xref_Active to False. --- 212,218 ---- Debug_Generated_Code := False; ! -- Turn cross-referencing on in case it was disabled (e.g. by -gnatD) -- Do we really need to spend time generating xref in CodePeer -- mode??? Consider setting Xref_Active to False. *************** procedure Gnat1drv is *** 211,218 **** Polling_Required := False; ! -- Set operating mode to Generate_Code to benefit from full ! -- front-end expansion (e.g. generics). Operating_Mode := Generate_Code; --- 222,229 ---- Polling_Required := False; ! -- Set operating mode to Generate_Code to benefit from full front-end ! -- expansion (e.g. generics). Operating_Mode := Generate_Code; *************** procedure Gnat1drv is *** 223,239 **** -- Enable assertions and debug pragmas, since they give CodePeer -- valuable extra information. ! Assertions_Enabled := True; ! Debug_Pragmas_Enabled := True; ! -- Suppress compiler warnings, since what we are interested in here ! -- is what CodePeer can find out. Also disable all simple value ! -- propagation. This is an optimization which is valuable for code ! -- optimization, and also for generation of compiler warnings, but ! -- these are being turned off anyway, and CodePeer understands ! -- things more clearly if references are not optimized in this way. - Warning_Mode := Suppress; Debug_Flag_MM := True; -- Set normal RM validity checking, and checking of IN OUT parameters --- 234,248 ---- -- Enable assertions and debug pragmas, since they give CodePeer -- valuable extra information. ! Assertions_Enabled := True; ! Debug_Pragmas_Enabled := True; ! -- Disable all simple value propagation. This is an optimization ! -- which is valuable for code optimization, and also for generation ! -- of compiler warnings, but these are being turned off by default, ! -- and CodePeer generates better messages (referencing original ! -- variables) this way. Debug_Flag_MM := True; -- Set normal RM validity checking, and checking of IN OUT parameters *************** procedure Gnat1drv is *** 251,256 **** --- 260,271 ---- -- front-end warnings when we are getting CodePeer output. Reset_Style_Check_Options; + + -- Always perform semantics and generate ali files in CodePeer mode, + -- so that a gnatmake -c -k will proceed further when possible. + + Force_ALI_Tree_File := True; + Try_Semantics := True; end if; -- Set Configurable_Run_Time mode if system.ads flag set *************** procedure Gnat1drv is *** 306,312 **** Targparm.Frontend_Layout_On_Target := True; end if; ! -- Set and check exception mechnism if Targparm.ZCX_By_Default_On_Target then if Targparm.GCC_ZCX_Support_On_Target then --- 321,327 ---- Targparm.Frontend_Layout_On_Target := True; end if; ! -- Set and check exception mechanism if Targparm.ZCX_By_Default_On_Target then if Targparm.GCC_ZCX_Support_On_Target then *************** procedure Gnat1drv is *** 316,325 **** end if; end if; ! -- Set proper status for overflow checks. We turn on overflow checks ! -- if -gnatp was not specified, and either -gnato is set or the back ! -- end takes care of overflow checks. Otherwise we suppress overflow ! -- checks by default (since front end checks are expensive). if not Opt.Suppress_Checks and then (Opt.Enable_Overflow_Checks --- 331,340 ---- end if; end if; ! -- Set proper status for overflow checks. We turn on overflow checks if ! -- -gnatp was not specified, and either -gnato is set or the back-end ! -- takes care of overflow checks. Otherwise we suppress overflow checks ! -- by default (since front end checks are expensive). if not Opt.Suppress_Checks and then (Opt.Enable_Overflow_Checks *************** procedure Gnat1drv is *** 332,337 **** --- 347,394 ---- else Suppress_Options (Overflow_Check) := True; end if; + + -- Set switch indicating if we can use N_Expression_With_Actions + + -- Debug flag -gnatd.X decisively sets usage on + + if Debug_Flag_Dot_XX then + Use_Expression_With_Actions := True; + + -- Debug flag -gnatd.Y decisively sets usage off + + elsif Debug_Flag_Dot_YY then + Use_Expression_With_Actions := False; + + -- Otherwise this feature is implemented, so we allow its use + + else + Use_Expression_With_Actions := True; + end if; + + -- Set switch indicating if back end can handle limited types, and + -- guarantee that no incorrect copies are made (e.g. in the context + -- of a conditional expression). + + -- Debug flag -gnatd.L decisively sets usage on + + if Debug_Flag_Dot_LL then + Back_End_Handles_Limited_Types := True; + + -- If no debug flag, usage off for AAMP, VM, SCIL cases + + elsif AAMP_On_Target + or else VM_Target /= No_VM + or else Generate_SCIL + then + Back_End_Handles_Limited_Types := False; + + -- Otherwise normal gcc back end, for now still turn flag off by + -- default, since there are unresolved problems in the front end. + + else + Back_End_Handles_Limited_Types := False; + end if; end Adjust_Global_Switches; -------------------- *************** procedure Gnat1drv is *** 357,363 **** Error_Msg_N ("remove incorrect body in file{!", Main_Unit_Node); end Bad_Body_Error; ! -- Start of processing for Check_Bad_Body begin -- Nothing to do if we are only checking syntax, because we don't know --- 414,420 ---- Error_Msg_N ("remove incorrect body in file{!", Main_Unit_Node); end Bad_Body_Error; ! -- Start of processing for Check_Bad_Body begin -- Nothing to do if we are only checking syntax, because we don't know *************** procedure Gnat1drv is *** 381,387 **** Sname := Unit_Name (Main_Unit); -- If we do not already have a body name, then get the body name ! -- (but how can we have a body name here ???) if not Is_Body_Name (Sname) then Sname := Get_Body_Name (Sname); --- 438,444 ---- Sname := Unit_Name (Main_Unit); -- If we do not already have a body name, then get the body name ! -- (but how can we have a body name here???) if not Is_Body_Name (Sname) then Sname := Get_Body_Name (Sname); *************** procedure Gnat1drv is *** 390,409 **** Fname := Get_File_Name (Sname, Subunit => False); Src_Ind := Load_Source_File (Fname); ! -- Case where body is present and it is not a subunit. Exclude ! -- the subunit case, because it has nothing to do with the ! -- package we are compiling. It is illegal for a child unit and a ! -- subunit with the same expanded name (RM 10.2(9)) to appear ! -- together in a partition, but there is nothing to stop a ! -- compilation environment from having both, and the test here ! -- simply allows that. If there is an attempt to include both in ! -- a partition, this is diagnosed at bind time. In Ada 83 mode ! -- this is not a warning case. ! -- Note: if weird file names are being used, we can have ! -- situation where the file name that supposedly contains body, ! -- in fact contains a spec, or we can't tell what it contains. ! -- Skip the error message in these cases. -- Also ignore body that is nothing but pragma No_Body; (that's the -- whole point of this pragma, to be used this way and to cause the --- 447,465 ---- Fname := Get_File_Name (Sname, Subunit => False); Src_Ind := Load_Source_File (Fname); ! -- Case where body is present and it is not a subunit. Exclude the ! -- subunit case, because it has nothing to do with the package we are ! -- compiling. It is illegal for a child unit and a subunit with the ! -- same expanded name (RM 10.2(9)) to appear together in a partition, ! -- but there is nothing to stop a compilation environment from having ! -- both, and the test here simply allows that. If there is an attempt ! -- to include both in a partition, this is diagnosed at bind time. In ! -- Ada 83 mode this is not a warning case. ! -- Note: if weird file names are being used, we can have a situation ! -- where the file name that supposedly contains body in fact contains ! -- a spec, or we can't tell what it contains. Skip the error message ! -- in these cases. -- Also ignore body that is nothing but pragma No_Body; (that's the -- whole point of this pragma, to be used this way and to cause the *************** begin *** 549,559 **** Nlists.Initialize; Sinput.Initialize; Sem.Initialize; Csets.Initialize; Uintp.Initialize; Urealp.Initialize; Errout.Initialize; - Namet.Initialize; SCOs.Initialize; Snames.Initialize; Stringt.Initialize; --- 605,615 ---- Nlists.Initialize; Sinput.Initialize; Sem.Initialize; + Exp_CG.Initialize; Csets.Initialize; Uintp.Initialize; Urealp.Initialize; Errout.Initialize; SCOs.Initialize; Snames.Initialize; Stringt.Initialize; *************** begin *** 583,590 **** if S = No_Source_File then Write_Line ("fatal error, run-time library not installed correctly"); ! Write_Line ! ("cannot locate file system.ads"); raise Unrecoverable_Error; -- Remember source index of system.ads (which was read successfully) --- 639,645 ---- if S = No_Source_File then Write_Line ("fatal error, run-time library not installed correctly"); ! Write_Line ("cannot locate file system.ads"); raise Unrecoverable_Error; -- Remember source index of system.ads (which was read successfully) *************** begin *** 615,623 **** Write_Str ("GNAT "); Write_Str (Gnat_Version_String); Write_Eol; ! Write_Str ("Copyright 1992-" & ! Current_Year & ! ", Free Software Foundation, Inc."); Write_Eol; end if; --- 670,677 ---- Write_Str ("GNAT "); Write_Str (Gnat_Version_String); Write_Eol; ! Write_Str ("Copyright 1992-" & Current_Year ! & ", Free Software Foundation, Inc."); Write_Eol; end if; *************** begin *** 657,662 **** --- 711,717 ---- Treepr.Tree_Dump; Sem_Ch13.Validate_Unchecked_Conversions; Sem_Ch13.Validate_Address_Clauses; + Sem_Ch13.Validate_Independence; Errout.Output_Messages; Namet.Finalize; *************** begin *** 677,685 **** Set_Generate_Code (Main_Unit); ! -- If we have a corresponding spec, and it comes from source ! -- or it is not a generated spec for a child subprogram body, ! -- then we need object code for the spec unit as well. if Nkind (Unit (Main_Unit_Node)) in N_Unit_Body and then not Acts_As_Spec (Main_Unit_Node) --- 732,740 ---- Set_Generate_Code (Main_Unit); ! -- If we have a corresponding spec, and it comes from source or it is ! -- not a generated spec for a child subprogram body, then we need object ! -- code for the spec unit as well. if Nkind (Unit (Main_Unit_Node)) in N_Unit_Body and then not Acts_As_Spec (Main_Unit_Node) *************** begin *** 713,720 **** Back_End_Mode := Declarations_Only; -- All remaining cases are cases in which the user requested that code ! -- be generated (i.e. no -gnatc or -gnats switch was used). Check if ! -- we can in fact satisfy this request. -- Cannot generate code if someone has turned off code generation for -- any reason at all. We will try to figure out a reason below. --- 768,775 ---- Back_End_Mode := Declarations_Only; -- All remaining cases are cases in which the user requested that code ! -- be generated (i.e. no -gnatc or -gnats switch was used). Check if we ! -- can in fact satisfy this request. -- Cannot generate code if someone has turned off code generation for -- any reason at all. We will try to figure out a reason below. *************** begin *** 726,751 **** -- subunits. Note that we always generate code for all generic units (a -- change from some previous versions of GNAT). ! elsif Main_Kind = N_Subprogram_Body ! and then not Subunits_Missing ! then Back_End_Mode := Generate_Object; -- We can generate code for a package body unless there are subunits -- missing (note that we always generate code for generic units, which -- is a change from some earlier versions of GNAT). ! elsif Main_Kind = N_Package_Body ! and then not Subunits_Missing ! then Back_End_Mode := Generate_Object; -- We can generate code for a package declaration or a subprogram -- declaration only if it does not required a body. ! elsif (Main_Kind = N_Package_Declaration ! or else ! Main_Kind = N_Subprogram_Declaration) and then (not Body_Required (Main_Unit_Node) or else --- 781,802 ---- -- subunits. Note that we always generate code for all generic units (a -- change from some previous versions of GNAT). ! elsif Main_Kind = N_Subprogram_Body and then not Subunits_Missing then Back_End_Mode := Generate_Object; -- We can generate code for a package body unless there are subunits -- missing (note that we always generate code for generic units, which -- is a change from some earlier versions of GNAT). ! elsif Main_Kind = N_Package_Body and then not Subunits_Missing then Back_End_Mode := Generate_Object; -- We can generate code for a package declaration or a subprogram -- declaration only if it does not required a body. ! elsif Nkind_In (Main_Kind, ! N_Package_Declaration, ! N_Subprogram_Declaration) and then (not Body_Required (Main_Unit_Node) or else *************** begin *** 756,773 **** -- We can generate code for a generic package declaration of a generic -- subprogram declaration only if does not require a body. ! elsif (Main_Kind = N_Generic_Package_Declaration ! or else ! Main_Kind = N_Generic_Subprogram_Declaration) and then not Body_Required (Main_Unit_Node) then Back_End_Mode := Generate_Object; ! -- Compilation units that are renamings do not require bodies, ! -- so we can generate code for them. ! elsif Main_Kind = N_Package_Renaming_Declaration ! or else Main_Kind = N_Subprogram_Renaming_Declaration then Back_End_Mode := Generate_Object; --- 807,823 ---- -- We can generate code for a generic package declaration of a generic -- subprogram declaration only if does not require a body. ! elsif Nkind_In (Main_Kind, N_Generic_Package_Declaration, ! N_Generic_Subprogram_Declaration) and then not Body_Required (Main_Unit_Node) then Back_End_Mode := Generate_Object; ! -- Compilation units that are renamings do not require bodies, so we can ! -- generate code for them. ! elsif Nkind_In (Main_Kind, N_Package_Renaming_Declaration, ! N_Subprogram_Renaming_Declaration) then Back_End_Mode := Generate_Object; *************** begin *** 812,862 **** if Subunits_Missing then Write_Str (" (missing subunits)"); Write_Eol; ! Write_Str ("to check parent unit"); elsif Main_Kind = N_Subunit then Write_Str (" (subunit)"); Write_Eol; ! Write_Str ("to check subunit"); elsif Main_Kind = N_Subprogram_Declaration then Write_Str (" (subprogram spec)"); Write_Eol; - Write_Str ("to check subprogram spec"); -- Generic package body in GNAT implementation mode elsif Main_Kind = N_Package_Body and then GNAT_Mode then Write_Str (" (predefined generic)"); Write_Eol; ! Write_Str ("to check predefined generic"); -- Only other case is a package spec else Write_Str (" (package spec)"); Write_Eol; - Write_Str ("to check package spec"); - end if; - - Write_Str (" for errors, use "); - - if Hostparm.OpenVMS then - Write_Str ("/NOLOAD"); - else - Write_Str ("-gnatc"); end if; - Write_Eol; Set_Standard_Output; Sem_Ch13.Validate_Unchecked_Conversions; Sem_Ch13.Validate_Address_Clauses; Errout.Finalize (Last_Call => True); Errout.Output_Messages; Treepr.Tree_Dump; Tree_Gen; ! Write_ALI (Object => False); Namet.Finalize; Check_Rep_Info; --- 862,918 ---- if Subunits_Missing then Write_Str (" (missing subunits)"); Write_Eol; ! ! -- Force generation of ALI file, for backward compatibility ! ! Opt.Force_ALI_Tree_File := True; elsif Main_Kind = N_Subunit then Write_Str (" (subunit)"); Write_Eol; ! ! -- Force generation of ALI file, for backward compatibility ! ! Opt.Force_ALI_Tree_File := True; elsif Main_Kind = N_Subprogram_Declaration then Write_Str (" (subprogram spec)"); Write_Eol; -- Generic package body in GNAT implementation mode elsif Main_Kind = N_Package_Body and then GNAT_Mode then Write_Str (" (predefined generic)"); Write_Eol; ! ! -- Force generation of ALI file, for backward compatibility ! ! Opt.Force_ALI_Tree_File := True; -- Only other case is a package spec else Write_Str (" (package spec)"); Write_Eol; end if; Set_Standard_Output; Sem_Ch13.Validate_Unchecked_Conversions; Sem_Ch13.Validate_Address_Clauses; + Sem_Ch13.Validate_Independence; Errout.Finalize (Last_Call => True); Errout.Output_Messages; Treepr.Tree_Dump; Tree_Gen; ! ! -- Generate ALI file if specially requested, or for missing subunits, ! -- subunits or predefined generic. ! ! if Opt.Force_ALI_Tree_File then ! Write_ALI (Object => False); ! end if; ! Namet.Finalize; Check_Rep_Info; *************** begin *** 865,872 **** Exit_Program (E_No_Code); end if; ! -- In -gnatc mode, we only do annotation if -gnatt or -gnatR is also ! -- set as indicated by Back_Annotate_Rep_Info being set to True. -- We don't call for annotations on a subunit, because to process those -- the back-end requires that the parent(s) be properly compiled. --- 921,928 ---- Exit_Program (E_No_Code); end if; ! -- In -gnatc mode, we only do annotation if -gnatt or -gnatR is also set ! -- as indicated by Back_Annotate_Rep_Info being set to True. -- We don't call for annotations on a subunit, because to process those -- the back-end requires that the parent(s) be properly compiled. *************** begin *** 874,881 **** -- Annotation is suppressed for targets where front-end layout is -- enabled, because the front end determines representations. ! -- Annotation is also suppressed in the case of compiling for ! -- a VM, since representations are largely symbolic there. if Back_End_Mode = Declarations_Only and then (not (Back_Annotate_Rep_Info or Generate_SCIL) --- 930,937 ---- -- Annotation is suppressed for targets where front-end layout is -- enabled, because the front end determines representations. ! -- Annotation is also suppressed in the case of compiling for a VM, ! -- since representations are largely symbolic there. if Back_End_Mode = Declarations_Only and then (not (Back_Annotate_Rep_Info or Generate_SCIL) *************** begin *** 885,890 **** --- 941,947 ---- then Sem_Ch13.Validate_Unchecked_Conversions; Sem_Ch13.Validate_Address_Clauses; + Sem_Ch13.Validate_Independence; Errout.Finalize (Last_Call => True); Errout.Output_Messages; Write_ALI (Object => False); *************** begin *** 938,943 **** --- 995,1004 ---- Namet.Unlock; + -- Generate the call-graph output of dispatching calls + + Exp_CG.Generate_CG_Output; + -- Validate unchecked conversions (using the values for size and -- alignment annotated by the backend where possible). *************** begin *** 948,953 **** --- 1009,1019 ---- Sem_Ch13.Validate_Address_Clauses; + -- Validate independence pragmas (again using values annotated by + -- the back end for component layout etc.) + + Sem_Ch13.Validate_Independence; + -- Now we complete output of errors, rep info and the tree info. These -- are delayed till now, since it is perfectly possible for gigi to -- generate errors, modify the tree (in particular by setting flags *************** begin *** 969,979 **** Write_ALI (Object => (Back_End_Mode = Generate_Object)); ! -- Generate the ASIS tree after writing the ALI file, since in ASIS ! -- mode, Write_ALI may in fact result in further tree decoration from ! -- the original tree file. Note that we dump the tree just before ! -- generating it, so that the dump will exactly reflect what is written ! -- out. Treepr.Tree_Dump; Tree_Gen; --- 1035,1044 ---- Write_ALI (Object => (Back_End_Mode = Generate_Object)); ! -- Generate ASIS tree after writing the ALI file, since in ASIS mode, ! -- Write_ALI may in fact result in further tree decoration from the ! -- original tree file. Note that we dump the tree just before generating ! -- it, so that the dump will exactly reflect what is written out. Treepr.Tree_Dump; Tree_Gen; diff -Nrcpad gcc-4.5.2/gcc/ada/gnat_rm.texi gcc-4.6.0/gcc/ada/gnat_rm.texi *** gcc-4.5.2/gcc/ada/gnat_rm.texi Thu Jan 28 10:10:58 2010 --- gcc-4.6.0/gcc/ada/gnat_rm.texi Mon Dec 20 07:26:57 2010 *************** *** 18,24 **** 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 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being ``GNAT Reference Manual'', and with no Back-Cover Texts. A copy of the license is --- 18,24 ---- 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.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being ``GNAT Reference Manual'', and with no Back-Cover Texts. A copy of the license is *************** AdaCore *** 81,87 **** * Interfacing to Other Languages:: * Specialized Needs Annexes:: * Implementation of Specific Ada Features:: ! * Project File Reference:: * Obsolescent Features:: * GNU Free Documentation License:: * Index:: --- 81,87 ---- * Interfacing to Other Languages:: * Specialized Needs Annexes:: * Implementation of Specific Ada Features:: ! * Implementation of Ada 2012 Features:: * Obsolescent Features:: * GNU Free Documentation License:: * Index:: *************** Implementation Defined Pragmas *** 100,105 **** --- 100,107 ---- * Pragma Ada_95:: * Pragma Ada_05:: * Pragma Ada_2005:: + * Pragma Ada_12:: + * Pragma Ada_2012:: * Pragma Annotate:: * Pragma Assert:: * Pragma Assume_No_Invalid_Values:: *************** Implementation Defined Pragmas *** 133,138 **** --- 135,141 ---- * Pragma Export_Value:: * Pragma Export_Valued_Procedure:: * Pragma Extend_System:: + * Pragma Extensions_Allowed:: * Pragma External:: * Pragma External_Name_Casing:: * Pragma Fast_Math:: *************** Implementation Defined Pragmas *** 140,146 **** * Pragma Finalize_Storage_Only:: * Pragma Float_Representation:: * Pragma Ident:: ! * Pragma Implemented_By_Entry:: * Pragma Implicit_Packing:: * Pragma Import_Exception:: * Pragma Import_Function:: --- 143,149 ---- * Pragma Finalize_Storage_Only:: * Pragma Float_Representation:: * Pragma Ident:: ! * Pragma Implemented:: * Pragma Implicit_Packing:: * Pragma Import_Exception:: * Pragma Import_Function:: *************** Implementation Defined Pragmas *** 154,159 **** --- 157,163 ---- * Pragma Interface_Name:: * Pragma Interrupt_Handler:: * Pragma Interrupt_State:: + * Pragma Invariant:: * Pragma Keep_Names:: * Pragma License:: * Pragma Link_With:: *************** Implementation Defined Pragmas *** 171,176 **** --- 175,181 ---- * Pragma Normalize_Scalars:: * Pragma Obsolescent:: * Pragma Optimize_Alignment:: + * Pragma Ordered:: * Pragma Passive:: * Pragma Persistent_BSS:: * Pragma Polling:: *************** Implementation Defined Pragmas *** 183,188 **** --- 188,194 ---- * Pragma Restriction_Warnings:: * Pragma Shared:: * Pragma Short_Circuit_And_Or:: + * Pragma Short_Descriptors:: * Pragma Source_File_Name:: * Pragma Source_File_Name_Project:: * Pragma Source_Reference:: *************** The GNAT Library *** 364,369 **** --- 370,377 ---- * GNAT.IO (g-io.ads):: * GNAT.IO_Aux (g-io_aux.ads):: * GNAT.Lock_Files (g-locfil.ads):: + * GNAT.MBBS_Discrete_Random (g-mbdira.ads):: + * GNAT.MBBS_Float_Random (g-mbflra.ads):: * GNAT.MD5 (g-md5.ads):: * GNAT.Memory_Dump (g-memdum.ads):: * GNAT.Most_Recent_Exception (g-moreex.ads):: *************** Implementation of Specific Ada Features *** 463,469 **** * The Size of Discriminated Records with Default Discriminants:: * Strict Conformance to the Ada Reference Manual:: ! Project File Reference Obsolescent Features --- 471,477 ---- * The Size of Discriminated Records with Default Discriminants:: * Strict Conformance to the Ada Reference Manual:: ! Implementation of Ada 2012 Features Obsolescent Features *************** to GNAT's implementation of machine code *** 582,589 **** other features. @item ! @ref{Project File Reference}, presents the syntax and semantics ! of project files. @item @ref{Obsolescent Features} documents implementation dependent features, --- 590,597 ---- other features. @item ! @ref{Implementation of Ada 2012 Features}, describes the status of the ! GNAT implementation of the Ada 2012 language standard. @item @ref{Obsolescent Features} documents implementation dependent features, *************** consideration, the use of these pragmas *** 717,722 **** --- 725,732 ---- * Pragma Ada_95:: * Pragma Ada_05:: * Pragma Ada_2005:: + * Pragma Ada_12:: + * Pragma Ada_2012:: * Pragma Annotate:: * Pragma Assert:: * Pragma Assume_No_Invalid_Values:: *************** consideration, the use of these pragmas *** 750,755 **** --- 760,766 ---- * Pragma Export_Value:: * Pragma Export_Valued_Procedure:: * Pragma Extend_System:: + * Pragma Extensions_Allowed:: * Pragma External:: * Pragma External_Name_Casing:: * Pragma Fast_Math:: *************** consideration, the use of these pragmas *** 757,763 **** * Pragma Finalize_Storage_Only:: * Pragma Float_Representation:: * Pragma Ident:: ! * Pragma Implemented_By_Entry:: * Pragma Implicit_Packing:: * Pragma Import_Exception:: * Pragma Import_Function:: --- 768,774 ---- * Pragma Finalize_Storage_Only:: * Pragma Float_Representation:: * Pragma Ident:: ! * Pragma Implemented:: * Pragma Implicit_Packing:: * Pragma Import_Exception:: * Pragma Import_Function:: *************** consideration, the use of these pragmas *** 771,776 **** --- 782,788 ---- * Pragma Interface_Name:: * Pragma Interrupt_Handler:: * Pragma Interrupt_State:: + * Pragma Invariant:: * Pragma Keep_Names:: * Pragma License:: * Pragma Link_With:: *************** consideration, the use of these pragmas *** 788,793 **** --- 800,806 ---- * Pragma Normalize_Scalars:: * Pragma Obsolescent:: * Pragma Optimize_Alignment:: + * Pragma Ordered:: * Pragma Passive:: * Pragma Persistent_BSS:: * Pragma Polling:: *************** consideration, the use of these pragmas *** 800,805 **** --- 813,819 ---- * Pragma Restriction_Warnings:: * Pragma Shared:: * Pragma Short_Circuit_And_Or:: + * Pragma Short_Descriptors:: * Pragma Source_File_Name:: * Pragma Source_File_Name_Project:: * Pragma Source_Reference:: *************** pragma Ada_05; *** 908,916 **** @noindent A configuration pragma that establishes Ada 2005 mode for the unit to which it applies, regardless of the mode set by the command line switches. ! This mode is set automatically for the @code{Ada} and @code{System} ! packages and their children, so you need not specify it in these ! contexts. This pragma is useful when writing a reusable component that itself uses Ada 2005 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. --- 922,928 ---- @noindent A configuration pragma that establishes Ada 2005 mode for the unit to which it applies, regardless of the mode set by the command line switches. ! This pragma is useful when writing a reusable component that itself uses Ada 2005 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. *************** pragma Ada_2005; *** 927,932 **** --- 939,975 ---- This configuration pragma is a synonym for pragma Ada_05 and has the same syntax and effect. + @node Pragma Ada_12 + @unnumberedsec Pragma Ada_12 + @findex Ada_12 + @noindent + Syntax: + @smallexample @c ada + pragma Ada_12; + @end smallexample + + @noindent + A configuration pragma that establishes Ada 2012 mode for the unit to which + it applies, regardless of the mode set by the command line switches. + This mode is set automatically for the @code{Ada} and @code{System} + packages and their children, so you need not specify it in these + contexts. This pragma is useful when writing a reusable component that + itself uses Ada 2012 features, but which is intended to be usable from + Ada 83, Ada 95, or Ada 2005 programs. + + @node Pragma Ada_2012 + @unnumberedsec Pragma Ada_2012 + @findex Ada_2005 + @noindent + Syntax: + @smallexample @c ada + pragma Ada_2012; + @end smallexample + + @noindent + This configuration pragma is a synonym for pragma Ada_12 and has the + same syntax and effect. + @node Pragma Annotate @unnumberedsec Pragma Annotate @findex Annotate *************** pragma Convention_Identifier (Fortran77, *** 1510,1516 **** @noindent would allow the use of the convention identifier @code{Fortran77} in subsequent code, avoiding the need to modify the sources. As another ! example, you could use this to parametrize convention requirements according to systems. Suppose you needed to use @code{Stdcall} on windows systems, and @code{C} on some other system, then you could define a convention identifier @code{Library} and use a single --- 1553,1559 ---- @noindent would allow the use of the convention identifier @code{Fortran77} in subsequent code, avoiding the need to modify the sources. As another ! example, you could use this to parameterize convention requirements according to systems. Suppose you needed to use @code{Stdcall} on windows systems, and @code{C} on some other system, then you could define a convention identifier @code{Library} and use a single *************** gnat_ugn, @value{EDITION} User's Guide}. *** 1719,1842 **** Syntax: @smallexample @c ada ! pragma Eliminate ( ! [Unit_Name =>] IDENTIFIER | ! SELECTED_COMPONENT); ! ! pragma Eliminate ( ! [Unit_Name =>] IDENTIFIER | ! SELECTED_COMPONENT, ! [Entity =>] IDENTIFIER | ! SELECTED_COMPONENT | ! STRING_LITERAL ! [,OVERLOADING_RESOLUTION]); ! ! OVERLOADING_RESOLUTION ::= PARAMETER_AND_RESULT_TYPE_PROFILE | ! SOURCE_LOCATION ! PARAMETER_AND_RESULT_TYPE_PROFILE ::= PROCEDURE_PROFILE | ! FUNCTION_PROFILE ! PROCEDURE_PROFILE ::= Parameter_Types => PARAMETER_TYPES ! FUNCTION_PROFILE ::= [Parameter_Types => PARAMETER_TYPES,] ! Result_Type => result_SUBTYPE_NAME] ! PARAMETER_TYPES ::= (SUBTYPE_NAME @{, SUBTYPE_NAME@}) ! SUBTYPE_NAME ::= STRING_VALUE ! SOURCE_LOCATION ::= Source_Location => SOURCE_TRACE ! SOURCE_TRACE ::= STRING_VALUE ! STRING_VALUE ::= STRING_LITERAL @{& STRING_LITERAL@} @end smallexample @noindent ! This pragma indicates that the given entity is not used outside the ! compilation unit it is defined in. The entity must be an explicitly declared ! subprogram; this includes generic subprogram instances and ! subprograms declared in generic package instances. ! ! If the entity to be eliminated is a library level subprogram, then ! the first form of pragma @code{Eliminate} is used with only a single argument. ! In this form, the @code{Unit_Name} argument specifies the name of the ! library level unit to be eliminated. ! ! In all other cases, both @code{Unit_Name} and @code{Entity} arguments ! are required. If item is an entity of a library package, then the first ! argument specifies the unit name, and the second argument specifies ! the particular entity. If the second argument is in string form, it must ! correspond to the internal manner in which GNAT stores entity names (see ! compilation unit Namet in the compiler sources for details). ! ! The remaining parameters (OVERLOADING_RESOLUTION) are optionally used ! to distinguish between overloaded subprograms. If a pragma does not contain ! the OVERLOADING_RESOLUTION parameter(s), it is applied to all the overloaded ! subprograms denoted by the first two parameters. ! ! Use PARAMETER_AND_RESULT_TYPE_PROFILE to specify the profile of the subprogram ! to be eliminated in a manner similar to that used for the extended ! @code{Import} and @code{Export} pragmas, except that the subtype names are ! always given as strings. At the moment, this form of distinguishing ! overloaded subprograms is implemented only partially, so we do not recommend ! using it for practical subprogram elimination. ! ! Note that in case of a parameterless procedure its profile is represented ! as @code{Parameter_Types => ("")} ! ! Alternatively, the @code{Source_Location} parameter is used to specify ! which overloaded alternative is to be eliminated by pointing to the ! location of the DEFINING_PROGRAM_UNIT_NAME of this subprogram in the ! source text. The string literal (or concatenation of string literals) ! given as SOURCE_TRACE must have the following format: ! ! @smallexample @c ada ! SOURCE_TRACE ::= SOURCE_LOCATION@{LBRACKET SOURCE_LOCATION RBRACKET@} ! ! LBRACKET ::= [ ! RBRACKET ::= ] ! ! SOURCE_LOCATION ::= FILE_NAME:LINE_NUMBER ! FILE_NAME ::= STRING_LITERAL ! LINE_NUMBER ::= DIGIT @{DIGIT@} ! @end smallexample ! ! SOURCE_TRACE should be the short name of the source file (with no directory ! information), and LINE_NUMBER is supposed to point to the line where the ! defining name of the subprogram is located. ! For the subprograms that are not a part of generic instantiations, only one ! SOURCE_LOCATION is used. If a subprogram is declared in a package ! instantiation, SOURCE_TRACE contains two SOURCE_LOCATIONs, the first one is ! the location of the (DEFINING_PROGRAM_UNIT_NAME of the) instantiation, and the ! second one denotes the declaration of the corresponding subprogram in the ! generic package. This approach is recursively used to create SOURCE_LOCATIONs ! in case of nested instantiations. The effect of the pragma is to allow the compiler to eliminate the code or data associated with the named entity. Any reference to ! an eliminated entity outside the compilation unit it is defined in, ! causes a compile time or link time error. The intention of pragma @code{Eliminate} is to allow a program to be compiled ! in a system independent manner, with unused entities eliminated, without ! the requirement of modifying the source text. Normally the required set of @code{Eliminate} pragmas is constructed automatically using the gnatelim tool. Elimination of unused entities local to a compilation unit is automatic, without requiring the use of pragma @code{Eliminate}. ! Note that the reason this pragma takes string literals where names might ! be expected is that a pragma @code{Eliminate} can appear in a context where the ! relevant names are not visible. ! ! Note that any change in the source files that includes removing, splitting of ! adding lines may make the set of Eliminate pragmas using SOURCE_LOCATION ! parameter illegal. ! It is legal to use pragma Eliminate where the referenced entity is a ! dispatching operation, but it is not clear what this would mean, since ! in general the call does not know which entity is actually being called. ! Consequently, a pragma Eliminate for a dispatching operation is ignored. @node Pragma Export_Exception @unnumberedsec Pragma Export_Exception --- 1762,1831 ---- Syntax: @smallexample @c ada ! pragma Eliminate (UNIT_NAME, ENTITY, Source_Location => SOURCE_TRACE) ! UNIT_NAME ::= IDENTIFIER | ! SELECTED_COMPONENT, ! ENTITY ::= IDENTIFIER | ! SELECTED_COMPONENT, ! SOURCE_TRACE ::= SOURCE_REFERENCE | ! SOURCE_REFERENCE LBRACKET SOURCE_TRACE RBRACKET ! LBRACKET ::= [ ! RBRACKET ::= ] ! SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER ! FILE_NAME ::= STRING_LITERAL ! LINE_NUMBER ::= INTEGER_LITERAL @end smallexample @noindent ! This pragma indicates that the given entity is not used in the program ! to be compiled and built. The entity must be an explicitly declared ! subprogram; this includes generic subprogram instances and ! subprograms declared in generic package instances. @code{Unit_Name} ! must be the name of the compilation unit in which the entity is declared. ! The @code{Source_Location} argument is used to resolve overloading ! in case more then one callable entity with the same name is declared ! in the given compilation unit. Each file name must be the short name of the ! source file (with no directory information). ! If an entity is not declared in ! a generic instantiation (this includes generic subprogram instances), ! the source trace includes only one source ! reference. If an entity is declared inside a generic instantiation, ! its source trace starts from the source location in the instantiation and ! ends with the source location of the declaration of the corresponding ! entity in the generic ! unit. This approach is recursively used in case of nested instantiations: ! the leftmost element of the ! source trace is the location of the outermost instantiation, the next ! element is the location of the next (first nested) instantiation in the ! code of the corresponding generic unit, and so on. The effect of the pragma is to allow the compiler to eliminate the code or data associated with the named entity. Any reference to ! an eliminated entity outside the compilation unit where it is defined ! causes a compile-time or link-time error. The intention of pragma @code{Eliminate} is to allow a program to be compiled ! in a system-independent manner, with unused entities eliminated, without ! needing to modify the source text. Normally the required set of @code{Eliminate} pragmas is constructed automatically using the gnatelim tool. Elimination of unused entities local to a compilation unit is automatic, without requiring the use of pragma @code{Eliminate}. ! Any source file change that removes, splits, or ! adds lines may make the set of Eliminate pragmas invalid because their ! @code{Source_Location} argument values may get out of date. ! Pragma Eliminate may be used where the referenced entity is a ! dispatching operation. In this case all the subprograms to which the ! given operation can dispatch are considered to be unused (are never called ! as a result of a direct or a dispatching call). @node Pragma Export_Exception @unnumberedsec Pragma Export_Exception *************** you can construct your own extension uni *** 2176,2183 **** definition. Note that such a package is a child of @code{System} and thus is considered part of the implementation. To compile it you will have to use the appropriate switch for compiling ! system units. @xref{Top, @value{EDITION} User's Guide, About This ! Guide,, gnat_ugn, @value{EDITION} User's Guide}, for details. @node Pragma External @unnumberedsec Pragma External --- 2165,2202 ---- definition. Note that such a package is a child of @code{System} and thus is considered part of the implementation. To compile it you will have to use the appropriate switch for compiling ! system units. ! @xref{Top, @value{EDITION} User's Guide, About This Guide, gnat_ugn, @value{EDITION} User's Guide}, ! for details. ! ! @node Pragma Extensions_Allowed ! @unnumberedsec Pragma Extensions_Allowed ! @cindex Ada Extensions ! @cindex GNAT Extensions ! @findex Extensions_Allowed ! @noindent ! Syntax: ! ! @smallexample @c ada ! pragma Extensions_Allowed (On | Off); ! @end smallexample ! ! @noindent ! This configuration pragma enables or disables the implementation ! extension mode (the use of Off as a parameter cancels the effect ! of the @option{-gnatX} command switch). ! ! In extension mode, the latest version of the Ada language is ! implemented (currently Ada 2012), and in addition a small number ! of GNAT specific extensions are recognized as follows: ! ! @table @asis ! @item Constrained attribute for generic objects ! The @code{Constrained} attribute is permitted for objects of ! generic types. The result indicates if the corresponding actual ! is constrained. ! ! @end table @node Pragma External @unnumberedsec Pragma External *************** floating point types declared in the pac *** 2367,2375 **** be @code{IEEE_Float} and the pragma has no effect. On OpenVMS, the argument may be @code{VAX_Float} to specify the use of the VAX float format for the floating-point types in Standard. This requires that ! the standard runtime libraries be recompiled. @xref{The GNAT Run-Time ! Library Builder gnatlbr,,, gnat_ugn, @value{EDITION} User's Guide ! OpenVMS}, for a description of the @code{GNAT LIBRARY} command. The two argument form specifies the representation to be used for the specified floating-point type. On all systems other than OpenVMS, --- 2386,2392 ---- be @code{IEEE_Float} and the pragma has no effect. On OpenVMS, the argument may be @code{VAX_Float} to specify the use of the VAX float format for the floating-point types in Standard. This requires that ! the standard runtime libraries be recompiled. The two argument form specifies the representation to be used for the specified floating-point type. On all systems other than OpenVMS, *************** format, as follows: *** 2382,2390 **** @item For digits values up to 6, F float format will be used. @item ! For digits values from 7 to 9, G float format will be used. @item ! For digits values from 10 to 15, F float format will be used. @item Digits values above 15 are not allowed. @end itemize --- 2399,2407 ---- @item For digits values up to 6, F float format will be used. @item ! For digits values from 7 to 9, D float format will be used. @item ! For digits values from 10 to 15, G float format will be used. @item Digits values above 15 are not allowed. @end itemize *************** maximum allowed length is 31 characters, *** 2412,2452 **** maintain compatibility with this compiler, you should obey this length limit. ! @node Pragma Implemented_By_Entry ! @unnumberedsec Pragma Implemented_By_Entry ! @findex Implemented_By_Entry @noindent Syntax: @smallexample @c ada ! pragma Implemented_By_Entry (LOCAL_NAME); @end smallexample @noindent ! This is a representation pragma which applies to protected, synchronized and ! task interface primitives. If the pragma is applied to primitive operation Op ! of interface Iface, it is illegal to override Op in a type that implements ! Iface, with anything other than an entry. @smallexample @c ada ! type Iface is protected interface; ! procedure Do_Something (Object : in out Iface) is abstract; ! pragma Implemented_By_Entry (Do_Something); ! protected type P is new Iface with ! procedure Do_Something; -- Illegal ! end P; ! task type T is new Iface with ! entry Do_Something; -- Legal ! end T; @end smallexample @noindent ! NOTE: The pragma is still in its design stage by the Ada Rapporteur Group. It ! is intended to be used in conjunction with dispatching requeue statements as ! described in AI05-0030. Should the ARG decide on an official name and syntax, ! this pragma will become language-defined rather than GNAT-specific. @node Pragma Implicit_Packing @unnumberedsec Pragma Implicit_Packing --- 2429,2479 ---- maintain compatibility with this compiler, you should obey this length limit. ! @node Pragma Implemented ! @unnumberedsec Pragma Implemented ! @findex Implemented @noindent Syntax: @smallexample @c ada ! pragma Implemented (procedure_LOCAL_NAME, implementation_kind); ! ! implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any @end smallexample @noindent ! This is an Ada 2012 representation pragma which applies to protected, task ! and synchronized interface primitives. The use of pragma Implemented provides ! a way to impose a static requirement on the overriding operation by adhering ! to one of the three implementation kids: entry, protected procedure or any of ! the above. @smallexample @c ada ! type Synch_Iface is synchronized interface; ! procedure Prim_Op (Obj : in out Iface) is abstract; ! pragma Implemented (Prim_Op, By_Protected_Procedure); ! protected type Prot_1 is new Synch_Iface with ! procedure Prim_Op; -- Legal ! end Prot_1; ! protected type Prot_2 is new Synch_Iface with ! entry Prim_Op; -- Illegal ! end Prot_2; ! ! task type Task_Typ is new Synch_Iface with ! entry Prim_Op; -- Illegal ! end Task_Typ; @end smallexample @noindent ! When applied to the procedure_or_entry_NAME of a requeue statement, pragma ! Implemented determines the runtime behavior of the requeue. Implementation kind ! By_Entry guarantees that the action of requeueing will proceed from an entry to ! another entry. Implementation kind By_Protected_Procedure transforms the ! requeue into a dispatching call, thus eliminating the chance of blocking. Kind ! By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on ! the target's overriding subprogram kind. @node Pragma Implicit_Packing @unnumberedsec Pragma Implicit_Packing *************** for r'size use 16; *** 2497,2503 **** @noindent Without a pragma Pack, each Boolean field requires 8 bits, so the minimum size is 72 bits, but with a pragma Pack, 16 bits would be ! sufficient. The use of pragma Implciit_Packing allows this record declaration to compile without an explicit pragma Pack. @node Pragma Import_Exception @unnumberedsec Pragma Import_Exception --- 2524,2530 ---- @noindent Without a pragma Pack, each Boolean field requires 8 bits, so the minimum size is 72 bits, but with a pragma Pack, 16 bits would be ! sufficient. The use of pragma Implicit_Packing allows this record declaration to compile without an explicit pragma Pack. @node Pragma Import_Exception @unnumberedsec Pragma Import_Exception *************** the standard Ada pragma @code{Import}. *** 2856,2862 **** with Ada 83. The definition is upwards compatible both with pragma @code{Interface} as defined in the Ada 83 Reference Manual, and also with some extended implementations of this pragma in certain Ada 83 ! implementations. @node Pragma Interface_Name @unnumberedsec Pragma Interface_Name --- 2883,2894 ---- with Ada 83. The definition is upwards compatible both with pragma @code{Interface} as defined in the Ada 83 Reference Manual, and also with some extended implementations of this pragma in certain Ada 83 ! implementations. The only difference between pragma @code{Interface} ! and pragma @code{Import} is that there is special circuitry to allow ! both pragmas to appear for the same subprogram entity (normally it ! is illegal to have multiple @code{Import} pragmas. This is useful in ! maintaining Ada 83/Ada 95 compatibility and is compatible with other ! Ada 83 compilers. @node Pragma Interface_Name @unnumberedsec Pragma Interface_Name *************** Ada exceptions, or used to implement run *** 2923,2929 **** Pragma @code{Interrupt_State} provides a general mechanism for overriding such uses of interrupts. It subsumes the functionality of pragma @code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not ! available on OS/2, Windows or VMS. On all other platforms than VxWorks, it applies to signals; on VxWorks, it applies to vectored hardware interrupts and may be used to mark interrupts required by the board support package as reserved. --- 2955,2961 ---- Pragma @code{Interrupt_State} provides a general mechanism for overriding such uses of interrupts. It subsumes the functionality of pragma @code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not ! available on Windows or VMS. On all other platforms than VxWorks, it applies to signals; on VxWorks, it applies to vectored hardware interrupts and may be used to mark interrupts required by the board support package as reserved. *************** Overriding the default state of signals *** 2975,2980 **** --- 3007,3049 ---- with an application's runtime behavior in the cases of the synchronous signals, and in the case of the signal used to implement the @code{abort} statement. + @node Pragma Invariant + @unnumberedsec Pragma Invariant + @findex Invariant + @noindent + Syntax: + + @smallexample @c ada + pragma Invariant + ([Entity =>] private_type_LOCAL_NAME, + [Check =>] EXPRESSION + [,[Message =>] String_Expression]); + @end smallexample + + @noindent + This pragma provides exactly the same capabilities as the Invariant aspect + defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The Invariant + aspect is fully implemented in Ada 2012 mode, but since it requires the use + of the aspect syntax, which is not available exception in 2012 mode, it is + not possible to use the Invariant aspect in earlier versions of Ada. However + the Invariant pragma may be used in any version of Ada. + + The pragma must appear within the visible part of the package specification, + after the type to which its Entity argument appears. As with the Invariant + aspect, the Check expression is not analyzed until the end of the visible + part of the package, so it may contain forward references. The Message + argument, if present, provides the exception message used if the invariant + is violated. If no Message parameter is provided, a default message that + identifies the line on which the pragma appears is used. + + It is permissible to have multiple Invariants for the same type entity, in + which case they are and'ed together. It is permissible to use this pragma + in Ada 2012 mode, but you cannot have both an invariant aspect and an + invariant pragma for the same entity. + + For further details on the use of this pragma, see the Ada 2012 documentation + of the Invariant aspect. + @node Pragma Keep_Names @unnumberedsec Pragma Keep_Names @findex Keep_Names *************** type @code{Long_Float} and for floating *** 3280,3288 **** For further details on this pragma, see the @cite{DEC Ada Language Reference Manual}, section 3.5.7b. Note that to use this pragma, the standard runtime libraries must be recompiled. - @xref{The GNAT Run-Time Library Builder gnatlbr,,, gnat_ugn, - @value{EDITION} User's Guide OpenVMS}, for a description of the - @code{GNAT LIBRARY} command. @node Pragma Machine_Attribute @unnumberedsec Pragma Machine_Attribute --- 3349,3354 ---- *************** The effect of this pragma is to output a *** 3537,3543 **** an entity thus marked that the subprogram is obsolescent if the appropriate warning option in the compiler is activated. If the Message parameter is present, then a second warning message is given containing this text. In ! addition, a reference to the eneity is considered to be a violation of pragma Restrictions (No_Obsolescent_Features). This pragma can also be used as a program unit pragma for a package, --- 3603,3609 ---- an entity thus marked that the subprogram is obsolescent if the appropriate warning option in the compiler is activated. If the Message parameter is present, then a second warning message is given containing this text. In ! addition, a reference to the entity is considered to be a violation of pragma Restrictions (No_Obsolescent_Features). This pragma can also be used as a program unit pragma for a package, *************** unit are excluded from the consistency c *** 3667,3672 **** --- 3733,3833 ---- latter are compiled by default in pragma Optimize_Alignment (Off) mode if no pragma appears at the start of the file. + @node Pragma Ordered + @unnumberedsec Pragma Ordered + @findex Ordered + @findex pragma @code{Ordered} + @noindent + Syntax: + + @smallexample @c ada + pragma Ordered (enumeration_first_subtype_LOCAL_NAME); + @end smallexample + + @noindent + Most enumeration types are from a conceptual point of view unordered. + For example, consider: + + @smallexample @c ada + type Color is (Red, Blue, Green, Yellow); + @end smallexample + + @noindent + By Ada semantics @code{Blue > Red} and @code{Green > Blue}, + but really these relations make no sense; the enumeration type merely + specifies a set of possible colors, and the order is unimportant. + + For unordered enumeration types, it is generally a good idea if + clients avoid comparisons (other than equality or inequality) and + explicit ranges. (A @emph{client} is a unit where the type is referenced, + other than the unit where the type is declared, its body, and its subunits.) + For example, if code buried in some client says: + + @smallexample @c ada + if Current_Color < Yellow then ... + if Current_Color in Blue .. Green then ... + @end smallexample + + @noindent + then the client code is relying on the order, which is undesirable. + It makes the code hard to read and creates maintenance difficulties if + entries have to be added to the enumeration type. Instead, + the code in the client should list the possibilities, or an + appropriate subtype should be declared in the unit that declares + the original enumeration type. E.g., the following subtype could + be declared along with the type @code{Color}: + + @smallexample @c ada + subtype RBG is Color range Red .. Green; + @end smallexample + + @noindent + and then the client could write: + + @smallexample @c ada + if Current_Color in RBG then ... + if Current_Color = Blue or Current_Color = Green then ... + @end smallexample + + @noindent + However, some enumeration types are legitimately ordered from a conceptual + point of view. For example, if you declare: + + @smallexample @c ada + type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun); + @end smallexample + + @noindent + then the ordering imposed by the language is reasonable, and + clients can depend on it, writing for example: + + @smallexample @c ada + if D in Mon .. Fri then ... + if D < Wed then ... + @end smallexample + + @noindent + The pragma @option{Ordered} is provided to mark enumeration types that + are conceptually ordered, alerting the reader that clients may depend + on the ordering. GNAT provides a pragma to mark enumerations as ordered + rather than one to mark them as unordered, since in our experience, + the great majority of enumeration types are conceptually unordered. + + The types @code{Boolean}, @code{Character}, @code{Wide_Character}, + and @code{Wide_Wide_Character} + are considered to be ordered types, so each is declared with a + pragma @code{Ordered} in package @code{Standard}. + + Normally pragma @code{Ordered} serves only as documentation and a guide for + coding standards, but GNAT provides a warning switch @option{-gnatw.u} that + requests warnings for inappropriate uses (comparisons and explicit + subranges) for unordered types. If this switch is used, then any + enumeration type not marked with pragma @code{Ordered} will be considered + as unordered, and will generate warnings for inappropriate uses. + + For additional information please refer to the description of the + @option{-gnatw.u} switch in the @value{EDITION} User's Guide. + @node Pragma Passive @unnumberedsec Pragma Passive @findex Passive *************** inlining (-gnatN option set) are accepte *** 3967,3974 **** by the compiler, but are ignored at run-time even if postcondition checking is enabled. - - @node Pragma Profile (Ravenscar) @unnumberedsec Pragma Profile (Ravenscar) @findex Ravenscar --- 4128,4133 ---- *************** modifies a global variable (the count). *** 4212,4217 **** --- 4371,4384 ---- example (where a table of previous calls is kept and consulted to avoid re-computation). + Note also that the normal rules excluding optimization of subprograms + in pure units (when parameter types are descended from System.Address, + or when the full view of a parameter type is limited), do not apply + for the Pure_Function case. If you explicitly specify Pure_Function, + the compiler may optimize away calls with identical arguments, and + if that results in unexpected behavior, the proper action is not to + use the pragma for subprograms that are not (conceptually) pure. + @findex Pure Note: Most functions in a @code{Pure} package are automatically pure, and there is no need to use pragma @code{Pure_Function} for such functions. One *************** short-circuited logical operators. If th *** 4276,4282 **** within the file being compiled, it applies only to the file being compiled. There is no requirement that all units in a partition use this option. ! semantics are identical to pragma Atomic. @node Pragma Source_File_Name @unnumberedsec Pragma Source_File_Name @findex Source_File_Name --- 4443,4465 ---- within the file being compiled, it applies only to the file being compiled. There is no requirement that all units in a partition use this option. ! @node Pragma Short_Descriptors ! @unnumberedsec Pragma Short_Descriptors ! @findex Short_Descriptors ! @noindent ! Syntax: ! ! @smallexample @c ada ! pragma Short_Descriptors ! @end smallexample ! ! @noindent ! In VMS versions of the compiler, this configuration pragma causes all ! occurrences of the mechanism types Descriptor[_xxx] to be treated as ! Short_Descriptor[_xxx]. This is helpful in porting legacy applications from a ! 32-bit environment to a 64-bit environment. This pragma is ignored for non-VMS ! versions. ! @node Pragma Source_File_Name @unnumberedsec Pragma Source_File_Name @findex Source_File_Name *************** gcc -c -gnatyl @dots{} *** 4533,4539 **** The form ALL_CHECKS activates all standard checks (its use is equivalent to the use of the @code{gnaty} switch with no options. @xref{Top, @value{EDITION} User's Guide, About This Guide, gnat_ugn, ! @value{EDITION} User's Guide}, for details. The forms with @code{Off} and @code{On} can be used to temporarily disable style checks --- 4716,4726 ---- The form ALL_CHECKS activates all standard checks (its use is equivalent to the use of the @code{gnaty} switch with no options. @xref{Top, @value{EDITION} User's Guide, About This Guide, gnat_ugn, ! @value{EDITION} User's Guide}, for details.) ! ! Note: the behavior is slightly different in GNAT mode (@option{-gnatg} used). ! In this case, ALL_CHECKS implies the standard set of GNAT mode style check ! options (i.e. equivalent to -gnatyg). The forms with @code{Off} and @code{On} can be used to temporarily disable style checks *************** pragma Suppress_All; *** 4620,4630 **** @end smallexample @noindent ! This pragma can only appear immediately following a compilation ! unit. The effect is to apply @code{Suppress (All_Checks)} to the unit ! which it follows. This pragma is implemented for compatibility with DEC ! Ada 83 usage. The use of pragma @code{Suppress (All_Checks)} as a normal ! configuration pragma is the preferred usage in GNAT@. @node Pragma Suppress_Exception_Locations @unnumberedsec Pragma Suppress_Exception_Locations --- 4807,4819 ---- @end smallexample @noindent ! This pragma can appear anywhere within a unit. ! The effect is to apply @code{Suppress (All_Checks)} to the unit ! in which it appears. This pragma is implemented for compatibility with DEC ! Ada 83 usage where it appears at the end of a unit, and for compatibility ! with Rational Ada, where it appears as a program unit pragma. ! The use of the standard Ada pragma @code{Suppress (All_Checks)} ! as a normal configuration pragma is the preferred usage in GNAT@. @node Pragma Suppress_Exception_Locations @unnumberedsec Pragma Suppress_Exception_Locations *************** used to cause the compiler to entirely i *** 5249,5254 **** --- 5438,5446 ---- be useful in checking whether obsolete pragmas in existing programs are hiding real problems. + Note: pragma Warnings does not affect the processing of style messages. See + separate entry for pragma Style_Checks for control of style messages. + @node Pragma Weak_External @unnumberedsec Pragma Weak_External @findex Weak_External *************** consideration, you should minimize the u *** 5384,5389 **** --- 5576,5582 ---- * Passed_By_Reference:: * Pool_Address:: * Range_Length:: + * Ref:: * Result:: * Safe_Emax:: * Safe_Large:: *************** and implementation of the @code{Bit} att *** 5500,5506 **** @unnumberedsec Bit_Position @findex Bit_Position @noindent ! @code{@var{R.C}'Bit}, where @var{R} is a record object and C is one of the fields of the record type, yields the bit offset within the record contains the first bit of storage allocated for the object. The value of this attribute is of the --- 5693,5699 ---- @unnumberedsec Bit_Position @findex Bit_Position @noindent ! @code{@var{R.C}'Bit_Position}, where @var{R} is a record object and C is one of the fields of the record type, yields the bit offset within the record contains the first bit of storage allocated for the object. The value of this attribute is of the *************** may raise @code{Constraint_Error}. *** 5676,5686 **** @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 --- 5869,5879 ---- @cindex Representation of enums @findex Enum_Val @noindent ! For every enumeration subtype @var{S}, @code{@var{S}'Enum_Val} denotes a function with the following spec: @smallexample @c ada ! function @var{S}'Enum_Val (Arg : @i{Universal_Integer) return @var{S}'Base}; @end smallexample *************** end record; *** 5946,5952 **** @end smallexample @noindent ! will have a size of 40 (that is @code{Rec'Size} will be 40. The alignment will be 4, because of the integer field, and so the default size of record objects for this type will be 64 (8 bytes). --- 6139,6145 ---- @end smallexample @noindent ! will have a size of 40 (that is @code{Rec'Size} will be 40). The alignment will be 4, because of the integer field, and so the default size of record objects for this type will be 64 (8 bytes). *************** will be 64 (8 bytes). *** 5957,5970 **** @cindex Postconditions @noindent The attribute Prefix'Old can be used within a ! subprogram to refer to the value of the prefix on entry. So for example if you have an argument of a record type X called Arg1, you can refer to Arg1.Field'Old which yields the value of Arg1.Field on entry. The implementation simply involves generating an object declaration which captures the value on entry. Any prefix is allowed except one of a limited type (since limited ! types cannot be copied to capture their values) or a local variable ! (since it does not exist at subprogram entry time). The following example shows the use of 'Old to implement a test of a postcondition: --- 6150,6166 ---- @cindex Postconditions @noindent The attribute Prefix'Old can be used within a ! subprogram body or within a precondition or ! postcondition pragma. The effect is to ! refer to the value of the prefix on entry. So for example if you have an argument of a record type X called Arg1, you can refer to Arg1.Field'Old which yields the value of Arg1.Field on entry. The implementation simply involves generating an object declaration which captures the value on entry. Any prefix is allowed except one of a limited type (since limited ! types cannot be copied to capture their values) or an expression ! which references a local variable ! (since local variables do not exist at subprogram entry time). The following example shows the use of 'Old to implement a test of a postcondition: *************** range). The result is static for static *** 6036,6041 **** --- 6232,6247 ---- applied to the index subtype of a one dimensional array always gives the same result as @code{Range} applied to the array itself. + @node Ref + @unnumberedsec Ref + @findex Ref + @noindent + The @code{System.Address'Ref} + (@code{System.Address} is the only permissible prefix) + denotes a function identical to + @code{System.Storage_Elements.To_Address} except that + it is a static attribute. See @ref{To_Address} for more details. + @node Result @unnumberedsec Result @findex Result *************** number. The static result is the string *** 6197,6205 **** the number as defined in the original source. This allows the user program to access the actual text of named numbers without intermediate conversions and without the need to enclose the strings in quotes (which ! would preclude their use as numbers). This is used internally for the ! construction of values of the floating-point attributes from the file ! @file{ttypef.ads}, but may also be used by user programs. For example, the following program prints the first 50 digits of pi: --- 6403,6409 ---- the number as defined in the original source. This allows the user program to access the actual text of named numbers without intermediate conversions and without the need to enclose the strings in quotes (which ! would preclude their use as numbers). For example, the following program prints the first 50 digits of pi: *************** For example: *** 6575,6581 **** for Y'Address use X'Address;>> @end smallexample - @sp 1 @cartouche An implementation need not support a specification for the @code{Size} --- 6779,6784 ---- *************** for scalar types. *** 7027,7042 **** @cindex Stream oriented attributes The XDR implementation is provided as an alternative body of the @code{System.Stream_Attributes} package, in the file ! @file{s-strxdr.adb} in the GNAT library. ! There is no @file{s-strxdr.ads} file. In order to install the XDR implementation, do the following: @enumerate @item Replace the default implementation of the @code{System.Stream_Attributes} package with the XDR implementation. For example on a Unix platform issue the commands: @smallexample ! $ mv s-stratt.adb s-strold.adb ! $ mv s-strxdr.adb s-stratt.adb @end smallexample @item --- 7230,7245 ---- @cindex Stream oriented attributes The XDR implementation is provided as an alternative body of the @code{System.Stream_Attributes} package, in the file ! @file{s-stratt-xdr.adb} in the GNAT library. ! There is no @file{s-stratt-xdr.ads} file. In order to install the XDR implementation, do the following: @enumerate @item Replace the default implementation of the @code{System.Stream_Attributes} package with the XDR implementation. For example on a Unix platform issue the commands: @smallexample ! $ mv s-stratt.adb s-stratt-default.adb ! $ mv s-stratt-xdr.adb s-stratt.adb @end smallexample @item *************** Followed. *** 7725,7734 **** @chapter Implementation Defined Characteristics @noindent ! In addition to the implementation dependent pragmas and attributes, and ! the implementation advice, there are a number of other Ada features ! that are potentially implementation dependent. These are mentioned ! throughout the Ada Reference Manual, and are summarized in Annex M@. A requirement for conforming Ada compilers is that they provide documentation describing how the implementation deals with each of these --- 7928,7938 ---- @chapter Implementation Defined Characteristics @noindent ! In addition to the implementation dependent pragmas and attributes, and the ! implementation advice, there are a number of other Ada features that are ! potentially implementation dependent and are designated as ! implementation-defined. These are mentioned throughout the Ada Reference ! Manual, and are summarized in Annex M@. A requirement for conforming Ada compilers is that they provide documentation describing how the implementation deals with each of these *************** made with appropriate alignment *** 8344,8349 **** --- 8548,8582 ---- @sp 1 @cartouche @noindent + @strong{53}. The semantics of operations on invalid representations. + See 13.9.2(10-11). + @end cartouche + @noindent + For assignments and other operations where the use of invalid values cannot + result in erroneous behavior, the compiler ignores the possibility of invalid + values. An exception is raised at the point where an invalid value would + result in erroneous behavior. For example executing: + + @smallexample @c ada + procedure invalidvals is + X : Integer := -1; + Y : Natural range 1 .. 10; + for Y'Address use X'Address; + Z : Natural range 1 .. 10; + A : array (Natural range 1 .. 10) of Integer; + begin + Z := Y; -- no exception + A (Z) := 3; -- exception raised; + end; + @end smallexample + + @noindent + As indicated, an exception is raised on the array assignment, but not + on the simple assignment of the invalid negative value from Y to Z. + + @sp 1 + @cartouche + @noindent @strong{53}. The manner of choosing a storage pool for an access type when @code{Storage_Pool} is not specified for the type. See 13.11(17). @end cartouche *************** floating-point. *** 8846,8852 **** @code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27). @end cartouche @noindent ! Maximum image width is 649, see library file @file{a-numran.ads}. @sp 1 @cartouche --- 9079,9085 ---- @code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27). @end cartouche @noindent ! Maximum image width is 6864, see library file @file{s-rannum.ads}. @sp 1 @cartouche *************** Maximum image width is 649, see library *** 8855,8861 **** @code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27). @end cartouche @noindent ! Maximum image width is 80, see library file @file{a-nudira.ads}. @sp 1 @cartouche --- 9088,9094 ---- @code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27). @end cartouche @noindent ! Maximum image width is 6864, see library file @file{s-rannum.ads}. @sp 1 @cartouche *************** Maximum image width is 80, see library f *** 8864,8871 **** A.5.2(32). @end cartouche @noindent ! The algorithm is documented in the source files @file{a-numran.ads} and ! @file{a-numran.adb}. @sp 1 @cartouche --- 9097,9105 ---- A.5.2(32). @end cartouche @noindent ! The algorithm is the Mersenne Twister, as documented in the source file ! @file{s-rannum.adb}. This version of the algorithm has a period of ! 2**19937-1. @sp 1 @cartouche *************** The algorithm is documented in the sourc *** 8874,8880 **** state. See A.5.2(38). @end cartouche @noindent ! See the documentation contained in the file @file{a-numran.adb}. @sp 1 @cartouche --- 9108,9116 ---- state. See A.5.2(38). @end cartouche @noindent ! The value returned by the Image function is the concatenation of ! the fixed-width decimal representations of the 624 32-bit integers ! of the state vector. @sp 1 @cartouche *************** random numbers is one microsecond. *** 8896,8903 **** Annex is not supported. See A.5.3(72). @end cartouche @noindent ! See the source file @file{ttypef.ads} for the values of all numeric ! attributes. @sp 1 @cartouche --- 9132,9139 ---- Annex is not supported. See A.5.3(72). @end cartouche @noindent ! Run the compiler with @option{-gnatS} to produce a listing of package ! @code{Standard}, has the values of all numeric attributes. @sp 1 @cartouche *************** main program in the natural manner. *** 8954,8960 **** @sp 1 @cartouche @noindent ! @strong{74}. Implementation-defined convention names. See B.1(11). @end cartouche @noindent The following convention names are supported --- 9190,9293 ---- @sp 1 @cartouche @noindent ! @strong{74}. The interpretation of the @code{Form} parameter in procedure ! @code{Create_Directory}. See A.16(56). ! @end cartouche ! @noindent ! The @code{Form} parameter is not used. ! ! @sp 1 ! @cartouche ! @noindent ! @strong{75}. The interpretation of the @code{Form} parameter in procedure ! @code{Create_Path}. See A.16(60). ! @end cartouche ! @noindent ! The @code{Form} parameter is not used. ! ! @sp 1 ! @cartouche ! @noindent ! @strong{76}. The interpretation of the @code{Form} parameter in procedure ! @code{Copy_File}. See A.16(68). ! @end cartouche ! @noindent ! The @code{Form} parameter is case-insensitive. ! ! Two fields are recognized in the @code{Form} parameter: ! ! @table @code ! ! @item preserve= ! ! @item mode= ! ! @end table ! ! @noindent ! starts immediately after the character '=' and ends with the ! character immediately preceding the next comma (',') or with the last ! character of the parameter. ! ! The only possible values for preserve= are: ! ! @table @code ! ! @item no_attributes ! Do not try to preserve any file attributes. This is the default if no ! preserve= is found in Form. ! ! @item all_attributes ! Try to preserve all file attributes (timestamps, access rights). ! ! @item timestamps ! Preserve the timestamp of the copied file, but not the other file attributes. ! ! @end table ! ! @noindent ! The only possible values for mode= are: ! ! @table @code ! ! @item copy ! Only do the copy if the destination file does not already exist. If it already ! exists, Copy_File fails. ! ! @item overwrite ! Copy the file in all cases. Overwrite an already existing destination file. ! ! @item append ! Append the original file to the destination file. If the destination file does ! not exist, the destination file is a copy of the source file. When mode=append, ! the field preserve=, if it exists, is not taken into account. ! ! @end table ! ! @noindent ! If the Form parameter includes one or both of the fields and the value or ! values are incorrect, Copy_file fails with Use_Error. ! ! Examples of correct Forms: ! ! @smallexample ! Form => "preserve=no_attributes,mode=overwrite" (the default) ! Form => "mode=append" ! Form => "mode=copy, preserve=all_attributes" ! @end smallexample ! ! @noindent ! Examples of incorrect Forms ! ! @smallexample ! Form => "preserve=junk" ! Form => "mode=internal, preserve=timestamps" ! @end smallexample ! ! @sp 1 ! @cartouche ! @noindent ! @strong{77}. Implementation-defined convention names. See B.1(11). @end cartouche @noindent The following convention names are supported *************** implementations, these names are accepte *** 9012,9018 **** @sp 1 @cartouche @noindent ! @strong{75}. The meaning of link names. See B.1(36). @end cartouche @noindent Link names are the actual names used by the linker. --- 9345,9351 ---- @sp 1 @cartouche @noindent ! @strong{78}. The meaning of link names. See B.1(36). @end cartouche @noindent Link names are the actual names used by the linker. *************** Link names are the actual names used by *** 9020,9026 **** @sp 1 @cartouche @noindent ! @strong{76}. The manner of choosing link names when neither the link name nor the address of an imported or exported entity is specified. See B.1(36). @end cartouche --- 9353,9359 ---- @sp 1 @cartouche @noindent ! @strong{79}. The manner of choosing link names when neither the link name nor the address of an imported or exported entity is specified. See B.1(36). @end cartouche *************** letters. *** 9032,9038 **** @sp 1 @cartouche @noindent ! @strong{77}. The effect of pragma @code{Linker_Options}. See B.1(37). @end cartouche @noindent The string passed to @code{Linker_Options} is presented uninterpreted as --- 9365,9371 ---- @sp 1 @cartouche @noindent ! @strong{80}. The effect of pragma @code{Linker_Options}. See B.1(37). @end cartouche @noindent The string passed to @code{Linker_Options} is presented uninterpreted as *************** from the corresponding package spec. *** 9053,9059 **** @sp 1 @cartouche @noindent ! @strong{78}. The contents of the visible part of package @code{Interfaces} and its language-defined descendants. See B.2(1). @end cartouche @noindent --- 9386,9392 ---- @sp 1 @cartouche @noindent ! @strong{81}. The contents of the visible part of package @code{Interfaces} and its language-defined descendants. See B.2(1). @end cartouche @noindent *************** See files with prefix @file{i-} in the d *** 9062,9068 **** @sp 1 @cartouche @noindent ! @strong{79}. Implementation-defined children of package @code{Interfaces}. The contents of the visible part of package @code{Interfaces}. See B.2(11). @end cartouche --- 9395,9401 ---- @sp 1 @cartouche @noindent ! @strong{82}. Implementation-defined children of package @code{Interfaces}. The contents of the visible part of package @code{Interfaces}. See B.2(11). @end cartouche *************** See files with prefix @file{i-} in the d *** 9072,9078 **** @sp 1 @cartouche @noindent ! @strong{80}. The types @code{Floating}, @code{Long_Floating}, @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and @code{COBOL_Character}; and the initialization of the variables @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in --- 9405,9411 ---- @sp 1 @cartouche @noindent ! @strong{83}. The types @code{Floating}, @code{Long_Floating}, @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and @code{COBOL_Character}; and the initialization of the variables @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in *************** For initialization, see the file @file{i *** 9100,9106 **** @sp 1 @cartouche @noindent ! @strong{81}. Support for access to machine instructions. See C.1(1). @end cartouche @noindent See documentation in file @file{s-maccod.ads} in the distributed library. --- 9433,9439 ---- @sp 1 @cartouche @noindent ! @strong{84}. Support for access to machine instructions. See C.1(1). @end cartouche @noindent See documentation in file @file{s-maccod.ads} in the distributed library. *************** See documentation in file @file{s-maccod *** 9108,9114 **** @sp 1 @cartouche @noindent ! @strong{82}. Implementation-defined aspects of access to machine operations. See C.1(9). @end cartouche @noindent --- 9441,9447 ---- @sp 1 @cartouche @noindent ! @strong{85}. Implementation-defined aspects of access to machine operations. See C.1(9). @end cartouche @noindent *************** See documentation in file @file{s-maccod *** 9117,9123 **** @sp 1 @cartouche @noindent ! @strong{83}. Implementation-defined aspects of interrupts. See C.3(2). @end cartouche @noindent Interrupts are mapped to signals or conditions as appropriate. See --- 9450,9456 ---- @sp 1 @cartouche @noindent ! @strong{86}. Implementation-defined aspects of interrupts. See C.3(2). @end cartouche @noindent Interrupts are mapped to signals or conditions as appropriate. See *************** on the interrupts supported on a particu *** 9128,9134 **** @sp 1 @cartouche @noindent ! @strong{84}. Implementation-defined aspects of pre-elaboration. See C.4(13). @end cartouche @noindent --- 9461,9467 ---- @sp 1 @cartouche @noindent ! @strong{87}. Implementation-defined aspects of pre-elaboration. See C.4(13). @end cartouche @noindent *************** except under control of the debugger. *** 9138,9144 **** @sp 1 @cartouche @noindent ! @strong{85}. The semantics of pragma @code{Discard_Names}. See C.5(7). @end cartouche @noindent Pragma @code{Discard_Names} causes names of enumeration literals to --- 9471,9477 ---- @sp 1 @cartouche @noindent ! @strong{88}. The semantics of pragma @code{Discard_Names}. See C.5(7). @end cartouche @noindent Pragma @code{Discard_Names} causes names of enumeration literals to *************** Pos values. *** 9149,9155 **** @sp 1 @cartouche @noindent ! @strong{86}. The result of the @code{Task_Identification.Image} attribute. See C.7.1(7). @end cartouche @noindent --- 9482,9488 ---- @sp 1 @cartouche @noindent ! @strong{89}. The result of the @code{Task_Identification.Image} attribute. See C.7.1(7). @end cartouche @noindent *************** virtual address of the control block of *** 9179,9185 **** @sp 1 @cartouche @noindent ! @strong{87}. The value of @code{Current_Task} when in a protected entry or interrupt handler. See C.7.1(17). @end cartouche @noindent --- 9512,9518 ---- @sp 1 @cartouche @noindent ! @strong{90}. The value of @code{Current_Task} when in a protected entry or interrupt handler. See C.7.1(17). @end cartouche @noindent *************** convenient thread, so the value of @code *** 9189,9195 **** @sp 1 @cartouche @noindent ! @strong{88}. The effect of calling @code{Current_Task} from an entry body or interrupt handler. See C.7.1(19). @end cartouche @noindent --- 9522,9528 ---- @sp 1 @cartouche @noindent ! @strong{91}. The effect of calling @code{Current_Task} from an entry body or interrupt handler. See C.7.1(19). @end cartouche @noindent *************** executing the code. *** 9200,9206 **** @sp 1 @cartouche @noindent ! @strong{89}. Implementation-defined aspects of @code{Task_Attributes}. See C.7.2(19). @end cartouche @noindent --- 9533,9539 ---- @sp 1 @cartouche @noindent ! @strong{92}. Implementation-defined aspects of @code{Task_Attributes}. See C.7.2(19). @end cartouche @noindent *************** There are no implementation-defined aspe *** 9209,9215 **** @sp 1 @cartouche @noindent ! @strong{90}. Values of all @code{Metrics}. See D(2). @end cartouche @noindent The metrics information for GNAT depends on the performance of the --- 9542,9548 ---- @sp 1 @cartouche @noindent ! @strong{93}. Values of all @code{Metrics}. See D(2). @end cartouche @noindent The metrics information for GNAT depends on the performance of the *************** the required metrics. *** 9224,9230 **** @sp 1 @cartouche @noindent ! @strong{91}. The declarations of @code{Any_Priority} and @code{Priority}. See D.1(11). @end cartouche @noindent --- 9557,9563 ---- @sp 1 @cartouche @noindent ! @strong{94}. The declarations of @code{Any_Priority} and @code{Priority}. See D.1(11). @end cartouche @noindent *************** See declarations in file @file{system.ad *** 9233,9239 **** @sp 1 @cartouche @noindent ! @strong{92}. Implementation-defined execution resources. See D.1(15). @end cartouche @noindent There are no implementation-defined execution resources. --- 9566,9572 ---- @sp 1 @cartouche @noindent ! @strong{95}. Implementation-defined execution resources. See D.1(15). @end cartouche @noindent There are no implementation-defined execution resources. *************** There are no implementation-defined exec *** 9241,9247 **** @sp 1 @cartouche @noindent ! @strong{93}. Whether, on a multiprocessor, a task that is waiting for access to a protected object keeps its processor busy. See D.2.1(3). @end cartouche @noindent --- 9574,9580 ---- @sp 1 @cartouche @noindent ! @strong{96}. Whether, on a multiprocessor, a task that is waiting for access to a protected object keeps its processor busy. See D.2.1(3). @end cartouche @noindent *************** object does not keep its processor busy. *** 9251,9257 **** @sp 1 @cartouche @noindent ! @strong{94}. The affect of implementation defined execution resources on task dispatching. See D.2.1(9). @end cartouche @noindent --- 9584,9590 ---- @sp 1 @cartouche @noindent ! @strong{97}. The affect of implementation defined execution resources on task dispatching. See D.2.1(9). @end cartouche @noindent *************** underlying operating system. *** 9267,9273 **** @sp 1 @cartouche @noindent ! @strong{95}. Implementation-defined @code{policy_identifiers} allowed in a pragma @code{Task_Dispatching_Policy}. See D.2.2(3). @end cartouche @noindent --- 9600,9606 ---- @sp 1 @cartouche @noindent ! @strong{98}. Implementation-defined @code{policy_identifiers} allowed in a pragma @code{Task_Dispatching_Policy}. See D.2.2(3). @end cartouche @noindent *************** pragma. *** 9277,9283 **** @sp 1 @cartouche @noindent ! @strong{96}. Implementation-defined aspects of priority inversion. See D.2.2(16). @end cartouche @noindent --- 9610,9616 ---- @sp 1 @cartouche @noindent ! @strong{99}. Implementation-defined aspects of priority inversion. See D.2.2(16). @end cartouche @noindent *************** of delay expirations for lower priority *** 9287,9293 **** @sp 1 @cartouche @noindent ! @strong{97}. Implementation defined task dispatching. See D.2.2(18). @end cartouche @noindent @c SGI info: --- 9620,9626 ---- @sp 1 @cartouche @noindent ! @strong{100}. Implementation defined task dispatching. See D.2.2(18). @end cartouche @noindent @c SGI info: *************** The policy is the same as that of the un *** 9300,9306 **** @sp 1 @cartouche @noindent ! @strong{98}. Implementation-defined @code{policy_identifiers} allowed in a pragma @code{Locking_Policy}. See D.3(4). @end cartouche @noindent --- 9633,9639 ---- @sp 1 @cartouche @noindent ! @strong{101}. Implementation-defined @code{policy_identifiers} allowed in a pragma @code{Locking_Policy}. See D.3(4). @end cartouche @noindent *************** requesting the lock. *** 9313,9319 **** @sp 1 @cartouche @noindent ! @strong{99}. Default ceiling priorities. See D.3(10). @end cartouche @noindent The ceiling priority of protected objects of the type --- 9646,9652 ---- @sp 1 @cartouche @noindent ! @strong{102}. Default ceiling priorities. See D.3(10). @end cartouche @noindent The ceiling priority of protected objects of the type *************** Reference Manual D.3(10), *** 9323,9329 **** @sp 1 @cartouche @noindent ! @strong{100}. The ceiling of any protected object used internally by the implementation. See D.3(16). @end cartouche @noindent --- 9656,9662 ---- @sp 1 @cartouche @noindent ! @strong{103}. The ceiling of any protected object used internally by the implementation. See D.3(16). @end cartouche @noindent *************** The ceiling priority of internal protect *** 9333,9339 **** @sp 1 @cartouche @noindent ! @strong{101}. Implementation-defined queuing policies. See D.4(1). @end cartouche @noindent There are no implementation-defined queuing policies. --- 9666,9672 ---- @sp 1 @cartouche @noindent ! @strong{104}. Implementation-defined queuing policies. See D.4(1). @end cartouche @noindent There are no implementation-defined queuing policies. *************** There are no implementation-defined queu *** 9341,9347 **** @sp 1 @cartouche @noindent ! @strong{102}. On a multiprocessor, any conditions that cause the completion of an aborted construct to be delayed later than what is specified for a single processor. See D.6(3). @end cartouche --- 9674,9680 ---- @sp 1 @cartouche @noindent ! @strong{105}. On a multiprocessor, any conditions that cause the completion of an aborted construct to be delayed later than what is specified for a single processor. See D.6(3). @end cartouche *************** processor, there are no further delays. *** 9352,9358 **** @sp 1 @cartouche @noindent ! @strong{103}. Any operations that implicitly require heap storage allocation. See D.7(8). @end cartouche @noindent --- 9685,9691 ---- @sp 1 @cartouche @noindent ! @strong{106}. Any operations that implicitly require heap storage allocation. See D.7(8). @end cartouche @noindent *************** task creation. *** 9362,9368 **** @sp 1 @cartouche @noindent ! @strong{104}. Implementation-defined aspects of pragma @code{Restrictions}. See D.7(20). @end cartouche @noindent --- 9695,9701 ---- @sp 1 @cartouche @noindent ! @strong{107}. Implementation-defined aspects of pragma @code{Restrictions}. See D.7(20). @end cartouche @noindent *************** There are no such implementation-defined *** 9371,9377 **** @sp 1 @cartouche @noindent ! @strong{105}. Implementation-defined aspects of package @code{Real_Time}. See D.8(17). @end cartouche @noindent --- 9704,9710 ---- @sp 1 @cartouche @noindent ! @strong{108}. Implementation-defined aspects of package @code{Real_Time}. See D.8(17). @end cartouche @noindent *************** There are no implementation defined aspe *** 9380,9386 **** @sp 1 @cartouche @noindent ! @strong{106}. Implementation-defined aspects of @code{delay_statements}. See D.9(8). @end cartouche @noindent --- 9713,9719 ---- @sp 1 @cartouche @noindent ! @strong{109}. Implementation-defined aspects of @code{delay_statements}. See D.9(8). @end cartouche @noindent *************** delayed (see D.9(7)). *** 9390,9396 **** @sp 1 @cartouche @noindent ! @strong{107}. The upper bound on the duration of interrupt blocking caused by the implementation. See D.12(5). @end cartouche @noindent --- 9723,9729 ---- @sp 1 @cartouche @noindent ! @strong{110}. The upper bound on the duration of interrupt blocking caused by the implementation. See D.12(5). @end cartouche @noindent *************** no cases is it more than 10 milliseconds *** 9400,9406 **** @sp 1 @cartouche @noindent ! @strong{108}. The means for creating and executing distributed programs. See E(5). @end cartouche @noindent --- 9733,9739 ---- @sp 1 @cartouche @noindent ! @strong{111}. The means for creating and executing distributed programs. See E(5). @end cartouche @noindent *************** distributed programs. See the GLADE ref *** 9410,9416 **** @sp 1 @cartouche @noindent ! @strong{109}. Any events that can result in a partition becoming inaccessible. See E.1(7). @end cartouche @noindent --- 9743,9749 ---- @sp 1 @cartouche @noindent ! @strong{112}. Any events that can result in a partition becoming inaccessible. See E.1(7). @end cartouche @noindent *************** See the GLADE reference manual for full *** 9419,9425 **** @sp 1 @cartouche @noindent ! @strong{110}. The scheduling policies, treatment of priorities, and management of shared resources between partitions in certain cases. See E.1(11). @end cartouche --- 9752,9758 ---- @sp 1 @cartouche @noindent ! @strong{113}. The scheduling policies, treatment of priorities, and management of shared resources between partitions in certain cases. See E.1(11). @end cartouche *************** multi-partition execution. *** 9430,9436 **** @sp 1 @cartouche @noindent ! @strong{111}. Events that cause the version of a compilation unit to change. See E.3(5). @end cartouche @noindent --- 9763,9769 ---- @sp 1 @cartouche @noindent ! @strong{114}. Events that cause the version of a compilation unit to change. See E.3(5). @end cartouche @noindent *************** comments. *** 9443,9449 **** @sp 1 @cartouche @noindent ! @strong{112}. Whether the execution of the remote subprogram is immediately aborted as a result of cancellation. See E.4(13). @end cartouche @noindent --- 9776,9782 ---- @sp 1 @cartouche @noindent ! @strong{115}. Whether the execution of the remote subprogram is immediately aborted as a result of cancellation. See E.4(13). @end cartouche @noindent *************** a distributed application. *** 9453,9459 **** @sp 1 @cartouche @noindent ! @strong{113}. Implementation-defined aspects of the PCS@. See E.5(25). @end cartouche @noindent See the GLADE reference manual for a full description of all implementation --- 9786,9792 ---- @sp 1 @cartouche @noindent ! @strong{116}. Implementation-defined aspects of the PCS@. See E.5(25). @end cartouche @noindent See the GLADE reference manual for a full description of all implementation *************** defined aspects of the PCS@. *** 9462,9468 **** @sp 1 @cartouche @noindent ! @strong{114}. Implementation-defined interfaces in the PCS@. See E.5(26). @end cartouche @noindent --- 9795,9801 ---- @sp 1 @cartouche @noindent ! @strong{117}. Implementation-defined interfaces in the PCS@. See E.5(26). @end cartouche @noindent *************** implementation defined interfaces. *** 9472,9478 **** @sp 1 @cartouche @noindent ! @strong{115}. The values of named numbers in the package @code{Decimal}. See F.2(7). @end cartouche @noindent --- 9805,9811 ---- @sp 1 @cartouche @noindent ! @strong{118}. The values of named numbers in the package @code{Decimal}. See F.2(7). @end cartouche @noindent *************** implementation defined interfaces. *** 9492,9498 **** @sp 1 @cartouche @noindent ! @strong{116}. The value of @code{Max_Picture_Length} in the package @code{Text_IO.Editing}. See F.3.3(16). @end cartouche @noindent --- 9825,9831 ---- @sp 1 @cartouche @noindent ! @strong{119}. The value of @code{Max_Picture_Length} in the package @code{Text_IO.Editing}. See F.3.3(16). @end cartouche @noindent *************** implementation defined interfaces. *** 9501,9507 **** @sp 1 @cartouche @noindent ! @strong{117}. The value of @code{Max_Picture_Length} in the package @code{Wide_Text_IO.Editing}. See F.3.4(5). @end cartouche @noindent --- 9834,9840 ---- @sp 1 @cartouche @noindent ! @strong{120}. The value of @code{Max_Picture_Length} in the package @code{Wide_Text_IO.Editing}. See F.3.4(5). @end cartouche @noindent *************** implementation defined interfaces. *** 9510,9516 **** @sp 1 @cartouche @noindent ! @strong{118}. The accuracy actually achieved by the complex elementary functions and by other complex arithmetic operations. See G.1(1). @end cartouche @noindent --- 9843,9849 ---- @sp 1 @cartouche @noindent ! @strong{121}. The accuracy actually achieved by the complex elementary functions and by other complex arithmetic operations. See G.1(1). @end cartouche @noindent *************** operations. Only fast math mode is curr *** 9520,9526 **** @sp 1 @cartouche @noindent ! @strong{119}. The sign of a zero result (or a component thereof) from any operator or function in @code{Numerics.Generic_Complex_Types}, when @code{Real'Signed_Zeros} is True. See G.1.1(53). @end cartouche --- 9853,9859 ---- @sp 1 @cartouche @noindent ! @strong{122}. The sign of a zero result (or a component thereof) from any operator or function in @code{Numerics.Generic_Complex_Types}, when @code{Real'Signed_Zeros} is True. See G.1.1(53). @end cartouche *************** implementation advice. *** 9531,9537 **** @sp 1 @cartouche @noindent ! @strong{120}. The sign of a zero result (or a component thereof) from any operator or function in @code{Numerics.Generic_Complex_Elementary_Functions}, when @code{Real'Signed_Zeros} is @code{True}. See G.1.2(45). --- 9864,9870 ---- @sp 1 @cartouche @noindent ! @strong{123}. The sign of a zero result (or a component thereof) from any operator or function in @code{Numerics.Generic_Complex_Elementary_Functions}, when @code{Real'Signed_Zeros} is @code{True}. See G.1.2(45). *************** implementation advice. *** 9543,9549 **** @sp 1 @cartouche @noindent ! @strong{121}. Whether the strict mode or the relaxed mode is the default. See G.2(2). @end cartouche @noindent --- 9876,9882 ---- @sp 1 @cartouche @noindent ! @strong{124}. Whether the strict mode or the relaxed mode is the default. See G.2(2). @end cartouche @noindent *************** provides a highly efficient implementati *** 9553,9559 **** @sp 1 @cartouche @noindent ! @strong{122}. The result interval in certain cases of fixed-to-float conversion. See G.2.1(10). @end cartouche @noindent --- 9886,9892 ---- @sp 1 @cartouche @noindent ! @strong{125}. The result interval in certain cases of fixed-to-float conversion. See G.2.1(10). @end cartouche @noindent *************** floating-point format. *** 9564,9570 **** @sp 1 @cartouche @noindent ! @strong{123}. The result of a floating point arithmetic operation in overflow situations, when the @code{Machine_Overflows} attribute of the result type is @code{False}. See G.2.1(13). @end cartouche --- 9897,9903 ---- @sp 1 @cartouche @noindent ! @strong{126}. The result of a floating point arithmetic operation in overflow situations, when the @code{Machine_Overflows} attribute of the result type is @code{False}. See G.2.1(13). @end cartouche *************** properly generated. *** 9581,9587 **** @sp 1 @cartouche @noindent ! @strong{124}. The result interval for division (or exponentiation by a negative exponent), when the floating point hardware implements division as multiplication by a reciprocal. See G.2.1(16). @end cartouche --- 9914,9920 ---- @sp 1 @cartouche @noindent ! @strong{127}. The result interval for division (or exponentiation by a negative exponent), when the floating point hardware implements division as multiplication by a reciprocal. See G.2.1(16). @end cartouche *************** Not relevant, division is IEEE exact. *** 9591,9597 **** @sp 1 @cartouche @noindent ! @strong{125}. The definition of close result set, which determines the accuracy of certain fixed point multiplications and divisions. See G.2.3(5). @end cartouche --- 9924,9930 ---- @sp 1 @cartouche @noindent ! @strong{128}. The definition of close result set, which determines the accuracy of certain fixed point multiplications and divisions. See G.2.3(5). @end cartouche *************** is converted to the target type. *** 9604,9610 **** @sp 1 @cartouche @noindent ! @strong{126}. Conditions on a @code{universal_real} operand of a fixed point multiplication or division for which the result shall be in the perfect result set. See G.2.3(22). @end cartouche --- 9937,9943 ---- @sp 1 @cartouche @noindent ! @strong{129}. Conditions on a @code{universal_real} operand of a fixed point multiplication or division for which the result shall be in the perfect result set. See G.2.3(22). @end cartouche *************** representable in 64-bits. *** 9616,9622 **** @sp 1 @cartouche @noindent ! @strong{127}. The result of a fixed point arithmetic operation in overflow situations, when the @code{Machine_Overflows} attribute of the result type is @code{False}. See G.2.3(27). @end cartouche --- 9949,9955 ---- @sp 1 @cartouche @noindent ! @strong{130}. The result of a fixed point arithmetic operation in overflow situations, when the @code{Machine_Overflows} attribute of the result type is @code{False}. See G.2.3(27). @end cartouche *************** types. *** 9627,9633 **** @sp 1 @cartouche @noindent ! @strong{128}. The result of an elementary function reference in overflow situations, when the @code{Machine_Overflows} attribute of the result type is @code{False}. See G.2.4(4). @end cartouche --- 9960,9966 ---- @sp 1 @cartouche @noindent ! @strong{131}. The result of an elementary function reference in overflow situations, when the @code{Machine_Overflows} attribute of the result type is @code{False}. See G.2.4(4). @end cartouche *************** IEEE infinite and Nan values are produce *** 9637,9643 **** @sp 1 @cartouche @noindent ! @strong{129}. The value of the angle threshold, within which certain elementary functions, complex arithmetic operations, and complex elementary functions yield results conforming to a maximum relative error bound. See G.2.4(10). --- 9970,9976 ---- @sp 1 @cartouche @noindent ! @strong{132}. The value of the angle threshold, within which certain elementary functions, complex arithmetic operations, and complex elementary functions yield results conforming to a maximum relative error bound. See G.2.4(10). *************** Information on this subject is not yet a *** 9648,9654 **** @sp 1 @cartouche @noindent ! @strong{130}. The accuracy of certain elementary functions for parameters beyond the angle threshold. See G.2.4(10). @end cartouche @noindent --- 9981,9987 ---- @sp 1 @cartouche @noindent ! @strong{133}. The accuracy of certain elementary functions for parameters beyond the angle threshold. See G.2.4(10). @end cartouche @noindent *************** Information on this subject is not yet a *** 9657,9663 **** @sp 1 @cartouche @noindent ! @strong{131}. The result of a complex arithmetic operation or complex elementary function reference in overflow situations, when the @code{Machine_Overflows} attribute of the corresponding real type is @code{False}. See G.2.6(5). --- 9990,9996 ---- @sp 1 @cartouche @noindent ! @strong{134}. The result of a complex arithmetic operation or complex elementary function reference in overflow situations, when the @code{Machine_Overflows} attribute of the corresponding real type is @code{False}. See G.2.6(5). *************** IEEE infinite and Nan values are produce *** 9668,9674 **** @sp 1 @cartouche @noindent ! @strong{132}. The accuracy of certain complex arithmetic operations and certain complex elementary functions for parameters (or components thereof) beyond the angle threshold. See G.2.6(8). @end cartouche --- 10001,10007 ---- @sp 1 @cartouche @noindent ! @strong{135}. The accuracy of certain complex arithmetic operations and certain complex elementary functions for parameters (or components thereof) beyond the angle threshold. See G.2.6(8). @end cartouche *************** Information on those subjects is not yet *** 9678,9684 **** @sp 1 @cartouche @noindent ! @strong{133}. Information regarding bounded errors and erroneous execution. See H.2(1). @end cartouche @noindent --- 10011,10017 ---- @sp 1 @cartouche @noindent ! @strong{136}. Information regarding bounded errors and erroneous execution. See H.2(1). @end cartouche @noindent *************** Information on this subject is not yet a *** 9687,9693 **** @sp 1 @cartouche @noindent ! @strong{134}. Implementation-defined aspects of pragma @code{Inspection_Point}. See H.3.2(8). @end cartouche @noindent --- 10020,10026 ---- @sp 1 @cartouche @noindent ! @strong{137}. Implementation-defined aspects of pragma @code{Inspection_Point}. See H.3.2(8). @end cartouche @noindent *************** be examined by the debugger at the inspe *** 9697,9703 **** @sp 1 @cartouche @noindent ! @strong{135}. Implementation-defined aspects of pragma @code{Restrictions}. See H.4(25). @end cartouche @noindent --- 10030,10036 ---- @sp 1 @cartouche @noindent ! @strong{138}. Implementation-defined aspects of pragma @code{Restrictions}. See H.4(25). @end cartouche @noindent *************** generated code. Checks must suppressed *** 9708,9714 **** @sp 1 @cartouche @noindent ! @strong{136}. Any restrictions on pragma @code{Restrictions}. See H.4(27). @end cartouche @noindent --- 10041,10047 ---- @sp 1 @cartouche @noindent ! @strong{139}. Any restrictions on pragma @code{Restrictions}. See H.4(27). @end cartouche @noindent *************** This is a predefined instantiation of *** 11837,11848 **** build the type @code{Complex} and @code{Imaginary}. @item Ada.Numerics.Discrete_Random ! This package provides a random number generator suitable for generating ! random integer values from a specified range. @item Ada.Numerics.Float_Random This package provides a random number generator suitable for generating ! uniformly distributed floating point values. @item Ada.Numerics.Generic_Complex_Elementary_Functions This is a generic version of the package that provides the --- 12170,12181 ---- build the type @code{Complex} and @code{Imaginary}. @item Ada.Numerics.Discrete_Random ! This generic package provides a random number generator suitable for generating ! uniformly distributed values of a specified discrete subtype. @item Ada.Numerics.Float_Random This package provides a random number generator suitable for generating ! uniformly distributed floating point values in the unit interval. @item Ada.Numerics.Generic_Complex_Elementary_Functions This is a generic version of the package that provides the *************** types are @code{Wide_Character} and @cod *** 12225,12232 **** @code{Character} and @code{String}. @end table - - @node The Implementation of Standard I/O @chapter The Implementation of Standard I/O --- 12558,12563 ---- *************** package Interfaces.C_Streams is *** 13241,13248 **** -- Standard C functions -- -------------------------- -- The functions selected below are ones that are ! -- available in DOS, OS/2, UNIX and Xenix (but not ! -- necessarily in ANSI C). These are very thin interfaces -- which copy exactly the C headers. For more -- documentation on these functions, see the Microsoft C -- "Run-Time Library Reference" (Microsoft Press, 1990, --- 13572,13579 ---- -- Standard C functions -- -------------------------- -- The functions selected below are ones that are ! -- available in UNIX (but not necessarily in ANSI C). ! -- These are very thin interfaces -- which copy exactly the C headers. For more -- documentation on these functions, see the Microsoft C -- "Run-Time Library Reference" (Microsoft Press, 1990, *************** of GNAT, and will generate a warning mes *** 13545,13550 **** --- 13876,13883 ---- * GNAT.IO (g-io.ads):: * GNAT.IO_Aux (g-io_aux.ads):: * GNAT.Lock_Files (g-locfil.ads):: + * GNAT.MBBS_Discrete_Random (g-mbdira.ads):: + * GNAT.MBBS_Float_Random (g-mbflra.ads):: * GNAT.MD5 (g-md5.ads):: * GNAT.Memory_Dump (g-memdum.ads):: * GNAT.Most_Recent_Exception (g-moreex.ads):: *************** for whether a file exists, and functions *** 14429,14434 **** --- 14762,14785 ---- Provides a general interface for using files as locks. Can be used for providing program level synchronization. + @node GNAT.MBBS_Discrete_Random (g-mbdira.ads) + @section @code{GNAT.MBBS_Discrete_Random} (@file{g-mbdira.ads}) + @cindex @code{GNAT.MBBS_Discrete_Random} (@file{g-mbdira.ads}) + @cindex Random number generation + + @noindent + The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses + a modified version of the Blum-Blum-Shub generator. + + @node GNAT.MBBS_Float_Random (g-mbflra.ads) + @section @code{GNAT.MBBS_Float_Random} (@file{g-mbflra.ads}) + @cindex @code{GNAT.MBBS_Float_Random} (@file{g-mbflra.ads}) + @cindex Random number generation + + @noindent + The original implementation of @code{Ada.Numerics.Float_Random}. Uses + a modified version of the Blum-Blum-Shub generator. + @node GNAT.MD5 (g-md5.ads) @section @code{GNAT.MD5} (@file{g-md5.ads}) @cindex @code{GNAT.MD5} (@file{g-md5.ads}) *************** the underlying kernel. Otherwise, some *** 15477,15483 **** the services offered by the underlying kernel to the semantics expected by GNARL@. ! Whatever the underlying OS (VxWorks, UNIX, OS/2, Windows NT, etc.) the key point is that each Ada task is mapped on a thread in the underlying kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task. --- 15828,15834 ---- the services offered by the underlying kernel to the semantics expected by GNARL@. ! Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the key point is that each Ada task is mapped on a thread in the underlying kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task. *************** If any of these conditions are violated, *** 15822,15828 **** a temporary (created either by the front-end or the code generator) and then that temporary will be copied onto the target. - @node The Size of Discriminated Records with Default Discriminants @section The Size of Discriminated Records with Default Discriminants --- 16173,16178 ---- *************** case for machines compliant with the IEE *** 15937,17072 **** machines that are not fully compliant with this standard, such as Alpha, the @option{-mieee} compiler flag must be used for achieving IEEE confirming behavior (although at the cost of a significant performance penalty), so ! infinite and and NaN values are properly generated. ! @node Project File Reference ! @chapter Project File Reference @noindent ! This chapter describes the syntax and semantics of project files. ! Project files specify the options to be used when building a system. ! Project files can specify global settings for all tools, ! as well as tool-specific settings. ! @xref{Examples of Project Files,,, gnat_ugn, @value{EDITION} User's Guide}, ! for examples of use. ! @menu ! * Reserved Words:: ! * Lexical Elements:: ! * Declarations:: ! * Empty declarations:: ! * Typed string declarations:: ! * Variables:: ! * Expressions:: ! * Attributes:: ! * Project Attributes:: ! * Attribute References:: ! * External Values:: ! * Case Construction:: ! * Packages:: ! * Package Renamings:: ! * Projects:: ! * Project Extensions:: ! * Project File Elaboration:: ! @end menu ! @node Reserved Words ! @section Reserved Words @noindent ! All Ada reserved words are reserved in project files, and cannot be used ! as variable names or project names. In addition, the following are ! also reserved in project files: ! @itemize ! @item @code{extends} ! @item @code{external} ! @item @code{project} ! @end itemize ! @node Lexical Elements ! @section Lexical Elements @noindent ! Rules for identifiers are the same as in Ada. Identifiers ! are case-insensitive. Strings are case sensitive, except where noted. ! Comments have the same form as in Ada. @noindent ! Syntax: ! @smallexample ! simple_name ::= ! identifier ! name ::= ! simple_name @{. simple_name@} ! @end smallexample ! @node Declarations ! @section Declarations @noindent ! Declarations introduce new entities that denote types, variables, attributes, ! and packages. Some declarations can only appear immediately within a project ! declaration. Others can appear within a project or within a package. ! Syntax: ! @smallexample ! declarative_item ::= ! simple_declarative_item | ! typed_string_declaration | ! package_declaration - simple_declarative_item ::= - variable_declaration | - typed_variable_declaration | - attribute_declaration | - case_construction | - empty_declaration - @end smallexample ! @node Empty declarations ! @section Empty declarations ! @smallexample ! empty_declaration ::= ! @b{null} ; ! @end smallexample ! An empty declaration is allowed anywhere a declaration is allowed. ! It has no effect. ! @node Typed string declarations ! @section Typed string declarations @noindent ! Typed strings are sequences of string literals. Typed strings are the only ! named types in project files. They are used in case constructions, where they ! provide support for conditional attribute definitions. ! Syntax: ! @smallexample ! typed_string_declaration ::= ! @b{type} _simple_name @b{is} ! ( string_literal @{, string_literal@} ); ! @end smallexample @noindent ! A typed string declaration can only appear immediately within a project ! declaration. ! All the string literals in a typed string declaration must be distinct. ! @node Variables ! @section Variables @noindent ! Variables denote values, and appear as constituents of expressions. ! @smallexample ! typed_variable_declaration ::= ! simple_name : name := string_expression ; ! variable_declaration ::= ! simple_name := expression; ! @end smallexample @noindent ! The elaboration of a variable declaration introduces the variable and ! assigns to it the value of the expression. The name of the variable is ! available after the assignment symbol. @noindent ! A typed_variable can only be declare once. @noindent ! a non-typed variable can be declared multiple times. @noindent ! Before the completion of its first declaration, the value of variable ! is the null string. ! @node Expressions ! @section Expressions @noindent ! An expression is a formula that defines a computation or retrieval of a value. ! In a project file the value of an expression is either a string or a list ! of strings. A string value in an expression is either a literal, the current ! value of a variable, an external value, an attribute reference, or a ! concatenation operation. ! Syntax: - @smallexample - expression ::= - term @{& term@} - term ::= - string_literal | - string_list | - name | - external_value | - attribute_reference ! string_literal ::= ! (same as Ada) ! string_list ::= ! ( expression @{ , expression @} ) ! @end smallexample - @subsection Concatenation @noindent ! The following concatenation functions are defined: - @smallexample @c ada - function "&" (X : String; Y : String) return String; - function "&" (X : String_List; Y : String) return String_List; - function "&" (X : String_List; Y : String_List) return String_List; - @end smallexample ! @node Attributes ! @section Attributes @noindent ! An attribute declaration defines a property of a project or package. This ! property can later be queried by means of an attribute reference. ! Attribute values are strings or string lists. ! Some attributes are associative arrays. These attributes are mappings whose ! domain is a set of strings. These attributes are declared one association ! at a time, by specifying a point in the domain and the corresponding image ! of the attribute. They may also be declared as a full associative array, ! getting the same associations as the corresponding attribute in an imported ! or extended project. - Attributes that are not associative arrays are called simple attributes. ! Syntax: ! @smallexample ! attribute_declaration ::= ! full_associative_array_declaration | ! @b{for} attribute_designator @b{use} expression ; ! full_associative_array_declaration ::= ! @b{for} simple_name @b{use} ! simple_name [ . simple_Name ] ' simple_name ; ! attribute_designator ::= ! simple_name | ! simple_name ( string_literal ) ! @end smallexample @noindent ! Some attributes are project-specific, and can only appear immediately within ! a project declaration. Others are package-specific, and can only appear within ! the proper package. ! The expression in an attribute definition must be a string or a string_list. ! The string literal appearing in the attribute_designator of an associative ! array attribute is case-insensitive. ! @node Project Attributes ! @section Project Attributes @noindent ! The following attributes apply to a project. All of them are simple ! attributes. ! @table @code ! @item Object_Dir ! Expression must be a path name. The attribute defines the ! directory in which the object files created by the build are to be placed. If ! not specified, object files are placed in the project directory. - @item Exec_Dir - Expression must be a path name. The attribute defines the - directory in which the executables created by the build are to be placed. - If not specified, executables are placed in the object directory. ! @item Source_Dirs ! Expression must be a list of path names. The attribute ! defines the directories in which the source files for the project are to be ! found. If not specified, source files are found in the project directory. ! If a string in the list ends with "/**", then the directory that precedes ! "/**" and all of its subdirectories (recursively) are included in the list ! of source directories. ! @item Excluded_Source_Dirs ! Expression must be a list of strings. Each entry designates a directory that ! is not to be included in the list of source directories of the project. ! This is normally used when there are strings ending with "/**" in the value ! of attribute Source_Dirs. ! @item Source_Files ! Expression must be a list of file names. The attribute ! defines the individual files, in the project directory, which are to be used ! as sources for the project. File names are path_names that contain no directory ! information. If the project has no sources the attribute must be declared ! explicitly with an empty list. - @item Excluded_Source_Files (Locally_Removed_Files) - Expression must be a list of strings that are legal file names. - Each file name must designate a source that would normally be a source file - in the source directories of the project or, if the project file is an - extending project file, inherited by the current project file. It cannot - designate an immediate source that is not inherited. Each of the source files - in the list are not considered to be sources of the project file: they are not - inherited. Attribute Locally_Removed_Files is obsolescent, attribute - Excluded_Source_Files is preferred. ! @item Source_List_File ! Expression must a single path name. The attribute ! defines a text file that contains a list of source file names to be used ! as sources for the project ! @item Library_Dir ! Expression must be a path name. The attribute defines the ! directory in which a library is to be built. The directory must exist, must ! be distinct from the project's object directory, and must be writable. ! @item Library_Name ! Expression must be a string that is a legal file name, ! without extension. The attribute defines a string that is used to generate ! the name of the library to be built by the project. - @item Library_Kind - Argument must be a string value that must be one of the - following @code{"static"}, @code{"dynamic"} or @code{"relocatable"}. This - string is case-insensitive. If this attribute is not specified, the library is - a static library. Otherwise, the library may be dynamic or relocatable. This - distinction is operating-system dependent. - @item Library_Version - Expression must be a string value whose interpretation - is platform dependent. On UNIX, it is used only for dynamic/relocatable - libraries as the internal name of the library (the @code{"soname"}). If the - library file name (built from the @code{Library_Name}) is different from the - @code{Library_Version}, then the library file will be a symbolic link to the - actual file whose name will be @code{Library_Version}. ! @item Library_Interface ! Expression must be a string list. Each element of the string list ! must designate a unit of the project. ! If this attribute is present in a Library Project File, then the project ! file is a Stand-alone Library_Project_File. ! @item Library_Auto_Init ! Expression must be a single string "true" or "false", case-insensitive. ! If this attribute is present in a Stand-alone Library Project File, ! it indicates if initialization is automatic when the dynamic library ! is loaded. ! @item Library_Options ! Expression must be a string list. Indicates additional switches that ! are to be used when building a shared library. - @item Library_GCC - Expression must be a single string. Designates an alternative to "gcc" - for building shared libraries. ! @item Library_Src_Dir ! Expression must be a path name. The attribute defines the ! directory in which the sources of the interfaces of a Stand-alone Library will ! be copied. The directory must exist, must be distinct from the project's ! object directory and source directories of all projects in the project tree, ! and must be writable. ! @item Library_Src_Dir ! Expression must be a path name. The attribute defines the ! directory in which the ALI files of a Library will ! be copied. The directory must exist, must be distinct from the project's ! object directory and source directories of all projects in the project tree, ! and must be writable. ! @item Library_Symbol_File ! Expression must be a single string. Its value is the single file name of a ! symbol file to be created when building a stand-alone library when the ! symbol policy is either "compliant", "controlled" or "restricted", ! on platforms that support symbol control, such as VMS. When symbol policy ! is "direct", then a file with this name must exist in the object directory. - @item Library_Reference_Symbol_File - Expression must be a single string. Its value is the path name of a - reference symbol file that is read when the symbol policy is either - "compliant" or "controlled", on platforms that support symbol control, - such as VMS, when building a stand-alone library. The path may be an absolute - path or a path relative to the project directory. ! @item Library_Symbol_Policy ! Expression must be a single string. Its case-insensitive value can only be ! "autonomous", "default", "compliant", "controlled", "restricted" or "direct". ! This attribute is not taken into account on all platforms. It controls the ! policy for exported symbols and, on some platforms (like VMS) that have the ! notions of major and minor IDs built in the library files, it controls ! the setting of these IDs. ! "autonomous" or "default": exported symbols are not controlled. - "compliant": if attribute Library_Reference_Symbol_File is not defined, then - it is equivalent to policy "autonomous". If there are exported symbols in - the reference symbol file that are not in the object files of the interfaces, - the major ID of the library is increased. If there are symbols in the - object files of the interfaces that are not in the reference symbol file, - these symbols are put at the end of the list in the newly created symbol file - and the minor ID is increased. ! "controlled": the attribute Library_Reference_Symbol_File must be defined. ! The library will fail to build if the exported symbols in the object files of ! the interfaces do not match exactly the symbol in the symbol file. ! "restricted": The attribute Library_Symbol_File must be defined. The library ! will fail to build if there are symbols in the symbol file that are not in ! the exported symbols of the object files of the interfaces. Additional symbols ! in the object files are not added to the symbol file. ! "direct": The attribute Library_Symbol_File must be defined and must designate ! an existing file in the object directory. This symbol file is passed directly ! to the underlying linker without any symbol processing. - @item Main - Expression must be a list of strings that are legal file names. - These file names designate existing compilation units in the source directory - that are legal main subprograms. ! When a project file is elaborated, as part of the execution of a gnatmake ! command, one or several executables are built and placed in the Exec_Dir. ! If the gnatmake command does not include explicit file names, the executables ! that are built correspond to the files specified by this attribute. ! @item Externally_Built ! Expression must be a single string. Its value must be either "true" of "false", ! case-insensitive. The default is "false". When the value of this attribute is ! "true", no attempt is made to compile the sources or to build the library, ! when the project is a library project. ! @item Main_Language ! This is a simple attribute. Its value is a string that specifies the ! language of the main program. ! @item Languages ! Expression must be a string list. Each string designates ! a programming language that is known to GNAT. The strings are case-insensitive. ! @end table ! @node Attribute References ! @section Attribute References @noindent ! Attribute references are used to retrieve the value of previously defined ! attribute for a package or project. ! Syntax: ! @smallexample ! attribute_reference ::= ! attribute_prefix ' simple_name [ ( string_literal ) ] ! attribute_prefix ::= ! @b{project} | ! simple_name . package_identifier ! @end smallexample @noindent ! If an attribute has not been specified for a given package or project, its ! value is the null string or the empty list. ! @node External Values ! @section External Values @noindent ! An external value is an expression whose value is obtained from the command ! that invoked the processing of the current project file (typically a ! gnatmake command). - Syntax: @smallexample ! external_value ::= ! @b{external} ( string_literal [, string_literal] ) @end smallexample @noindent ! The first string_literal is the string to be used on the command line or ! in the environment to specify the external value. The second string_literal, ! if present, is the default to use if there is no specification for this ! external value either on the command line or in the environment. ! @node Case Construction ! @section Case Construction @noindent ! A case construction supports attribute and variable declarations that depend ! on the value of a previously declared variable. ! Syntax: ! @smallexample ! case_construction ::= ! @b{case} name @b{is} ! @{case_item@} ! @b{end case} ; - case_item ::= - @b{when} discrete_choice_list => - @{case_construction | - attribute_declaration | - variable_declaration | - empty_declaration@} ! discrete_choice_list ::= ! string_literal @{| string_literal@} | ! @b{others} ! @end smallexample @noindent ! Inside a case construction, variable declarations must be for variables that ! have already been declared before the case construction. ! All choices in a choice list must be distinct. The choice lists of two ! distinct alternatives must be disjoint. Unlike Ada, the choice lists of all ! alternatives do not need to include all values of the type. An @code{others} ! choice must appear last in the list of alternatives. ! @node Packages ! @section Packages @noindent ! A package provides a grouping of variable declarations and attribute ! declarations to be used when invoking various GNAT tools. The name of ! the package indicates the tool(s) to which it applies. ! Syntax: ! @smallexample ! package_declaration ::= ! package_spec | package_renaming ! package_spec ::= ! @b{package} package_identifier @b{is} ! @{simple_declarative_item@} ! @b{end} package_identifier ; ! package_identifier ::= ! @code{Naming} | @code{Builder} | @code{Compiler} | @code{Binder} | ! @code{Linker} | @code{Finder} | @code{Cross_Reference} | ! @code{gnatls} | @code{IDE} | @code{Pretty_Printer} | @code{Check} @end smallexample ! @subsection Package Naming @noindent ! The attributes of a @code{Naming} package specifies the naming conventions ! that apply to the source files in a project. When invoking other GNAT tools, ! they will use the sources in the source directories that satisfy these ! naming conventions. ! The following attributes apply to a @code{Naming} package: ! @table @code ! @item Casing ! This is a simple attribute whose value is a string. Legal values of this ! string are @code{"lowercase"}, @code{"uppercase"} or @code{"mixedcase"}. ! These strings are themselves case insensitive. @noindent ! If @code{Casing} is not specified, then the default is @code{"lowercase"}. ! @item Dot_Replacement ! This is a simple attribute whose string value satisfies the following ! requirements: ! @itemize @bullet ! @item It must not be empty ! @item It cannot start or end with an alphanumeric character ! @item It cannot be a single underscore ! @item It cannot start with an underscore followed by an alphanumeric ! @item It cannot contain a dot @code{'.'} if longer than one character ! @end itemize @noindent ! If @code{Dot_Replacement} is not specified, then the default is @code{"-"}. ! @item Spec_Suffix ! This is an associative array attribute, defined on language names, ! whose image is a string that must satisfy the following ! conditions: ! @itemize @bullet ! @item It must not be empty ! @item It cannot start with an alphanumeric character ! @item It cannot start with an underscore followed by an alphanumeric character ! @end itemize @noindent ! For Ada, the attribute denotes the suffix used in file names that contain ! library unit declarations, that is to say units that are package and ! subprogram declarations. If @code{Spec_Suffix ("Ada")} is not ! specified, then the default is @code{".ads"}. ! For C and C++, the attribute denotes the suffix used in file names that ! contain prototypes. ! @item Body_Suffix ! This is an associative array attribute defined on language names, ! whose image is a string that must satisfy the following ! conditions: ! @itemize @bullet ! @item It must not be empty ! @item It cannot start with an alphanumeric character ! @item It cannot start with an underscore followed by an alphanumeric character ! @item It cannot be a suffix of @code{Spec_Suffix} ! @end itemize @noindent ! For Ada, the attribute denotes the suffix used in file names that contain ! library bodies, that is to say units that are package and subprogram bodies. ! If @code{Body_Suffix ("Ada")} is not specified, then the default is ! @code{".adb"}. ! For C and C++, the attribute denotes the suffix used in file names that contain ! source code. ! @item Separate_Suffix ! This is a simple attribute whose value satisfies the same conditions as ! @code{Body_Suffix}. ! This attribute is specific to Ada. It denotes the suffix used in file names ! that contain separate bodies. If it is not specified, then it defaults to same ! value as @code{Body_Suffix ("Ada")}. - @item Spec - This is an associative array attribute, specific to Ada, defined over - compilation unit names. The image is a string that is the name of the file - that contains that library unit. The file name is case sensitive if the - conventions of the host operating system require it. ! @item Body ! This is an associative array attribute, specific to Ada, defined over ! compilation unit names. The image is a string that is the name of the file ! that contains the library unit body for the named unit. The file name is case ! sensitive if the conventions of the host operating system require it. ! @item Specification_Exceptions ! This is an associative array attribute defined on language names, ! whose value is a list of strings. ! This attribute is not significant for Ada. - For C and C++, each string in the list denotes the name of a file that - contains prototypes, but whose suffix is not necessarily the - @code{Spec_Suffix} for the language. ! @item Implementation_Exceptions ! This is an associative array attribute defined on language names, ! whose value is a list of strings. ! This attribute is not significant for Ada. ! For C and C++, each string in the list denotes the name of a file that ! contains source code, but whose suffix is not necessarily the ! @code{Body_Suffix} for the language. ! @end table - The following attributes of package @code{Naming} are obsolescent. They are - kept as synonyms of other attributes for compatibility with previous versions - of the Project Manager. ! @table @code ! @item Specification_Suffix ! This is a synonym of @code{Spec_Suffix}. ! @item Implementation_Suffix ! This is a synonym of @code{Body_Suffix}. ! @item Specification ! This is a synonym of @code{Spec}. ! @item Implementation ! This is a synonym of @code{Body}. ! @end table ! @subsection package Compiler @noindent ! The attributes of the @code{Compiler} package specify the compilation options ! to be used by the underlying compiler. - @table @code - @item Default_Switches - This is an associative array attribute. Its - domain is a set of language names. Its range is a string list that - specifies the compilation options to be used when compiling a component - written in that language, for which no file-specific switches have been - specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies the ! compilation options to be used when compiling the named file. If a file ! is not specified in the Switches attribute, it is compiled with the ! options specified by Default_Switches of its language, if defined. ! @item Local_Configuration_Pragmas. ! This is a simple attribute, whose ! value is a path name that designates a file containing configuration pragmas ! to be used for all invocations of the compiler for immediate sources of the ! project. ! @end table ! @subsection package Builder @noindent ! The attributes of package @code{Builder} specify the compilation, binding, and ! linking options to be used when building an executable for a project. The ! following attributes apply to package @code{Builder}: ! @table @code ! @item Default_Switches ! This is an associative array attribute. Its ! domain is a set of language names. Its range is a string list that ! specifies options to be used when building a main ! written in that language, for which no file-specific switches have been ! specified. - @item Switches - This is an associative array attribute. Its domain is - a set of file names. Its range is a string list that specifies - options to be used when building the named main file. If a main file - is not specified in the Switches attribute, it is built with the - options specified by Default_Switches of its language, if defined. ! @item Global_Configuration_Pragmas ! This is a simple attribute, whose ! value is a path name that designates a file that contains configuration pragmas ! to be used in every build of an executable. If both local and global ! configuration pragmas are specified, a compilation makes use of both sets. ! @item Executable ! This is an associative array attribute. Its domain is ! a set of main source file names. Its range is a simple string that specifies ! the executable file name to be used when linking the specified main source. ! If a main source is not specified in the Executable attribute, the executable ! file name is deducted from the main source file name. ! This attribute has no effect if its value is the empty string. - @item Executable_Suffix - This is a simple attribute whose value is the suffix to be added to - the executables that don't have an attribute Executable specified. - @end table ! @subsection package Gnatls @noindent ! The attributes of package @code{Gnatls} specify the tool options to be used ! when invoking the library browser @command{gnatls}. ! The following attributes apply to package @code{Gnatls}: ! @table @code ! @item Switches ! This is a single attribute with a string list value. Each nonempty string ! in the list is an option when invoking @code{gnatls}. ! @end table ! @subsection package Binder @noindent ! The attributes of package @code{Binder} specify the options to be used ! when invoking the binder in the construction of an executable. ! The following attributes apply to package @code{Binder}: ! @table @code ! @item Default_Switches ! This is an associative array attribute. Its ! domain is a set of language names. Its range is a string list that ! specifies options to be used when binding a main ! written in that language, for which no file-specific switches have been ! specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when binding the named main file. If a main file ! is not specified in the Switches attribute, it is bound with the ! options specified by Default_Switches of its language, if defined. ! @end table ! @subsection package Linker @noindent ! The attributes of package @code{Linker} specify the options to be used when ! invoking the linker in the construction of an executable. ! The following attributes apply to package @code{Linker}: - @table @code - @item Default_Switches - This is an associative array attribute. Its - domain is a set of language names. Its range is a string list that - specifies options to be used when linking a main - written in that language, for which no file-specific switches have been - specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when linking the named main file. If a main file ! is not specified in the Switches attribute, it is linked with the ! options specified by Default_Switches of its language, if defined. ! @item Linker_Options ! This is a string list attribute. Its value specifies additional options that ! be given to the linker when linking an executable. This attribute is not ! used in the main project, only in projects imported directly or indirectly. ! @end table ! @subsection package Cross_Reference @noindent ! The attributes of package @code{Cross_Reference} specify the tool options ! to be used ! when invoking the library tool @command{gnatxref}. ! The following attributes apply to package @code{Cross_Reference}: ! @table @code ! @item Default_Switches ! This is an associative array attribute. Its ! domain is a set of language names. Its range is a string list that ! specifies options to be used when calling @command{gnatxref} on a source ! written in that language, for which no file-specific switches have been ! specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when calling @command{gnatxref} on the named main source. ! If a source is not specified in the Switches attribute, @command{gnatxref} will ! be called with the options specified by Default_Switches of its language, ! if defined. ! @end table ! @subsection package Finder @noindent ! The attributes of package @code{Finder} specify the tool options to be used ! when invoking the search tool @command{gnatfind}. ! The following attributes apply to package @code{Finder}: - @table @code - @item Default_Switches - This is an associative array attribute. Its - domain is a set of language names. Its range is a string list that - specifies options to be used when calling @command{gnatfind} on a source - written in that language, for which no file-specific switches have been - specified. - @item Switches - This is an associative array attribute. Its domain is - a set of file names. Its range is a string list that specifies - options to be used when calling @command{gnatfind} on the named main source. - If a source is not specified in the Switches attribute, @command{gnatfind} will - be called with the options specified by Default_Switches of its language, - if defined. - @end table ! @subsection package Check @noindent ! The attributes of package @code{Check} ! specify the checking rule options to be used ! when invoking the checking tool @command{gnatcheck}. ! The following attributes apply to package @code{Check}: ! @table @code ! @item Default_switches ! This is an associative array attribute. Its ! domain is a set of language names. Its range is a string list that ! specifies options to be used when calling @command{gnatcheck} on a source ! written in that language. The first string in the range should always be ! @code{"-rules"} to specify that all the other options belong to the ! @code{-rules} section of the parameters of @command{gnatcheck} call. ! @end table ! @subsection package Pretty_Printer @noindent ! The attributes of package @code{Pretty_Printer} ! specify the tool options to be used ! when invoking the formatting tool @command{gnatpp}. ! The following attributes apply to package @code{Pretty_Printer}: - @table @code - @item Default_switches - This is an associative array attribute. Its - domain is a set of language names. Its range is a string list that - specifies options to be used when calling @command{gnatpp} on a source - written in that language, for which no file-specific switches have been - specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when calling @command{gnatpp} on the named main source. ! If a source is not specified in the Switches attribute, @command{gnatpp} will ! be called with the options specified by Default_Switches of its language, ! if defined. ! @end table ! @subsection package gnatstub @noindent ! The attributes of package @code{gnatstub} ! specify the tool options to be used ! when invoking the tool @command{gnatstub}. ! The following attributes apply to package @code{gnatstub}: - @table @code - @item Default_switches - This is an associative array attribute. Its - domain is a set of language names. Its range is a string list that - specifies options to be used when calling @command{gnatstub} on a source - written in that language, for which no file-specific switches have been - specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when calling @command{gnatstub} on the named main source. ! If a source is not specified in the Switches attribute, @command{gnatpp} will ! be called with the options specified by Default_Switches of its language, ! if defined. ! @end table ! @subsection package Eliminate @noindent ! The attributes of package @code{Eliminate} ! specify the tool options to be used ! when invoking the tool @command{gnatelim}. ! The following attributes apply to package @code{Eliminate}: ! @table @code ! @item Default_switches ! This is an associative array attribute. Its ! domain is a set of language names. Its range is a string list that ! specifies options to be used when calling @command{gnatelim} on a source ! written in that language, for which no file-specific switches have been ! specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when calling @command{gnatelim} on the named main source. ! If a source is not specified in the Switches attribute, @command{gnatelim} will ! be called with the options specified by Default_Switches of its language, ! if defined. ! @end table ! @subsection package Metrics @noindent ! The attributes of package @code{Metrics} ! specify the tool options to be used ! when invoking the tool @command{gnatmetric}. ! The following attributes apply to package @code{Metrics}: ! @table @code ! @item Default_switches ! This is an associative array attribute. Its ! domain is a set of language names. Its range is a string list that ! specifies options to be used when calling @command{gnatmetric} on a source ! written in that language, for which no file-specific switches have been ! specified. ! @item Switches ! This is an associative array attribute. Its domain is ! a set of file names. Its range is a string list that specifies ! options to be used when calling @command{gnatmetric} on the named main source. ! If a source is not specified in the Switches attribute, @command{gnatmetric} ! will be called with the options specified by Default_Switches of its language, ! if defined. ! @end table ! @subsection package IDE @noindent ! The attributes of package @code{IDE} specify the options to be used when using ! an Integrated Development Environment such as @command{GPS}. - @table @code - @item Remote_Host - This is a simple attribute. Its value is a string that designates the remote - host in a cross-compilation environment, to be used for remote compilation and - debugging. This field should not be specified when running on the local - machine. ! @item Program_Host ! This is a simple attribute. Its value is a string that specifies the ! name of IP address of the embedded target in a cross-compilation environment, ! on which the program should execute. ! @item Communication_Protocol ! This is a simple string attribute. Its value is the name of the protocol ! to use to communicate with the target in a cross-compilation environment, ! e.g.@: @code{"wtx"} or @code{"vxworks"}. ! @item Compiler_Command ! This is an associative array attribute, whose domain is a language name. Its ! value is string that denotes the command to be used to invoke the compiler. ! The value of @code{Compiler_Command ("Ada")} is expected to be compatible with ! gnatmake, in particular in the handling of switches. ! @item Debugger_Command ! This is simple attribute, Its value is a string that specifies the name of ! the debugger to be used, such as gdb, powerpc-wrs-vxworks-gdb or gdb-4. ! @item Default_Switches ! This is an associative array attribute. Its indexes are the name of the ! external tools that the GNAT Programming System (GPS) is supporting. Its ! value is a list of switches to use when invoking that tool. ! @item Gnatlist ! This is a simple attribute. Its value is a string that specifies the name ! of the @command{gnatls} utility to be used to retrieve information about the ! predefined path; e.g., @code{"gnatls"}, @code{"powerpc-wrs-vxworks-gnatls"}. ! @item VCS_Kind ! This is a simple attribute. Its value is a string used to specify the ! Version Control System (VCS) to be used for this project, e.g.@: CVS, RCS ! ClearCase or Perforce. ! @item VCS_File_Check ! This is a simple attribute. Its value is a string that specifies the ! command used by the VCS to check the validity of a file, either ! when the user explicitly asks for a check, or as a sanity check before ! doing the check-in. ! @item VCS_Log_Check ! This is a simple attribute. Its value is a string that specifies ! the command used by the VCS to check the validity of a log file. - @item VCS_Repository_Root - The VCS repository root path. This is used to create tags or branches - of the repository. For subversion the value should be the @code{URL} - as specified to check-out the working copy of the repository. - @item VCS_Patch_Root - The local root directory to use for building patch file. All patch chunks - will be relative to this path. The root project directory is used if - this value is not defined. ! @end table ! @node Package Renamings ! @section Package Renamings @noindent ! A package can be defined by a renaming declaration. The new package renames ! a package declared in a different project file, and has the same attributes ! as the package it renames. ! Syntax: @smallexample ! package_renaming ::== ! @b{package} package_identifier @b{renames} ! simple_name.package_identifier ; @end smallexample @noindent ! The package_identifier of the renamed package must be the same as the ! package_identifier. The project whose name is the prefix of the renamed ! package must contain a package declaration with this name. This project ! must appear in the context_clause of the enclosing project declaration, ! or be the parent project of the enclosing child project. ! @node Projects ! @section Projects @noindent ! A project file specifies a set of rules for constructing a software system. ! A project file can be self-contained, or depend on other project files. ! Dependencies are expressed through a context clause that names other projects. ! Syntax: - @smallexample - project ::= - context_clause project_declaration ! project_declaration ::= ! simple_project_declaration | project_extension ! simple_project_declaration ::= ! @b{project} simple_name @b{is} ! @{declarative_item@} ! @b{end} simple_name; ! context_clause ::= ! @{with_clause@} ! with_clause ::= ! [@b{limited}] @b{with} path_name @{ , path_name @} ; ! path_name ::= ! string_literal ! @end smallexample @noindent ! A path name denotes a project file. A path name can be absolute or relative. ! An absolute path name includes a sequence of directories, in the syntax of ! the host operating system, that identifies uniquely the project file in the ! file system. A relative path name identifies the project file, relative ! to the directory that contains the current project, or relative to a ! directory listed in the environment variable ADA_PROJECT_PATH. ! Path names are case sensitive if file names in the host operating system ! are case sensitive. ! The syntax of the environment variable ADA_PROJECT_PATH is a list of ! directory names separated by colons (semicolons on Windows). ! A given project name can appear only once in a context_clause. ! It is illegal for a project imported by a context clause to refer, directly ! or indirectly, to the project in which this context clause appears (the ! dependency graph cannot contain cycles), except when one of the with_clause ! in the cycle is a @code{limited with}. ! @node Project Extensions ! @section Project Extensions @noindent ! A project extension introduces a new project, which inherits the declarations ! of another project. ! Syntax: ! @smallexample ! project_extension ::= ! @b{project} simple_name @b{extends} path_name @b{is} ! @{declarative_item@} ! @b{end} simple_name; ! @end smallexample @noindent ! The project extension declares a child project. The child project inherits ! all the declarations and all the files of the parent project, These inherited ! declaration can be overridden in the child project, by means of suitable ! declarations. ! @node Project File Elaboration ! @section Project File Elaboration @noindent ! A project file is processed as part of the invocation of a gnat tool that ! uses the project option. Elaboration of the process file consists in the ! sequential elaboration of all its declarations. The computed values of ! attributes and variables in the project are then used to establish the ! environment in which the gnat tool will execute. @node Obsolescent Features @chapter Obsolescent Features --- 16287,17902 ---- machines that are not fully compliant with this standard, such as Alpha, the @option{-mieee} compiler flag must be used for achieving IEEE confirming behavior (although at the cost of a significant performance penalty), so ! infinite and NaN values are properly generated. ! @node Implementation of Ada 2012 Features ! @chapter Implementation of Ada 2012 Features ! @cindex Ada 2012 implementation status ! ! This chapter contains a complete list of Ada 2012 features that have been ! implemented as of GNAT version 6.4. Generally, these features are only ! available if the @option{-gnat12} (Ada 2012 features enabled) flag is set ! @cindex @option{-gnat12} option ! or if the configuration pragma @code{Ada_2012} is used. ! @cindex pragma @code{Ada_2012} ! @cindex configuration pragma @code{Ada_2012} ! @cindex @code{Ada_2012} configuration pragma ! However, new pragmas, attributes, and restrictions are ! unconditionally available, since the Ada 95 standard allows the addition of ! new pragmas, attributes, and restrictions (there are exceptions, which are ! documented in the individual descriptions), and also certain packages ! were made available in earlier versions of Ada. ! ! An ISO date (YYYY-MM-DD) appears in parentheses on the description line. ! This date shows the implementation date of the feature. Any wavefront ! subsequent to this date will contain the indicated feature, as will any ! subsequent releases. A date of 0000-00-00 means that GNAT has always ! implemented the feature, or implemented it as soon as it appeared as a ! binding interpretation. ! ! Each feature corresponds to an Ada Issue (``AI'') approved by the Ada ! standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012. ! The features are ordered based on the relevant sections of the Ada ! Reference Manual (``RM''). When a given AI relates to multiple points ! in the RM, the earliest is used. ! ! A complete description of the AIs may be found in ! @url{www.ada-auth.org/ai05-summary.html}. ! ! @itemize @bullet ! ! @item ! @emph{AI-0176 Quantified expressions (2010-09-29)} ! @cindex AI-0176 (Ada 2012 feature) @noindent ! Both universally and existentially quantified expressions are implemented. ! They use the new syntax for iterators proposed in AI05-139-2, as well as ! the standard Ada loop syntax. ! @noindent ! RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0) ! @item ! @emph{AI-0079 Allow @i{other_format} characters in source (2010-07-10)} ! @cindex AI-0079 (Ada 2012 feature) @noindent ! Wide characters in the unicode category @i{other_format} are now allowed in ! source programs between tokens, but not within a token such as an identifier. ! @noindent ! RM References: 2.01 (4/2) 2.02 (7) ! @item ! @emph{AI-0091 Do not allow @i{other_format} in identifiers (0000-00-00)} ! @cindex AI-0091 (Ada 2012 feature) ! @noindent ! Wide characters in the unicode category @i{other_format} are not permitted ! within an identifier, since this can be a security problem. The error ! message for this case has been improved to be more specific, but GNAT has ! never allowed such characters to appear in identifiers. ! @noindent ! RM References: 2.03 (3.1/2) 2.03 (4/2) 2.03 (5/2) 2.03 (5.1/2) 2.03 (5.2/2) 2.03 (5.3/2) 2.09 (2/2) ! @item ! @emph{AI-0100 Placement of pragmas (2010-07-01)} ! @cindex AI-0100 (Ada 2012 feature) @noindent ! This AI is an earlier version of AI-163. It simplifies the rules ! for legal placement of pragmas. In the case of lists that allow pragmas, if ! the list may have no elements, then the list may consist solely of pragmas. @noindent ! RM References: 2.08 (7) ! @item ! @emph{AI-0163 Pragmas in place of null (2010-07-01)} ! @cindex AI-0163 (Ada 2012 feature) ! @noindent ! A statement sequence may be composed entirely of pragmas. It is no longer ! necessary to add a dummy @code{null} statement to make the sequence legal. ! ! @noindent ! RM References: 2.08 (7) 2.08 (16) ! ! @item ! @emph{AI-0080 ``View of'' not needed if clear from context (0000-00-00)} ! @cindex AI-0080 (Ada 2012 feature) @noindent ! This is an editorial change only, described as non-testable in the AI. ! @noindent ! RM References: 3.01 (7) ! @item ! @emph{AI-0183 Aspect specifications (2010-08-16)} ! @cindex AI-0183 (Ada 2012 feature) ! @noindent ! Aspect specifications have been fully implemented except for pre and post- ! conditions, and type invariants, which have their own separate AI's. All ! forms of declarations listed in the AI are supported. The following is a ! list of the aspects supported (with GNAT implementation aspects marked) ! @multitable {@code{Preelaborable_Initialization}} {--GNAT} ! @item @code{Ada_2005} @tab -- GNAT ! @item @code{Ada_2012} @tab -- GNAT ! @item @code{Address} @tab ! @item @code{Alignment} @tab ! @item @code{Atomic} @tab ! @item @code{Atomic_Components} @tab ! @item @code{Bit_Order} @tab ! @item @code{Component_Size} @tab ! @item @code{Discard_Names} @tab ! @item @code{External_Tag} @tab ! @item @code{Favor_Top_Level} @tab -- GNAT ! @item @code{Inline} @tab ! @item @code{Inline_Always} @tab -- GNAT ! @item @code{Invariant} @tab ! @item @code{Machine_Radix} @tab ! @item @code{No_Return} @tab ! @item @code{Object_Size} @tab -- GNAT ! @item @code{Pack} @tab ! @item @code{Persistent_BSS} @tab -- GNAT ! @item @code{Post} @tab ! @item @code{Pre} @tab ! @item @code{Predicate} @tab ! @item @code{Preelaborable_Initialization} @tab ! @item @code{Pure_Function} @tab -- GNAT ! @item @code{Shared} @tab -- GNAT ! @item @code{Size} @tab ! @item @code{Storage_Pool} @tab ! @item @code{Storage_Size} @tab ! @item @code{Stream_Size} @tab ! @item @code{Suppress} @tab ! @item @code{Suppress_Debug_Info} @tab -- GNAT ! @item @code{Unchecked_Union} @tab ! @item @code{Universal_Aliasing} @tab -- GNAT ! @item @code{Unmodified} @tab -- GNAT ! @item @code{Unreferenced} @tab -- GNAT ! @item @code{Unreferenced_Objects} @tab -- GNAT ! @item @code{Unsuppress} @tab ! @item @code{Value_Size} @tab -- GNAT ! @item @code{Volatile} @tab ! @item @code{Volatile_Components} ! @item @code{Warnings} @tab -- GNAT ! @end multitable ! @noindent ! Note that for aspects with an expression, e.g. @code{Size}, the expression is ! treated like a default expression (visibility is analyzed at the point of ! occurrence of the aspect, but evaluation of the expression occurs at the ! freeze point of the entity involved. @noindent ! RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6) ! 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03 ! (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2) ! 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2) ! 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1) ! 13.03.01 (0) ! ! @item ! @emph{AI-0128 Inequality is a primitive operation (0000-00-00)} ! @cindex AI-0128 (Ada 2012 feature) @noindent ! If an equality operator ("=") is declared for a type, then the implicitly ! declared inequality operator ("/=") is a primitive operation of the type. ! This is the only reasonable interpretation, and is the one always implemented ! by GNAT, but the RM was not entirely clear in making this point. ! @noindent ! RM References: 3.02.03 (6) 6.06 (6) ! @item ! @emph{AI-0003 Qualified expressions as names (2010-07-11)} ! @cindex AI-0003 (Ada 2012 feature) @noindent ! In Ada 2012, a qualified expression is considered to be syntactically a name, ! meaning that constructs such as @code{A'(F(X)).B} are now legal. This is ! useful in disambiguating some cases of overloading. ! @noindent ! RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3) ! 5.04 (7) ! @item ! @emph{AI-0120 Constant instance of protected object (0000-00-00)} ! @cindex AI-0120 (Ada 2012 feature) @noindent ! This is an RM editorial change only. The section that lists objects that are ! constant failed to include the current instance of a protected object ! within a protected function. This has always been treated as a constant ! in GNAT. @noindent ! RM References: 3.03 (21) ! ! @item ! @emph{AI-0008 General access to constrained objects (0000-00-00)} ! @cindex AI-0008 (Ada 2012 feature) @noindent ! The wording in the RM implied that if you have a general access to a ! constrained object, it could be used to modify the discriminants. This was ! obviously not intended. @code{Constraint_Error} should be raised, and GNAT ! has always done so in this situation. @noindent ! RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2) ! ! @item ! @emph{AI-0093 Additional rules use immutably limited (0000-00-00)} ! @cindex AI-0093 (Ada 2012 feature) @noindent ! This is an editorial change only, to make more widespread use of the Ada 2012 ! ``immutably limited''. ! @noindent ! RM References: 3.03 (23.4/3) ! @item ! @emph{AI-0096 Deriving from formal private types (2010-07-20)} ! @cindex AI-0096 (Ada 2012 feature) ! @noindent ! In general it is illegal for a type derived from a formal limited type to be ! nonlimited. This AI makes an exception to this rule: derivation is legal ! if it appears in the private part of the generic, and the formal type is not ! tagged. If the type is tagged, the legality check must be applied to the ! private part of the package. @noindent ! RM References: 3.04 (5.1/2) 6.02 (7) ! @item ! @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)} ! @cindex AI-0181 (Ada 2012 feature) @noindent ! From Ada 2005 on, soft hyphen is considered a non-graphic character, which ! means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the ! @code{Image} and @code{Value} attributes for the character types. Strictly ! speaking this is an inconsistency with Ada 95, but in practice the use of ! these attributes is so obscure that it will not cause problems. ! @noindent ! RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21) ! @item ! @emph{AI-0182 Additional forms for @code{Character'Value} (0000-00-00)} ! @cindex AI-0182 (Ada 2012 feature) ! @noindent ! This AI allows @code{Character'Value} to accept the string @code{'?'} where ! @code{?} is any character including non-graphic control characters. GNAT has ! always accepted such strings. It also allows strings such as ! @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this ! permission and raises @code{Constraint_Error}, as is certainly still ! permitted. ! @noindent ! RM References: 3.05 (56/2) ! ! ! @item ! @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)} ! @cindex AI-0214 (Ada 2012 feature) @noindent ! Ada 2012 relaxes the restriction that forbids discriminants of tagged types ! to have default expressions by allowing them when the type is limited. It ! is often useful to define a default value for a discriminant even though ! it can't be changed by assignment. ! @noindent ! RM References: 3.07 (9.1/2) 3.07.02 (3) ! ! @item ! @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)} ! @cindex AI-0102 (Ada 2012 feature) @noindent ! It is illegal to assign an anonymous access constant to an anonymous access ! variable. The RM did not have a clear rule to prevent this, but GNAT has ! always generated an error for this usage. ! @noindent ! RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2) ! @item ! @emph{AI-0158 Generalizing membership tests (2010-09-16)} ! @cindex AI-0158 (Ada 2012 feature) ! @noindent ! This AI extends the syntax of membership tests to simplify complex conditions ! that can be expressed as membership in a subset of values of any type. It ! introduces syntax for a list of expressions that may be used in loop contexts ! as well. ! @noindent ! RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27) ! @item ! @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)} ! @cindex AI-0173 (Ada 2012 feature) ! @noindent ! The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked ! with the tag of an abstract type, and @code{False} otherwise. ! @noindent ! RM References: 3.09 (7.4/2) 3.09 (12.4/2) ! @item ! @emph{AI-0076 function with controlling result (0000-00-00)} ! @cindex AI-0076 (Ada 2012 feature) ! @noindent ! This is an editorial change only. The RM defines calls with controlling ! results, but uses the term ``function with controlling result'' without an ! explicit definition. ! @noindent ! RM References: 3.09.02 (2/2) ! @item ! @emph{AI-0126 Dispatching with no declared operation (0000-00-00)} ! @cindex AI-0126 (Ada 2012 feature) ! @noindent ! This AI clarifies dispatching rules, and simply confirms that dispatching ! executes the operation of the parent type when there is no explicitly or ! implicitly declared operation for the descendant type. This has always been ! the case in all versions of GNAT. ! @noindent ! RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2) ! @item ! @emph{AI-0097 Treatment of abstract null extension (2010-07-19)} ! @cindex AI-0097 (Ada 2012 feature) ! @noindent ! The RM as written implied that in some cases it was possible to create an ! object of an abstract type, by having an abstract extension inherit a non- ! abstract constructor from its parent type. This mistake has been corrected ! in GNAT and in the RM, and this construct is now illegal. ! @noindent ! RM References: 3.09.03 (4/2) ! @item ! @emph{AI-0203 Extended return cannot be abstract (0000-00-00)} ! @cindex AI-0203 (Ada 2012 feature) ! @noindent ! A return_subtype_indication cannot denote an abstract subtype. GNAT has never ! permitted such usage. ! @noindent ! RM References: 3.09.03 (8/3) ! @item ! @emph{AI-0198 Inheriting abstract operators (0000-00-00)} ! @cindex AI-0198 (Ada 2012 feature) ! @noindent ! This AI resolves a conflict between two rules involving inherited abstract ! operations and predefined operators. If a derived numeric type inherits ! an abstract operator, it overrides the predefined one. This interpretation ! was always the one implemented in GNAT. ! @noindent ! RM References: 3.09.03 (4/3) ! @item ! @emph{AI-0073 Functions returning abstract types (2010-07-10)} ! @cindex AI-0073 (Ada 2012 feature) ! @noindent ! This AI covers a number of issues regarding returning abstract types. In ! particular generic functions cannot have abstract result types or access ! result types designated an abstract type. There are some other cases which ! are detailed in the AI. Note that this binding interpretation has not been ! retrofitted to operate before Ada 2012 mode, since it caused a significant ! number of regressions. ! ! @noindent ! RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2) ! ! @item ! @emph{AI-0070 Elaboration of interface types (0000-00-00)} ! @cindex AI-0070 (Ada 2012 feature) @noindent ! This is an editorial change only, there are no testable consequences short of ! checking for the absence of generated code for an interface declaration. ! @noindent ! RM References: 3.09.04 (18/2) ! ! ! @item ! @emph{AI-0208 Characteristics of incomplete views (0000-00-00)} ! @cindex AI-0208 (Ada 2012 feature) @noindent ! The wording in the Ada 2005 RM concerning characteristics of incomplete views ! was incorrect and implied that some programs intended to be legal were now ! illegal. GNAT had never considered such programs illegal, so it has always ! implemented the intent of this AI. ! ! @noindent ! RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2) ! ! @item ! @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)} ! @cindex AI-0162 (Ada 2012 feature) @noindent ! Incomplete types are made more useful by allowing them to be completed by ! private types and private extensions. ! ! @noindent ! RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2) ! ! ! ! @item ! @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)} ! @cindex AI-0098 (Ada 2012 feature) ! ! @noindent ! An unintentional omission in the RM implied some inconsistent restrictions on ! the use of anonymous access to subprogram values. These restrictions were not ! intentional, and have never been enforced by GNAT. ! ! @noindent ! RM References: 3.10.01 (6) 3.10.01 (9.2/2) ! ! ! @item ! @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)} ! @cindex AI-0199 (Ada 2012 feature) ! ! @noindent ! A choice list in a record aggregate can include several components of ! (distinct) anonymous access types as long as they have matching designated ! subtypes. ! ! @noindent ! RM References: 4.03.01 (16) ! ! ! @item ! @emph{AI-0220 Needed components for aggregates (0000-00-00)} ! @cindex AI-0220 (Ada 2012 feature) ! ! @noindent ! This AI addresses a wording problem in the RM that appears to permit some ! complex cases of aggregates with non-static discriminants. GNAT has always ! implemented the intended semantics. ! ! @noindent ! RM References: 4.03.01 (17) ! ! @item ! @emph{AI-0147 Conditional expressions (2009-03-29)} ! @cindex AI-0147 (Ada 2012 feature) ! ! @noindent ! Conditional expressions are permitted. The form of such an expression is: @smallexample ! (@b{if} @i{expr} @b{then} @i{expr} @{@b{elsif} @i{expr} @b{then} @i{expr}@} [@b{else} @i{expr}]) @end smallexample + The parentheses can be omitted in contexts where parentheses are present + anyway, such as subprogram arguments and pragma arguments. If the @b{else} + clause is omitted, @b{else True} is assumed; + thus @code{(@b{if} A @b{then} B)} is a way to conveniently represent + @emph{(A implies B)} in standard logic. + @noindent ! RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2) ! 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2) ! ! @item ! @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)} ! @cindex AI-0037 (Ada 2012 feature) @noindent ! This AI confirms that an association of the form @code{Indx => <>} in an ! array aggregate must raise @code{Constraint_Error} if @code{Indx} ! is out of range. The RM specified a range check on other associations, but ! not when the value of the association was defaulted. GNAT has always inserted ! a constraint check on the index value. ! @noindent ! RM References: 4.03.03 (29) ! @item ! @emph{AI-0123 Composability of equality (2010-04-13)} ! @cindex AI-0123 (Ada 2012 feature) @noindent ! Equality of untagged record composes, so that the predefined equality for a ! composite type that includes a component of some untagged record type ! @code{R} uses the equality operation of @code{R} (which may be user-defined ! or predefined). This makes the behavior of untagged records identical to that ! of tagged types in this respect. ! This change is an incompatibility with previous versions of Ada, but it ! corrects a non-uniformity that was often a source of confusion. Analysis of ! a large number of industrial programs indicates that in those rare cases ! where a composite type had an untagged record component with a user-defined ! equality, either there was no use of the composite equality, or else the code ! expected the same composability as for tagged types, and thus had a bug that ! would be fixed by this change. ! @noindent ! RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24) ! 8.05.04 (8) ! ! ! @item ! @emph{AI-0088 The value of exponentiation (0000-00-00)} ! @cindex AI-0088 (Ada 2012 feature) @noindent ! This AI clarifies the equivalence rule given for the dynamic semantics of ! exponentiation: the value of the operation can be obtained by repeated ! multiplication, but the operation can be implemented otherwise (for example ! using the familiar divide-by-two-and-square algorithm, even if this is less ! accurate), and does not imply repeated reads of a volatile base. ! @noindent ! RM References: 4.05.06 (11) ! @item ! @emph{AI-0188 Case expressions (2010-01-09)} ! @cindex AI-0188 (Ada 2012 feature) ! @noindent ! Case expressions are permitted. This allows use of constructs such as: ! @smallexample ! X := (@b{case} Y @b{is when} 1 => 2, @b{when} 2 => 3, @b{when others} => 31) @end smallexample ! @noindent ! RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33) ! ! @item ! @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)} ! @cindex AI-0104 (Ada 2012 feature) @noindent ! The assignment @code{Ptr := @b{new not null} Some_Ptr;} will raise ! @code{Constraint_Error} because the default value of the allocated object is ! @b{null}. This useless construct is illegal in Ada 2012. ! @noindent ! RM References: 4.08 (2) ! @item ! @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)} ! @cindex AI-0157 (Ada 2012 feature) @noindent ! Allocation and Deallocation from an empty storage pool (i.e. allocation or ! deallocation of a pointer for which a static storage size clause of zero ! has been given) is now illegal and is detected as such. GNAT ! previously gave a warning but not an error. ! @noindent ! RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17) ! @item ! @emph{AI-0179 Statement not required after label (2010-04-10)} ! @cindex AI-0179 (Ada 2012 feature) @noindent ! It is not necessary to have a statement following a label, so a label ! can appear at the end of a statement sequence without the need for putting a ! null statement afterwards, but it is not allowable to have only labels and ! no real statements in a statement sequence. ! @noindent ! RM References: 5.01 (2) ! ! @item ! @emph{AI-139-2 Syntactic sugar for iterators (2010-09-29)} ! @cindex AI-139-2 (Ada 2012 feature) @noindent ! The new syntax for iterating over arrays and containers is now implemented. ! Iteration over containers is for now limited to read-only iterators. Only ! default iterators are supported, with the syntax: @code{@b{for} Elem @b{of} C}. ! @noindent ! RM References: 5.05 ! @item ! @emph{AI-0134 Profiles must match for full conformance (0000-00-00)} ! @cindex AI-0134 (Ada 2012 feature) ! @noindent ! For full conformance, the profiles of anonymous-access-to-subprogram ! parameters must match. GNAT has always enforced this rule. @noindent ! RM References: 6.03.01 (18) ! @item ! @emph{AI-0207 Mode conformance and access constant (0000-00-00)} ! @cindex AI-0207 (Ada 2012 feature) ! @noindent ! This AI confirms that access_to_constant indication must match for mode ! conformance. This was implemented in GNAT when the qualifier was originally ! introduced in Ada 2005. ! @noindent ! RM References: 6.03.01 (16/2) ! @item ! @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)} ! @cindex AI-0046 (Ada 2012 feature) ! @noindent ! For full conformance, in the case of access parameters, the null exclusion ! must match (either both or neither must have @code{@b{not null}}). ! @noindent ! RM References: 6.03.02 (18) ! @item ! @emph{AI-0118 The association of parameter associations (0000-00-00)} ! @cindex AI-0118 (Ada 2012 feature) ! @noindent ! This AI clarifies the rules for named associations in subprogram calls and ! generic instantiations. The rules have been in place since Ada 83. ! @noindent ! RM References: 6.04.01 (2) 12.03 (9) ! @item ! @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)} ! @cindex AI-0196 (Ada 2012 feature) ! @noindent ! Null exclusion checks are not made for @code{@b{out}} parameters when ! evaluating the actual parameters. GNAT has never generated these checks. ! @noindent ! RM References: 6.04.01 (13) ! @item ! @emph{AI-0015 Constant return objects (0000-00-00)} ! @cindex AI-0015 (Ada 2012 feature) ! @noindent ! The return object declared in an @i{extended_return_statement} may be ! declared constant. This was always intended, and GNAT has always allowed it. @noindent ! RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2) ! 6.05 (5.7/2) ! @item ! @emph{AI-0032 Extended return for class-wide functions (0000-00-00)} ! @cindex AI-0032 (Ada 2012 feature) ! @noindent ! If a function returns a class-wide type, the object of an extended return ! statement can be declared with a specific type that is covered by the class- ! wide type. This has been implemented in GNAT since the introduction of ! extended returns. Note AI-0103 complements this AI by imposing matching ! rules for constrained return types. ! @noindent ! RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2) ! 6.05 (8/2) ! ! @item ! @emph{AI-0103 Static matching for extended return (2010-07-23)} ! @cindex AI-0103 (Ada 2012 feature) @noindent ! If the return subtype of a function is an elementary type or a constrained ! type, the subtype indication in an extended return statement must match ! statically this return subtype. ! @noindent ! RM References: 6.05 (5.2/2) ! @item ! @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)} ! @cindex AI-0058 (Ada 2012 feature) + @noindent + The RM had some incorrect wording implying wrong treatment of abnormal + completion in an extended return. GNAT has always implemented the intended + correct semantics as described by this AI. ! @noindent ! RM References: 6.05 (22/2) ! @item ! @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)} ! @cindex AI-0050 (Ada 2012 feature) @noindent ! The implementation permissions for raising @code{Constraint_Error} early on a function call when it was clear an exception would be raised were over-permissive and allowed mishandling of discriminants in some cases. GNAT did ! not take advantage of these incorrect permissions in any case. ! @noindent ! RM References: 6.05 (24/2) ! ! @item ! @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)} ! @cindex AI-0125 (Ada 2012 feature) @noindent ! In Ada 2012, the declaration of a primitive operation of a type extension ! or private extension can also override an inherited primitive that is not ! visible at the point of this declaration. ! @noindent ! RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2) ! @item ! @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)} ! @cindex AI-0062 (Ada 2012 feature) ! @noindent ! A full constant may have a null exclusion even if its associated deferred ! constant does not. GNAT has always allowed this. @noindent ! RM References: 7.04 (6/2) 7.04 (7.1/2) ! @item ! @emph{AI-0178 Incomplete views are limited (0000-00-00)} ! @cindex AI-0178 (Ada 2012 feature) ! @noindent ! This AI clarifies the role of incomplete views and plugs an omission in the ! RM. GNAT always correctly restricted the use of incomplete views and types. ! @noindent ! RM References: 7.05 (3/2) 7.05 (6/2) ! @item ! @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)} ! @cindex AI-0087 (Ada 2012 feature) @noindent ! The actual for a formal nonlimited derived type cannot be limited. In ! particular, a formal derived type that extends a limited interface but which ! is not explicitly limited cannot be instantiated with a limited type. ! @noindent ! RM References: 7.05 (5/2) 12.05.01 (5.1/2) ! @item ! @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)} ! @cindex AI-0099 (Ada 2012 feature) ! @noindent ! This AI clarifies that ``needs finalization'' is part of dynamic semantics, ! and therefore depends on the run-time characteristics of an object (i.e. its ! tag) and not on its nominal type. As the AI indicates: ``we do not expect ! this to affect any implementation''. @noindent ! RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) ! @item ! @emph{AI-0064 Redundant finalization rule (0000-00-00)} ! @cindex AI-0064 (Ada 2012 feature) @noindent ! This is an editorial change only. The intended behavior is already checked ! by an existing ACATS test, which GNAT has always executed correctly. ! @noindent ! RM References: 7.06.01 (17.1/1) ! @item ! @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)} ! @cindex AI-0026 (Ada 2012 feature) ! @noindent ! Record representation clauses concerning Unchecked_Union types cannot mention ! the discriminant of the type. The type of a component declared in the variant ! part of an Unchecked_Union cannot be controlled, have controlled components, ! nor have protected or task parts. If an Unchecked_Union type is declared ! within the body of a generic unit or its descendants, then the type of a ! component declared in the variant part cannot be a formal private type or a ! formal private extension declared within the same generic unit. @noindent ! RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2) ! @item ! @emph{AI-0205 Extended return declares visible name (0000-00-00)} ! @cindex AI-0205 (Ada 2012 feature) ! @noindent ! This AI corrects a simple omission in the RM. Return objects have always ! been visible within an extended return statement. @noindent ! RM References: 8.03 (17) ! @item ! @emph{AI-0042 Overriding versus implemented-by (0000-00-00)} ! @cindex AI-0042 (Ada 2012 feature) ! @noindent ! This AI fixes a wording gap in the RM. An operation of a synchronized ! interface can be implemented by a protected or task entry, but the abstract ! operation is not being overridden in the usual sense, and it must be stated ! separately that this implementation is legal. This has always been the case ! in GNAT. @noindent ! RM References: 9.01 (9.2/2) 9.04 (11.1/2) ! @item ! @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)} ! @cindex AI-0030 (Ada 2012 feature) ! @noindent ! Requeue is permitted to a protected, synchronized or task interface primitive ! providing it is known that the overriding operation is an entry. Otherwise ! the requeue statement has the same effect as a procedure call. Use of pragma ! @code{Implemented} provides a way to impose a static requirement on the ! overriding operation by adhering to one of the implementation kinds: entry, ! protected procedure or any of the above. ! @noindent ! RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5) ! 9.05.04 (6) 9.05.04 (7) 9.05.04 (12) ! ! ! @item ! @emph{AI-0201 Independence of atomic object components (2010-07-22)} ! @cindex AI-0201 (Ada 2012 feature) @noindent ! If an Atomic object has a pragma @code{Pack} or a @code{Component_Size} ! attribute, then individual components may not be addressable by independent ! tasks. However, if the representation clause has no effect (is confirming), ! then independence is not compromised. Furthermore, in GNAT, specification of ! other appropriately addressable component sizes (e.g. 16 for 8-bit ! characters) also preserves independence. GNAT now gives very clear warnings ! both for the declaration of such a type, and for any assignment to its components. ! @noindent ! RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2) ! @item ! @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)} ! @cindex AI-0009 (Ada 2012 feature) ! @noindent ! This AI introduces the new pragmas @code{Independent} and ! @code{Independent_Components}, ! which control guaranteeing independence of access to objects and components. ! The AI also requires independence not unaffected by confirming rep clauses. @noindent ! RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2) ! C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14) ! @item ! @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)} ! @cindex AI-0072 (Ada 2012 feature) ! @noindent ! This AI clarifies that task signalling for reading @code{'Terminated} only ! occurs if the result is True. GNAT semantics has always been consistent with ! this notion of task signalling. ! @noindent ! RM References: 9.10 (6.1/1) ! @item ! @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)} ! @cindex AI-0108 (Ada 2012 feature) ! @noindent ! This AI confirms that an incomplete type from a limited view does not have ! discriminants. This has always been the case in GNAT. ! @noindent ! RM References: 10.01.01 (12.3/2) ! @item ! @emph{AI-0129 Limited views and incomplete types (0000-00-00)} ! @cindex AI-0129 (Ada 2012 feature) ! @noindent ! This AI clarifies the description of limited views: a limited view of a ! package includes only one view of a type that has an incomplete declaration ! and a full declaration (there is no possible ambiguity in a client package). ! This AI also fixes an omission: a nested package in the private part has no ! limited view. GNAT always implemented this correctly. ! @noindent ! RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2) ! @item ! @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)} ! @cindex AI-0077 (Ada 2012 feature) ! @noindent ! This AI clarifies that a declaration does not include a context clause, ! and confirms that it is illegal to have a context in which both a limited ! and a nonlimited view of a package are accessible. Such double visibility ! was always rejected by GNAT. @noindent ! RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2) ! ! @item ! @emph{AI-0122 Private with and children of generics (0000-00-00)} ! @cindex AI-0122 (Ada 2012 feature) ! ! @noindent ! This AI clarifies the visibility of private children of generic units within ! instantiations of a parent. GNAT has always handled this correctly. ! ! @noindent ! RM References: 10.01.02 (12/2) ! ! ! ! @item ! @emph{AI-0040 Limited with clauses on descendant (0000-00-00)} ! @cindex AI-0040 (Ada 2012 feature) ! ! @noindent ! This AI confirms that a limited with clause in a child unit cannot name ! an ancestor of the unit. This has always been checked in GNAT. ! ! @noindent ! RM References: 10.01.02 (20/2) ! ! @item ! @emph{AI-0132 Placement of library unit pragmas (0000-00-00)} ! @cindex AI-0132 (Ada 2012 feature) ! ! @noindent ! This AI fills a gap in the description of library unit pragmas. The pragma ! clearly must apply to a library unit, even if it does not carry the name ! of the enclosing unit. GNAT has always enforced the required check. ! ! @noindent ! RM References: 10.01.05 (7) ! ! ! @item ! @emph{AI-0034 Categorization of limited views (0000-00-00)} ! @cindex AI-0034 (Ada 2012 feature) ! ! @noindent ! The RM makes certain limited with clauses illegal because of categorization ! considerations, when the corresponding normal with would be legal. This is ! not intended, and GNAT has always implemented the recommended behavior. ! ! @noindent ! RM References: 10.02.01 (11/1) 10.02.01 (17/2) ! ! ! @item ! @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)} ! @cindex AI-0035 (Ada 2012 feature) ! ! @noindent ! This AI remedies some inconsistencies in the legality rules for Pure units. ! Derived access types are legal in a pure unit (on the assumption that the ! rule for a zero storage pool size has been enforced on the ancestor type). ! The rules are enforced in generic instances and in subunits. GNAT has always ! implemented the recommended behavior. ! ! @noindent ! RM References: 10.02.01 (15.1/2) 10.02.01 (15.4/2) 10.02.01 (15.5/2) 10.02.01 (17/2) ! ! ! @item ! @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)} ! @cindex AI-0219 (Ada 2012 feature) ! ! @noindent ! This AI refines the rules for the cases with limited parameters which do not ! allow the implementations to omit ``redundant''. GNAT now properly conforms ! to the requirements of this binding interpretation. ! ! @noindent ! RM References: 10.02.01 (18/2) ! ! @item ! @emph{AI-0043 Rules about raising exceptions (0000-00-00)} ! @cindex AI-0043 (Ada 2012 feature) ! ! @noindent ! This AI covers various omissions in the RM regarding the raising of ! exceptions. GNAT has always implemented the intended semantics. ! ! @noindent ! RM References: 11.04.01 (10.1/2) 11 (2) ! ! ! @item ! @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)} ! @cindex AI-0200 (Ada 2012 feature) ! ! @noindent ! This AI plugs a gap in the RM which appeared to allow some obviously intended ! illegal instantiations. GNAT has never allowed these instantiations. ! ! @noindent ! RM References: 12.07 (16) ! ! ! @item ! @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)} ! @cindex AI-0112 (Ada 2012 feature) ! ! @noindent ! This AI concerns giving names to various representation aspects, but the ! practical effect is simply to make the use of duplicate ! @code{Atomic}[@code{_Components}], ! @code{Volatile}[@code{_Components}] and ! @code{Independent}[@code{_Components}] pragmas illegal, and GNAT ! now performs this required check. ! ! @noindent ! RM References: 13.01 (8) ! ! @item ! @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)} ! @cindex AI-0106 (Ada 2012 feature) ! ! @noindent ! The RM appeared to allow representation pragmas on generic formal parameters, ! but this was not intended, and GNAT has never permitted this usage. ! ! @noindent ! RM References: 13.01 (9.1/1) ! ! ! @item ! @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)} ! @cindex AI-0012 (Ada 2012 feature) ! ! @noindent ! It is now illegal to give an inappropriate component size or a pragma ! @code{Pack} that attempts to change the component size in the case of atomic ! or aliased components. Previously GNAT ignored such an attempt with a ! warning. ! ! @noindent ! RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21) ! ! ! @item ! @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)} ! @cindex AI-0039 (Ada 2012 feature) ! ! @noindent ! The RM permitted the use of dynamic expressions (such as @code{ptr.@b{all})} ! for stream attributes, but these were never useful and are now illegal. GNAT ! has always regarded such expressions as illegal. ! ! @noindent ! RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2) ! ! ! @item ! @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)} ! @cindex AI-0095 (Ada 2012 feature) ! ! @noindent ! The prefix of @code{'Address} cannot statically denote a subprogram with ! convention @code{Intrinsic}. The use of the @code{Address} attribute raises ! @code{Program_Error} if the prefix denotes a subprogram with convention ! @code{Intrinsic}. ! ! @noindent ! RM References: 13.03 (11/1) ! ! ! @item ! @emph{AI-0116 Alignment of class-wide objects (0000-00-00)} ! @cindex AI-0116 (Ada 2012 feature) ! ! @noindent ! This AI requires that the alignment of a class-wide object be no greater ! than the alignment of any type in the class. GNAT has always followed this ! recommendation. ! ! @noindent ! RM References: 13.03 (29) 13.11 (16) ! ! ! @item ! @emph{AI-0146 Type invariants (2009-09-21)} ! @cindex AI-0146 (Ada 2012 feature) ! ! @noindent ! Type invariants may be specified for private types using the aspect notation. ! Aspect @code{Invariant} may be specified for any private type, ! @code{Invariant'Class} can ! only be specified for tagged types, and is inherited by any descendent of the ! tagged types. The invariant is a boolean expression that is tested for being ! true in the following situations: conversions to the private type, object ! declarations for the private type that are default initialized, and ! [@b{in}] @b{out} ! parameters and returned result on return from any primitive operation for ! the type that is visible to a client. ! ! @noindent ! RM References: 13.03.03 (00) ! ! @item ! @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)} ! @cindex AI-0078 (Ada 2012 feature) ! ! @noindent ! In Ada 2012, compilers are required to support unchecked conversion where the ! target alignment is a multiple of the source alignment. GNAT always supported ! this case (and indeed all cases of differing alignments, doing copies where ! required if the alignment was reduced). ! ! @noindent ! RM References: 13.09 (7) ! ! ! @item ! @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)} ! @cindex AI-0195 (Ada 2012 feature) ! ! @noindent ! The handling of invalid values is now designated to be implementation ! defined. This is a documentation change only, requiring Annex M in the GNAT ! Reference Manual to document this handling. ! In GNAT, checks for invalid values are made ! only when necessary to avoid erroneous behavior. Operations like assignments ! which cannot cause erroneous behavior ignore the possibility of invalid ! values and do not do a check. The date given above applies only to the ! documentation change, this behavior has always been implemented by GNAT. ! ! @noindent ! RM References: 13.09.01 (10) ! ! @item ! @emph{AI-0193 Alignment of allocators (2010-09-16)} ! @cindex AI-0193 (Ada 2012 feature) ! ! @noindent ! This AI introduces a new attribute @code{Max_Alignment_For_Allocation}, ! analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead ! of size. ! ! @noindent ! RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1) ! 13.11.01 (2) 13.11.01 (3) ! ! ! @item ! @emph{AI-0177 Parameterized expressions (2010-07-10)} ! @cindex AI-0177 (Ada 2012 feature) ! ! @noindent ! The new Ada 2012 notion of parameterized expressions is implemented. The form ! is: @smallexample ! @i{function specification} @b{is} (@i{expression}) @end smallexample @noindent ! This is exactly equivalent to the ! corresponding function body that returns the expression, but it can appear ! in a package spec. Note that the expression must be parenthesized. ! @noindent ! RM References: 13.11.01 (3/2) ! ! @item ! @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)} ! @cindex AI-0033 (Ada 2012 feature) @noindent ! Neither of these two pragmas may appear within a generic template, because ! the generic might be instantiated at other than the library level. ! @noindent ! RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2) ! @item ! @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)} ! @cindex AI-0161 (Ada 2012 feature) ! @noindent ! A new restriction @code{No_Default_Stream_Attributes} prevents the use of any ! of the default stream attributes for elementary types. If this restriction is ! in force, then it is necessary to provide explicit subprograms for any ! stream attributes used. ! @noindent ! RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2) ! @item ! @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)} ! @cindex AI-0194 (Ada 2012 feature) ! @noindent ! The @code{Stream_Size} attribute returns the default number of bits in the ! stream representation of the given type. ! This value is not affected by the presence ! of stream subprogram attributes for the type. GNAT has always implemented ! this interpretation. @noindent ! RM References: 13.13.02 (1.2/2) ! @item ! @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)} ! @cindex AI-0109 (Ada 2012 feature) ! @noindent ! This AI is an editorial change only. It removes the need for a tag check ! that can never fail. ! @noindent ! RM References: 13.13.02 (34/2) ! @item ! @emph{AI-0007 Stream read and private scalar types (0000-00-00)} ! @cindex AI-0007 (Ada 2012 feature) @noindent ! The RM as written appeared to limit the possibilities of declaring read ! attribute procedures for private scalar types. This limitation was not ! intended, and has never been enforced by GNAT. ! @noindent ! RM References: 13.13.02 (50/2) 13.13.02 (51/2) ! ! ! @item ! @emph{AI-0065 Remote access types and external streaming (0000-00-00)} ! @cindex AI-0065 (Ada 2012 feature) @noindent ! This AI clarifies the fact that all remote access types support external ! streaming. This fixes an obvious oversight in the definition of the ! language, and GNAT always implemented the intended correct rules. ! @noindent ! RM References: 13.13.02 (52/2) ! ! @item ! @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)} ! @cindex AI-0019 (Ada 2012 feature) @noindent ! The RM suggests that primitive subprograms of a specific tagged type are ! frozen when the tagged type is frozen. This would be an incompatible change ! and is not intended. GNAT has never attempted this kind of freezing and its ! behavior is consistent with the recommendation of this AI. ! ! @noindent ! RM References: 13.14 (2) 13.14 (3/1) 13.14 (8.1/1) 13.14 (10) 13.14 (14) 13.14 (15.1/2) ! ! @item ! @emph{AI-0017 Freezing and incomplete types (0000-00-00)} ! @cindex AI-0017 (Ada 2012 feature) ! ! @noindent ! So-called ``Taft-amendment types'' (i.e., types that are completed in package ! bodies) are not frozen by the occurrence of bodies in the ! enclosing declarative part. GNAT always implemented this properly. ! ! @noindent ! RM References: 13.14 (3/1) ! ! ! @item ! @emph{AI-0060 Extended definition of remote access types (0000-00-00)} ! @cindex AI-0060 (Ada 2012 feature) ! ! @noindent ! This AI extends the definition of remote access types to include access ! to limited, synchronized, protected or task class-wide interface types. ! GNAT already implemented this extension. ! ! @noindent ! RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18) ! ! @item ! @emph{AI-0114 Classification of letters (0000-00-00)} ! @cindex AI-0114 (Ada 2012 feature) ! ! @noindent ! The code points 170 (@code{FEMININE ORDINAL INDICATOR}), ! 181 (@code{MICRO SIGN}), and ! 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered ! lower case letters by Unicode. ! However, they are not allowed in identifiers, and they ! return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}. ! This behavior is consistent with that defined in Ada 95. ! ! @noindent ! RM References: A.03.02 (59) A.04.06 (7) ! ! ! @item ! @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)} ! @cindex AI-0185 (Ada 2012 feature) ! ! @noindent ! Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide ! classification functions for @code{Wide_Character} and ! @code{Wide_Wide_Character}, as well as providing ! case folding routines for @code{Wide_[Wide_]Character} and ! @code{Wide_[Wide_]String}. ! ! @noindent ! RM References: A.03.05 (0) A.03.06 (0) ! ! ! @item ! @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)} ! @cindex AI-0031 (Ada 2012 feature) ! ! @noindent ! A new version of @code{Find_Token} is added to all relevant string packages, ! with an extra parameter @code{From}. Instead of starting at the first ! character of the string, the search for a matching Token starts at the ! character indexed by the value of @code{From}. ! These procedures are available in all versions of Ada ! but if used in versions earlier than Ada 2012 they will generate a warning ! that an Ada 2012 subprogram is being used. ! ! @noindent ! RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51) ! A.04.05 (46) ! ! ! @item ! @emph{AI-0056 Index on null string returns zero (0000-00-00)} ! @cindex AI-0056 (Ada 2012 feature) ! ! @noindent ! The wording in the Ada 2005 RM implied an incompatible handling of the ! @code{Index} functions, resulting in raising an exception instead of ! returning zero in some situations. ! This was not intended and has been corrected. ! GNAT always returned zero, and is thus consistent with this AI. ! ! @noindent ! RM References: A.04.03 (56.2/2) A.04.03 (58.5/2) ! ! ! @item ! @emph{AI-0137 String encoding package (2010-03-25)} ! @cindex AI-0137 (Ada 2012 feature) ! ! @noindent ! The packages @code{Ada.Strings.UTF_Encoding}, together with its child ! packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings}, ! and @code{Wide_Wide_Strings} have been ! implemented. These packages (whose documentation can be found in the spec ! files @file{a-stuten.ads}, @file{a-suenco.ads}, @file{a-suenst.ads}, ! @file{a-suewst.ads}, @file{a-suezst.ads}) allow encoding and decoding of ! @code{String}, @code{Wide_String}, and @code{Wide_Wide_String} ! values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and ! UTF-16), as well as conversions between the different UTF encodings. With ! the exception of @code{Wide_Wide_Strings}, these packages are available in ! Ada 95 and Ada 2005 mode as well as Ada 2012 mode. ! The @code{Wide_Wide_Strings package} ! is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95 ! mode since it uses @code{Wide_Wide_Character}). ! ! @noindent ! RM References: A.04.11 ! ! @item ! @emph{AI-0038 Minor errors in Text_IO (0000-00-00)} ! @cindex AI-0038 (Ada 2012 feature) ! ! @noindent ! These are minor errors in the description on three points. The intent on ! all these points has always been clear, and GNAT has always implemented the ! correct intended semantics. ! ! @noindent ! RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.10.08 (10) A.10.08 (24) ! ! @item ! @emph{AI-0044 Restrictions on container instantiations (0000-00-00)} ! @cindex AI-0044 (Ada 2012 feature) ! ! @noindent ! This AI places restrictions on allowed instantiations of generic containers. ! These restrictions are not checked by the compiler, so there is nothing to ! change in the implementation. This affects only the RM documentation. ! ! @noindent ! RM References: A.18 (4/2) A.18.02 (231/2) A.18.03 (145/2) A.18.06 (56/2) A.18.08 (66/2) A.18.09 (79/2) A.18.26 (5/2) A.18.26 (9/2) ! ! @item ! @emph{AI-0127 Adding Locale Capabilities (2010-09-29)} ! @cindex AI-0127 (Ada 2012 feature) ! ! @noindent ! This package provides an interface for identifying the current locale. ! ! @noindent ! RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06 ! A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13 ! ! ! ! @item ! @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)} ! @cindex AI-0002 (Ada 2012 feature) ! ! @noindent ! The compiler is not required to support exporting an Ada subprogram with ! convention C if there are parameters or a return type of an unconstrained ! array type (such as @code{String}). GNAT allows such declarations but ! generates warnings. It is possible, but complicated, to write the ! corresponding C code and certainly such code would be specific to GNAT and ! non-portable. ! ! @noindent ! RM References: B.01 (17) B.03 (62) B.03 (71.1/2) ! ! ! @item ! @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)} ! @cindex AI-0216 (Ada 2012 feature) ! ! @noindent ! It is clearly the intention that @code{No_Task_Hierarchy} is intended to ! forbid tasks declared locally within subprograms, or functions returning task ! objects, and that is the implementation that GNAT has always provided. ! However the language in the RM was not sufficiently clear on this point. ! Thus this is a documentation change in the RM only. ! ! @noindent ! RM References: D.07 (3/3) ! ! @item ! @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)} ! @cindex AI-0211 (Ada 2012 feature) ! ! @noindent ! The restriction @code{No_Relative_Delays} forbids any calls to the subprogram ! @code{Ada.Real_Time.Timing_Events.Set_Handler}. ! ! @noindent ! RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2) ! ! @item ! @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)} ! @cindex AI-0190 (Ada 2012 feature) ! ! @noindent ! This AI introduces a new pragma @code{Default_Storage_Pool}, which can be ! used to control storage pools globally. ! In particular, you can force every access ! type that is used for allocation (@b{new}) to have an explicit storage pool, ! or you can declare a pool globally to be used for all access types that lack ! an explicit one. ! ! @noindent ! RM References: D.07 (8) ! ! @item ! @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)} ! @cindex AI-0189 (Ada 2012 feature) ! ! @noindent ! This AI introduces a new restriction @code{No_Allocators_After_Elaboration}, ! which says that no dynamic allocation will occur once elaboration is ! completed. ! In general this requires a run-time check, which is not required, and which ! GNAT does not attempt. But the static cases of allocators in a task body or ! in the body of the main program are detected and flagged at compile or bind ! time. ! ! @noindent ! RM References: D.07 (19.1/2) H.04 (23.3/2) ! ! @item ! @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)} ! @cindex AI-0171 (Ada 2012 feature) ! ! @noindent ! A new package @code{System.Multiprocessors} is added, together with the ! definition of pragma @code{CPU} for controlling task affinity. A new no ! dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains}, ! is added to the Ravenscar profile. ! ! @noindent ! RM References: D.13.01 (4/2) D.16 ! ! ! @item ! @emph{AI-0210 Correct Timing_Events metric (0000-00-00)} ! @cindex AI-0210 (Ada 2012 feature) ! ! @noindent ! This is a documentation only issue regarding wording of metric requirements, ! that does not affect the implementation of the compiler. ! ! @noindent ! RM References: D.15 (24/2) ! ! ! @item ! @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)} ! @cindex AI-0206 (Ada 2012 feature) ! ! @noindent ! Remote types packages are now allowed to depend on preelaborated packages. ! This was formerly considered illegal. ! ! @noindent ! RM References: E.02.02 (6) ! ! ! ! @item ! @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)} ! @cindex AI-0152 (Ada 2012 feature) ! ! @noindent ! Restriction @code{No_Anonymous_Allocators} prevents the use of allocators ! where the type of the returned value is an anonymous access type. ! ! @noindent ! RM References: H.04 (8/1) ! @end itemize ! @node Obsolescent Features @chapter Obsolescent Features diff -Nrcpad gcc-4.5.2/gcc/ada/gnat_ugn.texi gcc-4.6.0/gcc/ada/gnat_ugn.texi *** gcc-4.5.2/gcc/ada/gnat_ugn.texi Wed Jan 27 11:58:53 2010 --- gcc-4.6.0/gcc/ada/gnat_ugn.texi Sat Feb 12 18:45:06 2011 *************** *** 7,13 **** @c o @c G N A T _ U G N o @c o ! @c GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). o @c o @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo --- 7,13 ---- @c o @c G N A T _ U G N o @c o ! @c Copyright (C) 1992-2010, AdaCore o @c o @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *************** Copyright @copyright{} 1995-2009 Free So *** 18,24 **** Inc. Permission is granted to copy, distribute and/or modify this document ! under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts and with no Back-Cover Texts. A copy of the license is included in the section entitled --- 18,24 ---- Inc. Permission is granted to copy, distribute and/or modify this document ! under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts and with no Back-Cover Texts. A copy of the license is included in the section entitled *************** Texts. A copy of the license is include *** 107,112 **** --- 107,119 ---- @macro ovar{varname} @r{[}@var{\varname\}@r{]}@c @end macro + @c Status as of November 2009: + @c Unfortunately texi2pdf and texi2html treat the trailing "@c" + @c differently, and faulty output is produced by one or the other + @c depending on whether the "@c" is present or absent. + @c As a result, the @ovar macro is not used, and all invocations + @c of the @ovar macro have been expanded inline. + @settitle @value{EDITION} User's Guide @value{PLATFORM} @dircategory GNU Ada tools *************** AdaCore@* *** 169,182 **** * Configuration Pragmas:: * Handling Arbitrary File Naming Conventions Using gnatname:: * GNAT Project Manager:: * The Cross-Referencing Tools gnatxref and gnatfind:: * The GNAT Pretty-Printer gnatpp:: * The GNAT Metric Tool gnatmetric:: * File Name Krunching Using gnatkr:: * Preprocessing Using gnatprep:: - @ifset vms - * The GNAT Run-Time Library Builder gnatlbr:: - @end ifset * The GNAT Library Browser gnatls:: * Cleaning Up Using gnatclean:: @ifclear vms --- 176,187 ---- * Configuration Pragmas:: * Handling Arbitrary File Naming Conventions Using gnatname:: * GNAT Project Manager:: + * Tools Supporting Project Files:: * The Cross-Referencing Tools gnatxref and gnatfind:: * The GNAT Pretty-Printer gnatpp:: * The GNAT Metric Tool gnatmetric:: * File Name Krunching Using gnatkr:: * Preprocessing Using gnatprep:: * The GNAT Library Browser gnatls:: * Cleaning Up Using gnatclean:: @ifclear vms *************** Performance Considerations *** 340,345 **** --- 345,351 ---- Reducing Size of Ada Executables with gnatelim * About gnatelim:: * Running gnatelim:: + * Processing Precompiled Libraries:: * Correcting the List of Eliminate Pragmas:: * Making Your Executables Smaller:: * Summary of the gnatelim Usage Cycle:: *************** Handling Arbitrary File Naming Conventio *** 368,393 **** * Switches for gnatname:: * Examples of gnatname Usage:: - GNAT Project Manager - - * Introduction:: - * Examples of Project Files:: - * Project File Syntax:: - * Objects and Sources in Project Files:: - * Importing Projects:: - * Project Extension:: - * Project Hierarchy Extension:: - * External References in Project Files:: - * Packages in Project Files:: - * Variables from Imported Projects:: - * Naming Schemes:: - * Library Projects:: - * Stand-alone Library Projects:: - * Switches Related to Project Files:: - * Tools Supporting Project Files:: - * An Extended Example:: - * Project File Complete Syntax:: - The Cross-Referencing Tools gnatxref and gnatfind * Switches for gnatxref:: --- 374,379 ---- *************** Preprocessing Using gnatprep *** 420,433 **** * Form of Definitions File:: * Form of Input Text for gnatprep:: - @ifset vms - The GNAT Run-Time Library Builder gnatlbr - - * Running gnatlbr:: - * Switches for gnatlbr:: - * Examples of gnatlbr Usage:: - @end ifset - The GNAT Library Browser gnatls * Running gnatls:: --- 406,411 ---- *************** The gnatmem Tool *** 485,499 **** Verifying Properties Using gnatcheck - * Format of the Report File:: - * General gnatcheck Switches:: - * gnatcheck Rule Options:: - * Adding the Results of Compiler Checks to gnatcheck Output:: - * Project-Wide Checks:: - * Rule exemption:: - * Predefined Rules:: - * Example of gnatcheck Usage:: - Sample Bodies Using gnatstub * Running gnatstub:: --- 463,468 ---- *************** Running and Debugging Ada Programs *** 523,528 **** --- 492,498 ---- * Ada Exceptions:: * Ada Tasks:: * Debugging Generic Units:: + * Remote Debugging using gdbserver:: * GNAT Abnormal Termination or Failure to Terminate:: * Naming Conventions for GNAT Source Files:: * Getting Internal Debugging Information:: *************** Platform-Specific Information for the Ru *** 597,602 **** --- 567,574 ---- * Linux-Specific Considerations:: * AIX-Specific Considerations:: * Irix-Specific Considerations:: + * RTX-Specific Considerations:: + * HP-UX-Specific Considerations:: Example of Binder Output File *************** preprocessor utility that allows a singl *** 800,812 **** generate multiple or parameterized source files by means of macro substitution. - @ifset vms - @item - @ref{The GNAT Run-Time Library Builder gnatlbr}, describes @command{gnatlbr}, - a tool for rebuilding the GNAT run time with user-supplied - configuration pragmas. - @end ifset - @item @ref{The GNAT Library Browser gnatls}, describes @code{gnatls}, a utility that displays information about compiled units, including dependences --- 772,777 ---- *************** of the compiler (@pxref{Character Set Co *** 1804,1811 **** @noindent The basic character set is Latin-1. This character set is defined by ISO standard 8859, part 1. The lower half (character codes @code{16#00#} ! @dots{} @code{16#7F#)} is identical to standard ASCII coding, but the upper half ! is used to represent additional characters. These include extended letters used by European languages, such as French accents, the vowels with umlauts used in German, and the extra letter A-ring used in Swedish. --- 1769,1776 ---- @noindent The basic character set is Latin-1. This character set is defined by ISO standard 8859, part 1. The lower half (character codes @code{16#00#} ! @dots{} @code{16#7F#)} is identical to standard ASCII coding, but the upper ! half is used to represent additional characters. These include extended letters used by European languages, such as French accents, the vowels with umlauts used in German, and the extra letter A-ring used in Swedish. *************** should provide a stub body that raises @ *** 2944,2950 **** @noindent GNAT additionally provides a useful pragma @code{Convention_Identifier} ! that can be used to parametrize conventions and allow additional synonyms to be specified. For example if you have legacy code in which the convention identifier Fortran77 was used for Fortran, you can use the configuration pragma: --- 2909,2915 ---- @noindent GNAT additionally provides a useful pragma @code{Convention_Identifier} ! that can be used to parameterize conventions and allow additional synonyms to be specified. For example if you have legacy code in which the convention identifier Fortran77 was used for Fortran, you can use the configuration pragma: *************** compiled. *** 3849,3855 **** @cindex cannot generate code If you attempt to compile any of these files, you will get one of the ! following error messages (where @var{fff} is the name of the file you compiled): @smallexample cannot generate code for file @var{fff} (package spec) --- 3814,3821 ---- @cindex cannot generate code If you attempt to compile any of these files, you will get one of the ! following error messages (where @var{fff} is the name of the file you ! compiled): @smallexample cannot generate code for file @var{fff} (package spec) *************** without generating code, then use the @o *** 3873,3879 **** The basic command for compiling a file containing an Ada unit is @smallexample ! $ gcc -c @ovar{switches} @file{file name} @end smallexample @noindent --- 3839,3847 ---- The basic command for compiling a file containing an Ada unit is @smallexample ! @c $ gcc -c @ovar{switches} @file{file name} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gcc -c @r{[}@var{switches}@r{]} @file{file name} @end smallexample @noindent *************** effect if this switch is present. *** 4003,4009 **** @item -fno-inline-functions @cindex @option{-fno-inline-functions} (@command{gcc}) ! Suppresses automatic inlining of simple subprograms, which is enabled if @option{-O3} is used. @item -fno-inline-small-functions --- 3971,3977 ---- @item -fno-inline-functions @cindex @option{-fno-inline-functions} (@command{gcc}) ! Suppresses automatic inlining of subprograms, which is enabled if @option{-O3} is used. @item -fno-inline-small-functions *************** Enforce Ada 95 restrictions. *** 4066,4071 **** --- 4034,4050 ---- @cindex @option{-gnat05} (@command{gcc}) Allow full Ada 2005 features. + @item -gnat2005 + @cindex @option{-gnat2005} (@command{gcc}) + Allow full Ada 2005 features (same as @option{-gnat05}) + + @item -gnat12 + @cindex @option{-gnat12} (@command{gcc}) + + @item -gnat2012 + @cindex @option{-gnat2012} (@command{gcc}) + Allow full Ada 2012 features (same as @option{-gnat12}) + @item -gnata @cindex @option{-gnata} (@command{gcc}) Assertions enabled. @code{Pragma Assert} and @code{pragma Debug} to be *************** Specify a configuration pragma file *** 4135,4140 **** --- 4114,4125 ---- Defines a symbol, associated with @var{value}, for preprocessing. (@pxref{Integrated Preprocessing}). + @item -gnateE + @cindex @option{-gnateE} (@command{gcc}) + Generate extra information in exception messages, in particular display + extra column information and the value and range associated with index and + range check failures, and extra column information for access checks. + @item -gnatef @cindex @option{-gnatef} (@command{gcc}) Display full source path name in brief error messages. *************** Specify a preprocessing data file *** 4159,4164 **** --- 4144,4157 ---- @end ifclear (@pxref{Integrated Preprocessing}). + @item -gnateP + @cindex @option{-gnateP} (@command{gcc}) + Turn categorization dependency errors into warnings. + Ada requires that units that WITH one another have compatible categories, for + example a Pure unit cannto WITH a Preelaborate unit. If this switch is used, + these errors become warnings (which can be ignored, or suppressed in the usual + manner). This can be useful in some specialized circumstances such as the + temporary use of special test software. @item -gnateS @cindex @option{-gnateS} (@command{gcc}) Generate SCO (Source Coverage Obligation) information in the ALI *************** Note that @option{^-gnatg^/GNAT_INTERNAL *** 4188,4194 **** @option{^-gnatwae^/WARNINGS=ALL,ERRORS^} and @option{^-gnatyg^/STYLE_CHECKS=GNAT^} so that all standard warnings and all standard style options are turned on. ! All warnings and style error messages are treated as errors. @ifclear vms @item -gnatG=nn --- 4181,4187 ---- @option{^-gnatwae^/WARNINGS=ALL,ERRORS^} and @option{^-gnatyg^/STYLE_CHECKS=GNAT^} so that all standard warnings and all standard style options are turned on. ! All warnings and style messages are treated as errors. @ifclear vms @item -gnatG=nn *************** means that no limit applies. *** 4258,4264 **** @item -gnatn @cindex @option{-gnatn} (@command{gcc}) Activate inlining for subprograms for which ! pragma @code{inline} is specified. This inlining is performed by the GCC back-end. @item -gnatN --- 4251,4257 ---- @item -gnatn @cindex @option{-gnatn} (@command{gcc}) Activate inlining for subprograms for which ! pragma @code{Inline} is specified. This inlining is performed by the GCC back-end. @item -gnatN *************** controlled by this switch (division by z *** 4282,4288 **** @item -gnatp @cindex @option{-gnatp} (@command{gcc}) ! Suppress all checks. See @ref{Run-Time Checks} for details. @item -gnatP @cindex @option{-gnatP} (@command{gcc}) --- 4275,4286 ---- @item -gnatp @cindex @option{-gnatp} (@command{gcc}) ! Suppress all checks. See @ref{Run-Time Checks} for details. This switch ! has no effect if cancelled by a subsequent @option{-gnat-p} switch. ! ! @item -gnat-p ! @cindex @option{-gnat-p} (@command{gcc}) ! Cancel effect of previous @option{-gnatp} switch. @item -gnatP @cindex @option{-gnatP} (@command{gcc}) *************** Wide character encoding method *** 4360,4365 **** --- 4358,4367 ---- @cindex @option{-gnatx} (@command{gcc}) Suppress generation of cross-reference information. + @item -gnatX + @cindex @option{-gnatX} (@command{gcc}) + Enable GNAT implementation extensions and latest Ada version. + @item ^-gnaty^/STYLE_CHECKS=(option,option@dots{})^ @cindex @option{^-gnaty^/STYLE_CHECKS^} (@command{gcc}) Enable built-in style checks (@pxref{Style Checking}). *************** Inhibit the search of the default locati *** 4419,4425 **** Library (RTL) ALI files. @ifclear vms ! @item -O@ovar{n} @cindex @option{-O} (@command{gcc}) @var{n} controls the optimization level. --- 4421,4429 ---- Library (RTL) ALI files. @ifclear vms ! @c @item -O@ovar{n} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! @item -O@r{[}@var{n}@r{]} @cindex @option{-O} (@command{gcc}) @var{n} controls the optimization level. *************** The switches *** 4577,4582 **** --- 4581,4589 ---- @option{-gnatzc} and @option{-gnatzr} may not be combined with any other switches, and only one of them may appear in the command line. + @item + The switch @option{-gnat-p} may not be combined with any other switch. + @ifclear vms @item Once a ``y'' appears in the string (that is a use of the @option{-gnaty} *************** standard output is redirected, a brief s *** 4714,4727 **** @file{stderr} (standard error) giving the number of error messages and warning messages generated. ! @item -^gnatl^OUTPUT_FILE^=file ! @cindex @option{^-gnatl^OUTPUT_FILE^=fname} (@command{gcc}) This has the same effect as @option{-gnatl} except that the output is written to a file instead of to standard output. If the given name @file{fname} does not start with a period, then it is the full name of the file to be written. If @file{fname} is an extension, it is appended to the name of the file being compiled. For example, if ! file @file{xyz.adb} is compiled with @option{^-gnatl^OUTPUT_FILE^=.lst}, then the output is written to file ^xyz.adb.lst^xyz.adb_lst^. @item -gnatU --- 4721,4734 ---- @file{stderr} (standard error) giving the number of error messages and warning messages generated. ! @item ^-gnatl^/OUTPUT_FILE^=file ! @cindex @option{^-gnatl^/OUTPUT_FILE^=fname} (@command{gcc}) This has the same effect as @option{-gnatl} except that the output is written to a file instead of to standard output. If the given name @file{fname} does not start with a period, then it is the full name of the file to be written. If @file{fname} is an extension, it is appended to the name of the file being compiled. For example, if ! file @file{xyz.adb} is compiled with @option{^-gnatl^/OUTPUT_FILE^=.lst}, then the output is written to file ^xyz.adb.lst^xyz.adb_lst^. @item -gnatU *************** gnat_rm, GNAT Reference manual}. *** 5046,5059 **** @table @option @c !sort! @item -gnatwa ! @emph{Activate all optional errors.} @cindex @option{-gnatwa} (@command{gcc}) ! This switch activates most optional warning messages, see remaining list in this section for details on optional warning messages that can be individually controlled. The warnings that are not turned on by this switch are @option{-gnatwd} (implicit dereferencing), @option{-gnatwh} (hiding), @option{-gnatwl} (elaboration warnings), @option{-gnatw.o} (warn on values set by out parameters ignored) and @option{-gnatwt} (tracking of deleted conditional code). --- 5053,5067 ---- @table @option @c !sort! @item -gnatwa ! @emph{Activate most optional warnings.} @cindex @option{-gnatwa} (@command{gcc}) ! This switch activates most optional warning messages. See the remaining list in this section for details on optional warning messages that can be individually controlled. The warnings that are not turned on by this switch are @option{-gnatwd} (implicit dereferencing), @option{-gnatwh} (hiding), + @option{-gnatw.h} (holes (gaps) in record layouts) @option{-gnatwl} (elaboration warnings), @option{-gnatw.o} (warn on values set by out parameters ignored) and @option{-gnatwt} (tracking of deleted conditional code). *************** This switch suppresses warnings for impl *** 5190,5201 **** indexed components, slices, and selected components. @item -gnatwe ! @emph{Treat warnings as errors.} @cindex @option{-gnatwe} (@command{gcc}) @cindex Warnings, treat as error ! 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} --- 5198,5211 ---- indexed components, slices, and selected components. @item -gnatwe ! @emph{Treat warnings and style checks as errors.} @cindex @option{-gnatwe} (@command{gcc}) @cindex Warnings, treat as error ! This switch causes warning messages and style check 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. Note that this ! is the only -gnatw switch that affects the handling of style check messages. @item -gnatw.e @emph{Activate every optional warning} *************** Note that @option{-gnatwa} does not affe *** 5254,5259 **** --- 5264,5285 ---- @cindex @option{-gnatwH} (@command{gcc}) This switch suppresses warnings on hiding declarations. + @item -gnatw.h + @emph{Activate warnings on holes/gaps in records.} + @cindex @option{-gnatw.h} (@command{gcc}) + @cindex Record Representation (gaps) + This switch activates warnings on component clauses in record + representation clauses that leave holes (gaps) in the record layout. + If this warning option is active, then record representation clauses + should specify a contiguous layout, adding unused fill fields if needed. + Note that @option{-gnatwa} does not affect the setting of this warning option. + + @item -gnatw.H + @emph{Suppress warnings on holes/gaps in records.} + @cindex @option{-gnatw.H} (@command{gcc}) + This switch suppresses warnings on component clauses in record + representation clauses that leave holes (haps) in the record layout. + @item -gnatwi @emph{Activate warnings on implementation units.} @cindex @option{-gnatwi} (@command{gcc}) *************** This switch completely suppresses the *** 5558,5564 **** output of all warning messages from the GNAT front end. Note that it does not suppress warnings from the @command{gcc} back end. To suppress these back end warnings as well, use the switch @option{-w} ! in addition to @option{-gnatws}. @item -gnatwt @emph{Activate warnings for tracking of deleted conditional code.} --- 5584,5610 ---- output of all warning messages from the GNAT front end. Note that it does not suppress warnings from the @command{gcc} back end. To suppress these back end warnings as well, use the switch @option{-w} ! in addition to @option{-gnatws}. Also this switch has no effect on the ! handling of style check messages. ! ! @item -gnatw.s ! @emph{Activate warnings on overridden size clauses.} ! @cindex @option{-gnatw.s} (@command{gcc}) ! @cindex Record Representation (component sizes) ! This switch activates warnings on component clauses in record ! representation clauses where the length given overrides that ! specified by an explicit size clause for the component type. A ! warning is similarly given in the array case if a specified ! component size overrides an explicit size clause for the array ! component type. ! Note that @option{-gnatwa} does not affect the setting of this warning option. ! ! @item -gnatw.S ! @emph{Suppress warnings on overridden size clauses.} ! @cindex @option{-gnatw.S} (@command{gcc}) ! This switch suppresses warnings on component clauses in record ! representation clauses that override size clauses, and similar ! warnings when an array component size overrides a size clause. @item -gnatwt @emph{Activate warnings for tracking of deleted conditional code.} *************** This switch suppresses warnings for unus *** 5605,5610 **** --- 5651,5674 ---- It also turns off warnings on unreferenced formals (and thus includes the effect of @option{-gnatwF}). + @item -gnatw.u + @emph{Activate warnings on unordered enumeration types.} + @cindex @option{-gnatw.u} (@command{gcc}) + This switch causes enumeration types to be considered as conceptually + unordered, unless an explicit pragma @code{Ordered} is given for the type. + The effect is to generate warnings in clients that use explicit comparisons + or subranges, since these constructs both treat objects of the type as + ordered. (A @emph{client} is defined as a unit that is other than the unit in + which the type is declared, or its body or subunits.) Please refer to + the description of pragma @code{Ordered} in the + @cite{@value{EDITION} Reference Manual} for further details. + + @item -gnatw.U + @emph{Deactivate warnings on unordered enumeration types.} + @cindex @option{-gnatw.U} (@command{gcc}) + This switch causes all enumeration types to be considered as ordered, so + that no warnings are given for comparisons or subranges for any type. + @item -gnatwv @emph{Activate warnings on unassigned variables.} @cindex @option{-gnatwv} (@command{gcc}) *************** causes the compiler to *** 6117,6124 **** enforce specified style rules. A limited set of style rules has been used in writing the GNAT sources themselves. This switch allows user programs to activate all or some of these checks. If the source program fails a ! specified style check, an appropriate warning message is given, preceded by ! the character sequence ``(style)''. @ifset vms @code{(option,option,@dots{})} is a sequence of keywords @end ifset --- 6181,6201 ---- enforce specified style rules. A limited set of style rules has been used in writing the GNAT sources themselves. This switch allows user programs to activate all or some of these checks. If the source program fails a ! specified style check, an appropriate message is given, preceded by ! the character sequence ``(style)''. This message does not prevent ! successful compilation (unless the @option{-gnatwe} switch is used). ! ! Note that this is by no means intended to be a general facility for ! checking arbitrary coding standards. It is simply an embedding of the ! style rules we have chosen for the GNAT sources. If you are starting ! a project which does not have established style standards, you may ! find it useful to adopt the entire set of GNAT coding standards, or ! some subset of them. If you already have an established set of coding ! standards, then it may be that selected style checking options do ! indeed correspond to choices you have made, but for general checking ! of an existing set of coding rules, you should look to the gnatcheck ! tool, which is designed for that purpose. ! @ifset vms @code{(option,option,@dots{})} is a sequence of keywords @end ifset *************** Comments that follow other tokens on a l *** 6183,6190 **** following the ``@code{--}'' at the start of the comment. @item ! Full line comments must have two blanks following the ``@code{--}'' that ! starts the comment, with the following exceptions. @item A line consisting only of the ``@code{--}'' characters, possibly preceded --- 6260,6267 ---- following the ``@code{--}'' at the start of the comment. @item ! Full line comments must have at least two blanks following the ! ``@code{--}'' that starts the comment, with the following exceptions. @item A line consisting only of the ``@code{--}'' characters, possibly preceded *************** year). The compiler will generate code b *** 6608,6613 **** --- 6685,6700 ---- the condition being checked is true, which can result in disaster if that assumption is wrong. + The @option{-gnatp} switch has no effect if a subsequent + @option{-gnat-p} switch appears. + + @item -gnat-p + @cindex @option{-gnat-p} (@command{gcc}) + @cindex Suppressing checks + @cindex Checks, suppressing + @findex Suppress + This switch cancels the effect of a previous @option{gnatp} switch. + @item -gnato @cindex @option{-gnato} (@command{gcc}) @cindex Overflow checks *************** uses of the new Ada 2005 features will c *** 6881,6907 **** messages or warnings. This switch also can be used to cancel the effect of a previous ! @option{-gnat83} or @option{-gnat05} switch earlier in the command line. ! @item -gnat05 (Ada 2005 mode) @cindex @option{-gnat05} (@command{gcc}) @cindex Ada 2005 mode @noindent This switch directs the compiler to implement the Ada 2005 version of the ! language. Since Ada 2005 is almost completely upwards compatible with Ada 95 (and thus also with Ada 83), Ada 83 and Ada 95 programs may generally be compiled using this switch (see the description of the @option{-gnat83} and @option{-gnat95} switches for further information). For information about the approved ``Ada Issues'' that have been incorporated ! into Ada 2005, see @url{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs}. ! Included with GNAT releases is a file @file{features-ada0y} that describes ! the set of implemented Ada 2005 features. ! @end table @node Character Set Control @subsection Character Set Control --- 6968,7029 ---- messages or warnings. This switch also can be used to cancel the effect of a previous ! @option{-gnat83}, @option{-gnat05/2005}, or @option{-gnat12/2012} ! switch earlier in the command line. ! @item -gnat05 or -gnat2005 (Ada 2005 mode) @cindex @option{-gnat05} (@command{gcc}) + @cindex @option{-gnat2005} (@command{gcc}) @cindex Ada 2005 mode @noindent This switch directs the compiler to implement the Ada 2005 version of the ! language, as documented in the official Ada standards document. Since Ada 2005 is almost completely upwards compatible with Ada 95 (and thus also with Ada 83), Ada 83 and Ada 95 programs may generally be compiled using this switch (see the description of the @option{-gnat83} and @option{-gnat95} switches for further information). + @ifset PROEDITION + Note that even though Ada 2005 is the current official version of the + language, GNAT still compiles in Ada 95 mode by default, so if you are + using Ada 2005 features in your program, you must use this switch (or + the equivalent Ada_05 or Ada_2005 configuration pragmas). + @end ifset + + @item -gnat12 or -gnat2012 (Ada 2012 mode) + @cindex @option{-gnat12} (@command{gcc}) + @cindex @option{-gnat2012} (@command{gcc}) + @cindex Ada 2012 mode + + @noindent + This switch directs the compiler to implement the Ada 2012 version of the + language. + Since Ada 2012 is almost completely upwards + compatible with Ada 2005 (and thus also with Ada 83, and Ada 95), + Ada 83 and Ada 95 programs + may generally be compiled using this switch (see the description of the + @option{-gnat83}, @option{-gnat95}, and @option{-gnat05/2005} switches + for further information). + For information about the approved ``Ada Issues'' that have been incorporated ! into Ada 2012, see @url{http://www.ada-auth.org/ais.html}. ! Included with GNAT releases is a file @file{features-ada12} that describes ! the set of implemented Ada 2012 features. + @item -gnatX (Enable GNAT Extensions) + @cindex @option{-gnatX} (@command{gcc}) + @cindex Ada language extensions + @cindex GNAT extensions + + @noindent + This switch directs the compiler to implement the latest version of the + language (currently Ada 2012) and also to enable certain GNAT implementation + extensions that are not part of any Ada standard. For a full list of these + extensions, see the GNAT reference manual. + + @end table @node Character Set Control @subsection Character Set Control *************** Shows the storage pool associated with a *** 7187,7193 **** Used to list an equivalent declaration for an internally generated type that is referenced elsewhere in the listing. ! @item freeze @var{type-name} @ovar{actions} Shows the point at which @var{type-name} is frozen, with possible associated actions to be performed at the freeze point. --- 7309,7317 ---- Used to list an equivalent declaration for an internally generated type that is referenced elsewhere in the listing. ! @c @item freeze @var{type-name} @ovar{actions} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! @item freeze @var{type-name} @r{[}@var{actions}@r{]} Shows the point at which @var{type-name} is frozen, with possible associated actions to be performed at the freeze point. *************** to be read by the @command{gnatlink} uti *** 7886,7897 **** The form of the @code{gnatbind} command is @smallexample ! $ gnatbind @ovar{switches} @var{mainprog}@r{[}.ali@r{]} @ovar{switches} @end smallexample @noindent where @file{@var{mainprog}.adb} is the Ada file containing the main program ! unit body. If no switches are specified, @code{gnatbind} constructs an Ada package in two files whose names are @file{b~@var{mainprog}.ads}, and @file{b~@var{mainprog}.adb}. For example, if given the --- 8010,8023 ---- The form of the @code{gnatbind} command is @smallexample ! @c $ gnatbind @ovar{switches} @var{mainprog}@r{[}.ali@r{]} @ovar{switches} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatbind @r{[}@var{switches}@r{]} @var{mainprog}@r{[}.ali@r{]} @r{[}@var{switches}@r{]} @end smallexample @noindent where @file{@var{mainprog}.adb} is the Ada file containing the main program ! unit body. @code{gnatbind} constructs an Ada package in two files whose names are @file{b~@var{mainprog}.ads}, and @file{b~@var{mainprog}.adb}. For example, if given the *************** the generated main program. It can also *** 7962,7975 **** Ada code provided the @option{^-g^/DEBUG^} switch is used for @command{gnatbind} and @command{gnatlink}. - However for some purposes it may be convenient to generate the main - program in C rather than Ada. This may for example be helpful when you - are generating a mixed language program with the main program in C. The - GNAT compiler itself is an example. - The use of the @option{^-C^/BIND_FILE=C^} switch - for both @code{gnatbind} and @command{gnatlink} will cause the program to - be generated in C (and compiled using the gnu C compiler). - @node Switches for gnatbind @section Switches for @command{gnatbind} --- 8088,8093 ---- *************** be presented in subsequent sections. *** 7982,7987 **** --- 8100,8106 ---- * Binder Error Message Control:: * Elaboration Control:: * Output Control:: + * Dynamic Allocation Control:: * Binding with Non-Ada Main Programs:: * Binding Programs with No Main Subprogram:: @end menu *************** Specify directory to be searched for ALI *** 8013,8021 **** @cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatbind}) Specify directory to be searched for source file. ! @item ^-A^/BIND_FILE=ADA^ ! @cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatbind}) ! Generate binder program in Ada (default) @item ^-b^/REPORT_ERRORS=BRIEF^ @cindex @option{^-b^/REPORT_ERRORS=BRIEF^} (@command{gnatbind}) --- 8132,8140 ---- @cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatbind}) Specify directory to be searched for source file. ! @item ^-A^/ALI_LIST^@r{[=}@var{filename}@r{]} ! @cindex @option{^-A^/ALI_LIST^} (@command{gnatbind}) ! Output ALI list (to standard output or to the named file). @item ^-b^/REPORT_ERRORS=BRIEF^ @cindex @option{^-b^/REPORT_ERRORS=BRIEF^} (@command{gnatbind}) *************** Generate brief messages to @file{stderr} *** 8025,8034 **** @cindex @option{^-c^/NOOUTPUT^} (@command{gnatbind}) Check only, no generation of binder output file. - @item ^-C^/BIND_FILE=C^ - @cindex @option{^-C^/BIND_FILE=C^} (@command{gnatbind}) - Generate binder program in C - @item ^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]} @cindex @option{^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}} (@command{gnatbind}) This switch can be used to change the default task stack size value --- 8144,8149 ---- *************** Output complete list of elaboration-orde *** 8071,8077 **** @item ^-E^/STORE_TRACEBACKS^ @cindex @option{^-E^/STORE_TRACEBACKS^} (@command{gnatbind}) Store tracebacks in exception occurrences when the target supports it. - This is the default with the zero cost exception mechanism. @ignore @c The following may get moved to an appendix This option is currently supported on the following targets: --- 8186,8191 ---- *************** flag checks are generated. *** 8098,8103 **** --- 8212,8228 ---- @cindex @option{^-h^/HELP^} (@command{gnatbind}) Output usage (help) information + @item ^-H32^/32_MALLOC^ + @cindex @option{^-H32^/32_MALLOC^} (@command{gnatbind}) + Use 32-bit allocations for @code{__gnat_malloc} (and thus for access types). + For further details see @ref{Dynamic Allocation Control}. + + @item ^-H64^/64_MALLOC^ + @cindex @option{^-H64^/64_MALLOC^} (@command{gnatbind}) + Use 64-bit allocations for @code{__gnat_malloc} (and thus for access types). + @cindex @code{__gnat_malloc} + For further details see @ref{Dynamic Allocation Control}. + @item ^-I^/SEARCH^ @cindex @option{^-I^/SEARCH^} (@command{gnatbind}) Specify directory to be searched for source and ALI files. *************** Name the output file @var{file} (default *** 8173,8181 **** Note that if this option is used, then linking must be done manually, gnatlink cannot be used. ! @item ^-O^/OBJECT_LIST^ @cindex @option{^-O^/OBJECT_LIST^} (@command{gnatbind}) ! Output object list. @item ^-p^/PESSIMISTIC_ELABORATION^ @cindex @option{^-p^/PESSIMISTIC_ELABORATION^} (@command{gnatbind}) --- 8298,8306 ---- Note that if this option is used, then linking must be done manually, gnatlink cannot be used. ! @item ^-O^/OBJECT_LIST^@r{[=}@var{filename}@r{]} @cindex @option{^-O^/OBJECT_LIST^} (@command{gnatbind}) ! Output object list (to standard output or to the named file). @item ^-p^/PESSIMISTIC_ELABORATION^ @cindex @option{^-p^/PESSIMISTIC_ELABORATION^} (@command{gnatbind}) *************** generated by the binder. *** 8474,8497 **** @table @option @c !sort! - @item ^-A^/BIND_FILE=ADA^ - @cindex @option{^-A^/BIND_FILE=ADA^} (@code{gnatbind}) - Generate binder program in Ada (default). The binder program is named - @file{b~@var{mainprog}.adb} by default. This can be changed with - @option{^-o^/OUTPUT^} @code{gnatbind} option. - @item ^-c^/NOOUTPUT^ @cindex @option{^-c^/NOOUTPUT^} (@code{gnatbind}) Check only. Do not generate the binder output file. In this mode the binder performs all error checks but does not generate an output file. - @item ^-C^/BIND_FILE=C^ - @cindex @option{^-C^/BIND_FILE=C^} (@code{gnatbind}) - Generate binder program in C. The binder program is named - @file{b_@var{mainprog}.c}. - This can be changed with @option{^-o^/OUTPUT^} @code{gnatbind} - option. - @item ^-e^/ELABORATION_DEPENDENCIES^ @cindex @option{^-e^/ELABORATION_DEPENDENCIES^} (@code{gnatbind}) Output complete list of elaboration-order dependencies, showing the --- 8599,8609 ---- *************** directory names for the run-time units d *** 8526,8533 **** @cindex @option{^-o^/OUTPUT^} (@code{gnatbind}) Set name of output file to @var{file} instead of the normal @file{b~@var{mainprog}.adb} default. Note that @var{file} denote the Ada ! binder generated body filename. In C mode you would normally give ! @var{file} an extension of @file{.c} because it will be a C source program. Note that if this option is used, then linking must be done manually. It is not possible to use gnatlink in this case, since it cannot locate the binder file. --- 8638,8644 ---- @cindex @option{^-o^/OUTPUT^} (@code{gnatbind}) Set name of output file to @var{file} instead of the normal @file{b~@var{mainprog}.adb} default. Note that @var{file} denote the Ada ! binder generated body filename. Note that if this option is used, then linking must be done manually. It is not possible to use gnatlink in this case, since it cannot locate the binder file. *************** be used to improve code generation in so *** 8540,8545 **** --- 8651,8685 ---- @end table + @node Dynamic Allocation Control + @subsection Dynamic Allocation Control + + @noindent + The heap control switches -- @option{-H32} and @option{-H64} -- + determine whether dynamic allocation uses 32-bit or 64-bit memory. + They only affect compiler-generated allocations via @code{__gnat_malloc}; + explicit calls to @code{malloc} and related functions from the C + run-time library are unaffected. + + @table @option + @item -H32 + Allocate memory on 32-bit heap + + @item -H64 + Allocate memory on 64-bit heap. This is the default + unless explicitly overridden by a @code{'Size} clause on the access type. + @end table + + @ifset vms + @noindent + See also @ref{Access types and 32/64-bit allocation}. + @end ifset + @ifclear vms + @noindent + These switches are only effective on VMS platforms. + @end ifclear + + @node Binding with Non-Ada Main Programs @subsection Binding with Non-Ada Main Programs *************** more quite separate groups of Ada units. *** 8601,8609 **** The binder takes the name of its output file from the last specified ALI file, unless overridden by the use of the @option{^-o file^/OUTPUT=file^}. @cindex @option{^-o^/OUTPUT^} (@command{gnatbind}) ! The output is an Ada unit in source form that can ! be compiled with GNAT unless the -C switch is used in which case the ! output is a C source file, which must be compiled using the C compiler. This compilation occurs automatically as part of the @command{gnatlink} processing. --- 8741,8747 ---- The binder takes the name of its output file from the last specified ALI file, unless overridden by the use of the @option{^-o file^/OUTPUT=file^}. @cindex @option{^-o^/OUTPUT^} (@command{gnatbind}) ! The output is an Ada unit in source form that can be compiled with GNAT. This compilation occurs automatically as part of the @command{gnatlink} processing. *************** The main program @code{Hello} (source pr *** 8800,8838 **** bound using the standard switch settings. The generated main program is @file{mainprog.adb} with the associated spec in @file{mainprog.ads}. Note that you must specify the body here not the ! spec, in the case where the output is in Ada. Note that if this option ! is used, then linking must be done manually, since gnatlink will not ! be able to find the generated file. ! ! @ifclear vms ! @item gnatbind main -C -o mainprog.c -x ! @end ifclear ! @ifset vms ! @item gnatbind MAIN.ALI /BIND_FILE=C /OUTPUT=Mainprog.C /READ_SOURCES=NONE ! @end ifset ! The main program @code{Main} (source program in ! @file{main.adb}) is bound, excluding source files from the ! consistency checking, generating ! the file @file{mainprog.c}. ! ! @ifclear vms ! @item gnatbind -x main_program -C -o mainprog.c ! This command is exactly the same as the previous example. Switches may ! appear anywhere in the command line, and single letter switches may be ! combined into a single switch. ! @end ifclear ! ! @ifclear vms ! @item gnatbind -n math dbase -C -o ada-control.c ! @end ifclear ! @ifset vms ! @item gnatbind /NOMAIN math dbase /BIND_FILE=C /OUTPUT=ada-control.c ! @end ifset ! The main program is in a language other than Ada, but calls to ! subprograms in packages @code{Math} and @code{Dbase} appear. This call ! to @code{gnatbind} generates the file @file{ada-control.c} containing ! the @code{adainit} and @code{adafinal} routines to be called before and ! after accessing the Ada units. @end table @c ------------------------------------ --- 8938,8945 ---- bound using the standard switch settings. The generated main program is @file{mainprog.adb} with the associated spec in @file{mainprog.ads}. Note that you must specify the body here not the ! spec. Note that if this option is used, then linking must be done manually, ! since gnatlink will not be able to find the generated file. @end table @c ------------------------------------ *************** driver (see @ref{The GNAT Driver and Pro *** 8865,8872 **** The form of the @command{gnatlink} command is @smallexample ! $ gnatlink @ovar{switches} @var{mainprog}@r{[}.ali@r{]} ! @ovar{non-Ada objects} @ovar{linker options} @end smallexample @noindent --- 8972,8983 ---- The form of the @command{gnatlink} command is @smallexample ! @c $ gnatlink @ovar{switches} @var{mainprog}@r{[}.ali@r{]} ! @c @ovar{non-Ada objects} @ovar{linker options} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatlink @r{[}@var{switches}@r{]} @var{mainprog}@r{[}.ali@r{]} ! @r{[}@var{non-Ada objects}@r{]} @r{[}@var{linker options}@r{]} ! @end smallexample @noindent *************** units, or in @code{Import} pragmas in an *** 8897,8909 **** switches. The default linker called by gnatlink is @command{gcc} which in turn calls the appropriate system linker. Standard options for the linker such as @option{-lmy_lib} or @option{-Ldir} can be added as is. For options that are not recognized by @command{gcc} as linker options, use the @command{gcc} switches @option{-Xlinker} or @option{-Wl,}. Refer to the GCC documentation for ! details. Here is an example showing how to generate a linker map: @smallexample $ ^gnatlink my_prog -Wl,-Map,MAPFILE^GNAT LINK my_prog.ali /MAP^ --- 9008,9028 ---- switches. The default linker called by gnatlink is @command{gcc} which in turn calls the appropriate system linker. + + One useful option for the linker is @option{-s}: it reduces the size of the + executable by removing all symbol table and relocation information from the + executable. + Standard options for the linker such as @option{-lmy_lib} or @option{-Ldir} can be added as is. For options that are not recognized by @command{gcc} as linker options, use the @command{gcc} switches @option{-Xlinker} or @option{-Wl,}. + Refer to the GCC documentation for ! details. ! ! Here is an example showing how to generate a linker map: @smallexample $ ^gnatlink my_prog -Wl,-Map,MAPFILE^GNAT LINK my_prog.ali /MAP^ *************** Display Copyright and version, then exit *** 8947,8963 **** If @option{--version} was not used, display usage, then exit disregarding all other options. - @item ^-A^/BIND_FILE=ADA^ - @cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatlink}) - The binder has generated code in Ada. This is the default. - - @item ^-C^/BIND_FILE=C^ - @cindex @option{^-C^/BIND_FILE=C^} (@command{gnatlink}) - If instead of generating a file in Ada, the binder has generated one in - C, then the linker needs to know about it. Use this switch to signal - to @command{gnatlink} that the binder has generated C code rather than - Ada code. - @item ^-f^/FORCE_OBJECT_FILE_LIST^ @cindex Command line length @cindex @option{^-f^/FORCE_OBJECT_FILE_LIST^} (@command{gnatlink}) --- 9066,9071 ---- *************** dependencies, they will always be tracke *** 9144,9151 **** The usual form of the @command{gnatmake} command is @smallexample ! $ gnatmake @ovar{switches} @var{file_name} ! @ovar{file_names} @ovar{mode_switches} @end smallexample @noindent --- 9252,9262 ---- The usual form of the @command{gnatmake} command is @smallexample ! @c $ gnatmake @ovar{switches} @var{file_name} ! @c @ovar{file_names} @ovar{mode_switches} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatmake @r{[}@var{switches}@r{]} @var{file_name} ! @r{[}@var{file_names}@r{]} @r{[}@var{mode_switches}@r{]} @end smallexample @noindent *************** itself must not include any embedded spa *** 9233,9238 **** --- 9344,9388 ---- @end ifclear + @item ^--subdirs^/SUBDIRS^=subdir + Actual object directory of each project file is the subdirectory subdir of the + object directory specified or defaulted in the project file. + + @item ^--single-compile-per-obj-dir^/SINGLE_COMPILE_PER_OBJ_DIR^ + Disallow simultaneous compilations in the same object directory when + project files are used. + + @item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^ + By default, shared library projects are not allowed to import static library + projects. When this switch is used on the command line, this restriction is + relaxed. + + @item ^--source-info=^/SRC_INFO=source-info-file^ + Specify a source info file. This switch is active only when project files + are used. If the source info file is specified as a relative path, then it is + relative to the object directory of the main project. If the source info file + does not exist, then after the Project Manager has successfully parsed and + processed the project files and found the sources, it creates the source info + file. If the source info file already exists and can be read successfully, + then the Project Manager will get all the needed information about the sources + from the source info file and will not look for them. This reduces the time + to process the project files, especially when looking for sources that take a + long time. If the source info file exists but cannot be parsed successfully, + the Project Manager will attempt to recreate it. If the Project Manager fails + to create the source info file, a message is issued, but gnatmake does not + fail. + + @ifclear vms + @item --create-map-file + When linking an executable, create a map file. The name of the map file + has the same name as the executable with extension ".map". + + @item --create-map-file=mapfile + When linking an executable, create a map file. The name of the map file is + "mapfile". + + @end ifclear + @item ^-a^/ALL_FILES^ @cindex @option{^-a^/ALL_FILES^} (@command{gnatmake}) Consider all files in the make process, even the GNAT internal system *************** This also assumes that no directory matc *** 9342,9348 **** instance that you do not have a directory called "sources.ads" when using the default GNAT naming scheme). ! When you do not have to use this switch (ie by default), gnatmake is able to save a lot of system calls (several per source file and object file), which can result in a significant speed up to load and manipulate a project file, especially when using source files from a remote system. --- 9492,9498 ---- instance that you do not have a directory called "sources.ads" when using the default GNAT naming scheme). ! When you do not have to use this switch (i.e.@: by default), gnatmake is able to save a lot of system calls (several per source file and object file), which can result in a significant speed up to load and manipulate a project file, especially when using source files from a remote system. *************** generates highly optimized code and has *** 10088,10099 **** the slowest compilation time. @item ^-O3^/OPTIMIZE=INLINING^ ! Full optimization as in @option{-O2}, ! and also attempts automatic inlining of small ! subprograms within a unit (@pxref{Inlining of Subprograms}). @item ^-Os^/OPTIMIZE=SPACE^ ! Optimize space usage of resulting program. @end table @noindent --- 10238,10249 ---- the slowest compilation time. @item ^-O3^/OPTIMIZE=INLINING^ ! Full optimization as in @option{-O2}; ! also uses more aggressive automatic inlining of subprograms within a unit ! (@pxref{Inlining of Subprograms}) and attempts to vectorize loops. @item ^-Os^/OPTIMIZE=SPACE^ ! Optimize space usage (code and data) of resulting program. @end table @noindent *************** levels. *** 10122,10128 **** Note regarding the use of @option{-O3}: The use of this optimization level is generally discouraged with GNAT, since it often results in larger ! executables which run more slowly. See further discussion of this point in @ref{Inlining of Subprograms}. @node Debugging Optimized Code --- 10272,10278 ---- Note regarding the use of @option{-O3}: The use of this optimization level is generally discouraged with GNAT, since it often results in larger ! executables which may run more slowly. See further discussion of this point in @ref{Inlining of Subprograms}. @node Debugging Optimized Code *************** subprograms. *** 10272,10280 **** @item @cindex pragma Inline @findex Inline ! 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 --- 10422,10432 ---- @item @cindex pragma Inline @findex Inline ! Any one of the following applies: @code{pragma Inline} is applied to the ! subprogram and the @option{^-gnatn^/INLINE^} switch is specified; the ! subprogram is local to the unit and called once from within it; the ! subprogram is small and optimization level @option{-O2} is specified; ! optimization level @option{-O3}) is specified. @end itemize @noindent *************** The call appears in a body (not in a pac *** 10298,10306 **** There is a @code{pragma Inline} for the subprogram. @item ! @cindex @option{-gnatn} (@command{gcc}) ! The @option{^-gnatn^/INLINE^} switch ! is used in the @command{gcc} command line @end itemize Even if all these conditions are met, it may not be possible for --- 10450,10456 ---- There is a @code{pragma Inline} for the subprogram. @item ! The @option{^-gnatn^/INLINE^} switch is used on the command line. @end itemize Even if all these conditions are met, it may not be possible for *************** this switch is used to suppress the resu *** 10358,10364 **** @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 --- 10508,10518 ---- @cindex @option{-fno-inline-functions} (@command{gcc}) Note: The @option{-fno-inline-functions} switch can be used to prevent ! automatic inlining of subprograms if @option{-O3} is used. ! ! @cindex @option{-fno-inline-small-functions} (@command{gcc}) ! Note: The @option{-fno-inline-small-functions} switch can be used to prevent ! automatic inlining of small subprograms if @option{-O2} is used. @cindex @option{-fno-inline-functions-called-once} (@command{gcc}) Note: The @option{-fno-inline-functions-called-once} switch *************** program. *** 10670,10675 **** --- 10824,10830 ---- @menu * About gnatelim:: * Running gnatelim:: + * Processing Precompiled Libraries:: * Correcting the List of Eliminate Pragmas:: * Making Your Executables Smaller:: * Summary of the gnatelim Usage Cycle:: *************** because the compiler will not generate t *** 10693,10712 **** @xref{Pragma Eliminate,,, gnat_rm, GNAT Reference Manual}, for more information about this pragma. ! @code{gnatelim} needs as its input data the name of the main subprogram ! and a bind file for a main subprogram. ! To create a bind file for @code{gnatelim}, run @code{gnatbind} for ! the main subprogram. @code{gnatelim} can work with both Ada and C ! bind files; when both are present, it uses the Ada bind file. ! The following commands will build the program and create the bind file: @smallexample $ gnatmake ^-c Main_Prog^/ACTIONS=COMPILE MAIN_PROG^ - $ gnatbind main_prog @end smallexample ! Note that @code{gnatelim} needs neither object nor ALI files. @node Running gnatelim @subsection Running @code{gnatelim} --- 10848,10871 ---- @xref{Pragma Eliminate,,, gnat_rm, GNAT Reference Manual}, for more information about this pragma. ! @code{gnatelim} needs as its input data the name of the main subprogram. ! If a set of source files is specified as @code{gnatelim} arguments, it ! treats these files as a complete set of sources making up a program to ! analyse, and analyses only these sources. ! ! After a full successful build of the main subprogram @code{gnatelim} can be ! called without specifying sources to analyse, in this case it computes ! the source closure of the main unit from the @file{ALI} files. ! ! The following command will create the set of @file{ALI} files needed for ! @code{gnatelim}: @smallexample $ gnatmake ^-c Main_Prog^/ACTIONS=COMPILE MAIN_PROG^ @end smallexample ! Note that @code{gnatelim} does not need object files. @node Running gnatelim @subsection Running @code{gnatelim} *************** Note that @code{gnatelim} needs neither *** 10715,10737 **** @code{gnatelim} has the following command-line interface: @smallexample ! $ gnatelim @ovar{options} name @end smallexample @noindent ! @code{name} should be a name of a source file that contains the main subprogram ! of a program (partition). @code{gnatelim} has the following switches: @table @option @c !sort! @item ^-q^/QUIET^ @cindex @option{^-q^/QUIET^} (@command{gnatelim}) Quiet mode: by default @code{gnatelim} outputs to the standard error stream the number of program units left to be processed. This option turns this trace off. @item ^-v^/VERBOSE^ @cindex @option{^-v^/VERBOSE^} (@command{gnatelim}) Verbose mode: @code{gnatelim} version information is printed as Ada --- 10874,10944 ---- @code{gnatelim} has the following command-line interface: @smallexample ! $ gnatelim [@var{switches}] ^-main^?MAIN^=@var{main_unit_name} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]} @end smallexample @noindent ! @var{main_unit_name} should be a name of a source file that contains the main ! subprogram of a program (partition). ! ! Each @var{filename} is the name (including the extension) of a source ! file to process. ``Wildcards'' are allowed, and ! the file name may contain path information. ! ! @samp{@var{gcc_switches}} is a list of switches for ! @command{gcc}. They will be passed on to all compiler invocations made by ! @command{gnatelim} to generate the ASIS trees. Here you can provide ! @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, ! use the @option{-gnatec} switch to set the configuration file, ! use the @option{-gnat05} switch if sources should be compiled in ! Ada 2005 mode etc. @code{gnatelim} has the following switches: @table @option @c !sort! + @item ^-files^/FILES^=@var{filename} + @cindex @option{^-files^/FILES^} (@code{gnatelim}) + Take the argument source files from the specified file. This file should be an + ordinary text file containing file names separated by spaces or + line breaks. You can use this switch more than once in the same call to + @command{gnatelim}. You also can combine this switch with + an explicit list of files. + + @item ^-log^/LOG^ + @cindex @option{^-log^/LOG^} (@command{gnatelim}) + Duplicate all the output sent to @file{stderr} into a log file. The log file + is named @file{gnatelim.log} and is located in the current directory. + + @item ^-log^/LOGFILE^=@var{filename} + @cindex @option{^-log^/LOGFILE^} (@command{gnatelim}) + Duplicate all the output sent to @file{stderr} into a specified log file. + + @cindex @option{^--no-elim-dispatch^/NO_DISPATCH^} (@command{gnatelim}) + @item ^--no-elim-dispatch^/NO_DISPATCH^ + Do not generate pragmas for dispatching operations. + + @item ^--ignore^/IGNORE^=@var{filename} + @cindex @option{^--ignore^/IGNORE^} (@command{gnatelim}) + Do not generate pragmas for subprograms declared in the sources + listed in a specified file + + @cindex @option{^-o^/OUTPUT^} (@command{gnatelim}) + @item ^-o^/OUTPUT^=@var{report_file} + Put @command{gnatelim} output into a specified file. If this file already exists, + it is overridden. If this switch is not used, @command{gnatelim} outputs its results + into @file{stderr} + @item ^-q^/QUIET^ @cindex @option{^-q^/QUIET^} (@command{gnatelim}) Quiet mode: by default @code{gnatelim} outputs to the standard error stream the number of program units left to be processed. This option turns this trace off. + @cindex @option{^-t^/TIME^} (@command{gnatelim}) + @item ^-t^/TIME^ + Print out execution time. + @item ^-v^/VERBOSE^ @cindex @option{^-v^/VERBOSE^} (@command{gnatelim}) Verbose mode: @code{gnatelim} version information is printed as Ada *************** comments to the standard output stream. *** 10739,10805 **** program units left @code{gnatelim} will output the name of the current unit being processed. ! @item ^-a^/ALL^ ! @cindex @option{^-a^/ALL^} (@command{gnatelim}) ! Also look for subprograms from the GNAT run time that can be eliminated. Note ! that when @file{gnat.adc} is produced using this switch, the entire program ! must be recompiled with switch @option{^-a^/ALL_FILES^} to @command{gnatmake}. ! ! @item ^-I^/INCLUDE_DIRS=^@var{dir} ! @cindex @option{^-I^/INCLUDE_DIRS^} (@command{gnatelim}) ! When looking for source files also look in directory @var{dir}. Specifying ! @option{^-I-^/INCLUDE_DIRS=-^} instructs @code{gnatelim} not to look for ! sources in the current directory. ! ! @item ^-b^/BIND_FILE=^@var{bind_file} ! @cindex @option{^-b^/BIND_FILE^} (@command{gnatelim}) ! Specifies @var{bind_file} as the bind file to process. If not set, the name ! of the bind file is computed from the full expanded Ada name ! of a main subprogram. ! ! @item ^-C^/CONFIG_FILE=^@var{config_file} ! @cindex @option{^-C^/CONFIG_FILE^} (@command{gnatelim}) ! Specifies a file @var{config_file} that contains configuration pragmas. The ! file must be specified with full path. ! ! @item ^--GCC^/COMPILER^=@var{compiler_name} ! @cindex @option{^-GCC^/COMPILER^} (@command{gnatelim}) ! Instructs @code{gnatelim} to use specific @command{gcc} compiler instead of one ! available on the path. ! ! @item ^--GNATMAKE^/GNATMAKE^=@var{gnatmake_name} ! @cindex @option{^--GNATMAKE^/GNATMAKE^} (@command{gnatelim}) ! Instructs @code{gnatelim} to use specific @command{gnatmake} instead of one ! available on the path. @end table ! @noindent ! @code{gnatelim} sends its output to the standard output stream, and all the ! tracing and debug information is sent to the standard error stream. ! In order to produce a proper GNAT configuration file ! @file{gnat.adc}, redirection must be used: ! ! @smallexample ! @ifset vms ! $ PIPE GNAT ELIM MAIN_PROG.ADB > GNAT.ADC ! @end ifset ! @ifclear vms ! $ gnatelim main_prog.adb > gnat.adc ! @end ifclear ! @end smallexample ! ! @ifclear vms ! @noindent ! or ! ! @smallexample ! $ gnatelim main_prog.adb >> gnat.adc ! @end smallexample @noindent ! in order to append the @code{gnatelim} output to the existing contents of ! @file{gnat.adc}. ! @end ifclear @node Correcting the List of Eliminate Pragmas @subsection Correcting the List of Eliminate Pragmas --- 10946,10969 ---- program units left @code{gnatelim} will output the name of the current unit being processed. ! @item ^-wq^/WARNINGS=QUIET^ ! @cindex @option{^-wq^/WARNINGS=QUIET^} (@command{gnatelim}) ! Quiet warning mode - some warnings are suppressed. In particular warnings that ! indicate that the analysed set of sources is incomplete to make up a ! partition and that some subprogram bodies are missing are not generated. @end table ! @node Processing Precompiled Libraries ! @subsection Processing Precompiled Libraries @noindent ! If some program uses a precompiled Ada library, it can be processed by ! @code{gnatelim} in a usual way. @code{gnatelim} will newer generate an ! Eliminate pragma for a subprogram if the body of this subprogram has not ! been analysed, this is a typical case for subprograms from precompiled ! libraries. Switch @option{^-wq^/WARNINGS=QUIET^} may be used to suppress ! warnings about missing source files and non-analyzed subprogram bodies ! that can be generated when processing precompiled Ada libraries. @node Correcting the List of Eliminate Pragmas @subsection Correcting the List of Eliminate Pragmas *************** subprograms that are actually called in *** 10810,10831 **** compiler will generate an error message of the form: @smallexample ! file.adb:106:07: cannot call eliminated subprogram "My_Prog" @end smallexample @noindent You will need to manually remove the wrong @code{Eliminate} pragmas from ! the @file{gnat.adc} file. You should recompile your program ! from scratch after that, because you need a consistent @file{gnat.adc} file ! during the entire compilation. @node Making Your Executables Smaller @subsection Making Your Executables Smaller @noindent In order to get a smaller executable for your program you now have to ! recompile the program completely with the new @file{gnat.adc} file ! created by @code{gnatelim} in your current directory: @smallexample $ gnatmake ^-f main_prog^/FORCE_COMPILE MAIN_PROG^ --- 10974,10996 ---- compiler will generate an error message of the form: @smallexample ! main.adb:4:08: cannot reference subprogram "P" eliminated at elim.out:5 @end smallexample @noindent You will need to manually remove the wrong @code{Eliminate} pragmas from ! the configuration file indicated in the error message. You should recompile ! your program from scratch after that, because you need a consistent ! configuration file(s) during the entire compilation. @node Making Your Executables Smaller @subsection Making Your Executables Smaller @noindent In order to get a smaller executable for your program you now have to ! recompile the program completely with the configuration file containing ! pragmas Eliminate generated by gnatelim. If these pragmas are placed in ! @file{gnat.adc} file located in your current directory, just do: @smallexample $ gnatmake ^-f main_prog^/FORCE_COMPILE MAIN_PROG^ *************** with the set of pragmas @code{Eliminate} *** 10839,10848 **** Be aware that the set of @code{Eliminate} pragmas is specific to each program. It is not recommended to merge sets of @code{Eliminate} ! pragmas created for different programs in one @file{gnat.adc} file. @node Summary of the gnatelim Usage Cycle ! @subsection Summary of the gnatelim Usage Cycle @noindent Here is a quick summary of the steps to be taken in order to reduce --- 11004,11013 ---- Be aware that the set of @code{Eliminate} pragmas is specific to each program. It is not recommended to merge sets of @code{Eliminate} ! pragmas created for different programs in one configuration file. @node Summary of the gnatelim Usage Cycle ! @subsection Summary of the @code{gnatelim} Usage Cycle @noindent Here is a quick summary of the steps to be taken in order to reduce *************** to produce the debugging information, to *** 10852,10866 **** @enumerate @item ! Produce a bind file @smallexample $ gnatmake ^-c main_prog^/ACTIONS=COMPILE MAIN_PROG^ - $ gnatbind main_prog @end smallexample @item ! Generate a list of @code{Eliminate} pragmas @smallexample @ifset vms $ PIPE GNAT ELIM MAIN_PROG > GNAT.ADC --- 11017,11032 ---- @enumerate @item ! Create a complete set of @file{ALI} files (if the program has not been ! built already) @smallexample $ gnatmake ^-c main_prog^/ACTIONS=COMPILE MAIN_PROG^ @end smallexample @item ! Generate a list of @code{Eliminate} pragmas in default configuration file ! @file{gnat.adc} in the current directory @smallexample @ifset vms $ PIPE GNAT ELIM MAIN_PROG > GNAT.ADC *************** in which GNAT processes the ACVC tests. *** 11119,11126 **** The @code{gnatchop} command has the form: @smallexample $ gnatchop switches @var{file name} @r{[}@var{file name} @dots{}@r{]} ! @ovar{directory} @end smallexample @noindent --- 11285,11295 ---- The @code{gnatchop} command has the form: @smallexample + @c $ gnatchop switches @var{file name} @r{[}@var{file name} @dots{}@r{]} + @c @ovar{directory} + @c Expanding @ovar macro inline (explanation in macro def comments) $ gnatchop switches @var{file name} @r{[}@var{file name} @dots{}@r{]} ! @r{[}@var{directory}@r{]} @end smallexample @noindent *************** recognized by GNAT: *** 11376,11381 **** --- 11545,11552 ---- Ada_95 Ada_05 Ada_2005 + Ada_12 + Ada_2012 Assertion_Policy Assume_No_Invalid_Values C_Pass_By_Copy *************** recognized by GNAT: *** 11388,11393 **** --- 11559,11565 ---- Convention_Identifier Debug_Policy Detect_Blocking + Default_Storage_Pool Discard_Names Elaboration_Checks Eliminate *************** recognized by GNAT: *** 11419,11424 **** --- 11591,11597 ---- Restrictions Restrictions_Warnings Reviewable + Short_Circuit_And_Or Source_File_Name Source_File_Name_Project Style_Checks *************** set of files. *** 11546,11553 **** The usual form of the @code{gnatname} command is @smallexample ! $ gnatname @ovar{switches} @var{naming_pattern} @ovar{naming_patterns} ! @r{[}--and @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}@r{]} @end smallexample @noindent --- 11719,11729 ---- The usual form of the @code{gnatname} command is @smallexample ! @c $ gnatname @ovar{switches} @var{naming_pattern} @ovar{naming_patterns} ! @c @r{[}--and @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}@r{]} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatname @r{[}@var{switches}@r{]} @var{naming_pattern} @r{[}@var{naming_patterns}@r{]} ! @r{[}--and @r{[}@var{switches}@r{]} @var{naming_pattern} @r{[}@var{naming_patterns}@r{]}@r{]} @end smallexample @noindent *************** regular files. *** 11563,11569 **** @noindent One or several Naming Patterns may be given as arguments to @code{gnatname}. ! Each Naming Pattern is enclosed between double quotes. A Naming Pattern is a regular expression similar to the wildcard patterns used in file names by the Unix shells or the DOS prompt. --- 11739,11746 ---- @noindent One or several Naming Patterns may be given as arguments to @code{gnatname}. ! Each Naming Pattern is enclosed between double quotes (or single ! quotes on Windows). A Naming Pattern is a regular expression similar to the wildcard patterns used in file names by the Unix shells or the DOS prompt. *************** are used in this example. *** 11762,15360 **** @c ***************************************** @c * G N A T P r o j e c t M a n a g e r * @c ***************************************** - @node GNAT Project Manager - @chapter GNAT Project Manager - - @menu - * Introduction:: - * Examples of Project Files:: - * Project File Syntax:: - * Objects and Sources in Project Files:: - * Importing Projects:: - * Project Extension:: - * Project Hierarchy Extension:: - * External References in Project Files:: - * Packages in Project Files:: - * Variables from Imported Projects:: - * Naming Schemes:: - * Library Projects:: - * Stand-alone Library Projects:: - * Switches Related to Project Files:: - * Tools Supporting Project Files:: - * An Extended Example:: - * Project File Complete Syntax:: - @end menu - - @c **************** - @c * Introduction * - @c **************** - - @node Introduction - @section Introduction - - @noindent - This chapter describes GNAT's @emph{Project Manager}, a facility that allows - you to manage complex builds involving a number of source files, directories, - and compilation options for different system configurations. In particular, - project files allow you to specify: - @itemize @bullet - @item - The directory or set of directories containing the source files, and/or the - names of the specific source files themselves - @item - The directory in which the compiler's output - (@file{ALI} files, object files, tree files) is to be placed - @item - The directory in which the executable programs is to be placed - @item - ^Switch^Switch^ settings for any of the project-enabled tools - (@command{gnatmake}, compiler, binder, linker, @code{gnatls}, @code{gnatxref}, - @code{gnatfind}); you can apply these settings either globally or to individual - compilation units. - @item - The source files containing the main subprogram(s) to be built - @item - The source programming language(s) (currently Ada and/or C) - @item - Source file naming conventions; you can specify these either globally or for - individual compilation units - @end itemize - - @menu - * Project Files:: - @end menu - - @node Project Files - @subsection Project Files - - @noindent - Project files are written in a syntax close to that of Ada, using familiar - notions such as packages, context clauses, declarations, default values, - assignments, and inheritance. Finally, project files can be built - hierarchically from other project files, simplifying complex system - integration and project reuse. - - A @dfn{project} is a specific set of values for various compilation properties. - The settings for a given project are described by means of - a @dfn{project file}, which is a text file written in an Ada-like syntax. - Property values in project files are either strings or lists of strings. - Properties that are not explicitly set receive default values. A project - file may interrogate the values of @dfn{external variables} (user-defined - command-line switches or environment variables), and it may specify property - settings conditionally, based on the value of such variables. - - In simple cases, a project's source files depend only on other source files - in the same project, or on the predefined libraries. (@emph{Dependence} is - used in - the Ada technical sense; as in one Ada unit @code{with}ing another.) However, - the Project Manager also allows more sophisticated arrangements, - where the source files in one project depend on source files in other - projects: - @itemize @bullet - @item - One project can @emph{import} other projects containing needed source files. - @item - You can organize GNAT projects in a hierarchy: a @emph{child} project - can extend a @emph{parent} project, inheriting the parent's source files and - optionally overriding any of them with alternative versions - @end itemize - - @noindent - More generally, the Project Manager lets you structure large development - efforts into hierarchical subsystems, where build decisions are delegated - to the subsystem level, and thus different compilation environments - (^switch^switch^ settings) used for different subsystems. - - The Project Manager is invoked through the - @option{^-P^/PROJECT_FILE=^@emph{projectfile}} - switch to @command{gnatmake} or to the @command{^gnat^GNAT^} front driver. - @ifclear vms - There may be zero, one or more spaces between @option{-P} and - @option{@emph{projectfile}}. - @end ifclear - If you want to define (on the command line) an external variable that is - queried by the project file, you must use the - @option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch. - The Project Manager parses and interprets the project file, and drives the - invoked tool based on the project settings. - - The Project Manager supports a wide range of development strategies, - for systems of all sizes. Here are some typical practices that are - easily handled: - @itemize @bullet - @item - Using a common set of source files, but generating object files in different - directories via different ^switch^switch^ settings - @item - Using a mostly-shared set of source files, but with different versions of - some unit or units - @end itemize - - @noindent - The destination of an executable can be controlled inside a project file - using the @option{^-o^-o^} - ^switch^switch^. - In the absence of such a ^switch^switch^ either inside - the project file or on the command line, any executable files generated by - @command{gnatmake} are placed in the directory @code{Exec_Dir} specified - in the project file. If no @code{Exec_Dir} is specified, they will be placed - in the object directory of the project. - - You can use project files to achieve some of the effects of a source - versioning system (for example, defining separate projects for - the different sets of sources that comprise different releases) but the - Project Manager is independent of any source configuration management tools - that might be used by the developers. - - The next section introduces the main features of GNAT's project facility - through a sequence of examples; subsequent sections will present the syntax - and semantics in more detail. A more formal description of the project - facility appears in @ref{Project File Reference,,, gnat_rm, GNAT - Reference Manual}. - - @c ***************************** - @c * Examples of Project Files * - @c ***************************** - - @node Examples of Project Files - @section Examples of Project Files - @noindent - This section illustrates some of the typical uses of project files and - explains their basic structure and behavior. - - @menu - * Common Sources with Different ^Switches^Switches^ and Directories:: - * Using External Variables:: - * Importing Other Projects:: - * Extending a Project:: - @end menu - - @node Common Sources with Different ^Switches^Switches^ and Directories - @subsection Common Sources with Different ^Switches^Switches^ and Directories - - @menu - * Source Files:: - * Specifying the Object Directory:: - * Specifying the Exec Directory:: - * Project File Packages:: - * Specifying ^Switch^Switch^ Settings:: - * Main Subprograms:: - * Executable File Names:: - * Source File Naming Conventions:: - * Source Language(s):: - @end menu - - @noindent - Suppose that the Ada source files @file{pack.ads}, @file{pack.adb}, and - @file{proc.adb} are in the @file{/common} directory. The file - @file{proc.adb} contains an Ada main subprogram @code{Proc} that @code{with}s - package @code{Pack}. We want to compile these source files under two sets - of ^switches^switches^: - @itemize @bullet - @item - When debugging, we want to pass the @option{-g} switch to @command{gnatmake}, - and the @option{^-gnata^-gnata^}, - @option{^-gnato^-gnato^}, - and @option{^-gnatE^-gnatE^} switches to the - compiler; the compiler's output is to appear in @file{/common/debug} - @item - When preparing a release version, we want to pass the @option{^-O2^O2^} switch - to the compiler; the compiler's output is to appear in @file{/common/release} - @end itemize - - @noindent - The GNAT project files shown below, respectively @file{debug.gpr} and - @file{release.gpr} in the @file{/common} directory, achieve these effects. - - Schematically: - @smallexample - @group - ^/common^[COMMON]^ - debug.gpr - release.gpr - pack.ads - pack.adb - proc.adb - @end group - @group - ^/common/debug^[COMMON.DEBUG]^ - proc.ali, proc.o - pack.ali, pack.o - @end group - @group - ^/common/release^[COMMON.RELEASE]^ - proc.ali, proc.o - pack.ali, pack.o - @end group - @end smallexample - Here are the corresponding project files: - - @smallexample @c projectfile - @group - project Debug is - for Object_Dir use "debug"; - for Main use ("proc"); - - package Builder is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-g^-g^"); - for Executable ("proc.adb") use "proc1"; - end Builder; - @end group - - @group - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("-fstack-check", - "^-gnata^-gnata^", - "^-gnato^-gnato^", - "^-gnatE^-gnatE^"); - end Compiler; - end Debug; - @end group - @end smallexample - - @smallexample @c projectfile - @group - project Release is - for Object_Dir use "release"; - for Exec_Dir use "."; - for Main use ("proc"); - - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-O2^-O2^"); - end Compiler; - end Release; - @end group - @end smallexample - - @noindent - The name of the project defined by @file{debug.gpr} is @code{"Debug"} (case - insensitive), and analogously the project defined by @file{release.gpr} is - @code{"Release"}. For consistency the file should have the same name as the - project, and the project file's extension should be @code{"gpr"}. These - conventions are not required, but a warning is issued if they are not followed. - - If the current directory is @file{^/temp^[TEMP]^}, then the command - @smallexample - gnatmake ^-P/common/debug.gpr^/PROJECT_FILE=[COMMON]DEBUG^ - @end smallexample - - @noindent - generates object and ALI files in @file{^/common/debug^[COMMON.DEBUG]^}, - as well as the @code{^proc1^PROC1.EXE^} executable, - using the ^switch^switch^ settings defined in the project file. - - Likewise, the command - @smallexample - gnatmake ^-P/common/release.gpr^/PROJECT_FILE=[COMMON]RELEASE^ - @end smallexample - - @noindent - generates object and ALI files in @file{^/common/release^[COMMON.RELEASE]^}, - and the @code{^proc^PROC.EXE^} - executable in @file{^/common^[COMMON]^}, - using the ^switch^switch^ settings from the project file. - - @node Source Files - @unnumberedsubsubsec Source Files - - @noindent - If a project file does not explicitly specify a set of source directories or - a set of source files, then by default the project's source files are the - Ada source files in the project file directory. Thus @file{pack.ads}, - @file{pack.adb}, and @file{proc.adb} are the source files for both projects. - - @node Specifying the Object Directory - @unnumberedsubsubsec Specifying the Object Directory - - @noindent - Several project properties are modeled by Ada-style @emph{attributes}; - a property is defined by supplying the equivalent of an Ada attribute - definition clause in the project file. - A project's object directory is another such a property; the corresponding - attribute is @code{Object_Dir}, and its value is also a string expression, - specified either as absolute or relative. In the later case, - it is relative to the project file directory. Thus the compiler's - output is directed to @file{^/common/debug^[COMMON.DEBUG]^} - (for the @code{Debug} project) - and to @file{^/common/release^[COMMON.RELEASE]^} - (for the @code{Release} project). - If @code{Object_Dir} is not specified, then the default is the project file - directory itself. - - @node Specifying the Exec Directory - @unnumberedsubsubsec Specifying the Exec Directory - - @noindent - A project's exec directory is another property; the corresponding - attribute is @code{Exec_Dir}, and its value is also a string expression, - either specified as relative or absolute. If @code{Exec_Dir} is not specified, - then the default is the object directory (which may also be the project file - directory if attribute @code{Object_Dir} is not specified). Thus the executable - is placed in @file{^/common/debug^[COMMON.DEBUG]^} - for the @code{Debug} project (attribute @code{Exec_Dir} not specified) - and in @file{^/common^[COMMON]^} for the @code{Release} project. - - @node Project File Packages - @unnumberedsubsubsec Project File Packages - - @noindent - A GNAT tool that is integrated with the Project Manager is modeled by a - corresponding package in the project file. In the example above, - The @code{Debug} project defines the packages @code{Builder} - (for @command{gnatmake}) and @code{Compiler}; - the @code{Release} project defines only the @code{Compiler} package. - - The Ada-like package syntax is not to be taken literally. Although packages in - project files bear a surface resemblance to packages in Ada source code, the - notation is simply a way to convey a grouping of properties for a named - entity. Indeed, the package names permitted in project files are restricted - to a predefined set, corresponding to the project-aware tools, and the contents - of packages are limited to a small set of constructs. - The packages in the example above contain attribute definitions. - - @node Specifying ^Switch^Switch^ Settings - @unnumberedsubsubsec Specifying ^Switch^Switch^ Settings - - @noindent - ^Switch^Switch^ settings for a project-aware tool can be specified through - attributes in the package that corresponds to the tool. - The example above illustrates one of the relevant attributes, - @code{^Default_Switches^Default_Switches^}, which is defined in packages - in both project files. - Unlike simple attributes like @code{Source_Dirs}, - @code{^Default_Switches^Default_Switches^} is - known as an @emph{associative array}. When you define this attribute, you must - supply an ``index'' (a literal string), and the effect of the attribute - definition is to set the value of the array at the specified index. - For the @code{^Default_Switches^Default_Switches^} attribute, - the index is a programming language (in our case, Ada), - and the value specified (after @code{use}) must be a list - of string expressions. - - The attributes permitted in project files are restricted to a predefined set. - Some may appear at project level, others in packages. - For any attribute that is an associative array, the index must always be a - literal string, but the restrictions on this string (e.g., a file name or a - language name) depend on the individual attribute. - Also depending on the attribute, its specified value will need to be either a - string or a string list. - - In the @code{Debug} project, we set the switches for two tools, - @command{gnatmake} and the compiler, and thus we include the two corresponding - packages; each package defines the @code{^Default_Switches^Default_Switches^} - attribute with index @code{"Ada"}. - Note that the package corresponding to - @command{gnatmake} is named @code{Builder}. The @code{Release} project is - similar, but only includes the @code{Compiler} package. - - In project @code{Debug} above, the ^switches^switches^ starting with - @option{-gnat} that are specified in package @code{Compiler} - could have been placed in package @code{Builder}, since @command{gnatmake} - transmits all such ^switches^switches^ to the compiler. - - @node Main Subprograms - @unnumberedsubsubsec Main Subprograms - - @noindent - One of the specifiable properties of a project is a list of files that contain - main subprograms. This property is captured in the @code{Main} attribute, - whose value is a list of strings. If a project defines the @code{Main} - attribute, it is not necessary to identify the main subprogram(s) when - invoking @command{gnatmake} (@pxref{gnatmake and Project Files}). - - @node Executable File Names - @unnumberedsubsubsec Executable File Names - - @noindent - By default, the executable file name corresponding to a main source is - deduced from the main source file name. Through the attributes - @code{Executable} and @code{Executable_Suffix} of package @code{Builder}, - it is possible to change this default. - In project @code{Debug} above, the executable file name - for main source @file{^proc.adb^PROC.ADB^} is - @file{^proc1^PROC1.EXE^}. - Attribute @code{Executable_Suffix}, when specified, may change the suffix - of the executable files, when no attribute @code{Executable} applies: - its value replace the platform-specific executable suffix. - Attributes @code{Executable} and @code{Executable_Suffix} are the only ways to - specify a non-default executable file name when several mains are built at once - in a single @command{gnatmake} command. - - @node Source File Naming Conventions - @unnumberedsubsubsec Source File Naming Conventions - - @noindent - Since the project files above do not specify any source file naming - conventions, the GNAT defaults are used. The mechanism for defining source - file naming conventions -- a package named @code{Naming} -- - is described below (@pxref{Naming Schemes}). - - @node Source Language(s) - @unnumberedsubsubsec Source Language(s) - - @noindent - Since the project files do not specify a @code{Languages} attribute, by - default the GNAT tools assume that the language of the project file is Ada. - More generally, a project can comprise source files - in Ada, C, and/or other languages. - - @node Using External Variables - @subsection Using External Variables - - @noindent - Instead of supplying different project files for debug and release, we can - define a single project file that queries an external variable (set either - on the command line or via an ^environment variable^logical name^) in order to - conditionally define the appropriate settings. Again, assume that the - source files @file{pack.ads}, @file{pack.adb}, and @file{proc.adb} are - located in directory @file{^/common^[COMMON]^}. The following project file, - @file{build.gpr}, queries the external variable named @code{STYLE} and - defines an object directory and ^switch^switch^ settings based on whether - the value is @code{"deb"} (debug) or @code{"rel"} (release), and where - the default is @code{"deb"}. - - @smallexample @c projectfile - @group - project Build is - for Main use ("proc"); - - type Style_Type is ("deb", "rel"); - Style : Style_Type := external ("STYLE", "deb"); - - case Style is - when "deb" => - for Object_Dir use "debug"; - - when "rel" => - for Object_Dir use "release"; - for Exec_Dir use "."; - end case; - @end group - - @group - package Builder is - - case Style is - when "deb" => - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-g^-g^"); - for Executable ("proc") use "proc1"; - when others => - null; - end case; - - end Builder; - @end group - - @group - package Compiler is - - case Style is - when "deb" => - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnata^-gnata^", - "^-gnato^-gnato^", - "^-gnatE^-gnatE^"); - - when "rel" => - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-O2^-O2^"); - end case; - - end Compiler; - - end Build; - @end group - @end smallexample - - @noindent - @code{Style_Type} is an example of a @emph{string type}, which is the project - file analog of an Ada enumeration type but whose components are string literals - rather than identifiers. @code{Style} is declared as a variable of this type. - - The form @code{external("STYLE", "deb")} is known as an - @emph{external reference}; its first argument is the name of an - @emph{external variable}, and the second argument is a default value to be - used if the external variable doesn't exist. You can define an external - variable on the command line via the @option{^-X^/EXTERNAL_REFERENCE^} switch, - or you can use ^an environment variable^a logical name^ - as an external variable. - - Each @code{case} construct is expanded by the Project Manager based on the - value of @code{Style}. Thus the command - @ifclear vms - @smallexample - gnatmake -P/common/build.gpr -XSTYLE=deb - @end smallexample - @end ifclear - - @ifset vms - @smallexample - gnatmake /PROJECT_FILE=[COMMON]BUILD.GPR /EXTERNAL_REFERENCE=STYLE=deb - @end smallexample - @end ifset - - @noindent - is equivalent to the @command{gnatmake} invocation using the project file - @file{debug.gpr} in the earlier example. So is the command - @smallexample - gnatmake ^-P/common/build.gpr^/PROJECT_FILE=[COMMON]BUILD.GPR^ - @end smallexample - - @noindent - since @code{"deb"} is the default for @code{STYLE}. - - Analogously, - - @ifclear vms - @smallexample - gnatmake -P/common/build.gpr -XSTYLE=rel - @end smallexample - @end ifclear - - @ifset vms - @smallexample - GNAT MAKE /PROJECT_FILE=[COMMON]BUILD.GPR /EXTERNAL_REFERENCE=STYLE=rel - @end smallexample - @end ifset - - @noindent - is equivalent to the @command{gnatmake} invocation using the project file - @file{release.gpr} in the earlier example. - - @node Importing Other Projects - @subsection Importing Other Projects - @cindex @code{ADA_PROJECT_PATH} - @cindex @code{GPR_PROJECT_PATH} - - @noindent - A compilation unit in a source file in one project may depend on compilation - units in source files in other projects. To compile this unit under - control of a project file, the - dependent project must @emph{import} the projects containing the needed source - files. - This effect is obtained using syntax similar to an Ada @code{with} clause, - but where @code{with}ed entities are strings that denote project files. - - As an example, suppose that the two projects @code{GUI_Proj} and - @code{Comm_Proj} are defined in the project files @file{gui_proj.gpr} and - @file{comm_proj.gpr} in directories @file{^/gui^[GUI]^} - and @file{^/comm^[COMM]^}, respectively. - Suppose that the source files for @code{GUI_Proj} are - @file{gui.ads} and @file{gui.adb}, and that the source files for - @code{Comm_Proj} are @file{comm.ads} and @file{comm.adb}, where each set of - files is located in its respective project file directory. Schematically: - - @smallexample - @group - ^/gui^[GUI]^ - gui_proj.gpr - gui.ads - gui.adb - @end group - - @group - ^/comm^[COMM]^ - comm_proj.gpr - comm.ads - comm.adb - @end group - @end smallexample - - @noindent - We want to develop an application in directory @file{^/app^[APP]^} that - @code{with} the packages @code{GUI} and @code{Comm}, using the properties of - the corresponding project files (e.g.@: the ^switch^switch^ settings - and object directory). - Skeletal code for a main procedure might be something like the following: - - @smallexample @c ada - @group - with GUI, Comm; - procedure App_Main is - @dots{} - begin - @dots{} - end App_Main; - @end group - @end smallexample - - @noindent - Here is a project file, @file{app_proj.gpr}, that achieves the desired - effect: - - @smallexample @c projectfile - @group - with "/gui/gui_proj", "/comm/comm_proj"; - project App_Proj is - for Main use ("app_main"); - end App_Proj; - @end group - @end smallexample - - @noindent - Building an executable is achieved through the command: - @smallexample - gnatmake ^-P/app/app_proj^/PROJECT_FILE=[APP]APP_PROJ^ - @end smallexample - @noindent - which will generate the @code{^app_main^APP_MAIN.EXE^} executable - in the directory where @file{app_proj.gpr} resides. - - If an imported project file uses the standard extension (@code{^gpr^GPR^}) then - (as illustrated above) the @code{with} clause can omit the extension. - - Our example specified an absolute path for each imported project file. - Alternatively, the directory name of an imported object can be omitted - if either - @itemize @bullet - @item - The imported project file is in the same directory as the importing project - file, or - @item - You have defined one or two ^environment variables^logical names^ - that includes the directory containing - the needed project file. The syntax of @code{GPR_PROJECT_PATH} and - @code{ADA_PROJECT_PATH} is the same as - the syntax of @code{ADA_INCLUDE_PATH} and @code{ADA_OBJECTS_PATH}: a list of - directory names separated by colons (semicolons on Windows). - @end itemize - - @noindent - Thus, if we define @code{ADA_PROJECT_PATH} or @code{GPR_PROJECT_PATH} - to include @file{^/gui^[GUI]^} and - @file{^/comm^[COMM]^}, then our project file @file{app_proj.gpr} can be written - as follows: - - @smallexample @c projectfile - @group - with "gui_proj", "comm_proj"; - project App_Proj is - for Main use ("app_main"); - end App_Proj; - @end group - @end smallexample - - @noindent - Importing other projects can create ambiguities. - For example, the same unit might be present in different imported projects, or - it might be present in both the importing project and in an imported project. - Both of these conditions are errors. Note that in the current version of - the Project Manager, it is illegal to have an ambiguous unit even if the - unit is never referenced by the importing project. This restriction may be - relaxed in a future release. - - @node Extending a Project - @subsection Extending a Project - - @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 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} - another project (the ``parent'') then by default all source files of the - parent project are inherited by the child, but the child project can - override any of the parent's source files with new versions, and can also - add new files. This facility is the project analog of a type extension in - Object-Oriented Programming. Project hierarchies are permitted (a child - project may be the parent of yet another project), and a project that - inherits one project can also import other projects. - - As an example, suppose that directory @file{^/seq^[SEQ]^} contains the project - file @file{seq_proj.gpr} as well as the source files @file{pack.ads}, - @file{pack.adb}, and @file{proc.adb}: - - @smallexample - @group - ^/seq^[SEQ]^ - pack.ads - pack.adb - proc.adb - seq_proj.gpr - @end group - @end smallexample - - @noindent - Note that the project file can simply be empty (that is, no attribute or - package is defined): - - @smallexample @c projectfile - @group - project Seq_Proj is - end Seq_Proj; - @end group - @end smallexample - - @noindent - implying that its source files are all the Ada source files in the project - directory. - - Suppose we want to supply an alternate version of @file{pack.adb}, in - directory @file{^/tasking^[TASKING]^}, but use the existing versions of - @file{pack.ads} and @file{proc.adb}. We can define a project - @code{Tasking_Proj} that inherits @code{Seq_Proj}: - - @smallexample - @group - ^/tasking^[TASKING]^ - pack.adb - tasking_proj.gpr - @end group - - @group - project Tasking_Proj extends "/seq/seq_proj" is - end Tasking_Proj; - @end group - @end smallexample - - @noindent - The version of @file{pack.adb} used in a build depends on which project file - is specified. - - Note that we could have obtained the desired behavior using project import - rather than project inheritance; a @code{base} project would contain the - sources for @file{pack.ads} and @file{proc.adb}, a sequential project would - import @code{base} and add @file{pack.adb}, and likewise a tasking project - would import @code{base} and add a different version of @file{pack.adb}. The - choice depends on whether other sources in the original project need to be - overridden. If they do, then project extension is necessary, otherwise, - importing is sufficient. - - @noindent - In a project file that extends another project file, it is possible to - indicate that an inherited source is not part of the sources of the extending - project. This is necessary sometimes when a package spec has been overloaded - and no longer requires a body: in this case, it is necessary to indicate that - the inherited body is not part of the sources of the project, otherwise there - will be a compilation error when compiling the spec. - - For that purpose, the attribute @code{Excluded_Source_Files} is used. - Its value is a string list: a list of file names. It is also possible to use - attribute @code{Excluded_Source_List_File}. Its value is a single string: - the file name of a text file containing a list of file names, one per line. - - @smallexample @c @projectfile - project B extends "a" is - for Source_Files use ("pkg.ads"); - -- New spec of Pkg does not need a completion - for Excluded_Source_Files use ("pkg.adb"); - end B; - @end smallexample - - Attribute @code{Excluded_Source_Files} may also be used to check if a source - is still needed: if it is possible to build using @command{gnatmake} when such - a source is put in attribute @code{Excluded_Source_Files} of a project P, then - it is possible to remove the source completely from a system that includes - project P. - - @c *********************** - @c * Project File Syntax * - @c *********************** - - @node Project File Syntax - @section Project File Syntax - - @menu - * Basic Syntax:: - * Qualified Projects:: - * Packages:: - * Expressions:: - * String Types:: - * Variables:: - * Attributes:: - * Associative Array Attributes:: - * case Constructions:: - @end menu - - @noindent - This section describes the structure of project files. - - A project may be an @emph{independent project}, entirely defined by a single - project file. Any Ada source file in an independent project depends only - on the predefined library and other Ada source files in the same project. - - @noindent - A project may also @dfn{depend on} other projects, in either or both of - the following ways: - @itemize @bullet - @item It may import any number of projects - @item It may extend at most one other project - @end itemize - - @noindent - The dependence relation is a directed acyclic graph (the subgraph reflecting - the ``extends'' relation is a tree). - - A project's @dfn{immediate sources} are the source files directly defined by - that project, either implicitly by residing in the project file's directory, - or explicitly through any of the source-related attributes described below. - More generally, a project @var{proj}'s @dfn{sources} are the immediate sources - of @var{proj} together with the immediate sources (unless overridden) of any - project on which @var{proj} depends (either directly or indirectly). - - @node Basic Syntax - @subsection Basic Syntax - - @noindent - As seen in the earlier examples, project files have an Ada-like syntax. - The minimal project file is: - @smallexample @c projectfile - @group - project Empty is - - end Empty; - @end group - @end smallexample - - @noindent - The identifier @code{Empty} is the name of the project. - This project name must be present after the reserved - word @code{end} at the end of the project file, followed by a semi-colon. - - Any name in a project file, such as the project name or a variable name, - has the same syntax as an Ada identifier. - - The reserved words of project files are the Ada 95 reserved words plus - @code{extends}, @code{external}, and @code{project}. Note that the only Ada - reserved words currently used in project file syntax are: - - @itemize @bullet - @item - @code{all} - @item - @code{at} - @item - @code{case} - @item - @code{end} - @item - @code{for} - @item - @code{is} - @item - @code{limited} - @item - @code{null} - @item - @code{others} - @item - @code{package} - @item - @code{renames} - @item - @code{type} - @item - @code{use} - @item - @code{when} - @item - @code{with} - @end itemize - - @noindent - Comments in project files have the same syntax as in Ada, two consecutive - hyphens through the end of the line. - - @node Qualified Projects - @subsection Qualified Projects - - @noindent - Before the reserved @code{project}, there may be one or two "qualifiers", that - is identifiers or other reserved words, to qualify the project. - - The current list of qualifiers is: - - @itemize @bullet - @item - @code{abstract}: qualify a project with no sources. A qualified abstract - project must either have no declaration of attributes @code{Source_Dirs}, - @code{Source_Files}, @code{Languages} or @code{Source_List_File}, or one of - @code{Source_Dirs}, @code{Source_Files}, or @code{Languages} must be declared - as empty. If it extends another project, the project it extends must also be a - qualified abstract project. - - @item - @code{standard}: a standard project is a non library project with sources. - - @item - @code{aggregate}: for future extension - - @item - @code{aggregate library}: for future extension - - @item - @code{library}: a library project must declare both attributes - @code{Library_Name} and @code{Library_Dir}. - - @item - @code{configuration}: a configuration project cannot be in a project tree. - @end itemize - - @node Packages - @subsection Packages - - @noindent - A project file may contain @emph{packages}. The name of a package must be one - of the identifiers from the following list. A package - with a given name may only appear once in a project file. Package names are - case insensitive. The following package names are legal: - - @itemize @bullet - @item - @code{Naming} - @item - @code{Builder} - @item - @code{Compiler} - @item - @code{Binder} - @item - @code{Linker} - @item - @code{Finder} - @item - @code{Cross_Reference} - @item - @code{Check} - @item - @code{Eliminate} - @item - @code{Pretty_Printer} - @item - @code{Metrics} - @item - @code{gnatls} - @item - @code{gnatstub} - @item - @code{IDE} - @item - @code{Language_Processing} - @end itemize - - @noindent - In its simplest form, a package may be empty: - - @smallexample @c projectfile - @group - project Simple is - package Builder is - end Builder; - end Simple; - @end group - @end smallexample - - @noindent - A package may contain @emph{attribute declarations}, - @emph{variable declarations} and @emph{case constructions}, as will be - described below. - - When there is ambiguity between a project name and a package name, - the name always designates the project. To avoid possible confusion, it is - always a good idea to avoid naming a project with one of the - names allowed for packages or any name that starts with @code{gnat}. - - @node Expressions - @subsection Expressions - - @noindent - An @emph{expression} is either a @emph{string expression} or a - @emph{string list expression}. - - A @emph{string expression} is either a @emph{simple string expression} or a - @emph{compound string expression}. - - A @emph{simple string expression} is one of the following: - @itemize @bullet - @item A literal string; e.g.@: @code{"comm/my_proj.gpr"} - @item A string-valued variable reference (@pxref{Variables}) - @item A string-valued attribute reference (@pxref{Attributes}) - @item An external reference (@pxref{External References in Project Files}) - @end itemize - - @noindent - A @emph{compound string expression} is a concatenation of string expressions, - using the operator @code{"&"} - @smallexample - Path & "/" & File_Name & ".ads" - @end smallexample - - @noindent - A @emph{string list expression} is either a - @emph{simple string list expression} or a - @emph{compound string list expression}. - - A @emph{simple string list expression} is one of the following: - @itemize @bullet - @item A parenthesized list of zero or more string expressions, - separated by commas - @smallexample - File_Names := (File_Name, "gnat.adc", File_Name & ".orig"); - Empty_List := (); - @end smallexample - @item A string list-valued variable reference - @item A string list-valued attribute reference - @end itemize - - @noindent - A @emph{compound string list expression} is the concatenation (using - @code{"&"}) of a simple string list expression and an expression. Note that - each term in a compound string list expression, except the first, may be - either a string expression or a string list expression. - - @smallexample @c projectfile - @group - File_Name_List := () & File_Name; -- One string in this list - Extended_File_Name_List := File_Name_List & (File_Name & ".orig"); - -- Two strings - Big_List := File_Name_List & Extended_File_Name_List; - -- Concatenation of two string lists: three strings - Illegal_List := "gnat.adc" & Extended_File_Name_List; - -- Illegal: must start with a string list - @end group - @end smallexample - - @node String Types - @subsection String Types - - @noindent - A @emph{string type declaration} introduces a discrete set of string literals. - If a string variable is declared to have this type, its value - is restricted to the given set of literals. - - Here is an example of a string type declaration: - - @smallexample @c projectfile - type OS is ("NT", "nt", "Unix", "GNU/Linux", "other OS"); - @end smallexample - - @noindent - Variables of a string type are called @emph{typed variables}; all other - variables are called @emph{untyped variables}. Typed variables are - particularly useful in @code{case} constructions, to support conditional - attribute declarations. - (@pxref{case Constructions}). - - The string literals in the list are case sensitive and must all be different. - They may include any graphic characters allowed in Ada, including spaces. - - A string type may only be declared at the project level, not inside a package. - - A string type may be referenced by its name if it has been declared in the same - project file, or by an expanded name whose prefix is the name of the project - in which it is declared. - - @node Variables - @subsection Variables - - @noindent - A variable may be declared at the project file level, or within a package. - Here are some examples of variable declarations: - - @smallexample @c projectfile - @group - This_OS : OS := external ("OS"); -- a typed variable declaration - That_OS := "GNU/Linux"; -- an untyped variable declaration - @end group - @end smallexample - - @noindent - The syntax of a @emph{typed variable declaration} is identical to the Ada - syntax for an object declaration. By contrast, the syntax of an untyped - variable declaration is identical to an Ada assignment statement. In fact, - variable declarations in project files have some of the characteristics of - an assignment, in that successive declarations for the same variable are - allowed. Untyped variable declarations do establish the expected kind of the - variable (string or string list), and successive declarations for it must - respect the initial kind. - - @noindent - A string variable declaration (typed or untyped) declares a variable - whose value is a string. This variable may be used as a string expression. - @smallexample @c projectfile - File_Name := "readme.txt"; - Saved_File_Name := File_Name & ".saved"; - @end smallexample - - @noindent - A string list variable declaration declares a variable whose value is a list - of strings. The list may contain any number (zero or more) of strings. - - @smallexample @c projectfile - Empty_List := (); - List_With_One_Element := ("^-gnaty^-gnaty^"); - List_With_Two_Elements := List_With_One_Element & "^-gnatg^-gnatg^"; - Long_List := ("main.ada", "pack1_.ada", "pack1.ada", "pack2_.ada" - "pack2.ada", "util_.ada", "util.ada"); - @end smallexample - - @noindent - The same typed variable may not be declared more than once at project level, - and it may not be declared more than once in any package; it is in effect - a constant. - - The same untyped variable may be declared several times. Declarations are - elaborated in the order in which they appear, so the new value replaces - the old one, and any subsequent reference to the variable uses the new value. - However, as noted above, if a variable has been declared as a string, all - subsequent - declarations must give it a string value. Similarly, if a variable has - been declared as a string list, all subsequent declarations - must give it a string list value. - - A @emph{variable reference} may take several forms: - - @itemize @bullet - @item The simple variable name, for a variable in the current package (if any) - or in the current project - @item An expanded name, whose prefix is a context name. - @end itemize - - @noindent - A @emph{context} may be one of the following: - - @itemize @bullet - @item The name of an existing package in the current project - @item The name of an imported project of the current project - @item The name of an ancestor project (i.e., a project extended by the current - project, either directly or indirectly) - @item An expanded name whose prefix is an imported/parent project name, and - whose selector is a package name in that project. - @end itemize - - @noindent - A variable reference may be used in an expression. - - @node Attributes - @subsection Attributes - - @noindent - A project (and its packages) may have @emph{attributes} that define - the project's properties. Some attributes have values that are strings; - others have values that are string lists. - - There are two categories of attributes: @emph{simple attributes} - and @emph{associative arrays} (@pxref{Associative Array Attributes}). - - Legal project attribute names, and attribute names for each legal package are - listed below. Attributes names are case-insensitive. - - The following attributes are defined on projects (all are simple attributes): - - @multitable @columnfractions .4 .3 - @item @emph{Attribute Name} - @tab @emph{Value} - @item @code{Source_Files} - @tab string list - @item @code{Source_Dirs} - @tab string list - @item @code{Source_List_File} - @tab string - @item @code{Object_Dir} - @tab string - @item @code{Exec_Dir} - @tab string - @item @code{Excluded_Source_Dirs} - @tab string list - @item @code{Excluded_Source_Files} - @tab string list - @item @code{Excluded_Source_List_File} - @tab string - @item @code{Languages} - @tab string list - @item @code{Main} - @tab string list - @item @code{Library_Dir} - @tab string - @item @code{Library_Name} - @tab string - @item @code{Library_Kind} - @tab string - @item @code{Library_Version} - @tab string - @item @code{Library_Interface} - @tab string - @item @code{Library_Auto_Init} - @tab string - @item @code{Library_Options} - @tab string list - @item @code{Library_Src_Dir} - @tab string - @item @code{Library_ALI_Dir} - @tab string - @item @code{Library_GCC} - @tab string - @item @code{Library_Symbol_File} - @tab string - @item @code{Library_Symbol_Policy} - @tab string - @item @code{Library_Reference_Symbol_File} - @tab string - @item @code{Externally_Built} - @tab string - @end multitable - - @noindent - The following attributes are defined for package @code{Naming} - (@pxref{Naming Schemes}): - - @multitable @columnfractions .4 .2 .2 .2 - @item Attribute Name @tab Category @tab Index @tab Value - @item @code{Spec_Suffix} - @tab associative array - @tab language name - @tab string - @item @code{Body_Suffix} - @tab associative array - @tab language name - @tab string - @item @code{Separate_Suffix} - @tab simple attribute - @tab n/a - @tab string - @item @code{Casing} - @tab simple attribute - @tab n/a - @tab string - @item @code{Dot_Replacement} - @tab simple attribute - @tab n/a - @tab string - @item @code{Spec} - @tab associative array - @tab Ada unit name - @tab string - @item @code{Body} - @tab associative array - @tab Ada unit name - @tab string - @item @code{Specification_Exceptions} - @tab associative array - @tab language name - @tab string list - @item @code{Implementation_Exceptions} - @tab associative array - @tab language name - @tab string list - @end multitable - - @noindent - The following attributes are defined for packages @code{Builder}, - @code{Compiler}, @code{Binder}, - @code{Linker}, @code{Cross_Reference}, and @code{Finder} - (@pxref{^Switches^Switches^ and Project Files}). - - @multitable @columnfractions .4 .2 .2 .2 - @item Attribute Name @tab Category @tab Index @tab Value - @item @code{^Default_Switches^Default_Switches^} - @tab associative array - @tab language name - @tab string list - @item @code{^Switches^Switches^} - @tab associative array - @tab file name - @tab string list - @end multitable - - @noindent - In addition, package @code{Compiler} has a single string attribute - @code{Local_Configuration_Pragmas} and package @code{Builder} has a single - string attribute @code{Global_Configuration_Pragmas}. - - @noindent - Each simple attribute has a default value: the empty string (for string-valued - attributes) and the empty list (for string list-valued attributes). - - An attribute declaration defines a new value for an attribute. - - Examples of simple attribute declarations: - - @smallexample @c projectfile - for Object_Dir use "objects"; - for Source_Dirs use ("units", "test/drivers"); - @end smallexample - - @noindent - The syntax of a @dfn{simple attribute declaration} is similar to that of an - attribute definition clause in Ada. - - Attributes references may be appear in expressions. - The general form for such a reference is @code{'}: - Associative array attributes are functions. Associative - array attribute references must have an argument that is a string literal. - - Examples are: - - @smallexample @c projectfile - project'Object_Dir - Naming'Dot_Replacement - Imported_Project'Source_Dirs - Imported_Project.Naming'Casing - Builder'^Default_Switches^Default_Switches^("Ada") - @end smallexample - - @noindent - The prefix of an attribute may be: - @itemize @bullet - @item @code{project} for an attribute of the current project - @item The name of an existing package of the current project - @item The name of an imported project - @item The name of a parent project that is extended by the current project - @item An expanded name whose prefix is imported/parent project name, - and whose selector is a package name - @end itemize - - @noindent - Example: - @smallexample @c projectfile - @group - project Prj is - for Source_Dirs use project'Source_Dirs & "units"; - for Source_Dirs use project'Source_Dirs & "test/drivers" - end Prj; - @end group - @end smallexample - - @noindent - In the first attribute declaration, initially the attribute @code{Source_Dirs} - has the default value: an empty string list. After this declaration, - @code{Source_Dirs} is a string list of one element: @code{"units"}. - After the second attribute declaration @code{Source_Dirs} is a string list of - two elements: @code{"units"} and @code{"test/drivers"}. - - Note: this example is for illustration only. In practice, - the project file would contain only one attribute declaration: - - @smallexample @c projectfile - for Source_Dirs use ("units", "test/drivers"); - @end smallexample - - @node Associative Array Attributes - @subsection Associative Array Attributes - - @noindent - Some attributes are defined as @emph{associative arrays}. An associative - array may be regarded as a function that takes a string as a parameter - and delivers a string or string list value as its result. - - Here are some examples of single associative array attribute associations: - - @smallexample @c projectfile - for Body ("main") use "Main.ada"; - for ^Switches^Switches^ ("main.ada") - use ("^-v^-v^", - "^-gnatv^-gnatv^"); - for ^Switches^Switches^ ("main.ada") - use Builder'^Switches^Switches^ ("main.ada") - & "^-g^-g^"; - @end smallexample - - @noindent - Like untyped variables and simple attributes, associative array attributes - may be declared several times. Each declaration supplies a new value for the - attribute, and replaces the previous setting. - - @noindent - An associative array attribute may be declared as a full associative array - declaration, with the value of the same attribute in an imported or extended - project. - - @smallexample @c projectfile - package Builder is - for Default_Switches use Default.Builder'Default_Switches; - end Builder; - @end smallexample - - @noindent - In this example, @code{Default} must be either a project imported by the - current project, or the project that the current project extends. If the - attribute is in a package (in this case, in package @code{Builder}), the same - package needs to be specified. - - @noindent - A full associative array declaration replaces any other declaration for the - attribute, including other full associative array declaration. Single - associative array associations may be declare after a full associative - declaration, modifying the value for a single association of the attribute. - - @node case Constructions - @subsection @code{case} Constructions - - @noindent - A @code{case} construction is used in a project file to effect conditional - behavior. - Here is a typical example: - - @smallexample @c projectfile - @group - project MyProj is - type OS_Type is ("GNU/Linux", "Unix", "NT", "VMS"); - - OS : OS_Type := external ("OS", "GNU/Linux"); - @end group - - @group - package Compiler is - case OS is - when "GNU/Linux" | "Unix" => - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnath^-gnath^"); - when "NT" => - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnatP^-gnatP^"); - when others => - end case; - end Compiler; - end MyProj; - @end group - @end smallexample - - @noindent - The syntax of a @code{case} construction is based on the Ada case statement - (although there is no @code{null} construction for empty alternatives). - - The case expression must be a typed string variable. - Each alternative comprises the reserved word @code{when}, either a list of - literal strings separated by the @code{"|"} character or the reserved word - @code{others}, and the @code{"=>"} token. - Each literal string must belong to the string type that is the type of the - case variable. - An @code{others} alternative, if present, must occur last. - - After each @code{=>}, there are zero or more constructions. The only - constructions allowed in a case construction are other case constructions, - attribute declarations and variable declarations. String type declarations and - package declarations are not allowed. Variable declarations are restricted to - variables that have already been declared before the case construction. - - The value of the case variable is often given by an external reference - (@pxref{External References in Project Files}). - - @c **************************************** - @c * Objects and Sources in Project Files * - @c **************************************** - - @node Objects and Sources in Project Files - @section Objects and Sources in Project Files - - @menu - * Object Directory:: - * Exec Directory:: - * Source Directories:: - * Source File Names:: - @end menu - - @noindent - Each project has exactly one object directory and one or more source - directories. The source directories must contain at least one source file, - unless the project file explicitly specifies that no source files are present - (@pxref{Source File Names}). - - @node Object Directory - @subsection Object Directory - - @noindent - The object directory for a project is the directory containing the compiler's - output (such as @file{ALI} files and object files) for the project's immediate - sources. - - The object directory is given by the value of the attribute @code{Object_Dir} - in the project file. - - @smallexample @c projectfile - for Object_Dir use "objects"; - @end smallexample - - @noindent - The attribute @code{Object_Dir} has a string value, the path name of the object - directory. The path name may be absolute or relative to the directory of the - project file. This directory must already exist, and be readable and writable. - - By default, when the attribute @code{Object_Dir} is not given an explicit value - or when its value is the empty string, the object directory is the same as the - directory containing the project file. - - @node Exec Directory - @subsection Exec Directory - - @noindent - The exec directory for a project is the directory containing the executables - for the project's main subprograms. - - The exec directory is given by the value of the attribute @code{Exec_Dir} - in the project file. - - @smallexample @c projectfile - for Exec_Dir use "executables"; - @end smallexample - - @noindent - The attribute @code{Exec_Dir} has a string value, the path name of the exec - directory. The path name may be absolute or relative to the directory of the - project file. This directory must already exist, and be writable. - - By default, when the attribute @code{Exec_Dir} is not given an explicit value - or when its value is the empty string, the exec directory is the same as the - object directory of the project file. - - @node Source Directories - @subsection Source Directories - - @noindent - The source directories of a project are specified by the project file - attribute @code{Source_Dirs}. - - This attribute's value is a string list. If the attribute is not given an - explicit value, then there is only one source directory, the one where the - project file resides. - - A @code{Source_Dirs} attribute that is explicitly defined to be the empty list, - as in - - @smallexample @c projectfile - for Source_Dirs use (); - @end smallexample - - @noindent - indicates that the project contains no source files. - - Otherwise, each string in the string list designates one or more - source directories. - - @smallexample @c projectfile - for Source_Dirs use ("sources", "test/drivers"); - @end smallexample - - @noindent - If a string in the list ends with @code{"/**"}, then the directory whose path - name precedes the two asterisks, as well as all its subdirectories - (recursively), are source directories. - - @smallexample @c projectfile - for Source_Dirs use ("/system/sources/**"); - @end smallexample - - @noindent - Here the directory @code{/system/sources} and all of its subdirectories - (recursively) are source directories. - - To specify that the source directories are the directory of the project file - and all of its subdirectories, you can declare @code{Source_Dirs} as follows: - @smallexample @c projectfile - for Source_Dirs use ("./**"); - @end smallexample - - @noindent - Each of the source directories must exist and be readable. - - @node Source File Names - @subsection Source File Names - - @noindent - In a project that contains source files, their names may be specified by the - attributes @code{Source_Files} (a string list) or @code{Source_List_File} - (a string). Source file names never include any directory information. - - If the attribute @code{Source_Files} is given an explicit value, then each - element of the list is a source file name. - - @smallexample @c projectfile - for Source_Files use ("main.adb"); - for Source_Files use ("main.adb", "pack1.ads", "pack2.adb"); - @end smallexample - - @noindent - If the attribute @code{Source_Files} is not given an explicit value, - but the attribute @code{Source_List_File} is given a string value, - then the source file names are contained in the text file whose path name - (absolute or relative to the directory of the project file) is the - value of the attribute @code{Source_List_File}. - - Each line in the file that is not empty or is not a comment - contains a source file name. - - @smallexample @c projectfile - for Source_List_File use "source_list.txt"; - @end smallexample - - @noindent - By default, if neither the attribute @code{Source_Files} nor the attribute - @code{Source_List_File} is given an explicit value, then each file in the - source directories that conforms to the project's naming scheme - (@pxref{Naming Schemes}) is an immediate source of the project. - - A warning is issued if both attributes @code{Source_Files} and - @code{Source_List_File} are given explicit values. In this case, the attribute - @code{Source_Files} prevails. - - Each source file name must be the name of one existing source file - in one of the source directories. - - A @code{Source_Files} attribute whose value is an empty list - indicates that there are no source files in the project. - - If the order of the source directories is known statically, that is if - @code{"/**"} is not used in the string list @code{Source_Dirs}, then there may - be several files with the same source file name. In this case, only the file - in the first directory is considered as an immediate source of the project - file. If the order of the source directories is not known statically, it is - an error to have several files with the same source file name. - - Projects can be specified to have no Ada source - files: the value of @code{Source_Dirs} or @code{Source_Files} may be an empty - list, or the @code{"Ada"} may be absent from @code{Languages}: - - @smallexample @c projectfile - for Source_Dirs use (); - for Source_Files use (); - for Languages use ("C", "C++"); - @end smallexample - - @noindent - Otherwise, a project must contain at least one immediate source. - - Projects with no source files are useful as template packages - (@pxref{Packages in Project Files}) for other projects; in particular to - define a package @code{Naming} (@pxref{Naming Schemes}). - - @c **************************** - @c * Importing Projects * - @c **************************** - - @node Importing Projects - @section Importing Projects - @cindex @code{ADA_PROJECT_PATH} - @cindex @code{GPR_PROJECT_PATH} - - @noindent - An immediate source of a project P may depend on source files that - are neither immediate sources of P nor in the predefined library. - To get this effect, P must @emph{import} the projects that contain the needed - source files. - - @smallexample @c projectfile - @group - with "project1", "utilities.gpr"; - with "/namings/apex.gpr"; - project Main is - @dots{} - @end group - @end smallexample - - @noindent - As can be seen in this example, the syntax for importing projects is similar - to the syntax for importing compilation units in Ada. However, project files - use literal strings instead of names, and the @code{with} clause identifies - project files rather than packages. - - Each literal string is the file name or path name (absolute or relative) of a - project file. If a string corresponds to a file name, with no path or a - relative path, then its location is determined by the @emph{project path}. The - latter can be queried using @code{gnatls -v}. It contains: - - @itemize @bullet - @item - In first position, the directory containing the current project file. - @item - In last position, the default project directory. This default project directory - is part of the GNAT installation and is the standard place to install project - files giving access to standard support libraries. - @ifclear vms - @ref{Installing a library} - @end ifclear - - @item - In between, all the directories referenced in the - ^environment variables^logical names^ @env{GPR_PROJECT_PATH} - and @env{ADA_PROJECT_PATH} if they exist, and in that order. - @end itemize - - @noindent - If a relative pathname is used, as in - - @smallexample @c projectfile - with "tests/proj"; - @end smallexample - - @noindent - then the full path for the project is constructed by concatenating this - relative path to those in the project path, in order, until a matching file is - found. Any symbolic link will be fully resolved in the directory of the - importing project file before the imported project file is examined. - - If the @code{with}'ed project file name does not have an extension, - the default is @file{^.gpr^.GPR^}. If a file with this extension is not found, - then the file name as specified in the @code{with} clause (no extension) will - be used. In the above example, if a file @code{project1.gpr} is found, then it - will be used; otherwise, if a file @code{^project1^PROJECT1^} exists - then it will be used; if neither file exists, this is an error. - - A warning is issued if the name of the project file does not match the - name of the project; this check is case insensitive. - - Any source file that is an immediate source of the imported project can be - used by the immediate sources of the importing project, transitively. Thus - if @code{A} imports @code{B}, and @code{B} imports @code{C}, the immediate - sources of @code{A} may depend on the immediate sources of @code{C}, even if - @code{A} does not import @code{C} explicitly. However, this is not recommended, - because if and when @code{B} ceases to import @code{C}, some sources in - @code{A} will no longer compile. - - A side effect of this capability is that normally cyclic dependencies are not - permitted: if @code{A} imports @code{B} (directly or indirectly) then @code{B} - is not allowed to import @code{A}. However, there are cases when cyclic - dependencies would be beneficial. For these cases, another form of import - between projects exists, the @code{limited with}: a project @code{A} that - imports a project @code{B} with a straight @code{with} may also be imported, - directly or indirectly, by @code{B} on the condition that imports from @code{B} - to @code{A} include at least one @code{limited with}. - - @smallexample @c 0projectfile - with "../b/b.gpr"; - with "../c/c.gpr"; - project A is - end A; - - limited with "../a/a.gpr"; - project B is - end B; - - with "../d/d.gpr"; - project C is - end C; - - limited with "../a/a.gpr"; - project D is - end D; - @end smallexample - - @noindent - In the above legal example, there are two project cycles: - @itemize @bullet - @item A-> B-> A - @item A -> C -> D -> A - @end itemize - - @noindent - In each of these cycle there is one @code{limited with}: import of @code{A} - from @code{B} and import of @code{A} from @code{D}. - - The difference between straight @code{with} and @code{limited with} is that - the name of a project imported with a @code{limited with} cannot be used in the - project that imports it. In particular, its packages cannot be renamed and - its variables cannot be referred to. - - An exception to the above rules for @code{limited with} is that for the main - project specified to @command{gnatmake} or to the @command{GNAT} driver a - @code{limited with} is equivalent to a straight @code{with}. For example, - in the example above, projects @code{B} and @code{D} could not be main - projects for @command{gnatmake} or to the @command{GNAT} driver, because they - each have a @code{limited with} that is the only one in a cycle of importing - projects. - - @c ********************* - @c * Project Extension * - @c ********************* - - @node Project Extension - @section Project Extension - - @noindent - During development of a large system, it is sometimes necessary to use - modified versions of some of the source files, without changing the original - sources. This can be achieved through the @emph{project extension} facility. - - @smallexample @c projectfile - project Modified_Utilities extends "/baseline/utilities.gpr" is @dots{} - @end smallexample - - @noindent - A project extension declaration introduces an extending project - (the @emph{child}) and a project being extended (the @emph{parent}). - - By default, a child project inherits all the sources of its parent. - However, inherited sources can be overridden: a unit in a parent is hidden - by a unit of the same name in the child. - - Inherited sources are considered to be sources (but not immediate sources) - 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 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 spec will still be found in the project - @code{Utilities}. - - A child project can have only one parent, except when it is qualified as - abstract. But it may import any number of other projects. - - A project is not allowed to import directly or indirectly at the same time a - child project and any of its ancestors. - - @c ******************************* - @c * Project Hierarchy Extension * - @c ******************************* - - @node Project Hierarchy Extension - @section Project Hierarchy Extension - - @noindent - When extending a large system spanning multiple projects, it is often - inconvenient to extend every project in the hierarchy that is impacted by a - small change introduced. In such cases, it is possible to create a virtual - extension of entire hierarchy using @code{extends all} relationship. - - When the project is extended using @code{extends all} inheritance, all projects - that are imported by it, both directly and indirectly, are considered virtually - extended. That is, the Project Manager creates "virtual projects" - that extend every project in the hierarchy; all these virtual projects have - no sources of their own and have as object directory the object directory of - the root of "extending all" project. - - It is possible to explicitly extend one or more projects in the hierarchy - in order to modify the sources. These extending projects must be imported by - the "extending all" project, which will replace the corresponding virtual - projects with the explicit ones. - - When building such a project hierarchy extension, the Project Manager will - ensure that both modified sources and sources in virtual extending projects - that depend on them, are recompiled. - - By means of example, consider the following hierarchy of projects. - - @enumerate - @item - project A, containing package P1 - @item - project B importing A and containing package P2 which depends on P1 - @item - project C importing B and containing package P3 which depends on P2 - @end enumerate - - @noindent - We want to modify packages P1 and P3. - - This project hierarchy will need to be extended as follows: - - @enumerate - @item - Create project A1 that extends A, placing modified P1 there: - - @smallexample @c 0projectfile - project A1 extends "(@dots{})/A" is - end A1; - @end smallexample - - @item - Create project C1 that "extends all" C and imports A1, placing modified - P3 there: - - @smallexample @c 0projectfile - with "(@dots{})/A1"; - project C1 extends all "(@dots{})/C" is - end C1; - @end smallexample - @end enumerate - - When you build project C1, your entire modified project space will be - recompiled, including the virtual project B1 that has been impacted by the - "extending all" inheritance of project C. - - Note that if a Library Project in the hierarchy is virtually extended, - the virtual project that extends the Library Project is not a Library Project. - - @c **************************************** - @c * External References in Project Files * - @c **************************************** - - @node External References in Project Files - @section External References in Project Files - - @noindent - A project file may contain references to external variables; such references - are called @emph{external references}. - - An external variable is either defined as part of the environment (an - environment variable in Unix, for example) or else specified on the command - line via the @option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch. - If both, then the command line value is used. - - The value of an external reference is obtained by means of the built-in - function @code{external}, which returns a string value. - This function has two forms: - @itemize @bullet - @item @code{external (external_variable_name)} - @item @code{external (external_variable_name, default_value)} - @end itemize - - @noindent - Each parameter must be a string literal. For example: - - @smallexample @c projectfile - external ("USER") - external ("OS", "GNU/Linux") - @end smallexample - - @noindent - In the form with one parameter, the function returns the value of - the external variable given as parameter. If this name is not present in the - environment, the function returns an empty string. - - In the form with two string parameters, the second argument is - the value returned when the variable given as the first argument is not - present in the environment. In the example above, if @code{"OS"} is not - the name of ^an environment variable^a logical name^ and is not passed on - the command line, then the returned value is @code{"GNU/Linux"}. - - An external reference may be part of a string expression or of a string - list expression, and can therefore appear in a variable declaration or - an attribute declaration. - - @smallexample @c projectfile - @group - type Mode_Type is ("Debug", "Release"); - Mode : Mode_Type := external ("MODE"); - case Mode is - when "Debug" => - @dots{} - @end group - @end smallexample - - @c ***************************** - @c * Packages in Project Files * - @c ***************************** - - @node Packages in Project Files - @section Packages in Project Files - - @noindent - A @emph{package} defines the settings for project-aware tools within a - project. - For each such tool one can declare a package; the names for these - packages are preset (@pxref{Packages}). - A package may contain variable declarations, attribute declarations, and case - constructions. - - @smallexample @c projectfile - @group - project Proj is - package Builder is -- used by gnatmake - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-v^-v^", - "^-g^-g^"); - end Builder; - end Proj; - @end group - @end smallexample - - @noindent - The syntax of package declarations mimics that of package in Ada. - - Most of the packages have an attribute - @code{^Default_Switches^Default_Switches^}. - This attribute is an associative array, and its value is a string list. - The index of the associative array is the name of a programming language (case - insensitive). This attribute indicates the ^switch^switch^ - or ^switches^switches^ to be used - with the corresponding tool. - - Some packages also have another attribute, @code{^Switches^Switches^}, - an associative array whose value is a string list. - The index is the name of a source file. - This attribute indicates the ^switch^switch^ - or ^switches^switches^ to be used by the corresponding - tool when dealing with this specific file. - - Further information on these ^switch^switch^-related attributes is found in - @ref{^Switches^Switches^ and Project Files}. - - A package may be declared as a @emph{renaming} of another package; e.g., from - the project file for an imported project. - - @smallexample @c projectfile - @group - with "/global/apex.gpr"; - project Example is - package Naming renames Apex.Naming; - @dots{} - end Example; - @end group - @end smallexample - - @noindent - Packages that are renamed in other project files often come from project files - that have no sources: they are just used as templates. Any modification in the - template will be reflected automatically in all the project files that rename - a package from the template. - - In addition to the tool-oriented packages, you can also declare a package - named @code{Naming} to establish specialized source file naming conventions - (@pxref{Naming Schemes}). - - @c ************************************ - @c * Variables from Imported Projects * - @c ************************************ - - @node Variables from Imported Projects - @section Variables from Imported Projects - - @noindent - An attribute or variable defined in an imported or parent project can - be used in expressions in the importing / extending project. - Such an attribute or variable is denoted by an expanded name whose prefix - is either the name of the project or the expanded name of a package within - a project. - - @smallexample @c projectfile - @group - with "imported"; - project Main extends "base" is - Var1 := Imported.Var; - Var2 := Base.Var & ".new"; - @end group - - @group - package Builder is - for ^Default_Switches^Default_Switches^ ("Ada") - use Imported.Builder'Ada_^Switches^Switches^ & - "^-gnatg^-gnatg^" & - "^-v^-v^"; - end Builder; - @end group - - @group - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use Base.Compiler'Ada_^Switches^Switches^; - end Compiler; - end Main; - @end group - @end smallexample - - @noindent - In this example: - - @itemize @bullet - @item - The value of @code{Var1} is a copy of the variable @code{Var} defined - in the project file @file{"imported.gpr"} - @item - the value of @code{Var2} is a copy of the value of variable @code{Var} - defined in the project file @file{base.gpr}, concatenated with @code{".new"} - @item - attribute @code{^Default_Switches^Default_Switches^ ("Ada")} in package - @code{Builder} is a string list that includes in its value a copy of the value - of @code{Ada_^Switches^Switches^} defined in the @code{Builder} package - in project file @file{imported.gpr} plus two new elements: - @option{"^-gnatg^-gnatg^"} - and @option{"^-v^-v^"}; - @item - attribute @code{^Default_Switches^Default_Switches^ ("Ada")} in package - @code{Compiler} is a copy of the variable @code{Ada_^Switches^Switches^} - defined in the @code{Compiler} package in project file @file{base.gpr}, - the project being extended. - @end itemize - - @c ****************** - @c * Naming Schemes * - @c ****************** - - @node Naming Schemes - @section Naming Schemes - - @noindent - Sometimes an Ada software system is ported from a foreign compilation - environment to GNAT, and the file names do not use the default GNAT - conventions. Instead of changing all the file names (which for a variety - of reasons might not be possible), you can define the relevant file - naming scheme in the @code{Naming} package in your project file. - - @noindent - Note that the use of pragmas described in - @ref{Alternative File Naming Schemes} by mean of a configuration - pragmas file is not supported when using project files. You must use - the features described in this paragraph. You can however use specify - other configuration pragmas (@pxref{Specifying Configuration Pragmas}). - - @ifclear vms - For example, the following - package models the Apex file naming rules: - - @smallexample @c projectfile - @group - package Naming is - for Casing use "lowercase"; - for Dot_Replacement use "."; - for Spec_Suffix ("Ada") use ".1.ada"; - for Body_Suffix ("Ada") use ".2.ada"; - end Naming; - @end group - @end smallexample - @end ifclear - - @ifset vms - For example, the following package models the HP Ada file naming rules: - - @smallexample @c projectfile - @group - package Naming is - for Casing use "lowercase"; - for Dot_Replacement use "__"; - for Spec_Suffix ("Ada") use "_.^ada^ada^"; - for Body_Suffix ("Ada") use ".^ada^ada^"; - end Naming; - @end group - @end smallexample - - @noindent - (Note that @code{Casing} is @code{"lowercase"} because GNAT gets the file - names in lower case) - @end ifset - - @noindent - You can define the following attributes in package @code{Naming}: - - @table @code - - @item @code{Casing} - This must be a string with one of the three values @code{"lowercase"}, - @code{"uppercase"} or @code{"mixedcase"}; these strings are case insensitive. - - @noindent - If @code{Casing} is not specified, then the default is @code{"lowercase"}. - - @item @code{Dot_Replacement} - This must be a string whose value satisfies the following conditions: - - @itemize @bullet - @item It must not be empty - @item It cannot start or end with an alphanumeric character - @item It cannot be a single underscore - @item It cannot start with an underscore followed by an alphanumeric - @item It cannot contain a dot @code{'.'} except if the entire string - is @code{"."} - @end itemize - - @noindent - If @code{Dot_Replacement} is not specified, then the default is @code{"-"}. - - @item @code{Spec_Suffix} - This is an associative array (indexed by the programming language name, case - insensitive) whose value is a string that must satisfy the following - conditions: - - @itemize @bullet - @item It must not be empty - @item It must include at least one dot - @end itemize - @noindent - If @code{Spec_Suffix ("Ada")} is not specified, then the default is - @code{"^.ads^.ADS^"}. - - @item @code{Body_Suffix} - This is an associative array (indexed by the programming language name, case - insensitive) whose value is a string that must satisfy the following - conditions: - - @itemize @bullet - @item It must not be empty - @item It must include at least one dot - @item It cannot be the same as @code{Spec_Suffix ("Ada")} - @end itemize - @noindent - If @code{Body_Suffix ("Ada")} and @code{Spec_Suffix ("Ada")} end with the - same string, then a file name that ends with the longest of these two suffixes - will be a body if the longest suffix is @code{Body_Suffix ("Ada")} or a spec - if the longest suffix is @code{Spec_Suffix ("Ada")}. - - If the suffix does not start with a '.', a file with a name exactly equal - to the suffix will also be part of the project (for instance if you define - the suffix as @code{Makefile}, a file called @file{Makefile} will be part - of the project. This is not interesting in general when using projects to - compile. However, it might become useful when a project is also used to - find the list of source files in an editor, like the GNAT Programming System - (GPS). - - If @code{Body_Suffix ("Ada")} is not specified, then the default is - @code{"^.adb^.ADB^"}. - - @item @code{Separate_Suffix} - This must be a string whose value satisfies the same conditions as - @code{Body_Suffix}. The same "longest suffix" rules apply. - - @noindent - If @code{Separate_Suffix ("Ada")} is not specified, then it defaults to same - value as @code{Body_Suffix ("Ada")}. - - @item @code{Spec} - @noindent - You can use the associative array attribute @code{Spec} to define - the source file name for an individual Ada compilation unit's spec. The array - index must be a string literal that identifies the Ada unit (case insensitive). - The value of this attribute must be a string that identifies the file that - contains this unit's spec (case sensitive or insensitive depending on the - operating system). - - @smallexample @c projectfile - for Spec ("MyPack.MyChild") use "mypack.mychild.spec"; - @end smallexample - - When the source file contains several units, you can indicate at what - position the unit occurs in the file, with the following. The first unit - in the file has index 1 - - @smallexample @c projectfile - for Body ("top") use "foo.a" at 1; - for Body ("foo") use "foo.a" at 2; - @end smallexample - - @item @code{Body} - - You can use the associative array attribute @code{Body} to - define the source file name for an individual Ada compilation unit's body - (possibly a subunit). The array index must be a string literal that identifies - the Ada unit (case insensitive). The value of this attribute must be a string - that identifies the file that contains this unit's body or subunit (case - sensitive or insensitive depending on the operating system). - - @smallexample @c projectfile - for Body ("MyPack.MyChild") use "mypack.mychild.body"; - @end smallexample - @end table - - @c ******************** - @c * Library Projects * - @c ******************** - - @node Library Projects - @section Library Projects - - @noindent - @emph{Library projects} are projects whose object code is placed in a library. - (Note that this facility is not yet supported on all platforms). - - @code{gnatmake} or @code{gprbuild} will collect all object files into a - single archive, which might either be a shared or a static library. This - library can later on be linked with multiple executables, potentially - reducing their sizes. - - If your project file specifies languages other than Ada, but you are still - using @code{gnatmake} to compile and link, the latter will not try to - compile your sources other than Ada (you should use @code{gprbuild} if that - is your intent). However, @code{gnatmake} will automatically link all object - files found in the object directory, whether or not they were compiled from - an Ada source file. This specific behavior only applies when multiple - languages are specified. - - To create a library project, you need to define in its project file - two project-level attributes: @code{Library_Name} and @code{Library_Dir}. - Additionally, you may define other library-related attributes such as - @code{Library_Kind}, @code{Library_Version}, @code{Library_Interface}, - @code{Library_Auto_Init}, @code{Library_Options} and @code{Library_GCC}. - - The @code{Library_Name} attribute has a string value. There is no restriction - on the name of a library. It is the responsibility of the developer to - choose a name that will be accepted by the platform. It is recommended to - choose names that could be Ada identifiers; such names are almost guaranteed - to be acceptable on all platforms. - - The @code{Library_Dir} attribute has a string value that designates the path - (absolute or relative) of the directory where the library will reside. - It must designate an existing directory, and this directory must be writable, - different from the project's object directory and from any source directory - in the project tree. - - If both @code{Library_Name} and @code{Library_Dir} are specified and - are legal, then the project file defines a library project. The optional - library-related attributes are checked only for such project files. - - The @code{Library_Kind} attribute has a string value that must be one of the - following (case insensitive): @code{"static"}, @code{"dynamic"} or - @code{"relocatable"} (which is a synonym for @code{"dynamic"}). If this - attribute is not specified, the library is a static library, that is - an archive of object files that can be potentially linked into a - static executable. Otherwise, the library may be dynamic or - relocatable, that is a library that is loaded only at the start of execution. - - If you need to build both a static and a dynamic library, you should use two - different object directories, since in some cases some extra code needs to - be generated for the latter. For such cases, it is recommended to either use - two different project files, or a single one which uses external variables - to indicate what kind of library should be build. - - The @code{Library_ALI_Dir} attribute may be specified to indicate the - directory where the ALI files of the library will be copied. When it is - not specified, the ALI files are copied to the directory specified in - attribute @code{Library_Dir}. The directory specified by @code{Library_ALI_Dir} - must be writable and different from the project's object directory and from - any source directory in the project tree. - - The @code{Library_Version} attribute has a string value whose interpretation - is platform dependent. It has no effect on VMS and Windows. On Unix, it is - used only for dynamic/relocatable libraries as the internal name of the - library (the @code{"soname"}). If the library file name (built from the - @code{Library_Name}) is different from the @code{Library_Version}, then the - library file will be a symbolic link to the actual file whose name will be - @code{Library_Version}. - - Example (on Unix): - - @smallexample @c projectfile - @group - project Plib is - - Version := "1"; - - for Library_Dir use "lib_dir"; - for Library_Name use "dummy"; - for Library_Kind use "relocatable"; - for Library_Version use "libdummy.so." & Version; - - end Plib; - @end group - @end smallexample - - @noindent - Directory @file{lib_dir} will contain the internal library file whose name - will be @file{libdummy.so.1}, and @file{libdummy.so} will be a symbolic link to - @file{libdummy.so.1}. - - When @command{gnatmake} detects that a project file - is a library project file, it will check all immediate sources of the project - and rebuild the library if any of the sources have been recompiled. - - Standard project files can import library project files. In such cases, - the libraries will only be rebuilt if some of its sources are recompiled - because they are in the closure of some other source in an importing project. - Sources of the library project files that are not in such a closure will - not be checked, unless the full library is checked, because one of its sources - needs to be recompiled. - - For instance, assume the project file @code{A} imports the library project file - @code{L}. The immediate sources of A are @file{a1.adb}, @file{a2.ads} and - @file{a2.adb}. The immediate sources of L are @file{l1.ads}, @file{l1.adb}, - @file{l2.ads}, @file{l2.adb}. - - If @file{l1.adb} has been modified, then the library associated with @code{L} - will be rebuilt when compiling all the immediate sources of @code{A} only - if @file{a1.ads}, @file{a2.ads} or @file{a2.adb} includes a statement - @code{"with L1;"}. - - To be sure that all the sources in the library associated with @code{L} are - up to date, and that all the sources of project @code{A} are also up to date, - the following two commands needs to be used: - - @smallexample - gnatmake -Pl.gpr - gnatmake -Pa.gpr - @end smallexample - - When a library is built or rebuilt, an attempt is made first to delete all - files in the library directory. - All @file{ALI} files will also be copied from the object directory to the - library directory. To build executables, @command{gnatmake} will use the - library rather than the individual object files. - - @ifclear vms - It is also possible to create library project files for third-party libraries - that are precompiled and cannot be compiled locally thanks to the - @code{externally_built} attribute. (See @ref{Installing a library}). - @end ifclear - - @c ******************************* - @c * Stand-alone Library Projects * - @c ******************************* - - @node Stand-alone Library Projects - @section Stand-alone Library Projects - - @noindent - A Stand-alone Library is a library that contains the necessary code to - elaborate the Ada units that are included in the library. A Stand-alone - Library is suitable to be used in an executable when the main is not - in Ada. However, Stand-alone Libraries may also be used with an Ada main - subprogram. - - A Stand-alone Library Project is a Library Project where the library is - a Stand-alone Library. - - To be a Stand-alone Library Project, in addition to the two attributes - that make a project a Library Project (@code{Library_Name} and - @code{Library_Dir}, see @ref{Library Projects}), the attribute - @code{Library_Interface} must be defined. - - @smallexample @c projectfile - @group - for Library_Dir use "lib_dir"; - for Library_Name use "dummy"; - for Library_Interface use ("int1", "int1.child"); - @end group - @end smallexample - - Attribute @code{Library_Interface} has a nonempty string list value, - each string in the list designating a unit contained in an immediate source - of the project file. - - When a Stand-alone Library is built, first the binder is invoked to build - a package whose name depends on the library name - (^b~dummy.ads/b^B$DUMMY.ADS/B^ in the example above). - This binder-generated package includes initialization and - finalization procedures whose - names depend on the library name (dummyinit and dummyfinal in the example - above). The object corresponding to this package is included in the library. - - A dynamic or relocatable Stand-alone Library is automatically initialized - if automatic initialization of Stand-alone Libraries is supported on the - platform and if attribute @code{Library_Auto_Init} is not specified or - is specified with the value "true". A static Stand-alone Library is never - automatically initialized. - - Single string attribute @code{Library_Auto_Init} may be specified with only - two possible values: "false" or "true" (case-insensitive). Specifying - "false" for attribute @code{Library_Auto_Init} will prevent automatic - initialization of dynamic or relocatable libraries. - - When a non-automatically initialized Stand-alone Library is used - in an executable, its initialization procedure must be called before - any service of the library is used. - When the main subprogram is in Ada, it may mean that the initialization - procedure has to be called during elaboration of another package. - - For a Stand-Alone Library, only the @file{ALI} files of the Interface Units - (those that are listed in attribute @code{Library_Interface}) are copied to - the Library Directory. As a consequence, only the Interface Units may be - imported from Ada units outside of the library. If other units are imported, - the binding phase will fail. - - When a Stand-Alone Library is bound, the switches that are specified in - the attribute @code{Default_Switches ("Ada")} in package @code{Binder} are - used in the call to @command{gnatbind}. - - The string list attribute @code{Library_Options} may be used to specified - additional switches to the call to @command{gcc} to link the library. - - The attribute @code{Library_Src_Dir}, may be specified for a - Stand-Alone Library. @code{Library_Src_Dir} is a simple attribute that has a - single string value. Its value must be the path (absolute or relative to the - project directory) of an existing directory. This directory cannot be the - object directory or one of the source directories, but it can be the same as - the library directory. The sources of the Interface - Units of the library, necessary to an Ada client of the library, will be - copied to the designated directory, called Interface Copy directory. - These sources includes the specs of the Interface Units, but they may also - include bodies and subunits, when pragmas @code{Inline} or @code{Inline_Always} - are used, or when there is a generic units in the spec. Before the sources - are copied to the Interface Copy directory, an attempt is made to delete all - files in the Interface Copy directory. - - @c ************************************* - @c * Switches Related to Project Files * - @c ************************************* - @node Switches Related to Project Files - @section Switches Related to Project Files - - @noindent - 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 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 - by @option{^-X^/EXTERNAL_REFERENCE^} switches, if any. - @ifclear vms - There may zero, one or more spaces between @option{-P} and @var{project}. - @end ifclear - - @noindent - There must be only one @option{^-P^/PROJECT_FILE^} switch on the command line. - - @noindent - Since the Project Manager parses the project file only after all the switches - on the command line are checked, the order of the switches - @option{^-P^/PROJECT_FILE^}, - @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} - or @option{^-X^/EXTERNAL_REFERENCE^} is not significant. - - @item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} - @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. - - @ifclear vms - @noindent - If @var{name} or @var{value} includes a space, then @var{name=value} should be - put between quotes. - @smallexample - -XOS=NT - -X"user=John Doe" - @end smallexample - @end ifclear - - @noindent - Several @option{^-X^/EXTERNAL_REFERENCE^} switches can be used simultaneously. - If several @option{^-X^/EXTERNAL_REFERENCE^} switches specify the same - @var{name}, only the last one is used. - - @noindent - 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 @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool) - Indicates the verbosity of the parsing of GNAT project files. - - @ifclear vms - @option{-vP0} means Default; - @option{-vP1} means Medium; - @option{-vP2} means High. - @end ifclear - - @ifset vms - There are three possible options for this qualifier: DEFAULT, MEDIUM and - HIGH. - @end ifset - - @noindent - The default is ^Default^DEFAULT^: no output for syntactically correct - project files. - @noindent - If several @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} switches are present, - only the last one is used. - - @item ^-aP^/ADD_PROJECT_SEARCH_DIR=^ - @cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool) - Add directory 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^= - @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 - 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 ********************************** - @c * Tools Supporting Project Files * - @c ********************************** - - @node Tools Supporting Project Files - @section Tools Supporting Project Files - - @menu - * gnatmake and Project Files:: - * The GNAT Driver and Project Files:: - @end menu - - @node gnatmake and Project Files - @subsection gnatmake and Project Files - - @noindent - This section covers several topics related to @command{gnatmake} and - project files: defining ^switches^switches^ for @command{gnatmake} - and for the tools that it invokes; specifying configuration pragmas; - the use of the @code{Main} attribute; building and rebuilding library project - files. - - @menu - * ^Switches^Switches^ and Project Files:: - * Specifying Configuration Pragmas:: - * Project Files and Main Subprograms:: - * Library Project Files:: - @end menu - - @node ^Switches^Switches^ and Project Files - @subsubsection ^Switches^Switches^ and Project Files - - @ifset vms - It is not currently possible to specify VMS style qualifiers in the project - files; only Unix style ^switches^switches^ may be specified. - @end ifset - - @noindent - For each of the packages @code{Builder}, @code{Compiler}, @code{Binder}, and - @code{Linker}, you can specify a @code{^Default_Switches^Default_Switches^} - attribute, a @code{^Switches^Switches^} attribute, or both; - as their names imply, these ^switch^switch^-related - attributes affect the ^switches^switches^ that are used for each of these GNAT - components when - @command{gnatmake} is invoked. As will be explained below, these - component-specific ^switches^switches^ precede - the ^switches^switches^ provided on the @command{gnatmake} command line. - - The @code{^Default_Switches^Default_Switches^} attribute is an associative - array indexed by language name (case insensitive) whose value is a string list. - For example: - - @smallexample @c projectfile - @group - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnaty^-gnaty^", - "^-v^-v^"); - end Compiler; - @end group - @end smallexample - - @noindent - The @code{^Switches^Switches^} attribute is also an associative array, - indexed by a file name (which may or may not be case sensitive, depending - on the operating system) whose value is a string list. For example: - - @smallexample @c projectfile - @group - package Builder is - for ^Switches^Switches^ ("main1.adb") - use ("^-O2^-O2^"); - for ^Switches^Switches^ ("main2.adb") - use ("^-g^-g^"); - end Builder; - @end group - @end smallexample - - @noindent - For the @code{Builder} package, the file names must designate source files - for main subprograms. For the @code{Binder} and @code{Linker} packages, the - file names must designate @file{ALI} or source files for main subprograms. - In each case just the file name without an explicit extension is acceptable. - - For each tool used in a program build (@command{gnatmake}, the compiler, the - binder, and the linker), the corresponding package @dfn{contributes} a set of - ^switches^switches^ for each file on which the tool is invoked, based on the - ^switch^switch^-related attributes defined in the package. - In particular, the ^switches^switches^ - that each of these packages contributes for a given file @var{f} comprise: - - @itemize @bullet - @item - the value of attribute @code{^Switches^Switches^ (@var{f})}, - if it is specified in the package for the given file, - @item - otherwise, the value of @code{^Default_Switches^Default_Switches^ ("Ada")}, - if it is specified in the package. - @end itemize - - @noindent - If neither of these attributes is defined in the package, then the package does - not contribute any ^switches^switches^ for the given file. - - When @command{gnatmake} is invoked on a file, the ^switches^switches^ comprise - two sets, in the following order: those contributed for the file - by the @code{Builder} package; - and the switches passed on the command line. - - When @command{gnatmake} invokes a tool (compiler, binder, linker) on a file, - the ^switches^switches^ passed to the tool comprise three sets, - in the following order: - - @enumerate - @item - the applicable ^switches^switches^ contributed for the file - by the @code{Builder} package in the project file supplied on the command line; - - @item - those contributed for the file by the package (in the relevant project file -- - see below) corresponding to the tool; and - - @item - the applicable switches passed on the command line. - @end enumerate - - @noindent - The term @emph{applicable ^switches^switches^} reflects the fact that - @command{gnatmake} ^switches^switches^ may or may not be passed to individual - tools, depending on the individual ^switch^switch^. - - @command{gnatmake} may invoke the compiler on source files from different - projects. The Project Manager will use the appropriate project file to - determine the @code{Compiler} package for each source file being compiled. - Likewise for the @code{Binder} and @code{Linker} packages. - - As an example, consider the following package in a project file: - - @smallexample @c projectfile - @group - project Proj1 is - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-g^-g^"); - for ^Switches^Switches^ ("a.adb") - use ("^-O1^-O1^"); - for ^Switches^Switches^ ("b.adb") - use ("^-O2^-O2^", - "^-gnaty^-gnaty^"); - end Compiler; - end Proj1; - @end group - @end smallexample - - @noindent - If @command{gnatmake} is invoked with this project file, and it needs to - compile, say, the files @file{a.adb}, @file{b.adb}, and @file{c.adb}, then - @file{a.adb} will be compiled with the ^switch^switch^ - @option{^-O1^-O1^}, - @file{b.adb} with ^switches^switches^ - @option{^-O2^-O2^} - and @option{^-gnaty^-gnaty^}, - and @file{c.adb} with @option{^-g^-g^}. - - The following example illustrates the ordering of the ^switches^switches^ - contributed by different packages: - - @smallexample @c projectfile - @group - project Proj2 is - package Builder is - for ^Switches^Switches^ ("main.adb") - use ("^-g^-g^", - "^-O1^-)1^", - "^-f^-f^"); - end Builder; - @end group - - @group - package Compiler is - for ^Switches^Switches^ ("main.adb") - use ("^-O2^-O2^"); - end Compiler; - end Proj2; - @end group - @end smallexample - - @noindent - If you issue the command: - - @smallexample - gnatmake ^-Pproj2^/PROJECT_FILE=PROJ2^ -O0 main - @end smallexample - - @noindent - then the compiler will be invoked on @file{main.adb} with the following - sequence of ^switches^switches^ - - @smallexample - ^-g -O1 -O2 -O0^-g -O1 -O2 -O0^ - @end smallexample - - with the last @option{^-O^-O^} - ^switch^switch^ having precedence over the earlier ones; - several other ^switches^switches^ - (such as @option{^-c^-c^}) are added implicitly. - - The ^switches^switches^ - @option{^-g^-g^} - and @option{^-O1^-O1^} are contributed by package - @code{Builder}, @option{^-O2^-O2^} is contributed - by the package @code{Compiler} - and @option{^-O0^-O0^} comes from the command line. - - The @option{^-g^-g^} - ^switch^switch^ will also be passed in the invocation of - @command{Gnatlink.} - - A final example illustrates switch contributions from packages in different - project files: - - @smallexample @c projectfile - @group - project Proj3 is - for Source_Files use ("pack.ads", "pack.adb"); - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnata^-gnata^"); - end Compiler; - end Proj3; - @end group - - @group - with "Proj3"; - project Proj4 is - for Source_Files use ("foo_main.adb", "bar_main.adb"); - package Builder is - for ^Switches^Switches^ ("foo_main.adb") - use ("^-s^-s^", - "^-g^-g^"); - end Builder; - end Proj4; - @end group - - @group - -- Ada source file: - with Pack; - procedure Foo_Main is - @dots{} - end Foo_Main; - @end group - @end smallexample - - If the command is - @smallexample - gnatmake ^-PProj4^/PROJECT_FILE=PROJ4^ foo_main.adb -cargs -gnato - @end smallexample - - @noindent - then the ^switches^switches^ passed to the compiler for @file{foo_main.adb} are - @option{^-g^-g^} (contributed by the package @code{Proj4.Builder}) and - @option{^-gnato^-gnato^} (passed on the command line). - When the imported package @code{Pack} is compiled, the ^switches^switches^ used - are @option{^-g^-g^} from @code{Proj4.Builder}, - @option{^-gnata^-gnata^} (contributed from package @code{Proj3.Compiler}, - and @option{^-gnato^-gnato^} from the command line. - - @noindent - When using @command{gnatmake} with project files, some ^switches^switches^ or - arguments may be expressed as relative paths. As the working directory where - compilation occurs may change, these relative paths are converted to absolute - paths. For the ^switches^switches^ found in a project file, the relative paths - are relative to the project file directory, for the switches on the command - line, they are relative to the directory where @command{gnatmake} is invoked. - The ^switches^switches^ for which this occurs are: - ^-I^-I^, - ^-A^-A^, - ^-L^-L^, - ^-aO^-aO^, - ^-aL^-aL^, - ^-aI^-aI^, as well as all arguments that are not switches (arguments to - ^switch^switch^ - ^-o^-o^, object files specified in package @code{Linker} or after - -largs on the command line). The exception to this rule is the ^switch^switch^ - ^--RTS=^--RTS=^ for which a relative path argument is never converted. - - @node Specifying Configuration Pragmas - @subsubsection Specifying Configuration Pragmas - - When using @command{gnatmake} with project files, if there exists a file - @file{gnat.adc} that contains configuration pragmas, this file will be - ignored. - - Configuration pragmas can be defined by means of the following attributes in - project files: @code{Global_Configuration_Pragmas} in package @code{Builder} - and @code{Local_Configuration_Pragmas} in package @code{Compiler}. - - Both these attributes are single string attributes. Their values is the path - name of a file containing configuration pragmas. If a path name is relative, - then it is relative to the project directory of the project file where the - attribute is defined. - - When compiling a source, the configuration pragmas used are, in order, - those listed in the file designated by attribute - @code{Global_Configuration_Pragmas} in package @code{Builder} of the main - project file, if it is specified, and those listed in the file designated by - attribute @code{Local_Configuration_Pragmas} in package @code{Compiler} of - the project file of the source, if it exists. - - @node Project Files and Main Subprograms - @subsubsection Project Files and Main Subprograms - - @noindent - When using a project file, you can invoke @command{gnatmake} - with one or several main subprograms, by specifying their source files on the - command line. - - @smallexample - gnatmake ^-P^/PROJECT_FILE=^prj main1 main2 main3 - @end smallexample - - @noindent - Each of these needs to be a source file of the same project, except - when the switch ^-u^/UNIQUE^ is used. - - @noindent - When ^-u^/UNIQUE^ is not used, all the mains need to be sources of the - same project, one of the project in the tree rooted at the project specified - on the command line. The package @code{Builder} of this common project, the - "main project" is the one that is considered by @command{gnatmake}. - - @noindent - When ^-u^/UNIQUE^ is used, the specified source files may be in projects - imported directly or indirectly by the project specified on the command line. - Note that if such a source file is not part of the project specified on the - command line, the ^switches^switches^ found in package @code{Builder} of the - project specified on the command line, if any, that are transmitted - to the compiler will still be used, not those found in the project file of - the source file. - - @noindent - When using a project file, you can also invoke @command{gnatmake} without - explicitly specifying any main, and the effect depends on whether you have - defined the @code{Main} attribute. This attribute has a string list value, - where each element in the list is the name of a source file (the file - extension is optional) that contains a unit that can be a main subprogram. - - If the @code{Main} attribute is defined in a project file as a non-empty - string list and the switch @option{^-u^/UNIQUE^} is not used on the command - line, then invoking @command{gnatmake} with this project file but without any - main on the command line is equivalent to invoking @command{gnatmake} with all - the file names in the @code{Main} attribute on the command line. - - Example: - @smallexample @c projectfile - @group - project Prj is - for Main use ("main1", "main2", "main3"); - end Prj; - @end group - @end smallexample - - @noindent - With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"} - is equivalent to - @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1 main2 main3"}. - - When the project attribute @code{Main} is not specified, or is specified - as an empty string list, or when the switch @option{-u} is used on the command - line, then invoking @command{gnatmake} with no main on the command line will - result in all immediate sources of the project file being checked, and - potentially recompiled. Depending on the presence of the switch @option{-u}, - sources from other project files on which the immediate sources of the main - project file depend are also checked and potentially recompiled. In other - words, the @option{-u} switch is applied to all of the immediate sources of the - main project file. - - When no main is specified on the command line and attribute @code{Main} exists - and includes several mains, or when several mains are specified on the - command line, the default ^switches^switches^ in package @code{Builder} will - be used for all mains, even if there are specific ^switches^switches^ - specified for one or several mains. - - But the ^switches^switches^ from package @code{Binder} or @code{Linker} will be - the specific ^switches^switches^ for each main, if they are specified. - - @node Library Project Files - @subsubsection Library Project Files - - @noindent - When @command{gnatmake} is invoked with a main project file that is a library - project file, it is not allowed to specify one or more mains on the command - line. - - @noindent - When a library project file is specified, switches ^-b^/ACTION=BIND^ and - ^-l^/ACTION=LINK^ have special meanings. - - @itemize @bullet - @item ^-b^/ACTION=BIND^ is only allowed for stand-alone libraries. It indicates - to @command{gnatmake} that @command{gnatbind} should be invoked for the - library. - - @item ^-l^/ACTION=LINK^ may be used for all library projects. It indicates - to @command{gnatmake} that the binder generated file should be compiled - (in the case of a stand-alone library) and that the library should be built. - - @end itemize - - @node The GNAT Driver and Project Files - @subsection The GNAT Driver and Project Files - - @noindent - A number of GNAT tools, other than @command{^gnatmake^gnatmake^} - can benefit from project files: - @command{^gnatbind^gnatbind^}, - @command{^gnatcheck^gnatcheck^}), - @command{^gnatclean^gnatclean^}), - @command{^gnatelim^gnatelim^}, - @command{^gnatfind^gnatfind^}, - @command{^gnatlink^gnatlink^}, - @command{^gnatls^gnatls^}, - @command{^gnatmetric^gnatmetric^}, - @command{^gnatpp^gnatpp^}, - @command{^gnatstub^gnatstub^}, - and @command{^gnatxref^gnatxref^}. However, none of these tools can be invoked - directly with a project file switch (@option{^-P^/PROJECT_FILE=^}). - They must be invoked through the @command{gnat} driver. - - The @command{gnat} driver is a wrapper that accepts a number of commands and - calls the corresponding tool. It was designed initially for VMS platforms (to - convert VMS qualifiers to Unix-style switches), but it is now available on all - GNAT platforms. - - On non-VMS platforms, the @command{gnat} driver accepts the following commands - (case insensitive): - - @itemize @bullet - @item - BIND to invoke @command{^gnatbind^gnatbind^} - @item - CHOP to invoke @command{^gnatchop^gnatchop^} - @item - CLEAN to invoke @command{^gnatclean^gnatclean^} - @item - COMP or COMPILE to invoke the compiler - @item - ELIM to invoke @command{^gnatelim^gnatelim^} - @item - FIND to invoke @command{^gnatfind^gnatfind^} - @item - KR or KRUNCH to invoke @command{^gnatkr^gnatkr^} - @item - LINK to invoke @command{^gnatlink^gnatlink^} - @item - LS or LIST to invoke @command{^gnatls^gnatls^} - @item - MAKE to invoke @command{^gnatmake^gnatmake^} - @item - NAME to invoke @command{^gnatname^gnatname^} - @item - PREP or PREPROCESS to invoke @command{^gnatprep^gnatprep^} - @item - PP or PRETTY to invoke @command{^gnatpp^gnatpp^} - @item - METRIC to invoke @command{^gnatmetric^gnatmetric^} - @item - STUB to invoke @command{^gnatstub^gnatstub^} - @item - XREF to invoke @command{^gnatxref^gnatxref^} - @end itemize - - @noindent - (note that the compiler is invoked using the command - @command{^gnatmake -f -u -c^gnatmake -f -u -c^}). - - @noindent - On non-VMS platforms, between @command{gnat} and the command, two - special switches may be used: - - @itemize @bullet - @item - @command{-v} to display the invocation of the tool. - @item - @command{-dn} to prevent the @command{gnat} driver from removing - the temporary files it has created. These temporary files are - configuration files and temporary file list files. - @end itemize - - @noindent - The command may be followed by switches and arguments for the invoked - tool. - - @smallexample - gnat bind -C main.ali - gnat ls -a main - gnat chop foo.txt - @end smallexample - - @noindent - Switches may also be put in text files, one switch per line, and the text - files may be specified with their path name preceded by '@@'. - - @smallexample - gnat bind @@args.txt main.ali - @end smallexample - - @noindent - In addition, for commands BIND, COMP or COMPILE, FIND, ELIM, LS or LIST, LINK, - METRIC, PP or PRETTY, STUB and XREF, the project file related switches - (@option{^-P^/PROJECT_FILE^}, - @option{^-X^/EXTERNAL_REFERENCE^} and - @option{^-vP^/MESSAGES_PROJECT_FILE=^x}) may be used in addition to - the switches of the invoking tool. - - @noindent - When GNAT PP or GNAT PRETTY is used with a project file, but with no source - specified on the command line, it invokes @command{^gnatpp^gnatpp^} with all - the immediate sources of the specified project file. - - @noindent - When GNAT METRIC is used with a project file, but with no source - specified on the command line, it invokes @command{^gnatmetric^gnatmetric^} - with all the immediate sources of the specified project file and with - @option{^-d^/DIRECTORY^} with the parameter pointing to the object directory - of the project. - - @noindent - In addition, when GNAT PP, GNAT PRETTY or GNAT METRIC is used with - a project file, no source is specified on the command line and - switch ^-U^/ALL_PROJECTS^ is specified on the command line, then - the underlying tool (^gnatpp^gnatpp^ or - ^gnatmetric^gnatmetric^) is invoked for all sources of all projects, - not only for the immediate sources of the main project. - @ifclear vms - (-U stands for Universal or Union of the project files of the project tree) - @end ifclear - - @noindent - For each of the following commands, there is optionally a corresponding - package in the main project. - - @itemize @bullet - @item - package @code{Binder} for command BIND (invoking @code{^gnatbind^gnatbind^}) - - @item - package @code{Check} for command CHECK (invoking - @code{^gnatcheck^gnatcheck^}) - - @item - package @code{Compiler} for command COMP or COMPILE (invoking the compiler) - - @item - package @code{Cross_Reference} for command XREF (invoking - @code{^gnatxref^gnatxref^}) - - @item - package @code{Eliminate} for command ELIM (invoking - @code{^gnatelim^gnatelim^}) - - @item - package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^}) - - @item - package @code{Gnatls} for command LS or LIST (invoking @code{^gnatls^gnatls^}) - - @item - package @code{Gnatstub} for command STUB - (invoking @code{^gnatstub^gnatstub^}) - - @item - package @code{Linker} for command LINK (invoking @code{^gnatlink^gnatlink^}) - - @item - package @code{Check} for command CHECK - (invoking @code{^gnatcheck^gnatcheck^}) - - @item - package @code{Metrics} for command METRIC - (invoking @code{^gnatmetric^gnatmetric^}) - - @item - package @code{Pretty_Printer} for command PP or PRETTY - (invoking @code{^gnatpp^gnatpp^}) - - @end itemize - - @noindent - Package @code{Gnatls} has a unique attribute @code{^Switches^Switches^}, - a simple variable with a string list value. It contains ^switches^switches^ - for the invocation of @code{^gnatls^gnatls^}. - - @smallexample @c projectfile - @group - project Proj1 is - package gnatls is - for ^Switches^Switches^ - use ("^-a^-a^", - "^-v^-v^"); - end gnatls; - end Proj1; - @end group - @end smallexample - - @noindent - All other packages have two attribute @code{^Switches^Switches^} and - @code{^Default_Switches^Default_Switches^}. ! @noindent ! @code{^Switches^Switches^} is an associative array attribute, indexed by the ! source file name, that has a string list value: the ^switches^switches^ to be ! used when the tool corresponding to the package is invoked for the specific ! source file. ! ! @noindent ! @code{^Default_Switches^Default_Switches^} is an associative array attribute, ! indexed by the programming language that has a string list value. ! @code{^Default_Switches^Default_Switches^ ("Ada")} contains the ! ^switches^switches^ for the invocation of the tool corresponding ! to the package, except if a specific @code{^Switches^Switches^} attribute ! is specified for the source file. ! ! @smallexample @c projectfile ! @group ! project Proj is ! ! for Source_Dirs use ("./**"); ! ! package gnatls is ! for ^Switches^Switches^ use ! ("^-a^-a^", ! "^-v^-v^"); ! end gnatls; ! @end group ! @group ! ! package Compiler is ! for ^Default_Switches^Default_Switches^ ("Ada") ! use ("^-gnatv^-gnatv^", ! "^-gnatwa^-gnatwa^"); ! end Binder; ! @end group ! @group ! ! package Binder is ! for ^Default_Switches^Default_Switches^ ("Ada") ! use ("^-C^-C^", ! "^-e^-e^"); ! end Binder; ! @end group ! @group ! ! package Linker is ! for ^Default_Switches^Default_Switches^ ("Ada") ! use ("^-C^-C^"); ! for ^Switches^Switches^ ("main.adb") ! use ("^-C^-C^", ! "^-v^-v^", ! "^-v^-v^"); ! end Linker; ! @end group ! @group ! ! package Finder is ! for ^Default_Switches^Default_Switches^ ("Ada") ! use ("^-a^-a^", ! "^-f^-f^"); ! end Finder; ! @end group ! @group ! ! package Cross_Reference is ! for ^Default_Switches^Default_Switches^ ("Ada") ! use ("^-a^-a^", ! "^-f^-f^", ! "^-d^-d^", ! "^-u^-u^"); ! end Cross_Reference; ! end Proj; ! @end group ! @end smallexample ! ! @noindent ! With the above project file, commands such as ! ! @smallexample ! ^gnat comp -Pproj main^GNAT COMP /PROJECT_FILE=PROJ MAIN^ ! ^gnat ls -Pproj main^GNAT LIST /PROJECT_FILE=PROJ MAIN^ ! ^gnat xref -Pproj main^GNAT XREF /PROJECT_FILE=PROJ MAIN^ ! ^gnat bind -Pproj main.ali^GNAT BIND /PROJECT_FILE=PROJ MAIN.ALI^ ! ^gnat link -Pproj main.ali^GNAT LINK /PROJECT_FILE=PROJ MAIN.ALI^ ! @end smallexample ! ! @noindent ! will set up the environment properly and invoke the tool with the switches ! found in the package corresponding to the tool: ! @code{^Default_Switches^Default_Switches^ ("Ada")} for all tools, ! except @code{^Switches^Switches^ ("main.adb")} ! for @code{^gnatlink^gnatlink^}. ! It is also possible to invoke some of the tools, ! @code{^gnatcheck^gnatcheck^}), ! @code{^gnatmetric^gnatmetric^}), ! and @code{^gnatpp^gnatpp^}) ! on a set of project units thanks to the combination of the switches ! @option{-P}, @option{-U} and possibly the main unit when one is interested ! in its closure. For instance, ! @smallexample ! gnat metric -Pproj ! @end smallexample ! will compute the metrics for all the immediate units of project ! @code{proj}. ! @smallexample ! gnat metric -Pproj -U ! @end smallexample ! will compute the metrics for all the units of the closure of projects ! rooted at @code{proj}. ! @smallexample ! gnat metric -Pproj -U main_unit ! @end smallexample ! will compute the metrics for the closure of units rooted at ! @code{main_unit}. This last possibility relies implicitly ! on @command{gnatbind}'s option @option{-R}. ! ! @c ********************** ! @node An Extended Example ! @section An Extended Example ! ! @noindent ! Suppose that we have two programs, @var{prog1} and @var{prog2}, ! whose sources are in corresponding directories. We would like ! to build them with a single @command{gnatmake} command, and we want to place ! their object files into @file{build} subdirectories of the source directories. ! Furthermore, we want to have to have two separate subdirectories ! in @file{build} -- @file{release} and @file{debug} -- which will contain ! the object files compiled with different set of compilation flags. ! ! In other words, we have the following structure: ! ! @smallexample ! @group ! main ! |- prog1 ! | |- build ! | | debug ! | | release ! |- prog2 ! |- build ! | debug ! | release ! @end group ! @end smallexample ! ! @noindent ! Here are the project files that we must place in a directory @file{main} ! to maintain this structure: ! ! @enumerate ! ! @item We create a @code{Common} project with a package @code{Compiler} that ! specifies the compilation ^switches^switches^: ! ! @smallexample ! File "common.gpr": ! @group ! @b{project} Common @b{is} ! ! @b{for} Source_Dirs @b{use} (); -- No source files ! @end group ! ! @group ! @b{type} Build_Type @b{is} ("release", "debug"); ! Build : Build_Type := External ("BUILD", "debug"); ! @end group ! @group ! @b{package} Compiler @b{is} ! @b{case} Build @b{is} ! @b{when} "release" => ! @b{for} ^Default_Switches^Default_Switches^ ("Ada") ! @b{use} ("^-O2^-O2^"); ! @b{when} "debug" => ! @b{for} ^Default_Switches^Default_Switches^ ("Ada") ! @b{use} ("^-g^-g^"); ! @b{end case}; ! @b{end} Compiler; ! ! @b{end} Common; ! @end group ! @end smallexample ! ! @item We create separate projects for the two programs: ! ! @smallexample ! @group ! File "prog1.gpr": ! ! @b{with} "common"; ! @b{project} Prog1 @b{is} ! ! @b{for} Source_Dirs @b{use} ("prog1"); ! @b{for} Object_Dir @b{use} "prog1/build/" & Common.Build; ! ! @b{package} Compiler @b{renames} Common.Compiler; ! ! @b{end} Prog1; ! @end group ! @end smallexample ! ! @smallexample ! @group ! File "prog2.gpr": ! ! @b{with} "common"; ! @b{project} Prog2 @b{is} ! ! @b{for} Source_Dirs @b{use} ("prog2"); ! @b{for} Object_Dir @b{use} "prog2/build/" & Common.Build; ! ! @b{package} Compiler @b{renames} Common.Compiler; ! ! @end group ! @b{end} Prog2; ! @end smallexample ! ! @item We create a wrapping project @code{Main}: @smallexample @group ! File "main.gpr": ! ! @b{with} "common"; ! @b{with} "prog1"; ! @b{with} "prog2"; ! @b{project} Main @b{is} ! ! @b{package} Compiler @b{renames} Common.Compiler; ! ! @b{end} Main; @end group @end smallexample ! @item Finally we need to create a dummy procedure that @code{with}s (either ! explicitly or implicitly) all the sources of our two programs. ! @end enumerate @noindent ! Now we can build the programs using the command ! @smallexample ! gnatmake ^-P^/PROJECT_FILE=^main dummy ! @end smallexample @noindent ! for the Debug mode, or ! ! @ifclear vms ! @smallexample ! gnatmake -Pmain -XBUILD=release ! @end smallexample ! @end ifclear ! @ifset vms ! @smallexample ! GNAT MAKE /PROJECT_FILE=main /EXTERNAL_REFERENCE=BUILD=release ! @end smallexample ! @end ifset @noindent ! for the Release mode. ! ! @c ******************************** ! @c * Project File Complete Syntax * ! @c ******************************** ! ! @node Project File Complete Syntax ! @section Project File Complete Syntax ! ! @smallexample ! project ::= ! context_clause project_declaration ! ! context_clause ::= ! @{with_clause@} ! ! with_clause ::= ! @b{with} path_name @{ , path_name @} ; ! ! path_name ::= ! string_literal ! ! project_declaration ::= ! simple_project_declaration | project_extension ! ! simple_project_declaration ::= ! @b{project} simple_name @b{is} ! @{declarative_item@} ! @b{end} simple_name; ! ! project_extension ::= ! @b{project} simple_name @b{extends} path_name @b{is} ! @{declarative_item@} ! @b{end} simple_name; ! ! declarative_item ::= ! package_declaration | ! typed_string_declaration | ! other_declarative_item ! ! package_declaration ::= ! package_spec | package_renaming ! ! package_spec ::= ! @b{package} package_identifier @b{is} ! @{simple_declarative_item@} ! @b{end} package_identifier ; ! ! package_identifier ::= ! @code{Naming} | @code{Builder} | @code{Compiler} | @code{Binder} | ! @code{Linker} | @code{Finder} | @code{Cross_Reference} | ! @code{^gnatls^gnatls^} | @code{IDE} | @code{Pretty_Printer} ! ! package_renaming ::== ! @b{package} package_identifier @b{renames} ! simple_name.package_identifier ; ! ! typed_string_declaration ::= ! @b{type} _simple_name @b{is} ! ( string_literal @{, string_literal@} ); ! ! other_declarative_item ::= ! attribute_declaration | ! typed_variable_declaration | ! variable_declaration | ! case_construction ! ! attribute_declaration ::= ! full_associative_array_declaration | ! @b{for} attribute_designator @b{use} expression ; ! ! full_associative_array_declaration ::= ! @b{for} simple_name @b{use} ! simple_name [ . simple_Name ] ' simple_name ; ! ! attribute_designator ::= ! simple_name | ! simple_name ( string_literal ) ! ! typed_variable_declaration ::= ! simple_name : name := string_expression ; ! ! variable_declaration ::= ! simple_name := expression; ! ! expression ::= ! term @{& term@} ! ! term ::= ! literal_string | ! string_list | ! name | ! external_value | ! attribute_reference ! ! string_literal ::= ! (same as Ada) ! ! string_list ::= ! ( expression @{ , expression @} ) ! ! external_value ::= ! @b{external} ( string_literal [, string_literal] ) ! ! attribute_reference ::= ! attribute_prefix ' simple_name [ ( literal_string ) ] ! ! attribute_prefix ::= ! @b{project} | ! simple_name | package_identifier | ! simple_name . package_identifier ! ! case_construction ::= ! @b{case} name @b{is} ! @{case_item@} ! @b{end case} ; ! ! case_item ::= ! @b{when} discrete_choice_list => ! @{case_construction | attribute_declaration@} ! ! discrete_choice_list ::= ! string_literal @{| string_literal@} | ! @b{others} ! ! name ::= ! simple_name @{. simple_name@} ! simple_name ::= ! identifier (same as Ada) ! @end smallexample @node The Cross-Referencing Tools gnatxref and gnatfind @chapter The Cross-Referencing Tools @code{gnatxref} and @code{gnatfind} --- 11939,11996 ---- @c ***************************************** @c * G N A T P r o j e c t M a n a g e r * @c ***************************************** ! @c ------ macros for projects.texi ! @c These macros are needed when building the gprbuild documentation, but ! @c should have no effect in the gnat user's guide + @macro CODESAMPLE{TXT} @smallexample @group ! \TXT\ @end group @end smallexample + @end macro ! @macro PROJECTFILE{TXT} ! @CODESAMPLE{\TXT\} ! @end macro ! @c simulates a newline when in a @CODESAMPLE ! @macro NL{} ! @end macro + @macro TIP{TXT} + @quotation @noindent ! \TXT\ ! @end quotation ! @end macro ! @macro TIPHTML{TXT} ! \TXT\ ! @end macro + @macro IMPORTANT{TXT} + @quotation @noindent ! \TXT\ ! @end quotation ! @end macro + @macro NOTE{TXT} + @quotation @noindent ! \TXT\ ! @end quotation ! @end macro ! @include projects.texi ! @c ***************************************** ! @c * Cross-referencing tools ! @c ***************************************** @node The Cross-Referencing Tools gnatxref and gnatfind @chapter The Cross-Referencing Tools @code{gnatxref} and @code{gnatfind} *************** use the @code{gnat} driver (see @ref{The *** 15403,15409 **** @noindent The command invocation for @code{gnatxref} is: @smallexample ! $ gnatxref @ovar{switches} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]} @end smallexample @noindent --- 12039,12047 ---- @noindent The command invocation for @code{gnatxref} is: @smallexample ! @c $ gnatxref @ovar{switches} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatxref @r{[}@var{switches}@r{]} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]} @end smallexample @noindent *************** Do not look for sources in the system de *** 15467,15472 **** --- 12105,12117 ---- @cindex @option{-nostdlib} (@command{gnatxref}) Do not look for library files in the system default directory. + @item --ext=@var{extension} + @cindex @option{--ext} (@command{gnatxref}) + Specify an alternate ali file extension. The default is @code{ali} and other + extensions (e.g. @code{sli} for SPARK library files) may be specified via this + switch. Note that if this switch overrides the default, which means that only + the new extension will be considered. + @item --RTS=@var{rts-path} @cindex @option{--RTS} (@command{gnatxref}) Specifies the default location of the runtime library. Same meaning as the *************** Equivalent to @samp{-aODIR -aIDIR}. *** 15495,15501 **** @item -pFILE @cindex @option{-pFILE} (@command{gnatxref}) ! Specify a project file to use @xref{Project Files}. If you need to use the @file{.gpr} project files, you should use gnatxref through the GNAT driver (@command{gnat xref -Pproject}). --- 12140,12146 ---- @item -pFILE @cindex @option{-pFILE} (@command{gnatxref}) ! Specify a project file to use @xref{GNAT Project Manager}. If you need to use the @file{.gpr} project files, you should use gnatxref through the GNAT driver (@command{gnat xref -Pproject}). *************** you can say @samp{gnatxref ^-ag^/ALL_FIL *** 15535,15542 **** The command line for @code{gnatfind} is: @smallexample ! $ gnatfind @ovar{switches} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]} ! @r{[}@var{file1} @var{file2} @dots{}] @end smallexample @noindent --- 12180,12190 ---- The command line for @code{gnatfind} is: @smallexample ! @c $ gnatfind @ovar{switches} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]} ! @c @r{[}@var{file1} @var{file2} @dots{}] ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatfind @r{[}@var{switches}@r{]} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]} ! @r{[}@var{file1} @var{file2} @dots{}@r{]} @end smallexample @noindent *************** Equivalent to @samp{-aODIR -aIDIR}. *** 15675,15681 **** @item -pFILE @cindex @option{-pFILE} (@command{gnatfind}) ! Specify a project file (@pxref{Project Files}) to use. By default, @code{gnatxref} and @code{gnatfind} will try to locate a project file in the current directory. --- 12323,12329 ---- @item -pFILE @cindex @option{-pFILE} (@command{gnatfind}) ! Specify a project file (@pxref{GNAT Project Manager}) to use. By default, @code{gnatxref} and @code{gnatfind} will try to locate a project file in the current directory. *************** call @command{gnatpp} through the @comma *** 16122,16128 **** The @command{gnatpp} command has the form @smallexample ! $ gnatpp @ovar{switches} @var{filename} @end smallexample @noindent --- 12770,12778 ---- The @command{gnatpp} command has the form @smallexample ! @c $ gnatpp @ovar{switches} @var{filename} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatpp @r{[}@var{switches}@r{]} @var{filename} @r{[}-cargs @var{gcc_switches}@r{]} @end smallexample @noindent *************** output source file *** 16138,16143 **** --- 12788,12802 ---- reformat; ``wildcards'' or several file names on the same gnatpp command are allowed. The file name may contain path information; it does not have to follow the GNAT file naming rules + + @item + @samp{@var{gcc_switches}} is a list of switches for + @command{gcc}. They will be passed on to all compiler invocations made by + @command{gnatelim} to generate the ASIS trees. Here you can provide + @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, + use the @option{-gnatec} switch to set the configuration file, + use the @option{-gnat05} switch if sources should be compiled in + Ada 2005 mode etc. @end itemize @menu *************** with @option{^-pipe^/STANDARD_OUTPUT^} o *** 16635,16646 **** The additional @command{gnatpp} switches are defined in this subsection. @table @option ! @item ^-files @var{filename}^/FILES=@var{output_file}^ @cindex @option{^-files^/FILES^} (@code{gnatpp}) Take the argument source files from the specified file. This file should be an ! ordinary textual file containing file names separated by spaces or ! line breaks. You can use this switch more then once in the same call to ! @command{gnatpp}. You also can combine this switch with explicit list of files. @item ^-v^/VERBOSE^ --- 13294,13305 ---- The additional @command{gnatpp} switches are defined in this subsection. @table @option ! @item ^-files @var{filename}^/FILES=@var{filename}^ @cindex @option{^-files^/FILES^} (@code{gnatpp}) Take the argument source files from the specified file. This file should be an ! ordinary text file containing file names separated by spaces or ! line breaks. You can use this switch more than once in the same call to ! @command{gnatpp}. You also can combine this switch with an explicit list of files. @item ^-v^/VERBOSE^ *************** through the @command{gnat} driver. *** 17224,17230 **** The @command{gnatmetric} command has the form @smallexample ! $ gnatmetric @ovar{switches} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]} @end smallexample @noindent --- 13883,13891 ---- The @command{gnatmetric} command has the form @smallexample ! @c $ gnatmetric @ovar{switches} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatmetric @r{[}@var{switches}@r{]} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]} @end smallexample @noindent *************** Including both a @option{-files} switch *** 17245,17255 **** @var{filename} arguments is permitted. @item ! @samp{-cargs @var{gcc_switches}} is a list of switches for @command{gcc}. They will be passed on to all compiler invocations made by @command{gnatmetric} to generate the ASIS trees. Here you can provide @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, ! and use the @option{-gnatec} switch to set the configuration file. @end itemize @menu --- 13906,13918 ---- @var{filename} arguments is permitted. @item ! @samp{@var{gcc_switches}} is a list of switches for @command{gcc}. They will be passed on to all compiler invocations made by @command{gnatmetric} to generate the ASIS trees. Here you can provide @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, ! and use the @option{-gnatec} switch to set the configuration file, ! use the @option{-gnat05} switch if sources should be compiled in ! Ada 2005 mode etc. @end itemize @menu *************** Do not generate the output in text form *** 17319,17325 **** @cindex @option{^-d^/DIRECTORY^} (@command{gnatmetric}) @item ^-d @var{output_dir}^/DIRECTORY=@var{output_dir}^ ! Put textual files with detailed metrics into @var{output_dir} @cindex @option{^-o^/SUFFIX_DETAILS^} (@command{gnatmetric}) @item ^-o @var{file_suffix}^/SUFFIX_DETAILS=@var{file_suffix}^ --- 13982,13988 ---- @cindex @option{^-d^/DIRECTORY^} (@command{gnatmetric}) @item ^-d @var{output_dir}^/DIRECTORY=@var{output_dir}^ ! Put text files with detailed metrics into @var{output_dir} @cindex @option{^-o^/SUFFIX_DETAILS^} (@command{gnatmetric}) @item ^-o @var{file_suffix}^/SUFFIX_DETAILS=@var{file_suffix}^ *************** Additional @command{gnatmetric} switches *** 17896,17902 **** @cindex @option{^-files^/FILES^} (@code{gnatmetric}) Take the argument source files from the specified file. This file should be an ordinary text file containing file names separated by spaces or ! line breaks. You can use this switch more then once in the same call to @command{gnatmetric}. You also can combine this switch with an explicit list of files. --- 14559,14565 ---- @cindex @option{^-files^/FILES^} (@code{gnatmetric}) Take the argument source files from the specified file. This file should be an ordinary text file containing file names separated by spaces or ! line breaks. You can use this switch more than once in the same call to @command{gnatmetric}. You also can combine this switch with an explicit list of files. *************** Verbose mode; *** 17906,17917 **** @command{gnatmetric} generates version information and then a trace of sources being processed. - @item ^-dv^/DEBUG_OUTPUT^ - @cindex @option{^-dv^/DEBUG_OUTPUT^} (@code{gnatmetric}) - Debug mode; - @command{gnatmetric} generates various messages useful to understand what - happens during the metrics computation - @item ^-q^/QUIET^ @cindex @option{^-q^/QUIET^} (@code{gnatmetric}) Quiet mode. --- 14569,14574 ---- *************** The @code{gnatkr} command has the form *** 18006,18012 **** @ifclear vms @smallexample ! $ gnatkr @var{name} @ovar{length} @end smallexample @end ifclear --- 14663,14671 ---- @ifclear vms @smallexample ! @c $ gnatkr @var{name} @ovar{length} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatkr @var{name} @r{[}@var{length}@r{]} @end smallexample @end ifclear *************** all characters need to be in the ASCII s *** 18194,18200 **** To call @code{gnatprep} use @smallexample ! $ gnatprep @ovar{switches} @var{infile} @var{outfile} @ovar{deffile} @end smallexample @noindent --- 14853,14861 ---- To call @code{gnatprep} use @smallexample ! @c $ gnatprep @ovar{switches} @var{infile} @var{outfile} @ovar{deffile} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatprep @r{[}@var{switches}@r{]} @var{infile} @var{outfile} @r{[}@var{deffile}@r{]} @end smallexample @noindent *************** Header : String := $XYZ; *** 18457,18532 **** @noindent and then the substitution will occur as desired. - @ifset vms - @node The GNAT Run-Time Library Builder gnatlbr - @chapter The GNAT Run-Time Library Builder @code{gnatlbr} - @findex gnatlbr - @cindex Library builder - - @noindent - @code{gnatlbr} is a tool for rebuilding the GNAT run time with user - supplied configuration pragmas. - - @menu - * Running gnatlbr:: - * Switches for gnatlbr:: - * Examples of gnatlbr Usage:: - @end menu - - @node Running gnatlbr - @section Running @code{gnatlbr} - - @noindent - The @code{gnatlbr} command has the form - - @smallexample - $ GNAT LIBRARY /@r{[}CREATE@r{|}SET@r{|}DELETE@r{]}=directory @r{[}/CONFIG=file@r{]} - @end smallexample - - @node Switches for gnatlbr - @section Switches for @code{gnatlbr} - - @noindent - @code{gnatlbr} recognizes the following switches: - - @table @option - @c !sort! - @item /CREATE=directory - @cindex @code{/CREATE} (@code{gnatlbr}) - Create the new run-time library in the specified directory. - - @item /SET=directory - @cindex @code{/SET} (@code{gnatlbr}) - Make the library in the specified directory the current run-time library. - - @item /DELETE=directory - @cindex @code{/DELETE} (@code{gnatlbr}) - Delete the run-time library in the specified directory. - - @item /CONFIG=file - @cindex @code{/CONFIG} (@code{gnatlbr}) - With /CREATE: Use the configuration pragmas in the specified file when - building the library. - - With /SET: Use the configuration pragmas in the specified file when - compiling. - - @end table - - @node Examples of gnatlbr Usage - @section Example of @code{gnatlbr} Usage - - @smallexample - Contents of VAXFLOAT.ADC: - pragma Float_Representation (VAX_Float); - - $ GNAT LIBRARY /CREATE=[.VAXFLOAT] /CONFIG=VAXFLOAT.ADC - - GNAT LIBRARY rebuilds the run-time library in directory [.VAXFLOAT] - - @end smallexample - @end ifset - @node The GNAT Library Browser gnatls @chapter The GNAT Library Browser @code{gnatls} @findex gnatls --- 15118,15123 ---- *************** Display Copyright and version, then exit *** 18878,18883 **** --- 15469,15483 ---- If @option{--version} was not used, display usage, then exit disregarding all other options. + @item ^--subdirs^/SUBDIRS^=subdir + Actual object directory of each project file is the subdirectory subdir of the + object directory specified or defaulted in the project file. + + @item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^ + By default, shared library projects are not allowed to import static library + projects. When this switch is used on the command line, this restriction is + relaxed. + @item ^-c^/COMPILER_FILES_ONLY^ @cindex @option{^-c^/COMPILER_FILES_ONLY^} (@code{gnatclean}) Only attempt to delete the files produced by the compiler, not those produced *************** be accessed by the directive @option{-l@ *** 19155,19200 **** @noindent If you use project files, library installation is part of the library build ! process. Thus no further action is needed in order to make use of the ! libraries that are built as part of the general application build. A usable ! version of the library is installed in the directory specified by the ! @code{Library_Dir} attribute of the library project file. ! ! You may want to install a library in a context different from where the library ! is built. This situation arises with third party suppliers, who may want ! to distribute a library in binary form where the user is not expected to be ! able to recompile the library. The simplest option in this case is to provide ! a project file slightly different from the one used to build the library, by ! using the @code{externally_built} attribute. For instance, the project ! file used to build the library in the previous section can be changed into the ! following one when the library is installed: ! ! @smallexample @c projectfile ! project My_Lib is ! for Source_Dirs use ("src1", "src2"); ! for Library_Name use "mylib"; ! for Library_Dir use "lib"; ! for Library_Kind use "dynamic"; ! for Externally_Built use "true"; ! end My_lib; ! @end smallexample ! ! @noindent ! This project file assumes that the directories @file{src1}, ! @file{src2}, and @file{lib} exist in ! the directory containing the project file. The @code{externally_built} ! attribute makes it clear to the GNAT builder that it should not attempt to ! recompile any of the units from this library. It allows the library provider to ! restrict the source set to the minimum necessary for clients to make use of the ! library as described in the first section of this chapter. It is the ! responsibility of the library provider to install the necessary sources, ALI ! files and libraries in the directories mentioned in the project file. For ! convenience, the user's library project file should be installed in a location ! that will be searched automatically by the GNAT ! builder. These are the directories referenced in the @env{GPR_PROJECT_PATH} ! environment variable (@pxref{Importing Projects}), and also the default GNAT ! library location that can be queried with @command{gnatls -v} and is usually of ! the form $gnat_install_root/lib/gnat. When project files are not an option, it is also possible, but not recommended, to install the library so that the sources needed to use the library are on the --- 15755,15761 ---- @noindent If you use project files, library installation is part of the library build ! process (@pxref{Installing a library with project files}). When project files are not an option, it is also possible, but not recommended, to install the library so that the sources needed to use the library are on the *************** Solaris and Windows NT/2000/XP (x86). *** 20170,20176 **** The @code{gnatmem} command has the form @smallexample ! $ gnatmem @ovar{switches} user_program @end smallexample @noindent --- 16731,16739 ---- The @code{gnatmem} command has the form @smallexample ! @c $ gnatmem @ovar{switches} user_program ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatmem @r{[}@var{switches}@r{]} @var{user_program} @end smallexample @noindent *************** Therefore, checks can only be performed *** 20684,23124 **** legal Ada units. Moreover, when a unit depends semantically upon units located outside the current directory, the source search path has to be provided when calling @command{gnatcheck}, either through a specified project file or ! through @command{gnatcheck} switches as described below. A number of rules are predefined in @command{gnatcheck} and are described later in this chapter. - You can also add new rules, by modifying the @command{gnatcheck} code and - rebuilding the tool. In order to add a simple rule making some local checks, - a small amount of straightforward ASIS-based programming is usually needed. - - Project support for @command{gnatcheck} is provided by the GNAT - driver (see @ref{The GNAT Driver and Project Files}). - - Invoking @command{gnatcheck} on the command line has the form: - - @smallexample - $ gnatcheck @ovar{switches} @{@var{filename}@} - @r{[}^-files^/FILES^=@{@var{arg_list_filename}@}@r{]} - @r{[}-cargs @var{gcc_switches}@r{]} -rules @var{rule_options} - @end smallexample - - @noindent - where - @itemize @bullet - @item - @var{switches} specify the general tool options - - @item - Each @var{filename} is the name (including the extension) of a source - file to process. ``Wildcards'' are allowed, and - the file name may contain path information. - - @item - Each @var{arg_list_filename} is the name (including the extension) of a text - file containing the names of the source files to process, separated by spaces - or line breaks. - - @item - @var{gcc_switches} is a list of switches for - @command{gcc}. They will be passed on to all compiler invocations made by - @command{gnatcheck} to generate the ASIS trees. Here you can provide - @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, - and use the @option{-gnatec} switch to set the configuration file. - - @item - @var{rule_options} is a list of options for controlling a set of - rules to be checked by @command{gnatcheck} (@pxref{gnatcheck Rule Options}). - @end itemize - - @noindent - Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be - supplied. - - @menu - * Format of the Report File:: - * General gnatcheck Switches:: - * gnatcheck Rule Options:: - * Adding the Results of Compiler Checks to gnatcheck Output:: - * Project-Wide Checks:: - * Rule exemption:: - * Predefined Rules:: - * Example of gnatcheck Usage:: - @end menu - - @node Format of the Report File - @section Format of the Report File - @cindex Report file (for @code{gnatcheck}) - - @noindent - The @command{gnatcheck} tool outputs on @file{stdout} all messages concerning - rule violations. - It also creates a text file that - contains the complete report of the last gnatcheck run. By default this file - is named named @file{^gnatcheck.out^GNATCHECK.OUT^} and it is located in the - current directory; the @option{^-o^/OUTPUT^} option can be used to change the - name and/or location of the report file. This report contains: - @itemize @bullet - @item date and time of @command{gnatcheck} run, the version of - the tool that has generated this report and the full parameters - of the @command{gnatcheck} invocation; - @item list of enabled rules; - @item total number of detected violations; - @item list of source files where rule violations have been detected; - @item list of source files where no violations have been detected. - @end itemize - - @node General gnatcheck Switches - @section General @command{gnatcheck} Switches - - @noindent - The following switches control the general @command{gnatcheck} behavior - - @table @option - @c !sort! - @cindex @option{^-a^/ALL^} (@command{gnatcheck}) - @item ^-a^/ALL^ - Process all units including those with read-only ALI files such as - those from the GNAT Run-Time library. - - @ifclear vms - @ignore - @cindex @option{-d} (@command{gnatcheck}) - @item -d - Debug mode - @end ignore - - @cindex @option{-dd} (@command{gnatcheck}) - @item -dd - Progress indicator mode (for use in GPS). - @end ifclear - - @cindex @option{^-h^/HELP^} (@command{gnatcheck}) - @item ^-h^/HELP^ - List the predefined and user-defined rules. For more details see - @ref{Predefined Rules}. - - @cindex @option{^-l^/LOCS^} (@command{gnatcheck}) - @item ^-l^/LOCS^ - Use full source locations references in the report file. For a construct from - a generic instantiation a full source location is a chain from the location - of this construct in the generic unit to the place where this unit is - instantiated. - - @cindex @option{^-log^/LOG^} (@command{gnatcheck}) - @item ^-log^/LOG^ - Duplicate all the output sent to @file{stderr} into a log file. The log file - is named @file{gnatcheck.log} and is located in the current directory. - - @cindex @option{^-m^/DIAGNOSTIC_LIMIT^} (@command{gnatcheck}) - @item ^-m@i{nnnn}^/DIAGNOSTIC_LIMIT=@i{nnnn}^ - Maximum number of diagnostics to be sent to @file{stdout}, where @i{nnnn} is in - the range 0@dots{}1000; - the default value is 500. Zero means that there is no limitation on - the number of diagnostic messages to be output. - - @cindex @option{^-q^/QUIET^} (@command{gnatcheck}) - @item ^-q^/QUIET^ - Quiet mode. All the diagnostics about rule violations are placed in the - @command{gnatcheck} report file only, without duplication on @file{stdout}. - - @cindex @option{^-s^/SHORT^} (@command{gnatcheck}) - @item ^-s^/SHORT^ - Short format of the report file (no version information, no list of applied - rules, no list of checked sources is included) - - @cindex @option{^--include-file=@var{file}^/INCLUDE_FILE=@var{file}^} (@command{gnatcheck}) - @item ^--include-file^/INCLUDE_FILE^ - Append the content of the specified text file to the report file - - @cindex @option{^-t^/TIME^} (@command{gnatcheck}) - @item ^-t^/TIME^ - Print out execution time. - - @cindex @option{^-v^/VERBOSE^} (@command{gnatcheck}) - @item ^-v^/VERBOSE^ - Verbose mode; @command{gnatcheck} generates version information and then - a trace of sources being processed. - - @cindex @option{^-o ^/OUTPUT^} (@command{gnatcheck}) - @item ^-o ^/OUTPUT=^@var{report_file} - Set name of report file file to @var{report_file} . - - @end table - - @noindent - Note that if any of the options @option{^-s1^/COMPILER_STYLE^}, - @option{^-s2^/BY_RULES^} or - @option{^-s3^/BY_FILES_BY_RULES^} is specified, - then the @command{gnatcheck} report file will only contain sections - explicitly denoted by these options. - - @node gnatcheck Rule Options - @section @command{gnatcheck} Rule Options - - @noindent - The following options control the processing performed by - @command{gnatcheck}. - - @table @option - @cindex @option{+ALL} (@command{gnatcheck}) - @item +ALL - Turn all the rule checks ON. - - @cindex @option{-ALL} (@command{gnatcheck}) - @item -ALL - Turn all the rule checks OFF. - - @cindex @option{+R} (@command{gnatcheck}) - @item +R@var{rule_id}@r{[}:@var{param}@r{]} - Turn on the check for a specified rule with the specified parameter, if any. - @var{rule_id} must be the identifier of one of the currently implemented rules - (use @option{^-h^/HELP^} for the list of implemented rules). Rule identifiers - are not case-sensitive. The @var{param} item must - be a string representing a valid parameter(s) for the specified rule. - If it contains any space characters then this string must be enclosed in - quotation marks. - - @cindex @option{-R} (@command{gnatcheck}) - @item -R@var{rule_id}@r{[}:@var{param}@r{]} - Turn off the check for a specified rule with the specified parameter, if any. - - @cindex @option{-from} (@command{gnatcheck}) - @item -from=@var{rule_option_filename} - Read the rule options from the text file @var{rule_option_filename}, referred - to as a ``coding standard file'' below. - - @end table - - @noindent - The default behavior is that all the rule checks are disabled. - - A coding standard file is a text file that contains a set of rule options - described above. - @cindex Coding standard file (for @code{gnatcheck}) - The file may contain empty lines and Ada-style comments (comment - lines and end-of-line comments). There can be several rule options on a - single line (separated by a space). - - A coding standard file may reference other coding standard files by including - more @option{-from=@var{rule_option_filename}} - options, each such option being replaced with the content of the - corresponding coding standard file during processing. In case a - cycle is detected (that is, @file{@var{rule_file_1}} reads rule options - from @file{@var{rule_file_2}}, and @file{@var{rule_file_2}} reads - (directly or indirectly) rule options from @file{@var{rule_file_1}}), - processing fails with an error message. - - - @node Adding the Results of Compiler Checks to gnatcheck Output - @section Adding the Results of Compiler Checks to @command{gnatcheck} Output - - @noindent - The @command{gnatcheck} tool can include in the generated diagnostic messages - and in - the report file the results of the checks performed by the compiler. Though - disabled by default, this effect may be obtained by using @option{+R} with - the following rule identifiers and parameters: - - @table @option - @item Restrictions - To record restrictions violations (which are performed by the compiler if the - pragma @code{Restrictions} or @code{Restriction_Warnings} are given), - use the @code{Restrictions} rule - with the same parameters as pragma - @code{Restrictions} or @code{Restriction_Warnings}. - - @item Style_Checks - To record compiler style checks (@pxref{Style Checking}), use the - @code{Style_Checks} rule. - This rule takes a parameter in one of the following forms: - @itemize - @item - @code{All_Checks}, - which enables the standard style checks corresponding to the @option{-gnatyy} - GNAT style check option, or - - @item - a string with the same - structure and semantics as the @code{string_LITERAL} parameter of the - GNAT pragma @code{Style_Checks} - (for further information about this pragma, - @pxref{Pragma Style_Checks,,, gnat_rm, GNAT Reference Manual}). - @end itemize - - @noindent - For example, the - @code{+RStyle_Checks:O} rule option activates - the compiler style check that corresponds to - @code{-gnatyO} style check option. - - @item Warnings - To record compiler warnings (@pxref{Warning Message Control}), use the - @code{Warnings} rule with a parameter that is a valid - @i{static_string_expression} argument of the GNAT pragma @code{Warnings} - (for further information about this pragma, - @pxref{Pragma Warnings,,,gnat_rm, GNAT Reference Manual}). - Note that in case of gnatcheck - 's' parameter, that corresponds to the GNAT @option{-gnatws} option, disables - all the specific warnings, but not suppresses the warning mode, - and 'e' parameter, corresponding to @option{-gnatwe} that means - "treat warnings as errors", does not have any effect. - - @end table - - To disable a specific restriction check, use @code{-RStyle_Checks} gnatcheck - option with the corresponding restriction name as a parameter. @code{-R} is - not available for @code{Style_Checks} and @code{Warnings} options, to disable - warnings and style checks, use the corresponding warning and style options. - - @node Project-Wide Checks - @section Project-Wide Checks - @cindex Project-wide checks (for @command{gnatcheck}) - - @noindent - In order to perform checks on all units of a given project, you can use - the GNAT driver along with the @option{-P} option: - @smallexample - gnat check -Pproj -rules -from=my_rules - @end smallexample - - @noindent - If the project @code{proj} depends upon other projects, you can perform - checks on the project closure using the @option{-U} option: - @smallexample - gnat check -Pproj -U -rules -from=my_rules - @end smallexample - - @noindent - Finally, if not all the units are relevant to a particular main - program in the project closure, you can perform checks for the set - of units needed to create a given main program (unit closure) using - the @option{-U} option followed by the name of the main unit: - @smallexample - gnat check -Pproj -U main -rules -from=my_rules - @end smallexample - - - @node Rule exemption - @section Rule exemption - @cindex Rule exemption (for @command{gnatcheck}) - - @noindent - One of the most useful applications of @command{gnatcheck} is to - automate the enforcement of project-specific coding standards, - for example in safety-critical systems where particular features - must be restricted in order to simplify the certification effort. - However, it may sometimes be appropriate to violate a coding standard rule, - and in such cases the rationale for the violation should be provided - in the source program itself so that the individuals - reviewing or maintaining the program can immediately understand the intent. - - The @command{gnatcheck} tool supports this practice with the notion of - a ``rule exemption'' covering a specific source code section. Normally - rule violation messages are issued both on @file{stderr} - and in a report file. In contrast, exempted violations are not listed on - @file{stderr}; thus users invoking @command{gnatcheck} interactively - (e.g. in its GPS interface) do not need to pay attention to known and - justified violations. However, exempted violations along with their - justification are documented in a special section of the report file that - @command{gnatcheck} generates. - - @menu - * Using pragma Annotate to Control Rule Exemption:: - * gnatcheck Annotations Rules:: - @end menu - - @node Using pragma Annotate to Control Rule Exemption - @subsection Using pragma @code{Annotate} to Control Rule Exemption - @cindex Using pragma Annotate to control rule exemption - - @noindent - Rule exemption is controlled by pragma @code{Annotate} when its first - argument is ``gnatcheck''. The syntax of @command{gnatcheck}'s - exemption control annotations is as follows: - - @smallexample @c ada - @group - pragma Annotate (gnatcheck, @i{exemption_control}, @i{Rule_Name}, [@i{justification}]); - - @i{exemption_control} ::= Exempt_On | Exempt_Off - - @i{Rule_Name} ::= string_literal - - @i{justification} ::= string_literal - @end group - @end smallexample - - @noindent - When a @command{gnatcheck} annotation has more then four arguments, - @command{gnatcheck} issues a warning and ignores the additional arguments. - If the additional arguments do not follow the syntax above, - @command{gnatcheck} emits a warning and ignores the annotation. - - The @i{@code{Rule_Name}} argument should be the name of some existing - @command{gnatcheck} rule. - Otherwise a warning message is generated and the pragma is - ignored. If @code{Rule_Name} denotes a rule that is not activated by the given - @command{gnatcheck} call, the pragma is ignored and no warning is issued. - - A source code section where an exemption is active for a given rule is - delimited by an @code{exempt_on} and @code{exempt_off} annotation pair: - - @smallexample @c ada - pragma Annotate (gnatcheck, Exempt_On, Rule_Name, "justification"); - -- source code section - pragma Annotate (gnatcheck, Exempt_Off, Rule_Name); - @end smallexample - - - @node gnatcheck Annotations Rules - @subsection @command{gnatcheck} Annotations Rules - @cindex @command{gnatcheck} annotations rules - - @itemize @bullet - - @item - An ``Exempt_Off'' annotation can only appear after a corresponding - ``Exempt_On'' annotation. - - @item - Exempted source code sections are only based on the source location of the - annotations. Any source construct between the two - annotations is part of the exempted source code section. - - @item - Exempted source code sections for different rules are independent. They can - be nested or intersect with one another without limitation. - Creating nested or intersecting source code sections for the same rule is - not allowed. - - @item - Malformed exempted source code sections are reported by a warning, and - the corresponding rule exemptions are ignored. - - @item - When an exempted source code section does not contain at least one violation - of the exempted rule, a warning is emitted on @file{stderr}. - - @item - If an ``Exempt_On'' annotation pragma does not have a matching - ``Exempt_Off'' annotation pragma in the same compilation unit, then the - exemption for the given rule is ignored and a warning is issued. - @end itemize - - - @node Predefined Rules - @section Predefined Rules - @cindex Predefined rules (for @command{gnatcheck}) - - @ignore - @c (Jan 2007) Since the global rules are still under development and are not - @c documented, there is no point in explaining the difference between - @c global and local rules - @noindent - A rule in @command{gnatcheck} is either local or global. - A @emph{local rule} is a rule that applies to a well-defined section - of a program and that can be checked by analyzing only this section. - A @emph{global rule} requires analysis of some global properties of the - whole program (mostly related to the program call graph). - As of @value{NOW}, the implementation of global rules should be - considered to be at a preliminary stage. You can use the - @option{+GLOBAL} option to enable all the global rules, and the - @option{-GLOBAL} rule option to disable all the global rules. - - All the global rules in the list below are - so indicated by marking them ``GLOBAL''. - This +GLOBAL and -GLOBAL options are not - included in the list of gnatcheck options above, because at the moment they - are considered as a temporary debug options. - - @command{gnatcheck} performs rule checks for generic - instances only for global rules. This limitation may be relaxed in a later - release. - @end ignore - - @noindent - The following subsections document the rules implemented in - @command{gnatcheck}. - The subsection title is the same as the rule identifier, which may be - used as a parameter of the @option{+R} or @option{-R} options. - - - @menu - * Abstract_Type_Declarations:: - * Anonymous_Arrays:: - * Anonymous_Subtypes:: - * Blocks:: - * Boolean_Relational_Operators:: - @ignore - * Ceiling_Violations:: - @end ignore - * Complex_Inlined_Subprograms:: - * Controlled_Type_Declarations:: - * Declarations_In_Blocks:: - * Deep_Inheritance_Hierarchies:: - * Deeply_Nested_Generics:: - * Deeply_Nested_Inlining:: - @ignore - * Deeply_Nested_Local_Inlining:: - @end ignore - * Default_Parameters:: - * Direct_Calls_To_Primitives:: - * Discriminated_Records:: - * Enumeration_Ranges_In_CASE_Statements:: - * Exceptions_As_Control_Flow:: - * Exits_From_Conditional_Loops:: - * EXIT_Statements_With_No_Loop_Name:: - * Expanded_Loop_Exit_Names:: - * Explicit_Full_Discrete_Ranges:: - * Float_Equality_Checks:: - * Forbidden_Attributes:: - * Forbidden_Pragmas:: - * Function_Style_Procedures:: - * Generics_In_Subprograms:: - * GOTO_Statements:: - * Implicit_IN_Mode_Parameters:: - * Implicit_SMALL_For_Fixed_Point_Types:: - * Improperly_Located_Instantiations:: - * Improper_Returns:: - * Library_Level_Subprograms:: - * Local_Packages:: - @ignore - * Improperly_Called_Protected_Entries:: - @end ignore - * Metrics:: - * Misnamed_Controlling_Parameters:: - * Misnamed_Identifiers:: - * Multiple_Entries_In_Protected_Definitions:: - * Name_Clashes:: - * Non_Qualified_Aggregates:: - * Non_Short_Circuit_Operators:: - * Non_SPARK_Attributes:: - * Non_Tagged_Derived_Types:: - * Non_Visible_Exceptions:: - * Numeric_Literals:: - * OTHERS_In_Aggregates:: - * OTHERS_In_CASE_Statements:: - * OTHERS_In_Exception_Handlers:: - * Outer_Loop_Exits:: - * Overloaded_Operators:: - * Overly_Nested_Control_Structures:: - * Parameters_Out_Of_Order:: - * Positional_Actuals_For_Defaulted_Generic_Parameters:: - * Positional_Actuals_For_Defaulted_Parameters:: - * Positional_Components:: - * Positional_Generic_Parameters:: - * Positional_Parameters:: - * Predefined_Numeric_Types:: - * Raising_External_Exceptions:: - * Raising_Predefined_Exceptions:: - * Separate_Numeric_Error_Handlers:: - @ignore - * Recursion:: - * Side_Effect_Functions:: - @end ignore - * Slices:: - * Too_Many_Parents:: - * Unassigned_OUT_Parameters:: - * Uncommented_BEGIN_In_Package_Bodies:: - * Unconditional_Exits:: - * Unconstrained_Array_Returns:: - * Universal_Ranges:: - * Unnamed_Blocks_And_Loops:: - @ignore - * Unused_Subprograms:: - @end ignore - * USE_PACKAGE_Clauses:: - * Visible_Components:: - * Volatile_Objects_Without_Address_Clauses:: - @end menu - - - @node Abstract_Type_Declarations - @subsection @code{Abstract_Type_Declarations} - @cindex @code{Abstract_Type_Declarations} rule (for @command{gnatcheck}) - - @noindent - Flag all declarations of abstract types. For an abstract private - type, both the private and full type declarations are flagged. - - This rule has no parameters. - - - @node Anonymous_Arrays - @subsection @code{Anonymous_Arrays} - @cindex @code{Anonymous_Arrays} rule (for @command{gnatcheck}) - - @noindent - Flag all anonymous array type definitions (by Ada semantics these can only - occur in object declarations). - - This rule has no parameters. - - @node Anonymous_Subtypes - @subsection @code{Anonymous_Subtypes} - @cindex @code{Anonymous_Subtypes} rule (for @command{gnatcheck}) - - @noindent - Flag all uses of anonymous subtypes (except cases when subtype indication - is a part of a record component definition, and this subtype indication - depends on a discriminant). A use of an anonymous subtype is - any instance of a subtype indication with a constraint, other than one - that occurs immediately within a subtype declaration. Any use of a range - other than as a constraint used immediately within a subtype declaration - is considered as an anonymous subtype. - - An effect of this rule is that @code{for} loops such as the following are - flagged (since @code{1..N} is formally a ``range''): - - @smallexample @c ada - for I in 1 .. N loop - @dots{} - end loop; - @end smallexample - - @noindent - Declaring an explicit subtype solves the problem: - - @smallexample @c ada - subtype S is Integer range 1..N; - @dots{} - for I in S loop - @dots{} - end loop; - @end smallexample - - @noindent - This rule has no parameters. - - @node Blocks - @subsection @code{Blocks} - @cindex @code{Blocks} rule (for @command{gnatcheck}) - - @noindent - Flag each block statement. - - This rule has no parameters. - - @node Boolean_Relational_Operators - @subsection @code{Boolean_Relational_Operators} - @cindex @code{Boolean_Relational_Operators} rule (for @command{gnatcheck}) - - @noindent - Flag each call to a predefined relational operator (``<'', ``>'', ``<='', - ``>='', ``='' and ``/='') for the predefined Boolean type. - (This rule is useful in enforcing the SPARK language restrictions.) - - Calls to predefined relational operators of any type derived from - @code{Standard.Boolean} are not detected. Calls to user-defined functions - with these designators, and uses of operators that are renamings - of the predefined relational operators for @code{Standard.Boolean}, - are likewise not detected. - - This rule has no parameters. - - @ignore - @node Ceiling_Violations - @subsection @code{Ceiling5_Violations} (under construction, GLOBAL) - @cindex @code{Ceiling_Violations} rule (for @command{gnatcheck}) - - @noindent - Flag invocations of a protected operation by a task whose priority exceeds - the protected object's ceiling. - - As of @value{NOW}, this rule has the following limitations: - - @itemize @bullet - - @item - We consider only pragmas Priority and Interrupt_Priority as means to define - a task/protected operation priority. We do not consider the effect of using - Ada.Dynamic_Priorities.Set_Priority procedure; - - @item - We consider only base task priorities, and no priority inheritance. That is, - we do not make a difference between calls issued during task activation and - execution of the sequence of statements from task body; - - @item - Any situation when the priority of protected operation caller is set by a - dynamic expression (that is, the corresponding Priority or - Interrupt_Priority pragma has a non-static expression as an argument) we - treat as a priority inconsistency (and, therefore, detect this situation). - @end itemize - - @noindent - At the moment the notion of the main subprogram is not implemented in - gnatcheck, so any pragma Priority in a library level subprogram body (in case - if this subprogram can be a main subprogram of a partition) changes the - priority of an environment task. So if we have more then one such pragma in - the set of processed sources, the pragma that is processed last, defines the - priority of an environment task. - - This rule has no parameters. - @end ignore - - @node Controlled_Type_Declarations - @subsection @code{Controlled_Type_Declarations} - @cindex @code{Controlled_Type_Declarations} rule (for @command{gnatcheck}) - - @noindent - Flag all declarations of controlled types. A declaration of a private type - is flagged if its full declaration declares a controlled type. A declaration - of a derived type is flagged if its ancestor type is controlled. Subtype - declarations are not checked. A declaration of a type that itself is not a - descendant of a type declared in @code{Ada.Finalization} but has a controlled - component is not checked. - - This rule has no parameters. - - - @node Complex_Inlined_Subprograms - @subsection @code{Complex_Inlined_Subprograms} - @cindex @code{Complex_Inlined_Subprograms} rule (for @command{gnatcheck}) - - @noindent - Flags a subprogram (or generic subprogram) if - pragma Inline is applied to the subprogram and at least one of the following - conditions is met: - - @itemize @bullet - @item - it contains at least one complex declaration such as a subprogram body, - package, task, protected declaration, or a generic instantiation - (except instantiation of @code{Ada.Unchecked_Conversion}); - - @item - it contains at least one complex statement such as a loop, a case - or a if statement, or a short circuit control form; - - @item - the number of statements exceeds - a value specified by the @option{N} rule parameter; - @end itemize - - @noindent - This rule has the following (mandatory) parameter for the @option{+R} option: - - @table @emph - @item N - Positive integer specifying the maximum allowed total number of statements - in the subprogram body. - @end table - - - @node Declarations_In_Blocks - @subsection @code{Declarations_In_Blocks} - @cindex @code{Declarations_In_Blocks} rule (for @command{gnatcheck}) - - @noindent - Flag all block statements containing local declarations. A @code{declare} - block with an empty @i{declarative_part} or with a @i{declarative part} - containing only pragmas and/or @code{use} clauses is not flagged. - - This rule has no parameters. - - - @node Deep_Inheritance_Hierarchies - @subsection @code{Deep_Inheritance_Hierarchies} - @cindex @code{Deep_Inheritance_Hierarchies} rule (for @command{gnatcheck}) - - @noindent - Flags a tagged derived type declaration or an interface type declaration if - its depth (in its inheritance - hierarchy) exceeds the value specified by the @option{N} rule parameter. - - The inheritance depth of a tagged type or interface type is defined as 0 for - a type with no parent and no progenitor, and otherwise as 1 + max of the - depths of the immediate parent and immediate progenitors. - - This rule does not flag private extension - declarations. In the case of a private extension, the corresponding full - declaration is checked. - - This rule has the following (mandatory) parameter for the @option{+R} option: - - @table @emph - @item N - Integer not less than -1 specifying the maximal allowed depth of any inheritance - hierarchy. If the rule parameter is set to -1, the rule flags all the declarations - of tagged and interface types. - @end table - - - @node Deeply_Nested_Generics - @subsection @code{Deeply_Nested_Generics} - @cindex @code{Deeply_Nested_Generics} rule (for @command{gnatcheck}) - - @noindent - Flags a generic declaration nested in another generic declaration if - the nesting level of the inner generic exceeds - a value specified by the @option{N} rule parameter. - The nesting level is the number of generic declaratons that enclose the given - (generic) declaration. Formal packages are not flagged by this rule. - - This rule has the following (mandatory) parameters for the @option{+R} option: - - @table @emph - @item N - Positive integer specifying the maximal allowed nesting level - for a generic declaration. - @end table - - @node Deeply_Nested_Inlining - @subsection @code{Deeply_Nested_Inlining} - @cindex @code{Deeply_Nested_Inlining} rule (for @command{gnatcheck}) - - @noindent - Flags a subprogram (or generic subprogram) if - pragma Inline has been applied to the subprogram but the subprogram - calls to another inlined subprogram that results in nested inlining - with nesting depth exceeding the value specified by the - @option{N} rule parameter. - - This rule requires the global analysis of all the compilation units that - are @command{gnatcheck} arguments; such analysis may affect the tool's - performance. - - This rule has the following (mandatory) parameter for the @option{+R} option: - - @table @emph - @item N - Positive integer specifying the maximal allowed level of nested inlining. - @end table - - - @ignore - @node Deeply_Nested_Local_Inlining - @subsection @code{Deeply_Nested_Local_Inlining} - @cindex @code{Deeply_Nested_Local_Inlining} rule (for @command{gnatcheck}) - - @noindent - Flags a subprogram body if a pragma @code{Inline} is applied to the - corresponding subprogram (or generic subprogram) and the body contains a call - to another inlined subprogram that results in nested inlining with nesting - depth more then a value specified by the @option{N} rule parameter. - This rule is similar to @code{Deeply_Nested_Inlining} rule, but it - assumes that calls to subprograms in - with'ed units are not inlided, so all the analysis of the depth of inlining is - limited by the compilation unit where the subprogram body is located and the - units it depends semantically upon. Such analysis may be usefull for the case - when neiter @option{-gnatn} nor @option{-gnatN} option is used when building - the executable. - - This rule has the following (mandatory) parameters for the @option{+R} option: - - @table @emph - @item N - Positive integer specifying the maximal allowed level of nested inlining. - @end table - - @end ignore - - @node Default_Parameters - @subsection @code{Default_Parameters} - @cindex @code{Default_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flag all default expressions for subprogram parameters. Parameter - declarations of formal and generic subprograms are also checked. - - This rule has no parameters. - - - @node Direct_Calls_To_Primitives - @subsection @code{Direct_Calls_To_Primitives} - @cindex @code{Direct_Calls_To_Primitives} rule (for @command{gnatcheck}) - - @noindent - Flags any non-dispatching call to a dispatching primitive operation, except - for the common idiom where a primitive subprogram for a tagged type - directly calls the same primitive subprogram of the type's immediate ancestor. - - This rule has no parameters. - - - @node Discriminated_Records - @subsection @code{Discriminated_Records} - @cindex @code{Discriminated_Records} rule (for @command{gnatcheck}) - - @noindent - Flag all declarations of record types with discriminants. Only the - declarations of record and record extension types are checked. Incomplete, - formal, private, derived and private extension type declarations are not - checked. Task and protected type declarations also are not checked. - - This rule has no parameters. - - - @node Enumeration_Ranges_In_CASE_Statements - @subsection @code{Enumeration_Ranges_In_CASE_Statements} - @cindex @code{Enumeration_Ranges_In_CASE_Statements} (for @command{gnatcheck}) - - @noindent - Flag each use of a range of enumeration literals as a choice in a - @code{case} statement. - All forms for specifying a range (explicit ranges - such as @code{A .. B}, subtype marks and @code{'Range} attributes) are flagged. - An enumeration range is - flagged even if contains exactly one enumeration value or no values at all. A - type derived from an enumeration type is considered as an enumeration type. - - This rule helps prevent maintenance problems arising from adding an - enumeration value to a type and having it implicitly handled by an existing - @code{case} statement with an enumeration range that includes the new literal. - - This rule has no parameters. - - - @node Exceptions_As_Control_Flow - @subsection @code{Exceptions_As_Control_Flow} - @cindex @code{Exceptions_As_Control_Flow} (for @command{gnatcheck}) - - @noindent - Flag each place where an exception is explicitly raised and handled in the - same subprogram body. A @code{raise} statement in an exception handler, - package body, task body or entry body is not flagged. - - The rule has no parameters. - - @node Exits_From_Conditional_Loops - @subsection @code{Exits_From_Conditional_Loops} - @cindex @code{Exits_From_Conditional_Loops} (for @command{gnatcheck}) - - @noindent - Flag any exit statement if it transfers the control out of a @code{for} loop - or a @code{while} loop. This includes cases when the @code{exit} statement - applies to a @code{FOR} or @code{while} loop, and cases when it is enclosed - in some @code{for} or @code{while} loop, but transfers the control from some - outer (inconditional) @code{loop} statement. - - The rule has no parameters. - - - @node EXIT_Statements_With_No_Loop_Name - @subsection @code{EXIT_Statements_With_No_Loop_Name} - @cindex @code{EXIT_Statements_With_No_Loop_Name} (for @command{gnatcheck}) - - @noindent - Flag each @code{exit} statement that does not specify the name of the loop - being exited. - - The rule has no parameters. - - - @node Expanded_Loop_Exit_Names - @subsection @code{Expanded_Loop_Exit_Names} - @cindex @code{Expanded_Loop_Exit_Names} rule (for @command{gnatcheck}) - - @noindent - Flag all expanded loop names in @code{exit} statements. - - This rule has no parameters. - - @node Explicit_Full_Discrete_Ranges - @subsection @code{Explicit_Full_Discrete_Ranges} - @cindex @code{Explicit_Full_Discrete_Ranges} rule (for @command{gnatcheck}) - - @noindent - Flag each discrete range that has the form @code{A'First .. A'Last}. - - This rule has no parameters. - - @node Float_Equality_Checks - @subsection @code{Float_Equality_Checks} - @cindex @code{Float_Equality_Checks} rule (for @command{gnatcheck}) - - @noindent - Flag all calls to the predefined equality operations for floating-point types. - Both ``@code{=}'' and ``@code{/=}'' operations are checked. - User-defined equality operations are not flagged, nor are ``@code{=}'' - and ``@code{/=}'' operations for fixed-point types. - - This rule has no parameters. - - - @node Forbidden_Attributes - @subsection @code{Forbidden_Attributes} - @cindex @code{Forbidden_Attributes} rule (for @command{gnatcheck}) - - @noindent - Flag each use of the specified attributes. The attributes to be detected are - named in the rule's parameters. - - This rule has the following parameters: - - @itemize @bullet - @item For the @option{+R} option - - @table @asis - @item @emph{Attribute_Designator} - Adds the specified attribute to the set of attributes to be detected and sets - the detection checks for all the specified attributes ON. - If @emph{Attribute_Designator} - does not denote any attribute defined in the Ada standard - or in - @ref{Implementation Defined Attributes,,, gnat_rm, GNAT Reference - Manual}, it is treated as the name of unknown attribute. - - @item @code{GNAT} - All the GNAT-specific attributes are detected; this sets - the detection checks for all the specified attributes ON. - - @item @code{ALL} - All attributes are detected; this sets the rule ON. - @end table - - @item For the @option{-R} option - @table @asis - @item @emph{Attribute_Designator} - Removes the specified attribute from the set of attributes to be - detected without affecting detection checks for - other attributes. If @emph{Attribute_Designator} does not correspond to any - attribute defined in the Ada standard or in - @ref{Implementation Defined Attributes,,, gnat_rm, GNAT Reference Manual}, - this option is treated as turning OFF detection of all unknown attributes. - - @item GNAT - Turn OFF detection of all GNAT-specific attributes - - @item ALL - Clear the list of the attributes to be detected and - turn the rule OFF. - @end table - @end itemize - - @noindent - Parameters are not case sensitive. If @emph{Attribute_Designator} does not - have the syntax of an Ada identifier and therefore can not be considered as a - (part of an) attribute designator, a diagnostic message is generated and the - corresponding parameter is ignored. (If an attribute allows a static - expression to be a part of the attribute designator, this expression is - ignored by this rule.) - - When more then one parameter is given in the same rule option, the parameters - must be separated by commas. - - If more then one option for this rule is specified for the gnatcheck call, a - new option overrides the previous one(s). - - The @option{+R} option with no parameters turns the rule ON, with the set of - attributes to be detected defined by the previous rule options. - (By default this set is empty, so if the only option specified for the rule is - @option{+RForbidden_Attributes} (with - no parameter), then the rule is enabled, but it does not detect anything). - The @option{-R} option with no parameter turns the rule OFF, but it does not - affect the set of attributes to be detected. - - - @node Forbidden_Pragmas - @subsection @code{Forbidden_Pragmas} - @cindex @code{Forbidden_Pragmas} rule (for @command{gnatcheck}) - - @noindent - Flag each use of the specified pragmas. The pragmas to be detected - are named in the rule's parameters. - - This rule has the following parameters: - - @itemize @bullet - @item For the @option{+R} option - - @table @asis - @item @emph{Pragma_Name} - Adds the specified pragma to the set of pragmas to be - checked and sets the checks for all the specified pragmas - ON. @emph{Pragma_Name} is treated as a name of a pragma. If it - does not correspond to any pragma name defined in the Ada - standard or to the name of a GNAT-specific pragma defined - in @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference - Manual}, it is treated as the name of unknown pragma. - - @item @code{GNAT} - All the GNAT-specific pragmas are detected; this sets - the checks for all the specified pragmas ON. - - @item @code{ALL} - All pragmas are detected; this sets the rule ON. - @end table - - @item For the @option{-R} option - @table @asis - @item @emph{Pragma_Name} - Removes the specified pragma from the set of pragmas to be - checked without affecting checks for - other pragmas. @emph{Pragma_Name} is treated as a name - of a pragma. If it does not correspond to any pragma - defined in the Ada standard or to any name defined in - @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual}, - this option is treated as turning OFF detection of all unknown pragmas. - - @item GNAT - Turn OFF detection of all GNAT-specific pragmas - - @item ALL - Clear the list of the pragmas to be detected and - turn the rule OFF. - @end table - @end itemize - - @noindent - Parameters are not case sensitive. If @emph{Pragma_Name} does not have - the syntax of an Ada identifier and therefore can not be considered - as a pragma name, a diagnostic message is generated and the corresponding - parameter is ignored. - - When more then one parameter is given in the same rule option, the parameters - must be separated by a comma. - - If more then one option for this rule is specified for the @command{gnatcheck} - call, a new option overrides the previous one(s). - - The @option{+R} option with no parameters turns the rule ON with the set of - pragmas to be detected defined by the previous rule options. - (By default this set is empty, so if the only option specified for the rule is - @option{+RForbidden_Pragmas} (with - no parameter), then the rule is enabled, but it does not detect anything). - The @option{-R} option with no parameter turns the rule OFF, but it does not - affect the set of pragmas to be detected. - - - - - @node Function_Style_Procedures - @subsection @code{Function_Style_Procedures} - @cindex @code{Function_Style_Procedures} rule (for @command{gnatcheck}) - - @noindent - Flag each procedure that can be rewritten as a function. A procedure can be - converted into a function if it has exactly one parameter of mode @code{out} - and no parameters of mode @code{in out}. Procedure declarations, - formal procedure declarations, and generic procedure declarations are always - checked. Procedure - bodies and body stubs are flagged only if they do not have corresponding - separate declarations. Procedure renamings and procedure instantiations are - not flagged. - - If a procedure can be rewritten as a function, but its @code{out} parameter is - of a limited type, it is not flagged. - - Protected procedures are not flagged. Null procedures also are not flagged. - - This rule has no parameters. - - - @node Generics_In_Subprograms - @subsection @code{Generics_In_Subprograms} - @cindex @code{Generics_In_Subprograms} rule (for @command{gnatcheck}) - - @noindent - Flag each declaration of a generic unit in a subprogram. Generic - declarations in the bodies of generic subprograms are also flagged. - A generic unit nested in another generic unit is not flagged. - If a generic unit is - declared in a local package that is declared in a subprogram body, the - generic unit is flagged. - - This rule has no parameters. - - - @node GOTO_Statements - @subsection @code{GOTO_Statements} - @cindex @code{GOTO_Statements} rule (for @command{gnatcheck}) - - @noindent - Flag each occurrence of a @code{goto} statement. - - This rule has no parameters. - - - @node Implicit_IN_Mode_Parameters - @subsection @code{Implicit_IN_Mode_Parameters} - @cindex @code{Implicit_IN_Mode_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flag each occurrence of a formal parameter with an implicit @code{in} mode. - Note that @code{access} parameters, although they technically behave - like @code{in} parameters, are not flagged. - - This rule has no parameters. - - - @node Implicit_SMALL_For_Fixed_Point_Types - @subsection @code{Implicit_SMALL_For_Fixed_Point_Types} - @cindex @code{Implicit_SMALL_For_Fixed_Point_Types} rule (for @command{gnatcheck}) - - @noindent - Flag each fixed point type declaration that lacks an explicit - representation clause to define its @code{'Small} value. - Since @code{'Small} can be defined only for ordinary fixed point types, - decimal fixed point type declarations are not checked. - - This rule has no parameters. - - - @node Improperly_Located_Instantiations - @subsection @code{Improperly_Located_Instantiations} - @cindex @code{Improperly_Located_Instantiations} rule (for @command{gnatcheck}) - - @noindent - 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 - bodies of protected subprograms are flagged. - - This rule has no parameters. - - - - @node Improper_Returns - @subsection @code{Improper_Returns} - @cindex @code{Improper_Returns} rule (for @command{gnatcheck}) - - @noindent - Flag each explicit @code{return} statement in procedures, and - multiple @code{return} statements in functions. - Diagnostic messages are generated for all @code{return} statements - in a procedure (thus each procedure must be written so that it - returns implicitly at the end of its statement part), - and for all @code{return} statements in a function after the first one. - This rule supports the stylistic convention that each subprogram - should have no more than one point of normal return. - - This rule has no parameters. - - - @node Library_Level_Subprograms - @subsection @code{Library_Level_Subprograms} - @cindex @code{Library_Level_Subprograms} rule (for @command{gnatcheck}) - - @noindent - Flag all library-level subprograms (including generic subprogram instantiations). - - This rule has no parameters. - - - @node Local_Packages - @subsection @code{Local_Packages} - @cindex @code{Local_Packages} rule (for @command{gnatcheck}) - - @noindent - Flag all local packages declared in package and generic package - specs. - Local packages in bodies are not flagged. - - This rule has no parameters. - - @ignore - @node Improperly_Called_Protected_Entries - @subsection @code{Improperly_Called_Protected_Entries} (under construction, GLOBAL) - @cindex @code{Improperly_Called_Protected_Entries} rule (for @command{gnatcheck}) - - @noindent - Flag each protected entry that can be called from more than one task. - - This rule has no parameters. - @end ignore - - @node Metrics - @subsection @code{Metrics} - @cindex @code{Metrics} rule (for @command{gnatcheck}) - - @noindent - There is a set of checks based on computing a metric value and comparing the - result with the specified upper (or lower, depending on a specific metric) - value specified for a given metric. A construct is flagged if a given metric - is applicable (can be computed) for it and the computed value is greater - then (lover then) the specified upper (lower) bound. - - The name of any metric-based rule consists of the prefix @code{Metrics_} - followed by the name of the corresponding metric (see the table below). - For @option{+R} option, each metric-based rule has a numeric parameter - specifying the bound (integer or real, depending on a metric), @option{-R} - option for metric rules does not have a parameter. - - The following table shows the metric names for that the corresponding - metrics-based checks are supported by gnatcheck, including the - constraint that must be satisfied by the bound that is specified for the check - and what bound - upper (U) or lower (L) - should be specified. - - @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 (U) - @item @code{Cyclomatic_Complexity} @tab Cyclomatic complexity @tab Positive integer (U) - @item @code{LSLOC} @tab Logical Source Lines of Code @tab Positive integer (U) - @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_Cyclomatic_Complexity : 7 - @end smallexample - @noindent - means that all bodies with cyclomatic complexity exceeding 7 will be flagged. - - To turn OFF the check for cyclomatic complexity metric, use the following option: - @smallexample - -RMetrics_Cyclomatic_Complexity - @end smallexample - - - @node Misnamed_Controlling_Parameters - @subsection @code{Misnamed_Controlling_Parameters} - @cindex @code{Misnamed_Controlling_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flags a declaration of a dispatching operation, if the first parameter is - not a controlling one and its name is not @code{This} (the check for - parameter name is not case-sensitive). Declarations of dispatching functions - with controlling result and no controlling parameter are never flagged. - - A subprogram body declaration, subprogram renaming declaration or subprogram - body stub is flagged only if it is not a completion of a prior subprogram - declaration. - - This rule has no parameters. - - - - @node Misnamed_Identifiers - @subsection @code{Misnamed_Identifiers} - @cindex @code{Misnamed_Identifiers} rule (for @command{gnatcheck}) - - @noindent - Flag the declaration of each identifier that does not have a suffix - corresponding to the kind of entity being declared. - The following declarations are checked: - - @itemize @bullet - @item - type declarations - - @item - subtype declarations - - @item - constant declarations (but not number declarations) - - @item - package renaming declarations (but not generic package renaming - declarations) - @end itemize - - @noindent - This rule may have parameters. When used without parameters, the rule enforces - the following checks: - - @itemize @bullet - @item - type-defining names end with @code{_T}, unless the type is an access type, - in which case the suffix must be @code{_A} - @item - constant names end with @code{_C} - @item - names defining package renamings end with @code{_R} - @end itemize - - @noindent - Defining identifiers from incomplete type declarations are never flagged. - - For a private type declaration (including private extensions), the defining - identifier from the private type declaration is checked against the type - suffix (even if the corresponding full declaration is an access type - declaration), and the defining identifier from the corresponding full type - declaration is not checked. - - @noindent - For a deferred constant, the defining name in the corresponding full constant - declaration is not checked. - - Defining names of formal types are not checked. - - The rule may have the following parameters: - - @itemize @bullet - @item - For the @option{+R} option: - @table @code - @item Default - Sets the default listed above for all the names to be checked. - - @item Type_Suffix=@emph{string} - Specifies the suffix for a type name. - - @item Access_Suffix=@emph{string} - Specifies the suffix for an access type name. If - this parameter is set, it overrides for access - types the suffix set by the @code{Type_Suffix} parameter. - For access types, @emph{string} may have the following format: - @emph{suffix1(suffix2)}. That means that an access type name - should have the @emph{suffix1} suffix except for the case when - the designated type is also an access type, in this case the - type name should have the @emph{suffix1 & suffix2} suffix. - - @item Class_Access_Suffix=@emph{string} - Specifies the suffix for the name of an access type that points to some class-wide - type. If this parameter is set, it overrides for such access - types the suffix set by the @code{Type_Suffix} or @code{Access_Suffix} - parameter. - - @item Class_Subtype_Suffix=@emph{string} - Specifies the suffix for the name of a subtype that denotes a class-wide type. - - @item Constant_Suffix=@emph{string} - Specifies the suffix for a constant name. - - @item Renaming_Suffix=@emph{string} - Specifies the suffix for a package renaming name. - @end table - - @item - For the @option{-R} option: - @table @code - @item All_Suffixes - Remove all the suffixes specified for the - identifier suffix checks, whether by default or - as specified by other rule parameters. All the - checks for this rule are disabled as a result. - - @item Type_Suffix - Removes the suffix specified for types. This - disables checks for types but does not disable - any other checks for this rule (including the - check for access type names if @code{Access_Suffix} is - set). - - @item Access_Suffix - Removes the suffix specified for access types. - This disables checks for access type names but - does not disable any other checks for this rule. - If @code{Type_Suffix} is set, access type names are - checked as ordinary type names. - - @item Class_Access_Suffix - Removes the suffix specified for access types pointing to class-wide - type. This disables specific checks for names of access types pointing to - class-wide types but does not disable any other checks for this rule. - If @code{Type_Suffix} is set, access type names are - checked as ordinary type names. If @code{Access_Suffix} is set, these - access types are checked as any other access type name. - - @item Class_Subtype_Suffix=@emph{string} - Removes the suffix specified for subtype names. - This disables checks for subtype names but - does not disable any other checks for this rule. - - @item Constant_Suffix - Removes the suffix specified for constants. This - disables checks for constant names but does not - disable any other checks for this rule. - - @item Renaming_Suffix - Removes the suffix specified for package - renamings. This disables checks for package - renamings but does not disable any other checks - for this rule. - @end table - @end itemize - - @noindent - If more than one parameter is used, parameters must be separated by commas. - - If more than one option is specified for the @command{gnatcheck} invocation, - a new option overrides the previous one(s). - - The @option{+RMisnamed_Identifiers} option (with no parameter) enables - checks for all the - name suffixes specified by previous options used for this rule. - - The @option{-RMisnamed_Identifiers} option (with no parameter) disables - all the checks but keeps - all the suffixes specified by previous options used for this rule. - - The @emph{string} value must be a valid suffix for an Ada identifier (after - trimming all the leading and trailing space characters, if any). - Parameters are not case sensitive, except the @emph{string} part. - - If any error is detected in a rule parameter, the parameter is ignored. - In such a case the options that are set for the rule are not - specified. - - - - @node Multiple_Entries_In_Protected_Definitions - @subsection @code{Multiple_Entries_In_Protected_Definitions} - @cindex @code{Multiple_Entries_In_Protected_Definitions} rule (for @command{gnatcheck}) - - @noindent - Flag each protected definition (i.e., each protected object/type declaration) - that defines more than one entry. - Diagnostic messages are generated for all the entry declarations - except the first one. An entry family is counted as one entry. Entries from - the private part of the protected definition are also checked. - - This rule has no parameters. - - @node Name_Clashes - @subsection @code{Name_Clashes} - @cindex @code{Name_Clashes} rule (for @command{gnatcheck}) - - @noindent - Check that certain names are not used as defining identifiers. To activate - this rule, you need to supply a reference to the dictionary file(s) as a rule - parameter(s) (more then one dictionary file can be specified). If no - dictionary file is set, this rule will not cause anything to be flagged. - Only defining occurrences, not references, are checked. - The check is not case-sensitive. - - This rule is enabled by default, but without setting any corresponding - dictionary file(s); thus the default effect is to do no checks. - - A dictionary file is a plain text file. The maximum line length for this file - is 1024 characters. If the line is longer then this limit, extra characters - are ignored. - - Each line can be either an empty line, a comment line, or a line containing - a list of identifiers separated by space or HT characters. - A comment is an Ada-style comment (from @code{--} to end-of-line). - Identifiers must follow the Ada syntax for identifiers. - A line containing one or more identifiers may end with a comment. - - @node Non_Qualified_Aggregates - @subsection @code{Non_Qualified_Aggregates} - @cindex @code{Non_Qualified_Aggregates} rule (for @command{gnatcheck}) - - @noindent - Flag each non-qualified aggregate. - A non-qualified aggregate is an - aggregate that is not the expression of a qualified expression. A - string literal is not considered an aggregate, but an array - aggregate of a string type is considered as a normal aggregate. - Aggregates of anonymous array types are not flagged. - - This rule has no parameters. - - - @node Non_Short_Circuit_Operators - @subsection @code{Non_Short_Circuit_Operators} - @cindex @code{Non_Short_Circuit_Operators} rule (for @command{gnatcheck}) - - @noindent - Flag all calls to predefined @code{and} and @code{or} operators for - any boolean type. Calls to - user-defined @code{and} and @code{or} and to operators defined by renaming - declarations are not flagged. Calls to predefined @code{and} and @code{or} - operators for modular types or boolean array types are not flagged. - - This rule has no parameters. - - - - @node Non_SPARK_Attributes - @subsection @code{Non_SPARK_Attributes} - @cindex @code{Non_SPARK_Attributes} rule (for @command{gnatcheck}) - - @noindent - The SPARK language defines the following subset of Ada 95 attribute - designators as those that can be used in SPARK programs. The use of - any other attribute is flagged. - - @itemize @bullet - @item @code{'Adjacent} - @item @code{'Aft} - @item @code{'Base} - @item @code{'Ceiling} - @item @code{'Component_Size} - @item @code{'Compose} - @item @code{'Copy_Sign} - @item @code{'Delta} - @item @code{'Denorm} - @item @code{'Digits} - @item @code{'Exponent} - @item @code{'First} - @item @code{'Floor} - @item @code{'Fore} - @item @code{'Fraction} - @item @code{'Last} - @item @code{'Leading_Part} - @item @code{'Length} - @item @code{'Machine} - @item @code{'Machine_Emax} - @item @code{'Machine_Emin} - @item @code{'Machine_Mantissa} - @item @code{'Machine_Overflows} - @item @code{'Machine_Radix} - @item @code{'Machine_Rounds} - @item @code{'Max} - @item @code{'Min} - @item @code{'Model} - @item @code{'Model_Emin} - @item @code{'Model_Epsilon} - @item @code{'Model_Mantissa} - @item @code{'Model_Small} - @item @code{'Modulus} - @item @code{'Pos} - @item @code{'Pred} - @item @code{'Range} - @item @code{'Remainder} - @item @code{'Rounding} - @item @code{'Safe_First} - @item @code{'Safe_Last} - @item @code{'Scaling} - @item @code{'Signed_Zeros} - @item @code{'Size} - @item @code{'Small} - @item @code{'Succ} - @item @code{'Truncation} - @item @code{'Unbiased_Rounding} - @item @code{'Val} - @item @code{'Valid} - @end itemize - - @noindent - This rule has no parameters. - - - @node Non_Tagged_Derived_Types - @subsection @code{Non_Tagged_Derived_Types} - @cindex @code{Non_Tagged_Derived_Types} rule (for @command{gnatcheck}) - - @noindent - Flag all derived type declarations that do not have a record extension part. - - This rule has no parameters. - - - - @node Non_Visible_Exceptions - @subsection @code{Non_Visible_Exceptions} - @cindex @code{Non_Visible_Exceptions} rule (for @command{gnatcheck}) - - @noindent - Flag constructs leading to the possibility of propagating an exception - out of the scope in which the exception is declared. - Two cases are detected: - - @itemize @bullet - @item - An exception declaration in a subprogram body, task body or block - statement is flagged if the body or statement does not contain a handler for - that exception or a handler with an @code{others} choice. - - @item - A @code{raise} statement in an exception handler of a subprogram body, - task body or block statement is flagged if it (re)raises a locally - declared exception. This may occur under the following circumstances: - @itemize @minus - @item - it explicitly raises a locally declared exception, or - @item - it does not specify an exception name (i.e., it is simply @code{raise;}) - and the enclosing handler contains a locally declared exception in its - exception choices. - @end itemize - @end itemize - - @noindent - Renamings of local exceptions are not flagged. - - This rule has no parameters. - - - @node Numeric_Literals - @subsection @code{Numeric_Literals} - @cindex @code{Numeric_Literals} rule (for @command{gnatcheck}) - - @noindent - Flag each use of a numeric literal in an index expression, and in any - circumstance except for the following: - - @itemize @bullet - @item - a literal occurring in the initialization expression for a constant - declaration or a named number declaration, or - - @item - an integer literal that is less than or equal to a value - specified by the @option{N} rule parameter. - @end itemize - - @noindent - This rule may have the following parameters for the @option{+R} option: - - @table @asis - @item @emph{N} - @emph{N} is an integer literal used as the maximal value that is not flagged - (i.e., integer literals not exceeding this value are allowed) - - @item @code{ALL} - All integer literals are flagged - @end table - - @noindent - If no parameters are set, the maximum unflagged value is 1. - - The last specified check limit (or the fact that there is no limit at - all) is used when multiple @option{+R} options appear. - - The @option{-R} option for this rule has no parameters. - It disables the rule but retains the last specified maximum unflagged value. - If the @option{+R} option subsequently appears, this value is used as the - threshold for the check. - - - @node OTHERS_In_Aggregates - @subsection @code{OTHERS_In_Aggregates} - @cindex @code{OTHERS_In_Aggregates} rule (for @command{gnatcheck}) - - @noindent - Flag each use of an @code{others} choice in extension aggregates. - In record and array aggregates, an @code{others} choice is flagged unless - it is used to refer to all components, or to all but one component. - - If, in case of a named array aggregate, there are two associations, one - with an @code{others} choice and another with a discrete range, the - @code{others} choice is flagged even if the discrete range specifies - exactly one component; for example, @code{(1..1 => 0, others => 1)}. - - This rule has no parameters. - - @node OTHERS_In_CASE_Statements - @subsection @code{OTHERS_In_CASE_Statements} - @cindex @code{OTHERS_In_CASE_Statements} rule (for @command{gnatcheck}) - - @noindent - Flag any use of an @code{others} choice in a @code{case} statement. - - This rule has no parameters. - - @node OTHERS_In_Exception_Handlers - @subsection @code{OTHERS_In_Exception_Handlers} - @cindex @code{OTHERS_In_Exception_Handlers} rule (for @command{gnatcheck}) - - @noindent - Flag any use of an @code{others} choice in an exception handler. - - This rule has no parameters. - - - @node Outer_Loop_Exits - @subsection @code{Outer_Loop_Exits} - @cindex @code{Outer_Loop_Exits} rule (for @command{gnatcheck}) - - @noindent - Flag each @code{exit} statement containing a loop name that is not the name - of the immediately enclosing @code{loop} statement. - - This rule has no parameters. - - - @node Overloaded_Operators - @subsection @code{Overloaded_Operators} - @cindex @code{Overloaded_Operators} rule (for @command{gnatcheck}) - - @noindent - Flag each function declaration that overloads an operator symbol. - A function body is checked only if the body does not have a - separate spec. Formal functions are also checked. For a - renaming declaration, only renaming-as-declaration is checked - - This rule has no parameters. - - - @node Overly_Nested_Control_Structures - @subsection @code{Overly_Nested_Control_Structures} - @cindex @code{Overly_Nested_Control_Structures} rule (for @command{gnatcheck}) - - @noindent - Flag each control structure whose nesting level exceeds the value provided - in the rule parameter. - - The control structures checked are the following: - - @itemize @bullet - @item @code{if} statement - @item @code{case} statement - @item @code{loop} statement - @item Selective accept statement - @item Timed entry call statement - @item Conditional entry call - @item Asynchronous select statement - @end itemize - - @noindent - The rule has the following parameter for the @option{+R} option: - - @table @emph - @item N - Positive integer specifying the maximal control structure nesting - level that is not flagged - @end table - - @noindent - If the parameter for the @option{+R} option is not specified or - if it is not a positive integer, @option{+R} option is ignored. - - If more then one option is specified for the gnatcheck call, the later option and - new parameter override the previous one(s). - - - @node Parameters_Out_Of_Order - @subsection @code{Parameters_Out_Of_Order} - @cindex @code{Parameters_Out_Of_Order} rule (for @command{gnatcheck}) - - @noindent - Flag each subprogram and entry declaration whose formal parameters are not - ordered according to the following scheme: - - @itemize @bullet - - @item @code{in} and @code{access} parameters first, - then @code{in out} parameters, - and then @code{out} parameters; - - @item for @code{in} mode, parameters with default initialization expressions - occur last - @end itemize - - @noindent - Only the first violation of the described order is flagged. - - The following constructs are checked: - - @itemize @bullet - @item subprogram declarations (including null procedures); - @item generic subprogram declarations; - @item formal subprogram declarations; - @item entry declarations; - @item subprogram bodies and subprogram body stubs that do not - have separate specifications - @end itemize - - @noindent - Subprogram renamings are not checked. - - This rule has no parameters. - - - @node Positional_Actuals_For_Defaulted_Generic_Parameters - @subsection @code{Positional_Actuals_For_Defaulted_Generic_Parameters} - @cindex @code{Positional_Actuals_For_Defaulted_Generic_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flag each generic actual parameter corresponding to a generic formal - parameter with a default initialization, if positional notation is used. - - This rule has no parameters. - - @node Positional_Actuals_For_Defaulted_Parameters - @subsection @code{Positional_Actuals_For_Defaulted_Parameters} - @cindex @code{Positional_Actuals_For_Defaulted_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flag each actual parameter to a subprogram or entry call where the - corresponding formal parameter has a default expression, if positional - notation is used. - - This rule has no parameters. - - @node Positional_Components - @subsection @code{Positional_Components} - @cindex @code{Positional_Components} rule (for @command{gnatcheck}) - - @noindent - Flag each array, record and extension aggregate that includes positional - notation. - - This rule has no parameters. - - - @node Positional_Generic_Parameters - @subsection @code{Positional_Generic_Parameters} - @cindex @code{Positional_Generic_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flag each positional actual generic parameter except for the case when - the generic unit being iinstantiated has exactly one generic formal - parameter. - - This rule has no parameters. - - - @node Positional_Parameters - @subsection @code{Positional_Parameters} - @cindex @code{Positional_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flag each positional parameter notation in a subprogram or entry call, - except for the following: - - @itemize @bullet - @item - Parameters of calls to of prefix or infix operators are not flagged - @item - If the called subprogram or entry has only one formal parameter, - the parameter of the call is not flagged; - @item - If a subprogram call uses the @emph{Object.Operation} notation, then - @itemize @minus - @item - the first parameter (that is, @emph{Object}) is not flagged; - @item - if the called subprogram has only two parameters, the second parameter - of the call is not flagged; - @end itemize - @end itemize - - @noindent - This rule has no parameters. - - - - - @node Predefined_Numeric_Types - @subsection @code{Predefined_Numeric_Types} - @cindex @code{Predefined_Numeric_Types} rule (for @command{gnatcheck}) - - @noindent - Flag each explicit use of the name of any numeric type or subtype defined - in package @code{Standard}. - - The rationale for this rule is to detect when the - program may depend on platform-specific characteristics of the implementation - of the predefined numeric types. Note that this rule is over-pessimistic; - for example, a program that uses @code{String} indexing - likely needs a variable of type @code{Integer}. - Another example is the flagging of predefined numeric types with explicit - constraints: - - @smallexample @c ada - subtype My_Integer is Integer range Left .. Right; - Vy_Var : My_Integer; - @end smallexample - - @noindent - This rule detects only numeric types and subtypes defined in - @code{Standard}. The use of numeric types and subtypes defined in other - predefined packages (such as @code{System.Any_Priority} or - @code{Ada.Text_IO.Count}) is not flagged - - This rule has no parameters. - - - - @node Raising_External_Exceptions - @subsection @code{Raising_External_Exceptions} - @cindex @code{Raising_External_Exceptions} rule (for @command{gnatcheck}) - - @noindent - Flag any @code{raise} statement, in a program unit declared in a library - package or in a generic library package, for an exception that is - neither a predefined exception nor an exception that is also declared (or - renamed) in the visible part of the package. - - This rule has no parameters. - - - - @node Raising_Predefined_Exceptions - @subsection @code{Raising_Predefined_Exceptions} - @cindex @code{Raising_Predefined_Exceptions} rule (for @command{gnatcheck}) - - @noindent - Flag each @code{raise} statement that raises a predefined exception - (i.e., one of the exceptions @code{Constraint_Error}, @code{Numeric_Error}, - @code{Program_Error}, @code{Storage_Error}, or @code{Tasking_Error}). - - This rule has no parameters. - - @node Separate_Numeric_Error_Handlers - @subsection @code{Separate_Numeric_Error_Handlers} - @cindex @code{Separate_Numeric_Error_Handlers} rule (for @command{gnatcheck}) - - @noindent - Flags each exception handler that contains a choice for - the predefined @code{Constraint_Error} exception, but does not contain - the choice for the predefined @code{Numeric_Error} exception, or - that contains the choice for @code{Numeric_Error}, but does not contain the - choice for @code{Constraint_Error}. - - This rule has no parameters. - - @ignore - @node Recursion - @subsection @code{Recursion} (under construction, GLOBAL) - @cindex @code{Recursion} rule (for @command{gnatcheck}) - - @noindent - Flag recursive subprograms (cycles in the call graph). Declarations, and not - calls, of recursive subprograms are detected. - - This rule has no parameters. - @end ignore - - @ignore - @node Side_Effect_Functions - @subsection @code{Side_Effect_Functions} (under construction, GLOBAL) - @cindex @code{Side_Effect_Functions} rule (for @command{gnatcheck}) - - @noindent - Flag functions with side effects. - - We define a side effect as changing any data object that is not local for the - body of this function. - - At the moment, we do NOT consider a side effect any input-output operations - (changing a state or a content of any file). - - We do not consider protected functions for this rule (???) - - There are the following sources of side effect: - - @enumerate - @item Explicit (or direct) side-effect: - - @itemize @bullet - @item - direct assignment to a non-local variable; - - @item - direct call to an entity that is known to change some data object that is - not local for the body of this function (Note, that if F1 calls F2 and F2 - does have a side effect, this does not automatically mean that F1 also - have a side effect, because it may be the case that F2 is declared in - F1's body and it changes some data object that is global for F2, but - local for F1); - @end itemize - - @item Indirect side-effect: - @itemize @bullet - @item - Subprogram calls implicitly issued by: - @itemize @bullet - @item - computing initialization expressions from type declarations as a part - of object elaboration or allocator evaluation; - @item - computing implicit parameters of subprogram or entry calls or generic - instantiations; - @end itemize - - @item - activation of a task that change some non-local data object (directly or - indirectly); - - @item - elaboration code of a package that is a result of a package instantiation; - - @item - controlled objects; - @end itemize - - @item Situations when we can suspect a side-effect, but the full static check - is either impossible or too hard: - @itemize @bullet - @item - assignment to access variables or to the objects pointed by access - variables; - - @item - call to a subprogram pointed by access-to-subprogram value - - @item - dispatching calls; - @end itemize - @end enumerate - - @noindent - This rule has no parameters. - @end ignore - - @node Slices - @subsection @code{Slices} - @cindex @code{Slices} rule (for @command{gnatcheck}) - - @noindent - Flag all uses of array slicing - - This rule has no parameters. - - - @node Too_Many_Parents - @subsection @code{Too_Many_Parents} - @cindex @code{Too_Many_Parents} rule (for @command{gnatcheck}) - - @noindent - Flags any type declaration, single task declaration or single protected - declaration that has more then @option{N} parents, @option{N} is a parameter - of the rule. - A parent here is either a (sub)type denoted by the subtype mark from the - parent_subtype_indication (in case of a derived type declaration), or - any of the progenitors from the interface list, if any. - - This rule has the following (mandatory) parameters for the @option{+R} option: - - @table @emph - @item N - Positive integer specifying the maximal allowed number of parents. - @end table - - - @node Unassigned_OUT_Parameters - @subsection @code{Unassigned_OUT_Parameters} - @cindex @code{Unassigned_OUT_Parameters} rule (for @command{gnatcheck}) - - @noindent - Flags procedures' @code{out} parameters that are not assigned, and - identifies the contexts in which the assignments are missing. - - An @code{out} parameter is flagged in the statements in the procedure - body's handled sequence of statements (before the procedure body's - @code{exception} part, if any) if this sequence of statements contains - no assignments to the parameter. - - An @code{out} parameter is flagged in an exception handler in the exception - part of the procedure body's handled sequence of statements if the handler - contains no assignment to the parameter. - - Bodies of generic procedures are also considered. - - The following are treated as assignments to an @code{out} parameter: - - @itemize @bullet - @item - an assignment statement, with the parameter or some component as the target; - - @item - passing the parameter (or one of its components) as an @code{out} or - @code{in out} parameter. - @end itemize - - @noindent - This rule does not have any parameters. - - - - @node Uncommented_BEGIN_In_Package_Bodies - @subsection @code{Uncommented_BEGIN_In_Package_Bodies} - @cindex @code{Uncommented_BEGIN_In_Package_Bodies} rule (for @command{gnatcheck}) - - @noindent - Flags each package body with declarations and a statement part that does not - include a trailing comment on the line containing the @code{begin} keyword; - this trailing comment needs to specify the package name and nothing else. - The @code{begin} is not flagged if the package body does not - contain any declarations. - - If the @code{begin} keyword is placed on the - same line as the last declaration or the first statement, it is flagged - independently of whether the line contains a trailing comment. The - diagnostic message is attached to the line containing the first statement. - - This rule has no parameters. - - @node Unconditional_Exits - @subsection @code{Unconditional_Exits} - @cindex @code{Unconditional_Exits} rule (for @command{gnatcheck}) - - @noindent - Flag unconditional @code{exit} statements. - - This rule has no parameters. - - @node Unconstrained_Array_Returns - @subsection @code{Unconstrained_Array_Returns} - @cindex @code{Unconstrained_Array_Returns} rule (for @command{gnatcheck}) - - @noindent - Flag each function returning an unconstrained array. Function declarations, - function bodies (and body stubs) having no separate specifications, - and generic function instantiations are checked. - Function calls and function renamings are - not checked. - - Generic function declarations, and function declarations in generic - packages are not checked, instead this rule checks the results of - generic instantiations (that is, expanded specification and expanded - body corresponding to an instantiation). - - This rule has no parameters. - - @node Universal_Ranges - @subsection @code{Universal_Ranges} - @cindex @code{Universal_Ranges} rule (for @command{gnatcheck}) - - @noindent - Flag discrete ranges that are a part of an index constraint, constrained - array definition, or @code{for}-loop parameter specification, and whose bounds - are both of type @i{universal_integer}. Ranges that have at least one - bound of a specific type (such as @code{1 .. N}, where @code{N} is a variable - or an expression of non-universal type) are not flagged. - - This rule has no parameters. ! ! @node Unnamed_Blocks_And_Loops ! @subsection @code{Unnamed_Blocks_And_Loops} ! @cindex @code{Unnamed_Blocks_And_Loops} rule (for @command{gnatcheck}) ! ! @noindent ! Flag each unnamed block statement and loop statement. ! ! The rule has no parameters. ! ! ! ! @ignore ! @node Unused_Subprograms ! @subsection @code{Unused_Subprograms} (under construction, GLOBAL) ! @cindex @code{Unused_Subprograms} rule (for @command{gnatcheck}) ! ! @noindent ! Flag all unused subprograms. ! ! This rule has no parameters. ! @end ignore ! ! ! ! ! @node USE_PACKAGE_Clauses ! @subsection @code{USE_PACKAGE_Clauses} ! @cindex @code{USE_PACKAGE_Clauses} rule (for @command{gnatcheck}) ! ! @noindent ! Flag all @code{use} clauses for packages; @code{use type} clauses are ! not flagged. ! ! This rule has no parameters. ! ! ! @node Visible_Components ! @subsection @code{Visible_Components} ! @cindex @code{Visible_Components} rule (for @command{gnatcheck}) ! ! @noindent ! Flags all the type declarations located in the visible part of a library ! package or a library generic package that can declare a visible component. A ! type is considered as declaring a visible component if it contains a record ! definition by its own or as a part of a record extension. Type declaration is ! flagged even if it contains a record definition that defines no components. ! ! Declarations located in private parts of local (generic) packages are not ! flagged. Declarations in private packages are not flagged. ! ! This rule has no parameters. ! ! ! @node Volatile_Objects_Without_Address_Clauses ! @subsection @code{Volatile_Objects_Without_Address_Clauses} ! @cindex @code{Volatile_Objects_Without_Address_Clauses} rule (for @command{gnatcheck}) ! ! @noindent ! Flag each volatile object that does not have an address clause. ! ! The following check is made: if the pragma @code{Volatile} is applied to a ! data object or to its type, then an address clause must ! be supplied for this object. ! ! This rule does not check the components of data objects, ! array components that are volatile as a result of the pragma ! @code{Volatile_Components}, or objects that are volatile because ! they are atomic as a result of pragmas @code{Atomic} or ! @code{Atomic_Components}. ! ! Only variable declarations, and not constant declarations, are checked. ! ! This rule has no parameters. ! ! @node Example of gnatcheck Usage ! @section Example of @command{gnatcheck} Usage ! ! @noindent ! Here is a simple example. Suppose that in the current directory we have a ! project file named @file{gnatcheck_example.gpr} with the following content: ! ! @smallexample @c projectfile ! project Gnatcheck_Example is ! ! for Source_Dirs use ("src"); ! for Object_Dir use "obj"; ! for Main use ("main.adb"); ! ! package Check is ! for Default_Switches ("ada") use ("-rules", "-from=coding_standard"); ! end Check; ! ! end Gnatcheck_Example; ! @end smallexample ! ! @noindent ! And the file named @file{coding_standard} is also located in the current ! directory and has the following content: ! ! @smallexample ! ----------------------------------------------------- ! -- This is a sample gnatcheck coding standard file -- ! ----------------------------------------------------- ! ! -- First, turning on rules, that are directly implemented in gnatcheck ! +RAbstract_Type_Declarations ! +RAnonymous_Arrays ! +RLocal_Packages ! +RFloat_Equality_Checks ! +REXIT_Statements_With_No_Loop_Name ! ! -- Then, activating compiler checks of interest: ! +RStyle_Checks:e ! -- This style check checks if a unit name is present on END keyword that ! -- is the end of the unit declaration ! @end smallexample ! ! @noindent ! And the subdirectory @file{src} contains the following Ada sources: ! ! @file{pack.ads}: ! ! @smallexample @c ada ! package Pack is ! type T is abstract tagged private; ! procedure P (X : T) is abstract; ! ! package Inner is ! type My_Float is digits 8; ! function Is_Equal (L, R : My_Float) return Boolean; ! end Inner; ! private ! type T is abstract tagged null record; ! end; ! @end smallexample ! ! @noindent ! @file{pack.adb}: ! ! @smallexample @c ada ! package body Pack is ! package body Inner is ! function Is_Equal (L, R : My_Float) return Boolean is ! begin ! return L = R; ! end; ! end Inner; ! end Pack; ! @end smallexample ! ! @noindent ! and @file{main.adb} ! ! @smallexample @c ada ! with Pack; use Pack; ! procedure Main is ! ! pragma Annotate ! (gnatcheck, Exempt_On, "Anonymous_Arrays", "this one is fine"); ! Float_Array : array (1 .. 10) of Inner.My_Float; ! pragma Annotate (gnatcheck, Exempt_Off, "Anonymous_Arrays"); ! ! Another_Float_Array : array (1 .. 10) of Inner.My_Float; ! ! use Inner; ! ! B : Boolean := False; ! ! begin ! for J in Float_Array'Range loop ! if Is_Equal (Float_Array (J), Another_Float_Array (J)) then ! B := True; ! exit; ! end if; ! end loop; ! end Main; ! @end smallexample ! ! @noindent ! And suppose we call @command{gnatcheck} from the current directory using ! the @command{gnat} driver: ! ! @smallexample ! gnat check -Pgnatcheck_example.gpr ! @end smallexample ! ! @noindent ! As a result, @command{gnatcheck} is called to check all the files from the ! project @file{gnatcheck_example.gpr} using the coding standard defined by ! the file @file{coding_standard}. As the result, the @command{gnatcheck} ! report file named @file{gnatcheck.out} will be created in the current ! directory, and it will have the following content: ! ! @smallexample ! RULE CHECKING REPORT ! ! 1. OVERVIEW ! ! Date and time of execution: 2009.10.28 14:17 ! Tool version: GNATCHECK (built with ASIS 2.0.R for GNAT Pro 6.3.0w (20091016)) ! Command line: ! ! gnatcheck -files=.../GNAT-TEMP-000004.TMP -cargs -gnatec=.../GNAT-TEMP-000003.TMP -rules -from=coding_standard ! ! Coding standard (applied rules): ! Abstract_Type_Declarations ! Anonymous_Arrays ! EXIT_Statements_With_No_Loop_Name ! Float_Equality_Checks ! Local_Packages ! ! Compiler style checks: -gnatye ! ! Number of coding standard violations: 6 ! Number of exempted coding standard violations: 1 ! ! 2. DETECTED RULE VIOLATIONS ! ! 2.1. NON-EXEMPTED VIOLATIONS ! ! Source files with non-exempted violations ! pack.ads ! pack.adb ! main.adb ! ! List of violations grouped by files, and ordered by increasing source location: ! ! pack.ads:2:4: declaration of abstract type ! pack.ads:5:4: declaration of local package ! pack.ads:10:30: declaration of abstract type ! pack.ads:11:1: (style) "end Pack" required ! pack.adb:5:19: use of equality operation for float values ! pack.adb:6:7: (style) "end Is_Equal" required ! main.adb:9:26: anonymous array type ! main.adb:19:10: exit statement with no loop name ! ! 2.2. EXEMPTED VIOLATIONS ! ! Source files with exempted violations ! main.adb ! ! List of violations grouped by files, and ordered by increasing source location: ! ! main.adb:6:18: anonymous array type ! (this one is fine) ! ! 2.3. SOURCE FILES WITH NO VIOLATION ! ! No files without violations ! ! END OF REPORT ! @end smallexample @c ********************************* --- 17247,17258 ---- legal Ada units. Moreover, when a unit depends semantically upon units located outside the current directory, the source search path has to be provided when calling @command{gnatcheck}, either through a specified project file or ! through @command{gnatcheck} switches. A number of rules are predefined in @command{gnatcheck} and are described later in this chapter. ! For full details, refer to @cite{GNATcheck Reference Manual} document. @c ********************************* *************** option @option{^--no-exception^/NO_EXCEP *** 23157,23163 **** @command{gnatstub} has the command-line interface of the form @smallexample ! $ gnatstub @ovar{switches} @var{filename} @ovar{directory} @end smallexample @noindent --- 17291,17299 ---- @command{gnatstub} has the command-line interface of the form @smallexample ! @c $ gnatstub @ovar{switches} @var{filename} @ovar{directory} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatstub @r{[}@var{switches}@r{]} @var{filename} @r{[}@var{directory}@r{]} @r{[}-cargs @var{gcc_switches}@r{]} @end smallexample @noindent *************** indicates the directory in which the bod *** 23185,23190 **** --- 17321,17334 ---- is the current directory) + @item @samp{@var{gcc_switches}} is a list of switches for + @command{gcc}. They will be passed on to all compiler invocations made by + @command{gnatelim} to generate the ASIS trees. Here you can provide + @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, + use the @option{-gnatec} switch to set the configuration file, + use the @option{-gnat05} switch if sources should be compiled in + Ada 2005 mode etc. + @item switches is an optional sequence of switches as described in the next section @end table *************** Same as @option{^-gnatyM^/MAX_LINE_LENGT *** 23272,23278 **** @item ^--no-exception^/NO_EXCEPTION^ @cindex @option{^--no-exception^/NO_EXCEPTION^} (@command{gnatstub}) ! Avoind raising PROGRAM_ERROR in the generated bodies of program unit stubs. This is not always possible for function stubs. @item ^--no-local-header^/NO_LOCAL_HEADER^ --- 17416,17422 ---- @item ^--no-exception^/NO_EXCEPTION^ @cindex @option{^--no-exception^/NO_EXCEPTION^} (@command{gnatstub}) ! void raising PROGRAM_ERROR in the generated bodies of program unit stubs. This is not always possible for function stubs. @item ^--no-local-header^/NO_LOCAL_HEADER^ *************** Verbose mode: generate version informati *** 23326,23335 **** @findex binding @noindent ! GNAT now comes with a new experimental binding generator for C and C++ ! headers which is intended to do 95% of the tedious work of generating ! Ada specs from C or C++ header files. Note that this still is a work in ! progress, not designed to generate 100% correct Ada specs. The code generated is using the Ada 2005 syntax, which makes it easier to interface with other languages than previous versions of Ada. --- 17470,17494 ---- @findex binding @noindent ! GNAT now comes with a binding generator for C and C++ headers which is ! intended to do 95% of the tedious work of generating Ada specs from C ! or C++ header files. ! ! Note that this capability is not intended to generate 100% correct Ada specs, ! and will is some cases require manual adjustments, although it can often ! be used out of the box in practice. ! ! Some of the known limitations include: ! ! @itemize @bullet ! @item only very simple character constant macros are translated into Ada ! constants. Function macros (macros with arguments) are partially translated ! as comments, to be completed manually if needed. ! @item some extensions (e.g. vector types) are not supported ! @item pointers to pointers or complex structures are mapped to System.Address ! @item identifiers with identical name (except casing) will generate compilation ! errors (e.g. @code{shm_get} vs @code{SHM_GET}). ! @end itemize The code generated is using the Ada 2005 syntax, which makes it easier to interface with other languages than previous versions of Ada. *************** easier to interface with other languages *** 23347,23353 **** The binding generator is part of the @command{gcc} compiler and can be invoked via the @option{-fdump-ada-spec} switch, which will generate Ada spec files for the header files specified on the command line, and all ! header files needed by these files transitivitely. For example: @smallexample $ g++ -c -fdump-ada-spec -C /usr/include/time.h --- 17506,17512 ---- The binding generator is part of the @command{gcc} compiler and can be invoked via the @option{-fdump-ada-spec} switch, which will generate Ada spec files for the header files specified on the command line, and all ! header files needed by these files transitively. For example: @smallexample $ g++ -c -fdump-ada-spec -C /usr/include/time.h *************** be able to click on any identifier and g *** 23676,23682 **** The command line is as follow: @smallexample ! $ perl gnathtml.pl @ovar{^switches^options^} @var{ada-files} @end smallexample @noindent --- 17835,17843 ---- The command line is as follow: @smallexample ! @c $ perl gnathtml.pl @ovar{^switches^options^} @var{ada-files} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ perl gnathtml.pl @r{[}@var{^switches^options^}@r{]} @var{ada-files} @end smallexample @noindent *************** is. The syntax of this line is: *** 23782,23788 **** Alternatively, you may run the script using the following command line: @smallexample ! $ perl gnathtml.pl @ovar{switches} @var{files} @end smallexample @ifset vms --- 17943,17951 ---- Alternatively, you may run the script using the following command line: @smallexample ! @c $ perl gnathtml.pl @ovar{switches} @var{files} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ perl gnathtml.pl @r{[}@var{switches}@r{]} @var{files} @end smallexample @ifset vms *************** gnatmake -f -pg -P my_project *** 23982,23990 **** @end smallexample @noindent ! Note that only the objects that were compiled with the @samp{-pg} switch will be ! profiled; if you need to profile your whole project, use the ! @samp{-f} gnatmake switch to force full recompilation. @node Program execution @subsection Program execution --- 18145,18153 ---- @end smallexample @noindent ! Note that only the objects that were compiled with the @samp{-pg} switch will ! be profiled; if you need to profile your whole project, use the @samp{-f} ! gnatmake switch to force full recompilation. @node Program execution @subsection Program execution *************** the incorrect user program. *** 24142,24147 **** --- 18305,18311 ---- * Ada Exceptions:: * Ada Tasks:: * Debugging Generic Units:: + * Remote Debugging using gdbserver:: * GNAT Abnormal Termination or Failure to Terminate:: * Naming Conventions for GNAT Source Files:: * Getting Internal Debugging Information:: *************** and execution encounters the breakpoint, *** 24287,24297 **** stops and @code{GDB} signals that the breakpoint was encountered by printing the line of code before which the program is halted. ! @item breakpoint exception @var{name} ! A special form of the breakpoint command which breakpoints whenever ! exception @var{name} is raised. ! If @var{name} is omitted, ! then a breakpoint will occur when any exception is raised. @item print @var{expression} This will print the value of the given expression. Most simple --- 18451,18460 ---- stops and @code{GDB} signals that the breakpoint was encountered by printing the line of code before which the program is halted. ! @item catch exception @var{name} ! This command causes the program execution to stop whenever exception ! @var{name} is raised. If @var{name} is omitted, then the execution is ! suspended when any exception is raised. @item print @var{expression} This will print the value of the given expression. Most simple *************** The value returned is always that from t *** 24453,24477 **** that was stepped through. @node Ada Exceptions ! @section Breaking on Ada Exceptions @cindex Exceptions @noindent ! You can set breakpoints that trip when your program raises ! selected exceptions. @table @code ! @item break exception ! Set a breakpoint that trips whenever (any task in the) program raises ! any exception. ! @item break exception @var{name} ! Set a breakpoint that trips whenever (any task in the) program raises ! the exception @var{name}. ! @item break exception unhandled ! Set a breakpoint that trips whenever (any task in the) program raises an ! exception for which there is no handler. @item info exceptions @itemx info exceptions @var{regexp} --- 18616,18640 ---- that was stepped through. @node Ada Exceptions ! @section Stopping when Ada Exceptions are Raised @cindex Exceptions @noindent ! You can set catchpoints that stop the program execution when your program ! raises selected exceptions. @table @code ! @item catch exception ! Set a catchpoint that stops execution whenever (any task in the) program ! raises any exception. ! @item catch exception @var{name} ! Set a catchpoint that stops execution whenever (any task in the) program ! raises the exception @var{name}. ! @item catch exception unhandled ! Set a catchpoint that stops executing whenever (any task in the) program ! raises an exception for which there is no handler. @item info exceptions @itemx info exceptions @var{regexp} *************** When the breakpoint occurs, you can step *** 24600,24605 **** --- 18763,18818 ---- instance in the normal manner and examine the values of local variables, as for other units. + @node Remote Debugging using gdbserver + @section Remote Debugging using gdbserver + @cindex Remote Debugging using gdbserver + + @noindent + On platforms where gdbserver is supported, it is possible to use this tool + to debug your application remotely. This can be useful in situations + where the program needs to be run on a target host that is different + from the host used for development, particularly when the target has + a limited amount of resources (either CPU and/or memory). + + To do so, start your program using gdbserver on the target machine. + gdbserver then automatically suspends the execution of your program + at its entry point, waiting for a debugger to connect to it. The + following commands starts an application and tells gdbserver to + wait for a connection with the debugger on localhost port 4444. + + @smallexample + $ gdbserver localhost:4444 program + Process program created; pid = 5685 + Listening on port 4444 + @end smallexample + + Once gdbserver has started listening, we can tell the debugger to establish + a connection with this gdbserver, and then start the same debugging session + as if the program was being debugged on the same host, directly under + the control of GDB. + + @smallexample + $ gdb program + (gdb) target remote targethost:4444 + Remote debugging using targethost:4444 + 0x00007f29936d0af0 in ?? () from /lib64/ld-linux-x86-64.so. + (gdb) b foo.adb:3 + Breakpoint 1 at 0x401f0c: file foo.adb, line 3. + (gdb) continue + Continuing. + + Breakpoint 1, foo () at foo.adb:4 + 4 end foo; + @end smallexample + + It is also possible to use gdbserver to attach to an already running + program, in which case the execution of that program is simply suspended + until the connection between the debugger and gdbserver is established. + + For more information on how to use gdbserver, @ref{Top, Server, Using + the gdbserver Program, gdb, Debugging with GDB}. GNAT Pro provides support + for gdbserver on x86-linux, x86-windows and x86_64-linux. + @node GNAT Abnormal Termination or Failure to Terminate @section GNAT Abnormal Termination or Failure to Terminate @cindex GNAT Abnormal Termination or Failure to Terminate *************** Unlike HP Ada, the GNAT ``@code{EXPORT_} *** 25951,25957 **** a separate subprogram specification which must appear before the subprogram body. ! GNAT also supplies a number of implementation-defined pragmas as follows: @itemize @bullet @item @code{ABORT_DEFER} --- 20164,20172 ---- a separate subprogram specification which must appear before the subprogram body. ! GNAT also supplies a number of implementation-defined pragmas including the ! following: ! @itemize @bullet @item @code{ABORT_DEFER} *************** GNAT also supplies a number of implement *** 25961,25966 **** --- 20176,20187 ---- @item @code{ADA_05} + @item @code{Ada_2005} + + @item @code{Ada_12} + + @item @code{Ada_2012} + @item @code{ANNOTATE} @item @code{ASSERT} *************** GNAT also supplies a number of implement *** 26007,26013 **** @end itemize @noindent ! For full details on these GNAT implementation-defined pragmas, see @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual}. --- 20228,20234 ---- @end itemize @noindent ! For full details on these and other GNAT implementation-defined pragmas, see @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual}. *************** information about several specific platf *** 26906,26911 **** --- 21127,21133 ---- * AIX-Specific Considerations:: * Irix-Specific Considerations:: * RTX-Specific Considerations:: + * HP-UX-Specific Considerations:: @end menu @node Summary of Run-Time Configurations *************** Windows executables that run in Ring 3 t *** 27265,27274 **** @item Real-time subsystem (RTSS) executables that run in Ring 0, where performance can be optimized with RTSS applications taking precedent ! over all Windows applications (@emph{rts-rtx-rtss}). @end itemize @c ******************************* @node Example of Binder Output File @appendix Example of Binder Output File --- 21487,21533 ---- @item Real-time subsystem (RTSS) executables that run in Ring 0, where performance can be optimized with RTSS applications taking precedent ! over all Windows applications (@emph{rts-rtx-rtss}). This mode requires ! the Microsoft linker to handle RTSS libraries. @end itemize + @node HP-UX-Specific Considerations + @section HP-UX-Specific Considerations + @cindex HP-UX Scheduling + + @noindent + On HP-UX, appropriate privileges are required to change the scheduling + parameters of a task. The calling process must have appropriate + privileges or be a member of a group having @code{PRIV_RTSCHED} access to + successfully change the scheduling parameters. + + By default, GNAT uses the @code{SCHED_HPUX} policy. To have access to the + priority range 0-31 either the @code{FIFO_Within_Priorities} or the + @code{Round_Robin_Within_Priorities} scheduling policies need to be set. + + To specify the @code{FIFO_Within_Priorities} scheduling policy you can use + one of the following: + + @itemize @bullet + @item + @code{pragma Time_Slice (0.0)} + @cindex pragma Time_Slice + @item + the corresponding binder option @option{-T0} + @cindex @option{-T0} option + @item + @code{pragma Task_Dispatching_Policy (FIFO_Within_Priorities)} + @cindex pragma Task_Dispatching_Policy + @end itemize + + @noindent + To specify the @code{Round_Robin_Within_Priorities}, scheduling policy + you should use @code{pragma Time_Slice} with a + value greater than @code{0.0}, or use the corresponding @option{-T} + binder option, or set the @code{pragma Task_Dispatching_Policy + (Round_Robin_Within_Priorities)}. + @c ******************************* @node Example of Binder Output File @appendix Example of Binder Output File *************** Note that in this approach, both declara *** 30118,30125 **** compiler so this can only be used where both declarations are legal, even though one of them will not be used. ! Another approach is to define integer constants, e.g.@: @code{Bits_Per_Word}, or ! Boolean constants, e.g.@: @code{Little_Endian}, and then write declarations that are parameterized by these constants. For example @smallexample @c ada --- 24377,24384 ---- compiler so this can only be used where both declarations are legal, even though one of them will not be used. ! Another approach is to define integer constants, e.g.@: @code{Bits_Per_Word}, ! or Boolean constants, e.g.@: @code{Little_Endian}, and then write declarations that are parameterized by these constants. For example @smallexample @c ada *************** Such code will be referred to below as @ *** 31725,31734 **** @menu * Address types:: ! * Access types:: * Unchecked conversions:: * Predefined constants:: * Interfacing with C:: * Experience with source compatibility:: @end menu --- 25984,25994 ---- @menu * Address types:: ! * Access types and 32/64-bit allocation:: * Unchecked conversions:: * Predefined constants:: * Interfacing with C:: + * 32/64-bit descriptors:: * Experience with source compatibility:: @end menu *************** approach has been taken: *** 31743,31751 **** --- 26003,26015 ---- @itemize @bullet @item @code{System.Address} always has a size of 64 bits + @cindex @code{System.Address} size + @cindex @code{Address} size @item @code{System.Short_Address} is a 32-bit subtype of @code{System.Address} + @cindex @code{System.Short_Address} size + @cindex @code{Short_Address} size @end itemize @noindent *************** required in any code setting or accessin *** 31784,31814 **** automatically perform any needed conversions between address formats. ! @node Access types ! @subsubsection Access types @noindent ! By default, objects designated by access values are always ! allocated in the 32-bit ! address space. Thus legacy code will never contain ! any objects that are not addressable with 32-bit addresses, and ! the compiler will never raise exceptions as result of mixing ! 32-bit and 64-bit addresses. ! However, the access values themselves are represented in 64 bits, for optimum ! performance and future compatibility with 64-bit code. As was ! the case with @code{System.Address}, the compiler will give an error message ! if an object or record component has a representation clause that ! requires the access value to fit in 32 bits. In such a situation, ! an explicit size clause for the access type, specifying 32 bits, ! will have the desired effect. - General access types (declared with @code{access all}) can never be - 32 bits, as values of such types must be able to refer to any object - of the designated type, - including objects residing outside the 32-bit address range. - Existing Ada 83 code will not contain such type definitions, - however, since general access types were introduced in Ada 95. @node Unchecked conversions @subsubsection Unchecked conversions --- 26048,26111 ---- automatically perform any needed conversions between address formats. ! @node Access types and 32/64-bit allocation ! @subsubsection Access types and 32/64-bit allocation ! @cindex 32-bit allocation ! @cindex 64-bit allocation @noindent ! By default, objects designated by access values are always allocated in ! the 64-bit address space, and access values themselves are represented ! in 64 bits. If these defaults are not appropriate, and 32-bit allocation ! is required (for example if the address of an allocated object is assigned ! to a @code{Short_Address} variable), then several alternatives are available: ! @itemize @bullet ! @item ! A pool-specific access type (ie, an @w{Ada 83} access type, whose ! definition is @code{access T} versus @code{access all T} or ! @code{access constant T}), may be declared with a @code{'Size} representation ! clause that establishes the size as 32 bits. ! In such circumstances allocations for that type will ! be from the 32-bit heap. Such a clause is not permitted ! for a general access type (declared with @code{access all} or ! @code{access constant}) as values of such types must be able to refer ! to any object of the designated type, including objects residing outside ! the 32-bit address range. Existing @w{Ada 83} code will not contain such ! type definitions, however, since general access types were introduced ! in @w{Ada 95}. ! ! @item ! Switches for @command{GNAT BIND} control whether the internal GNAT ! allocation routine @code{__gnat_malloc} uses 64-bit or 32-bit allocations. ! @cindex @code{__gnat_malloc} ! The switches are respectively @option{-H64} (the default) and ! @option{-H32}. ! @cindex @option{-H32} (@command{gnatbind}) ! @cindex @option{-H64} (@command{gnatbind}) ! ! @item ! The environment variable (logical name) @code{GNAT$NO_MALLOC_64} ! @cindex @code{GNAT$NO_MALLOC_64} environment variable ! may be used to force @code{__gnat_malloc} to use 32-bit allocation. ! If this variable is left ! undefined, or defined as @code{"DISABLE"}, @code{"FALSE"}, or @code{"0"}, ! then the default (64-bit) allocation is used. ! If defined as @code{"ENABLE"}, @code{"TRUE"}, or @code{"1"}, ! then 32-bit allocation is used. The gnatbind qualifiers described above ! override this logical name. ! ! @item ! A ^gcc switch^gcc switch^ for OpenVMS, @option{-mno-malloc64}, operates ! @cindex @option{-mno-malloc64} (^gcc^gcc^) ! at a low level to convert explicit calls to @code{malloc} and related ! functions from the C run-time library so that they perform allocations ! in the 32-bit heap. ! Since all internal allocations from GNAT use @code{__gnat_malloc}, ! this switch is not required unless the program makes explicit calls on ! @code{malloc} (or related functions) from interfaced C code. ! @end itemize @node Unchecked conversions @subsubsection Unchecked conversions *************** pragma Convention(C, int_star); *** 31881,31886 **** --- 26178,26197 ---- for int_star'Size use 64; -- Necessary to get 64 and not 32 bits @end smallexample + @node 32/64-bit descriptors + @subsubsection 32/64-bit descriptors + + @noindent + By default, GNAT uses a 64-bit descriptor mechanism. For an imported + subprogram (i.e., a subprogram identified by pragma @code{Import_Function}, + @code{Import_Procedure}, or @code{Import_Valued_Procedure}) that specifies + @code{Short_Descriptor} as its mechanism, a 32-bit descriptor is used. + @cindex @code{Short_Descriptor} mechanism for imported subprograms + + If the configuration pragma @code{Short_Descriptors} is supplied, then + all descriptors will be 32 bits. + @cindex pragma @code{Short_Descriptors} + @node Experience with source compatibility @subsubsection Experience with source compatibility *************** these sorts of potential source code por *** 31913,31920 **** * Making code 64 bit clean:: * Allocating memory from the 64 bit storage pool:: * Restrictions on use of 64 bit objects:: - * Using 64 bit storage pools by default:: - * General access types:: * STARLET and other predefined libraries:: @end menu --- 26224,26229 ---- *************** Any attempt to do this will raise @code{ *** 31958,31970 **** @subsubsection Allocating memory from the 64-bit storage pool @noindent ! For any access type @code{T} that potentially requires memory allocations ! beyond the 32-bit address space, ! use the following representation clause: ! ! @smallexample @c ada ! for T'Storage_Pool use System.Pool_64; ! @end smallexample @node Restrictions on use of 64 bit objects @subsubsection Restrictions on use of 64-bit objects --- 26267,26276 ---- @subsubsection Allocating memory from the 64-bit storage pool @noindent ! By default, all allocations -- for both pool-specific and general ! access types -- use the 64-bit storage pool. To override ! this default, for an individual access type or globally, see ! @ref{Access types and 32/64-bit allocation}. @node Restrictions on use of 64 bit objects @subsubsection Restrictions on use of 64-bit objects *************** or assigning it to a variable of type @c *** 31979,32024 **** no exception is raised and execution will become erroneous. - @node Using 64 bit storage pools by default - @subsubsection Using 64-bit storage pools by default - - @noindent - In some cases it may be desirable to have the compiler allocate - from 64-bit storage pools by default. This may be the case for - libraries that are 64-bit clean, but may be used in both 32-bit - and 64-bit contexts. For these cases the following configuration - pragma may be specified: - - @smallexample @c ada - pragma Pool_64_Default; - @end smallexample - - @noindent - Any code compiled in the context of this pragma will by default - use the @code{System.Pool_64} storage pool. This default may be overridden - for a specific access type @code{T} by the representation clause: - - @smallexample @c ada - for T'Storage_Pool use System.Pool_32; - @end smallexample - - @noindent - Any object whose address may be passed to a subprogram with a - @code{Short_Address} argument, or assigned to a variable of type - @code{Short_Address}, needs to be allocated from this pool. - - @node General access types - @subsubsection General access types - - @noindent - Objects designated by access values from a - general access type (declared with @code{access all}) are never allocated - from a 64-bit storage pool. Code that uses general access types will - accept objects allocated in either 32-bit or 64-bit address spaces, - but never allocate objects outside the 32-bit address space. - Using general access types ensures maximum compatibility with both - 32-bit and 64-bit code. - @node STARLET and other predefined libraries @subsubsection STARLET and other predefined libraries --- 26285,26290 ---- *************** platforms (NT, 2000, and XP Professional *** 32078,32085 **** * Windows Calling Conventions:: * Introduction to Dynamic Link Libraries (DLLs):: * Using DLLs with GNAT:: - * Building DLLs with GNAT:: * Building DLLs with GNAT Project files:: * Building DLLs with gnatdll:: * GNAT and Windows Resources:: * Debugging a DLL:: --- 26344,26351 ---- * Windows Calling Conventions:: * Introduction to Dynamic Link Libraries (DLLs):: * Using DLLs with GNAT:: * Building DLLs with GNAT Project files:: + * Building DLLs with GNAT:: * Building DLLs with gnatdll:: * GNAT and Windows Resources:: * Debugging a DLL:: *************** features are not used, but it is not gua *** 32140,32150 **** @item It is not possible to link against Microsoft libraries except for ! import libraries. The library must be built to be compatible with ! @file{MSVCRT.LIB} (/MD Microsoft compiler option), @file{LIBC.LIB} and ! @file{LIBCMT.LIB} (/ML or /MT Microsoft compiler options) are known to ! not be compatible with the GNAT runtime. Even if the library is ! compatible with @file{MSVCRT.LIB} it is not guaranteed to work. @item When the compilation environment is located on FAT32 drives, users may --- 26406,26412 ---- @item It is not possible to link against Microsoft libraries except for ! import libraries. Interfacing must be done by the mean of DLLs. @item When the compilation environment is located on FAT32 drives, users may *************** interoperability strategy. *** 32235,32263 **** If you use @command{gcc} to compile the non-Ada part of your application, there are no Windows-specific restrictions that affect the overall ! interoperability with your Ada code. If you plan to use ! Microsoft tools (e.g.@: Microsoft Visual C/C++), you should be aware of ! the following limitations: ! ! @itemize @bullet ! @item ! You cannot link your Ada code with an object or library generated with ! Microsoft tools if these use the @code{.tls} section (Thread Local ! Storage section) since the GNAT linker does not yet support this section. ! ! @item ! You cannot link your Ada code with an object or library generated with ! Microsoft tools if these use I/O routines other than those provided in ! the Microsoft DLL: @code{msvcrt.dll}. This is because the GNAT run time ! uses the services of @code{msvcrt.dll} for its I/Os. Use of other I/O ! libraries can cause a conflict with @code{msvcrt.dll} services. For ! instance Visual C++ I/O stream routines conflict with those in ! @code{msvcrt.dll}. ! @end itemize ! ! @noindent ! If you do want to use the Microsoft tools for your non-Ada code and hit one ! of the above limitations, you have two choices: @enumerate @item --- 26497,26504 ---- If you use @command{gcc} to compile the non-Ada part of your application, there are no Windows-specific restrictions that affect the overall ! interoperability with your Ada code. If you do want to use the ! Microsoft tools for your non-Ada code, you have two choices: @enumerate @item *************** build the DLL and use GNAT to build your *** 32269,32276 **** @item Or you can encapsulate your Ada code in a DLL to be linked with the other part of your application. In this case, use GNAT to build the DLL ! (@pxref{Building DLLs with GNAT}) and use the Microsoft or whatever ! environment to build your executable. @end enumerate @node Windows Calling Conventions --- 26510,26517 ---- @item Or you can encapsulate your Ada code in a DLL to be linked with the other part of your application. In this case, use GNAT to build the DLL ! (@pxref{Building DLLs with GNAT Project files}) and use the Microsoft ! or whatever environment to build your executable. @end enumerate @node Windows Calling Conventions *************** environment to build your executable. *** 32278,32283 **** --- 26519,26528 ---- @findex Stdcall @findex APIENTRY + This section pertain only to Win32. On Win64 there is a single native + calling convention. All convention specifiers are ignored on this + platform. + @menu * C Calling Convention:: * Stdcall Calling Convention:: *************** $ gnatmake my_ada_app -largs -lAPI *** 32581,32591 **** @noindent The argument @option{-largs -lAPI} at the end of the @command{gnatmake} command ! tells the GNAT linker to look first for a library named @file{API.lib} ! (Microsoft-style name) and if not found for a libraries named ! @file{libAPI.dll.a}, @file{API.dll.a} or @file{libAPI.a}. ! (GNAT-style name). Note that if the Ada package spec for @file{API.dll} ! contains the following pragma @smallexample @c ada pragma Linker_Options ("-lAPI"); --- 26826,26848 ---- @noindent The argument @option{-largs -lAPI} at the end of the @command{gnatmake} command ! tells the GNAT linker to look for an import library. The linker will ! look for a library name in this specific order: ! ! @enumerate ! @item @file{libAPI.dll.a} ! @item @file{API.dll.a} ! @item @file{libAPI.a} ! @item @file{API.lib} ! @item @file{libAPI.dll} ! @item @file{API.dll} ! @end enumerate ! ! The first three are the GNU style import libraries. The third is the ! Microsoft style import libraries. The last two are the actual DLL names. ! ! Note that if the Ada package spec for @file{API.dll} contains the ! following pragma @smallexample @c ada pragma Linker_Options ("-lAPI"); *************** end API; *** 32643,32649 **** @noindent Note that a variable is ! @strong{always imported with a Stdcall convention}. A function can have @code{C} or @code{Stdcall} convention. (@pxref{Windows Calling Conventions}). --- 26900,26906 ---- @noindent Note that a variable is ! @strong{always imported with a DLL convention}. A function can have @code{C} or @code{Stdcall} convention. (@pxref{Windows Calling Conventions}). *************** See the Microsoft documentation for furt *** 32824,32829 **** --- 27081,27099 ---- @code{lib}. @end enumerate + @node Building DLLs with GNAT Project files + @section Building DLLs with GNAT Project files + @cindex DLLs, building + + @noindent + There is nothing specific to Windows in the build process. + @pxref{Library Projects}. + + @noindent + Due to a system limitation, it is not possible under Windows to create threads + when inside the @code{DllMain} routine which is used for auto-initialization + of shared libraries, so it is not possible to have library level tasks in SALs. + @node Building DLLs with GNAT @section Building DLLs with GNAT @cindex DLLs, building *************** into the DLL. This is done by using the *** 32842,32852 **** @item building the DLL ! To build the DLL you must use @command{gcc}'s @option{-shared} ! option. It is quite simple to use this method: @smallexample ! $ gcc -shared -o api.dll obj1.o obj2.o @dots{} @end smallexample It is important to note that in this case all symbols found in the --- 27112,27122 ---- @item building the DLL ! To build the DLL you must use @command{gcc}'s @option{-shared} and ! @option{-shared-libgcc} options. It is quite simple to use this method: @smallexample ! $ gcc -shared -shared-libgcc -o api.dll obj1.o obj2.o @dots{} @end smallexample It is important to note that in this case all symbols found in the *************** the set of symbols to export by passing *** 32855,32861 **** file, @pxref{The Definition File}. For example: @smallexample ! $ gcc -shared -o api.dll api.def obj1.o obj2.o @dots{} @end smallexample If you use a definition file you must export the elaboration procedures --- 27125,27131 ---- file, @pxref{The Definition File}. For example: @smallexample ! $ gcc -shared -shared-libgcc -o api.dll api.def obj1.o obj2.o @dots{} @end smallexample If you use a definition file you must export the elaboration procedures *************** option. *** 32886,32904 **** $ gnatmake main -Iapilib -bargs -shared -largs -Lapilib -lAPI @end smallexample - @node Building DLLs with GNAT Project files - @section Building DLLs with GNAT Project files - @cindex DLLs, building - - @noindent - There is nothing specific to Windows in the build process. - @pxref{Library Projects}. - - @noindent - Due to a system limitation, it is not possible under Windows to create threads - when inside the @code{DllMain} routine which is used for auto-initialization - of shared libraries, so it is not possible to have library level tasks in SALs. - @node Building DLLs with gnatdll @section Building DLLs with gnatdll @cindex DLLs, building --- 27156,27161 ---- *************** of shared libraries, so it is not possib *** 32914,32922 **** @end menu @noindent ! Note that it is preferred to use the built-in GNAT DLL support ! (@pxref{Building DLLs with GNAT}) or GNAT Project files ! (@pxref{Building DLLs with GNAT Project files}) to build DLLs. This section explains how to build DLLs containing Ada code using @code{gnatdll}. These DLLs will be referred to as Ada DLLs in the --- 27171,27179 ---- @end menu @noindent ! Note that it is preferred to use GNAT Project files ! (@pxref{Building DLLs with GNAT Project files}) or the built-in GNAT ! DLL support (@pxref{Building DLLs with GNAT}) or to build DLLs. This section explains how to build DLLs containing Ada code using @code{gnatdll}. These DLLs will be referred to as Ada DLLs in the *************** static import library for the DLL and th *** 33257,33263 **** @smallexample @cartouche ! $ gnatdll @ovar{switches} @var{list-of-files} @r{[}-largs @var{opts}@r{]} @end cartouche @end smallexample --- 27514,27522 ---- @smallexample @cartouche ! @c $ gnatdll @ovar{switches} @var{list-of-files} @r{[}-largs @var{opts}@r{]} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ gnatdll @r{[}@var{switches}@r{]} @var{list-of-files} @r{[}-largs @var{opts}@r{]} @end cartouche @end smallexample *************** missing, only the static import library *** 33273,33279 **** You may specify any of the following switches to @code{gnatdll}: @table @code ! @item -a@ovar{address} @cindex @option{-a} (@code{gnatdll}) Build a non-relocatable DLL at @var{address}. If @var{address} is not specified the default address @var{0x11000000} will be used. By default, --- 27532,27540 ---- You may specify any of the following switches to @code{gnatdll}: @table @code ! @c @item -a@ovar{address} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! @item -a@r{[}@var{address}@r{]} @cindex @option{-a} (@code{gnatdll}) Build a non-relocatable DLL at @var{address}. If @var{address} is not specified the default address @var{0x11000000} will be used. By default, *************** common @code{dlltool} switches. The form *** 33476,33482 **** is @smallexample ! $ dlltool @ovar{switches} @end smallexample @noindent --- 27737,27745 ---- is @smallexample ! @c $ dlltool @ovar{switches} ! @c Expanding @ovar macro inline (explanation in macro def comments) ! $ dlltool @r{[}@var{switches}@r{]} @end smallexample @noindent *************** The program is built with foreign tools *** 33655,33661 **** @item The program is built with @code{GCC/GNAT} and the DLL is built with foreign tools. - @item @end enumerate @noindent --- 27918,27923 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gnatbind.adb gcc-4.6.0/gcc/ada/gnatbind.adb *** gcc-4.5.2/gcc/ada/gnatbind.adb Tue Oct 27 13:22:25 2009 --- gcc-4.6.0/gcc/ada/gnatbind.adb Fri Oct 8 12:54:03 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Rident; use Rident; *** 45,50 **** --- 45,51 ---- with Snames; with Switch; use Switch; with Switch.B; use Switch.B; + with Table; with Targparm; use Targparm; with Types; use Types; *************** procedure Gnatbind is *** 81,86 **** --- 82,97 ---- Mapping_File : String_Ptr := null; + package Closure_Sources is new Table.Table + (Table_Component_Type => File_Name_Type, + Table_Index_Type => Natural, + Table_Low_Bound => 1, + Table_Initial => 10, + Table_Increment => 100, + Table_Name => "Gnatbind.Closure_Sources"); + -- Table to record the sources in the closure, to avoid duplications. Used + -- only with switch -R. + function Gnatbind_Supports_Auto_Init return Boolean; -- Indicates if automatic initialization of elaboration procedure -- through the constructor mechanism is possible on the platform. *************** procedure Gnatbind is *** 132,165 **** -- should not be listed. No_Restriction_List : constant array (All_Restrictions) of Boolean := ! (No_Exception_Propagation => True, -- Modifies code resulting in different exception semantics ! No_Exceptions => True, -- Has unexpected Suppress (All_Checks) effect ! No_Implicit_Conditionals => True, -- This could modify and pessimize generated code ! No_Implicit_Dynamic_Code => True, -- This could modify and pessimize generated code ! No_Implicit_Loops => True, -- This could modify and pessimize generated code ! No_Recursion => True, -- Not checkable at compile time ! No_Reentrancy => True, -- Not checkable at compile time ! Max_Entry_Queue_Length => True, -- Not checkable at compile time ! Max_Storage_At_Blocking => True, -- Not checkable at compile time ! others => False); Additional_Restrictions_Listed : Boolean := False; -- Set True if we have listed header for restrictions --- 143,182 ---- -- should not be listed. No_Restriction_List : constant array (All_Restrictions) of Boolean := ! (No_Allocators_After_Elaboration => True, ! -- This involves run-time conditions not checkable at compile time ! ! No_Anonymous_Allocators => True, ! -- Premature, since we have not implemented this yet ! ! No_Exception_Propagation => True, -- Modifies code resulting in different exception semantics ! No_Exceptions => True, -- Has unexpected Suppress (All_Checks) effect ! No_Implicit_Conditionals => True, -- This could modify and pessimize generated code ! No_Implicit_Dynamic_Code => True, -- This could modify and pessimize generated code ! No_Implicit_Loops => True, -- This could modify and pessimize generated code ! No_Recursion => True, -- Not checkable at compile time ! No_Reentrancy => True, -- Not checkable at compile time ! Max_Entry_Queue_Length => True, -- Not checkable at compile time ! Max_Storage_At_Blocking => True, -- Not checkable at compile time ! others => False); Additional_Restrictions_Listed : Boolean := False; -- Set True if we have listed header for restrictions *************** begin *** 572,584 **** Osint.Add_Default_Search_Dirs; -- Carry out package initializations. These are initializations which ! -- might logically be performed at elaboration time, but Namet at least ! -- can't be done that way (because it is used in the Compiler), and we ! -- decide to be consistent. Like elaboration, the order in which these ! -- calls are made is in some cases important. Csets.Initialize; - Namet.Initialize; Snames.Initialize; -- Acquire target parameters --- 589,599 ---- Osint.Add_Default_Search_Dirs; -- Carry out package initializations. These are initializations which ! -- might logically be performed at elaboration time, and we decide to be ! -- consistent. Like elaboration, the order in which these calls are made ! -- is in some cases important. Csets.Initialize; Snames.Initialize; -- Acquire target parameters *************** begin *** 671,681 **** begin Id := Scan_ALI ! (F => Main_Lib_File, ! T => Text, ! Ignore_ED => False, ! Err => False, ! Ignore_Errors => Debug_Flag_I); end; Free (Text); --- 686,697 ---- begin Id := Scan_ALI ! (F => Main_Lib_File, ! T => Text, ! Ignore_ED => False, ! Err => False, ! Ignore_Errors => Debug_Flag_I, ! Directly_Scanned => True); end; Free (Text); *************** begin *** 726,735 **** Free (Text); end if; ! -- Acquire all information in ALI files that have been read in for Index in ALIs.First .. ALIs.Last loop ! Read_ALI (Index); end loop; -- Quit if some file needs compiling --- 742,751 ---- Free (Text); end if; ! -- Load ALIs for all dependent units for Index in ALIs.First .. ALIs.Last loop ! Read_Withed_ALIs (Index); end loop; -- Quit if some file needs compiling *************** begin *** 738,743 **** --- 754,781 ---- raise Unrecoverable_Error; end if; + -- Output list of ALI files in closure + + if Output_ALI_List then + if ALI_List_Filename /= null then + Set_List_File (ALI_List_Filename.all); + end if; + + for Index in ALIs.First .. ALIs.Last loop + declare + Full_Afile : constant File_Name_Type := + Find_File (ALIs.Table (Index).Afile, Library); + begin + Write_Name (Full_Afile); + Write_Eol; + end; + end loop; + + if ALI_List_Filename /= null then + Close_List_File; + end if; + end if; + -- Build source file table from the ALI files we have read in Set_Source_Table; *************** begin *** 757,764 **** and then ALIs.Table (ALIs.First).Main_Program = None and then not No_Main_Subprogram then ! Error_Msg_File_1 := Main_Lib_File; ! Error_Msg ("{ does not contain a unit that can be a main program"); end if; -- Perform consistency and correctness checks --- 795,814 ---- and then ALIs.Table (ALIs.First).Main_Program = None and then not No_Main_Subprogram then ! Get_Name_String ! (Units.Table (ALIs.Table (ALIs.First).First_Unit).Uname); ! ! declare ! Unit_Name : String := Name_Buffer (1 .. Name_Len - 2); ! begin ! To_Mixed (Unit_Name); ! Get_Name_String (ALIs.Table (ALIs.First).Sfile); ! Add_Str_To_Name_Buffer (":1: "); ! Add_Str_To_Name_Buffer (Unit_Name); ! Add_Str_To_Name_Buffer (" cannot be used as a main program"); ! Write_Line (Name_Buffer (1 .. Name_Len)); ! Errors_Detected := Errors_Detected + 1; ! end; end if; -- Perform consistency and correctness checks *************** begin *** 814,868 **** -- sources) if -R was used. if List_Closure then ! if not Zero_Formatting then ! Write_Eol; ! Write_Str ("REFERENCED SOURCES"); ! Write_Eol; ! end if; ! for J in reverse Elab_Order.First .. Elab_Order.Last loop ! -- Do not include the sources of the runtime ! if not Is_Internal_File_Name ! (Units.Table (Elab_Order.Table (J)).Sfile) ! then ! if not Zero_Formatting then ! Write_Str (" "); ! end if; ! Write_Str ! (Get_Name_String ! (Units.Table (Elab_Order.Table (J)).Sfile)); Write_Eol; end if; - end loop; ! -- Subunits do not appear in the elaboration table because they ! -- are subsumed by their parent units, but we need to list them ! -- for other tools. For now they are listed after other files, ! -- rather than right after their parent, since there is no easy ! -- link between the elaboration table and the ALIs table ??? ! -- Note also that subunits may appear repeatedly in the list, ! -- if the parent unit appears in the context of several units ! -- in the closure. ! for J in Sdep.First .. Sdep.Last loop ! if Sdep.Table (J).Subunit_Name /= No_Name ! and then not Is_Internal_File_Name (Sdep.Table (J).Sfile) ! then ! if not Zero_Formatting then ! Write_Str (" "); end if; ! Write_Str (Get_Name_String (Sdep.Table (J).Sfile)); Write_Eol; end if; ! end loop; ! ! if not Zero_Formatting then ! Write_Eol; ! end if; end if; end if; end if; --- 864,953 ---- -- sources) if -R was used. if List_Closure then ! List_Closure_Display : declare ! Source : File_Name_Type; ! function Put_In_Sources (S : File_Name_Type) return Boolean; ! -- Check if S is already in table Sources and put in Sources ! -- if it is not. Return False if the source is already in ! -- Sources, and True if it is added. ! -------------------- ! -- Put_In_Sources -- ! -------------------- ! function Put_In_Sources (S : File_Name_Type) ! return Boolean ! is ! begin ! for J in 1 .. Closure_Sources.Last loop ! if Closure_Sources.Table (J) = S then ! return False; ! end if; ! end loop; ! Closure_Sources.Append (S); ! return True; ! end Put_In_Sources; ! ! -- Start of processing for List_Closure_Display ! ! begin ! Closure_Sources.Init; ! ! if not Zero_Formatting then ! Write_Eol; ! Write_Str ("REFERENCED SOURCES"); Write_Eol; end if; ! for J in reverse Elab_Order.First .. Elab_Order.Last loop ! Source := Units.Table (Elab_Order.Table (J)).Sfile; ! -- Do not include the sources of the runtime and do not ! -- include the same source several times. ! ! if Put_In_Sources (Source) ! and then not Is_Internal_File_Name (Source) ! then ! if not Zero_Formatting then ! Write_Str (" "); ! end if; ! ! Write_Str (Get_Name_String (Source)); ! Write_Eol; end if; + end loop; ! -- Subunits do not appear in the elaboration table because ! -- they are subsumed by their parent units, but we need to ! -- list them for other tools. For now they are listed after ! -- other files, rather than right after their parent, since ! -- there is no easy link between the elaboration table and ! -- the ALIs table ??? As subunits may appear repeatedly in ! -- the list, if the parent unit appears in the context of ! -- several units in the closure, duplicates are suppressed. ! ! for J in Sdep.First .. Sdep.Last loop ! Source := Sdep.Table (J).Sfile; ! ! if Sdep.Table (J).Subunit_Name /= No_Name ! and then Put_In_Sources (Source) ! and then not Is_Internal_File_Name (Source) ! then ! if not Zero_Formatting then ! Write_Str (" "); ! end if; ! ! Write_Str (Get_Name_String (Source)); ! Write_Eol; ! end if; ! end loop; ! ! if not Zero_Formatting then Write_Eol; end if; ! end List_Closure_Display; end if; end if; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/gnatcmd.adb gcc-4.6.0/gcc/ada/gnatcmd.adb *** gcc-4.5.2/gcc/ada/gnatcmd.adb Wed Jan 27 13:29:52 2010 --- gcc-4.6.0/gcc/ada/gnatcmd.adb Tue Oct 12 12:58:32 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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,31 **** --- 26,32 ---- with GNAT.Directory_Operations; use GNAT.Directory_Operations; with Csets; + with Hostparm; use Hostparm; with Makeutl; use Makeutl; with MLib.Tgt; use MLib.Tgt; with MLib.Utl; *************** with Table; *** 46,61 **** with Targparm; with Tempdir; with Types; use Types; ! with Hostparm; use Hostparm; ! -- Used to determine if we are in VMS or not for error message purposes with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; ! with GNAT.OS_Lib; use GNAT.OS_Lib; ! ! with VMS_Conv; use VMS_Conv; procedure GNATCmd is Project_Node_Tree : Project_Node_Tree_Ref; --- 47,60 ---- with Targparm; with Tempdir; with Types; use Types; ! with VMS_Conv; use VMS_Conv; ! with VMS_Cmds; use VMS_Cmds; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; ! with GNAT.OS_Lib; use GNAT.OS_Lib; procedure GNATCmd is Project_Node_Tree : Project_Node_Tree_Ref; *************** procedure GNATCmd is *** 122,127 **** --- 121,127 ---- Naming_String : constant SA := new String'("naming"); Binder_String : constant SA := new String'("binder"); + Builder_String : constant SA := new String'("builder"); Compiler_String : constant SA := new String'("compiler"); Check_String : constant SA := new String'("check"); Synchronize_String : constant SA := new String'("synchronize"); *************** procedure GNATCmd is *** 139,145 **** new String_List'((Naming_String, Binder_String)); Packages_To_Check_By_Check : constant String_List_Access := ! new String_List'((Naming_String, Check_String, Compiler_String)); Packages_To_Check_By_Sync : constant String_List_Access := new String_List'((Naming_String, Synchronize_String, Compiler_String)); --- 139,146 ---- new String_List'((Naming_String, Binder_String)); Packages_To_Check_By_Check : constant String_List_Access := ! new String_List' ! ((Naming_String, Builder_String, Check_String, Compiler_String)); Packages_To_Check_By_Sync : constant String_List_Access := new String_List'((Naming_String, Synchronize_String, Compiler_String)); *************** procedure GNATCmd is *** 209,217 **** procedure Check_Files; -- For GNAT LIST, GNAT PRETTY, GNAT METRIC, and GNAT STACK, check if a ! -- project file is specified, without any file arguments. If it is the ! -- case, invoke the GNAT tool with the proper list of files, derived from ! -- the sources of the project. function Check_Project (Project : Project_Id; --- 210,218 ---- procedure Check_Files; -- For GNAT LIST, GNAT PRETTY, GNAT METRIC, and GNAT STACK, check if a ! -- project file is specified, without any file arguments and without a ! -- switch -files=. If it is the case, invoke the GNAT tool with the proper ! -- list of files, derived from the sources of the project. function Check_Project (Project : Project_Id; *************** procedure GNATCmd is *** 232,237 **** --- 233,243 ---- -- STUB), gnatpp (GNAT PRETTY), gnatelim (GNAT ELIM), and gnatmetric (GNAT -- METRIC). + function Mapping_File return Path_Name_Type; + -- Create and return the path name of a mapping file. Used for gnatstub + -- (GNAT STUB), gnatpp (GNAT PRETTY), gnatelim (GNAT ELIM), and gnatmetric + -- (GNAT METRIC). + procedure Delete_Temp_Config_Files; -- Delete all temporary config files. The caller is responsible for -- ensuring that Keep_Temporary_Files is False. *************** procedure GNATCmd is *** 313,333 **** Status : Integer; Success : Boolean; begin ! -- Check if there is at least one argument that is not a switch for Index in 1 .. Last_Switches.Last loop ! if Last_Switches.Table (Index) (1) /= '-' then if Index = 1 or else (The_Command = Check ! and then ! Last_Switches.Table (Index - 1).all /= "-o") or else (The_Command = Pretty ! and then ! Last_Switches.Table (Index - 1).all /= "-o" and then ! Last_Switches.Table (Index - 1).all /= "-of") or else (The_Command = Metric and then --- 319,388 ---- Status : Integer; Success : Boolean; + procedure Add_To_Response_File + (File_Name : String; + Check_File : Boolean := True); + -- Include the file name passed as parameter in the response file for + -- the tool being called. If the response file can not be written then + -- the file name is passed in the parameter list of the tool. If the + -- Check_File parameter is True then the procedure verifies the + -- existence of the file before adding it to the response file. + + -------------------------- + -- Add_To_Response_File -- + -------------------------- + + procedure Add_To_Response_File + (File_Name : String; + Check_File : Boolean := True) + is + begin + Name_Len := 0; + + Add_Str_To_Name_Buffer (File_Name); + + if not Check_File or else + Is_Regular_File (Name_Buffer (1 .. Name_Len)) + then + if FD /= Invalid_FD then + Name_Len := Name_Len + 1; + Name_Buffer (Name_Len) := ASCII.LF; + + Status := Write (FD, Name_Buffer (1)'Address, Name_Len); + + if Status /= Name_Len then + Osint.Fail ("disk full"); + end if; + else + Last_Switches.Increment_Last; + Last_Switches.Table (Last_Switches.Last) := + new String'(File_Name); + end if; + end if; + end Add_To_Response_File; + + -- Start of processing for Check_Files + begin ! -- Check if there is at least one argument that is not a switch or if ! -- there is a -files= switch. for Index in 1 .. Last_Switches.Last loop ! if Last_Switches.Table (Index).all'Length > 7 ! and then Last_Switches.Table (Index) (1 .. 7) = "-files=" ! then ! Add_Sources := False; ! exit; ! ! elsif Last_Switches.Table (Index) (1) /= '-' then if Index = 1 or else (The_Command = Check ! and then Last_Switches.Table (Index - 1).all /= "-o") or else (The_Command = Pretty ! and then Last_Switches.Table (Index - 1).all /= "-o" ! and then Last_Switches.Table (Index - 1).all /= "-of") or else (The_Command = Metric and then *************** procedure GNATCmd is *** 346,362 **** end if; end loop; ! -- If all arguments were switches, add the path names of all the sources ! -- of the main project. if Add_Sources then ! -- For gnatcheck, gnatpp and gnatmetric , create a temporary file and ! -- put the list of sources in it. if The_Command = Check or else The_Command = Pretty or else ! The_Command = Metric then Tempdir.Create_Temp_File (FD, Temp_File_Name); Last_Switches.Increment_Last; --- 401,419 ---- end if; end loop; ! -- If all arguments are switches and there is no switch -files=, add ! -- the path names of all the sources of the main project. if Add_Sources then ! -- For gnatcheck, gnatpp, and gnatmetric, create a temporary file ! -- and put the list of sources in it. For gnatstack create a ! -- temporary file with the list of .ci files. if The_Command = Check or else The_Command = Pretty or else ! The_Command = Metric or else ! The_Command = Stack then Tempdir.Create_Temp_File (FD, Temp_File_Name); Last_Switches.Increment_Last; *************** procedure GNATCmd is *** 378,404 **** if Check_Project (Proj.Project, Project) then declare Main : String_List_Id; - File : String_Access; begin -- Include binder generated files for main programs Main := Proj.Project.Mains; while Main /= Nil_String loop ! File := ! new String' ! (Get_Name_String ! (Proj.Project.Object_Directory.Name) & ! B_Start.all & ! MLib.Fil.Ext_To ! (Get_Name_String ! (Project_Tree.String_Elements.Table ! (Main).Value), ! "ci")); ! if Is_Regular_File (File.all) then ! Last_Switches.Increment_Last; ! Last_Switches.Table (Last_Switches.Last) := File; end if; Main := --- 435,473 ---- if Check_Project (Proj.Project, Project) then declare Main : String_List_Id; begin -- Include binder generated files for main programs Main := Proj.Project.Mains; while Main /= Nil_String loop ! Add_To_Response_File ! (Get_Name_String ! (Proj.Project.Object_Directory.Name) & ! B_Start.all & ! MLib.Fil.Ext_To ! (Get_Name_String ! (Project_Tree.String_Elements.Table ! (Main).Value), ! "ci")); ! -- When looking for the .ci file for a binder ! -- generated file, look for both b~xxx and b__xxx ! -- as gprbuild always uses b__ as the prefix of ! -- such files. ! ! if not Is_Regular_File (Name_Buffer (1 .. Name_Len)) ! and then B_Start.all /= "b__" ! then ! Add_To_Response_File ! (Get_Name_String ! (Proj.Project.Object_Directory.Name) & ! "b__" & ! MLib.Fil.Ext_To ! (Get_Name_String ! (Project_Tree.String_Elements.Table ! (Main).Value), ! "ci")); end if; Main := *************** procedure GNATCmd is *** 411,427 **** -- files that contains the initialization and -- finalization of the library. ! File := ! new String' ! (Get_Name_String ! (Proj.Project.Object_Directory.Name) & ! B_Start.all & ! Get_Name_String (Proj.Project.Library_Name) & ! ".ci"); ! if Is_Regular_File (File.all) then ! Last_Switches.Increment_Last; ! Last_Switches.Table (Last_Switches.Last) := File; end if; end if; end; --- 480,506 ---- -- files that contains the initialization and -- finalization of the library. ! Add_To_Response_File ! (Get_Name_String ! (Proj.Project.Object_Directory.Name) & ! B_Start.all & ! Get_Name_String (Proj.Project.Library_Name) & ! ".ci"); ! -- When looking for the .ci file for a binder ! -- generated file, look for both b~xxx and b__xxx ! -- as gprbuild always uses b__ as the prefix of ! -- such files. ! ! if not Is_Regular_File (Name_Buffer (1 .. Name_Len)) ! and then B_Start.all /= "b__" ! then ! Add_To_Response_File ! (Get_Name_String ! (Proj.Project.Object_Directory.Name) & ! "b__" & ! Get_Name_String (Proj.Project.Library_Name) & ! ".ci"); end if; end if; end; *************** procedure GNATCmd is *** 443,450 **** then -- There is a body, check if it is for this project ! if All_Projects or else ! Unit.File_Names (Impl).Project = Project then Subunit := False; --- 522,529 ---- then -- There is a body, check if it is for this project ! if All_Projects ! or else Unit.File_Names (Impl).Project = Project then Subunit := False; *************** procedure GNATCmd is *** 530,545 **** end if; if not Subunit then ! Last_Switches.Increment_Last; ! Last_Switches.Table (Last_Switches.Last) := ! new String' ! (Get_Name_String ! (Unit.File_Names ! (Impl).Project. Object_Directory.Name) & ! MLib.Fil.Ext_To ! (Get_Name_String ! (Unit.File_Names (Impl).Display_File), ! "ci")); end if; end if; --- 609,622 ---- end if; if not Subunit then ! Add_To_Response_File ! (Get_Name_String ! (Unit.File_Names ! (Impl).Project. Object_Directory.Name) & ! MLib.Fil.Ext_To ! (Get_Name_String ! (Unit.File_Names (Impl).Display_File), ! "ci")); end if; end if; *************** procedure GNATCmd is *** 551,566 **** if Check_Project (Unit.File_Names (Spec).Project, Project) then ! Last_Switches.Increment_Last; ! Last_Switches.Table (Last_Switches.Last) := ! new String' ! (Get_Name_String ! (Unit.File_Names ! (Spec).Project. Object_Directory.Name) & ! Dir_Separator & ! MLib.Fil.Ext_To ! (Get_Name_String (Unit.File_Names (Spec).File), ! "ci")); end if; end if; --- 628,641 ---- if Check_Project (Unit.File_Names (Spec).Project, Project) then ! Add_To_Response_File ! (Get_Name_String ! (Unit.File_Names ! (Spec).Project. Object_Directory.Name) & ! Dir_Separator & ! MLib.Fil.Ext_To ! (Get_Name_String (Unit.File_Names (Spec).File), ! "ci")); end if; end if; *************** procedure GNATCmd is *** 575,604 **** (Unit.File_Names (Kind).Project, Project) and then not Unit.File_Names (Kind).Locally_Removed then ! Name_Len := 0; ! Add_Char_To_Name_Buffer ('"'); ! Add_Str_To_Name_Buffer ! (Get_Name_String ! (Unit.File_Names (Kind).Path.Display_Name)); ! Add_Char_To_Name_Buffer ('"'); ! ! if FD /= Invalid_FD then ! Name_Len := Name_Len + 1; ! Name_Buffer (Name_Len) := ASCII.LF; ! Status := ! Write (FD, Name_Buffer (1)'Address, Name_Len); ! ! if Status /= Name_Len then ! Osint.Fail ("disk full"); ! end if; ! ! else ! Last_Switches.Increment_Last; ! Last_Switches.Table (Last_Switches.Last) := ! new String'(Get_Name_String ! (Unit.File_Names ! (Kind).Path.Display_Name)); ! end if; end if; end loop; end if; --- 650,661 ---- (Unit.File_Names (Kind).Project, Project) and then not Unit.File_Names (Kind).Locally_Removed then ! Add_To_Response_File ! ("""" & ! Get_Name_String ! (Unit.File_Names (Kind).Path.Display_Name) & ! """", ! Check_File => False); end if; end loop; end if; *************** procedure GNATCmd is *** 794,801 **** Return_Code => Return_Code, Err_To_Out => True); - Close (FD); - -- Read the output of the invocation of gnatmake Open (File, In_File, Get_Name_String (Name)); --- 851,856 ---- *************** procedure GNATCmd is *** 883,888 **** --- 938,958 ---- end Index; ------------------ + -- Mapping_File -- + ------------------ + + function Mapping_File return Path_Name_Type is + Result : Path_Name_Type; + begin + Prj.Env.Create_Mapping_File + (Project => Project, + Language => Name_Ada, + In_Tree => Project_Tree, + Name => Result); + return Result; + end Mapping_File; + + ------------------ -- Process_Link -- ------------------ *************** procedure GNATCmd is *** 1056,1063 **** -- Append ".ali" if file name does not end with it if Switch'Length <= 4 ! or else Switch (Switch'Last - 3 .. Switch'Last) ! /= ".ali" then Last := ALI_File'Last; end if; --- 1126,1132 ---- -- Append ".ali" if file name does not end with it if Switch'Length <= 4 ! or else Switch (Switch'Last - 3 .. Switch'Last) /= ".ali" then Last := ALI_File'Last; end if; *************** procedure GNATCmd is *** 1070,1077 **** else for K in Switch'Range loop ! if Switch (K) = '/' or else ! Switch (K) = Directory_Separator then Test_Existence := True; exit; --- 1139,1146 ---- else for K in Switch'Range loop ! if Switch (K) = '/' ! or else Switch (K) = Directory_Separator then Test_Existence := True; exit; *************** procedure GNATCmd is *** 1245,1251 **** New_Line; for C in Command_List'Range loop ! if not Command_List (C).VMS_Only then if Targparm.AAMP_On_Target then Put ("gnaampcmd "); else --- 1314,1323 ---- New_Line; for C in Command_List'Range loop ! ! -- No usage for VMS only command or for Sync ! ! if not Command_List (C).VMS_Only and then C /= Sync then if Targparm.AAMP_On_Target then Put ("gnaampcmd "); else *************** procedure GNATCmd is *** 1279,1285 **** end loop; New_Line; ! Put_Line ("Commands find, list, metric, pretty, stack, stub and xref " & "accept project file switches -vPx, -Pprj and -Xnam=val"); New_Line; end Non_VMS_Usage; --- 1351,1357 ---- end loop; New_Line; ! Put_Line ("All commands except chop, krunch and preprocess " & "accept project file switches -vPx, -Pprj and -Xnam=val"); New_Line; end Non_VMS_Usage; *************** procedure GNATCmd is *** 1291,1299 **** begin -- Initializations - Namet.Initialize; Csets.Initialize; - Snames.Initialize; Project_Node_Tree := new Project_Node_Tree_Data; --- 1363,1369 ---- *************** begin *** 1323,1328 **** --- 1393,1411 ---- Targparm.Get_Target_Parameters; + -- Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE, + -- so that the spawned tool may know the way the GNAT driver was invoked. + + Name_Len := 0; + Add_Str_To_Name_Buffer (Command_Name); + + for J in 1 .. Argument_Count loop + Add_Char_To_Name_Buffer (' '); + Add_Str_To_Name_Buffer (Argument (J)); + end loop; + + Setenv ("GNAT_DRIVER_COMMAND_LINE", Name_Buffer (1 .. Name_Len)); + -- 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. *************** begin *** 1499,1504 **** --- 1582,1596 ---- Program_Name (Command_List (The_Command).Unixcmd.all, "gnat"); end if; + -- For the tools where the GNAT driver processes the project files, + -- allow shared library projects to import projects that are not shared + -- library projects, to avoid adding a switch for these tools. For the + -- builder (gnatmake), if a shared library project imports a project + -- that is not a shared library project and the appropriate switch is + -- not specified, the invocation of gnatmake will fail. + + Opt.Unchecked_Shared_Lib_Imports := True; + -- Locate the executable for the command Exec_Path := Locate_Exec_On_Path (Program.all); *************** begin *** 1611,1621 **** -- --subdirs=... Specify Subdirs ! if Argv'Length > Makeutl.Subdirs_Option'Length and then ! Argv ! (Argv'First .. ! Argv'First + Makeutl.Subdirs_Option'Length - 1) = ! Makeutl.Subdirs_Option then Subdirs := new String' --- 1703,1714 ---- -- --subdirs=... Specify Subdirs ! if Argv'Length > Makeutl.Subdirs_Option'Length ! and then ! Argv ! (Argv'First .. ! Argv'First + Makeutl.Subdirs_Option'Length - 1) = ! Makeutl.Subdirs_Option then Subdirs := new String' *************** begin *** 1630,1637 **** elsif Argv'Length > 3 and then Argv (Argv'First + 1 .. Argv'First + 2) = "aP" then ! Add_Search_Project_Directory ! (Project_Node_Tree, Argv (Argv'First + 3 .. Argv'Last)); Remove_Switch (Arg_Num); --- 1723,1731 ---- elsif Argv'Length > 3 and then Argv (Argv'First + 1 .. Argv'First + 2) = "aP" then ! Prj.Env.Add_Directories ! (Project_Node_Tree.Project_Path, ! Argv (Argv'First + 3 .. Argv'Last)); Remove_Switch (Arg_Num); *************** begin *** 1724,1731 **** ('=', Argv (Argv'First + 2 .. Argv'Last)); begin ! if Equal_Pos >= Argv'First + 3 and then ! Equal_Pos /= Argv'Last then Add (Project_Node_Tree, External_Name => Argv (Argv'First + 2 .. Equal_Pos - 1), --- 1818,1826 ---- ('=', Argv (Argv'First + 2 .. Argv'Last)); begin ! if Equal_Pos >= Argv'First + 3 ! and then Equal_Pos /= Argv'Last ! then Add (Project_Node_Tree, External_Name => Argv (Argv'First + 2 .. Equal_Pos - 1), *************** begin *** 1927,1933 **** end if; end; ! if The_Command = Bind or else The_Command = Link or else The_Command = Elim then --- 2022,2028 ---- end if; end; ! if The_Command = Bind or else The_Command = Link or else The_Command = Elim then *************** begin *** 1942,1948 **** -- For gnatcheck, gnatstub, gnatmetric, gnatpp and gnatelim, create -- a configuration pragmas file, if necessary. ! if The_Command = Pretty or else The_Command = Metric or else The_Command = Stub or else The_Command = Elim --- 2037,2043 ---- -- For gnatcheck, gnatstub, gnatmetric, gnatpp and gnatelim, create -- a configuration pragmas file, if necessary. ! if The_Command = Pretty or else The_Command = Metric or else The_Command = Stub or else The_Command = Elim *************** begin *** 2080,2086 **** while K <= First_Switches.Last and then (The_Command /= Check ! or else First_Switches.Table (K).all /= "-rules") loop Add_To_Carg_Switches (First_Switches.Table (K)); K := K + 1; --- 2175,2181 ---- while K <= First_Switches.Last and then (The_Command /= Check ! or else First_Switches.Table (K).all /= "-rules") loop Add_To_Carg_Switches (First_Switches.Table (K)); K := K + 1; *************** begin *** 2120,2127 **** while K <= Last_Switches.Last and then (The_Command /= Check ! or else ! Last_Switches.Table (K).all /= "-rules") loop Add_To_Carg_Switches (Last_Switches.Table (K)); K := K + 1; --- 2215,2221 ---- while K <= Last_Switches.Last and then (The_Command /= Check ! or else Last_Switches.Table (K).all /= "-rules") loop Add_To_Carg_Switches (Last_Switches.Table (K)); K := K + 1; *************** begin *** 2149,2154 **** --- 2243,2249 ---- declare CP_File : constant Path_Name_Type := Configuration_Pragmas_File; + M_File : constant Path_Name_Type := Mapping_File; begin if CP_File /= No_Path then *************** begin *** 2162,2167 **** --- 2257,2351 ---- (new String'("-gnatec=" & Get_Name_String (CP_File))); end if; end if; + + if M_File /= No_Path then + Add_To_Carg_Switches + (new String'("-gnatem=" & Get_Name_String (M_File))); + end if; + + -- For gnatcheck, also indicate a global configuration pragmas + -- file and, if -U is not used, a local one. + + if The_Command = Check then + declare + Pkg : constant Prj.Package_Id := + Prj.Util.Value_Of + (Name => Name_Builder, + In_Packages => Project.Decl.Packages, + In_Tree => Project_Tree); + + Variable : Variable_Value := + Prj.Util.Value_Of + (Name => No_Name, + Attribute_Or_Array_Name => + Name_Global_Configuration_Pragmas, + In_Package => Pkg, + In_Tree => Project_Tree); + + begin + if (Variable = Nil_Variable_Value + or else Length_Of_Name (Variable.Value) = 0) + and then Pkg /= No_Package + then + Variable := + Prj.Util.Value_Of + (Name => Name_Ada, + Attribute_Or_Array_Name => + Name_Global_Config_File, + In_Package => Pkg, + In_Tree => Project_Tree); + end if; + + if Variable /= Nil_Variable_Value + and then Length_Of_Name (Variable.Value) /= 0 + then + Add_To_Carg_Switches + (new String' + ("-gnatec=" & Get_Name_String (Variable.Value))); + end if; + end; + + if not All_Projects then + declare + Pkg : constant Prj.Package_Id := + Prj.Util.Value_Of + (Name => Name_Compiler, + In_Packages => Project.Decl.Packages, + In_Tree => Project_Tree); + + Variable : Variable_Value := + Prj.Util.Value_Of + (Name => No_Name, + Attribute_Or_Array_Name => + Name_Local_Configuration_Pragmas, + In_Package => Pkg, + In_Tree => Project_Tree); + + begin + if (Variable = Nil_Variable_Value + or else Length_Of_Name (Variable.Value) = 0) + and then Pkg /= No_Package + then + Variable := + Prj.Util.Value_Of + (Name => Name_Ada, + Attribute_Or_Array_Name => + Name_Local_Config_File, + In_Package => Pkg, + In_Tree => Project_Tree); + end if; + + if Variable /= Nil_Variable_Value + and then Length_Of_Name (Variable.Value) /= 0 + then + Add_To_Carg_Switches + (new String' + ("-gnatec=" & + Get_Name_String (Variable.Value))); + end if; + end; + end if; + end if; end; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/gnathtml.pl gcc-4.6.0/gcc/ada/gnathtml.pl *** gcc-4.5.2/gcc/ada/gnathtml.pl Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/gnathtml.pl Sun May 2 16:56:05 2010 *************** EOF *** 1090,1098 **** local ($index_file) = 0; ! mkdir ($output_dir, 0777) if (! -d $output_dir); ! mkdir ($output_dir."/files", 0777) if (! -d $output_dir."/files"); ! mkdir ($output_dir."/funcs", 0777) if (! -d $output_dir."/funcs"); &parse_prj_file ($prjfile) if ($prjfile); --- 1090,1098 ---- local ($index_file) = 0; ! mkdir ($output_dir, 0755) if (! -d $output_dir); ! mkdir ($output_dir."/files", 0755) if (! -d $output_dir."/files"); ! mkdir ($output_dir."/funcs", 0755) if (! -d $output_dir."/funcs"); &parse_prj_file ($prjfile) if ($prjfile); diff -Nrcpad gcc-4.5.2/gcc/ada/gnatlbr.adb gcc-4.6.0/gcc/ada/gnatlbr.adb *** gcc-4.5.2/gcc/ada/gnatlbr.adb Tue Apr 8 06:44:39 2008 --- gcc-4.6.0/gcc/ada/gnatlbr.adb Thu Jan 1 00:00:00 1970 *************** *** 1,346 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T L B R -- - -- -- - -- B o d y -- - -- -- - -- 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- -- - -- 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. -- - -- -- - ------------------------------------------------------------------------------ - - -- Program to create, set, or delete an alternate runtime library - - -- Works by calling an appropriate target specific Makefile residing - -- in the default library object (e.g. adalib) directory from the context - -- of the new library objects directory. - - -- Command line arguments are: - -- 1st: --[create | set | delete]= - -- --create : Build a library - -- --set : Set environment variables to point to a library - -- --delete : Delete a library - - -- 2nd: --config= - -- A -gnatg valid file containing desired configuration pragmas - - -- This program is currently used only on Alpha/VMS - - with Ada.Command_Line; use Ada.Command_Line; - with Ada.Text_IO; use Ada.Text_IO; - with GNAT.OS_Lib; use GNAT.OS_Lib; - with Gnatvsn; use Gnatvsn; - with Interfaces.C_Streams; use Interfaces.C_Streams; - with Osint; use Osint; - with System; - - procedure GnatLbr is - pragma Ident (Gnat_Static_Version_String); - - type Lib_Mode is (None, Create, Set, Delete); - Next_Arg : Integer; - Mode : Lib_Mode := None; - ADC_File : String_Access := null; - Lib_Dir : String_Access := null; - Make : constant String := "make"; - Make_Path : String_Access; - - procedure Create_Directory (Name : System.Address; Mode : Integer); - pragma Import (C, Create_Directory, "decc$mkdir"); - - begin - if Argument_Count = 0 then - Put ("Usage: "); - Put_Line - ("gnatlbr --[create|set|delete]= [--config=]"); - Exit_Program (E_Fatal); - end if; - - Next_Arg := 1; - - loop - exit when Next_Arg > Argument_Count; - - Process_One_Arg : declare - Arg : constant String := Argument (Next_Arg); - - begin - if Arg'Length > 9 and then Arg (1 .. 9) = "--create=" then - if Mode = None then - Mode := Create; - Lib_Dir := new String'(Arg (10 .. Arg'Last)); - else - Put_Line (Standard_Error, "Error: Multiple modes specified"); - Exit_Program (E_Fatal); - end if; - - elsif Arg'Length > 6 and then Arg (1 .. 6) = "--set=" then - if Mode = None then - Mode := Set; - Lib_Dir := new String'(Arg (7 .. Arg'Last)); - else - Put_Line (Standard_Error, "Error: Multiple modes specified"); - Exit_Program (E_Fatal); - end if; - - elsif Arg'Length > 9 and then Arg (1 .. 9) = "--delete=" then - if Mode = None then - Mode := Delete; - Lib_Dir := new String'(Arg (10 .. Arg'Last)); - else - Put_Line (Standard_Error, "Error: Multiple modes specified"); - Exit_Program (E_Fatal); - end if; - - elsif Arg'Length > 9 and then Arg (1 .. 9) = "--config=" then - if ADC_File /= null then - Put_Line (Standard_Error, - "Error: Multiple gnat.adc files specified"); - Exit_Program (E_Fatal); - end if; - - ADC_File := new String'(Arg (10 .. Arg'Last)); - - else - Put_Line (Standard_Error, "Error: Unrecognized option: " & Arg); - Exit_Program (E_Fatal); - - end if; - end Process_One_Arg; - - Next_Arg := Next_Arg + 1; - end loop; - - case Mode is - when Create => - - -- Validate arguments - - if Lib_Dir = null then - Put_Line (Standard_Error, "Error: No library directory specified"); - Exit_Program (E_Fatal); - end if; - - if Is_Directory (Lib_Dir.all) then - Put_Line (Standard_Error, - "Error:" & Lib_Dir.all & " already exists"); - Exit_Program (E_Fatal); - end if; - - if ADC_File = null then - Put_Line (Standard_Error, - "Error: No configuration file specified"); - Exit_Program (E_Fatal); - end if; - - if not Is_Regular_File (ADC_File.all) then - Put_Line (Standard_Error, - "Error: " & ADC_File.all & " doesn't exist"); - Exit_Program (E_Fatal); - end if; - - 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; - F_ADC_File : String (1 .. max_path_len); - F_ADC_File_Len : Integer := max_path_len; - Include_Dirs : Integer; - Object_Dirs : Integer; - Include_Dir : array (Integer range 1 .. 256) of String_Access; - Object_Dir : array (Integer range 1 .. 256) of String_Access; - Include_Dir_Name : String_Access; - Object_Dir_Name : String_Access; - - begin - -- Create the new top level library directory - - if not Is_Directory (Lib_Dir.all) then - Create_Directory (C_Lib_Dir'Address, 8#755#); - end if; - - 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 - F_ADC_File_Len := I - 1; - exit; - end if; - end loop; - - -- - -- Make a list of the default library source and object - -- directories. Usually only one, except on VMS where - -- there are two. - -- - Include_Dirs := 0; - Include_Dir_Name := new String'(Include_Dir_Default_Prefix); - Get_Next_Dir_In_Path_Init (Include_Dir_Name); - - loop - declare - Dir : constant String_Access := String_Access - (Get_Next_Dir_In_Path (Include_Dir_Name)); - begin - exit when Dir = null; - Include_Dirs := Include_Dirs + 1; - Include_Dir (Include_Dirs) := - String_Access (Normalize_Directory_Name (Dir.all)); - end; - end loop; - - Object_Dirs := 0; - Object_Dir_Name := new String'(Object_Dir_Default_Prefix); - Get_Next_Dir_In_Path_Init (Object_Dir_Name); - - loop - declare - Dir : constant String_Access := - String_Access - (Get_Next_Dir_In_Path (Object_Dir_Name)); - begin - exit when Dir = null; - Object_Dirs := Object_Dirs + 1; - Object_Dir (Object_Dirs) - := String_Access (Normalize_Directory_Name (Dir.all)); - end; - end loop; - - -- "Make" an alternate sublibrary for each default sublibrary - - for Dirs in 1 .. Object_Dirs loop - Make_Args (1) := - new String'("-C"); - - Make_Args (2) := - new String'(Lib_Dir.all); - - -- Resolve /gnu on VMS by converting to host format and then - -- convert resolved path back to canonical format for the - -- make program. This fixes the problem that can occur when - -- GNU: is a search path pointing to multiple versions of GNAT. - - Make_Args (3) := - new String'("ADA_INCLUDE_PATH=" & - To_Canonical_Dir_Spec - (To_Host_Dir_Spec - (Include_Dir (Dirs).all, True).all, True).all); - - Make_Args (4) := - new String'("ADA_OBJECTS_PATH=" & - To_Canonical_Dir_Spec - (To_Host_Dir_Spec - (Object_Dir (Dirs).all, True).all, True).all); - - Make_Args (5) := - new String'("GNAT_ADC_FILE=" - & F_ADC_File (1 .. F_ADC_File_Len)); - - Make_Args (6) := - new String'("LIBRARY_VERSION=" & '"' & - Verbose_Library_Version & '"'); - - Make_Args (7) := - new String'("-f"); - - Make_Args (8) := - new String'(Object_Dir (Dirs).all & "Makefile.lib"); - - Make_Args (9) := - new String'("create"); - - Make_Path := Locate_Exec_On_Path (Make); - Put (Make); - - for J in 1 .. Make_Args'Last loop - Put (" "); - Put (Make_Args (J).all); - end loop; - - New_Line; - Spawn (Make_Path.all, Make_Args, Success); - - if not Success then - Put_Line (Standard_Error, "Error: Make failed"); - Exit_Program (E_Fatal); - end if; - end loop; - end Create_Block; - - when Set => - - -- Validate arguments - - if Lib_Dir = null then - Put_Line (Standard_Error, - "Error: No library directory specified"); - Exit_Program (E_Fatal); - end if; - - if not Is_Directory (Lib_Dir.all) then - Put_Line (Standard_Error, - "Error: " & Lib_Dir.all & " doesn't exist"); - Exit_Program (E_Fatal); - end if; - - if ADC_File = null then - Put_Line (Standard_Error, - "Error: No configuration file specified"); - Exit_Program (E_Fatal); - end if; - - if not Is_Regular_File (ADC_File.all) then - Put_Line (Standard_Error, - "Error: " & ADC_File.all & " doesn't exist"); - Exit_Program (E_Fatal); - end if; - - -- Give instructions - - Put_Line ("Copy the contents of " - & ADC_File.all & " into your GNAT.ADC file"); - Put_Line ("and use GNAT Make qualifier /OBJECT_SEARCH=(" - & To_Host_Dir_Spec - (Lib_Dir (Lib_Dir'First .. Lib_Dir'Last) & "/declib", False).all - & "," - & To_Host_Dir_Spec - (Lib_Dir (Lib_Dir'First .. Lib_Dir'Last) & "/adalib", False).all - & ")"); - Put_Line ("or else define ADA_OBJECTS_PATH as " & '"' - & To_Host_Dir_Spec - (Lib_Dir (Lib_Dir'First .. Lib_Dir'Last) & "/declib", False).all - & ',' - & To_Host_Dir_Spec - (Lib_Dir (Lib_Dir'First .. Lib_Dir'Last) & "/adalib", False).all - & '"'); - - when Delete => - - -- Give instructions - - Put_Line ("GNAT Librarian DELETE not yet implemented."); - Put_Line ("Use appropriate system tools to remove library"); - - when None => - Put_Line (Standard_Error, - "Error: No mode (create|set|delete) specified"); - Exit_Program (E_Fatal); - - end case; - - end GnatLbr; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gnatlink.adb gcc-4.6.0/gcc/ada/gnatlink.adb *** gcc-4.5.2/gcc/ada/gnatlink.adb Mon Jan 25 16:24:20 2010 --- gcc-4.6.0/gcc/ada/gnatlink.adb Fri Oct 22 13:51:35 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** with Table; *** 41,50 **** with Targparm; use Targparm; with Types; ! with Ada.Command_Line; use Ada.Command_Line; ! with Ada.Exceptions; use Ada.Exceptions; ! with System.OS_Lib; use System.OS_Lib; with System.CRTL; with Interfaces.C_Streams; use Interfaces.C_Streams; --- 41,50 ---- with Targparm; use Targparm; with Types; ! with Ada.Command_Line; use Ada.Command_Line; ! with Ada.Exceptions; use Ada.Exceptions; ! with System.OS_Lib; use System.OS_Lib; with System.CRTL; with Interfaces.C_Streams; use Interfaces.C_Streams; *************** procedure Gnatlink is *** 159,168 **** -- 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; --- 159,164 ---- *************** procedure Gnatlink is *** 199,204 **** --- 195,207 ---- function Base_Name (File_Name : String) return String; -- Return just the file name part without the extension (if present) + procedure Check_Existing_Executable (File_Name : String); + -- Delete any existing executable to avoid accidentally updating the target + -- of a symbolic link, but produce a Fatail_Error if File_Name matches any + -- of the source file names. This avoids overwriting of extensionless + -- source files by accident on systems where executables do not have + -- extensions. + procedure Delete (Name : String); -- Wrapper to unlink as status is ignored by this application *************** procedure Gnatlink is *** 258,263 **** --- 261,292 ---- return File_Name (Findex1 .. Findex2 - 1); end Base_Name; + ------------------------------- + -- Check_Existing_Executable -- + ------------------------------- + + procedure Check_Existing_Executable (File_Name : String) is + Ename : String := File_Name; + Efile : File_Name_Type; + Sfile : File_Name_Type; + + begin + Canonical_Case_File_Name (Ename); + Name_Len := 0; + Add_Str_To_Name_Buffer (Ename); + Efile := Name_Find; + + for J in Units.Table'First .. Units.Last loop + Sfile := Units.Table (J).Sfile; + if Sfile = Efile then + Exit_With_Error ("executable name """ & File_Name & """ matches " + & "source file name """ & Get_Name_String (Sfile) & """"); + end if; + end loop; + + Delete (File_Name); + end Check_Existing_Executable; + ------------ -- Delete -- ------------ *************** procedure Gnatlink is *** 957,998 **** -- to read from a file instead of the command line is only triggered if -- a conservative threshold is passed. ! 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 --- 986,992 ---- -- to read from a file instead of the command line is only triggered if -- a conservative threshold is passed. ! if Object_List_File_Required or else (Object_List_File_Supported and then Link_Bytes > Link_Max) then *************** procedure Gnatlink is *** 1447,1454 **** Write_Eol; Write_Line (" mainprog.ali the ALI file of the main program"); Write_Eol; - Write_Line (" -A Binder generated source file is in Ada (default)"); - Write_Line (" -C Binder generated source file is in C"); Write_Line (" -f force object file list to be generated"); Write_Line (" -g Compile binder source file with debug information"); Write_Line (" -n Do not compile the binder source file"); --- 1441,1446 ---- *************** begin *** 1539,1545 **** -- Initialize packages to be used - Namet.Initialize; Csets.Initialize; Snames.Initialize; --- 1531,1536 ---- *************** begin *** 1563,1569 **** -- the binder generated file if Compile_Bind_File and then Standard_Gcc then - Initialize_ALI; Name_Len := Ali_File_Name'Length; Name_Buffer (1 .. Name_Len) := Ali_File_Name.all; --- 1554,1559 ---- *************** begin *** 1648,1662 **** Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := new String'("-mrtp"); - - -- Pass -fsjlj to the linker if --RTS=sjlj was passed - - elsif Arg'Length > 9 - and then Arg (Arg'First + 6 .. Arg'First + 9) = "sjlj" - then - Linker_Options.Increment_Last; - Linker_Options.Table (Linker_Options.Last) := - new String'("-fsjlj"); end if; end if; end; --- 1638,1643 ---- *************** begin *** 1716,1722 **** if Linker_Path = null then if VM_Target = CLI_Target then ! Linker_Path := System.OS_Lib.Locate_Exec_On_Path ("ilasm"); if Linker_Path = null then Exit_With_Error ("Couldn't locate ilasm"); --- 1697,1703 ---- if Linker_Path = null then if VM_Target = CLI_Target then ! Linker_Path := System.OS_Lib.Locate_Exec_On_Path ("dotnet-ld"); if Linker_Path = null then Exit_With_Error ("Couldn't locate ilasm"); *************** begin *** 1747,1764 **** & Get_Target_Debuggable_Suffix.all); end if; ! if VM_Target = CLI_Target then ! Linker_Options.Increment_Last; ! Linker_Options.Table (Linker_Options.Last) := new String'("/QUIET"); ! ! Linker_Options.Increment_Last; ! Linker_Options.Table (Linker_Options.Last) := new String'("/DEBUG"); ! ! Linker_Options.Increment_Last; ! Linker_Options.Table (Linker_Options.Last) := ! new String'("/OUTPUT=" & Output_File_Name.all); ! ! elsif RTX_RTSS_Kernel_Module_On_Target then Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := new String'("/OUT:" & Output_File_Name.all); --- 1728,1734 ---- & Get_Target_Debuggable_Suffix.all); end if; ! if RTX_RTSS_Kernel_Module_On_Target then Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := new String'("/OUT:" & Output_File_Name.all); *************** begin *** 1772,1787 **** new String'(Output_File_Name.all); end if; ! -- Delete existing executable, in case it is a symbolic link, to avoid ! -- modifying the target of the symbolic link. ! ! declare ! Dummy : Boolean; ! pragma Unreferenced (Dummy); ! ! begin ! Delete_File (Output_File_Name.all, Dummy); ! end; -- Warn if main program is called "test", as that may be a built-in command -- on Unix. On non-Unix systems executables have a suffix, so the warning --- 1742,1748 ---- new String'(Output_File_Name.all); end if; ! Check_Existing_Executable (Output_File_Name.all); -- Warn if main program is called "test", as that may be a built-in command -- on Unix. On non-Unix systems executables have a suffix, so the warning *************** begin *** 1943,1959 **** IDENT_Op : Boolean := False; begin ! if VM_Target = CLI_Target then ! -- Remove extraneous flags not relevant for CIL. Also remove empty ! -- arguments, since ilasm chokes on them. for J in reverse Linker_Options.First .. Linker_Options.Last loop if Linker_Options.Table (J)'Length = 0 - or else Linker_Options.Table (J) (1 .. 2) = "-L" - or else Linker_Options.Table (J) (1 .. 2) = "-l" or else Linker_Options.Table (J) (1 .. 3) = "-Wl" or else Linker_Options.Table (J) (1 .. 3) = "-sh" or else Linker_Options.Table (J) (1 .. 2) = "-g" then Linker_Options.Table (J .. Linker_Options.Last - 1) := --- 1904,1918 ---- IDENT_Op : Boolean := False; begin ! if AAMP_On_Target then ! -- Remove extraneous flags not relevant for AAMP for J in reverse Linker_Options.First .. Linker_Options.Last loop if Linker_Options.Table (J)'Length = 0 or else Linker_Options.Table (J) (1 .. 3) = "-Wl" or else Linker_Options.Table (J) (1 .. 3) = "-sh" + or else Linker_Options.Table (J) (1 .. 2) = "-O" or else Linker_Options.Table (J) (1 .. 2) = "-g" then Linker_Options.Table (J .. Linker_Options.Last - 1) := *************** begin *** 1971,1980 **** --- 1930,1941 ---- for J in reverse Linker_Options.First .. Linker_Options.Last loop -- Remove flags that are not accepted + if Linker_Options.Table (J)'Length = 0 or else Linker_Options.Table (J) (1 .. 2) = "-l" or else Linker_Options.Table (J) (1 .. 3) = "-Wl" or else Linker_Options.Table (J) (1 .. 3) = "-sh" + or else Linker_Options.Table (J) (1 .. 2) = "-O" or else Linker_Options.Table (J) (1 .. 8) = "-Xlinker" or else Linker_Options.Table (J) (1 .. 9) = "-mthreads" then *************** begin *** 2157,2171 **** -- Remove duplicate IDENTIFICATION directives (VMS) ! if Linker_Options.Table (J)'Length > 27 ! and then Linker_Options.Table (J) (1 .. 28) ! = "--for-linker=IDENTIFICATION=" then if IDENT_Op then Linker_Options.Table (J .. Linker_Options.Last - 1) := Linker_Options.Table (J + 1 .. Linker_Options.Last); Linker_Options.Decrement_Last; Num_Args := Num_Args - 1; else IDENT_Op := True; end if; --- 2118,2133 ---- -- Remove duplicate IDENTIFICATION directives (VMS) ! if Linker_Options.Table (J)'Length > 29 ! and then Linker_Options.Table (J) (1 .. 30) = ! "--for-linker=--identification=" then if IDENT_Op then Linker_Options.Table (J .. Linker_Options.Last - 1) := Linker_Options.Table (J + 1 .. Linker_Options.Last); Linker_Options.Decrement_Last; Num_Args := Num_Args - 1; + else IDENT_Op := True; end if; *************** begin *** 2273,2282 **** 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); --- 2235,2240 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gnatls.adb gcc-4.6.0/gcc/ada/gnatls.adb *** gcc-4.5.2/gcc/ada/gnatls.adb Mon Nov 30 14:15:51 2009 --- gcc-4.6.0/gcc/ada/gnatls.adb Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** procedure Gnatls is *** 1362,1374 **** declare Src_Path_Name : constant String_Ptr := ! String_Ptr ! (Get_RTS_Search_Dir ! (Argv (7 .. Argv'Last), Include)); Lib_Path_Name : constant String_Ptr := ! String_Ptr ! (Get_RTS_Search_Dir ! (Argv (7 .. Argv'Last), Objects)); begin if Src_Path_Name /= null --- 1362,1372 ---- declare Src_Path_Name : constant String_Ptr := ! Get_RTS_Search_Dir ! (Argv (7 .. Argv'Last), Include); Lib_Path_Name : constant String_Ptr := ! Get_RTS_Search_Dir ! (Argv (7 .. Argv'Last), Objects); begin if Src_Path_Name /= null *************** procedure Gnatls is *** 1524,1530 **** begin -- Initialize standard packages - Namet.Initialize; Csets.Initialize; Snames.Initialize; --- 1522,1527 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gnatmem.adb gcc-4.6.0/gcc/ada/gnatmem.adb *** gcc-4.5.2/gcc/ada/gnatmem.adb Tue Apr 8 06:44:39 2008 --- gcc-4.6.0/gcc/ada/gnatmem.adb Thu Jan 1 00:00:00 1970 *************** *** 1,815 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- G N A T M E M -- - -- -- - -- B o d y -- - -- -- - -- 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- -- - -- 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. -- - -- -- - ------------------------------------------------------------------------------ - - -- GNATMEM is a utility that tracks memory leaks. It is based on a simple - -- idea: - - -- - Read the allocation log generated by the application linked using - -- instrumented memory allocation and deallocation (see memtrack.adb for - -- this circuitry). To get access to this functionality, the application - -- must be relinked with library libgmem.a: - - -- $ gnatmake my_prog -largs -lgmem - - -- The running my_prog will produce a file named gmem.out that will be - -- parsed by gnatmem. - - -- - Record a reference to the allocated memory on each allocation call - - -- - Suppress this reference on deallocation - - -- - At the end of the program, remaining references are potential leaks. - -- sort them out the best possible way in order to locate the root of - -- the leak. - - -- This capability is not supported on all platforms, please refer to - -- memtrack.adb for further information. - - -- In order to help finding out the real leaks, the notion of "allocation - -- root" is defined. An allocation root is a specific point in the program - -- execution generating memory allocation where data is collected (such as - -- number of allocations, amount of memory allocated, high water mark, etc.) - - with Ada.Float_Text_IO; - with Ada.Integer_Text_IO; - with Ada.Text_IO; use Ada.Text_IO; - - with System; use System; - with System.Storage_Elements; use System.Storage_Elements; - - with GNAT.Command_Line; use GNAT.Command_Line; - with GNAT.Heap_Sort_G; - with GNAT.OS_Lib; use GNAT.OS_Lib; - with GNAT.HTable; use GNAT.HTable; - - with Gnatvsn; use Gnatvsn; - with Memroot; use Memroot; - - procedure Gnatmem is - - package Int_IO renames Ada.Integer_Text_IO; - - ------------------------ - -- Other Declarations -- - ------------------------ - - type Storage_Elmt is record - Elmt : Character; - -- * = End of log file - -- A = found a ALLOC mark in the log - -- D = found a DEALL mark in the log - - Address : Integer_Address; - Size : Storage_Count; - Timestamp : Duration; - end record; - -- This type is used to read heap operations from the log file. - -- Elmt contains the type of the operation, which can be either - -- allocation, deallocation, or a special mark indicating the - -- end of the log file. Address is used to store address on the - -- heap where a chunk was allocated/deallocated, size is only - -- for A event and contains size of the allocation, and Timestamp - -- is the clock value at the moment of allocation - - Log_Name : String_Access; - -- Holds the name of the heap operations log file - - Program_Name : String_Access; - -- Holds the name of the user executable - - function Read_Next return Storage_Elmt; - -- Reads next dynamic storage operation from the log file - - function Mem_Image (X : Storage_Count) return String; - -- X is a size in storage_element. Returns a value - -- in Megabytes, Kilobytes or Bytes as appropriate. - - procedure Process_Arguments; - -- Read command line arguments - - procedure Usage; - -- Prints out the option help - - function Gmem_Initialize (Dumpname : String) return Boolean; - -- Opens the file represented by Dumpname and prepares it for - -- work. Returns False if the file does not have the correct format, True - -- otherwise. - - procedure Gmem_A2l_Initialize (Exename : String); - -- Initialises the convert_addresses interface by supplying it with - -- the name of the executable file Exename - - ----------------------------------- - -- HTable address --> Allocation -- - ----------------------------------- - - type Allocation is record - Root : Root_Id; - Size : Storage_Count; - end record; - - type Address_Range is range 0 .. 4097; - function H (A : Integer_Address) return Address_Range; - No_Alloc : constant Allocation := (No_Root_Id, 0); - - package Address_HTable is new GNAT.HTable.Simple_HTable ( - Header_Num => Address_Range, - Element => Allocation, - No_Element => No_Alloc, - Key => Integer_Address, - Hash => H, - Equal => "="); - - BT_Depth : Integer := 1; - - -- Some global statistics - - Global_Alloc_Size : Storage_Count := 0; - -- Total number of bytes allocated during the lifetime of a program - - Global_High_Water_Mark : Storage_Count := 0; - -- Largest amount of storage ever in use during the lifetime - - Global_Nb_Alloc : Integer := 0; - -- Total number of allocations - - Global_Nb_Dealloc : Integer := 0; - -- Total number of deallocations - - Nb_Root : Integer := 0; - -- Total number of allocation roots - - Nb_Wrong_Deall : Integer := 0; - -- Total number of wrong deallocations (i.e. without matching alloc) - - Minimum_Nb_Leaks : Integer := 1; - -- How many unfreed allocs should be in a root for it to count as leak - - T0 : Duration := 0.0; - -- The moment at which memory allocation routines initialized (should - -- be pretty close to the moment the program started since there are - -- always some allocations at RTL elaboration - - Tmp_Alloc : Allocation; - Dump_Log_Mode : Boolean := False; - Quiet_Mode : Boolean := False; - - ------------------------------ - -- Allocation Roots Sorting -- - ------------------------------ - - Sort_Order : String (1 .. 3) := "nwh"; - -- This is the default order in which sorting criteria will be applied - -- n - Total number of unfreed allocations - -- w - Final watermark - -- h - High watermark - - -------------------------------- - -- GMEM functionality binding -- - -------------------------------- - - --------------------- - -- Gmem_Initialize -- - --------------------- - - function Gmem_Initialize (Dumpname : String) return Boolean is - function Initialize (Dumpname : System.Address) return Duration; - pragma Import (C, Initialize, "__gnat_gmem_initialize"); - - S : aliased String := Dumpname & ASCII.NUL; - - begin - T0 := Initialize (S'Address); - return T0 > 0.0; - end Gmem_Initialize; - - ------------------------- - -- Gmem_A2l_Initialize -- - ------------------------- - - procedure Gmem_A2l_Initialize (Exename : String) is - procedure A2l_Initialize (Exename : System.Address); - pragma Import (C, A2l_Initialize, "__gnat_gmem_a2l_initialize"); - - S : aliased String := Exename & ASCII.NUL; - - begin - A2l_Initialize (S'Address); - end Gmem_A2l_Initialize; - - --------------- - -- Read_Next -- - --------------- - - function Read_Next return Storage_Elmt is - procedure Read_Next (buf : System.Address); - pragma Import (C, Read_Next, "__gnat_gmem_read_next"); - - S : Storage_Elmt; - - begin - Read_Next (S'Address); - return S; - end Read_Next; - - ------- - -- H -- - ------- - - function H (A : Integer_Address) return Address_Range is - begin - return Address_Range (A mod Integer_Address (Address_Range'Last)); - end H; - - --------------- - -- Mem_Image -- - --------------- - - function Mem_Image (X : Storage_Count) return String is - Ks : constant Storage_Count := X / 1024; - Megs : constant Storage_Count := Ks / 1024; - Buff : String (1 .. 7); - - begin - if Megs /= 0 then - Ada.Float_Text_IO.Put (Buff, Float (X) / 1024.0 / 1024.0, 2, 0); - return Buff & " Megabytes"; - - elsif Ks /= 0 then - Ada.Float_Text_IO.Put (Buff, Float (X) / 1024.0, 2, 0); - return Buff & " Kilobytes"; - - else - Ada.Integer_Text_IO.Put (Buff (1 .. 4), Integer (X)); - return Buff (1 .. 4) & " Bytes"; - end if; - end Mem_Image; - - ----------- - -- Usage -- - ----------- - - procedure Usage is - begin - New_Line; - Put ("GNATMEM "); - Put_Line (Gnat_Version_String); - Put_Line ("Copyright 1997-2007, Free Software Foundation, Inc."); - New_Line; - - Put_Line ("Usage: gnatmem switches [depth] exename"); - New_Line; - Put_Line (" depth backtrace depth to take into account, default is" - & Integer'Image (BT_Depth)); - Put_Line (" exename the name of the executable to be analyzed"); - New_Line; - Put_Line ("Switches:"); - Put_Line (" -b n same as depth parameter"); - Put_Line (" -i file read the allocation log from specific file"); - Put_Line (" default is gmem.out in the current directory"); - Put_Line (" -m n masks roots with less than n leaks, default is 1"); - Put_Line (" specify 0 to see even released allocation roots"); - Put_Line (" -q quiet, minimum output"); - Put_Line (" -s order sort allocation roots according to an order of"); - Put_Line (" sort criteria"); - GNAT.OS_Lib.OS_Exit (1); - end Usage; - - ----------------------- - -- Process_Arguments -- - ----------------------- - - procedure Process_Arguments is - begin - -- Parse the options first - - loop - case Getopt ("b: dd m: i: q s:") is - when ASCII.NUL => exit; - - when 'b' => - begin - BT_Depth := Natural'Value (Parameter); - exception - when Constraint_Error => - Usage; - end; - - when 'd' => - Dump_Log_Mode := True; - - when 'm' => - begin - Minimum_Nb_Leaks := Natural'Value (Parameter); - exception - when Constraint_Error => - Usage; - end; - - when 'i' => - Log_Name := new String'(Parameter); - - when 'q' => - Quiet_Mode := True; - - when 's' => - declare - S : constant String (Sort_Order'Range) := Parameter; - begin - for J in Sort_Order'Range loop - if S (J) = 'n' or else - S (J) = 'w' or else - S (J) = 'h' - then - Sort_Order (J) := S (J); - else - Put_Line ("Invalid sort criteria string."); - GNAT.OS_Lib.OS_Exit (1); - end if; - end loop; - end; - - when others => - null; - end case; - end loop; - - -- Set default log file if -i hasn't been specified - - if Log_Name = null then - Log_Name := new String'("gmem.out"); - end if; - - -- Get the optional backtrace length and program name - - declare - Str1 : constant String := GNAT.Command_Line.Get_Argument; - Str2 : constant String := GNAT.Command_Line.Get_Argument; - - begin - if Str1 = "" then - Usage; - end if; - - if Str2 = "" then - Program_Name := new String'(Str1); - else - BT_Depth := Natural'Value (Str1); - Program_Name := new String'(Str2); - end if; - - exception - when Constraint_Error => - Usage; - end; - - -- Ensure presence of executable suffix in Program_Name - - declare - Suffix : String_Access := Get_Executable_Suffix; - Tmp : String_Access; - - begin - if Suffix.all /= "" - and then - Program_Name.all - (Program_Name.all'Last - Suffix.all'Length + 1 .. - Program_Name.all'Last) /= Suffix.all - then - Tmp := new String'(Program_Name.all & Suffix.all); - Free (Program_Name); - Program_Name := Tmp; - end if; - - Free (Suffix); - - -- Search the executable on the path. If not found in the PATH, we - -- default to the current directory. Otherwise, libaddr2line will - -- fail with an error: - - -- (null): Bad address - - Tmp := Locate_Exec_On_Path (Program_Name.all); - - if Tmp = null then - Tmp := new String'('.' & Directory_Separator & Program_Name.all); - end if; - - Free (Program_Name); - Program_Name := Tmp; - end; - - if not Is_Regular_File (Log_Name.all) then - Put_Line ("Couldn't find " & Log_Name.all); - GNAT.OS_Lib.OS_Exit (1); - end if; - - if not Gmem_Initialize (Log_Name.all) then - Put_Line ("File " & Log_Name.all & " is not a gnatmem log file"); - GNAT.OS_Lib.OS_Exit (1); - end if; - - if not Is_Regular_File (Program_Name.all) then - Put_Line ("Couldn't find " & Program_Name.all); - end if; - - Gmem_A2l_Initialize (Program_Name.all); - - exception - when GNAT.Command_Line.Invalid_Switch => - Ada.Text_IO.Put_Line ("Invalid switch : " - & GNAT.Command_Line.Full_Switch); - Usage; - end Process_Arguments; - - -- Local variables - - Cur_Elmt : Storage_Elmt; - Buff : String (1 .. 16); - - -- Start of processing for Gnatmem - - begin - Process_Arguments; - - if Dump_Log_Mode then - Put_Line ("Full dump of dynamic memory operations history"); - Put_Line ("----------------------------------------------"); - - declare - function CTime (Clock : Address) return Address; - pragma Import (C, CTime, "ctime"); - - Int_T0 : Integer := Integer (T0); - CTime_Addr : constant Address := CTime (Int_T0'Address); - - Buffer : String (1 .. 30); - for Buffer'Address use CTime_Addr; - - begin - Put_Line ("Log started at T0 =" & Duration'Image (T0) & " (" - & Buffer (1 .. 24) & ")"); - end; - end if; - - -- Main loop analysing the data generated by the instrumented routines. - -- For each allocation, the backtrace is kept and stored in a htable - -- whose entry is the address. For each deallocation, we look for the - -- corresponding allocation and cancel it. - - Main : loop - Cur_Elmt := Read_Next; - - case Cur_Elmt.Elmt is - when '*' => - exit Main; - - when 'A' => - - -- Read the corresponding back trace - - Tmp_Alloc.Root := Read_BT (BT_Depth); - - if Quiet_Mode then - - if Nb_Alloc (Tmp_Alloc.Root) = 0 then - Nb_Root := Nb_Root + 1; - end if; - - Set_Nb_Alloc (Tmp_Alloc.Root, Nb_Alloc (Tmp_Alloc.Root) + 1); - Address_HTable.Set (Cur_Elmt.Address, Tmp_Alloc); - - elsif Cur_Elmt.Size > 0 then - - -- Update global counters if the allocated size is meaningful - - Global_Alloc_Size := Global_Alloc_Size + Cur_Elmt.Size; - Global_Nb_Alloc := Global_Nb_Alloc + 1; - - if Global_High_Water_Mark < Global_Alloc_Size then - Global_High_Water_Mark := Global_Alloc_Size; - end if; - - -- Update the number of allocation root if this is a new one - - if Nb_Alloc (Tmp_Alloc.Root) = 0 then - Nb_Root := Nb_Root + 1; - end if; - - -- Update allocation root specific counters - - Set_Alloc_Size (Tmp_Alloc.Root, - Alloc_Size (Tmp_Alloc.Root) + Cur_Elmt.Size); - - Set_Nb_Alloc (Tmp_Alloc.Root, Nb_Alloc (Tmp_Alloc.Root) + 1); - - if High_Water_Mark (Tmp_Alloc.Root) < - Alloc_Size (Tmp_Alloc.Root) - then - Set_High_Water_Mark (Tmp_Alloc.Root, - Alloc_Size (Tmp_Alloc.Root)); - end if; - - -- Associate this allocation root to the allocated address - - Tmp_Alloc.Size := Cur_Elmt.Size; - Address_HTable.Set (Cur_Elmt.Address, Tmp_Alloc); - - end if; - - when 'D' => - - -- Get the corresponding Dealloc_Size and Root - - Tmp_Alloc := Address_HTable.Get (Cur_Elmt.Address); - - if Tmp_Alloc.Root = No_Root_Id then - - -- There was no prior allocation at this address, something is - -- very wrong. Mark this allocation root as problematic. - - Tmp_Alloc.Root := Read_BT (BT_Depth); - - if Nb_Alloc (Tmp_Alloc.Root) = 0 then - Set_Nb_Alloc (Tmp_Alloc.Root, Nb_Alloc (Tmp_Alloc.Root) - 1); - Nb_Wrong_Deall := Nb_Wrong_Deall + 1; - end if; - - else - -- Update global counters - - if not Quiet_Mode then - Global_Alloc_Size := Global_Alloc_Size - Tmp_Alloc.Size; - end if; - - Global_Nb_Dealloc := Global_Nb_Dealloc + 1; - - -- Update allocation root specific counters - - if not Quiet_Mode then - Set_Alloc_Size (Tmp_Alloc.Root, - Alloc_Size (Tmp_Alloc.Root) - Tmp_Alloc.Size); - end if; - - Set_Nb_Alloc (Tmp_Alloc.Root, Nb_Alloc (Tmp_Alloc.Root) - 1); - - -- Update the number of allocation root if this one disappears - - if Nb_Alloc (Tmp_Alloc.Root) = 0 - and then Minimum_Nb_Leaks > 0 then - Nb_Root := Nb_Root - 1; - end if; - - -- Deassociate the deallocated address - - Address_HTable.Remove (Cur_Elmt.Address); - end if; - - when others => - raise Program_Error; - end case; - - if Dump_Log_Mode then - case Cur_Elmt.Elmt is - when 'A' => - Put ("ALLOC"); - Int_IO.Put (Buff (1 .. 16), Integer (Cur_Elmt.Address), 16); - Put (Buff); - Int_IO.Put (Buff (1 .. 8), Integer (Cur_Elmt.Size)); - Put (Buff (1 .. 8) & " bytes at moment T0 +"); - Put_Line (Duration'Image (Cur_Elmt.Timestamp - T0)); - - when 'D' => - Put ("DEALL"); - Int_IO.Put (Buff (1 .. 16), Integer (Cur_Elmt.Address), 16); - Put (Buff); - Put_Line (" at moment T0 +" - & Duration'Image (Cur_Elmt.Timestamp - T0)); - when others => - raise Program_Error; - end case; - - Print_BT (Tmp_Alloc.Root); - end if; - - end loop Main; - - -- Print out general information about overall allocation - - if not Quiet_Mode then - Put_Line ("Global information"); - Put_Line ("------------------"); - - Put (" Total number of allocations :"); - Ada.Integer_Text_IO.Put (Global_Nb_Alloc, 4); - New_Line; - - Put (" Total number of deallocations :"); - Ada.Integer_Text_IO.Put (Global_Nb_Dealloc, 4); - New_Line; - - Put_Line (" Final Water Mark (non freed mem) :" - & Mem_Image (Global_Alloc_Size)); - Put_Line (" High Water Mark :" - & Mem_Image (Global_High_Water_Mark)); - New_Line; - end if; - - -- Print out the back traces corresponding to potential leaks in order - -- greatest number of non-deallocated allocations. - - Print_Back_Traces : declare - type Root_Array is array (Natural range <>) of Root_Id; - type Access_Root_Array is access Root_Array; - - Leaks : constant Access_Root_Array := - new Root_Array (0 .. Nb_Root); - Leak_Index : Natural := 0; - - Bogus_Dealls : constant Access_Root_Array := - new Root_Array (1 .. Nb_Wrong_Deall); - Deall_Index : Natural := 0; - Nb_Alloc_J : Natural := 0; - - procedure Move (From : Natural; To : Natural); - function Lt (Op1, Op2 : Natural) return Boolean; - package Root_Sort is new GNAT.Heap_Sort_G (Move, Lt); - - ---------- - -- Move -- - ---------- - - procedure Move (From : Natural; To : Natural) is - begin - Leaks (To) := Leaks (From); - end Move; - - -------- - -- Lt -- - -------- - - function Lt (Op1, Op2 : Natural) return Boolean is - - function Apply_Sort_Criterion (S : Character) return Integer; - -- Applies a specific sort criterion; returns -1, 0 or 1 if Op1 is - -- smaller than, equal, or greater than Op2 according to criterion. - - -------------------------- - -- Apply_Sort_Criterion -- - -------------------------- - - function Apply_Sort_Criterion (S : Character) return Integer is - LOp1, LOp2 : Integer; - - begin - case S is - when 'n' => - LOp1 := Nb_Alloc (Leaks (Op1)); - LOp2 := Nb_Alloc (Leaks (Op2)); - - when 'w' => - LOp1 := Integer (Alloc_Size (Leaks (Op1))); - LOp2 := Integer (Alloc_Size (Leaks (Op2))); - - when 'h' => - LOp1 := Integer (High_Water_Mark (Leaks (Op1))); - LOp2 := Integer (High_Water_Mark (Leaks (Op2))); - - when others => - return 0; -- Can't actually happen - end case; - - if LOp1 < LOp2 then - return -1; - elsif LOp1 > LOp2 then - return 1; - else - return 0; - end if; - - exception - when Constraint_Error => - return 0; - end Apply_Sort_Criterion; - - -- Local Variables - - Result : Integer; - - -- Start of processing for Lt - - begin - for S in Sort_Order'Range loop - Result := Apply_Sort_Criterion (Sort_Order (S)); - if Result = -1 then - return False; - elsif Result = 1 then - return True; - end if; - end loop; - return False; - end Lt; - - -- Start of processing for Print_Back_Traces - - begin - -- Transfer all the relevant Roots in the Leaks and a Bogus_Deall arrays - - Tmp_Alloc.Root := Get_First; - while Tmp_Alloc.Root /= No_Root_Id loop - if Nb_Alloc (Tmp_Alloc.Root) = 0 and then Minimum_Nb_Leaks > 0 then - null; - - elsif Nb_Alloc (Tmp_Alloc.Root) < 0 then - Deall_Index := Deall_Index + 1; - Bogus_Dealls (Deall_Index) := Tmp_Alloc.Root; - - else - Leak_Index := Leak_Index + 1; - Leaks (Leak_Index) := Tmp_Alloc.Root; - end if; - - Tmp_Alloc.Root := Get_Next; - end loop; - - -- Print out wrong deallocations - - if Nb_Wrong_Deall > 0 then - Put_Line ("Releasing deallocated memory at :"); - if not Quiet_Mode then - Put_Line ("--------------------------------"); - end if; - - for J in 1 .. Bogus_Dealls'Last loop - Print_BT (Bogus_Dealls (J), Short => Quiet_Mode); - New_Line; - end loop; - end if; - - -- Print out all allocation Leaks - - if Leak_Index > 0 then - - -- Sort the Leaks so that potentially important leaks appear first - - Root_Sort.Sort (Leak_Index); - - for J in 1 .. Leak_Index loop - Nb_Alloc_J := Nb_Alloc (Leaks (J)); - - if Nb_Alloc_J >= Minimum_Nb_Leaks then - if Quiet_Mode then - if Nb_Alloc_J = 1 then - Put_Line (" 1 leak at :"); - else - Put_Line (Integer'Image (Nb_Alloc_J) & " leaks at :"); - end if; - - else - Put_Line ("Allocation Root #" & Integer'Image (J)); - Put_Line ("-------------------"); - - Put (" Number of non freed allocations :"); - Ada.Integer_Text_IO.Put (Nb_Alloc_J, 4); - New_Line; - - Put_Line - (" Final Water Mark (non freed mem) :" - & Mem_Image (Alloc_Size (Leaks (J)))); - - Put_Line - (" High Water Mark :" - & Mem_Image (High_Water_Mark (Leaks (J)))); - - Put_Line (" Backtrace :"); - end if; - - Print_BT (Leaks (J), Short => Quiet_Mode); - New_Line; - end if; - end loop; - end if; - end Print_Back_Traces; - end Gnatmem; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gnatname.adb gcc-4.6.0/gcc/ada/gnatname.adb *** gcc-4.5.2/gcc/ada/gnatname.adb Fri Oct 30 13:27:40 2009 --- gcc-4.6.0/gcc/ada/gnatname.adb Fri Jun 18 14:50:17 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** procedure Gnatname is *** 306,312 **** -- Add and initialize another component to Arguments table ! Arguments.Increment_Last; Patterns.Init (Arguments.Table (Arguments.Last).Directories); --- 306,325 ---- -- Add and initialize another component to Arguments table ! declare ! New_Arguments : Argument_Data; ! pragma Warnings (Off, New_Arguments); ! -- Declaring this defaulted initialized object ensures ! -- that the new allocated component of table Arguments ! -- is correctly initialized. ! ! -- This is VERY ugly, Table should never be used with ! -- data requiring default initialization. We should ! -- find a way to avoid violating this rule ??? ! ! begin ! Arguments.Append (New_Arguments); ! end; Patterns.Init (Arguments.Table (Arguments.Last).Directories); diff -Nrcpad gcc-4.5.2/gcc/ada/gnatsym.adb gcc-4.6.0/gcc/ada/gnatsym.adb *** gcc-4.5.2/gcc/ada/gnatsym.adb Tue Apr 7 15:01:27 2009 --- gcc-4.6.0/gcc/ada/gnatsym.adb Tue Jun 22 15:41:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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,59 **** -- - (optional) the name of the reference symbol file -- - the names of one or more object files where the symbols are found - with Ada.Exceptions; use Ada.Exceptions; - with Ada.Text_IO; use Ada.Text_IO; - - with GNAT.Command_Line; use GNAT.Command_Line; - with GNAT.OS_Lib; use GNAT.OS_Lib; - with Gnatvsn; use Gnatvsn; with Osint; use Osint; with Output; use Output; - with Symbols; use Symbols; with Table; procedure Gnatsym is Empty_String : aliased String := ""; --- 41,59 ---- -- - (optional) the name of the reference symbol file -- - the names of one or more object files where the symbols are found with Gnatvsn; use Gnatvsn; with Osint; use Osint; with Output; use Output; with Symbols; use Symbols; with Table; + with Ada.Exceptions; use Ada.Exceptions; + with Ada.Text_IO; use Ada.Text_IO; + + with GNAT.Command_Line; use GNAT.Command_Line; + with GNAT.Directory_Operations; use GNAT.Directory_Operations; + with GNAT.OS_Lib; use GNAT.OS_Lib; + procedure Gnatsym is Empty_String : aliased String := ""; *************** procedure Gnatsym is *** 82,89 **** Version_String : String_Access := Empty; -- The version of the library (used on VMS) package Object_Files is new Table.Table ! (Table_Component_Type => String_Access, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 10, --- 82,94 ---- Version_String : String_Access := Empty; -- The version of the library (used on VMS) + type Object_File_Data is record + Path : String_Access; + Name : String_Access; + end record; + package Object_Files is new Table.Table ! (Table_Component_Type => Object_File_Data, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 10, *************** procedure Gnatsym is *** 164,170 **** end case; end loop; ! -- Get the file names loop declare --- 169,176 ---- end case; end loop; ! -- Get the object file names and put them in the table in alphabetical ! -- order of base names. loop declare *************** procedure Gnatsym is *** 175,181 **** exit when S'Length = 0; Object_Files.Increment_Last; ! Object_Files.Table (Object_Files.Last) := S; end; end loop; exception --- 181,206 ---- exit when S'Length = 0; Object_Files.Increment_Last; ! ! declare ! Base : constant String := Base_Name (S.all); ! Last : constant Positive := Object_Files.Last; ! J : Positive; ! ! begin ! J := 1; ! while J < Last loop ! if Object_Files.Table (J).Name.all > Base then ! Object_Files.Table (J + 1 .. Last) := ! Object_Files.Table (J .. Last - 1); ! exit; ! end if; ! ! J := J + 1; ! end loop; ! ! Object_Files.Table (J) := (S, new String'(Base)); ! end; end; end loop; exception *************** begin *** 304,317 **** if Verbose then Write_Str ("Processing object file """); ! Write_Str (Object_Files.Table (Object_File).all); Write_Line (""""); end if; ! Processing.Process (Object_Files.Table (Object_File).all, Success); end loop; ! -- Finalize the object file if Success then if Verbose then --- 329,344 ---- if Verbose then Write_Str ("Processing object file """); ! Write_Str (Object_Files.Table (Object_File).Path.all); Write_Line (""""); end if; ! Processing.Process ! (Object_Files.Table (Object_File).Path.all, ! Success); end loop; ! -- Finalize the symbol file if Success then if Verbose then diff -Nrcpad gcc-4.5.2/gcc/ada/gnatvsn.adb gcc-4.6.0/gcc/ada/gnatvsn.adb *** gcc-4.5.2/gcc/ada/gnatvsn.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/gnatvsn.adb Fri Dec 3 04:48:56 2010 *************** package body Gnatvsn is *** 53,61 **** " FOR A PARTICULAR PURPOSE."; end Gnat_Free_Software; ! Version_String : String (1 .. Ver_Len_Max); -- Import the C string defined in the (language-independent) source file ! -- version.c. -- The size is not the real one, which does not matter since we will -- check for the nul character in Gnat_Version_String. pragma Import (C, Version_String, "version_string"); --- 53,62 ---- " FOR A PARTICULAR PURPOSE."; end Gnat_Free_Software; ! type char_array is array (Natural range <>) of aliased Character; ! Version_String : char_array (0 .. Ver_Len_Max - 1); -- Import the C string defined in the (language-independent) source file ! -- version.c using the zero-based convention of the C language. -- The size is not the real one, which does not matter since we will -- check for the nul character in Gnat_Version_String. pragma Import (C, Version_String, "version_string"); *************** package body Gnatvsn is *** 65,79 **** ------------------------- function Gnat_Version_String return String is ! NUL_Pos : Positive := 1; begin loop ! exit when Version_String (NUL_Pos) = ASCII.NUL; ! NUL_Pos := NUL_Pos + 1; end loop; ! return Version_String (1 .. NUL_Pos - 1); end Gnat_Version_String; end Gnatvsn; --- 66,84 ---- ------------------------- function Gnat_Version_String return String is ! S : String (1 .. Ver_Len_Max); ! Pos : Natural := 0; begin loop ! exit when Version_String (Pos) = ASCII.NUL; ! S (Pos + 1) := Version_String (Pos); ! Pos := Pos + 1; ! ! exit when Pos = Ver_Len_Max; end loop; ! return S (1 .. Pos); end Gnat_Version_String; end Gnatvsn; diff -Nrcpad gcc-4.5.2/gcc/ada/gnatvsn.ads gcc-4.6.0/gcc/ada/gnatvsn.ads *** gcc-4.5.2/gcc/ada/gnatvsn.ads Mon Jan 25 14:24:18 2010 --- gcc-4.6.0/gcc/ada/gnatvsn.ads Fri Dec 3 04:48:56 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,36 **** -- -- ------------------------------------------------------------------------------ ! -- This package spec exports version information for GNAT, GNATBIND and ! -- GNATMAKE. package Gnatvsn is --- 29,36 ---- -- -- ------------------------------------------------------------------------------ ! -- This package spec holds version information for the GNAT tools. ! -- It is updated whenever the release number is changed. package Gnatvsn is *************** package Gnatvsn is *** 70,92 **** -- Return the name of the Copyright holder to be displayed by the different -- GNAT tools when switch --version is used. ! Ver_Len_Max : constant := 64; -- Longest possible length for Gnat_Version_String in this or any -- other version of GNAT. This is used by the binder to establish -- space to store any possible version string value for checks. This -- value should never be decreased in the future, but it would be ! -- OK to increase it if absolutely necessary. ! Library_Version : constant String := "4.5"; ! -- Library version. This value must be updated whenever any change to the ! -- compiler affects the library formats in such a way as to obsolete ! -- previously compiled library modules. -- ! -- Note: Makefile.in relies on the precise format of the library version ! -- string in order to correctly construct the soname value. Verbose_Library_Version : constant String := "GNAT Lib v" & Library_Version; ! -- Version string stored in e.g. ALI files. Current_Year : constant String := "2010"; -- Used in printing copyright messages --- 70,96 ---- -- Return the name of the Copyright holder to be displayed by the different -- GNAT tools when switch --version is used. ! Ver_Len_Max : constant := 256; -- Longest possible length for Gnat_Version_String in this or any -- other version of GNAT. This is used by the binder to establish -- space to store any possible version string value for checks. This -- value should never be decreased in the future, but it would be ! -- OK to increase it if absolutely necessary. If it is increased, ! -- be sure to increase GNAT.Compiler.Version.Ver_Len_Max as well. ! Ver_Prefix : constant String := "GNAT Version: "; ! -- Prefix generated by binder. If it is changed, be sure to change ! -- GNAT.Compiler_Version.Ver_Prefix as well. ! ! Library_Version : constant String := "4.6"; ! -- Library version. This value must be updated when the compiler ! -- version number Gnat_Static_Version_String is updated. -- ! -- Note: Makefile.in uses the library version string to construct the ! -- soname value. Verbose_Library_Version : constant String := "GNAT Lib v" & Library_Version; ! -- Version string stored in e.g. ALI files Current_Year : constant String := "2010"; -- Used in printing copyright messages diff -Nrcpad gcc-4.5.2/gcc/ada/gnatxref.adb gcc-4.6.0/gcc/ada/gnatxref.adb *** gcc-4.5.2/gcc/ada/gnatxref.adb Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/gnatxref.adb Wed Jun 23 06:26:07 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** procedure Gnatxref is *** 52,57 **** --- 52,60 ---- RTS_Specified : String_Access := null; -- Used to detect multiple use of --RTS= switch + EXT_Specified : String_Access := null; + -- Used to detect multiple use of --ext= switch + procedure Parse_Cmd_Line; -- Parse every switch on the command line *************** procedure Gnatxref is *** 79,85 **** loop case GNAT.Command_Line.Getopt ! ("a aI: aO: d f g h I: nostdinc nostdlib p: u v -RTS=") is when ASCII.NUL => exit; --- 82,88 ---- loop case GNAT.Command_Line.Getopt ! ("a aI: aO: d f g h I: nostdinc nostdlib p: u v -RTS= -ext=") is when ASCII.NUL => exit; *************** procedure Gnatxref is *** 140,182 **** -- Check that it is the first time we see this switch ! if RTS_Specified = null then ! RTS_Specified := new String'(GNAT.Command_Line.Parameter); ! elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then ! Osint.Fail ("--RTS cannot be specified multiple times"); ! end if; ! Opt.No_Stdinc := True; ! Opt.RTS_Switch := True; ! declare ! Src_Path_Name : constant String_Ptr := ! Get_RTS_Search_Dir ! (GNAT.Command_Line.Parameter, Include); ! Lib_Path_Name : constant String_Ptr := ! Get_RTS_Search_Dir ! (GNAT.Command_Line.Parameter, Objects); ! begin ! if Src_Path_Name /= null and then Lib_Path_Name /= null then ! Add_Search_Dirs (Src_Path_Name, Include); ! Add_Search_Dirs (Lib_Path_Name, Objects); ! elsif Src_Path_Name = null and then Lib_Path_Name = null then ! Osint.Fail ("RTS path not valid: missing " & ! "adainclude and adalib directories"); ! elsif Src_Path_Name = null then ! Osint.Fail ("RTS path not valid: missing " & ! "adainclude directory"); ! elsif Lib_Path_Name = null then ! Osint.Fail ("RTS path not valid: missing " & ! "adalib directory"); end if; ! end; when others => Write_Usage; --- 143,212 ---- -- Check that it is the first time we see this switch ! if Full_Switch = "-RTS" then ! if RTS_Specified = null then ! RTS_Specified := new String'(GNAT.Command_Line.Parameter); ! elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then ! Osint.Fail ("--RTS cannot be specified multiple times"); ! end if; ! Opt.No_Stdinc := True; ! Opt.RTS_Switch := True; ! declare ! Src_Path_Name : constant String_Ptr := ! Get_RTS_Search_Dir ! (GNAT.Command_Line.Parameter, ! Include); ! Lib_Path_Name : constant String_Ptr := ! Get_RTS_Search_Dir ! (GNAT.Command_Line.Parameter, ! Objects); ! begin ! if Src_Path_Name /= null ! and then Lib_Path_Name /= null ! then ! Add_Search_Dirs (Src_Path_Name, Include); ! Add_Search_Dirs (Lib_Path_Name, Objects); ! elsif Src_Path_Name = null ! and then Lib_Path_Name = null ! then ! Osint.Fail ("RTS path not valid: missing " & ! "adainclude and adalib directories"); ! elsif Src_Path_Name = null then ! Osint.Fail ("RTS path not valid: missing " & ! "adainclude directory"); ! elsif Lib_Path_Name = null then ! Osint.Fail ("RTS path not valid: missing " & ! "adalib directory"); ! end if; ! end; ! ! elsif GNAT.Command_Line.Full_Switch = "-ext" then ! ! -- Check that it is the first time we see this switch ! ! if EXT_Specified = null then ! EXT_Specified := new String'(GNAT.Command_Line.Parameter); ! ! elsif EXT_Specified.all /= GNAT.Command_Line.Parameter then ! Osint.Fail ("--ext cannot be specified multiple times"); end if; ! ! if EXT_Specified'Length ! = Osint.ALI_Default_Suffix'Length ! then ! Osint.ALI_Suffix := EXT_Specified.all'Access; ! else ! Osint.Fail ("--ext argument must have 3 characters"); ! end if; ! end if; when others => Write_Usage; *************** procedure Gnatxref is *** 239,244 **** --- 269,275 ---- & " directory"); Put_Line (" -nostdlib Don't look for library files in the system" & " default directory"); + Put_Line (" --ext=xxx Specify alternate ali file extension"); Put_Line (" --RTS=dir specify the default source and object search" & " path"); Put_Line (" -p file Use file as the default project file"); diff -Nrcpad gcc-4.5.2/gcc/ada/gprep.adb gcc-4.6.0/gcc/ada/gprep.adb *** gcc-4.5.2/gcc/ada/gprep.adb Wed Sep 16 12:25:44 2009 --- gcc-4.6.0/gcc/ada/gprep.adb Thu Sep 9 12:31:35 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package body GPrep is *** 91,99 **** procedure Display_Copyright; -- Display the copyright notice - procedure Obsolescent_Check (S : Source_Ptr); - -- Null procedure, needed by instantiation of Scng below - procedure Post_Scan; -- Null procedure, needed by instantiation of Scng below --- 91,96 ---- *************** package body GPrep is *** 103,109 **** Errutil.Error_Msg_S, Errutil.Error_Msg_SC, Errutil.Error_Msg_SP, - Obsolescent_Check, Errutil.Style); -- The scanner for the preprocessor --- 100,105 ---- *************** package body GPrep is *** 172,178 **** -- Do some initializations (order is important here!) Csets.Initialize; - Namet.Initialize; Snames.Initialize; Stringt.Initialize; Prep.Initialize; --- 168,173 ---- *************** package body GPrep is *** 312,327 **** New_Line (Outfile.all); end New_EOL_To_Outfile; - ----------------------- - -- Obsolescent_Check -- - ----------------------- - - procedure Obsolescent_Check (S : Source_Ptr) is - pragma Warnings (Off, S); - begin - null; - end Obsolescent_Check; - --------------- -- Post_Scan -- --------------- --- 307,312 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/gsocket.h gcc-4.6.0/gcc/ada/gsocket.h *** gcc-4.5.2/gcc/ada/gsocket.h Mon Jun 22 12:24:57 2009 --- gcc-4.6.0/gcc/ada/gsocket.h Mon Jun 14 12:39:55 2010 *************** *** 6,12 **** * * * C Header File * * * ! * Copyright (C) 2004-2009, 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 2004-2010, 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,77 **** #elif defined (WINNT) #define FD_SETSIZE 1024 - #include #ifdef __MINGW32__ #include --- 71,76 ---- *************** *** 160,165 **** --- 159,166 ---- #endif + #include + #elif defined(VMS) #define FD_SETSIZE 4096 #ifndef IN_RTS *************** *** 179,192 **** #endif /* ! * RTEMS has these .h files but not until you have built RTEMS. When ! * IN_RTS, you only have the .h files in the newlib C library. ! * Because this file is also included from gen-soccon.c which is built ! * to run on RTEMS (not IN_RTS), we must distinguish between IN_RTS ! * and using this file to compile gen-soccon. */ ! #if !(defined (VMS) || defined (__MINGW32__) || \ ! (defined(__rtems__) && defined(IN_RTS))) #include #include #include --- 180,192 ---- #endif /* ! * RTEMS has these .h files but not until you have built and installed ! * RTEMS. When building a C/C++ toolset, you also build the newlib C library. ! * So the build procedure for an RTEMS GNAT toolset requires that ! * you build a C/C++ toolset, then build and install RTEMS with ! * --enable-multilib, and finally build the Ada part of the toolset. */ ! #if !(defined (VMS) || defined (__MINGW32__)) #include #include #include *************** *** 194,227 **** #include #endif ! /* ! * Handling of gethostbyname, gethostbyaddr, getservbyname and getservbyport ! * ========================================================================= ! * ! * The default implementation of GNAT.Sockets.Thin requires that these ! * operations be either thread safe, or that a reentrant version getXXXbyYYY_r ! * be provided. In both cases, socket.c provides a __gnat_safe_getXXXbyYYY ! * function with the same signature as getXXXbyYYY_r. If the operating ! * system version of getXXXbyYYY is thread safe, the provided auxiliary ! * buffer argument is unused and ignored. ! * ! * Target specific versions of GNAT.Sockets.Thin for platforms that can't ! * fulfill these requirements must provide their own protection mechanism ! * in Safe_GetXXXbyYYY, and if they require GNAT.Sockets to provide a buffer ! * to this effect, then we need to set Need_Netdb_Buffer here (case of ! * VxWorks and VMS). ! */ ! ! #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 (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || defined(__rtems__) # define HAVE_GETxxxBYyyy_R 1 #endif ! #if defined (HAVE_GETxxxBYyyy_R) || !defined (HAVE_THREAD_SAFE_GETxxxBYyyy) # define Need_Netdb_Buffer 1 #else # define Need_Netdb_Buffer 0 #endif #if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__) --- 194,230 ---- #include #endif ! #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 (__GLIBC__) || \ ! (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || \ ! defined(__rtems__) # define HAVE_GETxxxBYyyy_R 1 #endif ! /* ! * Properties of the unerlying NetDB library: ! * Need_Netdb_Buffer __gnat_getXXXbyYYY expects a caller-supplied buffer ! * Need_Netdb_Lock __gnat_getXXXbyYYY expects the caller to ensure ! * mutual exclusion ! * ! * See "Handling of gethostbyname, gethostbyaddr, getservbyname and ! * getservbyport" in socket.c for details. ! */ ! ! #if defined (HAVE_GETxxxBYyyy_R) # define Need_Netdb_Buffer 1 + # define Need_Netdb_Lock 0 + #else # define Need_Netdb_Buffer 0 + # if !defined (HAVE_THREAD_SAFE_GETxxxBYyyy) + # define Need_Netdb_Lock 1 + # else + # define Need_Netdb_Lock 0 + # endif #endif #if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__) diff -Nrcpad gcc-4.5.2/gcc/ada/i-c.ads gcc-4.6.0/gcc/ada/i-c.ads *** gcc-4.5.2/gcc/ada/i-c.ads Fri Apr 6 09:13:42 2007 --- gcc-4.6.0/gcc/ada/i-c.ads Thu Oct 7 12:59:00 2010 *************** package Interfaces.C is *** 47,53 **** type unsigned_char is mod (UCHAR_MAX + 1); for unsigned_char'Size use CHAR_BIT; ! subtype plain_char is unsigned_char; -- ??? should be parametrized -- Note: the Integer qualifications used in the declaration of ptrdiff_t -- avoid ambiguities when compiling in the presence of s-auxdec.ads and --- 47,53 ---- type unsigned_char is mod (UCHAR_MAX + 1); for unsigned_char'Size use CHAR_BIT; ! subtype plain_char is unsigned_char; -- ??? should be parameterized -- Note: the Integer qualifications used in the declaration of ptrdiff_t -- avoid ambiguities when compiling in the presence of s-auxdec.ads and diff -Nrcpad gcc-4.5.2/gcc/ada/i-cexten.ads gcc-4.6.0/gcc/ada/i-cexten.ads *** gcc-4.5.2/gcc/ada/i-cexten.ads Fri Jul 10 09:36:00 2009 --- gcc-4.6.0/gcc/ada/i-cexten.ads Tue Oct 19 10:30:52 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with System; *** 36,59 **** package Interfaces.C.Extensions is ! -- Following 7 declarations need comments ??? subtype void is System.Address; subtype void_ptr is System.Address; subtype opaque_structure_def is System.Address; type opaque_structure_def_ptr is access opaque_structure_def; subtype incomplete_class_def is System.Address; type incomplete_class_def_ptr is access incomplete_class_def; subtype bool is plain_char; ! -- 64bit integer types subtype long_long is Long_Long_Integer; type unsigned_long_long is mod 2 ** 64; -- Types for bitfields type Unsigned_1 is mod 2 ** 1; --- 36,74 ---- package Interfaces.C.Extensions is ! -- Definitions for C "void" and "void *" types subtype void is System.Address; subtype void_ptr is System.Address; + -- Definitions for C incomplete/unknown structs + subtype opaque_structure_def is System.Address; type opaque_structure_def_ptr is access opaque_structure_def; + -- Definitions for C++ incomplete/unknown classes + subtype incomplete_class_def is System.Address; type incomplete_class_def_ptr is access incomplete_class_def; + -- C bool + subtype bool is plain_char; ! -- 64-bit integer types subtype long_long is Long_Long_Integer; type unsigned_long_long is mod 2 ** 64; + -- 128-bit integer type available on 64-bit platforms: + -- typedef int signed_128 __attribute__ ((mode (TI))); + + type Signed_128 is record + low, high : unsigned_long_long; + end record; + pragma Convention (C_Pass_By_Copy, Signed_128); + for Signed_128'Alignment use unsigned_long_long'Alignment * 2; + -- Types for bitfields type Unsigned_1 is mod 2 ** 1; diff -Nrcpad gcc-4.5.2/gcc/ada/i-cstrea.ads gcc-4.6.0/gcc/ada/i-cstrea.ads *** gcc-4.5.2/gcc/ada/i-cstrea.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/i-cstrea.ads Tue Jun 22 16:57:01 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2010, 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- -- *************** package Interfaces.C_Streams is *** 76,84 **** -- Standard C functions -- -------------------------- ! -- The functions selected below are ones that are available in DOS, ! -- OS/2, UNIX and Xenix (but not necessarily in ANSI C). These are ! -- very thin interfaces which copy exactly the C headers. For more -- documentation on these functions, see the Microsoft C "Run-Time -- Library Reference" (Microsoft Press, 1990, ISBN 1-55615-225-6), -- which includes useful information on system compatibility. --- 76,84 ---- -- Standard C functions -- -------------------------- ! -- The functions selected below are ones that are available in ! -- UNIX (but not necessarily in ANSI C). These are very thin ! -- interfaces which copy exactly the C headers. For more -- documentation on these functions, see the Microsoft C "Run-Time -- Library Reference" (Microsoft Press, 1990, ISBN 1-55615-225-6), -- which includes useful information on system compatibility. diff -Nrcpad gcc-4.5.2/gcc/ada/i-forbla-darwin.adb gcc-4.6.0/gcc/ada/i-forbla-darwin.adb *** gcc-4.5.2/gcc/ada/i-forbla-darwin.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/i-forbla-darwin.adb Fri Jun 18 10:19:44 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2006-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2006-2010, 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,36 **** --- 32,38 ---- -- Version for Mac OS X package body Interfaces.Fortran.BLAS is + pragma Linker_Options ("-lgnala"); + pragma Linker_Options ("-lm"); pragma Linker_Options ("-Wl,-framework,vecLib"); end Interfaces.Fortran.BLAS; diff -Nrcpad gcc-4.5.2/gcc/ada/impunit.adb gcc-4.6.0/gcc/ada/impunit.adb *** gcc-4.5.2/gcc/ada/impunit.adb Mon Nov 30 14:57:12 2009 --- gcc-4.6.0/gcc/ada/impunit.adb Tue Oct 26 10:42:02 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2010, 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- -- *************** package body Impunit is *** 55,61 **** Non_Imp_File_Names_95 : constant File_List := ( ------------------------------------------------------ ! -- Ada Hierarchy Units from Ada-83 Reference Manual -- ------------------------------------------------------ "a-astaco", -- Ada.Asynchronous_Task_Control --- 55,61 ---- Non_Imp_File_Names_95 : constant File_List := ( ------------------------------------------------------ ! -- Ada Hierarchy Units from Ada-95 Reference Manual -- ------------------------------------------------------ "a-astaco", -- Ada.Asynchronous_Task_Control *************** package body Impunit is *** 173,178 **** --- 173,188 ---- "a-wichun", -- Ada.Wide_Characters.Unicode "a-widcha", -- Ada.Wide_Characters + -- Note: strictly the following should be Ada 2012 units, but it seems + -- harmless (and useful) to make then available in Ada 95 mode, since + -- they do not deal with Wide_Wide_Character. + + "a-wichha", -- Ada.Wide_Characters.Handling + "a-stuten", -- Ada.Strings.UTF_Encoding + "a-suenco", -- Ada.Strings.UTF_Encoding.Conversions + "a-suenst", -- Ada.Strings.UTF_Encoding.Strings + "a-suewst", -- Ada.Strings.UTF_Encoding.Wide_Strings + --------------------------- -- GNAT Special IO Units -- --------------------------- *************** package body Impunit is *** 250,255 **** --- 260,267 ---- "g-io ", -- GNAT.IO "g-io_aux", -- GNAT.IO_Aux "g-locfil", -- GNAT.Lock_Files + "g-mbdira", -- GNAT.MBBS_Discrete_Random + "g-mbflra", -- GNAT.MBBS_Float_Random "g-md5 ", -- GNAT.MD5 "g-memdum", -- GNAT.Memory_Dump "g-moreex", -- GNAT.Most_Recent_Exception *************** package body Impunit is *** 382,389 **** --- 394,403 ---- "a-disedf", -- Ada.Dispatching.EDF "a-dispat", -- Ada.Dispatching "a-envvar", -- Ada.Environment_Variables + "a-etgrbu", -- Ada.Execution_Time.Group_Budgets "a-exetim", -- Ada.Execution_Time "a-extiti", -- Ada.Execution_Time.Timers + "a-izteio", -- Ada.Integer_Wide_Wide_Text_IO "a-rttiev", -- Ada.Real_Time.Timing_Events "a-ngcoar", -- Ada.Numerics.Generic_Complex_Arrays "a-ngrear", -- Ada.Numerics.Generic_Real_Arrays *************** package body Impunit is *** 414,419 **** --- 428,434 ---- "a-wwboio", -- Ada.Wide_Text_IO.Wide_Bounded_IO "a-wwunio", -- Ada.Wide_Text_IO.Wide_Unbounded_IO "a-zchara", -- Ada.Wide_Wide_Characters + "a-zchhan", -- Ada.Wide_Wide_Characters.Handling "a-ztcoio", -- Ada.Wide_Wide_Text_IO.Complex_IO "a-ztedit", -- Ada.Wide_Wide_Text_IO.Editing "a-zttest", -- Ada.Wide_Wide_Text_IO.Text_Streams *************** package body Impunit is *** 457,462 **** --- 472,482 ---- "a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO "a-zchuni", -- Ada.Wide_Wide_Characters.Unicode + -- Note: strictly the following should be Ada 2012 units, but it seems + -- harmless (and useful) to make then available in Ada 2005 mode. + + "a-suezst", -- Ada.Strings.UTF_Encoding.Wide_Wide_Strings + --------------------------- -- GNAT Special IO Units -- --------------------------- *************** package body Impunit is *** 478,483 **** --- 498,519 ---- "g-zspche", -- GNAT.Wide_Wide_Spelling_Checker "g-zstspl"); -- GNAT.Wide_Wide_String_Split + -------------------- + -- Ada 2012 Units -- + -------------------- + + -- The following units should be used only in Ada 2012 mode + + Non_Imp_File_Names_12 : constant File_List := ( + "s-multip", -- System.Multiprocessors + "s-mudido", -- System.Multiprocessors.Dispatching_Domains + "a-cobove", -- Ada.Containers.Bounded_Vectors + "a-cbdlli", -- Ada.Containers.Bounded_Doubly_Linked_Lists + "a-cborse", -- Ada.Containers.Bounded_Ordered_Sets + "a-cborma", -- Ada.Containers.Bounded_Ordered_Maps + "a-cbhase", -- Ada.Containers.Bounded_Hashed_Sets + "a-cbhama"); -- Ada.Containers.Bounded_Hashed_Maps + ----------------------- -- Alternative Units -- ----------------------- *************** package body Impunit is *** 494,499 **** --- 530,537 ---- -- Array of alternative unit names Scasuti : aliased String := "GNAT.Case_Util"; + Scrc32 : aliased String := "GNAT.CRC32"; + Shtable : aliased String := "GNAT.HTable"; Sos_lib : aliased String := "GNAT.OS_Lib"; Sregexp : aliased String := "GNAT.Regexp"; Sregpat : aliased String := "GNAT.Regpat"; *************** package body Impunit is *** 504,511 **** -- Array giving mapping ! Map_Array : constant array (1 .. 8) of Aunit_Record := ( ("casuti", Scasuti'Access), ("os_lib", Sos_lib'Access), ("regexp", Sregexp'Access), ("regpat", Sregpat'Access), --- 542,551 ---- -- Array giving mapping ! Map_Array : constant array (1 .. 10) of Aunit_Record := ( ("casuti", Scasuti'Access), + ("crc32 ", Scrc32 'Access), + ("htable", Shtable'Access), ("os_lib", Sos_lib'Access), ("regexp", Sregexp'Access), ("regpat", Sregpat'Access), *************** package body Impunit is *** 573,583 **** end if; end loop; ! -- See if name is in 05 list for J in Non_Imp_File_Names_05'Range loop if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then ! return Ada_05_Unit; end if; end loop; --- 613,631 ---- end if; end loop; ! -- See if name is in 2005 list for J in Non_Imp_File_Names_05'Range loop if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then ! return Ada_2005_Unit; ! end if; ! end loop; ! ! -- See if name is in 2012 list ! ! for J in Non_Imp_File_Names_12'Range loop ! if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J) then ! return Ada_2012_Unit; end if; end loop; *************** package body Impunit is *** 609,620 **** Get_Name_String (Fname); ! if Name_Len = 12 and then Name_Buffer (1 .. 2) = "s-" ! and then Name_Buffer (9 .. 12) = ".ads" then for J in Map_Array'Range loop ! if Name_Buffer (3 .. 8) = Map_Array (J).Fname then Error_Msg_Strlen := Map_Array (J).Aname'Length; Error_Msg_String (1 .. Error_Msg_Strlen) := Map_Array (J).Aname.all; --- 657,673 ---- Get_Name_String (Fname); ! if Name_Len in 11 .. 12 and then Name_Buffer (1 .. 2) = "s-" ! and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads" then for J in Map_Array'Range loop ! if (Name_Len = 12 and then ! Name_Buffer (3 .. 8) = Map_Array (J).Fname) ! or else ! (Name_Len = 11 and then ! Name_Buffer (3 .. 7) = Map_Array (J).Fname (1 .. 5)) ! then Error_Msg_Strlen := Map_Array (J).Aname'Length; Error_Msg_String (1 .. Error_Msg_Strlen) := Map_Array (J).Aname.all; diff -Nrcpad gcc-4.5.2/gcc/ada/impunit.ads gcc-4.6.0/gcc/ada/impunit.ads *** gcc-4.5.2/gcc/ada/impunit.ads Wed Jul 15 12:53:31 2009 --- gcc-4.6.0/gcc/ada/impunit.ads Mon Oct 11 09:20:53 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2010, 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- -- *************** package Impunit is *** 48,57 **** -- in both Ada 95 mode and Ada 05 mode. Note that in Ada 83 mode, no -- child units are allowed, so you can't even name such a unit. ! Ada_05_Unit); ! -- This unit is defined in the Ada 05 RM. Withing this unit from a ! -- Ada 95 mode program will generate a warning (again, strictly speaking ! -- this should be an error, but that seems over-strenuous). function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit; -- Given the unit number of a unit, this function determines the type --- 48,62 ---- -- in both Ada 95 mode and Ada 05 mode. Note that in Ada 83 mode, no -- child units are allowed, so you can't even name such a unit. ! Ada_2005_Unit, ! -- This unit is defined in the Ada 2005 RM. Withing this unit from a ! -- Ada 95 mode program will generate a warning (again, strictly speaking ! -- this should be an error, but that seems over-strenuous). ! ! Ada_2012_Unit); ! -- This unit is defined in the Ada 2012 RM. Withing this unit from a Ada ! -- 95 mode or Ada 2005 program will generate a warning (again, strictly ! -- speaking this should be an error, but that seems over-strenuous). function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit; -- Given the unit number of a unit, this function determines the type diff -Nrcpad gcc-4.5.2/gcc/ada/init.c gcc-4.6.0/gcc/ada/init.c *** gcc-4.5.2/gcc/ada/init.c Mon Jan 25 16:24:20 2010 --- gcc-4.6.0/gcc/ada/init.c Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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- * *************** extern void Raise_From_Signal_Handler (s *** 86,91 **** --- 86,92 ---- /* Global values computed by the binder. */ int __gl_main_priority = -1; + int __gl_main_cpu = -1; int __gl_time_slice_val = -1; char __gl_wc_encoding = 'n'; char __gl_locking_policy = ' '; *************** nanosleep (struct timestruc_t *Rqtp, str *** 214,225 **** #endif /* _AIXVERSION_430 */ - static void __gnat_error_handler (int sig, siginfo_t * si, void * uc); - static void __gnat_error_handler (int sig, ! siginfo_t * si ATTRIBUTE_UNUSED, ! void * uc ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; --- 215,224 ---- #endif /* _AIXVERSION_430 */ static void __gnat_error_handler (int sig, ! siginfo_t *si ATTRIBUTE_UNUSED, ! void *ucontext ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; *************** __gnat_install_handler (void) *** 287,293 **** #include #include - static void __gnat_error_handler (int, siginfo_t *, struct sigcontext *); extern char *__gnat_get_code_loc (struct sigcontext *); extern void __gnat_set_code_loc (struct sigcontext *, char *); extern size_t __gnat_machine_state_length (void); --- 286,291 ---- *************** __gnat_adjust_context_for_raise (int sig *** 310,316 **** } static void ! __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context) { struct Exception_Data *exception; static int recurse = 0; --- 308,314 ---- } static void ! __gnat_error_handler (int sig, siginfo_t *si, void *ucontext) { struct Exception_Data *exception; static int recurse = 0; *************** __gnat_error_handler (int sig, siginfo_t *** 318,327 **** /* Adjusting is required for every fault context, so adjust for this one now, before we possibly trigger a recursive fault below. */ ! __gnat_adjust_context_for_raise (sig, context); /* If this was an explicit signal from a "kill", just resignal it. */ ! if (SI_FROMUSER (sip)) { signal (sig, SIG_DFL); kill (getpid(), sig); --- 316,325 ---- /* Adjusting is required for every fault context, so adjust for this one now, before we possibly trigger a recursive fault below. */ ! __gnat_adjust_context_for_raise (sig, ucontext); /* If this was an explicit signal from a "kill", just resignal it. */ ! if (SI_FROMUSER (si)) { signal (sig, SIG_DFL); kill (getpid(), sig); *************** __gnat_error_handler (int sig, siginfo_t *** 338,345 **** ??? Using a static variable here isn't task-safe, but it's much too hard to do anything else and we're just determining which exception to raise. */ ! if (sip->si_code == SEGV_ACCERR ! || (((long) sip->si_addr) & 3) != 0 || recurse) { exception = &constraint_error; --- 336,344 ---- ??? Using a static variable here isn't task-safe, but it's much too hard to do anything else and we're just determining which exception to raise. */ ! if (si->si_code == SEGV_ACCERR ! || (long) si->si_addr == 0 ! || (((long) si->si_addr) & 3) != 0 || recurse) { exception = &constraint_error; *************** __gnat_error_handler (int sig, siginfo_t *** 353,361 **** the actual address, just to be on the same page. */ recurse++; ((volatile char *) ! ((long) sip->si_addr & - getpagesize ()))[getpagesize ()]; ! msg = "stack overflow (or erroneous memory access)"; exception = &storage_error; } break; --- 352,360 ---- the actual address, just to be on the same page. */ recurse++; ((volatile char *) ! ((long) si->si_addr & - getpagesize ()))[getpagesize ()]; exception = &storage_error; + msg = "stack overflow (or erroneous memory access)"; } break; *************** __gnat_machine_state_length (void) *** 438,450 **** #include static void ! __gnat_error_handler (int sig, siginfo_t *siginfo, void *ucontext); ! ! static void ! __gnat_error_handler ! (int sig, ! siginfo_t *siginfo ATTRIBUTE_UNUSED, ! void *ucontext ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; --- 437,445 ---- #include static void ! __gnat_error_handler (int sig, ! siginfo_t *si ATTRIBUTE_UNUSED, ! void *ucontext ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; *************** void fake_linux_sigemptyset (sigset_t *s *** 570,577 **** #endif - static void __gnat_error_handler (int, siginfo_t *siginfo, void *ucontext); - #if defined (i386) || defined (__x86_64__) || defined (__ia64__) #define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE --- 565,570 ---- *************** __gnat_adjust_context_for_raise (int sig *** 581,591 **** { mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext; ! /* On the i386 and x86-64 architectures, we specifically detect calls to ! the null address and entirely fold the not-yet-fully-established frame ! to prevent it from stopping the unwinding. ! ! 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 --- 574,580 ---- { 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 *************** __gnat_adjust_context_for_raise (int sig *** 605,629 **** #if defined (i386) unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP]; - /* The call insn pushes the return address onto the stack. Pop it. */ - if (pc == NULL) - { - mcontext->gregs[REG_EIP] = *(unsigned long *)mcontext->gregs[REG_ESP]; - mcontext->gregs[REG_ESP] += 4; - } /* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */ ! else if (signo == SIGSEGV && *pc == 0x00240c83) mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long); #elif defined (__x86_64__) unsigned long *pc = (unsigned long *)mcontext->gregs[REG_RIP]; - /* The call insn pushes the return address onto the stack. Pop it. */ - if (pc == NULL) - { - mcontext->gregs[REG_RIP] = *(unsigned long *)mcontext->gregs[REG_RSP]; - mcontext->gregs[REG_RSP] += 8; - } /* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */ ! else if (signo == SIGSEGV && (*pc & 0xffffffffff) == 0x00240c8348) mcontext->gregs[REG_RSP] += 4096 + 4 * sizeof (unsigned long); #elif defined (__ia64__) /* ??? The IA-64 unwinder doesn't compensate for signals. */ --- 594,606 ---- #if defined (i386) unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP]; /* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */ ! if (signo == SIGSEGV && pc && *pc == 0x00240c83) mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long); #elif defined (__x86_64__) unsigned long *pc = (unsigned long *)mcontext->gregs[REG_RIP]; /* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */ ! if (signo == SIGSEGV && pc && (*pc & 0xffffffffff) == 0x00240c8348) mcontext->gregs[REG_RSP] += 4096 + 4 * sizeof (unsigned long); #elif defined (__ia64__) /* ??? The IA-64 unwinder doesn't compensate for signals. */ *************** __gnat_adjust_context_for_raise (int sig *** 634,645 **** #endif static void ! __gnat_error_handler (int sig, ! siginfo_t *siginfo ATTRIBUTE_UNUSED, ! void *ucontext) { struct Exception_Data *exception; - static int recurse = 0; const char *msg; /* Adjusting is required for every fault context, so adjust for this one --- 611,619 ---- #endif static void ! __gnat_error_handler (int sig, siginfo_t *si ATTRIBUTE_UNUSED, void *ucontext) { struct Exception_Data *exception; const char *msg; /* Adjusting is required for every fault context, so adjust for this one *************** __gnat_error_handler (int sig, *** 649,690 **** switch (sig) { case SIGSEGV: ! /* If the problem was permissions, this is a constraint error. ! Likewise if the failing address isn't maximally aligned or if ! we've recursed. ! ! ??? Using a static variable here isn't task-safe, but it's ! much too hard to do anything else and we're just determining ! which exception to raise. */ ! if (recurse) ! { ! exception = &constraint_error; ! msg = "SIGSEGV"; ! } ! else ! { ! /* Here we would like a discrimination test to see whether the ! page before the faulting address is accessible. Unfortunately ! Linux seems to have no way of giving us the faulting address. ! ! In versions of a-init.c before 1.95, we had a test of the page ! before the stack pointer using: ! recurse++; ! ((volatile char *) ! ((long) info->esp_at_signal & - getpagesize ()))[getpagesize ()]; ! but that's wrong, since it tests the stack pointer location, and ! the current stack probe code does not move the stack pointer ! until all probes succeed. ! 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. */ ! msg = "stack overflow (or erroneous memory access)"; ! exception = &storage_error; ! } break; case SIGBUS: --- 623,646 ---- switch (sig) { case SIGSEGV: ! /* Here we would like a discrimination test to see whether the page ! before the faulting address is accessible. Unfortunately, Linux ! seems to have no way of giving us the faulting address. ! In old versions of init.c, we had a test of the page before the ! stack pointer: ! ((volatile char *) ! ((long) si->esp_at_signal & - getpagesize ()))[getpagesize ()]; ! but that's wrong since it tests the stack pointer location and the ! stack probing code may not move it until all probes succeed. ! 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. */ ! exception = &storage_error; ! msg = "stack overflow (or erroneous memory access)"; break; case SIGBUS: *************** __gnat_error_handler (int sig, *** 702,712 **** msg = "unhandled signal"; } - recurse = 0; 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 --- 658,667 ---- msg = "unhandled signal"; } Raise_From_Signal_Handler (exception, msg); } ! #if defined (i386) || defined (__x86_64__) || defined (__powerpc__) /* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */ #endif *************** __gnat_install_handler (void) *** 747,753 **** 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); --- 702,708 ---- handled properly, avoiding a SEGV generation from stack usage by the handler itself. */ ! #if defined (i386) || defined (__x86_64__) || defined (__powerpc__) stack_t stack; stack.ss_sp = __gnat_alternate_stack; stack.ss_size = sizeof (__gnat_alternate_stack); *************** __gnat_install_handler (void) *** 768,774 **** sigaction (SIGILL, &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') --- 723,729 ---- sigaction (SIGILL, &act, NULL); if (__gnat_get_interrupt_state (SIGBUS) != 's') sigaction (SIGBUS, &act, NULL); ! #if defined (i386) || defined (__x86_64__) || defined (__powerpc__) act.sa_flags |= SA_ONSTACK; #endif if (__gnat_get_interrupt_state (SIGSEGV) != 's') *************** extern int (*Check_Abort_Status) (void); *** 800,807 **** extern struct Exception_Data _abort_signal; - static void __gnat_error_handler (int, int, sigcontext_t *); - /* We are not setting the SA_SIGINFO bit in the sigaction flags when connecting that handler, with the effects described in the sigaction man page: --- 755,760 ---- *************** __gnat_install_handler(void) *** 1007,1064 **** #define RETURN_ADDR_OFFSET 0 #endif - /* 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. */ - #if !defined (REG_PC) - #define REG_PC PC - #endif - - static void __gnat_error_handler (int, siginfo_t *, void *); - - #define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE - - void - __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext) - { - mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext; - unsigned long *pc = (unsigned long *)mcontext->gregs[REG_PC]; - - /* We specifically detect calls to the null address and entirely fold - the not-yet-fully-established frame to prevent it from stopping the - unwinding. */ - if (pc == NULL) - #if defined (__sparc) - /* The call insn moves the return address into %o7. Move it back. */ - mcontext->gregs[REG_PC] = mcontext->gregs[REG_O7]; - #elif defined (i386) - { - /* The call insn pushes the return address onto the stack. Pop it. */ - mcontext->gregs[REG_PC] = *(unsigned long *)mcontext->gregs[UESP]; - mcontext->gregs[UESP] += 4; - } - #elif defined (__x86_64__) - { - /* The call insn pushes the return address onto the stack. Pop it. */ - mcontext->gregs[REG_PC] = *(unsigned long *)mcontext->gregs[REG_RSP]; - mcontext->gregs[REG_RSP] += 8; - } - #else - #error architecture not supported on Solaris - #endif - } - static void ! __gnat_error_handler (int sig, siginfo_t *sip, void *ucontext) { struct Exception_Data *exception; static int recurse = 0; const char *msg; - /* Adjusting is required for every fault context, so adjust for this one - now, before we possibly trigger a recursive fault below. */ - __gnat_adjust_context_for_raise (sig, ucontext); - switch (sig) { case SIGSEGV: --- 960,972 ---- #define RETURN_ADDR_OFFSET 0 #endif static void ! __gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED) { struct Exception_Data *exception; static int recurse = 0; const char *msg; switch (sig) { case SIGSEGV: *************** __gnat_error_handler (int sig, siginfo_t *** 1069,1077 **** ??? Using a static variable here isn't task-safe, but it's much too hard to do anything else and we're just determining which exception to raise. */ ! if (sip->si_code == SEGV_ACCERR ! || (long) sip->si_addr == 0 ! || (((long) sip->si_addr) & 3) != 0 || recurse) { exception = &constraint_error; --- 977,985 ---- ??? Using a static variable here isn't task-safe, but it's much too hard to do anything else and we're just determining which exception to raise. */ ! if (si->si_code == SEGV_ACCERR ! || (long) si->si_addr == 0 ! || (((long) si->si_addr) & 3) != 0 || recurse) { exception = &constraint_error; *************** __gnat_error_handler (int sig, siginfo_t *** 1085,1091 **** the actual address, just to be on the same page. */ recurse++; ((volatile char *) ! ((long) sip->si_addr & - getpagesize ()))[getpagesize ()]; exception = &storage_error; msg = "stack overflow (or erroneous memory access)"; } --- 993,999 ---- the actual address, just to be on the same page. */ recurse++; ((volatile char *) ! ((long) si->si_addr & - getpagesize ()))[getpagesize ()]; exception = &storage_error; msg = "stack overflow (or erroneous memory access)"; } *************** __gnat_install_handler (void) *** 1143,1153 **** #elif defined (VMS) /* Routine called from binder to override default feature values. */ ! void __gnat_set_features (); int __gnat_features_set = 0; - long __gnat_error_handler (int *, void *); - #ifdef __IA64 #define lib_get_curr_invo_context LIB$I64_GET_CURR_INVO_CONTEXT #define lib_get_prev_invo_context LIB$I64_GET_PREV_INVO_CONTEXT --- 1051,1059 ---- #elif defined (VMS) /* Routine called from binder to override default feature values. */ ! void __gnat_set_features (void); int __gnat_features_set = 0; #ifdef __IA64 #define lib_get_curr_invo_context LIB$I64_GET_CURR_INVO_CONTEXT #define lib_get_prev_invo_context LIB$I64_GET_PREV_INVO_CONTEXT *************** long __gnat_error_handler (int *, void * *** 1158,1172 **** #define lib_get_invo_handle LIB$GET_INVO_HANDLE #endif - #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). */ - extern long __gnat_error_prehandler (void); - - extern char *__gnat_error_prehandler_stack; /* Alternate signal stack */ - #endif - /* 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. */ --- 1064,1069 ---- *************** struct cond_except { *** 1198,1204 **** const struct Exception_Data *except; }; ! 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 --- 1095,1104 ---- const struct Exception_Data *except; }; ! 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 *************** static const struct cond_except cond_exc *** 1338,1344 **** That predicate function is called indirectly, via a function pointer, by __gnat_error_handler, and changing that pointer is allowed to the ! the user code by way of the __gnat_set_resignal_predicate interface. The user level function may then implement what it likes, including for instance the maintenance of a dynamic data structure if the set --- 1238,1244 ---- That predicate function is called indirectly, via a function pointer, by __gnat_error_handler, and changing that pointer is allowed to the ! user code by way of the __gnat_set_resignal_predicate interface. The user level function may then implement what it likes, including for instance the maintenance of a dynamic data structure if the set *************** static const struct cond_except cond_exc *** 1355,1361 **** typedef int resignal_predicate (int code); ! const int *cond_resignal_table [] = { &C$_SIGKILL, &CMA$_EXIT_THREAD, &SS$_DEBUG, --- 1255,1261 ---- typedef int resignal_predicate (int code); ! static const int * const cond_resignal_table [] = { &C$_SIGKILL, &CMA$_EXIT_THREAD, &SS$_DEBUG, *************** const int *cond_resignal_table [] = { *** 1366,1372 **** 0 }; ! const int facility_resignal_table [] = { 0x1380000, /* RDB */ 0x2220000, /* SQL */ 0 --- 1266,1272 ---- 0 }; ! static const int facility_resignal_table [] = { 0x1380000, /* RDB */ 0x2220000, /* SQL */ 0 *************** __gnat_default_resignal_p (int code) *** 1394,1408 **** /* Static pointer to predicate that the __gnat_error_handler exception vector invokes to determine if it should resignal a condition. */ ! static resignal_predicate * __gnat_resignal_p = __gnat_default_resignal_p; /* User interface to change the predicate pointer to PREDICATE. Reset to the default if PREDICATE is null. */ void ! __gnat_set_resignal_predicate (resignal_predicate * predicate) { ! if (predicate == 0) __gnat_resignal_p = __gnat_default_resignal_p; else __gnat_resignal_p = predicate; --- 1294,1308 ---- /* Static pointer to predicate that the __gnat_error_handler exception vector invokes to determine if it should resignal a condition. */ ! static resignal_predicate *__gnat_resignal_p = __gnat_default_resignal_p; /* User interface to change the predicate pointer to PREDICATE. Reset to the default if PREDICATE is null. */ void ! __gnat_set_resignal_predicate (resignal_predicate *predicate) { ! if (predicate == NULL) __gnat_resignal_p = __gnat_default_resignal_p; else __gnat_resignal_p = predicate; *************** __gnat_set_resignal_predicate (resignal_ *** 1416,1424 **** and separated by line termination. */ static int ! copy_msg (msgdesc, message) ! struct descriptor_s *msgdesc; ! char *message; { int len = strlen (message); int copy_len; --- 1316,1322 ---- and separated by line termination. */ static int ! copy_msg (struct descriptor_s *msgdesc, char *message) { int len = strlen (message); int copy_len; *************** __gnat_handle_vms_condition (int *sigarg *** 1445,1451 **** { struct Exception_Data *exception = 0; Exception_Code base_code; ! struct descriptor_s gnat_facility = {4,0,"GNAT"}; char message [Default_Exception_Msg_Max_Length]; const char *msg = ""; --- 1343,1349 ---- { struct Exception_Data *exception = 0; Exception_Code base_code; ! struct descriptor_s gnat_facility = {4, 0, "GNAT"}; char message [Default_Exception_Msg_Max_Length]; const char *msg = ""; *************** __gnat_handle_vms_condition (int *sigarg *** 1458,1474 **** #ifdef IN_RTS /* 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); if (exception) { ! message [0] = 0; /* 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; --- 1356,1372 ---- #ifdef IN_RTS /* 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); if (exception) { ! message[0] = 0; /* 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; *************** __gnat_handle_vms_condition (int *sigarg *** 1498,1510 **** exception = &storage_error; msg = "stack overflow (or erroneous memory access)"; } ! __gnat_adjust_context_for_raise (0, (void *)mechargs); break; case SS$_STKOVF: exception = &storage_error; msg = "stack overflow"; ! __gnat_adjust_context_for_raise (0, (void *)mechargs); break; case SS$_HPARITH: --- 1396,1408 ---- exception = &storage_error; msg = "stack overflow (or erroneous memory access)"; } ! __gnat_adjust_context_for_raise (SS$_ACCVIO, (void *)mechargs); break; case SS$_STKOVF: exception = &storage_error; msg = "stack overflow"; ! __gnat_adjust_context_for_raise (SS$_STKOVF, (void *)mechargs); break; case SS$_HPARITH: *************** __gnat_handle_vms_condition (int *sigarg *** 1513,1523 **** #else exception = &constraint_error; msg = "arithmetic error"; ! #ifndef __alpha__ ! /* 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 #endif break; --- 1411,1417 ---- #else exception = &constraint_error; msg = "arithmetic error"; ! __gnat_adjust_context_for_raise (SS$_HPARITH, (void *)mechargs); #endif break; *************** __gnat_handle_vms_condition (int *sigarg *** 1541,1548 **** /* Scan the VMS standard condition table for a match and fetch the associated GNAT exception pointer. */ for (i = 0; ! cond_except_table [i].cond && ! !LIB$MATCH_COND (&sigargs [1], &cond_except_table [i].cond); i++); exception = (struct Exception_Data *) cond_except_table [i].except; --- 1435,1442 ---- /* Scan the VMS standard condition table for a match and fetch the associated GNAT exception pointer. */ for (i = 0; ! cond_except_table[i].cond && ! !LIB$MATCH_COND (&sigargs[1], &cond_except_table[i].cond); i++); exception = (struct Exception_Data *) cond_except_table [i].except; *************** __gnat_handle_vms_condition (int *sigarg *** 1556,1566 **** #else exception = &program_error; #endif ! message [0] = 0; /* Subtract PC & PSL fields which messes with PUTMSG. */ ! sigargs [0] -= 2; SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message); ! sigargs [0] += 2; msg = message; break; } --- 1450,1460 ---- #else exception = &program_error; #endif ! message[0] = 0; /* Subtract PC & PSL fields which messes with PUTMSG. */ ! sigargs[0] -= 2; SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message); ! sigargs[0] += 2; msg = message; break; } *************** __gnat_handle_vms_condition (int *sigarg *** 1568,1601 **** Raise_From_Signal_Handler (exception, msg); } - long - __gnat_error_handler (int *sigargs, void *mechargs) - { - return __gnat_handle_vms_condition (sigargs, mechargs); - } - void __gnat_install_handler (void) { long prvhnd ATTRIBUTE_UNUSED; #if !defined (IN_RTS) ! SYS$SETEXV (1, __gnat_error_handler, 3, &prvhnd); ! #endif ! ! /* On alpha-vms, we avoid the global vector annoyance thanks to frame based ! handlers to turn conditions into exceptions since GCC 3.4. The global ! vector is still required for earlier GCC versions. We're resorting to ! the __gnat_error_prehandler assembly function in this case. */ ! ! #if defined (IN_RTS) && defined (__alpha__) ! if ((__GNUC__ * 10 + __GNUC_MINOR__) < 34) ! { ! char * c = (char *) xmalloc (2049); ! ! __gnat_error_prehandler_stack = &c[2048]; ! SYS$SETEXV (1, __gnat_error_prehandler, 3, &prvhnd); ! } #endif __gnat_handler_installed = 1; --- 1462,1474 ---- Raise_From_Signal_Handler (exception, msg); } void __gnat_install_handler (void) { long prvhnd ATTRIBUTE_UNUSED; #if !defined (IN_RTS) ! SYS$SETEXV (1, __gnat_handle_vms_condition, 3, &prvhnd); #endif __gnat_handler_installed = 1; *************** __gnat_install_handler (void) *** 1614,1630 **** void __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext) { ! /* Add one to the address of the instruction signaling the condition, ! located in the sigargs array. */ ! CHF$MECH_ARRAY * mechargs = (CHF$MECH_ARRAY *) ucontext; ! CHF$SIGNAL_ARRAY * sigargs ! = (CHF$SIGNAL_ARRAY *) mechargs->chf$q_mch_sig_addr; ! int vcount = sigargs->chf$is_sig_args; ! int * pc_slot = & (&sigargs->chf$l_sig_name)[vcount-2]; ! (*pc_slot) ++; } #endif --- 1487,1506 ---- void __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext) { ! if (signo == SS$_HPARITH) ! { ! /* Sub one to the address of the instruction signaling the condition, ! located in the sigargs array. */ ! CHF$MECH_ARRAY * mechargs = (CHF$MECH_ARRAY *) ucontext; ! CHF$SIGNAL_ARRAY * sigargs ! = (CHF$SIGNAL_ARRAY *) mechargs->chf$q_mch_sig_addr; ! int vcount = sigargs->chf$is_sig_args; ! int * pc_slot = & (&sigargs->chf$l_sig_name)[vcount-2]; ! (*pc_slot)--; ! } } #endif *************** __gnat_adjust_context_for_raise (int sig *** 1661,1712 **** #endif ! /* Feature logical name and global variable address pair */ ! struct feature {char *name; int* gl_addr;}; ! /* Default values for GNAT features set by environment. */ ! int __gl_no_malloc_64 = 0; ! /* Array feature logical names and global variable addresses */ ! static struct feature features[] = { ! {"GNAT$NO_MALLOC_64", &__gl_no_malloc_64}, ! {0, 0} }; ! void __gnat_set_features () { ! struct descriptor_s name_desc, result_desc; ! int i, status; ! unsigned short rlen; ! #define MAXEQUIV 10 ! char buff [MAXEQUIV]; ! /* Loop through features array and test name for enable/disable */ ! for (i=0; features [i].name; i++) { ! name_desc.len = strlen (features [i].name); ! name_desc.mbz = 0; ! name_desc.adr = features [i].name; ! result_desc.len = MAXEQUIV - 1; ! result_desc.mbz = 0; ! result_desc.adr = buff; ! status = LIB$GET_LOGICAL (&name_desc, &result_desc, &rlen); ! if (((status & 1) == 1) && (rlen < MAXEQUIV)) ! buff [rlen] = 0; ! else ! strcpy (buff, ""); ! if (strcmp (buff, "ENABLE") == 0) ! *features [i].gl_addr = 1; ! else if (strcmp (buff, "DISABLE") == 0) ! *features [i].gl_addr = 0; } ! __gnat_features_set = 1; } /*******************/ --- 1537,1723 ---- #endif ! /* Easier interface for LIB$GET_LOGICAL: put the equivalence of NAME into BUF, ! always NUL terminated. In case of error or if the result is longer than ! LEN (length of BUF) an empty string is written info BUF. */ ! static void ! __gnat_vms_get_logical (const char *name, char *buf, int len) ! { ! struct descriptor_s name_desc, result_desc; ! int status; ! unsigned short rlen; ! /* Build the descriptor for NAME. */ ! name_desc.len = strlen (name); ! name_desc.mbz = 0; ! name_desc.adr = (char *)name; ! ! /* Build the descriptor for the result. */ ! result_desc.len = len; ! result_desc.mbz = 0; ! result_desc.adr = buf; ! ! status = LIB$GET_LOGICAL (&name_desc, &result_desc, &rlen); ! ! if ((status & 1) == 1 && rlen < len) ! buf[rlen] = 0; ! else ! buf[0] = 0; ! } ! ! /* Size of a page on ia64 and alpha VMS. */ ! #define VMS_PAGESIZE 8192 ! ! /* User mode. */ ! #define PSL__C_USER 3 ! ! /* No access. */ ! #define PRT__C_NA 0 ! ! /* Descending region. */ ! #define VA__M_DESCEND 1 ! ! /* Get by virtual address. */ ! #define VA___REGSUM_BY_VA 1 ! ! /* Memory region summary. */ ! struct regsum ! { ! unsigned long long q_region_id; ! unsigned int l_flags; ! unsigned int l_region_protection; ! void *pq_start_va; ! unsigned long long q_region_size; ! void *pq_first_free_va; }; ! extern int SYS$GET_REGION_INFO (unsigned int, unsigned long long *, ! void *, void *, unsigned int, ! void *, unsigned int *); ! extern int SYS$EXPREG_64 (unsigned long long *, unsigned long long, ! unsigned int, unsigned int, void **, ! unsigned long long *); ! extern int SYS$SETPRT_64 (void *, unsigned long long, unsigned int, ! unsigned int, void **, unsigned long long *, ! unsigned int *); ! extern int SYS$PUTMSG (void *, int (*)(), void *, unsigned long long); ! ! /* Add a guard page in the memory region containing ADDR at ADDR +/- SIZE. ! (The sign depends on the kind of the memory region). */ ! ! static int ! __gnat_set_stack_guard_page (void *addr, unsigned long size) { ! int status; ! void *ret_va; ! unsigned long long ret_len; ! unsigned int ret_prot; ! void *start_va; ! unsigned long long length; ! unsigned int retlen; ! struct regsum buffer; ! /* Get the region for ADDR. */ ! status = SYS$GET_REGION_INFO ! (VA___REGSUM_BY_VA, NULL, addr, NULL, sizeof (buffer), &buffer, &retlen); ! if ((status & 1) != 1) ! return -1; ! ! /* Extend the region. */ ! status = SYS$EXPREG_64 (&buffer.q_region_id, ! size, 0, 0, &start_va, &length); ! ! if ((status & 1) != 1) ! return -1; ! ! /* Create a guard page. */ ! if (!(buffer.l_flags & VA__M_DESCEND)) ! start_va = (void *)((unsigned long long)start_va + length - VMS_PAGESIZE); ! ! status = SYS$SETPRT_64 (start_va, VMS_PAGESIZE, PSL__C_USER, PRT__C_NA, ! &ret_va, &ret_len, &ret_prot); ! ! if ((status & 1) != 1) ! return -1; ! return 0; ! } ! ! /* Read logicals to limit the stack(s) size. */ ! ! static void ! __gnat_set_stack_limit (void) ! { ! #ifdef __ia64__ ! void *sp; ! unsigned long size; ! char value[16]; ! char *e; ! ! /* The main stack. */ ! __gnat_vms_get_logical ("GNAT_STACK_SIZE", value, sizeof (value)); ! size = strtoul (value, &e, 0); ! if (e > value && *e == 0) { ! asm ("mov %0=sp" : "=r" (sp)); ! __gnat_set_stack_guard_page (sp, size * 1024); ! } ! /* The register stack. */ ! __gnat_vms_get_logical ("GNAT_RBS_SIZE", value, sizeof (value)); ! size = strtoul (value, &e, 0); ! if (e > value && *e == 0) ! { ! asm ("mov %0=ar.bsp" : "=r" (sp)); ! __gnat_set_stack_guard_page (sp, size * 1024); ! } ! #endif ! } ! /* Feature logical name and global variable address pair. ! If we ever add another feature logical to this list, the ! feature struct will need to be enhanced to take into account ! possible values for *gl_addr. */ ! struct feature { ! const char *name; ! int *gl_addr; ! }; ! /* Default values for GNAT features set by environment. */ ! int __gl_heap_size = 64; ! /* Array feature logical names and global variable addresses. */ ! static const struct feature features[] = { ! {"GNAT$NO_MALLOC_64", &__gl_heap_size}, ! {0, 0} ! }; ! ! void ! __gnat_set_features (void) ! { ! int i; ! char buff[16]; ! ! /* Loop through features array and test name for enable/disable. */ ! for (i = 0; features[i].name; i++) ! { ! __gnat_vms_get_logical (features[i].name, buff, sizeof (buff)); ! ! if (strcmp (buff, "ENABLE") == 0 ! || strcmp (buff, "TRUE") == 0 ! || strcmp (buff, "1") == 0) ! *features[i].gl_addr = 32; ! else if (strcmp (buff, "DISABLE") == 0 ! || strcmp (buff, "FALSE") == 0 ! || strcmp (buff, "0") == 0) ! *features[i].gl_addr = 64; } ! /* Features to artificially limit the stack size. */ ! __gnat_set_stack_limit (); ! ! __gnat_features_set = 1; } /*******************/ *************** void __gnat_set_features () *** 1719,1729 **** #include #include - static void __gnat_error_handler (int, siginfo_t *, ucontext_t *); - static void ! __gnat_error_handler (int sig, siginfo_t *info __attribute__ ((unused)), ! ucontext_t *ucontext) { struct Exception_Data *exception; const char *msg; --- 1730,1739 ---- #include #include static void ! __gnat_error_handler (int sig, ! siginfo_t *si ATTRIBUTE_UNUSED, ! void *ucontext ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; *************** __gnat_map_signal (int sig) *** 1939,1946 **** propagation after the required low level adjustments. */ void ! __gnat_error_handler (int sig, void * si ATTRIBUTE_UNUSED, ! struct sigcontext * sc) { sigset_t mask; --- 1949,1957 ---- propagation after the required low level adjustments. */ void ! __gnat_error_handler (int sig, ! void *si ATTRIBUTE_UNUSED, ! struct sigcontext *sc ATTRIBUTE_UNUSED) { sigset_t mask; *************** __gnat_install_handler(void) *** 2176,2183 **** /* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ char __gnat_alternate_stack[32 * 1024]; /* 1 * MINSIGSTKSZ */ - static void __gnat_error_handler (int sig, siginfo_t * si, void * uc); - /* Defined in xnu unix_signal.c. Tell the kernel to re-use alt stack when delivering a signal. */ #define UC_RESET_ALT_STACK 0x80000000 --- 2187,2192 ---- *************** __gnat_is_stack_guard (mach_vm_address_t *** 2208,2214 **** } static void ! __gnat_error_handler (int sig, siginfo_t * si, void * uc ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; --- 2217,2223 ---- } static void ! __gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; *************** __gnat_install_handler (void) *** 2306,2315 **** /*********************/ /* 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. */ ! #if defined (_WIN32) || defined (__INTERIX) || defined (__EMX__) \ || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \ || defined (__OpenBSD__) --- 2315,2324 ---- /*********************/ /* This routine is called as each process thread is created, for possible ! initialization of the FP processor. This version is used under INTERIX ! and WIN32. */ ! #if defined (_WIN32) || defined (__INTERIX) \ || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \ || defined (__OpenBSD__) diff -Nrcpad gcc-4.5.2/gcc/ada/initialize.c gcc-4.6.0/gcc/ada/initialize.c *** gcc-4.5.2/gcc/ada/initialize.c Mon Jul 13 12:16:51 2009 --- gcc-4.6.0/gcc/ada/initialize.c Mon Jun 14 08:31:33 2010 *************** __gnat_initialize (void *eh) *** 307,319 **** or the other, except for the mixed Ada/C++ case in which the first scheme would fail for the same reason as in the linked-with-kernel situation. ! Selecting the crt set with the ctors/dtors capabilities (first scheme ! above) is triggered by adding "-dynamic" to the gcc *link* command line ! options. Selecting the other set is achieved by using "-static" instead. ! ! This is a first approach, tightly synchronized with a number of GCC ! configuration and crtstuff changes. We need to ensure that those changes ! are there to activate this circuitry. */ #if (__GNUC__ >= 3) && (defined (_ARCH_PPC) || defined (__ppc)) { --- 307,316 ---- or the other, except for the mixed Ada/C++ case in which the first scheme would fail for the same reason as in the linked-with-kernel situation. ! The crt set selection is controlled by command line options via GCC's ! STARTFILE_SPEC in rs6000/vxworks.h. This is tightly synchronized with a ! number of other GCC configuration and crtstuff changes, and we need to ! ensure that those changes are there to activate this circuitry. */ #if (__GNUC__ >= 3) && (defined (_ARCH_PPC) || defined (__ppc)) { diff -Nrcpad gcc-4.5.2/gcc/ada/inline.adb gcc-4.6.0/gcc/ada/inline.adb *** gcc-4.5.2/gcc/ada/inline.adb Mon Jul 20 12:47:50 2009 --- gcc-4.6.0/gcc/ada/inline.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Fname.UF; use Fname.UF; *** 34,40 **** with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; - with Opt; use Opt; with Sem_Aux; use Sem_Aux; with Sem_Ch8; use Sem_Ch8; with Sem_Ch10; use Sem_Ch10; --- 34,39 ---- *************** package body Inline is *** 139,146 **** ----------------------- function Scope_In_Main_Unit (Scop : Entity_Id) return Boolean; ! -- Return True if Scop is in the main unit or its spec, or in a ! -- parent of the main unit if it is a child unit. procedure Add_Call (Called : Entity_Id; Caller : Entity_Id := Empty); -- Make two entries in Inlined table, for an inlined subprogram being --- 138,144 ---- ----------------------- function Scope_In_Main_Unit (Scop : Entity_Id) return Boolean; ! -- Return True if Scop is in the main unit or its spec procedure Add_Call (Called : Entity_Id; Caller : Entity_Id := Empty); -- Make two entries in Inlined table, for an inlined subprogram being *************** package body Inline is *** 339,345 **** elsif not Is_Inlined (Pack) and then not Has_Completion (E) - and then not Scope_In_Main_Unit (Pack) then Set_Is_Inlined (Pack); Inlined_Bodies.Increment_Last; --- 337,342 ---- *************** package body Inline is *** 355,360 **** --- 352,358 ---- procedure Add_Inlined_Subprogram (Index : Subp_Index) is E : constant Entity_Id := Inlined.Table (Index).Name; + Pack : constant Entity_Id := Cunit_Entity (Get_Code_Unit (E)); Succ : Succ_Index; Subp : Subp_Index; *************** package body Inline is *** 390,396 **** function Process (N : Node_Id) return Traverse_Result; -- Look for calls to subprograms with no previous spec, declared ! -- in the same enclosiong package body. ------------- -- Process -- --- 388,394 ---- function Process (N : Node_Id) return Traverse_Result; -- Look for calls to subprograms with no previous spec, declared ! -- in the same enclosing package body. ------------- -- Process -- *************** package body Inline is *** 474,483 **** -- Start of processing for Add_Inlined_Subprogram begin ! -- Insert the current subprogram in the list of inlined subprograms, ! -- if it can actually be inlined by the back-end. ! if not Scope_In_Main_Unit (E) and then Is_Inlined (E) and then not Is_Nested (E) and then not Has_Initialized_Type (E) --- 472,483 ---- -- Start of processing for Add_Inlined_Subprogram begin ! -- Insert the current subprogram in the list of inlined subprograms, if ! -- it can actually be inlined by the back-end, and if its unit is known ! -- to be inlined, or is an instance whose body will be analyzed anyway. ! if (Is_Inlined (Pack) or else Is_Generic_Instance (Pack)) ! and then not Scope_In_Main_Unit (E) and then Is_Inlined (E) and then not Is_Nested (E) and then not Has_Initialized_Type (E) *************** package body Inline is *** 626,631 **** --- 626,684 ---- Pack : Entity_Id; S : Succ_Index; + function Is_Ancestor_Of_Main + (U_Name : Entity_Id; + Nam : Node_Id) return Boolean; + -- Determine whether the unit whose body is loaded is an ancestor of + -- the main unit, and has a with_clause on it. The body is not + -- analyzed yet, so the check is purely lexical: the name of the with + -- clause is a selected component, and names of ancestors must match. + + ------------------------- + -- Is_Ancestor_Of_Main -- + ------------------------- + + function Is_Ancestor_Of_Main + (U_Name : Entity_Id; + Nam : Node_Id) return Boolean + is + Pref : Node_Id; + + begin + if Nkind (Nam) /= N_Selected_Component then + return False; + + else + if Chars (Selector_Name (Nam)) /= + Chars (Cunit_Entity (Main_Unit)) + then + return False; + end if; + + Pref := Prefix (Nam); + if Nkind (Pref) = N_Identifier then + + -- Par is an ancestor of Par.Child. + + return Chars (Pref) = Chars (U_Name); + + elsif Nkind (Pref) = N_Selected_Component + and then Chars (Selector_Name (Pref)) = Chars (U_Name) + then + -- Par.Child is an ancestor of Par.Child.Grand. + + return True; -- should check that ancestor match + + else + -- A is an ancestor of A.B.C if it is an ancestor of A.B + + return Is_Ancestor_Of_Main (U_Name, Pref); + end if; + end if; + end Is_Ancestor_Of_Main; + + -- Start of processing for Analyze_Inlined_Bodies + begin Analyzing_Inlined_Bodies := False; *************** package body Inline is *** 651,658 **** Comp_Unit := Parent (Comp_Unit); end loop; ! -- Load the body, unless it the main unit, or is an instance ! -- whose body has already been analyzed. if Present (Comp_Unit) and then Comp_Unit /= Cunit (Main_Unit) --- 704,711 ---- Comp_Unit := Parent (Comp_Unit); end loop; ! -- Load the body, unless it the main unit, or is an instance whose ! -- body has already been analyzed. if Present (Comp_Unit) and then Comp_Unit /= Cunit (Main_Unit) *************** package body Inline is *** 668,674 **** begin if not Is_Loaded (Bname) then ! Load_Needed_Body (Comp_Unit, OK); if not OK then --- 721,728 ---- begin if not Is_Loaded (Bname) then ! Style_Check := False; ! Load_Needed_Body (Comp_Unit, OK, Do_Analyze => False); if not OK then *************** package body Inline is *** 682,687 **** --- 736,778 ---- Error_Msg_File_1 := Get_File_Name (Bname, Subunit => False); Error_Msg_N ("\but file{ was not found!?", Comp_Unit); + + else + -- If the package to be inlined is an ancestor unit of + -- the main unit, and it has a semantic dependence on + -- it, the inlining cannot take place to prevent an + -- elaboration circularity. The desired body is not + -- analyzed yet, to prevent the completion of Taft + -- amendment types that would lead to elaboration + -- circularities in gigi. + + declare + U_Id : constant Entity_Id := + Defining_Entity (Unit (Comp_Unit)); + Body_Unit : constant Node_Id := + Library_Unit (Comp_Unit); + Item : Node_Id; + + begin + Item := First (Context_Items (Body_Unit)); + while Present (Item) loop + if Nkind (Item) = N_With_Clause + and then + Is_Ancestor_Of_Main (U_Id, Name (Item)) + then + Set_Is_Inlined (U_Id, False); + exit; + end if; + + Next (Item); + end loop; + + -- If no suspicious with_clauses, analyze the body. + + if Is_Inlined (U_Id) then + Semantics (Body_Unit); + end if; + end; end if; end if; end; *************** package body Inline is *** 698,711 **** Instantiate_Bodies; ! -- The list of inlined subprograms is an overestimate, because ! -- it includes inlined functions called from functions that are ! -- compiled as part of an inlined package, but are not themselves ! -- called. An accurate computation of just those subprograms that ! -- are needed requires that we perform a transitive closure over ! -- the call graph, starting from calls in the main program. Here ! -- we do one step of the inverse transitive closure, and reset ! -- the Is_Called flag on subprograms all of whose callers are not. for Index in Inlined.First .. Inlined.Last loop S := Inlined.Table (Index).First_Succ; --- 789,802 ---- Instantiate_Bodies; ! -- The list of inlined subprograms is an overestimate, because it ! -- includes inlined functions called from functions that are compiled ! -- as part of an inlined package, but are not themselves called. An ! -- accurate computation of just those subprograms that are needed ! -- requires that we perform a transitive closure over the call graph, ! -- starting from calls in the main program. Here we do one step of ! -- the inverse transitive closure, and reset the Is_Called flag on ! -- subprograms all of whose callers are not. for Index in Inlined.First .. Inlined.Last loop S := Inlined.Table (Index).First_Succ; *************** package body Inline is *** 1125,1166 **** ------------------------ function Scope_In_Main_Unit (Scop : Entity_Id) return Boolean is ! Comp : Node_Id; ! S : Entity_Id; ! Ent : Entity_Id := Cunit_Entity (Main_Unit); begin ! -- The scope may be within the main unit, or it may be an ancestor ! -- of the main unit, if the main unit is a child unit. In both cases ! -- it makes no sense to process the body before the main unit. In ! -- the second case, this may lead to circularities if a parent body ! -- depends on a child spec, and we are analyzing the child. ! ! S := Scop; ! while Scope (S) /= Standard_Standard ! and then not Is_Child_Unit (S) ! loop ! S := Scope (S); ! end loop; ! ! Comp := Parent (S); ! while Present (Comp) ! and then Nkind (Comp) /= N_Compilation_Unit ! loop ! Comp := Parent (Comp); ! end loop; ! ! if Is_Child_Unit (Ent) then ! while Present (Ent) ! and then Is_Child_Unit (Ent) ! loop ! if Scope (Ent) = S then ! return True; ! end if; ! ! Ent := Scope (Ent); ! end loop; ! end if; return Comp = Cunit (Main_Unit) --- 1216,1229 ---- ------------------------ function Scope_In_Main_Unit (Scop : Entity_Id) return Boolean is ! Comp : constant Node_Id := Cunit (Get_Code_Unit (Scop)); begin ! -- Check whether the scope of the subprogram to inline is within the ! -- main unit or within its spec. In either case there are no additional ! -- bodies to process. If the subprogram appears in a parent of the ! -- current unit, the check on whether inlining is possible is done in ! -- Analyze_Inlined_Bodies. return Comp = Cunit (Main_Unit) diff -Nrcpad gcc-4.5.2/gcc/ada/inline.ads gcc-4.6.0/gcc/ada/inline.ads *** gcc-4.5.2/gcc/ada/inline.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/inline.ads Wed Jun 23 09:53:24 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** *** 36,41 **** --- 36,42 ---- -- Frontend, and thus are not mutually recursive. with Alloc; + with Opt; use Opt; with Sem; use Sem; with Table; with Types; use Types; *************** package Inline is *** 84,89 **** --- 85,94 ---- -- This means we have to capture this information from the current scope -- at the point of instantiation. + Version : Ada_Version_Type; + -- The body must be compiled with the same language version as the + -- spec. The version may be set by a configuration pragma in a separate + -- file or in the current file, and may differ from body to body. end record; package Pending_Instantiations is new Table.Table ( diff -Nrcpad gcc-4.5.2/gcc/ada/itypes.adb gcc-4.6.0/gcc/ada/itypes.adb *** gcc-4.5.2/gcc/ada/itypes.adb Fri Apr 10 14:39:18 2009 --- gcc-4.6.0/gcc/ada/itypes.adb Thu Oct 7 09:12:36 2010 *************** package body Itypes is *** 112,117 **** --- 112,118 ---- Set_Treat_As_Volatile (I_Typ, Treat_As_Volatile (T)); Set_Is_Atomic (I_Typ, Is_Atomic (T)); Set_Is_Ada_2005_Only (I_Typ, Is_Ada_2005_Only (T)); + Set_Is_Ada_2012_Only (I_Typ, Is_Ada_2012_Only (T)); Set_Can_Never_Be_Null (I_Typ); return I_Typ; diff -Nrcpad gcc-4.5.2/gcc/ada/itypes.ads gcc-4.6.0/gcc/ada/itypes.ads *** gcc-4.5.2/gcc/ada/itypes.ads Tue Apr 8 07:04:25 2008 --- gcc-4.6.0/gcc/ada/itypes.ads Thu Jun 17 10:45:18 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Itypes is *** 127,133 **** -- If the implicit type does not need an external name, then the -- Related_Id parameter is omitted (and hence Empty). In this case -- Suffix and Suffix_Index are ignored and the implicit type name is ! -- created by a call to New_Internal_Name ('T'). -- -- Note that in all cases, the name starts with "T". This is used -- to identify implicit types in the error message handling circuits. --- 127,133 ---- -- If the implicit type does not need an external name, then the -- Related_Id parameter is omitted (and hence Empty). In this case -- Suffix and Suffix_Index are ignored and the implicit type name is ! -- created by a call to Make_Temporary. -- -- Note that in all cases, the name starts with "T". This is used -- to identify implicit types in the error message handling circuits. diff -Nrcpad gcc-4.5.2/gcc/ada/layout.adb gcc-4.6.0/gcc/ada/layout.adb *** gcc-4.5.2/gcc/ada/layout.adb Wed Jun 24 09:11:43 2009 --- gcc-4.6.0/gcc/ada/layout.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body Layout is *** 620,626 **** Name => New_Occurrence_Of (Ent, Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars => Vname), Selector_Name => New_Occurrence_Of (Comp, Loc)))); else --- 620,626 ---- Name => New_Occurrence_Of (Ent, Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Vname), Selector_Name => New_Occurrence_Of (Comp, Loc)))); else *************** package body Layout is *** 628,634 **** Make_Function_Call (Loc, Name => New_Occurrence_Of (Ent, Loc), Parameter_Associations => New_List ( ! Make_Identifier (Loc, Chars => Vname))); end if; else --- 628,634 ---- Make_Function_Call (Loc, Name => New_Occurrence_Of (Ent, Loc), Parameter_Associations => New_List ( ! Make_Identifier (Loc, Vname))); end if; else *************** package body Layout is *** 727,733 **** Size := (Dynamic, Expr_From_SO_Ref (Loc, Component_Size (E))); end if; ! -- Loop through indices Indx := First_Index (E); while Present (Indx) loop --- 727,733 ---- Size := (Dynamic, Expr_From_SO_Ref (Loc, Component_Size (E))); end if; ! -- Loop through indexes Indx := First_Index (E); while Present (Indx) loop *************** package body Layout is *** 988,994 **** N := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Chars => Vname), Selector_Name => New_Occurrence_Of (Entity (N), Loc)); -- Set the Etype attributes of the selected name and its prefix. --- 988,994 ---- N := Make_Selected_Component (Loc, ! Prefix => Make_Identifier (Loc, Vname), Selector_Name => New_Occurrence_Of (Entity (N), Loc)); -- Set the Etype attributes of the selected name and its prefix. *************** package body Layout is *** 1059,1065 **** Size := (Dynamic, Expr_From_SO_Ref (Loc, Component_Size (E))); end if; ! -- Loop to process array indices Indx := First_Index (E); while Present (Indx) loop --- 1059,1065 ---- Size := (Dynamic, Expr_From_SO_Ref (Loc, Component_Size (E))); end if; ! -- Loop to process array indexes Indx := First_Index (E); while Present (Indx) loop *************** package body Layout is *** 1990,1996 **** Make_Function_Call (Loc, Name => New_Occurrence_Of (RMS_Ent, Loc), Parameter_Associations => New_List ( ! Make_Identifier (Loc, Chars => Vname))); -- If the size is represented by a constant, then the -- expression we want is a reference to this constant --- 1990,1996 ---- Make_Function_Call (Loc, Name => New_Occurrence_Of (RMS_Ent, Loc), Parameter_Associations => New_List ( ! Make_Identifier (Loc, Vname))); -- If the size is represented by a constant, then the -- expression we want is a reference to this constant *************** package body Layout is *** 2104,2110 **** Discrim := Make_Selected_Component (Loc, Prefix => ! Make_Identifier (Loc, Chars => Vname), Selector_Name => New_Occurrence_Of (Entity (Name (Vpart)), Loc)); --- 2104,2110 ---- Discrim := Make_Selected_Component (Loc, Prefix => ! Make_Identifier (Loc, Vname), Selector_Name => New_Occurrence_Of (Entity (Name (Vpart)), Loc)); *************** package body Layout is *** 2130,2139 **** Append ( Make_Selected_Component (Loc, Prefix => ! Make_Identifier (Loc, Chars => Vname), Selector_Name => ! New_Occurrence_Of ! (D_Entity, Loc)), D_List); D_Entity := Next_Discriminant (D_Entity); --- 2130,2138 ---- Append ( Make_Selected_Component (Loc, Prefix => ! Make_Identifier (Loc, Vname), Selector_Name => ! New_Occurrence_Of (D_Entity, Loc)), D_List); D_Entity := Next_Discriminant (D_Entity); *************** package body Layout is *** 2560,2581 **** begin -- For some reasons, access types can cause trouble, So let's ! -- just do this for discrete types ??? if Present (CT) ! and then Is_Discrete_Type (CT) and then Known_Static_Esize (CT) then declare S : constant Uint := Esize (CT); - begin ! if S = 8 or else ! S = 16 or else ! S = 32 or else ! S = 64 ! then ! Set_Component_Size (E, Esize (CT)); end if; end; end if; --- 2559,2575 ---- begin -- For some reasons, access types can cause trouble, So let's ! -- just do this for scalar types ??? if Present (CT) ! and then Is_Scalar_Type (CT) and then Known_Static_Esize (CT) then declare S : constant Uint := Esize (CT); begin ! if Addressable (S) then ! Set_Component_Size (E, S); end if; end; end if; *************** package body Layout is *** 2736,2743 **** begin if Spec < Min then Error_Msg_Uint_1 := Min; ! Error_Msg_NE ! ("size for & too small, minimum allowed is ^", SC, E); Init_Esize (E); Init_RM_Size (E); end if; --- 2730,2736 ---- begin if Spec < Min then Error_Msg_Uint_1 := Min; ! Error_Msg_NE ("size for & too small, minimum allowed is ^", SC, E); Init_Esize (E); Init_RM_Size (E); end if; *************** package body Layout is *** 3119,3129 **** Make_Func : Boolean := False) return Dynamic_SO_Ref is Loc : constant Source_Ptr := Sloc (Ins_Type); ! ! K : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('K')); ! Decl : Node_Id; Vtype_Primary_View : Entity_Id; --- 3112,3118 ---- Make_Func : Boolean := False) return Dynamic_SO_Ref is Loc : constant Source_Ptr := Sloc (Ins_Type); ! K : constant Entity_Id := Make_Temporary (Loc, 'K'); Decl : Node_Id; Vtype_Primary_View : Entity_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/lib-load.adb gcc-4.6.0/gcc/ada/lib-load.adb *** gcc-4.5.2/gcc/ada/lib-load.adb Wed Jul 15 10:34:59 2009 --- gcc-4.6.0/gcc/ada/lib-load.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Lib.Load is *** 214,224 **** --- 214,226 ---- Expected_Unit => Spec_Name, Fatal_Error => True, Generate_Code => False, + Has_Allocator => False, Has_RACW => False, Is_Compiler_Unit => False, Ident_String => Empty, Loading => False, Main_Priority => Default_Main_Priority, + Main_CPU => Default_Main_CPU, Munit_Index => 0, Serial_Number => 0, Source_Index => No_Source_File, *************** package body Lib.Load is *** 318,328 **** --- 320,332 ---- Expected_Unit => No_Unit_Name, Fatal_Error => False, Generate_Code => False, + Has_Allocator => False, Has_RACW => False, Is_Compiler_Unit => False, Ident_String => Empty, Loading => True, Main_Priority => Default_Main_Priority, + Main_CPU => Default_Main_CPU, Munit_Index => 0, Serial_Number => 0, Source_Index => Main_Source_File, *************** package body Lib.Load is *** 344,350 **** Subunit : Boolean; Corr_Body : Unit_Number_Type := No_Unit; Renamings : Boolean := False; ! With_Node : Node_Id := Empty) return Unit_Number_Type is Calling_Unit : Unit_Number_Type; Uname_Actual : Unit_Name_Type; --- 348,355 ---- Subunit : Boolean; Corr_Body : Unit_Number_Type := No_Unit; Renamings : Boolean := False; ! With_Node : Node_Id := Empty; ! PMES : Boolean := False) return Unit_Number_Type is Calling_Unit : Unit_Number_Type; Uname_Actual : Unit_Name_Type; *************** package body Lib.Load is *** 352,361 **** Unump : Unit_Number_Type; Fname : File_Name_Type; Src_Ind : Source_File_Index; ! ! -- Start of processing for Load_Unit begin -- If renamings are allowed and we have a child unit name, then we -- must first load the parent to deal with finding the real name. -- Retain the with_clause that names the child, so that if it is --- 357,367 ---- Unump : Unit_Number_Type; Fname : File_Name_Type; Src_Ind : Source_File_Index; ! Save_PMES : constant Boolean := Parsing_Main_Extended_Source; begin + Parsing_Main_Extended_Source := PMES; + -- If renamings are allowed and we have a child unit name, then we -- must first load the parent to deal with finding the real name. -- Retain the with_clause that names the child, so that if it is *************** package body Lib.Load is *** 372,377 **** --- 378,384 ---- With_Node => With_Node); if Unump = No_Unit then + Parsing_Main_Extended_Source := Save_PMES; return No_Unit; end if; *************** package body Lib.Load is *** 513,519 **** -- See if we already have an entry for this unit Unum := Main_Unit; - while Unum <= Units.Last loop exit when Uname_Actual = Units.Table (Unum).Unit_Name; Unum := Unum + 1; --- 520,525 ---- *************** package body Lib.Load is *** 553,562 **** end if; Write_Dependency_Chain; ! return No_Unit; else ! return No_Unit; end if; end if; end loop; --- 559,570 ---- end if; Write_Dependency_Chain; ! Unum := No_Unit; ! goto Done; else ! Unum := No_Unit; ! goto Done; end if; end if; end loop; *************** package body Lib.Load is *** 601,607 **** Load_Stack.Decrement_Last; end if; ! return No_Unit; end if; if Debug_Flag_L then --- 609,616 ---- Load_Stack.Decrement_Last; end if; ! Unum := No_Unit; ! goto Done; end if; if Debug_Flag_L then *************** package body Lib.Load is *** 611,617 **** end if; Load_Stack.Decrement_Last; ! return Unum; -- Unit is not already in table, so try to open the file --- 620,626 ---- end if; Load_Stack.Decrement_Last; ! goto Done; -- Unit is not already in table, so try to open the file *************** package body Lib.Load is *** 642,652 **** --- 651,663 ---- Expected_Unit => Uname_Actual, Fatal_Error => False, Generate_Code => False, + Has_Allocator => False, Has_RACW => False, Is_Compiler_Unit => False, Ident_String => Empty, Loading => True, Main_Priority => Default_Main_Priority, + Main_CPU => Default_Main_CPU, Munit_Index => 0, Serial_Number => 0, Source_Index => Src_Ind, *************** package body Lib.Load is *** 658,669 **** -- Parse the new unit declare ! Save_Index : constant Nat := Multiple_Unit_Index; begin Multiple_Unit_Index := Get_Unit_Index (Uname_Actual); Units.Table (Unum).Munit_Index := Multiple_Unit_Index; Initialize_Scanner (Unum, Source_Index (Unum)); Discard_List (Par (Configuration_Pragmas => False)); Multiple_Unit_Index := Save_Index; Set_Loading (Unum, False); end; --- 669,690 ---- -- Parse the new unit declare ! Save_Index : constant Nat := Multiple_Unit_Index; ! Save_PMES : constant Boolean := Parsing_Main_Extended_Source; ! begin Multiple_Unit_Index := Get_Unit_Index (Uname_Actual); Units.Table (Unum).Munit_Index := Multiple_Unit_Index; Initialize_Scanner (Unum, Source_Index (Unum)); + + if Calling_Unit = Main_Unit and then Subunit then + Parsing_Main_Extended_Source := True; + end if; + Discard_List (Par (Configuration_Pragmas => False)); + + Parsing_Main_Extended_Source := Save_PMES; + Multiple_Unit_Index := Save_Index; Set_Loading (Unum, False); end; *************** package body Lib.Load is *** 680,686 **** Error_Msg ("\incorrect spec in file { must be removed first!", Load_Msg_Sloc); ! return No_Unit; end if; -- If loaded unit had a fatal error, then caller inherits it! --- 701,708 ---- Error_Msg ("\incorrect spec in file { must be removed first!", Load_Msg_Sloc); ! Unum := No_Unit; ! goto Done; end if; -- If loaded unit had a fatal error, then caller inherits it! *************** package body Lib.Load is *** 697,703 **** -- All done, return unit number ! return Unum; -- Case of file not found --- 719,725 ---- -- All done, return unit number ! goto Done; -- Case of file not found *************** package body Lib.Load is *** 751,759 **** Units.Decrement_Last; end if; ! return No_Unit; end if; end if; end Load_Unit; -------------------------- --- 773,788 ---- Units.Decrement_Last; end if; ! Unum := No_Unit; ! goto Done; end if; end if; + + -- Here to exit, with result in Unum + + <> + Parsing_Main_Extended_Source := Save_PMES; + return Unum; end Load_Unit; -------------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/lib-load.ads gcc-4.6.0/gcc/ada/lib-load.ads *** gcc-4.5.2/gcc/ada/lib-load.ads Wed Apr 22 10:11:00 2009 --- gcc-4.6.0/gcc/ada/lib-load.ads Fri Sep 10 14:41:21 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Lib.Load is *** 109,115 **** Subunit : Boolean; Corr_Body : Unit_Number_Type := No_Unit; Renamings : Boolean := False; ! With_Node : Node_Id := Empty) return Unit_Number_Type; -- This function loads and parses the unit specified by Load_Name (or -- returns the unit number for the previously constructed units table -- entry if this is not the first call for this unit). Required indicates --- 109,116 ---- Subunit : Boolean; Corr_Body : Unit_Number_Type := No_Unit; Renamings : Boolean := False; ! With_Node : Node_Id := Empty; ! PMES : Boolean := False) return Unit_Number_Type; -- This function loads and parses the unit specified by Load_Name (or -- returns the unit number for the previously constructed units table -- entry if this is not the first call for this unit). Required indicates *************** package Lib.Load is *** 151,156 **** --- 152,160 ---- -- With_Node is set to the with_clause or limited_with_clause causing -- the unit to be loaded, and is used to bypass the circular dependency -- check in the case of a limited_with_clause (Ada 2005, AI-50217). + -- + -- PMES indicates the required setting of Parsing_Main_Extended_Unit during + -- loading of the unit. This flag is saved and restored over the call. procedure Change_Main_Unit_To_Spec; -- This procedure is called if the main unit file contains a No_Body pragma diff -Nrcpad gcc-4.5.2/gcc/ada/lib-util.adb gcc-4.6.0/gcc/ada/lib-util.adb *** gcc-4.5.2/gcc/ada/lib-util.adb Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/lib-util.adb Mon Jun 14 13:09:06 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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,30 **** --- 25,31 ---- with Hostparm; with Osint.C; use Osint.C; + with Stringt; use Stringt; package body Lib.Util is *************** package body Lib.Util is *** 39,46 **** Info_Buffer_Col : Natural := 1; -- Column number of next character to be written. ! -- Can be different from Info_Buffer_Len + 1 ! -- because of tab characters written by Write_Info_Tab. --------------------- -- Write_Info_Char -- --- 40,52 ---- Info_Buffer_Col : Natural := 1; -- Column number of next character to be written. ! -- Can be different from Info_Buffer_Len + 1 because of tab characters ! -- written by Write_Info_Tab. ! ! procedure Write_Info_Hex_Byte (J : Natural); ! -- Place two hex digits representing the value J (which is in the range ! -- 0-255) in Info_Buffer, incrementing Info_Buffer_Len by 2. The digits ! -- are output using lower case letters. --------------------- -- Write_Info_Char -- *************** package body Lib.Util is *** 58,77 **** -------------------------- procedure Write_Info_Char_Code (Code : Char_Code) is - - procedure Write_Info_Hex_Byte (J : Natural); - -- Write single hex digit - - procedure Write_Info_Hex_Byte (J : Natural) is - Hexd : constant String := "0123456789abcdef"; - - begin - Write_Info_Char (Hexd (J / 16 + 1)); - Write_Info_Char (Hexd (J mod 16 + 1)); - end Write_Info_Hex_Byte; - - -- Start of processing for Write_Info_Char_Code - begin -- 00 .. 7F --- 64,69 ---- *************** package body Lib.Util is *** 128,138 **** --- 120,158 ---- end Write_Info_EOL; ------------------------- + -- Write_Info_Hex_Byte -- + ------------------------- + + procedure Write_Info_Hex_Byte (J : Natural) is + Hexd : constant array (0 .. 15) of Character := "0123456789abcdef"; + begin + Write_Info_Char (Hexd (J / 16)); + Write_Info_Char (Hexd (J mod 16)); + end Write_Info_Hex_Byte; + + ------------------------- -- Write_Info_Initiate -- ------------------------- procedure Write_Info_Initiate (Key : Character) renames Write_Info_Char; + -------------------- + -- Write_Info_Int -- + -------------------- + + procedure Write_Info_Int (N : Int) is + begin + if N >= 0 then + Write_Info_Nat (N); + + -- Negative numbers, use Write_Info_Uint to avoid problems with largest + -- negative number. + + else + Write_Info_Uint (UI_From_Int (N)); + end if; + end Write_Info_Int; + --------------------- -- Write_Info_Name -- --------------------- *************** package body Lib.Util is *** 169,174 **** --- 189,226 ---- Write_Info_Char (Character'Val (N mod 10 + Character'Pos ('0'))); end Write_Info_Nat; + --------------------- + -- Write_Info_Slit -- + --------------------- + + procedure Write_Info_Slit (S : String_Id) is + C : Character; + + begin + Write_Info_Str (""""); + + for J in 1 .. String_Length (S) loop + C := Get_Character (Get_String_Char (S, J)); + + if C in Character'Val (16#20#) .. Character'Val (16#7E#) + and then C /= '{' + then + Write_Info_Char (C); + + if C = '"' then + Write_Info_Char (C); + end if; + + else + Write_Info_Char ('{'); + Write_Info_Hex_Byte (Character'Pos (C)); + Write_Info_Char ('}'); + end if; + end loop; + + Write_Info_Char ('"'); + end Write_Info_Slit; + -------------------- -- Write_Info_Str -- -------------------- *************** package body Lib.Util is *** 225,231 **** Info_Buffer_Len := 0; Info_Buffer_Col := 1; - end Write_Info_Terminate; end Lib.Util; --- 277,292 ---- Info_Buffer_Len := 0; Info_Buffer_Col := 1; end Write_Info_Terminate; + --------------------- + -- Write_Info_Uint -- + --------------------- + + procedure Write_Info_Uint (N : Uint) is + begin + UI_Image (N, Decimal); + Write_Info_Str (UI_Image_Buffer (1 .. UI_Image_Length)); + end Write_Info_Uint; + end Lib.Util; diff -Nrcpad gcc-4.5.2/gcc/ada/lib-util.ads gcc-4.6.0/gcc/ada/lib-util.ads *** gcc-4.5.2/gcc/ada/lib-util.ads Wed Jul 22 15:35:52 2009 --- gcc-4.6.0/gcc/ada/lib-util.ads Mon Jun 14 13:01:07 2010 *************** *** 23,28 **** --- 23,30 ---- -- -- ------------------------------------------------------------------------------ + with Uintp; use Uintp; + package Lib.Util is -- This package implements a buffered write of library information *************** package Lib.Util is *** 52,57 **** --- 54,63 ---- procedure Write_Info_Nat (N : Nat); -- Adds image of N to Info_Buffer with no leading or trailing blanks + procedure Write_Info_Int (N : Int); + -- Adds image of N to Info_Buffer with no leading or trailing blanks. A + -- minus sign is prepended for negative values. + procedure Write_Info_Name (Name : Name_Id); procedure Write_Info_Name (Name : File_Name_Type); procedure Write_Info_Name (Name : Unit_Name_Type); *************** package Lib.Util is *** 59,64 **** --- 65,73 ---- -- name is written literally from the names table entry without modifying -- the case, using simply Get_Name_String. + procedure Write_Info_Slit (S : String_Id); + -- Write string literal value in format required for L/N lines in ali file + procedure Write_Info_Str (Val : String); -- Adds characters of Val to Info_Buffer surrounded by quotes *************** package Lib.Util is *** 70,73 **** --- 79,86 ---- procedure Write_Info_Terminate; -- Terminate current info line and output lines built in Info_Buffer + procedure Write_Info_Uint (N : Uint); + -- Adds decimal image of N to Info_Buffer with no leading or trailing + -- blanks. A minus sign is prepended for negative values. + end Lib.Util; diff -Nrcpad gcc-4.5.2/gcc/ada/lib-writ.adb gcc-4.6.0/gcc/ada/lib-writ.adb *** gcc-4.5.2/gcc/ada/lib-writ.adb Wed Jul 15 10:34:59 2009 --- gcc-4.6.0/gcc/ada/lib-writ.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Lib.Writ is *** 80,90 **** --- 80,92 ---- Dynamic_Elab => False, Fatal_Error => False, Generate_Code => False, + Has_Allocator => False, Has_RACW => False, Is_Compiler_Unit => False, Ident_String => Empty, Loading => False, Main_Priority => -1, + Main_CPU => -1, Munit_Index => 0, Serial_Number => 0, Version => 0, *************** package body Lib.Writ is *** 135,145 **** --- 137,149 ---- Dynamic_Elab => False, Fatal_Error => False, Generate_Code => False, + Has_Allocator => False, Has_RACW => False, Is_Compiler_Unit => False, Ident_String => Empty, Loading => False, Main_Priority => -1, + Main_CPU => -1, Munit_Index => 0, Serial_Number => 0, Version => 0, *************** package body Lib.Writ is *** 592,633 **** for J in 1 .. Linker_Option_Lines.Last loop declare ! S : constant Linker_Option_Entry := ! Linker_Option_Lines.Table (J); ! C : Character; ! begin if S.Unit = Unit_Num then Write_Info_Initiate ('L'); ! Write_Info_Str (" """); ! for J in 1 .. String_Length (S.Option) loop ! C := Get_Character (Get_String_Char (S.Option, J)); ! if C in Character'Val (16#20#) .. Character'Val (16#7E#) ! and then C /= '{' ! then ! Write_Info_Char (C); ! if C = '"' then ! Write_Info_Char (C); end if; - else declare ! Hex : constant array (0 .. 15) of Character := ! "0123456789ABCDEF"; begin ! Write_Info_Char ('{'); ! Write_Info_Char (Hex (Character'Pos (C) / 16)); ! Write_Info_Char (Hex (Character'Pos (C) mod 16)); ! Write_Info_Char ('}'); end; - end if; - end loop; ! Write_Info_Char ('"'); Write_Info_EOL; end if; end; --- 596,685 ---- for J in 1 .. Linker_Option_Lines.Last loop declare ! S : Linker_Option_Entry renames Linker_Option_Lines.Table (J); begin if S.Unit = Unit_Num then Write_Info_Initiate ('L'); ! Write_Info_Char (' '); ! Write_Info_Slit (S.Option); ! Write_Info_EOL; ! end if; ! end; ! end loop; ! -- Output notes ! for J in 1 .. Notes.Last loop ! declare ! N : constant Node_Id := Notes.Table (J).Pragma_Node; ! L : constant Source_Ptr := Sloc (N); ! U : constant Unit_Number_Type := Notes.Table (J).Unit; ! C : Character; ! begin ! if U = Unit_Num then ! Write_Info_Initiate ('N'); ! Write_Info_Char (' '); ! ! case Chars (Pragma_Identifier (N)) is ! when Name_Annotate => ! C := 'A'; ! when Name_Comment => ! C := 'C'; ! when Name_Ident => ! C := 'I'; ! when Name_Title => ! C := 'T'; ! when Name_Subtitle => ! C := 'S'; ! when others => ! raise Program_Error; ! end case; ! ! Write_Info_Char (C); ! Write_Info_Int (Int (Get_Logical_Line_Number (L))); ! Write_Info_Char (':'); ! Write_Info_Int (Int (Get_Column_Number (L))); ! ! declare ! A : Node_Id; ! ! begin ! A := First (Pragma_Argument_Associations (N)); ! while Present (A) loop ! Write_Info_Char (' '); ! ! if Chars (A) /= No_Name then ! Write_Info_Name (Chars (A)); ! Write_Info_Char (':'); end if; declare ! Expr : constant Node_Id := Expression (A); begin ! if Nkind (Expr) = N_Identifier then ! Write_Info_Name (Chars (Expr)); ! ! elsif Nkind (Expr) = N_Integer_Literal ! and then Is_Static_Expression (Expr) ! then ! Write_Info_Uint (Intval (Expr)); ! ! elsif Nkind (Expr) = N_String_Literal ! and then Is_Static_Expression (Expr) ! then ! Write_Info_Slit (Strval (Expr)); ! ! else ! Write_Info_Str (""); ! end if; end; ! Next (A); ! end loop; ! end; ! Write_Info_EOL; end if; end; *************** package body Lib.Writ is *** 811,818 **** return; end if; ! -- Build sorted source dependency table. We do this right away, ! -- because it is referenced by Up_To_Date_ALI_File_Exists. for Unum in Units.First .. Last_Unit loop if Cunit_Entity (Unum) = Empty --- 863,870 ---- return; end if; ! -- Build sorted source dependency table. We do this right away, because ! -- it is referenced by Up_To_Date_ALI_File_Exists. for Unum in Units.First .. Last_Unit loop if Cunit_Entity (Unum) = Empty *************** package body Lib.Writ is *** 827,835 **** Lib.Sort (Sdep_Table (1 .. Num_Sdep)); ! -- If we are not generating code, and there is an up to date ! -- ali file accessible, read it, and acquire the compilation ! -- arguments from this file. if Operating_Mode /= Generate_Code then if Up_To_Date_ALI_File_Exists then --- 879,887 ---- Lib.Sort (Sdep_Table (1 .. Num_Sdep)); ! -- If we are not generating code, and there is an up to date ALI file ! -- file accessible, read it, and acquire the compilation arguments from ! -- this file. if Operating_Mode /= Generate_Code then if Up_To_Date_ALI_File_Exists then *************** package body Lib.Writ is *** 877,882 **** --- 929,943 ---- Write_Info_Nat (Opt.Time_Slice_Value); end if; + if Has_Allocator (Main_Unit) then + Write_Info_Str (" AB"); + end if; + + if Main_CPU (Main_Unit) /= Default_Main_CPU then + Write_Info_Str (" C="); + Write_Info_Nat (Main_CPU (Main_Unit)); + end if; + Write_Info_Str (" W="); Write_Info_Char (WC_Encoding_Letters (Wide_Character_Encoding_Method)); diff -Nrcpad gcc-4.5.2/gcc/ada/lib-writ.ads gcc-4.6.0/gcc/ada/lib-writ.ads *** gcc-4.5.2/gcc/ada/lib-writ.ads Wed Jan 27 13:39:30 2010 --- gcc-4.6.0/gcc/ada/lib-writ.ads Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Lib.Writ is *** 116,122 **** -- -- M Main Program -- -- --------------------- ! -- M type [priority] [T=time-slice] W=? -- This line appears only if the main unit for this file is suitable -- for use as a main program. The parameters are: --- 116,122 ---- -- -- M Main Program -- -- --------------------- ! -- M type [priority] [T=time-slice] [AB] [C=cpu] W=? -- This line appears only if the main unit for this file is suitable -- for use as a main program. The parameters are: *************** package Lib.Writ is *** 141,146 **** --- 141,160 ---- -- milliseconds. The actual significance of this parameter is -- target dependent. + -- AB + + -- Present if there is an allocator in the body of the procedure + -- after the BEGIN. This will be a violation of the restriction + -- No_Allocators_After_Elaboration if it is present, and this + -- unit is used as a main program (only the binder can find the + -- violation, since only the binder knows the main program). + + -- C=cpu + + -- Present only if there was a valid pragma CPU in the + -- corresponding unit to set the main task affinity. It is an + -- unsigned decimal integer. + -- W=? -- This parameter indicates the wide character encoding method used *************** package Lib.Writ is *** 571,583 **** -- source file, so that this order is preserved by the binder in -- constructing the set of linker arguments. --------------------- -- Reference Lines -- --------------------- -- The reference lines contain information about references from any of the ! -- units in the compilation (including, body version and version ! -- attributes, linker options pragmas and source dependencies. -- ------------------------------------ -- -- E External Version References -- --- 585,631 ---- -- source file, so that this order is preserved by the binder in -- constructing the set of linker arguments. + -- -------------- + -- -- N Notes -- + -- -------------- + + -- The final section of unit-specific lines contains notes which record + -- annotations inserted in source code for processing by external tools + -- using pragmas. For each occurrence of any of these pragmas, a line is + -- generated with the following syntax: + + -- N x [:] ... + + -- x is one of: + -- A pragma Annotate + -- C pragma Comment + -- I pragma Ident + -- T pragma Title + -- S pragma Subtitle + + -- is the source location of the pragma in line:col format + + -- Successive entries record the pragma_argument_associations. + + -- If a pragma argument identifier is present, the entry is prefixed + -- with the pragma argument identifier followed by a colon. + + -- represents the pragma argument, and has the following + -- conventions: + + -- - identifiers are output verbatim + -- - static string expressions are output as literals encoded as + -- for L lines + -- - static integer expressions are output as decimal literals + -- - any other expression is replaced by the placeholder "" + --------------------- -- Reference Lines -- --------------------- -- The reference lines contain information about references from any of the ! -- units in the compilation (including body version and version attributes, ! -- linker options pragmas and source dependencies). -- ------------------------------------ -- -- E External Version References -- *************** package Lib.Writ is *** 654,693 **** -- The cross-reference data follows the dependency lines. See the spec of -- Lib.Xref for details on the format of this data. - -- -------------- - -- -- N Notes -- - -- -------------- - - -- The note lines record annotations inserted in source code for processing - -- by external tools using pragmas. For each occurrence of any of these - -- pragmas, a line is generated with the following syntax: - - -- N x [:] ... - - -- x is one of: - -- A pragma Annotate - -- C pragma Comment - -- I pragma Ident - -- T pragma Title - -- S pragma Subtitle - - -- is the source file containing the pragma by its dependency index - -- (first D line has index 1) - -- is the source location of the pragma - - -- Successive entries record the pragma_argument_associations. - - -- For a named association, the entry is prefixed with the pragma argument - -- identifier followed by a colon. - - -- represents the pragma argument, and has the following conventions: - - -- - identifiers are output verbatim - -- - static string expressions are output as literals encoded as for - -- L lines - -- - static integer expressions are output as decimal literals - -- - any other expression is replaced by the placeholder "" - --------------------------------- -- Source Coverage Obligations -- --------------------------------- --- 702,707 ---- *************** package Lib.Writ is *** 696,709 **** -- reference data. See the spec of Par_SCO for full details of the format. ---------------------- ! -- Global_Variables -- ---------------------- ! -- The table structure defined here stores one entry for each ! -- Interrupt_State pragma encountered either in the main source or ! -- in an ancillary with'ed source. Since interrupt state values ! -- have to be consistent across all units in a partition, we may ! -- as well detect inconsistencies at compile time when we can. type Interrupt_State_Entry is record Interrupt_Number : Pos; --- 710,722 ---- -- reference data. See the spec of Par_SCO for full details of the format. ---------------------- ! -- Global Variables -- ---------------------- ! -- The table defined here stores one entry for each Interrupt_State pragma ! -- encountered either in the main source or in an ancillary with'ed source. ! -- Since interrupt state values have to be consistent across all units in a ! -- partition, we detect inconsistencies at compile time when we can. type Interrupt_State_Entry is record Interrupt_Number : Pos; diff -Nrcpad gcc-4.5.2/gcc/ada/lib-xref.adb gcc-4.6.0/gcc/ada/lib-xref.adb *** gcc-4.5.2/gcc/ada/lib-xref.adb Wed Jul 15 10:15:49 2009 --- gcc-4.6.0/gcc/ada/lib-xref.adb Tue Oct 26 12:19:56 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body Lib.Xref is *** 214,220 **** Base_T : Entity_Id; Prim : Elmt_Id; Prim_List : Elist_Id; - Ent : Entity_Id; begin -- Handle subtypes of synchronized types --- 214,219 ---- *************** package body Lib.Xref is *** 242,255 **** -- The check for Present here is to protect against previously -- reported critical errors. ! if Is_Concurrent_Type (Base_T) ! and then Present (Corresponding_Record_Type (Base_T)) ! then ! Prim_List := Primitive_Operations ! (Corresponding_Record_Type (Base_T)); ! else ! Prim_List := Primitive_Operations (Base_T); ! end if; if No (Prim_List) then return; --- 241,247 ---- -- The check for Present here is to protect against previously -- reported critical errors. ! Prim_List := Primitive_Operations (Base_T); if No (Prim_List) then return; *************** package body Lib.Xref is *** 262,273 **** -- reference purposes (it is the original for which we want the xref -- and for which the comes_from_source test must be performed). ! Ent := Node (Prim); ! while Present (Alias (Ent)) loop ! Ent := Alias (Ent); ! end loop; ! ! Generate_Reference (Typ, Ent, 'p', Set_Ref => False); Next_Elmt (Prim); end loop; end Generate_Prim_Op_References; --- 254,261 ---- -- reference purposes (it is the original for which we want the xref -- and for which the comes_from_source test must be performed). ! Generate_Reference ! (Typ, Ultimate_Alias (Node (Prim)), 'p', Set_Ref => False); Next_Elmt (Prim); end loop; end Generate_Prim_Op_References; *************** package body Lib.Xref is *** 473,485 **** if Comes_From_Source (N) and then Is_Ada_2005_Only (E) ! and then Ada_Version < Ada_05 and then Warn_On_Ada_2005_Compatibility ! and then (Typ = 'm' or else Typ = 'r') then Error_Msg_NE ("& is only defined in Ada 2005?", N, E); end if; -- Never collect references if not in main source unit. However, we omit -- this test if Typ is 'e' or 'k', since these entries are structural, -- and it is useful to have them in units that reference packages as --- 461,485 ---- if Comes_From_Source (N) and then Is_Ada_2005_Only (E) ! and then Ada_Version < Ada_2005 and then Warn_On_Ada_2005_Compatibility ! and then (Typ = 'm' or else Typ = 'r' or else Typ = 's') then Error_Msg_NE ("& is only defined in Ada 2005?", N, E); end if; + -- Warn if reference to Ada 2012 entity not in Ada 2012 mode. We only + -- detect real explicit references (modifications and references). + + if Comes_From_Source (N) + and then Is_Ada_2012_Only (E) + and then Ada_Version < Ada_2012 + and then Warn_On_Ada_2012_Compatibility + and then (Typ = 'm' or else Typ = 'r') + then + Error_Msg_NE ("& is only defined in Ada 2012?", N, E); + end if; + -- Never collect references if not in main source unit. However, we omit -- this test if Typ is 'e' or 'k', since these entries are structural, -- and it is useful to have them in units that reference packages as *************** package body Lib.Xref is *** 666,672 **** -- Check for pragma Unreferenced given and reference is within -- this source unit (occasion for possible warning to be issued). ! if Has_Pragma_Unreferenced (E) and then In_Same_Extended_Unit (E, N) then -- A reference as a named parameter in a call does not count --- 666,672 ---- -- Check for pragma Unreferenced given and reference is within -- this source unit (occasion for possible warning to be issued). ! if Has_Unreferenced (E) and then In_Same_Extended_Unit (E, N) then -- A reference as a named parameter in a call does not count *************** package body Lib.Xref is *** 699,705 **** BE := First_Entity (Current_Scope); while Present (BE) loop if Chars (BE) = Chars (E) then ! Error_Msg_NE ("?pragma Unreferenced given for&!", N, BE); exit; end if; --- 699,705 ---- BE := First_Entity (Current_Scope); while Present (BE) loop if Chars (BE) = Chars (E) then ! Error_Msg_NE -- CODEFIX ("?pragma Unreferenced given for&!", N, BE); exit; end if; *************** package body Lib.Xref is *** 711,717 **** -- Here we issue the warning, since this is a real reference else ! Error_Msg_NE ("?pragma Unreferenced given for&!", N, E); end if; end if; --- 711,718 ---- -- Here we issue the warning, since this is a real reference else ! Error_Msg_NE -- CODEFIX ! ("?pragma Unreferenced given for&!", N, E); end if; end if; *************** package body Lib.Xref is *** 846,852 **** if Typ = 'p' and then Is_Subprogram (N) ! and then Is_Overriding_Operation (N) then Xrefs.Table (Indx).Typ := 'P'; else --- 847,853 ---- if Typ = 'p' and then Is_Subprogram (N) ! and then Present (Overridden_Operation (N)) then Xrefs.Table (Indx).Typ := 'P'; else *************** package body Lib.Xref is *** 1171,1177 **** if Is_Type (Ent) and then Is_Tagged_Type (Ent) ! and then Ent = Base_Type (Ent) and then In_Extended_Main_Source_Unit (Ent) then Generate_Prim_Op_References (Ent); --- 1172,1178 ---- if Is_Type (Ent) and then Is_Tagged_Type (Ent) ! and then Is_Base_Type (Ent) and then In_Extended_Main_Source_Unit (Ent) then Generate_Prim_Op_References (Ent); *************** package body Lib.Xref is *** 1280,1286 **** if Is_Type (Ent) and then Is_Tagged_Type (Ent) and then Is_Derived_Type (Ent) ! and then Ent = Base_Type (Ent) and then In_Extended_Main_Source_Unit (Ent) then declare --- 1281,1287 ---- if Is_Type (Ent) and then Is_Tagged_Type (Ent) and then Is_Derived_Type (Ent) ! and then Is_Base_Type (Ent) and then In_Extended_Main_Source_Unit (Ent) then declare *************** package body Lib.Xref is *** 1703,1712 **** -- through several levels of derivation, so find the -- ultimate (source) ancestor. ! Op := Alias (Old_E); ! while Present (Alias (Op)) loop ! Op := Alias (Op); ! end loop; -- Normal case of no alias present --- 1704,1710 ---- -- through several levels of derivation, so find the -- ultimate (source) ancestor. ! Op := Ultimate_Alias (Old_E); -- Normal case of no alias present *************** package body Lib.Xref is *** 1804,1830 **** Ctyp := '*'; end if; ! -- Special handling for access parameter ! ! declare ! K : constant Entity_Kind := Ekind (Etype (XE.Ent)); ! begin ! if (K = E_Anonymous_Access_Type ! or else ! K = E_Anonymous_Access_Subprogram_Type ! or else K = ! E_Anonymous_Access_Protected_Subprogram_Type) ! and then Is_Formal (XE.Ent) then Ctyp := 'p'; ! -- Special handling for Boolean ! elsif Ctyp = 'e' and then Is_Boolean_Type (Ent) then ! Ctyp := 'b'; ! end if; ! end; end if; -- Special handling for abstract types and operations --- 1802,1826 ---- Ctyp := '*'; end if; ! -- Special handling for access parameters and objects of ! -- an anonymous access type. ! if Ekind_In (Etype (XE.Ent), ! E_Anonymous_Access_Type, ! E_Anonymous_Access_Subprogram_Type, ! E_Anonymous_Access_Protected_Subprogram_Type) ! then ! if Is_Formal (XE.Ent) ! or else Ekind_In (XE.Ent, E_Variable, E_Constant) then Ctyp := 'p'; + end if; ! -- Special handling for Boolean ! elsif Ctyp = 'e' and then Is_Boolean_Type (Ent) then ! Ctyp := 'b'; ! end if; end if; -- Special handling for abstract types and operations *************** package body Lib.Xref is *** 2167,2174 **** end loop; end; ! -- For array types, list index types as well. ! -- (This is not C, indices have distinct types). elsif Is_Array_Type (XE.Ent) then declare --- 2163,2170 ---- end loop; end; ! -- For array types, list index types as well. (This is ! -- not C, indexes have distinct types). elsif Is_Array_Type (XE.Ent) then declare *************** package body Lib.Xref is *** 2187,2193 **** -- on operation that was overridden. if Is_Subprogram (XE.Ent) ! and then Is_Overriding_Operation (XE.Ent) then Output_Overridden_Op (Overridden_Operation (XE.Ent)); end if; --- 2183,2189 ---- -- on operation that was overridden. if Is_Subprogram (XE.Ent) ! and then Present (Overridden_Operation (XE.Ent)) then Output_Overridden_Op (Overridden_Operation (XE.Ent)); end if; diff -Nrcpad gcc-4.5.2/gcc/ada/lib-xref.ads gcc-4.6.0/gcc/ada/lib-xref.ads *** gcc-4.5.2/gcc/ada/lib-xref.ads Mon Jul 27 13:26:41 2009 --- gcc-4.6.0/gcc/ada/lib-xref.ads Tue Oct 12 10:32:58 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package Lib.Xref is *** 68,76 **** -- col is the column number of the referenced entity -- level is a single character that separates the col and ! -- entity fields. It is an asterisk for a top level library -- entity that is publicly visible, as well for an entity declared ! -- in the visible part of a generic package, and space otherwise. -- entity is the name of the referenced entity, with casing in -- the canonical casing for the source file where it is defined. --- 68,77 ---- -- col is the column number of the referenced entity -- level is a single character that separates the col and ! -- entity fields. It is an asterisk (*) for a top level library -- entity that is publicly visible, as well for an entity declared ! -- in the visible part of a generic package, the plus sign (+) for ! -- a C/C++ static entity, and space otherwise. -- entity is the name of the referenced entity, with casing in -- the canonical casing for the source file where it is defined. *************** package Lib.Xref is *** 182,187 **** --- 183,189 ---- -- P = overriding primitive operation -- r = reference -- R = subprogram reference in dispatching call + -- s = subprogram reference in a static call -- t = end of body -- w = WITH line -- x = type extension *************** package Lib.Xref is *** 295,300 **** --- 297,305 ---- -- the specification of the primitive operation of the root -- type when the call has a controlling argument in its class. + -- s is used to mark a static subprogram call. The reference is + -- to the specification of the subprogram being called. + -- t is similar to e. It identifies the end of a corresponding -- body (such a reference always links up with a b reference) *************** package Lib.Xref is *** 541,557 **** -- d decimal fixed-point object decimal fixed-point type -- e non-Boolean enumeration object non_Boolean enumeration type -- f floating-point object floating-point type ! -- g (unused) (unused) -- h Interface (Ada 2005) Abstract type -- i signed integer object signed integer type ! -- j (unused) (unused) -- k generic package package -- l label on loop label on statement -- m modular integer object modular integer type -- n enumeration literal named number -- o ordinary fixed-point object ordinary fixed-point type -- p access object access type ! -- q label on block (unused) -- r record object record type -- s string object string type -- t task object task type --- 546,562 ---- -- d decimal fixed-point object decimal fixed-point type -- e non-Boolean enumeration object non_Boolean enumeration type -- f floating-point object floating-point type ! -- g C/C++ macro C/C++ fun-like macro -- h Interface (Ada 2005) Abstract type -- i signed integer object signed integer type ! -- j C++ class object C++ class -- k generic package package -- l label on loop label on statement -- m modular integer object modular integer type -- n enumeration literal named number -- o ordinary fixed-point object ordinary fixed-point type -- p access object access type ! -- q label on block C/C++ include file -- r record object record type -- s string object string type -- t task object task type diff -Nrcpad gcc-4.5.2/gcc/ada/lib.adb gcc-4.6.0/gcc/ada/lib.adb *** gcc-4.5.2/gcc/ada/lib.adb Mon Jul 13 10:22:57 2009 --- gcc-4.6.0/gcc/ada/lib.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Lib is *** 113,118 **** --- 113,123 ---- return Units.Table (U).Generate_Code; end Generate_Code; + function Has_Allocator (U : Unit_Number_Type) return Boolean is + begin + return Units.Table (U).Has_Allocator; + end Has_Allocator; + function Has_RACW (U : Unit_Number_Type) return Boolean is begin return Units.Table (U).Has_RACW; *************** package body Lib is *** 133,138 **** --- 138,148 ---- return Units.Table (U).Loading; end Loading; + function Main_CPU (U : Unit_Number_Type) return Int is + begin + return Units.Table (U).Main_CPU; + end Main_CPU; + function Main_Priority (U : Unit_Number_Type) return Int is begin return Units.Table (U).Main_Priority; *************** package body Lib is *** 198,203 **** --- 208,218 ---- Units.Table (U).Generate_Code := B; end Set_Generate_Code; + procedure Set_Has_Allocator (U : Unit_Number_Type; B : Boolean := True) is + begin + Units.Table (U).Has_Allocator := B; + end Set_Has_Allocator; + procedure Set_Has_RACW (U : Unit_Number_Type; B : Boolean := True) is begin Units.Table (U).Has_RACW := B; *************** package body Lib is *** 221,226 **** --- 236,246 ---- Units.Table (U).Loading := B; end Set_Loading; + procedure Set_Main_CPU (U : Unit_Number_Type; P : Int) is + begin + Units.Table (U).Main_CPU := P; + end Set_Main_CPU; + procedure Set_Main_Priority (U : Unit_Number_Type; P : Int) is begin Units.Table (U).Main_Priority := P; *************** package body Lib is *** 701,711 **** Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit)); begin ! -- If Mloc is not set, it means we are still parsing the main unit, ! -- so everything so far is in the extended main source unit. ! if Mloc = No_Location then ! return True; -- Special value cases --- 721,730 ---- Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit)); begin ! -- If parsing, then use the global flag to indicate result ! if Compiler_State = Parsing then ! return Parsing_Main_Extended_Source; -- Special value cases *************** package body Lib is *** 741,751 **** Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit)); begin ! -- If Mloc is not set, it means we are still parsing the main unit, ! -- so everything so far is in the extended main source unit. ! if Mloc = No_Location then ! return True; -- Special value cases --- 760,769 ---- Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit)); begin ! -- If parsing, then use the global flag to indicate result ! if Compiler_State = Parsing then ! return Parsing_Main_Extended_Source; -- Special value cases *************** package body Lib is *** 858,863 **** --- 876,882 ---- procedure Initialize is begin Linker_Option_Lines.Init; + Notes.Init; Load_Stack.Init; Units.Init; Compilation_Switches.Init; *************** package body Lib is *** 984,994 **** procedure Store_Linker_Option_String (S : String_Id) is begin ! Linker_Option_Lines.Increment_Last; ! Linker_Option_Lines.Table (Linker_Option_Lines.Last) := ! (Option => S, Unit => Current_Sem_Unit); end Store_Linker_Option_String; ------------------------------- -- Synchronize_Serial_Number -- ------------------------------- --- 1003,1020 ---- procedure Store_Linker_Option_String (S : String_Id) is begin ! Linker_Option_Lines.Append ((Option => S, Unit => Current_Sem_Unit)); end Store_Linker_Option_String; + ---------------- + -- Store_Note -- + ---------------- + + procedure Store_Note (N : Node_Id) is + begin + Notes.Append ((Pragma_Node => N, Unit => Current_Sem_Unit)); + end Store_Note; + ------------------------------- -- Synchronize_Serial_Number -- ------------------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/lib.ads gcc-4.6.0/gcc/ada/lib.ads *** gcc-4.5.2/gcc/ada/lib.ads Wed Jul 15 10:15:49 2009 --- gcc-4.6.0/gcc/ada/lib.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Types; use Types; *** 39,44 **** --- 39,59 ---- package Lib is + type Compiler_State_Type is (Parsing, Analyzing); + Compiler_State : Compiler_State_Type; + -- Indicates current state of compilation. This is used to implement the + -- function In_Extended_Main_Source_Unit. + + Parsing_Main_Extended_Source : Boolean := False; + -- Set True if we are currently parsing a file that is part of the main + -- extended source (the main unit, its spec, or one of its subunits). This + -- flag to implement In_Extended_Main_Source_Unit. + + Analysing_Subunit_Of_Main : Boolean := False; + -- Set to True when analyzing a subunit of the main source. When True, if + -- the subunit is preprocessed and -gnateG is specified, then the + -- preprocessed file (.prep) is written. + -------------------------------------------- -- General Approach to Library Management -- -------------------------------------------- *************** package Lib is *** 342,347 **** --- 357,372 ---- -- that the default priority is to be used (and is also used for -- entries that do not correspond to possible main programs). + -- Main_CPU + -- This field is used to indicate the affinity of a possible main + -- program, as set by a pragma CPU. A value of -1 indicates + -- that the default affinity is to be used (and is also used for + -- entries that do not correspond to possible main programs). + + -- Has_Allocator + -- This flag is set if a subprogram unit has an allocator after the + -- BEGIN (it is used to set the AB flag in the M ALI line). + -- 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. *************** package Lib is *** 373,378 **** --- 398,406 ---- Default_Main_Priority : constant Int := -1; -- Value used in Main_Priority field to indicate default main priority + Default_Main_CPU : constant Int := -1; + -- Value used in Main_CPU field to indicate default main affinity + function Cunit (U : Unit_Number_Type) return Node_Id; function Cunit_Entity (U : Unit_Number_Type) return Entity_Id; function Dependency_Num (U : Unit_Number_Type) return Nat; *************** package Lib is *** 382,390 **** --- 410,420 ---- function Fatal_Error (U : Unit_Number_Type) return Boolean; function Generate_Code (U : Unit_Number_Type) return Boolean; function Ident_String (U : Unit_Number_Type) return Node_Id; + function Has_Allocator (U : Unit_Number_Type) return Boolean; function Has_RACW (U : Unit_Number_Type) return Boolean; function Is_Compiler_Unit (U : Unit_Number_Type) return Boolean; function Loading (U : Unit_Number_Type) return Boolean; + function Main_CPU (U : Unit_Number_Type) return Int; 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; *************** package Lib is *** 400,408 **** --- 430,440 ---- procedure Set_Fatal_Error (U : Unit_Number_Type; B : Boolean := True); procedure Set_Generate_Code (U : Unit_Number_Type; B : Boolean := True); procedure Set_Has_RACW (U : Unit_Number_Type; B : Boolean := True); + procedure Set_Has_Allocator (U : Unit_Number_Type; B : Boolean := True); procedure Set_Is_Compiler_Unit (U : Unit_Number_Type; B : Boolean := True); procedure Set_Ident_String (U : Unit_Number_Type; N : Node_Id); procedure Set_Loading (U : Unit_Number_Type; B : Boolean := True); + procedure Set_Main_CPU (U : Unit_Number_Type; P : Int); 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); *************** package Lib is *** 574,579 **** --- 606,615 ---- -- This procedure is called to register the string from a pragma -- Linker_Option. The argument is the Id of the string to register. + procedure Store_Note (N : Node_Id); + -- This procedure is called to register a pragma N for which a notes + -- entry is required. + procedure Initialize; -- Initialize internal tables *************** private *** 634,643 **** --- 670,681 ---- pragma Inline (Dependency_Num); pragma Inline (Fatal_Error); pragma Inline (Generate_Code); + pragma Inline (Has_Allocator); pragma Inline (Has_RACW); pragma Inline (Is_Compiler_Unit); pragma Inline (Increment_Serial_Number); pragma Inline (Loading); + pragma Inline (Main_CPU); pragma Inline (Main_Priority); pragma Inline (Munit_Index); pragma Inline (OA_Setting); *************** private *** 645,652 **** --- 683,692 ---- pragma Inline (Set_Cunit_Entity); pragma Inline (Set_Fatal_Error); pragma Inline (Set_Generate_Code); + pragma Inline (Set_Has_Allocator); pragma Inline (Set_Has_RACW); pragma Inline (Set_Loading); + pragma Inline (Set_Main_CPU); pragma Inline (Set_Main_Priority); pragma Inline (Set_OA_Setting); pragma Inline (Set_Unit_Name); *************** private *** 665,670 **** --- 705,711 ---- Dependency_Num : Int; Ident_String : Node_Id; Main_Priority : Int; + Main_CPU : Int; Serial_Number : Nat; Version : Word; Error_Location : Source_Ptr; *************** private *** 674,679 **** --- 715,721 ---- Is_Compiler_Unit : Boolean; Dynamic_Elab : Boolean; Loading : Boolean; + Has_Allocator : Boolean; OA_Setting : Character; end record; *************** private *** 692,710 **** Dependency_Num at 28 range 0 .. 31; Ident_String at 32 range 0 .. 31; Main_Priority at 36 range 0 .. 31; ! Serial_Number at 40 range 0 .. 31; ! Version at 44 range 0 .. 31; ! Error_Location at 48 range 0 .. 31; ! Fatal_Error at 52 range 0 .. 7; ! 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 .. 7; ! OA_Setting at 57 range 0 .. 7; ! Loading at 58 range 0 .. 15; end record; ! for Unit_Record'Size use 60 * 8; -- This ensures that we did not leave out any fields package Units is new Table.Table ( --- 734,754 ---- Dependency_Num at 28 range 0 .. 31; Ident_String at 32 range 0 .. 31; Main_Priority at 36 range 0 .. 31; ! Main_CPU at 40 range 0 .. 31; ! Serial_Number at 44 range 0 .. 31; ! Version at 48 range 0 .. 31; ! Error_Location at 52 range 0 .. 31; ! Fatal_Error at 56 range 0 .. 7; ! Generate_Code at 57 range 0 .. 7; ! Has_RACW at 58 range 0 .. 7; ! Dynamic_Elab at 59 range 0 .. 7; ! Is_Compiler_Unit at 60 range 0 .. 7; ! OA_Setting at 61 range 0 .. 7; ! Loading at 62 range 0 .. 7; ! Has_Allocator at 63 range 0 .. 7; end record; ! for Unit_Record'Size use 64 * 8; -- This ensures that we did not leave out any fields package Units is new Table.Table ( *************** private *** 733,738 **** --- 777,797 ---- Table_Increment => Alloc.Linker_Option_Lines_Increment, Table_Name => "Linker_Option_Lines"); + -- The following table stores references to pragmas that generate Notes + + type Notes_Entry is record + Pragma_Node : Node_Id; + Unit : Unit_Number_Type; + end record; + + package Notes is new Table.Table ( + Table_Component_Type => Notes_Entry, + Table_Index_Type => Integer, + Table_Low_Bound => 1, + Table_Initial => Alloc.Notes_Initial, + Table_Increment => Alloc.Notes_Increment, + Table_Name => "Notes"); + -- The following table records the compilation switches used to compile -- the main unit. The table includes only switches. It excludes -o -- switches as well as artifacts of the gcc/gnat1 interface such as *************** private *** 765,771 **** With_Node : Node_Id; end record; ! -- The Load_Stack table contains a list of unit numbers (indices into the -- unit table) of units being loaded on a single dependency chain, and a -- flag to indicate whether this unit is loaded through a limited_with -- clause. The First entry is the main unit. The second entry, if present --- 824,830 ---- With_Node : Node_Id; end record; ! -- The Load_Stack table contains a list of unit numbers (indexes into the -- unit table) of units being loaded on a single dependency chain, and a -- flag to indicate whether this unit is loaded through a limited_with -- clause. The First entry is the main unit. The second entry, if present diff -Nrcpad gcc-4.5.2/gcc/ada/link.c gcc-4.6.0/gcc/ada/link.c *** gcc-4.5.2/gcc/ada/link.c Mon Jan 25 14:21:16 2010 --- gcc-4.6.0/gcc/ada/link.c Mon Dec 20 07:26:57 2010 *************** *** 63,69 **** /* be used by default for linking libgnat (shared or static) */ /* shared_libgcc_default gives the system dependent link method that */ ! /* be used by default for linking libgcc (shared or statis) */ /* using_gnu_linker is set to 1 when the GNU linker is used under this */ /* target. */ --- 63,69 ---- /* be used by default for linking libgnat (shared or static) */ /* shared_libgcc_default gives the system dependent link method that */ ! /* be used by default for linking libgcc (shared or static) */ /* using_gnu_linker is set to 1 when the GNU linker is used under this */ /* target. */ diff -Nrcpad gcc-4.5.2/gcc/ada/locales.c gcc-4.6.0/gcc/ada/locales.c *** gcc-4.5.2/gcc/ada/locales.c Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/locales.c Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,56 ---- + /**************************************************************************** + * * + * GNAT COMPILER COMPONENTS * + * * + * L O C A L E S * + * * + * C Implementation File * + * * + * Copyright (C) 2010, 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. * + * * + * As a special exception under Section 7 of GPL version 3, you are granted * + * additional permissions described in the GCC Runtime Library Exception, * + * version 3.1, as published by the Free Software Foundation. * + * * + * You should have received a copy of the GNU General Public License and * + * a copy of the GCC Runtime Library Exception along with this program; * + * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see * + * . * + * * + * GNAT was originally developed by the GNAT team at New York University. * + * Extensive contributions were provided by Ada Core Technologies Inc. * + * * + ****************************************************************************/ + + /* This file provides OS-dependent support for the Ada.Locales package. */ + + typedef char char4 [4]; + + /* + c_get_language_code needs to fill in the Alpha-3 encoding of the + language code (3 lowercase letters). That should be "und" if the + language is unknown. [see Ada.Locales] + */ + void c_get_language_code (char4 p) { + char *r = "und"; + for (; *r != '\0'; p++, r++) + *p = *r; + } + + /* + c_get_country_code needs to fill in the Alpha-2 encoding of the + country code (2 uppercase letters). That should be "ZZ" if the + country is unknown. [see Ada.Locales] + */ + void c_get_country_code (char4 p) { + char *r = "ZZ"; + for (; *r != '\0'; p++, r++) + *p = *r; + } diff -Nrcpad gcc-4.5.2/gcc/ada/make.adb gcc-4.6.0/gcc/ada/make.adb *** gcc-4.5.2/gcc/ada/make.adb Mon Nov 30 16:08:37 2009 --- gcc-4.6.0/gcc/ada/make.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Ada.Command_Line; use Ada. *** 71,76 **** --- 71,77 ---- with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables; + with GNAT.HTable; with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.OS_Lib; use GNAT.OS_Lib; *************** package body Make is *** 135,183 **** -- complex, for example in main.1.ada, the termination in this name is -- ".1.ada" and in main_.ada the termination is "_.ada". - ------------------------------------- - -- Queue (Q) Manipulation Routines -- - ------------------------------------- - - -- The Q is used in Compile_Sources below. Its implementation uses the GNAT - -- generic package Table (basically an extensible array). Q_Front points to - -- the first valid element in the Q, whereas Q.First is the first element - -- ever enqueued, while Q.Last - 1 is the last element in the Q. - -- - -- +---+--------------+---+---+---+-----------+---+-------- - -- Q | | ........ | | | | ....... | | - -- +---+--------------+---+---+---+-----------+---+-------- - -- ^ ^ ^ - -- Q.First Q_Front Q.Last-1 - -- - -- The elements comprised between Q.First and Q_Front-1 are the elements - -- that have been enqueued and then dequeued, while the elements between - -- Q_Front and Q.Last-1 are the elements currently in the Q. When the Q - -- is initialized Q_Front = Q.First = Q.Last. After Compile_Sources has - -- terminated its execution, Q_Front = Q.Last and the elements contained - -- between Q.First and Q.Last-1 are those that were explored and thus - -- marked by Compile_Sources. Whenever the Q is reinitialized, the elements - -- between Q.First and Q.Last-1 are unmarked. - - procedure Init_Q; - -- Must be called to (re)initialize the Q - - procedure Insert_Q - (Source_File : File_Name_Type; - Source_Unit : Unit_Name_Type := No_Unit_Name; - Index : Int := 0); - -- Inserts Source_File at the end of Q. Provide Source_Unit when possible - -- for external use (gnatdist). Provide index for multi-unit sources. - - function Empty_Q return Boolean; - -- Returns True if Q is empty - - procedure Extract_From_Q - (Source_File : out File_Name_Type; - Source_Unit : out Unit_Name_Type; - Source_Index : out Int); - -- Extracts the first element from the Q - procedure Insert_Project_Sources (The_Project : Project_Id; All_Projects : Boolean; --- 136,141 ---- *************** package body Make is *** 190,231 **** -- including, if The_Project is an extending project, sources inherited -- from projects being extended. - First_Q_Initialization : Boolean := True; - -- Will be set to false after Init_Q has been called once - - Q_Front : Natural; - -- Points to the first valid element in the Q - Unique_Compile : Boolean := False; -- Set to True if -u or -U or a project file with no main is used Unique_Compile_All_Projects : Boolean := False; -- Set to True if -U is used RTS_Specified : String_Access := null; -- Used to detect multiple --RTS= switches N_M_Switch : Natural := 0; -- Used to count -mxxx switches that can affect multilib ! type Q_Record is record ! File : File_Name_Type; ! Unit : Unit_Name_Type; ! Index : Int; ! end record; ! -- File is the name of the file to compile. Unit is for gnatdist ! -- use in order to easily get the unit name of a file to compile ! -- when its name is krunched or declared in gnat.adc. Index, when not 0, ! -- is the index of the unit in a multi-unit source. ! package Q is new Table.Table ( ! Table_Component_Type => Q_Record, ! Table_Index_Type => Natural, ! Table_Low_Bound => 0, ! Table_Initial => 4000, ! Table_Increment => 100, ! Table_Name => "Make.Q"); ! -- This is the actual Q -- The 3 following packages are used to store gcc, gnatbind and gnatlink -- switches found in the project files. --- 148,222 ---- -- including, if The_Project is an extending project, sources inherited -- from projects being extended. Unique_Compile : Boolean := False; -- Set to True if -u or -U or a project file with no main is used Unique_Compile_All_Projects : Boolean := False; -- Set to True if -U is used + Must_Compile : Boolean := False; + -- True if gnatmake is invoked with -f -u and one or several mains on the + -- command line. + + Main_On_Command_Line : Boolean := False; + -- True if gnatmake is invoked with one or several mains on the command + -- line. + RTS_Specified : String_Access := null; -- Used to detect multiple --RTS= switches N_M_Switch : Natural := 0; -- Used to count -mxxx switches that can affect multilib ! package Queue is ! --------------------------------- ! -- Queue Manipulation Routines -- ! --------------------------------- ! procedure Initialize (Queue_Per_Obj_Dir : Boolean); ! -- Initialize the queue ! ! function Is_Empty return Boolean; ! -- Returns True if the queue is empty ! ! function Is_Virtually_Empty return Boolean; ! -- Returns True if the queue is empty or if all object directories are ! -- busy. ! ! procedure Insert ! (Source_File_Name : File_Name_Type; ! Project : Project_Id; ! Source_Unit : Unit_Name_Type := No_Unit_Name; ! Index : Int := 0); ! -- Insert source in the queue ! ! procedure Extract ! (Source_File_Name : out File_Name_Type; ! Source_Unit : out Unit_Name_Type; ! Source_Index : out Int); ! -- Get the first source that can be compiled from the queue. If no ! -- source may be compiled, return No_File/No_Source. ! ! function Size return Natural; ! -- Return the total size of the queue, including the sources already ! -- extracted. ! ! function Processed return Natural; ! -- Return the number of source in the queue that have already been ! -- processed. ! ! procedure Set_Obj_Dir_Busy (Obj_Dir : Path_Name_Type); ! -- Indicate that this object directory is busy, so that when ! -- One_Compilation_Per_Obj_Dir is True no other compilation occurs in ! -- this object directory. ! ! procedure Set_Obj_Dir_Free (Obj_Dir : Path_Name_Type); ! -- Indicate that there is no compilation for this object directory ! ! function Element (Rank : Positive) return File_Name_Type; ! -- Get the file name for element of index Rank in the queue ! ! end Queue; -- The 3 following packages are used to store gcc, gnatbind and gnatlink -- switches found in the project files. *************** package body Make is *** 362,367 **** --- 353,361 ---- -- calling Change_Dir if the current working directory is already this -- directory. + Map_File : String_Access := null; + -- Value of switch --create-map-file + -- Packages of project files where unknown attributes are errors Naming_String : aliased String := "naming"; *************** package body Make is *** 438,443 **** --- 432,440 ---- -- with the switches -c, -b and -l. These flags are reset to True for -- each invocation of procedure Gnatmake. + Do_Codepeer_Globalize_Step : Boolean := False; + -- Flag to indicate whether the CodePeer globalizer should be called + Shared_String : aliased String := "-shared"; Force_Elab_Flags_String : aliased String := "-F"; *************** package body Make is *** 660,679 **** Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake"); -- Default compiler, binder, linker programs Saved_Gcc : String_Access := null; Saved_Gnatbind : String_Access := null; Saved_Gnatlink : String_Access := null; -- Given by the command line. Will be used, if non null Gcc_Path : String_Access := ! GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all); Gnatbind_Path : String_Access := ! GNAT.OS_Lib.Locate_Exec_On_Path (Gnatbind.all); Gnatlink_Path : String_Access := ! GNAT.OS_Lib.Locate_Exec_On_Path (Gnatlink.all); -- Path for compiler, binder, linker programs, defaulted now for gnatdist. -- Changed later if overridden on command line. Comp_Flag : constant String_Access := new String'("-c"); Output_Flag : constant String_Access := new String'("-o"); Ada_Flag_1 : constant String_Access := new String'("-x"); --- 657,683 ---- Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake"); -- Default compiler, binder, linker programs + Globalizer : constant String := "codepeer_globalizer"; + -- CodePeer globalizer executable name + Saved_Gcc : String_Access := null; Saved_Gnatbind : String_Access := null; Saved_Gnatlink : String_Access := null; -- Given by the command line. Will be used, if non null Gcc_Path : String_Access := ! GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all); Gnatbind_Path : String_Access := ! GNAT.OS_Lib.Locate_Exec_On_Path (Gnatbind.all); Gnatlink_Path : String_Access := ! GNAT.OS_Lib.Locate_Exec_On_Path (Gnatlink.all); -- Path for compiler, binder, linker programs, defaulted now for gnatdist. -- Changed later if overridden on command line. + Globalizer_Path : constant String_Access := + GNAT.OS_Lib.Locate_Exec_On_Path (Globalizer); + -- Path for CodePeer globalizer + Comp_Flag : constant String_Access := new String'("-c"); Output_Flag : constant String_Access := new String'("-o"); Ada_Flag_1 : constant String_Access := new String'("-x"); *************** package body Make is *** 795,802 **** type Temp_Path_Names is array (Positive range <>) of Path_Name_Type; type Temp_Path_Ptr is access Temp_Path_Names; ! type Free_File_Indices is array (Positive range <>) of Positive; ! type Free_Indices_Ptr is access Free_File_Indices; type Project_Compilation_Data is record Mapping_File_Names : Temp_Path_Ptr; --- 799,806 ---- type Temp_Path_Names is array (Positive range <>) of Path_Name_Type; type Temp_Path_Ptr is access Temp_Path_Names; ! type Free_File_Indexes is array (Positive range <>) of Positive; ! type Free_Indexes_Ptr is access Free_File_Indexes; type Project_Compilation_Data is record Mapping_File_Names : Temp_Path_Ptr; *************** package body Make is *** 807,817 **** Last_Mapping_File_Names : Natural; -- Index of the last mapping file created for this project ! Free_Mapping_File_Indices : Free_Indices_Ptr; ! -- Indices in Mapping_File_Names of the mapping file names that can be -- reused for subsequent compilations. ! Last_Free_Indices : Natural; -- Number of mapping files that can be reused end record; -- Information necessary when compiling a project --- 811,821 ---- Last_Mapping_File_Names : Natural; -- Index of the last mapping file created for this project ! Free_Mapping_File_Indexes : Free_Indexes_Ptr; ! -- Indexes in Mapping_File_Names of the mapping file names that can be -- reused for subsequent compilations. ! Last_Free_Indexes : Natural; -- Number of mapping files that can be reused end record; -- Information necessary when compiling a project *************** package body Make is *** 1013,1018 **** --- 1017,1026 ---- -- during a compilation are also transitively included in the W section -- of the originally compiled file. + procedure Globalize (Success : out Boolean); + -- Call the CodePeer globalizer on all the project's object directories, + -- or on the current directory if no projects. + procedure Initialize (Project_Node_Tree : out Project_Node_Tree_Ref); -- Performs default and package initialization. Therefore, -- Compile_Sources can be called by an external unit. *************** package body Make is *** 1387,1393 **** if Project_Of_Current_Object_Directory /= Project then Project_Of_Current_Object_Directory := Project; ! Object_Directory := Project.Object_Directory.Name; -- Set the working directory to the object directory of the actual -- project. --- 1395,1401 ---- if Project_Of_Current_Object_Directory /= Project then Project_Of_Current_Object_Directory := Project; ! Object_Directory := Project.Object_Directory.Display_Name; -- Set the working directory to the object directory of the actual -- project. *************** package body Make is *** 1409,1415 **** when Directory_Error => Make_Failed ("unable to change to object directory """ & Path_Or_File_Name ! (Project.Object_Directory.Name) & """ of project " & Get_Name_String (Project.Display_Name)); end Change_To_Object_Directory; --- 1417,1423 ---- when Directory_Error => Make_Failed ("unable to change to object directory """ & Path_Or_File_Name ! (Project.Object_Directory.Display_Name) & """ of project " & Get_Name_String (Project.Display_Name)); end Change_To_Object_Directory; *************** package body Make is *** 1664,1669 **** --- 1672,1703 ---- return; end if; + -- When compiling with -gnatc, don't take ALI file into account if + -- it has not been generated for the current source, for example if + -- it has been generated for the spec, but we are compiling the body. + + if Operating_Mode = Check_Semantics then + declare + File_Name : constant String := Get_Name_String (Source_File); + OK : Boolean := False; + + begin + for U in ALIs.Table (ALI).First_Unit .. + ALIs.Table (ALI).Last_Unit + loop + OK := Get_Name_String (Units.Table (U).Sfile) = File_Name; + exit when OK; + end loop; + + if not OK then + Verbose_Msg + (Full_Lib_File, "not generated for the same source"); + ALI := No_ALI_Id; + return; + end if; + end; + end if; + -- Check for matching compiler switches if needed if Check_Switches then *************** package body Make is *** 1785,1790 **** --- 1819,1831 ---- Modified_Source := Time_Stamp_Mismatch (ALI, Read_Only); + -- To avoid using too much memory when switch -m is used, free the + -- memory allocated for the source file when computing the checksum. + + if Minimal_Recompilation then + Sinput.P.Clear_Source_File_Table; + end if; + if Modified_Source /= No_File then ALI := No_ALI_Id; *************** package body Make is *** 1815,1822 **** end if; elsif not Read_Only and then Main_Project /= No_Project then ! ! if not Check_Source_Info_In_ALI (ALI) then ALI := No_ALI_Id; return; end if; --- 1856,1862 ---- end if; elsif not Read_Only and then Main_Project /= No_Project then ! if not Check_Source_Info_In_ALI (ALI, Project_Tree) then ALI := No_ALI_Id; return; end if; *************** package body Make is *** 1890,1897 **** if ALI_Project = No_Project then ALI := No_ALI_Id; ! Verbose_Msg ! (Lib_File, " wrong object directory"); return; end if; --- 1930,1936 ---- if ALI_Project = No_Project then ALI := No_ALI_Id; ! Verbose_Msg (Lib_File, " wrong object directory"); return; end if; *************** package body Make is *** 2236,2247 **** if Arguments_Project = No_Project then Add_Arguments (The_Saved_Gcc_Switches.all); ! elsif not Arguments_Project.Externally_Built then -- We get the project directory for the relative path -- switches and arguments. ! Arguments_Project := Ultimate_Extending_Project_Of ! (Arguments_Project); -- If building a dynamic or relocatable library, compile with -- PIC option, if it exists. --- 2275,2288 ---- if Arguments_Project = No_Project then Add_Arguments (The_Saved_Gcc_Switches.all); ! elsif not Arguments_Project.Externally_Built ! or else Must_Compile ! then -- We get the project directory for the relative path -- switches and arguments. ! Arguments_Project := ! Ultimate_Extending_Project_Of (Arguments_Project); -- If building a dynamic or relocatable library, compile with -- PIC option, if it exists. *************** package body Make is *** 2251,2257 **** then declare PIC : constant String := MLib.Tgt.PIC_Option; - begin if PIC /= "" then Add_Arguments ((1 => new String'(PIC))); --- 2292,2297 ---- *************** package body Make is *** 2309,2315 **** New_Args : Argument_List (1 .. Number); Last_New : Natural := 0; Dir_Path : constant String := Get_Name_String ! (Arguments_Project.Directory.Name); begin Current := Switches.Values; --- 2349,2355 ---- New_Args : Argument_List (1 .. Number); Last_New : Natural := 0; Dir_Path : constant String := Get_Name_String ! (Arguments_Project.Directory.Display_Name); begin Current := Switches.Values; *************** package body Make is *** 2352,2358 **** (Name_Buffer (1 .. Name_Len))); Dir_Path : constant String := Get_Name_String ! (Arguments_Project.Directory.Name); begin Test_If_Relative_Path --- 2392,2399 ---- (Name_Buffer (1 .. Name_Len))); Dir_Path : constant String := Get_Name_String ! (Arguments_Project. ! Directory.Display_Name); begin Test_If_Relative_Path *************** package body Make is *** 2432,2438 **** -- Info on the mapping file Need_To_Check_Standard_Library : Boolean := ! Check_Readonly_Files and not Unique_Compile; procedure Add_Process --- 2473,2479 ---- -- Info on the mapping file Need_To_Check_Standard_Library : Boolean := ! (Check_Readonly_Files or Must_Compile) and not Unique_Compile; procedure Add_Process *************** package body Make is *** 2487,2494 **** -- library file name. Process_Id of the process spawned to execute the -- compilation. package Good_ALI is new Table.Table ( ! Table_Component_Type => ALI_Id, Table_Index_Type => Natural, Table_Low_Bound => 1, Table_Initial => 50, --- 2528,2540 ---- -- library file name. Process_Id of the process spawned to execute the -- compilation. + type ALI_Project is record + ALI : ALI_Id; + Project : Project_Id; + end record; + package Good_ALI is new Table.Table ( ! Table_Component_Type => ALI_Project, Table_Index_Type => Natural, Table_Low_Bound => 1, Table_Initial => 50, *************** package body Make is *** 2503,2509 **** -- Get a mapping file name. If there is one to be reused, reuse it. -- Otherwise, create a new mapping file. ! function Get_Next_Good_ALI return ALI_Id; -- Returns the next good ALI_Id record procedure Record_Failure --- 2549,2555 ---- -- Get a mapping file name. If there is one to be reused, reuse it. -- Otherwise, create a new mapping file. ! function Get_Next_Good_ALI return ALI_Project; -- Returns the next good ALI_Id record procedure Record_Failure *************** package body Make is *** 2514,2520 **** -- If Found is False then the compilation of File failed because we -- could not find it. Records also Unit when possible. ! procedure Record_Good_ALI (A : ALI_Id); -- Records in the previous set the Id of an ALI file function Must_Exit_Because_Of_Error return Boolean; --- 2560,2566 ---- -- If Found is False then the compilation of File failed because we -- could not find it. Records also Unit when possible. ! procedure Record_Good_ALI (A : ALI_Id; Project : Project_Id); -- Records in the previous set the Id of an ALI file function Must_Exit_Because_Of_Error return Boolean; *************** package body Make is *** 2570,2575 **** --- 2616,2625 ---- Project => Arguments_Project); Outstanding_Compiles := OC1; + + if Arguments_Project /= No_Project then + Queue.Set_Obj_Dir_Busy (Arguments_Project.Object_Directory.Name); + end if; end Add_Process; -------------------- *************** package body Make is *** 2608,2613 **** --- 2658,2667 ---- Data := Running_Compile (J); Project := Running_Compile (J).Project; + if Project /= No_Project then + Queue.Set_Obj_Dir_Free (Project.Object_Directory.Name); + end if; + -- If a mapping file was used by this compilation, get its -- file name for reuse by a subsequent compilation. *************** package body Make is *** 2615,2624 **** Comp_Data := Project_Compilation_Htable.Get (Project_Compilation, Project); ! Comp_Data.Last_Free_Indices := ! Comp_Data.Last_Free_Indices + 1; ! Comp_Data.Free_Mapping_File_Indices ! (Comp_Data.Last_Free_Indices) := Running_Compile (J).Mapping_File; end if; --- 2669,2678 ---- Comp_Data := Project_Compilation_Htable.Get (Project_Compilation, Project); ! Comp_Data.Last_Free_Indexes := ! Comp_Data.Last_Free_Indexes + 1; ! Comp_Data.Free_Mapping_File_Indexes ! (Comp_Data.Last_Free_Indexes) := Running_Compile (J).Mapping_File; end if; *************** package body Make is *** 2688,2694 **** end if; else ! Insert_Q (Sfile, Index => 0); Mark (Sfile, Index => 0); end if; end if; --- 2742,2748 ---- end if; else ! Queue.Insert (Sfile, Project => No_Project, Index => 0); Mark (Sfile, Index => 0); end if; end if; *************** package body Make is *** 2719,2729 **** -- check for an eventual library project, and use the full path. if Arguments_Project /= No_Project then ! if not Arguments_Project.Externally_Built then Prj.Env.Set_Ada_Paths (Arguments_Project, Project_Tree, ! Including_Libraries => True); if not Unique_Compile and then MLib.Tgt.Support_For_Libraries /= Prj.None --- 2773,2786 ---- -- check for an eventual library project, and use the full path. if Arguments_Project /= No_Project then ! if not Arguments_Project.Externally_Built ! or else Must_Compile ! then Prj.Env.Set_Ada_Paths (Arguments_Project, Project_Tree, ! Including_Libraries => True, ! Include_Path => Use_Include_Path_File); if not Unique_Compile and then MLib.Tgt.Support_For_Libraries /= Prj.None *************** package body Make is *** 2734,2740 **** begin if Prj.Library ! and then not Prj.Externally_Built and then not Prj.Need_To_Build_Lib then -- Add to the Q all sources of the project that have --- 2791,2797 ---- begin if Prj.Library ! and then (not Prj.Externally_Built or else Must_Compile) and then not Prj.Need_To_Build_Lib then -- Add to the Q all sources of the project that have *************** package body Make is *** 2842,2847 **** --- 2899,2911 ---- Do_Bind_Step := False; Do_Link_Step := False; Syntax_Only := False; + + elsif Args (J).all = "-gnatC" + or else Args (J).all = "-gnatcC" + then + -- If we compile with -gnatC, enable CodePeer globalize step + + Do_Codepeer_Globalize_Step := True; end if; end loop; *************** package body Make is *** 2886,2892 **** begin if Is_Predefined_File_Name (Fname, False) then ! if Check_Readonly_Files then Comp_Args (Comp_Args'First + 2 .. Comp_Last + 1) := Comp_Args (Comp_Args'First + 1 .. Comp_Last); Comp_Last := Comp_Last + 1; --- 2950,2956 ---- begin if Is_Predefined_File_Name (Fname, False) then ! if Check_Readonly_Files or else Must_Compile then Comp_Args (Comp_Args'First + 2 .. Comp_Last + 1) := Comp_Args (Comp_Args'First + 1 .. Comp_Last); Comp_Last := Comp_Last + 1; *************** package body Make is *** 2994,2999 **** --- 3058,3064 ---- ------------------------------- procedure Fill_Queue_From_ALI_Files is + ALI_P : ALI_Project; ALI : ALI_Id; Source_Index : Int; Sfile : File_Name_Type; *************** package body Make is *** 3003,3010 **** begin while Good_ALI_Present loop ! ALI := Get_Next_Good_ALI; ! Source_Index := Unit_Index_Of (ALIs.Table (ALI).Afile); -- If we are processing the library file corresponding to the -- main source file check if this source can be a main unit. --- 3068,3076 ---- begin while Good_ALI_Present loop ! ALI_P := Get_Next_Good_ALI; ! ALI := ALI_P.ALI; ! Source_Index := Unit_Index_Of (ALIs.Table (ALI_P.ALI).Afile); -- If we are processing the library file corresponding to the -- main source file check if this source can be a main unit. *************** package body Make is *** 3084,3097 **** if Is_Marked (Sfile, Source_Index) then Debug_Msg ("Skipping marked file:", Sfile); ! elsif not Check_Readonly_Files and then Is_Internal_File_Name (Sfile, False) then Debug_Msg ("Skipping internal file:", Sfile); else ! Insert_Q ! (Sfile, Withs.Table (K).Uname, Source_Index); Mark (Sfile, Source_Index); end if; end if; --- 3150,3166 ---- if Is_Marked (Sfile, Source_Index) then Debug_Msg ("Skipping marked file:", Sfile); ! elsif not (Check_Readonly_Files or Must_Compile) and then Is_Internal_File_Name (Sfile, False) then Debug_Msg ("Skipping internal file:", Sfile); else ! Queue.Insert ! (Sfile, ! ALI_P.Project, ! Withs.Table (K).Uname, ! Source_Index); Mark (Sfile, Source_Index); end if; end if; *************** package body Make is *** 3113,3121 **** -- If there is a mapping file ready to be reused, reuse it ! if Data.Last_Free_Indices > 0 then ! Mfile := Data.Free_Mapping_File_Indices (Data.Last_Free_Indices); ! Data.Last_Free_Indices := Data.Last_Free_Indices - 1; -- Otherwise, create and initialize a new one --- 3182,3190 ---- -- If there is a mapping file ready to be reused, reuse it ! if Data.Last_Free_Indexes > 0 then ! Mfile := Data.Free_Mapping_File_Indexes (Data.Last_Free_Indexes); ! Data.Last_Free_Indexes := Data.Last_Free_Indexes - 1; -- Otherwise, create and initialize a new one *************** package body Make is *** 3137,3150 **** -- Get_Next_Good_ALI -- ----------------------- ! function Get_Next_Good_ALI return ALI_Id is ! ALI : ALI_Id; begin pragma Assert (Good_ALI_Present); ! ALI := Good_ALI.Table (Good_ALI.Last); Good_ALI.Decrement_Last; ! return ALI; end Get_Next_Good_ALI; ---------------------- --- 3206,3219 ---- -- Get_Next_Good_ALI -- ----------------------- ! function Get_Next_Good_ALI return ALI_Project is ! ALIP : ALI_Project; begin pragma Assert (Good_ALI_Present); ! ALIP := Good_ALI.Table (Good_ALI.Last); Good_ALI.Decrement_Last; ! return ALIP; end Get_Next_Good_ALI; ---------------------- *************** package body Make is *** 3198,3207 **** -- Record_Good_ALI -- --------------------- ! procedure Record_Good_ALI (A : ALI_Id) is begin Good_ALI.Increment_Last; ! Good_ALI.Table (Good_ALI.Last) := A; end Record_Good_ALI; ------------------------------- --- 3267,3276 ---- -- Record_Good_ALI -- --------------------- ! procedure Record_Good_ALI (A : ALI_Id; Project : Project_Id) is begin Good_ALI.Increment_Last; ! Good_ALI.Table (Good_ALI.Last) := (A, Project); end Record_Good_ALI; ------------------------------- *************** package body Make is *** 3237,3244 **** -- The object file begin ! if not Empty_Q and then Outstanding_Compiles < Max_Process then ! Extract_From_Q (Source_File, Source_Unit, Source_Index); Osint.Full_Source_Name (Source_File, --- 3306,3315 ---- -- The object file begin ! if not Queue.Is_Virtually_Empty and then ! Outstanding_Compiles < Max_Process ! then ! Queue.Extract (Source_File, Source_Unit, Source_Index); Osint.Full_Source_Name (Source_File, *************** package body Make is *** 3265,3278 **** end if; In_Lib_Dir := Full_Lib_File /= No_File ! and then In_Ada_Lib_Dir (Full_Lib_File); -- Since the following requires a system call, we precompute it -- when needed. if not In_Lib_Dir then if Full_Lib_File /= No_File ! and then not Check_Readonly_Files then Get_Name_String (Full_Lib_File); Name_Buffer (Name_Len + 1) := ASCII.NUL; --- 3336,3349 ---- end if; In_Lib_Dir := Full_Lib_File /= No_File ! and then In_Ada_Lib_Dir (Full_Lib_File); -- Since the following requires a system call, we precompute it -- when needed. if not In_Lib_Dir then if Full_Lib_File /= No_File ! and then not (Check_Readonly_Files or else Must_Compile) then Get_Name_String (Full_Lib_File); Name_Buffer (Name_Len + 1) := ASCII.NUL; *************** package body Make is *** 3314,3320 **** -- Source and library files can be located but are internal -- files. ! elsif not Check_Readonly_Files and then Full_Lib_File /= No_File and then Is_Internal_File_Name (Source_File, False) then --- 3385,3391 ---- -- Source and library files can be located but are internal -- files. ! elsif not (Check_Readonly_Files or else Must_Compile) and then Full_Lib_File /= No_File and then Is_Internal_File_Name (Source_File, False) then *************** package body Make is *** 3342,3347 **** --- 3413,3419 ---- if Arguments_Project = No_Project or else not Arguments_Project.Externally_Built + or else Must_Compile then -- Don't waste any time if we have to recompile anyway *************** package body Make is *** 3367,3373 **** -- The ALI file is up-to-date; record its Id ! Record_Good_ALI (ALI); -- Record the time stamp of the most recent object -- file as long as no (re)compilations are needed. --- 3439,3445 ---- -- The ALI file is up-to-date; record its Id ! Record_Good_ALI (ALI, Arguments_Project); -- Record the time stamp of the most recent object -- file as long as no (re)compilations are needed. *************** package body Make is *** 3473,3479 **** then Get_Name_String (Project_Of_Current_Object_Directory ! .Object_Directory.Name); Add_Str_To_Name_Buffer (Get_Name_String (Lib_File)); Full_Lib_File := Name_Find; --- 3545,3551 ---- then Get_Name_String (Project_Of_Current_Object_Directory ! .Object_Directory.Display_Name); Add_Str_To_Name_Buffer (Get_Name_String (Lib_File)); Full_Lib_File := Name_Find; *************** package body Make is *** 3522,3528 **** begin if Outstanding_Compiles = Max_Process ! or else (Empty_Q and then not Good_ALI_Present and then Outstanding_Compiles > 0) then --- 3594,3600 ---- begin if Outstanding_Compiles = Max_Process ! or else (Queue.Is_Virtually_Empty and then not Good_ALI_Present and then Outstanding_Compiles > 0) then *************** package body Make is *** 3583,3589 **** end if; else ! Record_Good_ALI (ALI); end if; Free (Text); --- 3655,3661 ---- end if; else ! Record_Good_ALI (ALI, Data.Project); end if; Free (Text); *************** package body Make is *** 3619,3628 **** Good_ALI.Init; - if First_Q_Initialization then - Init_Q; - end if; - if Initialize_ALI_Data then Initialize_ALI; Initialize_ALI_Source; --- 3691,3696 ---- *************** package body Make is *** 3642,3648 **** -- compilations if -jnnn is used. if not Is_Marked (Main_Source, Main_Index) then ! Insert_Q (Main_Source, Index => Main_Index); Mark (Main_Source, Main_Index); end if; --- 3710,3716 ---- -- compilations if -jnnn is used. if not Is_Marked (Main_Source, Main_Index) then ! Queue.Insert (Main_Source, Main_Project, Index => Main_Index); Mark (Main_Source, Main_Index); end if; *************** package body Make is *** 3654,3660 **** -- Keep looping until there is no more work to do (the Q is empty) -- and all the outstanding compilations have terminated. ! Make_Loop : while not Empty_Q or else Outstanding_Compiles > 0 loop exit Make_Loop when Must_Exit_Because_Of_Error; exit Make_Loop when Start_Compile_If_Possible (Args); --- 3722,3729 ---- -- Keep looping until there is no more work to do (the Q is empty) -- and all the outstanding compilations have terminated. ! Make_Loop : ! while not Queue.Is_Empty or else Outstanding_Compiles > 0 loop exit Make_Loop when Must_Exit_Because_Of_Error; exit Make_Loop when Start_Compile_If_Possible (Args); *************** package body Make is *** 3667,3677 **** if Display_Compilation_Progress then Write_Str ("completed "); ! Write_Int (Int (Q_Front)); Write_Str (" out of "); ! Write_Int (Int (Q.Last)); Write_Str (" ("); ! Write_Int (Int ((Q_Front * 100) / (Q.Last - Q.First))); Write_Str ("%)..."); Write_Eol; end if; --- 3736,3746 ---- if Display_Compilation_Progress then Write_Str ("completed "); ! Write_Int (Int (Queue.Processed)); Write_Str (" out of "); ! Write_Int (Int (Queue.Size)); Write_Str (" ("); ! Write_Int (Int ((Queue.Processed * 100) / Queue.Size)); Write_Str ("%)..."); Write_Eol; end if; *************** package body Make is *** 4032,4060 **** Display_Executed_Programs := Display; end Display_Commands; - ------------- - -- Empty_Q -- - ------------- - - function Empty_Q return Boolean is - begin - if Debug.Debug_Flag_P then - Write_Str (" Q := ["); - - for J in Q_Front .. Q.Last - 1 loop - Write_Str (" "); - Write_Name (Q.Table (J).File); - Write_Eol; - Write_Str (" "); - end loop; - - Write_Str ("]"); - Write_Eol; - end if; - - return Q_Front >= Q.Last; - end Empty_Q; - -------------------------- -- Enter_Into_Obsoleted -- -------------------------- --- 4101,4106 ---- *************** package body Make is *** 4086,4123 **** Obsoleted.Set (F2, True); end Enter_Into_Obsoleted; ! -------------------- ! -- Extract_From_Q -- ! -------------------- ! procedure Extract_From_Q ! (Source_File : out File_Name_Type; ! Source_Unit : out Unit_Name_Type; ! Source_Index : out Int) ! is ! File : constant File_Name_Type := Q.Table (Q_Front).File; ! Unit : constant Unit_Name_Type := Q.Table (Q_Front).Unit; ! Index : constant Int := Q.Table (Q_Front).Index; ! begin ! if Debug.Debug_Flag_Q then ! Write_Str (" Q := Q - [ "); ! Write_Name (File); ! if Index /= 0 then ! Write_Str (", "); ! Write_Int (Index); end if; ! Write_Str (" ]"); ! Write_Eol; end if; ! Q_Front := Q_Front + 1; ! Source_File := File; ! Source_Unit := Unit; ! Source_Index := Index; ! end Extract_From_Q; -------------- -- Gnatmake -- --- 4132,4183 ---- Obsoleted.Set (F2, True); end Enter_Into_Obsoleted; ! --------------- ! -- Globalize -- ! --------------- ! procedure Globalize (Success : out Boolean) is ! Quiet_Str : aliased String := "-quiet"; ! Globalizer_Args : constant Argument_List := ! (1 => Quiet_Str'Unchecked_Access); ! Previous_Dir : String_Access; ! procedure Globalize_Dir (Dir : String); ! -- Call CodePeer globalizer on Dir ! ------------------- ! -- Globalize_Dir -- ! ------------------- ! ! procedure Globalize_Dir (Dir : String) is ! Result : Boolean; ! begin ! if Previous_Dir = null or else Dir /= Previous_Dir.all then ! Free (Previous_Dir); ! Previous_Dir := new String'(Dir); ! Change_Dir (Dir); ! GNAT.OS_Lib.Spawn (Globalizer_Path.all, Globalizer_Args, Result); ! Success := Success and Result; end if; + end Globalize_Dir; ! procedure Globalize_Dirs is new ! Prj.Env.For_All_Object_Dirs (Globalize_Dir); ! ! begin ! Success := True; ! Display (Globalizer, Globalizer_Args); ! ! if Globalizer_Path = null then ! Make_Failed ("error, unable to locate " & Globalizer); end if; ! if Main_Project = No_Project then ! GNAT.OS_Lib.Spawn (Globalizer_Path.all, Globalizer_Args, Success); ! else ! Globalize_Dirs (Main_Project); ! end if; ! end Globalize; -------------- -- Gnatmake -- *************** package body Make is *** 4168,4177 **** -- Check that the main subprograms do exist and that they all -- belong to the same project file. - procedure Create_Binder_Mapping_File - (Args : in out Argument_List; Last_Arg : in out Natural); - -- Create a binder mapping file and add the necessary switch - ----------------- -- Check_Mains -- ----------------- --- 4228,4233 ---- *************** package body Make is *** 4314,4498 **** end loop; end Check_Mains; - -------------------------------- - -- Create_Binder_Mapping_File -- - -------------------------------- - - procedure Create_Binder_Mapping_File - (Args : in out Argument_List; Last_Arg : in out Natural) - is - Mapping_FD : File_Descriptor := Invalid_FD; - -- A File Descriptor for an eventual mapping file - - ALI_Unit : Unit_Name_Type := No_Unit_Name; - -- The unit name of an ALI file - - ALI_Name : File_Name_Type := No_File; - -- The file name of the ALI file - - ALI_Project : Project_Id := No_Project; - -- The project of the ALI file - - Bytes : Integer; - OK : Boolean := True; - Unit : Unit_Index; - - Status : Boolean; - -- For call to Close - - begin - Tempdir.Create_Temp_File (Mapping_FD, Mapping_Path); - Record_Temp_File (Project_Tree, Mapping_Path); - - if Mapping_FD /= Invalid_FD then - - -- Traverse all units - - Unit := Units_Htable.Get_First (Project_Tree.Units_HT); - - while Unit /= No_Unit_Index loop - if Unit.Name /= No_Name then - - -- If there is a body, put it in the mapping - - if Unit.File_Names (Impl) /= No_Source - and then Unit.File_Names (Impl).Project /= - No_Project - then - Get_Name_String (Unit.Name); - Add_Str_To_Name_Buffer ("%b"); - ALI_Unit := Name_Find; - ALI_Name := - Lib_File_Name - (Unit.File_Names (Impl).Display_File); - ALI_Project := Unit.File_Names (Impl).Project; - - -- Otherwise, if there is a spec, put it in the mapping - - elsif Unit.File_Names (Spec) /= No_Source - and then Unit.File_Names (Spec).Project /= No_Project - then - Get_Name_String (Unit.Name); - Add_Str_To_Name_Buffer ("%s"); - ALI_Unit := Name_Find; - ALI_Name := - Lib_File_Name - (Unit.File_Names (Spec).Display_File); - ALI_Project := Unit.File_Names (Spec).Project; - - else - ALI_Name := No_File; - end if; - - -- If we have something to put in the mapping then do it - -- now. However, if the project is extended, we don't put - -- anything in the mapping file, because we don't know where - -- the ALI file is: it might be in the extended project - -- object directory as well as in the extending project - -- object directory. - - if ALI_Name /= No_File - and then ALI_Project.Extended_By = No_Project - and then ALI_Project.Extends = No_Project - then - -- First check if the ALI file exists. If it does not, - -- do not put the unit in the mapping file. - - declare - ALI : constant String := Get_Name_String (ALI_Name); - - begin - -- For library projects, use the library directory, - -- for other projects, use the object directory. - - if ALI_Project.Library then - Get_Name_String (ALI_Project.Library_Dir.Name); - else - Get_Name_String - (ALI_Project.Object_Directory.Name); - end if; - - if not - Is_Directory_Separator (Name_Buffer (Name_Len)) - then - Add_Char_To_Name_Buffer (Directory_Separator); - end if; - - Add_Str_To_Name_Buffer (ALI); - Add_Char_To_Name_Buffer (ASCII.LF); - - declare - ALI_Path_Name : constant String := - Name_Buffer (1 .. Name_Len); - - begin - if Is_Regular_File - (ALI_Path_Name (1 .. ALI_Path_Name'Last - 1)) - then - -- First line is the unit name - - Get_Name_String (ALI_Unit); - Add_Char_To_Name_Buffer (ASCII.LF); - Bytes := - Write - (Mapping_FD, - Name_Buffer (1)'Address, - Name_Len); - OK := Bytes = Name_Len; - - exit when not OK; - - -- Second line it the ALI file name - - Get_Name_String (ALI_Name); - Add_Char_To_Name_Buffer (ASCII.LF); - Bytes := - Write - (Mapping_FD, - Name_Buffer (1)'Address, - Name_Len); - OK := (Bytes = Name_Len); - - exit when not OK; - - -- Third line it the ALI path name - - Bytes := - Write - (Mapping_FD, - ALI_Path_Name (1)'Address, - ALI_Path_Name'Length); - OK := (Bytes = ALI_Path_Name'Length); - - -- If OK is False, it means we were unable to - -- write a line. No point in continuing with the - -- other units. - - exit when not OK; - end if; - end; - end; - end if; - end if; - - Unit := Units_Htable.Get_Next (Project_Tree.Units_HT); - end loop; - - Close (Mapping_FD, Status); - - OK := OK and Status; - - -- If the creation of the mapping file was successful, we add the - -- switch to the arguments of gnatbind. - - if OK then - Last_Arg := Last_Arg + 1; - Args (Last_Arg) := - new String'("-F=" & Get_Name_String (Mapping_Path)); - end if; - end if; - end Create_Binder_Mapping_File; - -- Start of processing for Gnatmake -- This body is very long, should be broken down??? --- 4370,4375 ---- *************** package body Make is *** 4555,4564 **** Add_Switch ("-n", Binder, And_Save => True); ! for J in Q.First .. Q.Last - 1 loop Add_Switch (Get_Name_String ! (Lib_File_Name (Q.Table (J).File)), Binder, And_Save => True); end loop; end if; --- 4432,4441 ---- Add_Switch ("-n", Binder, And_Save => True); ! for J in 1 .. Queue.Size loop Add_Switch (Get_Name_String ! (Lib_File_Name (Queue.Element (J))), Binder, And_Save => True); end loop; end if; *************** package body Make is *** 4683,4711 **** -- language, all the Ada mains. while Value /= Prj.Nil_String loop - Get_Name_String - (Project_Tree.String_Elements.Table (Value).Value); - -- To know if a main is an Ada main, get its project. -- It should be the project specified on the command -- line. ! if (not Foreign_Language) or else ! Prj.Env.Project_Of ! (Name_Buffer (1 .. Name_Len), ! Main_Project, ! Project_Tree) = ! Main_Project ! then ! At_Least_One_Main := True; ! Osint.Add_File ! (Get_Name_String ! (Project_Tree.String_Elements.Table ! (Value).Value), ! Index => ! Project_Tree.String_Elements.Table ! (Value).Index); ! end if; Value := Project_Tree.String_Elements.Table (Value).Next; --- 4560,4600 ---- -- language, all the Ada mains. while Value /= Prj.Nil_String loop -- To know if a main is an Ada main, get its project. -- It should be the project specified on the command -- line. ! Get_Name_String ! (Project_Tree.String_Elements.Table (Value).Value); ! ! declare ! Main_Name : constant String := ! Get_Name_String ! (Project_Tree.String_Elements.Table ! (Value).Value); ! Proj : constant Project_Id := ! Prj.Env.Project_Of ! (Main_Name, Main_Project, Project_Tree); ! begin ! ! if Proj = Main_Project then ! ! At_Least_One_Main := True; ! Osint.Add_File ! (Get_Name_String ! (Project_Tree.String_Elements.Table ! (Value).Value), ! Index => ! Project_Tree.String_Elements.Table ! (Value).Index); ! ! elsif not Foreign_Language then ! Make_Failed ! ("""" & Main_Name & ! """ is not a source of project " & ! Get_Name_String (Main_Project.Display_Name)); ! end if; ! end; Value := Project_Tree.String_Elements.Table (Value).Next; *************** package body Make is *** 4731,4743 **** Display_Version ("GNATMAKE", "1995"); end if; - if Main_Project /= No_Project - and then Main_Project.Externally_Built - then - Make_Failed - ("nothing to do for a main project that is externally built"); - end if; - if Osint.Number_Of_Files = 0 then if Main_Project /= No_Project and then Main_Project.Library --- 4620,4625 ---- *************** package body Make is *** 5174,5179 **** --- 5056,5080 ---- end; end if; + -- The combination of -f -u and one or several mains on the command line + -- implies -a. + + if Force_Compilations + and then Unique_Compile + and then not Unique_Compile_All_Projects + and then Main_On_Command_Line + then + Must_Compile := True; + end if; + + if Main_Project /= No_Project + and then not Must_Compile + and then Main_Project.Externally_Built + then + Make_Failed + ("nothing to do for a main project that is externally built"); + end if; + -- Get the target parameters, which are only needed for a couple of -- cases in gnatmake. Protect against an exception, such as the case of -- system.ads missing from the library, and fail gracefully. *************** package body Make is *** 5280,5286 **** begin if not Is_Absolute_Path (Exec_File_Name) then ! Get_Name_String (Main_Project.Exec_Directory.Name); if not Is_Directory_Separator (Name_Buffer (Name_Len)) --- 5181,5188 ---- begin if not Is_Absolute_Path (Exec_File_Name) then ! Get_Name_String ! (Main_Project.Exec_Directory.Display_Name); if not Is_Directory_Separator (Name_Buffer (Name_Len)) *************** package body Make is *** 5305,5311 **** declare Dir_Path : constant String := ! Get_Name_String (Main_Project.Directory.Name); begin for J in 1 .. Binder_Switches.Last loop Test_If_Relative_Path --- 5207,5213 ---- declare Dir_Path : constant String := ! Get_Name_String (Main_Project.Directory.Display_Name); begin for J in 1 .. Binder_Switches.Last loop Test_If_Relative_Path *************** package body Make is *** 5419,5424 **** --- 5321,5331 ---- Saved_Maximum_Processes := Maximum_Processes; end if; + if Debug.Debug_Flag_M then + Write_Line ("Maximum number of simultaneous compilations =" & + Saved_Maximum_Processes'Img); + end if; + -- Allocate as many temporary mapping file names as the maximum number -- of compilations processed, for each possible project. *************** package body Make is *** 5431,5439 **** (Mapping_File_Names => new Temp_Path_Names (1 .. Saved_Maximum_Processes), Last_Mapping_File_Names => 0, ! Free_Mapping_File_Indices => new Free_File_Indices (1 .. Saved_Maximum_Processes), ! Last_Free_Indices => 0); Project_Compilation_Htable.Set (Project_Compilation, Proj.Project, Data); --- 5338,5346 ---- (Mapping_File_Names => new Temp_Path_Names (1 .. Saved_Maximum_Processes), Last_Mapping_File_Names => 0, ! Free_Mapping_File_Indexes => new Free_File_Indexes (1 .. Saved_Maximum_Processes), ! Last_Free_Indexes => 0); Project_Compilation_Htable.Set (Project_Compilation, Proj.Project, Data); *************** package body Make is *** 5444,5452 **** (Mapping_File_Names => new Temp_Path_Names (1 .. Saved_Maximum_Processes), Last_Mapping_File_Names => 0, ! Free_Mapping_File_Indices => new Free_File_Indices (1 .. Saved_Maximum_Processes), ! Last_Free_Indices => 0); Project_Compilation_Htable.Set (Project_Compilation, No_Project, Data); --- 5351,5359 ---- (Mapping_File_Names => new Temp_Path_Names (1 .. Saved_Maximum_Processes), Last_Mapping_File_Names => 0, ! Free_Mapping_File_Indexes => new Free_File_Indexes (1 .. Saved_Maximum_Processes), ! Last_Free_Indexes => 0); Project_Compilation_Htable.Set (Project_Compilation, No_Project, Data); *************** package body Make is *** 5563,5568 **** --- 5470,5479 ---- Args (J) := Gcc_Switches.Table (J); end loop; + Queue.Initialize + (Main_Project /= No_Project and then + One_Compilation_Per_Obj_Dir); + -- Now we invoke Compile_Sources for the current main Compile_Sources *************** package body Make is *** 5587,5596 **** Write_Eol; end if; - -- Make sure the queue will be reinitialized for the next round - - First_Q_Initialization := True; - Total_Compilation_Failures := Total_Compilation_Failures + Compilation_Failures; --- 5498,5503 ---- *************** package body Make is *** 6026,6037 **** -- and all the object directories in ADA_OBJECTS_PATH, -- except those of library projects. ! Prj.Env.Set_Ada_Paths (Main_Project, Project_Tree, False); -- If switch -C was specified, create a binder mapping file if Create_Mapping_File then ! Create_Binder_Mapping_File (Args, Last_Arg); end if; end if; --- 5933,5951 ---- -- and all the object directories in ADA_OBJECTS_PATH, -- except those of library projects. ! Prj.Env.Set_Ada_Paths ! (Main_Project, Project_Tree, Use_Include_Path_File); -- If switch -C was specified, create a binder mapping file if Create_Mapping_File then ! Mapping_Path := Create_Binder_Mapping_File; ! ! if Mapping_Path /= No_Path then ! Last_Arg := Last_Arg + 1; ! Args (Last_Arg) := ! new String'("-F=" & Get_Name_String (Mapping_Path)); ! end if; end if; end if; *************** package body Make is *** 6043,6049 **** exception when others => ! -- Delete the temporary mapping file, if one was created. if Mapping_Path /= No_Path then Delete_Temporary_File (Project_Tree, Mapping_Path); --- 5957,5963 ---- exception when others => ! -- Delete the temporary mapping file if one was created if Mapping_Path /= No_Path then Delete_Temporary_File (Project_Tree, Mapping_Path); *************** package body Make is *** 6054,6060 **** raise; end; ! -- If -dn was not specified, delete the temporary mapping file, -- if one was created. if Mapping_Path /= No_Path then --- 5968,5974 ---- raise; end; ! -- If -dn was not specified, delete the temporary mapping file -- if one was created. if Mapping_Path /= No_Path then *************** package body Make is *** 6253,6259 **** -- Put the object directories in ADA_OBJECTS_PATH ! Prj.Env.Set_Ada_Paths (Main_Project, Project_Tree, False); -- Check for attributes Linker'Linker_Options in projects -- other than the main project --- 6167,6177 ---- -- Put the object directories in ADA_OBJECTS_PATH ! Prj.Env.Set_Ada_Paths ! (Main_Project, ! Project_Tree, ! Including_Libraries => False, ! Include_Path => False); -- Check for attributes Linker'Linker_Options in projects -- other than the main project *************** package body Make is *** 6271,6276 **** --- 6189,6203 ---- end; end if; + -- Add switch -M to gnatlink if builder switch + -- --create-map-file has been specified. + + if Map_File /= null then + Linker_Switches.Increment_Last; + Linker_Switches.Table (Linker_Switches.Last) := + new String'("-M" & Map_File.all); + end if; + declare Args : Argument_List (Linker_Switches.First .. Linker_Switches.Last + 2); *************** package body Make is *** 6486,6492 **** declare Dir_Path : constant String := Get_Name_String ! (Main_Project.Directory.Name); begin for --- 6413,6419 ---- declare Dir_Path : constant String := Get_Name_String ! (Main_Project.Directory.Display_Name); begin for *************** package body Make is *** 6533,6538 **** --- 6460,6482 ---- Delete_All_Marks; end loop Multiple_Main_Loop; + if Do_Codepeer_Globalize_Step then + declare + Success : Boolean := False; + begin + Globalize (Success); + + if not Success then + Set_Standard_Error; + Write_Str ("*** globalize failed."); + + if Commands_To_Stdout then + Set_Standard_Output; + end if; + end if; + end; + end if; + if Failed_Links.Last > 0 then for Index in 1 .. Successful_Links.Last loop Write_Str ("Linking of """); *************** package body Make is *** 6567,6572 **** --- 6511,6520 ---- Delete_All_Temp_Files; + -- Output Namet statistics + + Namet.Finalize; + exception when X : others => Set_Standard_Error; *************** package body Make is *** 6651,6667 **** File_Index := Data.Last_Mapping_File_Names; end Init_Mapping_File; - ------------ - -- Init_Q -- - ------------ - - procedure Init_Q is - begin - First_Q_Initialization := False; - Q_Front := Q.First; - Q.Set_Last (Q.First); - end Init_Q; - ---------------- -- Initialize -- ---------------- --- 6599,6604 ---- *************** package body Make is *** 6688,6694 **** Check_Object_Consistency := True; ! -- Package initializations. The order of calls is important here Output.Set_Standard_Error; --- 6625,6631 ---- Check_Object_Consistency := True; ! -- Package initializations (the order of calls is important here) Output.Set_Standard_Error; *************** package body Make is *** 6697,6704 **** Linker_Switches.Init; Csets.Initialize; - Namet.Initialize; - Snames.Initialize; Prj.Initialize (Project_Tree); --- 6634,6639 ---- *************** package body Make is *** 6934,6939 **** --- 6869,6875 ---- Unit : Unit_Index; Sfile : File_Name_Type; Index : Int; + Project : Project_Id; Extending : constant Boolean := The_Project.Extends /= No_Project; *************** package body Make is *** 6975,6982 **** Unit := Units_Htable.Get_First (Project_Tree.Units_HT); while Unit /= null loop ! Sfile := No_File; ! Index := 0; -- If there is a source for the body, and the body has not been -- locally removed. --- 6911,6919 ---- Unit := Units_Htable.Get_First (Project_Tree.Units_HT); while Unit /= null loop ! Sfile := No_File; ! Index := 0; ! Project := No_Project; -- If there is a source for the body, and the body has not been -- locally removed. *************** package body Make is *** 6987,6992 **** --- 6924,6930 ---- -- And it is a source for the specified project if Check_Project (Unit.File_Names (Impl).Project) then + Project := Unit.File_Names (Impl).Project; -- If we don't have a spec, we cannot consider the source -- if it is a subunit. *************** package body Make is *** 7009,7015 **** begin Src_Ind := Sinput.P.Load_Project_File (Get_Name_String ! (Unit.File_Names (Impl).Path.Name)); -- If it is a subunit, discard it --- 6947,6953 ---- begin Src_Ind := Sinput.P.Load_Project_File (Get_Name_String ! (Unit.File_Names (Impl).Path.Display_Name)); -- If it is a subunit, discard it *************** package body Make is *** 7037,7074 **** Sfile := Unit.File_Names (Spec).Display_File; Index := Unit.File_Names (Spec).Index; end if; ! -- If Put_In_Q is True, we insert into the Q ! if Put_In_Q then ! -- For the first source inserted into the Q, we need to initialize ! -- the Q, but not for the subsequent sources. ! if First_Q_Initialization then ! Init_Q; end if; ! -- And of course, only insert in the Q if the source is not marked ! ! 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, Index => Index); ! Mark (Sfile, Index); ! end if; ! elsif Sfile /= No_File then -- If Put_In_Q is False, we add the source as if it were specified -- on the command line, and we set Put_In_Q to True, so that the ! -- following sources will be put directly in the queue. This will ! -- allow parallel compilation processes if -jx switch is used. if Verbose_Mode then Write_Str ("Adding """); --- 6975,7010 ---- Sfile := Unit.File_Names (Spec).Display_File; Index := Unit.File_Names (Spec).Index; + Project := Unit.File_Names (Spec).Project; end if; ! -- For the first source inserted into the Q, we need to initialize ! -- the Q, but not for the subsequent sources. ! Queue.Initialize ! (Main_Project /= No_Project and then ! One_Compilation_Per_Obj_Dir); ! -- And of course, only insert in the Q if the source is not marked ! 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; ! Queue.Insert (Sfile, Project, Index => Index); ! Mark (Sfile, Index); ! end if; ! if not Put_In_Q and then Sfile /= No_File then -- If Put_In_Q is False, we add the source as if it were specified -- on the command line, and we set Put_In_Q to True, so that the ! -- following sources will only be put in the queue. The source is ! -- already in the Q, but we need at least one fake main to call ! -- Compile_Sources. if Verbose_Mode then Write_Str ("Adding """); *************** package body Make is *** 7078,7126 **** 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 - -- initialized to avoid errors. - - if First_Q_Initialization then - Init_Q; - end if; end if; Unit := Units_Htable.Get_Next (Project_Tree.Units_HT); end loop; end Insert_Project_Sources; - -------------- - -- Insert_Q -- - -------------- - - procedure Insert_Q - (Source_File : File_Name_Type; - Source_Unit : Unit_Name_Type := No_Unit_Name; - Index : Int := 0) - is - begin - if Debug.Debug_Flag_Q then - Write_Str (" Q := Q + [ "); - Write_Name (Source_File); - - if Index /= 0 then - Write_Str (", "); - Write_Int (Index); - end if; - - Write_Str (" ] "); - Write_Eol; - end if; - - Q.Table (Q.Last) := - (File => Source_File, - Unit => Source_Unit, - Index => Index); - Q.Increment_Last; - end Insert_Q; - --------------------- -- Is_In_Obsoleted -- --------------------- --- 7014,7025 ---- *************** package body Make is *** 7533,7538 **** --- 7432,7721 ---- (Project_Node_Tree, "--RTS=" & Line (1 .. N_Read), And_Save => True); end Process_Multilib; + ----------- + -- Queue -- + ----------- + + package body Queue is + + type Q_Record is record + File : File_Name_Type; + Unit : Unit_Name_Type; + Index : Int; + Project : Project_Id; + Processed : Boolean; + end record; + -- File is the name of the file to compile. Unit is for gnatdist use in + -- order to easily get the unit name of a file to compile when its name + -- is krunched or declared in gnat.adc. Index, when not 0, is the index + -- of the unit in a multi-unit source. + + package Q is new Table.Table + (Table_Component_Type => Q_Record, + Table_Index_Type => Positive, + Table_Low_Bound => 1, + Table_Initial => 4000, + Table_Increment => 100, + Table_Name => "Make.Queue.Q"); + -- This is the actual Q + + package Busy_Obj_Dirs is new GNAT.HTable.Simple_HTable + (Header_Num => Prj.Header_Num, + Element => Boolean, + No_Element => False, + Key => Path_Name_Type, + Hash => Hash, + Equal => "="); + + Q_First : Natural := 1; + -- Points to the first valid element in the queue + + Q_Processed : Natural := 0; + One_Queue_Per_Obj_Dir : Boolean := False; + Q_Initialized : Boolean := False; + + ------------- + -- Element -- + ------------- + + function Element (Rank : Positive) return File_Name_Type is + begin + if Rank <= Q.Last then + return Q.Table (Rank).File; + else + return No_File; + end if; + end Element; + + ------------- + -- Extract -- + ------------- + + -- This body needs commenting ??? + + procedure Extract + (Source_File_Name : out File_Name_Type; + Source_Unit : out Unit_Name_Type; + Source_Index : out Int) + is + Found : Boolean := False; + + begin + if One_Queue_Per_Obj_Dir then + for J in Q_First .. Q.Last loop + if not Q.Table (J).Processed + and then (Q.Table (J).Project = No_Project + or else not + Busy_Obj_Dirs.Get + (Q.Table (J).Project.Object_Directory.Name)) + then + Found := True; + Source_File_Name := Q.Table (J).File; + Source_Unit := Q.Table (J).Unit; + Source_Index := Q.Table (J).Index; + Q.Table (J).Processed := True; + + if J = Q_First then + while Q_First <= Q.Last + and then Q.Table (Q_First).Processed + loop + Q_First := Q_First + 1; + end loop; + end if; + + exit; + end if; + end loop; + + elsif Q_First <= Q.Last then + Source_File_Name := Q.Table (Q_First).File; + Source_Unit := Q.Table (Q_First).Unit; + Source_Index := Q.Table (Q_First).Index; + Q.Table (Q_First).Processed := True; + Q_First := Q_First + 1; + Found := True; + end if; + + if Found then + Q_Processed := Q_Processed + 1; + else + Source_File_Name := No_File; + Source_Unit := No_Unit_Name; + Source_Index := 0; + end if; + + if Found and then Debug.Debug_Flag_Q then + Write_Str (" Q := Q - [ "); + Write_Name (Source_File_Name); + + if Source_Index /= 0 then + Write_Str (", "); + Write_Int (Source_Index); + end if; + + Write_Str (" ]"); + Write_Eol; + + Write_Str (" Q_First ="); + Write_Int (Int (Q_First)); + Write_Eol; + + Write_Str (" Q.Last ="); + Write_Int (Int (Q.Last)); + Write_Eol; + end if; + end Extract; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize (Queue_Per_Obj_Dir : Boolean) is + begin + if not Q_Initialized then + One_Queue_Per_Obj_Dir := Queue_Per_Obj_Dir; + Q.Init; + Q_Initialized := True; + Q_Processed := 0; + Q_First := 1; + end if; + end Initialize; + + ------------ + -- Insert -- + ------------ + + -- This body needs commenting ??? + + procedure Insert + (Source_File_Name : File_Name_Type; + Project : Project_Id; + Source_Unit : Unit_Name_Type := No_Unit_Name; + Index : Int := 0) + is + begin + Q.Append + ((File => Source_File_Name, + Project => Project, + Unit => Source_Unit, + Index => Index, + Processed => False)); + + if Debug.Debug_Flag_Q then + Write_Str (" Q := Q + [ "); + Write_Name (Source_File_Name); + + if Index /= 0 then + Write_Str (", "); + Write_Int (Index); + end if; + + Write_Str (" ] "); + Write_Eol; + + Write_Str (" Q_First ="); + Write_Int (Int (Q_First)); + Write_Eol; + + Write_Str (" Q.Last ="); + Write_Int (Int (Q.Last)); + Write_Eol; + end if; + end Insert; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty return Boolean is + begin + if Debug.Debug_Flag_P then + Write_Str (" Q := ["); + + for J in Q_First .. Q.Last loop + if not Q.Table (J).Processed then + Write_Str (" "); + Write_Name (Q.Table (J).File); + Write_Eol; + Write_Str (" "); + end if; + end loop; + + Write_Str ("]"); + Write_Eol; + end if; + + return Q_First > Q.Last; + end Is_Empty; + + ------------------------ + -- Is_Virtually_Empty -- + ------------------------ + + function Is_Virtually_Empty return Boolean is + begin + if One_Queue_Per_Obj_Dir then + for J in Q_First .. Q.Last loop + if not Q.Table (J).Processed + and then + (Q.Table (J).Project = No_Project + or else not + Busy_Obj_Dirs.Get + (Q.Table (J).Project.Object_Directory.Name)) + then + return False; + end if; + end loop; + + return True; + + else + return Is_Empty; + end if; + end Is_Virtually_Empty; + + --------------- + -- Processed -- + --------------- + + function Processed return Natural is + begin + return Q_Processed; + end Processed; + + ---------------------- + -- Set_Obj_Dir_Busy -- + ---------------------- + + procedure Set_Obj_Dir_Busy (Obj_Dir : Path_Name_Type) is + begin + if One_Queue_Per_Obj_Dir then + Busy_Obj_Dirs.Set (Obj_Dir, True); + end if; + end Set_Obj_Dir_Busy; + + ---------------------- + -- Set_Obj_Dir_Free -- + ---------------------- + + procedure Set_Obj_Dir_Free (Obj_Dir : Path_Name_Type) is + begin + if One_Queue_Per_Obj_Dir then + Busy_Obj_Dirs.Set (Obj_Dir, False); + end if; + end Set_Obj_Dir_Free; + + ---------- + -- Size -- + ---------- + + function Size return Natural is + begin + return Q.Last; + end Size; + + end Queue; + ----------------------------- -- Recursive_Compute_Depth -- ----------------------------- *************** package body Make is *** 7897,7908 **** --- 8080,8110 ---- end; end if; + elsif Argv'Length > Source_Info_Option'Length and then + Argv (1 .. Source_Info_Option'Length) = Source_Info_Option + then + Project_Tree.Source_Info_File_Name := + new String'(Argv (Source_Info_Option'Length + 1 .. Argv'Last)); + elsif Argv'Length >= 8 and then Argv (1 .. 8) = "--param=" then Add_Switch (Argv, Compiler, And_Save => And_Save); Add_Switch (Argv, Linker, And_Save => And_Save); + elsif Argv = Create_Map_File_Switch then + Map_File := new String'(""); + + elsif Argv'Length > Create_Map_File_Switch'Length + 1 + and then + Argv (1 .. Create_Map_File_Switch'Length) = Create_Map_File_Switch + and then + Argv (Create_Map_File_Switch'Length + 1) = '=' + then + Map_File := + new String' + (Argv (Create_Map_File_Switch'Length + 2 .. Argv'Last)); + else Scan_Make_Switches (Project_Node_Tree, Argv, Success); end if; *************** package body Make is *** 7994,8005 **** elsif Argv (2) = 'L' then Add_Switch (Argv, Linker, And_Save => And_Save); ! -- For -gxxxxx, -pg, -mxxx, -fxxx: give the switch to both the -- compiler and the linker (except for -gnatxxx which is only for the -- compiler). Some of the -mxxx (for example -m64) and -fxxx (for -- example -ftest-coverage for gcov) need to be used when compiling -- the binder generated files, and using all these gcc switches for ! -- the binder generated files should not be a problem. elsif (Argv (2) = 'g' and then (Argv'Last < 5 --- 8196,8207 ---- elsif Argv (2) = 'L' then Add_Switch (Argv, Linker, And_Save => And_Save); ! -- For -gxxx, -pg, -mxxx, -fxxx, -Oxxx, pass the switch to both the -- compiler and the linker (except for -gnatxxx which is only for the -- compiler). Some of the -mxxx (for example -m64) and -fxxx (for -- example -ftest-coverage for gcov) need to be used when compiling -- the binder generated files, and using all these gcc switches for ! -- them should not be a problem. Pass -Oxxx to the linker for LTO. elsif (Argv (2) = 'g' and then (Argv'Last < 5 *************** package body Make is *** 8007,8012 **** --- 8209,8215 ---- or else Argv (2 .. Argv'Last) = "pg" or else (Argv (2) = 'm' and then Argv'Last > 2) or else (Argv (2) = 'f' and then Argv'Last > 2) + or else Argv (2) = 'O' then Add_Switch (Argv, Compiler, And_Save => And_Save); Add_Switch (Argv, Linker, And_Save => And_Save); *************** package body Make is *** 8174,8186 **** elsif Argv (2 .. Argv'Last) = "nostdlib" then ! -- Don't pass -nostdlib to gnatlink, it will disable ! -- linking with all standard library files. No_Stdlib := True; - - Add_Switch (Argv, Compiler, And_Save => And_Save); Add_Switch (Argv, Binder, And_Save => And_Save); elsif Argv (2 .. Argv'Last) = "nostdinc" then --- 8377,8387 ---- elsif Argv (2 .. Argv'Last) = "nostdlib" then ! -- Pass -nstdlib to gnatbind and gnatlink No_Stdlib := True; Add_Switch (Argv, Binder, And_Save => And_Save); + Add_Switch (Argv, Linker, And_Save => And_Save); elsif Argv (2 .. Argv'Last) = "nostdinc" then *************** package body Make is *** 8206,8211 **** --- 8407,8416 ---- -- If not a switch it must be a file name else + if And_Save then + Main_On_Command_Line := True; + end if; + Add_File (Argv); Mains.Add_Main (Argv); end if; *************** package body Make is *** 8248,8257 **** Switches := Prj.Util.Value_Of ! (Index => Name_Id (Source_File), ! Src_Index => Source_Index, ! In_Array => Switches_Array, ! In_Tree => Project_Tree); -- Check also without the suffix --- 8453,8463 ---- Switches := Prj.Util.Value_Of ! (Index => Name_Id (Source_File), ! Src_Index => Source_Index, ! In_Array => Switches_Array, ! In_Tree => Project_Tree, ! Allow_Wildcards => True); -- Check also without the suffix *************** package body Make is *** 8262,8274 **** Naming : Lang_Naming_Data renames Lang.Config.Naming_Data; Name : String (1 .. Source_File_Name'Length + 3); Last : Positive := Source_File_Name'Length; ! Spec_Suffix : constant String := ! Get_Name_String (Naming.Spec_Suffix); ! Body_Suffix : constant String := ! Get_Name_String (Naming.Body_Suffix); ! Truncated : Boolean := False; begin Name (1 .. Last) := Source_File_Name; if Last > Body_Suffix'Length --- 8468,8480 ---- Naming : Lang_Naming_Data renames Lang.Config.Naming_Data; Name : String (1 .. Source_File_Name'Length + 3); Last : Positive := Source_File_Name'Length; ! Spec_Suffix : String := Get_Name_String (Naming.Spec_Suffix); ! Body_Suffix : String := Get_Name_String (Naming.Body_Suffix); ! Truncated : Boolean := False; begin + Canonical_Case_File_Name (Spec_Suffix); + Canonical_Case_File_Name (Body_Suffix); Name (1 .. Last) := Source_File_Name; if Last > Body_Suffix'Length *************** package body Make is *** 8293,8302 **** Add_Str_To_Name_Buffer (Name (1 .. Last)); Switches := Prj.Util.Value_Of ! (Index => Name_Find, ! Src_Index => 0, ! In_Array => Switches_Array, ! In_Tree => Project_Tree); if Switches = Nil_Variable_Value and then Allow_ALI then Last := Source_File_Name'Length; --- 8499,8509 ---- Add_Str_To_Name_Buffer (Name (1 .. Last)); Switches := Prj.Util.Value_Of ! (Index => Name_Find, ! Src_Index => 0, ! In_Array => Switches_Array, ! In_Tree => Project_Tree, ! Allow_Wildcards => True); if Switches = Nil_Variable_Value and then Allow_ALI then Last := Source_File_Name'Length; diff -Nrcpad gcc-4.5.2/gcc/ada/makeusg.adb gcc-4.6.0/gcc/ada/makeusg.adb *** gcc-4.5.2/gcc/ada/makeusg.adb Tue Apr 8 06:48:54 2008 --- gcc-4.6.0/gcc/ada/makeusg.adb Tue Oct 26 10:42:02 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,30 **** -- -- ------------------------------------------------------------------------------ ! with Osint; use Osint; ! with Output; use Output; with Usage; procedure Makeusg is --- 23,31 ---- -- -- ------------------------------------------------------------------------------ ! with Makeutl; ! with Osint; use Osint; ! with Output; use Output; with Usage; procedure Makeusg is *************** begin *** 195,200 **** --- 196,216 ---- Write_Str (" -v Display reasons for all (re)compilations"); Write_Eol; + -- Line for -vl + + Write_Str (" -vl Verbose output (low verbosity)"); + Write_Eol; + + -- Line for -vm + + Write_Str (" -vm Verbose output (medium verbosity)"); + Write_Eol; + + -- Line for -vh + + Write_Str (" -vh Equivalent to -v (high verbosity)"); + Write_Eol; + -- Line for -vPx Write_Str (" -vPx Specify verbosity when parsing GNAT Project Files"); *************** begin *** 311,316 **** --- 327,347 ---- Write_Str (" --subdirs=dir real obj/lib/exec dirs are subdirs"); Write_Eol; + + -- Line for --source-info= + + Write_Str (" "); + Write_Str (Makeutl.Source_Info_Option); + Write_Str ("file specify a source info file"); + Write_Eol; + + -- Line for --unchecked-shared-lib-imports + + Write_Str (" "); + Write_Str (Makeutl.Unchecked_Shared_Lib_Imports); + Write_Eol; + Write_Str (" Allow shared libraries to import static libraries"); + Write_Eol; Write_Eol; -- General Compiler, Binder, Linker switches diff -Nrcpad gcc-4.5.2/gcc/ada/makeutl.adb gcc-4.6.0/gcc/ada/makeutl.adb *** gcc-4.5.2/gcc/ada/makeutl.adb Mon Nov 30 15:10:58 2009 --- gcc-4.6.0/gcc/ada/makeutl.adb Thu Oct 7 09:26:27 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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,31 **** --- 26,32 ---- with ALI; use ALI; with Debug; with Fname; + with Hostparm; with Osint; use Osint; with Output; use Output; with Opt; use Opt; *************** with Prj.Ext; *** 33,45 **** 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; package body Makeutl is --- 34,46 ---- with Prj.Util; with Snames; use Snames; with Table; + with Tempdir; with Ada.Command_Line; use Ada.Command_Line; + with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Directory_Operations; use GNAT.Directory_Operations; ! with GNAT.HTable; package body Makeutl is *************** package body Makeutl is *** 58,64 **** function Hash (Key : Mark_Key) return Mark_Num; ! package Marks is new System.HTable.Simple_HTable (Header_Num => Mark_Num, Element => Boolean, No_Element => False, --- 59,65 ---- function Hash (Key : Mark_Key) return Mark_Num; ! package Marks is new GNAT.HTable.Simple_HTable (Header_Num => Mark_Num, Element => Boolean, No_Element => False, *************** package body Makeutl is *** 202,208 **** -- Check_Source_Info_In_ALI -- ------------------------------ ! function Check_Source_Info_In_ALI (The_ALI : ALI_Id) return Boolean is Unit_Name : Name_Id; begin --- 203,212 ---- -- Check_Source_Info_In_ALI -- ------------------------------ ! function Check_Source_Info_In_ALI ! (The_ALI : ALI_Id; ! Tree : Project_Tree_Ref) return Boolean ! is Unit_Name : Name_Id; begin *************** package body Makeutl is *** 241,247 **** end loop; end loop; ! -- Loop to check subunits for D in ALIs.Table (The_ALI).First_Sdep .. ALIs.Table (The_ALI).Last_Sdep --- 245,251 ---- end loop; end loop; ! -- Loop to check subunits and replaced sources for D in ALIs.Table (The_ALI).First_Sdep .. ALIs.Table (The_ALI).Last_Sdep *************** package body Makeutl is *** 252,259 **** begin Unit_Name := SD.Subunit_Name; ! if Unit_Name /= No_Name then -- For separates, the file is no longer associated with the -- unit ("proc-sep.adb" is not associated with unit "proc.sep") -- so we need to check whether the source file still exists in --- 256,287 ---- begin Unit_Name := SD.Subunit_Name; ! if Unit_Name = No_Name then ! -- Check if this source file has been replaced by a source with ! -- a different file name. + if Tree /= null and then Tree.Replaced_Source_Number > 0 then + declare + Replacement : constant File_Name_Type := + Replaced_Source_HTable.Get + (Tree.Replaced_Sources, SD.Sfile); + + begin + if Replacement /= No_File then + if Verbose_Mode then + Write_Line + ("source file" & + Get_Name_String (SD.Sfile) & + " has been replaced by " & + Get_Name_String (Replacement)); + end if; + + return False; + end if; + end; + end if; + + else -- For separates, the file is no longer associated with the -- unit ("proc-sep.adb" is not associated with unit "proc.sep") -- so we need to check whether the source file still exists in *************** package body Makeutl is *** 294,299 **** --- 322,504 ---- return True; end Check_Source_Info_In_ALI; + -------------------------------- + -- Create_Binder_Mapping_File -- + -------------------------------- + + function Create_Binder_Mapping_File return Path_Name_Type is + Mapping_Path : Path_Name_Type := No_Path; + + Mapping_FD : File_Descriptor := Invalid_FD; + -- A File Descriptor for an eventual mapping file + + ALI_Unit : Unit_Name_Type := No_Unit_Name; + -- The unit name of an ALI file + + ALI_Name : File_Name_Type := No_File; + -- The file name of the ALI file + + ALI_Project : Project_Id := No_Project; + -- The project of the ALI file + + Bytes : Integer; + OK : Boolean := False; + Unit : Unit_Index; + + Status : Boolean; + -- For call to Close + + begin + Tempdir.Create_Temp_File (Mapping_FD, Mapping_Path); + Record_Temp_File (Project_Tree, Mapping_Path); + + if Mapping_FD /= Invalid_FD then + OK := True; + + -- Traverse all units + + Unit := Units_Htable.Get_First (Project_Tree.Units_HT); + while Unit /= No_Unit_Index loop + if Unit.Name /= No_Name then + + -- If there is a body, put it in the mapping + + if Unit.File_Names (Impl) /= No_Source + and then Unit.File_Names (Impl).Project /= No_Project + then + Get_Name_String (Unit.Name); + Add_Str_To_Name_Buffer ("%b"); + ALI_Unit := Name_Find; + ALI_Name := + Lib_File_Name (Unit.File_Names (Impl).Display_File); + ALI_Project := Unit.File_Names (Impl).Project; + + -- Otherwise, if there is a spec, put it in the mapping + + elsif Unit.File_Names (Spec) /= No_Source + and then Unit.File_Names (Spec).Project /= No_Project + then + Get_Name_String (Unit.Name); + Add_Str_To_Name_Buffer ("%s"); + ALI_Unit := Name_Find; + ALI_Name := + Lib_File_Name (Unit.File_Names (Spec).Display_File); + ALI_Project := Unit.File_Names (Spec).Project; + + else + ALI_Name := No_File; + end if; + + -- If we have something to put in the mapping then do it now. + -- However, if the project is extended, we don't put anything + -- in the mapping file, since we don't know where the ALI file + -- is: it might be in the extended project object directory as + -- well as in the extending project object directory. + + if ALI_Name /= No_File + and then ALI_Project.Extended_By = No_Project + and then ALI_Project.Extends = No_Project + then + -- First check if the ALI file exists. If it does not, do + -- not put the unit in the mapping file. + + declare + ALI : constant String := Get_Name_String (ALI_Name); + + begin + -- For library projects, use the library ALI directory, + -- for other projects, use the object directory. + + if ALI_Project.Library then + Get_Name_String + (ALI_Project.Library_ALI_Dir.Display_Name); + else + Get_Name_String + (ALI_Project.Object_Directory.Display_Name); + end if; + + if not + Is_Directory_Separator (Name_Buffer (Name_Len)) + then + Add_Char_To_Name_Buffer (Directory_Separator); + end if; + + Add_Str_To_Name_Buffer (ALI); + Add_Char_To_Name_Buffer (ASCII.LF); + + declare + ALI_Path_Name : constant String := + Name_Buffer (1 .. Name_Len); + + begin + if Is_Regular_File + (ALI_Path_Name (1 .. ALI_Path_Name'Last - 1)) + then + -- First line is the unit name + + Get_Name_String (ALI_Unit); + Add_Char_To_Name_Buffer (ASCII.LF); + Bytes := + Write + (Mapping_FD, + Name_Buffer (1)'Address, + Name_Len); + OK := Bytes = Name_Len; + + exit when not OK; + + -- Second line it the ALI file name + + Get_Name_String (ALI_Name); + Add_Char_To_Name_Buffer (ASCII.LF); + Bytes := + Write + (Mapping_FD, + Name_Buffer (1)'Address, + Name_Len); + OK := (Bytes = Name_Len); + + exit when not OK; + + -- Third line it the ALI path name + + Bytes := + Write + (Mapping_FD, + ALI_Path_Name (1)'Address, + ALI_Path_Name'Length); + OK := (Bytes = ALI_Path_Name'Length); + + -- If OK is False, it means we were unable to + -- write a line. No point in continuing with the + -- other units. + + exit when not OK; + end if; + end; + end; + end if; + end if; + + Unit := Units_Htable.Get_Next (Project_Tree.Units_HT); + end loop; + + Close (Mapping_FD, Status); + + OK := OK and Status; + end if; + + -- If the creation of the mapping file was successful, we add the switch + -- to the arguments of gnatbind. + + if OK then + return Mapping_Path; + + else + return No_Path; + end if; + end Create_Binder_Mapping_File; + ----------------- -- Create_Name -- ----------------- *************** package body Makeutl is *** 378,383 **** --- 583,594 ---- -- Beginning of Executable_Prefix_Path begin + -- For VMS, the path returned is always /gnu/ + + if Hostparm.OpenVMS then + return "/gnu/"; + end if; + -- First determine if a path prefix was placed in front of the -- executable name. diff -Nrcpad gcc-4.5.2/gcc/ada/makeutl.ads gcc-4.6.0/gcc/ada/makeutl.ads *** gcc-4.5.2/gcc/ada/makeutl.ads Mon Nov 30 11:02:59 2009 --- gcc-4.6.0/gcc/ada/makeutl.ads Thu Oct 7 09:26:27 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package Makeutl is *** 43,52 **** --- 43,68 ---- Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data; -- The project tree + Source_Info_Option : constant String := "--source-info="; + -- Switch to indicate the source info file + Subdirs_Option : constant String := "--subdirs="; -- Switch used to indicate that the real directories (object, exec, -- library, ...) are subdirectories of those in the project file. + Unchecked_Shared_Lib_Imports : constant String := + "--unchecked-shared-lib-imports"; + -- Command line switch to allow shared library projects to import projects + -- that are not shared library projects. + + Single_Compile_Per_Obj_Dir_Switch : constant String := + "--single-compile-per-obj-dir"; + -- Switch to forbid simultaneous compilations for the same object directory + -- when project files are used. + + Create_Map_File_Switch : constant String := "--create-map-file"; + -- Switch to create a map file when an executable is linked + procedure Add (Option : String_Access; To : in out String_List_Access; *************** package Makeutl is *** 57,62 **** --- 73,81 ---- Last : in out Natural); -- Add a string to a list of strings + function Create_Binder_Mapping_File return Path_Name_Type; + -- Create a binder mapping file and returns its path name + function Create_Name (Name : String) return File_Name_Type; function Create_Name (Name : String) return Name_Id; function Create_Name (Name : String) return Path_Name_Type; *************** package Makeutl is *** 86,92 **** -- True if the unit is in one of the project file, but the file name is not -- one of its source. Returns False otherwise. ! function Check_Source_Info_In_ALI (The_ALI : ALI.ALI_Id) return Boolean; -- Check whether all file references in ALI are still valid (i.e. the -- source files are still associated with the same units). Return True -- if everything is still valid. --- 105,113 ---- -- True if the unit is in one of the project file, but the file name is not -- one of its source. Returns False otherwise. ! function Check_Source_Info_In_ALI ! (The_ALI : ALI.ALI_Id; ! Tree : Project_Tree_Ref) return Boolean; -- Check whether all file references in ALI are still valid (i.e. the -- source files are still associated with the same units). Return True -- if everything is still valid. diff -Nrcpad gcc-4.5.2/gcc/ada/memroot.adb gcc-4.6.0/gcc/ada/memroot.adb *** gcc-4.5.2/gcc/ada/memroot.adb Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/memroot.adb Thu Jan 1 00:00:00 1970 *************** *** 1,615 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- M E M R O O T -- - -- -- - -- B o d y -- - -- -- - -- 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- -- - -- 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. -- - -- -- - ------------------------------------------------------------------------------ - - with GNAT.Table; - with GNAT.HTable; use GNAT.HTable; - with Ada.Text_IO; use Ada.Text_IO; - - package body Memroot is - - Main_Name_Id : Name_Id; - -- The constant "main" where we should stop the backtraces - - ------------- - -- Name_Id -- - ------------- - - package Chars is new GNAT.Table ( - Table_Component_Type => Character, - Table_Index_Type => Integer, - Table_Low_Bound => 1, - Table_Initial => 10_000, - Table_Increment => 100); - -- The actual character container for names - - type Name is record - First, Last : Integer; - end record; - - package Names is new GNAT.Table ( - Table_Component_Type => Name, - Table_Index_Type => Name_Id, - Table_Low_Bound => 0, - Table_Initial => 400, - Table_Increment => 100); - - type Name_Range is range 1 .. 1023; - - function Name_Eq (N1, N2 : Name) return Boolean; - -- compare 2 names - - function H (N : Name) return Name_Range; - - package Name_HTable is new GNAT.HTable.Simple_HTable ( - Header_Num => Name_Range, - Element => Name_Id, - No_Element => No_Name_Id, - Key => Name, - Hash => H, - Equal => Name_Eq); - - -------------- - -- Frame_Id -- - -------------- - - type Frame is record - Name, File, Line : Name_Id; - end record; - - function Image - (F : Frame_Id; - Max_Fil : Integer; - Max_Lin : Integer; - Short : Boolean := False) return String; - -- Returns an image for F containing the file name, the Line number, - -- and if 'Short' is not true, the subprogram name. When possible, spaces - -- are inserted between the line number and the subprogram name in order - -- to align images of the same frame. Alignment is computed with Max_Fil - -- & Max_Lin representing the max number of character in a filename or - -- length in a given frame. - - package Frames is new GNAT.Table ( - Table_Component_Type => Frame, - Table_Index_Type => Frame_Id, - Table_Low_Bound => 1, - Table_Initial => 400, - Table_Increment => 100); - - type Frame_Range is range 1 .. 10000; - function H (N : Integer_Address) return Frame_Range; - - package Frame_HTable is new GNAT.HTable.Simple_HTable ( - Header_Num => Frame_Range, - Element => Frame_Id, - No_Element => No_Frame_Id, - Key => Integer_Address, - Hash => H, - Equal => "="); - - ------------- - -- Root_Id -- - ------------- - - type Root is record - First, Last : Integer; - Nb_Alloc : Integer; - Alloc_Size : Storage_Count; - High_Water_Mark : Storage_Count; - end record; - - package Frames_In_Root is new GNAT.Table ( - Table_Component_Type => Frame_Id, - Table_Index_Type => Integer, - Table_Low_Bound => 1, - Table_Initial => 400, - Table_Increment => 100); - - package Roots is new GNAT.Table ( - Table_Component_Type => Root, - Table_Index_Type => Root_Id, - Table_Low_Bound => 1, - Table_Initial => 200, - Table_Increment => 100); - type Root_Range is range 1 .. 513; - - function Root_Eq (N1, N2 : Root) return Boolean; - function H (B : Root) return Root_Range; - - package Root_HTable is new GNAT.HTable.Simple_HTable ( - Header_Num => Root_Range, - Element => Root_Id, - No_Element => No_Root_Id, - Key => Root, - Hash => H, - Equal => Root_Eq); - - ---------------- - -- Alloc_Size -- - ---------------- - - function Alloc_Size (B : Root_Id) return Storage_Count is - begin - return Roots.Table (B).Alloc_Size; - end Alloc_Size; - - ----------------- - -- Enter_Frame -- - ----------------- - - function Enter_Frame - (Addr : System.Address; - Name : Name_Id; - File : Name_Id; - Line : Name_Id) - return Frame_Id - is - begin - Frames.Increment_Last; - Frames.Table (Frames.Last) := Frame'(Name, File, Line); - - Frame_HTable.Set (To_Integer (Addr), Frames.Last); - return Frames.Last; - end Enter_Frame; - - ---------------- - -- Enter_Name -- - ---------------- - - function Enter_Name (S : String) return Name_Id is - Old_L : constant Integer := Chars.Last; - Len : constant Integer := S'Length; - F : constant Integer := Chars.Allocate (Len); - Res : Name_Id; - - begin - Chars.Table (F .. F + Len - 1) := Chars.Table_Type (S); - Names.Increment_Last; - Names.Table (Names.Last) := Name'(F, F + Len - 1); - Res := Name_HTable.Get (Names.Table (Names.Last)); - - if Res /= No_Name_Id then - Names.Decrement_Last; - Chars.Set_Last (Old_L); - return Res; - - else - Name_HTable.Set (Names.Table (Names.Last), Names.Last); - return Names.Last; - end if; - end Enter_Name; - - ---------------- - -- Enter_Root -- - ---------------- - - function Enter_Root (Fr : Frame_Array) return Root_Id is - Old_L : constant Integer := Frames_In_Root.Last; - Len : constant Integer := Fr'Length; - F : constant Integer := Frames_In_Root.Allocate (Len); - Res : Root_Id; - - begin - Frames_In_Root.Table (F .. F + Len - 1) := - Frames_In_Root.Table_Type (Fr); - Roots.Increment_Last; - Roots.Table (Roots.Last) := Root'(F, F + Len - 1, 0, 0, 0); - Res := Root_HTable.Get (Roots.Table (Roots.Last)); - - if Res /= No_Root_Id then - Frames_In_Root.Set_Last (Old_L); - Roots.Decrement_Last; - return Res; - - else - Root_HTable.Set (Roots.Table (Roots.Last), Roots.Last); - return Roots.Last; - end if; - end Enter_Root; - - --------------- - -- Frames_Of -- - --------------- - - function Frames_Of (B : Root_Id) return Frame_Array is - begin - return Frame_Array ( - Frames_In_Root.Table (Roots.Table (B).First .. Roots.Table (B).Last)); - end Frames_Of; - - --------------- - -- Get_First -- - --------------- - - function Get_First return Root_Id is - begin - return Root_HTable.Get_First; - end Get_First; - - -------------- - -- Get_Next -- - -------------- - - function Get_Next return Root_Id is - begin - return Root_HTable.Get_Next; - end Get_Next; - - ------- - -- H -- - ------- - - function H (B : Root) return Root_Range is - - type Uns is mod 2 ** 32; - - function Rotate_Left (Value : Uns; Amount : Natural) return Uns; - pragma Import (Intrinsic, Rotate_Left); - - Tmp : Uns := 0; - - begin - for J in B.First .. B.Last loop - Tmp := Rotate_Left (Tmp, 1) + Uns (Frames_In_Root.Table (J)); - end loop; - - return Root_Range'First - + Root_Range'Base (Tmp mod Root_Range'Range_Length); - end H; - - function H (N : Name) return Name_Range is - function H is new Hash (Name_Range); - - begin - return H (String (Chars.Table (N.First .. N.Last))); - end H; - - function H (N : Integer_Address) return Frame_Range is - begin - return Frame_Range (1 + N mod Frame_Range'Range_Length); - end H; - - --------------------- - -- High_Water_Mark -- - --------------------- - - function High_Water_Mark (B : Root_Id) return Storage_Count is - begin - return Roots.Table (B).High_Water_Mark; - end High_Water_Mark; - - ----------- - -- Image -- - ----------- - - function Image (N : Name_Id) return String is - Nam : Name renames Names.Table (N); - - begin - return String (Chars.Table (Nam.First .. Nam.Last)); - end Image; - - function Image - (F : Frame_Id; - Max_Fil : Integer; - Max_Lin : Integer; - Short : Boolean := False) return String - is - Fram : Frame renames Frames.Table (F); - Fil : Name renames Names.Table (Fram.File); - Lin : Name renames Names.Table (Fram.Line); - Nam : Name renames Names.Table (Fram.Name); - - Fil_Len : constant Integer := Fil.Last - Fil.First + 1; - Lin_Len : constant Integer := Lin.Last - Lin.First + 1; - - use type Chars.Table_Type; - - Spaces : constant String (1 .. 80) := (1 .. 80 => ' '); - - Result : constant String := - String (Chars.Table (Fil.First .. Fil.Last)) - & ':' - & String (Chars.Table (Lin.First .. Lin.Last)); - begin - if Short then - return Result; - else - return Result - & Spaces (1 .. 1 + Max_Fil - Fil_Len + Max_Lin - Lin_Len) - & String (Chars.Table (Nam.First .. Nam.Last)); - end if; - end Image; - - ------------- - -- Name_Eq -- - ------------- - - function Name_Eq (N1, N2 : Name) return Boolean is - use type Chars.Table_Type; - begin - return - Chars.Table (N1.First .. N1.Last) = Chars.Table (N2.First .. N2.Last); - end Name_Eq; - - -------------- - -- Nb_Alloc -- - -------------- - - function Nb_Alloc (B : Root_Id) return Integer is - begin - return Roots.Table (B).Nb_Alloc; - end Nb_Alloc; - - -------------- - -- Print_BT -- - -------------- - - procedure Print_BT (B : Root_Id; Short : Boolean := False) is - Max_Col_Width : constant := 35; - -- Largest filename length for which backtraces will be - -- properly aligned. Frames containing longer names won't be - -- truncated but they won't be properly aligned either. - - F : constant Frame_Array := Frames_Of (B); - - Max_Fil : Integer; - Max_Lin : Integer; - - begin - Max_Fil := 0; - Max_Lin := 0; - - for J in F'Range loop - declare - Fram : Frame renames Frames.Table (F (J)); - Fil : Name renames Names.Table (Fram.File); - Lin : Name renames Names.Table (Fram.Line); - - begin - Max_Fil := Integer'Max (Max_Fil, Fil.Last - Fil.First + 1); - Max_Lin := Integer'Max (Max_Lin, Lin.Last - Lin.First + 1); - end; - end loop; - - Max_Fil := Integer'Min (Max_Fil, Max_Col_Width); - - for J in F'Range loop - Put (" "); - Put_Line (Image (F (J), Max_Fil, Max_Lin, Short)); - end loop; - end Print_BT; - - ------------- - -- Read_BT -- - ------------- - - function Read_BT (BT_Depth : Integer) return Root_Id is - Max_Line : constant Integer := 500; - Curs1 : Integer; - Curs2 : Integer; - Line : String (1 .. Max_Line); - Last : Integer := 0; - Frames : Frame_Array (1 .. BT_Depth); - F : Integer := Frames'First; - Nam : Name_Id; - Fil : Name_Id; - Lin : Name_Id; - Add : System.Address; - Int_Add : Integer_Address; - Fr : Frame_Id; - Main_Found : Boolean := False; - pragma Warnings (Off, Line); - - procedure Find_File; - pragma Inline (Find_File); - -- Position Curs1 and Curs2 so that Line (Curs1 .. Curs2) contains - -- the file name. The file name may not be on the current line since - -- a frame may be printed on more than one line when there is a lot - -- of parameters or names are long, so this subprogram can read new - -- lines of input. - - procedure Find_Line; - pragma Inline (Find_Line); - -- Position Curs1 and Curs2 so that Line (Curs1 .. Curs2) contains - -- the line number. - - procedure Find_Name; - pragma Inline (Find_Name); - -- Position Curs1 and Curs2 so that Line (Curs1 .. Curs2) contains - -- the subprogram name. - - function Skip_To_Space (Pos : Integer) return Integer; - pragma Inline (Skip_To_Space); - -- Scans Line starting with position Pos, returning the position - -- immediately before the first space, or the value of Last if no - -- spaces were found - - --------------- - -- Find_File -- - --------------- - - procedure Find_File is - begin - -- Skip " at " - - Curs1 := Curs2 + 5; - Curs2 := Last; - - -- Scan backwards from end of line until ':' is encountered - - for J in reverse Curs1 .. Last loop - if Line (J) = ':' then - Curs2 := J - 1; - end if; - end loop; - end Find_File; - - --------------- - -- Find_Line -- - --------------- - - procedure Find_Line is - begin - Curs1 := Curs2 + 2; - Curs2 := Last; - - -- Check for Curs1 too large. Should never happen with non-corrupt - -- output. If it does happen, just reset it to the highest value. - - if Curs1 > Last then - Curs1 := Last; - end if; - end Find_Line; - - --------------- - -- Find_Name -- - --------------- - - procedure Find_Name is - begin - -- Skip the address value and " in " - - Curs1 := Skip_To_Space (1) + 5; - Curs2 := Skip_To_Space (Curs1); - end Find_Name; - - ------------------- - -- Skip_To_Space -- - ------------------- - - function Skip_To_Space (Pos : Integer) return Integer is - begin - for Cur in Pos .. Last loop - if Line (Cur) = ' ' then - return Cur - 1; - end if; - end loop; - - return Last; - end Skip_To_Space; - - procedure Gmem_Read_Next_Frame (Addr : out System.Address); - pragma Import (C, Gmem_Read_Next_Frame, "__gnat_gmem_read_next_frame"); - -- Read the next frame in the current traceback. Addr is set to 0 if - -- there are no more addresses in this traceback. The pointer is moved - -- to the next frame. - - procedure Gmem_Symbolic - (Addr : System.Address; Buf : String; Last : out Natural); - pragma Import (C, Gmem_Symbolic, "__gnat_gmem_symbolic"); - -- Get the symbolic traceback for Addr. Note: we cannot use - -- GNAT.Tracebacks.Symbolic, since the latter will only work with the - -- current executable. - -- - -- "__gnat_gmem_symbolic" will work with the executable whose name is - -- given in gnat_argv[0], as initialized by Gnatmem.Gmem_A21_Initialize. - - -- Start of processing for Read_BT - - begin - while F <= BT_Depth and then not Main_Found loop - Gmem_Read_Next_Frame (Add); - Int_Add := To_Integer (Add); - exit when Int_Add = 0; - - Fr := Frame_HTable.Get (Int_Add); - - if Fr = No_Frame_Id then - Gmem_Symbolic (Add, Line, Last); - Last := Last - 1; -- get rid of the trailing line-feed - Find_Name; - - -- Skip the __gnat_malloc frame itself - - if Line (Curs1 .. Curs2) /= "<__gnat_malloc>" then - Nam := Enter_Name (Line (Curs1 .. Curs2)); - Main_Found := (Nam = Main_Name_Id); - - Find_File; - Fil := Enter_Name (Line (Curs1 .. Curs2)); - Find_Line; - Lin := Enter_Name (Line (Curs1 .. Curs2)); - - Frames (F) := Enter_Frame (Add, Nam, Fil, Lin); - F := F + 1; - end if; - - else - Frames (F) := Fr; - Main_Found := (Memroot.Frames.Table (Fr).Name = Main_Name_Id); - F := F + 1; - end if; - end loop; - - return Enter_Root (Frames (1 .. F - 1)); - end Read_BT; - - ------------- - -- Root_Eq -- - ------------- - - function Root_Eq (N1, N2 : Root) return Boolean is - use type Frames_In_Root.Table_Type; - - begin - return - Frames_In_Root.Table (N1.First .. N1.Last) - = Frames_In_Root.Table (N2.First .. N2.Last); - end Root_Eq; - - -------------------- - -- Set_Alloc_Size -- - -------------------- - - procedure Set_Alloc_Size (B : Root_Id; V : Storage_Count) is - begin - Roots.Table (B).Alloc_Size := V; - end Set_Alloc_Size; - - ------------------------- - -- Set_High_Water_Mark -- - ------------------------- - - procedure Set_High_Water_Mark (B : Root_Id; V : Storage_Count) is - begin - Roots.Table (B).High_Water_Mark := V; - end Set_High_Water_Mark; - - ------------------ - -- Set_Nb_Alloc -- - ------------------ - - procedure Set_Nb_Alloc (B : Root_Id; V : Integer) is - begin - Roots.Table (B).Nb_Alloc := V; - end Set_Nb_Alloc; - - begin - -- Initialize name for No_Name_ID - - Names.Increment_Last; - Names.Table (Names.Last) := Name'(1, 0); - Main_Name_Id := Enter_Name ("main"); - end Memroot; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/memroot.ads gcc-4.6.0/gcc/ada/memroot.ads *** gcc-4.5.2/gcc/ada/memroot.ads Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/memroot.ads Thu Jan 1 00:00:00 1970 *************** *** 1,109 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- M E M R O O T -- - -- -- - -- S p e c -- - -- -- - -- 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- -- - -- 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 package offers basic types that deal with gdb backtraces related - -- to memory allocation. A memory root (root_id) is a backtrace - -- referencing the actual point of allocation along with counters - -- recording various information concerning allocation at this root. - - -- A back trace is composed of Frames (Frame_Id) which themselves are - -- nothing else than a subprogram call at a source location which can be - -- represented by three strings: subprogram name, file name and line - -- number. All the needed strings are entered in a table and referenced - -- through a Name_Id in order to avoid duplication. - - with System.Storage_Elements; use System.Storage_Elements; - - package Memroot is - - -- Simple abstract type for names. A name is a sequence of letters - - type Name_Id is new Natural; - No_Name_Id : constant Name_Id := 0; - - function Enter_Name (S : String) return Name_Id; - function Image (N : Name_Id) return String; - - -- Simple abstract type for a backtrace frame. A frame is composed by - -- a subprogram name, a file name and a line reference. - - type Frame_Id is new Natural; - No_Frame_Id : constant Frame_Id := 0; - - function Enter_Frame - (Addr : System.Address; - Name : Name_Id; - File : Name_Id; - Line : Name_Id) - return Frame_Id; - - type Frame_Array is array (Natural range <>) of Frame_Id; - - -- Simple abstract type for an allocation root. It is composed by a set - -- of frames, the number of allocation, the total size of allocated - -- memory, and the high water mark. An iterator is also provided to - -- iterate over all the entered allocation roots. - - type Root_Id is new Natural; - No_Root_Id : constant Root_Id := 0; - - function Read_BT (BT_Depth : Integer) return Root_Id; - -- Reads a backtrace whose maximum frame number is given by - -- BT_Depth and returns the corresponding Allocation root. - - function Enter_Root (Fr : Frame_Array) return Root_Id; - -- Create an allocation root from the frames that compose it - - function Frames_Of (B : Root_Id) return Frame_Array; - -- Retrieves the Frames of the root's backtrace - - procedure Print_BT (B : Root_Id; Short : Boolean := False); - -- Prints on standard out the backtrace associated with the root B - -- When Short is set to True, only the filename & line info is printed. - -- When it is set to false, the subprogram name is also printed. - - function Get_First return Root_Id; - function Get_Next return Root_Id; - -- Iterator to iterate over roots - - procedure Set_Nb_Alloc (B : Root_Id; V : Integer); - function Nb_Alloc (B : Root_Id) return Integer; - -- Access and modify the number of allocation counter associated with - -- this allocation root. If the value is negative, it means that this is - -- not an allocation root but a deallocation root (this can only happen - -- in erroneous situations where there are more frees than allocations). - - procedure Set_Alloc_Size (B : Root_Id; V : Storage_Count); - function Alloc_Size (B : Root_Id) return Storage_Count; - -- Access and modify the total allocated memory counter associated with - -- this allocation root. - - procedure Set_High_Water_Mark (B : Root_Id; V : Storage_Count); - function High_Water_Mark (B : Root_Id) return Storage_Count; - -- Access and modify the high water mark associated with this - -- allocation root. The high water mark is the maximum value, over - -- time, of the Alloc_Size. - - end Memroot; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/mingw32.h gcc-4.6.0/gcc/ada/mingw32.h *** gcc-4.5.2/gcc/ada/mingw32.h Fri Sep 18 14:01:37 2009 --- gcc-4.6.0/gcc/ada/mingw32.h Mon Dec 20 07:26:57 2010 *************** *** 83,89 **** extern UINT CurrentCodePage; ! /* Macros to convert to/from the code page speficied in CurrentCodePage. */ #define S2WSC(wstr,str,len) \ MultiByteToWideChar (CurrentCodePage,0,str,-1,wstr,len) #define WS2SC(str,wstr,len) \ --- 83,89 ---- extern UINT CurrentCodePage; ! /* Macros to convert to/from the code page specified in CurrentCodePage. */ #define S2WSC(wstr,str,len) \ MultiByteToWideChar (CurrentCodePage,0,str,-1,wstr,len) #define WS2SC(str,wstr,len) \ diff -Nrcpad gcc-4.5.2/gcc/ada/mlib-prj.adb gcc-4.6.0/gcc/ada/mlib-prj.adb *** gcc-4.5.2/gcc/ada/mlib-prj.adb Fri Aug 7 09:42:01 2009 --- gcc-4.6.0/gcc/ada/mlib-prj.adb Thu Sep 9 12:46:27 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body MLib.Prj is *** 1374,1385 **** (Object_Dir_Path & Directory_Separator & Filename (1 .. Last)); ! C_Object_Path : String := Object_Path; ! C_Filename : String := Filename (1 .. Last); begin - Canonical_Case_File_Name (C_Object_Path); Canonical_Case_File_Name (C_Filename); -- If in the object directory of an extended --- 1374,1385 ---- (Object_Dir_Path & Directory_Separator & Filename (1 .. Last)); + Object_File : constant String := + Filename (1 .. Last); ! C_Filename : String := Object_File; begin Canonical_Case_File_Name (C_Filename); -- If in the object directory of an extended *************** package body MLib.Prj is *** 1390,1409 **** or else C_Filename (1 .. B_Start'Length) /= B_Start.all then ! Name_Len := Last; ! Name_Buffer (1 .. Name_Len) := ! C_Filename (1 .. Last); Id := Name_Find; if not Objects_Htable.Get (Id) then declare ALI_File : constant String := ! Ext_To ! (C_Filename ! (1 .. Last), "ali"); ALI_Path : constant String := ! Ext_To (C_Object_Path, "ali"); Add_It : Boolean; Fname : File_Name_Type; --- 1390,1406 ---- or else C_Filename (1 .. B_Start'Length) /= B_Start.all then ! Name_Len := 0; ! Add_Str_To_Name_Buffer (C_Filename); Id := Name_Find; if not Objects_Htable.Get (Id) then declare ALI_File : constant String := ! Ext_To (C_Filename, "ali"); ALI_Path : constant String := ! Ext_To (Object_Path, "ali"); Add_It : Boolean; Fname : File_Name_Type; *************** package body MLib.Prj is *** 1801,1807 **** -- the library file and any ALI file of a source of the project. begin ! Get_Name_String (For_Project.Library_Dir.Name); Change_Dir (Name_Buffer (1 .. Name_Len)); exception --- 1798,1804 ---- -- the library file and any ALI file of a source of the project. begin ! Get_Name_String (For_Project.Library_Dir.Display_Name); Change_Dir (Name_Buffer (1 .. Name_Len)); exception *************** package body MLib.Prj is *** 1942,1948 **** Copy_ALI_Files (Files => Ali_Files.all, ! To => For_Project.Library_ALI_Dir.Name, Interfaces => Arguments (1 .. Argument_Number)); -- Copy interface sources if Library_Src_Dir specified --- 1939,1945 ---- Copy_ALI_Files (Files => Ali_Files.all, ! To => For_Project.Library_ALI_Dir.Display_Name, Interfaces => Arguments (1 .. Argument_Number)); -- Copy interface sources if Library_Src_Dir specified *************** package body MLib.Prj is *** 1954,1960 **** -- could be a source of the project. begin ! Get_Name_String (For_Project.Library_Src_Dir.Name); Change_Dir (Name_Buffer (1 .. Name_Len)); exception --- 1951,1957 ---- -- could be a source of the project. begin ! Get_Name_String (For_Project.Library_Src_Dir.Display_Name); Change_Dir (Name_Buffer (1 .. Name_Len)); exception *************** package body MLib.Prj is *** 2085,2091 **** Lib_Name : constant File_Name_Type := Library_File_Name_For (For_Project, In_Tree); begin ! Change_Dir (Get_Name_String (For_Project.Library_Dir.Name)); Lib_TS := File_Stamp (Lib_Name); For_Project.Library_TS := Lib_TS; end; --- 2082,2089 ---- Lib_Name : constant File_Name_Type := Library_File_Name_For (For_Project, In_Tree); begin ! Change_Dir ! (Get_Name_String (For_Project.Library_Dir.Display_Name)); Lib_TS := File_Stamp (Lib_Name); For_Project.Library_TS := Lib_TS; end; *************** package body MLib.Prj is *** 2107,2113 **** -- be Empty_Time_Stamp, earlier than any other time stamp. Change_Dir ! (Get_Name_String (For_Project.Object_Directory.Name)); Open (Dir => Object_Dir, Dir_Name => "."); -- For all entries in the object directory --- 2105,2111 ---- -- be Empty_Time_Stamp, earlier than any other time stamp. Change_Dir ! (Get_Name_String (For_Project.Object_Directory.Display_Name)); Open (Dir => Object_Dir, Dir_Name => "."); -- For all entries in the object directory *************** package body MLib.Prj is *** 2212,2218 **** begin -- Change the working directory to the object directory ! Change_Dir (Get_Name_String (For_Project.Object_Directory.Name)); for Index in Interfaces'Range loop --- 2210,2216 ---- begin -- Change the working directory to the object directory ! Change_Dir (Get_Name_String (For_Project.Object_Directory.Display_Name)); for Index in Interfaces'Range loop *************** package body MLib.Prj is *** 2285,2290 **** --- 2283,2293 ---- for Index in 1 .. Argument_Number loop Write_Char (' '); Write_Str (Arguments (Index).all); + + if not Opt.Verbose_Mode and then Index > 4 then + Write_Str (" ..."); + exit; + end if; end loop; Write_Eol; diff -Nrcpad gcc-4.5.2/gcc/ada/mlib-tgt-specific-mingw.adb gcc-4.6.0/gcc/ada/mlib-tgt-specific-mingw.adb *** gcc-4.5.2/gcc/ada/mlib-tgt-specific-mingw.adb Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/mlib-tgt-specific-mingw.adb Tue Oct 5 09:57:10 2010 *************** *** 7,13 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 7,13 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package body MLib.Tgt.Specific is *** 61,68 **** function PIC_Option return String; ! No_Argument_List : constant String_List := (1 .. 0 => null); ! -- Used as value of parameter Options or Options2 in calls to Gcc --------------------------- -- Build_Dynamic_Library -- --- 61,70 ---- function PIC_Option return String; ! Shared_Libgcc : aliased String := "-shared-libgcc"; ! ! Shared_Libgcc_Switch : constant Argument_List := ! (1 => Shared_Libgcc'Access); --------------------------- -- Build_Dynamic_Library -- *************** package body MLib.Tgt.Specific is *** 99,105 **** Tools.Gcc (Output_File => Lib_File, Objects => Ofiles, ! Options => No_Argument_List, Options_2 => Options, Driver_Name => Driver_Name); end Build_Dynamic_Library; --- 101,107 ---- Tools.Gcc (Output_File => Lib_File, Objects => Ofiles, ! Options => Shared_Libgcc_Switch, Options_2 => Options, Driver_Name => Driver_Name); end Build_Dynamic_Library; diff -Nrcpad gcc-4.5.2/gcc/ada/mlib-tgt.adb gcc-4.6.0/gcc/ada/mlib-tgt.adb *** gcc-4.5.2/gcc/ada/mlib-tgt.adb Wed Apr 29 09:28:07 2009 --- gcc-4.6.0/gcc/ada/mlib-tgt.adb Thu Sep 9 12:46:27 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body MLib.Tgt is *** 343,349 **** else declare Lib_Dir : constant String := ! Get_Name_String (Project.Library_Dir.Name); Lib_Name : constant String := Get_Name_String (Project.Library_Name); --- 343,349 ---- else declare Lib_Dir : constant String := ! Get_Name_String (Project.Library_Dir.Display_Name); Lib_Name : constant String := Get_Name_String (Project.Library_Name); diff -Nrcpad gcc-4.5.2/gcc/ada/mlib-utl.adb gcc-4.6.0/gcc/ada/mlib-utl.adb *** gcc-4.5.2/gcc/ada/mlib-utl.adb Tue Apr 7 15:01:27 2009 --- gcc-4.6.0/gcc/ada/mlib-utl.adb Tue Jun 22 12:32:34 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package body MLib.Utl is *** 460,470 **** end loop; if not Opt.Quiet_Output then ! Write_Str (Driver.all); for J in 1 .. A loop ! Write_Char (' '); ! Write_Str (Arguments (J).all); end loop; -- Do not display all the object files if not in verbose mode, only --- 460,484 ---- end loop; if not Opt.Quiet_Output then ! if Opt.Verbose_Mode then ! Write_Str (Driver.all); ! ! elsif Driver_Name /= No_Name then ! Write_Str (Get_Name_String (Driver_Name)); ! ! else ! Write_Str (Gcc_Name.all); ! end if; for J in 1 .. A loop ! if Opt.Verbose_Mode or else J < 4 then ! Write_Char (' '); ! Write_Str (Arguments (J).all); ! ! else ! Write_Str (" ..."); ! exit; ! end if; end loop; -- Do not display all the object files if not in verbose mode, only *************** package body MLib.Utl is *** 480,489 **** --- 494,512 ---- elsif Position = Second then Write_Str (" ..."); Position := Last; + exit; end if; end loop; for J in Options_2'Range loop + if not Opt.Verbose_Mode then + if Position = Second then + Write_Str (" ..."); + end if; + + exit; + end if; + Write_Char (' '); Write_Str (Options_2 (J).all); end loop; diff -Nrcpad gcc-4.5.2/gcc/ada/namet.adb gcc-4.6.0/gcc/ada/namet.adb *** gcc-4.5.2/gcc/ada/namet.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/namet.adb Tue Oct 26 12:56:43 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Output; use Output; *** 39,44 **** --- 39,46 ---- with Tree_IO; use Tree_IO; with Widechar; use Widechar; + with Interfaces; use Interfaces; + package body Namet is Name_Chars_Reserve : constant := 5000; *************** package body Namet is *** 50,56 **** -- reallocating during this second unlocked phase, we reserve a bit of -- extra space before doing the release call. ! Hash_Num : constant Int := 2**12; -- Number of headers in the hash table. Current hash algorithm is closely -- tailored to this choice, so it can only be changed if a corresponding -- change is made to the hash algorithm. --- 52,58 ---- -- reallocating during this second unlocked phase, we reserve a bit of -- extra space before doing the release call. ! Hash_Num : constant Int := 2**16; -- Number of headers in the hash table. Current hash algorithm is closely -- tailored to this choice, so it can only be changed if a corresponding -- change is made to the hash algorithm. *************** package body Namet is *** 123,133 **** -------------- procedure Finalize is ! Max_Chain_Length : constant := 50; ! -- Max length of chains for which specific information is output ! F : array (Int range 0 .. Max_Chain_Length) of Int; ! -- N'th entry is number of chains of length N Probes : Int := 0; -- Used to compute average number of probes --- 125,136 ---- -------------- procedure Finalize is ! F : array (Int range 0 .. 50) of Int; ! -- N'th entry is the number of chains of length N, except last entry, ! -- which is the number of chains of length F'Last or more. ! Max_Chain_Length : Int := 0; ! -- Maximum length of all chains Probes : Int := 0; -- Used to compute average number of probes *************** package body Namet is *** 135,183 **** Nsyms : Int := 0; -- Number of symbols in table begin ! if Debug_Flag_H then ! for J in F'Range loop ! F (J) := 0; ! end loop; ! for J in Hash_Index_Type loop ! if Hash_Table (J) = No_Name then ! F (0) := F (0) + 1; ! else ! Write_Str ("Hash_Table ("); ! Write_Int (J); ! Write_Str (") has "); ! declare ! C : Int := 1; ! N : Name_Id; ! S : Int; ! begin ! C := 0; ! N := Hash_Table (J); ! while N /= No_Name loop ! N := Name_Entries.Table (N).Hash_Link; ! C := C + 1; ! end loop; Write_Int (C); Write_Str (" entries"); Write_Eol; ! if C < Max_Chain_Length then ! F (C) := F (C) + 1; ! else ! F (Max_Chain_Length) := F (Max_Chain_Length) + 1; ! end if; N := Hash_Table (J); - while N /= No_Name loop S := Name_Entries.Table (N).Name_Chars_Index; Write_Str (" "); for J in 1 .. Name_Entries.Table (N).Name_Len loop --- 138,211 ---- Nsyms : Int := 0; -- Number of symbols in table + Verbosity : constant Int range 1 .. 3 := 1; + pragma Warnings (Off, Verbosity); + -- This constant indicates the level of verbosity in the output from + -- this procedure. Currently this can only be changed by editing the + -- declaration above and recompiling. That's good enough in practice, + -- since we very rarely need to use this debug option. Settings are: + -- + -- 1 => print basic summary information + -- 2 => in addition print number of entries per hash chain + -- 3 => in addition print content of entries + + Zero : constant Int := Character'Pos ('0'); + begin ! if not Debug_Flag_H then ! return; ! end if; ! for J in F'Range loop ! F (J) := 0; ! end loop; ! for J in Hash_Index_Type loop ! if Hash_Table (J) = No_Name then ! F (0) := F (0) + 1; ! else ! declare ! C : Int; ! N : Name_Id; ! S : Int; ! begin ! C := 0; ! N := Hash_Table (J); ! while N /= No_Name loop ! N := Name_Entries.Table (N).Hash_Link; ! C := C + 1; ! end loop; ! ! Nsyms := Nsyms + 1; ! Probes := Probes + (1 + C) * 100; ! ! if C > Max_Chain_Length then ! Max_Chain_Length := C; ! end if; + if Verbosity >= 2 then + Write_Str ("Hash_Table ("); + Write_Int (J); + Write_Str (") has "); Write_Int (C); Write_Str (" entries"); Write_Eol; + end if; ! if C < F'Last then ! F (C) := F (C) + 1; ! else ! F (F'Last) := F (F'Last) + 1; ! end if; + if Verbosity >= 3 then N := Hash_Table (J); while N /= No_Name loop S := Name_Entries.Table (N).Name_Chars_Index; + Write_Str (" "); for J in 1 .. Name_Entries.Table (N).Name_Len loop *************** package body Namet is *** 185,234 **** end loop; Write_Eol; N := Name_Entries.Table (N).Hash_Link; end loop; ! end; ! end if; ! end loop; ! Write_Eol; ! for J in Int range 0 .. Max_Chain_Length loop ! if F (J) /= 0 then ! Write_Str ("Number of hash chains of length "); ! if J < 10 then ! Write_Char (' '); ! end if; ! Write_Int (J); ! if J = Max_Chain_Length then ! Write_Str (" or greater"); ! end if; ! Write_Str (" = "); ! Write_Int (F (J)); ! Write_Eol; ! if J /= 0 then ! Nsyms := Nsyms + F (J); ! Probes := Probes + F (J) * (1 + J) * 100; ! end if; ! end if; ! end loop; ! Write_Eol; ! Write_Str ("Average number of probes for lookup = "); ! Probes := Probes / Nsyms; ! Write_Int (Probes / 200); ! Write_Char ('.'); ! Probes := (Probes mod 200) / 2; ! Write_Char (Character'Val (48 + Probes / 10)); ! Write_Char (Character'Val (48 + Probes mod 10)); ! Write_Eol; ! Write_Eol; ! end if; end Finalize; ----------------------------- --- 213,273 ---- end loop; Write_Eol; + N := Name_Entries.Table (N).Hash_Link; end loop; ! end if; ! end; ! end if; ! end loop; ! Write_Eol; ! for J in F'Range loop ! if F (J) /= 0 then ! Write_Str ("Number of hash chains of length "); ! if J < 10 then ! Write_Char (' '); ! end if; ! Write_Int (J); ! if J = F'Last then ! Write_Str (" or greater"); ! end if; ! Write_Str (" = "); ! Write_Int (F (J)); ! Write_Eol; ! end if; ! end loop; ! -- Print out average number of probes, in the case where Name_Find is ! -- called for a string that is already in the table. ! Write_Eol; ! Write_Str ("Average number of probes for lookup = "); ! Probes := Probes / Nsyms; ! Write_Int (Probes / 200); ! Write_Char ('.'); ! Probes := (Probes mod 200) / 2; ! Write_Char (Character'Val (Zero + Probes / 10)); ! Write_Char (Character'Val (Zero + Probes mod 10)); ! Write_Eol; ! ! Write_Str ("Max_Chain_Length = "); ! Write_Int (Max_Chain_Length); ! Write_Eol; ! Write_Str ("Name_Chars'Length = "); ! Write_Int (Name_Chars.Last - Name_Chars.First + 1); ! Write_Eol; ! Write_Str ("Name_Entries'Length = "); ! Write_Int (Int (Name_Entries.Last - Name_Entries.First + 1)); ! Write_Eol; ! Write_Str ("Nsyms = "); ! Write_Int (Nsyms); ! Write_Eol; end Finalize; ----------------------------- *************** package body Namet is *** 711,861 **** ---------- function Hash return Hash_Index_Type is - begin - -- For the cases of 1-12 characters, all characters participate in the - -- hash. The positioning is randomized, with the bias that characters - -- later on participate fully (i.e. are added towards the right side). ! case Name_Len is ! ! when 0 => ! return 0; ! ! when 1 => ! return ! Character'Pos (Name_Buffer (1)); ! ! when 2 => ! return (( ! Character'Pos (Name_Buffer (1))) * 64 + ! Character'Pos (Name_Buffer (2))) mod Hash_Num; ! ! when 3 => ! return ((( ! Character'Pos (Name_Buffer (1))) * 16 + ! Character'Pos (Name_Buffer (3))) * 16 + ! Character'Pos (Name_Buffer (2))) mod Hash_Num; ! ! when 4 => ! return (((( ! Character'Pos (Name_Buffer (1))) * 8 + ! Character'Pos (Name_Buffer (2))) * 8 + ! Character'Pos (Name_Buffer (3))) * 8 + ! Character'Pos (Name_Buffer (4))) mod Hash_Num; ! ! when 5 => ! return ((((( ! Character'Pos (Name_Buffer (4))) * 8 + ! Character'Pos (Name_Buffer (1))) * 4 + ! Character'Pos (Name_Buffer (3))) * 4 + ! Character'Pos (Name_Buffer (5))) * 8 + ! Character'Pos (Name_Buffer (2))) mod Hash_Num; ! ! when 6 => ! return (((((( ! Character'Pos (Name_Buffer (5))) * 4 + ! Character'Pos (Name_Buffer (1))) * 4 + ! Character'Pos (Name_Buffer (4))) * 4 + ! Character'Pos (Name_Buffer (2))) * 4 + ! Character'Pos (Name_Buffer (6))) * 4 + ! Character'Pos (Name_Buffer (3))) mod Hash_Num; ! ! when 7 => ! return ((((((( ! Character'Pos (Name_Buffer (4))) * 4 + ! Character'Pos (Name_Buffer (3))) * 4 + ! Character'Pos (Name_Buffer (1))) * 4 + ! Character'Pos (Name_Buffer (2))) * 2 + ! Character'Pos (Name_Buffer (5))) * 2 + ! Character'Pos (Name_Buffer (7))) * 2 + ! Character'Pos (Name_Buffer (6))) mod Hash_Num; ! ! when 8 => ! return (((((((( ! Character'Pos (Name_Buffer (2))) * 4 + ! Character'Pos (Name_Buffer (1))) * 4 + ! Character'Pos (Name_Buffer (3))) * 2 + ! Character'Pos (Name_Buffer (5))) * 2 + ! Character'Pos (Name_Buffer (7))) * 2 + ! Character'Pos (Name_Buffer (6))) * 2 + ! Character'Pos (Name_Buffer (4))) * 2 + ! Character'Pos (Name_Buffer (8))) mod Hash_Num; ! ! when 9 => ! return ((((((((( ! Character'Pos (Name_Buffer (2))) * 4 + ! Character'Pos (Name_Buffer (1))) * 4 + ! Character'Pos (Name_Buffer (3))) * 4 + ! Character'Pos (Name_Buffer (4))) * 2 + ! Character'Pos (Name_Buffer (8))) * 2 + ! Character'Pos (Name_Buffer (7))) * 2 + ! Character'Pos (Name_Buffer (5))) * 2 + ! Character'Pos (Name_Buffer (6))) * 2 + ! Character'Pos (Name_Buffer (9))) mod Hash_Num; ! ! when 10 => ! return (((((((((( ! Character'Pos (Name_Buffer (01))) * 2 + ! Character'Pos (Name_Buffer (02))) * 2 + ! Character'Pos (Name_Buffer (08))) * 2 + ! Character'Pos (Name_Buffer (03))) * 2 + ! Character'Pos (Name_Buffer (04))) * 2 + ! Character'Pos (Name_Buffer (09))) * 2 + ! Character'Pos (Name_Buffer (06))) * 2 + ! Character'Pos (Name_Buffer (05))) * 2 + ! Character'Pos (Name_Buffer (07))) * 2 + ! Character'Pos (Name_Buffer (10))) mod Hash_Num; ! when 11 => ! return ((((((((((( ! Character'Pos (Name_Buffer (05))) * 2 + ! Character'Pos (Name_Buffer (01))) * 2 + ! Character'Pos (Name_Buffer (06))) * 2 + ! Character'Pos (Name_Buffer (09))) * 2 + ! Character'Pos (Name_Buffer (07))) * 2 + ! Character'Pos (Name_Buffer (03))) * 2 + ! Character'Pos (Name_Buffer (08))) * 2 + ! Character'Pos (Name_Buffer (02))) * 2 + ! Character'Pos (Name_Buffer (10))) * 2 + ! Character'Pos (Name_Buffer (04))) * 2 + ! Character'Pos (Name_Buffer (11))) mod Hash_Num; ! when 12 => ! return (((((((((((( ! Character'Pos (Name_Buffer (03))) * 2 + ! Character'Pos (Name_Buffer (02))) * 2 + ! Character'Pos (Name_Buffer (05))) * 2 + ! Character'Pos (Name_Buffer (01))) * 2 + ! Character'Pos (Name_Buffer (06))) * 2 + ! Character'Pos (Name_Buffer (04))) * 2 + ! Character'Pos (Name_Buffer (08))) * 2 + ! Character'Pos (Name_Buffer (11))) * 2 + ! Character'Pos (Name_Buffer (07))) * 2 + ! Character'Pos (Name_Buffer (09))) * 2 + ! Character'Pos (Name_Buffer (10))) * 2 + ! Character'Pos (Name_Buffer (12))) mod Hash_Num; ! -- Names longer than 12 characters are handled by taking the first ! -- 6 odd numbered characters and the last 6 even numbered characters. ! when others => declare ! Even_Name_Len : constant Integer := (Name_Len) / 2 * 2; ! begin ! return (((((((((((( ! Character'Pos (Name_Buffer (01))) * 2 + ! Character'Pos (Name_Buffer (Even_Name_Len - 10))) * 2 + ! Character'Pos (Name_Buffer (03))) * 2 + ! Character'Pos (Name_Buffer (Even_Name_Len - 08))) * 2 + ! Character'Pos (Name_Buffer (05))) * 2 + ! Character'Pos (Name_Buffer (Even_Name_Len - 06))) * 2 + ! Character'Pos (Name_Buffer (07))) * 2 + ! Character'Pos (Name_Buffer (Even_Name_Len - 04))) * 2 + ! Character'Pos (Name_Buffer (09))) * 2 + ! Character'Pos (Name_Buffer (Even_Name_Len - 02))) * 2 + ! Character'Pos (Name_Buffer (11))) * 2 + ! Character'Pos (Name_Buffer (Even_Name_Len))) mod Hash_Num; ! end; ! end case; end Hash; ---------------- --- 750,776 ---- ---------- function Hash return Hash_Index_Type is ! -- This hash function looks at every character, in order to make it ! -- likely that similar strings get different hash values. The rotate by ! -- 7 bits has been determined empirically to be good, and it doesn't ! -- lose bits like a shift would. The final conversion can't overflow, ! -- because the table is 2**16 in size. This function probably needs to ! -- be changed if the hash table size is changed. ! -- Note that we could get some speed improvement by aligning the string ! -- to 32 or 64 bits, and doing word-wise xor's. We could also implement ! -- a growable table. It doesn't seem worth the trouble to do those ! -- things, for now. ! Result : Unsigned_16 := 0; ! begin ! for J in 1 .. Name_Len loop ! Result := Rotate_Left (Result, 7) xor Character'Pos (Name_Buffer (J)); ! end loop; ! return Hash_Index_Type (Result); end Hash; ---------------- *************** package body Namet is *** 864,893 **** procedure Initialize is begin ! Name_Chars.Init; ! Name_Entries.Init; ! ! -- Initialize entries for one character names ! ! for C in Character loop ! Name_Entries.Append ! ((Name_Chars_Index => Name_Chars.Last, ! Name_Len => 1, ! Byte_Info => 0, ! Int_Info => 0, ! Name_Has_No_Encodings => True, ! Hash_Link => No_Name)); ! ! Name_Chars.Append (C); ! Name_Chars.Append (ASCII.NUL); ! end loop; ! -- Clear hash table ! for J in Hash_Index_Type loop ! Hash_Table (J) := No_Name; ! end loop; ! end Initialize; ---------------------- -- Is_Internal_Name -- --- 779,799 ---- procedure Initialize is begin ! null; ! end Initialize; ! ------------------------------- ! -- Insert_Str_In_Name_Buffer -- ! ------------------------------- ! procedure Insert_Str_In_Name_Buffer (S : String; Index : Positive) is ! SL : constant Natural := S'Length; ! begin ! Name_Buffer (Index + SL .. Name_Len + SL) := ! Name_Buffer (Index .. Name_Len); ! Name_Buffer (Index .. Index + SL - 1) := S; ! Name_Len := Name_Len + SL; ! end Insert_Str_In_Name_Buffer; ---------------------- -- Is_Internal_Name -- *************** package body Namet is *** 1133,1138 **** --- 1039,1075 ---- end if; end Name_Find; + ------------------ + -- Reinitialize -- + ------------------ + + procedure Reinitialize is + begin + Name_Chars.Init; + Name_Entries.Init; + + -- Initialize entries for one character names + + for C in Character loop + Name_Entries.Append + ((Name_Chars_Index => Name_Chars.Last, + Name_Len => 1, + Byte_Info => 0, + Int_Info => 0, + Name_Has_No_Encodings => True, + Hash_Link => No_Name)); + + Name_Chars.Append (C); + Name_Chars.Append (ASCII.NUL); + end loop; + + -- Clear hash table + + for J in Hash_Index_Type loop + Hash_Table (J) := No_Name; + end loop; + end Reinitialize; + ---------------------- -- Reset_Name_Table -- ---------------------- *************** package body Namet is *** 1399,1402 **** --- 1336,1343 ---- end if; end Write_Name_Decoded; + -- Package initialization, initialize tables + + begin + Reinitialize; end Namet; diff -Nrcpad gcc-4.5.2/gcc/ada/namet.ads gcc-4.6.0/gcc/ada/namet.ads *** gcc-4.5.2/gcc/ada/namet.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/namet.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Namet is *** 70,76 **** -- followed by an upper case letter or an underscore. -- Character literals Character literals have names that are used only for ! -- debugging and error message purposes. The form is a -- upper case Q followed by a single lower case letter, -- or by a Uxx/Wxxxx/WWxxxxxxx encoding as described for -- identifiers. The Set_Character_Literal_Name procedure --- 70,76 ---- -- followed by an upper case letter or an underscore. -- Character literals Character literals have names that are used only for ! -- debugging and error message purposes. The form is an -- upper case Q followed by a single lower case letter, -- or by a Uxx/Wxxxx/WWxxxxxxx encoding as described for -- identifiers. The Set_Character_Literal_Name procedure *************** package Namet is *** 139,146 **** ----------------------------- -- Name_Id values are used to identify entries in the names table. Except ! -- for the special values No_Name, and Error_Name, they are subscript ! -- values for the Names table defined in package Namet. -- Note that with only a few exceptions, which are clearly documented, the -- type Name_Id should be regarded as a private type. In particular it is --- 139,146 ---- ----------------------------- -- Name_Id values are used to identify entries in the names table. Except ! -- for the special values No_Name and Error_Name, they are subscript values ! -- for the Names table defined in this package. -- Note that with only a few exceptions, which are clearly documented, the -- type Name_Id should be regarded as a private type. In particular it is *************** package Namet is *** 239,252 **** -- is, it starts with an upper case O). procedure Initialize; ! -- Initializes the names table, including initializing the first 26 ! -- entries in the table (for the 1-character lower case names a-z) Note ! -- that Initialize must not be called if Tree_Read is used. procedure Lock; -- Lock name tables before calling back end. We reserve some extra space -- before locking to avoid unnecessary inefficiencies when we unlock. procedure Unlock; -- Unlocks the name table to allow use of the extra space reserved by the -- call to Lock. See gnat1drv for details of the need for this. --- 239,258 ---- -- is, it starts with an upper case O). procedure Initialize; ! -- This is a dummy procedure. It is retained for easy compatibility with ! -- clients who used to call Initialize when this call was required. Now ! -- initialization is performed automatically during package elaboration. ! -- Note that this change fixes problems which existed prior to the change ! -- of Initialize being called more than once. See also Reinitialize which ! -- allows reinitialization of the tables. procedure Lock; -- Lock name tables before calling back end. We reserve some extra space -- before locking to avoid unnecessary inefficiencies when we unlock. + procedure Reinitialize; + -- Clears the name tables and removes all existing entries from the table. + procedure Unlock; -- Unlocks the name table to allow use of the extra space reserved by the -- call to Lock. See gnat1drv for details of the need for this. *************** package Namet is *** 344,349 **** --- 350,360 ---- -- Add characters of string S to the end of the string currently stored -- in the Name_Buffer, incrementing Name_Len by the length of the string. + procedure Insert_Str_In_Name_Buffer (S : String; Index : Positive); + -- Inserts given string in name buffer, starting at Index. Any existing + -- characters at or past this location get moved beyond the inserted string + -- and Name_Len is incremented by the length of the string. + procedure Set_Character_Literal_Name (C : Char_Code); -- This procedure sets the proper encoded name for the character literal -- for the given character code. On return Name_Buffer and Name_Len are diff -Nrcpad gcc-4.5.2/gcc/ada/nlists.adb gcc-4.6.0/gcc/ada/nlists.adb *** gcc-4.5.2/gcc/ada/nlists.adb Fri Apr 17 09:38:12 2009 --- gcc-4.6.0/gcc/ada/nlists.adb Thu Sep 9 09:35:11 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Nlists is *** 52,61 **** -- three fields: type List_Header is record ! First : Node_Id; -- Pointer to first node in list. Empty if list is empty ! Last : Node_Id; -- Pointer to last node in list. Empty if list is empty Parent : Node_Id; --- 52,61 ---- -- three fields: type List_Header is record ! First : Node_Or_Entity_Id; -- Pointer to first node in list. Empty if list is empty ! Last : Node_Or_Entity_Id; -- Pointer to last node in list. Empty if list is empty Parent : Node_Id; *************** package body Nlists is *** 85,100 **** -- list and Prev_Node is Empty at the start of a list. package Next_Node is new Table.Table ( ! Table_Component_Type => Node_Id, ! Table_Index_Type => Node_Id'Base, Table_Low_Bound => First_Node_Id, Table_Initial => Alloc.Orig_Nodes_Initial, Table_Increment => Alloc.Orig_Nodes_Increment, Table_Name => "Next_Node"); package Prev_Node is new Table.Table ( ! Table_Component_Type => Node_Id, ! Table_Index_Type => Node_Id'Base, Table_Low_Bound => First_Node_Id, Table_Initial => Alloc.Orig_Nodes_Initial, Table_Increment => Alloc.Orig_Nodes_Increment, --- 85,100 ---- -- list and Prev_Node is Empty at the start of a list. package Next_Node is new Table.Table ( ! Table_Component_Type => Node_Or_Entity_Id, ! Table_Index_Type => Node_Or_Entity_Id'Base, Table_Low_Bound => First_Node_Id, Table_Initial => Alloc.Orig_Nodes_Initial, Table_Increment => Alloc.Orig_Nodes_Increment, Table_Name => "Next_Node"); package Prev_Node is new Table.Table ( ! Table_Component_Type => Node_Or_Entity_Id, ! Table_Index_Type => Node_Or_Entity_Id'Base, Table_Low_Bound => First_Node_Id, Table_Initial => Alloc.Orig_Nodes_Initial, Table_Increment => Alloc.Orig_Nodes_Increment, *************** package body Nlists is *** 104,126 **** -- Local Subprograms -- ----------------------- ! procedure Set_First (List : List_Id; To : Node_Id); pragma Inline (Set_First); -- Sets First field of list header List to reference To ! procedure Set_Last (List : List_Id; To : Node_Id); pragma Inline (Set_Last); -- Sets Last field of list header List to reference To ! procedure Set_List_Link (Node : Node_Id; To : List_Id); pragma Inline (Set_List_Link); -- Sets list link of Node to list header To ! procedure Set_Next (Node : Node_Id; To : Node_Id); pragma Inline (Set_Next); -- Sets the Next_Node pointer for Node to reference To ! procedure Set_Prev (Node : Node_Id; To : Node_Id); pragma Inline (Set_Prev); -- Sets the Prev_Node pointer for Node to reference To --- 104,126 ---- -- Local Subprograms -- ----------------------- ! procedure Set_First (List : List_Id; To : Node_Or_Entity_Id); pragma Inline (Set_First); -- Sets First field of list header List to reference To ! procedure Set_Last (List : List_Id; To : Node_Or_Entity_Id); pragma Inline (Set_Last); -- Sets Last field of list header List to reference To ! procedure Set_List_Link (Node : Node_Or_Entity_Id; To : List_Id); pragma Inline (Set_List_Link); -- Sets list link of Node to list header To ! procedure Set_Next (Node : Node_Or_Entity_Id; To : Node_Or_Entity_Id); pragma Inline (Set_Next); -- Sets the Next_Node pointer for Node to reference To ! procedure Set_Prev (Node : Node_Or_Entity_Id; To : Node_Or_Entity_Id); pragma Inline (Set_Prev); -- Sets the Prev_Node pointer for Node to reference To *************** package body Nlists is *** 128,135 **** -- Allocate_List_Tables -- -------------------------- ! procedure Allocate_List_Tables (N : Node_Id) is ! Old_Last : constant Node_Id'Base := Next_Node.Last; begin pragma Assert (N >= Old_Last); --- 128,135 ---- -- Allocate_List_Tables -- -------------------------- ! procedure Allocate_List_Tables (N : Node_Or_Entity_Id) is ! Old_Last : constant Node_Or_Entity_Id'Base := Next_Node.Last; begin pragma Assert (N >= Old_Last); *************** package body Nlists is *** 149,156 **** -- Append -- ------------ ! procedure Append (Node : Node_Id; To : List_Id) is ! L : constant Node_Id := Last (To); procedure Append_Debug; pragma Inline (Append_Debug); --- 149,156 ---- -- Append -- ------------ ! procedure Append (Node : Node_Or_Entity_Id; To : List_Id) is ! L : constant Node_Or_Entity_Id := Last (To); procedure Append_Debug; pragma Inline (Append_Debug); *************** package body Nlists is *** 230,238 **** else declare ! L : constant Node_Id := Last (To); ! F : constant Node_Id := First (List); ! N : Node_Id; begin pragma Debug (Append_List_Debug); --- 230,238 ---- else declare ! L : constant Node_Or_Entity_Id := Last (To); ! F : constant Node_Or_Entity_Id := First (List); ! N : Node_Or_Entity_Id; begin pragma Debug (Append_List_Debug); *************** package body Nlists is *** 272,278 **** -- Append_To -- --------------- ! procedure Append_To (To : List_Id; Node : Node_Id) is begin Append (Node, To); end Append_To; --- 272,278 ---- -- Append_To -- --------------- ! procedure Append_To (To : List_Id; Node : Node_Or_Entity_Id) is begin Append (Node, To); end Append_To; *************** package body Nlists is *** 281,287 **** -- First -- ----------- ! function First (List : List_Id) return Node_Id is begin if List = No_List then return Empty; --- 281,287 ---- -- First -- ----------- ! function First (List : List_Id) return Node_Or_Entity_Id is begin if List = No_List then return Empty; *************** package body Nlists is *** 295,302 **** -- First_Non_Pragma -- ---------------------- ! function First_Non_Pragma (List : List_Id) return Node_Id is ! N : constant Node_Id := First (List); begin if Nkind (N) /= N_Pragma and then --- 295,302 ---- -- First_Non_Pragma -- ---------------------- ! function First_Non_Pragma (List : List_Id) return Node_Or_Entity_Id is ! N : constant Node_Or_Entity_Id := First (List); begin if Nkind (N) /= N_Pragma and then *************** package body Nlists is *** 329,339 **** end Initialize; ------------------ ! -- Insert_After -- ------------------ ! procedure Insert_After (After : Node_Id; Node : Node_Id) is procedure Insert_After_Debug; pragma Inline (Insert_After_Debug); -- Output debug information if Debug_Flag_N set --- 329,350 ---- end Initialize; ------------------ ! -- In_Same_List -- ------------------ ! function In_Same_List (N1, N2 : Node_Or_Entity_Id) return Boolean is ! begin ! return List_Containing (N1) = List_Containing (N2); ! end In_Same_List; + ------------------ + -- Insert_After -- + ------------------ + + procedure Insert_After + (After : Node_Or_Entity_Id; + Node : Node_Or_Entity_Id) + is procedure Insert_After_Debug; pragma Inline (Insert_After_Debug); -- Output debug information if Debug_Flag_N set *************** package body Nlists is *** 366,373 **** pragma Debug (Insert_After_Debug); declare ! Before : constant Node_Id := Next (After); ! LC : constant List_Id := List_Containing (After); begin if Present (Before) then --- 377,384 ---- pragma Debug (Insert_After_Debug); declare ! Before : constant Node_Or_Entity_Id := Next (After); ! LC : constant List_Id := List_Containing (After); begin if Present (Before) then *************** package body Nlists is *** 390,397 **** -- Insert_Before -- ------------------- ! procedure Insert_Before (Before : Node_Id; Node : Node_Id) is ! procedure Insert_Before_Debug; pragma Inline (Insert_Before_Debug); -- Output debug information if Debug_Flag_N set --- 401,410 ---- -- Insert_Before -- ------------------- ! procedure Insert_Before ! (Before : Node_Or_Entity_Id; ! Node : Node_Or_Entity_Id) ! is procedure Insert_Before_Debug; pragma Inline (Insert_Before_Debug); -- Output debug information if Debug_Flag_N set *************** package body Nlists is *** 424,431 **** pragma Debug (Insert_Before_Debug); declare ! After : constant Node_Id := Prev (Before); ! LC : constant List_Id := List_Containing (Before); begin if Present (After) then --- 437,444 ---- pragma Debug (Insert_Before_Debug); declare ! After : constant Node_Or_Entity_Id := Prev (Before); ! LC : constant List_Id := List_Containing (Before); begin if Present (After) then *************** package body Nlists is *** 448,454 **** -- Insert_List_After -- ----------------------- ! procedure Insert_List_After (After : Node_Id; List : List_Id) is procedure Insert_List_After_Debug; pragma Inline (Insert_List_After_Debug); --- 461,467 ---- -- Insert_List_After -- ----------------------- ! procedure Insert_List_After (After : Node_Or_Entity_Id; List : List_Id) is procedure Insert_List_After_Debug; pragma Inline (Insert_List_After_Debug); *************** package body Nlists is *** 479,489 **** else declare ! Before : constant Node_Id := Next (After); ! LC : constant List_Id := List_Containing (After); ! F : constant Node_Id := First (List); ! L : constant Node_Id := Last (List); ! N : Node_Id; begin pragma Debug (Insert_List_After_Debug); --- 492,502 ---- else declare ! Before : constant Node_Or_Entity_Id := Next (After); ! LC : constant List_Id := List_Containing (After); ! F : constant Node_Or_Entity_Id := First (List); ! L : constant Node_Or_Entity_Id := Last (List); ! N : Node_Or_Entity_Id; begin pragma Debug (Insert_List_After_Debug); *************** package body Nlists is *** 515,521 **** -- Insert_List_Before -- ------------------------ ! procedure Insert_List_Before (Before : Node_Id; List : List_Id) is procedure Insert_List_Before_Debug; pragma Inline (Insert_List_Before_Debug); --- 528,534 ---- -- Insert_List_Before -- ------------------------ ! procedure Insert_List_Before (Before : Node_Or_Entity_Id; List : List_Id) is procedure Insert_List_Before_Debug; pragma Inline (Insert_List_Before_Debug); *************** package body Nlists is *** 546,556 **** else declare ! After : constant Node_Id := Prev (Before); ! LC : constant List_Id := List_Containing (Before); ! F : constant Node_Id := First (List); ! L : constant Node_Id := Last (List); ! N : Node_Id; begin pragma Debug (Insert_List_Before_Debug); --- 559,569 ---- else declare ! After : constant Node_Or_Entity_Id := Prev (Before); ! LC : constant List_Id := List_Containing (Before); ! F : constant Node_Or_Entity_Id := First (List); ! L : constant Node_Or_Entity_Id := Last (List); ! N : Node_Or_Entity_Id; begin pragma Debug (Insert_List_Before_Debug); *************** package body Nlists is *** 591,597 **** -- Is_List_Member -- -------------------- ! function Is_List_Member (Node : Node_Id) return Boolean is begin return Nodes.Table (Node).In_List; end Is_List_Member; --- 604,610 ---- -- Is_List_Member -- -------------------- ! function Is_List_Member (Node : Node_Or_Entity_Id) return Boolean is begin return Nodes.Table (Node).In_List; end Is_List_Member; *************** package body Nlists is *** 609,615 **** -- Last -- ---------- ! function Last (List : List_Id) return Node_Id is begin pragma Assert (List <= Lists.Last); return Lists.Table (List).Last; --- 622,628 ---- -- Last -- ---------- ! function Last (List : List_Id) return Node_Or_Entity_Id is begin pragma Assert (List <= Lists.Last); return Lists.Table (List).Last; *************** package body Nlists is *** 628,635 **** -- Last_Non_Pragma -- --------------------- ! function Last_Non_Pragma (List : List_Id) return Node_Id is ! N : constant Node_Id := Last (List); begin if Nkind (N) /= N_Pragma then return N; --- 641,648 ---- -- Last_Non_Pragma -- --------------------- ! function Last_Non_Pragma (List : List_Id) return Node_Or_Entity_Id is ! N : constant Node_Or_Entity_Id := Last (List); begin if Nkind (N) /= N_Pragma then return N; *************** package body Nlists is *** 642,648 **** -- List_Containing -- --------------------- ! function List_Containing (Node : Node_Id) return List_Id is begin pragma Assert (Is_List_Member (Node)); return List_Id (Nodes.Table (Node).Link); --- 655,661 ---- -- List_Containing -- --------------------- ! function List_Containing (Node : Node_Or_Entity_Id) return List_Id is begin pragma Assert (Is_List_Member (Node)); return List_Id (Nodes.Table (Node).Link); *************** package body Nlists is *** 654,660 **** function List_Length (List : List_Id) return Nat is Result : Nat; ! Node : Node_Id; begin Result := 0; --- 667,673 ---- function List_Length (List : List_Id) return Nat is Result : Nat; ! Node : Node_Or_Entity_Id; begin Result := 0; *************** package body Nlists is *** 698,704 **** function New_Copy_List (List : List_Id) return List_Id is NL : List_Id; ! E : Node_Id; begin if List = No_List then --- 711,717 ---- function New_Copy_List (List : List_Id) return List_Id is NL : List_Id; ! E : Node_Or_Entity_Id; begin if List = No_List then *************** package body Nlists is *** 723,729 **** function New_Copy_List_Original (List : List_Id) return List_Id is NL : List_Id; ! E : Node_Id; begin if List = No_List then --- 736,742 ---- function New_Copy_List_Original (List : List_Id) return List_Id is NL : List_Id; ! E : Node_Or_Entity_Id; begin if List = No_List then *************** package body Nlists is *** 790,796 **** -- list directly, rather than first building an empty list and then doing -- the insertion, which results in some unnecessary work. ! function New_List (Node : Node_Id) return List_Id is procedure New_List_Debug; pragma Inline (New_List_Debug); --- 803,809 ---- -- list directly, rather than first building an empty list and then doing -- the insertion, which results in some unnecessary work. ! function New_List (Node : Node_Or_Entity_Id) return List_Id is procedure New_List_Debug; pragma Inline (New_List_Debug); *************** package body Nlists is *** 838,851 **** end if; end New_List; ! function New_List (Node1, Node2 : Node_Id) return List_Id is L : constant List_Id := New_List (Node1); begin Append (Node2, L); return L; end New_List; ! function New_List (Node1, Node2, Node3 : Node_Id) return List_Id is L : constant List_Id := New_List (Node1); begin Append (Node2, L); --- 851,871 ---- end if; end New_List; ! function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id) return List_Id ! is L : constant List_Id := New_List (Node1); begin Append (Node2, L); return L; end New_List; ! function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id) return List_Id ! is L : constant List_Id := New_List (Node1); begin Append (Node2, L); *************** package body Nlists is *** 853,859 **** return L; end New_List; ! function New_List (Node1, Node2, Node3, Node4 : Node_Id) return List_Id is L : constant List_Id := New_List (Node1); begin Append (Node2, L); --- 873,884 ---- return L; end New_List; ! function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id; ! Node4 : Node_Or_Entity_Id) return List_Id ! is L : constant List_Id := New_List (Node1); begin Append (Node2, L); *************** package body Nlists is *** 863,873 **** end New_List; function New_List ! (Node1 : Node_Id; ! Node2 : Node_Id; ! Node3 : Node_Id; ! Node4 : Node_Id; ! Node5 : Node_Id) return List_Id is L : constant List_Id := New_List (Node1); begin --- 888,898 ---- end New_List; function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id; ! Node4 : Node_Or_Entity_Id; ! Node5 : Node_Or_Entity_Id) return List_Id is L : constant List_Id := New_List (Node1); begin *************** package body Nlists is *** 879,890 **** end New_List; function New_List ! (Node1 : Node_Id; ! Node2 : Node_Id; ! Node3 : Node_Id; ! Node4 : Node_Id; ! Node5 : Node_Id; ! Node6 : Node_Id) return List_Id is L : constant List_Id := New_List (Node1); begin --- 904,915 ---- end New_List; function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id; ! Node4 : Node_Or_Entity_Id; ! Node5 : Node_Or_Entity_Id; ! Node6 : Node_Or_Entity_Id) return List_Id is L : constant List_Id := New_List (Node1); begin *************** package body Nlists is *** 900,912 **** -- Next -- ---------- ! function Next (Node : Node_Id) return Node_Id is begin pragma Assert (Is_List_Member (Node)); return Next_Node.Table (Node); end Next; ! procedure Next (Node : in out Node_Id) is begin Node := Next (Node); end Next; --- 925,937 ---- -- Next -- ---------- ! function Next (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id is begin pragma Assert (Is_List_Member (Node)); return Next_Node.Table (Node); end Next; ! procedure Next (Node : in out Node_Or_Entity_Id) is begin Node := Next (Node); end Next; *************** package body Nlists is *** 924,945 **** -- Next_Non_Pragma -- --------------------- ! function Next_Non_Pragma (Node : Node_Id) return Node_Id is ! N : Node_Id; begin N := Node; loop N := Next (N); ! exit when Nkind (N) /= N_Pragma ! and then ! Nkind (N) /= N_Null_Statement; end loop; return N; end Next_Non_Pragma; ! procedure Next_Non_Pragma (Node : in out Node_Id) is begin Node := Next_Non_Pragma (Node); end Next_Non_Pragma; --- 949,970 ---- -- Next_Non_Pragma -- --------------------- ! function Next_Non_Pragma ! (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id ! is ! N : Node_Or_Entity_Id; begin N := Node; loop N := Next (N); ! exit when not Nkind_In (N, N_Pragma, N_Null_Statement); end loop; return N; end Next_Non_Pragma; ! procedure Next_Non_Pragma (Node : in out Node_Or_Entity_Id) is begin Node := Next_Non_Pragma (Node); end Next_Non_Pragma; *************** package body Nlists is *** 966,975 **** -- p -- ------- ! function p (U : Union_Id) return Node_Id is begin if U in Node_Range then ! return Parent (Node_Id (U)); elsif U in List_Range then return Parent (List_Id (U)); else --- 991,1000 ---- -- p -- ------- ! function p (U : Union_Id) return Node_Or_Entity_Id is begin if U in Node_Range then ! return Parent (Node_Or_Entity_Id (U)); elsif U in List_Range then return Parent (List_Id (U)); else *************** package body Nlists is *** 981,987 **** -- Parent -- ------------ ! function Parent (List : List_Id) return Node_Id is begin pragma Assert (List <= Lists.Last); return Lists.Table (List).Parent; --- 1006,1012 ---- -- Parent -- ------------ ! function Parent (List : List_Id) return Node_Or_Entity_Id is begin pragma Assert (List <= Lists.Last); return Lists.Table (List).Parent; *************** package body Nlists is *** 991,998 **** -- Pick -- ---------- ! function Pick (List : List_Id; Index : Pos) return Node_Id is ! Elmt : Node_Id; begin Elmt := First (List); --- 1016,1023 ---- -- Pick -- ---------- ! function Pick (List : List_Id; Index : Pos) return Node_Or_Entity_Id is ! Elmt : Node_Or_Entity_Id; begin Elmt := First (List); *************** package body Nlists is *** 1007,1014 **** -- Prepend -- ------------- ! procedure Prepend (Node : Node_Id; To : List_Id) is ! F : constant Node_Id := First (To); procedure Prepend_Debug; pragma Inline (Prepend_Debug); --- 1032,1039 ---- -- Prepend -- ------------- ! procedure Prepend (Node : Node_Or_Entity_Id; To : List_Id) is ! F : constant Node_Or_Entity_Id := First (To); procedure Prepend_Debug; pragma Inline (Prepend_Debug); *************** package body Nlists is *** 1055,1065 **** Set_List_Link (Node, To); end Prepend; ---------------- -- Prepend_To -- ---------------- ! procedure Prepend_To (To : List_Id; Node : Node_Id) is begin Prepend (Node, To); end Prepend_To; --- 1080,1161 ---- Set_List_Link (Node, To); end Prepend; + ------------------ + -- Prepend_List -- + ------------------ + + procedure Prepend_List (List : List_Id; To : List_Id) is + + procedure Prepend_List_Debug; + pragma Inline (Prepend_List_Debug); + -- Output debug information if Debug_Flag_N set + + ------------------------ + -- Prepend_List_Debug -- + ------------------------ + + procedure Prepend_List_Debug is + begin + if Debug_Flag_N then + Write_Str ("Prepend list "); + Write_Int (Int (List)); + Write_Str (" to list "); + Write_Int (Int (To)); + Write_Eol; + end if; + end Prepend_List_Debug; + + -- Start of processing for Prepend_List + + begin + if Is_Empty_List (List) then + return; + + else + declare + F : constant Node_Or_Entity_Id := First (To); + L : constant Node_Or_Entity_Id := Last (List); + N : Node_Or_Entity_Id; + + begin + pragma Debug (Prepend_List_Debug); + + N := L; + loop + Set_List_Link (N, To); + N := Prev (N); + exit when No (N); + end loop; + + if No (F) then + Set_Last (To, L); + else + Set_Next (L, F); + end if; + + Set_Prev (F, L); + Set_First (To, First (List)); + + Set_First (List, Empty); + Set_Last (List, Empty); + end; + end if; + end Prepend_List; + + --------------------- + -- Prepend_List_To -- + --------------------- + + procedure Prepend_List_To (To : List_Id; List : List_Id) is + begin + Prepend_List (List, To); + end Prepend_List_To; + ---------------- -- Prepend_To -- ---------------- ! procedure Prepend_To (To : List_Id; Node : Node_Or_Entity_Id) is begin Prepend (Node, To); end Prepend_To; *************** package body Nlists is *** 1077,1089 **** -- Prev -- ---------- ! function Prev (Node : Node_Id) return Node_Id is begin pragma Assert (Is_List_Member (Node)); return Prev_Node.Table (Node); end Prev; ! procedure Prev (Node : in out Node_Id) is begin Node := Prev (Node); end Prev; --- 1173,1185 ---- -- Prev -- ---------- ! function Prev (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id is begin pragma Assert (Is_List_Member (Node)); return Prev_Node.Table (Node); end Prev; ! procedure Prev (Node : in out Node_Or_Entity_Id) is begin Node := Prev (Node); end Prev; *************** package body Nlists is *** 1101,1108 **** -- Prev_Non_Pragma -- --------------------- ! function Prev_Non_Pragma (Node : Node_Id) return Node_Id is ! N : Node_Id; begin N := Node; --- 1197,1206 ---- -- Prev_Non_Pragma -- --------------------- ! function Prev_Non_Pragma ! (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id ! is ! N : Node_Or_Entity_Id; begin N := Node; *************** package body Nlists is *** 1114,1120 **** return N; end Prev_Non_Pragma; ! procedure Prev_Non_Pragma (Node : in out Node_Id) is begin Node := Prev_Non_Pragma (Node); end Prev_Non_Pragma; --- 1212,1218 ---- return N; end Prev_Non_Pragma; ! procedure Prev_Non_Pragma (Node : in out Node_Or_Entity_Id) is begin Node := Prev_Non_Pragma (Node); end Prev_Non_Pragma; *************** package body Nlists is *** 1123,1132 **** -- Remove -- ------------ ! procedure Remove (Node : Node_Id) is ! Lst : constant List_Id := List_Containing (Node); ! Prv : constant Node_Id := Prev (Node); ! Nxt : constant Node_Id := Next (Node); procedure Remove_Debug; pragma Inline (Remove_Debug); --- 1221,1230 ---- -- Remove -- ------------ ! procedure Remove (Node : Node_Or_Entity_Id) is ! Lst : constant List_Id := List_Containing (Node); ! Prv : constant Node_Or_Entity_Id := Prev (Node); ! Nxt : constant Node_Or_Entity_Id := Next (Node); procedure Remove_Debug; pragma Inline (Remove_Debug); *************** package body Nlists is *** 1170,1177 **** -- Remove_Head -- ----------------- ! function Remove_Head (List : List_Id) return Node_Id is ! Frst : constant Node_Id := First (List); procedure Remove_Head_Debug; pragma Inline (Remove_Head_Debug); --- 1268,1275 ---- -- Remove_Head -- ----------------- ! function Remove_Head (List : List_Id) return Node_Or_Entity_Id is ! Frst : constant Node_Or_Entity_Id := First (List); procedure Remove_Head_Debug; pragma Inline (Remove_Head_Debug); *************** package body Nlists is *** 1200,1206 **** else declare ! Nxt : constant Node_Id := Next (Frst); begin Set_First (List, Nxt); --- 1298,1304 ---- else declare ! Nxt : constant Node_Or_Entity_Id := Next (Frst); begin Set_First (List, Nxt); *************** package body Nlists is *** 1222,1229 **** -- Remove_Next -- ----------------- ! function Remove_Next (Node : Node_Id) return Node_Id is ! Nxt : constant Node_Id := Next (Node); procedure Remove_Next_Debug; pragma Inline (Remove_Next_Debug); --- 1320,1329 ---- -- Remove_Next -- ----------------- ! function Remove_Next ! (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id ! is ! Nxt : constant Node_Or_Entity_Id := Next (Node); procedure Remove_Next_Debug; pragma Inline (Remove_Next_Debug); *************** package body Nlists is *** 1247,1254 **** begin if Present (Nxt) then declare ! Nxt2 : constant Node_Id := Next (Nxt); ! LC : constant List_Id := List_Containing (Node); begin pragma Debug (Remove_Next_Debug); --- 1347,1354 ---- begin if Present (Nxt) then declare ! Nxt2 : constant Node_Or_Entity_Id := Next (Nxt); ! LC : constant List_Id := List_Containing (Node); begin pragma Debug (Remove_Next_Debug); *************** package body Nlists is *** 1272,1278 **** -- Set_First -- --------------- ! procedure Set_First (List : List_Id; To : Node_Id) is begin Lists.Table (List).First := To; end Set_First; --- 1372,1378 ---- -- Set_First -- --------------- ! procedure Set_First (List : List_Id; To : Node_Or_Entity_Id) is begin Lists.Table (List).First := To; end Set_First; *************** package body Nlists is *** 1281,1287 **** -- Set_Last -- -------------- ! procedure Set_Last (List : List_Id; To : Node_Id) is begin Lists.Table (List).Last := To; end Set_Last; --- 1381,1387 ---- -- Set_Last -- -------------- ! procedure Set_Last (List : List_Id; To : Node_Or_Entity_Id) is begin Lists.Table (List).Last := To; end Set_Last; *************** package body Nlists is *** 1290,1296 **** -- Set_List_Link -- ------------------- ! procedure Set_List_Link (Node : Node_Id; To : List_Id) is begin Nodes.Table (Node).Link := Union_Id (To); end Set_List_Link; --- 1390,1396 ---- -- Set_List_Link -- ------------------- ! procedure Set_List_Link (Node : Node_Or_Entity_Id; To : List_Id) is begin Nodes.Table (Node).Link := Union_Id (To); end Set_List_Link; *************** package body Nlists is *** 1299,1305 **** -- Set_Next -- -------------- ! procedure Set_Next (Node : Node_Id; To : Node_Id) is begin Next_Node.Table (Node) := To; end Set_Next; --- 1399,1405 ---- -- Set_Next -- -------------- ! procedure Set_Next (Node : Node_Or_Entity_Id; To : Node_Or_Entity_Id) is begin Next_Node.Table (Node) := To; end Set_Next; *************** package body Nlists is *** 1308,1314 **** -- Set_Parent -- ---------------- ! procedure Set_Parent (List : List_Id; Node : Node_Id) is begin pragma Assert (List <= Lists.Last); Lists.Table (List).Parent := Node; --- 1408,1414 ---- -- Set_Parent -- ---------------- ! procedure Set_Parent (List : List_Id; Node : Node_Or_Entity_Id) is begin pragma Assert (List <= Lists.Last); Lists.Table (List).Parent := Node; *************** package body Nlists is *** 1318,1324 **** -- Set_Prev -- -------------- ! procedure Set_Prev (Node : Node_Id; To : Node_Id) is begin Prev_Node.Table (Node) := To; end Set_Prev; --- 1418,1424 ---- -- Set_Prev -- -------------- ! procedure Set_Prev (Node : Node_Or_Entity_Id; To : Node_Or_Entity_Id) is begin Prev_Node.Table (Node) := To; end Set_Prev; diff -Nrcpad gcc-4.5.2/gcc/ada/nlists.ads gcc-4.6.0/gcc/ada/nlists.ads *** gcc-4.5.2/gcc/ada/nlists.ads Fri Apr 17 09:38:12 2009 --- gcc-4.6.0/gcc/ada/nlists.ads Thu Sep 9 09:35:11 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Nlists is *** 49,54 **** --- 49,58 ---- -- Note: node lists can contain either nodes or entities (extended nodes) -- or a mixture of nodes and extended nodes. + function In_Same_List (N1, N2 : Node_Or_Entity_Id) return Boolean; + pragma Inline (In_Same_List); + -- Equivalent to List_Containing (N1) = List_Containing (N2) + function Last_List_Id return List_Id; pragma Inline (Last_List_Id); -- Returns Id of last allocated list header *************** package Nlists is *** 70,102 **** -- Used in contexts where an empty list (as opposed to an initially empty -- list to be filled in) is required. ! function New_List (Node : Node_Id) return List_Id; -- Build a new list initially containing the given node ! function New_List (Node1, Node2 : Node_Id) return List_Id; -- Build a new list initially containing the two given nodes ! function New_List (Node1, Node2, Node3 : Node_Id) return List_Id; -- Build a new list initially containing the three given nodes ! function New_List (Node1, Node2, Node3, Node4 : Node_Id) return List_Id; ! -- Build a new list initially containing the four given nodes function New_List ! (Node1 : Node_Id; ! Node2 : Node_Id; ! Node3 : Node_Id; ! Node4 : Node_Id; ! Node5 : Node_Id) return List_Id; -- Build a new list initially containing the five given nodes function New_List ! (Node1 : Node_Id; ! Node2 : Node_Id; ! Node3 : Node_Id; ! Node4 : Node_Id; ! Node5 : Node_Id; ! Node6 : Node_Id) return List_Id; -- Build a new list initially containing the six given nodes function New_Copy_List (List : List_Id) return List_Id; --- 74,115 ---- -- Used in contexts where an empty list (as opposed to an initially empty -- list to be filled in) is required. ! function New_List ! (Node : Node_Or_Entity_Id) return List_Id; -- Build a new list initially containing the given node ! function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id) return List_Id; -- Build a new list initially containing the two given nodes ! function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id) return List_Id; -- Build a new list initially containing the three given nodes ! function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id; ! Node4 : Node_Or_Entity_Id) return List_Id; function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id; ! Node4 : Node_Or_Entity_Id; ! Node5 : Node_Or_Entity_Id) return List_Id; -- Build a new list initially containing the five given nodes function New_List ! (Node1 : Node_Or_Entity_Id; ! Node2 : Node_Or_Entity_Id; ! Node3 : Node_Or_Entity_Id; ! Node4 : Node_Or_Entity_Id; ! Node5 : Node_Or_Entity_Id; ! Node6 : Node_Or_Entity_Id) return List_Id; -- Build a new list initially containing the six given nodes function New_Copy_List (List : List_Id) return List_Id; *************** package Nlists is *** 108,119 **** function New_Copy_List_Original (List : List_Id) return List_Id; -- Same as New_Copy_List but copies only nodes coming from source ! function First (List : List_Id) return Node_Id; pragma Inline (First); -- Obtains the first element of the given node list or, if the node list -- has no items or is equal to No_List, then Empty is returned. ! function First_Non_Pragma (List : List_Id) return Node_Id; -- Used when dealing with a list that can contain pragmas to skip past -- any initial pragmas and return the first element that is not a pragma. -- If the list is empty, or if it contains only pragmas, then Empty is --- 121,132 ---- function New_Copy_List_Original (List : List_Id) return List_Id; -- Same as New_Copy_List but copies only nodes coming from source ! function First (List : List_Id) return Node_Or_Entity_Id; pragma Inline (First); -- Obtains the first element of the given node list or, if the node list -- has no items or is equal to No_List, then Empty is returned. ! function First_Non_Pragma (List : List_Id) return Node_Or_Entity_Id; -- Used when dealing with a list that can contain pragmas to skip past -- any initial pragmas and return the first element that is not a pragma. -- If the list is empty, or if it contains only pragmas, then Empty is *************** package Nlists is *** 122,135 **** -- This function also skips N_Null nodes which can result from rewriting -- unrecognized or incorrect pragmas. ! function Last (List : List_Id) return Node_Id; pragma Inline (Last); -- Obtains the last element of the given node list or, if the node list -- has no items, then Empty is returned. It is an error to call Last with -- a Node_Id or No_List. (No_List is not considered to be the same as an -- empty node list). ! function Last_Non_Pragma (List : List_Id) return Node_Id; -- Obtains the last element of a given node list that is not a pragma. -- If the list is empty, or if it contains only pragmas, then Empty is -- returned. It is an error to call Last_Non_Pragma with a Node_Id or --- 135,148 ---- -- This function also skips N_Null nodes which can result from rewriting -- unrecognized or incorrect pragmas. ! function Last (List : List_Id) return Node_Or_Entity_Id; pragma Inline (Last); -- Obtains the last element of the given node list or, if the node list -- has no items, then Empty is returned. It is an error to call Last with -- a Node_Id or No_List. (No_List is not considered to be the same as an -- empty node list). ! function Last_Non_Pragma (List : List_Id) return Node_Or_Entity_Id; -- Obtains the last element of a given node list that is not a pragma. -- If the list is empty, or if it contains only pragmas, then Empty is -- returned. It is an error to call Last_Non_Pragma with a Node_Id or *************** package Nlists is *** 141,182 **** -- this function with No_List (No_List is not considered to be the same -- as an empty list). ! function Next (Node : Node_Id) return Node_Id; pragma Inline (Next); -- This function returns the next node on a node list, or Empty if Node is -- the last element of the node list. The argument must be a member of a -- node list. ! procedure Next (Node : in out Node_Id); pragma Inline (Next); -- Equivalent to Node := Next (Node); ! function Next_Non_Pragma (Node : Node_Id) return Node_Id; -- This function returns the next node on a node list, skipping past any -- pragmas, or Empty if there is no non-pragma entry left. The argument -- must be a member of a node list. This function also skips N_Null nodes -- which can result from rewriting unrecognized or incorrect pragmas. ! procedure Next_Non_Pragma (Node : in out Node_Id); pragma Inline (Next_Non_Pragma); -- Equivalent to Node := Next_Non_Pragma (Node); ! function Prev (Node : Node_Id) return Node_Id; pragma Inline (Prev); -- This function returns the previous node on a node list, or Empty -- if Node is the first element of the node list. The argument must be -- a member of a node list. Note: the implementation does maintain back -- pointers, so this function executes quickly in constant time. ! function Pick (List : List_Id; Index : Pos) return Node_Id; -- Given a list, picks out the Index'th entry (1 = first entry). The -- caller must ensure that Index is in range. ! procedure Prev (Node : in out Node_Id); pragma Inline (Prev); -- Equivalent to Node := Prev (Node); ! function Prev_Non_Pragma (Node : Node_Id) return Node_Id; pragma Inline (Prev_Non_Pragma); -- This function returns the previous node on a node list, skipping any -- pragmas. If Node is the first element of the list, or if the only --- 154,197 ---- -- this function with No_List (No_List is not considered to be the same -- as an empty list). ! function Next (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id; pragma Inline (Next); -- This function returns the next node on a node list, or Empty if Node is -- the last element of the node list. The argument must be a member of a -- node list. ! procedure Next (Node : in out Node_Or_Entity_Id); pragma Inline (Next); -- Equivalent to Node := Next (Node); ! function Next_Non_Pragma ! (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id; -- This function returns the next node on a node list, skipping past any -- pragmas, or Empty if there is no non-pragma entry left. The argument -- must be a member of a node list. This function also skips N_Null nodes -- which can result from rewriting unrecognized or incorrect pragmas. ! procedure Next_Non_Pragma (Node : in out Node_Or_Entity_Id); pragma Inline (Next_Non_Pragma); -- Equivalent to Node := Next_Non_Pragma (Node); ! function Prev (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id; pragma Inline (Prev); -- This function returns the previous node on a node list, or Empty -- if Node is the first element of the node list. The argument must be -- a member of a node list. Note: the implementation does maintain back -- pointers, so this function executes quickly in constant time. ! function Pick (List : List_Id; Index : Pos) return Node_Or_Entity_Id; -- Given a list, picks out the Index'th entry (1 = first entry). The -- caller must ensure that Index is in range. ! procedure Prev (Node : in out Node_Or_Entity_Id); pragma Inline (Prev); -- Equivalent to Node := Prev (Node); ! function Prev_Non_Pragma ! (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id; pragma Inline (Prev_Non_Pragma); -- This function returns the previous node on a node list, skipping any -- pragmas. If Node is the first element of the list, or if the only *************** package Nlists is *** 185,191 **** -- does maintain back pointers, so this function executes quickly in -- constant time. ! procedure Prev_Non_Pragma (Node : in out Node_Id); pragma Inline (Prev_Non_Pragma); -- Equivalent to Node := Prev_Non_Pragma (Node); --- 200,206 ---- -- does maintain back pointers, so this function executes quickly in -- constant time. ! procedure Prev_Non_Pragma (Node : in out Node_Or_Entity_Id); pragma Inline (Prev_Non_Pragma); -- Equivalent to Node := Prev_Non_Pragma (Node); *************** package Nlists is *** 199,221 **** -- This function determines if a given list id references a node list that -- contains at least one item. No_List as an argument returns False. ! function Is_List_Member (Node : Node_Id) return Boolean; pragma Inline (Is_List_Member); -- This function determines if a given node is a member of a node list. -- It is an error for Node to be Empty, or to be a node list. ! function List_Containing (Node : Node_Id) return List_Id; pragma Inline (List_Containing); -- This function provides a pointer to the node list containing Node. -- Node must be a member of a node list. ! procedure Append (Node : Node_Id; To : List_Id); -- Appends Node at the end of node list To. Node must be a non-empty node -- that is not already a member of a node list, and To must be a -- node list. An attempt to append an error node is ignored without -- complaint and the list is unchanged. ! procedure Append_To (To : List_Id; Node : Node_Id); pragma Inline (Append_To); -- Like Append, but arguments are the other way round --- 214,236 ---- -- This function determines if a given list id references a node list that -- contains at least one item. No_List as an argument returns False. ! function Is_List_Member (Node : Node_Or_Entity_Id) return Boolean; pragma Inline (Is_List_Member); -- This function determines if a given node is a member of a node list. -- It is an error for Node to be Empty, or to be a node list. ! function List_Containing (Node : Node_Or_Entity_Id) return List_Id; pragma Inline (List_Containing); -- This function provides a pointer to the node list containing Node. -- Node must be a member of a node list. ! procedure Append (Node : Node_Or_Entity_Id; To : List_Id); -- Appends Node at the end of node list To. Node must be a non-empty node -- that is not already a member of a node list, and To must be a -- node list. An attempt to append an error node is ignored without -- complaint and the list is unchanged. ! procedure Append_To (To : List_Id; Node : Node_Or_Entity_Id); pragma Inline (Append_To); -- Like Append, but arguments are the other way round *************** package Nlists is *** 227,274 **** pragma Inline (Append_List_To); -- Like Append_List, but arguments are the other way round ! procedure Insert_After (After : Node_Id; Node : Node_Id); -- Insert Node, which must be a non-empty node that is not already a -- member of a node list, immediately past node After, which must be a -- node that is currently a member of a node list. An attempt to insert -- an error node is ignored without complaint (and the list is unchanged). ! procedure Insert_List_After (After : Node_Id; List : List_Id); -- Inserts the entire contents of node list List immediately after node -- After, which must be a member of a node list. On return, the node list -- List is reset to be the empty node list. ! procedure Insert_Before (Before : Node_Id; Node : Node_Id); -- Insert Node, which must be a non-empty node that is not already a -- member of a node list, immediately before Before, which must be a node -- that is currently a member of a node list. An attempt to insert an -- error node is ignored without complaint (and the list is unchanged). ! procedure Insert_List_Before (Before : Node_Id; List : List_Id); -- Inserts the entire contents of node list List immediately before node -- Before, which must be a member of a node list. On return, the node list -- List is reset to be the empty node list. ! procedure Prepend (Node : Node_Id; To : List_Id); -- Prepends Node at the start of node list To. Node must be a non-empty -- node that is not already a member of a node list, and To must be a -- node list. An attempt to prepend an error node is ignored without -- complaint and the list is unchanged. ! procedure Prepend_To (To : List_Id; Node : Node_Id); pragma Inline (Prepend_To); -- Like Prepend, but arguments are the other way round ! procedure Remove (Node : Node_Id); -- Removes Node, which must be a node that is a member of a node list, -- from this node list. The contents of Node are not otherwise affected. ! function Remove_Head (List : List_Id) return Node_Id; -- Removes the head element of a node list, and returns the node (whose -- contents are not otherwise affected) as the result. If the node list -- is empty, then Empty is returned. ! function Remove_Next (Node : Node_Id) return Node_Id; -- Removes the item immediately following the given node, and returns it -- as the result. If Node is the last element of the list, then Empty is -- returned. Node must be a member of a list. Unlike Remove, Remove_Next --- 242,313 ---- pragma Inline (Append_List_To); -- Like Append_List, but arguments are the other way round ! procedure Insert_After ! (After : Node_Or_Entity_Id; ! Node : Node_Or_Entity_Id); -- Insert Node, which must be a non-empty node that is not already a -- member of a node list, immediately past node After, which must be a -- node that is currently a member of a node list. An attempt to insert -- an error node is ignored without complaint (and the list is unchanged). ! procedure Insert_List_After ! (After : Node_Or_Entity_Id; ! List : List_Id); -- Inserts the entire contents of node list List immediately after node -- After, which must be a member of a node list. On return, the node list -- List is reset to be the empty node list. ! procedure Insert_Before ! (Before : Node_Or_Entity_Id; ! Node : Node_Or_Entity_Id); -- Insert Node, which must be a non-empty node that is not already a -- member of a node list, immediately before Before, which must be a node -- that is currently a member of a node list. An attempt to insert an -- error node is ignored without complaint (and the list is unchanged). ! procedure Insert_List_Before ! (Before : Node_Or_Entity_Id; ! List : List_Id); -- Inserts the entire contents of node list List immediately before node -- Before, which must be a member of a node list. On return, the node list -- List is reset to be the empty node list. ! procedure Prepend ! (Node : Node_Or_Entity_Id; ! To : List_Id); -- Prepends Node at the start of node list To. Node must be a non-empty -- node that is not already a member of a node list, and To must be a -- node list. An attempt to prepend an error node is ignored without -- complaint and the list is unchanged. ! procedure Prepend_To ! (To : List_Id; ! Node : Node_Or_Entity_Id); pragma Inline (Prepend_To); -- Like Prepend, but arguments are the other way round ! procedure Prepend_List ! (List : List_Id; ! To : List_Id); ! -- Prepends node list List to the start of node list To. On return, ! -- List is reset to be empty. ! ! procedure Prepend_List_To ! (To : List_Id; ! List : List_Id); ! pragma Inline (Prepend_List_To); ! -- Like Prepend_List, but arguments are the other way round ! ! procedure Remove (Node : Node_Or_Entity_Id); -- Removes Node, which must be a node that is a member of a node list, -- from this node list. The contents of Node are not otherwise affected. ! function Remove_Head (List : List_Id) return Node_Or_Entity_Id; -- Removes the head element of a node list, and returns the node (whose -- contents are not otherwise affected) as the result. If the node list -- is empty, then Empty is returned. ! function Remove_Next (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id; -- Removes the item immediately following the given node, and returns it -- as the result. If Node is the last element of the list, then Empty is -- returned. Node must be a member of a list. Unlike Remove, Remove_Next *************** package Nlists is *** 294,306 **** -- Writes out internal tables to current tree file using the relevant -- Table.Tree_Write routines. ! function Parent (List : List_Id) return Node_Id; pragma Inline (Parent); -- Node lists may have a parent in the same way as a node. The function -- accesses the Parent value, which is either Empty when a list header -- is first created, or the value that has been set by Set_Parent. ! procedure Set_Parent (List : List_Id; Node : Node_Id); pragma Inline (Set_Parent); -- Sets the parent field of the given list to reference the given node --- 333,345 ---- -- Writes out internal tables to current tree file using the relevant -- Table.Tree_Write routines. ! function Parent (List : List_Id) return Node_Or_Entity_Id; pragma Inline (Parent); -- Node lists may have a parent in the same way as a node. The function -- accesses the Parent value, which is either Empty when a list header -- is first created, or the value that has been set by Set_Parent. ! procedure Set_Parent (List : List_Id; Node : Node_Or_Entity_Id); pragma Inline (Set_Parent); -- Sets the parent field of the given list to reference the given node *************** package Nlists is *** 314,320 **** -- Tests given Id for inequality with No_List. This allows notations like -- "if Present (Statements)" as opposed to "if Statements /= No_List". ! procedure Allocate_List_Tables (N : Node_Id); -- Called when nodes table is expanded to include node N. This call -- makes sure that list structures internal to Nlists are adjusted -- appropriately to reflect this increase in the size of the nodes table. --- 353,359 ---- -- Tests given Id for inequality with No_List. This allows notations like -- "if Present (Statements)" as opposed to "if Statements /= No_List". ! procedure Allocate_List_Tables (N : Node_Or_Entity_Id); -- Called when nodes table is expanded to include node N. This call -- makes sure that list structures internal to Nlists are adjusted -- appropriately to reflect this increase in the size of the nodes table. *************** package Nlists is *** 324,330 **** -- These functions return the addresses of the Next_Node and Prev_Node -- tables (used in Back_End for Gigi). ! function p (U : Union_Id) return Node_Id; -- This function is intended for use from the debugger, it determines -- whether U is a Node_Id or List_Id, and calls the appropriate Parent -- function and returns the parent Node in either case. This is shorter --- 363,369 ---- -- These functions return the addresses of the Next_Node and Prev_Node -- tables (used in Back_End for Gigi). ! function p (U : Union_Id) return Node_Or_Entity_Id; -- This function is intended for use from the debugger, it determines -- whether U is a Node_Id or List_Id, and calls the appropriate Parent -- function and returns the parent Node in either case. This is shorter diff -Nrcpad gcc-4.5.2/gcc/ada/opt.adb gcc-4.6.0/gcc/ada/opt.adb *** gcc-4.5.2/gcc/ada/opt.adb Mon Nov 30 11:55:21 2009 --- gcc-4.6.0/gcc/ada/opt.adb Mon Oct 18 14:05:56 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Opt is *** 50,55 **** --- 50,56 ---- Assume_No_Invalid_Values_Config := Assume_No_Invalid_Values; Check_Policy_List_Config := Check_Policy_List; Debug_Pragmas_Enabled_Config := Debug_Pragmas_Enabled; + Default_Pool_Config := Default_Pool; Dynamic_Elaboration_Checks_Config := Dynamic_Elaboration_Checks; Exception_Locations_Suppressed_Config := Exception_Locations_Suppressed; Extensions_Allowed_Config := Extensions_Allowed; *************** package body Opt is *** 61,66 **** --- 62,68 ---- Optimize_Alignment_Config := Optimize_Alignment; Persistent_BSS_Mode_Config := Persistent_BSS_Mode; Polling_Required_Config := Polling_Required; + Short_Descriptors_Config := Short_Descriptors; Use_VADS_Size_Config := Use_VADS_Size; -- Reset the indication that Optimize_Alignment was set locally, since *************** package body Opt is *** 82,87 **** --- 84,90 ---- Assume_No_Invalid_Values := Save.Assume_No_Invalid_Values; Check_Policy_List := Save.Check_Policy_List; Debug_Pragmas_Enabled := Save.Debug_Pragmas_Enabled; + Default_Pool := Save.Default_Pool; Dynamic_Elaboration_Checks := Save.Dynamic_Elaboration_Checks; Exception_Locations_Suppressed := Save.Exception_Locations_Suppressed; Extensions_Allowed := Save.Extensions_Allowed; *************** package body Opt is *** 94,99 **** --- 97,103 ---- Optimize_Alignment_Local := Save.Optimize_Alignment_Local; Persistent_BSS_Mode := Save.Persistent_BSS_Mode; Polling_Required := Save.Polling_Required; + Short_Descriptors := Save.Short_Descriptors; Use_VADS_Size := Save.Use_VADS_Size; end Restore_Opt_Config_Switches; *************** package body Opt is *** 109,114 **** --- 113,119 ---- Save.Assume_No_Invalid_Values := Assume_No_Invalid_Values; Save.Check_Policy_List := Check_Policy_List; Save.Debug_Pragmas_Enabled := Debug_Pragmas_Enabled; + Save.Default_Pool := Default_Pool; Save.Dynamic_Elaboration_Checks := Dynamic_Elaboration_Checks; Save.Exception_Locations_Suppressed := Exception_Locations_Suppressed; Save.Extensions_Allowed := Extensions_Allowed; *************** package body Opt is *** 121,126 **** --- 126,132 ---- Save.Optimize_Alignment_Local := Optimize_Alignment_Local; Save.Persistent_BSS_Mode := Persistent_BSS_Mode; Save.Polling_Required := Polling_Required; + Save.Short_Descriptors := Short_Descriptors; Save.Use_VADS_Size := Use_VADS_Size; end Save_Opt_Config_Switches; *************** package body Opt is *** 189,198 **** --- 195,206 ---- Use_VADS_Size := Use_VADS_Size_Config; end if; + Default_Pool := Default_Pool_Config; Exception_Locations_Suppressed := Exception_Locations_Suppressed_Config; Fast_Math := Fast_Math_Config; Optimize_Alignment := Optimize_Alignment_Config; Polling_Required := Polling_Required_Config; + Short_Descriptors := Short_Descriptors_Config; end Set_Opt_Config_Switches; --------------- *************** package body Opt is *** 223,228 **** --- 231,237 ---- Tree_Read_Bool (Assertions_Enabled); Tree_Read_Int (Int (Check_Policy_List)); Tree_Read_Bool (Debug_Pragmas_Enabled); + Tree_Read_Int (Int (Default_Pool)); Tree_Read_Bool (Enable_Overflow_Checks); Tree_Read_Bool (Full_List); *************** package body Opt is *** 288,293 **** --- 297,303 ---- Tree_Write_Bool (Assertions_Enabled); Tree_Write_Int (Int (Check_Policy_List)); Tree_Write_Bool (Debug_Pragmas_Enabled); + Tree_Write_Int (Int (Default_Pool)); Tree_Write_Bool (Enable_Overflow_Checks); Tree_Write_Bool (Full_List); Tree_Write_Int (Int (Version_String'Length)); diff -Nrcpad gcc-4.5.2/gcc/ada/opt.ads gcc-4.6.0/gcc/ada/opt.ads *** gcc-4.5.2/gcc/ada/opt.ads Mon Nov 30 14:24:04 2009 --- gcc-4.6.0/gcc/ada/opt.ads Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,51 **** --- 41,106 ---- with Hostparm; use Hostparm; with Types; use Types; + pragma Warnings (Off); + -- This package is used also by gnatcoll with System.Strings; use System.Strings; with System.WCh_Con; use System.WCh_Con; + pragma Warnings (On); package Opt is + ---------------------- + -- Checksum Control -- + ---------------------- + + -- Checksums are computed for sources to check for sources being the same + -- from a compilation point of view (e.g. spelling of identifiers and + -- white space layout do not count in this computation). + + -- The way the checksum is computed has evolved across the various versions + -- of GNAT. When gprbuild is called with -m, the checksums must be computed + -- the same way in gprbuild as it was in the GNAT version of the compiler. + -- The different ways are + + -- Version 6.4 and later: + + -- The Accumulate_Token_Checksum procedure is called after each numeric + -- literal and each identifier/keyword. For keywords, Tok_Identifier is + -- used in the call to Accumulate_Token_Checksum. + + -- Versions 5.04 to 6.3: + + -- For keywords, the token value were used in the call to procedure + -- Accumulate_Token_Checksum. Type Token_Type did not include Tok_Some. + + -- Versions 5.03: + + -- For keywords, the token value were used in the call to + -- Accumulate_Token_Checksum. Type Token_Type did not include + -- Tok_Interface, Tok_Overriding, Tok_Synchronized and Tok_Some. + + -- Versions 5.02 and before: + + -- No calls to procedure Accumulate_Token_Checksum (the checksum + -- mechanism was introduced in version 5.03). + + -- To signal to the scanner whether Accumulate_Token_Checksum needs to be + -- called and what versions to call, the following Boolean flags are used: + + Checksum_Accumulate_Token_Checksum : Boolean := True; + -- GPRBUILD + -- Set to False by gprbuild when the version of GNAT is 5.02 or before. If + -- this switch is False, then we do not call Accumulate_Token_Checksum, so + -- the setting of the following two flags is irrelevant. + + Checksum_GNAT_6_3 : Boolean := False; + -- GPRBUILD + -- Set to True by gprbuild when the version of GNAT is 6.3 or before. + + Checksum_GNAT_5_03 : Boolean := False; + -- GPRBUILD + -- Set to True by gprbuild when the version of GNAT is 5.03 or before. + ---------------------------------------------- -- Settings of Modes for Current Processing -- ---------------------------------------------- *************** package Opt is *** 61,77 **** -- GNATBIND, GNATLINK -- Set True if binder file to be generated in Ada rather than C ! type Ada_Version_Type is (Ada_83, Ada_95, Ada_05); ! pragma Warnings (Off, Ada_Version_Type); -- Versions of Ada for Ada_Version below. Note that these are ordered, -- so that tests like Ada_Version >= Ada_95 are legitimate and useful. ! -- The Warnings_Off pragma stops warnings for Ada_Version >= Ada_05, ! -- which we want to allow, so that things work OK when Ada_15 is added! ! -- This warning is now removed, so this pragma can be removed some time??? ! Ada_Version_Default : Ada_Version_Type := Ada_05; -- GNAT ! -- Default Ada version if no switch given Ada_Version : Ada_Version_Type := Ada_Version_Default; -- GNAT --- 116,136 ---- -- GNATBIND, GNATLINK -- Set True if binder file to be generated in Ada rather than C ! type Ada_Version_Type is (Ada_83, Ada_95, Ada_2005, Ada_2012); ! pragma Ordered (Ada_Version_Type); -- Versions of Ada for Ada_Version below. Note that these are ordered, -- so that tests like Ada_Version >= Ada_95 are legitimate and useful. ! -- Think twice before using "="; Ada_Version >= Ada_2012 is more likely ! -- what you want, because it will apply to future versions of the language. ! Ada_Version_Default : constant Ada_Version_Type := Ada_2005; ! pragma Warnings (Off, Ada_Version_Default); -- GNAT ! -- Default Ada version if no switch given. The Warnings off is to kill ! -- constant condition warnings. ! -- ! -- WARNING: some scripts rely on the format of this line of code. Any ! -- change must be coordinated with the scripts requirements. Ada_Version : Ada_Version_Type := Ada_Version_Default; -- GNAT *************** package Opt is *** 88,94 **** -- the rare cases (notably for pragmas Preelaborate_05 and Pure_05) -- where in the run-time we want the explicit version set. ! Ada_Version_Runtime : Ada_Version_Type := Ada_05; -- GNAT -- Ada version used to compile the runtime. Used to set Ada_Version (but -- not Ada_Version_Explicit) when compiling predefined or internal units. --- 147,153 ---- -- the rare cases (notably for pragmas Preelaborate_05 and Pure_05) -- where in the run-time we want the explicit version set. ! Ada_Version_Runtime : Ada_Version_Type := Ada_2012; -- GNAT -- Ada version used to compile the runtime. Used to set Ada_Version (but -- not Ada_Version_Explicit) when compiling predefined or internal units. *************** package Opt is *** 172,177 **** --- 231,245 ---- -- also set true if certain Unchecked_Conversion instantiations require -- checking based on annotated values. + Back_End_Handles_Limited_Types : Boolean; + -- This flag is set true if the back end can properly handle limited or + -- other by reference types, and avoid copies. If this flag is False, then + -- the front end does special expansion for conditional expressions to make + -- sure that no copy occurs. If the flag is True, then the expansion for + -- conditional expressions relies on the back end properly handling things. + -- Currently the default is False for all cases (set in gnat1drv). The + -- default can be modified using -gnatd.L (sets the flag True). + Bind_Alternate_Main_Name : Boolean := False; -- GNATBIND -- True if main should be called Alternate_Main_Name.all. *************** package Opt is *** 183,190 **** Bind_For_Library : Boolean := False; -- GNATBIND ! -- Set to True if the binder needs to generate a file designed for ! -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg. Bind_Only : Boolean := False; -- GNATMAKE, GPRMAKE, GPRBUILD --- 251,258 ---- Bind_For_Library : Boolean := False; -- GNATBIND ! -- Set to True if the binder needs to generate a file designed for building ! -- a library. May be set to True by Gnatbind.Scan_Bind_Arg. Bind_Only : Boolean := False; -- GNATMAKE, GPRMAKE, GPRBUILD *************** package Opt is *** 224,230 **** -- 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 --- 292,301 ---- -- 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. Note ! -- that Push_Scope and Pop_Scope in Sem_Ch8 save and restore the value ! -- of this variable, implementing the required scope control for pragmas ! -- appearing a declarative part. Check_Readonly_Files : Boolean := False; -- GNATMAKE *************** package Opt is *** 340,345 **** --- 411,426 ---- -- default was set by the binder, and that the default should be the -- initial value of System.Secondary_Stack.Default_Secondary_Stack_Size. + Default_Pool : Node_Id := Empty; + -- GNAT + -- Used to record the storage pool name (or null literal) that is the + -- argument of an applicable pragma Default_Storage_Pool. + -- Empty: No pragma Default_Storage_Pool applies. + -- N_Null node: "pragma Default_Storage_Pool (null);" applies. + -- otherwise: "pragma Default_Storage_Pool (X);" applies, and + -- this points to the name X. + -- Push_Scope and Pop_Scope in Sem_Ch8 save and restore this value. + Detect_Blocking : Boolean := False; -- GNAT -- Set True to force the run time to raise Program_Error if calls to *************** package Opt is *** 425,434 **** -- It is used to set Warn_On_Exception_Propagation True if the restriction -- No_Exception_Propagation is set. Exception_Locations_Suppressed : Boolean := False; -- GNAT ! -- This flag is set True if a Suppress_Exception_Locations configuration ! -- pragma is currently active. type Exception_Mechanism_Type is -- Determines the handling of exceptions. See Exp_Ch11 for details --- 506,521 ---- -- It is used to set Warn_On_Exception_Propagation True if the restriction -- No_Exception_Propagation is set. + Exception_Extra_Info : Boolean := False; + -- GNAT + -- True when switch -gnateE is used. When True, generate extra information + -- associated with exception messages (in particular range and index + -- checks). + Exception_Locations_Suppressed : Boolean := False; -- GNAT ! -- Set to True if a Suppress_Exception_Locations configuration pragma is ! -- currently active. type Exception_Mechanism_Type is -- Determines the handling of exceptions. See Exp_Ch11 for details *************** package Opt is *** 450,457 **** Front_End_Setjmp_Longjmp_Exceptions; -- GNAT -- Set to the appropriate value depending on the default as given in ! -- system.ads (ZCX_By_Default, GCC_ZCX_Support). ! -- The C convention is there to make this variable accessible to gigi. Exception_Tracebacks : Boolean := False; -- GNATBIND --- 537,544 ---- Front_End_Setjmp_Longjmp_Exceptions; -- GNAT -- Set to the appropriate value depending on the default as given in ! -- system.ads (ZCX_By_Default, GCC_ZCX_Support). The C convention is there ! -- to make this variable accessible to gigi. Exception_Tracebacks : Boolean := False; -- GNATBIND *************** package Opt is *** 570,575 **** --- 657,667 ---- -- GNAT -- True if compiling in GNAT system mode (-gnatg switch) + Heap_Size : Nat := 0; + -- GNATBIND + -- Heap size for memory allocations. Valid values are 32 and 64. Only + -- available on VMS. + HLO_Active : Boolean := False; -- GNAT -- True if High Level Optimizer is activated (-gnatH switch) *************** package Opt is *** 705,710 **** --- 797,807 ---- -- Set to True to skip compile and bind steps (except when Bind_Only is -- set to True). + List_Inherited_Aspects : Boolean := True; + -- GNAT + -- List inherited invariants, preconditions, and postconditions from + -- Invariant'Class, Pre'Class, and Post'Class aspects. + List_Restrictions : Boolean := False; -- GNATBIND -- Set to True to list restrictions pragmas that could apply to partition *************** package Opt is *** 888,893 **** --- 985,996 ---- -- GNATMAKE -- Set to True when an object directory is specified with option -D + One_Compilation_Per_Obj_Dir : Boolean := False; + -- GNATMAKE, GPRBUILD + -- Set to True with switch --single-compile-per-obj-dir. When True, there + -- cannot be simultaneous compilations with the object files in the same + -- object directory, if project files are used. + type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code); Operating_Mode : Operating_Mode_Type := Generate_Code; -- GNAT *************** package Opt is *** 939,947 **** -- GNATBIND -- True if output of list of linker options is requested (-K switch set) ! Output_Object_List : Boolean := False; -- GNATBIND ! -- True if output of list of objects is requested (-O switch set) Overflow_Checks_Unsuppressed : Boolean := False; -- GNAT --- 1042,1058 ---- -- GNATBIND -- True if output of list of linker options is requested (-K switch set) ! Output_ALI_List : Boolean := False; ! ALI_List_Filename : String_Ptr; -- GNATBIND ! -- True if output of list of ALIs is requested (-A switch set). List is ! -- output under the given filename, or standard output if not specified. ! ! Output_Object_List : Boolean := False; ! Object_List_Filename : String_Ptr; ! -- GNATBIND ! -- True if output of list of objects is requested (-O switch set). List is ! -- output under the given filename, or standard output if not specified. Overflow_Checks_Unsuppressed : Boolean := False; -- GNAT *************** package Opt is *** 1052,1058 **** --- 1163,1174 ---- -- GNAT -- Set True if a pragma Short_Circuit_And_Or applies to the current unit. + Short_Descriptors : Boolean := False; + -- GNAT + -- Set True if a pragma Short_Descriptors applies to the current unit. + Sprint_Line_Limit : Nat := 72; + -- GNAT -- Limit values for chopping long lines in Sprint output, can be reset -- by use of NNN parameter with -gnatG or -gnatD switches. *************** package Opt is *** 1166,1171 **** --- 1282,1292 ---- -- Tolerate time stamp and other consistency errors. If this flag is set to -- True (-t), then inconsistencies result in warnings rather than errors. + Treat_Categorization_Errors_As_Warnings : Boolean := False; + -- Normally categorization errors are true illegalities. If this switch + -- is set, then such errors result in warning messages rather than error + -- messages. Set True by -gnateP (P for Pure/Preelaborate). + Treat_Restrictions_As_Warnings : Boolean := False; -- GNAT -- Set True to treat pragma Restrictions as Restriction_Warnings. Set by *************** package Opt is *** 1226,1236 **** --- 1347,1369 ---- -- set True, and upper half characters in the source indicate the start of -- a wide character sequence. Set by -gnatW or -W switches. + Use_Include_Path_File : Boolean := False; + -- GNATMAKE, GPRBUILD + -- When True, create a source search path file, even when a mapping file + -- is used. + Usage_Requested : Boolean := False; -- GNAT, GNATBIND, GNATMAKE -- Set to True if -h (-gnath for the compiler) switch encountered -- requesting usage information + Use_Expression_With_Actions : Boolean; + -- The N_Expression_With_Actions node has been introduced relatively + -- recently, and not all back ends are prepared to handle it yet. So + -- we use this flag to suppress its use during a transitional period. + -- Currently the default is False for all cases (set in gnat1drv). + -- The default can be modified using -gnatd.X/-gnatd.Y. + Use_Pragma_Linker_Constructor : Boolean := False; -- GNATBIND -- True if pragma Linker_Constructor applies to adainit *************** package Opt is *** 1257,1262 **** --- 1390,1396 ---- -- information sent to standard output, also header, copyright and summary) type Verbosity_Level_Type is (None, Low, Medium, High); + pragma Ordered (Verbosity_Level_Type); Verbosity_Level : Verbosity_Level_Type := High; -- GNATMAKE, GPRMAKE -- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates *************** package Opt is *** 1277,1287 **** -- 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 --- 1411,1428 ---- -- including warnings on Ada 2005 obsolescent features used in Ada 2005 -- mode. Set False by -gnatwY. ! Warn_On_Ada_2012_Compatibility : Boolean := True; -- GNAT ! -- Set to True to generate all warnings on Ada 2012 compatibility issues, ! -- including warnings on Ada 2012 obsolescent features used in Ada 2012 ! -- mode. Set False by -gnatwY. ! ! Warn_On_All_Unread_Out_Parameters : Boolean := False; ! -- GNAT ! -- Set to True to generate warnings in all cases where a variable is ! -- modified by being passed as to an OUT formal, but the resulting value is ! -- never read. The default is that this warning is suppressed, except in ! -- the case of Warn_On_Assertion_Failure : Boolean := True; -- GNAT *************** package Opt is *** 1338,1350 **** -- but only if there is only one out parameter for the procedure involved. -- The default is that this warning is suppressed. - Warn_On_All_Unread_Out_Parameters : Boolean := False; - -- GNAT - -- Set to True to generate warnings in all cases where a variable is - -- modified by being passed as to an OUT formal, but the resulting value is - -- never read. The default is that this warning is suppressed, except in - -- the case of - Warn_On_No_Value_Assigned : Boolean := True; -- GNAT -- Set to True to generate warnings if no value is ever assigned to a --- 1479,1484 ---- *************** package Opt is *** 1366,1371 **** --- 1500,1510 ---- -- use this to avoid turning it on by default when No_Exception_Propagation -- restriction is set and an exception handler is present. + Warn_On_Object_Renames_Function : Boolean := False; + -- GNAT + -- Set to True to generate warnings when a function result is renamed as + -- an object. The default is that this warning is disabled. + Warn_On_Obsolescent_Feature : Boolean := False; -- GNAT -- Set to True to generate warnings on use of any feature in Annex or if a *************** package Opt is *** 1381,1396 **** -- Set to True to generate warnings for cases where parentheses are missing -- and the usage is questionable, because the intent is unclear. Warn_On_Redundant_Constructs : Boolean := False; -- GNAT -- Set to True to generate warnings for redundant constructs (e.g. useless -- assignments/conversions). The default is that this warning is disabled. - Warn_On_Object_Renames_Function : Boolean := False; - -- GNAT - -- Set to True to generate warnings when a function result is renamed as - -- an object. The default is that this warning is disabled. - Warn_On_Reverse_Bit_Order : Boolean := True; -- GNAT -- Set to True to generate warning (informational) messages for component --- 1520,1536 ---- -- Set to True to generate warnings for cases where parentheses are missing -- and the usage is questionable, because the intent is unclear. + 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_Redundant_Constructs : Boolean := False; -- GNAT -- Set to True to generate warnings for redundant constructs (e.g. useless -- assignments/conversions). The default is that this warning is disabled. Warn_On_Reverse_Bit_Order : Boolean := True; -- GNAT -- Set to True to generate warning (informational) messages for component *************** package Opt is *** 1408,1413 **** --- 1548,1560 ---- -- non-portable semantics (e.g. because sizes of types differ). The default -- is that this warning is enabled. + Warn_On_Unordered_Enumeration_Type : Boolean := False; + -- GNAT + -- Set to True to generate warnings for inappropriate uses (comparisons + -- and explicit ranges) on unordered enumeration types (which includes + -- all enumeration types for which pragma Ordered is not given). The + -- default is that this warning is disabled. + Warn_On_Unrecognized_Pragma : Boolean := True; -- GNAT -- Set to True to generate warnings for unrecognized pragmas. The default *************** package Opt is *** 1511,1516 **** --- 1658,1668 ---- -- mode, as possibly set by the command line switch -gnata and possibly -- modified by the use of the configuration pragma Debug_Policy. + Default_Pool_Config : Node_Id := Empty; + -- GNAT + -- Same as Default_Pool above, except this is only for Default_Storage_Pool + -- pragmas that are configuration pragmas. + Dynamic_Elaboration_Checks_Config : Boolean := False; -- GNAT -- Set True for dynamic elaboration checking mode, as set by the -gnatE *************** package Opt is *** 1594,1599 **** --- 1746,1759 ---- -- flag is used to set the initial value for Polling_Required at the start -- of analyzing each unit. + Short_Descriptors_Config : Boolean; + -- GNAT + -- This is the value of the configuration switch that controls the use of + -- Short_Descriptors for setting descriptor default sizes. It can be set + -- True by the use of the pragma Short_Descriptors in the gnat.adc file. + -- This flag is used to set the initial value for Short_Descriptors at the + -- start of analyzing each unit. + Use_VADS_Size_Config : Boolean; -- GNAT -- This is the value of the configuration switch that controls the use of *************** private *** 1711,1716 **** --- 1871,1877 ---- Assume_No_Invalid_Values : Boolean; Check_Policy_List : Node_Id; Debug_Pragmas_Enabled : Boolean; + Default_Pool : Node_Id; Dynamic_Elaboration_Checks : Boolean; Exception_Locations_Suppressed : Boolean; Extensions_Allowed : Boolean; *************** private *** 1723,1728 **** --- 1884,1890 ---- Optimize_Alignment_Local : Boolean; Persistent_BSS_Mode : Boolean; Polling_Required : Boolean; + Short_Descriptors : Boolean; Use_VADS_Size : Boolean; end record; diff -Nrcpad gcc-4.5.2/gcc/ada/osint-b.adb gcc-4.6.0/gcc/ada/osint-b.adb *** gcc-4.5.2/gcc/ada/osint-b.adb Tue Apr 7 15:01:27 2009 --- gcc-4.6.0/gcc/ada/osint-b.adb Tue Jun 22 09:46:58 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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,33 **** --- 24,36 ---- ------------------------------------------------------------------------------ with Opt; use Opt; + with Output; use Output; with Targparm; use Targparm; package body Osint.B is + Current_List_File : File_Descriptor := Invalid_FD; + ------------------------- -- Close_Binder_Output -- ------------------------- *************** package body Osint.B is *** 45,50 **** --- 48,66 ---- end Close_Binder_Output; + --------------------- + -- Close_List_File -- + --------------------- + + procedure Close_List_File is + begin + if Current_List_File /= Invalid_FD then + Close (Current_List_File); + Current_List_File := Invalid_FD; + Set_Standard_Output; + end if; + end Close_List_File; + -------------------------- -- Create_Binder_Output -- -------------------------- *************** package body Osint.B is *** 65,72 **** begin if Output_File_Name /= "" then ! Name_Buffer (Output_File_Name'Range) := Output_File_Name; ! Name_Buffer (Output_File_Name'Last + 1) := ASCII.NUL; if Typ = 's' then Name_Buffer (Output_File_Name'Last) := 's'; --- 81,88 ---- begin if Output_File_Name /= "" then ! Name_Buffer (1 .. Output_File_Name'Length) := Output_File_Name; ! Name_Buffer (Output_File_Name'Length + 1) := ASCII.NUL; if Typ = 's' then Name_Buffer (Output_File_Name'Last) := 's'; *************** package body Osint.B is *** 176,181 **** --- 192,213 ---- Current_File_Name_Index := To; end Set_Current_File_Name_Index; + ------------------- + -- Set_List_File -- + ------------------- + + procedure Set_List_File (Filename : String) is + begin + pragma Assert (Current_List_File = Invalid_FD); + Current_List_File := Create_File (Filename, Text); + + if Current_List_File = Invalid_FD then + Fail ("cannot create list file: " & Filename); + else + Set_Output (Current_List_File); + end if; + end Set_List_File; + ----------------------- -- Write_Binder_Info -- ----------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/osint-b.ads gcc-4.6.0/gcc/ada/osint-b.ads *** gcc-4.5.2/gcc/ada/osint-b.ads Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/osint-b.ads Tue Jun 22 09:36:25 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package Osint.B is *** 44,52 **** -- Binder Output -- ------------------- ! -- These routines are used by the binder to generate the C source file ! -- containing the binder output. The format of this file is described ! -- in the package Bindfmt. procedure Create_Binder_Output (Output_File_Name : String; --- 44,52 ---- -- Binder Output -- ------------------- ! -- These routines are used by the binder to generate the C or Ada source ! -- files containing the binder output. The format of these files is ! -- described in package Bindgen. procedure Create_Binder_Output (Output_File_Name : String; *************** package Osint.B is *** 81,84 **** --- 81,96 ---- procedure Set_Current_File_Name_Index (To : Int); -- Set value of Current_File_Name_Index (in private part of Osint) to To + ---------------------------------- + -- Other binder-generated files -- + ---------------------------------- + + procedure Set_List_File (Filename : String); + -- Create Filename as a text output file and set it as the current output + -- (see Output.Set_Output). + + procedure Close_List_File; + -- If a specific output file was created by Set_List_File, close it and + -- reset the current output file to standard output. + end Osint.B; diff -Nrcpad gcc-4.5.2/gcc/ada/osint.adb gcc-4.6.0/gcc/ada/osint.adb *** gcc-4.5.2/gcc/ada/osint.adb Mon Nov 30 14:19:48 2009 --- gcc-4.6.0/gcc/ada/osint.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,45 **** -- -- ------------------------------------------------------------------------------ with Unchecked_Conversion; with System.Case_Util; use System.Case_Util; with GNAT.HTable; - with Alloc; - with Debug; - with Fmap; use Fmap; - with Gnatvsn; use Gnatvsn; - with Hostparm; - with Opt; use Opt; - with Output; use Output; - with Sdefault; use Sdefault; - with Table; - with Targparm; use Targparm; - package body Osint is Running_Program : Program_Type := Unspecified; --- 23,48 ---- -- -- ------------------------------------------------------------------------------ + with Alloc; + with Debug; + with Fmap; use Fmap; + with Gnatvsn; use Gnatvsn; + with Hostparm; + with Opt; use Opt; + with Output; use Output; + with Sdefault; use Sdefault; + with Table; + with Targparm; use Targparm; + with Unchecked_Conversion; + pragma Warnings (Off); + -- This package is used also by gnatcoll with System.Case_Util; use System.Case_Util; + pragma Warnings (On); with GNAT.HTable; package body Osint is Running_Program : Program_Type := Unspecified; *************** package body Osint is *** 538,544 **** end loop; end if; ! if not Opt.No_Stdlib and not Opt.RTS_Switch then Search_Path := Read_Default_Search_Dirs (String_Access (Update_Path (Search_Dir_Prefix)), --- 541,551 ---- end loop; end if; ! -- Even when -nostdlib is used, we still want to have visibility on ! -- the run-time object directory, as it is used by gnatbind to find ! -- the run-time ALI files in "real" ZFP set up. ! ! if not Opt.RTS_Switch then Search_Path := Read_Default_Search_Dirs (String_Access (Update_Path (Search_Dir_Prefix)), *************** package body Osint is *** 681,703 **** -- Canonical_Case_File_Name -- ------------------------------ - -- For now, we only deal with the case of a-z. Eventually we should - -- worry about other Latin-1 letters on systems that support this ??? - procedure Canonical_Case_File_Name (S : in out String) is begin if not File_Names_Case_Sensitive then ! for J in S'Range loop ! if S (J) in 'A' .. 'Z' then ! S (J) := Character'Val ( ! Character'Pos (S (J)) + ! Character'Pos ('a') - ! Character'Pos ('A')); ! end if; ! end loop; end if; end Canonical_Case_File_Name; --------------------------- -- Create_File_And_Check -- --------------------------- --- 688,711 ---- -- Canonical_Case_File_Name -- ------------------------------ procedure Canonical_Case_File_Name (S : in out String) is begin if not File_Names_Case_Sensitive then ! To_Lower (S); end if; end Canonical_Case_File_Name; + --------------------------------- + -- Canonical_Case_Env_Var_Name -- + --------------------------------- + + procedure Canonical_Case_Env_Var_Name (S : in out String) is + begin + if not Env_Vars_Case_Sensitive then + To_Lower (S); + end if; + end Canonical_Case_Env_Var_Name; + --------------------------- -- Create_File_And_Check -- --------------------------- *************** package body Osint is *** 1155,1161 **** begin -- If we are looking for a config file, look only in the current -- directory, i.e. return input argument unchanged. Also look only in ! -- the curren directory if we are looking for a .dg file (happens in -- -gnatD mode). if T = Config --- 1163,1169 ---- begin -- If we are looking for a config file, look only in the current -- directory, i.e. return input argument unchanged. Also look only in ! -- the current directory if we are looking for a .dg file (happens in -- -gnatD mode). if T = Config *************** package body Osint is *** 2500,2505 **** --- 2508,2520 ---- return null; end if; + + elsif Current_Full_Obj_Stamp < Current_Full_Lib_Stamp then + Close (Lib_FD, Status); + + -- No need to check the status, we return null anyway + + return null; end if; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/osint.ads gcc-4.6.0/gcc/ada/osint.ads *** gcc-4.5.2/gcc/ada/osint.ads Mon Nov 30 15:16:49 2009 --- gcc-4.6.0/gcc/ada/osint.ads Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,47 **** with Namet; use Namet; with Types; use Types; - with System.Storage_Elements; - with System.OS_Lib; use System.OS_Lib; with System; use System; pragma Elaborate_All (System.OS_Lib); -- For the call to function Get_Target_Object_Suffix in the private part package Osint is Multi_Unit_Index_Character : Character := '~'; ! -- The character before the index of the unit in a multi-unit source, in ! -- ALI and object file names. This is not a constant, because it is changed ! -- to '$' on VMS. Ada_Include_Path : constant String := "ADA_INCLUDE_PATH"; Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH"; --- 29,51 ---- with Namet; use Namet; with Types; use Types; with System; use System; + pragma Warnings (Off); + -- This package is used also by gnatcoll + with System.OS_Lib; use System.OS_Lib; + pragma Warnings (On); + + with System.Storage_Elements; + pragma Elaborate_All (System.OS_Lib); -- For the call to function Get_Target_Object_Suffix in the private part package Osint is Multi_Unit_Index_Character : Character := '~'; ! -- The character before the index of the unit in a multi-unit source in ALI ! -- and object file names. Changed to '$' on VMS. Ada_Include_Path : constant String := "ADA_INCLUDE_PATH"; Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH"; *************** package Osint is *** 80,86 **** Get_File_Names_Case_Sensitive /= 0; -- Set to indicate whether the operating system convention is for file -- names to be case sensitive (e.g., in Unix, set True), or non case ! -- sensitive (e.g., in OS/2, set False). procedure Canonical_Case_File_Name (S : in out String); -- Given a file name, converts it to canonical case form. For systems --- 84,90 ---- Get_File_Names_Case_Sensitive /= 0; -- Set to indicate whether the operating system convention is for file -- names to be case sensitive (e.g., in Unix, set True), or non case ! -- sensitive (e.g., in Windows, set False). procedure Canonical_Case_File_Name (S : in out String); -- Given a file name, converts it to canonical case form. For systems *************** package Osint is *** 90,95 **** --- 94,116 ---- -- this call converts the given string to canonical all lower case form, -- so that two file names compare equal if they refer to the same file. + function Get_Env_Vars_Case_Sensitive return Int; + pragma Import (C, Get_Env_Vars_Case_Sensitive, + "__gnat_get_env_vars_case_sensitive"); + Env_Vars_Case_Sensitive : constant Boolean := + Get_Env_Vars_Case_Sensitive /= 0; + -- Set to indicate whether the operating system convention is for + -- environment variable names to be case sensitive (e.g., in Unix, set + -- True), or non case sensitive (e.g., in Windows, set False). + + procedure Canonical_Case_Env_Var_Name (S : in out String); + -- Given an environment variable name, converts it to canonical case form. + -- For systems where environment variable names are case sensitive, this + -- procedure has no effect. If environment variable names are not case + -- sensitive, then this call converts the given string to canonical all + -- lower case form, so that two environment variable names compare equal if + -- they refer to the same environment variable. + function Number_Of_Files return Int; -- Gives the total number of filenames found on the command line diff -Nrcpad gcc-4.5.2/gcc/ada/output.adb gcc-4.6.0/gcc/ada/output.adb *** gcc-4.5.2/gcc/ada/output.adb Wed Jul 15 10:15:49 2009 --- gcc-4.6.0/gcc/ada/output.adb Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,36 **** -- -- ------------------------------------------------------------------------------ - with System.OS_Lib; use System.OS_Lib; - package body Output is Current_FD : File_Descriptor := Standout; --- 29,34 ---- *************** package body Output is *** 131,138 **** else declare ! Indented_Buffer : constant String ! := (1 .. Cur_Indentation => ' ') & Buffer (1 .. Len); begin Write_Buffer (Indented_Buffer); end; --- 129,137 ---- else declare ! Indented_Buffer : constant String := ! (1 .. Cur_Indentation => ' ') & ! Buffer (1 .. Len); begin Write_Buffer (Indented_Buffer); end; *************** package body Output is *** 140,148 **** exception when Write_Error => ! -- If there are errors with standard error, just quit. ! -- Otherwise, set the output to standard error before reporting ! -- a failure and quitting. if Current_FD /= Standerr then Current_FD := Standerr; --- 139,148 ---- exception when Write_Error => ! ! -- If there are errors with standard error just quit. Otherwise ! -- set the output to standard error before reporting a failure ! -- and quitting. if Current_FD /= Standerr then Current_FD := Standerr; *************** package body Output is *** 228,244 **** Special_Output_Proc := P; end Set_Special_Output; ! ------------------------ ! -- Set_Standard_Error -- ! ------------------------ ! procedure Set_Standard_Error is begin if Special_Output_Proc = null then Flush_Buffer; end if; ! Current_FD := Standerr; end Set_Standard_Error; ------------------------- --- 228,253 ---- Special_Output_Proc := P; end Set_Special_Output; ! ---------------- ! -- Set_Output -- ! ---------------- ! procedure Set_Output (FD : File_Descriptor) is begin if Special_Output_Proc = null then Flush_Buffer; end if; ! Current_FD := FD; ! end Set_Output; ! ! ------------------------ ! -- Set_Standard_Error -- ! ------------------------ ! ! procedure Set_Standard_Error is ! begin ! Set_Output (Standerr); end Set_Standard_Error; ------------------------- *************** package body Output is *** 247,257 **** procedure Set_Standard_Output is begin ! if Special_Output_Proc = null then ! Flush_Buffer; ! end if; ! ! Current_FD := Standout; end Set_Standard_Output; ------- --- 256,262 ---- procedure Set_Standard_Output is begin ! Set_Output (Standout); end Set_Standard_Output; ------- diff -Nrcpad gcc-4.5.2/gcc/ada/output.ads gcc-4.6.0/gcc/ada/output.ads *** gcc-4.5.2/gcc/ada/output.ads Tue Jul 7 12:42:43 2009 --- gcc-4.6.0/gcc/ada/output.ads Tue Jun 22 13:26:32 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,70 **** -- -- ------------------------------------------------------------------------------ ! -- This package contains low level output routines used by the compiler ! -- for writing error messages and informational output. It is also used ! -- by the debug source file output routines (see Sprintf.Print_Eol). with Hostparm; use Hostparm; with Types; use Types; package Output is pragma Elaborate_Body; type Output_Proc is access procedure (S : String); ! -- This type is used for the Set_Special_Output procedure. If this ! -- procedure is called, then instead of lines being written to ! -- standard error or standard output, a call is made to the given ! -- procedure for each line, passing the line with an end of line ! -- character (which is a single ASCII.LF character, even in systems ! -- which normally use CR/LF or some other sequence for line end). ----------------- -- Subprograms -- ----------------- procedure Set_Special_Output (P : Output_Proc); ! -- Sets subsequent output to call procedure P. If P is null, then ! -- the call cancels the effect of a previous call, reverting the ! -- output to standard error or standard output depending on the ! -- mode at the time of previous call. Any exception generated by ! -- by calls to P is simply propagated to the caller of the routine ! -- causing the write operation. procedure Cancel_Special_Output; ! -- Cancels the effect of a call to Set_Special_Output, if any. ! -- The output is then directed to standard error or standard output ! -- depending on the last call to Set_Standard_Error or Set_Standard_Output. ! -- It is never an error to call Cancel_Special_Output. It has the same ! -- effect as calling Set_Special_Output (null). procedure Ignore_Output (S : String); -- Does nothing. To disable output, pass Ignore_Output'Access to --- 29,74 ---- -- -- ------------------------------------------------------------------------------ ! -- This package contains low level output routines used by the compiler for ! -- writing error messages and informational output. It is also used by the ! -- debug source file output routines (see Sprint.Print_Debug_Line). with Hostparm; use Hostparm; with Types; use Types; + pragma Warnings (Off); + -- This package is used also by gnatcoll + with System.OS_Lib; use System.OS_Lib; + pragma Warnings (On); + package Output is pragma Elaborate_Body; type Output_Proc is access procedure (S : String); ! -- This type is used for the Set_Special_Output procedure. If Output_Proc ! -- is called, then instead of lines being written to standard error or ! -- standard output, a call is made to the given procedure for each line, ! -- passing the line with an end of line character (which is a single ! -- ASCII.LF character, even in systems which normally use CR/LF or some ! -- other sequence for line end). ----------------- -- Subprograms -- ----------------- procedure Set_Special_Output (P : Output_Proc); ! -- Sets subsequent output to call procedure P. If P is null, then the call ! -- cancels the effect of a previous call, reverting the output to standard ! -- error or standard output depending on the mode at the time of previous ! -- call. Any exception generated by by calls to P is simply propagated to ! -- the caller of the routine causing the write operation. procedure Cancel_Special_Output; ! -- Cancels the effect of a call to Set_Special_Output, if any. The output ! -- is then directed to standard error or standard output depending on the ! -- last call to Set_Standard_Error or Set_Standard_Output. It is never an ! -- error to call Cancel_Special_Output. It has the same effect as calling ! -- Set_Special_Output (null). procedure Ignore_Output (S : String); -- Does nothing. To disable output, pass Ignore_Output'Access to *************** package Output is *** 79,89 **** procedure Set_Standard_Output; -- Sets subsequent output to appear on the standard output file (whatever ! -- that might mean for the host operating system, if anything) when ! -- no special output is in effect. When a special output is in effect, ! -- the output will appear on standard output only after special output ! -- has been cancelled. Output to standard output is the default mode ! -- before any call to either of the Set procedures. procedure Indent; -- Increases the current indentation level. Whenever a line is written --- 83,99 ---- procedure Set_Standard_Output; -- Sets subsequent output to appear on the standard output file (whatever ! -- that might mean for the host operating system, if anything) when no ! -- special output is in effect. When a special output is in effect, the ! -- output will appear on standard output only after special output has been ! -- cancelled. Output to standard output is the default mode before any call ! -- to either of the Set procedures. ! ! procedure Set_Output (FD : File_Descriptor); ! -- Sets subsequent output to appear on the given file descriptor when no ! -- special output is in effect. When a special output is in effect, the ! -- output will appear on the given file descriptor only after special ! -- output has been cancelled. procedure Indent; -- Increases the current indentation level. Whenever a line is written *************** package Output is *** 101,136 **** -- If last character in buffer matches C, erase it, otherwise no effect procedure Write_Eol; ! -- Write an end of line (whatever is required by the system in use, ! -- e.g. CR/LF for DOS, or LF for Unix) to the standard output file. ! -- This routine also empties the line buffer, actually writing it ! -- to the file. Note that Write_Eol is the only routine that causes ! -- any actual output to be written. Trailing spaces are removed. procedure Write_Eol_Keep_Blanks; -- Similar as Write_Eol, except that trailing spaces are not removed procedure Write_Int (Val : Int); ! -- Write an integer value with no leading blanks or zeroes. Negative ! -- values are preceded by a minus sign). procedure Write_Spaces (N : Nat); -- Write N spaces procedure Write_Str (S : String); -- Write a string of characters to the standard output file. Note that ! -- end of line is normally handled separately using WRITE_EOL, but it ! -- is allowed for the string to contain LF (but not CR) characters, ! -- which are properly interpreted as end of line characters. The string ! -- may also contain horizontal tab characters. procedure Write_Line (S : String); -- Equivalent to Write_Str (S) followed by Write_Eol; function Column return Pos; pragma Inline (Column); ! -- Returns the number of the column about to be written (e.g. a value ! -- of 1 means the current line is empty). ------------------------- -- Buffer Save/Restore -- --- 111,146 ---- -- If last character in buffer matches C, erase it, otherwise no effect procedure Write_Eol; ! -- Write an end of line (whatever is required by the system in use, e.g. ! -- CR/LF for DOS, or LF for Unix) to the standard output file. This routine ! -- also empties the line buffer, actually writing it to the file. Note that ! -- Write_Eol is the only routine that causes any actual output to be ! -- written. Trailing spaces are removed. procedure Write_Eol_Keep_Blanks; -- Similar as Write_Eol, except that trailing spaces are not removed procedure Write_Int (Val : Int); ! -- Write an integer value with no leading blanks or zeroes. Negative values ! -- are preceded by a minus sign). procedure Write_Spaces (N : Nat); -- Write N spaces procedure Write_Str (S : String); -- Write a string of characters to the standard output file. Note that ! -- end of line is normally handled separately using WRITE_EOL, but it is ! -- allowable for the string to contain LF (but not CR) characters, which ! -- are properly interpreted as end of line characters. The string may also ! -- contain horizontal tab characters. procedure Write_Line (S : String); -- Equivalent to Write_Str (S) followed by Write_Eol; function Column return Pos; pragma Inline (Column); ! -- Returns the number of the column about to be written (e.g. a value of 1 ! -- means the current line is empty). ------------------------- -- Buffer Save/Restore -- diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch10.adb gcc-4.6.0/gcc/ada/par-ch10.adb *** gcc-4.5.2/gcc/ada/par-ch10.adb Wed Jul 15 10:25:24 2009 --- gcc-4.6.0/gcc/ada/par-ch10.adb Fri Oct 22 14:51:40 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch10 is *** 344,355 **** Get_Expected_Unit_Type (File_Name (Current_Source_File)) = Expect_Body then ! Error_Msg_BC ("keyword BODY expected here [see file name]"); Restore_Scan_State (Scan_State); ! Set_Unit (Comp_Unit_Node, P_Package (Pf_Pbod)); else Restore_Scan_State (Scan_State); ! Set_Unit (Comp_Unit_Node, P_Package (Pf_Decl_Gins_Pbod_Rnam)); end if; elsif Token = Tok_Generic then --- 344,356 ---- Get_Expected_Unit_Type (File_Name (Current_Source_File)) = Expect_Body then ! Error_Msg_BC -- CODEFIX ! ("keyword BODY expected here [see file name]"); Restore_Scan_State (Scan_State); ! Set_Unit (Comp_Unit_Node, P_Package (Pf_Pbod_Pexp)); else Restore_Scan_State (Scan_State); ! Set_Unit (Comp_Unit_Node, P_Package (Pf_Decl_Gins_Pbod_Rnam_Pexp)); end if; elsif Token = Tok_Generic then *************** package body Ch10 is *** 363,369 **** or else Token = Tok_Overriding or else Token = Tok_Procedure then ! Set_Unit (Comp_Unit_Node, P_Subprogram (Pf_Decl_Gins_Pbod_Rnam)); -- A little bit of an error recovery check here. If we just scanned -- a subprogram declaration (as indicated by an SIS entry being --- 364,370 ---- or else Token = Tok_Overriding or else Token = Tok_Procedure then ! Set_Unit (Comp_Unit_Node, P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Pexp)); -- A little bit of an error recovery check here. If we just scanned -- a subprogram declaration (as indicated by an SIS entry being *************** package body Ch10 is *** 395,401 **** -- Otherwise we saved the semicolon position, so complain else ! Error_Msg (""";"" should be IS", SIS_Semicolon_Sloc); end if; Body_Node := Unit (Comp_Unit_Node); --- 396,403 ---- -- Otherwise we saved the semicolon position, so complain else ! Error_Msg -- CODEFIX ! (""";"" should be IS", SIS_Semicolon_Sloc); end if; Body_Node := Unit (Comp_Unit_Node); *************** package body Ch10 is *** 632,638 **** -- Check we did not with any child units Item := First (Context_Items (Comp_Unit_Node)); - while Present (Item) loop if Nkind (Item) = N_With_Clause and then Nkind (Name (Item)) /= N_Identifier --- 634,639 ---- *************** package body Ch10 is *** 836,845 **** end if; if Token /= Tok_With then ! Error_Msg_SC ("unexpected LIMITED ignored"); end if; ! if Ada_Version < Ada_05 then Error_Msg_SP ("LIMITED WITH is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 837,847 ---- end if; if Token /= Tok_With then ! Error_Msg_SC -- CODEFIX ! ("unexpected LIMITED ignored"); end if; ! if Ada_Version < Ada_2005 then Error_Msg_SP ("LIMITED WITH is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch10 is *** 858,864 **** Restore_Scan_State (Scan_State); -- to PRIVATE return Item_List; ! elsif Ada_Version < Ada_05 then Error_Msg_SP ("`PRIVATE WITH` is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 860,866 ---- Restore_Scan_State (Scan_State); -- to PRIVATE return Item_List; ! elsif Ada_Version < Ada_2005 then Error_Msg_SP ("`PRIVATE WITH` is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch10 is *** 876,883 **** -- WITH TYPE is an obsolete GNAT specific extension ! Error_Msg_SP ! ("`WITH TYPE` is an obsolete 'G'N'A'T extension"); Error_Msg_SP ("\use Ada 2005 `LIMITED WITH` clause instead"); Scan; -- past TYPE --- 878,884 ---- -- WITH TYPE is an obsolete GNAT specific extension ! Error_Msg_SP ("`WITH TYPE` is an obsolete 'G'N'A'T extension"); Error_Msg_SP ("\use Ada 2005 `LIMITED WITH` clause instead"); Scan; -- past TYPE *************** package body Ch10 is *** 912,917 **** --- 913,922 ---- -- place where such an "error" should be caught. Set_Name (With_Node, P_Qualified_Simple_Name); + if Name (With_Node) = Error then + Remove (With_Node); + end if; + Set_First_Name (With_Node, First_Flag); Set_Limited_Present (With_Node, Has_Limited); Set_Private_Present (With_Node, Has_Private); *************** package body Ch10 is *** 1028,1038 **** Ignore (Tok_Semicolon); ! if Token = Tok_Function or else Token = Tok_Procedure then ! Body_Node := P_Subprogram (Pf_Pbod); elsif Token = Tok_Package then ! Body_Node := P_Package (Pf_Pbod); elsif Token = Tok_Protected then Scan; -- past PROTECTED --- 1033,1047 ---- Ignore (Tok_Semicolon); ! if Token = Tok_Function ! or else Token = Tok_Not ! or else Token = Tok_Overriding ! or else Token = Tok_Procedure ! then ! Body_Node := P_Subprogram (Pf_Pbod_Pexp); elsif Token = Tok_Package then ! Body_Node := P_Package (Pf_Pbod_Pexp); elsif Token = Tok_Protected then Scan; -- past PROTECTED diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch11.adb gcc-4.6.0/gcc/ada/par-ch11.adb *** gcc-4.5.2/gcc/ada/par-ch11.adb Wed Apr 15 10:46:56 2009 --- gcc-4.6.0/gcc/ada/par-ch11.adb Mon Oct 11 09:20:53 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch11 is *** 119,125 **** Set_Choice_Parameter (Handler_Node, Choice_Param_Node); elsif Token = Tok_Others then ! Error_Msg_AP ("missing "":"""); Change_Identifier_To_Defining_Identifier (Choice_Param_Node); Set_Choice_Parameter (Handler_Node, Choice_Param_Node); --- 119,126 ---- Set_Choice_Parameter (Handler_Node, Choice_Param_Node); elsif Token = Tok_Others then ! Error_Msg_AP -- CODEFIX ! ("missing "":"""); Change_Identifier_To_Defining_Identifier (Choice_Param_Node); Set_Choice_Parameter (Handler_Node, Choice_Param_Node); *************** package body Ch11 is *** 197,203 **** end if; if Token = Tok_With then ! if Ada_Version < Ada_05 then Error_Msg_SC ("string expression in raise is Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); end if; --- 198,204 ---- end if; if Token = Tok_With then ! if Ada_Version < Ada_2005 then Error_Msg_SC ("string expression in raise is Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); end if; diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch12.adb gcc-4.6.0/gcc/ada/par-ch12.adb *** gcc-4.5.2/gcc/ada/par-ch12.adb Wed May 6 12:49:36 2009 --- gcc-4.6.0/gcc/ada/par-ch12.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch12 is *** 61,70 **** -- GENERIC_SUBPROGRAM_DECLARATION | GENERIC_PACKAGE_DECLARATION -- GENERIC_SUBPROGRAM_DECLARATION ::= ! -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION; -- GENERIC_PACKAGE_DECLARATION ::= ! -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION; -- GENERIC_FORMAL_PART ::= -- generic {GENERIC_FORMAL_PARAMETER_DECLARATION | USE_CLAUSE} --- 61,72 ---- -- GENERIC_SUBPROGRAM_DECLARATION | GENERIC_PACKAGE_DECLARATION -- GENERIC_SUBPROGRAM_DECLARATION ::= ! -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- GENERIC_PACKAGE_DECLARATION ::= ! -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- GENERIC_FORMAL_PART ::= -- generic {GENERIC_FORMAL_PARAMETER_DECLARATION | USE_CLAUSE} *************** package body Ch12 is *** 194,207 **** exit Decl_Loop; end if; end if; - end loop Decl_Loop; -- Generic formal part is scanned, scan out subprogram or package spec if Token = Tok_Package then Gen_Decl := New_Node (N_Generic_Package_Declaration, Gen_Sloc); ! Set_Specification (Gen_Decl, P_Package (Pf_Spcn)); else Gen_Decl := New_Node (N_Generic_Subprogram_Declaration, Gen_Sloc); --- 196,209 ---- exit Decl_Loop; end if; end if; end loop Decl_Loop; -- Generic formal part is scanned, scan out subprogram or package spec if Token = Tok_Package then Gen_Decl := New_Node (N_Generic_Package_Declaration, Gen_Sloc); ! Set_Specification (Gen_Decl, P_Package (Pf_Spcn, Gen_Decl)); ! else Gen_Decl := New_Node (N_Generic_Subprogram_Declaration, Gen_Sloc); *************** package body Ch12 is *** 213,219 **** then Error_Msg_SP ("child unit allowed only at library level"); end if; ! TF_Semicolon; end if; Set_Generic_Formal_Declarations (Gen_Decl, Decls); --- 215,222 ---- then Error_Msg_SP ("child unit allowed only at library level"); end if; ! ! P_Aspect_Specifications (Gen_Decl); end if; Set_Generic_Formal_Declarations (Gen_Decl, Decls); *************** package body Ch12 is *** 275,282 **** begin -- Figure out if a generic actual part operation is present. Clearly -- there is no generic actual part if the current token is semicolon ! if Token = Tok_Semicolon then return No_List; -- If we don't have a left paren, then we have an error, and the job --- 278,286 ---- begin -- Figure out if a generic actual part operation is present. Clearly -- there is no generic actual part if the current token is semicolon + -- or if we have aspect specifications present. ! if Token = Tok_Semicolon or else Aspect_Specifications_Present then return No_List; -- If we don't have a left paren, then we have an error, and the job *************** package body Ch12 is *** 335,341 **** -- Ada2005: an association can be given by: others => <> if Token = Tok_Others then ! if Ada_Version < Ada_05 then Error_Msg_SP ("partial parametrization of formal packages" & " is an Ada 2005 extension"); --- 339,345 ---- -- Ada2005: an association can be given by: others => <> if Token = Tok_Others then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("partial parametrization of formal packages" & " is an Ada 2005 extension"); *************** package body Ch12 is *** 346,352 **** Scan; -- past OTHERS if Token /= Tok_Arrow then ! Error_Msg_BC ("expect arrow after others"); else Scan; -- past arrow end if; --- 350,356 ---- Scan; -- past OTHERS if Token /= Tok_Arrow then ! Error_Msg_BC ("expect arrow after others"); else Scan; -- past arrow end if; *************** package body Ch12 is *** 402,410 **** -- FORMAL_OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : ! -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION]; -- The caller has checked that the initial token is an identifier --- 406,416 ---- -- FORMAL_OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : ! -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION]; + -- [ASPECT_SPECIFICATIONS]; -- The caller has checked that the initial token is an identifier *************** package body Ch12 is *** 425,431 **** begin Idents (1) := P_Defining_Identifier (C_Comma_Colon); Num_Idents := 1; - while Comma_Present loop Num_Idents := Num_Idents + 1; Idents (Num_Idents) := P_Defining_Identifier (C_Comma_Colon); --- 431,436 ---- *************** package body Ch12 is *** 463,469 **** Set_Access_Definition (Decl_Node, P_Access_Definition (Not_Null_Present)); ! if Ada_Version < Ada_05 then Error_Msg_SP ("access definition not allowed in formal object " & "declaration"); --- 468,474 ---- Set_Access_Definition (Decl_Node, P_Access_Definition (Not_Null_Present)); ! if Ada_Version < Ada_2005 then Error_Msg_SP ("access definition not allowed in formal object " & "declaration"); *************** package body Ch12 is *** 479,484 **** --- 484,490 ---- No_Constraint; Set_Default_Expression (Decl_Node, Init_Expr_Opt); + P_Aspect_Specifications (Decl_Node); if Ident > 1 then Set_Prev_Ids (Decl_Node, True); *************** package body Ch12 is *** 494,501 **** Ident := Ident + 1; Restore_Scan_State (Scan_State); end loop Ident_Loop; - - TF_Semicolon; end P_Formal_Object_Declarations; ----------------------------------- --- 500,505 ---- *************** package body Ch12 is *** 504,510 **** -- FORMAL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] ! -- is FORMAL_TYPE_DEFINITION; -- The caller has checked that the initial token is TYPE --- 508,515 ---- -- FORMAL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] ! -- is FORMAL_TYPE_DEFINITION ! -- [ASPECT_SPECIFICATIONS]; -- The caller has checked that the initial token is TYPE *************** package body Ch12 is *** 532,546 **** if Def_Node /= Error then Set_Formal_Type_Definition (Decl_Node, Def_Node); ! TF_Semicolon; else Decl_Node := Error; -- If we have semicolon, skip it to avoid cascaded errors ! if Token = Tok_Semicolon then ! Scan; end if; end if; --- 537,556 ---- if Def_Node /= Error then Set_Formal_Type_Definition (Decl_Node, Def_Node); ! P_Aspect_Specifications (Decl_Node); else Decl_Node := Error; + -- If we have aspect specifications, skip them + + if Aspect_Specifications_Present then + P_Aspect_Specifications (Error); + -- If we have semicolon, skip it to avoid cascaded errors ! elsif Token = Tok_Semicolon then ! Scan; -- past semicolon end if; end if; *************** package body Ch12 is *** 824,829 **** --- 834,853 ---- Set_Sloc (Def_Node, Token_Ptr); T_Private; + + if Token = Tok_Tagged then -- CODEFIX + Error_Msg_SC ("TAGGED must come before PRIVATE"); + Scan; -- past TAGGED + + elsif Token = Tok_Abstract then -- CODEFIX + Error_Msg_SC ("`ABSTRACT TAGGED` must come before PRIVATE"); + Scan; -- past ABSTRACT + + if Token = Tok_Tagged then + Scan; -- past TAGGED + end if; + end if; + return Def_Node; end P_Formal_Private_Type_Definition; *************** package body Ch12 is *** 856,862 **** Set_Limited_Present (Def_Node); Scan; -- past LIMITED ! if Ada_Version < Ada_05 then Error_Msg_SP ("LIMITED in derived type is an Ada 2005 extension"); Error_Msg_SP --- 880,886 ---- Set_Limited_Present (Def_Node); Scan; -- past LIMITED ! if Ada_Version < Ada_2005 then Error_Msg_SP ("LIMITED in derived type is an Ada 2005 extension"); Error_Msg_SP *************** package body Ch12 is *** 867,873 **** Set_Synchronized_Present (Def_Node); Scan; -- past SYNCHRONIZED ! if Ada_Version < Ada_05 then Error_Msg_SP ("SYNCHRONIZED in derived type is an Ada 2005 extension"); Error_Msg_SP --- 891,897 ---- Set_Synchronized_Present (Def_Node); Scan; -- past SYNCHRONIZED ! if Ada_Version < Ada_2005 then Error_Msg_SP ("SYNCHRONIZED in derived type is an Ada 2005 extension"); Error_Msg_SP *************** package body Ch12 is *** 888,894 **** if Token = Tok_And then Scan; -- past AND ! if Ada_Version < Ada_05 then Error_Msg_SP ("abstract interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 912,918 ---- if Token = Tok_And then Scan; -- past AND ! if Ada_Version < Ada_2005 then Error_Msg_SP ("abstract interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch12 is *** 912,918 **** Scan; if Token = Tok_Private then ! Error_Msg_SC ("TAGGED should be WITH"); Set_Private_Present (Def_Node, True); T_Private; else --- 936,943 ---- Scan; if Token = Tok_Private then ! Error_Msg_SC -- CODEFIX ! ("TAGGED should be WITH"); Set_Private_Present (Def_Node, True); T_Private; else *************** package body Ch12 is *** 1077,1086 **** -- | FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT]; -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT]; -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <> --- 1102,1113 ---- -- | FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT] ! -- [ASPECT_SPECIFICATIONS]; -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT] ! -- [ASPECT_SPECIFICATIONS]; -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <> *************** package body Ch12 is *** 1107,1113 **** New_Node (N_Formal_Abstract_Subprogram_Declaration, Prev_Sloc); Scan; -- past ABSTRACT ! if Ada_Version < Ada_05 then Error_Msg_SP ("formal abstract subprograms are an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 1134,1140 ---- New_Node (N_Formal_Abstract_Subprogram_Declaration, Prev_Sloc); Scan; -- past ABSTRACT ! if Ada_Version < Ada_2005 then Error_Msg_SP ("formal abstract subprograms are an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch12 is *** 1121,1135 **** Set_Specification (Def_Node, Spec_Node); if Token = Tok_Semicolon then ! Scan; -- past ";" elsif Token = Tok_Box then Set_Box_Present (Def_Node, True); Scan; -- past <> - T_Semicolon; elsif Token = Tok_Null then ! if Ada_Version < Ada_05 then Error_Msg_SP ("null default subprograms are an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 1148,1164 ---- Set_Specification (Def_Node, Spec_Node); if Token = Tok_Semicolon then ! null; ! ! elsif Aspect_Specifications_Present then ! null; elsif Token = Tok_Box then Set_Box_Present (Def_Node, True); Scan; -- past <> elsif Token = Tok_Null then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("null default subprograms are an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch12 is *** 1142,1161 **** end if; Scan; -- past NULL - T_Semicolon; else Set_Default_Name (Def_Node, P_Name); - T_Semicolon; end if; else Def_Node := New_Node (N_Formal_Concrete_Subprogram_Declaration, Prev_Sloc); Set_Specification (Def_Node, Spec_Node); - T_Semicolon; end if; return Def_Node; end P_Formal_Subprogram_Declaration; --- 1171,1188 ---- end if; Scan; -- past NULL else Set_Default_Name (Def_Node, P_Name); end if; else Def_Node := New_Node (N_Formal_Concrete_Subprogram_Declaration, Prev_Sloc); Set_Specification (Def_Node, Spec_Node); end if; + P_Aspect_Specifications (Def_Node); return Def_Node; end P_Formal_Subprogram_Declaration; *************** package body Ch12 is *** 1177,1183 **** -- FORMAL_PACKAGE_DECLARATION ::= -- with package DEFINING_IDENTIFIER ! -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART; -- FORMAL_PACKAGE_ACTUAL_PART ::= -- ([OTHERS =>] <>) | --- 1204,1211 ---- -- FORMAL_PACKAGE_DECLARATION ::= -- with package DEFINING_IDENTIFIER ! -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART ! -- [ASPECT_SPECIFICATIONS]; -- FORMAL_PACKAGE_ACTUAL_PART ::= -- ([OTHERS =>] <>) | *************** package body Ch12 is *** 1221,1227 **** end if; end if; ! T_Semicolon; return Def_Node; end P_Formal_Package_Declaration; --- 1249,1255 ---- end if; end if; ! P_Aspect_Specifications (Def_Node); return Def_Node; end P_Formal_Package_Declaration; diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch13.adb gcc-4.6.0/gcc/ada/par-ch13.adb *** gcc-4.5.2/gcc/ada/par-ch13.adb Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/par-ch13.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch13 is *** 35,40 **** --- 35,133 ---- function P_Component_Clause return Node_Id; function P_Mod_Clause return Node_Id; + ----------------------------------- + -- Aspect_Specifications_Present -- + ----------------------------------- + + function Aspect_Specifications_Present + (Strict : Boolean := Ada_Version < Ada_2012) return Boolean + is + Scan_State : Saved_Scan_State; + Result : Boolean; + + begin + Save_Scan_State (Scan_State); + + -- If we have a semicolon, test for semicolon followed by Aspect + -- Specifications, in which case we decide the semicolon is accidental. + + if Token = Tok_Semicolon then + Scan; -- past semicolon + + -- The recursive test is set Strict, since we already have one + -- error (the unexpected semicolon), so we will ignore that semicolon + -- only if we absolutely definitely have an aspect specification + -- following it. + + if Aspect_Specifications_Present (Strict => True) then + Error_Msg_SP ("|extra "";"" ignored"); + return True; + + else + Restore_Scan_State (Scan_State); + return False; + end if; + end if; + + -- Definitely must have WITH to consider aspect specs to be present + + if Token /= Tok_With then + return False; + end if; + + -- Have a WITH, see if it looks like an aspect specification + + Save_Scan_State (Scan_State); + Scan; -- past WITH + + -- If no identifier, then consider that we definitely do not have an + -- aspect specification. + + if Token /= Tok_Identifier then + Result := False; + + -- This is where we pay attention to the Strict mode. Normally when we + -- are in Ada 2012 mode, Strict is False, and we consider that we have + -- an aspect specification if the identifier is an aspect name (even if + -- not followed by =>) or the identifier is not an aspect name but is + -- followed by =>. P_Aspect_Specifications will generate messages if the + -- aspect specification is ill-formed. + + elsif not Strict then + if Get_Aspect_Id (Token_Name) /= No_Aspect then + Result := True; + else + Scan; -- past identifier + Result := Token = Tok_Arrow; + end if; + + -- If earlier than Ada 2012, check for valid aspect identifier followed + -- by an arrow, and consider that this is still an aspect specification + -- so we give an appropriate message. + + else + if Get_Aspect_Id (Token_Name) = No_Aspect then + Result := False; + + else + Scan; -- past aspect name + + if Token /= Tok_Arrow then + Result := False; + + else + Restore_Scan_State (Scan_State); + Error_Msg_SC ("|aspect specification is an Ada 2012 feature"); + Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch"); + return True; + end if; + end if; + end if; + + Restore_Scan_State (Scan_State); + return Result; + end Aspect_Specifications_Present; + -------------------------------------------- -- 13.1 Representation Clause (also I.7) -- -------------------------------------------- *************** package body Ch13 is *** 274,279 **** --- 367,538 ---- -- Parsed by P_Representation_Clause (13.1) + -------------------------------- + -- 13.1 Aspect Specification -- + -------------------------------- + + -- ASPECT_SPECIFICATION ::= + -- with ASPECT_MARK [=> ASPECT_DEFINITION] {. + -- ASPECT_MARK [=> ASPECT_DEFINITION] } + + -- ASPECT_MARK ::= aspect_IDENTIFIER['Class] + + -- ASPECT_DEFINITION ::= NAME | EXPRESSION + + -- Error recovery: cannot raise Error_Resync + + procedure P_Aspect_Specifications (Decl : Node_Id) is + Aspects : List_Id; + Aspect : Node_Id; + A_Id : Aspect_Id; + OK : Boolean; + Ptr : Source_Ptr; + + begin + -- Check if aspect specification present + + if not Aspect_Specifications_Present then + TF_Semicolon; + return; + end if; + + -- Aspect Specification is present + + Ptr := Token_Ptr; + Scan; -- past WITH + + -- Here we have an aspect specification to scan, note that we don;t + -- set the flag till later, because it may turn out that we have no + -- valid aspects in the list. + + Aspects := Empty_List; + loop + OK := True; + + if Token /= Tok_Identifier then + Error_Msg_SC ("aspect identifier expected"); + Resync_Past_Semicolon; + return; + end if; + + -- We have an identifier (which should be an aspect identifier) + + A_Id := Get_Aspect_Id (Token_Name); + Aspect := + Make_Aspect_Specification (Token_Ptr, + Identifier => Token_Node); + + -- No valid aspect identifier present + + if A_Id = No_Aspect then + Error_Msg_SC ("aspect identifier expected"); + + if Token = Tok_Apostrophe then + Scan; -- past ' + Scan; -- past presumably CLASS + end if; + + if Token = Tok_Arrow then + Scan; -- Past arrow + Set_Expression (Aspect, P_Expression); + OK := False; + + elsif Token = Tok_Comma then + OK := False; + + else + Resync_Past_Semicolon; + return; + end if; + + -- OK aspect scanned + + else + Scan; -- past identifier + + -- Check for 'Class present + + if Token = Tok_Apostrophe then + if not Class_Aspect_OK (A_Id) then + Error_Msg_Node_1 := Identifier (Aspect); + Error_Msg_SC ("aspect& does not permit attribute here"); + Scan; -- past apostrophe + Scan; -- past presumed CLASS + OK := False; + + else + Scan; -- past apostrophe + + if Token /= Tok_Identifier + or else Token_Name /= Name_Class + then + Error_Msg_SC ("Class attribute expected here"); + OK := False; + + if Token = Tok_Identifier then + Scan; -- past identifier not CLASS + end if; + + else + Scan; -- past CLASS + Set_Class_Present (Aspect); + end if; + end if; + end if; + + -- Test case of missing aspect definition + + if Token = Tok_Comma or else Token = Tok_Semicolon then + if Aspect_Argument (A_Id) /= Optional then + Error_Msg_Node_1 := Aspect; + Error_Msg_AP ("aspect& requires an aspect definition"); + OK := False; + end if; + + -- Here we have an aspect definition + + else + if Token = Tok_Arrow then + Scan; -- past arrow + else + T_Arrow; + OK := False; + end if; + + if Aspect_Argument (A_Id) = Name then + Set_Expression (Aspect, P_Name); + else + Set_Expression (Aspect, P_Expression); + end if; + end if; + + -- If OK clause scanned, add it to the list + + if OK then + Append (Aspect, Aspects); + end if; + + if Token = Tok_Comma then + Scan; -- past comma + else + T_Semicolon; + exit; + end if; + end if; + end loop; + + -- If aspects scanned, store them + + if Is_Non_Empty_List (Aspects) then + if Decl = Error then + Error_Msg ("aspect specifications not allowed here", Ptr); + else + Set_Parent (Aspects, Decl); + Set_Aspect_Specifications (Decl, Aspects); + end if; + end if; + end P_Aspect_Specifications; + --------------------------------------------- -- 13.4 Enumeration Representation Clause -- --------------------------------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch2.adb gcc-4.6.0/gcc/ada/par-ch2.adb *** gcc-4.5.2/gcc/ada/par-ch2.adb Tue Jul 7 10:36:25 2009 --- gcc-4.6.0/gcc/ada/par-ch2.adb Mon Oct 11 09:20:53 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch2 is *** 291,297 **** -- Ada 2005 (AI-284): INTERFACE is a new reserved word but it is -- allowed as a pragma name. ! if Ada_Version >= Ada_05 and then Token = Tok_Interface then Prag_Name := Name_Interface; --- 291,297 ---- -- Ada 2005 (AI-284): INTERFACE is a new reserved word but it is -- allowed as a pragma name. ! if Ada_Version >= Ada_2005 and then Token = Tok_Interface then Prag_Name := Name_Interface; *************** package body Ch2 is *** 501,509 **** Id_Present := False; end if; ! if Identifier_Seen and not Id_Present then ! Error_Msg_SC ! ("|pragma argument identifier required here (RM 2.8(4))"); end if; if Id_Present then --- 501,516 ---- Id_Present := False; end if; ! -- Diagnose error of "positional" argument for pragma appearing after ! -- a "named" argument (quotes here are because that's not quite accurate ! -- Ada RM terminology). ! ! -- Since older GNAT versions did not generate this error, disable this ! -- message in codepeer mode to help legacy code using codepeer. ! ! if Identifier_Seen and not Id_Present and not CodePeer_Mode then ! Error_Msg_SC ("|pragma argument identifier required here"); ! Error_Msg_SC ("\since previous argument had identifier (RM 2.8(4))"); end if; if Id_Present then diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch3.adb gcc-4.6.0/gcc/ada/par-ch3.adb *** gcc-4.5.2/gcc/ada/par-ch3.adb Mon Jul 13 10:22:57 2009 --- gcc-4.6.0/gcc/ada/par-ch3.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch3 is *** 111,117 **** -- current token, and if this is the first such message issued, saves -- the message id in Missing_Begin_Msg, for possible later replacement. - --------------------------------- -- Check_Restricted_Expression -- --------------------------------- --- 111,116 ---- *************** package body Ch3 is *** 125,134 **** elsif Nkind_In (N, N_In, N_Not_In) and then Paren_Count (N) = 0 then ! Error_Msg_N ! ("|this expression must be parenthesized!", N); ! Error_Msg_N ! ("\|since extensions (and set notation) are allowed", N); end if; end Check_Restricted_Expression; --- 124,130 ---- elsif Nkind_In (N, N_In, N_Not_In) and then Paren_Count (N) = 0 then ! Error_Msg_N ("|this expression must be parenthesized!", N); end if; end Check_Restricted_Expression; *************** package body Ch3 is *** 254,262 **** -- and we need to fix it. if Nkind (Ident_Node) = N_Defining_Identifier then ! Ident_Node := ! Make_Identifier (Sloc (Ident_Node), ! Chars => Chars (Ident_Node)); end if; -- Change identifier to defining identifier if not in error --- 250,256 ---- -- and we need to fix it. if Nkind (Ident_Node) = N_Defining_Identifier then ! Ident_Node := Make_Identifier (Sloc (Ident_Node), Chars (Ident_Node)); end if; -- Change identifier to defining identifier if not in error *************** package body Ch3 is *** 279,285 **** -- | PRIVATE_EXTENSION_DECLARATION -- FULL_TYPE_DECLARATION ::= ! -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] is TYPE_DEFINITION; -- | CONCURRENT_TYPE_DECLARATION -- INCOMPLETE_TYPE_DECLARATION ::= --- 273,280 ---- -- | PRIVATE_EXTENSION_DECLARATION -- FULL_TYPE_DECLARATION ::= ! -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] is TYPE_DEFINITION ! -- [ASPECT_SPECIFICATIONS]; -- | CONCURRENT_TYPE_DECLARATION -- INCOMPLETE_TYPE_DECLARATION ::= *************** package body Ch3 is *** 311,321 **** -- Error recovery: can raise Error_Resync ! -- Note: The processing for full type declaration, incomplete type ! -- declaration, private type declaration and type definition is ! -- included in this function. The processing for concurrent type ! -- declarations is NOT here, but rather in chapter 9 (i.e. this ! -- function handles only declarations starting with TYPE). function P_Type_Declaration return Node_Id is Abstract_Present : Boolean := False; --- 306,316 ---- -- Error recovery: can raise Error_Resync ! -- The processing for full type declarations, incomplete type declarations, ! -- private type declarations and type definitions is included in this ! -- function. The processing for concurrent type declarations is NOT here, ! -- but rather in chapter 9 (this function handles only declarations ! -- starting with TYPE). function P_Type_Declaration return Node_Id is Abstract_Present : Boolean := False; *************** package body Ch3 is *** 330,336 **** Type_Start_Col : Column_Number; Unknown_Dis : Boolean; ! Typedef_Node : Node_Id; -- Normally holds type definition, except in the case of a private -- extension declaration, in which case it holds the declaration itself --- 325,331 ---- Type_Start_Col : Column_Number; Unknown_Dis : Boolean; ! Typedef_Node : Node_Id; -- Normally holds type definition, except in the case of a private -- extension declaration, in which case it holds the declaration itself *************** package body Ch3 is *** 385,391 **** Scan; -- past = used in place of IS elsif Token = Tok_Renames then ! Error_Msg_SC ("RENAMES should be IS"); Scan; -- past RENAMES used in place of IS else --- 380,387 ---- Scan; -- past = used in place of IS elsif Token = Tok_Renames then ! Error_Msg_SC -- CODEFIX ! ("RENAMES should be IS"); Scan; -- past RENAMES used in place of IS else *************** package body Ch3 is *** 435,441 **** -- Ada 2005 (AI-419): AARM 3.4 (2/2) ! if (Ada_Version < Ada_05 and then Token = Tok_Limited) or else Token = Tok_Private or else Token = Tok_Record or else Token = Tok_Null --- 431,437 ---- -- Ada 2005 (AI-419): AARM 3.4 (2/2) ! if (Ada_Version < Ada_2005 and then Token = Tok_Limited) or else Token = Tok_Private or else Token = Tok_Record or else Token = Tok_Null *************** package body Ch3 is *** 478,499 **** when Tok_Access | Tok_Not => -- Ada 2005 (AI-231) Typedef_Node := P_Access_Type_Definition; - TF_Semicolon; exit; when Tok_Array => Typedef_Node := P_Array_Type_Definition; - TF_Semicolon; exit; when Tok_Delta => Typedef_Node := P_Fixed_Point_Definition; - TF_Semicolon; exit; when Tok_Digits => Typedef_Node := P_Floating_Point_Definition; - TF_Semicolon; exit; when Tok_In => --- 474,491 ---- *************** package body Ch3 is *** 502,530 **** when Tok_Integer_Literal => T_Range; Typedef_Node := P_Signed_Integer_Type_Definition; - TF_Semicolon; exit; when Tok_Null => Typedef_Node := P_Record_Definition; - TF_Semicolon; exit; when Tok_Left_Paren => Typedef_Node := P_Enumeration_Type_Definition; ! End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); - TF_Semicolon; exit; when Tok_Mod => Typedef_Node := P_Modular_Type_Definition; - TF_Semicolon; exit; when Tok_New => --- 494,516 ---- when Tok_Integer_Literal => T_Range; Typedef_Node := P_Signed_Integer_Type_Definition; exit; when Tok_Null => Typedef_Node := P_Record_Definition; exit; when Tok_Left_Paren => Typedef_Node := P_Enumeration_Type_Definition; ! End_Labl := Make_Identifier (Token_Ptr, Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); exit; when Tok_Mod => Typedef_Node := P_Modular_Type_Definition; exit; when Tok_New => *************** package body Ch3 is *** 533,565 **** if Nkind (Typedef_Node) = N_Derived_Type_Definition and then Present (Record_Extension_Part (Typedef_Node)) then ! End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Record_Extension_Part (Typedef_Node), End_Labl); end if; - TF_Semicolon; exit; when Tok_Range => Typedef_Node := P_Signed_Integer_Type_Definition; - TF_Semicolon; exit; when Tok_Record => Typedef_Node := P_Record_Definition; ! End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); - TF_Semicolon; exit; when Tok_Tagged => --- 519,544 ---- if Nkind (Typedef_Node) = N_Derived_Type_Definition and then Present (Record_Extension_Part (Typedef_Node)) then ! End_Labl := Make_Identifier (Token_Ptr, Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Record_Extension_Part (Typedef_Node), End_Labl); end if; exit; when Tok_Range => Typedef_Node := P_Signed_Integer_Type_Definition; exit; when Tok_Record => Typedef_Node := P_Record_Definition; ! End_Labl := Make_Identifier (Token_Ptr, Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); exit; when Tok_Tagged => *************** package body Ch3 is *** 568,574 **** -- Ada 2005 (AI-326): If the words IS TAGGED appear, the type -- is a tagged incomplete type. ! if Ada_Version >= Ada_05 and then Token = Tok_Semicolon then Scan; -- past ; --- 547,553 ---- -- Ada 2005 (AI-326): If the words IS TAGGED appear, the type -- is a tagged incomplete type. ! if Ada_Version >= Ada_2005 and then Token = Tok_Semicolon then Scan; -- past ; *************** package body Ch3 is *** 611,618 **** Set_Limited_Present (Typedef_Node, True); End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); --- 590,596 ---- Set_Limited_Present (Typedef_Node, True); End_Labl := ! Make_Identifier (Token_Ptr, Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); *************** package body Ch3 is *** 634,648 **** Set_Tagged_Present (Typedef_Node, True); End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); end if; end if; - TF_Semicolon; exit; when Tok_Limited => --- 612,624 ---- Set_Tagged_Present (Typedef_Node, True); End_Labl := ! Make_Identifier (Token_Ptr, Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label (Typedef_Node, End_Labl); end if; end if; exit; when Tok_Limited => *************** package body Ch3 is *** 705,711 **** -- Ada 2005 (AI-419): LIMITED NEW elsif Token = Tok_New then ! if Ada_Version < Ada_05 then Error_Msg_SP ("LIMITED in derived type is an Ada 2005 extension"); Error_Msg_SP --- 681,687 ---- -- Ada 2005 (AI-419): LIMITED NEW elsif Token = Tok_New then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("LIMITED in derived type is an Ada 2005 extension"); Error_Msg_SP *************** package body Ch3 is *** 719,726 **** and then Present (Record_Extension_Part (Typedef_Node)) then End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label --- 695,701 ---- and then Present (Record_Extension_Part (Typedef_Node)) then End_Labl := ! Make_Identifier (Token_Ptr, Chars (Ident_Node)); Set_Comes_From_Source (End_Labl, False); Set_End_Label *************** package body Ch3 is *** 735,741 **** T_Private; -- past PRIVATE (or complain if not there!) end if; - TF_Semicolon; exit; -- Here we have an identifier after the IS, which is certainly --- 710,715 ---- *************** package body Ch3 is *** 750,756 **** if not Token_Is_At_Start_Of_Line then Typedef_Node := P_Derived_Type_Def_Or_Private_Ext_Decl; - TF_Semicolon; -- If the identifier is at the start of the line, and is in the -- same column as the type declaration itself then we consider --- 724,729 ---- *************** package body Ch3 is *** 771,777 **** else Typedef_Node := P_Record_Definition; - TF_Semicolon; end if; exit; --- 744,749 ---- *************** package body Ch3 is *** 781,793 **** when Tok_Interface => Typedef_Node := P_Interface_Type_Definition (Abstract_Present); Abstract_Present := True; - TF_Semicolon; exit; when Tok_Private => Decl_Node := New_Node (N_Private_Type_Declaration, Type_Loc); Scan; -- past PRIVATE ! TF_Semicolon; exit; -- Ada 2005 (AI-345): Protected, synchronized or task interface --- 753,779 ---- when Tok_Interface => Typedef_Node := P_Interface_Type_Definition (Abstract_Present); Abstract_Present := True; exit; when Tok_Private => Decl_Node := New_Node (N_Private_Type_Declaration, Type_Loc); Scan; -- past PRIVATE ! ! -- Check error cases of private [abstract] tagged ! ! if Token = Tok_Abstract then ! Error_Msg_SC ("`ABSTRACT TAGGED` must come before PRIVATE"); ! Scan; -- past ABSTRACT ! ! if Token = Tok_Tagged then ! Scan; -- past TAGGED ! end if; ! ! elsif Token = Tok_Tagged then ! Error_Msg_SC ("TAGGED must come before PRIVATE"); ! Scan; -- past TAGGED ! end if; ! exit; -- Ada 2005 (AI-345): Protected, synchronized or task interface *************** package body Ch3 is *** 851,857 **** end if; end; - TF_Semicolon; exit; -- Anything else is an error --- 837,842 ---- *************** package body Ch3 is *** 935,940 **** --- 920,926 ---- Set_Defining_Identifier (Decl_Node, Ident_Node); Set_Discriminant_Specifications (Decl_Node, Discr_List); + P_Aspect_Specifications (Decl_Node); return Decl_Node; end P_Type_Declaration; *************** package body Ch3 is *** 972,978 **** TF_Is; if Token = Tok_New then ! Error_Msg_SC ("NEW ignored (only allowed in type declaration)"); Scan; -- past NEW end if; --- 958,965 ---- TF_Is; if Token = Tok_New then ! Error_Msg_SC -- CODEFIX ! ("NEW ignored (only allowed in type declaration)"); Scan; -- past NEW end if; *************** package body Ch3 is *** 981,987 **** Set_Subtype_Indication (Decl_Node, P_Subtype_Indication (Not_Null_Present)); ! TF_Semicolon; return Decl_Node; end P_Subtype_Declaration; --- 968,974 ---- Set_Subtype_Indication (Decl_Node, P_Subtype_Indication (Not_Null_Present)); ! P_Aspect_Specifications (Decl_Node); return Decl_Node; end P_Subtype_Declaration; *************** package body Ch3 is *** 1019,1025 **** -- access ..." is legal in Ada 95, whereas "Formal : not null -- Named_Access_Type" is not. ! if Ada_Version >= Ada_05 or else (Ada_Version >= Ada_95 and then Allow_Anonymous_In_95 and then Token = Tok_Access) --- 1006,1012 ---- -- access ..." is legal in Ada 95, whereas "Formal : not null -- Named_Access_Type" is not. ! if Ada_Version >= Ada_2005 or else (Ada_Version >= Ada_95 and then Allow_Anonymous_In_95 and then Token = Tok_Access) *************** package body Ch3 is *** 1138,1143 **** --- 1125,1140 ---- Discard_Junk_Node (P_Array_Type_Definition); return Error; + -- If Some becomes a keyword, the following is needed to make it + -- acceptable in older versions of Ada. + + elsif Token = Tok_Some + and then Ada_Version < Ada_2012 + then + Scan_Reserved_Identifier (False); + Scan; + return Token_Node; + else Type_Node := P_Qualified_Simple_Name_Resync; *************** package body Ch3 is *** 1278,1288 **** -- OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ACCESS_DEFINITION [:= EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ARRAY_TYPE_DEFINITION [:= EXPRESSION]; -- NUMBER_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : constant ::= static_EXPRESSION; --- 1275,1288 ---- -- OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ACCESS_DEFINITION [:= EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ARRAY_TYPE_DEFINITION [:= EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- NUMBER_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : constant ::= static_EXPRESSION; *************** package body Ch3 is *** 1297,1303 **** -- DEFINING_IDENTIFIER : exception renames exception_NAME; -- EXCEPTION_DECLARATION ::= ! -- DEFINING_IDENTIFIER_LIST : exception; -- Note that the ALIASED indication in an object declaration is -- marked by a flag in the parent node. --- 1297,1304 ---- -- DEFINING_IDENTIFIER : exception renames exception_NAME; -- EXCEPTION_DECLARATION ::= ! -- DEFINING_IDENTIFIER_LIST : exception ! -- [ASPECT_SPECIFICATIONS]; -- Note that the ALIASED indication in an object declaration is -- marked by a flag in the parent node. *************** package body Ch3 is *** 1358,1365 **** procedure No_List is begin if Num_Idents > 1 then ! Error_Msg ("identifier list not allowed for RENAMES", ! Sloc (Idents (2))); end if; List_OK := False; --- 1359,1367 ---- procedure No_List is begin if Num_Idents > 1 then ! Error_Msg ! ("identifier list not allowed for RENAMES", ! Sloc (Idents (2))); end if; List_OK := False; *************** package body Ch3 is *** 1379,1385 **** Check_Misspelling_Of (Tok_Renames); if Token = Tok_Renames then ! Error_Msg_SP ("|extra "":"" ignored"); Scan; -- past RENAMES return True; else --- 1381,1388 ---- Check_Misspelling_Of (Tok_Renames); if Token = Tok_Renames then ! Error_Msg_SP -- CODEFIX ! ("|extra "":"" ignored"); Scan; -- past RENAMES return True; else *************** package body Ch3 is *** 1587,1593 **** Set_Null_Exclusion_Present (Decl_Node, Not_Null_Present); if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); --- 1590,1596 ---- Set_Null_Exclusion_Present (Decl_Node, Not_Null_Present); if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); *************** package body Ch3 is *** 1650,1656 **** -- Access definition (AI-406) or subtype indication if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); --- 1653,1659 ---- -- Access definition (AI-406) or subtype indication if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); *************** package body Ch3 is *** 1691,1697 **** Not_Null_Present := P_Null_Exclusion; -- Ada 2005 (AI-231/423) if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); --- 1694,1700 ---- Not_Null_Present := P_Null_Exclusion; -- Ada 2005 (AI-231/423) if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); *************** package body Ch3 is *** 1719,1725 **** -- Object renaming declaration if Token_Is_Renames then ! if Ada_Version < Ada_05 then Error_Msg_SP ("`NOT NULL` not allowed in object renaming"); raise Error_Resync; --- 1722,1728 ---- -- Object renaming declaration if Token_Is_Renames then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("`NOT NULL` not allowed in object renaming"); raise Error_Resync; *************** package body Ch3 is *** 1750,1758 **** -- illegal if Token_Is_Renames then ! Error_Msg_N ("constraint not allowed in object renaming " ! & "declaration", ! Constraint (Object_Definition (Decl_Node))); raise Error_Resync; end if; end if; --- 1753,1762 ---- -- illegal if Token_Is_Renames then ! Error_Msg_N ! ("constraint not allowed in object renaming " ! & "declaration", ! Constraint (Object_Definition (Decl_Node))); raise Error_Resync; end if; end if; *************** package body Ch3 is *** 1761,1767 **** -- Ada 2005 (AI-230): Access Definition case elsif Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); --- 1765,1771 ---- -- Ada 2005 (AI-230): Access Definition case elsif Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); *************** package body Ch3 is *** 1834,1841 **** end if; end if; - TF_Semicolon; Set_Defining_Identifier (Decl_Node, Idents (Ident)); if List_OK then if Ident < Num_Idents then --- 1838,1845 ---- end if; end if; Set_Defining_Identifier (Decl_Node, Idents (Ident)); + P_Aspect_Specifications (Decl_Node); if List_OK then if Ident < Num_Idents then *************** package body Ch3 is *** 1923,1929 **** begin Typedef_Node := New_Node (N_Derived_Type_Definition, Token_Ptr); ! if Ada_Version < Ada_05 and then Token = Tok_Identifier and then Token_Name = Name_Interface then --- 1927,1933 ---- begin Typedef_Node := New_Node (N_Derived_Type_Definition, Token_Ptr); ! if Ada_Version < Ada_2005 and then Token = Tok_Identifier and then Token_Name = Name_Interface then *************** package body Ch3 is *** 1950,1956 **** if Token = Tok_And then Scan; -- past AND ! if Ada_Version < Ada_05 then Error_Msg_SP ("abstract interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 1954,1960 ---- if Token = Tok_And then Scan; -- past AND ! if Ada_Version < Ada_2005 then Error_Msg_SP ("abstract interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch3 is *** 1974,1988 **** -- missing in the case of "type X is new Y record ..." or in the -- case of "type X is new Y null record". ! if Token = Tok_With or else Token = Tok_Record or else Token = Tok_Null then T_With; -- past WITH or give error message if Token = Tok_Limited then ! Error_Msg_SC ! ("LIMITED keyword not allowed in private extension"); Scan; -- ignore LIMITED end if; --- 1978,2000 ---- -- missing in the case of "type X is new Y record ..." or in the -- case of "type X is new Y null record". ! -- First make sure we don't have an aspect specification. If we do ! -- return now, so that our caller can check it (the WITH here is not ! -- part of a type extension). ! ! if Aspect_Specifications_Present then ! return Typedef_Node; ! ! -- OK, not an aspect specification, so continue test for extension ! ! elsif Token = Tok_With or else Token = Tok_Record or else Token = Tok_Null then T_With; -- past WITH or give error message if Token = Tok_Limited then ! Error_Msg_SC ("LIMITED keyword not allowed in private extension"); Scan; -- ignore LIMITED end if; *************** package body Ch3 is *** 2107,2113 **** Range_Node : Node_Id; Save_Loc : Source_Ptr; - -- Start of processing for P_Range_Or_Subtype_Mark begin --- 2119,2124 ---- *************** package body Ch3 is *** 2170,2175 **** --- 2181,2191 ---- return Expr_Node; end if; + -- Simple expression case + + elsif Expr_Form = EF_Simple and then Allow_Simple_Expression then + return Expr_Node; + -- Here we have some kind of error situation. Check for junk parens -- then return what we have, caller will deal with other errors. *************** package body Ch3 is *** 2245,2251 **** function P_Defining_Character_Literal return Node_Id is Literal_Node : Node_Id; - begin Literal_Node := Token_Node; Change_Character_Literal_To_Defining_Character_Literal (Literal_Node); --- 2261,2266 ---- *************** package body Ch3 is *** 2644,2650 **** -- Ada 2005 (AI-230): Access Definition case if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); --- 2659,2665 ---- -- Ada 2005 (AI-230): Access Definition case if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); *************** package body Ch3 is *** 3326,3332 **** -- COMPONENT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION ! -- [:= DEFAULT_EXPRESSION]; -- COMPONENT_DEFINITION ::= -- [aliased] [NULL_EXCLUSION] SUBTYPE_INDICATION | ACCESS_DEFINITION --- 3341,3348 ---- -- COMPONENT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION ! -- [:= DEFAULT_EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- COMPONENT_DEFINITION ::= -- [aliased] [NULL_EXCLUSION] SUBTYPE_INDICATION | ACCESS_DEFINITION *************** package body Ch3 is *** 3412,3418 **** -- Ada 2005 (AI-230): Access Definition case if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); --- 3428,3434 ---- -- Ada 2005 (AI-230): Access Definition case if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("generalized use of anonymous access types " & "is an Ada 2005 extension"); *************** package body Ch3 is *** 3434,3441 **** Set_Null_Exclusion_Present (CompDef_Node, Not_Null_Present); if Token = Tok_Array then ! Error_Msg_SC ! ("anonymous arrays not allowed as components"); raise Error_Resync; end if; --- 3450,3456 ---- Set_Null_Exclusion_Present (CompDef_Node, Not_Null_Present); if Token = Tok_Array then ! Error_Msg_SC ("anonymous arrays not allowed as components"); raise Error_Resync; end if; *************** package body Ch3 is *** 3467,3476 **** Ident := Ident + 1; Restore_Scan_State (Scan_State); T_Colon; - end loop Ident_Loop; ! TF_Semicolon; end P_Component_Items; -------------------------------- --- 3482,3490 ---- Ident := Ident + 1; Restore_Scan_State (Scan_State); T_Colon; end loop Ident_Loop; ! P_Aspect_Specifications (Decl_Node); end P_Component_Items; -------------------------------- *************** package body Ch3 is *** 3514,3520 **** Error_Msg ("discriminant name expected", Sloc (Case_Node)); elsif Paren_Count (Case_Node) /= 0 then ! Error_Msg ("|discriminant name may not be parenthesized", Sloc (Case_Node)); Set_Paren_Count (Case_Node, 0); end if; --- 3528,3535 ---- Error_Msg ("discriminant name expected", Sloc (Case_Node)); elsif Paren_Count (Case_Node) /= 0 then ! Error_Msg ! ("|discriminant name may not be parenthesized", Sloc (Case_Node)); Set_Paren_Count (Case_Node, 0); end if; *************** package body Ch3 is *** 3657,3684 **** -- Expression else ! -- If extensions are permitted then the expression must be a ! -- simple expression. The resaon for this restriction (i.e. ! -- going back to the Ada 83 rule) is to avoid ambiguities ! -- when set membership operations are allowed, consider the -- following: -- when A in 1 .. 10 | 12 => -- This is ambiguous without parentheses, so we require one ! -- of the following two parenthesized forms to disambuguate: -- one of the following: -- when (A in 1 .. 10 | 12) => -- when (A in 1 .. 10) | 12 => ! -- To solve this, if extensins are enabled, we disallow ! -- the use of membership operations in expressions in ! -- choices. Technically in the grammar, the expression ! -- must match the grammar for restricted expression. ! if Extensions_Allowed then Check_Restricted_Expression (Expr_Node); -- In Ada 83 mode, the syntax required a simple expression --- 3672,3700 ---- -- Expression else ! -- In Ada 2012 mode, the expression must be a simple ! -- expression. The reason for this restriction (i.e. going ! -- back to the Ada 83 rule) is to avoid ambiguities when set ! -- membership operations are allowed, consider the -- following: -- when A in 1 .. 10 | 12 => -- This is ambiguous without parentheses, so we require one ! -- of the following two parenthesized forms to disambiguate: -- one of the following: -- when (A in 1 .. 10 | 12) => -- when (A in 1 .. 10) | 12 => ! -- To solve this, in Ada 2012 mode, we disallow the use of ! -- membership operations in expressions in choices. ! -- Technically in the grammar, the expression must match the ! -- grammar for restricted expression. ! ! if Ada_Version >= Ada_2012 then Check_Restricted_Expression (Expr_Node); -- In Ada 83 mode, the syntax required a simple expression *************** package body Ch3 is *** 3698,3704 **** end if; if Token = Tok_Comma then ! Error_Msg_SC (""","" should be ""'|"""); else exit when Token /= Tok_Vertical_Bar; end if; --- 3714,3721 ---- end if; if Token = Tok_Comma then ! Error_Msg_SC -- CODEFIX ! (""","" should be ""'|"""); else exit when Token /= Tok_Vertical_Bar; end if; *************** package body Ch3 is *** 3739,3752 **** Typedef_Node : Node_Id; begin ! if Ada_Version < Ada_05 then Error_Msg_SP ("abstract interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; if Abstract_Present then ! Error_Msg_SP ("ABSTRACT not allowed in interface type definition " & ! "(RM 3.9.4(2/2))"); end if; Scan; -- past INTERFACE --- 3756,3770 ---- Typedef_Node : Node_Id; begin ! if Ada_Version < Ada_2005 then Error_Msg_SP ("abstract interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; if Abstract_Present then ! Error_Msg_SP ! ("ABSTRACT not allowed in interface type definition " & ! "(RM 3.9.4(2/2))"); end if; Scan; -- past INTERFACE *************** package body Ch3 is *** 3754,3760 **** -- Ada 2005 (AI-345): In case of interfaces with a null list of -- interfaces we build a record_definition node. ! if Token = Tok_Semicolon then Typedef_Node := New_Node (N_Record_Definition, Token_Ptr); Set_Abstract_Present (Typedef_Node); --- 3772,3778 ---- -- Ada 2005 (AI-345): In case of interfaces with a null list of -- interfaces we build a record_definition node. ! if Token = Tok_Semicolon or else Aspect_Specifications_Present then Typedef_Node := New_Node (N_Record_Definition, Token_Ptr); Set_Abstract_Present (Typedef_Node); *************** package body Ch3 is *** 3917,3923 **** -- Ada 2005 (AI-318-02) if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SC ("anonymous access result type is an Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); --- 3935,3941 ---- -- Ada 2005 (AI-318-02) if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SC ("anonymous access result type is an Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); *************** package body Ch3 is *** 4018,4024 **** or else Token = Tok_Procedure or else Token = Tok_Function then ! if Ada_Version < Ada_05 then Error_Msg_SP ("access-to-subprogram is an Ada 2005 extension"); Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); end if; --- 4036,4042 ---- or else Token = Tok_Procedure or else Token = Tok_Function then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("access-to-subprogram is an Ada 2005 extension"); Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); end if; *************** package body Ch3 is *** 4034,4040 **** Set_Null_Exclusion_Present (Def_Node, Null_Exclusion_Present); if Token = Tok_All then ! if Ada_Version < Ada_05 then Error_Msg_SP ("ALL is not permitted for anonymous access types"); end if; --- 4052,4058 ---- Set_Null_Exclusion_Present (Def_Node, Null_Exclusion_Present); if Token = Tok_All then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("ALL is not permitted for anonymous access types"); end if; *************** package body Ch3 is *** 4043,4049 **** Set_All_Present (Def_Node); elsif Token = Tok_Constant then ! if Ada_Version < Ada_05 then Error_Msg_SP ("access-to-constant is an Ada 2005 extension"); Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); end if; --- 4061,4067 ---- Set_All_Present (Def_Node); elsif Token = Tok_Constant then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("access-to-constant is an Ada 2005 extension"); Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); end if; *************** package body Ch3 is *** 4136,4142 **** when Tok_Function => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub), Decls); Done := False; when Tok_For => --- 4154,4160 ---- when Tok_Function => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp), Decls); Done := False; when Tok_For => *************** package body Ch3 is *** 4180,4186 **** Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); Token := Tok_Overriding; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub), Decls); Done := False; -- Normal case, no overriding, or overriding followed by colon --- 4198,4204 ---- Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); Token := Tok_Overriding; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp), Decls); Done := False; -- Normal case, no overriding, or overriding followed by colon *************** package body Ch3 is *** 4195,4211 **** when Tok_Not => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub), Decls); Done := False; when Tok_Overriding => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub), Decls); Done := False; when Tok_Package => Check_Bad_Layout; ! Append (P_Package (Pf_Decl_Gins_Pbod_Rnam_Stub), Decls); Done := False; when Tok_Pragma => --- 4213,4229 ---- when Tok_Not => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp), Decls); Done := False; when Tok_Overriding => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp), Decls); Done := False; when Tok_Package => Check_Bad_Layout; ! Append (P_Package (Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp), Decls); Done := False; when Tok_Pragma => *************** package body Ch3 is *** 4214,4220 **** when Tok_Procedure => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub), Decls); Done := False; when Tok_Protected => --- 4232,4238 ---- when Tok_Procedure => Check_Bad_Layout; ! Append (P_Subprogram (Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp), Decls); Done := False; when Tok_Protected => *************** package body Ch3 is *** 4284,4290 **** -- Otherwise we saved the semicolon position, so complain else ! Error_Msg ("|"";"" should be IS", SIS_Semicolon_Sloc); end if; -- The next job is to fix up any declarations that occurred --- 4302,4309 ---- -- Otherwise we saved the semicolon position, so complain else ! Error_Msg -- CODEFIX ! ("|"";"" should be IS", SIS_Semicolon_Sloc); end if; -- The next job is to fix up any declarations that occurred *************** package body Ch3 is *** 4328,4350 **** Done := True; end if; ! -- Normally an END terminates the scan for basic declarative ! -- items. The one exception is END RECORD, which is probably ! -- left over from some other junk. ! when Tok_End => ! Save_Scan_State (Scan_State); -- at END ! Scan; -- past END ! if Token = Tok_Record then ! Error_Msg_SP ("no RECORD for this `end record`!"); ! Scan; -- past RECORD ! TF_Semicolon; ! else ! Restore_Scan_State (Scan_State); -- to END ! Done := True; ! end if; -- The following tokens which can only be the start of a statement -- are considered to end a declarative part (i.e. we have a missing --- 4347,4369 ---- Done := True; end if; ! -- Normally an END terminates the scan for basic declarative items. ! -- The one exception is END RECORD, which is probably left over from ! -- some other junk. ! when Tok_End => ! Save_Scan_State (Scan_State); -- at END ! Scan; -- past END ! if Token = Tok_Record then ! Error_Msg_SP ("no RECORD for this `end record`!"); ! Scan; -- past RECORD ! TF_Semicolon; ! else ! Restore_Scan_State (Scan_State); -- to END ! Done := True; ! end if; -- The following tokens which can only be the start of a statement -- are considered to end a declarative part (i.e. we have a missing *************** package body Ch3 is *** 4519,4532 **** Kind = N_Task_Body or else Kind = N_Protected_Body then ! Error_Msg ! ("proper body not allowed in package spec", Sloc (Decl)); -- Test for body stub scanned, not acceptable as basic decl item elsif Kind in N_Body_Stub then ! Error_Msg ! ("body stub not allowed in package spec", Sloc (Decl)); elsif Kind = N_Assignment_Statement then Error_Msg --- 4538,4549 ---- Kind = N_Task_Body or else Kind = N_Protected_Body then ! Error_Msg ("proper body not allowed in package spec", Sloc (Decl)); -- Test for body stub scanned, not acceptable as basic decl item elsif Kind in N_Body_Stub then ! Error_Msg ("body stub not allowed in package spec", Sloc (Decl)); elsif Kind = N_Assignment_Statement then Error_Msg diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch4.adb gcc-4.6.0/gcc/ada/par-ch4.adb *** gcc-4.5.2/gcc/ada/par-ch4.adb Wed Oct 28 13:31:51 2009 --- gcc-4.6.0/gcc/ada/par-ch4.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch4 is *** 42,47 **** --- 42,48 ---- Attribute_Base => True, Attribute_Class => True, Attribute_Stub_Type => True, + Attribute_Type_Key => True, others => False); -- This map contains True for parameterless attributes that return a -- string or a type. For those attributes, a left parenthesis after *************** package body Ch4 is *** 63,68 **** --- 64,70 ---- function P_Aggregate_Or_Paren_Expr return Node_Id; function P_Allocator return Node_Id; + function P_Case_Expression_Alternative return Node_Id; function P_Record_Or_Array_Component_Association return Node_Id; function P_Factor return Node_Id; function P_Primary return Node_Id; *************** package body Ch4 is *** 232,244 **** Save_Scan_State (Scan_State); -- at apostrophe Scan; -- past apostrophe ! -- If left paren, then this might be a qualified expression, but we ! -- are only in the business of scanning out names, so return with ! -- Token backed up to point to the apostrophe. The treatment for ! -- the range attribute is similar (we do not consider x'range to ! -- be a name in this grammar). ! if Token = Tok_Left_Paren or else Token = Tok_Range then Restore_Scan_State (Scan_State); -- to apostrophe Expr_Form := EF_Simple_Name; return Name_Node; --- 234,251 ---- Save_Scan_State (Scan_State); -- at apostrophe Scan; -- past apostrophe ! -- Qualified expression in Ada 2012 mode (treated as a name) ! if Ada_Version >= Ada_2012 and then Token = Tok_Left_Paren then ! goto Scan_Name_Extension_Apostrophe; ! ! -- If left paren not in Ada 2012, then it is not part of the name, ! -- since qualified expressions are not names in prior versions of ! -- Ada, so return with Token backed up to point to the apostrophe. ! -- The treatment for the range attribute is similar (we do not ! -- consider x'range to be a name in this grammar). ! ! elsif Token = Tok_Left_Paren or else Token = Tok_Range then Restore_Scan_State (Scan_State); -- to apostrophe Expr_Form := EF_Simple_Name; return Name_Node; *************** package body Ch4 is *** 362,367 **** --- 369,378 ---- -- the current token to Tok_Semicolon, and returns True. -- Otherwise returns False. + ------------------------------------ + -- Apostrophe_Should_Be_Semicolon -- + ------------------------------------ + function Apostrophe_Should_Be_Semicolon return Boolean is begin if Token_Is_At_Start_Of_Line then *************** package body Ch4 is *** 377,390 **** -- Start of processing for Scan_Apostrophe begin -- If range attribute after apostrophe, then return with Token -- pointing to the apostrophe. Note that in this case the prefix -- need not be a simple name (cases like A.all'range). Similarly -- if there is a left paren after the apostrophe, then we also -- return with Token pointing to the apostrophe (this is the ! -- qualified expression case). ! if Token = Tok_Range or else Token = Tok_Left_Paren then Restore_Scan_State (Scan_State); -- to apostrophe Expr_Form := EF_Name; return Name_Node; --- 388,407 ---- -- Start of processing for Scan_Apostrophe begin + -- Check for qualified expression case in Ada 2012 mode + + if Ada_Version >= Ada_2012 and then Token = Tok_Left_Paren then + Name_Node := P_Qualified_Expression (Name_Node); + goto Scan_Name_Extension; + -- If range attribute after apostrophe, then return with Token -- pointing to the apostrophe. Note that in this case the prefix -- need not be a simple name (cases like A.all'range). Similarly -- if there is a left paren after the apostrophe, then we also -- return with Token pointing to the apostrophe (this is the ! -- aggregate case, or some error case). ! elsif Token = Tok_Range or else Token = Tok_Left_Paren then Restore_Scan_State (Scan_State); -- to apostrophe Expr_Form := EF_Name; return Name_Node; *************** package body Ch4 is *** 436,442 **** elsif Token = Tok_Access then Attr_Name := Name_Access; ! elsif Token = Tok_Mod and then Ada_Version = Ada_05 then Attr_Name := Name_Mod; elsif Apostrophe_Should_Be_Semicolon then --- 453,459 ---- elsif Token = Tok_Access then Attr_Name := Name_Access; ! elsif Token = Tok_Mod and then Ada_Version >= Ada_95 then Attr_Name := Name_Mod; elsif Apostrophe_Should_Be_Semicolon then *************** package body Ch4 is *** 565,572 **** elsif Token = Tok_Range then if Expr_Form /= EF_Simple_Name then ! Error_Msg_SC -- CODEFIX??? ! ("subtype mark must precede RANGE"); raise Error_Resync; end if; --- 582,588 ---- elsif Token = Tok_Range then if Expr_Form /= EF_Simple_Name then ! Error_Msg_SC ("subtype mark must precede RANGE"); raise Error_Resync; end if; *************** package body Ch4 is *** 632,638 **** Error_Msg ("expect identifier in parameter association", Sloc (Expr_Node)); ! Scan; -- past arrow. elsif not Comma_Present then T_Right_Paren; --- 648,654 ---- Error_Msg ("expect identifier in parameter association", Sloc (Expr_Node)); ! Scan; -- past arrow elsif not Comma_Present then T_Right_Paren; *************** package body Ch4 is *** 1153,1158 **** --- 1169,1201 ---- Lparen_Sloc : Source_Ptr; Scan_State : Saved_Scan_State; + procedure Box_Error; + -- Called if <> is encountered as positional aggregate element. Issues + -- error message and sets Expr_Node to Error. + + --------------- + -- Box_Error -- + --------------- + + procedure Box_Error is + begin + if Ada_Version < Ada_2005 then + Error_Msg_SC ("box in aggregate is an Ada 2005 extension"); + end if; + + -- Ada 2005 (AI-287): The box notation is allowed only with named + -- notation because positional notation might be error prone. For + -- example, in "(X, <>, Y, <>)", there is no type associated with + -- the boxes, so you might not be leaving out the components you + -- thought you were leaving out. + + Error_Msg_SC ("(Ada 2005) box only allowed with named notation"); + Scan; -- past box + Expr_Node := Error; + end Box_Error; + + -- Start of processing for P_Aggregate_Or_Paren_Expr + begin Lparen_Sloc := Token_Ptr; T_Left_Paren; *************** package body Ch4 is *** 1164,1169 **** --- 1207,1226 ---- T_Right_Paren; return Expr_Node; + -- Case expression case + + elsif Token = Tok_Case then + Expr_Node := P_Case_Expression; + T_Right_Paren; + return Expr_Node; + + -- Quantified expression case + + elsif Token = Tok_For then + Expr_Node := P_Quantified_Expression; + T_Right_Paren; + return Expr_Node; + -- Note: the mechanism used here of rescanning the initial expression -- is distinctly unpleasant, but it saves a lot of fiddling in scanning -- out the discrete choice list. *************** package body Ch4 is *** 1189,1214 **** end if; end if; ! -- Ada 2005 (AI-287): The box notation is allowed only with named ! -- notation because positional notation might be error prone. For ! -- example, in "(X, <>, Y, <>)", there is no type associated with ! -- the boxes, so you might not be leaving out the components you ! -- thought you were leaving out. ! if Ada_Version >= Ada_05 and then Token = Tok_Box then ! Error_Msg_SC ("(Ada 2005) box notation only allowed with " ! & "named notation"); ! Scan; -- past BOX ! Aggregate_Node := New_Node (N_Aggregate, Lparen_Sloc); ! return Aggregate_Node; end if; - Expr_Node := P_Expression_Or_Range_Attribute_If_OK; - -- Extension aggregate case if Token = Tok_With then - if Nkind (Expr_Node) = N_Attribute_Reference and then Attribute_Name (Expr_Node) = Name_Range then --- 1246,1262 ---- end if; end if; ! -- Scan expression, handling box appearing as positional argument ! if Token = Tok_Box then ! Box_Error; ! else ! Expr_Node := P_Expression_Or_Range_Attribute_If_OK; end if; -- Extension aggregate case if Token = Tok_With then if Nkind (Expr_Node) = N_Attribute_Reference and then Attribute_Name (Expr_Node) = Name_Range then *************** package body Ch4 is *** 1309,1316 **** "extension aggregate"); raise Error_Resync; ! -- A range attribute can only appear as part of a discrete choice ! -- list. elsif Nkind (Expr_Node) = N_Attribute_Reference and then Attribute_Name (Expr_Node) = Name_Range --- 1357,1363 ---- "extension aggregate"); raise Error_Resync; ! -- Range attribute can only appear as part of a discrete choice list elsif Nkind (Expr_Node) = N_Attribute_Reference and then Attribute_Name (Expr_Node) = Name_Range *************** package body Ch4 is *** 1332,1338 **** or else Token = Tok_Semicolon then if Present (Assoc_List) then ! Error_Msg_BC ("""='>"" expected (positional association cannot follow " & "named association)"); end if; --- 1379,1385 ---- or else Token = Tok_Semicolon then if Present (Assoc_List) then ! Error_Msg_BC -- CODEFIX ("""='>"" expected (positional association cannot follow " & "named association)"); end if; *************** package body Ch4 is *** 1375,1389 **** -- that doesn't belong to us! if Token in Token_Class_Eterm then ! Error_Msg_AP ("expecting expression or component association"); ! exit; end if; -- Otherwise initiate for reentry to top of loop by scanning an -- initial expression, unless the first token is OTHERS. ! if Token = Tok_Others then Expr_Node := Empty; else Save_Scan_State (Scan_State); -- at start of expression Expr_Node := P_Expression_Or_Range_Attribute_If_OK; --- 1422,1453 ---- -- that doesn't belong to us! if Token in Token_Class_Eterm then ! ! -- If Some becomes a keyword, the following is needed to make it ! -- acceptable in older versions of Ada. ! ! if Token = Tok_Some ! and then Ada_Version < Ada_2012 ! then ! Scan_Reserved_Identifier (False); ! else ! Error_Msg_AP ! ("expecting expression or component association"); ! exit; ! end if; end if; + -- Deal with misused box + + if Token = Tok_Box then + Box_Error; + -- Otherwise initiate for reentry to top of loop by scanning an -- initial expression, unless the first token is OTHERS. ! elsif Token = Tok_Others then Expr_Node := Empty; + else Save_Scan_State (Scan_State); -- at start of expression Expr_Node := P_Expression_Or_Range_Attribute_If_OK; *************** package body Ch4 is *** 1439,1445 **** -- Ada 2005(AI-287): The box notation is used to indicate the -- default initialization of aggregate components ! if Ada_Version < Ada_05 then Error_Msg_SP ("component association with '<'> is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 1503,1509 ---- -- Ada 2005(AI-287): The box notation is used to indicate the -- default initialization of aggregate components ! if Ada_Version < Ada_2005 then Error_Msg_SP ("component association with '<'> is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch4 is *** 1513,1522 **** -- 4.4 Expression -- --------------------- -- EXPRESSION ::= ! -- RELATION {and RELATION} | RELATION {and then RELATION} ! -- | RELATION {or RELATION} | RELATION {or else RELATION} ! -- | RELATION {xor RELATION} -- On return, Expr_Form indicates the categorization of the expression -- EF_Range_Attr is not a possible value (if a range attribute is found, --- 1577,1591 ---- -- 4.4 Expression -- --------------------- + -- This procedure parses EXPRESSION or CHOICE_EXPRESSION + -- EXPRESSION ::= ! -- RELATION {LOGICAL_OPERATOR RELATION} ! ! -- CHOICE_EXPRESSION ::= ! -- CHOICE_RELATION {LOGICAL_OPERATOR CHOICE_RELATION} ! ! -- LOGICAL_OPERATOR ::= and | and then | or | or else | xor -- On return, Expr_Form indicates the categorization of the expression -- EF_Range_Attr is not a possible value (if a range attribute is found, *************** package body Ch4 is *** 1570,1582 **** end P_Expression; -- This function is identical to the normal P_Expression, except that it ! -- also permits the appearence of a conditional expression without the ! -- usual surrounding parentheses. function P_Expression_If_OK return Node_Id is begin ! if Token = Tok_If then return P_Conditional_Expression; else return P_Expression; end if; --- 1639,1658 ---- end P_Expression; -- This function is identical to the normal P_Expression, except that it ! -- also permits the appearance of a case, conditional, or quantified ! -- expression without the usual surrounding parentheses. function P_Expression_If_OK return Node_Id is begin ! if Token = Tok_Case then ! return P_Case_Expression; ! ! elsif Token = Tok_If then return P_Conditional_Expression; + + elsif Token = Tok_For then + return P_Quantified_Expression; + else return P_Expression; end if; *************** package body Ch4 is *** 1672,1683 **** end if; end P_Expression_Or_Range_Attribute; ! -- Version that allows a non-parenthesized conditional expression function P_Expression_Or_Range_Attribute_If_OK return Node_Id is begin ! if Token = Tok_If then return P_Conditional_Expression; else return P_Expression_Or_Range_Attribute; end if; --- 1748,1767 ---- end if; end P_Expression_Or_Range_Attribute; ! -- Version that allows a non-parenthesized case, conditional, or quantified ! -- expression function P_Expression_Or_Range_Attribute_If_OK return Node_Id is begin ! if Token = Tok_Case then ! return P_Case_Expression; ! ! elsif Token = Tok_If then return P_Conditional_Expression; + + elsif Token = Tok_For then + return P_Quantified_Expression; + else return P_Expression_Or_Range_Attribute; end if; *************** package body Ch4 is *** 1687,1696 **** -- 4.4 Relation -- ------------------- ! -- RELATION ::= -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] ! -- | SIMPLE_EXPRESSION [not] in RANGE ! -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK -- On return, Expr_Form indicates the categorization of the expression --- 1771,1789 ---- -- 4.4 Relation -- ------------------- ! -- This procedure scans both relations and choice relations ! ! -- CHOICE_RELATION ::= -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] ! ! -- RELATION ::= ! -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST ! ! -- MEMBERSHIP_CHOICE_LIST ::= ! -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE} ! ! -- MEMBERSHIP_CHOICE ::= ! -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK -- On return, Expr_Form indicates the categorization of the expression *************** package body Ch4 is *** 2020,2026 **** if Token = Tok_Dot then Error_Msg_SC ("prefix for selection is not a name"); ! raise Error_Resync; end if; -- Special test to improve error recovery: If the current token is --- 2113,2129 ---- if Token = Tok_Dot then Error_Msg_SC ("prefix for selection is not a name"); ! ! -- If qualified expression, comment and continue, otherwise something ! -- is pretty nasty so do an Error_Resync call. ! ! if Ada_Version < Ada_2012 ! and then Nkind (Node1) = N_Qualified_Expression ! then ! Error_Msg_SC ("\would be legal in Ada 2012 mode"); ! else ! raise Error_Resync; ! end if; end if; -- Special test to improve error recovery: If the current token is *************** package body Ch4 is *** 2226,2232 **** -- NUMERIC_LITERAL | null -- | STRING_LITERAL | AGGREGATE -- | NAME | QUALIFIED_EXPRESSION ! -- | ALLOCATOR | (EXPRESSION) -- Error recovery: can raise Error_Resync --- 2329,2335 ---- -- NUMERIC_LITERAL | null -- | STRING_LITERAL | AGGREGATE -- | NAME | QUALIFIED_EXPRESSION ! -- | ALLOCATOR | (EXPRESSION) | QUANTIFIED_EXPRESSION -- Error recovery: can raise Error_Resync *************** package body Ch4 is *** 2339,2347 **** return Error; -- If this looks like a conditional expression, then treat it ! -- that way with an error messasge. ! elsif Extensions_Allowed then Error_Msg_SC ("conditional expression must be parenthesized"); return P_Conditional_Expression; --- 2442,2450 ---- return Error; -- If this looks like a conditional expression, then treat it ! -- that way with an error message. ! elsif Ada_Version >= Ada_2012 then Error_Msg_SC ("conditional expression must be parenthesized"); return P_Conditional_Expression; *************** package body Ch4 is *** 2352,2357 **** --- 2455,2504 ---- return P_Identifier; end if; + -- Deal with CASE (possible unparenthesized case expression) + + when Tok_Case => + + -- If this looks like a real case, defined as a CASE appearing + -- the start of a new line, then we consider we have a missing + -- operand. + + if Token_Is_At_Start_Of_Line then + Error_Msg_AP ("missing operand"); + return Error; + + -- If this looks like a case expression, then treat it that way + -- with an error message. + + elsif Ada_Version >= Ada_2012 then + Error_Msg_SC ("case expression must be parenthesized"); + return P_Case_Expression; + + -- Otherwise treat as misused identifier + + else + return P_Identifier; + end if; + + -- For [all | some] indicates a quantified expression + + when Tok_For => + + if Token_Is_At_Start_Of_Line then + Error_Msg_AP ("misplaced loop"); + return Error; + + elsif Ada_Version >= Ada_2012 then + Error_Msg_SC ("quantified expression must be parenthesized"); + return P_Quantified_Expression; + + else + + -- Otherwise treat as misused identifier + + return P_Identifier; + end if; + -- Anything else is illegal as the first token of a primary, but -- we test for a reserved identifier so that it is treated nicely *************** package body Ch4 is *** 2360,2366 **** return P_Identifier; elsif Prev_Token = Tok_Comma then ! Error_Msg_SP ("|extra "","" ignored"); raise Error_Resync; else --- 2507,2514 ---- return P_Identifier; elsif Prev_Token = Tok_Comma then ! Error_Msg_SP -- CODEFIX ! ("|extra "","" ignored"); raise Error_Resync; else *************** package body Ch4 is *** 2372,2377 **** --- 2520,2575 ---- end loop; end P_Primary; + ------------------------------- + -- 4.4 Quantified_Expression -- + ------------------------------- + + -- QUANTIFIED_EXPRESSION ::= + -- for QUANTIFIER LOOP_PARAMETER_SPECIFICATION => PREDICATE | + -- for QUANTIFIER ITERATOR_SPECIFICATION => PREDICATE + + function P_Quantified_Expression return Node_Id is + I_Spec : Node_Id; + Node1 : Node_Id; + + begin + Scan; -- past FOR + + Node1 := New_Node (N_Quantified_Expression, Prev_Token_Ptr); + + if Token = Tok_All then + Set_All_Present (Node1); + + -- We treat Some as a non-reserved keyword, so it appears to the scanner + -- as an identifier. If Some is made into a reserved word, the check + -- below is against Tok_Some. + + elsif Token /= Tok_Identifier + or else Chars (Token_Node) /= Name_Some + then + Error_Msg_AP ("missing quantifier"); + raise Error_Resync; + end if; + + Scan; -- past SOME + I_Spec := P_Loop_Parameter_Specification; + + if Nkind (I_Spec) = N_Loop_Parameter_Specification then + Set_Loop_Parameter_Specification (Node1, I_Spec); + else + Set_Iterator_Specification (Node1, I_Spec); + end if; + + if Token = Tok_Arrow then + Scan; + Set_Condition (Node1, P_Expression); + return Node1; + else + Error_Msg_AP ("missing arrow"); + raise Error_Resync; + end if; + end P_Quantified_Expression; + --------------------------- -- 4.5 Logical Operator -- --------------------------- *************** package body Ch4 is *** 2458,2464 **** begin if Token = Tok_Box then ! Error_Msg_SC ("|""'<'>"" should be ""/="""); end if; Op_Kind := Relop_Node (Token); --- 2656,2663 ---- begin if Token = Tok_Box then ! Error_Msg_SC -- CODEFIX ! ("|""'<'>"" should be ""/="""); end if; Op_Kind := Relop_Node (Token); *************** package body Ch4 is *** 2573,2579 **** -- Error_Recovery: cannot raise Error_Resync ! function P_Qualified_Expression (Subtype_Mark : Node_Id) return Node_Id is Qual_Node : Node_Id; begin Qual_Node := New_Node (N_Qualified_Expression, Prev_Token_Ptr); --- 2772,2778 ---- -- Error_Recovery: cannot raise Error_Resync ! function P_Qualified_Expression (Subtype_Mark : Node_Id) return Node_Id is Qual_Node : Node_Id; begin Qual_Node := New_Node (N_Qualified_Expression, Prev_Token_Ptr); *************** package body Ch4 is *** 2620,2625 **** --- 2819,2912 ---- return Alloc_Node; end P_Allocator; + ----------------------- + -- P_Case_Expression -- + ----------------------- + + function P_Case_Expression return Node_Id is + Loc : constant Source_Ptr := Token_Ptr; + Case_Node : Node_Id; + Save_State : Saved_Scan_State; + + begin + if Ada_Version < Ada_2012 then + Error_Msg_SC ("|case expression is an Ada 2012 feature"); + Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch"); + end if; + + Scan; -- past CASE + Case_Node := + Make_Case_Expression (Loc, + Expression => P_Expression_No_Right_Paren, + Alternatives => New_List); + T_Is; + + -- We now have scanned out CASE expression IS, scan alternatives + + loop + T_When; + Append_To (Alternatives (Case_Node), P_Case_Expression_Alternative); + + -- Missing comma if WHEN (more alternatives present) + + if Token = Tok_When then + T_Comma; + + -- If comma/WHEN, skip comma and we have another alternative + + elsif Token = Tok_Comma then + Save_Scan_State (Save_State); + Scan; -- past comma + + if Token /= Tok_When then + Restore_Scan_State (Save_State); + exit; + end if; + + -- If no comma or WHEN, definitely done + + else + exit; + end if; + end loop; + + -- If we have an END CASE, diagnose as not needed + + if Token = Tok_End then + Error_Msg_SC ("`END CASE` not allowed at end of case expression"); + Scan; -- past END + + if Token = Tok_Case then + Scan; -- past CASE; + end if; + end if; + + -- Return the Case_Expression node + + return Case_Node; + end P_Case_Expression; + + ----------------------------------- + -- P_Case_Expression_Alternative -- + ----------------------------------- + + -- CASE_STATEMENT_ALTERNATIVE ::= + -- when DISCRETE_CHOICE_LIST => + -- EXPRESSION + + -- The caller has checked that and scanned past the initial WHEN token + -- Error recovery: can raise Error_Resync + + function P_Case_Expression_Alternative return Node_Id is + Case_Alt_Node : Node_Id; + begin + Case_Alt_Node := New_Node (N_Case_Expression_Alternative, Token_Ptr); + Set_Discrete_Choices (Case_Alt_Node, P_Discrete_Choice_List); + TF_Arrow; + Set_Expression (Case_Alt_Node, P_Expression); + return Case_Alt_Node; + end P_Case_Expression_Alternative; + ------------------------------ -- P_Conditional_Expression -- ------------------------------ *************** package body Ch4 is *** 2633,2645 **** begin Inside_Conditional_Expression := Inside_Conditional_Expression + 1; ! if Token = Tok_If and then not Extensions_Allowed then ! Error_Msg_SC ("|conditional expression is an Ada extension"); ! Error_Msg_SC ("\|use -gnatX switch to compile this unit"); end if; Scan; -- past IF or ELSIF ! Append_To (Exprs, P_Expression_No_Right_Paren); TF_Then; Append_To (Exprs, P_Expression); --- 2920,2932 ---- begin Inside_Conditional_Expression := Inside_Conditional_Expression + 1; ! if Token = Tok_If and then Ada_Version < Ada_2012 then ! Error_Msg_SC ("|conditional expression is an Ada 2012 feature"); ! Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch"); end if; Scan; -- past IF or ELSIF ! Append_To (Exprs, P_Condition); TF_Then; Append_To (Exprs, P_Expression); *************** package body Ch4 is *** 2652,2658 **** Scan; -- past semicolon if Token = Tok_Else or else Token = Tok_Elsif then ! Error_Msg_SP ("|extra "";"" ignored"); else Restore_Scan_State (State); --- 2939,2946 ---- Scan; -- past semicolon if Token = Tok_Else or else Token = Tok_Elsif then ! Error_Msg_SP -- CODEFIX ! ("|extra "";"" ignored"); else Restore_Scan_State (State); *************** package body Ch4 is *** 2706,2723 **** -- P_Membership_Test -- ----------------------- procedure P_Membership_Test (N : Node_Id) is Alt : constant Node_Id := P_Range_Or_Subtype_Mark ! (Allow_Simple_Expression => Extensions_Allowed); begin -- Set case if Token = Tok_Vertical_Bar then ! if not Extensions_Allowed then ! Error_Msg_SC ("set notation is a language extension"); ! Error_Msg_SC ("\|use -gnatX switch to compile this unit"); end if; Set_Alternatives (N, New_List (Alt)); --- 2994,3014 ---- -- P_Membership_Test -- ----------------------- + -- MEMBERSHIP_CHOICE_LIST ::= MEMBERHIP_CHOICE {'|' MEMBERSHIP_CHOICE} + -- MEMBERSHIP_CHOICE ::= CHOICE_EXPRESSION | range | subtype_mark + procedure P_Membership_Test (N : Node_Id) is Alt : constant Node_Id := P_Range_Or_Subtype_Mark ! (Allow_Simple_Expression => (Ada_Version >= Ada_2012)); begin -- Set case if Token = Tok_Vertical_Bar then ! if Ada_Version < Ada_2012 then ! Error_Msg_SC ("set notation is an Ada 2012 feature"); ! Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch"); end if; Set_Alternatives (N, New_List (Alt)); diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch5.adb gcc-4.6.0/gcc/ada/par-ch5.adb *** gcc-4.5.2/gcc/ada/par-ch5.adb Wed May 6 12:49:36 2009 --- gcc-4.6.0/gcc/ada/par-ch5.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch5 is *** 34,45 **** function P_Case_Statement return Node_Id; function P_Case_Statement_Alternative return Node_Id; - function P_Condition return Node_Id; function P_Exit_Statement return Node_Id; function P_Goto_Statement return Node_Id; function P_If_Statement return Node_Id; function P_Label return Node_Id; - function P_Loop_Parameter_Specification return Node_Id; function P_Null_Statement return Node_Id; function P_Assignment_Statement (LHS : Node_Id) return Node_Id; --- 34,43 ---- *************** package body Ch5 is *** 62,67 **** --- 60,70 ---- -- the N_Identifier node for the label on the loop. If Loop_Name is -- Empty on entry (the default), then the for statement is unlabeled. + function P_Iterator_Specification (Def_Id : Node_Id) return Node_Id; + -- Parse an iterator specification. The defining identifier has already + -- been scanned, as it is the common prefix between loop and iterator + -- specification. + function P_Loop_Statement (Loop_Name : Node_Id := Empty) return Node_Id; -- Parse loop statement. If Loop_Name is non-Empty on entry, it is -- the N_Identifier node for the label on the loop. If Loop_Name is *************** package body Ch5 is *** 84,90 **** -- 5.1 Sequence of Statements -- --------------------------------- ! -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT} -- STATEMENT ::= -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT --- 87,94 ---- -- 5.1 Sequence of Statements -- --------------------------------- ! -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT} {LABEL} ! -- Note: the final label is an Ada 2012 addition. -- STATEMENT ::= -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT *************** package body Ch5 is *** 150,155 **** --- 154,165 ---- -- is required. It is initialized from the Sreq flag, and modified as -- statements are scanned (a statement turns it off, and a label turns -- it back on again since a statement must follow a label). + -- Note : this final requirement is lifted in Ada 2012. + + Statement_Seen : Boolean; + -- In Ada 2012, a label can end a sequence of statements, but the + -- sequence cannot contain only labels. This flag is set whenever a + -- label is encountered, to enforce this rule at the end of a sequence. Declaration_Found : Boolean := False; -- This flag is set True if a declaration is encountered, so that the *************** package body Ch5 is *** 191,199 **** ----------------------------- procedure Test_Statement_Required is begin if Statement_Required then ! Error_Msg_BC ("statement expected"); end if; end Test_Statement_Required; --- 201,257 ---- ----------------------------- procedure Test_Statement_Required is + function All_Pragmas return Boolean; + -- Return True if statement list is all pragmas + + ----------------- + -- All_Pragmas -- + ----------------- + + function All_Pragmas return Boolean is + S : Node_Id; + begin + S := First (Statement_List); + while Present (S) loop + if Nkind (S) /= N_Pragma then + return False; + else + Next (S); + end if; + end loop; + + return True; + end All_Pragmas; + + -- Start of processing for Test_Statement_Required + begin if Statement_Required then ! ! -- Check no statement required after label in Ada 2012, and that ! -- it is OK to have nothing but pragmas in a statement sequence. ! ! if Ada_Version >= Ada_2012 ! and then not Is_Empty_List (Statement_List) ! and then ! ((Nkind (Last (Statement_List)) = N_Label ! and then Statement_Seen) ! or else All_Pragmas) ! then ! declare ! Null_Stm : constant Node_Id := ! Make_Null_Statement (Token_Ptr); ! begin ! Set_Comes_From_Source (Null_Stm, False); ! Append_To (Statement_List, Null_Stm); ! end; ! ! -- If not Ada 2012, or not special case above, give error message ! ! else ! Error_Msg_BC -- CODEFIX ! ("statement expected"); ! end if; end if; end Test_Statement_Required; *************** package body Ch5 is *** 202,207 **** --- 260,266 ---- begin Statement_List := New_List; Statement_Required := SS_Flags.Sreq; + Statement_Seen := False; loop Ignore (Tok_Semicolon); *************** package body Ch5 is *** 333,342 **** when Tok_Exception => Test_Statement_Required; ! -- If Extm not set and the exception is not to the left ! -- of the expected column of the end for this sequence, then ! -- we assume it belongs to the current sequence, even though ! -- it is not permitted. if not SS_Flags.Extm and then Start_Column >= Scope.Table (Scope.Last).Ecol --- 392,401 ---- when Tok_Exception => Test_Statement_Required; ! -- If Extm not set and the exception is not to the left of ! -- the expected column of the end for this sequence, then we ! -- assume it belongs to the current sequence, even though it ! -- is not permitted. if not SS_Flags.Extm and then Start_Column >= Scope.Table (Scope.Last).Ecol *************** package body Ch5 is *** 349,355 **** -- Always return, in the case where we scanned out handlers -- that we did not expect, Parse_Exception_Handlers returned ! -- with Token being either end or EOF, so we are OK exit; --- 408,414 ---- -- Always return, in the case where we scanned out handlers -- that we did not expect, Parse_Exception_Handlers returned ! -- with Token being either end or EOF, so we are OK. exit; *************** package body Ch5 is *** 357,364 **** when Tok_Or => ! -- Terminate if Ortm set or if the or is to the left ! -- of the expected column of the end for this sequence if SS_Flags.Ortm or else Start_Column < Scope.Table (Scope.Last).Ecol --- 416,423 ---- when Tok_Or => ! -- Terminate if Ortm set or if the or is to the left of the ! -- expected column of the end for this sequence. if SS_Flags.Ortm or else Start_Column < Scope.Table (Scope.Last).Ecol *************** package body Ch5 is *** 384,392 **** exit when SS_Flags.Tatm and then Token = Tok_Abort; ! -- Otherwise we treat THEN as some kind of mess where we ! -- did not see the associated IF, but we pick up assuming ! -- it had been there! Restore_Scan_State (Scan_State); -- to THEN Append_To (Statement_List, P_If_Statement); --- 443,451 ---- exit when SS_Flags.Tatm and then Token = Tok_Abort; ! -- Otherwise we treat THEN as some kind of mess where we did ! -- not see the associated IF, but we pick up assuming it had ! -- been there! Restore_Scan_State (Scan_State); -- to THEN Append_To (Statement_List, P_If_Statement); *************** package body Ch5 is *** 396,403 **** when Tok_When | Tok_Others => ! -- Terminate if Whtm set or if the WHEN is to the left ! -- of the expected column of the end for this sequence if SS_Flags.Whtm or else Start_Column < Scope.Table (Scope.Last).Ecol --- 455,462 ---- when Tok_When | Tok_Others => ! -- Terminate if Whtm set or if the WHEN is to the left of ! -- the expected column of the end for this sequence. if SS_Flags.Whtm or else Start_Column < Scope.Table (Scope.Last).Ecol *************** package body Ch5 is *** 607,613 **** or else Nkind (Name_Node) = N_Selected_Component) then ! Error_Msg_SC ("""/"" should be ""."""); Statement_Required := False; raise Error_Resync; --- 666,673 ---- or else Nkind (Name_Node) = N_Selected_Component) then ! Error_Msg_SC -- CODEFIX ! ("""/"" should be ""."""); Statement_Required := False; raise Error_Resync; *************** package body Ch5 is *** 717,724 **** --- 777,791 ---- Statement_Required := False; -- Label starting with << which must precede real statement + -- Note: in Ada 2012, the label may end the sequence. when Tok_Less_Less => + if Present (Last (Statement_List)) + and then Nkind (Last (Statement_List)) /= N_Label + then + Statement_Seen := True; + end if; + Append_To (Statement_List, P_Label); Statement_Required := True; *************** package body Ch5 is *** 857,863 **** Junk_Declaration; else ! Error_Msg_BC ("statement expected"); raise Error_Resync; end if; end case; --- 924,931 ---- Junk_Declaration; else ! Error_Msg_BC -- CODEFIX ! ("statement expected"); raise Error_Resync; end if; end case; *************** package body Ch5 is *** 1172,1178 **** -- of WHEN expression => if Token = Tok_Arrow then ! Error_Msg_SC ("THEN expected"); Scan; -- past the arrow Pop_Scope_Stack; -- remove unneeded entry raise Error_Resync; --- 1240,1247 ---- -- of WHEN expression => if Token = Tok_Arrow then ! Error_Msg_SC -- CODEFIX ! ("THEN expected"); Scan; -- past the arrow Pop_Scope_Stack; -- remove unneeded entry raise Error_Resync; *************** package body Ch5 is *** 1208,1214 **** Scan; -- past ELSE if Else_Should_Be_Elsif then ! Error_Msg_SP ("ELSE should be ELSIF"); Add_Elsif_Part; else --- 1277,1284 ---- Scan; -- past ELSE if Else_Should_Be_Elsif then ! Error_Msg_SP -- CODEFIX ! ("ELSE should be ELSIF"); Add_Elsif_Part; else *************** package body Ch5 is *** 1258,1264 **** if Token = Tok_Colon_Equal then while Token = Tok_Colon_Equal loop ! Error_Msg_SC (""":="" should be ""="""); Scan; -- past junk := Discard_Junk_Node (P_Expression_No_Right_Paren); end loop; --- 1328,1335 ---- if Token = Tok_Colon_Equal then while Token = Tok_Colon_Equal loop ! Error_Msg_SC -- CODEFIX ! (""":="" should be ""="""); Scan; -- past junk := Discard_Junk_Node (P_Expression_No_Right_Paren); end loop; *************** package body Ch5 is *** 1453,1460 **** if No (Loop_Name) then Created_Name := ! Make_Identifier (Sloc (Loop_Node), ! Chars => Set_Loop_Block_Name ('L')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Loop_Node, True); Set_Identifier (Loop_Node, Created_Name); --- 1524,1530 ---- if No (Loop_Name) then Created_Name := ! Make_Identifier (Sloc (Loop_Node), Set_Loop_Block_Name ('L')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Loop_Node, True); Set_Identifier (Loop_Node, Created_Name); *************** package body Ch5 is *** 1486,1491 **** --- 1556,1562 ---- Iter_Scheme_Node : Node_Id; Loop_For_Flag : Boolean; Created_Name : Node_Id; + Spec : Node_Id; begin Push_Scope_Stack; *************** package body Ch5 is *** 1497,1504 **** Loop_For_Flag := (Prev_Token = Tok_Loop); Scan; -- past FOR Iter_Scheme_Node := New_Node (N_Iteration_Scheme, Token_Ptr); ! Set_Loop_Parameter_Specification ! (Iter_Scheme_Node, P_Loop_Parameter_Specification); -- The following is a special test so that a miswritten for loop such -- as "loop for I in 1..10;" is handled nicely, without making an extra --- 1568,1580 ---- Loop_For_Flag := (Prev_Token = Tok_Loop); Scan; -- past FOR Iter_Scheme_Node := New_Node (N_Iteration_Scheme, Token_Ptr); ! Spec := P_Loop_Parameter_Specification; ! ! if Nkind (Spec) = N_Loop_Parameter_Specification then ! Set_Loop_Parameter_Specification (Iter_Scheme_Node, Spec); ! else ! Set_Iterator_Specification (Iter_Scheme_Node, Spec); ! end if; -- The following is a special test so that a miswritten for loop such -- as "loop for I in 1..10;" is handled nicely, without making an extra *************** package body Ch5 is *** 1519,1526 **** if No (Loop_Name) then Created_Name := ! Make_Identifier (Sloc (Loop_Node), ! Chars => Set_Loop_Block_Name ('L')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Loop_Node, True); Set_Identifier (Loop_Node, Created_Name); --- 1595,1601 ---- if No (Loop_Name) then Created_Name := ! Make_Identifier (Sloc (Loop_Node), Set_Loop_Block_Name ('L')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Loop_Node, True); Set_Identifier (Loop_Node, Created_Name); *************** package body Ch5 is *** 1586,1593 **** if No (Loop_Name) then Created_Name := ! Make_Identifier (Sloc (Loop_Node), ! Chars => Set_Loop_Block_Name ('L')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Loop_Node, True); Set_Identifier (Loop_Node, Created_Name); --- 1661,1667 ---- if No (Loop_Name) then Created_Name := ! Make_Identifier (Sloc (Loop_Node), Set_Loop_Block_Name ('L')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Loop_Node, True); Set_Identifier (Loop_Node, Created_Name); *************** package body Ch5 is *** 1620,1630 **** Scan_State : Saved_Scan_State; begin - Loop_Param_Specification_Node := - New_Node (N_Loop_Parameter_Specification, Token_Ptr); Save_Scan_State (Scan_State); ID_Node := P_Defining_Identifier (C_In); Set_Defining_Identifier (Loop_Param_Specification_Node, ID_Node); if Token = Tok_Left_Paren then --- 1694,1725 ---- Scan_State : Saved_Scan_State; begin Save_Scan_State (Scan_State); ID_Node := P_Defining_Identifier (C_In); + + -- If the next token is OF, it indicates an Ada 2012 iterator. If the + -- next token is a colon, this is also an Ada 2012 iterator, including + -- a subtype indication for the loop parameter. Otherwise we parse the + -- construct as a loop parameter specification. Note that the form + -- "for A in B" is ambiguous, and must be resolved semantically: if B + -- is a discrete subtype this is a loop specification, but if it is an + -- expression it is an iterator specification. Ambiguity is resolved + -- during analysis of the loop parameter specification. + + if Token = Tok_Of or else Token = Tok_Colon then + if Ada_Version < Ada_2012 then + Error_Msg_SC ("iterator is an Ada2012 feature"); + end if; + + return P_Iterator_Specification (ID_Node); + end if; + + -- The span of the Loop_Parameter_Specification starts at the + -- defining identifier. + + Loop_Param_Specification_Node := + New_Node (N_Loop_Parameter_Specification, Sloc (ID_Node)); Set_Defining_Identifier (Loop_Param_Specification_Node, ID_Node); if Token = Tok_Left_Paren then *************** package body Ch5 is *** 1654,1659 **** --- 1749,1790 ---- return Error; end P_Loop_Parameter_Specification; + ---------------------------------- + -- 5.5.1 Iterator_Specification -- + ---------------------------------- + + function P_Iterator_Specification (Def_Id : Node_Id) return Node_Id is + Node1 : Node_Id; + + begin + Node1 := New_Node (N_Iterator_Specification, Sloc (Def_Id)); + Set_Defining_Identifier (Node1, Def_Id); + + if Token = Tok_Colon then + Scan; -- past : + Set_Subtype_Indication (Node1, P_Subtype_Indication); + end if; + + if Token = Tok_Of then + Set_Of_Present (Node1); + Scan; -- past OF + + elsif Token = Tok_In then + Scan; -- past IN + + else + return Error; + end if; + + if Token = Tok_Reverse then + Scan; -- past REVERSE + Set_Reverse_Present (Node1, True); + end if; + + Set_Name (Node1, P_Name); + return Node1; + end P_Iterator_Specification; + -------------------------- -- 5.6 Block Statement -- -------------------------- *************** package body Ch5 is *** 1699,1706 **** if No (Block_Name) then Created_Name := ! Make_Identifier (Sloc (Block_Node), ! Chars => Set_Loop_Block_Name ('B')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Block_Node, True); Set_Identifier (Block_Node, Created_Name); --- 1830,1836 ---- if No (Block_Name) then Created_Name := ! Make_Identifier (Sloc (Block_Node), Set_Loop_Block_Name ('B')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Block_Node, True); Set_Identifier (Block_Node, Created_Name); *************** package body Ch5 is *** 1741,1748 **** if No (Block_Name) then Created_Name := ! Make_Identifier (Sloc (Block_Node), ! Chars => Set_Loop_Block_Name ('B')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Block_Node, True); Set_Identifier (Block_Node, Created_Name); --- 1871,1877 ---- if No (Block_Name) then Created_Name := ! Make_Identifier (Sloc (Block_Node), Set_Loop_Block_Name ('B')); Set_Comes_From_Source (Created_Name, False); Set_Has_Created_Identifier (Block_Node, True); Set_Identifier (Block_Node, Created_Name); *************** package body Ch5 is *** 2196,2202 **** -- What we are interested in is whether it was a case of a bad IS. if Scope.Table (Scope.Last + 1).Etyp = E_Bad_Is then ! Error_Msg ("|IS should be "";""", Scope.Table (Scope.Last + 1).S_Is); Set_Bad_Is_Detected (Parent, True); end if; --- 2325,2332 ---- -- What we are interested in is whether it was a case of a bad IS. if Scope.Table (Scope.Last + 1).Etyp = E_Bad_Is then ! Error_Msg -- CODEFIX ! ("|IS should be "";""", Scope.Table (Scope.Last + 1).S_Is); Set_Bad_Is_Detected (Parent, True); end if; *************** package body Ch5 is *** 2225,2231 **** TF_Then; while Token = Tok_Then loop ! Error_Msg_SC ("redundant THEN"); TF_Then; end loop; --- 2355,2362 ---- TF_Then; while Token = Tok_Then loop ! Error_Msg_SC -- CODEFIX ! ("redundant THEN"); TF_Then; end loop; diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch6.adb gcc-4.6.0/gcc/ada/par-ch6.adb *** gcc-4.5.2/gcc/ada/par-ch6.adb Wed May 6 12:53:27 2009 --- gcc-4.6.0/gcc/ada/par-ch6.adb Tue Oct 12 09:10:13 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch6 is *** 64,70 **** if Token = Tok_Return then Restore_Scan_State (Scan_State); ! Error_Msg_SC ("|extra "";"" ignored"); Scan; -- rescan past junk semicolon else Restore_Scan_State (Scan_State); --- 64,71 ---- if Token = Tok_Return then Restore_Scan_State (Scan_State); ! Error_Msg_SC -- CODEFIX ! ("|extra "";"" ignored"); Scan; -- rescan past junk semicolon else Restore_Scan_State (Scan_State); *************** package body Ch6 is *** 81,91 **** -- This routine scans out a subprogram declaration, subprogram body, -- subprogram renaming declaration or subprogram generic instantiation. ! -- SUBPROGRAM_DECLARATION ::= SUBPROGRAM_SPECIFICATION; -- ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- SUBPROGRAM_SPECIFICATION is abstract; -- SUBPROGRAM_SPECIFICATION ::= -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE --- 82,96 ---- -- This routine scans out a subprogram declaration, subprogram body, -- subprogram renaming declaration or subprogram generic instantiation. + -- It also handles the new Ada 2012 parameterized expression form ! -- SUBPROGRAM_DECLARATION ::= ! -- SUBPROGRAM_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- SUBPROGRAM_SPECIFICATION is abstract ! -- [ASPECT_SPECIFICATIONS]; -- SUBPROGRAM_SPECIFICATION ::= -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE *************** package body Ch6 is *** 121,126 **** --- 126,134 ---- -- is classified as a basic declarative item, but it is parsed here, with -- other subprogram constructs. + -- PARAMETERIZED_EXPRESSION ::= + -- FUNCTION SPECIFICATION IS (EXPRESSION); + -- The value in Pf_Flags indicates which of these possible declarations -- is acceptable to the caller: *************** package body Ch6 is *** 129,134 **** --- 137,143 ---- -- Pf_Flags.Pbod Set if proper body OK -- Pf_Flags.Rnam Set if renaming declaration OK -- Pf_Flags.Stub Set if body stub OK + -- Pf_Flags.Pexp Set if parameterized expression OK -- If an inappropriate form is encountered, it is scanned out but an -- error message indicating that it is appearing in an inappropriate *************** package body Ch6 is *** 195,201 **** Not_Overriding := True; else ! Error_Msg_SC ("OVERRIDING expected!"); end if; -- Ada 2005: scan leading OVERRIDING indicator --- 204,211 ---- Not_Overriding := True; else ! Error_Msg_SC -- CODEFIX ! ("OVERRIDING expected!"); end if; -- Ada 2005: scan leading OVERRIDING indicator *************** package body Ch6 is *** 209,228 **** Is_Overriding := True; end if; ! if (Is_Overriding or else Not_Overriding) then ! -- Note that if we are not in Ada_05 mode, error messages have -- already been given, so no need to give another message here. -- An overriding indicator is allowed for subprogram declarations, ! -- bodies, renamings, stubs, and instantiations. The test against ! -- Pf_Decl_Pbod is added to account for the case of subprograms ! -- declared in a protected type, where only subprogram declarations ! -- and bodies can occur. ! if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub and then ! Pf_Flags /= Pf_Decl_Pbod then Error_Msg_SC ("overriding indicator not allowed here!"); --- 219,241 ---- Is_Overriding := True; end if; ! if Is_Overriding or else Not_Overriding then ! -- Note that if we are not in Ada_2005 mode, error messages have -- already been given, so no need to give another message here. -- An overriding indicator is allowed for subprogram declarations, ! -- bodies (including subunits), renamings, stubs, and instantiations. ! -- The test against Pf_Decl_Pbod is added to account for the case of ! -- subprograms declared in a protected type, where only subprogram ! -- declarations and bodies can occur. The Pf_Pbod case is for ! -- subunits. ! if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp and then ! Pf_Flags /= Pf_Decl_Pbod_Pexp ! and then ! Pf_Flags /= Pf_Pbod_Pexp then Error_Msg_SC ("overriding indicator not allowed here!"); *************** package body Ch6 is *** 295,301 **** Set_Defining_Unit_Name (Inst_Node, Name_Node); Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt); ! TF_Semicolon; Pop_Scope_Stack; -- Don't need scope stack entry in this case if Is_Overriding then --- 308,314 ---- Set_Defining_Unit_Name (Inst_Node, Name_Node); Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt); ! P_Aspect_Specifications (Inst_Node); Pop_Scope_Stack; -- Don't need scope stack entry in this case if Is_Overriding then *************** package body Ch6 is *** 345,351 **** if Token = Tok_Return then if not Func then ! Error_Msg ("PROCEDURE should be FUNCTION", Fproc_Sloc); Func := True; end if; --- 358,365 ---- if Token = Tok_Return then if not Func then ! Error_Msg -- CODEFIX ! ("PROCEDURE should be FUNCTION", Fproc_Sloc); Func := True; end if; *************** package body Ch6 is *** 356,362 **** -- Ada 2005 (AI-318-02) if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SC ("anonymous access result type is an Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); --- 370,376 ---- -- Ada 2005 (AI-318-02) if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SC ("anonymous access result type is an Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); *************** package body Ch6 is *** 370,378 **** end if; else if Func then - Ignore (Tok_Right_Paren); TF_Return; end if; end if; --- 384,401 ---- end if; else + -- Skip extra parenthesis at end of formal part + + Ignore (Tok_Right_Paren); + + -- For function, scan result subtype + if Func then TF_Return; + + if Prev_Token = Tok_Return then + Result_Node := P_Subtype_Mark; + end if; end if; end if; *************** package body Ch6 is *** 418,443 **** Scan; -- past semicolon if Token = Tok_Is then ! Error_Msg_SP ("extra "";"" ignored"); else Restore_Scan_State (Scan_State); end if; end if; -- Deal with case of semicolon ending a subprogram declaration ! if Token = Tok_Semicolon then if not Pf_Flags.Decl then T_Is; end if; Scan; -- past semicolon -- If semicolon is immediately followed by IS, then ignore the -- semicolon, and go process the body. if Token = Tok_Is then ! Error_Msg_SP ("|extra "";"" ignored"); T_Is; -- scan past IS goto Subprogram_Body; --- 441,474 ---- Scan; -- past semicolon if Token = Tok_Is then ! Error_Msg_SP -- CODEFIX ! ("extra "";"" ignored"); else Restore_Scan_State (Scan_State); end if; end if; + -- Subprogram declaration ended by aspect specifications + + if Aspect_Specifications_Present then + goto Subprogram_Declaration; + -- Deal with case of semicolon ending a subprogram declaration ! elsif Token = Tok_Semicolon then if not Pf_Flags.Decl then T_Is; end if; + Save_Scan_State (Scan_State); Scan; -- past semicolon -- If semicolon is immediately followed by IS, then ignore the -- semicolon, and go process the body. if Token = Tok_Is then ! Error_Msg_SP -- CODEFIX ! ("|extra "";"" ignored"); T_Is; -- scan past IS goto Subprogram_Body; *************** package body Ch6 is *** 449,458 **** elsif Token = Tok_Begin and then Start_Column >= Scope.Table (Scope.Last).Ecol then ! Error_Msg_SP ("|"";"" should be IS!"); goto Subprogram_Body; else goto Subprogram_Declaration; end if; --- 480,491 ---- elsif Token = Tok_Begin and then Start_Column >= Scope.Table (Scope.Last).Ecol then ! Error_Msg_SP -- CODEFIX ! ("|"";"" should be IS!"); goto Subprogram_Body; else + Restore_Scan_State (Scan_State); goto Subprogram_Declaration; end if; *************** package body Ch6 is *** 489,495 **** -- Deal nicely with (now obsolete) use of <> in place of abstract if Token = Tok_Box then ! Error_Msg_SC ("ABSTRACT expected"); Token := Tok_Abstract; end if; --- 522,529 ---- -- Deal nicely with (now obsolete) use of <> in place of abstract if Token = Tok_Box then ! Error_Msg_SC -- CODEFIX ! ("ABSTRACT expected"); Token := Tok_Abstract; end if; *************** package body Ch6 is *** 501,513 **** Set_Specification (Absdec_Node, Specification_Node); Pop_Scope_Stack; -- discard unneeded entry Scan; -- past ABSTRACT ! TF_Semicolon; return Absdec_Node; -- Ada 2005 (AI-248): Parse a null procedure declaration elsif Token = Tok_Null then ! if Ada_Version < Ada_05 then Error_Msg_SP ("null procedures are an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; --- 535,547 ---- Set_Specification (Absdec_Node, Specification_Node); Pop_Scope_Stack; -- discard unneeded entry Scan; -- past ABSTRACT ! P_Aspect_Specifications (Absdec_Node); return Absdec_Node; -- Ada 2005 (AI-248): Parse a null procedure declaration elsif Token = Tok_Null then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("null procedures are an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; *************** package body Ch6 is *** 520,526 **** Set_Null_Present (Specification_Node); end if; - TF_Semicolon; goto Subprogram_Declaration; -- Check for IS NEW with Formal_Part present and handle nicely --- 554,559 ---- *************** package body Ch6 is *** 548,570 **** goto Subprogram_Body; end if; -- Here we have a missing IS or missing semicolon, we always guess -- a missing semicolon, since we are pretty good at fixing up a -- semicolon which should really be an IS else ! Error_Msg_AP ("|missing "";"""); SIS_Missing_Semicolon_Message := Get_Msg_Id; goto Subprogram_Declaration; end if; end if; ! -- Processing for subprogram body <> - if not Pf_Flags.Pbod then - Error_Msg_SP ("subprogram body not allowed here!"); - end if; -- Subprogram body stub case --- 581,606 ---- goto Subprogram_Body; end if; + -- Aspect specifications present + + elsif Aspect_Specifications_Present then + goto Subprogram_Declaration; + -- Here we have a missing IS or missing semicolon, we always guess -- a missing semicolon, since we are pretty good at fixing up a -- semicolon which should really be an IS else ! Error_Msg_AP -- CODEFIX ! ("|missing "";"""); SIS_Missing_Semicolon_Message := Get_Msg_Id; goto Subprogram_Declaration; end if; end if; ! -- Processing for stub or subprogram body or parameterized expression <> -- Subprogram body stub case *************** package body Ch6 is *** 587,615 **** TF_Semicolon; return Stub_Node; ! -- Subprogram body case else ! -- Here is the test for a suspicious IS (i.e. one that looks ! -- like it might more properly be a semicolon). See separate ! -- section discussing use of IS instead of semicolon in ! -- package Parse. ! if (Token in Token_Class_Declk ! or else ! Token = Tok_Identifier) ! and then Start_Column <= Scope.Table (Scope.Last).Ecol ! and then Scope.Last /= 1 ! then ! Scope.Table (Scope.Last).Etyp := E_Suspicious_Is; ! Scope.Table (Scope.Last).S_Is := Prev_Token_Ptr; ! end if; ! Body_Node := ! New_Node (N_Subprogram_Body, Sloc (Specification_Node)); ! Set_Specification (Body_Node, Specification_Node); ! Parse_Decls_Begin_End (Body_Node); ! return Body_Node; end if; -- Processing for subprogram declaration --- 623,781 ---- TF_Semicolon; return Stub_Node; ! -- Subprogram body or parameterized expression case else ! Scan_Body_Or_Parameterized_Expression : declare ! function Likely_Parameterized_Expression return Boolean; ! -- Returns True if we have a probably case of a parameterized ! -- expression omitting the parentheses, if so, returns True ! -- and emits an appropriate error message, else returns False. ! ------------------------------------- ! -- Likely_Parameterized_Expression -- ! ------------------------------------- ! ! function Likely_Parameterized_Expression return Boolean is ! begin ! -- If currently pointing to BEGIN or a declaration keyword ! -- or a pragma, then we definitely have a subprogram body. ! -- This is a common case, so worth testing first. ! ! if Token = Tok_Begin ! or else Token in Token_Class_Declk ! or else Token = Tok_Pragma ! then ! return False; ! ! -- Test for tokens which could only start an expression and ! -- thus signal the case of a parameterized expression. ! ! elsif Token in Token_Class_Literal ! or else Token in Token_Class_Unary_Addop ! or else Token = Tok_Left_Paren ! or else Token = Tok_Abs ! or else Token = Tok_Null ! or else Token = Tok_New ! or else Token = Tok_Not ! then ! null; ! ! -- Anything other than an identifier must be a body ! ! elsif Token /= Tok_Identifier then ! return False; ! ! -- Here for an identifier ! ! else ! -- If the identifier is the first token on its line, then ! -- let's assume that we have a missing begin and this is ! -- intended as a subprogram body. ! ! if Token_Is_At_Start_Of_Line then ! return False; ! ! -- Otherwise we have to scan ahead. If the identifier is ! -- followed by a colon or a comma, it is a declaration ! -- and hence we have a subprogram body. Otherwise assume ! -- a parameterized expression. ! ! else ! declare ! Scan_State : Saved_Scan_State; ! Tok : Token_Type; ! begin ! Save_Scan_State (Scan_State); ! Scan; -- past identifier ! Tok := Token; ! Restore_Scan_State (Scan_State); ! ! if Tok = Tok_Colon or else Tok = Tok_Comma then ! return False; ! end if; ! end; ! end if; ! end if; ! ! -- Fall through if we have a likely parameterized expression ! ! Error_Msg_SC ! ("parameterized expression must be " ! & "enclosed in parentheses"); ! return True; ! end Likely_Parameterized_Expression; ! ! -- Start of processing for Scan_Body_Or_Parameterized_Expression ! ! begin ! -- Parameterized_Expression case ! ! if Token = Tok_Left_Paren ! or else Likely_Parameterized_Expression ! then ! -- Check parameterized expression allowed here ! ! if not Pf_Flags.Pexp then ! Error_Msg_SC ! ("parameterized expression not allowed here!"); ! end if; ! ! -- Check we are in Ada 2012 mode ! ! if Ada_Version < Ada_2012 then ! Error_Msg_SC ! ("parameterized expression is an Ada 2012 feature!"); ! Error_Msg_SC ! ("\unit must be compiled with -gnat2012 switch!"); ! end if; ! ! -- Parse out expression and build parameterized expression ! ! Body_Node := ! New_Node ! (N_Parameterized_Expression, Sloc (Specification_Node)); ! Set_Specification (Body_Node, Specification_Node); ! Set_Expression (Body_Node, P_Expression); ! T_Semicolon; ! Pop_Scope_Stack; ! ! -- Subprogram body case ! ! else ! -- Check body allowed here ! ! if not Pf_Flags.Pbod then ! Error_Msg_SP ("subprogram body not allowed here!"); ! end if; ! ! -- Here is the test for a suspicious IS (i.e. one that ! -- looks like it might more properly be a semicolon). ! -- See separate section describing use of IS instead ! -- of semicolon in package Parse. ! ! if (Token in Token_Class_Declk ! or else ! Token = Tok_Identifier) ! and then Start_Column <= Scope.Table (Scope.Last).Ecol ! and then Scope.Last /= 1 ! then ! Scope.Table (Scope.Last).Etyp := E_Suspicious_Is; ! Scope.Table (Scope.Last).S_Is := Prev_Token_Ptr; ! end if; ! ! -- Build and return subprogram body, parsing declarations ! -- and statement sequence that belong to the body. ! ! Body_Node := ! New_Node (N_Subprogram_Body, Sloc (Specification_Node)); ! Set_Specification (Body_Node, Specification_Node); ! Parse_Decls_Begin_End (Body_Node); ! end if; ! ! return Body_Node; ! end Scan_Body_Or_Parameterized_Expression; end if; -- Processing for subprogram declaration *************** package body Ch6 is *** 618,623 **** --- 784,790 ---- Decl_Node := New_Node (N_Subprogram_Declaration, Sloc (Specification_Node)); Set_Specification (Decl_Node, Specification_Node); + P_Aspect_Specifications (Decl_Node); -- If this is a context in which a subprogram body is permitted, -- set active SIS entry in case (see section titled "Handling *************** package body Ch6 is *** 635,641 **** Pop_Scope_Stack; return Decl_Node; - end P_Subprogram; --------------------------------- --- 802,807 ---- *************** package body Ch6 is *** 691,697 **** -- Ada 2005 (AI-318-02) if Token = Tok_Access then ! if Ada_Version < Ada_05 then Error_Msg_SC ("anonymous access result type is an Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); --- 857,863 ---- -- Ada 2005 (AI-318-02) if Token = Tok_Access then ! if Ada_Version < Ada_2005 then Error_Msg_SC ("anonymous access result type is an Ada 2005 extension"); Error_Msg_SC ("\unit must be compiled with -gnat05 switch"); *************** package body Ch6 is *** 1216,1222 **** -- that semicolon should have been a right parenthesis and exit if Token = Tok_Is or else Token = Tok_Return then ! Error_Msg_SP ("|"";"" should be "")"""); exit Specification_Loop; end if; --- 1382,1389 ---- -- that semicolon should have been a right parenthesis and exit if Token = Tok_Is or else Token = Tok_Return then ! Error_Msg_SP -- CODEFIX ! ("|"";"" should be "")"""); exit Specification_Loop; end if; *************** package body Ch6 is *** 1224,1230 **** -- assume we had a missing right parenthesis and terminate list if Token in Token_Class_Declk then ! Error_Msg_AP ("missing "")"""); Restore_Scan_State (Scan_State); exit Specification_Loop; end if; --- 1391,1398 ---- -- assume we had a missing right parenthesis and terminate list if Token in Token_Class_Declk then ! Error_Msg_AP -- CODEFIX ! ("missing "")"""); Restore_Scan_State (Scan_State); exit Specification_Loop; end if; *************** package body Ch6 is *** 1287,1293 **** Set_In_Present (Node, True); if Style.Mode_In_Check and then Token /= Tok_Out then ! Error_Msg_SP ("(style) IN should be omitted"); end if; if Token = Tok_Access then --- 1455,1462 ---- Set_In_Present (Node, True); if Style.Mode_In_Check and then Token /= Tok_Out then ! Error_Msg_SP -- CODEFIX ! ("(style) IN should be omitted"); end if; if Token = Tok_Access then *************** package body Ch6 is *** 1302,1309 **** end if; if Token = Tok_In then ! Error_Msg_SC -- CODEFIX ??? ! ("IN must precede OUT in parameter mode"); Scan; -- past IN Set_In_Present (Node, True); end if; --- 1471,1477 ---- end if; if Token = Tok_In then ! Error_Msg_SC ("IN must precede OUT in parameter mode"); Scan; -- past IN Set_In_Present (Node, True); end if; *************** package body Ch6 is *** 1525,1531 **** -- Extended_return_statement (Ada 2005 only -- AI-318): else ! if Ada_Version < Ada_05 then Error_Msg_SP (" extended_return_statement is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 1693,1699 ---- -- Extended_return_statement (Ada 2005 only -- AI-318): else ! if Ada_Version < Ada_2005 then Error_Msg_SP (" extended_return_statement is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch7.adb gcc-4.6.0/gcc/ada/par-ch7.adb *** gcc-4.5.2/gcc/ada/par-ch7.adb Thu Apr 9 12:28:57 2009 --- gcc-4.6.0/gcc/ada/par-ch7.adb Tue Oct 12 09:10:13 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch7 is *** 37,43 **** -- This routine scans out a package declaration, package body, or a -- renaming declaration or generic instantiation starting with PACKAGE ! -- PACKAGE_DECLARATION ::= PACKAGE_SPECIFICATION; -- PACKAGE_SPECIFICATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is --- 37,45 ---- -- This routine scans out a package declaration, package body, or a -- renaming declaration or generic instantiation starting with PACKAGE ! -- PACKAGE_DECLARATION ::= ! -- PACKAGE_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- PACKAGE_SPECIFICATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is *************** package body Ch7 is *** 59,64 **** --- 61,71 ---- -- PACKAGE_BODY_STUB ::= -- package body DEFINING_IDENTIFIER is separate; + -- PACKAGE_INSTANTIATION ::= + -- package DEFINING_PROGRAM_UNIT_NAME is + -- new generic_package_NAME [GENERIC_ACTUAL_PART] + -- [ASPECT_SPECIFICATIONS]; + -- The value in Pf_Flags indicates which of these possible declarations -- is acceptable to the caller: *************** package body Ch7 is *** 69,78 **** -- Pf_Flags.Rnam Set if renaming declaration OK -- Pf_Flags.Stub Set if body stub OK ! -- If an inappropriate form is encountered, it is scanned out but an ! -- error message indicating that it is appearing in an inappropriate ! -- context is issued. The only possible settings for Pf_Flags are those ! -- defined as constants in package Par. -- Note: in all contexts where a package specification is required, there -- is a terminating semicolon. This semicolon is scanned out in the case --- 76,85 ---- -- Pf_Flags.Rnam Set if renaming declaration OK -- Pf_Flags.Stub Set if body stub OK ! -- If an inappropriate form is encountered, it is scanned out but an error ! -- message indicating that it is appearing in an inappropriate context is ! -- issued. The only possible settings for Pf_Flags are those defined as ! -- constants in package Par. -- Note: in all contexts where a package specification is required, there -- is a terminating semicolon. This semicolon is scanned out in the case *************** package body Ch7 is *** 85,91 **** -- Error recovery: cannot raise Error_Resync ! function P_Package (Pf_Flags : Pf_Rec) return Node_Id is Package_Node : Node_Id; Specification_Node : Node_Id; Name_Node : Node_Id; --- 92,101 ---- -- Error recovery: cannot raise Error_Resync ! function P_Package ! (Pf_Flags : Pf_Rec; ! Decl : Node_Id := Empty) return Node_Id ! is Package_Node : Node_Id; Specification_Node : Node_Id; Name_Node : Node_Id; *************** package body Ch7 is *** 101,114 **** Scan; -- past PACKAGE if Token = Tok_Type then ! Error_Msg_SC ("TYPE not allowed here"); Scan; -- past TYPE end if; -- Case of package body. Note that we demand a package body if that -- is the only possibility (even if the BODY keyword is not present) ! if Token = Tok_Body or else Pf_Flags = Pf_Pbod then if not Pf_Flags.Pbod then Error_Msg_SC ("package body cannot appear here!"); end if; --- 111,125 ---- Scan; -- past PACKAGE if Token = Tok_Type then ! Error_Msg_SC -- CODEFIX ! ("TYPE not allowed here"); Scan; -- past TYPE end if; -- Case of package body. Note that we demand a package body if that -- is the only possibility (even if the BODY keyword is not present) ! if Token = Tok_Body or else Pf_Flags = Pf_Pbod_Pexp then if not Pf_Flags.Pbod then Error_Msg_SC ("package body cannot appear here!"); end if; *************** package body Ch7 is *** 184,190 **** Set_Name (Package_Node, P_Qualified_Simple_Name); Set_Generic_Associations (Package_Node, P_Generic_Actual_Part_Opt); ! TF_Semicolon; Pop_Scope_Stack; -- Case of package declaration or package specification --- 195,201 ---- Set_Name (Package_Node, P_Qualified_Simple_Name); Set_Generic_Associations (Package_Node, P_Generic_Actual_Part_Opt); ! P_Aspect_Specifications (Package_Node); Pop_Scope_Stack; -- Case of package declaration or package specification *************** package body Ch7 is *** 238,244 **** Discard_Junk_List (P_Sequence_Of_Statements (SS_None)); end if; ! End_Statements (Specification_Node); end if; return Package_Node; --- 249,259 ---- Discard_Junk_List (P_Sequence_Of_Statements (SS_None)); end if; ! if Nkind (Package_Node) = N_Package_Declaration then ! End_Statements (Specification_Node, Package_Node); ! else ! End_Statements (Specification_Node, Decl); ! end if; end if; return Package_Node; diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch8.adb gcc-4.6.0/gcc/ada/par-ch8.adb *** gcc-4.5.2/gcc/ada/par-ch8.adb Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/par-ch8.adb Mon Oct 11 09:11:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch8 is *** 51,59 **** begin Scan; -- past USE ! if Token = Tok_Type then return P_Use_Type_Clause; - else return P_Use_Package_Clause; end if; --- 51,58 ---- begin Scan; -- past USE ! if Token = Tok_Type or else Token = Tok_All then return P_Use_Type_Clause; else return P_Use_Package_Clause; end if; *************** package body Ch8 is *** 95,112 **** -- 8.4 Use Type Clause -- -------------------------- ! -- USE_TYPE_CLAUSE ::= use type SUBTYPE_MARK {, SUBTYPE_MARK}; -- The caller has checked that the initial token is USE, scanned it out ! -- and that the current token is TYPE. -- Error recovery: cannot raise Error_Resync function P_Use_Type_Clause return Node_Id is ! Use_Node : Node_Id; begin Use_Node := New_Node (N_Use_Type_Clause, Prev_Token_Ptr); Set_Subtype_Marks (Use_Node, New_List); if Ada_Version = Ada_83 then --- 94,128 ---- -- 8.4 Use Type Clause -- -------------------------- ! -- USE_TYPE_CLAUSE ::= use [ALL] type SUBTYPE_MARK {, SUBTYPE_MARK}; -- The caller has checked that the initial token is USE, scanned it out ! -- and that the current token is either ALL or TYPE. ! ! -- Note: Use of ALL is an Ada 2012 feature -- Error recovery: cannot raise Error_Resync function P_Use_Type_Clause return Node_Id is ! Use_Node : Node_Id; ! All_Present : Boolean; begin + if Token = Tok_All then + if Ada_Version < Ada_2012 then + Error_Msg_SC ("|`USE ALL TYPE` is an Ada 2012 feature"); + Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch"); + end if; + + All_Present := True; + Scan; -- past ALL + + else + All_Present := False; + end if; + Use_Node := New_Node (N_Use_Type_Clause, Prev_Token_Ptr); + Set_All_Present (Use_Node, All_Present); Set_Subtype_Marks (Use_Node, New_List); if Ada_Version = Ada_83 then diff -Nrcpad gcc-4.5.2/gcc/ada/par-ch9.adb gcc-4.6.0/gcc/ada/par-ch9.adb *** gcc-4.5.2/gcc/ada/par-ch9.adb Wed May 6 12:49:36 2009 --- gcc-4.6.0/gcc/ada/par-ch9.adb Tue Oct 12 13:05:11 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Ch9 is *** 40,62 **** function P_Entry_Body_Formal_Part return Node_Id; function P_Entry_Declaration return Node_Id; function P_Entry_Index_Specification return Node_Id; - function P_Protected_Definition return Node_Id; function P_Protected_Operation_Declaration_Opt return Node_Id; function P_Protected_Operation_Items return List_Id; - function P_Task_Definition return Node_Id; function P_Task_Items return List_Id; ----------------------------- -- 9.1 Task (also 10.1.3) -- ----------------------------- -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- TASK_BODY ::= -- task body DEFINING_IDENTIFIER is --- 40,72 ---- function P_Entry_Body_Formal_Part return Node_Id; function P_Entry_Declaration return Node_Id; function P_Entry_Index_Specification return Node_Id; function P_Protected_Operation_Declaration_Opt return Node_Id; function P_Protected_Operation_Items return List_Id; function P_Task_Items return List_Id; + function P_Protected_Definition (Decl : Node_Id) return Node_Id; + -- Parses protected definition and following aspect specifications if + -- present. The argument is the declaration node to which the aspect + -- specifications are to be attached. + + function P_Task_Definition (Decl : Node_Id) return Node_Id; + -- Parses task definition and following aspect specifications if present. + -- The argument is the declaration node to which the aspect specifications + -- are to be attached. + ----------------------------- -- 9.1 Task (also 10.1.3) -- ----------------------------- -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION] ! -- [ASPECT_SPECIFICATIONS]; -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION] ! -- [ASPECT_SPECIFICATIONS]; -- TASK_BODY ::= -- task body DEFINING_IDENTIFIER is *************** package body Ch9 is *** 143,152 **** end if; end if; -- Parse optional task definition. Note that P_Task_Definition scans ! -- out the semicolon as well as the task definition itself. ! if Token = Tok_Semicolon then -- A little check, if the next token after semicolon is -- Entry, then surely the semicolon should really be IS --- 153,169 ---- end if; end if; + -- If we have aspect definitions present here, then we do not have + -- a task definition present. + + if Aspect_Specifications_Present then + P_Aspect_Specifications (Task_Node); + -- Parse optional task definition. Note that P_Task_Definition scans ! -- out the semicolon and possible aspect specifications as well as ! -- the task definition itself. ! elsif Token = Tok_Semicolon then -- A little check, if the next token after semicolon is -- Entry, then surely the semicolon should really be IS *************** package body Ch9 is *** 154,164 **** Scan; -- past semicolon if Token = Tok_Entry then ! Error_Msg_SP ("|"";"" should be IS"); ! Set_Task_Definition (Task_Node, P_Task_Definition); else Pop_Scope_Stack; -- Remove unused entry end if; else TF_Is; -- must have IS if no semicolon --- 171,185 ---- Scan; -- past semicolon if Token = Tok_Entry then ! Error_Msg_SP -- CODEFIX ! ("|"";"" should be IS"); ! Set_Task_Definition (Task_Node, P_Task_Definition (Task_Node)); else Pop_Scope_Stack; -- Remove unused entry end if; + + -- Here we have a task definition + else TF_Is; -- must have IS if no semicolon *************** package body Ch9 is *** 167,173 **** if Token = Tok_New then Scan; -- past NEW ! if Ada_Version < Ada_05 then Error_Msg_SP ("task interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; --- 188,194 ---- if Token = Tok_New then Scan; -- past NEW ! if Ada_Version < Ada_2005 then Error_Msg_SP ("task interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; *************** package body Ch9 is *** 181,198 **** end loop; if Token /= Tok_With then ! Error_Msg_SC ("WITH expected"); end if; Scan; -- past WITH if Token = Tok_Private then ! Error_Msg_SP ("PRIVATE not allowed in task type declaration"); end if; end if; ! Set_Task_Definition (Task_Node, P_Task_Definition); end if; return Task_Node; --- 202,220 ---- end loop; if Token /= Tok_With then ! Error_Msg_SC -- CODEFIX ! ("WITH expected"); end if; Scan; -- past WITH if Token = Tok_Private then ! Error_Msg_SP -- CODEFIX ("PRIVATE not allowed in task type declaration"); end if; end if; ! Set_Task_Definition (Task_Node, P_Task_Definition (Task_Node)); end if; return Task_Node; *************** package body Ch9 is *** 231,237 **** -- Error recovery: cannot raise Error_Resync ! function P_Task_Definition return Node_Id is Def_Node : Node_Id; begin --- 253,259 ---- -- Error recovery: cannot raise Error_Resync ! function P_Task_Definition (Decl : Node_Id) return Node_Id is Def_Node : Node_Id; begin *************** package body Ch9 is *** 251,257 **** end loop; end if; ! End_Statements (Def_Node); return Def_Node; end P_Task_Definition; --- 273,279 ---- end loop; end if; ! End_Statements (Def_Node, Decl); return Def_Node; end P_Task_Definition; *************** package body Ch9 is *** 345,355 **** -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- PROTECTED_BODY ::= -- protected body DEFINING_IDENTIFIER is --- 367,379 ---- -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION ! -- [ASPECT_SPECIFICATIONS]; -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; + -- [ASPECT_SPECIFICATIONS]; -- PROTECTED_BODY ::= -- protected body DEFINING_IDENTIFIER is *************** package body Ch9 is *** 454,472 **** if Token /= Tok_Is then Restore_Scan_State (Scan_State); ! Error_Msg_SC ("missing IS"); Set_Protected_Definition (Protected_Node, Make_Protected_Definition (Token_Ptr, Visible_Declarations => Empty_List, End_Label => Empty)); SIS_Entry_Active := False; ! End_Statements (Protected_Definition (Protected_Node)); ! Scan; -- past semicolon return Protected_Node; end if; ! Error_Msg_SP ("|extra ""("" ignored"); end if; T_Is; --- 478,498 ---- if Token /= Tok_Is then Restore_Scan_State (Scan_State); ! Error_Msg_SC -- CODEFIX ! ("missing IS"); Set_Protected_Definition (Protected_Node, Make_Protected_Definition (Token_Ptr, Visible_Declarations => Empty_List, End_Label => Empty)); SIS_Entry_Active := False; ! End_Statements ! (Protected_Definition (Protected_Node), Protected_Node); return Protected_Node; end if; ! Error_Msg_SP -- CODEFIX ! ("|extra ""("" ignored"); end if; T_Is; *************** package body Ch9 is *** 476,482 **** if Token = Tok_New then Scan; -- past NEW ! if Ada_Version < Ada_05 then Error_Msg_SP ("protected interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; --- 502,508 ---- if Token = Tok_New then Scan; -- past NEW ! if Ada_Version < Ada_2005 then Error_Msg_SP ("protected interface is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); end if; *************** package body Ch9 is *** 492,504 **** end loop; if Token /= Tok_With then ! Error_Msg_SC ("WITH expected"); end if; Scan; -- past WITH end if; ! Set_Protected_Definition (Protected_Node, P_Protected_Definition); return Protected_Node; end if; end P_Protected; --- 518,532 ---- end loop; if Token /= Tok_With then ! Error_Msg_SC -- CODEFIX ! ("WITH expected"); end if; Scan; -- past WITH end if; ! Set_Protected_Definition ! (Protected_Node, P_Protected_Definition (Protected_Node)); return Protected_Node; end if; end P_Protected; *************** package body Ch9 is *** 533,539 **** -- Error recovery: cannot raise Error_Resync ! function P_Protected_Definition return Node_Id is Def_Node : Node_Id; Item_Node : Node_Id; --- 561,567 ---- -- Error recovery: cannot raise Error_Resync ! function P_Protected_Definition (Decl : Node_Id) return Node_Id is Def_Node : Node_Id; Item_Node : Node_Id; *************** package body Ch9 is *** 579,585 **** end loop Declaration_Loop; end loop Private_Loop; ! End_Statements (Def_Node); return Def_Node; end P_Protected_Definition; --- 607,613 ---- end loop Declaration_Loop; end loop Private_Loop; ! End_Statements (Def_Node, Decl); return Def_Node; end P_Protected_Definition; *************** package body Ch9 is *** 625,631 **** Scan; -- past OVERRIDING Not_Overriding := True; else ! Error_Msg_SC ("OVERRIDING expected!"); end if; else --- 653,660 ---- Scan; -- past OVERRIDING Not_Overriding := True; else ! Error_Msg_SC -- CODEFIX ! ("OVERRIDING expected!"); end if; else *************** package body Ch9 is *** 633,640 **** Is_Overriding := True; end if; ! if (Is_Overriding or else Not_Overriding) then ! if Ada_Version < Ada_05 then Error_Msg_SP ("overriding indicator is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); --- 662,669 ---- Is_Overriding := True; end if; ! if Is_Overriding or else Not_Overriding then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("overriding indicator is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); *************** package body Ch9 is *** 645,651 **** Set_Must_Not_Override (Decl, Not_Overriding); elsif Token = Tok_Function or else Token = Tok_Procedure then ! Decl := P_Subprogram (Pf_Decl); Set_Must_Override (Specification (Decl), Is_Overriding); Set_Must_Not_Override (Specification (Decl), Not_Overriding); --- 674,680 ---- Set_Must_Not_Override (Decl, Not_Overriding); elsif Token = Tok_Function or else Token = Tok_Procedure then ! Decl := P_Subprogram (Pf_Decl_Pexp); Set_Must_Override (Specification (Decl), Is_Overriding); Set_Must_Not_Override (Specification (Decl), Not_Overriding); *************** package body Ch9 is *** 676,682 **** return P_Entry_Declaration; elsif Token = Tok_Function or else Token = Tok_Procedure then ! return P_Subprogram (Pf_Decl); elsif Token = Tok_Identifier then L := New_List; --- 705,711 ---- return P_Entry_Declaration; elsif Token = Tok_Function or else Token = Tok_Procedure then ! return P_Subprogram (Pf_Decl_Pexp); elsif Token = Tok_Identifier then L := New_List; *************** package body Ch9 is *** 748,754 **** or else Token = Tok_Not or else Bad_Spelling_Of (Tok_Not) then ! Append (P_Subprogram (Pf_Decl_Pbod), Item_List); elsif Token = Tok_Pragma or else Bad_Spelling_Of (Tok_Pragma) then P_Pragmas_Opt (Item_List); --- 777,783 ---- or else Token = Tok_Not or else Bad_Spelling_Of (Tok_Not) then ! Append (P_Subprogram (Pf_Decl_Pbod_Pexp), Item_List); elsif Token = Tok_Pragma or else Bad_Spelling_Of (Tok_Pragma) then P_Pragmas_Opt (Item_List); *************** package body Ch9 is *** 758,765 **** Scan; -- past PRIVATE elsif Token = Tok_Identifier then ! Error_Msg_SC ! ("all components must be declared in spec!"); Resync_Past_Semicolon; elsif Token in Token_Class_Declk then --- 787,793 ---- Scan; -- past PRIVATE elsif Token = Tok_Identifier then ! Error_Msg_SC ("all components must be declared in spec!"); Resync_Past_Semicolon; elsif Token in Token_Class_Declk then *************** package body Ch9 is *** 782,787 **** --- 810,816 ---- -- [OVERRIDING_INDICATOR] -- entry DEFINING_IDENTIFIER [(DISCRETE_SUBTYPE_DEFINITION)] -- PARAMETER_PROFILE; + -- [ASPECT_SPECIFICATIONS]; -- The caller has checked that the initial token is ENTRY, NOT or -- OVERRIDING. *************** package body Ch9 is *** 809,815 **** Scan; -- part OVERRIDING Not_Overriding := True; else ! Error_Msg_SC ("OVERRIDING expected!"); end if; elsif Token = Tok_Overriding then --- 838,845 ---- Scan; -- part OVERRIDING Not_Overriding := True; else ! Error_Msg_SC -- CODEFIX ! ("OVERRIDING expected!"); end if; elsif Token = Tok_Overriding then *************** package body Ch9 is *** 817,829 **** Is_Overriding := True; end if; ! if (Is_Overriding or else Not_Overriding) then ! if Ada_Version < Ada_05 then Error_Msg_SP ("overriding indicator is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); elsif Token /= Tok_Entry then ! Error_Msg_SC ("ENTRY expected!"); end if; end if; --- 847,860 ---- Is_Overriding := True; end if; ! if Is_Overriding or else Not_Overriding then ! if Ada_Version < Ada_2005 then Error_Msg_SP ("overriding indicator is an Ada 2005 extension"); Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); elsif Token /= Tok_Entry then ! Error_Msg_SC -- CODEFIX ! ("ENTRY expected!"); end if; end if; *************** package body Ch9 is *** 893,899 **** Discard_Junk_Node (P_Expression_No_Right_Paren); end if; ! TF_Semicolon; return Decl_Node; exception --- 924,930 ---- Discard_Junk_Node (P_Expression_No_Right_Paren); end if; ! P_Aspect_Specifications (Decl_Node); return Decl_Node; exception *************** package body Ch9 is *** 1115,1121 **** Bnode := P_Expression_No_Right_Paren; if Token = Tok_Colon_Equal then ! Error_Msg_SC ("|"":="" should be ""="""); Scan; Bnode := P_Expression_No_Right_Paren; end if; --- 1146,1153 ---- Bnode := P_Expression_No_Right_Paren; if Token = Tok_Colon_Equal then ! Error_Msg_SC -- CODEFIX ! ("|"":="" should be ""="""); Scan; Bnode := P_Expression_No_Right_Paren; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/par-endh.adb gcc-4.6.0/gcc/ada/par-endh.adb *** gcc-4.5.2/gcc/ada/par-endh.adb Wed May 6 12:49:36 2009 --- gcc-4.6.0/gcc/ada/par-endh.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Endh is *** 166,172 **** -- Check_End -- --------------- ! function Check_End return Boolean is Name_On_Separate_Line : Boolean; -- Set True if the name on an END line is on a separate source line -- from the END. This is highly suspicious, but is allowed. The point --- 166,172 ---- -- Check_End -- --------------- ! function Check_End (Decl : Node_Id := Empty) return Boolean is Name_On_Separate_Line : Boolean; -- Set True if the name on an END line is on a separate source line -- from the END. This is highly suspicious, but is allowed. The point *************** package body Endh is *** 333,341 **** Copy_Name (Selector_Name (N))); else ! R := ! Make_Identifier (Token_Ptr, ! Chars => Chars (N)); Set_Comes_From_Source (N, False); return R; end if; --- 333,339 ---- Copy_Name (Selector_Name (N))); else ! R := Make_Identifier (Token_Ptr, Chars (N)); Set_Comes_From_Source (N, False); return R; end if; *************** package body Endh is *** 357,365 **** elsif Nkind (End_Labl) = N_Defining_Identifier or else Nkind (End_Labl) = N_Identifier then ! End_Labl := ! Make_Identifier (Token_Ptr, ! Chars => Chars (End_Labl)); elsif Nkind (End_Labl) = N_Defining_Operator_Symbol or else Nkind (End_Labl) = N_Operator_Symbol --- 355,361 ---- elsif Nkind (End_Labl) = N_Defining_Identifier or else Nkind (End_Labl) = N_Identifier then ! End_Labl := Make_Identifier (Token_Ptr, Chars (End_Labl)); elsif Nkind (End_Labl) = N_Defining_Operator_Symbol or else Nkind (End_Labl) = N_Operator_Symbol *************** package body Endh is *** 387,425 **** end if; end if; ! -- Except in case of END RECORD, semicolon must follow. For END ! -- RECORD, a semicolon does follow, but it is part of a higher level ! -- construct. In any case, a missing semicolon is not serious enough ! -- to consider the END statement to be bad in the sense that we ! -- are dealing with (i.e. to be suspicious that it is not in fact ! -- the END statement we are looking for!) if End_Type /= E_Record then - if Token = Tok_Semicolon then - T_Semicolon; ! -- Semicolon is missing. If the missing semicolon is at the end ! -- of the line, i.e. we are at the start of the line now, then ! -- a missing semicolon gets flagged, but is not serious enough ! -- to consider the END statement to be bad in the sense that we ! -- are dealing with (i.e. to be suspicious that this END is not ! -- the END statement we are looking for). ! -- Similarly, if we are at a colon, we flag it but a colon for ! -- a semicolon is not serious enough to consider the END to be ! -- incorrect. Same thing for a period in place of a semicolon. ! elsif Token_Is_At_Start_Of_Line ! or else Token = Tok_Colon ! or else Token = Tok_Dot ! then ! T_Semicolon; ! -- If the missing semicolon is not at the start of the line, ! -- then we do consider the END line to be dubious in this sense. ! else ! End_OK := False; end if; end if; end if; --- 383,433 ---- end if; end if; ! -- Deal with terminating aspect specifications and following semi- ! -- colon. We skip this in the case of END RECORD, since in this ! -- case the aspect specifications and semicolon are handled at ! -- a higher level. if End_Type /= E_Record then ! -- Scan aspect specifications if permitted here ! if Aspect_Specifications_Present then ! if No (Decl) then ! P_Aspect_Specifications (Error); ! else ! P_Aspect_Specifications (Decl); ! end if; ! -- If no aspect specifications, must have a semicolon ! elsif End_Type /= E_Record then ! if Token = Tok_Semicolon then ! T_Semicolon; ! -- Semicolon is missing. If the missing semicolon is at the end ! -- of the line, i.e. we are at the start of the line now, then ! -- a missing semicolon gets flagged, but is not serious enough ! -- to consider the END statement to be bad in the sense that we ! -- are dealing with (i.e. to be suspicious that this END is not ! -- the END statement we are looking for). ! ! -- Similarly, if we are at a colon, we flag it but a colon for ! -- a semicolon is not serious enough to consider the END to be ! -- incorrect. Same thing for a period in place of a semicolon. ! ! elsif Token_Is_At_Start_Of_Line ! or else Token = Tok_Colon ! or else Token = Tok_Dot ! then ! T_Semicolon; ! ! -- If the missing semicolon is not at the start of the line, ! -- then we consider the END line to be dubious in this sense. ! ! else ! End_OK := False; ! end if; end if; end if; end if; *************** package body Endh is *** 644,656 **** -- Error recovery: cannot raise Error_Resync; ! procedure End_Statements (Parent : Node_Id := Empty) is begin -- This loop runs more than once in the case where Check_End rejects -- the END sequence, as indicated by Check_End returning False. loop ! if Check_End then if Present (Parent) then Set_End_Label (Parent, End_Labl); end if; --- 652,666 ---- -- Error recovery: cannot raise Error_Resync; ! procedure End_Statements ! (Parent : Node_Id := Empty; ! Decl : Node_Id := Empty) is begin -- This loop runs more than once in the case where Check_End rejects -- the END sequence, as indicated by Check_End returning False. loop ! if Check_End (Decl) then if Present (Parent) then Set_End_Label (Parent, End_Labl); end if; diff -Nrcpad gcc-4.5.2/gcc/ada/par-labl.adb gcc-4.6.0/gcc/ada/par-labl.adb *** gcc-4.5.2/gcc/ada/par-labl.adb Wed Aug 20 13:55:20 2008 --- gcc-4.6.0/gcc/ada/par-labl.adb Thu Sep 9 09:35:11 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** procedure Labl is *** 375,387 **** and then Matches (Node (N), Node (S1)) then if not Found then ! if Parent (Node (N)) = Parent (Node (S1)) then Source := S1; Found := True; ! else ! -- The goto is within some nested structure No_Header (N); return; end if; --- 375,393 ---- and then Matches (Node (N), Node (S1)) then if not Found then ! ! -- If the label and the goto are both in the same statement ! -- list, then we've found a loop. Note that labels and goto ! -- statements are always part of some list, so In_Same_List ! -- always makes sense. ! ! if In_Same_List (Node (N), Node (S1)) then Source := S1; Found := True; ! -- The goto is within some nested structure + else No_Header (N); return; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/par-load.adb gcc-4.6.0/gcc/ada/par-load.adb *** gcc-4.5.2/gcc/ada/par-load.adb Wed Jul 15 10:39:11 2009 --- gcc-4.6.0/gcc/ada/par-load.adb Fri Sep 10 14:41:21 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** begin *** 266,276 **** Required => False, Subunit => False, Error_Node => Curunit, ! Corr_Body => Cur_Unum); ! -- If we successfully load the unit, then set the spec/body ! -- pointers. Once again note that if the loaded unit has a fatal error, ! -- Load will have set our Fatal_Error flag to propagate this condition. if Unum /= No_Unit then Set_Library_Unit (Curunit, Cunit (Unum)); --- 266,277 ---- Required => False, Subunit => False, Error_Node => Curunit, ! Corr_Body => Cur_Unum, ! PMES => (Cur_Unum = Main_Unit)); ! -- If we successfully load the unit, then set the spec/body pointers. ! -- Once again note that if the loaded unit has a fatal error, Load will ! -- have set our Fatal_Error flag to propagate this condition. if Unum /= No_Unit then Set_Library_Unit (Curunit, Cunit (Unum)); *************** begin *** 347,353 **** Load_Unit (Load_Name => Body_Name, Required => True, ! Subunit => True, Error_Node => Name (Unit (Curunit))); if Unum /= No_Unit then --- 348,354 ---- Load_Unit (Load_Name => Body_Name, Required => True, ! Subunit => False, Error_Node => Name (Unit (Curunit))); if Unum /= No_Unit then diff -Nrcpad gcc-4.5.2/gcc/ada/par-prag.adb gcc-4.6.0/gcc/ada/par-prag.adb *** gcc-4.5.2/gcc/ada/par-prag.adb Wed Jan 27 13:29:52 2010 --- gcc-4.6.0/gcc/ada/par-prag.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** function Prag (Pragma_Node : Node_Id; Se *** 150,157 **** Error_Msg_Name_2 := Name_On; Error_Msg_Name_3 := Name_Off; ! Error_Msg ! ("argument for pragma% must be% or%", Sloc (Argx)); raise Error_Resync; end if; end Check_Arg_Is_On_Or_Off; --- 150,156 ---- Error_Msg_Name_2 := Name_On; Error_Msg_Name_3 := Name_Off; ! Error_Msg ("argument for pragma% must be% or%", Sloc (Argx)); raise Error_Resync; end if; end Check_Arg_Is_On_Or_Off; *************** begin *** 307,321 **** -- Ada_05/Ada_2005 -- --------------------- ! -- This pragma must be processed at parse time, since we want to set -- the Ada version properly at parse time to recognize the appropriate -- Ada version syntax. However, it is only the zero argument form that -- must be processed at parse time. when Pragma_Ada_05 | Pragma_Ada_2005 => if Arg_Count = 0 then ! Ada_Version := Ada_05; ! Ada_Version_Explicit := Ada_05; end if; ----------- --- 306,335 ---- -- Ada_05/Ada_2005 -- --------------------- ! -- These pragmas must be processed at parse time, since we want to set -- the Ada version properly at parse time to recognize the appropriate -- Ada version syntax. However, it is only the zero argument form that -- must be processed at parse time. when Pragma_Ada_05 | Pragma_Ada_2005 => if Arg_Count = 0 then ! Ada_Version := Ada_2005; ! Ada_Version_Explicit := Ada_2005; ! end if; ! ! --------------------- ! -- Ada_12/Ada_2012 -- ! --------------------- ! ! -- These pragmas must be processed at parse time, since we want to set ! -- the Ada version properly at parse time to recognize the appropriate ! -- Ada version syntax. However, it is only the zero argument form that ! -- must be processed at parse time. ! ! when Pragma_Ada_12 | Pragma_Ada_2012 => ! if Arg_Count = 0 then ! Ada_Version := Ada_2012; ! Ada_Version_Explicit := Ada_2012; end if; ----------- *************** begin *** 375,382 **** --- 389,398 ---- if Chars (Expression (Arg1)) = Name_On then Extensions_Allowed := True; + Ada_Version := Ada_2012; else Extensions_Allowed := False; + Ada_Version := Ada_Version_Explicit; end if; ---------------- *************** begin *** 943,949 **** OK := False; elsif Chars (A) = Name_All_Checks then ! Stylesw.Set_Default_Style_Check_Options; elsif Chars (A) = Name_On then Style_Check := True; --- 959,969 ---- OK := False; elsif Chars (A) = Name_All_Checks then ! if GNAT_Mode then ! Stylesw.Set_GNAT_Style_Check_Options; ! else ! Stylesw.Set_Default_Style_Check_Options; ! end if; elsif Chars (A) = Name_On then Style_Check := True; *************** begin *** 962,967 **** --- 982,1014 ---- end if; end Style_Checks; + ------------------------- + -- Suppress_All (GNAT) -- + ------------------------- + + -- pragma Suppress_All + + -- This is a rather odd pragma, because other compilers allow it in + -- strange places. DEC allows it at the end of units, and Rational + -- allows it as a program unit pragma, when it would be more natural + -- if it were a configuration pragma. + + -- Since the reason we provide this pragma is for compatibility with + -- these other compilers, we want to accommodate these strange placement + -- rules, and the easiest thing is simply to allow it anywhere in a + -- unit. If this pragma appears anywhere within a unit, then the effect + -- is as though a pragma Suppress (All_Checks) had appeared as the first + -- line of the current file, i.e. as the first configuration pragma in + -- the current unit. + + -- To get this effect, we set the flag Has_Pragma_Suppress_All in the + -- compilation unit node for the current source file then in the last + -- stage of parsing a file, if this flag is set, we materialize the + -- Suppress (All_Checks) pragma, marked as not coming from Source. + + when Pragma_Suppress_All => + Set_Has_Pragma_Suppress_All (Cunit (Current_Source_Unit)); + --------------------- -- Warnings (GNAT) -- --------------------- *************** begin *** 1071,1076 **** --- 1118,1124 ---- Pragma_CPP_Constructor | Pragma_CPP_Virtual | Pragma_CPP_Vtable | + Pragma_CPU | Pragma_C_Pass_By_Copy | Pragma_Comment | Pragma_Common_Object | *************** begin *** 1081,1086 **** --- 1129,1135 ---- Pragma_Convention | Pragma_Debug_Policy | Pragma_Detect_Blocking | + Pragma_Default_Storage_Pool | Pragma_Dimension | Pragma_Discard_Names | Pragma_Eliminate | *************** begin *** 1103,1109 **** Pragma_Finalize_Storage_Only | Pragma_Float_Representation | Pragma_Ident | ! Pragma_Implemented_By_Entry | Pragma_Implicit_Packing | Pragma_Import | Pragma_Import_Exception | --- 1152,1158 ---- Pragma_Finalize_Storage_Only | Pragma_Float_Representation | Pragma_Ident | ! Pragma_Implemented | Pragma_Implicit_Packing | Pragma_Import | Pragma_Import_Exception | *************** begin *** 1111,1116 **** --- 1160,1167 ---- Pragma_Import_Object | Pragma_Import_Procedure | Pragma_Import_Valued_Procedure | + Pragma_Independent | + Pragma_Independent_Components | Pragma_Initialize_Scalars | Pragma_Inline | Pragma_Inline_Always | *************** begin *** 1121,1126 **** --- 1172,1178 ---- Pragma_Interrupt_Handler | Pragma_Interrupt_State | Pragma_Interrupt_Priority | + Pragma_Invariant | Pragma_Java_Constructor | Pragma_Java_Interface | Pragma_Keep_Names | *************** begin *** 1139,1148 **** Pragma_Memory_Size | Pragma_No_Body | Pragma_No_Return | - Pragma_Obsolescent | Pragma_No_Run_Time | Pragma_No_Strict_Aliasing | Pragma_Normalize_Scalars | Pragma_Optimize | Pragma_Optimize_Alignment | Pragma_Pack | --- 1191,1201 ---- Pragma_Memory_Size | Pragma_No_Body | Pragma_No_Return | Pragma_No_Run_Time | Pragma_No_Strict_Aliasing | Pragma_Normalize_Scalars | + Pragma_Obsolescent | + Pragma_Ordered | Pragma_Optimize | Pragma_Optimize_Alignment | Pragma_Pack | *************** begin *** 1152,1157 **** --- 1205,1211 ---- Pragma_Persistent_BSS | Pragma_Postcondition | Pragma_Precondition | + Pragma_Predicate | Pragma_Preelaborate | Pragma_Preelaborate_05 | Pragma_Priority | *************** begin *** 1174,1186 **** Pragma_Shared | Pragma_Shared_Passive | Pragma_Short_Circuit_And_Or | Pragma_Storage_Size | Pragma_Storage_Unit | Pragma_Static_Elaboration_Desired | Pragma_Stream_Convert | Pragma_Subtitle | Pragma_Suppress | - Pragma_Suppress_All | Pragma_Suppress_Debug_Info | Pragma_Suppress_Exception_Locations | Pragma_Suppress_Initialization | --- 1228,1240 ---- Pragma_Shared | Pragma_Shared_Passive | Pragma_Short_Circuit_And_Or | + Pragma_Short_Descriptors | Pragma_Storage_Size | Pragma_Storage_Unit | Pragma_Static_Elaboration_Desired | Pragma_Stream_Convert | Pragma_Subtitle | Pragma_Suppress | Pragma_Suppress_Debug_Info | Pragma_Suppress_Exception_Locations | Pragma_Suppress_Initialization | diff -Nrcpad gcc-4.5.2/gcc/ada/par-tchk.adb gcc-4.6.0/gcc/ada/par-tchk.adb *** gcc-4.5.2/gcc/ada/par-tchk.adb Wed May 6 12:49:36 2009 --- gcc-4.6.0/gcc/ada/par-tchk.adb Fri Jun 18 12:14:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Tchk is *** 83,97 **** -- A little recovery helper, accept then in place of => elsif Token = Tok_Then then ! Error_Msg_BC ("|THEN should be ""='>"""); Scan; -- past THEN used in place of => elsif Token = Tok_Colon_Equal then ! Error_Msg_SC ("|"":="" should be ""='>"""); Scan; -- past := used in place of => else ! Error_Msg_AP ("missing ""='>"""); end if; end T_Arrow; --- 83,100 ---- -- A little recovery helper, accept then in place of => elsif Token = Tok_Then then ! Error_Msg_BC -- CODEFIX ! ("|THEN should be ""='>"""); Scan; -- past THEN used in place of => elsif Token = Tok_Colon_Equal then ! Error_Msg_SC -- CODEFIX ! ("|"":="" should be ""='>"""); Scan; -- past := used in place of => else ! Error_Msg_AP -- CODEFIX ! ("missing ""='>"""); end if; end T_Arrow; *************** package body Tchk is *** 122,128 **** if Token = Tok_Box then Scan; else ! Error_Msg_AP ("missing ""'<'>"""); end if; end T_Box; --- 125,132 ---- if Token = Tok_Box then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing ""'<'>"""); end if; end T_Box; *************** package body Tchk is *** 135,141 **** if Token = Tok_Colon then Scan; else ! Error_Msg_AP ("missing "":"""); end if; end T_Colon; --- 139,146 ---- if Token = Tok_Colon then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing "":"""); end if; end T_Colon; *************** package body Tchk is *** 149,167 **** Scan; elsif Token = Tok_Equal then ! Error_Msg_SC ("|""="" should be "":="""); Scan; elsif Token = Tok_Colon then ! Error_Msg_SC ("|"":"" should be "":="""); Scan; elsif Token = Tok_Is then ! Error_Msg_SC ("|IS should be "":="""); Scan; else ! Error_Msg_AP ("missing "":="""); end if; end T_Colon_Equal; --- 154,176 ---- Scan; elsif Token = Tok_Equal then ! Error_Msg_SC -- CODEFIX ! ("|""="" should be "":="""); Scan; elsif Token = Tok_Colon then ! Error_Msg_SC -- CODEFIX ! ("|"":"" should be "":="""); Scan; elsif Token = Tok_Is then ! Error_Msg_SC -- CODEFIX ! ("|IS should be "":="""); Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing "":="""); end if; end T_Colon_Equal; *************** package body Tchk is *** 182,188 **** if Token = Tok_Comma then Scan; else ! Error_Msg_AP ("missing "","""); end if; end if; --- 191,198 ---- if Token = Tok_Comma then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing "","""); end if; end if; *************** package body Tchk is *** 200,206 **** if Token = Tok_Dot_Dot then Scan; else ! Error_Msg_AP ("missing "".."""); end if; end T_Dot_Dot; --- 210,217 ---- if Token = Tok_Dot_Dot then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing "".."""); end if; end T_Dot_Dot; *************** package body Tchk is *** 222,228 **** if Token = Tok_Greater_Greater then Scan; else ! Error_Msg_AP ("missing ""'>'>"""); end if; end T_Greater_Greater; --- 233,240 ---- if Token = Tok_Greater_Greater then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing ""'>'>"""); end if; end T_Greater_Greater; *************** package body Tchk is *** 271,285 **** -- Allow OF, => or = to substitute for IS with complaint elsif Token = Tok_Arrow then ! Error_Msg_SC ("|""=>"" should be IS"); Scan; -- past => elsif Token = Tok_Of then ! Error_Msg_SC ("|OF should be IS"); Scan; -- past OF elsif Token = Tok_Equal then ! Error_Msg_SC ("|""="" should be IS"); Scan; -- past = else --- 283,300 ---- -- Allow OF, => or = to substitute for IS with complaint elsif Token = Tok_Arrow then ! Error_Msg_SC -- CODEFIX ! ("|""=>"" should be IS"); Scan; -- past => elsif Token = Tok_Of then ! Error_Msg_SC -- CODEFIX ! ("|OF should be IS"); Scan; -- past OF elsif Token = Tok_Equal then ! Error_Msg_SC -- CODEFIX ! ("|""="" should be IS"); Scan; -- past = else *************** package body Tchk is *** 289,295 **** -- Ignore extra IS keywords while Token = Tok_Is loop ! Error_Msg_SC ("|extra IS ignored"); Scan; end loop; end T_Is; --- 304,311 ---- -- Ignore extra IS keywords while Token = Tok_Is loop ! Error_Msg_SC -- CODEFIX ! ("|extra IS ignored"); Scan; end loop; end T_Is; *************** package body Tchk is *** 303,309 **** if Token = Tok_Left_Paren then Scan; else ! Error_Msg_AP ("missing ""("""); end if; end T_Left_Paren; --- 319,326 ---- if Token = Tok_Left_Paren then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing ""("""); end if; end T_Left_Paren; *************** package body Tchk is *** 314,320 **** procedure T_Loop is begin if Token = Tok_Do then ! Error_Msg_SC ("LOOP expected"); Scan; else Check_Token (Tok_Loop, AP); --- 331,338 ---- procedure T_Loop is begin if Token = Tok_Do then ! Error_Msg_SC -- CODEFIX ! ("LOOP expected"); Scan; else Check_Token (Tok_Loop, AP); *************** package body Tchk is *** 393,399 **** if Token = Tok_Right_Paren then Scan; else ! Error_Msg_AP ("|missing "")"""); end if; end T_Right_Paren; --- 411,418 ---- if Token = Tok_Right_Paren then Scan; else ! Error_Msg_AP -- CODEFIX ! ("|missing "")"""); end if; end T_Right_Paren; *************** package body Tchk is *** 408,431 **** Scan; if Token = Tok_Semicolon then ! Error_Msg_SC ("|extra "";"" ignored"); Scan; end if; return; elsif Token = Tok_Colon then ! Error_Msg_SC ("|"":"" should be "";"""); Scan; return; elsif Token = Tok_Comma then ! Error_Msg_SC ("|"","" should be "";"""); Scan; return; elsif Token = Tok_Dot then ! Error_Msg_SC ("|""."" should be "";"""); Scan; return; --- 427,454 ---- Scan; if Token = Tok_Semicolon then ! Error_Msg_SC -- CODEFIX ! ("|extra "";"" ignored"); Scan; end if; return; elsif Token = Tok_Colon then ! Error_Msg_SC -- CODEFIX ! ("|"":"" should be "";"""); Scan; return; elsif Token = Tok_Comma then ! Error_Msg_SC -- CODEFIX ! ("|"","" should be "";"""); Scan; return; elsif Token = Tok_Dot then ! Error_Msg_SC -- CODEFIX ! ("|""."" should be "";"""); Scan; return; *************** package body Tchk is *** 464,470 **** -- If none of those tests return, we really have a missing semicolon ! Error_Msg_AP ("|missing "";"""); return; end T_Semicolon; --- 487,494 ---- -- If none of those tests return, we really have a missing semicolon ! Error_Msg_AP -- CODEFIX ! ("|missing "";"""); return; end T_Semicolon; *************** package body Tchk is *** 646,652 **** Scan; -- skip RETURN and we are done else ! Error_Msg_SC ("missing RETURN"); Save_Scan_State (Scan_State); -- at start of junk tokens loop --- 670,677 ---- Scan; -- skip RETURN and we are done else ! Error_Msg_SC -- CODEFIX ! ("missing RETURN"); Save_Scan_State (Scan_State); -- at start of junk tokens loop *************** package body Tchk is *** 814,820 **** if Token = Tok_Left_Paren then Scan; else ! Error_Msg_AP ("missing ""(""!"); end if; end U_Left_Paren; --- 839,846 ---- if Token = Tok_Left_Paren then Scan; else ! Error_Msg_AP -- CODEFIX ! ("missing ""(""!"); end if; end U_Left_Paren; *************** package body Tchk is *** 827,833 **** if Token = Tok_Right_Paren then Scan; else ! Error_Msg_AP ("|missing "")""!"); end if; end U_Right_Paren; --- 853,860 ---- if Token = Tok_Right_Paren then Scan; else ! Error_Msg_AP -- CODEFIX ! ("|missing "")""!"); end if; end U_Right_Paren; *************** package body Tchk is *** 846,852 **** Scan; if Token = T then ! Error_Msg_SP ("|extra "";"" ignored"); Scan; else Error_Msg_SP (M); --- 873,880 ---- Scan; if Token = T then ! Error_Msg_SP -- CODEFIX ! ("|extra "";"" ignored"); Scan; else Error_Msg_SP (M); *************** package body Tchk is *** 856,862 **** Scan; if Token = T then ! Error_Msg_SP ("|extra "","" ignored"); Scan; else --- 884,891 ---- Scan; if Token = T then ! Error_Msg_SP -- CODEFIX ! ("|extra "","" ignored"); Scan; else diff -Nrcpad gcc-4.5.2/gcc/ada/par-util.adb gcc-4.6.0/gcc/ada/par-util.adb *** gcc-4.5.2/gcc/ada/par-util.adb Wed May 6 12:53:27 2009 --- gcc-4.6.0/gcc/ada/par-util.adb Fri Jun 18 12:14:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Util is *** 72,78 **** and then Name_Len = 7 and then Name_Buffer (1 .. 7) = "program" then ! Error_Msg_SC ("PROCEDURE expected"); Token := T; return True; --- 72,79 ---- and then Name_Len = 7 and then Name_Buffer (1 .. 7) = "program" then ! Error_Msg_SC -- CODEFIX ! ("PROCEDURE expected"); Token := T; return True; *************** package body Util is *** 86,93 **** M2 (P2 + J - 1) := Fold_Upper (S (J)); end loop; ! Error_Msg_SC -- CODEFIX??? ! (M2 (1 .. P2 - 1 + S'Last)); Token := T; return True; end if; --- 87,93 ---- M2 (P2 + J - 1) := Fold_Upper (S (J)); end loop; ! Error_Msg_SC (M2 (1 .. P2 - 1 + S'Last)); Token := T; return True; end if; *************** package body Util is *** 334,340 **** <> Restore_Scan_State (Scan_State); ! Error_Msg_SC ("|"";"" should be "","""); Scan; -- past the semicolon return True; --- 334,341 ---- <> Restore_Scan_State (Scan_State); ! Error_Msg_SC -- CODEFIX ! ("|"";"" should be "","""); Scan; -- past the semicolon return True; *************** package body Util is *** 384,409 **** begin while Token = T loop if T = Tok_Comma then ! Error_Msg_SC ("|extra "","" ignored"); elsif T = Tok_Left_Paren then ! Error_Msg_SC ("|extra ""("" ignored"); elsif T = Tok_Right_Paren then ! Error_Msg_SC ("|extra "")"" ignored"); elsif T = Tok_Semicolon then ! Error_Msg_SC ("|extra "";"" ignored"); elsif T = Tok_Colon then ! Error_Msg_SC ("|extra "":"" ignored"); else declare Tname : constant String := Token_Type'Image (Token); begin ! Error_Msg_SC ! ("|extra " & Tname (5 .. Tname'Last) & "ignored"); end; end if; --- 385,414 ---- begin while Token = T loop if T = Tok_Comma then ! Error_Msg_SC -- CODEFIX ! ("|extra "","" ignored"); elsif T = Tok_Left_Paren then ! Error_Msg_SC -- CODEFIX ! ("|extra ""("" ignored"); elsif T = Tok_Right_Paren then ! Error_Msg_SC -- CODEFIX ! ("|extra "")"" ignored"); elsif T = Tok_Semicolon then ! Error_Msg_SC -- CODEFIX ! ("|extra "";"" ignored"); elsif T = Tok_Colon then ! Error_Msg_SC -- CODEFIX ! ("|extra "":"" ignored"); else declare Tname : constant String := Token_Type'Image (Token); begin ! Error_Msg_SC ("|extra " & Tname (5 .. Tname'Last) & "ignored"); end; end if; *************** package body Util is *** 567,574 **** end; Error_Msg_Node_1 := Prev; ! Error_Msg_SC ! ("unexpected identifier, possibly & was meant here"); Scan; end Merge_Identifier; --- 572,578 ---- end; Error_Msg_Node_1 := Prev; ! Error_Msg_SC ("unexpected identifier, possibly & was meant here"); Scan; end Merge_Identifier; diff -Nrcpad gcc-4.5.2/gcc/ada/par.adb gcc-4.6.0/gcc/ada/par.adb *** gcc-4.5.2/gcc/ada/par.adb Wed Jul 15 10:39:11 2009 --- gcc-4.6.0/gcc/ada/par.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Casing; use Casing; with Debug; use Debug; *************** function Par (Configuration_Pragmas : Bo *** 352,358 **** Pbod : Boolean; -- True if proper body OK Rnam : Boolean; -- True if renaming declaration OK Stub : Boolean; -- True if body stub OK ! Fil1 : Boolean; -- Filler to fill to 8 bits Fil2 : Boolean; -- Filler to fill to 8 bits end record; pragma Pack (Pf_Rec); --- 353,359 ---- Pbod : Boolean; -- True if proper body OK Rnam : Boolean; -- True if renaming declaration OK Stub : Boolean; -- True if body stub OK ! Pexp : Boolean; -- True if parametrized expression OK Fil2 : Boolean; -- Filler to fill to 8 bits end record; pragma Pack (Pf_Rec); *************** function Par (Configuration_Pragmas : Bo *** 360,377 **** function T return Boolean renames True; function F return Boolean renames False; ! Pf_Decl_Gins_Pbod_Rnam_Stub : constant Pf_Rec := ! Pf_Rec'(F, T, T, T, T, T, F, F); ! Pf_Decl : constant Pf_Rec := ! Pf_Rec'(F, T, F, F, F, F, F, F); ! Pf_Decl_Gins_Pbod_Rnam : constant Pf_Rec := ! Pf_Rec'(F, T, T, T, T, F, F, F); ! Pf_Decl_Pbod : constant Pf_Rec := ! Pf_Rec'(F, T, F, T, F, F, F, F); ! Pf_Pbod : constant Pf_Rec := ! Pf_Rec'(F, F, F, T, F, F, F, F); ! Pf_Spcn : constant Pf_Rec := ! Pf_Rec'(T, F, F, F, F, F, F, F); -- The above are the only allowed values of Pf_Rec arguments type SS_Rec is record --- 361,378 ---- function T return Boolean renames True; function F return Boolean renames False; ! Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp : constant Pf_Rec := ! Pf_Rec'(F, T, T, T, T, T, T, F); ! Pf_Decl_Pexp : constant Pf_Rec := ! Pf_Rec'(F, T, F, F, F, F, T, F); ! Pf_Decl_Gins_Pbod_Rnam_Pexp : constant Pf_Rec := ! Pf_Rec'(F, T, T, T, T, F, T, F); ! Pf_Decl_Pbod_Pexp : constant Pf_Rec := ! Pf_Rec'(F, T, F, T, F, F, T, F); ! Pf_Pbod_Pexp : constant Pf_Rec := ! Pf_Rec'(F, F, F, T, F, F, T, F); ! Pf_Spcn : constant Pf_Rec := ! Pf_Rec'(T, F, F, F, F, F, F, F); -- The above are the only allowed values of Pf_Rec arguments type SS_Rec is record *************** function Par (Configuration_Pragmas : Bo *** 631,637 **** function P_Range_Or_Subtype_Mark (Allow_Simple_Expression : Boolean := False) return Node_Id; -- Scans out a range or subtype mark, and also permits a general simple ! -- expression if Allow_Simple_Expresion is set to True. function Init_Expr_Opt (P : Boolean := False) return Node_Id; -- If an initialization expression is present (:= expression), then --- 632,638 ---- function P_Range_Or_Subtype_Mark (Allow_Simple_Expression : Boolean := False) return Node_Id; -- Scans out a range or subtype mark, and also permits a general simple ! -- expression if Allow_Simple_Expression is set to True. function Init_Expr_Opt (P : Boolean := False) return Node_Id; -- If an initialization expression is present (:= expression), then *************** function Par (Configuration_Pragmas : Bo *** 676,683 **** function P_Simple_Expression return Node_Id; function P_Simple_Expression_Or_Range_Attribute return Node_Id; function P_Conditional_Expression return Node_Id; ! -- Scans out a conditional expression. Called with token pointing to -- the IF keyword, and returns pointing to the terminating right paren, -- semicolon or comma, but does not consume this terminating token. --- 677,689 ---- function P_Simple_Expression return Node_Id; function P_Simple_Expression_Or_Range_Attribute return Node_Id; + function P_Case_Expression return Node_Id; + -- Scans out a case expression. Called with Token pointing to the CASE + -- keyword, and returns pointing to the terminating right parent, + -- semicolon, or comma, but does not consume this terminating token. + function P_Conditional_Expression return Node_Id; ! -- Scans out a conditional expression. Called with Token pointing to -- the IF keyword, and returns pointing to the terminating right paren, -- semicolon or comma, but does not consume this terminating token. *************** function Par (Configuration_Pragmas : Bo *** 697,702 **** --- 703,712 ---- function P_Qualified_Expression (Subtype_Mark : Node_Id) return Node_Id; -- This routine scans out a qualified expression when the caller has -- already scanned out the name and apostrophe of the construct. + + function P_Quantified_Expression return Node_Id; + -- This routine scans out a quantified expression when the caller has + -- already scanned out the keyword "for" of the construct. end Ch4; ------------- *************** function Par (Configuration_Pragmas : Bo *** 704,709 **** --- 714,725 ---- ------------- package Ch5 is + function P_Condition return Node_Id; + -- Scan out and return a condition + + function P_Loop_Parameter_Specification return Node_Id; + -- Used in loop constructs and quantified expressions. + function P_Statement_Name (Name_Node : Node_Id) return Node_Id; -- Given a node representing a name (which is a call), converts it -- to the syntactically corresponding procedure call statement. *************** function Par (Configuration_Pragmas : Bo *** 745,754 **** ------------- package Ch7 is ! function P_Package (Pf_Flags : Pf_Rec) return Node_Id; -- Scans out any construct starting with the keyword PACKAGE. The -- parameter indicates which possible kinds of construct (body, spec, ! -- instantiation etc.) are permissible in the current context. end Ch7; ------------- --- 761,774 ---- ------------- package Ch7 is ! function P_Package ! (Pf_Flags : Pf_Rec; ! Decl : Node_Id := Empty) return Node_Id; -- Scans out any construct starting with the keyword PACKAGE. The -- parameter indicates which possible kinds of construct (body, spec, ! -- instantiation etc.) are permissible in the current context. Decl ! -- is set in the specification case to request that if there are aspect ! -- specifications present, they be associated with this declaration. end Ch7; ------------- *************** function Par (Configuration_Pragmas : Bo *** 828,833 **** --- 848,881 ---- package Ch13 is function P_Representation_Clause return Node_Id; + function Aspect_Specifications_Present + (Strict : Boolean := Ada_Version < Ada_2012) return Boolean; + -- This function tests whether the next keyword is WITH followed by + -- something that looks reasonably like an aspect specification. If so, + -- True is returned. Otherwise False is returned. In either case control + -- returns with the token pointer unchanged (i.e. pointing to the WITH + -- token in the case where True is returned). This function takes care + -- of generating appropriate messages if aspect specifications appear + -- in versions of Ada prior to Ada 2012. The parameter strict can be + -- set to True, to be rather strict about considering something to be + -- an aspect specification. If Strict is False, then the circuitry is + -- rather more generous in considering something ill-formed to be an + -- attempt at an aspect specification. The default is more strict for + -- Ada versions before Ada 2012 (where aspect specifications are not + -- permitted). + + procedure P_Aspect_Specifications (Decl : Node_Id); + -- This subprogram is called with the current token pointing to either a + -- WITH keyword starting an aspect specification, or a semicolon. In the + -- former case, the aspect specifications are scanned out including the + -- terminating semicolon, the Has_Aspect_Specifications flag is set in + -- the given declaration node, and the list of aspect specifications is + -- constructed and associated with this declaration node using a call to + -- Set_Aspect_Specifications. If no WITH keyword is present, then this + -- call has no effect other than scanning out the semicolon. If Decl is + -- Error on entry, any scanned aspect specifications are ignored and a + -- message is output saying aspect specifications not permitted here. + function P_Code_Statement (Subtype_Mark : Node_Id) return Node_Id; -- Function to parse a code statement. The caller has scanned out -- the name to be used as the subtype mark (but has not checked that *************** function Par (Configuration_Pragmas : Bo *** 852,858 **** -- Routines for handling end lines, including scope recovery package Endh is ! function Check_End return Boolean; -- Called when an end sequence is required. In the absence of an error -- situation, Token contains Tok_End on entry, but in a missing end -- case, this may not be the case. Pop_End_Context is used to determine --- 900,906 ---- -- Routines for handling end lines, including scope recovery package Endh is ! function Check_End (Decl : Node_Id := Empty) return Boolean; -- Called when an end sequence is required. In the absence of an error -- situation, Token contains Tok_End on entry, but in a missing end -- case, this may not be the case. Pop_End_Context is used to determine *************** function Par (Configuration_Pragmas : Bo *** 863,868 **** --- 911,920 ---- -- Skip_And_Reject). Note that the END sequence includes a semicolon, -- except in the case of END RECORD, where a semicolon follows the END -- RECORD, but is not part of the record type definition itself. + -- + -- If Decl is non-empty, then aspect specifications are permitted + -- following the end, and Decl is the declaration node with which + -- these aspect specifications are to be associated. procedure End_Skip; -- Skip past an end sequence. On entry Token contains Tok_End, and we *************** function Par (Configuration_Pragmas : Bo *** 872,884 **** -- position after the end sequence. We do not issue any additional -- error messages while carrying this out. ! procedure End_Statements (Parent : Node_Id := Empty); -- Called when an end is required or expected to terminate a sequence -- of statements. The caller has already made an appropriate entry in -- the Scope.Table to describe the expected form of the end. This can -- only be used in cases where the only appropriate terminator is end. -- If Parent is non-empty, then if a correct END line is encountered, -- the End_Label field of Parent is set appropriately. end Endh; -------------- --- 924,942 ---- -- position after the end sequence. We do not issue any additional -- error messages while carrying this out. ! procedure End_Statements ! (Parent : Node_Id := Empty; ! Decl : Node_Id := Empty); -- Called when an end is required or expected to terminate a sequence -- of statements. The caller has already made an appropriate entry in -- the Scope.Table to describe the expected form of the end. This can -- only be used in cases where the only appropriate terminator is end. -- If Parent is non-empty, then if a correct END line is encountered, -- the End_Label field of Parent is set appropriately. + -- + -- If Decl is non-null, then it is a declaration node, and aspect + -- specifications are permitted after the end statement. These aspect + -- specifications, if present, are stored in this declaration node. end Endh; -------------- *************** function Par (Configuration_Pragmas : Bo *** 1182,1193 **** -------------- procedure Labl; ! -- This procedure creates implicit label declarations for all label that ! -- are declared in the current unit. Note that this could conceptually ! -- be done at the point where the labels are declared, but it is tricky ! -- to do it then, since the tree is not hooked up at the point where the ! -- label is declared (e.g. a sequence of statements is not yet attached ! -- to its containing scope at the point a label in the sequence is found) -------------- -- Par.Load -- --- 1240,1251 ---- -------------- procedure Labl; ! -- This procedure creates implicit label declarations for all labels that ! -- are declared in the current unit. Note that this could conceptually be ! -- done at the point where the labels are declared, but it is tricky to do ! -- it then, since the tree is not hooked up at the point where the label is ! -- declared (e.g. a sequence of statements is not yet attached to its ! -- containing scope at the point a label in the sequence is found). -------------- -- Par.Load -- *************** function Par (Configuration_Pragmas : Bo *** 1250,1255 **** --- 1308,1314 ---- -- Start of processing for Par begin + Compiler_State := Parsing; -- Deal with configuration pragmas case first *************** begin *** 1261,1270 **** --- 1320,1331 ---- begin loop if Token = Tok_EOF then + Compiler_State := Analyzing; return Pragmas; elsif Token /= Tok_Pragma then Error_Msg_SC ("only pragmas allowed in configuration file"); + Compiler_State := Analyzing; return Error_List; else *************** begin *** 1364,1370 **** begin -- If parsing was successful and we are not in check syntax ! -- mode, check that language defined units are compiled in GNAT -- mode. For this purpose we do NOT consider renamings in annex -- J as predefined. That allows users to compile their own -- versions of these files, and in particular, in the VMS --- 1425,1431 ---- begin -- If parsing was successful and we are not in check syntax ! -- mode, check that language-defined units are compiled in GNAT -- mode. For this purpose we do NOT consider renamings in annex -- J as predefined. That allows users to compile their own -- versions of these files, and in particular, in the VMS *************** begin *** 1395,1401 **** Name = "system" then Error_Msg ! ("language defined units may not be recompiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 4 --- 1456,1462 ---- Name = "system" then Error_Msg ! ("language-defined units cannot be recompiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 4 *************** begin *** 1403,1410 **** Name (Name'First .. Name'First + 3) = "ada." then Error_Msg ! ("descendents of package Ada " & ! "may not be compiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 11 --- 1464,1471 ---- Name (Name'First .. Name'First + 3) = "ada." then Error_Msg ! ("user-defined descendents of package Ada " & ! "are not allowed", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 11 *************** begin *** 1412,1419 **** Name (Name'First .. Name'First + 10) = "interfaces." then Error_Msg ! ("descendents of package Interfaces " & ! "may not be compiled", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 7 --- 1473,1480 ---- Name (Name'First .. Name'First + 10) = "interfaces." then Error_Msg ! ("user-defined descendents of package Interfaces " & ! "are not allowed", Sloc (Unit (Comp_Unit_Node))); elsif Name'Length > 7 *************** begin *** 1425,1432 **** "system.rpc.") then Error_Msg ! ("descendents of package System " & ! "may not be compiled", Sloc (Unit (Comp_Unit_Node))); end if; end; --- 1486,1493 ---- "system.rpc.") then Error_Msg ! ("user-defined descendents of package System " & ! "are not allowed", Sloc (Unit (Comp_Unit_Node))); end if; end; *************** begin *** 1474,1479 **** --- 1535,1541 ---- Restore_Opt_Config_Switches (Save_Config_Switches); Set_Comes_From_Source_Default (False); + Compiler_State := Analyzing; return Empty_List; end if; end Par; diff -Nrcpad gcc-4.5.2/gcc/ada/par_sco.adb gcc-4.6.0/gcc/ada/par_sco.adb *** gcc-4.5.2/gcc/ada/par_sco.adb Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/par_sco.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2009-2010, 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- -- *************** package body Par_SCO is *** 63,75 **** Table_Increment => 200, Table_Name => "SCO_Unit_Number_Entry"); ! -------------------------- ! -- Condition Hash Table -- ! -------------------------- -- We need to be able to get to conditions quickly for handling the calls ! -- to Set_SCO_Condition efficiently. For this purpose we identify the ! -- conditions in the table by their starting sloc, and use the following -- hash table to map from these starting sloc values to SCO_Table indexes. type Header_Num is new Integer range 0 .. 996; --- 63,76 ---- Table_Increment => 200, Table_Name => "SCO_Unit_Number_Entry"); ! --------------------------------- ! -- Condition/Pragma Hash Table -- ! --------------------------------- -- We need to be able to get to conditions quickly for handling the calls ! -- to Set_SCO_Condition efficiently, and similarly to get to pragmas to ! -- handle calls to Set_SCO_Pragma_Enabled. For this purpose we identify the ! -- conditions and pragmas in the table by their starting sloc, and use this -- hash table to map from these starting sloc values to SCO_Table indexes. type Header_Num is new Integer range 0 .. 996; *************** package body Par_SCO is *** 81,87 **** function Equal (F1, F2 : Source_Ptr) return Boolean; -- Function to test two keys for equality ! package Condition_Hash_Table is new Simple_HTable (Header_Num, Int, 0, Source_Ptr, Hash, Equal); -- The actual hash table --- 82,88 ---- function Equal (F1, F2 : Source_Ptr) return Boolean; -- Function to test two keys for equality ! package Condition_Pragma_Hash_Table is new Simple_HTable (Header_Num, Int, 0, Source_Ptr, Hash, Equal); -- The actual hash table *************** package body Par_SCO is *** 103,111 **** procedure Process_Decisions (N : Node_Id; T : Character); -- If N is Empty, has no effect. Otherwise scans the tree for the node N, -- to output any decisions it contains. T is one of IEPWX (for context of ! -- expresion: if/exit when/pragma/while/expression). If T is other than X, ! -- then a decision is always present (at the very least a simple decision ! -- is present at the top level). procedure Process_Decisions (L : List_Id; T : Character); -- Calls above procedure for each element of the list L --- 104,113 ---- procedure Process_Decisions (N : Node_Id; T : Character); -- If N is Empty, has no effect. Otherwise scans the tree for the node N, -- to output any decisions it contains. T is one of IEPWX (for context of ! -- expression: if/exit when/pragma/while/expression). If T is other than X, ! -- the node N is the conditional expression involved, and a decision is ! -- always present (at the very least a simple decision is present at the ! -- top level). procedure Process_Decisions (L : List_Id; T : Character); -- Calls above procedure for each element of the list L *************** package body Par_SCO is *** 119,129 **** --- 121,133 ---- -- Append an entry to SCO_Table with fields set as per arguments procedure Traverse_Declarations_Or_Statements (L : List_Id); + procedure Traverse_Generic_Instantiation (N : Node_Id); procedure Traverse_Generic_Package_Declaration (N : Node_Id); procedure Traverse_Handled_Statement_Sequence (N : Node_Id); procedure Traverse_Package_Body (N : Node_Id); procedure Traverse_Package_Declaration (N : Node_Id); procedure Traverse_Subprogram_Body (N : Node_Id); + procedure Traverse_Subprogram_Declaration (N : Node_Id); -- Traverse the corresponding construct, generating SCO table entries procedure Write_SCOs_To_ALI_File is new Put_SCOs; *************** package body Par_SCO is *** 299,306 **** function Is_Logical_Operator (N : Node_Id) return Boolean is begin ! return Nkind_In (N, N_Op_Xor, ! N_Op_Not, N_And_Then, N_Or_Else); end Is_Logical_Operator; --- 303,309 ---- function Is_Logical_Operator (N : Node_Id) return Boolean is begin ! return Nkind_In (N, N_Op_Not, N_And_Then, N_Or_Else); end Is_Logical_Operator; *************** package body Par_SCO is *** 327,332 **** --- 330,346 ---- procedure Process_Decisions (N : Node_Id; T : Character) is + Mark : Nat; + -- This is used to mark the location of a decision sequence in the SCO + -- table. We use it for backing out a simple decision in an expression + -- context that contains only NOT operators. + + X_Not_Decision : Boolean; + -- This flag keeps track of whether a decision sequence in the SCO table + -- contains only NOT operators, and is for an expression context (T=X). + -- The flag will be set False if T is other than X, or if an operator + -- other than NOT is in the sequence. + function Process_Node (N : Node_Id) return Traverse_Result; -- Processes one node in the traversal, looking for logical operators, -- and if one is found, outputs the appropriate table entries. *************** package body Par_SCO is *** 340,352 **** -- Process_Decision_Operand, because we can't get decisions mixed up in -- the global table. Call has no effect if N is Empty. ! procedure Output_Element (N : Node_Id; T : Character); -- Node N is an operand of a logical operator that is not itself a -- logical operator, or it is a simple decision. This routine outputs ! -- the table entry for the element, with C1 set to T (' ' for one of ! -- the elements of a complex decision, or 'I'/'W'/'E' for a simple ! -- decision (from an IF, WHILE, or EXIT WHEN). Last is set to False, ! -- and an entry is made in the condition hash table. procedure Process_Decision_Operand (N : Node_Id); -- This is called on node N, the top level node of a decision, or on one --- 354,368 ---- -- Process_Decision_Operand, because we can't get decisions mixed up in -- the global table. Call has no effect if N is Empty. ! procedure Output_Element (N : Node_Id); -- Node N is an operand of a logical operator that is not itself a -- logical operator, or it is a simple decision. This routine outputs ! -- the table entry for the element, with C1 set to ' '. Last is set ! -- False, and an entry is made in the condition hash table. ! ! procedure Output_Header (T : Character); ! -- Outputs a decision header node. T is I/W/E/P for IF/WHILE/EXIT WHEN/ ! -- PRAGMA, and 'X' for the expression case. procedure Process_Decision_Operand (N : Node_Id); -- This is called on node N, the top level node of a decision, or on one *************** package body Par_SCO is *** 376,391 **** else L := Left_Opnd (N); ! if Nkind (N) = N_Op_Xor then ! C := '^'; ! elsif Nkind_In (N, N_Op_Or, N_Or_Else) then C := '|'; else C := '&'; end if; end if; ! Set_Table_Entry (C, ' ', No_Location, No_Location, False); Output_Decision_Operand (L); Output_Decision_Operand (Right_Opnd (N)); --- 392,410 ---- else L := Left_Opnd (N); ! if Nkind_In (N, N_Op_Or, N_Or_Else) then C := '|'; else C := '&'; end if; end if; ! Set_Table_Entry ! (C1 => C, ! C2 => ' ', ! From => Sloc (N), ! To => No_Location, ! Last => False); Output_Decision_Operand (L); Output_Decision_Operand (Right_Opnd (N)); *************** package body Par_SCO is *** 393,399 **** -- Not a logical operator else ! Output_Element (N, ' '); end if; end Output_Decision_Operand; --- 412,418 ---- -- Not a logical operator else ! Output_Element (N); end if; end Output_Decision_Operand; *************** package body Par_SCO is *** 401,415 **** -- Output_Element -- -------------------- ! procedure Output_Element (N : Node_Id; T : Character) is FSloc : Source_Ptr; LSloc : Source_Ptr; begin Sloc_Range (N, FSloc, LSloc); ! Set_Table_Entry (T, 'c', FSloc, LSloc, False); ! Condition_Hash_Table.Set (FSloc, SCO_Table.Last); end Output_Element; ------------------------------ -- Process_Decision_Operand -- ------------------------------ --- 420,502 ---- -- Output_Element -- -------------------- ! procedure Output_Element (N : Node_Id) is FSloc : Source_Ptr; LSloc : Source_Ptr; begin Sloc_Range (N, FSloc, LSloc); ! Set_Table_Entry ! (C1 => ' ', ! C2 => 'c', ! From => FSloc, ! To => LSloc, ! Last => False); ! Condition_Pragma_Hash_Table.Set (FSloc, SCO_Table.Last); end Output_Element; + ------------------- + -- Output_Header -- + ------------------- + + procedure Output_Header (T : Character) is + begin + case T is + when 'I' | 'E' | 'W' => + + -- For IF, EXIT, WHILE, the token SLOC can be found from + -- the SLOC of the parent of the expression. + + Set_Table_Entry + (C1 => T, + C2 => ' ', + From => Sloc (Parent (N)), + To => No_Location, + Last => False); + + when 'P' => + + -- For PRAGMA, we must get the location from the pragma node. + -- Argument N is the pragma argument, and we have to go up two + -- levels (through the pragma argument association) to get to + -- the pragma node itself. + + declare + Loc : constant Source_Ptr := Sloc (Parent (Parent (N))); + + begin + Set_Table_Entry + (C1 => 'P', + C2 => 'd', + From => Loc, + To => No_Location, + Last => False); + + -- For pragmas we also must make an entry in the hash table + -- for later access by Set_SCO_Pragma_Enabled. We set the + -- pragma as disabled above, the call will change C2 to 'e' + -- to enable the pragma header entry. + + Condition_Pragma_Hash_Table.Set (Loc, SCO_Table.Last); + end; + + when 'X' => + + -- For an expression, no Sloc + + Set_Table_Entry + (C1 => 'X', + C2 => ' ', + From => No_Location, + To => No_Location, + Last => False); + + -- No other possibilities + + when others => + raise Program_Error; + end case; + end Output_Header; + ------------------------------ -- Process_Decision_Operand -- ------------------------------ *************** package body Par_SCO is *** 419,424 **** --- 506,512 ---- if Is_Logical_Operator (N) then if Nkind (N) /= N_Op_Not then Process_Decision_Operand (Left_Opnd (N)); + X_Not_Decision := False; end if; Process_Decision_Operand (Right_Opnd (N)); *************** package body Par_SCO is *** 439,447 **** -- Logical operators, output table entries and then process -- operands recursively to deal with nested conditions. ! when N_And_Then | ! N_Or_Else | ! N_Op_Not => declare T : Character; --- 527,535 ---- -- Logical operators, output table entries and then process -- operands recursively to deal with nested conditions. ! when N_And_Then | ! N_Or_Else | ! N_Op_Not => declare T : Character; *************** package body Par_SCO is *** 458,472 **** -- Output header for sequence ! Set_Table_Entry (T, ' ', No_Location, No_Location, False); -- Output the decision Output_Decision_Operand (N); ! -- Change Last in last table entry to True to mark end ! SCO_Table.Table (SCO_Table.Last).Last := True; -- Process any embedded decisions --- 546,571 ---- -- Output header for sequence ! X_Not_Decision := T = 'X' and then Nkind (N) = N_Op_Not; ! Mark := SCO_Table.Last; ! Output_Header (T); -- Output the decision Output_Decision_Operand (N); ! -- If the decision was in an expression context (T = 'X') ! -- and contained only NOT operators, then we don't output ! -- it, so delete it. ! if X_Not_Decision then ! SCO_Table.Set_Last (Mark); ! ! -- Otherwise, set Last in last table entry to mark end ! ! else ! SCO_Table.Table (SCO_Table.Last).Last := True; ! end if; -- Process any embedded decisions *************** package body Par_SCO is *** 474,482 **** return Skip; end; -- Conditional expression, processed like an if statement ! when N_Conditional_Expression => declare Cond : constant Node_Id := First (Expressions (N)); Thnx : constant Node_Id := Next (Cond); --- 573,586 ---- return Skip; end; + -- Case expression + + when N_Case_Expression => + return OK; -- ??? + -- Conditional expression, processed like an if statement ! when N_Conditional_Expression => declare Cond : constant Node_Id := First (Expressions (N)); Thnx : constant Node_Id := Next (Cond); *************** package body Par_SCO is *** 508,518 **** -- See if we have simple decision at outer level and if so then -- generate the decision entry for this simple decision. A simple -- decision is a boolean expression (which is not a logical operator ! -- or short circuit form) appearing as the operand of an IF, WHILE ! -- or EXIT WHEN construct. if T /= 'X' and then not Is_Logical_Operator (N) then ! Output_Element (N, T); -- Change Last in last table entry to True to mark end of -- sequence, which is this case is only one element long. --- 612,623 ---- -- See if we have simple decision at outer level and if so then -- generate the decision entry for this simple decision. A simple -- decision is a boolean expression (which is not a logical operator ! -- or short circuit form) appearing as the operand of an IF, WHILE, ! -- EXIT WHEN, or special PRAGMA construct. if T /= 'X' and then not Is_Logical_Operator (N) then ! Output_Header (T); ! Output_Element (N); -- Change Last in last table entry to True to mark end of -- sequence, which is this case is only one element long. *************** package body Par_SCO is *** 671,676 **** --- 776,784 ---- if Nkind (Lu) = N_Subprogram_Body then Traverse_Subprogram_Body (Lu); + elsif Nkind (Lu) = N_Subprogram_Declaration then + Traverse_Subprogram_Declaration (Lu); + elsif Nkind (Lu) = N_Package_Declaration then Traverse_Package_Declaration (Lu); *************** package body Par_SCO is *** 680,691 **** elsif Nkind (Lu) = N_Generic_Package_Declaration then Traverse_Generic_Package_Declaration (Lu); ! -- For anything else, the only issue is default expressions for ! -- parameters, where we have to worry about possible embedded decisions ! -- but nothing else. else ! Process_Decisions (Lu, 'X'); end if; -- Make entry for new unit in unit tables, we will fill in the file --- 788,801 ---- elsif Nkind (Lu) = N_Generic_Package_Declaration then Traverse_Generic_Package_Declaration (Lu); ! elsif Nkind (Lu) in N_Generic_Instantiation then ! Traverse_Generic_Instantiation (Lu); ! ! -- All other cases of compilation units (e.g. renamings), generate ! -- no SCO information. else ! null; end if; -- Make entry for new unit in unit tables, we will fill in the file *************** package body Par_SCO is *** 704,717 **** -- Set_SCO_Condition -- ----------------------- ! procedure Set_SCO_Condition (First_Loc : Source_Ptr; Typ : Character) is ! Index : constant Nat := Condition_Hash_Table.Get (First_Loc); begin if Index /= 0 then ! SCO_Table.Table (Index).C2 := Typ; end if; end Set_SCO_Condition; --------------------- -- Set_Table_Entry -- --------------------- --- 814,861 ---- -- Set_SCO_Condition -- ----------------------- ! procedure Set_SCO_Condition (Cond : Node_Id; Val : Boolean) is ! Orig : constant Node_Id := Original_Node (Cond); ! Index : Nat; ! Start : Source_Ptr; ! Dummy : Source_Ptr; ! ! Constant_Condition_Code : constant array (Boolean) of Character := ! (False => 'f', True => 't'); begin + Sloc_Range (Orig, Start, Dummy); + Index := Condition_Pragma_Hash_Table.Get (Start); + + -- The test here for zero is to deal with possible previous errors + if Index /= 0 then ! pragma Assert (SCO_Table.Table (Index).C1 = ' '); ! SCO_Table.Table (Index).C2 := Constant_Condition_Code (Val); end if; end Set_SCO_Condition; + ---------------------------- + -- Set_SCO_Pragma_Enabled -- + ---------------------------- + + procedure Set_SCO_Pragma_Enabled (Loc : Source_Ptr) is + Index : Nat; + + begin + -- Note: the reason we use the Sloc value as the key is that in the + -- generic case, the call to this procedure is made on a copy of the + -- original node, so we can't use the Node_Id value. + + Index := Condition_Pragma_Hash_Table.Get (Loc); + + -- The test here for zero is to deal with possible previous errors + + if Index /= 0 then + pragma Assert (SCO_Table.Table (Index).C1 = 'P'); + SCO_Table.Table (Index).C2 := 'e'; + end if; + end Set_SCO_Pragma_Enabled; + --------------------- -- Set_Table_Entry -- --------------------- *************** package body Par_SCO is *** 756,789 **** -- Traverse_Declarations_Or_Statements -- ----------------------------------------- ! procedure Traverse_Declarations_Or_Statements (L : List_Id) is ! N : Node_Id; ! Dummy : Source_Ptr; ! type SC_Entry is record ! From : Source_Ptr; ! To : Source_Ptr; ! Typ : Character; ! end record; ! -- Used to store a single entry in the following array ! SC_Array : array (Nat range 1 .. 10_000) of SC_Entry; ! SC_Last : Nat; -- Used to store statement components for a CS entry to be output ! -- as a result of the call to this procedure. SC_Last is the last -- entry stored, so the current statement sequence is represented ! -- by SC_Array (1 .. SC_Last). Extend_Statement_Sequence adds an ! -- entry to this array, and Set_Statement_Entry clears it, copying ! -- the entries to the main SCO output table. The reason that we do ! -- the temporary caching of results in this array is that we want ! -- the SCO table entries for a given CS line to be contiguous, and ! -- the processing may output intermediate entries such as decision ! -- entries. Note that the limit of 10_000 here is arbitrary, but does ! -- not cause any trouble, if we encounter more than 10_000 statements ! -- we simply break the current CS sequence at that point, which is ! -- harmless, since this is only used for back annotation and it is ! -- not critical that back annotation always work in all cases. Anyway ! -- exceeding 10,000 statements in a basic block is very unlikely. procedure Extend_Statement_Sequence (N : Node_Id; Typ : Character); -- Extend the current statement sequence to encompass the node N. Typ --- 900,972 ---- -- Traverse_Declarations_Or_Statements -- ----------------------------------------- ! -- Tables used by Traverse_Declarations_Or_Statements for temporarily ! -- holding statement and decision entries. These are declared globally ! -- since they are shared by recursive calls to this procedure. ! type SC_Entry is record ! From : Source_Ptr; ! To : Source_Ptr; ! Typ : Character; ! end record; ! -- Used to store a single entry in the following table, From:To represents ! -- the range of entries in the CS line entry, and typ is the type, with ! -- space meaning that no type letter will accompany the entry. ! package SC is new Table.Table ( ! Table_Component_Type => SC_Entry, ! Table_Index_Type => Nat, ! Table_Low_Bound => 1, ! Table_Initial => 1000, ! Table_Increment => 200, ! Table_Name => "SCO_SC"); -- Used to store statement components for a CS entry to be output ! -- as a result of the call to this procedure. SC.Last is the last -- entry stored, so the current statement sequence is represented ! -- by SC_Array (SC_First .. SC.Last), where SC_First is saved on ! -- entry to each recursive call to the routine. ! -- ! -- Extend_Statement_Sequence adds an entry to this array, and then ! -- Set_Statement_Entry clears the entries starting with SC_First, ! -- copying these entries to the main SCO output table. The reason that ! -- we do the temporary caching of results in this array is that we want ! -- the SCO table entries for a given CS line to be contiguous, and the ! -- processing may output intermediate entries such as decision entries. ! ! type SD_Entry is record ! Nod : Node_Id; ! Lst : List_Id; ! Typ : Character; ! end record; ! -- Used to store a single entry in the following table. Nod is the node to ! -- be searched for decisions for the case of Process_Decisions_Defer with a ! -- node argument (with Lst set to No_List. Lst is the list to be searched ! -- for decisions for the case of Process_Decisions_Defer with a List ! -- argument (in which case Nod is set to Empty). ! ! package SD is new Table.Table ( ! Table_Component_Type => SD_Entry, ! Table_Index_Type => Nat, ! Table_Low_Bound => 1, ! Table_Initial => 1000, ! Table_Increment => 200, ! Table_Name => "SCO_SD"); ! -- Used to store possible decision information. Instead of calling the ! -- Process_Decisions procedures directly, we call Process_Decisions_Defer, ! -- which simply stores the arguments in this table. Then when we clear ! -- out a statement sequence using Set_Statement_Entry, after generating ! -- the CS lines for the statements, the entries in this table result in ! -- calls to Process_Decision. The reason for doing things this way is to ! -- ensure that decisions are output after the CS line for the statements ! -- in which the decisions occur. ! ! procedure Traverse_Declarations_Or_Statements (L : List_Id) is ! N : Node_Id; ! Dummy : Source_Ptr; ! ! SC_First : constant Nat := SC.Last + 1; ! SD_First : constant Nat := SD.Last + 1; ! -- Record first entries used in SC/SD at this recursive level procedure Extend_Statement_Sequence (N : Node_Id; Typ : Character); -- Extend the current statement sequence to encompass the node N. Typ *************** package body Par_SCO is *** 806,837 **** -- called when we find a statement or declaration that generates its -- own table entry, so that we must end the current statement sequence. ------------------------- -- Set_Statement_Entry -- ------------------------- procedure Set_Statement_Entry is ! C1 : Character; begin ! if SC_Last /= 0 then ! for J in 1 .. SC_Last loop ! if J = 1 then ! C1 := 'S'; ! else ! C1 := 's'; ! end if; Set_Table_Entry (C1 => C1, ! C2 => SC_Array (J).Typ, ! From => SC_Array (J).From, ! To => SC_Array (J).To, Last => (J = SC_Last)); ! end loop; ! SC_Last := 0; ! end if; end Set_Statement_Entry; ------------------------------- --- 989,1057 ---- -- called when we find a statement or declaration that generates its -- own table entry, so that we must end the current statement sequence. + procedure Process_Decisions_Defer (N : Node_Id; T : Character); + pragma Inline (Process_Decisions_Defer); + -- This routine is logically the same as Process_Decisions, except that + -- the arguments are saved in the SD table, for later processing when + -- Set_Statement_Entry is called, which goes through the saved entries + -- making the corresponding calls to Process_Decision. + + procedure Process_Decisions_Defer (L : List_Id; T : Character); + pragma Inline (Process_Decisions_Defer); + -- Same case for list arguments, deferred call to Process_Decisions + ------------------------- -- Set_Statement_Entry -- ------------------------- procedure Set_Statement_Entry is ! C1 : Character; ! SC_Last : constant Int := SC.Last; ! SD_Last : constant Int := SD.Last; begin ! -- Output statement entries from saved entries in SC table ! ! for J in SC_First .. SC_Last loop ! if J = SC_First then ! C1 := 'S'; ! else ! C1 := 's'; ! end if; + declare + SCE : SC_Entry renames SC.Table (J); + begin Set_Table_Entry (C1 => C1, ! C2 => SCE.Typ, ! From => SCE.From, ! To => SCE.To, Last => (J = SC_Last)); ! end; ! end loop; ! -- Clear out used section of SC table ! ! SC.Set_Last (SC_First - 1); ! ! -- Output any embedded decisions ! ! for J in SD_First .. SD_Last loop ! declare ! SDE : SD_Entry renames SD.Table (J); ! begin ! if Present (SDE.Nod) then ! Process_Decisions (SDE.Nod, SDE.Typ); ! else ! Process_Decisions (SDE.Lst, SDE.Typ); ! end if; ! end; ! end loop; ! ! -- Clear out used section of SD table ! ! SD.Set_Last (SD_First - 1); end Set_Statement_Entry; ------------------------------- *************** package body Par_SCO is *** 839,858 **** ------------------------------- procedure Extend_Statement_Sequence (N : Node_Id; Typ : Character) is begin ! -- Clear out statement sequence if array full ! ! if SC_Last = SC_Array'Last then ! Set_Statement_Entry; ! else ! SC_Last := SC_Last + 1; ! end if; ! ! -- Record new entry ! ! Sloc_Range ! (N, SC_Array (SC_Last).From, SC_Array (SC_Last).To); ! SC_Array (SC_Last).Typ := Typ; end Extend_Statement_Sequence; procedure Extend_Statement_Sequence --- 1059,1069 ---- ------------------------------- procedure Extend_Statement_Sequence (N : Node_Id; Typ : Character) is + F : Source_Ptr; + T : Source_Ptr; begin ! Sloc_Range (N, F, T); ! SC.Append ((F, T, Typ)); end Extend_Statement_Sequence; procedure Extend_Statement_Sequence *************** package body Par_SCO is *** 860,886 **** To : Node_Id; Typ : Character) is begin ! -- Clear out statement sequence if array full ! if SC_Last = SC_Array'Last then ! Set_Statement_Entry; ! else ! SC_Last := SC_Last + 1; ! end if; ! -- Make new entry ! Sloc_Range (From, SC_Array (SC_Last).From, Dummy); ! Sloc_Range (To, Dummy, SC_Array (SC_Last).To); ! SC_Array (SC_Last).Typ := Typ; ! end Extend_Statement_Sequence; -- Start of processing for Traverse_Declarations_Or_Statements begin if Is_Non_Empty_List (L) then - SC_Last := 0; -- Loop through statements or declarations --- 1071,1102 ---- To : Node_Id; Typ : Character) is + F : Source_Ptr; + T : Source_Ptr; begin ! Sloc_Range (From, F, Dummy); ! Sloc_Range (To, Dummy, T); ! SC.Append ((F, T, Typ)); ! end Extend_Statement_Sequence; ! ----------------------------- ! -- Process_Decisions_Defer -- ! ----------------------------- ! procedure Process_Decisions_Defer (N : Node_Id; T : Character) is ! begin ! SD.Append ((N, No_List, T)); ! end Process_Decisions_Defer; ! procedure Process_Decisions_Defer (L : List_Id; T : Character) is ! begin ! SD.Append ((Empty, L, T)); ! end Process_Decisions_Defer; -- Start of processing for Traverse_Declarations_Or_Statements begin if Is_Non_Empty_List (L) then -- Loop through statements or declarations *************** package body Par_SCO is *** 915,931 **** -- Subprogram declaration when N_Subprogram_Declaration => ! Set_Statement_Entry; ! Process_Decisions (Parameter_Specifications (Specification (N)), 'X'); -- Generic subprogram declaration when N_Generic_Subprogram_Declaration => ! Set_Statement_Entry; ! Process_Decisions (Generic_Formal_Declarations (N), 'X'); ! Process_Decisions (Parameter_Specifications (Specification (N)), 'X'); -- Subprogram_Body --- 1131,1148 ---- -- Subprogram declaration when N_Subprogram_Declaration => ! Process_Decisions_Defer (Parameter_Specifications (Specification (N)), 'X'); + Set_Statement_Entry; -- Generic subprogram declaration when N_Generic_Subprogram_Declaration => ! Process_Decisions_Defer ! (Generic_Formal_Declarations (N), 'X'); ! Process_Decisions_Defer (Parameter_Specifications (Specification (N)), 'X'); + Set_Statement_Entry; -- Subprogram_Body *************** package body Par_SCO is *** 940,947 **** when N_Exit_Statement => Extend_Statement_Sequence (N, ' '); Set_Statement_Entry; - Process_Decisions (Condition (N), 'E'); -- Label, which breaks the current statement sequence, but the -- label itself is not included in the next statement sequence, --- 1157,1164 ---- when N_Exit_Statement => Extend_Statement_Sequence (N, ' '); + Process_Decisions_Defer (Condition (N), 'E'); Set_Statement_Entry; -- Label, which breaks the current statement sequence, but the -- label itself is not included in the next statement sequence, *************** package body Par_SCO is *** 963,978 **** when N_If_Statement => Extend_Statement_Sequence (N, Condition (N), 'I'); Set_Statement_Entry; ! Process_Decisions (Condition (N), 'I'); Traverse_Declarations_Or_Statements (Then_Statements (N)); if Present (Elsif_Parts (N)) then declare Elif : Node_Id := First (Elsif_Parts (N)); begin while Present (Elif) loop ! Process_Decisions (Condition (Elif), 'I'); Traverse_Declarations_Or_Statements (Then_Statements (Elif)); Next (Elif); --- 1180,1212 ---- when N_If_Statement => Extend_Statement_Sequence (N, Condition (N), 'I'); + Process_Decisions_Defer (Condition (N), 'I'); Set_Statement_Entry; ! ! -- Now we traverse the statements in the THEN part ! Traverse_Declarations_Or_Statements (Then_Statements (N)); + -- Loop through ELSIF parts if present + if Present (Elsif_Parts (N)) then declare Elif : Node_Id := First (Elsif_Parts (N)); + begin while Present (Elif) loop ! ! -- We generate a statement sequence for the ! -- construct "ELSIF condition", so that we have ! -- a statement for the resulting decisions. ! ! Extend_Statement_Sequence ! (Elif, Condition (Elif), 'I'); ! Process_Decisions_Defer (Condition (Elif), 'I'); ! Set_Statement_Entry; ! ! -- Traverse the statements in the ELSIF ! Traverse_Declarations_Or_Statements (Then_Statements (Elif)); Next (Elif); *************** package body Par_SCO is *** 980,985 **** --- 1214,1221 ---- end; end if; + -- Finally traverse the ELSE statements if present + Traverse_Declarations_Or_Statements (Else_Statements (N)); -- Case statement, which breaks the current statement sequence, *************** package body Par_SCO is *** 987,1000 **** when N_Case_Statement => Extend_Statement_Sequence (N, Expression (N), 'C'); Set_Statement_Entry; - Process_Decisions (Expression (N), 'X'); -- Process case branches declare Alt : Node_Id; - begin Alt := First (Alternatives (N)); while Present (Alt) loop --- 1223,1235 ---- when N_Case_Statement => Extend_Statement_Sequence (N, Expression (N), 'C'); + Process_Decisions_Defer (Expression (N), 'X'); Set_Statement_Entry; -- Process case branches declare Alt : Node_Id; begin Alt := First (Alternatives (N)); while Present (Alt) loop *************** package body Par_SCO is *** 1017,1038 **** when N_Simple_Return_Statement => Extend_Statement_Sequence (N, ' '); Set_Statement_Entry; - Process_Decisions (Expression (N), 'X'); -- Extended return statement when N_Extended_Return_Statement => ! declare ! Odecl : constant Node_Id := ! First (Return_Object_Declarations (N)); ! begin ! if Present (Expression (Odecl)) then ! Extend_Statement_Sequence ! (N, Expression (Odecl), 'R'); ! Process_Decisions (Expression (Odecl), 'X'); ! end if; ! end; Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N)); --- 1252,1268 ---- when N_Simple_Return_Statement => Extend_Statement_Sequence (N, ' '); + Process_Decisions_Defer (Expression (N), 'X'); Set_Statement_Entry; -- Extended return statement when N_Extended_Return_Statement => ! Extend_Statement_Sequence ! (N, Last (Return_Object_Declarations (N)), 'R'); ! Process_Decisions_Defer ! (Return_Object_Declarations (N), 'X'); ! Set_Statement_Entry; Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N)); *************** package body Par_SCO is *** 1057,1069 **** if Present (Condition (ISC)) then Extend_Statement_Sequence (N, ISC, 'W'); ! Process_Decisions (Condition (ISC), 'W'); -- For statement else Extend_Statement_Sequence (N, ISC, 'F'); ! Process_Decisions (Loop_Parameter_Specification (ISC), 'X'); end if; end; --- 1287,1299 ---- if Present (Condition (ISC)) then Extend_Statement_Sequence (N, ISC, 'W'); ! Process_Decisions_Defer (Condition (ISC), 'W'); -- For statement else Extend_Statement_Sequence (N, ISC, 'F'); ! Process_Decisions_Defer (Loop_Parameter_Specification (ISC), 'X'); end if; end; *************** package body Par_SCO is *** 1077,1118 **** when N_Pragma => Extend_Statement_Sequence (N, 'P'); ! -- For pragmas Assert, Check, Precondition, and ! -- Postcondition, we generate decision entries for the ! -- condition only if the pragma is enabled. For now, we just ! -- check Assertions_Enabled, which will be set to reflect ! -- the presence of -gnata. ! -- Later we should move processing of the relevant pragmas ! -- to Par_Prag, and properly set the flag Pragma_Enabled at ! -- parse time, so that we can check this flag instead ??? ! -- For all other pragmas, we always generate decision ! -- entries for any embedded expressions. ! declare ! Nam : constant Name_Id := ! Chars (Pragma_Identifier (N)); ! Arg : Node_Id := First (Pragma_Argument_Associations (N)); ! begin ! case Nam is ! when Name_Assert | ! Name_Check | ! Name_Precondition | ! Name_Postcondition => if Nam = Name_Check then Next (Arg); end if; ! if Assertions_Enabled then ! Process_Decisions (Expression (Arg), 'P'); ! end if; ! when others => ! Process_Decisions (N, 'X'); ! end case; ! end; -- All other cases, which extend the current statement sequence -- but do not terminate it, even if they have nested decisions. --- 1307,1361 ---- when N_Pragma => Extend_Statement_Sequence (N, 'P'); ! -- Processing depends on the kind of pragma ! case Pragma_Name (N) is ! when Name_Assert | ! Name_Check | ! Name_Precondition | ! Name_Postcondition => ! -- For Assert/Check/Precondition/Postcondition, we ! -- must generate a P entry for the decision. Note that ! -- this is done unconditionally at this stage. Output ! -- for disabled pragmas is suppressed later on, when ! -- we output the decision line in Put_SCOs. ! declare ! Nam : constant Name_Id := ! Chars (Pragma_Identifier (N)); ! Arg : Node_Id := ! First (Pragma_Argument_Associations (N)); + begin if Nam = Name_Check then Next (Arg); end if; ! Process_Decisions_Defer (Expression (Arg), 'P'); ! end; ! -- For all other pragmas, we generate decision entries ! -- for any embedded expressions. ! ! when others => ! Process_Decisions_Defer (N, 'X'); ! end case; ! ! -- Object declaration. Ignored if Prev_Ids is set, since the ! -- parser generates multiple instances of the whole declaration ! -- if there is more than one identifier declared, and we only ! -- want one entry in the SCO's, so we take the first, for which ! -- Prev_Ids is False. ! ! when N_Object_Declaration => ! if not Prev_Ids (N) then ! Extend_Statement_Sequence (N, 'o'); ! ! if Has_Decision (N) then ! Process_Decisions_Defer (N, 'X'); ! end if; ! end if; -- All other cases, which extend the current statement sequence -- but do not terminate it, even if they have nested decisions. *************** package body Par_SCO is *** 1135,1143 **** when N_Subtype_Declaration => Typ := 's'; - when N_Object_Declaration => - Typ := 'o'; - when N_Renaming_Declaration => Typ := 'r'; --- 1378,1383 ---- *************** package body Par_SCO is *** 1154,1160 **** -- Process any embedded decisions if Has_Decision (N) then ! Process_Decisions (N, 'X'); end if; end case; --- 1394,1400 ---- -- Process any embedded decisions if Has_Decision (N) then ! Process_Decisions_Defer (N, 'X'); end if; end case; *************** package body Par_SCO is *** 1165,1170 **** --- 1405,1434 ---- end if; end Traverse_Declarations_Or_Statements; + ------------------------------------ + -- Traverse_Generic_Instantiation -- + ------------------------------------ + + procedure Traverse_Generic_Instantiation (N : Node_Id) is + First : Source_Ptr; + Last : Source_Ptr; + + begin + -- First we need a statement entry to cover the instantiation + + Sloc_Range (N, First, Last); + Set_Table_Entry + (C1 => 'S', + C2 => ' ', + From => First, + To => Last, + Last => True); + + -- Now output any embedded decisions + + Process_Decisions (N, 'X'); + end Traverse_Generic_Instantiation; + ------------------------------------------ -- Traverse_Generic_Package_Declaration -- ------------------------------------------ *************** package body Par_SCO is *** 1183,1189 **** Handler : Node_Id; begin - -- For package bodies without a statement part, the parser adds an empty -- one, to normalize the representation. The null statement therein, -- which does not come from source, does not get a SCO. --- 1447,1452 ---- *************** package body Par_SCO is *** 1232,1235 **** --- 1495,1510 ---- Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N)); end Traverse_Subprogram_Body; + ------------------------------------- + -- Traverse_Subprogram_Declaration -- + ------------------------------------- + + procedure Traverse_Subprogram_Declaration (N : Node_Id) is + ADN : constant Node_Id := Aux_Decls_Node (Parent (N)); + begin + Traverse_Declarations_Or_Statements (Config_Pragmas (ADN)); + Traverse_Declarations_Or_Statements (Declarations (ADN)); + Traverse_Declarations_Or_Statements (Pragmas_After (ADN)); + end Traverse_Subprogram_Declaration; + end Par_SCO; diff -Nrcpad gcc-4.5.2/gcc/ada/par_sco.ads gcc-4.6.0/gcc/ada/par_sco.ads *** gcc-4.5.2/gcc/ada/par_sco.ads Tue Jan 26 10:25:52 2010 --- gcc-4.6.0/gcc/ada/par_sco.ads Thu Jun 17 07:42:04 2010 *************** *** 25,180 **** -- This package contains the routines used to deal with generation and output -- of Soure Coverage Obligations (SCO's) used for coverage analysis purposes. with Types; use Types; package Par_SCO is - ---------------- - -- SCO Format -- - ---------------- - - -- Source coverage obligations are generated on a unit-by-unit basis in the - -- ALI file, using lines that start with the identifying character C. These - -- lines are generated if the -gnatC switch is set. - - -- Sloc Ranges - - -- In several places in the SCO lines, Sloc ranges appear. These are used - -- to indicate the first and last Sloc of some construct in the tree and - -- they have the form: - - -- line:col-line:col - - -- Note that SCO's are generated only for generic templates, not for - -- generic instances (since only the first are part of the source). So - -- we don't need generic instantiation stuff in these line:col items. - - -- SCO File headers - - -- The SCO information follows the cross-reference information, so it - -- need not be read by tools like gnatbind, gnatmake etc. The SCO output - -- is divided into sections, one section for each unit for which SCO's - -- are generated. A SCO section has a header of the form: - - -- C dependency-number filename - - -- This header precedes SCO information for the unit identified by - -- dependency number and file name. The dependency number is the - -- index into the generated D lines and is ones origin (i.e. 2 = - -- reference to second generated D line). - - -- Note that the filename here will reflect the original name if - -- a Source_Reference pragma was encountered (since all line number - -- references will be with respect to the original file). - - -- Statements - - -- For the purpose of SCO generation, the notion of statement includes - -- simple statements and also the following declaration types: - - -- type_declaration - -- subtype_declaration - -- object_declaration - -- renaming_declaration - -- generic_instantiation - - -- Statement lines - - -- These lines correspond to a sequence of one or more statements which - -- are always exeecuted in sequence, The first statement may be an entry - -- point (e.g. statement after a label), and the last statement may be - -- an exit point (e.g. an exit statement), but no other entry or exit - -- points may occur within the sequence of statements. The idea is that - -- the sequence can be treated as a single unit from a coverage point of - -- view, if any of the code for the statement sequence is executed, this - -- corresponds to coverage of the entire statement sequence. The form of - -- a statement line in the ALI file is: - - -- CS sloc-range - - -- Exit points - - -- An exit point is a statement that causes transfer of control. Examples - -- are exit statements, raise statements and return statements. The form - -- of an exit point in the ALI file is: - - -- CT sloc-range - - -- Decisions - - -- Decisions represent the most significant section of the SCO lines - - -- Note: in the following description, logical operator includes the - -- short circuited forms (so can be any of AND, OR, XOR, NOT, AND THEN, - -- or OR ELSE). - - -- Decisions are either simple or complex. A simple decision is a boolean - -- expresssion that occurs in the context of a control structure in the - -- source program, including WHILE, IF, EXIT WHEN. Note that a boolean - -- expression in any other context, e.g. on the right side of an - -- assignment, is not considered to be a decision. - - -- A complex decision is an occurrence of a logical operator which is not - -- itself an operand of some other logical operator. If any operand of - -- the logical operator is itself a logical operator, this is not a - -- separate decision, it is part of the same decision. - - -- So for example, if we have - - -- A, B, C, D : Boolean; - -- function F (Arg : Boolean) return Boolean); - -- ... - -- A and then (B or else F (C and then D)) - - -- There are two (complex) decisions here: - - -- 1. X and then (Y or else Z) - - -- where X = A, Y = B, and Z = F (C and then D) - - -- 2. C and then D - - -- For each decision, a decision line is generated with the form: - - -- C* expression - - -- Here * is one of the following characters: - - -- I decision in IF statement or conditional expression - -- E decision in EXIT WHEN statement - -- W decision in WHILE iteration scheme - -- X decision appearing in some other expression context - - -- The expression is a prefix polish form indicating the structure of - -- the decision, including logical operators and short circuit forms. - -- The following is a grammar showing the structure of expression: - - -- expression ::= term (if expr is not logical operator) - -- expression ::= & term term (if expr is AND THEN) - -- expression ::= | term term (if expr is OR ELSE) - -- expression ::= !term (if expr is NOT) - - -- term ::= element - -- term ::= expression - - -- element ::= outcome sloc-range - - -- outcome is one of the following letters: - - -- c condition - -- t true condition - -- f false condition - - -- where t/f are used to mark a condition that has been recognized by - -- the compiler as always being true or false. - - -- & indicates either AND THEN connecting two conditions - - -- | indicates either OR ELSE connection two conditions - - -- ! indicates NOT applied to the expression - ----------------- -- Subprograms -- ----------------- --- 25,36 ---- -- This package contains the routines used to deal with generation and output -- of Soure Coverage Obligations (SCO's) used for coverage analysis purposes. + -- See package SCOs for full documentation of format of SCO information. with Types; use Types; package Par_SCO is ----------------- -- Subprograms -- ----------------- *************** package Par_SCO is *** 187,197 **** -- internal tables recording the SCO information. Note that this is done -- before any semantic analysis/expansion happens. ! procedure Set_SCO_Condition (First_Loc : Source_Ptr; Typ : Character); -- This procedure is called during semantic analysis to record a condition ! -- which has been identified as always True (Typ = 't') or always False ! -- (Typ = 'f') by the compiler. The condition is identified by the ! -- First_Sloc value in the original tree. procedure SCO_Output; -- Outputs SCO lines for all units, with appropriate section headers, for --- 43,61 ---- -- internal tables recording the SCO information. Note that this is done -- before any semantic analysis/expansion happens. ! procedure Set_SCO_Condition (Cond : Node_Id; Val : Boolean); -- This procedure is called during semantic analysis to record a condition ! -- which has been identified as always True or always False, as indicated ! -- by Val. The condition is identified by the First_Sloc value in the ! -- original tree associated with Cond. ! ! procedure Set_SCO_Pragma_Enabled (Loc : Source_Ptr); ! -- This procedure is called from Sem_Prag when a pragma is enabled (i.e. ! -- when the Pragma_Enabled flag is set). Loc is the Sloc of the N_Pragma ! -- node. This is used to enable the corresponding SCO table entry. Note ! -- that we use the Sloc as the key here, since in the generic case, the ! -- analysis is on a copy of the node, which is different from the node ! -- seen by Par_SCO in the parse tree (but the Sloc values are the same). procedure SCO_Output; -- Outputs SCO lines for all units, with appropriate section headers, for *************** package Par_SCO is *** 199,206 **** -- possibly modified by calls to Set_SCO_Condition. procedure dsco; ! -- Debug routine to dump SCO table. This is a raw format dump showing ! -- exactly what the tables contain. procedure pscos; -- Debugging procedure to output contents of SCO binary tables in the --- 63,70 ---- -- possibly modified by calls to Set_SCO_Condition. procedure dsco; ! -- Debug routine to dump internal SCO table. This is a raw format dump ! -- showing exactly what the table contains. procedure pscos; -- Debugging procedure to output contents of SCO binary tables in the diff -Nrcpad gcc-4.5.2/gcc/ada/prep.adb gcc-4.6.0/gcc/ada/prep.adb *** gcc-4.5.2/gcc/ada/prep.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/prep.adb Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package body Prep is *** 411,417 **** Scan.all; else ! Error_Msg ("`)` expected", Token_Ptr); end if; when Tok_Not => --- 411,418 ---- Scan.all; else ! Error_Msg -- CODEFIX ! ("`)` expected", Token_Ptr); end if; when Tok_Not => *************** package body Prep is *** 713,720 **** procedure List_Symbols (Foreword : String) is Order : array (0 .. Integer (Symbol_Table.Last (Mapping))) of Symbol_Id; ! -- After alphabetical sorting, this array stores the indices of ! -- the symbols in the order they are displayed. function Lt (Op1, Op2 : Natural) return Boolean; -- Comparison routine for sort call --- 714,721 ---- procedure List_Symbols (Foreword : String) is Order : array (0 .. Integer (Symbol_Table.Last (Mapping))) of Symbol_Id; ! -- After alphabetical sorting, this array stores the indexes of the ! -- symbols in the order they are displayed. function Lt (Op1, Op2 : Natural) return Boolean; -- Comparison routine for sort call *************** package body Prep is *** 906,912 **** Scan.all; if Token /= Tok_Colon_Equal then ! Error_Msg ("`:=` expected", Token_Ptr); goto Cleanup; end if; --- 907,914 ---- Scan.all; if Token /= Tok_Colon_Equal then ! Error_Msg -- CODEFIX ! ("`:=` expected", Token_Ptr); goto Cleanup; end if; *************** package body Prep is *** 1032,1039 **** Modified : Boolean := False; procedure Output (From, To : Source_Ptr); ! -- Output the characters with indices From .. To in the buffer ! -- to the output file. procedure Output_Line (From, To : Source_Ptr); -- Output a line or the end of a line from the buffer to the output --- 1034,1041 ---- Modified : Boolean := False; procedure Output (From, To : Source_Ptr); ! -- Output the characters with indexes From .. To in the buffer to the ! -- output file. procedure Output_Line (From, To : Source_Ptr); -- Output a line or the end of a line from the buffer to the output *************** package body Prep is *** 1219,1225 **** elsif Pp_States.Table (Pp_States.Last).Else_Ptr /= 0 then ! Error_Msg ("duplicate ELSE line", Token_Ptr); No_Error_Found := False; end if; --- 1221,1228 ---- elsif Pp_States.Table (Pp_States.Last).Else_Ptr /= 0 then ! Error_Msg -- CODEFIX ! ("duplicate ELSE line", Token_Ptr); No_Error_Found := False; end if; *************** package body Prep is *** 1269,1282 **** Scan.all; if Token /= Tok_If then ! Error_Msg ("IF expected", Token_Ptr); No_Error_Found := False; else Scan.all; if Token /= Tok_Semicolon then ! Error_Msg ("`;` Expected", Token_Ptr); No_Error_Found := False; else --- 1272,1287 ---- Scan.all; if Token /= Tok_If then ! Error_Msg -- CODEFIX ! ("IF expected", Token_Ptr); No_Error_Found := False; else Scan.all; if Token /= Tok_Semicolon then ! Error_Msg -- CODEFIX ! ("`;` Expected", Token_Ptr); No_Error_Found := False; else *************** package body Prep is *** 1312,1324 **** No_Error_Found := False; if Pp_States.Last = 0 then ! Error_Msg ("IF expected", Token_Ptr); elsif Pp_States.Table (Pp_States.Last).Else_Ptr = 0 then ! Error_Msg ("IF, ELSIF, ELSE, or `END IF` expected", ! Token_Ptr); else Error_Msg ("IF or `END IF` expected", Token_Ptr); --- 1317,1331 ---- No_Error_Found := False; if Pp_States.Last = 0 then ! Error_Msg -- CODEFIX ! ("IF expected", Token_Ptr); elsif Pp_States.Table (Pp_States.Last).Else_Ptr = 0 then ! Error_Msg ! ("IF, ELSIF, ELSE, or `END IF` expected", ! Token_Ptr); else Error_Msg ("IF or `END IF` expected", Token_Ptr); diff -Nrcpad gcc-4.5.2/gcc/ada/prepcomp.adb gcc-4.6.0/gcc/ada/prepcomp.adb *** gcc-4.5.2/gcc/ada/prepcomp.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/prepcomp.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package body Prepcomp is *** 47,53 **** -- The following variable should be a constant, but this is not possible -- because its type GNAT.Dynamic_Tables.Instance has a component P of ! -- unitialized private type GNAT.Dynamic_Tables.Table_Private and there -- are no exported values for this private type. Warnings are Off because -- it is never assigned a value. --- 47,53 ---- -- The following variable should be a constant, but this is not possible -- because its type GNAT.Dynamic_Tables.Instance has a component P of ! -- uninitialized private type GNAT.Dynamic_Tables.Table_Private and there -- are no exported values for this private type. Warnings are Off because -- it is never assigned a value. *************** package body Prepcomp is *** 342,348 **** while Token /= Tok_End_Of_Line and then Token /= Tok_EOF loop if Token /= Tok_Minus then ! Error_Msg ("`'-` expected", Token_Ptr); Skip_To_End_Of_Line; goto Scan_Line; end if; --- 342,349 ---- while Token /= Tok_End_Of_Line and then Token /= Tok_EOF loop if Token /= Tok_Minus then ! Error_Msg -- CODEFIX ! ("`'-` expected", Token_Ptr); Skip_To_End_Of_Line; goto Scan_Line; end if; *************** package body Prepcomp is *** 463,469 **** Scan; if Token /= Tok_Equal then ! Error_Msg ("`=` expected", Token_Ptr); Skip_To_End_Of_Line; goto Scan_Line; end if; --- 464,471 ---- Scan; if Token /= Tok_Equal then ! Error_Msg -- CODEFIX ! ("`=` expected", Token_Ptr); Skip_To_End_Of_Line; goto Scan_Line; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-attr.adb gcc-4.6.0/gcc/ada/prj-attr.adb *** gcc-4.5.2/gcc/ada/prj-attr.adb Tue Jan 26 14:02:25 2010 --- gcc-4.6.0/gcc/ada/prj-attr.adb Mon Oct 18 10:03:30 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body Prj.Attr is *** 71,77 **** "SVRproject_dir#" & "lVmain#" & "LVlanguages#" & - "SVmain_language#" & "Lbroots#" & "SVexternally_built#" & --- 71,76 ---- *************** package body Prj.Attr is *** 82,87 **** --- 81,87 ---- "LVsource_dirs#" & "Lainherit_source_path#" & "LVexcluded_source_dirs#" & + "LVignore_source_sub_dirs#" & -- Source files *************** package body Prj.Attr is *** 92,97 **** --- 92,103 ---- "SVexcluded_source_list_file#" & "LVinterfaces#" & + -- Projects (in aggregate projects) + + "LVproject_files#" & + "LVproject_path#" & + "SAexternal#" & + -- Libraries "SVlibrary_dir#" & *************** package body Prj.Attr is *** 100,105 **** --- 106,112 ---- "SVlibrary_version#" & "LVlibrary_interface#" & "SVlibrary_auto_init#" & + "LVleading_library_options#" & "LVlibrary_options#" & "SVlibrary_src_dir#" & "SVlibrary_ali_dir#" & *************** package body Prj.Attr is *** 147,164 **** "Saruntime_source_dir#" & -- package Naming "Pnaming#" & ! "Saspecification_suffix#" & "Saspec_suffix#" & ! "Saimplementation_suffix#" & "Sabody_suffix#" & "SVseparate_suffix#" & "SVcasing#" & "SVdot_replacement#" & ! "sAspecification#" & "sAspec#" & ! "sAimplementation#" & "sAbody#" & "Laspecification_exceptions#" & "Laimplementation_exceptions#" & --- 154,173 ---- "Saruntime_source_dir#" & -- package Naming + -- Some attributes are obsolescent, and renamed in the tree (see + -- Prj.Dect.Rename_Obsolescent_Attributes). "Pnaming#" & ! "Saspecification_suffix#" & -- Always renamed to "spec_suffix" in tree "Saspec_suffix#" & ! "Saimplementation_suffix#" & -- Always renamed to "body_suffix" in tree "Sabody_suffix#" & "SVseparate_suffix#" & "SVcasing#" & "SVdot_replacement#" & ! "sAspecification#" & -- Always renamed to "spec" in project tree "sAspec#" & ! "sAimplementation#" & -- Always renamed to "body" in project tree "sAbody#" & "Laspecification_exceptions#" & "Laimplementation_exceptions#" & *************** package body Prj.Attr is *** 247,252 **** --- 256,262 ---- "Plinker#" & "LVrequired_switches#" & "Ladefault_switches#" & + "LcOleading_switches#" & "LcOswitches#" & "LVlinker_options#" & "SVmap_file_option#" & *************** package body Prj.Attr is *** 325,330 **** --- 335,341 ---- "SVvcs_kind#" & "SVvcs_file_check#" & "SVvcs_log_check#" & + "SVdocumentation_dir#" & -- package Stack diff -Nrcpad gcc-4.5.2/gcc/ada/prj-attr.ads gcc-4.6.0/gcc/ada/prj-attr.ads *** gcc-4.5.2/gcc/ada/prj-attr.ads Mon Nov 30 11:38:12 2009 --- gcc-4.6.0/gcc/ada/prj-attr.ads Thu Sep 9 09:44:34 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package Prj.Attr is *** 44,51 **** -- packages and their attribute. This procedure should be called by -- Prj.Initialize. ! type Attribute_Kind is ! (Unknown, -- The attribute does not exist Single, --- 44,51 ---- -- packages and their attribute. This procedure should be called by -- Prj.Initialize. ! type Attribute_Kind is ( ! Unknown, -- The attribute does not exist Single, *************** package Prj.Attr is *** 61,69 **** Case_Insensitive_Associative_Array, -- Associative array attribute with a case insensitive index ! Optional_Index_Case_Insensitive_Associative_Array); -- Associative array attribute with a case insensitive index and an -- optional source index. -- 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 ... --- 61,70 ---- Case_Insensitive_Associative_Array, -- Associative array attribute with a case insensitive index ! Optional_Index_Case_Insensitive_Associative_Array -- Associative array attribute with a case insensitive index and an -- optional source index. + ); -- 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 ... *************** package Prj.Attr is *** 73,78 **** --- 74,84 ---- -- Subset of Attribute_Kinds that may be used for the attributes that is -- used when defining a new package. + subtype All_Case_Insensitive_Associative_Array is Attribute_Kind range + Case_Insensitive_Associative_Array .. + Optional_Index_Case_Insensitive_Associative_Array; + -- Subtype including both cases of Case_Insensitive_Associative_Array + Max_Attribute_Name_Length : constant := 64; -- The maximum length of attribute names diff -Nrcpad gcc-4.5.2/gcc/ada/prj-conf.adb gcc-4.6.0/gcc/ada/prj-conf.adb *** gcc-4.5.2/gcc/ada/prj-conf.adb Tue Jan 26 09:56:25 2010 --- gcc-4.6.0/gcc/ada/prj-conf.adb Fri Oct 22 10:41:17 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2006-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2006-2010, 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,45 **** -- -- ------------------------------------------------------------------------------ ! with Ada.Directories; use Ada.Directories; ! with GNAT.HTable; use GNAT.HTable; ! with Makeutl; use Makeutl; with MLib.Tgt; ! with Opt; use Opt; ! with Output; use Output; with Prj.Env; with Prj.Err; with Prj.Part; with Prj.PP; ! with Prj.Proc; use Prj.Proc; ! with Prj.Tree; use Prj.Tree; ! with Prj.Util; use Prj.Util; ! with Prj; use Prj; ! with Snames; use Snames; ! with System.Case_Util; use System.Case_Util; ! with System; package body Prj.Conf is --- 23,48 ---- -- -- ------------------------------------------------------------------------------ ! with Hostparm; ! with Makeutl; use Makeutl; with MLib.Tgt; ! with Opt; use Opt; ! with Output; use Output; with Prj.Env; with Prj.Err; with Prj.Part; with Prj.PP; ! with Prj.Proc; use Prj.Proc; ! with Prj.Tree; use Prj.Tree; ! with Prj.Util; use Prj.Util; ! with Prj; use Prj; ! with Snames; use Snames; ! ! with Ada.Directories; use Ada.Directories; ! with Ada.Exceptions; use Ada.Exceptions; ! ! with GNAT.Case_Util; use GNAT.Case_Util; ! with GNAT.HTable; use GNAT.HTable; package body Prj.Conf is *************** package body Prj.Conf is *** 64,69 **** --- 67,76 ---- -- Stores the runtime names for the various languages. This is in general -- set from a --RTS command line option. + ----------------------- + -- Local_Subprograms -- + ----------------------- + procedure Add_Attributes (Project_Tree : Project_Tree_Ref; Conf_Decl : Declarations; *************** package body Prj.Conf is *** 74,83 **** -- For string list values, prepend the value in the user declarations with -- the value in the config declarations. - function Locate_Config_File (Name : String) return String_Access; - -- Search for Name in the config files directory. Return full path if - -- found, or null otherwise - function Check_Target (Config_File : Prj.Project_Id; Autoconf_Specified : Boolean; --- 81,86 ---- *************** package body Prj.Conf is *** 87,93 **** -- Target should be set to the empty string when the user did not specify -- a target. If the target in the configuration file is invalid, this -- function will raise Invalid_Config with an appropriate message. ! -- Autoconf_Specified should be set to True if the user has used --autoconf -------------------- -- Add_Attributes -- --- 90,105 ---- -- Target should be set to the empty string when the user did not specify -- a target. If the target in the configuration file is invalid, this -- function will raise Invalid_Config with an appropriate message. ! -- Autoconf_Specified should be set to True if the user has used ! -- autoconf. ! ! function Locate_Config_File (Name : String) return String_Access; ! -- Search for Name in the config files directory. Return full path if ! -- found, or null otherwise. ! ! procedure Raise_Invalid_Config (Msg : String); ! pragma No_Return (Raise_Invalid_Config); ! -- Raises exception Invalid_Config with given message -------------------- -- Add_Attributes -- *************** package body Prj.Conf is *** 313,334 **** end loop; end Add_Attributes; ! ------------------------ ! -- Locate_Config_File -- ! ------------------------ - function Locate_Config_File (Name : String) return String_Access is - Prefix_Path : constant String := Executable_Prefix_Path; begin ! if Prefix_Path'Length /= 0 then ! return Locate_Regular_File ! (Name, ! "." & Path_Separator & ! Prefix_Path & "share" & Directory_Separator & "gpr"); ! else ! return Locate_Regular_File (Name, "."); end if; ! end Locate_Config_File; ------------------ -- Check_Target -- --- 325,518 ---- end loop; end Add_Attributes; ! ------------------------------------ ! -- Add_Default_GNAT_Naming_Scheme -- ! ------------------------------------ ! ! procedure Add_Default_GNAT_Naming_Scheme ! (Config_File : in out Project_Node_Id; ! Project_Tree : Project_Node_Tree_Ref) ! is ! procedure Create_Attribute ! (Name : Name_Id; ! Value : String; ! Index : String := ""; ! Pkg : Project_Node_Id := Empty_Node); ! ! ---------------------- ! -- Create_Attribute -- ! ---------------------- ! ! procedure Create_Attribute ! (Name : Name_Id; ! Value : String; ! Index : String := ""; ! Pkg : Project_Node_Id := Empty_Node) ! is ! Attr : Project_Node_Id; ! pragma Unreferenced (Attr); ! ! Expr : Name_Id := No_Name; ! Val : Name_Id := No_Name; ! Parent : Project_Node_Id := Config_File; ! begin ! if Index /= "" then ! Name_Len := Index'Length; ! Name_Buffer (1 .. Name_Len) := Index; ! Val := Name_Find; ! end if; ! ! if Pkg /= Empty_Node then ! Parent := Pkg; ! end if; ! ! Name_Len := Value'Length; ! Name_Buffer (1 .. Name_Len) := Value; ! Expr := Name_Find; ! ! Attr := Create_Attribute ! (Tree => Project_Tree, ! Prj_Or_Pkg => Parent, ! Name => Name, ! Index_Name => Val, ! Kind => Prj.Single, ! Value => Create_Literal_String (Expr, Project_Tree)); ! end Create_Attribute; ! ! -- Local variables ! ! Name : Name_Id; ! Naming : Project_Node_Id; ! ! -- Start of processing for Add_Default_GNAT_Naming_Scheme begin ! if Config_File = Empty_Node then ! ! -- Create a dummy config file is none was found ! ! Name_Len := Auto_Cgpr'Length; ! Name_Buffer (1 .. Name_Len) := Auto_Cgpr; ! Name := Name_Find; ! ! -- An invalid project name to avoid conflicts with user-created ones ! ! Name_Len := 5; ! Name_Buffer (1 .. Name_Len) := "_auto"; ! ! Config_File := ! Create_Project ! (In_Tree => Project_Tree, ! Name => Name_Find, ! Full_Path => Path_Name_Type (Name), ! Is_Config_File => True); ! ! -- Setup library support ! ! case MLib.Tgt.Support_For_Libraries is ! when None => ! null; ! ! when Static_Only => ! Create_Attribute (Name_Library_Support, "static_only"); ! ! when Full => ! Create_Attribute (Name_Library_Support, "full"); ! end case; ! ! if MLib.Tgt.Standalone_Library_Auto_Init_Is_Supported then ! Create_Attribute (Name_Library_Auto_Init_Supported, "true"); ! else ! Create_Attribute (Name_Library_Auto_Init_Supported, "false"); ! end if; ! ! -- Setup Ada support (Ada is the default language here, since this ! -- is only called when no config file existed initially, ie for ! -- gnatmake). ! ! Create_Attribute (Name_Default_Language, "ada"); ! ! Naming := Create_Package (Project_Tree, Config_File, "naming"); ! Create_Attribute (Name_Spec_Suffix, ".ads", "ada", Pkg => Naming); ! Create_Attribute (Name_Separate_Suffix, ".adb", "ada", Pkg => Naming); ! Create_Attribute (Name_Body_Suffix, ".adb", "ada", Pkg => Naming); ! Create_Attribute (Name_Dot_Replacement, "-", Pkg => Naming); ! Create_Attribute (Name_Casing, "lowercase", Pkg => Naming); ! ! if Current_Verbosity = High then ! Write_Line ("Automatically generated (in-memory) config file"); ! Prj.PP.Pretty_Print ! (Project => Config_File, ! In_Tree => Project_Tree, ! Backward_Compatibility => False); ! end if; end if; ! end Add_Default_GNAT_Naming_Scheme; ! ! ----------------------- ! -- Apply_Config_File -- ! ----------------------- ! ! procedure Apply_Config_File ! (Config_File : Prj.Project_Id; ! Project_Tree : Prj.Project_Tree_Ref) ! is ! Conf_Decl : constant Declarations := Config_File.Decl; ! Conf_Pack_Id : Package_Id; ! Conf_Pack : Package_Element; ! ! User_Decl : Declarations; ! User_Pack_Id : Package_Id; ! User_Pack : Package_Element; ! Proj : Project_List; ! ! begin ! Proj := Project_Tree.Projects; ! while Proj /= null loop ! if Proj.Project /= Config_File then ! User_Decl := Proj.Project.Decl; ! Add_Attributes ! (Project_Tree => Project_Tree, ! Conf_Decl => Conf_Decl, ! User_Decl => User_Decl); ! ! Conf_Pack_Id := Conf_Decl.Packages; ! while Conf_Pack_Id /= No_Package loop ! Conf_Pack := Project_Tree.Packages.Table (Conf_Pack_Id); ! ! User_Pack_Id := User_Decl.Packages; ! while User_Pack_Id /= No_Package loop ! User_Pack := Project_Tree.Packages.Table (User_Pack_Id); ! exit when User_Pack.Name = Conf_Pack.Name; ! User_Pack_Id := User_Pack.Next; ! end loop; ! ! if User_Pack_Id = No_Package then ! Package_Table.Increment_Last (Project_Tree.Packages); ! User_Pack := Conf_Pack; ! User_Pack.Next := User_Decl.Packages; ! User_Decl.Packages := ! Package_Table.Last (Project_Tree.Packages); ! Project_Tree.Packages.Table (User_Decl.Packages) := ! User_Pack; ! ! else ! Add_Attributes ! (Project_Tree => Project_Tree, ! Conf_Decl => Conf_Pack.Decl, ! User_Decl => Project_Tree.Packages.Table ! (User_Pack_Id).Decl); ! end if; ! ! Conf_Pack_Id := Conf_Pack.Next; ! end loop; ! ! Proj.Project.Decl := User_Decl; ! end if; ! ! Proj := Proj.Next; ! end loop; ! end Apply_Config_File; ------------------ -- Check_Target -- *************** package body Prj.Conf is *** 368,380 **** else if Tgt_Name /= No_Name then ! raise Invalid_Config ! with "invalid target name """ ! & Get_Name_String (Tgt_Name) & """ in configuration"; ! else ! raise Invalid_Config ! with "no target specified in configuration file"; end if; end if; end if; --- 552,563 ---- else if Tgt_Name /= No_Name then ! Raise_Invalid_Config ! ("invalid target name """ ! & Get_Name_String (Tgt_Name) & """ in configuration"); else ! Raise_Invalid_Config ! ("no target specified in configuration file"); end if; end if; end if; *************** package body Prj.Conf is *** 402,414 **** Flags : Processing_Flags; On_Load_Config : Config_File_Hook := null) is function Default_File_Name return String; -- Return the name of the default config file that should be tested procedure Do_Autoconf; ! -- Generate a new config file through gprconfig. ! -- In case of error, this raises the Invalid_Config exception with an ! -- appropriate message function Get_Config_Switches return Argument_List_Access; -- Return the --config switches to use for gprconfig --- 585,601 ---- Flags : Processing_Flags; On_Load_Config : Config_File_Hook := null) is + + At_Least_One_Compiler_Command : Boolean := False; + -- Set to True if at least one attribute Ide'Compiler_Command is + -- specified for one language of the system. + function Default_File_Name return String; -- Return the name of the default config file that should be tested procedure Do_Autoconf; ! -- Generate a new config file through gprconfig. In case of error, this ! -- raises the Invalid_Config exception with an appropriate message function Get_Config_Switches return Argument_List_Access; -- Return the --config switches to use for gprconfig *************** package body Prj.Conf is *** 443,448 **** --- 630,636 ---- declare T : constant String := Tmp.all; + begin Free (Tmp); *************** package body Prj.Conf is *** 630,635 **** --- 818,825 ---- new String'(Config_Command & ",," & Runtime_Name); else + At_Least_One_Compiler_Command := True; + declare Compiler_Command : constant String := Get_Name_String (Variable.Value); *************** package body Prj.Conf is *** 676,689 **** Gprconfig_Path := Locate_Exec_On_Path (Gprconfig_Name); if Gprconfig_Path = null then ! raise Invalid_Config ! with "could not locate gprconfig for auto-configuration"; end if; -- First, find the object directory of the user's project if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then ! Get_Name_String (Project.Directory.Name); else if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then --- 866,879 ---- Gprconfig_Path := Locate_Exec_On_Path (Gprconfig_Name); if Gprconfig_Path = null then ! Raise_Invalid_Config ! ("could not locate gprconfig for auto-configuration"); end if; -- First, find the object directory of the user's project if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then ! Get_Name_String (Project.Directory.Display_Name); else if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then *************** package body Prj.Conf is *** 692,698 **** else Name_Len := 0; Add_Str_To_Name_Buffer ! (Get_Name_String (Project.Directory.Name)); Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value)); end if; end if; --- 882,888 ---- else Name_Len := 0; Add_Str_To_Name_Buffer ! (Get_Name_String (Project.Directory.Display_Name)); Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value)); end if; end if; *************** package body Prj.Conf is *** 736,751 **** exception when others => ! raise Invalid_Config ! with "could not create object directory " & Obj_Dir; end; end if; if not Is_Directory (Obj_Dir) then case Flags.Require_Obj_Dirs is when Error => ! raise Invalid_Config ! with "object directory " & Obj_Dir & " does not exist"; when Warning => Prj.Err.Error_Msg (Flags, --- 926,941 ---- exception when others => ! Raise_Invalid_Config ! ("could not create object directory " & Obj_Dir); end; end if; if not Is_Directory (Obj_Dir) then case Flags.Require_Obj_Dirs is when Error => ! Raise_Invalid_Config ! ("object directory " & Obj_Dir & " does not exist"); when Warning => Prj.Err.Error_Msg (Flags, *************** package body Prj.Conf is *** 801,807 **** Arg_Last := 3; else if Target_Name = "" then ! Args (4) := new String'("--target=" & Normalized_Hostname); else Args (4) := new String'("--target=" & Target_Name); end if; --- 991,1004 ---- Arg_Last := 3; else if Target_Name = "" then ! if At_Least_One_Compiler_Command then ! Args (4) := new String'("--target=all"); ! ! else ! Args (4) := ! new String'("--target=" & Normalized_Hostname); ! end if; ! else Args (4) := new String'("--target=" & Target_Name); end if; *************** package body Prj.Conf is *** 850,857 **** Config_File_Path := Locate_Config_File (Args (3).all); if Config_File_Path = null then ! raise Invalid_Config ! with "could not create " & Args (3).all; end if; for F in Args'Range loop --- 1047,1054 ---- Config_File_Path := Locate_Config_File (Args (3).all); if Config_File_Path = null then ! Raise_Invalid_Config ! ("could not create " & Args (3).all); end if; for F in Args'Range loop *************** package body Prj.Conf is *** 877,885 **** if (not Allow_Automatic_Generation) and then Config_File_Name /= "" then ! raise Invalid_Config ! with "could not locate main configuration project " ! & Config_File_Name; end if; end if; --- 1074,1082 ---- if (not Allow_Automatic_Generation) and then Config_File_Name /= "" then ! Raise_Invalid_Config ! ("could not locate main configuration project " ! & Config_File_Name); end if; end if; *************** package body Prj.Conf is *** 889,896 **** <> if Automatically_Generated then ! -- This might raise an Invalid_Config exception ! Do_Autoconf; end if; -- Parse the configuration file --- 1086,1103 ---- <> if Automatically_Generated then ! if Hostparm.OpenVMS then ! ! -- There is no gprconfig on VMS ! ! Raise_Invalid_Config ! ("could not locate any configuration project file"); ! ! else ! -- This might raise an Invalid_Config exception ! ! Do_Autoconf; ! end if; end if; -- Parse the configuration file *************** package body Prj.Conf is *** 935,943 **** if Config_Project_Node = Empty_Node or else Config = No_Project then ! raise Invalid_Config ! with "processing of configuration project """ ! & Config_File_Path.all & """ failed"; end if; -- Check that the target of the configuration file is the one the user --- 1142,1150 ---- if Config_Project_Node = Empty_Node or else Config = No_Project then ! Raise_Invalid_Config ! ("processing of configuration project """ ! & Config_File_Path.all & """ failed"); end if; -- Check that the target of the configuration file is the one the user *************** package body Prj.Conf is *** 953,1034 **** end if; end Get_Or_Create_Configuration_File; ! -------------------------------------- ! -- Process_Project_And_Apply_Config -- ! -------------------------------------- ! ! procedure Process_Project_And_Apply_Config ! (Main_Project : out Prj.Project_Id; ! User_Project_Node : Prj.Tree.Project_Node_Id; ! Config_File_Name : String := ""; ! Autoconf_Specified : Boolean; ! Project_Tree : Prj.Project_Tree_Ref; ! Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Packages_To_Check : String_List_Access; ! Allow_Automatic_Generation : Boolean := True; ! Automatically_Generated : out Boolean; ! Config_File_Path : out String_Access; ! Target_Name : String := ""; ! Normalized_Hostname : String; ! Flags : Processing_Flags; ! On_Load_Config : Config_File_Hook := null; ! Reset_Tree : Boolean := True) ! is ! Main_Config_Project : Project_Id; ! Success : Boolean; begin ! Main_Project := No_Project; ! Automatically_Generated := False; ! ! Process_Project_Tree_Phase_1 ! (In_Tree => Project_Tree, ! Project => Main_Project, ! Success => Success, ! From_Project_Node => User_Project_Node, ! From_Project_Node_Tree => Project_Node_Tree, ! Flags => Flags, ! Reset_Tree => Reset_Tree); ! ! if not Success then ! Main_Project := No_Project; ! return; ! end if; ! ! -- Find configuration file ! ! Get_Or_Create_Configuration_File ! (Config => Main_Config_Project, ! Project => Main_Project, ! Project_Tree => Project_Tree, ! Project_Node_Tree => Project_Node_Tree, ! Allow_Automatic_Generation => Allow_Automatic_Generation, ! Config_File_Name => Config_File_Name, ! Autoconf_Specified => Autoconf_Specified, ! Target_Name => Target_Name, ! Normalized_Hostname => Normalized_Hostname, ! Packages_To_Check => Packages_To_Check, ! Config_File_Path => Config_File_Path, ! Automatically_Generated => Automatically_Generated, ! Flags => Flags, ! On_Load_Config => On_Load_Config); ! ! Apply_Config_File (Main_Config_Project, Project_Tree); ! ! -- Finish processing the user's project ! ! Prj.Proc.Process_Project_Tree_Phase_2 ! (In_Tree => Project_Tree, ! Project => Main_Project, ! Success => Success, ! From_Project_Node => User_Project_Node, ! From_Project_Node_Tree => Project_Node_Tree, ! Flags => Flags); ! ! if not Success then ! Main_Project := No_Project; end if; ! end Process_Project_And_Apply_Config; ------------------------------------ -- Parse_Project_And_Apply_Config -- --- 1160,1181 ---- end if; end Get_Or_Create_Configuration_File; ! ------------------------ ! -- Locate_Config_File -- ! ------------------------ + function Locate_Config_File (Name : String) return String_Access is + Prefix_Path : constant String := Executable_Prefix_Path; begin ! if Prefix_Path'Length /= 0 then ! return Locate_Regular_File ! (Name, ! "." & Path_Separator & ! Prefix_Path & "share" & Directory_Separator & "gpr"); ! else ! return Locate_Regular_File (Name, "."); end if; ! end Locate_Config_File; ------------------------------------ -- Parse_Project_And_Apply_Config -- *************** package body Prj.Conf is *** 1091,1171 **** On_Load_Config => On_Load_Config); end Parse_Project_And_Apply_Config; ! ----------------------- ! -- Apply_Config_File -- ! ----------------------- ! procedure Apply_Config_File ! (Config_File : Prj.Project_Id; ! Project_Tree : Prj.Project_Tree_Ref) is ! Conf_Decl : constant Declarations := Config_File.Decl; ! Conf_Pack_Id : Package_Id; ! Conf_Pack : Package_Element; ! ! User_Decl : Declarations; ! User_Pack_Id : Package_Id; ! User_Pack : Package_Element; ! Proj : Project_List; begin ! Proj := Project_Tree.Projects; ! while Proj /= null loop ! if Proj.Project /= Config_File then ! User_Decl := Proj.Project.Decl; ! Add_Attributes ! (Project_Tree => Project_Tree, ! Conf_Decl => Conf_Decl, ! User_Decl => User_Decl); ! Conf_Pack_Id := Conf_Decl.Packages; ! while Conf_Pack_Id /= No_Package loop ! Conf_Pack := Project_Tree.Packages.Table (Conf_Pack_Id); ! User_Pack_Id := User_Decl.Packages; ! while User_Pack_Id /= No_Package loop ! User_Pack := Project_Tree.Packages.Table (User_Pack_Id); ! exit when User_Pack.Name = Conf_Pack.Name; ! User_Pack_Id := User_Pack.Next; ! end loop; ! if User_Pack_Id = No_Package then ! Package_Table.Increment_Last (Project_Tree.Packages); ! User_Pack := Conf_Pack; ! User_Pack.Next := User_Decl.Packages; ! User_Decl.Packages := ! Package_Table.Last (Project_Tree.Packages); ! Project_Tree.Packages.Table (User_Decl.Packages) := ! User_Pack; else ! Add_Attributes ! (Project_Tree => Project_Tree, ! Conf_Decl => Conf_Pack.Decl, ! User_Decl => Project_Tree.Packages.Table ! (User_Pack_Id).Decl); end if; ! Conf_Pack_Id := Conf_Pack.Next; ! end loop; ! Proj.Project.Decl := User_Decl; end if; ! Proj := Proj.Next; ! end loop; ! end Apply_Config_File; ! --------------------- ! -- Set_Runtime_For -- ! --------------------- ! procedure Set_Runtime_For (Language : Name_Id; RTS_Name : String) is begin ! Name_Len := RTS_Name'Length; ! Name_Buffer (1 .. Name_Len) := RTS_Name; ! RTS_Languages.Set (Language, Name_Find); ! end Set_Runtime_For; ---------------------- -- Runtime_Name_For -- --- 1238,1371 ---- On_Load_Config => On_Load_Config); end Parse_Project_And_Apply_Config; ! -------------------------------------- ! -- Process_Project_And_Apply_Config -- ! -------------------------------------- ! procedure Process_Project_And_Apply_Config ! (Main_Project : out Prj.Project_Id; ! User_Project_Node : Prj.Tree.Project_Node_Id; ! Config_File_Name : String := ""; ! Autoconf_Specified : Boolean; ! Project_Tree : Prj.Project_Tree_Ref; ! Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Packages_To_Check : String_List_Access; ! Allow_Automatic_Generation : Boolean := True; ! Automatically_Generated : out Boolean; ! Config_File_Path : out String_Access; ! Target_Name : String := ""; ! Normalized_Hostname : String; ! Flags : Processing_Flags; ! On_Load_Config : Config_File_Hook := null; ! Reset_Tree : Boolean := True) is ! Main_Config_Project : Project_Id; ! Success : Boolean; begin ! Main_Project := No_Project; ! Automatically_Generated := False; ! Process_Project_Tree_Phase_1 ! (In_Tree => Project_Tree, ! Project => Main_Project, ! Success => Success, ! From_Project_Node => User_Project_Node, ! From_Project_Node_Tree => Project_Node_Tree, ! Flags => Flags, ! Reset_Tree => Reset_Tree); ! if not Success then ! Main_Project := No_Project; ! return; ! end if; ! if Project_Tree.Source_Info_File_Name /= null then ! if not Is_Absolute_Path (Project_Tree.Source_Info_File_Name.all) then ! declare ! Obj_Dir : constant Variable_Value := ! Value_Of ! (Name_Object_Dir, ! Main_Project.Decl.Attributes, ! Project_Tree); ! ! begin ! if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then ! Get_Name_String (Main_Project.Directory.Display_Name); else ! if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then ! Get_Name_String (Obj_Dir.Value); ! ! else ! Name_Len := 0; ! Add_Str_To_Name_Buffer ! (Get_Name_String (Main_Project.Directory.Display_Name)); ! Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value)); ! end if; end if; ! Add_Char_To_Name_Buffer (Directory_Separator); ! Add_Str_To_Name_Buffer (Project_Tree.Source_Info_File_Name.all); ! Free (Project_Tree.Source_Info_File_Name); ! Project_Tree.Source_Info_File_Name := ! new String'(Name_Buffer (1 .. Name_Len)); ! end; ! end if; ! Read_Source_Info_File (Project_Tree); ! end if; ! ! -- Find configuration file ! ! Get_Or_Create_Configuration_File ! (Config => Main_Config_Project, ! Project => Main_Project, ! Project_Tree => Project_Tree, ! Project_Node_Tree => Project_Node_Tree, ! Allow_Automatic_Generation => Allow_Automatic_Generation, ! Config_File_Name => Config_File_Name, ! Autoconf_Specified => Autoconf_Specified, ! Target_Name => Target_Name, ! Normalized_Hostname => Normalized_Hostname, ! Packages_To_Check => Packages_To_Check, ! Config_File_Path => Config_File_Path, ! Automatically_Generated => Automatically_Generated, ! Flags => Flags, ! On_Load_Config => On_Load_Config); ! ! Apply_Config_File (Main_Config_Project, Project_Tree); ! ! -- Finish processing the user's project ! ! Prj.Proc.Process_Project_Tree_Phase_2 ! (In_Tree => Project_Tree, ! Project => Main_Project, ! Success => Success, ! From_Project_Node => User_Project_Node, ! From_Project_Node_Tree => Project_Node_Tree, ! Flags => Flags); ! ! if Success then ! if Project_Tree.Source_Info_File_Name /= null and then ! not Project_Tree.Source_Info_File_Exists ! then ! Write_Source_Info_File (Project_Tree); end if; ! else ! Main_Project := No_Project; ! end if; ! end Process_Project_And_Apply_Config; ! -------------------------- ! -- Raise_Invalid_Config -- ! -------------------------- ! procedure Raise_Invalid_Config (Msg : String) is begin ! Raise_Exception (Invalid_Config'Identity, Msg); ! end Raise_Invalid_Config; ---------------------- -- Runtime_Name_For -- *************** package body Prj.Conf is *** 1180,1307 **** end if; end Runtime_Name_For; ! ------------------------------------ ! -- Add_Default_GNAT_Naming_Scheme -- ! ------------------------------------ ! ! procedure Add_Default_GNAT_Naming_Scheme ! (Config_File : in out Project_Node_Id; ! Project_Tree : Project_Node_Tree_Ref) ! is ! procedure Create_Attribute ! (Name : Name_Id; ! Value : String; ! Index : String := ""; ! Pkg : Project_Node_Id := Empty_Node); ! ! ---------------------- ! -- Create_Attribute -- ! ---------------------- ! ! procedure Create_Attribute ! (Name : Name_Id; ! Value : String; ! Index : String := ""; ! Pkg : Project_Node_Id := Empty_Node) ! is ! Attr : Project_Node_Id; ! pragma Unreferenced (Attr); ! ! Expr : Name_Id := No_Name; ! Val : Name_Id := No_Name; ! Parent : Project_Node_Id := Config_File; ! begin ! if Index /= "" then ! Name_Len := Index'Length; ! Name_Buffer (1 .. Name_Len) := Index; ! Val := Name_Find; ! end if; ! ! if Pkg /= Empty_Node then ! Parent := Pkg; ! end if; ! ! Name_Len := Value'Length; ! Name_Buffer (1 .. Name_Len) := Value; ! Expr := Name_Find; ! ! Attr := Create_Attribute ! (Tree => Project_Tree, ! Prj_Or_Pkg => Parent, ! Name => Name, ! Index_Name => Val, ! Kind => Prj.Single, ! Value => Create_Literal_String (Expr, Project_Tree)); ! end Create_Attribute; ! ! -- Local variables ! ! Name : Name_Id; ! Naming : Project_Node_Id; ! ! -- Start of processing for Add_Default_GNAT_Naming_Scheme begin ! if Config_File = Empty_Node then ! ! -- Create a dummy config file is none was found ! ! Name_Len := Auto_Cgpr'Length; ! Name_Buffer (1 .. Name_Len) := Auto_Cgpr; ! Name := Name_Find; ! ! -- An invalid project name to avoid conflicts with user-created ones ! ! Name_Len := 5; ! Name_Buffer (1 .. Name_Len) := "_auto"; ! ! Config_File := ! Create_Project ! (In_Tree => Project_Tree, ! Name => Name_Find, ! Full_Path => Path_Name_Type (Name), ! Is_Config_File => True); ! ! -- Setup library support ! ! case MLib.Tgt.Support_For_Libraries is ! when None => ! null; ! ! when Static_Only => ! Create_Attribute (Name_Library_Support, "static_only"); ! ! when Full => ! Create_Attribute (Name_Library_Support, "full"); ! end case; ! ! if MLib.Tgt.Standalone_Library_Auto_Init_Is_Supported then ! Create_Attribute (Name_Library_Auto_Init_Supported, "true"); ! else ! Create_Attribute (Name_Library_Auto_Init_Supported, "false"); ! end if; ! ! -- Setup Ada support (Ada is the default language here, since this ! -- is only called when no config file existed initially, ie for ! -- gnatmake). ! ! Create_Attribute (Name_Default_Language, "ada"); ! ! Naming := Create_Package (Project_Tree, Config_File, "naming"); ! Create_Attribute (Name_Spec_Suffix, ".ads", "ada", Pkg => Naming); ! Create_Attribute (Name_Separate_Suffix, ".adb", "ada", Pkg => Naming); ! Create_Attribute (Name_Body_Suffix, ".adb", "ada", Pkg => Naming); ! Create_Attribute (Name_Dot_Replacement, "-", Pkg => Naming); ! Create_Attribute (Name_Casing, "lowercase", Pkg => Naming); ! ! if Current_Verbosity = High then ! Write_Line ("Automatically generated (in-memory) config file"); ! Prj.PP.Pretty_Print ! (Project => Config_File, ! In_Tree => Project_Tree, ! Backward_Compatibility => False); ! end if; ! end if; ! end Add_Default_GNAT_Naming_Scheme; end Prj.Conf; --- 1380,1394 ---- end if; end Runtime_Name_For; ! --------------------- ! -- Set_Runtime_For -- ! --------------------- + procedure Set_Runtime_For (Language : Name_Id; RTS_Name : String) is begin ! Name_Len := RTS_Name'Length; ! Name_Buffer (1 .. Name_Len) := RTS_Name; ! RTS_Languages.Set (Language, Name_Find); ! end Set_Runtime_For; end Prj.Conf; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-conf.ads gcc-4.6.0/gcc/ada/prj-conf.ads *** gcc-4.5.2/gcc/ada/prj-conf.ads Thu Sep 17 10:38:31 2009 --- gcc-4.6.0/gcc/ada/prj-conf.ads Mon Dec 20 07:26:57 2010 *************** package Prj.Conf is *** 64,70 **** -- set). -- -- If the processing fails, Main_Project is set to No_Project. If the error ! -- happend while parsing the project itself (ie creating the tree), -- User_Project_Node is also set to Empty_Node. -- -- Autoconf_Specified indicates whether the user has specified --autoconf. --- 64,70 ---- -- set). -- -- If the processing fails, Main_Project is set to No_Project. If the error ! -- happened while parsing the project itself (i.e. creating the tree), -- User_Project_Node is also set to Empty_Node. -- -- Autoconf_Specified indicates whether the user has specified --autoconf. *************** package Prj.Conf is *** 151,157 **** -- by the user (either through gprbuild's --config or --autoconf switches). -- In the latter case, Autoconf_Specified should be set to true to indicate -- that the configuration file can be regenerated to match target and ! -- languages. This name can either be an absolute path, or the a base name -- that will be searched in the default config file directories (which -- depends on the installation path for the tools). -- --- 151,157 ---- -- by the user (either through gprbuild's --config or --autoconf switches). -- In the latter case, Autoconf_Specified should be set to true to indicate -- that the configuration file can be regenerated to match target and ! -- languages. This name can either be an absolute path, or the base name -- that will be searched in the default config file directories (which -- depends on the installation path for the tools). -- diff -Nrcpad gcc-4.5.2/gcc/ada/prj-dect.adb gcc-4.6.0/gcc/ada/prj-dect.adb *** gcc-4.5.2/gcc/ada/prj-dect.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/prj-dect.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body Prj.Dect is *** 48,53 **** --- 48,78 ---- -- a case construction (In_Case_Construction) or none of those two -- (In_Project). + procedure Rename_Obsolescent_Attributes + (In_Tree : Project_Node_Tree_Ref; + Attribute : Project_Node_Id; + Current_Package : Project_Node_Id); + -- Rename obsolescent attributes in the tree. + -- When the attribute has been renamed since its initial introduction in + -- the design of projects, we replace the old name in the tree with the + -- new name, so that the code does not have to check both names forever. + + procedure Check_Attribute_Allowed + (In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id; + Attribute : Project_Node_Id; + Flags : Processing_Flags); + -- Check whether the attribute is valid in this project. + -- In particular, depending on the type of project (qualifier), some + -- attributes might be disabled. + + procedure Check_Package_Allowed + (In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id; + Current_Package : Project_Node_Id; + Flags : Processing_Flags); + -- Check whether the package is valid in this project + procedure Parse_Attribute_Declaration (In_Tree : Project_Node_Tree_Ref; Attribute : out Project_Node_Id; *************** package body Prj.Dect is *** 147,152 **** --- 172,284 ---- (Declarations, In_Tree, To => First_Declarative_Item); end Parse; + ----------------------------------- + -- Rename_Obsolescent_Attributes -- + ----------------------------------- + + procedure Rename_Obsolescent_Attributes + (In_Tree : Project_Node_Tree_Ref; + Attribute : Project_Node_Id; + Current_Package : Project_Node_Id) + is + begin + if Present (Current_Package) + and then Expression_Kind_Of (Current_Package, In_Tree) /= Ignored + then + case Name_Of (Attribute, In_Tree) is + when Snames.Name_Specification => + Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec); + + when Snames.Name_Specification_Suffix => + Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec_Suffix); + + when Snames.Name_Implementation => + Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body); + + when Snames.Name_Implementation_Suffix => + Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body_Suffix); + + when others => + null; + end case; + end if; + end Rename_Obsolescent_Attributes; + + --------------------------- + -- Check_Package_Allowed -- + --------------------------- + + procedure Check_Package_Allowed + (In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id; + Current_Package : Project_Node_Id; + Flags : Processing_Flags) + is + Qualif : constant Project_Qualifier := + Project_Qualifier_Of (Project, In_Tree); + Name : constant Name_Id := Name_Of (Current_Package, In_Tree); + begin + if Qualif = Aggregate + and then Name /= Snames.Name_Builder + then + Error_Msg_Name_1 := Name; + Error_Msg + (Flags, + "package %% is forbidden in aggregate projects", + Location_Of (Current_Package, In_Tree)); + end if; + end Check_Package_Allowed; + + ----------------------------- + -- Check_Attribute_Allowed -- + ----------------------------- + + procedure Check_Attribute_Allowed + (In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id; + Attribute : Project_Node_Id; + Flags : Processing_Flags) + is + Qualif : constant Project_Qualifier := + Project_Qualifier_Of (Project, In_Tree); + Name : constant Name_Id := Name_Of (Attribute, In_Tree); + + begin + case Qualif is + when Aggregate => + if Name = Snames.Name_Languages + or else Name = Snames.Name_Source_Files + or else Name = Snames.Name_Source_List_File + or else Name = Snames.Name_Locally_Removed_Files + or else Name = Snames.Name_Excluded_Source_Files + or else Name = Snames.Name_Excluded_Source_List_File + or else Name = Snames.Name_Interfaces + or else Name = Snames.Name_Object_Dir + or else Name = Snames.Name_Exec_Dir + or else Name = Snames.Name_Source_Dirs + or else Name = Snames.Name_Inherit_Source_Path + then + Error_Msg_Name_1 := Name; + Error_Msg + (Flags, + "%% is not valid in aggregate projects", + Location_Of (Attribute, In_Tree)); + end if; + + when others => + if Name = Snames.Name_Project_Files + or else Name = Snames.Name_Project_Path + or else Name = Snames.Name_External + then + Error_Msg_Name_1 := Name; + Error_Msg + (Flags, + "%% is only valid in aggregate projects", + Location_Of (Attribute, In_Tree)); + end if; + end case; + end Check_Attribute_Allowed; + --------------------------------- -- Parse_Attribute_Declaration -- --------------------------------- *************** package body Prj.Dect is *** 165,201 **** Attribute_Name : Name_Id := No_Name; Optional_Index : Boolean := False; Pkg_Id : Package_Node_Id := Empty_Package; - Ignore : Boolean := False; ! begin ! Attribute := ! Default_Project_Node ! (Of_Kind => N_Attribute_Declaration, In_Tree => In_Tree); ! Set_Location_Of (Attribute, In_Tree, To => Token_Ptr); ! Set_Previous_Line_Node (Attribute); ! ! -- Scan past "for" ! ! Scan (In_Tree); ! -- Body may be an attribute name ! if Token = Tok_Body then ! Token := Tok_Identifier; ! Token_Name := Snames.Name_Body; ! end if; ! Expect (Tok_Identifier, "identifier"); ! if Token = Tok_Identifier then Attribute_Name := Token_Name; ! Set_Name_Of (Attribute, In_Tree, To => Token_Name); Set_Location_Of (Attribute, In_Tree, To => Token_Ptr); -- Find the attribute Current_Attribute := ! Attribute_Node_Id_Of (Token_Name, First_Attribute); -- If the attribute cannot be found, create the attribute if inside -- an unknown package. --- 297,325 ---- Attribute_Name : Name_Id := No_Name; Optional_Index : Boolean := False; Pkg_Id : Package_Node_Id := Empty_Package; ! procedure Process_Attribute_Name; ! -- Read the name of the attribute, and check its type ! procedure Process_Associative_Array_Index; ! -- Read the index of the associative array and check its validity ! ---------------------------- ! -- Process_Attribute_Name -- ! ---------------------------- ! procedure Process_Attribute_Name is ! Ignore : Boolean; ! begin Attribute_Name := Token_Name; ! Set_Name_Of (Attribute, In_Tree, To => Attribute_Name); Set_Location_Of (Attribute, In_Tree, To => Token_Ptr); -- Find the attribute Current_Attribute := ! Attribute_Node_Id_Of (Attribute_Name, First_Attribute); -- If the attribute cannot be found, create the attribute if inside -- an unknown package. *************** package body Prj.Dect is *** 247,289 **** end if; if Attribute_Kind_Of (Current_Attribute) in ! Case_Insensitive_Associative_Array .. ! Optional_Index_Case_Insensitive_Associative_Array then Set_Case_Insensitive (Attribute, In_Tree, To => True); end if; end if; Scan (In_Tree); -- past the attribute name - end if; - - -- Change obsolete names of attributes to the new names ! if Present (Current_Package) ! and then Expression_Kind_Of (Current_Package, In_Tree) /= Ignored ! then ! case Name_Of (Attribute, In_Tree) is ! when Snames.Name_Specification => ! Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec); ! ! when Snames.Name_Specification_Suffix => ! Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec_Suffix); ! ! when Snames.Name_Implementation => ! Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body); ! ! when Snames.Name_Implementation_Suffix => ! Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body_Suffix); ! ! when others => ! null; ! end case; ! end if; ! -- Associative array attributes ! if Token = Tok_Left_Paren then -- If the attribute is not an associative array attribute, report -- an error. If this information is still unknown, set the kind -- to Associative_Array. --- 371,399 ---- end if; if Attribute_Kind_Of (Current_Attribute) in ! All_Case_Insensitive_Associative_Array then Set_Case_Insensitive (Attribute, In_Tree, To => True); end if; end if; Scan (In_Tree); -- past the attribute name ! -- Set the expression kind of the attribute ! if Current_Attribute /= Empty_Attribute then ! Set_Expression_Kind_Of ! (Attribute, In_Tree, To => Variable_Kind_Of (Current_Attribute)); ! Optional_Index := Optional_Index_Of (Current_Attribute); ! end if; ! end Process_Attribute_Name; ! ------------------------------------- ! -- Process_Associative_Array_Index -- ! ------------------------------------- + procedure Process_Associative_Array_Index is + begin -- If the attribute is not an associative array attribute, report -- an error. If this information is still unknown, set the kind -- to Associative_Array. *************** package body Prj.Dect is *** 293,301 **** then Error_Msg (Flags, "the attribute """ & ! Get_Name_String ! (Attribute_Name_Of (Current_Attribute)) & ! """ cannot be an associative array", Location_Of (Attribute, In_Tree)); elsif Attribute_Kind_Of (Current_Attribute) = Unknown then --- 403,410 ---- then Error_Msg (Flags, "the attribute """ & ! Get_Name_String (Attribute_Name_Of (Current_Attribute)) ! & """ cannot be an associative array", Location_Of (Attribute, In_Tree)); elsif Attribute_Kind_Of (Current_Attribute) = Unknown then *************** package body Prj.Dect is *** 372,377 **** --- 481,515 ---- if Token = Tok_Right_Paren then Scan (In_Tree); -- past the right parenthesis end if; + end Process_Associative_Array_Index; + + begin + Attribute := + Default_Project_Node + (Of_Kind => N_Attribute_Declaration, In_Tree => In_Tree); + Set_Location_Of (Attribute, In_Tree, To => Token_Ptr); + Set_Previous_Line_Node (Attribute); + + -- Scan past "for" + + Scan (In_Tree); + + -- Body may be an attribute name + + if Token = Tok_Body then + Token := Tok_Identifier; + Token_Name := Snames.Name_Body; + end if; + + Expect (Tok_Identifier, "identifier"); + Process_Attribute_Name; + Rename_Obsolescent_Attributes (In_Tree, Attribute, Current_Package); + Check_Attribute_Allowed (In_Tree, Current_Project, Attribute, Flags); + + -- Associative array attributes + + if Token = Tok_Left_Paren then + Process_Associative_Array_Index; else -- If it is an associative array attribute and there are no left *************** package body Prj.Dect is *** 391,404 **** end if; end if; - -- Set the expression kind of the attribute - - if Current_Attribute /= Empty_Attribute then - Set_Expression_Kind_Of - (Attribute, In_Tree, To => Variable_Kind_Of (Current_Attribute)); - Optional_Index := Optional_Index_Of (Current_Attribute); - end if; - Expect (Tok_Use, "USE"); if Token = Tok_Use then --- 529,534 ---- *************** package body Prj.Dect is *** 1028,1035 **** First_Attribute : Attribute_Node_Id := Empty_Attribute; Current_Package : Package_Node_Id := Empty_Package; First_Declarative_Item : Project_Node_Id := Empty_Node; - Package_Location : constant Source_Ptr := Token_Ptr; begin Package_Declaration := --- 1158,1166 ---- First_Attribute : Attribute_Node_Id := Empty_Attribute; Current_Package : Package_Node_Id := Empty_Package; First_Declarative_Item : Project_Node_Id := Empty_Node; Package_Location : constant Source_Ptr := Token_Ptr; + Renaming : Boolean := False; + Extending : Boolean := False; begin Package_Declaration := *************** package body Prj.Dect is *** 1149,1162 **** Scan (In_Tree); end if; if Token = Tok_Renames then if Is_Config_File then Error_Msg (Flags, ! "no package renames in configuration projects", Token_Ptr); end if; ! -- Scan past "renames" Scan (In_Tree); --- 1280,1303 ---- Scan (In_Tree); end if; + Check_Package_Allowed + (In_Tree, Current_Project, Package_Declaration, Flags); + if Token = Tok_Renames then + Renaming := True; + elsif Token = Tok_Extends then + Extending := True; + end if; + + if Renaming or else Extending then if Is_Config_File then Error_Msg (Flags, ! "no package rename or extension in configuration projects", ! Token_Ptr); end if; ! -- Scan past "renames" or "extends" Scan (In_Tree); *************** package body Prj.Dect is *** 1250,1256 **** --- 1391,1399 ---- end if; end if; end if; + end if; + if Renaming then Expect (Tok_Semicolon, "`;`"); Set_End_Of_Line (Package_Declaration); Set_Previous_Line_Node (Package_Declaration); *************** package body Prj.Dect is *** 1306,1312 **** Remove_Next_End_Node; else ! Error_Msg (Flags, "expected IS or RENAMES", Token_Ptr); end if; end Parse_Package_Declaration; --- 1449,1455 ---- Remove_Next_End_Node; else ! Error_Msg (Flags, "expected IS", Token_Ptr); end if; end Parse_Package_Declaration; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-env.adb gcc-4.6.0/gcc/ada/prj-env.adb *** gcc-4.5.2/gcc/ada/prj-env.adb Mon Nov 30 14:24:04 2009 --- gcc-4.6.0/gcc/ada/prj-env.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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,40 **** --- 24,53 ---- ------------------------------------------------------------------------------ with Fmap; + with Hostparm; + with Makeutl; use Makeutl; with Opt; with Osint; use Osint; with Output; use Output; with Prj.Com; use Prj.Com; + with Sdefault; with Tempdir; + with GNAT.Directory_Operations; use GNAT.Directory_Operations; + package body Prj.Env is Buffer_Initial : constant := 1_000; -- Initial size of Buffer + Uninitialized_Prefix : constant String := '#' & Path_Separator; + -- Prefix to indicate that the project path has not been initialized yet. + -- Must be two characters long + + No_Project_Default_Dir : constant String := "-"; + -- Indicator in the project path to indicate that the default search + -- directories should not be added to the path + ----------------------- -- Local Subprograms -- ----------------------- *************** package body Prj.Env is *** 97,102 **** --- 110,121 ---- -- Return a project that is either Project or an extended ancestor of -- Project that itself is not extended. + procedure Initialize_Project_Path + (Self : in out Project_Search_Path; + Target_Name : String); + -- Initialize Current_Project_Path. Does nothing if the path has already + -- been initialized properly. + ---------------------- -- Ada_Include_Path -- ---------------------- *************** package body Prj.Env is *** 459,465 **** procedure Put (S : String); procedure Put_Line (S : String); -- Output procedures, analogous to normal Text_IO procs of same name. ! -- The text is put in Buffer, then it will be writen into a temporary -- file with procedure Write_Temp_File below. procedure Write_Temp_File; --- 478,484 ---- procedure Put (S : String); procedure Put_Line (S : String); -- Output procedures, analogous to normal Text_IO procs of same name. ! -- The text is put in Buffer, then it will be written into a temporary -- file with procedure Write_Temp_File below. procedure Write_Temp_File; *************** package body Prj.Env is *** 728,734 **** Fmap.Add_To_File_Map (Unit_Name => Unit_Name_Type (Data.Unit.Name), File_Name => Data.File, ! Path_Name => File_Name_Type (Data.Path.Name)); end if; end if; --- 747,753 ---- Fmap.Add_To_File_Map (Unit_Name => Unit_Name_Type (Data.Unit.Name), File_Name => Data.File, ! Path_Name => File_Name_Type (Data.Path.Display_Name)); end if; end if; *************** package body Prj.Env is *** 831,844 **** Put_Name_Buffer; end if; ! Get_Name_String (Source.File); Put_Name_Buffer; if Source.Locally_Removed then Name_Len := 1; Name_Buffer (1) := '/'; else ! Get_Name_String (Source.Path.Name); end if; Put_Name_Buffer; --- 850,863 ---- Put_Name_Buffer; end if; ! Get_Name_String (Source.Display_File); Put_Name_Buffer; if Source.Locally_Removed then Name_Len := 1; Name_Buffer (1) := '/'; else ! Get_Name_String (Source.Path.Display_Name); end if; Put_Name_Buffer; *************** package body Prj.Env is *** 1498,1504 **** procedure Set_Ada_Paths (Project : Project_Id; In_Tree : Project_Tree_Ref; ! Including_Libraries : Boolean) is Source_Paths : Source_Path_Table.Instance; --- 1517,1525 ---- procedure Set_Ada_Paths (Project : Project_Id; In_Tree : Project_Tree_Ref; ! Including_Libraries : Boolean; ! Include_Path : Boolean := True; ! Objects_Path : Boolean := True) is Source_Paths : Source_Path_Table.Instance; *************** package body Prj.Env is *** 1570,1576 **** -- If it is the first time we call this procedure for this project, -- compute the source path and/or the object path. ! if Project.Include_Path_File = No_Path then Source_Path_Table.Init (Source_Paths); Process_Source_Dirs := True; Create_New_Path_File --- 1591,1597 ---- -- If it is the first time we call this procedure for this project, -- compute the source path and/or the object path. ! if Include_Path and then Project.Include_Path_File = No_Path then Source_Path_Table.Init (Source_Paths); Process_Source_Dirs := True; Create_New_Path_File *************** package body Prj.Env is *** 1580,1586 **** -- For the object path, we make a distinction depending on -- Including_Libraries. ! if Including_Libraries then if Project.Objects_Path_File_With_Libs = No_Path then Object_Path_Table.Init (Object_Paths); Process_Object_Dirs := True; --- 1601,1607 ---- -- For the object path, we make a distinction depending on -- Including_Libraries. ! if Objects_Path and Including_Libraries then if Project.Objects_Path_File_With_Libs = No_Path then Object_Path_Table.Init (Object_Paths); Process_Object_Dirs := True; *************** package body Prj.Env is *** 1588,1594 **** (In_Tree, Object_FD, Project.Objects_Path_File_With_Libs); end if; ! else if Project.Objects_Path_File_Without_Libs = No_Path then Object_Path_Table.Init (Object_Paths); Process_Object_Dirs := True; --- 1609,1615 ---- (In_Tree, Object_FD, Project.Objects_Path_File_With_Libs); end if; ! elsif Objects_Path then if Project.Objects_Path_File_Without_Libs = No_Path then Object_Path_Table.Init (Object_Paths); Process_Object_Dirs := True; *************** package body Prj.Env is *** 1662,1668 **** -- Set the env vars, if they need to be changed, and set the -- corresponding flags. ! if In_Tree.Private_Part.Current_Source_Path_File /= Project.Include_Path_File then In_Tree.Private_Part.Current_Source_Path_File := --- 1683,1690 ---- -- Set the env vars, if they need to be changed, and set the -- corresponding flags. ! if Include_Path and then ! In_Tree.Private_Part.Current_Source_Path_File /= Project.Include_Path_File then In_Tree.Private_Part.Current_Source_Path_File := *************** package body Prj.Env is *** 1672,1699 **** Get_Name_String (In_Tree.Private_Part.Current_Source_Path_File)); end if; ! if Including_Libraries then ! if In_Tree.Private_Part.Current_Object_Path_File /= ! Project.Objects_Path_File_With_Libs ! then ! In_Tree.Private_Part.Current_Object_Path_File := ! Project.Objects_Path_File_With_Libs; ! Set_Path_File_Var ! (Project_Objects_Path_File, ! Get_Name_String ! (In_Tree.Private_Part.Current_Object_Path_File)); ! end if; ! else ! if In_Tree.Private_Part.Current_Object_Path_File /= ! Project.Objects_Path_File_Without_Libs ! then ! In_Tree.Private_Part.Current_Object_Path_File := ! Project.Objects_Path_File_Without_Libs; ! Set_Path_File_Var ! (Project_Objects_Path_File, ! Get_Name_String ! (In_Tree.Private_Part.Current_Object_Path_File)); end if; end if; --- 1694,1723 ---- Get_Name_String (In_Tree.Private_Part.Current_Source_Path_File)); end if; ! if Objects_Path then ! if Including_Libraries then ! if In_Tree.Private_Part.Current_Object_Path_File /= ! Project.Objects_Path_File_With_Libs ! then ! In_Tree.Private_Part.Current_Object_Path_File := ! Project.Objects_Path_File_With_Libs; ! Set_Path_File_Var ! (Project_Objects_Path_File, ! Get_Name_String ! (In_Tree.Private_Part.Current_Object_Path_File)); ! end if; ! else ! if In_Tree.Private_Part.Current_Object_Path_File /= ! Project.Objects_Path_File_Without_Libs ! then ! In_Tree.Private_Part.Current_Object_Path_File := ! Project.Objects_Path_File_Without_Libs; ! Set_Path_File_Var ! (Project_Objects_Path_File, ! Get_Name_String ! (In_Tree.Private_Part.Current_Object_Path_File)); ! end if; end if; end if; *************** package body Prj.Env is *** 1734,1737 **** --- 1758,2189 ---- return Result; end Ultimate_Extension_Of; + --------------------- + -- Add_Directories -- + --------------------- + + procedure Add_Directories + (Self : in out Project_Search_Path; + Path : String) + is + Tmp : String_Access; + begin + if Self.Path = null then + Self.Path := new String'(Uninitialized_Prefix & Path); + else + Tmp := Self.Path; + Self.Path := new String'(Tmp.all & Path_Separator & Path); + Free (Tmp); + end if; + end Add_Directories; + + ----------------------------- + -- Initialize_Project_Path -- + ----------------------------- + + procedure Initialize_Project_Path + (Self : in out Project_Search_Path; + Target_Name : String) + is + Add_Default_Dir : Boolean := True; + First : Positive; + Last : Positive; + New_Len : Positive; + New_Last : Positive; + + Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; + Gpr_Project_Path : constant String := "GPR_PROJECT_PATH"; + -- Name of alternate env. variable that contain path name(s) of + -- directories where project files may reside. GPR_PROJECT_PATH has + -- precedence over ADA_PROJECT_PATH. + + Gpr_Prj_Path : String_Access; + Ada_Prj_Path : String_Access; + -- The path name(s) of directories where project files may reside. + -- May be empty. + + begin + -- If already initialized, nothing else to do + + if Self.Path /= null + and then Self.Path (Self.Path'First) /= '#' + then + return; + end if; + + -- The current directory is always first in the search path. Since the + -- Project_Path currently starts with '#:' as a sign that it isn't + -- initialized, we simply replace '#' with '.' + + if Self.Path = null then + Self.Path := new String'('.' & Path_Separator); + else + Self.Path (Self.Path'First) := '.'; + end if; + + -- Then the reset of the project path (if any) currently contains the + -- directories added through Add_Search_Project_Directory + + -- If environment variables are defined and not empty, add their content + + Gpr_Prj_Path := Getenv (Gpr_Project_Path); + Ada_Prj_Path := Getenv (Ada_Project_Path); + + if Gpr_Prj_Path.all /= "" then + Add_Directories (Self, Gpr_Prj_Path.all); + end if; + + Free (Gpr_Prj_Path); + + if Ada_Prj_Path.all /= "" then + Add_Directories (Self, Ada_Prj_Path.all); + end if; + + Free (Ada_Prj_Path); + + -- Copy to Name_Buffer, since we will need to manipulate the path + + Name_Len := Self.Path'Length; + Name_Buffer (1 .. Name_Len) := Self.Path.all; + + -- Scan the directory path to see if "-" is one of the directories. + -- Remove each occurrence of "-" and set Add_Default_Dir to False. + -- Also resolve relative paths and symbolic links. + + First := 3; + loop + while First <= Name_Len + and then (Name_Buffer (First) = Path_Separator) + loop + First := First + 1; + end loop; + + exit when First > Name_Len; + + Last := First; + + while Last < Name_Len + and then Name_Buffer (Last + 1) /= Path_Separator + loop + Last := Last + 1; + end loop; + + -- If the directory is "-", set Add_Default_Dir to False and + -- remove from path. + + if Name_Buffer (First .. Last) = No_Project_Default_Dir then + Add_Default_Dir := False; + + for J in Last + 1 .. Name_Len loop + Name_Buffer (J - No_Project_Default_Dir'Length - 1) := + Name_Buffer (J); + end loop; + + Name_Len := Name_Len - No_Project_Default_Dir'Length - 1; + + -- After removing the '-', go back one character to get the next + -- directory correctly. + + Last := Last - 1; + + elsif not Hostparm.OpenVMS + or else not Is_Absolute_Path (Name_Buffer (First .. Last)) + then + -- On VMS, only expand relative path names, as absolute paths + -- may correspond to multi-valued VMS logical names. + + declare + New_Dir : constant String := + Normalize_Pathname + (Name_Buffer (First .. Last), + Resolve_Links => Opt.Follow_Links_For_Dirs); + + begin + -- If the absolute path was resolved and is different from + -- the original, replace original with the resolved path. + + if New_Dir /= Name_Buffer (First .. Last) + and then New_Dir'Length /= 0 + then + New_Len := Name_Len + New_Dir'Length - (Last - First + 1); + New_Last := First + New_Dir'Length - 1; + Name_Buffer (New_Last + 1 .. New_Len) := + Name_Buffer (Last + 1 .. Name_Len); + Name_Buffer (First .. New_Last) := New_Dir; + Name_Len := New_Len; + Last := New_Last; + end if; + end; + end if; + + First := Last + 1; + end loop; + + Free (Self.Path); + + -- Set the initial value of Current_Project_Path + + if Add_Default_Dir then + declare + Prefix : String_Ptr := Sdefault.Search_Dir_Prefix; + + begin + if Prefix = null then + Prefix := new String'(Executable_Prefix_Path); + + if Prefix.all /= "" then + if Target_Name /= "" then + Add_Str_To_Name_Buffer + (Path_Separator & Prefix.all & + "lib" & Directory_Separator & "gpr" & + Directory_Separator & Target_Name); + end if; + + Add_Str_To_Name_Buffer + (Path_Separator & Prefix.all & + "share" & Directory_Separator & "gpr"); + Add_Str_To_Name_Buffer + (Path_Separator & Prefix.all & + "lib" & Directory_Separator & "gnat"); + end if; + + else + Self.Path := + new String'(Name_Buffer (1 .. Name_Len) & Path_Separator & + Prefix.all & + ".." & Directory_Separator & + ".." & Directory_Separator & + ".." & Directory_Separator & "gnat"); + end if; + + Free (Prefix); + end; + end if; + + if Self.Path = null then + Self.Path := new String'(Name_Buffer (1 .. Name_Len)); + end if; + end Initialize_Project_Path; + + -------------- + -- Get_Path -- + -------------- + + procedure Get_Path + (Self : in out Project_Search_Path; + Path : out String_Access) + is + begin + Initialize_Project_Path (Self, ""); -- ??? Target_Name unspecified + Path := Self.Path; + end Get_Path; + + -------------- + -- Set_Path -- + -------------- + + procedure Set_Path + (Self : in out Project_Search_Path; Path : String) is + begin + Free (Self.Path); + Self.Path := new String'(Path); + Projects_Paths.Reset (Self.Cache); + end Set_Path; + + ------------------ + -- Find_Project -- + ------------------ + + procedure Find_Project + (Self : in out Project_Search_Path; + Project_File_Name : String; + Directory : String; + Path : out Namet.Path_Name_Type) + is + File : constant String := Project_File_Name; + -- Have to do a copy, in case the parameter is Name_Buffer, which we + -- modify below + + function Try_Path_Name (Path : String) return String_Access; + pragma Inline (Try_Path_Name); + -- Try the specified Path + + ------------------- + -- Try_Path_Name -- + ------------------- + + function Try_Path_Name (Path : String) return String_Access is + First : Natural; + Last : Natural; + Result : String_Access := null; + + begin + if Current_Verbosity = High then + Write_Str (" Trying "); + Write_Line (Path); + end if; + + if Is_Absolute_Path (Path) then + if Is_Regular_File (Path) then + Result := new String'(Path); + end if; + + else + -- Because we don't want to resolve symbolic links, we cannot use + -- Locate_Regular_File. So, we try each possible path + -- successively. + + First := Self.Path'First; + while First <= Self.Path'Last loop + while First <= Self.Path'Last + and then Self.Path (First) = Path_Separator + loop + First := First + 1; + end loop; + + exit when First > Self.Path'Last; + + Last := First; + while Last < Self.Path'Last + and then Self.Path (Last + 1) /= Path_Separator + loop + Last := Last + 1; + end loop; + + Name_Len := 0; + + if not Is_Absolute_Path (Self.Path (First .. Last)) then + Add_Str_To_Name_Buffer (Get_Current_Dir); -- ??? System call + Add_Char_To_Name_Buffer (Directory_Separator); + end if; + + Add_Str_To_Name_Buffer (Self.Path (First .. Last)); + Add_Char_To_Name_Buffer (Directory_Separator); + Add_Str_To_Name_Buffer (Path); + + if Current_Verbosity = High then + Write_Str (" Testing file "); + Write_Line (Name_Buffer (1 .. Name_Len)); + end if; + + if Is_Regular_File (Name_Buffer (1 .. Name_Len)) then + Result := new String'(Name_Buffer (1 .. Name_Len)); + exit; + end if; + + First := Last + 1; + end loop; + end if; + + return Result; + end Try_Path_Name; + + -- Local Declarations + + Result : String_Access; + Has_Dot : Boolean := False; + Key : Name_Id; + + -- Start of processing for Find_Project + + begin + Initialize_Project_Path (Self, ""); + + if Current_Verbosity = High then + Write_Str ("Searching for project ("""); + Write_Str (File); + Write_Str (""", """); + Write_Str (Directory); + Write_Line (""");"); + end if; + + -- Check the project cache + + Name_Len := File'Length; + Name_Buffer (1 .. Name_Len) := File; + Key := Name_Find; + Path := Projects_Paths.Get (Self.Cache, Key); + + if Path /= No_Path then + return; + end if; + + -- Check if File contains an extension (a dot before a + -- directory separator). If it is the case we do not try project file + -- with an added extension as it is not possible to have multiple dots + -- on a project file name. + + Check_Dot : for K in reverse File'Range loop + if File (K) = '.' then + Has_Dot := True; + exit Check_Dot; + end if; + + exit Check_Dot when File (K) = Directory_Separator + or else File (K) = '/'; + end loop Check_Dot; + + if not Is_Absolute_Path (File) then + + -- First we try /. + + if not Has_Dot then + Result := Try_Path_Name + (Directory & Directory_Separator & + File & Project_File_Extension); + end if; + + -- Then we try / + + if Result = null then + Result := Try_Path_Name (Directory & Directory_Separator & File); + end if; + end if; + + -- Then we try . + + if Result = null and then not Has_Dot then + Result := Try_Path_Name (File & Project_File_Extension); + end if; + + -- Then we try + + if Result = null then + Result := Try_Path_Name (File); + end if; + + -- If we cannot find the project file, we return an empty string + + if Result = null then + Path := Namet.No_Path; + return; + + else + declare + Final_Result : constant String := + GNAT.OS_Lib.Normalize_Pathname + (Result.all, + Directory => Directory, + Resolve_Links => Opt.Follow_Links_For_Files, + Case_Sensitive => True); + begin + Free (Result); + Name_Len := Final_Result'Length; + Name_Buffer (1 .. Name_Len) := Final_Result; + Path := Name_Find; + Projects_Paths.Set (Self.Cache, Key, Path); + end; + end if; + end Find_Project; + + ---------- + -- Free -- + ---------- + + procedure Free (Self : in out Project_Search_Path) is + begin + Free (Self.Path); + Projects_Paths.Reset (Self.Cache); + end Free; + end Prj.Env; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-env.ads gcc-4.6.0/gcc/ada/prj-env.ads *** gcc-4.5.2/gcc/ada/prj-env.ads Thu Sep 17 10:54:01 2009 --- gcc-4.6.0/gcc/ada/prj-env.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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,31 **** --- 26,34 ---- -- This package implements services for Project-aware tools, mostly related -- to the environment (configuration pragma files, path files, mapping files). + with GNAT.Dynamic_HTables; + with GNAT.OS_Lib; + package Prj.Env is procedure Initialize (In_Tree : Project_Tree_Ref); *************** package Prj.Env is *** 94,100 **** procedure Set_Ada_Paths (Project : Project_Id; In_Tree : Project_Tree_Ref; ! Including_Libraries : Boolean); -- Set the environment variables for additional project path files, after -- creating the path files if necessary. --- 97,105 ---- procedure Set_Ada_Paths (Project : Project_Id; In_Tree : Project_Tree_Ref; ! Including_Libraries : Boolean; ! Include_Path : Boolean := True; ! Objects_Path : Boolean := True); -- Set the environment variables for additional project path files, after -- creating the path files if necessary. *************** package Prj.Env is *** 140,148 **** (Project : Project_Id; In_Tree : Project_Tree_Ref); -- Iterate through all the source directories of a project, including those ! -- of imported or modified projects. ! -- Only returns those directories that potentially contain Ada sources (ie ! -- ignore projects that have no Ada sources generic with procedure Action (Path : String); --- 145,153 ---- (Project : Project_Id; In_Tree : Project_Tree_Ref); -- Iterate through all the source directories of a project, including those ! -- of imported or modified projects. Only returns those directories that ! -- potentially contain Ada sources (ie ignore projects that have no Ada ! -- sources generic with procedure Action (Path : String); *************** package Prj.Env is *** 150,153 **** --- 155,227 ---- -- Iterate through all the object directories of a project, including -- those of imported or modified projects. + ------------------ + -- Project Path -- + ------------------ + + type Project_Search_Path is private; + -- An abstraction of the project path. This object provides subprograms to + -- search for projects on the path (and caches the results for more + -- efficiency). + + procedure Free (Self : in out Project_Search_Path); + -- Free the memory used by Self + + procedure Add_Directories + (Self : in out Project_Search_Path; + Path : String); + -- Add one or more directories to the path. Directories added with this + -- procedure are added in order after the current directory and before the + -- path given by the environment variable GPR_PROJECT_PATH. A value of "-" + -- will remove the default project directory from the project path. + -- + -- Calls to this subprogram must be performed before the first call to + -- Find_Project below, or PATH will be added at the end of the search + -- path. + + procedure Get_Path + (Self : in out Project_Search_Path; + Path : out String_Access); + -- Return the current value of the project path, either the value set + -- during elaboration of the package or, if procedure Set_Project_Path has + -- been called, the value set by the last call to Set_Project_Path. + -- The returned value must not be modified. + + procedure Set_Path + (Self : in out Project_Search_Path; Path : String); + -- Override the value of the project path. + -- This also removes the implicit default search directories + + procedure Find_Project + (Self : in out Project_Search_Path; + Project_File_Name : String; + Directory : String; + Path : out Namet.Path_Name_Type); + -- Search for a project with the given name either in Directory (which + -- often will be the directory contain the project we are currently parsing + -- and which we found a reference to another project), or in the project + -- path. Extra_Project_Path contains additional directories to search. + -- + -- Project_File_Name can optionally contain directories, and the extension + -- (.gpr) for the file name is optional. + -- + -- Returns No_Name if no such project was found + + private + package Projects_Paths is new GNAT.Dynamic_HTables.Simple_HTable + (Header_Num => Header_Num, + Element => Path_Name_Type, + No_Element => No_Path, + Key => Name_Id, + Hash => Hash, + Equal => "="); + + type Project_Search_Path is record + Path : GNAT.OS_Lib.String_Access; + -- As a special case, if the first character is '#:" or this variable is + -- unset, this means that the PATH has not been fully initialized yet + -- (although subprograms above will properly take care of that). + + Cache : Projects_Paths.Instance; + end record; end Prj.Env; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-err.adb gcc-4.6.0/gcc/ada/prj-err.adb *** gcc-4.5.2/gcc/ada/prj-err.adb Tue Oct 27 13:51:46 2009 --- gcc-4.6.0/gcc/ada/prj-err.adb Tue Oct 5 09:29:14 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** with Stringt; use Stringt; *** 29,44 **** package body Prj.Err is - ----------------------- - -- Obsolescent_Check -- - ----------------------- - - procedure Obsolescent_Check (S : Source_Ptr) is - pragma Warnings (Off, S); - begin - null; - end Obsolescent_Check; - --------------- -- Post_Scan -- --------------- --- 29,34 ---- *************** package body Prj.Err is *** 105,110 **** --- 95,104 ---- -- so we shouldn't report errors for projects that the user has no -- access to in any case. + if Current_Verbosity = High then + Write_Line ("Error in in-memory project, ignored"); + end if; + return; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-err.ads gcc-4.6.0/gcc/ada/prj-err.ads *** gcc-4.5.2/gcc/ada/prj-err.ads Mon Jul 13 12:24:23 2009 --- gcc-4.6.0/gcc/ada/prj-err.ads Thu Sep 9 12:31:35 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** package Prj.Err is *** 82,101 **** -- Scanner -- ------------- - procedure Obsolescent_Check (S : Source_Ptr); - -- Dummy null procedure for Scng instantiation - procedure Post_Scan; -- Convert an Ada operator symbol into a standard string package Scanner is new Scng ! (Post_Scan => Post_Scan, ! Error_Msg => Errutil.Error_Msg, ! Error_Msg_S => Errutil.Error_Msg_S, ! Error_Msg_SC => Errutil.Error_Msg_SC, ! Error_Msg_SP => Errutil.Error_Msg_SP, ! Obsolescent_Check => Obsolescent_Check, ! Style => Errutil.Style); -- Instantiation of the generic scanner end Prj.Err; --- 82,97 ---- -- Scanner -- ------------- procedure Post_Scan; -- Convert an Ada operator symbol into a standard string package Scanner is new Scng ! (Post_Scan => Post_Scan, ! Error_Msg => Errutil.Error_Msg, ! Error_Msg_S => Errutil.Error_Msg_S, ! Error_Msg_SC => Errutil.Error_Msg_SC, ! Error_Msg_SP => Errutil.Error_Msg_SP, ! Style => Errutil.Style); -- Instantiation of the generic scanner end Prj.Err; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-ext.adb gcc-4.6.0/gcc/ada/prj-ext.adb *** gcc-4.5.2/gcc/ada/prj-ext.adb Mon Nov 30 09:42:59 2009 --- gcc-4.6.0/gcc/ada/prj-ext.adb Tue Oct 5 10:14:50 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2010, 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,49 **** -- -- ------------------------------------------------------------------------------ ! with System.OS_Lib; use System.OS_Lib; ! with Hostparm; ! with Makeutl; use Makeutl; ! with Opt; ! with Osint; use Osint; ! with Prj.Tree; use Prj.Tree; ! with Sdefault; package body Prj.Ext is - No_Project_Default_Dir : constant String := "-"; - -- Indicator in the project path to indicate that the default search - -- directories should not be added to the path - - Uninitialized_Prefix : constant String := '#' & Path_Separator; - -- Prefix to indicate that the project path has not been initilized yet. - -- Must be two characters long - - procedure Initialize_Project_Path (Tree : Prj.Tree.Project_Node_Tree_Ref); - -- Initialize Current_Project_Path - --------- -- Add -- --------- --- 23,33 ---- -- -- ------------------------------------------------------------------------------ ! with Osint; use Osint; ! with Prj.Tree; use Prj.Tree; package body Prj.Ext is --------- -- Add -- --------- *************** package body Prj.Ext is *** 61,90 **** The_Value := Name_Find; Name_Len := External_Name'Length; Name_Buffer (1 .. Name_Len) := External_Name; ! Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); The_Key := Name_Find; Name_To_Name_HTable.Set (Tree.External_References, The_Key, The_Value); end Add; - ---------------------------------- - -- Add_Search_Project_Directory -- - ---------------------------------- - - procedure Add_Search_Project_Directory - (Tree : Prj.Tree.Project_Node_Tree_Ref; - Path : String) - is - Tmp : String_Access; - begin - if Tree.Project_Path = null then - Tree.Project_Path := new String'(Uninitialized_Prefix & Path); - else - Tmp := Tree.Project_Path; - Tree.Project_Path := new String'(Tmp.all & Path_Separator & Path); - Free (Tmp); - end if; - end Add_Search_Project_Directory; - ----------- -- Check -- ----------- --- 45,55 ---- The_Value := Name_Find; Name_Len := External_Name'Length; Name_Buffer (1 .. Name_Len) := External_Name; ! Canonical_Case_Env_Var_Name (Name_Buffer (1 .. Name_Len)); The_Key := Name_Find; Name_To_Name_HTable.Set (Tree.External_References, The_Key, The_Value); end Add; ----------- -- Check -- ----------- *************** package body Prj.Ext is *** 110,298 **** return False; end Check; - ----------------------------- - -- Initialize_Project_Path -- - ----------------------------- - - procedure Initialize_Project_Path (Tree : Prj.Tree.Project_Node_Tree_Ref) is - Add_Default_Dir : Boolean := True; - First : Positive; - Last : Positive; - New_Len : Positive; - New_Last : Positive; - - Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; - Gpr_Project_Path : constant String := "GPR_PROJECT_PATH"; - -- Name of alternate env. variable that contain path name(s) of - -- directories where project files may reside. GPR_PROJECT_PATH has - -- precedence over ADA_PROJECT_PATH. - - Gpr_Prj_Path : String_Access := Getenv (Gpr_Project_Path); - Ada_Prj_Path : String_Access := Getenv (Ada_Project_Path); - -- The path name(s) of directories where project files may reside. - -- May be empty. - - begin - -- The current directory is always first in the search path. Since the - -- Project_Path currently starts with '#:' as a sign that it isn't - -- initialized, we simply replace '#' with '.' - - if Tree.Project_Path = null then - Tree.Project_Path := new String'('.' & Path_Separator); - else - Tree.Project_Path (Tree.Project_Path'First) := '.'; - end if; - - -- Then the reset of the project path (if any) currently contains the - -- directories added through Add_Search_Project_Directory - - -- If environment variables are defined and not empty, add their content - - if Gpr_Prj_Path.all /= "" then - Add_Search_Project_Directory (Tree, Gpr_Prj_Path.all); - end if; - - Free (Gpr_Prj_Path); - - if Ada_Prj_Path.all /= "" then - Add_Search_Project_Directory (Tree, Ada_Prj_Path.all); - end if; - - Free (Ada_Prj_Path); - - -- Copy to Name_Buffer, since we will need to manipulate the path - - Name_Len := Tree.Project_Path'Length; - Name_Buffer (1 .. Name_Len) := Tree.Project_Path.all; - - -- Scan the directory path to see if "-" is one of the directories. - -- Remove each occurrence of "-" and set Add_Default_Dir to False. - -- Also resolve relative paths and symbolic links. - - First := 3; - loop - while First <= Name_Len - and then (Name_Buffer (First) = Path_Separator) - loop - First := First + 1; - end loop; - - exit when First > Name_Len; - - Last := First; - - while Last < Name_Len - and then Name_Buffer (Last + 1) /= Path_Separator - loop - Last := Last + 1; - end loop; - - -- If the directory is "-", set Add_Default_Dir to False and - -- remove from path. - - if Name_Buffer (First .. Last) = No_Project_Default_Dir then - Add_Default_Dir := False; - - for J in Last + 1 .. Name_Len loop - Name_Buffer (J - No_Project_Default_Dir'Length - 1) := - Name_Buffer (J); - end loop; - - Name_Len := Name_Len - No_Project_Default_Dir'Length - 1; - - -- After removing the '-', go back one character to get the next - -- directory correctly. - - Last := Last - 1; - - elsif not Hostparm.OpenVMS - or else not Is_Absolute_Path (Name_Buffer (First .. Last)) - then - -- On VMS, only expand relative path names, as absolute paths - -- may correspond to multi-valued VMS logical names. - - declare - New_Dir : constant String := - Normalize_Pathname - (Name_Buffer (First .. Last), - Resolve_Links => Opt.Follow_Links_For_Dirs); - - begin - -- If the absolute path was resolved and is different from - -- the original, replace original with the resolved path. - - if New_Dir /= Name_Buffer (First .. Last) - and then New_Dir'Length /= 0 - then - New_Len := Name_Len + New_Dir'Length - (Last - First + 1); - New_Last := First + New_Dir'Length - 1; - Name_Buffer (New_Last + 1 .. New_Len) := - Name_Buffer (Last + 1 .. Name_Len); - Name_Buffer (First .. New_Last) := New_Dir; - Name_Len := New_Len; - Last := New_Last; - end if; - end; - end if; - - First := Last + 1; - end loop; - - Free (Tree.Project_Path); - - -- Set the initial value of Current_Project_Path - - if Add_Default_Dir then - declare - Prefix : String_Ptr := Sdefault.Search_Dir_Prefix; - - begin - if Prefix = null then - Prefix := new String'(Executable_Prefix_Path); - - if Prefix.all /= "" then - Add_Str_To_Name_Buffer - (Path_Separator & Prefix.all & - "share" & Directory_Separator & "gpr"); - Add_Str_To_Name_Buffer - (Path_Separator & Prefix.all & - Directory_Separator & "lib" & - Directory_Separator & "gnat"); - end if; - - else - Tree.Project_Path := - new String'(Name_Buffer (1 .. Name_Len) & Path_Separator & - Prefix.all & - ".." & Directory_Separator & - ".." & Directory_Separator & - ".." & Directory_Separator & "gnat"); - end if; - - Free (Prefix); - end; - end if; - - if Tree.Project_Path = null then - Tree.Project_Path := new String'(Name_Buffer (1 .. Name_Len)); - end if; - end Initialize_Project_Path; - - ------------------ - -- Project_Path -- - ------------------ - - function Project_Path (Tree : Project_Node_Tree_Ref) return String is - begin - if Tree.Project_Path = null - or else Tree.Project_Path (Tree.Project_Path'First) = '#' - then - Initialize_Project_Path (Tree); - end if; - - return Tree.Project_Path.all; - end Project_Path; - ----------- -- Reset -- ----------- --- 75,80 ---- *************** package body Prj.Ext is *** 302,319 **** Name_To_Name_HTable.Reset (Tree.External_References); end Reset; - ---------------------- - -- Set_Project_Path -- - ---------------------- - - procedure Set_Project_Path - (Tree : Project_Node_Tree_Ref; - New_Path : String) is - begin - Free (Tree.Project_Path); - Tree.Project_Path := new String'(New_Path); - end Set_Project_Path; - -------------- -- Value_Of -- -------------- --- 84,89 ---- *************** package body Prj.Ext is *** 328,334 **** Name : String := Get_Name_String (External_Name); begin ! Canonical_Case_File_Name (Name); Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; The_Value := --- 98,104 ---- Name : String := Get_Name_String (External_Name); begin ! Canonical_Case_Env_Var_Name (Name); Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; The_Value := diff -Nrcpad gcc-4.5.2/gcc/ada/prj-ext.ads gcc-4.6.0/gcc/ada/prj-ext.ads *** gcc-4.5.2/gcc/ada/prj-ext.ads Thu Sep 17 10:54:32 2009 --- gcc-4.6.0/gcc/ada/prj-ext.ads Tue Oct 5 09:26:00 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2010, 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- -- *************** with Prj.Tree; *** 30,63 **** package Prj.Ext is - ------------------ - -- Project Path -- - ------------------ - - procedure Add_Search_Project_Directory - (Tree : Prj.Tree.Project_Node_Tree_Ref; - Path : String); - -- Add a directory to the project path. Directories added with this - -- procedure are added in order after the current directory and before - -- the path given by the environment variable GPR_PROJECT_PATH. A value - -- of "-" will remove the default project directory from the project path. - -- - -- Calls to this subprogram must be performed before the first call to - -- Project_Path below, or PATH will be added at the end of the search - -- path. - - function Project_Path (Tree : Prj.Tree.Project_Node_Tree_Ref) return String; - -- Return the current value of the project path, either the value set - -- during elaboration of the package or, if procedure Set_Project_Path has - -- been called, the value set by the last call to Set_Project_Path. - - procedure Set_Project_Path - (Tree : Prj.Tree.Project_Node_Tree_Ref; - New_Path : String); - -- Give a new value to the project path. The new value New_Path should - -- always start with the current directory (".") and the path separators - -- should be the correct ones for the platform. - ------------------------- -- External References -- ------------------------- --- 30,35 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/prj-makr.adb gcc-4.6.0/gcc/ada/prj-makr.adb *** gcc-4.5.2/gcc/ada/prj-makr.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/prj-makr.adb Mon Oct 4 14:09:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body Prj.Makr is *** 693,699 **** W_Char => Write_A_Char'Access, W_Eol => Write_Eol'Access, W_Str => Write_A_String'Access, ! Backward_Compatibility => False); Close (Output_FD); -- Delete the naming project file if it already exists --- 693,700 ---- W_Char => Write_A_Char'Access, W_Eol => Write_Eol'Access, W_Str => Write_A_String'Access, ! Backward_Compatibility => False, ! Max_Line_Length => 79); Close (Output_FD); -- Delete the naming project file if it already exists *************** package body Prj.Makr is *** 792,798 **** -- Do some needed initializations Csets.Initialize; - Namet.Initialize; Snames.Initialize; Prj.Initialize (No_Project_Tree); Prj.Tree.Initialize (Tree); --- 793,798 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/prj-nmsc.adb gcc-4.6.0/gcc/ada/prj-nmsc.adb *** gcc-4.5.2/gcc/ada/prj-nmsc.adb Tue Jan 26 14:02:25 2010 --- gcc-4.6.0/gcc/ada/prj-nmsc.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2010, 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,36 **** -- -- ------------------------------------------------------------------------------ - with GNAT.Case_Util; use GNAT.Case_Util; - with GNAT.Directory_Operations; use GNAT.Directory_Operations; - with GNAT.Dynamic_HTables; - with Err_Vars; use Err_Vars; with Opt; use Opt; with Osint; use Osint; with Output; use Output; with Prj.Err; use Prj.Err; with Prj.Util; use Prj.Util; with Sinput.P; --- 23,33 ---- -- -- ------------------------------------------------------------------------------ with Err_Vars; use Err_Vars; with Opt; use Opt; with Osint; use Osint; with Output; use Output; + with Prj.Com; with Prj.Err; use Prj.Err; with Prj.Util; use Prj.Util; with Sinput.P; *************** with Ada.Strings; use Ada *** 43,48 **** --- 40,51 ---- with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; + with GNAT.Case_Util; use GNAT.Case_Util; + with GNAT.Directory_Operations; use GNAT.Directory_Operations; + with GNAT.Dynamic_HTables; + with GNAT.Regexp; use GNAT.Regexp; + with GNAT.Table; + package body Prj.Nmsc is No_Continuation_String : aliased String := ""; *************** package body Prj.Nmsc is *** 51,63 **** -- location. type Name_Location is record ! Name : File_Name_Type; -- ??? duplicates the key Location : Source_Ptr; Source : Source_Id := No_Source; Found : Boolean := False; end record; No_Name_Location : constant Name_Location := ! (No_File, No_Location, No_Source, False); package Source_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable (Header_Num => Header_Num, Element => Name_Location, --- 54,76 ---- -- location. type Name_Location is record ! Name : File_Name_Type; ! -- Key is duplicated, so that it is known when using functions Get_First ! -- and Get_Next, as these functions only return an Element. ! Location : Source_Ptr; Source : Source_Id := No_Source; + Listed : Boolean := False; Found : Boolean := False; end record; + No_Name_Location : constant Name_Location := ! (Name => No_File, ! Location => No_Location, ! Source => No_Source, ! Listed => False, ! Found => False); ! package Source_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable (Header_Num => Header_Num, Element => Name_Location, *************** package body Prj.Nmsc is *** 65,78 **** Key => File_Name_Type, Hash => Hash, Equal => "="); ! -- Information about file names found in string list attribute ! -- (Source_Files or Source_List_File). ! -- Except is set to True if source is a naming exception in the project. ! -- This is used to check that all referenced files were indeed found on the ! -- disk. type Unit_Exception is record ! Name : Name_Id; -- ??? duplicates the key Spec : File_Name_Type; Impl : File_Name_Type; end record; --- 78,93 ---- Key => File_Name_Type, Hash => Hash, Equal => "="); ! -- File name information found in string list attribute (Source_Files or ! -- Source_List_File). Except is set to True if source is a naming exception ! -- in the project. Used to check that all referenced files were indeed ! -- found on the disk. type Unit_Exception is record ! Name : Name_Id; ! -- Key is duplicated, so that it is known when using functions Get_First ! -- and Get_Next, as these functions only return an Element. ! Spec : File_Name_Type; Impl : File_Name_Type; end record; *************** package body Prj.Nmsc is *** 142,147 **** --- 157,163 ---- type Tree_Processing_Data is record Tree : Project_Tree_Ref; + Node_Tree : Prj.Tree.Project_Node_Tree_Ref; File_To_Source : Files_Htable.Instance; Flags : Prj.Processing_Flags; end record; *************** package body Prj.Nmsc is *** 151,160 **** -- This data must be initialized before processing any project, and the -- same data is used for processing all projects in the tree. procedure Initialize ! (Data : out Tree_Processing_Data; ! Tree : Project_Tree_Ref; ! Flags : Prj.Processing_Flags); -- Initialize Data procedure Free (Data : in out Tree_Processing_Data); --- 167,191 ---- -- This data must be initialized before processing any project, and the -- same data is used for processing all projects in the tree. + type Lib_Data is record + Name : Name_Id; + Proj : Project_Id; + end record; + + package Lib_Data_Table is new GNAT.Table + (Table_Component_Type => Lib_Data, + Table_Index_Type => Natural, + Table_Low_Bound => 1, + Table_Initial => 10, + Table_Increment => 100); + -- A table to record library names in order to check that two library + -- projects do not have the same library names. + procedure Initialize ! (Data : out Tree_Processing_Data; ! Tree : Project_Tree_Ref; ! Node_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Flags : Prj.Processing_Flags); -- Initialize Data procedure Free (Data : in out Tree_Processing_Data); *************** package body Prj.Nmsc is *** 188,193 **** --- 219,250 ---- -- exceptions, and copied into the Source_Names and Unit_Exceptions tables -- as appropriate. + type Search_Type is (Search_Files, Search_Directories); + + generic + with procedure Callback + (Path : Path_Information; + Pattern_Index : Natural); + procedure Expand_Subdirectory_Pattern + (Project : Project_Id; + Data : in out Tree_Processing_Data; + Patterns : String_List_Id; + Ignore : String_List_Id; + Search_For : Search_Type; + Resolve_Links : Boolean); + -- Search the subdirectories of Project's directory for files or + -- directories that match the globbing patterns found in Patterns (for + -- instance "**/*.adb"). Typically, Patterns will be the value of the + -- Source_Dirs or Excluded_Source_Dirs attributes. + -- Every time such a file or directory is found, the callback is called. + -- Resolve_Links indicates whether we should resolve links while + -- normalizing names. + -- In the callback, Pattern_Index is the index within Patterns where the + -- expanded pattern was found (1 for the first element of Patterns and + -- all its matching directories, then 2,...). + -- We use a generic and not an access-to-subprogram because in some cases + -- this code is compiled with the restriction No_Implicit_Dynamic_Code + procedure Add_Source (Id : out Source_Id; Data : in out Tree_Processing_Data; *************** package body Prj.Nmsc is *** 234,246 **** procedure Check_Package_Naming (Project : Project_Id; ! Data : in out Tree_Processing_Data; ! Bodies : out Array_Element_Id; ! Specs : out Array_Element_Id); -- Check the naming scheme part of Data, and initialize the naming scheme ! -- data in the config of the various languages. This also returns the ! -- naming scheme exceptions for unit-based languages (Bodies and Specs are ! -- associative arrays mapping individual unit names to source file names). procedure Check_Configuration (Project : Project_Id; --- 291,299 ---- procedure Check_Package_Naming (Project : Project_Id; ! Data : in out Tree_Processing_Data); -- Check the naming scheme part of Data, and initialize the naming scheme ! -- data in the config of the various languages. procedure Check_Configuration (Project : Project_Id; *************** package body Prj.Nmsc is *** 265,270 **** --- 318,334 ---- -- Check the library attributes of project Project in project tree -- and modify its data Data accordingly. + procedure Check_Aggregate_Project + (Project : Project_Id; + Data : in out Tree_Processing_Data); + -- Check aggregate projects attributes, and find the list of aggregated + -- projects. They are stored as a "project_files" language in Project. + + procedure Check_Abstract_Project + (Project : Project_Id; + Data : in out Tree_Processing_Data); + -- Check abstract projects attributes + procedure Check_Programming_Languages (Project : Project_Id; Data : in out Tree_Processing_Data); *************** package body Prj.Nmsc is *** 298,303 **** --- 362,368 ---- Data : in out Tree_Processing_Data; Source_Dir_Rank : Natural; Path : Path_Name_Type; + Display_Path : Path_Name_Type; File_Name : File_Name_Type; Display_File_Name : File_Name_Type; Locally_Removed : Boolean; *************** package body Prj.Nmsc is *** 307,317 **** -- schemes, it is added to various htables through Add_Source and to -- Source_Paths_Htable. -- ! -- Name is the name of the candidate file. It hasn't been normalized yet ! -- and is the direct result of readdir(). -- ! -- File_Name is the same as Name, but has been normalized. ! -- Display_File_Name, however, has not been normalized. -- -- Source_Directory is the directory in which the file was found. It is -- neither normalized nor has had links resolved, and must not end with a --- 372,383 ---- -- schemes, it is added to various htables through Add_Source and to -- Source_Paths_Htable. -- ! -- File_Name is the same as Display_File_Name, but has been normalized. ! -- They do not include the directory information. -- ! -- Path and Display_Path on the other hand are the full path to the file. ! -- Path must have been normalized (canonical casing and possibly links ! -- resolved). -- -- Source_Directory is the directory in which the file was found. It is -- neither normalized nor has had links resolved, and must not end with a *************** package body Prj.Nmsc is *** 413,421 **** (Project : in out Project_Processing_Data; Data : in out Tree_Processing_Data); -- Find all the sources of project Project in project tree Data.Tree and ! -- update its Data accordingly. This assumes that Data.First_Source has ! -- been initialized with the list of excluded sources and special naming ! -- exceptions. function Path_Name_Of (File_Name : File_Name_Type; --- 479,486 ---- (Project : in out Project_Processing_Data; Data : in out Tree_Processing_Data); -- Find all the sources of project Project in project tree Data.Tree and ! -- update its Data accordingly. This assumes that the special naming ! -- exceptions have already been processed. function Path_Name_Of (File_Name : File_Name_Type; *************** package body Prj.Nmsc is *** 424,430 **** -- if file cannot be found. procedure Remove_Source ! (Id : Source_Id; Replaced_By : Source_Id); -- Remove a file from the list of sources of a project. This might be -- because the file is replaced by another one in an extending project, --- 489,496 ---- -- if file cannot be found. procedure Remove_Source ! (Tree : Project_Tree_Ref; ! Id : Source_Id; Replaced_By : Source_Id); -- Remove a file from the list of sources of a project. This might be -- because the file is replaced by another one in an extending project, *************** package body Prj.Nmsc is *** 448,453 **** --- 514,545 ---- -- Debug print a value for a specific property. Does nothing when not in -- debug mode + procedure Error_Or_Warning + (Flags : Processing_Flags; + Kind : Error_Warning; + Msg : String; + Location : Source_Ptr; + Project : Project_Id); + -- Emits either an error or warning message (or nothing), depending on Kind + + ---------------------- + -- Error_Or_Warning -- + ---------------------- + + procedure Error_Or_Warning + (Flags : Processing_Flags; + Kind : Error_Warning; + Msg : String; + Location : Source_Ptr; + Project : Project_Id) is + begin + case Kind is + when Error => Error_Msg (Flags, Msg, Location, Project); + when Warning => Error_Msg (Flags, "?" & Msg, Location, Project); + when Silent => null; + end case; + end Error_Or_Warning; + ------------------------------ -- Replace_Into_Name_Buffer -- ------------------------------ *************** package body Prj.Nmsc is *** 620,628 **** -- (for instance because of symbolic links). elsif Source.Path.Name /= Path.Name then ! Error_Msg_Name_1 := Unit; ! Error_Msg ! (Data.Flags, "duplicate unit %%", Location, Project); Add_Src := False; end if; end if; --- 712,724 ---- -- (for instance because of symbolic links). elsif Source.Path.Name /= Path.Name then ! if not Source.Duplicate_Unit then ! Error_Msg_Name_1 := Unit; ! Error_Msg ! (Data.Flags, "\duplicate unit %%", Location, Project); ! Source.Duplicate_Unit := True; ! end if; ! Add_Src := False; end if; end if; *************** package body Prj.Nmsc is *** 640,645 **** --- 736,742 ---- end if; elsif Prev_Unit /= No_Unit_Index + and then Prev_Unit.File_Names (Kind) /= null and then not Source.Locally_Removed then -- Path is set if this is a source we found on the disk, in which *************** package body Prj.Nmsc is *** 677,682 **** --- 774,780 ---- elsif not Source.Locally_Removed and then not Data.Flags.Allow_Duplicate_Basenames and then Lang_Id.Config.Kind = Unit_Based + and then Source.Language.Config.Kind = Unit_Based then Error_Msg_File_1 := File_Name; Error_Msg_File_2 := File_Name_Type (Source.Project.Name); *************** package body Prj.Nmsc is *** 701,707 **** if Current_Verbosity = High then Write_Str ("Adding source File: "); ! Write_Str (Get_Name_String (File_Name)); if Index /= 0 then Write_Str (" at" & Index'Img); --- 799,805 ---- if Current_Verbosity = High then Write_Str ("Adding source File: "); ! Write_Str (Get_Name_String (Display_File)); if Index /= 0 then Write_Str (" at" & Index'Img); *************** package body Prj.Nmsc is *** 725,730 **** --- 823,829 ---- end if; Id.Project := Project; + Id.Location := Location; Id.Source_Dir_Rank := Source_Dir_Rank; Id.Language := Lang_Id; Id.Kind := Kind; *************** package body Prj.Nmsc is *** 736,741 **** --- 835,843 ---- Id.Dep_Name := Dependency_Name (File_Name, Lang_Id.Config.Dependency_Kind); Id.Naming_Exception := Naming_Exception; + Id.Object := Object_Name + (File_Name, Config.Object_File_Suffix); + Id.Switches := Switches_Name (File_Name); -- Add the source id to the Unit_Sources_HT hash table, if the unit name -- is not null. *************** package body Prj.Nmsc is *** 767,782 **** Override_Kind (Id, Kind); end if; - if Is_Compilable (Id) and then Config.Object_Generated then - Id.Object := Object_Name (File_Name, Config.Object_File_Suffix); - Id.Switches := Switches_Name (File_Name); - end if; - if Path /= No_Path_Information then Id.Path := Path; Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, Path.Name, Id); end if; if Index /= 0 then Project.Has_Multi_Unit_Sources := True; end if; --- 869,883 ---- Override_Kind (Id, Kind); end if; if Path /= No_Path_Information then Id.Path := Path; Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, Path.Name, Id); end if; + Id.Next_With_File_Name := + Source_Files_Htable.Get (Data.Tree.Source_Files_HT, File_Name); + Source_Files_Htable.Set (Data.Tree.Source_Files_HT, File_Name, Id); + if Index /= 0 then Project.Has_Multi_Unit_Sources := True; end if; *************** package body Prj.Nmsc is *** 787,793 **** Lang_Id.First_Source := Id; if Source_To_Replace /= No_Source then ! Remove_Source (Source_To_Replace, Id); end if; Files_Htable.Set (Data.File_To_Source, File_Name, Id); --- 888,903 ---- Lang_Id.First_Source := Id; if Source_To_Replace /= No_Source then ! Remove_Source (Data.Tree, Source_To_Replace, Id); ! end if; ! ! if Data.Tree.Replaced_Source_Number > 0 and then ! Replaced_Source_HTable.Get (Data.Tree.Replaced_Sources, Id.File) /= ! No_File ! then ! Replaced_Source_HTable.Remove (Data.Tree.Replaced_Sources, Id.File); ! Data.Tree.Replaced_Source_Number := ! Data.Tree.Replaced_Source_Number - 1; end if; Files_Htable.Set (Data.File_To_Source, File_Name, Id); *************** package body Prj.Nmsc is *** 808,970 **** end if; end Canonical_Case_File_Name; ! ----------- ! -- Check -- ! ----------- ! procedure Check ! (Project : Project_Id; ! Data : in out Tree_Processing_Data) is ! Specs : Array_Element_Id; ! Bodies : Array_Element_Id; ! Extending : Boolean := False; ! Prj_Data : Project_Processing_Data; ! ! begin ! Initialize (Prj_Data, Project); ! ! Check_If_Externally_Built (Project, Data); ! ! -- Object, exec and source directories ! Get_Directories (Project, Data); ! -- Get the programming languages ! Check_Programming_Languages (Project, Data); ! if Project.Qualifier = Dry ! and then Project.Source_Dirs /= Nil_String ! then ! declare ! Source_Dirs : constant Variable_Value := ! Util.Value_Of ! (Name_Source_Dirs, ! Project.Decl.Attributes, Data.Tree); ! Source_Files : constant Variable_Value := ! Util.Value_Of ! (Name_Source_Files, ! Project.Decl.Attributes, Data.Tree); ! Source_List_File : constant Variable_Value := ! Util.Value_Of ! (Name_Source_List_File, ! Project.Decl.Attributes, Data.Tree); ! Languages : constant Variable_Value := ! Util.Value_Of ! (Name_Languages, ! Project.Decl.Attributes, Data.Tree); ! begin ! if Source_Dirs.Values = Nil_String ! and then Source_Files.Values = Nil_String ! and then Languages.Values = Nil_String ! and then Source_List_File.Default ! then ! Project.Source_Dirs := Nil_String; ! else ! Error_Msg ! (Data.Flags, ! "at least one of Source_Files, Source_Dirs or Languages " ! & "must be declared empty for an abstract project", ! Project.Location, Project); ! end if; ! end; end if; ! -- Check configuration. This must be done even for gnatmake (even though ! -- no user configuration file was provided) since the default config we ! -- generate indicates whether libraries are supported for instance. ! ! Check_Configuration (Project, Data); ! ! -- Library attributes ! ! Check_Library_Attributes (Project, Data); ! if Current_Verbosity = High then ! Show_Source_Dirs (Project, Data.Tree); ! end if; ! Extending := Project.Extends /= No_Project; ! Check_Package_Naming (Project, Data, Bodies => Bodies, Specs => Specs); ! -- Find the sources if Project.Source_Dirs /= Nil_String then ! Look_For_Sources (Prj_Data, Data); ! ! if not Project.Externally_Built ! and then not Extending then ! declare ! Language : Language_Ptr; ! Source : Source_Id; ! Alt_Lang : Language_List; ! Continuation : Boolean := False; ! Iter : Source_Iterator; ! ! begin ! Language := Project.Languages; ! while Language /= No_Language_Index loop ! -- If there are no sources for this language, check if there ! -- are sources for which this is an alternate language. ! if Language.First_Source = No_Source ! and then (Data.Flags.Require_Sources_Other_Lang ! or else Language.Name = Name_Ada) ! then ! Iter := For_Each_Source (In_Tree => Data.Tree, ! Project => Project); ! Source_Loop : loop ! Source := Element (Iter); ! exit Source_Loop when Source = No_Source ! or else Source.Language = Language; ! Alt_Lang := Source.Alternate_Languages; ! while Alt_Lang /= null loop ! exit Source_Loop when Alt_Lang.Language = Language; ! Alt_Lang := Alt_Lang.Next; ! end loop; ! Next (Iter); ! end loop Source_Loop; ! if Source = No_Source then ! Report_No_Sources ! (Project, ! Get_Name_String (Language.Display_Name), ! Data, ! Prj_Data.Source_List_File_Location, ! Continuation); ! Continuation := True; ! end if; ! end if; ! Language := Language.Next; ! end loop; ! end; end if; end if; ! -- If a list of sources is specified in attribute Interfaces, set ! -- In_Interfaces only for the sources specified in the list. ! Check_Interfaces (Project, Data); ! -- If it is a library project file, check if it is a standalone library ! if Project.Library then ! Check_Stand_Alone_Library (Project, Data); ! end if; ! -- Put the list of Mains, if any, in the project data ! Get_Mains (Project, Data); Free (Prj_Data); end Check; --- 918,1076 ---- end if; end Canonical_Case_File_Name; ! ----------------------------- ! -- Check_Aggregate_Project -- ! ----------------------------- ! procedure Check_Aggregate_Project ! (Project : Project_Id; ! Data : in out Tree_Processing_Data) is ! Project_Files : constant Prj.Variable_Value := ! Prj.Util.Value_Of ! (Snames.Name_Project_Files, ! Project.Decl.Attributes, ! Data.Tree); ! procedure Found_Project_File (Path : Path_Information; Rank : Natural); ! -- Comments required ??? ! procedure Expand_Project_Files is ! new Expand_Subdirectory_Pattern (Callback => Found_Project_File); ! -- Comments required ??? ! ------------------------ ! -- Found_Project_File -- ! ------------------------ ! procedure Found_Project_File (Path : Path_Information; Rank : Natural) is ! pragma Unreferenced (Rank); ! begin ! if Current_Verbosity = High then ! Write_Str (" Aggregates:"); ! Write_Line (Get_Name_String (Path.Display_Name)); ! end if; ! end Found_Project_File; ! -- Start of processing for Check_Aggregate_Project ! begin ! if Project_Files.Default then ! Error_Msg_Name_1 := Snames.Name_Project_Files; ! Error_Msg ! (Data.Flags, ! "Attribute %% must be specified in aggregate project", ! Project.Location, Project); ! return; end if; ! -- Look for aggregated projects. For similarity with source files and ! -- dirs, the aggregated project files are not searched for on the ! -- project path, and are only found through the path specified in ! -- the Project_Files attribute. ! Expand_Project_Files ! (Project => Project, ! Data => Data, ! Patterns => Project_Files.Values, ! Ignore => Nil_String, ! Search_For => Search_Files, ! Resolve_Links => Opt.Follow_Links_For_Files); ! end Check_Aggregate_Project; ! ---------------------------- ! -- Check_Abstract_Project -- ! ---------------------------- ! procedure Check_Abstract_Project ! (Project : Project_Id; ! Data : in out Tree_Processing_Data) ! is ! Source_Dirs : constant Variable_Value := ! Util.Value_Of ! (Name_Source_Dirs, ! Project.Decl.Attributes, Data.Tree); ! Source_Files : constant Variable_Value := ! Util.Value_Of ! (Name_Source_Files, ! Project.Decl.Attributes, Data.Tree); ! Source_List_File : constant Variable_Value := ! Util.Value_Of ! (Name_Source_List_File, ! Project.Decl.Attributes, Data.Tree); ! Languages : constant Variable_Value := ! Util.Value_Of ! (Name_Languages, ! Project.Decl.Attributes, Data.Tree); + begin if Project.Source_Dirs /= Nil_String then ! if Source_Dirs.Values = Nil_String ! and then Source_Files.Values = Nil_String ! and then Languages.Values = Nil_String ! and then Source_List_File.Default then ! Project.Source_Dirs := Nil_String; ! else ! Error_Msg ! (Data.Flags, ! "at least one of Source_Files, Source_Dirs or Languages " ! & "must be declared empty for an abstract project", ! Project.Location, Project); ! end if; ! end if; ! end Check_Abstract_Project; ! ----------- ! -- Check -- ! ----------- ! procedure Check ! (Project : Project_Id; ! Data : in out Tree_Processing_Data) ! is ! Prj_Data : Project_Processing_Data; ! begin ! Initialize (Prj_Data, Project); ! Check_If_Externally_Built (Project, Data); ! if Project.Qualifier /= Aggregate then ! Get_Directories (Project, Data); ! Check_Programming_Languages (Project, Data); ! if Current_Verbosity = High then ! Show_Source_Dirs (Project, Data.Tree); end if; end if; ! case Project.Qualifier is ! when Aggregate => Check_Aggregate_Project (Project, Data); ! when Dry => Check_Abstract_Project (Project, Data); ! when others => null; ! end case; ! -- Check configuration. This must be done even for gnatmake (even though ! -- no user configuration file was provided) since the default config we ! -- generate indicates whether libraries are supported for instance. ! Check_Configuration (Project, Data); ! if Project.Qualifier /= Aggregate then ! Check_Library_Attributes (Project, Data); ! Check_Package_Naming (Project, Data); ! Look_For_Sources (Prj_Data, Data); ! Check_Interfaces (Project, Data); ! if Project.Library then ! Check_Stand_Alone_Library (Project, Data); ! end if; ! Get_Mains (Project, Data); ! end if; Free (Prj_Data); end Check; *************** package body Prj.Nmsc is *** 1799,1808 **** elsif Attribute.Name = Name_Required_Switches then ! -- Attribute Required_Switches: the minimum -- options to use when invoking the linker ! Put (Into_List => Project.Config.Minimum_Linker_Options, From_List => Attribute.Value.Values, In_Tree => Data.Tree); --- 1905,1915 ---- elsif Attribute.Name = Name_Required_Switches then ! -- Attribute Required_Switches: the minimum trailing -- options to use when invoking the linker ! Put (Into_List => ! Project.Config.Trailing_Linker_Required_Switches, From_List => Attribute.Value.Values, In_Tree => Data.Tree); *************** package body Prj.Nmsc is *** 1844,1849 **** --- 1951,1972 ---- elsif Name = Name_Option_List then Project.Config.Resp_File_Format := Option_List; + elsif Name_Buffer (1 .. Name_Len) = "gcc" then + Project.Config.Resp_File_Format := GCC; + + elsif Name_Buffer (1 .. Name_Len) = "gcc_gnu" then + Project.Config.Resp_File_Format := GCC_GNU; + + elsif + Name_Buffer (1 .. Name_Len) = "gcc_option_list" + then + Project.Config.Resp_File_Format := GCC_Option_List; + + elsif + Name_Buffer (1 .. Name_Len) = "gcc_object_list" + then + Project.Config.Resp_File_Format := GCC_Object_List; + else Error_Msg (Data.Flags, *************** package body Prj.Nmsc is *** 2282,2287 **** --- 2405,2452 ---- Lang_Index.Config.Toolchain_Version := Element.Value.Value; + -- For Ada, set proper checksum computation mode + + if Lang_Index.Name = Name_Ada then + declare + Vers : constant String := + Get_Name_String (Element.Value.Value); + pragma Assert (Vers'First = 1); + + begin + -- Version 6.3 or earlier + + if Vers'Length >= 8 + and then Vers (1 .. 5) = "GNAT " + and then Vers (7) = '.' + and then + (Vers (6) < '6' + or else + (Vers (6) = '6' and then Vers (8) < '4')) + then + Checksum_GNAT_6_3 := True; + + -- Version 5.03 or earlier + + if Vers (6) < '5' + or else (Vers (6) = '5' + and then Vers (Vers'Last) < '4') + then + Checksum_GNAT_5_03 := True; + + -- Version 5.02 or earlier + + if Vers (6) /= '5' + or else Vers (Vers'Last) < '3' + then + Checksum_Accumulate_Token_Checksum := + False; + end if; + end if; + end if; + end; + end if; + when Name_Runtime_Library_Dir => -- Attribute Runtime_Library_Dir () *************** package body Prj.Nmsc is *** 2719,2727 **** procedure Check_Package_Naming (Project : Project_Id; ! Data : in out Tree_Processing_Data; ! Bodies : out Array_Element_Id; ! Specs : out Array_Element_Id) is Naming_Id : constant Package_Id := Util.Value_Of --- 2884,2890 ---- procedure Check_Package_Naming (Project : Project_Id; ! Data : in out Tree_Processing_Data) is Naming_Id : constant Package_Id := Util.Value_Of *************** package body Prj.Nmsc is *** 2907,2913 **** Element : String_Element; File_Name : File_Name_Type; Source : Source_Id; - Iter : Source_Iterator; begin case Kind is --- 3070,3075 ---- *************** package body Prj.Nmsc is *** 2926,2935 **** In_Tree => Data.Tree); end case; ! Exception_List := Value_Of ! (Index => Lang, ! In_Array => Exceptions, ! In_Tree => Data.Tree); if Exception_List /= Nil_Variable_Value then Element_Id := Exception_List.Values; --- 3088,3098 ---- In_Tree => Data.Tree); end case; ! Exception_List := ! Value_Of ! (Index => Lang, ! In_Array => Exceptions, ! In_Tree => Data.Tree); if Exception_List /= Nil_Variable_Value then Element_Id := Exception_List.Values; *************** package body Prj.Nmsc is *** 2937,2947 **** Element := Data.Tree.String_Elements.Table (Element_Id); File_Name := Canonical_Case_File_Name (Element.Value); ! Iter := For_Each_Source (Data.Tree, Project); loop ! Source := Prj.Element (Iter); ! exit when Source = No_Source or else Source.File = File_Name; ! Next (Iter); end loop; if Source = No_Source then --- 3100,3112 ---- Element := Data.Tree.String_Elements.Table (Element_Id); File_Name := Canonical_Case_File_Name (Element.Value); ! Source := ! Source_Files_Htable.Get ! (Data.Tree.Source_Files_HT, File_Name); ! while Source /= No_Source ! and then Source.Project /= Project loop ! Source := Source.Next_With_File_Name; end loop; if Source = No_Source then *************** package body Prj.Nmsc is *** 2954,2960 **** Kind => Kind, File_Name => File_Name, Display_File => File_Name_Type (Element.Value), ! Naming_Exception => True); else -- Check if the file name is already recorded for another --- 3119,3126 ---- Kind => Kind, File_Name => File_Name, Display_File => File_Name_Type (Element.Value), ! Naming_Exception => True, ! Location => Element.Location); else -- Check if the file name is already recorded for another *************** package body Prj.Nmsc is *** 3218,3224 **** -- Spec_Suffix cannot be equal to Body_Suffix or Separate_Suffix, -- since that would cause a clear ambiguity. Note that we do allow -- a Spec_Suffix to have the same termination as one of these, ! -- which causes a potential ambiguity, but we resolve that my -- matching the longest possible suffix. if Lang_Id.Config.Naming_Data.Spec_Suffix /= No_File --- 3384,3390 ---- -- Spec_Suffix cannot be equal to Body_Suffix or Separate_Suffix, -- since that would cause a clear ambiguity. Note that we do allow -- a Spec_Suffix to have the same termination as one of these, ! -- which causes a potential ambiguity, but we resolve that by -- matching the longest possible suffix. if Lang_Id.Config.Naming_Data.Spec_Suffix /= No_File *************** package body Prj.Nmsc is *** 3252,3258 **** -- Get the naming exceptions for all languages ! for Kind in Spec .. Impl loop Lang_Id := Project.Languages; while Lang_Id /= No_Language_Index loop case Lang_Id.Config.Kind is --- 3418,3424 ---- -- Get the naming exceptions for all languages ! for Kind in Spec_Or_Body loop Lang_Id := Project.Languages; while Lang_Id /= No_Language_Index loop case Lang_Id.Config.Kind is *************** package body Prj.Nmsc is *** 3377,3385 **** -- Start of processing for Check_Naming_Schemes begin - Specs := No_Array_Element; - Bodies := No_Array_Element; - -- No Naming package or parsing a configuration file? nothing to do if Naming_Id /= No_Package --- 3543,3548 ---- *************** package body Prj.Nmsc is *** 3633,3731 **** "library directory { does not exist", Lib_Dir.Location, Project); -- The library directory cannot be the same as the Object -- directory. ! elsif Project.Library_Dir.Name = Project.Object_Directory.Name then ! Error_Msg ! (Data.Flags, ! "library directory cannot be the same " & ! "as object directory", ! Lib_Dir.Location, Project); ! Project.Library_Dir := No_Path_Information; ! else ! declare ! OK : Boolean := True; ! Dirs_Id : String_List_Id; ! Dir_Elem : String_Element; ! Pid : Project_List; ! begin ! -- The library directory cannot be the same as a source ! -- directory of the current project. ! Dirs_Id := Project.Source_Dirs; ! while Dirs_Id /= Nil_String loop ! Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id); ! Dirs_Id := Dir_Elem.Next; ! if Project.Library_Dir.Name = ! Path_Name_Type (Dir_Elem.Value) ! then ! Err_Vars.Error_Msg_File_1 := ! File_Name_Type (Dir_Elem.Value); ! Error_Msg ! (Data.Flags, ! "library directory cannot be the same " & ! "as source directory {", ! Lib_Dir.Location, Project); ! OK := False; ! exit; ! end if; ! end loop; ! if OK then ! -- The library directory cannot be the same as a source ! -- directory of another project either. ! Pid := Data.Tree.Projects; ! Project_Loop : loop ! exit Project_Loop when Pid = null; ! if Pid.Project /= Project then ! Dirs_Id := Pid.Project.Source_Dirs; ! Dir_Loop : while Dirs_Id /= Nil_String loop ! Dir_Elem := ! Data.Tree.String_Elements.Table (Dirs_Id); ! Dirs_Id := Dir_Elem.Next; ! if Project.Library_Dir.Name = ! Path_Name_Type (Dir_Elem.Value) ! then ! Err_Vars.Error_Msg_File_1 := ! File_Name_Type (Dir_Elem.Value); ! Err_Vars.Error_Msg_Name_1 := Pid.Project.Name; ! Error_Msg ! (Data.Flags, ! "library directory cannot be the same " & ! "as source directory { of project %%", ! Lib_Dir.Location, Project); ! OK := False; ! exit Project_Loop; ! end if; ! end loop Dir_Loop; ! end if; ! Pid := Pid.Next; ! end loop Project_Loop; ! end if; ! if not OK then ! Project.Library_Dir := No_Path_Information; ! elsif Current_Verbosity = High then ! -- Display the Library directory in high verbosity ! Write_Attr ! ("Library directory", ! Get_Name_String (Project.Library_Dir.Display_Name)); ! end if; ! end; end if; end if; --- 3796,3898 ---- "library directory { does not exist", Lib_Dir.Location, Project); + elsif not Project.Externally_Built then + -- The library directory cannot be the same as the Object -- directory. ! if Project.Library_Dir.Name = Project.Object_Directory.Name then ! Error_Msg ! (Data.Flags, ! "library directory cannot be the same " & ! "as object directory", ! Lib_Dir.Location, Project); ! Project.Library_Dir := No_Path_Information; ! else ! declare ! OK : Boolean := True; ! Dirs_Id : String_List_Id; ! Dir_Elem : String_Element; ! Pid : Project_List; ! begin ! -- The library directory cannot be the same as a source ! -- directory of the current project. ! Dirs_Id := Project.Source_Dirs; ! while Dirs_Id /= Nil_String loop ! Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id); ! Dirs_Id := Dir_Elem.Next; ! if Project.Library_Dir.Name = ! Path_Name_Type (Dir_Elem.Value) ! then ! Err_Vars.Error_Msg_File_1 := ! File_Name_Type (Dir_Elem.Value); ! Error_Msg ! (Data.Flags, ! "library directory cannot be the same " & ! "as source directory {", ! Lib_Dir.Location, Project); ! OK := False; ! exit; ! end if; ! end loop; ! if OK then ! -- The library directory cannot be the same as a ! -- source directory of another project either. ! Pid := Data.Tree.Projects; ! Project_Loop : loop ! exit Project_Loop when Pid = null; ! if Pid.Project /= Project then ! Dirs_Id := Pid.Project.Source_Dirs; ! Dir_Loop : while Dirs_Id /= Nil_String loop ! Dir_Elem := ! Data.Tree.String_Elements.Table (Dirs_Id); ! Dirs_Id := Dir_Elem.Next; ! if Project.Library_Dir.Name = ! Path_Name_Type (Dir_Elem.Value) ! then ! Err_Vars.Error_Msg_File_1 := ! File_Name_Type (Dir_Elem.Value); ! Err_Vars.Error_Msg_Name_1 := ! Pid.Project.Name; ! Error_Msg ! (Data.Flags, ! "library directory cannot be the same" & ! " as source directory { of project %%", ! Lib_Dir.Location, Project); ! OK := False; ! exit Project_Loop; ! end if; ! end loop Dir_Loop; ! end if; ! Pid := Pid.Next; ! end loop Project_Loop; ! end if; ! if not OK then ! Project.Library_Dir := No_Path_Information; ! elsif Current_Verbosity = High then ! -- Display the Library directory in high verbosity ! Write_Attr ! ("Library directory", ! Get_Name_String (Project.Library_Dir.Display_Name)); ! end if; ! end; ! end if; end if; end if; *************** package body Prj.Nmsc is *** 3813,3820 **** Lib_ALI_Dir.Location, Project); end if; ! if Project.Library_ALI_Dir /= Project.Library_Dir then ! -- The library ALI directory cannot be the same as the -- Object directory. --- 3980,3988 ---- Lib_ALI_Dir.Location, Project); end if; ! if (not Project.Externally_Built) and then ! Project.Library_ALI_Dir /= Project.Library_Dir ! then -- The library ALI directory cannot be the same as the -- Object directory. *************** package body Prj.Nmsc is *** 4078,4086 **** end; end if; ! if Project.Extends /= No_Project then Project.Extends.Library := False; end if; end Check_Library_Attributes; --------------------------------- --- 4246,4291 ---- end; end if; ! if Project.Extends /= No_Project and then Project.Extends.Library then ! ! -- Remove the library name from Lib_Data_Table ! ! for J in 1 .. Lib_Data_Table.Last loop ! if Lib_Data_Table.Table (J).Proj = Project.Extends then ! Lib_Data_Table.Table (J) := ! Lib_Data_Table.Table (Lib_Data_Table.Last); ! Lib_Data_Table.Set_Last (Lib_Data_Table.Last - 1); ! exit; ! end if; ! end loop; ! Project.Extends.Library := False; end if; + + if Project.Library and then not Lib_Name.Default then + + -- Check if the same library name is used in an other library project + + for J in 1 .. Lib_Data_Table.Last loop + if Lib_Data_Table.Table (J).Name = Project.Library_Name then + Error_Msg_Name_1 := Lib_Data_Table.Table (J).Proj.Name; + Error_Msg + (Data.Flags, + "Library name cannot be the same as in project %%", + Lib_Name.Location, Project); + Project.Library := False; + exit; + end if; + end loop; + end if; + + if Project.Library then + + -- Record the library name + + Lib_Data_Table.Append + ((Name => Project.Library_Name, Proj => Project)); + end if; end Check_Library_Attributes; --------------------------------- *************** package body Prj.Nmsc is *** 4780,4801 **** --------------------- procedure Get_Directories ! (Project : Project_Id; ! Data : in out Tree_Processing_Data) is - package Recursive_Dirs is new GNAT.Dynamic_HTables.Simple_HTable - (Header_Num => Header_Num, - Element => Boolean, - No_Element => False, - Key => Name_Id, - Hash => Hash, - Equal => "="); - -- Hash table stores recursive source directories, to avoid looking - -- several times, and to avoid cycles that may be introduced by symbolic - -- links. - - Visited : Recursive_Dirs.Instance; - Object_Dir : constant Variable_Value := Util.Value_Of (Name_Object_Dir, Project.Decl.Attributes, Data.Tree); --- 4985,4993 ---- --------------------- procedure Get_Directories ! (Project : Project_Id; ! Data : in out Tree_Processing_Data) is Object_Dir : constant Variable_Value := Util.Value_Of (Name_Object_Dir, Project.Decl.Attributes, Data.Tree); *************** package body Prj.Nmsc is *** 4808,4813 **** --- 5000,5011 ---- Util.Value_Of (Name_Source_Dirs, Project.Decl.Attributes, Data.Tree); + Ignore_Source_Sub_Dirs : constant Variable_Value := + Util.Value_Of + (Name_Ignore_Source_Sub_Dirs, + Project.Decl.Attributes, + Data.Tree); + Excluded_Source_Dirs : constant Variable_Value := Util.Value_Of (Name_Excluded_Source_Dirs, *************** package body Prj.Nmsc is *** 4826,5222 **** Prj.Util.Value_Of (Name_Languages, Project.Decl.Attributes, Data.Tree); ! procedure Find_Source_Dirs ! (From : File_Name_Type; ! Location : Source_Ptr; ! Rank : Natural; ! Removed : Boolean := False); ! -- Find one or several source directories, and add (or remove, if ! -- Removed is True) them to list of source directories of the project. ! ! ---------------------- ! -- Find_Source_Dirs -- ! ---------------------- ! ! procedure Find_Source_Dirs ! (From : File_Name_Type; ! Location : Source_Ptr; ! Rank : Natural; ! Removed : Boolean := False) ! is ! Directory : constant String := Get_Name_String (From); ! ! procedure Add_To_Or_Remove_From_List ! (Path_Id : Name_Id; ! Display_Path_Id : Name_Id); ! -- When Removed = False, the directory Path_Id to the list of ! -- source_dirs if not already in the list. When Removed = True, ! -- removed directory Path_Id if in the list. ! ! procedure Recursive_Find_Dirs (Path : Name_Id); ! -- Find all the subdirectories (recursively) of Path and add them ! -- to the list of source directories of the project. ! ! -------------------------------- ! -- Add_To_Or_Remove_From_List -- ! -------------------------------- ! ! procedure Add_To_Or_Remove_From_List ! (Path_Id : Name_Id; ! Display_Path_Id : Name_Id) ! is ! List : String_List_Id; ! Prev : String_List_Id; ! Rank_List : Number_List_Index; ! Prev_Rank : Number_List_Index; ! Element : String_Element; ! begin ! Prev := Nil_String; ! Prev_Rank := No_Number_List; ! List := Project.Source_Dirs; ! Rank_List := Project.Source_Dir_Ranks; ! while List /= Nil_String loop ! Element := Data.Tree.String_Elements.Table (List); ! exit when Element.Value = Path_Id; ! Prev := List; ! List := Element.Next; ! Prev_Rank := Rank_List; ! Rank_List := Data.Tree.Number_Lists.Table (Prev_Rank).Next; ! end loop; ! -- The directory is in the list if List is not Nil_String ! if not Removed and then List = Nil_String then ! if Current_Verbosity = High then ! Write_Str (" Adding Source Dir="); ! Write_Line (Get_Name_String (Path_Id)); ! end if; ! String_Element_Table.Increment_Last (Data.Tree.String_Elements); ! Element := ! (Value => Path_Id, ! Index => 0, ! Display_Value => Display_Path_Id, ! Location => No_Location, ! Flag => False, ! Next => Nil_String); ! Number_List_Table.Increment_Last (Data.Tree.Number_Lists); ! if Last_Source_Dir = Nil_String then ! -- This is the first source directory ! Project.Source_Dirs := ! String_Element_Table.Last (Data.Tree.String_Elements); ! Project.Source_Dir_Ranks := ! Number_List_Table.Last (Data.Tree.Number_Lists); ! else ! -- We already have source directories, link the previous ! -- last to the new one. ! Data.Tree.String_Elements.Table (Last_Source_Dir).Next := ! String_Element_Table.Last (Data.Tree.String_Elements); ! Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank).Next := ! Number_List_Table.Last (Data.Tree.Number_Lists); ! end if; ! -- And register this source directory as the new last ! Last_Source_Dir := String_Element_Table.Last (Data.Tree.String_Elements); ! Data.Tree.String_Elements.Table (Last_Source_Dir) := Element; ! Last_Src_Dir_Rank := Number_List_Table.Last (Data.Tree.Number_Lists); - Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank) := - (Number => Rank, Next => No_Number_List); ! elsif Removed and then List /= Nil_String then ! ! -- Remove source dir, if present ! ! if Prev = Nil_String then ! Project.Source_Dirs := ! Data.Tree.String_Elements.Table (List).Next; ! Project.Source_Dir_Ranks := ! Data.Tree.Number_Lists.Table (Rank_List).Next; ! ! else ! Data.Tree.String_Elements.Table (Prev).Next := ! Data.Tree.String_Elements.Table (List).Next; ! Data.Tree.Number_Lists.Table (Prev_Rank).Next := ! Data.Tree.Number_Lists.Table (Rank_List).Next; ! end if; ! end if; ! end Add_To_Or_Remove_From_List; ! ! ------------------------- ! -- Recursive_Find_Dirs -- ! ------------------------- ! ! procedure Recursive_Find_Dirs (Path : Name_Id) is ! Dir : Dir_Type; ! Name : String (1 .. 250); ! Last : Natural; ! ! Non_Canonical_Path : Name_Id := No_Name; ! Canonical_Path : Name_Id := No_Name; ! ! The_Path : constant String := ! Normalize_Pathname ! (Get_Name_String (Path), ! Directory => ! Get_Name_String (Project.Directory.Display_Name), ! Resolve_Links => Opt.Follow_Links_For_Dirs) & ! Directory_Separator; ! ! The_Path_Last : constant Natural := ! Compute_Directory_Last (The_Path); ! ! begin ! Name_Len := The_Path_Last - The_Path'First + 1; ! Name_Buffer (1 .. Name_Len) := ! The_Path (The_Path'First .. The_Path_Last); ! Non_Canonical_Path := Name_Find; ! Canonical_Path := ! Name_Id (Canonical_Case_File_Name (Non_Canonical_Path)); ! ! -- To avoid processing the same directory several times, check ! -- if the directory is already in Recursive_Dirs. If it is, then ! -- there is nothing to do, just return. If it is not, put it there ! -- and continue recursive processing. ! if not Removed then ! if Recursive_Dirs.Get (Visited, Canonical_Path) then ! return; ! else ! Recursive_Dirs.Set (Visited, Canonical_Path, True); ! end if; end if; ! Add_To_Or_Remove_From_List ! (Path_Id => Canonical_Path, ! Display_Path_Id => Non_Canonical_Path); ! ! -- Now look for subdirectories. Do that even when this directory ! -- is already in the list, because some of its subdirectories may ! -- not be in the list yet. ! ! Open (Dir, The_Path (The_Path'First .. The_Path_Last)); ! ! loop ! Read (Dir, Name, Last); ! exit when Last = 0; ! ! if Name (1 .. Last) /= "." ! and then Name (1 .. Last) /= ".." ! then ! -- Avoid . and .. directories ! ! if Current_Verbosity = High then ! Write_Str (" Checking "); ! Write_Line (Name (1 .. Last)); ! end if; ! ! declare ! Path_Name : constant String := ! Normalize_Pathname ! (Name => Name (1 .. Last), ! Directory => ! The_Path ! (The_Path'First .. The_Path_Last), ! Resolve_Links => ! Opt.Follow_Links_For_Dirs, ! Case_Sensitive => True); ! ! begin ! if Is_Directory (Path_Name) then ! ! -- We have found a new subdirectory, call self ! ! Name_Len := Path_Name'Length; ! Name_Buffer (1 .. Name_Len) := Path_Name; ! Recursive_Find_Dirs (Name_Find); ! end if; ! end; ! end if; ! end loop; ! ! Close (Dir); ! ! exception ! when Directory_Error => ! null; ! end Recursive_Find_Dirs; ! ! -- Start of processing for Find_Source_Dirs ! ! begin ! if Current_Verbosity = High and then not Removed then ! Write_Str ("Find_Source_Dirs ("""); ! Write_Str (Directory); ! Write_Str (","); ! Write_Str (Rank'Img); ! Write_Line (""")"); ! end if; ! ! -- First, check if we are looking for a directory tree, indicated ! -- by "/**" at the end. ! if Directory'Length >= 3 ! and then Directory (Directory'Last - 1 .. Directory'Last) = "**" ! and then (Directory (Directory'Last - 2) = '/' ! or else ! Directory (Directory'Last - 2) = Directory_Separator) ! then ! Name_Len := Directory'Length - 3; ! if Name_Len = 0 then ! -- Case of "/**": all directories in file system ! Name_Len := 1; ! Name_Buffer (1) := Directory (Directory'First); else ! Name_Buffer (1 .. Name_Len) := ! Directory (Directory'First .. Directory'Last - 3); ! end if; ! ! if Current_Verbosity = High then ! Write_Str ("Looking for all subdirectories of """); ! Write_Str (Name_Buffer (1 .. Name_Len)); ! Write_Line (""""); end if; ! declare ! Base_Dir : constant File_Name_Type := Name_Find; ! Root_Dir : constant String := ! Normalize_Pathname ! (Name => Get_Name_String (Base_Dir), ! Directory => ! Get_Name_String ! (Project.Directory.Display_Name), ! Resolve_Links => ! Opt.Follow_Links_For_Dirs, ! Case_Sensitive => True); ! ! begin ! if Root_Dir'Length = 0 then ! Err_Vars.Error_Msg_File_1 := Base_Dir; ! ! if Location = No_Location then ! Error_Msg ! (Data.Flags, ! "{ is not a valid directory.", ! Project.Location, Project); ! else ! Error_Msg ! (Data.Flags, ! "{ is not a valid directory.", ! Location, Project); ! end if; ! ! else ! -- We have an existing directory, we register it and all of ! -- its subdirectories. ! ! if Current_Verbosity = High then ! Write_Line ("Looking for source directories:"); ! end if; ! ! Name_Len := Root_Dir'Length; ! Name_Buffer (1 .. Name_Len) := Root_Dir; ! Recursive_Find_Dirs (Name_Find); ! ! if Current_Verbosity = High then ! Write_Line ("End of looking for source directories."); ! end if; ! end if; ! end; ! ! -- We have a single directory ! ! else ! declare ! Path_Name : Path_Information; ! Dir_Exists : Boolean; ! ! begin ! Locate_Directory ! (Project => Project, ! Name => From, ! Path => Path_Name, ! Dir_Exists => Dir_Exists, ! Data => Data, ! Must_Exist => False); ! ! if not Dir_Exists then ! Err_Vars.Error_Msg_File_1 := From; ! ! if Location = No_Location then ! Error_Msg ! (Data.Flags, ! "{ is not a valid directory", ! Project.Location, Project); ! else ! Error_Msg ! (Data.Flags, ! "{ is not a valid directory", ! Location, Project); ! end if; ! ! else ! declare ! Path : constant String := ! Normalize_Pathname ! (Name => ! Get_Name_String (Path_Name.Name), ! Directory => ! Get_Name_String (Project.Directory.Name), ! Resolve_Links => Opt.Follow_Links_For_Dirs, ! Case_Sensitive => True) & ! Directory_Separator; ! ! Last_Path : constant Natural := ! Compute_Directory_Last (Path); ! Path_Id : Name_Id; ! Display_Path : constant String := ! Get_Name_String ! (Path_Name.Display_Name); ! Last_Display_Path : constant Natural := ! Compute_Directory_Last ! (Display_Path); ! Display_Path_Id : Name_Id; ! ! begin ! Name_Len := 0; ! Add_Str_To_Name_Buffer (Path (Path'First .. Last_Path)); ! Path_Id := Name_Find; ! ! Name_Len := 0; ! Add_Str_To_Name_Buffer ! (Display_Path ! (Display_Path'First .. Last_Display_Path)); ! Display_Path_Id := Name_Find; ! Add_To_Or_Remove_From_List ! (Path_Id => Path_Id, ! Display_Path_Id => Display_Path_Id); ! end; ! end if; ! end; ! end if; ! Recursive_Dirs.Reset (Visited); ! end Find_Source_Dirs; -- Start of processing for Get_Directories - Dir_Exists : Boolean; - begin if Current_Verbosity = High then Write_Line ("Starting to look for directories"); --- 5024,5153 ---- Prj.Util.Value_Of (Name_Languages, Project.Decl.Attributes, Data.Tree); ! Remove_Source_Dirs : Boolean := False; ! procedure Add_To_Or_Remove_From_Source_Dirs ! (Path : Path_Information; ! Rank : Natural); ! -- When Removed = False, the directory Path_Id to the list of ! -- source_dirs if not already in the list. When Removed = True, ! -- removed directory Path_Id if in the list. ! procedure Find_Source_Dirs is new Expand_Subdirectory_Pattern ! (Add_To_Or_Remove_From_Source_Dirs); ! --------------------------------------- ! -- Add_To_Or_Remove_From_Source_Dirs -- ! --------------------------------------- ! procedure Add_To_Or_Remove_From_Source_Dirs ! (Path : Path_Information; ! Rank : Natural) ! is ! List : String_List_Id; ! Prev : String_List_Id; ! Rank_List : Number_List_Index; ! Prev_Rank : Number_List_Index; ! Element : String_Element; ! begin ! Prev := Nil_String; ! Prev_Rank := No_Number_List; ! List := Project.Source_Dirs; ! Rank_List := Project.Source_Dir_Ranks; ! while List /= Nil_String loop ! Element := Data.Tree.String_Elements.Table (List); ! exit when Element.Value = Name_Id (Path.Name); ! Prev := List; ! List := Element.Next; ! Prev_Rank := Rank_List; ! Rank_List := Data.Tree.Number_Lists.Table (Prev_Rank).Next; ! end loop; ! -- The directory is in the list if List is not Nil_String ! if not Remove_Source_Dirs and then List = Nil_String then ! if Current_Verbosity = High then ! Write_Str (" Adding Source Dir="); ! Write_Line (Get_Name_String (Path.Display_Name)); ! end if; ! String_Element_Table.Increment_Last (Data.Tree.String_Elements); ! Element := ! (Value => Name_Id (Path.Name), ! Index => 0, ! Display_Value => Name_Id (Path.Display_Name), ! Location => No_Location, ! Flag => False, ! Next => Nil_String); ! Number_List_Table.Increment_Last (Data.Tree.Number_Lists); ! if Last_Source_Dir = Nil_String then ! -- This is the first source directory ! Project.Source_Dirs := String_Element_Table.Last (Data.Tree.String_Elements); ! Project.Source_Dir_Ranks := Number_List_Table.Last (Data.Tree.Number_Lists); ! else ! -- We already have source directories, link the previous ! -- last to the new one. ! Data.Tree.String_Elements.Table (Last_Source_Dir).Next := ! String_Element_Table.Last (Data.Tree.String_Elements); ! Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank).Next := ! Number_List_Table.Last (Data.Tree.Number_Lists); end if; ! -- And register this source directory as the new last ! Last_Source_Dir := ! String_Element_Table.Last (Data.Tree.String_Elements); ! Data.Tree.String_Elements.Table (Last_Source_Dir) := Element; ! Last_Src_Dir_Rank := ! Number_List_Table.Last (Data.Tree.Number_Lists); ! Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank) := ! (Number => Rank, Next => No_Number_List); ! elsif Remove_Source_Dirs and then List /= Nil_String then ! -- Remove source dir if present ! if Prev = Nil_String then ! Project.Source_Dirs := ! Data.Tree.String_Elements.Table (List).Next; ! Project.Source_Dir_Ranks := ! Data.Tree.Number_Lists.Table (Rank_List).Next; else ! Data.Tree.String_Elements.Table (Prev).Next := ! Data.Tree.String_Elements.Table (List).Next; ! Data.Tree.Number_Lists.Table (Prev_Rank).Next := ! Data.Tree.Number_Lists.Table (Rank_List).Next; end if; + end if; + end Add_To_Or_Remove_From_Source_Dirs; ! -- Local declarations ! Dir_Exists : Boolean; ! No_Sources : constant Boolean := ! ((not Source_Files.Default ! and then Source_Files.Values = Nil_String) ! or else ! (not Source_Dirs.Default ! and then Source_Dirs.Values = Nil_String) ! or else ! (not Languages.Default ! and then Languages.Values = Nil_String)) ! and then Project.Extends = No_Project; -- Start of processing for Get_Directories begin if Current_Verbosity = High then Write_Line ("Starting to look for directories"); *************** package body Prj.Nmsc is *** 5225,5238 **** -- Set the object directory to its default which may be nil, if there -- is no sources in the project. ! if (((not Source_Files.Default) ! and then Source_Files.Values = Nil_String) ! or else ! ((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String) ! or else ! ((not Languages.Default) and then Languages.Values = Nil_String)) ! and then Project.Extends = No_Project ! then Project.Object_Directory := No_Path_Information; else Project.Object_Directory := Project.Directory; --- 5156,5162 ---- -- Set the object directory to its default which may be nil, if there -- is no sources in the project. ! if No_Sources then Project.Object_Directory := No_Path_Information; else Project.Object_Directory := Project.Directory; *************** package body Prj.Nmsc is *** 5249,5255 **** "Object_Dir cannot be empty", Object_Dir.Location, Project); ! else -- We check that the specified object directory does exist. -- However, even when it doesn't exist, we set it to a default -- value. This is for the benefit of tools that recover from --- 5173,5180 ---- "Object_Dir cannot be empty", Object_Dir.Location, Project); ! elsif not No_Sources then ! -- We check that the specified object directory does exist. -- However, even when it doesn't exist, we set it to a default -- value. This is for the benefit of tools that recover from *************** package body Prj.Nmsc is *** 5270,5301 **** if not Dir_Exists and then not Project.Externally_Built then ! -- The object directory does not exist, report an error if ! -- the project is not externally built. Err_Vars.Error_Msg_File_1 := File_Name_Type (Object_Dir.Value); ! ! case Data.Flags.Require_Obj_Dirs is ! when Error => ! Error_Msg ! (Data.Flags, ! "object directory { not found", ! Project.Location, Project); ! when Warning => ! Error_Msg ! (Data.Flags, ! "?object directory { not found", ! Project.Location, Project); ! when Silent => ! null; ! end case; end if; end if; ! elsif Project.Object_Directory /= No_Path_Information ! and then Subdirs /= null ! then Name_Len := 1; Name_Buffer (1) := '.'; Locate_Directory --- 5195,5212 ---- if not Dir_Exists and then not Project.Externally_Built then ! -- The object directory does not exist, report an error if the ! -- project is not externally built. Err_Vars.Error_Msg_File_1 := File_Name_Type (Object_Dir.Value); ! Error_Or_Warning ! (Data.Flags, Data.Flags.Require_Obj_Dirs, ! "object directory { not found", Project.Location, Project); end if; end if; ! elsif not No_Sources and then Subdirs /= null then Name_Len := 1; Name_Buffer (1) := '.'; Locate_Directory *************** package body Prj.Nmsc is *** 5334,5340 **** "Exec_Dir cannot be empty", Exec_Dir.Location, Project); ! else -- We check that the specified exec directory does exist Locate_Directory --- 5245,5252 ---- "Exec_Dir cannot be empty", Exec_Dir.Location, Project); ! elsif not No_Sources then ! -- We check that the specified exec directory does exist Locate_Directory *************** package body Prj.Nmsc is *** 5349,5358 **** if not Dir_Exists then Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value); ! Error_Msg ! (Data.Flags, ! "exec directory { not found", ! Project.Location, Project); end if; end if; end if; --- 5261,5269 ---- if not Dir_Exists then Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value); ! Error_Or_Warning ! (Data.Flags, Data.Flags.Missing_Source_Files, ! "exec directory { not found", Project.Location, Project); end if; end if; end if; *************** package body Prj.Nmsc is *** 5375,5381 **** pragma Assert (Source_Dirs.Kind = List, "Source_Dirs is not a list"); ! if (not Source_Files.Default) and then Source_Files.Values = Nil_String then Project.Source_Dirs := Nil_String; --- 5286,5292 ---- pragma Assert (Source_Dirs.Kind = List, "Source_Dirs is not a list"); ! if not Source_Files.Default and then Source_Files.Values = Nil_String then Project.Source_Dirs := Nil_String; *************** package body Prj.Nmsc is *** 5392,5472 **** -- No Source_Dirs specified: the single source directory is the one -- containing the project file. ! String_Element_Table.Append (Data.Tree.String_Elements, ! (Value => Name_Id (Project.Directory.Name), ! Display_Value => Name_Id (Project.Directory.Display_Name), ! Location => No_Location, ! Flag => False, ! Next => Nil_String, ! Index => 0)); ! ! Project.Source_Dirs := ! String_Element_Table.Last (Data.Tree.String_Elements); ! ! Number_List_Table.Append ! (Data.Tree.Number_Lists, ! (Number => 1, Next => No_Number_List)); ! ! Project.Source_Dir_Ranks := ! Number_List_Table.Last (Data.Tree.Number_Lists); ! if Current_Verbosity = High then ! Write_Attr ! ("Default source directory", ! Get_Name_String (Project.Directory.Display_Name)); ! end if; ! elsif Source_Dirs.Values = Nil_String then ! if Project.Qualifier = Standard then Error_Msg (Data.Flags, "a standard project cannot have no source directories", Source_Dirs.Location, Project); end if; - - Project.Source_Dirs := Nil_String; - - else - declare - Source_Dir : String_List_Id; - Element : String_Element; - Rank : Natural; - begin - -- Process the source directories for each element of the list - - Source_Dir := Source_Dirs.Values; - Rank := 0; - while Source_Dir /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Source_Dir); - Rank := Rank + 1; - Find_Source_Dirs - (File_Name_Type (Element.Value), Element.Location, Rank); - Source_Dir := Element.Next; - end loop; - end; end if; if not Excluded_Source_Dirs.Default and then Excluded_Source_Dirs.Values /= Nil_String then ! declare ! Source_Dir : String_List_Id; ! Element : String_Element; ! ! begin ! -- Process the source directories for each element of the list ! ! Source_Dir := Excluded_Source_Dirs.Values; ! while Source_Dir /= Nil_String loop ! Element := Data.Tree.String_Elements.Table (Source_Dir); ! Find_Source_Dirs ! (File_Name_Type (Element.Value), ! Element.Location, ! 0, ! Removed => True); ! Source_Dir := Element.Next; ! end loop; ! end; end if; if Current_Verbosity = High then --- 5303,5345 ---- -- No Source_Dirs specified: the single source directory is the one -- containing the project file. ! Remove_Source_Dirs := False; ! Add_To_Or_Remove_From_Source_Dirs ! (Path => (Name => Project.Directory.Name, ! Display_Name => Project.Directory.Display_Name), ! Rank => 1); ! else ! Remove_Source_Dirs := False; ! Find_Source_Dirs ! (Project => Project, ! Data => Data, ! Patterns => Source_Dirs.Values, ! Ignore => Ignore_Source_Sub_Dirs.Values, ! Search_For => Search_Directories, ! Resolve_Links => Opt.Follow_Links_For_Dirs); ! if Project.Source_Dirs = Nil_String ! and then Project.Qualifier = Standard ! then Error_Msg (Data.Flags, "a standard project cannot have no source directories", Source_Dirs.Location, Project); end if; end if; if not Excluded_Source_Dirs.Default and then Excluded_Source_Dirs.Values /= Nil_String then ! Remove_Source_Dirs := True; ! Find_Source_Dirs ! (Project => Project, ! Data => Data, ! Patterns => Excluded_Source_Dirs.Values, ! Ignore => Nil_String, ! Search_For => Search_Directories, ! Resolve_Links => Opt.Follow_Links_For_Dirs); end if; if Current_Verbosity = High then *************** package body Prj.Nmsc is *** 5482,5488 **** Element := Data.Tree.String_Elements.Table (Current); if Element.Value /= No_Name then Element.Value := ! Name_Id (Canonical_Case_File_Name (Name_Id (Element.Value))); Data.Tree.String_Elements.Table (Current) := Element; end if; --- 5355,5361 ---- Element := Data.Tree.String_Elements.Table (Current); if Element.Value /= No_Name then Element.Value := ! Name_Id (Canonical_Case_File_Name (Element.Value)); Data.Tree.String_Elements.Table (Current) := Element; end if; *************** package body Prj.Nmsc is *** 5610,5616 **** --- 5483,5493 ---- (Name => Source_Name, Location => Location, Source => No_Source, + Listed => True, Found => False); + + else + Name_Loc.Listed := True; end if; Source_Names_Htable.Set *************** package body Prj.Nmsc is *** 5807,5813 **** end; end if; ! -- Name_Buffer contains the name of the the unit in lower-cases. Check -- that this is a valid unit name Check_Ada_Name (Name_Buffer (1 .. Name_Len), Unit); --- 5684,5690 ---- end; end if; ! -- Name_Buffer contains the name of the unit in lower-cases. Check -- that this is a valid unit name Check_Ada_Name (Name_Buffer (1 .. Name_Len), Unit); *************** package body Prj.Nmsc is *** 6242,6255 **** ------------------ procedure Find_Sources ! (Project : in out Project_Processing_Data; ! Data : in out Tree_Processing_Data) is Sources : constant Variable_Value := Util.Value_Of (Name_Source_Files, ! Project.Project.Decl.Attributes, ! Data.Tree); Source_List_File : constant Variable_Value := Util.Value_Of --- 6119,6132 ---- ------------------ procedure Find_Sources ! (Project : in out Project_Processing_Data; ! Data : in out Tree_Processing_Data) is Sources : constant Variable_Value := Util.Value_Of (Name_Source_Files, ! Project.Project.Decl.Attributes, ! Data.Tree); Source_List_File : constant Variable_Value := Util.Value_Of *************** package body Prj.Nmsc is *** 6345,6355 **** (Name => Name, Location => Location, Source => No_Source, Found => False); ! Source_Names_Htable.Set ! (Project.Source_Names, Name, Name_Loc); end if; Current := Element.Next; end loop; --- 6222,6237 ---- (Name => Name, Location => Location, Source => No_Source, + Listed => True, Found => False); ! ! else ! Name_Loc.Listed := True; end if; + Source_Names_Htable.Set + (Project.Source_Names, Name, Name_Loc); + Current := Element.Next; end loop; *************** package body Prj.Nmsc is *** 6396,6401 **** --- 6278,6334 ---- Has_Explicit_Sources := False; end if; + -- Remove any exception that is not in the specified list of sources + + if Has_Explicit_Sources then + declare + Source : Source_Id; + Iter : Source_Iterator; + NL : Name_Location; + Again : Boolean; + begin + Iter_Loop : + loop + Again := False; + Iter := For_Each_Source (Data.Tree, Project.Project); + + Source_Loop : + loop + Source := Prj.Element (Iter); + exit Source_Loop when Source = No_Source; + + if Source.Naming_Exception then + NL := Source_Names_Htable.Get + (Project.Source_Names, Source.File); + + if NL /= No_Name_Location and then not NL.Listed then + -- Remove the exception + Source_Names_Htable.Set + (Project.Source_Names, + Source.File, + No_Name_Location); + Remove_Source (Data.Tree, Source, No_Source); + + Error_Msg_Name_1 := Name_Id (Source.File); + Error_Msg + (Data.Flags, + "? unknown source file %%", + NL.Location, + Project.Project); + + Again := True; + exit Source_Loop; + end if; + end if; + + Next (Iter); + end loop Source_Loop; + + exit Iter_Loop when not Again; + end loop Iter_Loop; + end; + end if; + Search_Directories (Project, Data => Data, *************** package body Prj.Nmsc is *** 6406,6411 **** --- 6339,6346 ---- declare Source : Source_Id; Iter : Source_Iterator; + Found : Boolean := False; + Path : Path_Information; begin Iter := For_Each_Source (Data.Tree, Project.Project); *************** package body Prj.Nmsc is *** 6417,6442 **** and then Source.Path = No_Path_Information then if Source.Unit /= No_Unit_Index then -- For multi-unit source files, source_id gets duplicated -- once for every unit. Only the first source_id got its ! -- full path set. So if it isn't set for that first one, ! -- the file wasn't found. Otherwise we need to update for ! -- units after the first one. ! if Source.Index = 0 ! or else Source.Index = 1 ! then Error_Msg_Name_1 := Name_Id (Source.Display_File); ! Error_Msg_Name_2 := Name_Id (Source.Unit.Name); ! Error_Msg ! (Data.Flags, "source file %% for unit %% not found", No_Location, Project.Project); else ! Source.Path := Files_Htable.Get ! (Data.File_To_Source, Source.File).Path; if Current_Verbosity = High then if Source.Path /= No_Path_Information then --- 6352,6382 ---- and then Source.Path = No_Path_Information then if Source.Unit /= No_Unit_Index then + Found := False; -- For multi-unit source files, source_id gets duplicated -- once for every unit. Only the first source_id got its ! -- full path set. ! if Source.Index /= 0 then ! Path := Files_Htable.Get ! (Data.File_To_Source, Source.File).Path; ! ! if Path /= No_Path_Information then ! Found := True; ! end if; ! end if; ! ! if not Found then Error_Msg_Name_1 := Name_Id (Source.Display_File); ! Error_Msg_Name_2 := Source.Unit.Name; ! Error_Or_Warning ! (Data.Flags, Data.Flags.Missing_Source_Files, "source file %% for unit %% not found", No_Location, Project.Project); else ! Source.Path := Path; if Current_Verbosity = High then if Source.Path /= No_Path_Information then *************** package body Prj.Nmsc is *** 6444,6457 **** & Get_Name_String (Source.File) & " at" & Source.Index'Img & " to " ! & Get_Name_String (Source.Path.Name)); end if; end if; end if; end if; if Source.Path = No_Path_Information then ! Remove_Source (Source, No_Source); end if; end if; --- 6384,6397 ---- & Get_Name_String (Source.File) & " at" & Source.Index'Img & " to " ! & Get_Name_String (Path.Name)); end if; end if; end if; end if; if Source.Path = No_Path_Information then ! Remove_Source (Data.Tree, Source, No_Source); end if; end if; *************** package body Prj.Nmsc is *** 6473,6489 **** while NL /= No_Name_Location loop if not NL.Found then Err_Vars.Error_Msg_File_1 := NL.Name; - if First_Error then ! Error_Msg ! (Data.Flags, "source file { not found", NL.Location, Project.Project); First_Error := False; - else ! Error_Msg ! (Data.Flags, "\source file { not found", NL.Location, Project.Project); end if; --- 6413,6427 ---- while NL /= No_Name_Location loop if not NL.Found then Err_Vars.Error_Msg_File_1 := NL.Name; if First_Error then ! Error_Or_Warning ! (Data.Flags, Data.Flags.Missing_Source_Files, "source file { not found", NL.Location, Project.Project); First_Error := False; else ! Error_Or_Warning ! (Data.Flags, Data.Flags.Missing_Source_Files, "\source file { not found", NL.Location, Project.Project); end if; *************** package body Prj.Nmsc is *** 6500,6513 **** ---------------- procedure Initialize ! (Data : out Tree_Processing_Data; ! Tree : Project_Tree_Ref; ! Flags : Prj.Processing_Flags) is begin Files_Htable.Reset (Data.File_To_Source); ! Data.Tree := Tree; ! Data.Flags := Flags; end Initialize; ---------- --- 6438,6453 ---- ---------------- procedure Initialize ! (Data : out Tree_Processing_Data; ! Tree : Project_Tree_Ref; ! Node_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Flags : Prj.Processing_Flags) is begin Files_Htable.Reset (Data.File_To_Source); ! Data.Tree := Tree; ! Data.Node_Tree := Node_Tree; ! Data.Flags := Flags; end Initialize; ---------- *************** package body Prj.Nmsc is *** 6721,6735 **** Data : in out Tree_Processing_Data; Source_Dir_Rank : Natural; Path : Path_Name_Type; File_Name : File_Name_Type; Display_File_Name : File_Name_Type; Locally_Removed : Boolean; For_All_Sources : Boolean) is - Canonical_Path : constant Path_Name_Type := - Path_Name_Type - (Canonical_Case_File_Name (Name_Id (Path))); - Name_Loc : Name_Location := Source_Names_Htable.Get (Project.Source_Names, File_Name); --- 6661,6672 ---- Data : in out Tree_Processing_Data; Source_Dir_Rank : Natural; Path : Path_Name_Type; + Display_Path : Path_Name_Type; File_Name : File_Name_Type; Display_File_Name : File_Name_Type; Locally_Removed : Boolean; For_All_Sources : Boolean) is Name_Loc : Name_Location := Source_Names_Htable.Get (Project.Source_Names, File_Name); *************** package body Prj.Nmsc is *** 6779,6789 **** Check_Name := True; else ! Name_Loc.Source.Path := (Canonical_Path, Path); Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, ! Canonical_Path, Name_Loc.Source); -- Check if this is a subunit --- 6716,6726 ---- Check_Name := True; else ! Name_Loc.Source.Path := (Path, Display_Path); Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, ! Path, Name_Loc.Source); -- Check if this is a subunit *************** package body Prj.Nmsc is *** 6792,6798 **** and then Name_Loc.Source.Kind = Impl then Src_Ind := Sinput.P.Load_Project_File ! (Get_Name_String (Canonical_Path)); if Sinput.P.Source_File_Is_Subunit (Src_Ind) then Override_Kind (Name_Loc.Source, Sep); --- 6729,6735 ---- and then Name_Loc.Source.Kind = Impl then Src_Ind := Sinput.P.Load_Project_File ! (Get_Name_String (Display_Path)); if Sinput.P.Source_File_Is_Subunit (Src_Ind) then Override_Kind (Name_Loc.Source, Sep); *************** package body Prj.Nmsc is *** 6844,6850 **** Display_File => Display_File_Name, Unit => Unit, Locally_Removed => Locally_Removed, ! Path => (Canonical_Path, Path)); -- If it is a source specified in a list, update the entry in -- the Source_Names table. --- 6781,6787 ---- Display_File => Display_File_Name, Unit => Unit, Locally_Removed => Locally_Removed, ! Path => (Path, Display_Path)); -- If it is a source specified in a list, update the entry in -- the Source_Names table. *************** package body Prj.Nmsc is *** 6858,6863 **** --- 6795,7132 ---- end if; end Check_File; + --------------------------------- + -- Expand_Subdirectory_Pattern -- + --------------------------------- + + procedure Expand_Subdirectory_Pattern + (Project : Project_Id; + Data : in out Tree_Processing_Data; + Patterns : String_List_Id; + Ignore : String_List_Id; + Search_For : Search_Type; + Resolve_Links : Boolean) + is + package Recursive_Dirs is new GNAT.Dynamic_HTables.Simple_HTable + (Header_Num => Header_Num, + Element => Boolean, + No_Element => False, + Key => Path_Name_Type, + Hash => Hash, + Equal => "="); + -- Hash table stores recursive source directories, to avoid looking + -- several times, and to avoid cycles that may be introduced by symbolic + -- links. + + File_Pattern : GNAT.Regexp.Regexp; + -- Pattern to use when matching file names. + + Visited : Recursive_Dirs.Instance; + + procedure Find_Pattern + (Pattern_Id : Name_Id; + Rank : Natural; + Location : Source_Ptr); + -- Find a specific pattern + + function Recursive_Find_Dirs + (Path : Path_Information; + Rank : Natural) return Boolean; + -- Search all the subdirectories (recursively) of Path. + -- Return True if at least one file or directory was processed + + function Subdirectory_Matches + (Path : Path_Information; + Rank : Natural) return Boolean; + -- Called when a matching directory was found. If the user is in fact + -- searching for files, we then search for those files matching the + -- pattern within the directory. + -- Return True if at least one file or directory was processed + + -------------------------- + -- Subdirectory_Matches -- + -------------------------- + + function Subdirectory_Matches + (Path : Path_Information; + Rank : Natural) return Boolean + is + Dir : Dir_Type; + Name : String (1 .. 250); + Last : Natural; + Found : Path_Information; + Success : Boolean := False; + + begin + case Search_For is + when Search_Directories => + Callback (Path, Rank); + return True; + + when Search_Files => + Open (Dir, Get_Name_String (Path.Display_Name)); + loop + Read (Dir, Name, Last); + exit when Last = 0; + + if Name (Name'First .. Last) /= "." + and then Name (Name'First .. Last) /= ".." + and then Match (Name (Name'First .. Last), File_Pattern) + then + Get_Name_String (Path.Display_Name); + Add_Str_To_Name_Buffer (Name (Name'First .. Last)); + + Found.Display_Name := Name_Find; + Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); + Found.Name := Name_Find; + + Callback (Found, Rank); + Success := True; + end if; + end loop; + + Close (Dir); + + return Success; + end case; + end Subdirectory_Matches; + + ------------------------- + -- Recursive_Find_Dirs -- + ------------------------- + + function Recursive_Find_Dirs + (Path : Path_Information; + Rank : Natural) return Boolean + is + Path_Str : constant String := Get_Name_String (Path.Display_Name); + Dir : Dir_Type; + Name : String (1 .. 250); + Last : Natural; + Success : Boolean := False; + + begin + if Current_Verbosity = High then + Write_Str (" Looking for subdirs of """); + Write_Str (Path_Str); + Write_Line (""""); + end if; + + if Recursive_Dirs.Get (Visited, Path.Name) then + return Success; + end if; + + Recursive_Dirs.Set (Visited, Path.Name, True); + + Success := Subdirectory_Matches (Path, Rank) or Success; + + Open (Dir, Path_Str); + + loop + Read (Dir, Name, Last); + exit when Last = 0; + + if Name (1 .. Last) /= "." + and then Name (1 .. Last) /= ".." + then + declare + Path_Name : constant String := + Normalize_Pathname + (Name => Name (1 .. Last), + Directory => Path_Str, + Resolve_Links => Resolve_Links) + & Directory_Separator; + Path2 : Path_Information; + OK : Boolean := True; + + begin + if Is_Directory (Path_Name) then + if Ignore /= Nil_String then + declare + Dir_Name : String := Name (1 .. Last); + List : String_List_Id := Ignore; + + begin + Canonical_Case_File_Name (Dir_Name); + + while List /= Nil_String loop + Get_Name_String + (Data.Tree.String_Elements.Table (List).Value); + Canonical_Case_File_Name + (Name_Buffer (1 .. Name_Len)); + OK := Name_Buffer (1 .. Name_Len) /= Dir_Name; + exit when not OK; + List := + Data.Tree.String_Elements.Table (List).Next; + end loop; + end; + end if; + + if OK then + Name_Len := 0; + Add_Str_To_Name_Buffer (Path_Name); + Path2.Display_Name := Name_Find; + + Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); + Path2.Name := Name_Find; + + Success := + Recursive_Find_Dirs (Path2, Rank) or Success; + end if; + end if; + end; + end if; + end loop; + + Close (Dir); + + return Success; + + exception + when Directory_Error => + return Success; + end Recursive_Find_Dirs; + + ------------------ + -- Find_Pattern -- + ------------------ + + procedure Find_Pattern + (Pattern_Id : Name_Id; + Rank : Natural; + Location : Source_Ptr) + is + Pattern : constant String := Get_Name_String (Pattern_Id); + Pattern_End : Natural := Pattern'Last; + Recursive : Boolean; + Dir : File_Name_Type; + Path_Name : Path_Information; + Dir_Exists : Boolean; + Has_Error : Boolean := False; + Success : Boolean; + + begin + if Current_Verbosity = High then + Write_Str ("Expand_Subdirectory_Pattern ("""); + Write_Str (Pattern); + Write_Line (""")"); + end if; + + -- If we are looking for files, find the pattern for the files + + if Search_For = Search_Files then + while Pattern_End >= Pattern'First + and then Pattern (Pattern_End) /= '/' + and then Pattern (Pattern_End) /= Directory_Separator + loop + Pattern_End := Pattern_End - 1; + end loop; + + if Pattern_End = Pattern'Last then + Err_Vars.Error_Msg_File_1 := File_Name_Type (Pattern_Id); + Error_Or_Warning + (Data.Flags, Data.Flags.Missing_Source_Files, + "Missing file name or pattern in {", Location, Project); + return; + end if; + + if Current_Verbosity = High then + Write_Str (" file pattern="); + Write_Line (Pattern (Pattern_End + 1 .. Pattern'Last)); + Write_Str (" Expand directory pattern="); + Write_Line (Pattern (Pattern'First .. Pattern_End)); + end if; + + File_Pattern := Compile + (Pattern (Pattern_End + 1 .. Pattern'Last), + Glob => True, + Case_Sensitive => File_Names_Case_Sensitive); + + -- If we had just "*.gpr", this is equivalent to "./*.gpr" + + if Pattern_End > Pattern'First then + Pattern_End := Pattern_End - 1; -- Skip directory separator + end if; + end if; + + Recursive := + Pattern_End - 1 >= Pattern'First + and then Pattern (Pattern_End - 1 .. Pattern_End) = "**" + and then (Pattern_End - 1 = Pattern'First + or else Pattern (Pattern_End - 2) = '/' + or else Pattern (Pattern_End - 2) = Directory_Separator); + + if Recursive then + Pattern_End := Pattern_End - 2; + if Pattern_End > Pattern'First then + Pattern_End := Pattern_End - 1; -- Skip '/' + end if; + end if; + + Name_Len := Pattern_End - Pattern'First + 1; + Name_Buffer (1 .. Name_Len) := Pattern (Pattern'First .. Pattern_End); + Dir := Name_Find; + + Locate_Directory + (Project => Project, + Name => Dir, + Path => Path_Name, + Dir_Exists => Dir_Exists, + Data => Data, + Must_Exist => False); + + if not Dir_Exists then + Err_Vars.Error_Msg_File_1 := Dir; + Error_Or_Warning + (Data.Flags, Data.Flags.Missing_Source_Files, + "{ is not a valid directory", Location, Project); + Has_Error := Data.Flags.Missing_Source_Files = Error; + end if; + + if not Has_Error then + -- Links have been resolved if necessary, and Path_Name + -- always ends with a directory separator. + + if Recursive then + Success := Recursive_Find_Dirs (Path_Name, Rank); + else + Success := Subdirectory_Matches (Path_Name, Rank); + end if; + + if not Success then + case Search_For is + when Search_Directories => + null; -- Error can't occur + + when Search_Files => + Err_Vars.Error_Msg_File_1 := File_Name_Type (Pattern_Id); + Error_Or_Warning + (Data.Flags, Data.Flags.Missing_Source_Files, + "file { not found", Location, Project); + end case; + end if; + end if; + end Find_Pattern; + + -- Local variables + + Pattern_Id : String_List_Id := Patterns; + Element : String_Element; + Rank : Natural := 1; + + -- Start of processing for Expand_Subdirectory_Pattern + + begin + while Pattern_Id /= Nil_String loop + Element := Data.Tree.String_Elements.Table (Pattern_Id); + Find_Pattern (Element.Value, Rank, Element.Location); + Rank := Rank + 1; + Pattern_Id := Element.Next; + end loop; + + Recursive_Dirs.Reset (Visited); + end Expand_Subdirectory_Pattern; + ------------------------ -- Search_Directories -- ------------------------ *************** package body Prj.Nmsc is *** 6891,6922 **** Num_Nod := Data.Tree.Number_Lists.Table (Src_Dir_Rank); Element := Data.Tree.String_Elements.Table (Source_Dir); ! if Element.Value /= No_Name then ! Get_Name_String (Element.Display_Value); ! ! if Current_Verbosity = High then ! Write_Str ("Directory: "); ! Write_Str (Name_Buffer (1 .. Name_Len)); ! Write_Line (Num_Nod.Number'Img); ! end if; declare Source_Directory : constant String := ! Name_Buffer (1 .. Name_Len) & ! Directory_Separator; Dir_Last : constant Natural := ! Compute_Directory_Last ! (Source_Directory); begin if Current_Verbosity = High then ! Write_Attr ("Source_Dir", Source_Directory); end if; -- We look to every entry in the source directory ! Open (Dir, Source_Directory); loop Read (Dir, Name, Last); --- 7160,7195 ---- Num_Nod := Data.Tree.Number_Lists.Table (Src_Dir_Rank); Element := Data.Tree.String_Elements.Table (Source_Dir); ! -- Use Element.Value in this test, not Display_Value, because we ! -- want the symbolic links to be resolved when appropriate. + if Element.Value /= No_Name then declare Source_Directory : constant String := ! Get_Name_String (Element.Value) ! & Directory_Separator; Dir_Last : constant Natural := ! Compute_Directory_Last (Source_Directory); ! ! Display_Source_Directory : constant String := ! Get_Name_String ! (Element.Display_Value) ! & Directory_Separator; ! -- Display_Source_Directory is to allow us to open a UTF-8 ! -- encoded directory on Windows. begin if Current_Verbosity = High then ! Write_Attr ! ("Source_Dir", ! Source_Directory (Source_Directory'First .. Dir_Last)); ! Write_Line (Num_Nod.Number'Img); end if; -- We look to every entry in the source directory ! Open (Dir, Display_Source_Directory); loop Read (Dir, Name, Last); *************** package body Prj.Nmsc is *** 6931,6937 **** if not Opt.Follow_Links_For_Files or else Is_Regular_File ! (Source_Directory & Name (1 .. Last)) then if Current_Verbosity = High then Write_Str (" Checking "); --- 7204,7210 ---- if not Opt.Follow_Links_For_Files or else Is_Regular_File ! (Display_Source_Directory & Name (1 .. Last)) then if Current_Verbosity = High then Write_Str (" Checking "); *************** package body Prj.Nmsc is *** 6961,6977 **** Resolve_Links => Opt.Follow_Links_For_Files, Case_Sensitive => True); - -- Case_Sensitive set True (no folding) ! Path : Path_Name_Type; ! FF : File_Found := Excluded_Sources_Htable.Get ! (Project.Excluded, File_Name); To_Remove : Boolean := False; begin Name_Len := Path_Name'Length; Name_Buffer (1 .. Name_Len) := Path_Name; ! Path := Name_Find; if FF /= No_File_Found then if not FF.Found then --- 7234,7257 ---- Resolve_Links => Opt.Follow_Links_For_Files, Case_Sensitive => True); ! Path : Path_Name_Type; ! FF : File_Found := ! Excluded_Sources_Htable.Get ! (Project.Excluded, File_Name); To_Remove : Boolean := False; begin Name_Len := Path_Name'Length; Name_Buffer (1 .. Name_Len) := Path_Name; ! ! if Osint.File_Names_Case_Sensitive then ! Path := Name_Find; ! else ! Canonical_Case_File_Name ! (Name_Buffer (1 .. Name_Len)); ! Path := Name_Find; ! end if; if FF /= No_File_Found then if not FF.Found then *************** package body Prj.Nmsc is *** 6981,6987 **** if Current_Verbosity = High then Write_Str (" excluded source """); ! Write_Str (Get_Name_String (File_Name)); Write_Line (""""); end if; --- 7261,7268 ---- if Current_Verbosity = High then Write_Str (" excluded source """); ! Write_Str ! (Get_Name_String (Display_File_Name)); Write_Line (""""); end if; *************** package body Prj.Nmsc is *** 6995,7005 **** --- 7276,7295 ---- end if; end if; + -- Preserve the user's original casing and use of + -- links. The display_value (a directory) already + -- ends with a directory separator by construction, + -- so no need to add one. + + Get_Name_String (Element.Display_Value); + Get_Name_String_And_Append (Display_File_Name); + Check_File (Project => Project, Source_Dir_Rank => Num_Nod.Number, Data => Data, Path => Path, + Display_Path => Name_Find, File_Name => File_Name, Locally_Removed => To_Remove, Display_File_Name => Display_File_Name, *************** package body Prj.Nmsc is *** 7066,7073 **** K => Source.File, E => Name_Location' (Name => Source.File, ! Location => No_Location, Source => Source, Found => False)); -- If this is an Ada exception, record in table Unit_Exceptions --- 7356,7364 ---- K => Source.File, E => Name_Location' (Name => Source.File, ! Location => Source.Location, Source => Source, + Listed => False, Found => False)); -- If this is an Ada exception, record in table Unit_Exceptions *************** package body Prj.Nmsc is *** 7105,7112 **** Data : in out Tree_Processing_Data) is Object_Files : Object_File_Names_Htable.Instance; ! Iter : Source_Iterator; ! Src : Source_Id; procedure Check_Object (Src : Source_Id); -- Check if object file name of Src is already used in the project tree, --- 7396,7403 ---- Data : in out Tree_Processing_Data) is Object_Files : Object_File_Names_Htable.Instance; ! Iter : Source_Iterator; ! Src : Source_Id; procedure Check_Object (Src : Source_Id); -- Check if object file name of Src is already used in the project tree, *************** package body Prj.Nmsc is *** 7118,7123 **** --- 7409,7480 ---- procedure Mark_Excluded_Sources; -- Mark as such the sources that are declared as excluded + procedure Check_Missing_Sources; + -- Check whether one of the languages has no sources, and report an + -- error when appropriate + + procedure Get_Sources_From_Source_Info; + -- Get the source information from the tables that were created when a + -- source info fie was read. + + --------------------------- + -- Check_Missing_Sources -- + --------------------------- + + procedure Check_Missing_Sources is + Extending : constant Boolean := + Project.Project.Extends /= No_Project; + Language : Language_Ptr; + Source : Source_Id; + Alt_Lang : Language_List; + Continuation : Boolean := False; + Iter : Source_Iterator; + begin + if not Project.Project.Externally_Built + and then not Extending + then + Language := Project.Project.Languages; + while Language /= No_Language_Index loop + + -- If there are no sources for this language, check if there + -- are sources for which this is an alternate language. + + if Language.First_Source = No_Source + and then (Data.Flags.Require_Sources_Other_Lang + or else Language.Name = Name_Ada) + then + Iter := For_Each_Source (In_Tree => Data.Tree, + Project => Project.Project); + Source_Loop : loop + Source := Element (Iter); + exit Source_Loop when Source = No_Source + or else Source.Language = Language; + + Alt_Lang := Source.Alternate_Languages; + while Alt_Lang /= null loop + exit Source_Loop when Alt_Lang.Language = Language; + Alt_Lang := Alt_Lang.Next; + end loop; + + Next (Iter); + end loop Source_Loop; + + if Source = No_Source then + Report_No_Sources + (Project.Project, + Get_Name_String (Language.Display_Name), + Data, + Project.Source_List_File_Location, + Continuation); + Continuation := True; + end if; + end if; + + Language := Language.Next; + end loop; + end if; + end Check_Missing_Sources; + ------------------ -- Check_Object -- ------------------ *************** package body Prj.Nmsc is *** 7273,7279 **** Src_Ind := Sinput.P.Load_Project_File ! (Get_Name_String (Src_Id.Path.Name)); if Sinput.P.Source_File_Is_Subunit (Src_Ind) then Override_Kind (Src_Id, Sep); --- 7630,7636 ---- Src_Ind := Sinput.P.Load_Project_File ! (Get_Name_String (Src_Id.Path.Display_Name)); if Sinput.P.Source_File_Is_Subunit (Src_Ind) then Override_Kind (Src_Id, Sep); *************** package body Prj.Nmsc is *** 7289,7307 **** end loop; end Check_Object_Files; -- Start of processing for Look_For_Sources begin ! Find_Excluded_Sources (Project, Data); ! if Project.Project.Languages /= No_Language_Index then ! Load_Naming_Exceptions (Project, Data); ! Find_Sources (Project, Data); ! Mark_Excluded_Sources; ! Check_Object_Files; ! end if; ! Object_File_Names_Htable.Reset (Object_Files); end Look_For_Sources; ------------------ --- 7646,7780 ---- end loop; end Check_Object_Files; + ---------------------------------- + -- Get_Sources_From_Source_Info -- + ---------------------------------- + + procedure Get_Sources_From_Source_Info is + Iter : Source_Info_Iterator; + Src : Source_Info; + Id : Source_Id; + Lang_Id : Language_Ptr; + begin + Initialize (Iter, Project.Project.Name); + + loop + Src := Source_Info_Of (Iter); + + exit when Src = No_Source_Info; + + Id := new Source_Data; + + Id.Project := Project.Project; + + Lang_Id := Project.Project.Languages; + while Lang_Id /= No_Language_Index and then + Lang_Id.Name /= Src.Language + loop + Lang_Id := Lang_Id.Next; + end loop; + + if Lang_Id = No_Language_Index then + Prj.Com.Fail + ("unknown language " & + Get_Name_String (Src.Language) & + " for project " & + Get_Name_String (Src.Project) & + " in source info file"); + end if; + + Id.Language := Lang_Id; + Id.Kind := Src.Kind; + + Id.Index := Src.Index; + + Id.Path := + (Path_Name_Type (Src.Display_Path_Name), + Path_Name_Type (Src.Path_Name)); + + Name_Len := 0; + Add_Str_To_Name_Buffer + (Ada.Directories.Simple_Name + (Get_Name_String (Src.Path_Name))); + Id.File := Name_Find; + + Id.Next_With_File_Name := + Source_Files_Htable.Get (Data.Tree.Source_Files_HT, Id.File); + Source_Files_Htable.Set (Data.Tree.Source_Files_HT, Id.File, Id); + + Name_Len := 0; + Add_Str_To_Name_Buffer + (Ada.Directories.Simple_Name + (Get_Name_String (Src.Display_Path_Name))); + Id.Display_File := Name_Find; + + Id.Dep_Name := Dependency_Name + (Id.File, Id.Language.Config.Dependency_Kind); + Id.Naming_Exception := Src.Naming_Exception; + Id.Object := Object_Name + (Id.File, Id.Language.Config.Object_File_Suffix); + Id.Switches := Switches_Name (Id.File); + + -- Add the source id to the Unit_Sources_HT hash table, if the + -- unit name is not null. + + if Src.Kind /= Sep and then Src.Unit_Name /= No_Name then + + declare + UData : Unit_Index := + Units_Htable.Get (Data.Tree.Units_HT, Src.Unit_Name); + begin + if UData = No_Unit_Index then + UData := new Unit_Data; + UData.Name := Src.Unit_Name; + Units_Htable.Set + (Data.Tree.Units_HT, Src.Unit_Name, UData); + end if; + + Id.Unit := UData; + end; + + -- Note that this updates Unit information as well + + Override_Kind (Id, Id.Kind); + end if; + + if Src.Index /= 0 then + Project.Project.Has_Multi_Unit_Sources := True; + end if; + + -- Add the source to the language list + + Id.Next_In_Lang := Id.Language.First_Source; + Id.Language.First_Source := Id; + + Files_Htable.Set (Data.File_To_Source, Id.File, Id); + + Next (Iter); + end loop; + end Get_Sources_From_Source_Info; + -- Start of processing for Look_For_Sources begin ! if Data.Tree.Source_Info_File_Exists then ! Get_Sources_From_Source_Info; ! else ! if Project.Project.Source_Dirs /= Nil_String then ! Find_Excluded_Sources (Project, Data); ! if Project.Project.Languages /= No_Language_Index then ! Load_Naming_Exceptions (Project, Data); ! Find_Sources (Project, Data); ! Mark_Excluded_Sources; ! Check_Object_Files; ! Check_Missing_Sources; ! end if; ! end if; ! ! Object_File_Names_Htable.Reset (Object_Files); ! end if; end Look_For_Sources; ------------------ *************** package body Prj.Nmsc is *** 7340,7346 **** ------------------- procedure Remove_Source ! (Id : Source_Id; Replaced_By : Source_Id) is Source : Source_Id; --- 7813,7820 ---- ------------------- procedure Remove_Source ! (Tree : Project_Tree_Ref; ! Id : Source_Id; Replaced_By : Source_Id) is Source : Source_Id; *************** package body Prj.Nmsc is *** 7360,7365 **** --- 7834,7856 ---- if Replaced_By /= No_Source then Id.Replaced_By := Replaced_By; Replaced_By.Declared_In_Interfaces := Id.Declared_In_Interfaces; + + if Id.File /= Replaced_By.File then + declare + Replacement : constant File_Name_Type := + Replaced_Source_HTable.Get + (Tree.Replaced_Sources, Id.File); + + begin + Replaced_Source_HTable.Set + (Tree.Replaced_Sources, Id.File, Replaced_By.File); + + if Replacement = No_File then + Tree.Replaced_Source_Number := + Tree.Replaced_Source_Number + 1; + end if; + end; + end if; end if; Id.In_Interfaces := False; *************** package body Prj.Nmsc is *** 7439,7445 **** while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Write_Str (" "); ! Write_Line (Get_Name_String (Element.Value)); Current := Element.Next; end loop; --- 7930,7936 ---- while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Write_Str (" "); ! Write_Line (Get_Name_String (Element.Display_Value)); Current := Element.Next; end loop; *************** package body Prj.Nmsc is *** 7453,7458 **** --- 7944,7950 ---- procedure Process_Naming_Scheme (Tree : Project_Tree_Ref; Root_Project : Project_Id; + Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Flags : Processing_Flags) is procedure Recursive_Check *************** package body Prj.Nmsc is *** 7485,7493 **** -- Start of processing for Process_Naming_Scheme begin ! Initialize (Data, Tree => Tree, Flags => Flags); Check_All_Projects (Root_Project, Data, Imported_First => True); Free (Data); end Process_Naming_Scheme; end Prj.Nmsc; --- 7977,8025 ---- -- Start of processing for Process_Naming_Scheme begin ! Lib_Data_Table.Init; ! Initialize (Data, Tree => Tree, Node_Tree => Node_Tree, Flags => Flags); Check_All_Projects (Root_Project, Data, Imported_First => True); Free (Data); + + -- Adjust language configs for projects that are extended + + declare + List : Project_List; + Proj : Project_Id; + Exte : Project_Id; + Lang : Language_Ptr; + Elng : Language_Ptr; + + begin + List := Tree.Projects; + while List /= null loop + Proj := List.Project; + Exte := Proj; + while Exte.Extended_By /= No_Project loop + Exte := Exte.Extended_By; + end loop; + + if Exte /= Proj then + Lang := Proj.Languages; + + if Lang /= No_Language_Index then + loop + Elng := Get_Language_From_Name + (Exte, Get_Name_String (Lang.Name)); + exit when Elng /= No_Language_Index; + Exte := Exte.Extends; + end loop; + + if Elng /= Lang then + Lang.Config := Elng.Config; + end if; + end if; + end if; + + List := List.Next; + end loop; + end; end Process_Naming_Scheme; end Prj.Nmsc; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-nmsc.ads gcc-4.6.0/gcc/ada/prj-nmsc.ads *** gcc-4.5.2/gcc/ada/prj-nmsc.ads Thu Sep 17 10:38:31 2009 --- gcc-4.6.0/gcc/ada/prj-nmsc.ads Tue Oct 5 09:26:00 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2000-2010, 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,35 **** --- 25,38 ---- -- Find source dirs and source files for a project + with Prj.Tree; + private package Prj.Nmsc is procedure Process_Naming_Scheme (Tree : Project_Tree_Ref; Root_Project : Project_Id; + Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Flags : Processing_Flags); -- Perform consistency and semantic checks on all the projects in the tree. -- This procedure interprets the various case statements in the project diff -Nrcpad gcc-4.5.2/gcc/ada/prj-part.adb gcc-4.6.0/gcc/ada/prj-part.adb *** gcc-4.5.2/gcc/ada/prj-part.adb Mon Nov 30 13:36:29 2009 --- gcc-4.6.0/gcc/ada/prj-part.adb Tue Oct 5 10:14:50 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Osint; use Osint; *** 29,47 **** with Output; use Output; with Prj.Com; use Prj.Com; with Prj.Dect; with Prj.Err; use Prj.Err; - with Prj.Ext; use Prj.Ext; with Sinput; use Sinput; with Sinput.P; use Sinput.P; with Snames; with Table; ! with Ada.Characters.Handling; use Ada.Characters.Handling; ! with Ada.Exceptions; use Ada.Exceptions; ! ! with GNAT.Directory_Operations; use GNAT.Directory_Operations; ! with System.HTable; use System.HTable; package body Prj.Part is --- 29,45 ---- with Output; use Output; with Prj.Com; use Prj.Com; with Prj.Dect; + with Prj.Env; use Prj.Env; with Prj.Err; use Prj.Err; with Sinput; use Sinput; with Sinput.P; use Sinput.P; with Snames; with Table; ! with Ada.Characters.Handling; use Ada.Characters.Handling; ! with Ada.Exceptions; use Ada.Exceptions; ! with GNAT.HTable; use GNAT.HTable; package body Prj.Part is *************** package body Prj.Part is *** 98,104 **** -- limited imported projects when there is a circularity with at least -- one limited imported project file. ! package Virtual_Hash is new System.HTable.Simple_HTable (Header_Num => Header_Num, Element => Project_Node_Id, No_Element => Empty_Node, --- 96,102 ---- -- limited imported projects when there is a circularity with at least -- one limited imported project file. ! package Virtual_Hash is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Project_Node_Id, No_Element => Empty_Node, *************** package body Prj.Part is *** 108,114 **** -- Hash table to store the node id of the project for which a virtual -- extending project need to be created. ! package Processed_Hash is new System.HTable.Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, --- 106,112 ---- -- Hash table to store the node id of the project for which a virtual -- extending project need to be created. ! package Processed_Hash is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, *************** package body Prj.Part is *** 119,133 **** -- need to have a virtual extending project, to avoid processing the same -- project twice. ! package Projects_Paths is new System.HTable.Simple_HTable ! (Header_Num => Header_Num, ! Element => Path_Name_Type, ! No_Element => No_Path, ! Key => Name_Id, ! Hash => Hash, ! Equal => "="); -- Hash table to cache project path to avoid looking for them on the path procedure Create_Virtual_Extending_Project (For_Project : Project_Node_Id; Main_Project : Project_Node_Id; --- 117,152 ---- -- need to have a virtual extending project, to avoid processing the same -- project twice. ! function Has_Circular_Dependencies ! (Flags : Processing_Flags; ! Normed_Path_Name : Path_Name_Type; ! Canonical_Path_Name : Path_Name_Type) return Boolean; ! -- Check for a circular dependency in the loaded project. ! -- Generates an error message in such a case. ! ! procedure Read_Project_Qualifier ! (Flags : Processing_Flags; ! In_Tree : Project_Node_Tree_Ref; ! Is_Config_File : Boolean; ! Qualifier_Location : out Source_Ptr; ! Project : Project_Node_Id); ! -- Check if there is a qualifier before the reserved word "project" ! -- Hash table to cache project path to avoid looking for them on the path + procedure Check_Extending_All_Imports + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id); + -- Check that a non extending-all project does not import an + -- extending-all project. + + procedure Check_Aggregate_Imports + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id); + -- Check that an aggregate project only imports abstract projects + procedure Create_Virtual_Extending_Project (For_Project : Project_Node_Id; Main_Project : Project_Node_Id; *************** package body Prj.Part is *** 158,164 **** (In_Tree : Project_Node_Tree_Ref; Project : out Project_Node_Id; Extends_All : out Boolean; ! Path_Name : String; Extended : Boolean; From_Extended : Extension_Origin; In_Limited : Boolean; --- 177,183 ---- (In_Tree : Project_Node_Tree_Ref; Project : out Project_Node_Id; Extends_All : out Boolean; ! Path_Name_Id : Path_Name_Type; Extended : Boolean; From_Extended : Extension_Origin; In_Limited : Boolean; *************** package body Prj.Part is *** 211,223 **** -- Is_Config_File should be set to True if the project represents a config -- file (.cgpr) since some specific checks apply. - function Project_Path_Name_Of - (In_Tree : Project_Node_Tree_Ref; - Project_File_Name : String; - Directory : String) return String; - -- Returns the path name of a project file. Returns an empty string - -- if project file cannot be found. - function Project_Name_From (Path_Name : String; Is_Config_File : Boolean) return Name_Id; --- 230,235 ---- *************** package body Prj.Part is *** 444,449 **** --- 456,462 ---- Real_Project_File_Name : String_Access := Osint.To_Canonical_File_Spec (Project_File_Name); + Path_Name_Id : Path_Name_Type; begin if Real_Project_File_Name = null then *************** package body Prj.Part is *** 452,604 **** Project := Empty_Node; ! Projects_Paths.Reset; ! ! if Current_Verbosity >= Medium then ! Write_Str ("GPR_PROJECT_PATH="""); ! Write_Str (Project_Path (In_Tree)); ! Write_Line (""""); ! end if; ! ! declare ! Path_Name : constant String := ! Project_Path_Name_Of (In_Tree, ! Real_Project_File_Name.all, ! Directory => Current_Directory); ! ! begin ! Free (Real_Project_File_Name); ! ! Prj.Err.Initialize; ! Prj.Err.Scanner.Set_Comment_As_Token (Store_Comments); ! Prj.Err.Scanner.Set_End_Of_Line_As_Token (Store_Comments); ! -- Parse the main project file ! if Path_Name = "" then Prj.Com.Fail ("project file """ & Project_File_Name & """ not found in " ! & Project_Path (In_Tree)); Project := Empty_Node; return; ! end if; ! begin ! Parse_Single_Project ! (In_Tree => In_Tree, ! Project => Project, ! Extends_All => Dummy, ! Path_Name => Path_Name, ! Extended => False, ! From_Extended => None, ! In_Limited => False, ! Packages_To_Check => Packages_To_Check, ! Depth => 0, ! Current_Dir => Current_Directory, ! Is_Config_File => Is_Config_File, ! Flags => Flags); ! exception ! when Types.Unrecoverable_Error => ! -- Unrecoverable_Error is raised when a line is too long. ! -- A meaningful error message will be displayed later. ! Project := Empty_Node; ! end; ! -- If Project is an extending-all project, create the eventual ! -- virtual extending projects and check that there are no illegally ! -- imported projects. ! if Present (Project) ! and then Is_Extending_All (Project, In_Tree) ! then ! -- First look for projects that potentially need a virtual ! -- extending project. ! Virtual_Hash.Reset; ! Processed_Hash.Reset; ! -- Mark the extending all project as processed, to avoid checking ! -- the imported projects in case of a "limited with" on this ! -- extending all project. ! Processed_Hash.Set (Project, True); ! declare ! Declaration : constant Project_Node_Id := ! Project_Declaration_Of (Project, In_Tree); ! begin ! Look_For_Virtual_Projects_For ! (Extended_Project_Of (Declaration, In_Tree), In_Tree, ! Potentially_Virtual => False); ! end; ! -- Now, check the projects directly imported by the main project. ! -- Remove from the potentially virtual any project extended by one ! -- of these imported projects. For non extending imported ! -- projects, check that they do not belong to the project tree of ! -- the project being "extended-all" by the main project. ! declare ! With_Clause : Project_Node_Id; ! Imported : Project_Node_Id := Empty_Node; ! Declaration : Project_Node_Id := Empty_Node; ! begin ! With_Clause := First_With_Clause_Of (Project, In_Tree); ! while Present (With_Clause) loop ! Imported := Project_Node_Of (With_Clause, In_Tree); ! if Present (Imported) then ! Declaration := Project_Declaration_Of (Imported, In_Tree); ! if Extended_Project_Of (Declaration, In_Tree) /= ! Empty_Node ! then ! loop ! Imported := ! Extended_Project_Of (Declaration, In_Tree); ! exit when No (Imported); ! Virtual_Hash.Remove (Imported); ! Declaration := ! Project_Declaration_Of (Imported, In_Tree); ! end loop; ! end if; end if; ! With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); ! end loop; ! end; ! -- Now create all the virtual extending projects ! declare ! Proj : Project_Node_Id := Virtual_Hash.Get_First; ! begin ! while Present (Proj) loop ! Create_Virtual_Extending_Project (Proj, Project, In_Tree); ! Proj := Virtual_Hash.Get_Next; ! end loop; ! end; ! end if; ! -- If there were any kind of error during the parsing, serious ! -- or not, then the parsing fails. ! if Err_Vars.Total_Errors_Detected > 0 then ! Project := Empty_Node; ! end if; ! if No (Project) or else Always_Errout_Finalize then ! Prj.Err.Finalize; ! -- Reinitialize to avoid duplicate warnings later on ! Prj.Err.Initialize; ! end if; ! end; exception when X : others => --- 465,612 ---- Project := Empty_Node; ! Find_Project (In_Tree.Project_Path, ! Project_File_Name => Real_Project_File_Name.all, ! Directory => Current_Directory, ! Path => Path_Name_Id); ! Free (Real_Project_File_Name); ! Prj.Err.Initialize; ! Prj.Err.Scanner.Set_Comment_As_Token (Store_Comments); ! Prj.Err.Scanner.Set_End_Of_Line_As_Token (Store_Comments); ! if Path_Name_Id = No_Path then ! declare ! P : String_Access; ! begin ! Get_Path (In_Tree.Project_Path, Path => P); Prj.Com.Fail ("project file """ & Project_File_Name & """ not found in " ! & P.all); Project := Empty_Node; return; ! end; ! end if; ! -- Parse the main project file ! begin ! Parse_Single_Project ! (In_Tree => In_Tree, ! Project => Project, ! Extends_All => Dummy, ! Path_Name_Id => Path_Name_Id, ! Extended => False, ! From_Extended => None, ! In_Limited => False, ! Packages_To_Check => Packages_To_Check, ! Depth => 0, ! Current_Dir => Current_Directory, ! Is_Config_File => Is_Config_File, ! Flags => Flags); ! exception ! when Types.Unrecoverable_Error => ! -- Unrecoverable_Error is raised when a line is too long. ! -- A meaningful error message will be displayed later. ! Project := Empty_Node; ! end; ! -- If Project is an extending-all project, create the eventual ! -- virtual extending projects and check that there are no illegally ! -- imported projects. ! if Present (Project) ! and then Is_Extending_All (Project, In_Tree) ! then ! -- First look for projects that potentially need a virtual ! -- extending project. ! Virtual_Hash.Reset; ! Processed_Hash.Reset; ! -- Mark the extending all project as processed, to avoid checking ! -- the imported projects in case of a "limited with" on this ! -- extending all project. ! Processed_Hash.Set (Project, True); ! declare ! Declaration : constant Project_Node_Id := ! Project_Declaration_Of (Project, In_Tree); ! begin ! Look_For_Virtual_Projects_For ! (Extended_Project_Of (Declaration, In_Tree), In_Tree, ! Potentially_Virtual => False); ! end; ! -- Now, check the projects directly imported by the main project. ! -- Remove from the potentially virtual any project extended by one ! -- of these imported projects. For non extending imported projects, ! -- check that they do not belong to the project tree of the project ! -- being "extended-all" by the main project. ! declare ! With_Clause : Project_Node_Id; ! Imported : Project_Node_Id := Empty_Node; ! Declaration : Project_Node_Id := Empty_Node; ! ! begin ! With_Clause := First_With_Clause_Of (Project, In_Tree); ! while Present (With_Clause) loop ! Imported := Project_Node_Of (With_Clause, In_Tree); ! ! if Present (Imported) then ! Declaration := Project_Declaration_Of (Imported, In_Tree); ! ! if Extended_Project_Of (Declaration, In_Tree) /= ! Empty_Node ! then ! loop ! Imported := ! Extended_Project_Of (Declaration, In_Tree); ! exit when No (Imported); ! Virtual_Hash.Remove (Imported); ! Declaration := ! Project_Declaration_Of (Imported, In_Tree); ! end loop; end if; + end if; ! With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); ! end loop; ! end; ! -- Now create all the virtual extending projects ! declare ! Proj : Project_Node_Id := Virtual_Hash.Get_First; ! begin ! while Present (Proj) loop ! Create_Virtual_Extending_Project (Proj, Project, In_Tree); ! Proj := Virtual_Hash.Get_Next; ! end loop; ! end; ! end if; ! -- If there were any kind of error during the parsing, serious ! -- or not, then the parsing fails. ! if Err_Vars.Total_Errors_Detected > 0 then ! Project := Empty_Node; ! end if; ! if No (Project) or else Always_Errout_Finalize then ! Prj.Err.Finalize; ! -- Reinitialize to avoid duplicate warnings later on ! Prj.Err.Initialize; ! end if; exception when X : others => *************** package body Prj.Part is *** 741,746 **** --- 749,755 ---- Current_With : With_Record; Extends_All : Boolean := False; + Imported_Path_Name_Id : Path_Name_Type; begin -- Set Current_Project to the last project in the current list, if the *************** package body Prj.Part is *** 759,809 **** Current_With_Clause := Current_With.Next; if Limited_Withs = Current_With.Limited_With then ! declare ! Original_Path : constant String := ! Get_Name_String (Current_With.Path); ! ! Imported_Path_Name : constant String := ! Project_Path_Name_Of ! (In_Tree, ! Original_Path, ! Project_Directory_Path); ! Resolved_Path : constant String := ! Normalize_Pathname ! (Imported_Path_Name, ! Directory => Current_Dir, ! Resolve_Links => ! Opt.Follow_Links_For_Files, ! Case_Sensitive => True); ! Withed_Project : Project_Node_Id := Empty_Node; ! begin ! if Imported_Path_Name = "" then ! -- The project file cannot be found ! Error_Msg_File_1 := File_Name_Type (Current_With.Path); ! Error_Msg ! (Flags, "unknown project file: {", Current_With.Location); ! -- If this is not imported by the main project file, display ! -- the import path. ! if Project_Stack.Last > 1 then ! for Index in reverse 1 .. Project_Stack.Last loop ! Error_Msg_File_1 := ! File_Name_Type ! (Project_Stack.Table (Index).Path_Name); ! Error_Msg ! (Flags, "\imported by {", Current_With.Location); ! end loop; ! end if; ! else ! -- New with clause Previous_Project := Current_Project; if No (Current_Project) then --- 768,815 ---- Current_With_Clause := Current_With.Next; if Limited_Withs = Current_With.Limited_With then ! Find_Project ! (In_Tree.Project_Path, ! Project_File_Name => Get_Name_String (Current_With.Path), ! Directory => Project_Directory_Path, ! Path => Imported_Path_Name_Id); ! if Imported_Path_Name_Id = No_Path then ! -- The project file cannot be found ! Error_Msg_File_1 := File_Name_Type (Current_With.Path); ! Error_Msg ! (Flags, "unknown project file: {", Current_With.Location); ! -- If this is not imported by the main project file, display ! -- the import path. ! if Project_Stack.Last > 1 then ! for Index in reverse 1 .. Project_Stack.Last loop ! Error_Msg_File_1 := ! File_Name_Type ! (Project_Stack.Table (Index).Path_Name); ! Error_Msg ! (Flags, "\imported by {", Current_With.Location); ! end loop; ! end if; ! else ! -- New with clause ! declare ! Resolved_Path : constant String := ! Normalize_Pathname ! (Get_Name_String (Imported_Path_Name_Id), ! Directory => Current_Dir, ! Resolve_Links => ! Opt.Follow_Links_For_Files, ! Case_Sensitive => True); ! Withed_Project : Project_Node_Id := Empty_Node; + begin Previous_Project := Current_Project; if No (Current_Project) then *************** package body Prj.Part is *** 862,868 **** (In_Tree => In_Tree, Project => Withed_Project, Extends_All => Extends_All, ! Path_Name => Imported_Path_Name, Extended => False, From_Extended => From_Extended, In_Limited => Limited_Withs, --- 868,874 ---- (In_Tree => In_Tree, Project => Withed_Project, Extends_All => Extends_All, ! Path_Name_Id => Imported_Path_Name_Id, Extended => False, From_Extended => From_Extended, In_Limited => Limited_Withs, *************** package body Prj.Part is *** 911,922 **** Set_Is_Extending_All (Current_Project, In_Tree); end if; end if; ! end if; ! end; end if; end loop; end Post_Parse_Context_Clause; -------------------------- -- Parse_Single_Project -- -------------------------- --- 917,1108 ---- Set_Is_Extending_All (Current_Project, In_Tree); end if; end if; ! end; ! end if; end if; end loop; end Post_Parse_Context_Clause; + --------------------------------- + -- Check_Extending_All_Imports -- + --------------------------------- + + procedure Check_Extending_All_Imports + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id) + is + With_Clause : Project_Node_Id; + Imported : Project_Node_Id; + + begin + if not Is_Extending_All (Project, In_Tree) then + With_Clause := First_With_Clause_Of (Project, In_Tree); + while Present (With_Clause) loop + Imported := Project_Node_Of (With_Clause, In_Tree); + + if Is_Extending_All (With_Clause, In_Tree) then + Error_Msg_Name_1 := Name_Of (Imported, In_Tree); + Error_Msg (Flags, "cannot import extending-all project %%", + Token_Ptr); + exit; + end if; + + With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); + end loop; + end if; + end Check_Extending_All_Imports; + + ----------------------------- + -- Check_Aggregate_Imports -- + ----------------------------- + + procedure Check_Aggregate_Imports + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id) + is + With_Clause, Imported : Project_Node_Id; + begin + if Project_Qualifier_Of (Project, In_Tree) = Aggregate then + With_Clause := First_With_Clause_Of (Project, In_Tree); + + while Present (With_Clause) loop + Imported := Project_Node_Of (With_Clause, In_Tree); + + if Project_Qualifier_Of (Imported, In_Tree) /= Dry then + Error_Msg_Name_1 := Name_Id (Path_Name_Of (Imported, In_Tree)); + Error_Msg (Flags, "can only import abstract projects, not %%", + Token_Ptr); + exit; + end if; + + With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); + end loop; + end if; + end Check_Aggregate_Imports; + + ---------------------------- + -- Read_Project_Qualifier -- + ---------------------------- + + procedure Read_Project_Qualifier + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Is_Config_File : Boolean; + Qualifier_Location : out Source_Ptr; + Project : Project_Node_Id) + is + Proj_Qualifier : Project_Qualifier := Unspecified; + begin + 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 Is_Config_File then + Error_Msg + (Flags, + "configuration projects cannot belong to a user" & + " project tree", + Token_Ptr); + end if; + + Proj_Qualifier := Configuration; + Scan (In_Tree); + + when others => + null; + end case; + end if; + + if Is_Config_File and then Proj_Qualifier = Unspecified then + + -- Set the qualifier to Configuration, even if the token doesn't + -- exist in the source file itself, so that we can differentiate + -- project files and configuration files later on. + + Proj_Qualifier := Configuration; + end if; + + if Proj_Qualifier /= Unspecified then + if Is_Config_File + and then Proj_Qualifier /= Configuration + then + Error_Msg (Flags, + "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; + end Read_Project_Qualifier; + + ------------------------------- + -- Has_Circular_Dependencies -- + ------------------------------- + + function Has_Circular_Dependencies + (Flags : Processing_Flags; + Normed_Path_Name : Path_Name_Type; + Canonical_Path_Name : Path_Name_Type) return Boolean is + begin + for Index in reverse 1 .. Project_Stack.Last loop + exit when Project_Stack.Table (Index).Limited_With; + + if Canonical_Path_Name = + Project_Stack.Table (Index).Canonical_Path_Name + then + Error_Msg (Flags, "circular dependency detected", Token_Ptr); + Error_Msg_Name_1 := Name_Id (Normed_Path_Name); + Error_Msg (Flags, "\ %% is imported by", Token_Ptr); + + for Current in reverse 1 .. Project_Stack.Last loop + Error_Msg_Name_1 := + Name_Id (Project_Stack.Table (Current).Path_Name); + + if Project_Stack.Table (Current).Canonical_Path_Name /= + Canonical_Path_Name + then + Error_Msg + (Flags, "\ %% which itself is imported by", Token_Ptr); + + else + Error_Msg (Flags, "\ %%", Token_Ptr); + exit; + end if; + end loop; + + return True; + end if; + end loop; + return False; + end Has_Circular_Dependencies; + -------------------------- -- Parse_Single_Project -- -------------------------- *************** package body Prj.Part is *** 925,931 **** (In_Tree : Project_Node_Tree_Ref; Project : out Project_Node_Id; Extends_All : out Boolean; ! Path_Name : String; Extended : Boolean; From_Extended : Extension_Origin; In_Limited : Boolean; --- 1111,1117 ---- (In_Tree : Project_Node_Tree_Ref; Project : out Project_Node_Id; Extends_All : out Boolean; ! Path_Name_Id : Path_Name_Type; Extended : Boolean; From_Extended : Extension_Origin; In_Limited : Boolean; *************** package body Prj.Part is *** 935,940 **** --- 1121,1128 ---- Is_Config_File : Boolean; Flags : Processing_Flags) is + Path_Name : constant String := Get_Name_String (Path_Name_Id); + Normed_Path_Name : Path_Name_Type; Canonical_Path_Name : Path_Name_Type; Project_Directory : Path_Name_Type; *************** package body Prj.Part is *** 963,969 **** Project_Comment_State : Tree.Comment_State; - Proj_Qualifier : Project_Qualifier := Unspecified; Qualifier_Location : Source_Ptr; begin --- 1151,1156 ---- *************** package body Prj.Part is *** 989,1026 **** Canonical_Path_Name := Name_Find; end; ! -- Check for a circular dependency ! ! for Index in reverse 1 .. Project_Stack.Last loop ! exit when Project_Stack.Table (Index).Limited_With; ! ! if Canonical_Path_Name = ! Project_Stack.Table (Index).Canonical_Path_Name ! then ! Error_Msg (Flags, "circular dependency detected", Token_Ptr); ! Error_Msg_Name_1 := Name_Id (Normed_Path_Name); ! Error_Msg (Flags, "\ %% is imported by", Token_Ptr); ! ! for Current in reverse 1 .. Project_Stack.Last loop ! Error_Msg_Name_1 := ! Name_Id (Project_Stack.Table (Current).Path_Name); ! ! if Project_Stack.Table (Current).Canonical_Path_Name /= ! Canonical_Path_Name ! then ! Error_Msg ! (Flags, "\ %% which itself is imported by", Token_Ptr); ! ! else ! Error_Msg (Flags, "\ %%", Token_Ptr); ! exit; ! end if; ! end loop; ! ! Project := Empty_Node; ! return; ! end if; ! end loop; -- Put the new path name on the stack --- 1176,1187 ---- Canonical_Path_Name := Name_Find; end; ! if Has_Circular_Dependencies ! (Flags, Normed_Path_Name, Canonical_Path_Name) ! then ! Project := Empty_Node; ! return; ! end if; -- Put the new path name on the stack *************** package body Prj.Part is *** 1157,1229 **** Set_Directory_Of (Project, In_Tree, Project_Directory); Set_Path_Name_Of (Project, In_Tree, Normed_Path_Name); ! -- 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 Is_Config_File then ! Error_Msg ! (Flags, ! "configuration projects cannot belong to a user" & ! " project tree", ! Token_Ptr); ! end if; ! ! Proj_Qualifier := Configuration; ! Scan (In_Tree); ! ! when others => ! null; ! end case; ! end if; ! ! if Is_Config_File and then Proj_Qualifier = Unspecified then ! ! -- Set the qualifier to Configuration, even if the token doesn't ! -- exist in the source file itself, so that we can differentiate ! -- project files and configuration files later on. ! ! Proj_Qualifier := Configuration; ! end if; ! ! if Proj_Qualifier /= Unspecified then ! if Is_Config_File ! and then Proj_Qualifier /= Configuration ! then ! Error_Msg (Flags, ! "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); --- 1318,1325 ---- Set_Directory_Of (Project, In_Tree, Project_Directory); Set_Path_Name_Of (Project, In_Tree, Normed_Path_Name); ! Read_Project_Qualifier ! (Flags, In_Tree, Is_Config_File, Qualifier_Location, Project); Set_Location_Of (Project, In_Tree, Token_Ptr); *************** package body Prj.Part is *** 1282,1288 **** -- Make sure that gnatmake will use mapping files ! Create_Mapping_File := True; -- We are extending another project --- 1378,1384 ---- -- Make sure that gnatmake will use mapping files ! Opt.Create_Mapping_File := True; -- We are extending another project *************** package body Prj.Part is *** 1442,1457 **** declare Original_Path_Name : constant String := Get_Name_String (Token_Name); ! ! Extended_Project_Path_Name : constant String := ! Project_Path_Name_Of ! (In_Tree, ! Original_Path_Name, ! Get_Name_String ! (Project_Directory)); ! begin ! if Extended_Project_Path_Name = "" then -- We could not find the project file to extend --- 1538,1552 ---- declare Original_Path_Name : constant String := Get_Name_String (Token_Name); ! Extended_Project_Path_Name_Id : Path_Name_Type; begin ! Find_Project ! (In_Tree.Project_Path, ! Project_File_Name => Original_Path_Name, ! Directory => Get_Name_String (Project_Directory), ! Path => Extended_Project_Path_Name_Id); ! ! if Extended_Project_Path_Name_Id = No_Path then -- We could not find the project file to extend *************** package body Prj.Part is *** 1489,1495 **** (In_Tree => In_Tree, Project => Extended_Project, Extends_All => Extends_All, ! Path_Name => Extended_Project_Path_Name, Extended => True, From_Extended => From_Ext, In_Limited => In_Limited, --- 1584,1590 ---- (In_Tree => In_Tree, Project => Extended_Project, Extends_All => Extends_All, ! Path_Name_Id => Extended_Project_Path_Name_Id, Extended => True, From_Extended => From_Ext, In_Limited => In_Limited, *************** package body Prj.Part is *** 1514,1520 **** -- with sources, if it inherits sources from the project -- it extends. ! if Proj_Qualifier = Dry and then Project_Qualifier_Of (Extended_Project, In_Tree) /= Dry then Error_Msg --- 1609,1615 ---- -- with sources, if it inherits sources from the project -- it extends. ! if Project_Qualifier_Of (Project, In_Tree) = Dry and then Project_Qualifier_Of (Extended_Project, In_Tree) /= Dry then Error_Msg *************** package body Prj.Part is *** 1530,1560 **** end if; end if; ! -- Check that a non extending-all project does not import an ! -- extending-all project. ! ! if not Is_Extending_All (Project, In_Tree) then ! declare ! With_Clause : Project_Node_Id := ! First_With_Clause_Of (Project, In_Tree); ! Imported : Project_Node_Id := Empty_Node; ! ! begin ! With_Clause_Loop : ! while Present (With_Clause) loop ! Imported := Project_Node_Of (With_Clause, In_Tree); ! ! if Is_Extending_All (With_Clause, In_Tree) then ! Error_Msg_Name_1 := Name_Of (Imported, In_Tree); ! Error_Msg (Flags, "cannot import extending-all project %%", ! Token_Ptr); ! exit With_Clause_Loop; ! end if; ! ! With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); ! end loop With_Clause_Loop; ! end; ! end if; -- Check that a project with a name including a dot either imports -- or extends the project whose name precedes the last dot. --- 1625,1632 ---- end if; end if; ! Check_Extending_All_Imports (Flags, In_Tree, Project); ! Check_Aggregate_Imports (Flags, In_Tree, Project); -- Check that a project with a name including a dot either imports -- or extends the project whose name precedes the last dot. *************** package body Prj.Part is *** 1572,1589 **** Name_Len := Name_Len - 1; end loop; ! -- If a dot was find, check if the parent project is imported ! -- or extended. if Name_Len > 0 then Name_Len := Name_Len - 1; declare ! Parent_Name : constant Name_Id := Name_Find; ! Parent_Found : Boolean := False; ! Parent_Node : Project_Node_Id := Empty_Node; ! With_Clause : Project_Node_Id := ! First_With_Clause_Of (Project, In_Tree); begin -- If there is an extended project, check its name --- 1644,1661 ---- Name_Len := Name_Len - 1; end loop; ! -- If a dot was found, check if parent project is imported or extended if Name_Len > 0 then Name_Len := Name_Len - 1; declare ! Parent_Name : constant Name_Id := Name_Find; ! Parent_Found : Boolean := False; ! Parent_Node : Project_Node_Id := Empty_Node; ! With_Clause : Project_Node_Id := ! First_With_Clause_Of (Project, In_Tree); ! Imp_Proj_Name : Name_Id; begin -- If there is an extended project, check its name *************** package body Prj.Part is *** 1597,1607 **** -- If the parent project is not the extended project, -- check each imported project until we find the parent project. while not Parent_Found and then Present (With_Clause) loop Parent_Node := Project_Node_Of (With_Clause, In_Tree); ! Parent_Found := Name_Of (Parent_Node, In_Tree) = Parent_Name; With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); ! end loop; if Parent_Found then Set_Parent_Project_Of (Project, In_Tree, To => Parent_Node); --- 1669,1689 ---- -- If the parent project is not the extended project, -- check each imported project until we find the parent project. + Imported_Loop : while not Parent_Found and then Present (With_Clause) loop Parent_Node := Project_Node_Of (With_Clause, In_Tree); ! Extension_Loop : while Present (Parent_Node) loop ! Imp_Proj_Name := Name_Of (Parent_Node, In_Tree); ! Parent_Found := Imp_Proj_Name = Parent_Name; ! exit Imported_Loop when Parent_Found; ! Parent_Node := ! Extended_Project_Of ! (Project_Declaration_Of (Parent_Node, In_Tree), ! In_Tree); ! end loop Extension_Loop; ! With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); ! end loop Imported_Loop; if Parent_Found then Set_Parent_Project_Of (Project, In_Tree, To => Parent_Node); *************** package body Prj.Part is *** 1729,1735 **** Node => Project, Canonical_Path => Canonical_Path_Name, Extended => Extended, ! Proj_Qualifier => Proj_Qualifier)); end if; declare --- 1811,1817 ---- Node => Project, Canonical_Path => Canonical_Path_Name, Extended => Extended, ! Proj_Qualifier => Project_Qualifier_Of (Project, In_Tree))); end if; declare *************** package body Prj.Part is *** 1918,2100 **** end loop; end Project_Name_From; - -------------------------- - -- Project_Path_Name_Of -- - -------------------------- - - function Project_Path_Name_Of - (In_Tree : Project_Node_Tree_Ref; - Project_File_Name : String; - Directory : String) return String - is - - function Try_Path_Name (Path : String) return String_Access; - pragma Inline (Try_Path_Name); - -- Try the specified Path - - ------------------- - -- Try_Path_Name -- - ------------------- - - function Try_Path_Name (Path : String) return String_Access is - Prj_Path : constant String := Project_Path (In_Tree); - First : Natural; - Last : Natural; - Result : String_Access := null; - - begin - if Current_Verbosity = High then - Write_Str (" Trying "); - Write_Line (Path); - end if; - - if Is_Absolute_Path (Path) then - if Is_Regular_File (Path) then - Result := new String'(Path); - end if; - - else - -- Because we don't want to resolve symbolic links, we cannot use - -- Locate_Regular_File. So, we try each possible path - -- successively. - - First := Prj_Path'First; - while First <= Prj_Path'Last loop - while First <= Prj_Path'Last - and then Prj_Path (First) = Path_Separator - loop - First := First + 1; - end loop; - - exit when First > Prj_Path'Last; - - Last := First; - while Last < Prj_Path'Last - and then Prj_Path (Last + 1) /= Path_Separator - loop - Last := Last + 1; - end loop; - - Name_Len := 0; - - if not Is_Absolute_Path (Prj_Path (First .. Last)) then - Add_Str_To_Name_Buffer (Get_Current_Dir); - Add_Char_To_Name_Buffer (Directory_Separator); - end if; - - Add_Str_To_Name_Buffer (Prj_Path (First .. Last)); - Add_Char_To_Name_Buffer (Directory_Separator); - Add_Str_To_Name_Buffer (Path); - - if Is_Regular_File (Name_Buffer (1 .. Name_Len)) then - Result := new String'(Name_Buffer (1 .. Name_Len)); - exit; - end if; - - First := Last + 1; - end loop; - end if; - - return Result; - end Try_Path_Name; - - -- Local Declarations - - Result : String_Access; - Result_Id : Path_Name_Type; - Has_Dot : Boolean := False; - Key : Name_Id; - - -- Start of processing for Project_Path_Name_Of - - begin - if Current_Verbosity = High then - Write_Str ("Project_Path_Name_Of ("""); - Write_Str (Project_File_Name); - Write_Str (""", """); - Write_Str (Directory); - Write_Line (""");"); - end if; - - -- Check the project cache - - Name_Len := Project_File_Name'Length; - Name_Buffer (1 .. Name_Len) := Project_File_Name; - Key := Name_Find; - Result_Id := Projects_Paths.Get (Key); - - if Result_Id /= No_Path then - return Get_Name_String (Result_Id); - end if; - - -- Check if Project_File_Name contains an extension (a dot before a - -- directory separator). If it is the case we do not try project file - -- with an added extension as it is not possible to have multiple dots - -- on a project file name. - - Check_Dot : for K in reverse Project_File_Name'Range loop - if Project_File_Name (K) = '.' then - Has_Dot := True; - exit Check_Dot; - end if; - - exit Check_Dot when Project_File_Name (K) = Directory_Separator - or else Project_File_Name (K) = '/'; - end loop Check_Dot; - - if not Is_Absolute_Path (Project_File_Name) then - - -- First we try /. - - if not Has_Dot then - Result := Try_Path_Name - (Directory & Directory_Separator & - Project_File_Name & Project_File_Extension); - end if; - - -- Then we try / - - if Result = null then - Result := Try_Path_Name - (Directory & Directory_Separator & Project_File_Name); - end if; - end if; - - -- Then we try . - - if Result = null and then not Has_Dot then - Result := Try_Path_Name (Project_File_Name & Project_File_Extension); - end if; - - -- Then we try - - if Result = null then - Result := Try_Path_Name (Project_File_Name); - end if; - - -- If we cannot find the project file, we return an empty string - - if Result = null then - return ""; - - else - declare - Final_Result : constant String := - GNAT.OS_Lib.Normalize_Pathname - (Result.all, - Directory => Directory, - Resolve_Links => Opt.Follow_Links_For_Files, - Case_Sensitive => True); - begin - Free (Result); - Name_Len := Final_Result'Length; - Name_Buffer (1 .. Name_Len) := Final_Result; - Result_Id := Name_Find; - - Projects_Paths.Set (Key, Result_Id); - return Final_Result; - end; - end if; - end Project_Path_Name_Of; - end Prj.Part; --- 2000,2003 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/prj-pp.adb gcc-4.6.0/gcc/ada/prj-pp.adb *** gcc-4.5.2/gcc/ada/prj-pp.adb Mon Nov 30 10:20:47 2009 --- gcc-4.6.0/gcc/ada/prj-pp.adb Mon Oct 4 14:09:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body Prj.PP is *** 34,52 **** Not_Tested : array (Project_Node_Kind) of Boolean := (others => True); - Max_Line_Length : constant := 255; - -- Maximum length of a line. This is chosen to be compatible with older - -- versions of GNAT that had a strict limit on the maximum line length. - - Column : Natural := 0; - -- Column number of the last character in the line. Used to avoid - -- outputting lines longer than Max_Line_Length. - - First_With_In_List : Boolean := True; - -- Indicate that the next with clause is first in a list such as - -- with "A", "B"; - -- First_With_In_List will be True for "A", but not for "B". - procedure Indicate_Tested (Kind : Project_Node_Kind); -- Set the corresponding component of array Not_Tested to False. -- Only called by pragmas Debug. --- 34,39 ---- *************** package body Prj.PP is *** 67,80 **** procedure Pretty_Print (Project : Prj.Tree.Project_Node_Id; In_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Increment : Positive := 3; ! Eliminate_Empty_Case_Constructions : Boolean := False; ! Minimize_Empty_Lines : Boolean := False; ! W_Char : Write_Char_Ap := null; ! W_Eol : Write_Eol_Ap := null; ! W_Str : Write_Str_Ap := null; Backward_Compatibility : Boolean; ! Id : Prj.Project_Id := Prj.No_Project) is procedure Print (Node : Project_Node_Id; Indent : Natural); -- A recursive procedure that traverses a project file tree and outputs --- 54,69 ---- procedure Pretty_Print (Project : Prj.Tree.Project_Node_Id; In_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Increment : Positive := 3; ! Eliminate_Empty_Case_Constructions : Boolean := False; ! Minimize_Empty_Lines : Boolean := False; ! W_Char : Write_Char_Ap := null; ! W_Eol : Write_Eol_Ap := null; ! W_Str : Write_Str_Ap := null; Backward_Compatibility : Boolean; ! Id : Prj.Project_Id := Prj.No_Project; ! Max_Line_Length : Max_Length_Of_Line := ! Max_Length_Of_Line'Last) is procedure Print (Node : Project_Node_Id; Indent : Natural); -- A recursive procedure that traverses a project file tree and outputs *************** package body Prj.PP is *** 82,109 **** -- is used when printing attributes, since in nested packages they -- need to use a fully qualified name. ! procedure Output_Attribute_Name (Name : Name_Id); -- Outputs an attribute name, taking into account the value of -- Backward_Compatibility. ! procedure Output_Name (Name : Name_Id; Capitalize : Boolean := True); -- Outputs a name procedure Start_Line (Indent : Natural); -- Outputs the indentation at the beginning of the line ! procedure Output_String (S : Name_Id); ! procedure Output_String (S : Path_Name_Type); -- Outputs a string using the default output procedures procedure Write_Empty_Line (Always : Boolean := False); -- Outputs an empty line, only if the previous line was not empty ! -- already and either Always is True or Minimize_Empty_Lines is False. procedure Write_Line (S : String); -- Outputs S followed by a new line ! procedure Write_String (S : String; Truncated : Boolean := False); -- Outputs S using Write_Str, starting a new line if line would -- become too long, when Truncated = False. -- When Truncated = True, only the part of the string that can fit on --- 71,105 ---- -- is used when printing attributes, since in nested packages they -- need to use a fully qualified name. ! procedure Output_Attribute_Name (Name : Name_Id; Indent : Natural); -- Outputs an attribute name, taking into account the value of -- Backward_Compatibility. ! procedure Output_Name ! (Name : Name_Id; ! Indent : Natural; ! Capitalize : Boolean := True); -- Outputs a name procedure Start_Line (Indent : Natural); -- Outputs the indentation at the beginning of the line ! procedure Output_String (S : Name_Id; Indent : Natural); ! procedure Output_String (S : Path_Name_Type; Indent : Natural); -- Outputs a string using the default output procedures procedure Write_Empty_Line (Always : Boolean := False); -- Outputs an empty line, only if the previous line was not empty ! -- already and either Always is True or Minimize_Empty_Lines is ! -- False. procedure Write_Line (S : String); -- Outputs S followed by a new line ! procedure Write_String ! (S : String; ! Indent : Natural; ! Truncated : Boolean := False); -- Outputs S using Write_Str, starting a new line if line would -- become too long, when Truncated = False. -- When Truncated = True, only the part of the string that can fit on *************** package body Prj.PP is *** 112,150 **** procedure Write_End_Of_Line_Comment (Node : Project_Node_Id); Write_Char : Write_Char_Ap := Output.Write_Char'Access; ! Write_Eol : Write_Eol_Ap := Output.Write_Eol'Access; ! Write_Str : Write_Str_Ap := Output.Write_Str'Access; -- These three access to procedure values are used for the output Last_Line_Is_Empty : Boolean := False; -- Used to avoid two consecutive empty lines --------------------------- -- Output_Attribute_Name -- --------------------------- ! procedure Output_Attribute_Name (Name : Name_Id) is begin if Backward_Compatibility then case Name is when Snames.Name_Spec => ! Output_Name (Snames.Name_Specification); when Snames.Name_Spec_Suffix => ! Output_Name (Snames.Name_Specification_Suffix); when Snames.Name_Body => ! Output_Name (Snames.Name_Implementation); when Snames.Name_Body_Suffix => ! Output_Name (Snames.Name_Implementation_Suffix); when others => ! Output_Name (Name); end case; else ! Output_Name (Name); end if; end Output_Attribute_Name; --- 108,155 ---- procedure Write_End_Of_Line_Comment (Node : Project_Node_Id); Write_Char : Write_Char_Ap := Output.Write_Char'Access; ! Write_Eol : Write_Eol_Ap := Output.Write_Eol'Access; ! Write_Str : Write_Str_Ap := Output.Write_Str'Access; -- These three access to procedure values are used for the output Last_Line_Is_Empty : Boolean := False; -- Used to avoid two consecutive empty lines + Column : Natural := 0; + -- Column number of the last character in the line. Used to avoid + -- outputting lines longer than Max_Line_Length. + + First_With_In_List : Boolean := True; + -- Indicate that the next with clause is first in a list such as + -- with "A", "B"; + -- First_With_In_List will be True for "A", but not for "B". + --------------------------- -- Output_Attribute_Name -- --------------------------- ! procedure Output_Attribute_Name (Name : Name_Id; Indent : Natural) is begin if Backward_Compatibility then case Name is when Snames.Name_Spec => ! Output_Name (Snames.Name_Specification, Indent); when Snames.Name_Spec_Suffix => ! Output_Name (Snames.Name_Specification_Suffix, Indent); when Snames.Name_Body => ! Output_Name (Snames.Name_Implementation, Indent); when Snames.Name_Body_Suffix => ! Output_Name (Snames.Name_Implementation_Suffix, Indent); when others => ! Output_Name (Name, Indent); end case; else ! Output_Name (Name, Indent); end if; end Output_Attribute_Name; *************** package body Prj.PP is *** 152,161 **** -- Output_Name -- ----------------- ! procedure Output_Name (Name : Name_Id; Capitalize : Boolean := True) is Capital : Boolean := Capitalize; begin Get_Name_String (Name); -- If line would become too long, create new line --- 157,174 ---- -- Output_Name -- ----------------- ! procedure Output_Name ! (Name : Name_Id; ! Indent : Natural; ! Capitalize : Boolean := True) ! is Capital : Boolean := Capitalize; begin + if Column = 0 and then Indent /= 0 then + Start_Line (Indent + Increment); + end if; + Get_Name_String (Name); -- If line would become too long, create new line *************** package body Prj.PP is *** 163,168 **** --- 176,185 ---- if Column + Name_Len > Max_Line_Length then Write_Eol.all; Column := 0; + + if Indent /= 0 then + Start_Line (Indent + Increment); + end if; end if; for J in 1 .. Name_Len loop *************** package body Prj.PP is *** 186,203 **** -- Output_String -- ------------------- ! procedure Output_String (S : Name_Id) is begin Get_Name_String (S); ! -- If line could become too long, create new line. ! -- Note that the number of characters on the line could be ! -- twice the number of character in the string (if every ! -- character is a '"') plus two (the initial and final '"'). if Column + Name_Len + Name_Len + 2 > Max_Line_Length then Write_Eol.all; Column := 0; end if; Write_Char ('"'); --- 203,228 ---- -- Output_String -- ------------------- ! procedure Output_String (S : Name_Id; Indent : Natural) is begin + if Column = 0 and then Indent /= 0 then + Start_Line (Indent + Increment); + end if; + Get_Name_String (S); ! -- If line could become too long, create new line. Note that the ! -- number of characters on the line could be twice the number of ! -- character in the string (if every character is a '"') plus two ! -- (the initial and final '"'). if Column + Name_Len + Name_Len + 2 > Max_Line_Length then Write_Eol.all; Column := 0; + + if Indent /= 0 then + Start_Line (Indent + Increment); + end if; end if; Write_Char ('"'); *************** package body Prj.PP is *** 214,227 **** Column := Column + 1; end if; ! -- If the string does not fit on one line, cut it in parts ! -- and concatenate. if J < Name_Len and then Column >= Max_Line_Length then Write_Str (""" &"); Write_Eol.all; Write_Char ('"'); ! Column := 1; end if; end loop; --- 239,254 ---- Column := Column + 1; end if; ! -- If the string does not fit on one line, cut it in parts and ! -- concatenate. if J < Name_Len and then Column >= Max_Line_Length then Write_Str (""" &"); Write_Eol.all; + Column := 0; + Start_Line (Indent + Increment); Write_Char ('"'); ! Column := Column + 1; end if; end loop; *************** package body Prj.PP is *** 229,237 **** Column := Column + 1; end Output_String; ! procedure Output_String (S : Path_Name_Type) is begin ! Output_String (Name_Id (S)); end Output_String; ---------------- --- 256,264 ---- Column := Column + 1; end Output_String; ! procedure Output_String (S : Path_Name_Type; Indent : Natural) is begin ! Output_String (Name_Id (S), Indent); end Output_String; ---------------- *************** package body Prj.PP is *** 269,276 **** begin if Value /= No_Name then ! Write_String (" --"); ! Write_String (Get_Name_String (Value), Truncated => True); end if; Write_Line (""); --- 296,303 ---- begin if Value /= No_Name then ! Write_String (" --", 0); ! Write_String (Get_Name_String (Value), 0, Truncated => True); end if; Write_Line (""); *************** package body Prj.PP is *** 282,288 **** procedure Write_Line (S : String) is begin ! Write_String (S); Last_Line_Is_Empty := False; Write_Eol.all; Column := 0; --- 309,315 ---- procedure Write_Line (S : String) is begin ! Write_String (S, 0); Last_Line_Is_Empty := False; Write_Eol.all; Column := 0; *************** package body Prj.PP is *** 292,300 **** -- Write_String -- ------------------ ! procedure Write_String (S : String; Truncated : Boolean := False) is Length : Natural := S'Length; begin -- If the string would not fit on the line, -- start a new line. --- 319,334 ---- -- Write_String -- ------------------ ! procedure Write_String ! (S : String; ! Indent : Natural; ! Truncated : Boolean := False) is Length : Natural := S'Length; begin + if Column = 0 and then Indent /= 0 then + Start_Line (Indent + Increment); + end if; + -- If the string would not fit on the line, -- start a new line. *************** package body Prj.PP is *** 305,310 **** --- 339,348 ---- else Write_Eol.all; Column := 0; + + if Indent /= 0 then + Start_Line (Indent + Increment); + end if; end if; end if; *************** package body Prj.PP is *** 316,322 **** -- Print -- ----------- ! procedure Print (Node : Project_Node_Id; Indent : Natural) is begin if Present (Node) then --- 354,360 ---- -- Print -- ----------- ! procedure Print (Node : Project_Node_Id; Indent : Natural) is begin if Present (Node) then *************** package body Prj.PP is *** 335,361 **** Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("project "); if Id /= Prj.No_Project then ! Output_Name (Id.Display_Name); else ! Output_Name (Name_Of (Node, In_Tree)); end if; -- Check if this project extends another project if Extended_Project_Path_Of (Node, In_Tree) /= No_Path then ! Write_String (" extends "); if Is_Extending_All (Node, In_Tree) then ! Write_String ("all "); end if; ! Output_String (Extended_Project_Path_Of (Node, In_Tree)); end if; ! Write_String (" is"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent + Increment); --- 373,401 ---- Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("project ", Indent); if Id /= Prj.No_Project then ! Output_Name (Id.Display_Name, Indent); else ! Output_Name (Name_Of (Node, In_Tree), Indent); end if; -- Check if this project extends another project if Extended_Project_Path_Of (Node, In_Tree) /= No_Path then ! Write_String (" extends ", Indent); if Is_Extending_All (Node, In_Tree) then ! Write_String ("all ", Indent); end if; ! Output_String ! (Extended_Project_Path_Of (Node, In_Tree), ! Indent); end if; ! Write_String (" is", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent + Increment); *************** package body Prj.PP is *** 368,379 **** (First_Comment_Before_End (Node, In_Tree), Indent + Increment); Start_Line (Indent); ! Write_String ("end "); if Id /= Prj.No_Project then ! Output_Name (Id.Display_Name); else ! Output_Name (Name_Of (Node, In_Tree)); end if; Write_Line (";"); --- 408,419 ---- (First_Comment_Before_End (Node, In_Tree), Indent + Increment); Start_Line (Indent); ! Write_String ("end ", Indent); if Id /= Prj.No_Project then ! Output_Name (Id.Display_Name, Indent); else ! Output_Name (Name_Of (Node, In_Tree), Indent); end if; Write_Line (";"); *************** package body Prj.PP is *** 397,416 **** if Non_Limited_Project_Node_Of (Node, In_Tree) = Empty_Node then ! Write_String ("limited "); end if; ! Write_String ("with "); end if; ! Output_String (String_Value_Of (Node, In_Tree)); if Is_Not_Last_In_List (Node, In_Tree) then ! Write_String (", "); First_With_In_List := False; else ! Write_String (";"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); First_With_In_List := True; --- 437,456 ---- if Non_Limited_Project_Node_Of (Node, In_Tree) = Empty_Node then ! Write_String ("limited ", Indent); end if; ! Write_String ("with ", Indent); end if; ! Output_String (String_Value_Of (Node, In_Tree), Indent); if Is_Not_Last_In_List (Node, In_Tree) then ! Write_String (", ", Indent); First_With_In_List := False; else ! Write_String (";", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); First_With_In_List := True; *************** package body Prj.PP is *** 441,465 **** Write_Empty_Line (Always => True); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("package "); ! Output_Name (Name_Of (Node, In_Tree)); if Project_Of_Renamed_Package_Of (Node, In_Tree) /= Empty_Node then ! Write_String (" renames "); Output_Name (Name_Of (Project_Of_Renamed_Package_Of (Node, In_Tree), ! In_Tree)); ! Write_String ("."); ! Output_Name (Name_Of (Node, In_Tree)); ! Write_String (";"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After_End (Node, In_Tree), Indent); else ! Write_String (" is"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent + Increment); --- 481,506 ---- Write_Empty_Line (Always => True); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("package ", Indent); ! Output_Name (Name_Of (Node, In_Tree), Indent); if Project_Of_Renamed_Package_Of (Node, In_Tree) /= Empty_Node then ! Write_String (" renames ", Indent); Output_Name (Name_Of (Project_Of_Renamed_Package_Of (Node, In_Tree), ! In_Tree), ! Indent); ! Write_String (".", Indent); ! Output_Name (Name_Of (Node, In_Tree), Indent); ! Write_String (";", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After_End (Node, In_Tree), Indent); else ! Write_String (" is", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent + Increment); *************** package body Prj.PP is *** 475,482 **** Print (First_Comment_Before_End (Node, In_Tree), Indent + Increment); Start_Line (Indent); ! Write_String ("end "); ! Output_Name (Name_Of (Node, In_Tree)); Write_Line (";"); Print (First_Comment_After_End (Node, In_Tree), Indent); Write_Empty_Line; --- 516,523 ---- Print (First_Comment_Before_End (Node, In_Tree), Indent + Increment); Start_Line (Indent); ! Write_String ("end ", Indent); ! Output_Name (Name_Of (Node, In_Tree), Indent); Write_Line (";"); Print (First_Comment_After_End (Node, In_Tree), Indent); Write_Empty_Line; *************** package body Prj.PP is *** 486,496 **** pragma Debug (Indicate_Tested (N_String_Type_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("type "); ! Output_Name (Name_Of (Node, In_Tree)); Write_Line (" is"); Start_Line (Indent + Increment); ! Write_String ("("); declare String_Node : Project_Node_Id := --- 527,537 ---- pragma Debug (Indicate_Tested (N_String_Type_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("type ", Indent); ! Output_Name (Name_Of (Node, In_Tree), Indent); Write_Line (" is"); Start_Line (Indent + Increment); ! Write_String ("(", Indent); declare String_Node : Project_Node_Id := *************** package body Prj.PP is *** 498,547 **** begin while Present (String_Node) loop ! Output_String (String_Value_Of (String_Node, In_Tree)); String_Node := Next_Literal_String (String_Node, In_Tree); if Present (String_Node) then ! Write_String (", "); end if; end loop; end; ! Write_String (");"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); when N_Literal_String => pragma Debug (Indicate_Tested (N_Literal_String)); ! Output_String (String_Value_Of (Node, In_Tree)); if Source_Index_Of (Node, In_Tree) /= 0 then ! Write_String (" at"); ! Write_String (Source_Index_Of (Node, In_Tree)'Img); end if; when N_Attribute_Declaration => pragma Debug (Indicate_Tested (N_Attribute_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("for "); ! Output_Attribute_Name (Name_Of (Node, In_Tree)); if Associative_Array_Index_Of (Node, In_Tree) /= No_Name then ! Write_String (" ("); Output_String ! (Associative_Array_Index_Of (Node, In_Tree)); if Source_Index_Of (Node, In_Tree) /= 0 then ! Write_String (" at"); ! Write_String (Source_Index_Of (Node, In_Tree)'Img); end if; ! Write_String (")"); end if; ! Write_String (" use "); if Present (Expression_Of (Node, In_Tree)) then Print (Expression_Of (Node, In_Tree), Indent); --- 539,595 ---- begin while Present (String_Node) loop ! Output_String ! (String_Value_Of (String_Node, In_Tree), ! Indent); String_Node := Next_Literal_String (String_Node, In_Tree); if Present (String_Node) then ! Write_String (", ", Indent); end if; end loop; end; ! Write_String (");", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); when N_Literal_String => pragma Debug (Indicate_Tested (N_Literal_String)); ! Output_String (String_Value_Of (Node, In_Tree), Indent); if Source_Index_Of (Node, In_Tree) /= 0 then ! Write_String (" at", Indent); ! Write_String ! (Source_Index_Of (Node, In_Tree)'Img, ! Indent); end if; when N_Attribute_Declaration => pragma Debug (Indicate_Tested (N_Attribute_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("for ", Indent); ! Output_Attribute_Name (Name_Of (Node, In_Tree), Indent); if Associative_Array_Index_Of (Node, In_Tree) /= No_Name then ! Write_String (" (", Indent); Output_String ! (Associative_Array_Index_Of (Node, In_Tree), ! Indent); if Source_Index_Of (Node, In_Tree) /= 0 then ! Write_String (" at", Indent); ! Write_String ! (Source_Index_Of (Node, In_Tree)'Img, ! Indent); end if; ! Write_String (")", Indent); end if; ! Write_String (" use ", Indent); if Present (Expression_Of (Node, In_Tree)) then Print (Expression_Of (Node, In_Tree), Indent); *************** package body Prj.PP is *** 555,570 **** Output_Name (Name_Of (Associative_Project_Of (Node, In_Tree), ! In_Tree)); if Present (Associative_Package_Of (Node, In_Tree)) then ! Write_String ("."); Output_Name (Name_Of (Associative_Package_Of (Node, In_Tree), ! In_Tree)); end if; elsif --- 603,620 ---- Output_Name (Name_Of (Associative_Project_Of (Node, In_Tree), ! In_Tree), ! Indent); if Present (Associative_Package_Of (Node, In_Tree)) then ! Write_String (".", Indent); Output_Name (Name_Of (Associative_Package_Of (Node, In_Tree), ! In_Tree), ! Indent); end if; elsif *************** package body Prj.PP is *** 573,586 **** Output_Name (Name_Of (Associative_Package_Of (Node, In_Tree), ! In_Tree)); end if; ! Write_String ("'"); ! Output_Attribute_Name (Name_Of (Node, In_Tree)); end if; ! Write_String (";"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); --- 623,637 ---- Output_Name (Name_Of (Associative_Package_Of (Node, In_Tree), ! In_Tree), ! Indent); end if; ! Write_String ("'", Indent); ! Output_Attribute_Name (Name_Of (Node, In_Tree), Indent); end if; ! Write_String (";", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); *************** package body Prj.PP is *** 589,601 **** (Indicate_Tested (N_Typed_Variable_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Output_Name (Name_Of (Node, In_Tree)); ! Write_String (" : "); Output_Name ! (Name_Of (String_Type_Of (Node, In_Tree), In_Tree)); ! Write_String (" := "); Print (Expression_Of (Node, In_Tree), Indent); ! Write_String (";"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); --- 640,653 ---- (Indicate_Tested (N_Typed_Variable_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Output_Name (Name_Of (Node, In_Tree), Indent); ! Write_String (" : ", Indent); Output_Name ! (Name_Of (String_Type_Of (Node, In_Tree), In_Tree), ! Indent); ! Write_String (" := ", Indent); Print (Expression_Of (Node, In_Tree), Indent); ! Write_String (";", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); *************** package body Prj.PP is *** 603,612 **** pragma Debug (Indicate_Tested (N_Variable_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Output_Name (Name_Of (Node, In_Tree)); ! Write_String (" := "); Print (Expression_Of (Node, In_Tree), Indent); ! Write_String (";"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); --- 655,664 ---- pragma Debug (Indicate_Tested (N_Variable_Declaration)); Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Output_Name (Name_Of (Node, In_Tree), Indent); ! Write_String (" := ", Indent); Print (Expression_Of (Node, In_Tree), Indent); ! Write_String (";", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); *************** package body Prj.PP is *** 621,627 **** Term := Next_Term (Term, In_Tree); if Present (Term) then ! Write_String (" & "); end if; end loop; end; --- 673,679 ---- Term := Next_Term (Term, In_Tree); if Present (Term) then ! Write_String (" & ", Indent); end if; end loop; end; *************** package body Prj.PP is *** 632,638 **** when N_Literal_String_List => pragma Debug (Indicate_Tested (N_Literal_String_List)); ! Write_String ("("); declare Expression : Project_Node_Id := --- 684,690 ---- when N_Literal_String_List => pragma Debug (Indicate_Tested (N_Literal_String_List)); ! Write_String ("(", Indent); declare Expression : Project_Node_Id := *************** package body Prj.PP is *** 645,684 **** Next_Expression_In_List (Expression, In_Tree); if Present (Expression) then ! Write_String (", "); end if; end loop; end; ! Write_String (")"); when N_Variable_Reference => pragma Debug (Indicate_Tested (N_Variable_Reference)); if Present (Project_Node_Of (Node, In_Tree)) then Output_Name ! (Name_Of (Project_Node_Of (Node, In_Tree), In_Tree)); ! Write_String ("."); end if; if Present (Package_Node_Of (Node, In_Tree)) then Output_Name ! (Name_Of (Package_Node_Of (Node, In_Tree), In_Tree)); ! Write_String ("."); end if; ! Output_Name (Name_Of (Node, In_Tree)); when N_External_Value => pragma Debug (Indicate_Tested (N_External_Value)); ! Write_String ("external ("); Print (External_Reference_Of (Node, In_Tree), Indent); if Present (External_Default_Of (Node, In_Tree)) then ! Write_String (", "); Print (External_Default_Of (Node, In_Tree), Indent); end if; ! Write_String (")"); when N_Attribute_Reference => pragma Debug (Indicate_Tested (N_Attribute_Reference)); --- 697,738 ---- Next_Expression_In_List (Expression, In_Tree); if Present (Expression) then ! Write_String (", ", Indent); end if; end loop; end; ! Write_String (")", Indent); when N_Variable_Reference => pragma Debug (Indicate_Tested (N_Variable_Reference)); if Present (Project_Node_Of (Node, In_Tree)) then Output_Name ! (Name_Of (Project_Node_Of (Node, In_Tree), In_Tree), ! Indent); ! Write_String (".", Indent); end if; if Present (Package_Node_Of (Node, In_Tree)) then Output_Name ! (Name_Of (Package_Node_Of (Node, In_Tree), In_Tree), ! Indent); ! Write_String (".", Indent); end if; ! Output_Name (Name_Of (Node, In_Tree), Indent); when N_External_Value => pragma Debug (Indicate_Tested (N_External_Value)); ! Write_String ("external (", Indent); Print (External_Reference_Of (Node, In_Tree), Indent); if Present (External_Default_Of (Node, In_Tree)) then ! Write_String (", ", Indent); Print (External_Default_Of (Node, In_Tree), Indent); end if; ! Write_String (")", Indent); when N_Attribute_Reference => pragma Debug (Indicate_Tested (N_Attribute_Reference)); *************** package body Prj.PP is *** 687,710 **** and then Project_Node_Of (Node, In_Tree) /= Project then Output_Name ! (Name_Of (Project_Node_Of (Node, In_Tree), In_Tree)); if Present (Package_Node_Of (Node, In_Tree)) then ! Write_String ("."); Output_Name ! (Name_Of (Package_Node_Of (Node, In_Tree), In_Tree)); end if; elsif Present (Package_Node_Of (Node, In_Tree)) then Output_Name ! (Name_Of (Package_Node_Of (Node, In_Tree), In_Tree)); else ! Write_String ("project"); end if; ! Write_String ("'"); ! Output_Attribute_Name (Name_Of (Node, In_Tree)); declare Index : constant Name_Id := --- 741,767 ---- and then Project_Node_Of (Node, In_Tree) /= Project then Output_Name ! (Name_Of (Project_Node_Of (Node, In_Tree), In_Tree), ! Indent); if Present (Package_Node_Of (Node, In_Tree)) then ! Write_String (".", Indent); Output_Name ! (Name_Of (Package_Node_Of (Node, In_Tree), In_Tree), ! Indent); end if; elsif Present (Package_Node_Of (Node, In_Tree)) then Output_Name ! (Name_Of (Package_Node_Of (Node, In_Tree), In_Tree), ! Indent); else ! Write_String ("project", Indent); end if; ! Write_String ("'", Indent); ! Output_Attribute_Name (Name_Of (Node, In_Tree), Indent); declare Index : constant Name_Id := *************** package body Prj.PP is *** 712,720 **** begin if Index /= No_Name then ! Write_String (" ("); ! Output_String (Index); ! Write_String (")"); end if; end; --- 769,777 ---- begin if Index /= No_Name then ! Write_String (" (", Indent); ! Output_String (Index, Indent); ! Write_String (")", Indent); end if; end; *************** package body Prj.PP is *** 743,753 **** Write_Empty_Line; Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("case "); Print (Case_Variable_Reference_Of (Node, In_Tree), Indent); ! Write_String (" is"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), --- 800,810 ---- Write_Empty_Line; Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("case ", Indent); Print (Case_Variable_Reference_Of (Node, In_Tree), Indent); ! Write_String (" is", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), *************** package body Prj.PP is *** 784,793 **** Write_Empty_Line; Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("when "); if No (First_Choice_Of (Node, In_Tree)) then ! Write_String ("others"); else declare --- 841,850 ---- Write_Empty_Line; Print (First_Comment_Before (Node, In_Tree), Indent); Start_Line (Indent); ! Write_String ("when ", Indent); if No (First_Choice_Of (Node, In_Tree)) then ! Write_String ("others", Indent); else declare *************** package body Prj.PP is *** 799,811 **** Label := Next_Literal_String (Label, In_Tree); if Present (Label) then ! Write_String (" | "); end if; end loop; end; end if; ! Write_String (" =>"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), --- 856,868 ---- Label := Next_Literal_String (Label, In_Tree); if Present (Label) then ! Write_String (" | ", Indent); end if; end loop; end; end if; ! Write_String (" =>", Indent); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), *************** package body Prj.PP is *** 837,845 **** end if; Start_Line (Indent); ! Write_String ("--"); Write_String (Get_Name_String (String_Value_Of (Node, In_Tree)), Truncated => True); Write_Line (""); --- 894,903 ---- end if; Start_Line (Indent); ! Write_String ("--", Indent); Write_String (Get_Name_String (String_Value_Of (Node, In_Tree)), + Indent, Truncated => True); Write_Line (""); diff -Nrcpad gcc-4.5.2/gcc/ada/prj-pp.ads gcc-4.6.0/gcc/ada/prj-pp.ads *** gcc-4.5.2/gcc/ada/prj-pp.ads Wed Apr 29 09:22:32 2009 --- gcc-4.6.0/gcc/ada/prj-pp.ads Tue Oct 5 10:14:50 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package Prj.PP is *** 43,63 **** type Write_Str_Ap is access procedure (S : String); procedure Pretty_Print (Project : Prj.Tree.Project_Node_Id; In_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Increment : Positive := 3; ! Eliminate_Empty_Case_Constructions : Boolean := False; ! Minimize_Empty_Lines : Boolean := False; ! W_Char : Write_Char_Ap := null; ! W_Eol : Write_Eol_Ap := null; ! W_Str : Write_Str_Ap := null; Backward_Compatibility : Boolean; ! Id : Prj.Project_Id := Prj.No_Project); -- Output a project file, using either the default output routines, or the -- ones specified by W_Char, W_Eol and W_Str. -- ! -- Increment is the number of spaces for each indentation level. -- -- W_Char, W_Eol and W_Str can be used to change the default output -- procedures. The default values force the output to Standard_Output. --- 43,67 ---- type Write_Str_Ap is access procedure (S : String); + subtype Max_Length_Of_Line is Positive range 50 .. 255; + procedure Pretty_Print (Project : Prj.Tree.Project_Node_Id; In_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Increment : Positive := 3; ! Eliminate_Empty_Case_Constructions : Boolean := False; ! Minimize_Empty_Lines : Boolean := False; ! W_Char : Write_Char_Ap := null; ! W_Eol : Write_Eol_Ap := null; ! W_Str : Write_Str_Ap := null; Backward_Compatibility : Boolean; ! Id : Prj.Project_Id := Prj.No_Project; ! Max_Line_Length : Max_Length_Of_Line := ! Max_Length_Of_Line'Last); -- Output a project file, using either the default output routines, or the -- ones specified by W_Char, W_Eol and W_Str. -- ! -- Increment is the number of spaces for each indentation level -- -- W_Char, W_Eol and W_Str can be used to change the default output -- procedures. The default values force the output to Standard_Output. *************** package Prj.PP is *** 77,82 **** --- 81,88 ---- -- -- Id is used to compute the display name of the project including its -- proper casing. + -- + -- Max_Line_Length is the maximum line length in the project file private diff -Nrcpad gcc-4.5.2/gcc/ada/prj-proc.adb gcc-4.6.0/gcc/ada/prj-proc.adb *** gcc-4.5.2/gcc/ada/prj-proc.adb Mon Nov 30 11:02:59 2009 --- gcc-4.6.0/gcc/ada/prj-proc.adb Fri Oct 8 10:22:31 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Prj.Ext; use Prj.Ext; *** 33,38 **** --- 33,40 ---- with Prj.Nmsc; use Prj.Nmsc; with Snames; + with Ada.Strings.Fixed; use Ada.Strings.Fixed; + with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.HTable; *************** package body Prj.Proc is *** 76,84 **** -- the package or project with declarations Decl. procedure Check ! (In_Tree : Project_Tree_Ref; ! Project : Project_Id; ! Flags : Processing_Flags); -- Set all projects to not checked, then call Recursive_Check for the -- main project Project. Project is set to No_Project if errors occurred. -- Current_Dir is for optimization purposes, avoiding extra system calls. --- 78,87 ---- -- the package or project with declarations Decl. procedure Check ! (In_Tree : Project_Tree_Ref; ! Project : Project_Id; ! Node_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Flags : Processing_Flags); -- Set all projects to not checked, then call Recursive_Check for the -- main project Project. Project is set to No_Project if errors occurred. -- Current_Dir is for optimization purposes, avoiding extra system calls. *************** package body Prj.Proc is *** 87,101 **** -- based languages) procedure Copy_Package_Declarations ! (From : Declarations; ! To : in out Declarations; ! New_Loc : Source_Ptr; ! Naming_Restricted : Boolean; ! In_Tree : Project_Tree_Ref); -- Copy a package declaration From to To for a renamed package. Change the ! -- locations of all the attributes to New_Loc. When Naming_Restricted is ! -- True, do not copy attributes Body, Spec, Implementation and ! -- Specification. function Expression (Project : Project_Id; --- 90,104 ---- -- based languages) procedure Copy_Package_Declarations ! (From : Declarations; ! To : in out Declarations; ! New_Loc : Source_Ptr; ! Restricted : Boolean; ! In_Tree : Project_Tree_Ref); -- Copy a package declaration From to To for a renamed package. Change the ! -- locations of all the attributes to New_Loc. When Restricted is ! -- True, do not copy attributes Body, Spec, Implementation, Specification ! -- and Linker_Options. function Expression (Project : Project_Id; *************** package body Prj.Proc is *** 270,281 **** ----------- procedure Check ! (In_Tree : Project_Tree_Ref; ! Project : Project_Id; ! Flags : Processing_Flags) is begin ! Process_Naming_Scheme (In_Tree, Project, Flags); -- Set the Other_Part field for the units --- 273,285 ---- ----------- procedure Check ! (In_Tree : Project_Tree_Ref; ! Project : Project_Id; ! Node_Tree : Prj.Tree.Project_Node_Tree_Ref; ! Flags : Processing_Flags) is begin ! Process_Naming_Scheme (In_Tree, Project, Node_Tree, Flags); -- Set the Other_Part field for the units *************** package body Prj.Proc is *** 314,324 **** ------------------------------- procedure Copy_Package_Declarations ! (From : Declarations; ! To : in out Declarations; ! New_Loc : Source_Ptr; ! Naming_Restricted : Boolean; ! In_Tree : Project_Tree_Ref) is V1 : Variable_Id; V2 : Variable_Id := No_Variable; --- 318,328 ---- ------------------------------- procedure Copy_Package_Declarations ! (From : Declarations; ! To : in out Declarations; ! New_Loc : Source_Ptr; ! Restricted : Boolean; ! In_Tree : Project_Tree_Ref) is V1 : Variable_Id; V2 : Variable_Id := No_Variable; *************** package body Prj.Proc is *** 346,351 **** --- 350,361 ---- Var := In_Tree.Variable_Elements.Table (V1); V1 := Var.Next; + -- Do not copy the value of attribute Linker_Options if Restricted + + if Restricted and then Var.Name = Snames.Name_Linker_Options then + Var.Value.Values := Nil_String; + end if; + -- Remove the Next component Var.Next := No_Variable; *************** package body Prj.Proc is *** 376,391 **** Arr := In_Tree.Arrays.Table (A1); A1 := Arr.Next; ! if not Naming_Restricted or else ! (Arr.Name /= Snames.Name_Body ! and then Arr.Name /= Snames.Name_Spec ! and then Arr.Name /= Snames.Name_Implementation ! and then Arr.Name /= Snames.Name_Specification) then -- Remove the Next component Arr.Next := No_Array; - Array_Table.Increment_Last (In_Tree.Arrays); -- Create new Array declaration --- 386,401 ---- Arr := In_Tree.Arrays.Table (A1); A1 := Arr.Next; ! if not Restricted ! or else ! (Arr.Name /= Snames.Name_Body and then ! Arr.Name /= Snames.Name_Spec and then ! Arr.Name /= Snames.Name_Implementation and then ! Arr.Name /= Snames.Name_Specification) then -- Remove the Next component Arr.Next := No_Array; Array_Table.Increment_Last (In_Tree.Arrays); -- Create new Array declaration *************** package body Prj.Proc is *** 454,459 **** --- 464,473 ---- Lower : Boolean; begin + if Index = All_Other_Names then + return Index; + end if; + Get_Name_String (Index); Lower := Case_Insensitive (Attr, Tree); *************** package body Prj.Proc is *** 1009,1023 **** From_Project_Node_Tree)); declare ! Name : constant Name_Id := Name_Find; ! Default : Name_Id := No_Name; ! Value : Name_Id := No_Name; ! ! Def_Var : Variable_Value; Default_Node : constant Project_Node_Id := ! External_Default_Of ! (The_Current_Term, From_Project_Node_Tree); begin -- If there is a default value for the external reference, --- 1023,1039 ---- From_Project_Node_Tree)); declare ! Name : constant Name_Id := Name_Find; ! Default : Name_Id := No_Name; ! Value : Name_Id := No_Name; ! Ext_List : Boolean := False; ! Str_List : String_List_Access := null; ! Def_Var : Variable_Value; Default_Node : constant Project_Node_Id := ! External_Default_Of ! (The_Current_Term, ! From_Project_Node_Tree); begin -- If there is a default value for the external reference, *************** package body Prj.Proc is *** 1041,1059 **** end if; end if; ! Value := ! Prj.Ext.Value_Of (From_Project_Node_Tree, Name, Default); ! if Value = No_Name then ! if not Quiet_Output then ! Error_Msg ! (Flags, "?undefined external reference", ! Location_Of ! (The_Current_Term, From_Project_Node_Tree), ! Project); end if; ! Value := Empty_String; end if; case Kind is --- 1057,1188 ---- end if; end if; ! Ext_List := Expression_Kind_Of ! (The_Current_Term, ! From_Project_Node_Tree) = List; ! if Ext_List then ! Value := ! Prj.Ext.Value_Of ! (From_Project_Node_Tree, Name, No_Name); ! ! if Value /= No_Name then ! declare ! Sep : constant String := ! Get_Name_String (Default); ! First : Positive := 1; ! Lst : Natural; ! Done : Boolean := False; ! Nmb : Natural; ! ! begin ! Get_Name_String (Value); ! ! if Name_Len = 0 ! or else Sep'Length = 0 ! or else Name_Buffer (1 .. Name_Len) = Sep ! then ! Done := True; ! end if; ! ! if not Done and then Name_Len < Sep'Length then ! Str_List := ! new String_List' ! (1 => new String' ! (Name_Buffer (1 .. Name_Len))); ! Done := True; ! end if; ! ! if not Done then ! if Name_Buffer (1 .. Sep'Length) = Sep then ! First := Sep'Length + 1; ! end if; ! ! if Name_Len - First + 1 >= Sep'Length ! and then ! Name_Buffer (Name_Len - Sep'Length + 1 .. ! Name_Len) = Sep ! then ! Name_Len := Name_Len - Sep'Length; ! end if; ! ! if Name_Len = 0 then ! Str_List := ! new String_List'(1 => new String'("")); ! Done := True; ! end if; ! end if; ! ! if not Done then ! -- Count the number of string ! ! declare ! Saved : constant Positive := First; ! begin ! ! Nmb := 1; ! loop ! Lst := ! Index ! (Source => ! Name_Buffer (First .. Name_Len), ! Pattern => Sep); ! exit when Lst = 0; ! Nmb := Nmb + 1; ! First := Lst + Sep'Length; ! end loop; ! ! First := Saved; ! end; ! ! Str_List := new String_List (1 .. Nmb); ! ! -- Populate the string list ! ! Nmb := 1; ! loop ! Lst := ! Index ! (Source => ! Name_Buffer (First .. Name_Len), ! Pattern => Sep); ! ! if Lst = 0 then ! Str_List (Nmb) := ! new String' ! (Name_Buffer (First .. Name_Len)); ! exit; ! ! else ! Str_List (Nmb) := ! new String' ! (Name_Buffer (First .. Lst - 1)); ! Nmb := Nmb + 1; ! First := Lst + Sep'Length; ! end if; ! end loop; ! end if; ! end; end if; ! else ! -- Get the value ! ! Value := ! Prj.Ext.Value_Of ! (From_Project_Node_Tree, Name, Default); ! ! if Value = No_Name then ! if not Quiet_Output then ! Error_Msg ! (Flags, "?undefined external reference", ! Location_Of ! (The_Current_Term, From_Project_Node_Tree), ! Project); ! end if; ! ! Value := Empty_String; ! end if; end if; case Kind is *************** package body Prj.Proc is *** 1062,1095 **** null; when Single => ! Add (Result.Value, Value); ! when List => ! String_Element_Table.Increment_Last ! (In_Tree.String_Elements); ! if Last = Nil_String then ! Result.Values := String_Element_Table.Last (In_Tree.String_Elements); ! else ! In_Tree.String_Elements.Table ! (Last).Next := String_Element_Table.Last ! (In_Tree.String_Elements); ! end if; ! Last := String_Element_Table.Last (In_Tree.String_Elements); ! In_Tree.String_Elements.Table (Last) := ! (Value => Value, ! Display_Value => No_Name, ! Location => ! Location_Of ! (The_Current_Term, From_Project_Node_Tree), ! Flag => False, ! Next => Nil_String, ! Index => 0); end case; end; --- 1191,1265 ---- null; when Single => ! if Ext_List then ! null; -- error ! else ! Add (Result.Value, Value); ! end if; ! when List => ! if not Ext_List or else Str_List /= null then ! String_Element_Table.Increment_Last (In_Tree.String_Elements); ! if Last = Nil_String then ! Result.Values := ! String_Element_Table.Last ! (In_Tree.String_Elements); ! else ! In_Tree.String_Elements.Table (Last).Next := ! String_Element_Table.Last (In_Tree.String_Elements); ! end if; ! ! Last := ! String_Element_Table.Last ! (In_Tree.String_Elements); ! ! if Ext_List then ! for Ind in Str_List'Range loop ! Name_Len := 0; ! Add_Str_To_Name_Buffer (Str_List (Ind).all); ! Value := Name_Find; ! In_Tree.String_Elements.Table (Last) := ! (Value => Value, ! Display_Value => No_Name, ! Location => ! Location_Of ! (The_Current_Term, ! From_Project_Node_Tree), ! Flag => False, ! Next => Nil_String, ! Index => 0); ! ! if Ind /= Str_List'Last then ! String_Element_Table.Increment_Last ! (In_Tree.String_Elements); ! In_Tree.String_Elements.Table ! (Last).Next := ! String_Element_Table.Last ! (In_Tree.String_Elements); ! Last := ! String_Element_Table.Last ! (In_Tree.String_Elements); ! end if; ! end loop; + else + In_Tree.String_Elements.Table (Last) := + (Value => Value, + Display_Value => No_Name, + Location => + Location_Of + (The_Current_Term, + From_Project_Node_Tree), + Flag => False, + Next => Nil_String, + Index => 0); + end if; + end if; end case; end; *************** package body Prj.Proc is *** 1255,1263 **** --- 1425,1525 ---- Pkg : Package_Id; Item : Project_Node_Id) is + procedure Check_Or_Set_Typed_Variable + (Value : in out Variable_Value; + Declaration : Project_Node_Id); + -- Check whether Value is valid for this typed variable declaration. If + -- it is an error, the behavior depends on the flags: either an error is + -- reported, or a warning, or nothing. In the last two cases, the value + -- of the variable is set to a valid value, replacing Value. + + --------------------------------- + -- Check_Or_Set_Typed_Variable -- + --------------------------------- + + procedure Check_Or_Set_Typed_Variable + (Value : in out Variable_Value; + Declaration : Project_Node_Id) + is + Loc : constant Source_Ptr := + Location_Of (Declaration, From_Project_Node_Tree); + + Reset_Value : Boolean := False; + Current_String : Project_Node_Id; + + begin + -- Report an error for an empty string + + if Value.Value = Empty_String then + Error_Msg_Name_1 := Name_Of (Declaration, From_Project_Node_Tree); + + case Flags.Allow_Invalid_External is + when Error => + Error_Msg (Flags, "no value defined for %%", Loc, Project); + when Warning => + Reset_Value := True; + Error_Msg (Flags, "?no value defined for %%", Loc, Project); + when Silent => + Reset_Value := True; + end case; + + else + -- Loop through all the valid strings for the + -- string type and compare to the string value. + + Current_String := + First_Literal_String + (String_Type_Of (Declaration, From_Project_Node_Tree), + From_Project_Node_Tree); + while Present (Current_String) + and then String_Value_Of + (Current_String, From_Project_Node_Tree) /= Value.Value + loop + Current_String := + Next_Literal_String (Current_String, From_Project_Node_Tree); + end loop; + + -- Report error if string value is not one for the string type + + if No (Current_String) then + Error_Msg_Name_1 := Value.Value; + Error_Msg_Name_2 := + Name_Of (Declaration, From_Project_Node_Tree); + + case Flags.Allow_Invalid_External is + when Error => + Error_Msg + (Flags, "value %% is illegal for typed string %%", + Loc, Project); + when Warning => + Error_Msg + (Flags, "?value %% is illegal for typed string %%", + Loc, Project); + Reset_Value := True; + when Silent => + Reset_Value := True; + end case; + end if; + end if; + + if Reset_Value then + Current_String := + First_Literal_String + (String_Type_Of (Declaration, From_Project_Node_Tree), + From_Project_Node_Tree); + + Value.Value := String_Value_Of + (Current_String, From_Project_Node_Tree); + end if; + end Check_Or_Set_Typed_Variable; + + -- Local variables + Current_Declarative_Item : Project_Node_Id; Current_Item : Project_Node_Id; + -- Start of processing for Process_Declarative_Items + begin -- Loop through declarative items *************** package body Prj.Proc is *** 1326,1332 **** if Present (Project_Of_Renamed_Package) then ! -- Renamed package declare Project_Name : constant Name_Id := --- 1588,1594 ---- if Present (Project_Of_Renamed_Package) then ! -- Renamed or extending package declare Project_Name : constant Name_Id := *************** package body Prj.Proc is *** 1353,1371 **** -- renaming declaration. Copy_Package_Declarations ! (From => In_Tree.Packages.Table (Renamed_Package).Decl, ! To => In_Tree.Packages.Table (New_Pkg).Decl, ! New_Loc => Location_Of (Current_Item, From_Project_Node_Tree), ! Naming_Restricted => False, ! In_Tree => In_Tree); end; - -- Standard package declaration, not renaming - else -- Set the default values of the attributes --- 1615,1631 ---- -- renaming declaration. Copy_Package_Declarations ! (From => In_Tree.Packages.Table (Renamed_Package).Decl, ! To => In_Tree.Packages.Table (New_Pkg).Decl, ! New_Loc => Location_Of (Current_Item, From_Project_Node_Tree), ! Restricted => False, ! In_Tree => In_Tree); end; else -- Set the default values of the attributes *************** package body Prj.Proc is *** 1380,1398 **** (Current_Item, From_Project_Node_Tree)), Project_Level => False); - -- And process declarative items of the new package - - Process_Declarative_Items - (Project => Project, - In_Tree => In_Tree, - Flags => Flags, - From_Project_Node => From_Project_Node, - From_Project_Node_Tree => From_Project_Node_Tree, - Pkg => New_Pkg, - Item => - First_Declarative_Item_Of - (Current_Item, From_Project_Node_Tree)); end if; end; end if; --- 1640,1661 ---- (Current_Item, From_Project_Node_Tree)), Project_Level => False); end if; + + -- Process declarative items (nothing to do when the + -- package is renaming, as the first declarative item is + -- null). + + Process_Declarative_Items + (Project => Project, + In_Tree => In_Tree, + Flags => Flags, + From_Project_Node => From_Project_Node, + From_Project_Node_Tree => From_Project_Node_Tree, + Pkg => New_Pkg, + Item => + First_Declarative_Item_Of + (Current_Item, From_Project_Node_Tree)); end; end if; *************** package body Prj.Proc is *** 1677,1683 **** else declare ! New_Value : constant Variable_Value := Expression (Project => Project, In_Tree => In_Tree, --- 1940,1946 ---- else declare ! New_Value : Variable_Value := Expression (Project => Project, In_Tree => In_Tree, *************** package body Prj.Proc is *** 1713,1771 **** if Kind_Of (Current_Item, From_Project_Node_Tree) = N_Typed_Variable_Declaration then ! -- Report an error for an empty string ! ! if New_Value.Value = Empty_String then ! Error_Msg_Name_1 := ! Name_Of (Current_Item, From_Project_Node_Tree); ! Error_Msg ! (Flags, ! "no value defined for %%", ! Location_Of ! (Current_Item, From_Project_Node_Tree), ! Project); ! ! else ! declare ! Current_String : Project_Node_Id; ! ! begin ! -- Loop through all the valid strings for the ! -- string type and compare to the string value. ! ! Current_String := ! First_Literal_String ! (String_Type_Of (Current_Item, ! From_Project_Node_Tree), ! From_Project_Node_Tree); ! while Present (Current_String) ! and then ! String_Value_Of ! (Current_String, From_Project_Node_Tree) /= ! New_Value.Value ! loop ! Current_String := ! Next_Literal_String ! (Current_String, From_Project_Node_Tree); ! end loop; ! ! -- Report an error if the string value is not ! -- one for the string type. ! ! if No (Current_String) then ! Error_Msg_Name_1 := New_Value.Value; ! Error_Msg_Name_2 := ! Name_Of ! (Current_Item, From_Project_Node_Tree); ! Error_Msg ! (Flags, ! "value %% is illegal for typed string %%", ! Location_Of ! (Current_Item, From_Project_Node_Tree), ! Project); ! end if; ! end; ! end if; end if; -- Comment here ??? --- 1976,1984 ---- if Kind_Of (Current_Item, From_Project_Node_Tree) = N_Typed_Variable_Declaration then ! Check_Or_Set_Typed_Variable ! (Value => New_Value, ! Declaration => Current_Item); end if; -- Comment here ??? *************** package body Prj.Proc is *** 2263,2269 **** Success := True; if Project /= No_Project then ! Check (In_Tree, Project, Flags); end if; -- If main project is an extending all project, set object directory of --- 2476,2482 ---- Success := True; if Project /= No_Project then ! Check (In_Tree, Project, From_Project_Node_Tree, Flags); end if; -- If main project is an extending all project, set object directory of *************** package body Prj.Proc is *** 2274,2286 **** Is_Extending_All (From_Project_Node, From_Project_Node_Tree) then declare ! Object_Dir : constant Path_Name_Type := ! Project.Object_Directory.Name; begin Prj := In_Tree.Projects; while Prj /= null loop if Prj.Project.Virtual then ! Prj.Project.Object_Directory.Name := Object_Dir; end if; Prj := Prj.Next; end loop; --- 2487,2499 ---- Is_Extending_All (From_Project_Node, From_Project_Node_Tree) then declare ! Object_Dir : constant Path_Information := ! Project.Object_Directory; begin Prj := In_Tree.Projects; while Prj /= null loop if Prj.Project.Virtual then ! Prj.Project.Object_Directory := Object_Dir; end if; Prj := Prj.Next; end loop; *************** package body Prj.Proc is *** 2579,2591 **** Next => Project.Decl.Packages); Project.Decl.Packages := Current_Pkg; Copy_Package_Declarations ! (From => Element.Decl, ! To => In_Tree.Packages.Table (Current_Pkg).Decl, ! New_Loc => No_Location, ! Naming_Restricted => ! Element.Name = Snames.Name_Naming, ! In_Tree => In_Tree); end if; Extended_Pkg := Element.Next; --- 2792,2803 ---- Next => Project.Decl.Packages); Project.Decl.Packages := Current_Pkg; Copy_Package_Declarations ! (From => Element.Decl, ! To => In_Tree.Packages.Table (Current_Pkg).Decl, ! New_Loc => No_Location, ! Restricted => True, ! In_Tree => In_Tree); end if; Extended_Pkg := Element.Next; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-strt.adb gcc-4.6.0/gcc/ada/prj-strt.adb *** gcc-4.5.2/gcc/ada/prj-strt.adb Mon Jul 13 12:04:11 2009 --- gcc-4.6.0/gcc/ada/prj-strt.adb Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body Prj.Strt is *** 74,81 **** Table_Initial => 10, Table_Increment => 100, Table_Name => "Prj.Strt.Choice_Lasts"); ! -- Used to store the indices of the choices in table Choices, ! -- to distinguish nested case constructions. Choice_First : Choice_Node_Id := 0; -- Index in table Choices of the first case label of the current --- 74,81 ---- Table_Initial => 10, Table_Increment => 100, Table_Name => "Prj.Strt.Choice_Lasts"); ! -- Used to store the indexes of the choices in table Choices, to ! -- distinguish nested case constructions. Choice_First : Choice_Node_Id := 0; -- Index in table Choices of the first case label of the current *************** package body Prj.Strt is *** 109,114 **** --- 109,115 ---- Current_Project : Project_Node_Id; Current_Package : Project_Node_Id; External_Value : out Project_Node_Id; + Expr_Kind : in out Variable_Kind; Flags : Processing_Flags); -- Parse an external reference. Current token is "external" *************** package body Prj.Strt is *** 216,223 **** Set_Case_Insensitive (Reference, In_Tree, To => Attribute_Kind_Of (Current_Attribute) in ! Case_Insensitive_Associative_Array .. ! Optional_Index_Case_Insensitive_Associative_Array); -- Scan past the attribute name --- 217,223 ---- Set_Case_Insensitive (Reference, In_Tree, To => Attribute_Kind_Of (Current_Attribute) in ! All_Case_Insensitive_Associative_Array); -- Scan past the attribute name *************** package body Prj.Strt is *** 230,248 **** if Token = Tok_Left_Paren then Scan (In_Tree); - Expect (Tok_String_Literal, "literal string"); ! if Token = Tok_String_Literal then Set_Associative_Array_Index_Of ! (Reference, In_Tree, To => Token_Name); Scan (In_Tree); - Expect (Tok_Right_Paren, "`)`"); ! if Token = Tok_Right_Paren then Scan (In_Tree); end if; end if; end if; end if; end if; --- 230,264 ---- if Token = Tok_Left_Paren then Scan (In_Tree); ! if Others_Allowed_For (Current_Attribute) ! and then Token = Tok_Others ! then Set_Associative_Array_Index_Of ! (Reference, In_Tree, To => All_Other_Names); Scan (In_Tree); ! else ! if Others_Allowed_For (Current_Attribute) then ! Expect ! (Tok_String_Literal, "literal string or others"); ! else ! Expect (Tok_String_Literal, "literal string"); ! end if; ! ! if Token = Tok_String_Literal then ! Set_Associative_Array_Index_Of ! (Reference, In_Tree, To => Token_Name); Scan (In_Tree); end if; end if; end if; + + Expect (Tok_Right_Paren, "`)`"); + + if Token = Tok_Right_Paren then + Scan (In_Tree); + end if; end if; end if; *************** package body Prj.Strt is *** 353,375 **** Current_Project : Project_Node_Id; Current_Package : Project_Node_Id; External_Value : out Project_Node_Id; Flags : Processing_Flags) is Field_Id : Project_Node_Id := Empty_Node; begin External_Value := Default_Project_Node (Of_Kind => N_External_Value, ! In_Tree => In_Tree, ! And_Expr_Kind => Single); Set_Location_Of (External_Value, In_Tree, To => Token_Ptr); ! -- The current token is External ! ! -- Get the left parenthesis Scan (In_Tree); Expect (Tok_Left_Paren, "`(`"); -- Scan past the left parenthesis --- 369,406 ---- Current_Project : Project_Node_Id; Current_Package : Project_Node_Id; External_Value : out Project_Node_Id; + Expr_Kind : in out Variable_Kind; Flags : Processing_Flags) is Field_Id : Project_Node_Id := Empty_Node; + Ext_List : Boolean := False; begin External_Value := Default_Project_Node (Of_Kind => N_External_Value, ! In_Tree => In_Tree); Set_Location_Of (External_Value, In_Tree, To => Token_Ptr); ! -- The current token is either external or external_as_list + Ext_List := Token = Tok_External_As_List; Scan (In_Tree); + + if Ext_List then + Set_Expression_Kind_Of (External_Value, In_Tree, To => List); + else + Set_Expression_Kind_Of (External_Value, In_Tree, To => Single); + end if; + + if Expr_Kind = Undefined then + if Ext_List then + Expr_Kind := List; + else + Expr_Kind := Single; + end if; + end if; + Expect (Tok_Left_Paren, "`(`"); -- Scan past the left parenthesis *************** package body Prj.Strt is *** 398,403 **** --- 429,438 ---- case Token is when Tok_Right_Paren => + if Ext_List then + Error_Msg (Flags, "`,` expected", Token_Ptr); + end if; + Scan (In_Tree); -- scan past right paren when Tok_Comma => *************** package body Prj.Strt is *** 433,439 **** end if; when others => ! Error_Msg (Flags, "`,` or `)` expected", Token_Ptr); end case; end if; end External_Reference; --- 468,478 ---- end if; when others => ! if Ext_List then ! Error_Msg (Flags, "`,` expected", Token_Ptr); ! else ! Error_Msg (Flags, "`,` or `)` expected", Token_Ptr); ! end if; end case; end if; end External_Reference; *************** package body Prj.Strt is *** 1478,1496 **** end if; end if; ! when Tok_External => ! ! -- An external reference is always a single string ! ! if Expr_Kind = Undefined then ! Expr_Kind := Single; ! end if; ! External_Reference (In_Tree => In_Tree, Flags => Flags, Current_Project => Current_Project, Current_Package => Current_Package, External_Value => Reference); Set_Current_Term (Term, In_Tree, To => Reference); --- 1517,1529 ---- end if; end if; ! when Tok_External | Tok_External_As_List => External_Reference (In_Tree => In_Tree, Flags => Flags, Current_Project => Current_Project, Current_Package => Current_Package, + Expr_Kind => Expr_Kind, External_Value => Reference); Set_Current_Term (Term, In_Tree, To => Reference); diff -Nrcpad gcc-4.5.2/gcc/ada/prj-tree.adb gcc-4.6.0/gcc/ada/prj-tree.adb *** gcc-4.5.2/gcc/ada/prj-tree.adb Mon Nov 30 12:02:49 2009 --- gcc-4.6.0/gcc/ada/prj-tree.adb Fri Oct 8 10:22:31 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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,29 **** --- 24,30 ---- ------------------------------------------------------------------------------ with Osint; use Osint; + with Prj.Env; use Prj.Env; with Prj.Err; with Ada.Unchecked_Deallocation; *************** package body Prj.Tree is *** 558,568 **** function Expression_Kind_Of (Node : Project_Node_Id; ! In_Tree : Project_Node_Tree_Ref) return Variable_Kind is begin pragma Assert (Present (Node) ! and then (In_Tree.Project_Nodes.Table (Node).Kind = N_Literal_String or else In_Tree.Project_Nodes.Table (Node).Kind = N_Attribute_Declaration --- 559,570 ---- function Expression_Kind_Of (Node : Project_Node_Id; ! In_Tree : Project_Node_Tree_Ref) return Variable_Kind ! is begin pragma Assert (Present (Node) ! and then -- should use Nkind_In here ??? why not??? (In_Tree.Project_Nodes.Table (Node).Kind = N_Literal_String or else In_Tree.Project_Nodes.Table (Node).Kind = N_Attribute_Declaration *************** package body Prj.Tree is *** 570,576 **** In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = ! N_Typed_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = N_Package_Declaration or else --- 572,578 ---- In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = ! N_Typed_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = N_Package_Declaration or else *************** package body Prj.Tree is *** 580,588 **** or else In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Reference or else ! In_Tree.Project_Nodes.Table (Node).Kind = ! N_Attribute_Reference)); ! return In_Tree.Project_Nodes.Table (Node).Expr_Kind; end Expression_Kind_Of; --- 582,590 ---- or else In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Reference or else ! In_Tree.Project_Nodes.Table (Node).Kind = N_Attribute_Reference ! or else ! In_Tree.Project_Nodes.Table (Node).Kind = N_External_Value)); return In_Tree.Project_Nodes.Table (Node).Expr_Kind; end Expression_Kind_Of; *************** package body Prj.Tree is *** 1836,1842 **** begin pragma Assert (Present (Node) ! and then (In_Tree.Project_Nodes.Table (Node).Kind = N_Literal_String or else In_Tree.Project_Nodes.Table (Node).Kind = N_Attribute_Declaration --- 1838,1844 ---- begin pragma Assert (Present (Node) ! and then -- should use Nkind_In here ??? why not??? (In_Tree.Project_Nodes.Table (Node).Kind = N_Literal_String or else In_Tree.Project_Nodes.Table (Node).Kind = N_Attribute_Declaration *************** package body Prj.Tree is *** 1844,1850 **** In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = ! N_Typed_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = N_Package_Declaration or else --- 1846,1852 ---- In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = ! N_Typed_Variable_Declaration or else In_Tree.Project_Nodes.Table (Node).Kind = N_Package_Declaration or else *************** package body Prj.Tree is *** 1854,1861 **** or else In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Reference or else ! In_Tree.Project_Nodes.Table (Node).Kind = ! N_Attribute_Reference)); In_Tree.Project_Nodes.Table (Node).Expr_Kind := To; end Set_Expression_Kind_Of; --- 1856,1864 ---- or else In_Tree.Project_Nodes.Table (Node).Kind = N_Variable_Reference or else ! In_Tree.Project_Nodes.Table (Node).Kind = N_Attribute_Reference ! or else ! In_Tree.Project_Nodes.Table (Node).Kind = N_External_Value)); In_Tree.Project_Nodes.Table (Node).Expr_Kind := To; end Set_Expression_Kind_Of; diff -Nrcpad gcc-4.5.2/gcc/ada/prj-tree.ads gcc-4.6.0/gcc/ada/prj-tree.ads *** gcc-4.5.2/gcc/ada/prj-tree.ads Mon Nov 30 12:02:49 2009 --- gcc-4.6.0/gcc/ada/prj-tree.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with GNAT.Dynamic_Tables; *** 31,36 **** --- 31,37 ---- with Table; with Prj.Attr; use Prj.Attr; + with Prj.Env; package Prj.Tree is *************** package Prj.Tree is *** 295,301 **** pragma Inline (Expression_Kind_Of); -- Only valid for N_Literal_String, N_Attribute_Declaration, -- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression, ! -- N_Term, N_Variable_Reference or N_Attribute_Reference nodes. function Is_Extending_All (Node : Project_Node_Id; --- 296,303 ---- pragma Inline (Expression_Kind_Of); -- Only valid for N_Literal_String, N_Attribute_Declaration, -- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression, ! -- N_Term, N_Variable_Reference, N_Attribute_Reference nodes or ! -- N_External_Value. function Is_Extending_All (Node : Project_Node_Id; *************** package Prj.Tree is *** 758,764 **** pragma Inline (Set_Expression_Kind_Of); -- Only valid for N_Literal_String, N_Attribute_Declaration, -- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression, ! -- N_Term, N_Variable_Reference or N_Attribute_Reference nodes. procedure Set_Is_Extending_All (Node : Project_Node_Id; --- 760,767 ---- pragma Inline (Set_Expression_Kind_Of); -- Only valid for N_Literal_String, N_Attribute_Declaration, -- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression, ! -- N_Term, N_Variable_Reference, N_Attribute_Reference or N_External_Value ! -- nodes. procedure Set_Is_Extending_All (Node : Project_Node_Id; *************** package Prj.Tree is *** 813,819 **** To : Int); pragma Inline (Set_Source_Index_Of); -- Only valid for N_Literal_String and N_Attribute_Declaration nodes. For ! -- N_Literal_String, set the source index of the litteral string. For -- N_Attribute_Declaration, set the source index of the index of the -- associative array element. --- 816,822 ---- To : Int); pragma Inline (Set_Source_Index_Of); -- Only valid for N_Literal_String and N_Attribute_Declaration nodes. For ! -- N_Literal_String, set the source index of the literal string. For -- N_Attribute_Declaration, set the source index of the index of the -- associative array element. *************** package Prj.Tree is *** 1466,1481 **** External_References : Name_To_Name_HTable.Instance; -- External references are stored in this hash table (and manipulated ! -- through subprogrames in prj-ext.ads). External references are -- project-tree specific so that one can load the same tree twice but -- have two views of it, for instance. ! Project_Path : String_Access; ! -- The project path, manipulated through subprograms in prj-ext.ads. ! -- As a special case, if the first character is '#:" or this variable is ! -- unset, this means that the PATH has not been fully initialized yet ! -- (although subprograms prj-ext.ads will properly take care of that). ! -- -- The project path is tree specific, since we might want to load -- simultaneously multiple projects, each with its own search path, in -- particular when using different compilers with different default --- 1469,1483 ---- External_References : Name_To_Name_HTable.Instance; -- External references are stored in this hash table (and manipulated ! -- through subprograms in prj-ext.ads). External references are -- project-tree specific so that one can load the same tree twice but -- have two views of it, for instance. ! Target_Name : String_Access := null; ! -- The target name, if any, specified with the gprbuild or gprclean ! -- switch --target=. ! ! Project_Path : aliased Prj.Env.Project_Search_Path; -- The project path is tree specific, since we might want to load -- simultaneously multiple projects, each with its own search path, in -- particular when using different compilers with different default diff -Nrcpad gcc-4.5.2/gcc/ada/prj-util.adb gcc-4.6.0/gcc/ada/prj-util.adb *** gcc-4.5.2/gcc/ada/prj-util.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/prj-util.adb Tue Oct 5 10:22:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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,40 **** --- 26,61 ---- with Ada.Unchecked_Deallocation; with GNAT.Case_Util; use GNAT.Case_Util; + with GNAT.Regexp; use GNAT.Regexp; with Osint; use Osint; with Output; use Output; + with Opt; with Prj.Com; with Snames; use Snames; + with Table; with Targparm; use Targparm; + with GNAT.HTable; + package body Prj.Util is + package Source_Info_Table is new Table.Table + (Table_Component_Type => Source_Info_Iterator, + Table_Index_Type => Natural, + Table_Low_Bound => 1, + Table_Initial => 10, + Table_Increment => 100, + Table_Name => "Makeutl.Source_Info_Table"); + + package Source_Info_Project_HTable is new GNAT.HTable.Simple_HTable + (Header_Num => Prj.Header_Num, + Element => Natural, + No_Element => 0, + Key => Name_Id, + Hash => Prj.Hash, + Equal => "="); + procedure Free is new Ada.Unchecked_Deallocation (Text_File_Data, Text_File); *************** package body Prj.Util is *** 43,60 **** ----------- procedure Close (File : in out Text_File) is begin if File = null then Prj.Com.Fail ("Close attempted on an invalid Text_File"); end if; ! -- Close file, no need to test status, since this is a file that we ! -- read, and the file was read successfully before we closed it. - Close (File.FD); Free (File); end Close; --------------- -- Duplicate -- --------------- --- 64,128 ---- ----------- procedure Close (File : in out Text_File) is + Len : Integer; + Status : Boolean; + begin if File = null then Prj.Com.Fail ("Close attempted on an invalid Text_File"); end if; ! if File.Out_File then ! if File.Buffer_Len > 0 then ! Len := Write (File.FD, File.Buffer'Address, File.Buffer_Len); ! ! if Len /= File.Buffer_Len then ! Prj.Com.Fail ("Unable to write to an out Text_File"); ! end if; ! end if; ! ! Close (File.FD, Status); ! ! if not Status then ! Prj.Com.Fail ("Unable to close an out Text_File"); ! end if; ! ! else ! ! -- Close in file, no need to test status, since this is a file that ! -- we read, and the file was read successfully before we closed it. ! ! Close (File.FD); ! end if; Free (File); end Close; + ------------ + -- Create -- + ------------ + + procedure Create (File : out Text_File; Name : String) is + FD : File_Descriptor; + File_Name : String (1 .. Name'Length + 1); + + begin + File_Name (1 .. Name'Length) := Name; + File_Name (File_Name'Last) := ASCII.NUL; + FD := Create_File (Name => File_Name'Address, + Fmode => GNAT.OS_Lib.Text); + + if FD = Invalid_FD then + File := null; + + else + File := new Text_File_Data; + File.FD := FD; + File.Out_File := True; + File.End_Of_File_Reached := True; + end if; + end Create; + --------------- -- Duplicate -- --------------- *************** package body Prj.Util is *** 110,116 **** Main : File_Name_Type; Index : Int; Ada_Main : Boolean := True; ! Language : String := "") return File_Name_Type is pragma Assert (Project /= No_Project); --- 178,185 ---- Main : File_Name_Type; Index : Int; Ada_Main : Boolean := True; ! Language : String := ""; ! Include_Suffix : Boolean := True) return File_Name_Type is pragma Assert (Project /= No_Project); *************** package body Prj.Util is *** 130,137 **** In_Package => Builder_Package, In_Tree => In_Tree); - Executable_Suffix_Name : Name_Id := No_Name; - Lang : Language_Ptr; Spec_Suffix : Name_Id := No_Name; --- 199,204 ---- *************** package body Prj.Util is *** 145,150 **** --- 212,221 ---- S_Suffix : File_Name_Type); -- Get the non empty suffixes in variables Spec_Suffix and Body_Suffix + function Add_Suffix (File : File_Name_Type) return File_Name_Type; + -- Return the name of the executable, based on File, and adding the + -- executable suffix if needed + ------------------ -- Get_Suffixes -- ------------------ *************** package body Prj.Util is *** 165,170 **** --- 236,287 ---- end if; end Get_Suffixes; + ---------------- + -- Add_Suffix -- + ---------------- + + function Add_Suffix (File : File_Name_Type) return File_Name_Type is + Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; + Result : File_Name_Type; + Suffix_From_Project : Variable_Value; + begin + if Include_Suffix then + if Project.Config.Executable_Suffix /= No_Name then + Executable_Extension_On_Target := + Project.Config.Executable_Suffix; + end if; + + Result := Executable_Name (File); + Executable_Extension_On_Target := Saved_EEOT; + return Result; + + elsif Builder_Package /= No_Package then + + -- If the suffix is specified in the project itself, as opposed to + -- the config file, it needs to be taken into account. However, + -- when the project was processed, in both cases the suffix was + -- stored in Project.Config, so get it from the project again. + + Suffix_From_Project := + Prj.Util.Value_Of + (Variable_Name => Name_Executable_Suffix, + In_Variables => + In_Tree.Packages.Table (Builder_Package).Decl.Attributes, + In_Tree => In_Tree); + + if Suffix_From_Project /= Nil_Variable_Value + and then Suffix_From_Project.Value /= No_Name + then + Executable_Extension_On_Target := Suffix_From_Project.Value; + Result := Executable_Name (File); + Executable_Extension_On_Target := Saved_EEOT; + return Result; + end if; + end if; + + return File; + end Add_Suffix; + -- Start of processing for Executable_Of begin *************** package body Prj.Util is *** 181,188 **** end if; if Builder_Package /= No_Package then - Executable_Suffix_Name := Project.Config.Executable_Suffix; - if Executable = Nil_Variable_Value and then Ada_Main then Get_Name_String (Main); --- 298,303 ---- *************** package body Prj.Util is *** 237,258 **** and then Executable.Value /= No_Name and then Length_Of_Name (Executable.Value) /= 0 then ! -- Get the executable name. If Executable_Suffix is defined, ! -- make sure that it will be the extension of the executable. ! ! declare ! Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; ! Result : File_Name_Type; ! ! begin ! if Executable_Suffix_Name /= No_Name then ! Executable_Extension_On_Target := Executable_Suffix_Name; ! end if; ! ! Result := Executable_Name (File_Name_Type (Executable.Value)); ! Executable_Extension_On_Target := Saved_EEOT; ! return Result; ! end; end if; end if; --- 352,358 ---- and then Executable.Value /= No_Name and then Length_Of_Name (Executable.Value) /= 0 then ! return Add_Suffix (File_Name_Type (Executable.Value)); end if; end if; *************** package body Prj.Util is *** 287,310 **** Get_Name_String (Strip_Suffix (Main)); end if; ! -- Get the executable name. If Executable_Suffix is defined in the ! -- configuration, make sure that it will be the extension of the ! -- executable. ! ! declare ! Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; ! Result : File_Name_Type; ! ! begin ! if Project.Config.Executable_Suffix /= No_Name then ! Executable_Extension_On_Target := ! Project.Config.Executable_Suffix; ! end if; ! ! Result := Executable_Name (Name_Find); ! Executable_Extension_On_Target := Saved_EEOT; ! return Result; ! end; end Executable_Of; -------------- --- 387,393 ---- Get_Name_String (Strip_Suffix (Main)); end if; ! return Add_Suffix (Name_Find); end Executable_Of; -------------- *************** package body Prj.Util is *** 350,355 **** --- 433,441 ---- begin if File = null then Prj.Com.Fail ("Get_Line attempted on an invalid Text_File"); + + elsif File.Out_File then + Prj.Com.Fail ("Get_Line attempted on an out file"); end if; Last := Line'First - 1; *************** package body Prj.Util is *** 385,390 **** --- 471,493 ---- end if; end Get_Line; + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize + (Iter : out Source_Info_Iterator; + For_Project : Name_Id) + is + Ind : constant Natural := Source_Info_Project_HTable.Get (For_Project); + begin + if Ind = 0 then + Iter := (No_Source_Info, 0); + else + Iter := Source_Info_Table.Table (Ind); + end if; + end Initialize; + -------------- -- Is_Valid -- -------------- *************** package body Prj.Util is *** 395,400 **** --- 498,517 ---- end Is_Valid; ---------- + -- Next -- + ---------- + + procedure Next (Iter : in out Source_Info_Iterator) is + begin + if Iter.Next = 0 then + Iter.Info := No_Source_Info; + + else + Iter := Source_Info_Table.Table (Iter.Next); + end if; + end Next; + + ---------- -- Open -- ---------- *************** package body Prj.Util is *** 481,486 **** --- 598,791 ---- end loop; end Put; + procedure Put (File : Text_File; S : String) is + Len : Integer; + begin + if File = null then + Prj.Com.Fail ("Attempted to write on an invalid Text_File"); + + elsif not File.Out_File then + Prj.Com.Fail ("Attempted to write an in Text_File"); + end if; + + if File.Buffer_Len + S'Length > File.Buffer'Last then + -- Write buffer + Len := Write (File.FD, File.Buffer'Address, File.Buffer_Len); + + if Len /= File.Buffer_Len then + Prj.Com.Fail ("Failed to write to an out Text_File"); + end if; + + File.Buffer_Len := 0; + end if; + + File.Buffer (File.Buffer_Len + 1 .. File.Buffer_Len + S'Length) := S; + File.Buffer_Len := File.Buffer_Len + S'Length; + end Put; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (File : Text_File; Line : String) is + L : String (1 .. Line'Length + 1); + begin + L (1 .. Line'Length) := Line; + L (L'Last) := ASCII.LF; + Put (File, L); + end Put_Line; + + --------------------------- + -- Read_Source_Info_File -- + --------------------------- + + procedure Read_Source_Info_File (Tree : Project_Tree_Ref) is + File : Text_File; + Info : Source_Info_Iterator; + Proj : Name_Id; + + procedure Report_Error; + + ------------------ + -- Report_Error -- + ------------------ + + procedure Report_Error is + begin + Write_Line ("errors in source info file """ & + Tree.Source_Info_File_Name.all & '"'); + Tree.Source_Info_File_Exists := False; + end Report_Error; + + begin + Source_Info_Project_HTable.Reset; + Source_Info_Table.Init; + + if Tree.Source_Info_File_Name = null then + Tree.Source_Info_File_Exists := False; + return; + end if; + + Open (File, Tree.Source_Info_File_Name.all); + + if not Is_Valid (File) then + if Opt.Verbose_Mode then + Write_Line ("source info file " & Tree.Source_Info_File_Name.all & + " does not exist"); + end if; + + Tree.Source_Info_File_Exists := False; + return; + end if; + + Tree.Source_Info_File_Exists := True; + + if Opt.Verbose_Mode then + Write_Line ("Reading source info file " & + Tree.Source_Info_File_Name.all); + end if; + + Source_Loop : + while not End_Of_File (File) loop + Info := (new Source_Info_Data, 0); + Source_Info_Table.Increment_Last; + + -- project name + Get_Line (File, Name_Buffer, Name_Len); + Proj := Name_Find; + Info.Info.Project := Proj; + Info.Next := Source_Info_Project_HTable.Get (Proj); + Source_Info_Project_HTable.Set (Proj, Source_Info_Table.Last); + + if End_Of_File (File) then + Report_Error; + exit Source_Loop; + end if; + + -- language name + Get_Line (File, Name_Buffer, Name_Len); + Info.Info.Language := Name_Find; + + if End_Of_File (File) then + Report_Error; + exit Source_Loop; + end if; + + -- kind + Get_Line (File, Name_Buffer, Name_Len); + Info.Info.Kind := Source_Kind'Value (Name_Buffer (1 .. Name_Len)); + + if End_Of_File (File) then + Report_Error; + exit Source_Loop; + end if; + + -- display path name + Get_Line (File, Name_Buffer, Name_Len); + Info.Info.Display_Path_Name := Name_Find; + Info.Info.Path_Name := Info.Info.Display_Path_Name; + + if End_Of_File (File) then + Report_Error; + exit Source_Loop; + end if; + + -- optional fields + Option_Loop : + loop + Get_Line (File, Name_Buffer, Name_Len); + exit Option_Loop when Name_Len = 0; + + if Name_Len <= 2 then + Report_Error; + exit Source_Loop; + + else + if Name_Buffer (1 .. 2) = "P=" then + Name_Buffer (1 .. Name_Len - 2) := + Name_Buffer (3 .. Name_Len); + Name_Len := Name_Len - 2; + Info.Info.Path_Name := Name_Find; + + elsif Name_Buffer (1 .. 2) = "U=" then + Name_Buffer (1 .. Name_Len - 2) := + Name_Buffer (3 .. Name_Len); + Name_Len := Name_Len - 2; + Info.Info.Unit_Name := Name_Find; + + elsif Name_Buffer (1 .. 2) = "I=" then + Info.Info.Index := Int'Value (Name_Buffer (3 .. Name_Len)); + + elsif Name_Buffer (1 .. Name_Len) = "N=T" then + Info.Info.Naming_Exception := True; + + else + Report_Error; + exit Source_Loop; + end if; + end if; + end loop Option_Loop; + + Source_Info_Table.Table (Source_Info_Table.Last) := Info; + end loop Source_Loop; + + Close (File); + + exception + when others => + Close (File); + Report_Error; + end Read_Source_Info_File; + + -------------------- + -- Source_Info_Of -- + -------------------- + + function Source_Info_Of (Iter : Source_Info_Iterator) return Source_Info is + begin + return Iter.Info; + end Source_Info_Of; + -------------- -- Value_Of -- -------------- *************** package body Prj.Util is *** 544,550 **** Src_Index : Int := 0; In_Array : Array_Element_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False) return Variable_Value is Current : Array_Element_Id; Element : Array_Element; --- 849,856 ---- Src_Index : Int := 0; In_Array : Array_Element_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False; ! Allow_Wildcards : Boolean := False) return Variable_Value is Current : Array_Element_Id; Element : Array_Element; *************** package body Prj.Util is *** 584,591 **** end if; end if; ! if Real_Index_1 = Real_Index_2 and then ! Src_Index = Element.Src_Index then return Element.Value; else --- 890,902 ---- end if; end if; ! if Src_Index = Element.Src_Index and then ! (Real_Index_1 = Real_Index_2 or else ! (Real_Index_2 /= All_Other_Names and then ! Allow_Wildcards and then ! Match (Get_Name_String (Real_Index_1), ! Compile (Get_Name_String (Real_Index_2), ! Glob => True)))) then return Element.Value; else *************** package body Prj.Util is *** 602,608 **** Attribute_Or_Array_Name : Name_Id; In_Package : Package_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False) return Variable_Value is The_Array : Array_Element_Id; The_Attribute : Variable_Value := Nil_Variable_Value; --- 913,920 ---- Attribute_Or_Array_Name : Name_Id; In_Package : Package_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False; ! Allow_Wildcards : Boolean := False) return Variable_Value is The_Array : Array_Element_Id; The_Attribute : Variable_Value := Nil_Variable_Value; *************** package body Prj.Util is *** 623,629 **** Src_Index => Index, In_Array => The_Array, In_Tree => In_Tree, ! Force_Lower_Case_Index => Force_Lower_Case_Index); -- If there is no array element, look for a variable --- 935,942 ---- Src_Index => Index, In_Array => The_Array, In_Tree => In_Tree, ! Force_Lower_Case_Index => Force_Lower_Case_Index, ! Allow_Wildcards => Allow_Wildcards); -- If there is no array element, look for a variable *************** package body Prj.Util is *** 731,736 **** --- 1044,1135 ---- return Nil_Variable_Value; end Value_Of; + ---------------------------- + -- Write_Source_Info_File -- + ---------------------------- + + procedure Write_Source_Info_File (Tree : Project_Tree_Ref) is + Iter : Source_Iterator := For_Each_Source (Tree); + Source : Prj.Source_Id; + File : Text_File; + + begin + if Opt.Verbose_Mode then + Write_Line ("Writing new source info file " & + Tree.Source_Info_File_Name.all); + end if; + + Create (File, Tree.Source_Info_File_Name.all); + + if not Is_Valid (File) then + Write_Line ("warning: unable to create source info file """ & + Tree.Source_Info_File_Name.all & '"'); + return; + end if; + + loop + Source := Element (Iter); + exit when Source = No_Source; + + if not Source.Locally_Removed and then + Source.Replaced_By = No_Source + then + -- Project name + + Put_Line (File, Get_Name_String (Source.Project.Name)); + + -- Language name + + Put_Line (File, Get_Name_String (Source.Language.Name)); + + -- Kind + + Put_Line (File, Source.Kind'Img); + + -- Display path name + + Put_Line (File, Get_Name_String (Source.Path.Display_Name)); + + -- Optional lines: + + -- Path name (P=) + + if Source.Path.Name /= Source.Path.Display_Name then + Put (File, "P="); + Put_Line (File, Get_Name_String (Source.Path.Name)); + end if; + + -- Unit name (U=) + + if Source.Unit /= No_Unit_Index then + Put (File, "U="); + Put_Line (File, Get_Name_String (Source.Unit.Name)); + end if; + + -- Multi-source index (I=) + + if Source.Index /= 0 then + Put (File, "I="); + Put_Line (File, Source.Index'Img); + end if; + + -- Naming exception ("N=T"); + + if Source.Naming_Exception then + Put_Line (File, "N=T"); + end if; + + -- Empty line to indicate end of info on this source + + Put_Line (File, ""); + end if; + + Next (Iter); + end loop; + + Close (File); + end Write_Source_Info_File; + --------------- -- Write_Str -- --------------- diff -Nrcpad gcc-4.5.2/gcc/ada/prj-util.ads gcc-4.6.0/gcc/ada/prj-util.ads *** gcc-4.5.2/gcc/ada/prj-util.ads Thu Jul 31 11:04:00 2008 --- gcc-4.6.0/gcc/ada/prj-util.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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,46 **** 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; ! 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??? --- 27,53 ---- package Prj.Util is function Executable_Of ! (Project : Project_Id; ! In_Tree : Project_Tree_Ref; ! Main : File_Name_Type; ! Index : Int; ! Ada_Main : Boolean := True; ! Language : String := ""; ! Include_Suffix : Boolean := True) 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. + -- + -- If Include_Suffix is true, then the ".exe" suffix (or any suffix defined + -- in the config) will be added. The suffix defined by the user in his own + -- project file is always taken into account. Otherwise, such a suffix is + -- not added. In particular, the prefix should not be added if you are + -- potentially testing for cross-platforms, since the suffix might not be + -- known (its default value comes from the ...-gnatmake prefix). + -- -- What is Ada_Main??? -- What is Language??? *************** package Prj.Util is *** 60,67 **** function Value_Of (Variable : Variable_Value; Default : String) return String; ! -- Get the value of a single string variable. If Variable is ! -- Nil_Variable_Value, is a string list or is defaulted, return Default. function Value_Of (Index : Name_Id; --- 67,74 ---- function Value_Of (Variable : Variable_Value; Default : String) return String; ! -- Get the value of a single string variable. If Variable is a string list, ! -- is Nil_Variable_Value,or is defaulted, return Default. function Value_Of (Index : Name_Id; *************** package Prj.Util is *** 79,85 **** Src_Index : Int := 0; In_Array : Array_Element_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False) return Variable_Value; -- Get a string array component (single String or String list). Returns -- Nil_Variable_Value if no component Index or if In_Array is null. -- --- 86,93 ---- Src_Index : Int := 0; In_Array : Array_Element_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False; ! Allow_Wildcards : Boolean := False) return Variable_Value; -- Get a string array component (single String or String list). Returns -- Nil_Variable_Value if no component Index or if In_Array is null. -- *************** package Prj.Util is *** 94,101 **** Attribute_Or_Array_Name : Name_Id; In_Package : Package_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False) return Variable_Value; ! -- In a specific package, -- - if there exists an array Attribute_Or_Array_Name with an index Name, -- returns the corresponding component (depending on the attribute, the -- index may or may not be case sensitive, see previous function), --- 102,110 ---- Attribute_Or_Array_Name : Name_Id; In_Package : Package_Id; In_Tree : Project_Tree_Ref; ! Force_Lower_Case_Index : Boolean := False; ! Allow_Wildcards : Boolean := False) return Variable_Value; ! -- In a specific package: -- - if there exists an array Attribute_Or_Array_Name with an index Name, -- returns the corresponding component (depending on the attribute, the -- index may or may not be case sensitive, see previous function), *************** package Prj.Util is *** 125,132 **** (Name : Name_Id; In_Packages : Package_Id; In_Tree : Project_Tree_Ref) return Package_Id; ! -- Returns a specified package in a package list. Returns No_Package if ! -- In_Packages is null or if Name is not the name of a package in -- Package_List. The caller must ensure that Name is in lower case. function Value_Of --- 134,141 ---- (Name : Name_Id; In_Packages : Package_Id; In_Tree : Project_Tree_Ref) return Package_Id; ! -- Returns a specified package in a package list. Returns No_Package ! -- if In_Packages is null or if Name is not the name of a package in -- Package_List. The caller must ensure that Name is in lower case. function Value_Of *************** package Prj.Util is *** 141,149 **** (S : String; Max_Length : Positive; Separator : Character); ! -- Output string S using Output.Write_Str. If S is too long to fit in ! -- one line of Max_Length, cut it in several lines, using Separator as ! -- the last character of each line, if possible. type Text_File is limited private; -- Represents a text file (default is invalid text file) --- 150,158 ---- (S : String; Max_Length : Positive; Separator : Character); ! -- Output string S using Output.Write_Str. If S is too long to fit in one ! -- line of Max_Length, cut it in several lines, using Separator as the last ! -- character of each line, if possible. type Text_File is limited private; -- Represents a text file (default is invalid text file) *************** package Prj.Util is *** 153,184 **** -- closed. procedure Open (File : out Text_File; Name : String); ! -- Open a text file to read (file is invalid if text file cannot be opened) function End_Of_File (File : Text_File) return Boolean; -- Returns True if the end of the text file File has been reached. Fails if ! -- File is invalid. procedure Get_Line (File : Text_File; Line : out String; Last : out Natural); ! -- Reads a line from an open text file (fails if file is invalid) procedure Close (File : in out Text_File); -- Close an open text file. File becomes invalid. Fails if File is already ! -- invalid. ! private type Text_File_Data is record FD : File_Descriptor := Invalid_FD; Buffer : String (1 .. 1_000); ! Buffer_Len : Natural; Cursor : Natural := 0; End_Of_File_Reached : Boolean := False; end record; type Text_File is access Text_File_Data; end Prj.Util; --- 162,253 ---- -- closed. procedure Open (File : out Text_File; Name : String); ! -- Open a text file to read (File is invalid if text file cannot be opened) ! ! procedure Create (File : out Text_File; Name : String); ! -- Create a text file to write (File is invalid if text file cannot be ! -- created). function End_Of_File (File : Text_File) return Boolean; -- Returns True if the end of the text file File has been reached. Fails if ! -- File is invalid. Return True if File is an out file. procedure Get_Line (File : Text_File; Line : out String; Last : out Natural); ! -- Reads a line from an open text file (fails if File is invalid or in an ! -- out file). ! ! procedure Put (File : Text_File; S : String); ! procedure Put_Line (File : Text_File; Line : String); ! -- Output a string or a line to an out text file (fails if File is invalid ! -- or in an in file). procedure Close (File : in out Text_File); -- Close an open text file. File becomes invalid. Fails if File is already ! -- invalid or if an out file cannot be closed successfully. ! ----------------------- ! -- Source info files -- ! ----------------------- ! ! procedure Write_Source_Info_File (Tree : Project_Tree_Ref); ! -- Create a new source info file, with the path name specified in the ! -- project tree data. Issue a warning if it is not possible to create ! -- the new file. ! ! procedure Read_Source_Info_File (Tree : Project_Tree_Ref); ! -- Check if there is a source info file specified for the project Tree. If ! -- so, attempt to read it. If the file exists and is successfully read, set ! -- the flag Source_Info_File_Exists to True for the tree. + type Source_Info_Data is record + Project : Name_Id; + Language : Name_Id; + Kind : Source_Kind; + Display_Path_Name : Name_Id; + Path_Name : Name_Id; + Unit_Name : Name_Id := No_Name; + Index : Int := 0; + Naming_Exception : Boolean := False; + end record; + -- Data read from a source info file for a single source + + type Source_Info is access all Source_Info_Data; + No_Source_Info : constant Source_Info := null; + + type Source_Info_Iterator is private; + -- Iterator to get the sources for a single project + + procedure Initialize + (Iter : out Source_Info_Iterator; + For_Project : Name_Id); + -- Initialize Iter for the project + + function Source_Info_Of (Iter : Source_Info_Iterator) return Source_Info; + -- Get the source info for the source corresponding to the current value of + -- the iterator. Returns No_Source_Info if there is no source corresponding + -- to the iterator. + + procedure Next (Iter : in out Source_Info_Iterator); + -- Advance the iterator to the next source in the project + + private type Text_File_Data is record FD : File_Descriptor := Invalid_FD; + Out_File : Boolean := False; Buffer : String (1 .. 1_000); ! Buffer_Len : Natural := 0; Cursor : Natural := 0; End_Of_File_Reached : Boolean := False; end record; type Text_File is access Text_File_Data; + type Source_Info_Iterator is record + Info : Source_Info; + Next : Natural; + end record; + end Prj.Util; diff -Nrcpad gcc-4.5.2/gcc/ada/prj.adb gcc-4.6.0/gcc/ada/prj.adb *** gcc-4.5.2/gcc/ada/prj.adb Mon Nov 30 12:02:49 2009 --- gcc-4.6.0/gcc/ada/prj.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Uintp; use Uintp; *** 34,43 **** with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Unchecked_Deallocation; with GNAT.Directory_Operations; use GNAT.Directory_Operations; ! ! with System.Case_Util; use System.Case_Util; ! with System.HTable; package body Prj is --- 34,42 ---- with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Unchecked_Deallocation; + with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Directory_Operations; use GNAT.Directory_Operations; ! with GNAT.HTable; package body Prj is *************** package body Prj is *** 49,56 **** The_Empty_String : Name_Id := No_Name; - subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case; - type Cst_String_Access is access constant String; All_Lower_Case_Image : aliased constant String := "lowercase"; --- 48,53 ---- *************** package body Prj is *** 250,265 **** return No_File; when Makefile => ! return ! File_Name_Type ! (Extend_Name ! (Source_File_Name, Makefile_Dependency_Suffix)); when ALI_File => ! return ! File_Name_Type ! (Extend_Name ! (Source_File_Name, ALI_Dependency_Suffix)); end case; end Dependency_Name; --- 247,256 ---- return No_File; when Makefile => ! return Extend_Name (Source_File_Name, Makefile_Dependency_Suffix); when ALI_File => ! return Extend_Name (Source_File_Name, ALI_Dependency_Suffix); end case; end Dependency_Name; *************** package body Prj is *** 568,574 **** -- Hash -- ---------- ! function Hash is new System.HTable.Hash (Header_Num => Header_Num); -- Used in implementation of other functions Hash below function Hash (Name : File_Name_Type) return Header_Num is --- 559,565 ---- -- Hash -- ---------- ! function Hash is new GNAT.HTable.Hash (Header_Num => Header_Num); -- Used in implementation of other functions Hash below function Hash (Name : File_Name_Type) return Header_Num is *************** package body Prj is *** 629,637 **** The_Empty_String := Name_Find; Prj.Attr.Initialize; ! Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project)); ! Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends)); ! Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External)); end if; if Tree /= No_Project_Tree then --- 620,634 ---- The_Empty_String := Name_Find; Prj.Attr.Initialize; ! ! Set_Name_Table_Byte ! (Name_Project, Token_Type'Pos (Tok_Project)); ! Set_Name_Table_Byte ! (Name_Extends, Token_Type'Pos (Tok_Extends)); ! Set_Name_Table_Byte ! (Name_External, Token_Type'Pos (Tok_External)); ! Set_Name_Table_Byte ! (Name_External_As_List, Token_Type'Pos (Tok_External_As_List)); end if; if Tree /= No_Project_Tree then *************** package body Prj is *** 879,884 **** --- 876,882 ---- Array_Table.Free (Tree.Arrays); Package_Table.Free (Tree.Packages); Source_Paths_Htable.Reset (Tree.Source_Paths_HT); + Source_Files_Htable.Reset (Tree.Source_Files_HT); Free_List (Tree.Projects, Free_Project => True); Free_Units (Tree.Units_HT); *************** package body Prj is *** 907,912 **** --- 905,914 ---- Array_Table.Init (Tree.Arrays); Package_Table.Init (Tree.Packages); Source_Paths_Htable.Reset (Tree.Source_Paths_HT); + Source_Files_Htable.Reset (Tree.Source_Files_HT); + Replaced_Source_HTable.Reset (Tree.Replaced_Sources); + + Tree.Replaced_Source_Number := 0; Free_List (Tree.Projects, Free_Project => True); Free_Units (Tree.Units_HT); *************** package body Prj is *** 1024,1034 **** if Project.Library then if Project.Object_Directory = No_Path_Information ! or else Contains_ALI_Files (Project.Library_ALI_Dir.Name) then ! return Project.Library_ALI_Dir.Name; else ! return Project.Object_Directory.Name; end if; -- For a non-library project, add object directory if it is not a --- 1026,1036 ---- if Project.Library then if Project.Object_Directory = No_Path_Information ! or else Contains_ALI_Files (Project.Library_ALI_Dir.Display_Name) then ! return Project.Library_ALI_Dir.Display_Name; else ! return Project.Object_Directory.Display_Name; end if; -- For a non-library project, add object directory if it is not a *************** package body Prj is *** 1054,1060 **** end loop; if Add_Object_Dir then ! return Project.Object_Directory.Name; end if; end; end if; --- 1056,1062 ---- end loop; if Add_Object_Dir then ! return Project.Object_Directory.Display_Name; end if; end; end if; *************** package body Prj is *** 1152,1160 **** function Is_Compilable (Source : Source_Id) return Boolean is begin ! return Source.Language.Config.Compiler_Driver /= No_File ! and then Length_Of_Name (Source.Language.Config.Compiler_Driver) /= 0 ! and then not Source.Locally_Removed; end Is_Compilable; ------------------------------ --- 1154,1191 ---- function Is_Compilable (Source : Source_Id) return Boolean is begin ! case Source.Compilable is ! when Unknown => ! if Source.Language.Config.Compiler_Driver /= No_File ! and then ! Length_Of_Name (Source.Language.Config.Compiler_Driver) /= 0 ! and then not Source.Locally_Removed ! and then (Source.Language.Config.Kind /= File_Based ! or else Source.Kind /= Spec) ! then ! -- Do not modify Source.Compilable before the source record ! -- has been initialized. ! ! if Source.Source_TS /= Empty_Time_Stamp then ! Source.Compilable := Yes; ! end if; ! ! return True; ! ! else ! if Source.Source_TS /= Empty_Time_Stamp then ! Source.Compilable := No; ! end if; ! ! return False; ! end if; ! ! when Yes => ! return True; ! ! when No => ! return False; ! end case; end Is_Compilable; ------------------------------ *************** package body Prj is *** 1226,1236 **** function Create_Flags (Report_Error : Error_Handler; When_No_Sources : Error_Warning; ! Require_Sources_Other_Lang : Boolean := True; ! Allow_Duplicate_Basenames : Boolean := True; ! Compiler_Driver_Mandatory : Boolean := False; ! Error_On_Unknown_Language : Boolean := True; ! Require_Obj_Dirs : Error_Warning := Error) return Processing_Flags is begin --- 1257,1269 ---- function Create_Flags (Report_Error : Error_Handler; When_No_Sources : Error_Warning; ! Require_Sources_Other_Lang : Boolean := True; ! Allow_Duplicate_Basenames : Boolean := True; ! Compiler_Driver_Mandatory : Boolean := False; ! Error_On_Unknown_Language : Boolean := True; ! Require_Obj_Dirs : Error_Warning := Error; ! Allow_Invalid_External : Error_Warning := Error; ! Missing_Source_Files : Error_Warning := Error) return Processing_Flags is begin *************** package body Prj is *** 1241,1247 **** Allow_Duplicate_Basenames => Allow_Duplicate_Basenames, Error_On_Unknown_Language => Error_On_Unknown_Language, Compiler_Driver_Mandatory => Compiler_Driver_Mandatory, ! Require_Obj_Dirs => Require_Obj_Dirs); end Create_Flags; ------------ --- 1274,1282 ---- Allow_Duplicate_Basenames => Allow_Duplicate_Basenames, Error_On_Unknown_Language => Error_On_Unknown_Language, Compiler_Driver_Mandatory => Compiler_Driver_Mandatory, ! Require_Obj_Dirs => Require_Obj_Dirs, ! Allow_Invalid_External => Allow_Invalid_External, ! Missing_Source_Files => Missing_Source_Files); end Create_Flags; ------------ diff -Nrcpad gcc-4.5.2/gcc/ada/prj.ads gcc-4.6.0/gcc/ada/prj.ads *** gcc-4.5.2/gcc/ada/prj.ads Tue Jan 26 14:02:25 2010 --- gcc-4.6.0/gcc/ada/prj.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package Prj is *** 292,308 **** Makefile_Dependency_Suffix : constant String := ".d"; ALI_Dependency_Suffix : constant String := ".ali"; - Switches_Dependency_Suffix : constant String := ".cswi"; ! Binder_Exchange_Suffix : constant String := ".bexch"; -- Suffix for binder exchange files ! Library_Exchange_Suffix : constant String := ".lexch"; -- Suffix for library exchange files type Name_List_Index is new Nat; ! No_Name_List : constant Name_List_Index := 0; type Name_Node is record Name : Name_Id := No_Name; --- 292,307 ---- Makefile_Dependency_Suffix : constant String := ".d"; ALI_Dependency_Suffix : constant String := ".ali"; Switches_Dependency_Suffix : constant String := ".cswi"; ! Binder_Exchange_Suffix : constant String := ".bexch"; -- Suffix for binder exchange files ! Library_Exchange_Suffix : constant String := ".lexch"; -- Suffix for library exchange files type Name_List_Index is new Nat; ! No_Name_List : constant Name_List_Index := 0; type Name_Node is record Name : Name_Id := No_Name; *************** package Prj is *** 664,672 **** --- 663,678 ---- -- Structure to define source data type Source_Data is record + Initialized : Boolean := False; + -- Set to True when Source_Data is completely initialized + Project : Project_Id := No_Project; -- Project of the source + Location : Source_Ptr := No_Location; + -- Location in the project file of the declaration of the source in + -- package Naming. + Source_Dir_Rank : Natural := 0; -- The rank of the source directory in list declared with attribute -- Source_Dirs. Two source files with the same name cannot appears in *************** package Prj is *** 703,708 **** --- 709,721 ---- -- file). Index is 0 if there is either no unit or a single one, and -- starts at 1 when there are multiple units + Compilable : Yes_No_Unknown := Unknown; + -- Updated at the first call to Is_Compilable. Yes if source file is + -- compilable. + + In_The_Queue : Boolean := False; + -- True if the source has been put in the queue + Locally_Removed : Boolean := False; -- True if the source has been "excluded" *************** package Prj is *** 762,773 **** Naming_Exception : Boolean := False; -- True if the source has an exceptional name Next_In_Lang : Source_Id := No_Source; -- Link to another source of the same language in the same project end record; No_Source_Data : constant Source_Data := ! (Project => No_Project, Source_Dir_Rank => 0, Language => No_Language_Index, In_Interfaces => True, --- 775,795 ---- Naming_Exception : Boolean := False; -- True if the source has an exceptional name + Duplicate_Unit : Boolean := False; + -- True when a duplicate unit has been reported for this source + Next_In_Lang : Source_Id := No_Source; -- Link to another source of the same language in the same project + + Next_With_File_Name : Source_Id := No_Source; + -- Link to another source with the same base file name + end record; No_Source_Data : constant Source_Data := ! (Initialized => False, ! Project => No_Project, ! Location => No_Location, Source_Dir_Rank => 0, Language => No_Language_Index, In_Interfaces => True, *************** package Prj is *** 777,782 **** --- 799,806 ---- Unit => No_Unit_Index, Index => 0, Locally_Removed => False, + Compilable => Unknown, + In_The_Queue => False, Replaced_By => No_Source, File => No_File, Display_File => No_File, *************** package Prj is *** 795,801 **** Switches_Path => No_Path, Switches_TS => Empty_Time_Stamp, Naming_Exception => False, ! Next_In_Lang => No_Source); package Source_Paths_Htable is new Simple_HTable (Header_Num => Header_Num, --- 819,836 ---- Switches_Path => No_Path, Switches_TS => Empty_Time_Stamp, Naming_Exception => False, ! Duplicate_Unit => False, ! Next_In_Lang => No_Source, ! Next_With_File_Name => No_Source); ! ! package Source_Files_Htable is new Simple_HTable ! (Header_Num => Header_Num, ! Element => Source_Id, ! No_Element => No_Source, ! Key => File_Name_Type, ! Hash => Hash, ! Equal => "="); ! -- Mapping of source file names to source ids package Source_Paths_Htable is new Simple_HTable (Header_Num => Header_Num, *************** package Prj is *** 815,820 **** --- 850,856 ---- Equal => "="); type Verbosity is (Default, Medium, High); + pragma Ordered (Verbosity); -- Verbosity when parsing GNAT Project Files -- Default is default (very quiet, if no errors). -- Medium is more verbose. *************** package Prj is *** 863,869 **** -- Return the object directory to use for the project. This depends on -- whether we have a library project or a standard project. This function -- might return No_Name when no directory applies. ! -- If we have a a library project file and Including_Libraries is True then -- the library dir is returned instead of the object dir. -- If Only_If_Ada is True, then No_Name will be returned when the project -- doesn't Ada sources. --- 899,905 ---- -- Return the object directory to use for the project. This depends on -- whether we have a library project or a standard project. This function -- might return No_Name when no directory applies. ! -- If we have a library project file and Including_Libraries is True then -- the library dir is returned instead of the object dir. -- If Only_If_Ada is True, then No_Name will be returned when the project -- doesn't Ada sources. *************** package Prj is *** 895,901 **** (None, GNU, Object_List, ! Option_List); -- The format of the different response files type Project_Configuration is record --- 931,941 ---- (None, GNU, Object_List, ! Option_List, ! GCC, ! GCC_GNU, ! GCC_Object_List, ! GCC_Option_List); -- The format of the different response files type Project_Configuration is record *************** package Prj is *** 933,939 **** Map_File_Option : Name_Id := No_Name; -- Option to use when invoking the linker to build a map file ! Minimum_Linker_Options : Name_List_Index := No_Name_List; -- The minimum options for the linker driver. Specified in the -- configuration. --- 973,979 ---- Map_File_Option : Name_Id := No_Name; -- Option to use when invoking the linker to build a map file ! Trailing_Linker_Required_Switches : Name_List_Index := No_Name_List; -- The minimum options for the linker driver. Specified in the -- configuration. *************** package Prj is *** 1032,1038 **** Executable_Suffix => No_Name, Linker => No_Path, Map_File_Option => No_Name, ! Minimum_Linker_Options => No_Name_List, Linker_Executable_Option => No_Name_List, Linker_Lib_Dir_Option => No_Name, Linker_Lib_Name_Option => No_Name, --- 1072,1079 ---- Executable_Suffix => No_Name, Linker => No_Path, Map_File_Option => No_Name, ! Trailing_Linker_Required_Switches => ! No_Name_List, Linker_Executable_Option => No_Name_List, Linker_Lib_Dir_Option => No_Name, Linker_Lib_Name_Option => No_Name, *************** package Prj is *** 1323,1328 **** --- 1364,1377 ---- -- Project_Tree_Data -- ----------------------- + package Replaced_Source_HTable is new Simple_HTable + (Header_Num => Header_Num, + Element => File_Name_Type, + No_Element => No_File, + Key => File_Name_Type, + Hash => Hash, + Equal => "="); + type Private_Project_Tree_Data is private; -- Data for a project tree that is used only by the Project Manager *************** package Prj is *** 1337,1349 **** Packages : Package_Table.Instance; Projects : Project_List; ! Units_HT : Units_Htable.Instance; ! -- Unit name to Unit_Index (and from there so Source_Id) ! Source_Paths_HT : Source_Paths_Htable.Instance; -- Full path to Source_Id ! Private_Part : Private_Project_Tree_Data; end record; -- Data for a project tree --- 1386,1414 ---- Packages : Package_Table.Instance; Projects : Project_List; ! Replaced_Sources : Replaced_Source_HTable.Instance; ! -- The list of sources that have been replaced by sources with ! -- different file names. ! Replaced_Source_Number : Natural := 0; ! -- The number of entries in Replaced_Sources ! ! Units_HT : Units_Htable.Instance; ! -- Unit name to Unit_Index (and from there to Source_Id) ! ! Source_Files_HT : Source_Files_Htable.Instance; ! -- Base source file names to Source_Id list. ! ! Source_Paths_HT : Source_Paths_Htable.Instance; -- Full path to Source_Id ! Source_Info_File_Name : String_Access := null; ! -- The name of the source info file, if specified by the builder ! ! Source_Info_File_Exists : Boolean := False; ! -- True when a source info file has been successfully read ! ! Private_Part : Private_Project_Tree_Data; end record; -- Data for a project tree *************** package Prj is *** 1380,1392 **** Imported_First : Boolean := False); -- Call Action for each project imported directly or indirectly by project -- By, as well as extended projects. -- The order of processing depends on Imported_First: ! -- If False, Action is called according to the order of importation: if A ! -- imports B, directly or indirectly, Action will be called for A before ! -- it is called for B. If two projects import each other directly or ! -- indirectly (using at least one "limited with"), it is not specified ! -- for which of these two projects Action will be called first. ! -- The order is reversed if Imported_First is True. -- With_State may be used by Action to choose a behavior or to report some -- global result. --- 1445,1461 ---- Imported_First : Boolean := False); -- Call Action for each project imported directly or indirectly by project -- By, as well as extended projects. + -- -- The order of processing depends on Imported_First: ! -- ! -- If False, Action is called according to the order of importation: if A ! -- imports B, directly or indirectly, Action will be called for A before ! -- it is called for B. If two projects import each other directly or ! -- indirectly (using at least one "limited with"), it is not specified ! -- for which of these two projects Action will be called first. ! -- ! -- The order is reversed if Imported_First is True ! -- -- With_State may be used by Action to choose a behavior or to report some -- global result. *************** package Prj is *** 1439,1445 **** type Error_Handler is access procedure (Project : Project_Id; Is_Warning : Boolean); ! -- This warngs when an error was found when parsing a project. The error -- itself is handled through Prj.Err (and Prj.Err.Finalize should be called -- to actually print the error). This ensures that duplicate error messages -- are always correctly removed, that errors msgs are sorted, and that all --- 1508,1514 ---- type Error_Handler is access procedure (Project : Project_Id; Is_Warning : Boolean); ! -- This warns when an error was found when parsing a project. The error -- itself is handled through Prj.Err (and Prj.Err.Finalize should be called -- to actually print the error). This ensures that duplicate error messages -- are always correctly removed, that errors msgs are sorted, and that all *************** package Prj is *** 1448,1458 **** function Create_Flags (Report_Error : Error_Handler; When_No_Sources : Error_Warning; ! Require_Sources_Other_Lang : Boolean := True; ! Allow_Duplicate_Basenames : Boolean := True; ! Compiler_Driver_Mandatory : Boolean := False; ! Error_On_Unknown_Language : Boolean := True; ! Require_Obj_Dirs : Error_Warning := Error) return Processing_Flags; -- Function used to create Processing_Flags structure -- --- 1517,1529 ---- function Create_Flags (Report_Error : Error_Handler; When_No_Sources : Error_Warning; ! Require_Sources_Other_Lang : Boolean := True; ! Allow_Duplicate_Basenames : Boolean := True; ! Compiler_Driver_Mandatory : Boolean := False; ! Error_On_Unknown_Language : Boolean := True; ! Require_Obj_Dirs : Error_Warning := Error; ! Allow_Invalid_External : Error_Warning := Error; ! Missing_Source_Files : Error_Warning := Error) return Processing_Flags; -- Function used to create Processing_Flags structure -- *************** package Prj is *** 1481,1486 **** --- 1552,1566 ---- -- If Require_Obj_Dirs is true, then all object directories must exist -- (possibly after they have been created automatically if the appropriate -- switches were specified), or an error is raised. + -- + -- If Allow_Invalid_External is Silent, then no error is reported when an + -- invalid value is used for an external variable (and it doesn't match its + -- type). Instead, the first possible value is used. + -- + -- Missing_Source_Files indicates whether it is an error or a warning that + -- a source file mentioned in the Source_Files attributes is not actually + -- found in the source directories. This also impacts errors for missing + -- source directories. Gprbuild_Flags : constant Processing_Flags; Gprclean_Flags : constant Processing_Flags; *************** package Prj is *** 1510,1515 **** --- 1590,1599 ---- -- another program running on the same machine has recreated it. -- Does nothing if Debug.Debug_Flag_N is set + Virtual_Prefix : constant String := "v$"; + -- The prefix for virtual extending projects. Because of the '$', which is + -- normally forbidden for project names, there cannot be any name clash. + private All_Packages : constant String_List_Access := null; *************** private *** 1524,1533 **** Location => No_Location, Default => False); - Virtual_Prefix : constant String := "v$"; - -- The prefix for virtual extending projects. Because of the '$', which is - -- normally forbidden for project names, there cannot be any name clash. - type Source_Iterator is record In_Tree : Project_Tree_Ref; --- 1608,1613 ---- *************** private *** 1589,1594 **** --- 1669,1676 ---- Compiler_Driver_Mandatory : Boolean; Error_On_Unknown_Language : Boolean; Require_Obj_Dirs : Error_Warning; + Allow_Invalid_External : Error_Warning; + Missing_Source_Files : Error_Warning; end record; Gprbuild_Flags : constant Processing_Flags := *************** private *** 1598,1604 **** Allow_Duplicate_Basenames => False, Compiler_Driver_Mandatory => True, Error_On_Unknown_Language => True, ! Require_Obj_Dirs => Error); Gprclean_Flags : constant Processing_Flags := (Report_Error => null, --- 1680,1688 ---- Allow_Duplicate_Basenames => False, Compiler_Driver_Mandatory => True, Error_On_Unknown_Language => True, ! Require_Obj_Dirs => Error, ! Allow_Invalid_External => Error, ! Missing_Source_Files => Error); Gprclean_Flags : constant Processing_Flags := (Report_Error => null, *************** private *** 1607,1613 **** Allow_Duplicate_Basenames => False, Compiler_Driver_Mandatory => True, Error_On_Unknown_Language => True, ! Require_Obj_Dirs => Warning); Gnatmake_Flags : constant Processing_Flags := (Report_Error => null, --- 1691,1699 ---- Allow_Duplicate_Basenames => False, Compiler_Driver_Mandatory => True, Error_On_Unknown_Language => True, ! Require_Obj_Dirs => Warning, ! Allow_Invalid_External => Error, ! Missing_Source_Files => Error); Gnatmake_Flags : constant Processing_Flags := (Report_Error => null, *************** private *** 1616,1621 **** Allow_Duplicate_Basenames => False, Compiler_Driver_Mandatory => False, Error_On_Unknown_Language => False, ! Require_Obj_Dirs => Error); end Prj; --- 1702,1709 ---- Allow_Duplicate_Basenames => False, Compiler_Driver_Mandatory => False, Error_On_Unknown_Language => False, ! Require_Obj_Dirs => Error, ! Allow_Invalid_External => Error, ! Missing_Source_Files => Error); end Prj; diff -Nrcpad gcc-4.5.2/gcc/ada/projects.texi gcc-4.6.0/gcc/ada/projects.texi *** gcc-4.5.2/gcc/ada/projects.texi Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/projects.texi Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,3969 ---- + @set gprconfig GPRconfig + + @c ------ projects.texi + @c This file is shared between the GNAT user's guide and gprbuild. It is not + @c compilable on its own, you should instead compile the other two manuals. + @c For that reason, there is no toplevel @menu + + @c --------------------------------------------- + @node GNAT Project Manager + @chapter GNAT Project Manager + @c --------------------------------------------- + + @noindent + @menu + * Introduction:: + * Building With Projects:: + * Organizing Projects into Subsystems:: + * Scenarios in Projects:: + * Library Projects:: + * Project Extension:: + * Project File Reference:: + @end menu + + @c --------------------------------------------- + @node Introduction + @section Introduction + @c --------------------------------------------- + + @noindent + This chapter describes GNAT's @emph{Project Manager}, a facility that allows + you to manage complex builds involving a number of source files, directories, + and options for different system configurations. In particular, + project files allow you to specify: + + @itemize @bullet + @item The directory or set of directories containing the source files, and/or the + names of the specific source files themselves + @item The directory in which the compiler's output + (@file{ALI} files, object files, tree files, etc.) is to be placed + @item The directory in which the executable programs are to be placed + @item Switch settings for any of the project-enabled tools; + you can apply these settings either globally or to individual compilation units. + @item The source files containing the main subprogram(s) to be built + @item The source programming language(s) + @item Source file naming conventions; you can specify these either globally or for + individual compilation units (@pxref{Naming Schemes}). + @item Change any of the above settings depending on external values, thus enabling + the reuse of the projects in various @b{scenarios} (@pxref{Scenarios + in Projects}). + @item Automatically build libraries as part of the build process + (@pxref{Library Projects}). + + @end itemize + + @noindent + Project files are written in a syntax close to that of Ada, using familiar + notions such as packages, context clauses, declarations, default values, + assignments, and inheritance (@pxref{Project File Reference}). + + Project files can be built hierarchically from other project files, simplifying + complex system integration and project reuse (@pxref{Organizing Projects into + Subsystems}). + + @itemize @bullet + @item One project can import other projects containing needed source files. + More generally, the Project Manager lets you structure large development + efforts into hierarchical subsystems, where build decisions are delegated + to the subsystem level, and thus different compilation environments + (switch settings) used for different subsystems. + @item You can organize GNAT projects in a hierarchy: a child project + can extend a parent project, inheriting the parent's source files and + optionally overriding any of them with alternative versions + (@pxref{Project Extension}). + + @end itemize + + @noindent + Several tools support project files, generally in addition to specifying + the information on the command line itself). They share common switches + to control the loading of the project (in particular + @option{^-P^/PROJECT_FILE=^@emph{projectfile}} and + @option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}}). + @xref{Switches Related to Project Files}. + + The Project Manager supports a wide range of development strategies, + for systems of all sizes. Here are some typical practices that are + easily handled: + + @itemize @bullet + @item Using a common set of source files and generating object files in different + directories via different switch settings. It can be used for instance, for + generating separate sets of object files for debugging and for production. + @item Using a mostly-shared set of source files with different versions of + some units or subunits. It can be used for instance, for grouping and hiding + @end itemize + + @noindent + all OS dependencies in a small number of implementation units. + + Project files can be used to achieve some of the effects of a source + versioning system (for example, defining separate projects for + the different sets of sources that comprise different releases) but the + Project Manager is independent of any source configuration management tool + that might be used by the developers. + + The various sections below introduce the different concepts related to + projects. Each section starts with examples and use cases, and then goes into + the details of related project file capabilities. + + @c --------------------------------------------- + @node Building With Projects + @section Building With Projects + @c --------------------------------------------- + + @noindent + In its simplest form, a unique project is used to build a single executable. + This section concentrates on such a simple setup. Later sections will extend + this basic model to more complex setups. + + The following concepts are the foundation of project files, and will be further + detailed later in this documentation. They are summarized here as a reference. + + @table @asis + @item @b{Project file}: + A text file using an Ada-like syntax, generally using the @file{.gpr} + extension. It defines build-related characteristics of an application. + The characteristics include the list of sources, the location of those + sources, the location for the generated object files, the name of + the main program, and the options for the various tools involved in the + build process. + + @item @b{Project attribute}: + A specific project characteristic is defined by an attribute clause. Its + value is a string or a sequence of strings. All settings in a project + are defined through a list of predefined attributes with precise + semantics. @xref{Attributes}. + + @item @b{Package in a project}: + Global attributes are defined at the top level of a project. + Attributes affecting specific tools are grouped in a + package whose name is related to tool's function. The most common + packages are @code{Builder}, @code{Compiler}, @code{Binder}, + and @code{Linker}. @xref{Packages}. + + @item @b{Project variables}: + In addition to attributes, a project can use variables to store intermediate + values and avoid duplication in complex expressions. It can be initialized + with a value coming from the environment. + A frequent use of variables is to define scenarios. + @xref{External Values}, @xref{Scenarios in Projects}, and @xref{Variables}. + + @item @b{Source files} and @b{source directories}: + A source file is associated with a language through a naming convention. For + instance, @code{foo.c} is typically the name of a C source file; + @code{bar.ads} or @code{bar.1.ada} are two common naming conventions for a + file containing an Ada spec. A compilation unit is often composed of a main + source file and potentially several auxiliary ones, such as header files in C. + The naming conventions can be user defined @xref{Naming Schemes}, and will + drive the builder to call the appropriate compiler for the given source file. + Source files are searched for in the source directories associated with the + project through the @b{Source_Dirs} attribute. By default, all the files (in + these source directories) following the naming conventions associated with the + declared languages are considered to be part of the project. It is also + possible to limit the list of source files using the @b{Source_Files} or + @b{Source_List_File} attributes. Note that those last two attributes only + accept basenames with no directory information. + + @item @b{Object files} and @b{object directory}: + An object file is an intermediate file produced by the compiler from a + compilation unit. It is used by post-compilation tools to produce + final executables or libraries. Object files produced in the context of + a given project are stored in a single directory that can be specified by the + @b{Object_Dir} attribute. In order to store objects in + two or more object directories, the system must be split into + distinct subsystems with their own project file. + + @end table + + The following subsections introduce gradually all the attributes of interest + for simple build needs. Here is the simple setup that will be used in the + following examples. + + The Ada source files @file{pack.ads}, @file{pack.adb}, and @file{proc.adb} are in + the @file{common/} directory. The file @file{proc.adb} contains an Ada main + subprogram @code{Proc} that @code{with}s package @code{Pack}. We want to compile + these source files with the switch @option{-O2}, and put the resulting files in + the directory @file{obj/}. + + @smallexample + @group + ^common/^[COMMON]^ + pack.ads + pack.adb + proc.adb + @end group + @group + ^common/release/^[COMMON.RELEASE]^ + proc.ali, proc.o pack.ali, pack.o + @end group + @end smallexample + + @noindent + Our project is to be called @emph{Build}. The name of the + file is the name of the project (case-insensitive) with the + @file{.gpr} extension, therefore the project file name is @file{build.gpr}. This + is not mandatory, but a warning is issued when this convention is not followed. + + This is a very simple example, and as stated above, a single project + file is enough for it. We will thus create a new file, that for now + should contain the following code: + + @smallexample + @b{project} Build @b{is} + @b{end} Build; + @end smallexample + + @menu + * Source Files and Directories:: + * Object and Exec Directory:: + * Main Subprograms:: + * Tools Options in Project Files:: + * Compiling with Project Files:: + * Executable File Names:: + * Avoid Duplication With Variables:: + * Naming Schemes:: + @end menu + + @c --------------------------------------------- + @node Source Files and Directories + @subsection Source Files and Directories + @c --------------------------------------------- + + @noindent + When you create a new project, the first thing to describe is how to find the + corresponding source files. This is the only settings that are needed by all + the tools that will use this project (builder, compiler, binder and linker for + the compilation, IDEs to edit the source files,@dots{}). + + @cindex Source directories + First step is to declare the source directories, which are the directories + to be searched to find source files. In the case of the example, + the @file{common} directory is the only source directory. + + @cindex @code{Source_Dirs} + There are several ways of defining source directories: + + @itemize @bullet + @item When the attribute @b{Source_Dirs} is not used, a project contains a + single source directory which is the one where the project file itself + resides. In our example, if @file{build.gpr} is placed in the @file{common} + directory, the project has the needed implicit source directory. + + @item The attribute @b{Source_Dirs} can be set to a list of path names, one + for each of the source directories. Such paths can either be absolute + names (for instance @file{"/usr/local/common/"} on UNIX), or relative to the + directory in which the project file resides (for instance "." if + @file{build.gpr} is inside @file{common/}, or "common" if it is one level up). + Each of the source directories must exist and be readable. + + @cindex portability + The syntax for directories is platform specific. For portability, however, + the project manager will always properly translate UNIX-like path names to + the native format of specific platform. For instance, when the same project + file is to be used both on Unix and Windows, "/" should be used as the + directory separator rather than "\". + + @item The attribute @b{Source_Dirs} can automatically include subdirectories + using a special syntax inspired by some UNIX shells. If any of the path in + the list ends with @emph{"/**"}, then that path and all its subdirectories + (recursively) are included in the list of source directories. For instance, + @file{./**} represent the complete directory tree rooted at ".". + @cindex Source directories, recursive + + @cindex @code{Excluded_Source_Dirs} + When using that construct, it can sometimes be convenient to also use the + attribute @b{Excluded_Source_Dirs}, which is also a list of paths. Each entry + specifies a directory whose immediate content, not including subdirs, is to + be excluded. It is also possible to exclude a complete directory subtree + using the "/**" notation. + + @cindex @code{Ignore_Source_Sub_Dirs} + It is often desirable to remove, from the source directories, directory + subtrees rooted at some subdirectories. An example is the subdirectories + created by a Version Control System such as Subversion that creates directory + subtrees .svn/**. To do that, attribute @b{Ignore_Source_Sub_Dirs} can be + used. It specifies the list of simple file names for the root of these + undesirable directory subtrees. + + @end itemize + + @noindent + When applied to the simple example, and because we generally prefer to have + the project file at the toplevel directory rather than mixed with the sources, + we will create the following file + + @smallexample + build.gpr + @b{project} Build @b{is} + @b{for} Source_Dirs @b{use} ("common"); -- <<<< + @b{end} Build; + @end smallexample + + @noindent + Once source directories have been specified, one may need to indicate + source files of interest. By default, all source files present in the source + directories are considered by the project manager. When this is not desired, + it is possible to specify the list of sources to consider explicitly. + In such a case, only source file base names are indicated and not + their absolute or relative path names. The project manager is in charge of + locating the specified source files in the specified source directories. + + @itemize @bullet + @item By default, the project manager search for all source files of all + specified languages in all the source directories. + + Since the project manager was initially developed for Ada environments, the + default language is usually Ada and the above project file is complete: it + defines without ambiguity the sources composing the project: that is to say, + all the sources in subdirectory "common" for the default language (Ada) using + the default naming convention. + + @cindex @code{Languages} + However, when compiling a multi-language application, or a pure C + application, the project manager must be told which languages are of + interest, which is done by setting the @b{Languages} attribute to a list of + strings, each of which is the name of a language. Tools like + @command{gnatmake} only know about Ada, while other tools like + @command{gprbuild} know about many more languages such as C, C++, Fortran, + assembly and others can be added dynamically. + + @cindex Naming scheme + Even when using only Ada, the default naming might not be suitable. Indeed, + how does the project manager recognizes an "Ada file" from any other + file? Project files can describe the naming scheme used for source files, + and override the default (@pxref{Naming Schemes}). The default is the + standard GNAT extension (@file{.adb} for bodies and @file{.ads} for + specs), which is what is used in our example, explaining why no naming scheme + is explicitly specified. + @xref{Naming Schemes}. + + @item @code{Source Files} + @cindex @code{Source_Files} + In some cases, source directories might contain files that should not be + included in a project. One can specify the explicit list of file names to + be considered through the @b{Source_Files} attribute. + When this attribute is defined, instead of looking at every file in the + source directories, the project manager takes only those names into + consideration reports errors if they cannot be found in the source + directories or does not correspond to the naming scheme. + + @item For various reasons, it is sometimes useful to have a project with no + sources (most of the time because the attributes defined in the project + file will be reused in other projects, as explained in @pxref{Organizing + Projects into Subsystems}. To do this, the attribute + @emph{Source_Files} is set to the empty list, i.e. @code{()}. Alternatively, + @emph{Source_Dirs} can be set to the empty list, with the same + result. + + @item @code{Source_List_File} + @cindex @code{Source_List_File} + If there is a great number of files, it might be more convenient to use + the attribute @b{Source_List_File}, which specifies the full path of a file. + This file must contain a list of source file names (one per line, no + directory information) that are searched as if they had been defined + through @emph{Source_Files}. Such a file can easily be created through + external tools. + + A warning is issued if both attributes @code{Source_Files} and + @code{Source_List_File} are given explicit values. In this case, the + attribute @code{Source_Files} prevails. + + @item @code{Excluded_Source_Files} + @cindex @code{Excluded_Source_Files} + @cindex @code{Locally_Removed_Files} + @cindex @code{Excluded_Source_List_File} + Specifying an explicit list of files is not always convenient.It might be + more convenient to use the default search rules with specific exceptions. + This can be done thanks to the attribute @b{Excluded_Source_Files} + (or its synonym @b{Locally_Removed_Files}). + Its value is the list of file names that should not be taken into account. + This attribute is often used when extending a project, @xref{Project + Extension}. A similar attribute @b{Excluded_Source_List_File} plays the same + role but takes the name of file containing file names similarly to + @code{Source_List_File}. + + @end itemize + + @noindent + In most simple cases, such as the above example, the default source file search + behavior provides the expected result, and we do not need to add anything after + setting @code{Source_Dirs}. The project manager automatically finds + @file{pack.ads}, @file{pack.adb} and @file{proc.adb} as source files of the + project. + + Note that it is considered an error for a project file to have no sources + attached to it unless explicitly declared as mentioned above. + + If the order of the source directories is known statically, that is if + @code{"/**"} is not used in the string list @code{Source_Dirs}, then there may + be several files with the same source file name sitting in different + directories of the project. In this case, only the file in the first directory + is considered as a source of the project and the others are hidden. If + @code{"/**"} is not used in the string list @code{Source_Dirs}, it is an error + to have several files with the same source file name in the same directory + @code{"/**"} subtree, since there would be an ambiguity as to which one should + be used. However, two files with the same source file name may in two single + directories or directory subtrees. In this case, the one in the first directory + or directory subtree is a source of the project. + + @c --------------------------------------------- + @node Object and Exec Directory + @subsection Object and Exec Directory + @c --------------------------------------------- + + @noindent + The next step when writing a project is to indicate where the compiler should + put the object files. In fact, the compiler and other tools might create + several different kind of files (for GNAT, there is the object file and the ALI + file for instance). One of the important concepts in projects is that most + tools may consider source directories as read-only and do not attempt to create + new or temporary files there. Instead, all files are created in the object + directory. It is of course not true for project-aware IDEs, whose purpose it is + to create the source files. + + @cindex @code{Object_Dir} + The object directory is specified through the @b{Object_Dir} attribute. + Its value is the path to the object directory, either absolute or + relative to the directory containing the project file. This + directory must already exist and be readable and writable, although + some tools have a switch to create the directory if needed (See + the switch @code{-p} for @command{gnatmake} and @command{gprbuild}). + + If the attribute @code{Object_Dir} is not specified, it defaults to + the project directory, that is the directory containing the project file. + + For our example, we can specify the object dir in this way: + + @smallexample + @b{project} Build @b{is} + @b{for} Source_Dirs @b{use} ("common"); + @b{for} Object_Dir @b{use} "obj"; -- <<<< + @b{end} Build; + @end smallexample + + @noindent + As mentioned earlier, there is a single object directory per project. As a + result, if you have an existing system where the object files are spread in + several directories, you can either move all of them into the same directory if + you want to build it with a single project file, or study the section on + subsystems (@pxref{Organizing Projects into Subsystems}) to see how each + separate object directory can be associated with one of the subsystem + constituting the application. + + When the @command{linker} is called, it usually creates an executable. By + default, this executable is placed in the object directory of the project. It + might be convenient to store it in its own directory. + + @cindex @code{Exec_Dir} + This can be done through the @code{Exec_Dir} attribute, which, like + @emph{Object_Dir} contains a single absolute or relative path and must point to + an existing and writable directory, unless you ask the tool to create it on + your behalf. When not specified, It defaults to the object directory and + therefore to the project file's directory if neither @emph{Object_Dir} nor + @emph{Exec_Dir} was specified. + + In the case of the example, let's place the executable in the root + of the hierarchy, ie the same directory as @file{build.gpr}. Hence + the project file is now + + @smallexample + @b{project} Build @b{is} + @b{for} Source_Dirs @b{use} ("common"); + @b{for} Object_Dir @b{use} "obj"; + @b{for} Exec_Dir @b{use} "."; -- <<<< + @b{end} Build; + @end smallexample + + @c --------------------------------------------- + @node Main Subprograms + @subsection Main Subprograms + @c --------------------------------------------- + + @noindent + In the previous section, executables were mentioned. The project manager needs + to be taught what they are. In a project file, an executable is indicated by + pointing to source file of the main subprogram. In C this is the file that + contains the @code{main} function, and in Ada the file that contains the main + unit. + + There can be any number of such main files within a given project, and thus + several executables can be built in the context of a single project file. Of + course, one given executable might not (and in fact will not) need all the + source files referenced by the project. As opposed to other build environments + such as @command{makefile}, one does not need to specify the list of + dependencies of each executable, the project-aware builders knows enough of the + semantics of the languages to build ands link only the necessary elements. + + @cindex @code{Main} + The list of main files is specified via the @b{Main} attribute. It contains + a list of file names (no directories). If a project defines this + attribute, it is not necessary to identify main files on the + command line when invoking a builder, and editors like + @command{GPS} will be able to create extra menus to spawn or debug the + corresponding executables. + + @smallexample + @b{project} Build @b{is} + @b{for} Source_Dirs @b{use} ("common"); + @b{for} Object_Dir @b{use} "obj"; + @b{for} Exec_Dir @b{use} "."; + @b{for} Main @b{use} ("proc.adb"); -- <<<< + @b{end} Build; + @end smallexample + + @noindent + If this attribute is defined in the project, then spawning the builder + with a command such as + + @smallexample + gnatmake ^-Pbuild^/PROJECT_FILE=build^ + @end smallexample + + @noindent + automatically builds all the executables corresponding to the files + listed in the @emph{Main} attribute. It is possible to specify one + or more executables on the command line to build a subset of them. + + @c --------------------------------------------- + @node Tools Options in Project Files + @subsection Tools Options in Project Files + @c --------------------------------------------- + + @noindent + We now have a project file that fully describes our environment, and can be + used to build the application with a simple @command{gnatmake} command as seen + in the previous section. In fact, the empty project we showed immediately at + the beginning (with no attribute at all) could already fulfill that need if it + was put in the @file{common} directory. + + Of course, we always want more control. This section will show you how to + specify the compilation switches that the various tools involved in the + building of the executable should use. + + @cindex command line length + Since source names and locations are described into the project file, it is not + necessary to use switches on the command line for this purpose (switches such + as -I for gcc). This removes a major source of command line length overflow. + Clearly, the builders will have to communicate this information one way or + another to the underlying compilers and tools they call but they usually use + response files for this and thus should not be subject to command line + overflows. + + Several tools are participating to the creation of an executable: the compiler + produces object files from the source files; the binder (in the Ada case) + creates an source file that takes care, among other things, of elaboration + issues and global variables initialization; and the linker gathers everything + into a single executable that users can execute. All these tools are known by + the project manager and will be called with user defined switches from the + project files. However, we need to introduce a new project file concept to + express which switches to be used for any of the tools involved in the build. + + @cindex project file packages + A project file is subdivided into zero or more @b{packages}, each of which + contains the attributes specific to one tool (or one set of tools). Project + files use an Ada-like syntax for packages. Package names permitted in project + files are restricted to a predefined set (@pxref{Packages}), and the contents + of packages are limited to a small set of constructs and attributes + (@pxref{Attributes}). + + Our example project file can be extended with the following empty packages. At + this stage, they could all be omitted since they are empty, but they show which + packages would be involved in the build process. + + @smallexample + @b{project} Build @b{is} + @b{for} Source_Dirs @b{use} ("common"); + @b{for} Object_Dir @b{use} "obj"; + @b{for} Exec_Dir @b{use} "."; + @b{for} Main @b{use} ("proc.adb"); + @b{end} Build; + + @b{package} Builder @b{is} --<<< for gnatmake and gprbuild + @b{end} Builder; + + @b{package} Compiler @b{is} --<<< for the compiler + @b{end} Compiler; + + @b{package} Binder @b{is} --<<< for the binder + @b{end} Binder; + + @b{package} Linker @b{is} --<<< for the linker + @b{end} Linker; + @end smallexample + + @noindent + Let's first examine the compiler switches. As stated in the initial description + of the example, we want to compile all files with @option{-O2}. This is a + compiler switch, although it is usual, on the command line, to pass it to the + builder which then passes it to the compiler. It is recommended to use directly + the right package, which will make the setup easier to understand for other + people. + + Several attributes can be used to specify the switches: + + @table @asis + @item @b{Default_Switches}: + @cindex @code{Default_Switches} + This is the first mention in this manual of an @b{indexed attribute}. When + this attribute is defined, one must supply an @emph{index} in the form of a + literal string. + In the case of @emph{Default_Switches}, the index is the name of the + language to which the switches apply (since a different compiler will + likely be used for each language, and each compiler has its own set of + switches). The value of the attribute is a list of switches. + + In this example, we want to compile all Ada source files with the + @option{-O2} switch, and the resulting project file is as follows + (only the @code{Compiler} package is shown): + + @smallexample + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") @b{use} ("-O2"); + @b{end} Compiler; + @end smallexample + + @item @b{Switches}: + @cindex @code{Switches} + in some cases, we might want to use specific switches + for one or more files. For instance, compiling @file{proc.adb} might not be + possible at high level of optimization because of a compiler issue. + In such a case, the @emph{Switches} + attribute (indexed on the file name) can be used and will override the + switches defined by @emph{Default_Switches}. Our project file would + become: + + @smallexample + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") @b{use} ("-O2"); + @b{for} Switches ("proc.adb") @b{use} ("-O0"); + @b{end} Compiler; + @end smallexample + + @noindent + @code{Switches} may take a pattern as an index, such as in: + + @smallexample + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") @b{use} ("-O2"); + @b{for} Switches ("pkg*") @b{use} ("-O0"); + @b{end} Compiler; + @end smallexample + + @noindent + Sources @file{pkg.adb} and @file{pkg-child.adb} would be compiled with -O0, + not -O2. + + @noindent + @code{Switches} can also be given a language name as index instead of a file + name in which case it has the same semantics as @emph{Default_Switches}. + However, indexes with wild cards are never valid for language name. + + @item @b{Local_Configuration_Pragmas}: + @cindex @code{Local_Configuration_Pragmas} + this attribute may specify the path + of a file containing configuration pragmas for use by the Ada compiler, + such as @code{pragma Restrictions (No_Tasking)}. These pragmas will be + used for all the sources of the project. + + @end table + + The switches for the other tools are defined in a similar manner through the + @b{Default_Switches} and @b{Switches} attributes, respectively in the + @emph{Builder} package (for @command{gnatmake} and @command{gprbuild}), + the @emph{Binder} package (binding Ada executables) and the @emph{Linker} + package (for linking executables). + + @c --------------------------------------------- + @node Compiling with Project Files + @subsection Compiling with Project Files + @c --------------------------------------------- + + @noindent + Now that our project files are written, let's build our executable. + Here is the command we would use from the command line: + + @smallexample + gnatmake ^-Pbuild^/PROJECT_FILE=build^ + @end smallexample + + @noindent + This will automatically build the executables specified through the + @emph{Main} attribute: for each, it will compile or recompile the + sources for which the object file does not exist or is not up-to-date; it + will then run the binder; and finally run the linker to create the + executable itself. + + @command{gnatmake} only knows how to handle Ada files. By using + @command{gprbuild} as a builder, you could automatically manage C files the + same way: create the file @file{utils.c} in the @file{common} directory, + set the attribute @emph{Languages} to @code{"(Ada, C)"}, and run + + @smallexample + gprbuild ^-Pbuild^/PROJECT_FILE=build^ + @end smallexample + + @noindent + Gprbuild knows how to recompile the C files and will + recompile them only if one of their dependencies has changed. No direct + indication on how to build the various elements is given in the + project file, which describes the project properties rather than a + set of actions to be executed. Here is the invocation of + @command{gprbuild} when building a multi-language program: + + @smallexample + $ gprbuild -Pbuild + gcc -c proc.adb + gcc -c pack.adb + gcc -c utils.c + gprbind proc + ... + gcc proc.o -o proc + @end smallexample + + @noindent + Notice the three steps described earlier: + + @itemize @bullet + @item The first three gcc commands correspond to the compilation phase. + @item The gprbind command corresponds to the post-compilation phase. + @item The last gcc command corresponds to the final link. + + @end itemize + + @noindent + @cindex @option{-v} option (for GPRbuild) + The default output of GPRbuild's execution is kept reasonably simple and easy + to understand. In particular, some of the less frequently used commands are not + shown, and some parameters are abbreviated. So it is not possible to rerun the + effect of the gprbuild command by cut-and-pasting its output. GPRbuild's option + @code{-v} provides a much more verbose output which includes, among other + information, more complete compilation, post-compilation and link commands. + + @c --------------------------------------------- + @node Executable File Names + @subsection Executable File Names + @c --------------------------------------------- + + @noindent + @cindex @code{Executable} + By default, the executable name corresponding to a main file is + computed from the main source file name. Through the attribute + @b{Builder.Executable}, it is possible to change this default. + + For instance, instead of building @command{proc} (or @command{proc.exe} + on Windows), we could configure our project file to build "proc1" + (resp proc1.exe) with the following addition: + + @smallexample @c projectfile + project Build is + ... -- same as before + package Builder is + for Executable ("proc.adb") use "proc1"; + end Builder + end Build; + @end smallexample + + @noindent + @cindex @code{Executable_Suffix} + Attribute @b{Executable_Suffix}, when specified, may change the suffix + of the executable files, when no attribute @code{Executable} applies: + its value replace the platform-specific executable suffix. + The default executable suffix is empty on UNIX and ".exe" on Windows. + + It is also possible to change the name of the produced executable by using the + command line switch @option{-o}. When several mains are defined in the project, + it is not possible to use the @option{-o} switch and the only way to change the + names of the executable is provided by Attributes @code{Executable} and + @code{Executable_Suffix}. + + @c --------------------------------------------- + @node Avoid Duplication With Variables + @subsection Avoid Duplication With Variables + @c --------------------------------------------- + + @noindent + To illustrate some other project capabilities, here is a slightly more complex + project using similar sources and a main program in C: + + @smallexample @c projectfile + project C_Main is + for Languages use ("Ada", "C"); + for Source_Dirs use ("common"); + for Object_Dir use "obj"; + for Main use ("main.c"); + package Compiler is + C_Switches := ("-pedantic"); + for Default_Switches ("C") use C_Switches; + for Default_Switches ("Ada") use ("-gnaty"); + for Switches ("main.c") use C_Switches & ("-g"); + end Compiler; + end C_Main; + @end smallexample + + @noindent + This project has many similarities with the previous one. + As expected, its @code{Main} attribute now refers to a C source. + The attribute @emph{Exec_Dir} is now omitted, thus the resulting + executable will be put in the directory @file{obj}. + + The most noticeable difference is the use of a variable in the + @emph{Compiler} package to store settings used in several attributes. + This avoids text duplication, and eases maintenance (a single place to + modify if we want to add new switches for C files). We will revisit + the use of variables in the context of scenarios (@pxref{Scenarios in + Projects}). + + In this example, we see how the file @file{main.c} can be compiled with + the switches used for all the other C files, plus @option{-g}. + In this specific situation the use of a variable could have been + replaced by a reference to the @code{Default_Switches} attribute: + + @smallexample @c projectfile + for Switches ("c_main.c") use Compiler'Default_Switches ("C") & ("-g"); + @end smallexample + + @noindent + Note the tick (@emph{'}) used to refer to attributes defined in a package. + + Here is the output of the GPRbuild command using this project: + + @smallexample + $gprbuild -Pc_main + gcc -c -pedantic -g main.c + gcc -c -gnaty proc.adb + gcc -c -gnaty pack.adb + gcc -c -pedantic utils.c + gprbind main.bexch + ... + gcc main.o -o main + @end smallexample + + @noindent + The default switches for Ada sources, + the default switches for C sources (in the compilation of @file{lib.c}), + and the specific switches for @file{main.c} have all been taken into + account. + + @c --------------------------------------------- + @node Naming Schemes + @subsection Naming Schemes + @c --------------------------------------------- + + @noindent + Sometimes an Ada software system is ported from one compilation environment to + another (say GNAT), and the file are not named using the default GNAT + conventions. Instead of changing all the file names, which for a variety of + reasons might not be possible, you can define the relevant file naming scheme + in the @b{Naming} package of your project file. + + The naming scheme has two distinct goals for the project manager: it + allows finding of source files when searching in the source + directories, and given a source file name it makes it possible to guess + the associated language, and thus the compiler to use. + + Note that the use by the Ada compiler of pragmas Source_File_Name is not + supported when using project files. You must use the features described in this + paragraph. You can however specify other configuration pragmas + (@pxref{Specifying Configuration Pragmas}). + + The following attributes can be defined in package @code{Naming}: + + @table @asis + @item @b{Casing}: + @cindex @code{Casing} + Its value must be one of @code{"lowercase"} (the default if + unspecified), @code{"uppercase"} or @code{"mixedcase"}. It describes the + casing of file names with regards to the Ada unit name. Given an Ada unit + My_Unit, the file name will respectively be @file{my_unit.adb} (lowercase), + @file{MY_UNIT.ADB} (uppercase) or @file{My_Unit.adb} (mixedcase). + On Windows, file names are case insensitive, so this attribute is + irrelevant. + + @item @b{Dot_Replacement}: + @cindex @code{Dot_Replacement} + This attribute specifies the string that should replace the "." in unit + names. Its default value is @code{"-"} so that a unit + @code{Parent.Child} is expected to be found in the file + @file{parent-child.adb}. The replacement string must satisfy the following + requirements to avoid ambiguities in the naming scheme: + + @itemize - + @item It must not be empty + @item It cannot start or end with an alphanumeric character + @item It cannot be a single underscore + @item It cannot start with an underscore followed by an alphanumeric + @item It cannot contain a dot @code{'.'} except if the entire string + is @code{"."} + + @end itemize + + @item @b{Spec_Suffix} and @b{Specification_Suffix}: + @cindex @code{Spec_Suffix} + @cindex @code{Specification_Suffix} + For Ada, these attributes give the suffix used in file names that contain + specifications. For other languages, they give the extension for files + that contain declaration (header files in C for instance). The attribute + is indexed on the language. + The two attributes are equivalent, but the latter is obsolescent. + If @code{Spec_Suffix ("Ada")} is not specified, then the default is + @code{"^.ads^.ADS^"}. + The value must satisfy the following requirements: + + @itemize - + @item It must not be empty + @item It cannot start with an alphanumeric character + @item It cannot start with an underscore followed by an alphanumeric character + @item It must include at least one dot + + @end itemize + + @item @b{Body_Suffix} and @b{Implementation_Suffix}: + @cindex @code{Body_Suffix} + @cindex @code{Implementation_Suffix} + These attributes give the extension used for file names that contain + code (bodies in Ada). They are indexed on the language. The second + version is obsolescent and fully replaced by the first attribute. + + These attributes must satisfy the same requirements as @code{Spec_Suffix}. + In addition, they must be different from any of the values in + @code{Spec_Suffix}. + If @code{Body_Suffix ("Ada")} is not specified, then the default is + @code{"^.adb^.ADB^"}. + + If @code{Body_Suffix ("Ada")} and @code{Spec_Suffix ("Ada")} end with the + same string, then a file name that ends with the longest of these two + suffixes will be a body if the longest suffix is @code{Body_Suffix ("Ada")} + or a spec if the longest suffix is @code{Spec_Suffix ("Ada")}. + + If the suffix does not start with a '.', a file with a name exactly equal + to the suffix will also be part of the project (for instance if you define + the suffix as @code{Makefile}, a file called @file{Makefile} will be part + of the project. This capability is usually not interesting when building. + However, it might become useful when a project is also used to + find the list of source files in an editor, like the GNAT Programming System + (GPS). + + @item @b{Separate_Suffix}: + @cindex @code{Separate_Suffix} + This attribute is specific to Ada. It denotes the suffix used in file names + that contain separate bodies. If it is not specified, then it defaults to + same value as @code{Body_Suffix ("Ada")}. The same rules apply as for the + @code{Body_Suffix} attribute. The only accepted index is "Ada". + + @item @b{Spec} or @b{Specification}: + @cindex @code{Spec} + @cindex @code{Specification} + This attribute @code{Spec} can be used to define the source file name for a + given Ada compilation unit's spec. The index is the literal name of the Ada + unit (case insensitive). The value is the literal base name of the file that + contains this unit's spec (case sensitive or insensitive depending on the + operating system). This attribute allows the definition of exceptions to the + general naming scheme, in case some files do not follow the usual + convention. + + When a source file contains several units, the relative position of the unit + can be indicated. The first unit in the file is at position 1 + + @smallexample @c projectfile + for Spec ("MyPack.MyChild") use "mypack.mychild.spec"; + for Spec ("top") use "foo.a" at 1; + for Spec ("foo") use "foo.a" at 2; + @end smallexample + + @item @b{Body} or @b{Implementation}: + @cindex @code{Body} + @cindex @code{Implementation} + These attribute play the same role as @emph{Spec} for Ada bodies. + + @item @b{Specification_Exceptions} and @b{Implementation_Exceptions}: + @cindex @code{Specification_Exceptions} + @cindex @code{Implementation_Exceptions} + These attributes define exceptions to the naming scheme for languages + other than Ada. They are indexed on the language name, and contain + a list of file names respectively for headers and source code. + + + @end table + + @ifclear vms + For example, the following package models the Apex file naming rules: + + @smallexample @c projectfile + @group + package Naming is + for Casing use "lowercase"; + for Dot_Replacement use "."; + for Spec_Suffix ("Ada") use ".1.ada"; + for Body_Suffix ("Ada") use ".2.ada"; + end Naming; + @end group + @end smallexample + @end ifclear + + @ifset vms + For example, the following package models the DEC Ada file naming rules: + + @smallexample @c projectfile + @group + package Naming is + for Casing use "lowercase"; + for Dot_Replacement use "__"; + for Spec_Suffix ("Ada") use "_.ada"; + for Body_Suffix ("Ada") use ".ada"; + end Naming; + @end group + @end smallexample + + @noindent + (Note that @code{Casing} is @code{"lowercase"} because GNAT gets the file + names in lower case) + @end ifset + + @c --------------------------------------------- + @node Organizing Projects into Subsystems + @section Organizing Projects into Subsystems + @c --------------------------------------------- + + @noindent + A @b{subsystem} is a coherent part of the complete system to be built. It is + represented by a set of sources and one single object directory. A system can + be composed of a single subsystem when it is simple as we have seen in the + first section. Complex systems are usually composed of several interdependent + subsystems. A subsystem is dependent on another subsystem if knowledge of the + other one is required to build it, and in particular if visibility on some of + the sources of this other subsystem is required. Each subsystem is usually + represented by its own project file. + + In this section, the previous example is being extended. Let's assume some + sources of our @code{Build} project depend on other sources. + For instance, when building a graphical interface, it is usual to depend upon + a graphical library toolkit such as GtkAda. Furthermore, we also need + sources from a logging module we had previously written. + + @menu + * Project Dependencies:: + * Cyclic Project Dependencies:: + * Sharing Between Projects:: + * Global Attributes:: + @end menu + + @c --------------------------------------------- + @node Project Dependencies + @subsection Project Dependencies + @c --------------------------------------------- + + @noindent + GtkAda comes with its own project file (appropriately called + @file{gtkada.gpr}), and we will assume we have already built a project + called @file{logging.gpr} for the logging module. With the information provided + so far in @file{build.gpr}, building the application would fail with an error + indicating that the gtkada and logging units that are relied upon by the sources + of this project cannot be found. + + This is easily solved by adding the following @b{with} clauses at the beginning + of our project: + + @smallexample @c projectfile + with "gtkada.gpr"; + with "a/b/logging.gpr"; + project Build is + ... -- as before + end Build; + @end smallexample + + @noindent + @cindex @code{Externally_Built} + When such a project is compiled, @command{gnatmake} will automatically + check the other projects and recompile their sources when needed. It will also + recompile the sources from @code{Build} when needed, and finally create the + executable. In some cases, the implementation units needed to recompile a + project are not available, or come from some third-party and you do not want to + recompile it yourself. In this case, the attribute @b{Externally_Built} to + "true" can be set, indicating to the builder that this project can be assumed + to be up-to-date, and should not be considered for recompilation. In Ada, if + the sources of this externally built project were compiled with another version + of the compiler or with incompatible options, the binder will issue an error. + + The project's @code{with} clause has several effects. It provides source + visibility between projects during the compilation process. It also guarantees + that the necessary object files from @code{Logging} and @code{GtkAda} are + available when linking @code{Build}. + + As can be seen in this example, the syntax for importing projects is similar + to the syntax for importing compilation units in Ada. However, project files + use literal strings instead of names, and the @code{with} clause identifies + project files rather than packages. + + Each literal string after @code{with} is the path + (absolute or relative) to a project file. The @code{.gpr} extension is + optional, although we recommend adding it. If no extension is specified, + and no project file with the @file{^.gpr^.GPR^} extension is found, then + the file is searched for exactly as written in the @code{with} clause, + that is with no extension. + + @cindex project path + When a relative path or a base name is used, the + project files are searched relative to each of the directories in the + @b{project path}. This path includes all the directories found with the + following algorithm, in that order, as soon as a matching file is found, + the search stops: + + @itemize @bullet + @item First, the file is searched relative to the directory that contains the + current project file. + @item + @cindex @code{ADA_PROJECT_PATH} + @cindex @code{GPR_PROJECT_PATH} + Then it is searched relative to all the directories specified in the + ^environment variables^logical names^ @b{GPR_PROJECT_PATH} and + @b{ADA_PROJECT_PATH} (in that order) if they exist. The former is + recommended, the latter is kept for backward compatibility. + @item Finally, it is searched relative to the default project directories. + Such directories depends on the tool used. For @command{gnatmake}, there is + one default project directory: @file{/lib/gnat/}. In our example, + @file{gtkada.gpr} is found in the predefined directory if it was installed at + the same root as GNAT. + + @end itemize + + @noindent + Some tools also support extending the project path from the command line, + generally through the @option{-aP}. You can see the value of the project + path by using the @command{gnatls -v} command. + + Any symbolic link will be fully resolved in the directory of the + importing project file before the imported project file is examined. + + Any source file in the imported project can be used by the sources of the + importing project, transitively. + Thus if @code{A} imports @code{B}, which imports @code{C}, the sources of + @code{A} may depend on the sources of @code{C}, even if @code{A} does not + import @code{C} explicitly. However, this is not recommended, because if + and when @code{B} ceases to import @code{C}, some sources in @code{A} will + no longer compile. @command{gprbuild} has a switch @option{--no-indirect-imports} + that will report such indirect dependencies. + + One very important aspect of a project hierarchy is that + @b{a given source can only belong to one project} (otherwise the project manager + would not know which settings apply to it and when to recompile it). It means + that different project files do not usually share source directories or + when they do, they need to specify precisely which project owns which sources + using attribute @code{Source_Files} or equivalent. By contrast, 2 projects + can each own a source with the same base file name as long as they live in + different directories. The latter is not true for Ada Sources because of the + correlation between source files and Ada units. + + @c --------------------------------------------- + @node Cyclic Project Dependencies + @subsection Cyclic Project Dependencies + @c --------------------------------------------- + + @noindent + Cyclic dependencies are mostly forbidden: + if @code{A} imports @code{B} (directly or indirectly) then @code{B} + is not allowed to import @code{A}. However, there are cases when cyclic + dependencies would be beneficial. For these cases, another form of import + between projects exists: the @b{limited with}. A project @code{A} that + imports a project @code{B} with a straight @code{with} may also be imported, + directly or indirectly, by @code{B} through a @code{limited with}. + + The difference between straight @code{with} and @code{limited with} is that + the name of a project imported with a @code{limited with} cannot be used in the + project importing it. In particular, its packages cannot be renamed and + its variables cannot be referred to. + + @smallexample @c 0projectfile + with "b.gpr"; + with "c.gpr"; + project A is + For Exec_Dir use B'Exec_Dir; -- ok + end A; + + limited with "a.gpr"; -- Cyclic dependency: A -> B -> A + project B is + For Exec_Dir use A'Exec_Dir; -- not ok + end B; + + with "d.gpr"; + project C is + end C; + + limited with "a.gpr"; -- Cyclic dependency: A -> C -> D -> A + project D is + For Exec_Dir use A'Exec_Dir; -- not ok + end D; + @end smallexample + + @c --------------------------------------------- + @node Sharing Between Projects + @subsection Sharing Between Projects + @c --------------------------------------------- + + @noindent + When building an application, it is common to have similar needs in several of + the projects corresponding to the subsystems under construction. For instance, + they will all have the same compilation switches. + + As seen before (@pxref{Tools Options in Project Files}), setting compilation + switches for all sources of a subsystem is simple: it is just a matter of + adding a @code{Compiler.Default_Switches} attribute to each project files with + the same value. Of course, that means duplication of data, and both places need + to be changed in order to recompile the whole application with different + switches. It can become a real problem if there are many subsystems and thus + many project files to edit. + + There are two main approaches to avoiding this duplication: + + @itemize @bullet + @item Since @file{build.gpr} imports @file{logging.gpr}, we could change it + to reference the attribute in Logging, either through a package renaming, + or by referencing the attribute. The following example shows both cases: + + @smallexample @c projectfile + project Logging is + package Compiler is + for Switches ("Ada") use ("-O2"); + end Compiler; + package Binder is + for Switches ("Ada") use ("-E"); + end Binder; + end Logging; + + with "logging.gpr"; + project Build is + package Compiler renames Logging.Compiler; + package Binder is + for Switches ("Ada") use Logging.Binder'Switches ("Ada"); + end Binder; + end Build; + @end smallexample + + @noindent + The solution used for @code{Compiler} gets the same value for all + attributes of the package, but you cannot modify anything from the + package (adding extra switches or some exceptions). The second + version is more flexible, but more verbose. + + If you need to refer to the value of a variable in an imported + project, rather than an attribute, the syntax is similar but uses + a "." rather than an apostrophe. For instance: + + @smallexample @c projectfile + with "imported"; + project Main is + Var1 := Imported.Var; + end Main; + @end smallexample + + @item The second approach is to define the switches in a third project. + That project is setup without any sources (so that, as opposed to + the first example, none of the project plays a special role), and + will only be used to define the attributes. Such a project is + typically called @file{shared.gpr}. + + @smallexample @c projectfile + abstract project Shared is + for Source_Files use (); -- no project + package Compiler is + for Switches ("Ada") use ("-O2"); + end Compiler; + end Shared; + + with "shared.gpr"; + project Logging is + package Compiler renames Shared.Compiler; + end Logging; + + with "shared.gpr"; + project Build is + package Compiler renames Shared.Compiler; + end Build; + @end smallexample + + @noindent + As for the first example, we could have chosen to set the attributes + one by one rather than to rename a package. The reason we explicitly + indicate that @code{Shared} has no sources is so that it can be created + in any directory and we are sure it shares no sources with @code{Build} + or @code{Logging}, which of course would be invalid. + + @cindex project qualifier + Note the additional use of the @b{abstract} qualifier in @file{shared.gpr}. + This qualifier is optional, but helps convey the message that we do not + intend this project to have sources (@pxref{Qualified Projects} for + more qualifiers). + @end itemize + + + @c --------------------------------------------- + @node Global Attributes + @subsection Global Attributes + @c --------------------------------------------- + + @noindent + We have already seen many examples of attributes used to specify a special + option of one of the tools involved in the build process. Most of those + attributes are project specific. That it to say, they only affect the invocation + of tools on the sources of the project where they are defined. + + There are a few additional attributes that apply to all projects in a + hierarchy as long as they are defined on the "main" project. + The main project is the project explicitly mentioned on the command-line. + The project hierarchy is the "with"-closure of the main project. + + Here is a list of commonly used global attributes: + + @table @asis + @item @b{Builder.Global_Configuration_Pragmas}: + @cindex @code{Global_Configuration_Pragmas} + This attribute points to a file that contains configuration pragmas + to use when building executables. These pragmas apply for all + executables build from this project hierarchy. As we have seen before, + additional pragmas can be specified on a per-project basis by setting the + @code{Compiler.Local_Configuration_Pragmas} attribute. + + @item @b{Builder.Global_Compilation_Switches}: + @cindex @code{Global_Compilation_Switches} + This attribute is a list of compiler switches to use when compiling any + source file in the project hierarchy. These switches are used in addition + to the ones defined in the @code{Compiler} package, which only apply to + the sources of the corresponding project. This attribute is indexed on + the name of the language. + + @end table + + Using such global capabilities is convenient. It can also lead to unexpected + behavior. Especially when several subsystems are shared among different main + projects and the different global attributes are not + compatible. Note that using aggregate projects can be a safer and more powerful + replacement to global attributes. + + @c --------------------------------------------- + @node Scenarios in Projects + @section Scenarios in Projects + @c --------------------------------------------- + + @noindent + Various aspects of the projects can be modified based on @b{scenarios}. These + are user-defined modes that change the behavior of a project. Typical + examples are the setup of platform-specific compiler options, or the use of + a debug and a release mode (the former would activate the generation of debug + information, when the second will focus on improving code optimization). + + Let's enhance our example to support a debug and a release modes.The issue is to + let the user choose what kind of system he is building: + use @option{-g} as compiler switches in debug mode and @option{-O2} + in release mode. We will also setup the projects so that we do not share the + same object directory in both modes, otherwise switching from one to the other + might trigger more recompilations than needed or mix objects from the 2 modes. + + One naive approach is to create two different project files, say + @file{build_debug.gpr} and @file{build_release.gpr}, that set the appropriate + attributes as explained in previous sections. This solution does not scale well, + because in presence of multiple projects depending on each other, + you will also have to duplicate the complete hierarchy and adapt the project + files to point to the right copies. + + @cindex scenarios + Instead, project files support the notion of scenarios controlled + by external values. Such values can come from several sources (in decreasing + order of priority): + + @table @asis + @item @b{Command line}: + @cindex @option{-X} + When launching @command{gnatmake} or @command{gprbuild}, the user can pass + extra @option{-X} switches to define the external value. In + our case, the command line might look like + + @smallexample + gnatmake -Pbuild.gpr -Xmode=debug + or gnatmake -Pbuild.gpr -Xmode=release + @end smallexample + + @item @b{^Environment variables^Logical names^}: + When the external value does not come from the command line, it can come from + the value of ^environment variables^logical names^ of the appropriate name. + In our case, if ^an environment variable^a logical name^ called "mode" + exist, its value will be taken into account. + + @item @b{External function second parameter} + + @end table + + @cindex @code{external} + We now need to get that value in the project. The general form is to use + the predefined function @b{external} which returns the current value of + the external. For instance, we could setup the object directory to point to + either @file{obj/debug} or @file{obj/release} by changing our project to + + @smallexample @c projectfile + project Build is + for Object_Dir use "obj/" & external ("mode", "debug"); + ... -- as before + end Build; + @end smallexample + + @noindent + The second parameter to @code{external} is optional, and is the default + value to use if "mode" is not set from the command line or the environment. + + In order to set the switches according to the different scenarios, other + constructs have to be introduced such as typed variables and case statements. + + @cindex typed variable + @cindex case statement + A @b{typed variable} is a variable that + can take only a limited number of values, similar to an enumeration in Ada. + Such a variable can then be used in a @b{case statement} and create conditional + sections in the project. The following example shows how this can be done: + + @smallexample @c projectfile + project Build is + type Mode_Type is ("debug", "release"); -- all possible values + Mode : Mode_Type := external ("mode", "debug"); -- a typed variable + + package Compiler is + case Mode is + when "debug" => + for Switches ("Ada") use ("-g"); + when "release" => + for Switches ("Ada") use ("-O2"); + end case; + end Compiler; + end Build; + @end smallexample + + @noindent + The project has suddenly grown in size, but has become much more flexible. + @code{Mode_Type} defines the only valid values for the @code{mode} variable. If + any other value is read from the environment, an error is reported and the + project is considered as invalid. + + The @code{Mode} variable is initialized with an external value + defaulting to @code{"debug"}. This default could be omitted and that would + force the user to define the value. Finally, we can use a case statement to set the + switches depending on the scenario the user has chosen. + + Most aspects of the projects can depend on scenarios. The notable exception + are project dependencies (@code{with} clauses), which may not depend on a scenario. + + Scenarios work the same way with @b{project hierarchies}: you can either + duplicate a variable similar to @code{Mode} in each of the project (as long + as the first argument to @code{external} is always the same and the type is + the same), or simply set the variable in the @file{shared.gpr} project + (@pxref{Sharing Between Projects}). + + @c --------------------------------------------- + @node Library Projects + @section Library Projects + @c --------------------------------------------- + + @noindent + So far, we have seen examples of projects that create executables. However, + it is also possible to create libraries instead. A @b{library} is a specific + type of subsystem where, for convenience, objects are grouped together + using system-specific means such as archives or windows DLLs. + + Library projects provide a system- and language-independent way of building both @b{static} + and @b{dynamic} libraries. They also support the concept of @b{standalone + libraries} (SAL) which offers two significant properties: the elaboration + (e.g. initialization) of the library is either automatic or very simple; + a change in the + implementation part of the library implies minimal post-compilation actions on + the complete system and potentially no action at all for the rest of the + system in the case of dynamic SALs. + + The GNAT Project Manager takes complete care of the library build, rebuild and + installation tasks, including recompilation of the source files for which + objects do not exist or are not up to date, assembly of the library archive, and + installation of the library (i.e., copying associated source, object and + @file{ALI} files to the specified location). + + @menu + * Building Libraries:: + * Using Library Projects:: + * Stand-alone Library Projects:: + * Installing a library with project files:: + @end menu + + @c --------------------------------------------- + @node Building Libraries + @subsection Building Libraries + @c --------------------------------------------- + + @noindent + Let's enhance our example and transform the @code{logging} subsystem into a + library. In order to do so, a few changes need to be made to @file{logging.gpr}. + A number of specific attributes needs to be defined: at least @code{Library_Name} + and @code{Library_Dir}; in addition, a number of other attributes can be used + to specify specific aspects of the library. For readability, it is also + recommended (although not mandatory), to use the qualifier @code{library} in + front of the @code{project} keyword. + + @table @asis + @item @b{Library_Name}: + @cindex @code{Library_Name} + This attribute is the name of the library to be built. There is no + restriction on the name of a library imposed by the project manager; + however, there may be system specific restrictions on the name. + In general, it is recommended to stick to alphanumeric characters + (and possibly underscores) to help portability. + + @item @b{Library_Dir}: + @cindex @code{Library_Dir} + This attribute is the path (absolute or relative) of the directory where + the library is to be installed. In the process of building a library, + the sources are compiled, the object files end up in the explicit or + implicit @code{Object_Dir} directory. When all sources of a library + are compiled, some of the compilation artifacts, including the library itself, + are copied to the library_dir directory. This directory must exists and be + writable. It must also be different from the object directory so that cleanup + activities in the Library_Dir do not affect recompilation needs. + + @end table + + Here is the new version of @file{logging.gpr} that makes it a library: + + @smallexample @c projectfile + library project Logging is -- "library" is optional + for Library_Name use "logging"; -- will create "liblogging.a" on Unix + for Object_Dir use "obj"; + for Library_Dir use "lib"; -- different from object_dir + end Logging; + @end smallexample + + @noindent + Once the above two attributes are defined, the library project is valid and + is enough for building a library with default characteristics. + Other library-related attributes can be used to change the defaults: + + @table @asis + @item @b{Library_Kind}: + @cindex @code{Library_Kind} + The value of this attribute must be either @code{"static"}, @code{"dynamic"} or + @code{"relocatable"} (the latter is a synonym for dynamic). It indicates + which kind of library should be build (the default is to build a + static library, that is an archive of object files that can potentially + be linked into a static executable). When the library is set to be dynamic, + a separate image is created that will be loaded independently, usually + at the start of the main program execution. Support for dynamic libraries is + very platform specific, for instance on Windows it takes the form of a DLL + while on GNU/Linux, it is a dynamic elf image whose suffix is usually + @file{.so}. Library project files, on the other hand, can be written in + a platform independent way so that the same project file can be used to build + a library on different operating systems. + + If you need to build both a static and a dynamic library, it is recommended + use two different object directories, since in some cases some extra code + needs to be generated for the latter. For such cases, one can + either define two different project files, or a single one which uses scenarios + to indicate at the various kinds of library to be build and their + corresponding object_dir. + + @cindex @code{Library_ALI_Dir} + @item @b{Library_ALI_Dir}: + This attribute may be specified to indicate the directory where the ALI + files of the library are installed. By default, they are copied into the + @code{Library_Dir} directory, but as for the executables where we have a + separate @code{Exec_Dir} attribute, you might want to put them in a separate + directory since there can be hundreds of them. The same restrictions as for + the @code{Library_Dir} attribute apply. + + @cindex @code{Library_Version} + @item @b{Library_Version}: + This attribute is platform dependent, and has no effect on VMS and Windows. + On Unix, it is used only for dynamic libraries as the internal + name of the library (the @code{"soname"}). If the library file name (built + from the @code{Library_Name}) is different from the @code{Library_Version}, + then the library file will be a symbolic link to the actual file whose name + will be @code{Library_Version}. This follows the usual installation schemes + for dynamic libraries on many Unix systems. + + @smallexample @c projectfile + @group + project Logging is + Version := "1"; + for Library_Dir use "lib"; + for Library_Name use "logging"; + for Library_Kind use "dynamic"; + for Library_Version use "liblogging.so." & Version; + end Logging; + @end group + @end smallexample + + @noindent + After the compilation, the directory @file{lib} will contain both a + @file{libdummy.so.1} library and a symbolic link to it called + @file{libdummy.so}. + + @cindex @code{Library_GCC} + @item @b{Library_GCC}: + This attribute is the name of the tool to use instead of "gcc" to link shared + libraries. A common use of this attribute is to define a wrapper script that + accomplishes specific actions before calling gcc (which itself is calling the + linker to build the library image). + + @item @b{Library_Options}: + @cindex @code{Library_Options} + This attribute may be used to specified additional switches (last switches) + when linking a shared library. + + @item @b{Leading_Library_Options}: + @cindex @code{Leading_Library_Options} + This attribute, that is taken into account only by @command{gprbuild}, may be + used to specified leading options (first switches) when linking a shared + library. + + @cindex @code{Linker_Options} + @item @b{Linker.Linker_Options}: + This attribute specifies additional switches to be given to the linker when + linking an executable. It is ignored when defined in the main project and + taken into account in all other projects that are imported directly or + indirectly. These switches complement the @code{Linker.Switches} + defined in the main project. This is useful when a particular subsystem + depends on an external library: adding this dependency as a + @code{Linker_Options} in the project of the subsystem is more convenient than + adding it to all the @code{Linker.Switches} of the main projects that depend + upon this subsystem. + @end table + + + @c --------------------------------------------- + @node Using Library Projects + @subsection Using Library Projects + @c --------------------------------------------- + + @noindent + When the builder detects that a project file is a library project file, it + recompiles all sources of the project that need recompilation and rebuild the + library if any of the sources have been recompiled. It then groups all object + files into a single file, which is a shared or a static library. This library + can later on be linked with multiple executables. Note that the use + of shard libraries reduces the size of the final executable and can also reduce + the memory footprint at execution time when the library is shared among several + executables. + + It is also possible to build @b{multi-language libraries}. When using + @command{gprbuild} as a builder, multi-language library projects allow naturally + the creation of multi-language libraries . @command{gnatmake}, does not try to + compile non Ada sources. However, when the project is multi-language, it will + automatically link all object files found in the object directory, whether or + not they were compiled from an Ada source file. This specific behavior does not + apply to Ada-only projects which only take into account the objects + corresponding to the sources of the project. + + A non-library project can import a library project. When the builder is invoked + on the former, the library of the latter is only rebuilt when absolutely + necessary. For instance, if a unit of the + library is not up-to-date but non of the executables need this unit, then the + unit is not recompiled and the library is not reassembled. + For instance, let's assume in our example that logging has the following + sources: @file{log1.ads}, @file{log1.adb}, @file{log2.ads} and + @file{log2.adb}. If @file{log1.adb} has been modified, then the library + @file{liblogging} will be rebuilt when compiling all the sources of + @code{Build} only if @file{proc.ads}, @file{pack.ads} or @file{pack.adb} + include a @code{"with Log1"}. + + To ensure that all the sources in the @code{Logging} library are + up to date, and that all the sources of @code{Build} are also up to date, + the following two commands needs to be used: + + @smallexample + gnatmake -Plogging.gpr + gnatmake -Pbuild.gpr + @end smallexample + + @noindent + All @file{ALI} files will also be copied from the object directory to the + library directory. To build executables, @command{gnatmake} will use the + library rather than the individual object files. + + @ifclear vms + Library projects can also be useful to describe a library that need to be used + but, for some reason, cannot be rebuilt. For instance, it is the case when some + of the library sources are not available. Such library projects need simply to + use the @code{Externally_Built} attribute as in the example below: + + @smallexample @c projectfile + library project Extern_Lib is + for Languages use ("Ada", "C"); + for Source_Dirs use ("lib_src"); + for Library_Dir use "lib2"; + for Library_Kind use "dynamic"; + for Library_Name use "l2"; + for Externally_Built use "true"; -- <<<< + end Extern_Lib; + @end smallexample + + @noindent + In the case of externally built libraries, the @code{Object_Dir} + attribute does not need to be specified because it will never be + used. + + The main effect of using such an externally built library project is mostly to + affect the linker command in order to reference the desired library. It can + also be achieved by using @code{Linker.Linker_Options} or @code{Linker.Switches} + in the project corresponding to the subsystem needing this external library. + This latter method is more straightforward in simple cases but when several + subsystems depend upon the same external library, finding the proper place + for the @code{Linker.Linker_Options} might not be easy and if it is + not placed properly, the final link command is likely to present ordering issues. + In such a situation, it is better to use the externally built library project + so that all other subsystems depending on it can declare this dependency thanks + to a project @code{with} clause, which in turn will trigger the builder to find + the proper order of libraries in the final link command. + @end ifclear + + @c --------------------------------------------- + @node Stand-alone Library Projects + @subsection Stand-alone Library Projects + @c --------------------------------------------- + + @noindent + @cindex standalone libraries + A @b{stand-alone library} is a library that contains the necessary code to + elaborate the Ada units that are included in the library. A stand-alone + library is a convenient way to add an Ada subsystem to a more global system + whose main is not in Ada since it makes the elaboration of the Ada part mostly + transparent. However, stand-alone libraries are also useful when the main is in + Ada: they provide a means for minimizing relinking & redeployment of complex + systems when localized changes are made. + + The most prominent characteristic of a stand-alone library is that it offers a + distinction between interface units and implementation units. Only the former + are visible to units outside the library. A stand-alone library project is thus + characterised by a third attribute, @b{Library_Interface}, in addition to the + two attributes that make a project a Library Project (@code{Library_Name} and + @code{Library_Dir}). + + @table @asis + @item @b{Library_Interface}: + @cindex @code{Library_Interface} + This attribute defines an explicit subset of the units of the project. + Projects importing this library project may only "with" units whose sources + are listed in the @code{Library_Interface}. Other sources are considered + implementation units. + + @smallexample @c projectfile + @group + for Library_Dir use "lib"; + for Library_Name use "loggin"; + for Library_Interface use ("lib1", "lib2"); -- unit names + @end group + @end smallexample + + @end table + + In order to include the elaboration code in the stand-alone library, the binder + is invoked on the closure of the library units creating a package whose name + depends on the library name (^b~logging.ads/b^B$LOGGING.ADS/B^ in the example). + This binder-generated package includes @b{initialization} and @b{finalization} + procedures whose names depend on the library name (@code{logginginit} and + @code{loggingfinal} in the example). The object corresponding to this package is + included in the library. + + @table @asis + @item @b{Library_Auto_Init}: + @cindex @code{Library_Auto_Init} + A dynamic stand-alone Library is automatically initialized + if automatic initialization of Stand-alone Libraries is supported on the + platform and if attribute @b{Library_Auto_Init} is not specified or + is specified with the value "true". A static Stand-alone Library is never + automatically initialized. Specifying "false" for this attribute + prevent automatic initialization. + + When a non-automatically initialized stand-alone library is used in an + executable, its initialization procedure must be called before any service of + the library is used. When the main subprogram is in Ada, it may mean that the + initialization procedure has to be called during elaboration of another + package. + + @item @b{Library_Dir}: + @cindex @code{Library_Dir} + For a stand-alone library, only the @file{ALI} files of the interface units + (those that are listed in attribute @code{Library_Interface}) are copied to + the library directory. As a consequence, only the interface units may be + imported from Ada units outside of the library. If other units are imported, + the binding phase will fail. + + @item @b{Binder.Default_Switches}: + When a stand-alone library is bound, the switches that are specified in + the attribute @b{Binder.Default_Switches ("Ada")} are + used in the call to @command{gnatbind}. + + @item @b{Library_Src_Dir}: + @cindex @code{Library_Src_Dir} + This attribute defines the location (absolute or relative to the project + directory) where the sources of the interface units are copied at + installation time. + These sources includes the specs of the interface units along with the closure + of sources necessary to compile them successfully. That may include bodies and + subunits, when pragmas @code{Inline} are used, or when there is a generic + units in the spec. This directory cannot point to the object directory or + one of the source directories, but it can point to the library directory, + which is the default value for this attribute. + + @item @b{Library_Symbol_Policy}: + @cindex @code{Library_Symbol_Policy} + This attribute controls the export of symbols and, on some platforms (like + VMS) that have the notions of major and minor IDs built in the library + files, it controls the setting of these IDs. It is not supported on all + platforms (where it will just have no effect). It may have one of the + following values: + + @itemize - + @item @code{"autonomous"} or @code{"default"}: exported symbols are not controlled + @item @code{"compliant"}: if attribute @b{Library_Reference_Symbol_File} + is not defined, then it is equivalent to policy "autonomous". If there + are exported symbols in the reference symbol file that are not in the + object files of the interfaces, the major ID of the library is increased. + If there are symbols in the object files of the interfaces that are not + in the reference symbol file, these symbols are put at the end of the list + in the newly created symbol file and the minor ID is increased. + @item @code{"controlled"}: the attribute @b{Library_Reference_Symbol_File} must be + defined. The library will fail to build if the exported symbols in the + object files of the interfaces do not match exactly the symbol in the + symbol file. + @item @code{"restricted"}: The attribute @b{Library_Symbol_File} must be defined. + The library will fail to build if there are symbols in the symbol file that + are not in the exported symbols of the object files of the interfaces. + Additional symbols in the object files are not added to the symbol file. + @item @code{"direct"}: The attribute @b{Library_Symbol_File} must be defined and + must designate an existing file in the object directory. This symbol file + is passed directly to the underlying linker without any symbol processing. + + @end itemize + + @item @b{Library_Reference_Symbol_File} + @cindex @code{Library_Reference_Symbol_File} + This attribute may define the path name of a reference symbol file that is + read when the symbol policy is either "compliant" or "controlled", on + platforms that support symbol control, such as VMS, when building a + stand-alone library. The path may be an absolute path or a path relative + to the project directory. + + @item @b{Library_Symbol_File} + @cindex @code{Library_Symbol_File} + This attribute may define the name of the symbol file to be created when + building a stand-alone library when the symbol policy is either "compliant", + "controlled" or "restricted", on platforms that support symbol control, + such as VMS. When symbol policy is "direct", then a file with this name + must exist in the object directory. + @end table + + + @c --------------------------------------------- + @node Installing a library with project files + @subsection Installing a library with project files + @c --------------------------------------------- + + @noindent + When using project files, library installation is part of the library build + process. Thus no further action is needed in order to make use of the + libraries that are built as part of the general application build. A usable + version of the library is installed in the directory specified by the + @code{Library_Dir} attribute of the library project file. + + You may want to install a library in a context different from where the library + is built. This situation arises with third party suppliers, who may want + to distribute a library in binary form where the user is not expected to be + able to recompile the library. The simplest option in this case is to provide + a project file slightly different from the one used to build the library, by + using the @code{externally_built} attribute. @ref{Using Library Projects} + + @c --------------------------------------------- + @node Project Extension + @section Project Extension + @c --------------------------------------------- + + @noindent + During development of a large system, it is sometimes necessary to use + modified versions of some of the source files, without changing the original + sources. This can be achieved through the @b{project extension} facility. + + Suppose for instance that our example @code{Build} project is build every night + for the whole team, in some shared directory. A developer usually need to work + on a small part of the system, and might not want to have a copy of all the + sources and all the object files (mostly because that would require too much + disk space, time to recompile everything). He prefers to be able to override + some of the source files in his directory, while taking advantage of all the + object files generated at night. + + Another example can be taken from large software systems, where it is common to have + multiple implementations of a common interface; in Ada terms, multiple + versions of a 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} + another project (the ``parent'') then by default all source files of the + parent project are inherited by the child, but the child project can + override any of the parent's source files with new versions, and can also + add new files or remove unnecessary ones. + This facility is the project analog of a type extension in + object-oriented programming. Project hierarchies are permitted (an extending + project may itself be extended), and a project that + extends a project can also import other projects. + + A third example is that of using project extensions to provide different + versions of the same system. For instance, assume that a @code{Common} + project is used by two development branches. One of the branches has now + been frozen, and no further change can be done to it or to @code{Common}. + However, the other development branch still needs evolution of @code{Common}. + Project extensions provide a flexible solution to create a new version + of a subsystem while sharing and reusing as much as possible from the original + one. + + A project extension inherits implicitly all the sources and objects from the + project it extends. It is possible to create a new version of some of the + sources in one of the additional source dirs of the extending project. Those new + versions hide the original versions. Adding new sources or removing existing + ones is also possible. Here is an example on how to extend the project + @code{Build} from previous examples: + + @smallexample @c projectfile + project Work extends "../bld/build.gpr" is + end Work; + @end smallexample + + @noindent + The project after @b{extends} is the one being extended. As usual, it can be + specified using an absolute path, or a path relative to any of the directories + in the project path (@pxref{Project Dependencies}). This project does not + specify source or object directories, so the default value for these attribute + will be used that is to say the current directory (where project @code{Work} is + placed). We can already compile that project with + + @smallexample + gnatmake -Pwork + @end smallexample + + @noindent + If no sources have been placed in the current directory, this command + won't do anything, since this project does not change the + sources it inherited from @code{Build}, therefore all the object files + in @code{Build} and its dependencies are still valid and are reused + automatically. + + Suppose we now want to supply an alternate version of @file{pack.adb} + but use the existing versions of @file{pack.ads} and @file{proc.adb}. + We can create the new file Work's current directory (likely + by copying the one from the @code{Build} project and making changes to + it. If new packages are needed at the same time, we simply create + new files in the source directory of the extending project. + + When we recompile, @command{gnatmake} will now automatically recompile + this file (thus creating @file{pack.o} in the current directory) and + any file that depends on it (thus creating @file{proc.o}). Finally, the + executable is also linked locally. + + Note that we could have obtained the desired behavior using project import + rather than project inheritance. A @code{base} project would contain the + sources for @file{pack.ads} and @file{proc.adb}, and @code{Work} would + import @code{base} and add @file{pack.adb}. In this scenario, @code{base} + cannot contain the original version of @file{pack.adb} otherwise there would be + 2 versions of the same unit in the closure of the project and this is not + allowed. Generally speaking, it is not recommended to put the spec and the + body of a unit in different projects since this affects their autonomy and + reusability. + + In a project file that extends another project, it is possible to + indicate that an inherited source is @b{not part} of the sources of the + extending project. This is necessary sometimes when a package spec has + been overridden and no longer requires a body: in this case, it is + necessary to indicate that the inherited body is not part of the sources + of the project, otherwise there will be a compilation error + when compiling the spec. + + @cindex @code{Excluded_Source_Files} + @cindex @code{Excluded_Source_List_File} + For that purpose, the attribute @b{Excluded_Source_Files} is used. + Its value is a list of file names. + It is also possible to use attribute @code{Excluded_Source_List_File}. + Its value is the path of a text file containing one file name per + line. + + @smallexample @c @projectfile + project Work extends "../bld/build.gpr" is + for Source_Files use ("pack.ads"); + -- New spec of Pkg does not need a completion + for Excluded_Source_Files use ("pack.adb"); + end Work; + @end smallexample + + @noindent + An extending project retains all the switches specified in the + extended project. + + @menu + * Project Hierarchy Extension:: + @end menu + + @c --------------------------------------------- + @node Project Hierarchy Extension + @subsection Project Hierarchy Extension + @c --------------------------------------------- + + @noindent + One of the fundamental restrictions in project extension is the following: + @b{A project is not allowed to import directly or indirectly at the same time an + extending project and one of its ancestors}. + + By means of example, consider the following hierarchy of projects. + + @smallexample + a.gpr contains package A1 + b.gpr, imports a.gpr and contains B1, which depends on A1 + c.gpr, imports b.gpr and contains C1, which depends on B1 + @end smallexample + + @noindent + If we want to locally extend the packages @code{A1} and @code{C1}, we need to + create several extending projects: + + @smallexample + a_ext.gpr which extends a.gpr, and overrides A1 + b_ext.gpr which extends b.gpr and imports a_ext.gpr + c_ext.gpr which extends c.gpr, imports b_ext.gpr and overrides C1 + @end smallexample + + @noindent + @smallexample @c projectfile + project A_Ext extends "a.gpr" is + for Source_Files use ("a1.adb", "a1.ads"); + end A_Ext; + + with "a_ext.gpr"; + project B_Ext extends "b.gpr" is + end B_Ext; + + with "b_ext.gpr"; + project C_Ext extends "c.gpr" is + for Source_Files use ("c1.adb"); + end C_Ext; + @end smallexample + + @noindent + The extension @file{b_ext.gpr} is required, even though we are not overriding + any of the sources of @file{b.gpr} because otherwise @file{c_expr.gpr} would + import @file{b.gpr} which itself knows nothing about @file{a_ext.gpr}. + + @cindex extends all + When extending a large system spanning multiple projects, it is often + inconvenient to extend every project in the hierarchy that is impacted by a + small change introduced in a low layer. In such cases, it is possible to create + an @b{implicit extension} of entire hierarchy using @b{extends all} + relationship. + + When the project is extended using @code{extends all} inheritance, all projects + that are imported by it, both directly and indirectly, are considered virtually + extended. That is, the project manager creates implicit projects + that extend every project in the hierarchy; all these implicit projects do not + control sources on their own and use the object directory of + the "extending all" project. + + It is possible to explicitly extend one or more projects in the hierarchy + in order to modify the sources. These extending projects must be imported by + the "extending all" project, which will replace the corresponding virtual + projects with the explicit ones. + + When building such a project hierarchy extension, the project manager will + ensure that both modified sources and sources in implicit extending projects + that depend on them, are recompiled. + + Thus, in our example we could create the following projects instead: + + @smallexample + a_ext.gpr, extends a.gpr and overrides A1 + c_ext.gpr, "extends all" c.gpr, imports a_ext.gpr and overrides C1 + + @end smallexample + + @noindent + @smallexample @c projectfile + project A_Ext extends "a.gpr" is + for Source_Files use ("a1.adb", "a1.ads"); + end A_Ext; + + with "a_ext.gpr"; + project C_Ext extends all "c.gpr" is + for Source_Files use ("c1.adb"); + end C_Ext; + @end smallexample + + @noindent + When building project @file{c_ext.gpr}, the entire modified project space is + considered for recompilation, including the sources of @file{b.gpr} that are + impacted by the changes in @code{A1} and @code{C1}. + + @c --------------------------------------------- + @node Project File Reference + @section Project File Reference + @c --------------------------------------------- + + @noindent + This section describes the syntactic structure of project files, the various + constructs that can be used. Finally, it ends with a summary of all available + attributes. + + @menu + * Project Declaration:: + * Qualified Projects:: + * Declarations:: + * Packages:: + * Expressions:: + * External Values:: + * Typed String Declaration:: + * Variables:: + * Attributes:: + * Case Statements:: + @end menu + + @c --------------------------------------------- + @node Project Declaration + @subsection Project Declaration + @c --------------------------------------------- + + @noindent + Project files have an Ada-like syntax. The minimal project file is: + + @smallexample @c projectfile + @group + project Empty is + end Empty; + @end group + @end smallexample + + @noindent + The identifier @code{Empty} is the name of the project. + This project name must be present after the reserved + word @code{end} at the end of the project file, followed by a semi-colon. + + @b{Identifiers} (i.e.@: the user-defined names such as project or variable names) + have the same syntax as Ada identifiers: they must start with a letter, + and be followed by zero or more letters, digits or underscore characters; + it is also illegal to have two underscores next to each other. Identifiers + are always case-insensitive ("Name" is the same as "name"). + + @smallexample + simple_name ::= identifier + name ::= simple_name @{ . simple_name @} + @end smallexample + + @noindent + @b{Strings} are used for values of attributes or as indexes for these + attributes. They are in general case sensitive, except when noted + otherwise (in particular, strings representing file names will be case + insensitive on some systems, so that "file.adb" and "File.adb" both + represent the same file). + + @b{Reserved words} are the same as for standard Ada 95, and cannot + be used for identifiers. In particular, the following words are currently + used in project files, but others could be added later on. In bold are the + extra reserved words in project files: @code{all, at, case, end, for, is, + limited, null, others, package, renames, type, use, when, with, @b{extends}, + @b{external}, @b{project}}. + + @b{Comments} in project files have the same syntax as in Ada, two consecutive + hyphens through the end of the line. + + A project may be an @b{independent project}, entirely defined by a single + project file. Any source file in an independent project depends only + on the predefined library and other source files in the same project. + But a project may also depend on other projects, either by importing them + through @b{with clauses}, or by @b{extending} at most one other project. Both + types of dependency can be used in the same project. + + A path name denotes a project file. It can be absolute or relative. + An absolute path name includes a sequence of directories, in the syntax of + the host operating system, that identifies uniquely the project file in the + file system. A relative path name identifies the project file, relative + to the directory that contains the current project, or relative to a + directory listed in the environment variables ADA_PROJECT_PATH and + GPR_PROJECT_PATH. Path names are case sensitive if file names in the host + operating system are case sensitive. As a special case, the directory + separator can always be "/" even on Windows systems, so that project files + can be made portable across architectures. + The syntax of the environment variable ADA_PROJECT_PATH and + GPR_PROJECT_PATH is a list of directory names separated by colons on UNIX and + semicolons on Windows. + + A given project name can appear only once in a context clause. + + It is illegal for a project imported by a context clause to refer, directly + or indirectly, to the project in which this context clause appears (the + dependency graph cannot contain cycles), except when one of the with clause + in the cycle is a @b{limited with}. + @c ??? Need more details here + + @smallexample @c projectfile + with "other_project.gpr"; + project My_Project extends "extended.gpr" is + end My_Project; + @end smallexample + + @noindent + These dependencies form a @b{directed graph}, potentially cyclic when using + @b{limited with}. The subprogram reflecting the @b{extends} relations is a + tree. + + A project's @b{immediate sources} are the source files directly defined by + that project, either implicitly by residing in the project source directories, + or explicitly through any of the source-related attributes. + More generally, a project sources are the immediate sources of the project + together with the immediate sources (unless overridden) of any + project on which it depends directly or indirectly. + + A @b{project hierarchy} can be created, where projects are children of + other projects. The name of such a child project must be @code{Parent.Child}, + where @code{Parent} is the name of the parent project. In particular, this + makes all @code{with} clauses of the parent project automatically visible + in the child project. + + @smallexample + project ::= context_clause project_declaration + + context_clause ::= @{with_clause@} + with_clause ::= @i{with} path_name @{ , path_name @} ; + path_name ::= string_literal + + project_declaration ::= simple_project_declaration | project_extension + simple_project_declaration ::= + @i{project} @i{}name @i{is} + @{declarative_item@} + @i{end} simple_name; + @end smallexample + + @c --------------------------------------------- + @node Qualified Projects + @subsection Qualified Projects + @c --------------------------------------------- + + @noindent + Before the reserved @code{project}, there may be one or two @b{qualifiers}, that + is identifiers or reserved words, to qualify the project. + The current list of qualifiers is: + + @table @asis + @item @b{abstract}: qualifies a project with no sources. Such a + project must either have no declaration of attributes @code{Source_Dirs}, + @code{Source_Files}, @code{Languages} or @code{Source_List_File}, or one of + @code{Source_Dirs}, @code{Source_Files}, or @code{Languages} must be declared + as empty. If it extends another project, the project it extends must also be a + qualified abstract project. + @item @b{standard}: a standard project is a non library project with sources. + This is the default (implicit) qualifier. + @item @b{aggregate}: for future extension + @item @b{aggregate library}: for future extension + @item @b{library}: a library project must declare both attributes + @code{Library_Name} and @code{Library_Dir}. + @item @b{configuration}: a configuration project cannot be in a project tree. + It describes compilers and other tools to @code{gprbuild}. + @end table + + + @c --------------------------------------------- + @node Declarations + @subsection Declarations + @c --------------------------------------------- + + @noindent + Declarations introduce new entities that denote types, variables, attributes, + and packages. Some declarations can only appear immediately within a project + declaration. Others can appear within a project or within a package. + + @smallexample + declarative_item ::= simple_declarative_item + | typed_string_declaration + | package_declaration + + simple_declarative_item ::= variable_declaration + | typed_variable_declaration + | attribute_declaration + | case_construction + | empty_declaration + + empty_declaration ::= @i{null} ; + @end smallexample + + @noindent + An empty declaration is allowed anywhere a declaration is allowed. It has + no effect. + + @c --------------------------------------------- + @node Packages + @subsection Packages + @c --------------------------------------------- + + @noindent + A project file may contain @b{packages}, that group attributes (typically + all the attributes that are used by one of the GNAT tools). + + A package with a given name may only appear once in a project file. + The following packages are currently supported in project files + (See @pxref{Attributes} for the list of attributes that each can contain). + + @table @code + @item Binder + This package specifies characteristics useful when invoking the binder either + directly via the @command{gnat} driver or when using a builder such as + @command{gnatmake} or @command{gprbuild}. @xref{Main Subprograms}. + @item Builder + This package specifies the compilation options used when building an + executable or a library for a project. Most of the options should be + set in one of @code{Compiler}, @code{Binder} or @code{Linker} packages, + but there are some general options that should be defined in this + package. @xref{Main Subprograms}, and @pxref{Executable File Names} in + particular. + @item Check + This package specifies the options used when calling the checking tool + @command{gnatcheck} via the @command{gnat} driver. Its attribute + @b{Default_Switches} has the same semantics as for the package + @code{Builder}. The first string should always be @code{-rules} to specify + that all the other options belong to the @code{-rules} section of the + parameters to @command{gnatcheck}. + @item Compiler + This package specifies the compilation options used by the compiler for + each languages. @xref{Tools Options in Project Files}. + @item Cross_Reference + This package specifies the options used when calling the library tool + @command{gnatxref} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item Eliminate + This package specifies the options used when calling the tool + @command{gnatelim} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item Finder + This package specifies the options used when calling the search tool + @command{gnatfind} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item Gnatls + This package the options to use when invoking @command{gnatls} via the + @command{gnat} driver. + @item Gnatstub + This package specifies the options used when calling the tool + @command{gnatstub} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item IDE + This package specifies the options used when starting an integrated + development environment, for instance @command{GPS} or @command{Gnatbench}. + @xref{The Development Environments}. + @item Linker + This package specifies the options used by the linker. + @xref{Main Subprograms}. + @item Metrics + This package specifies the options used when calling the tool + @command{gnatmetric} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item Naming + This package specifies the naming conventions that apply + to the source files in a project. In particular, these conventions are + used to automatically find all source files in the source directories, + or given a file name to find out its language for proper processing. + @xref{Naming Schemes}. + @item Pretty_Printer + This package specifies the options used when calling the formatting tool + @command{gnatpp} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item Stack + This package specifies the options used when calling the tool + @command{gnatstack} via the @command{gnat} driver. Its attributes + @b{Default_Switches} and @b{Switches} have the same semantics as for the + package @code{Builder}. + @item Synchronize + This package specifies the options used when calling the tool + @command{gnatsync} via the @command{gnat} driver. + + @end table + + In its simplest form, a package may be empty: + + @smallexample @c projectfile + @group + project Simple is + package Builder is + end Builder; + end Simple; + @end group + @end smallexample + + @noindent + A package may contain @b{attribute declarations}, + @b{variable declarations} and @b{case constructions}, as will be + described below. + + When there is ambiguity between a project name and a package name, + the name always designates the project. To avoid possible confusion, it is + always a good idea to avoid naming a project with one of the + names allowed for packages or any name that starts with @code{gnat}. + + A package can also be defined by a @b{renaming declaration}. The new package + renames a package declared in a different project file, and has the same + attributes as the package it renames. The name of the renamed package + must be the same as the name of the renaming package. The project must + contain a package declaration with this name, and the project + must appear in the context clause of the current project, or be its parent + project. It is not possible to add or override attributes to the renaming + project. If you need to do so, you should use an @b{extending declaration} + (see below). + + Packages that are renamed in other project files often come from project files + that have no sources: they are just used as templates. Any modification in the + template will be reflected automatically in all the project files that rename + a package from the template. This is a very common way to share settings + between projects. + + Finally, a package can also be defined by an @b{extending declaration}. This is + similar to a @b{renaming declaration}, except that it is possible to add or + override attributes. + + @smallexample + package_declaration ::= package_spec | package_renaming | package_extension + package_spec ::= + @i{package} @i{}simple_name @i{is} + @{simple_declarative_item@} + @i{end} package_identifier ; + package_renaming ::== + @i{package} @i{}simple_name @i{renames} @i{}simple_name.package_identifier ; + package_extension ::== + @i{package} @i{}simple_name @i{extends} @i{}simple_name.package_identifier @i{is} + @{simple_declarative_item@} + @i{end} package_identifier ; + @end smallexample + + @c --------------------------------------------- + @node Expressions + @subsection Expressions + @c --------------------------------------------- + + @noindent + An expression is any value that can be assigned to an attribute or a + variable. It is either a literal value, or a construct requiring runtime + computation by the project manager. In a project file, the computed value of + an expression is either a string or a list of strings. + + A string value is one of: + @itemize @bullet + @item A literal string, for instance @code{"comm/my_proj.gpr"} + @item The name of a variable that evaluates to a string (@pxref{Variables}) + @item The name of an attribute that evaluates to a string (@pxref{Attributes}) + @item An external reference (@pxref{External Values}) + @item A concatenation of the above, as in @code{"prefix_" & Var}. + + @end itemize + + @noindent + A list of strings is one of the following: + + @itemize @bullet + @item A parenthesized comma-separated list of zero or more string expressions, for + instance @code{(File_Name, "gnat.adc", File_Name & ".orig")} or @code{()}. + @item The name of a variable that evaluates to a list of strings + @item The name of an attribute that evaluates to a list of strings + @item A concatenation of a list of strings and a string (as defined above), for + instance @code{("A", "B") & "C"} + @item A concatenation of two lists of strings + + @end itemize + + @noindent + The following is the grammar for expressions + + @smallexample + string_literal ::= "@{string_element@}" -- Same as Ada + string_expression ::= string_literal + | @i{variable_}name + | external_value + | attribute_reference + | ( string_expression @{ & string_expression @} ) + string_list ::= ( string_expression @{ , string_expression @} ) + | @i{string_variable}_name + | @i{string_}attribute_reference + term ::= string_expression | string_list + expression ::= term @{ & term @} -- Concatenation + @end smallexample + + @noindent + Concatenation involves strings and list of strings. As soon as a list of + strings is involved, the result of the concatenation is a list of strings. The + following Ada declarations show the existing operators: + + @smallexample @c ada + function "&" (X : String; Y : String) return String; + function "&" (X : String_List; Y : String) return String_List; + function "&" (X : String_List; Y : String_List) return String_List; + @end smallexample + + @noindent + Here are some specific examples: + + @smallexample @c projectfile + @group + List := () & File_Name; -- One string in this list + List2 := List & (File_Name & ".orig"); -- Two strings + Big_List := List & Lists2; -- Three strings + Illegal := "gnat.adc" & List2; -- Illegal, must start with list + @end group + @end smallexample + + @c --------------------------------------------- + @node External Values + @subsection External Values + @c --------------------------------------------- + + @noindent + An external value is an expression whose value is obtained from the command + that invoked the processing of the current project file (typically a + gnatmake or gprbuild command). + + There are two kinds of external values, one that returns a single string, and + one that returns a string list. + + The syntax of a single string external value is: + + @smallexample + external_value ::= @i{external} ( string_literal [, string_literal] ) + @end smallexample + + @noindent + The first string_literal is the string to be used on the command line or + in the environment to specify the external value. The second string_literal, + if present, is the default to use if there is no specification for this + external value either on the command line or in the environment. + + Typically, the external value will either exist in the + ^environment variables^logical name^ + or be specified on the command line through the + @option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch. If both + are specified, then the command line value is used, so that a user can more + easily override the value. + + The function @code{external} always returns a string. It is an error if the + value was not found in the environment and no default was specified in the + call to @code{external}. + + An external reference may be part of a string expression or of a string + list expression, and can therefore appear in a variable declaration or + an attribute declaration. + + Most of the time, this construct is used to initialize typed variables, which + are then used in @b{case} statements to control the value assigned to + attributes in various scenarios. Thus such variables are often called + @b{scenario variables}. + + The syntax for a string list external value is: + + @smallexample + external_value ::= @i{external_as_list} ( string_literal , string_literal ) + @end smallexample + + @noindent + The first string_literal is the string to be used on the command line or + in the environment to specify the external value. The second string_literal is + the separator between each component of the string list. + + If the external value does not exist in the environment or on the command line, + the result is an empty list. This is also the case, if the separator is an + empty string or if the external value is only one separator. + + Any separator at the beginning or at the end of the external value is + discarded. Then, if there is no separator in the external value, the result is + a string list with only one string. Otherwise, any string between the beginning + and the first separator, between two consecutive separators and between the + last separator and the end are components of the string list. + + @smallexample + @i{external_as_list} ("SWITCHES", ",") + @end smallexample + + @noindent + If the external value is "-O2,-g", the result is ("-O2", "-g"). + + If the external value is ",-O2,-g,", the result is also ("-O2", "-g"). + + if the external value is "-gnav", the result is ("-gnatv"). + + If the external value is ",,", the result is (""). + + If the external value is ",", the result is (), the empty string list. + + @c --------------------------------------------- + @node Typed String Declaration + @subsection Typed String Declaration + @c --------------------------------------------- + + @noindent + A @b{type declaration} introduces a discrete set of string literals. + If a string variable is declared to have this type, its value + is restricted to the given set of literals. These are the only named + types in project files. A string type may only be declared at the project + level, not inside a package. + + @smallexample + typed_string_declaration ::= + @i{type} @i{}_simple_name @i{is} ( string_literal @{, string_literal@} ); + @end smallexample + + @noindent + The string literals in the list are case sensitive and must all be different. + They may include any graphic characters allowed in Ada, including spaces. + Here is an example of a string type declaration: + + @smallexample @c projectfile + type OS is ("NT", "nt", "Unix", "GNU/Linux", "other OS"); + @end smallexample + + @noindent + Variables of a string type are called @b{typed variables}; all other + variables are called @b{untyped variables}. Typed variables are + particularly useful in @code{case} constructions, to support conditional + attribute declarations. (@pxref{Case Statements}). + + A string type may be referenced by its name if it has been declared in the same + project file, or by an expanded name whose prefix is the name of the project + in which it is declared. + + @c --------------------------------------------- + @node Variables + @subsection Variables + @c --------------------------------------------- + + @noindent + @b{Variables} store values (strings or list of strings) and can appear + as part of an expression. The declaration of a variable creates the + variable and assigns the value of the expression to it. The name of the + variable is available immediately after the assignment symbol, if you + need to reuse its old value to compute the new value. Before the completion + of its first declaration, the value of a variable defaults to the empty + string (""). + + A @b{typed} variable can be used as part of a @b{case} expression to + compute the value, but it can only be declared once in the project file, + so that all case statements see the same value for the variable. This + provides more consistency and makes the project easier to understand. + The syntax for its declaration is identical to the Ada syntax for an + object declaration. In effect, a typed variable acts as a constant. + + An @b{untyped} variable can be declared and overridden multiple times + within the same project. It is declared implicitly through an Ada + assignment. The first declaration establishes the kind of the variable + (string or list of strings) and successive declarations must respect + the initial kind. Assignments are executed in the order in which they + appear, so the new value replaces the old one and any subsequent reference + to the variable uses the new value. + + A variable may be declared at the project file level, or within a package. + + @smallexample + typed_variable_declaration ::= + @i{}simple_name : @i{}name := string_expression; + variable_declaration ::= @i{}simple_name := expression; + @end smallexample + + @noindent + Here are some examples of variable declarations: + + @smallexample @c projectfile + @group + This_OS : OS := external ("OS"); -- a typed variable declaration + That_OS := "GNU/Linux"; -- an untyped variable declaration + + Name := "readme.txt"; + Save_Name := Name & ".saved"; + + Empty_List := (); + List_With_One_Element := ("-gnaty"); + List_With_Two_Elements := List_With_One_Element & "-gnatg"; + Long_List := ("main.ada", "pack1_.ada", "pack1.ada", "pack2_.ada"); + @end group + @end smallexample + + @noindent + A @b{variable reference} may take several forms: + + @itemize @bullet + @item The simple variable name, for a variable in the current package (if any) + or in the current project + @item An expanded name, whose prefix is a context name. + + @end itemize + + @noindent + A @b{context} may be one of the following: + + @itemize @bullet + @item The name of an existing package in the current project + @item The name of an imported project of the current project + @item The name of an ancestor project (i.e., a project extended by the current + project, either directly or indirectly) + @item An expanded name whose prefix is an imported/parent project name, and + whose selector is a package name in that project. + @end itemize + + + @c --------------------------------------------- + @node Attributes + @subsection Attributes + @c --------------------------------------------- + + @noindent + A project (and its packages) may have @b{attributes} that define + the project's properties. Some attributes have values that are strings; + others have values that are string lists. + + @smallexample + attribute_declaration ::= + simple_attribute_declaration | indexed_attribute_declaration + simple_attribute_declaration ::= @i{for} attribute_designator @i{use} expression ; + indexed_attribute_declaration ::= + @i{for} @i{}simple_name ( string_literal) @i{use} expression ; + attribute_designator ::= + @i{}simple_name + | @i{}simple_name ( string_literal ) + @end smallexample + + @noindent + There are two categories of attributes: @b{simple attributes} + and @b{indexed attributes}. + Each simple attribute has a default value: the empty string (for string + attributes) and the empty list (for string list attributes). + An attribute declaration defines a new value for an attribute, and overrides + the previous value. The syntax of a simple attribute declaration is similar to + that of an attribute definition clause in Ada. + + Some attributes are indexed. These attributes are mappings whose + domain is a set of strings. They are declared one association + at a time, by specifying a point in the domain and the corresponding image + of the attribute. + Like untyped variables and simple attributes, indexed attributes + may be declared several times. Each declaration supplies a new value for the + attribute, and replaces the previous setting. + + Here are some examples of attribute declarations: + + @smallexample @c projectfile + -- simple attributes + for Object_Dir use "objects"; + for Source_Dirs use ("units", "test/drivers"); + + -- indexed attributes + for Body ("main") use "Main.ada"; + for Switches ("main.ada") use ("-v", "-gnatv"); + for Switches ("main.ada") use Builder'Switches ("main.ada") & "-g"; + + -- indexed attributes copy (from package Builder in project Default) + -- The package name must always be specified, even if it is the current + -- package. + for Default_Switches use Default.Builder'Default_Switches; + @end smallexample + + @noindent + Attributes references may be appear anywhere in expressions, and are used + to retrieve the value previously assigned to the attribute. If an attribute + has not been set in a given package or project, its value defaults to the + empty string or the empty list. + + @smallexample + attribute_reference ::= attribute_prefix ' @i{_}simple_name [ (string_literal) ] + attribute_prefix ::= @i{project} + | @i{}simple_name + | package_identifier + | @i{}simple_name . package_identifier + @end smallexample + + @noindent + Examples are: + + @smallexample @c projectfile + project'Object_Dir + Naming'Dot_Replacement + Imported_Project'Source_Dirs + Imported_Project.Naming'Casing + Builder'Default_Switches ("Ada") + @end smallexample + + @noindent + The prefix of an attribute may be: + + @itemize @bullet + @item @code{project} for an attribute of the current project + @item The name of an existing package of the current project + @item The name of an imported project + @item The name of a parent project that is extended by the current project + @item An expanded name whose prefix is imported/parent project name, + and whose selector is a package name + + @end itemize + + @noindent + Legal attribute names are listed below, including the package in + which they must be declared. These names are case-insensitive. The + semantics for the attributes is explained in great details in other sections. + + The column @emph{index} indicates whether the attribute is an indexed attribute, + and when it is whether its index is case sensitive (sensitive) or not (insensitive), or if case sensitivity depends is the same as file names sensitivity on the + system (file). The text is between brackets ([]) if the index is optional. + + @multitable @columnfractions .3 .1 .2 .4 + @headitem Attribute Name @tab Value @tab Package @tab Index + @headitem General attributes @tab @tab @tab @pxref{Building With Projects} + @item Name @tab string @tab - @tab (Read-only, name of project) + @item Project_Dir @tab string @tab - @tab (Read-only, directory of project) + @item Source_Files @tab list @tab - @tab - + @item Source_Dirs @tab list @tab - @tab - + @item Source_List_File @tab string @tab - @tab - + @item Locally_Removed_Files @tab list @tab - @tab - + @item Excluded_Source_Files @tab list @tab - @tab - + @item Object_Dir @tab string @tab - @tab - + @item Exec_Dir @tab string @tab - @tab - + @item Excluded_Source_Dirs @tab list @tab - @tab - + @item Excluded_Source_Files @tab list @tab - @tab - + @item Excluded_Source_List_File @tab list @tab - @tab - + @item Inherit_Source_Path @tab list @tab - @tab insensitive + @item Languages @tab list @tab - @tab - + @item Main @tab list @tab - @tab - + @item Main_Language @tab string @tab - @tab - + @item Externally_Built @tab string @tab - @tab - + @item Roots @tab list @tab - @tab file + @headitem + Library-related attributes @tab @tab @tab @pxref{Library Projects} + @item Library_Dir @tab string @tab - @tab - + @item Library_Name @tab string @tab - @tab - + @item Library_Kind @tab string @tab - @tab - + @item Library_Version @tab string @tab - @tab - + @item Library_Interface @tab string @tab - @tab - + @item Library_Auto_Init @tab string @tab - @tab - + @item Library_Options @tab list @tab - @tab - + @item Leading_Library_Options @tab list @tab - @tab - + @item Library_Src_Dir @tab string @tab - @tab - + @item Library_ALI_Dir @tab string @tab - @tab - + @item Library_GCC @tab string @tab - @tab - + @item Library_Symbol_File @tab string @tab - @tab - + @item Library_Symbol_Policy @tab string @tab - @tab - + @item Library_Reference_Symbol_File @tab string @tab - @tab - + @item Interfaces @tab list @tab - @tab - + @headitem + Naming @tab @tab @tab @pxref{Naming Schemes} + @item Spec_Suffix @tab string @tab Naming @tab insensitive (language) + @item Body_Suffix @tab string @tab Naming @tab insensitive (language) + @item Separate_Suffix @tab string @tab Naming @tab - + @item Casing @tab string @tab Naming @tab - + @item Dot_Replacement @tab string @tab Naming @tab - + @item Spec @tab string @tab Naming @tab insensitive (Ada unit) + @item Body @tab string @tab Naming @tab insensitive (Ada unit) + @item Specification_Exceptions @tab list @tab Naming @tab insensitive (language) + @item Implementation_Exceptions @tab list @tab Naming @tab insensitive (language) + @headitem + Building @tab @tab @tab @pxref{Switches and Project Files} + @item Default_Switches @tab list @tab Builder, Compiler, Binder, Linker, Cross_Reference, Finder, Pretty_Printer, gnatstub, Check, Synchronize, Eliminate, Metrics, IDE @tab insensitive (language name) + @item Switches @tab list @tab Builder, Compiler, Binder, Linker, Cross_Reference, Finder, gnatls, Pretty_Printer, gnatstub, Check, Synchronize, Eliminate, Metrics, Stack @tab [file] (file name) + @item Local_Configuration_Pragmas @tab string @tab Compiler @tab - + @item Local_Config_File @tab string @tab insensitive @tab - + @item Global_Configuration_Pragmas @tab list @tab Builder @tab - + @item Global_Compilation_Switches @tab list @tab Builder @tab language + @item Executable @tab string @tab Builder @tab [file] + @item Executable_Suffix @tab string @tab Builder @tab - + @item Global_Config_File @tab string @tab Builder @tab insensitive (language) + @headitem + IDE (used and created by GPS) @tab @tab @tab + @item Remote_Host @tab string @tab IDE @tab - + @item Program_Host @tab string @tab IDE @tab - + @item Communication_Protocol @tab string @tab IDE @tab - + @item Compiler_Command @tab string @tab IDE @tab insensitive (language) + @item Debugger_Command @tab string @tab IDE @tab - + @item Gnatlist @tab string @tab IDE @tab - + @item VCS_Kind @tab string @tab IDE @tab - + @item VCS_File_Check @tab string @tab IDE @tab - + @item VCS_Log_Check @tab string @tab IDE @tab - + @item Documentation_Dir @tab string @tab IDE @tab - + @headitem + Configuration files @tab @tab @tab See gprbuild manual + @item Default_Language @tab string @tab - @tab - + @item Run_Path_Option @tab list @tab - @tab - + @item Run_Path_Origin @tab string @tab - @tab - + @item Separate_Run_Path_Options @tab string @tab - @tab - + @item Toolchain_Version @tab string @tab - @tab insensitive + @item Toolchain_Description @tab string @tab - @tab insensitive + @item Object_Generated @tab string @tab - @tab insensitive + @item Objects_Linked @tab string @tab - @tab insensitive + @item Target @tab string @tab - @tab - + @item Library_Builder @tab string @tab - @tab - + @item Library_Support @tab string @tab - @tab - + @item Archive_Builder @tab list @tab - @tab - + @item Archive_Builder_Append_Option @tab list @tab - @tab - + @item Archive_Indexer @tab list @tab - @tab - + @item Archive_Suffix @tab string @tab - @tab - + @item Library_Partial_Linker @tab list @tab - @tab - + @item Shared_Library_Prefix @tab string @tab - @tab - + @item Shared_Library_Suffix @tab string @tab - @tab - + @item Symbolic_Link_Supported @tab string @tab - @tab - + @item Library_Major_Minor_Id_Supported @tab string @tab - @tab - + @item Library_Auto_Init_Supported @tab string @tab - @tab - + @item Shared_Library_Minimum_Switches @tab list @tab - @tab - + @item Library_Version_Switches @tab list @tab - @tab - + @item Library_Install_Name_Option @tab string @tab - @tab - + @item Runtime_Library_Dir @tab string @tab - @tab insensitive + @item Runtime_Source_Dir @tab string @tab - @tab insensitive + @item Driver @tab string @tab Compiler,Binder,Linker @tab insensitive (language) + @item Required_Switches @tab list @tab Compiler,Binder,Linker @tab insensitive (language) + @item Leading_Required_Switches @tab list @tab Compiler @tab insensitive (language) + @item Trailing_Required_Switches @tab list @tab Compiler @tab insensitive (language) + @item Pic_Options @tab list @tab Compiler @tab insensitive (language) + @item Path_Syntax @tab string @tab Compiler @tab insensitive (language) + @item Object_File_Suffix @tab string @tab Compiler @tab insensitive (language) + @item Object_File_Switches @tab list @tab Compiler @tab insensitive (language) + @item Multi_Unit_Switches @tab list @tab Compiler @tab insensitive (language) + @item Multi_Unit_Object_Separator @tab string @tab Compiler @tab insensitive (language) + @item Mapping_File_Switches @tab list @tab Compiler @tab insensitive (language) + @item Mapping_Spec_Suffix @tab string @tab Compiler @tab insensitive (language) + @item Mapping_body_Suffix @tab string @tab Compiler @tab insensitive (language) + @item Config_File_Switches @tab list @tab Compiler @tab insensitive (language) + @item Config_Body_File_Name @tab string @tab Compiler @tab insensitive (language) + @item Config_Body_File_Name_Index @tab string @tab Compiler @tab insensitive (language) + @item Config_Body_File_Name_Pattern @tab string @tab Compiler @tab insensitive (language) + @item Config_Spec_File_Name @tab string @tab Compiler @tab insensitive (language) + @item Config_Spec_File_Name_Index @tab string @tab Compiler @tab insensitive (language) + @item Config_Spec_File_Name_Pattern @tab string @tab Compiler @tab insensitive (language) + @item Config_File_Unique @tab string @tab Compiler @tab insensitive (language) + @item Dependency_Switches @tab list @tab Compiler @tab insensitive (language) + @item Dependency_Driver @tab list @tab Compiler @tab insensitive (language) + @item Include_Switches @tab list @tab Compiler @tab insensitive (language) + @item Include_Path @tab string @tab Compiler @tab insensitive (language) + @item Include_Path_File @tab string @tab Compiler @tab insensitive (language) + @item Prefix @tab string @tab Binder @tab insensitive (language) + @item Objects_Path @tab string @tab Binder @tab insensitive (language) + @item Objects_Path_File @tab string @tab Binder @tab insensitive (language) + @item Linker_Options @tab list @tab Linker @tab - + @item Leading_Switches @tab list @tab Linker @tab - + @item Map_File_Options @tab string @tab Linker @tab - + @item Executable_Switches @tab list @tab Linker @tab - + @item Lib_Dir_Switch @tab string @tab Linker @tab - + @item Lib_Name_Switch @tab string @tab Linker @tab - + @item Max_Command_Line_Length @tab string @tab Linker @tab - + @item Response_File_Format @tab string @tab Linker @tab - + @item Response_File_Switches @tab list @tab Linker @tab - + @end multitable + + @c --------------------------------------------- + @node Case Statements + @subsection Case Statements + @c --------------------------------------------- + + @noindent + A @b{case} statement is used in a project file to effect conditional + behavior. Through this statement, you can set the value of attributes + and variables depending on the value previously assigned to a typed + variable. + + All choices in a choice list must be distinct. Unlike Ada, the choice + lists of all alternatives do not need to include all values of the type. + An @code{others} choice must appear last in the list of alternatives. + + The syntax of a @code{case} construction is based on the Ada case statement + (although the @code{null} statement for empty alternatives is optional). + + The case expression must be a typed string variable, whose value is often + given by an external reference (@pxref{External Values}). + + Each alternative starts with the reserved word @code{when}, either a list of + literal strings separated by the @code{"|"} character or the reserved word + @code{others}, and the @code{"=>"} token. + Each literal string must belong to the string type that is the type of the + case variable. + After each @code{=>}, there are zero or more statements. The only + statements allowed in a case construction are other case statements, + attribute declarations and variable declarations. String type declarations and + package declarations are not allowed. Variable declarations are restricted to + variables that have already been declared before the case construction. + + @smallexample + case_statement ::= + @i{case} @i{}name @i{is} @{case_item@} @i{end case} ; + + case_item ::= + @i{when} discrete_choice_list => + @{case_statement + | attribute_declaration + | variable_declaration + | empty_declaration@} + + discrete_choice_list ::= string_literal @{| string_literal@} | @i{others} + @end smallexample + + @noindent + Here is a typical example: + + @smallexample @c projectfile + @group + project MyProj is + type OS_Type is ("GNU/Linux", "Unix", "NT", "VMS"); + OS : OS_Type := external ("OS", "GNU/Linux"); + + package Compiler is + case OS is + when "GNU/Linux" | "Unix" => + for Switches ("Ada") use ("-gnath"); + when "NT" => + for Switches ("Ada") use ("-gnatP"); + when others => + null; + end case; + end Compiler; + end MyProj; + @end group + @end smallexample + + @c --------------------------------------------- + @node Tools Supporting Project Files + @chapter Tools Supporting Project Files + @c --------------------------------------------- + + @noindent + + + @menu + * gnatmake and Project Files:: + * The GNAT Driver and Project Files:: + * The Development Environments:: + * Cleaning up with GPRclean:: + @end menu + + @c --------------------------------------------- + @node gnatmake and Project Files + @section gnatmake and Project Files + @c --------------------------------------------- + + @noindent + This section covers several topics related to @command{gnatmake} and + project files: defining ^switches^switches^ for @command{gnatmake} + and for the tools that it invokes; specifying configuration pragmas; + the use of the @code{Main} attribute; building and rebuilding library project + files. + + @menu + * Switches Related to Project Files:: + * Switches and Project Files:: + * Specifying Configuration Pragmas:: + * Project Files and Main Subprograms:: + * Library Project Files:: + @end menu + + @c --------------------------------------------- + @node Switches Related to Project Files + @subsection Switches Related to Project Files + @c --------------------------------------------- + + @noindent + 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 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 + by @option{^-X^/EXTERNAL_REFERENCE^} switches, if any. + @ifclear vms + There may zero, one or more spaces between @option{-P} and @var{project}. + @end ifclear + + There must be only one @option{^-P^/PROJECT_FILE^} switch on the command line. + + Since the Project Manager parses the project file only after all the switches + on the command line are checked, the order of the switches + @option{^-P^/PROJECT_FILE^}, + @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} + or @option{^-X^/EXTERNAL_REFERENCE^} is not significant. + + @item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} + @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. + + @ifclear vms + If @var{name} or @var{value} includes a space, then @var{name=value} should be + put between quotes. + @smallexample + -XOS=NT + -X"user=John Doe" + @end smallexample + @end ifclear + + Several @option{^-X^/EXTERNAL_REFERENCE^} switches can be used simultaneously. + If several @option{^-X^/EXTERNAL_REFERENCE^} switches specify the same + @var{name}, only the last one is used. + + 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 @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool) + Indicates the verbosity of the parsing of GNAT project files. + + @ifclear vms + @option{-vP0} means Default; + @option{-vP1} means Medium; + @option{-vP2} means High. + @end ifclear + + @ifset vms + There are three possible options for this qualifier: DEFAULT, MEDIUM and + HIGH. + @end ifset + + The default is ^Default^DEFAULT^: no output for syntactically correct + 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=^ + @cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool) + Add directory 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^= + @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 + 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 --------------------------------------------- + @node Switches and Project Files + @subsection Switches and Project Files + @c --------------------------------------------- + + @noindent + @ifset vms + It is not currently possible to specify VMS style qualifiers in the project + files; only Unix style ^switches^switches^ may be specified. + @end ifset + + For each of the packages @code{Builder}, @code{Compiler}, @code{Binder}, and + @code{Linker}, you can specify a @code{^Default_Switches^Default_Switches^} + attribute, a @code{Switches} attribute, or both; + as their names imply, these ^switch^switch^-related + attributes affect the ^switches^switches^ that are used for each of these GNAT + components when + @command{gnatmake} is invoked. As will be explained below, these + component-specific ^switches^switches^ precede + the ^switches^switches^ provided on the @command{gnatmake} command line. + + The @code{^Default_Switches^Default_Switches^} attribute is an attribute + indexed by language name (case insensitive) whose value is a string list. + For example: + + @smallexample @c projectfile + @group + package Compiler is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-gnaty^-gnaty^", + "^-v^-v^"); + end Compiler; + @end group + @end smallexample + + @noindent + The @code{Switches} attribute is indexed on a file name (which may or may + not be case sensitive, depending + on the operating system) whose value is a string list. For example: + + @smallexample @c projectfile + @group + package Builder is + for Switches ("main1.adb") + use ("^-O2^-O2^"); + for Switches ("main2.adb") + use ("^-g^-g^"); + end Builder; + @end group + @end smallexample + + @noindent + For the @code{Builder} package, the file names must designate source files + for main subprograms. For the @code{Binder} and @code{Linker} packages, the + file names must designate @file{ALI} or source files for main subprograms. + In each case just the file name without an explicit extension is acceptable. + + For each tool used in a program build (@command{gnatmake}, the compiler, the + binder, and the linker), the corresponding package @dfn{contributes} a set of + ^switches^switches^ for each file on which the tool is invoked, based on the + ^switch^switch^-related attributes defined in the package. + In particular, the ^switches^switches^ + that each of these packages contributes for a given file @var{f} comprise: + + @itemize @bullet + @item the value of attribute @code{Switches (@var{f})}, + if it is specified in the package for the given file, + @item otherwise, the value of @code{^Default_Switches^Default_Switches^ ("Ada")}, + if it is specified in the package. + + @end itemize + + @noindent + If neither of these attributes is defined in the package, then the package does + not contribute any ^switches^switches^ for the given file. + + When @command{gnatmake} is invoked on a file, the ^switches^switches^ comprise + two sets, in the following order: those contributed for the file + by the @code{Builder} package; + and the switches passed on the command line. + + When @command{gnatmake} invokes a tool (compiler, binder, linker) on a file, + the ^switches^switches^ passed to the tool comprise three sets, + in the following order: + + @enumerate + @item + the applicable ^switches^switches^ contributed for the file + by the @code{Builder} package in the project file supplied on the command line; + + @item + those contributed for the file by the package (in the relevant project file -- + see below) corresponding to the tool; and + + @item + the applicable switches passed on the command line. + @end enumerate + + The term @emph{applicable ^switches^switches^} reflects the fact that + @command{gnatmake} ^switches^switches^ may or may not be passed to individual + tools, depending on the individual ^switch^switch^. + + @command{gnatmake} may invoke the compiler on source files from different + projects. The Project Manager will use the appropriate project file to + determine the @code{Compiler} package for each source file being compiled. + Likewise for the @code{Binder} and @code{Linker} packages. + + As an example, consider the following package in a project file: + + @smallexample @c projectfile + @group + project Proj1 is + package Compiler is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-g^-g^"); + for Switches ("a.adb") + use ("^-O1^-O1^"); + for Switches ("b.adb") + use ("^-O2^-O2^", + "^-gnaty^-gnaty^"); + end Compiler; + end Proj1; + @end group + @end smallexample + + @noindent + If @command{gnatmake} is invoked with this project file, and it needs to + compile, say, the files @file{a.adb}, @file{b.adb}, and @file{c.adb}, then + @file{a.adb} will be compiled with the ^switch^switch^ + @option{^-O1^-O1^}, + @file{b.adb} with ^switches^switches^ + @option{^-O2^-O2^} + and @option{^-gnaty^-gnaty^}, + and @file{c.adb} with @option{^-g^-g^}. + + The following example illustrates the ordering of the ^switches^switches^ + contributed by different packages: + + @smallexample @c projectfile + @group + project Proj2 is + package Builder is + for Switches ("main.adb") + use ("^-g^-g^", + "^-O1^-)1^", + "^-f^-f^"); + end Builder; + @end group + + @group + package Compiler is + for Switches ("main.adb") + use ("^-O2^-O2^"); + end Compiler; + end Proj2; + @end group + @end smallexample + + @noindent + If you issue the command: + + @smallexample + gnatmake ^-Pproj2^/PROJECT_FILE=PROJ2^ -O0 main + @end smallexample + + @noindent + then the compiler will be invoked on @file{main.adb} with the following + sequence of ^switches^switches^ + + @smallexample + ^-g -O1 -O2 -O0^-g -O1 -O2 -O0^ + @end smallexample + + @noindent + with the last @option{^-O^-O^} + ^switch^switch^ having precedence over the earlier ones; + several other ^switches^switches^ + (such as @option{^-c^-c^}) are added implicitly. + + The ^switches^switches^ + @option{^-g^-g^} + and @option{^-O1^-O1^} are contributed by package + @code{Builder}, @option{^-O2^-O2^} is contributed + by the package @code{Compiler} + and @option{^-O0^-O0^} comes from the command line. + + The @option{^-g^-g^} + ^switch^switch^ will also be passed in the invocation of + @command{Gnatlink.} + + A final example illustrates switch contributions from packages in different + project files: + + @smallexample @c projectfile + @group + project Proj3 is + for Source_Files use ("pack.ads", "pack.adb"); + package Compiler is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-gnata^-gnata^"); + end Compiler; + end Proj3; + @end group + + @group + with "Proj3"; + project Proj4 is + for Source_Files use ("foo_main.adb", "bar_main.adb"); + package Builder is + for Switches ("foo_main.adb") + use ("^-s^-s^", + "^-g^-g^"); + end Builder; + end Proj4; + @end group + + @group + -- Ada source file: + with Pack; + procedure Foo_Main is + @dots{} + end Foo_Main; + @end group + @end smallexample + + @noindent + If the command is + @smallexample + gnatmake ^-PProj4^/PROJECT_FILE=PROJ4^ foo_main.adb -cargs -gnato + @end smallexample + + @noindent + then the ^switches^switches^ passed to the compiler for @file{foo_main.adb} are + @option{^-g^-g^} (contributed by the package @code{Proj4.Builder}) and + @option{^-gnato^-gnato^} (passed on the command line). + When the imported package @code{Pack} is compiled, the ^switches^switches^ used + are @option{^-g^-g^} from @code{Proj4.Builder}, + @option{^-gnata^-gnata^} (contributed from package @code{Proj3.Compiler}, + and @option{^-gnato^-gnato^} from the command line. + + When using @command{gnatmake} with project files, some ^switches^switches^ or + arguments may be expressed as relative paths. As the working directory where + compilation occurs may change, these relative paths are converted to absolute + paths. For the ^switches^switches^ found in a project file, the relative paths + are relative to the project file directory, for the switches on the command + line, they are relative to the directory where @command{gnatmake} is invoked. + The ^switches^switches^ for which this occurs are: + ^-I^-I^, + ^-A^-A^, + ^-L^-L^, + ^-aO^-aO^, + ^-aL^-aL^, + ^-aI^-aI^, as well as all arguments that are not switches (arguments to + ^switch^switch^ + ^-o^-o^, object files specified in package @code{Linker} or after + -largs on the command line). The exception to this rule is the ^switch^switch^ + ^--RTS=^--RTS=^ for which a relative path argument is never converted. + + @c --------------------------------------------- + @node Specifying Configuration Pragmas + @subsection Specifying Configuration Pragmas + @c --------------------------------------------- + + @noindent + When using @command{gnatmake} with project files, if there exists a file + @file{gnat.adc} that contains configuration pragmas, this file will be + ignored. + + Configuration pragmas can be defined by means of the following attributes in + project files: @code{Global_Configuration_Pragmas} in package @code{Builder} + and @code{Local_Configuration_Pragmas} in package @code{Compiler}. + + Both these attributes are single string attributes. Their values is the path + name of a file containing configuration pragmas. If a path name is relative, + then it is relative to the project directory of the project file where the + attribute is defined. + + When compiling a source, the configuration pragmas used are, in order, + those listed in the file designated by attribute + @code{Global_Configuration_Pragmas} in package @code{Builder} of the main + project file, if it is specified, and those listed in the file designated by + attribute @code{Local_Configuration_Pragmas} in package @code{Compiler} of + the project file of the source, if it exists. + + @c --------------------------------------------- + @node Project Files and Main Subprograms + @subsection Project Files and Main Subprograms + @c --------------------------------------------- + + @noindent + When using a project file, you can invoke @command{gnatmake} + with one or several main subprograms, by specifying their source files on the + command line. + + @smallexample + gnatmake ^-P^/PROJECT_FILE=^prj main1 main2 main3 + @end smallexample + + @noindent + Each of these needs to be a source file of the same project, except + when the switch ^-u^/UNIQUE^ is used. + + When ^-u^/UNIQUE^ is not used, all the mains need to be sources of the + same project, one of the project in the tree rooted at the project specified + on the command line. The package @code{Builder} of this common project, the + "main project" is the one that is considered by @command{gnatmake}. + + When ^-u^/UNIQUE^ is used, the specified source files may be in projects + imported directly or indirectly by the project specified on the command line. + Note that if such a source file is not part of the project specified on the + command line, the ^switches^switches^ found in package @code{Builder} of the + project specified on the command line, if any, that are transmitted + to the compiler will still be used, not those found in the project file of + the source file. + + When using a project file, you can also invoke @command{gnatmake} without + explicitly specifying any main, and the effect depends on whether you have + defined the @code{Main} attribute. This attribute has a string list value, + where each element in the list is the name of a source file (the file + extension is optional) that contains a unit that can be a main subprogram. + + If the @code{Main} attribute is defined in a project file as a non-empty + string list and the switch @option{^-u^/UNIQUE^} is not used on the command + line, then invoking @command{gnatmake} with this project file but without any + main on the command line is equivalent to invoking @command{gnatmake} with all + the file names in the @code{Main} attribute on the command line. + + Example: + @smallexample @c projectfile + @group + project Prj is + for Main use ("main1", "main2", "main3"); + end Prj; + @end group + @end smallexample + + @noindent + With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"} + is equivalent to + @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1 main2 main3"}. + + When the project attribute @code{Main} is not specified, or is specified + as an empty string list, or when the switch @option{-u} is used on the command + line, then invoking @command{gnatmake} with no main on the command line will + result in all immediate sources of the project file being checked, and + potentially recompiled. Depending on the presence of the switch @option{-u}, + sources from other project files on which the immediate sources of the main + project file depend are also checked and potentially recompiled. In other + words, the @option{-u} switch is applied to all of the immediate sources of the + main project file. + + When no main is specified on the command line and attribute @code{Main} exists + and includes several mains, or when several mains are specified on the + command line, the default ^switches^switches^ in package @code{Builder} will + be used for all mains, even if there are specific ^switches^switches^ + specified for one or several mains. + + But the ^switches^switches^ from package @code{Binder} or @code{Linker} will be + the specific ^switches^switches^ for each main, if they are specified. + + @c --------------------------------------------- + @node Library Project Files + @subsection Library Project Files + @c --------------------------------------------- + + @noindent + When @command{gnatmake} is invoked with a main project file that is a library + project file, it is not allowed to specify one or more mains on the command + line. + + When a library project file is specified, switches ^-b^/ACTION=BIND^ and + ^-l^/ACTION=LINK^ have special meanings. + + @itemize @bullet + @item ^-b^/ACTION=BIND^ is only allowed for stand-alone libraries. It indicates + to @command{gnatmake} that @command{gnatbind} should be invoked for the + library. + + @item ^-l^/ACTION=LINK^ may be used for all library projects. It indicates + to @command{gnatmake} that the binder generated file should be compiled + (in the case of a stand-alone library) and that the library should be built. + @end itemize + + + @c --------------------------------------------- + @node The GNAT Driver and Project Files + @section The GNAT Driver and Project Files + @c --------------------------------------------- + + @noindent + A number of GNAT tools, other than @command{^gnatmake^gnatmake^} + can benefit from project files: + (@command{^gnatbind^gnatbind^}, + @command{^gnatcheck^gnatcheck^}, + @command{^gnatclean^gnatclean^}, + @command{^gnatelim^gnatelim^}, + @command{^gnatfind^gnatfind^}, + @command{^gnatlink^gnatlink^}, + @command{^gnatls^gnatls^}, + @command{^gnatmetric^gnatmetric^}, + @command{^gnatpp^gnatpp^}, + @command{^gnatstub^gnatstub^}, + and @command{^gnatxref^gnatxref^}). However, none of these tools can be invoked + directly with a project file switch (@option{^-P^/PROJECT_FILE=^}). + They must be invoked through the @command{gnat} driver. + + The @command{gnat} driver is a wrapper that accepts a number of commands and + calls the corresponding tool. It was designed initially for VMS platforms (to + convert VMS qualifiers to Unix-style switches), but it is now available on all + GNAT platforms. + + On non-VMS platforms, the @command{gnat} driver accepts the following commands + (case insensitive): + + @itemize @bullet + @item BIND to invoke @command{^gnatbind^gnatbind^} + @item CHOP to invoke @command{^gnatchop^gnatchop^} + @item CLEAN to invoke @command{^gnatclean^gnatclean^} + @item COMP or COMPILE to invoke the compiler + @item ELIM to invoke @command{^gnatelim^gnatelim^} + @item FIND to invoke @command{^gnatfind^gnatfind^} + @item KR or KRUNCH to invoke @command{^gnatkr^gnatkr^} + @item LINK to invoke @command{^gnatlink^gnatlink^} + @item LS or LIST to invoke @command{^gnatls^gnatls^} + @item MAKE to invoke @command{^gnatmake^gnatmake^} + @item NAME to invoke @command{^gnatname^gnatname^} + @item PREP or PREPROCESS to invoke @command{^gnatprep^gnatprep^} + @item PP or PRETTY to invoke @command{^gnatpp^gnatpp^} + @item METRIC to invoke @command{^gnatmetric^gnatmetric^} + @item STUB to invoke @command{^gnatstub^gnatstub^} + @item XREF to invoke @command{^gnatxref^gnatxref^} + + @end itemize + + @noindent + (note that the compiler is invoked using the command + @command{^gnatmake -f -u -c^gnatmake -f -u -c^}). + + On non-VMS platforms, between @command{gnat} and the command, two + special switches may be used: + + @itemize @bullet + @item @command{-v} to display the invocation of the tool. + @item @command{-dn} to prevent the @command{gnat} driver from removing + the temporary files it has created. These temporary files are + configuration files and temporary file list files. + + @end itemize + + @noindent + The command may be followed by switches and arguments for the invoked + tool. + + @smallexample + gnat bind -C main.ali + gnat ls -a main + gnat chop foo.txt + @end smallexample + + @noindent + Switches may also be put in text files, one switch per line, and the text + files may be specified with their path name preceded by '@@'. + + @smallexample + gnat bind @@args.txt main.ali + @end smallexample + + @noindent + In addition, for commands BIND, COMP or COMPILE, FIND, ELIM, LS or LIST, LINK, + METRIC, PP or PRETTY, STUB and XREF, the project file related switches + (@option{^-P^/PROJECT_FILE^}, + @option{^-X^/EXTERNAL_REFERENCE^} and + @option{^-vP^/MESSAGES_PROJECT_FILE=^x}) may be used in addition to + the switches of the invoking tool. + + When GNAT PP or GNAT PRETTY is used with a project file, but with no source + specified on the command line, it invokes @command{^gnatpp^gnatpp^} with all + the immediate sources of the specified project file. + + When GNAT METRIC is used with a project file, but with no source + specified on the command line, it invokes @command{^gnatmetric^gnatmetric^} + with all the immediate sources of the specified project file and with + @option{^-d^/DIRECTORY^} with the parameter pointing to the object directory + of the project. + + In addition, when GNAT PP, GNAT PRETTY or GNAT METRIC is used with + a project file, no source is specified on the command line and + switch ^-U^/ALL_PROJECTS^ is specified on the command line, then + the underlying tool (^gnatpp^gnatpp^ or + ^gnatmetric^gnatmetric^) is invoked for all sources of all projects, + not only for the immediate sources of the main project. + @ifclear vms + (-U stands for Universal or Union of the project files of the project tree) + @end ifclear + + For each of the following commands, there is optionally a corresponding + package in the main project. + + @itemize @bullet + @item package @code{Binder} for command BIND (invoking @code{^gnatbind^gnatbind^}) + + @item package @code{Check} for command CHECK (invoking + @code{^gnatcheck^gnatcheck^}) + + @item package @code{Compiler} for command COMP or COMPILE (invoking the compiler) + + @item package @code{Cross_Reference} for command XREF (invoking + @code{^gnatxref^gnatxref^}) + + @item package @code{Eliminate} for command ELIM (invoking + @code{^gnatelim^gnatelim^}) + + @item package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^}) + + @item package @code{Gnatls} for command LS or LIST (invoking @code{^gnatls^gnatls^}) + + @item package @code{Gnatstub} for command STUB + (invoking @code{^gnatstub^gnatstub^}) + + @item package @code{Linker} for command LINK (invoking @code{^gnatlink^gnatlink^}) + + @item package @code{Check} for command CHECK + (invoking @code{^gnatcheck^gnatcheck^}) + + @item package @code{Metrics} for command METRIC + (invoking @code{^gnatmetric^gnatmetric^}) + + @item package @code{Pretty_Printer} for command PP or PRETTY + (invoking @code{^gnatpp^gnatpp^}) + + @end itemize + + @noindent + Package @code{Gnatls} has a unique attribute @code{Switches}, + a simple variable with a string list value. It contains ^switches^switches^ + for the invocation of @code{^gnatls^gnatls^}. + + @smallexample @c projectfile + @group + project Proj1 is + package gnatls is + for Switches + use ("^-a^-a^", + "^-v^-v^"); + end gnatls; + end Proj1; + @end group + @end smallexample + + @noindent + All other packages have two attribute @code{Switches} and + @code{^Default_Switches^Default_Switches^}. + + @code{Switches} is an indexed attribute, indexed by the + source file name, that has a string list value: the ^switches^switches^ to be + used when the tool corresponding to the package is invoked for the specific + source file. + + @code{^Default_Switches^Default_Switches^} is an attribute, + indexed by the programming language that has a string list value. + @code{^Default_Switches^Default_Switches^ ("Ada")} contains the + ^switches^switches^ for the invocation of the tool corresponding + to the package, except if a specific @code{Switches} attribute + is specified for the source file. + + @smallexample @c projectfile + @group + project Proj is + + for Source_Dirs use ("./**"); + + package gnatls is + for Switches use + ("^-a^-a^", + "^-v^-v^"); + end gnatls; + @end group + @group + + package Compiler is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-gnatv^-gnatv^", + "^-gnatwa^-gnatwa^"); + end Binder; + @end group + @group + + package Binder is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-C^-C^", + "^-e^-e^"); + end Binder; + @end group + @group + + package Linker is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-C^-C^"); + for Switches ("main.adb") + use ("^-C^-C^", + "^-v^-v^", + "^-v^-v^"); + end Linker; + @end group + @group + + package Finder is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-a^-a^", + "^-f^-f^"); + end Finder; + @end group + @group + + package Cross_Reference is + for ^Default_Switches^Default_Switches^ ("Ada") + use ("^-a^-a^", + "^-f^-f^", + "^-d^-d^", + "^-u^-u^"); + end Cross_Reference; + end Proj; + @end group + @end smallexample + + @noindent + With the above project file, commands such as + + @smallexample + ^gnat comp -Pproj main^GNAT COMP /PROJECT_FILE=PROJ MAIN^ + ^gnat ls -Pproj main^GNAT LIST /PROJECT_FILE=PROJ MAIN^ + ^gnat xref -Pproj main^GNAT XREF /PROJECT_FILE=PROJ MAIN^ + ^gnat bind -Pproj main.ali^GNAT BIND /PROJECT_FILE=PROJ MAIN.ALI^ + ^gnat link -Pproj main.ali^GNAT LINK /PROJECT_FILE=PROJ MAIN.ALI^ + @end smallexample + + @noindent + will set up the environment properly and invoke the tool with the switches + found in the package corresponding to the tool: + @code{^Default_Switches^Default_Switches^ ("Ada")} for all tools, + except @code{Switches ("main.adb")} + for @code{^gnatlink^gnatlink^}. + It is also possible to invoke some of the tools, + (@code{^gnatcheck^gnatcheck^}, + @code{^gnatmetric^gnatmetric^}, + and @code{^gnatpp^gnatpp^}) + on a set of project units thanks to the combination of the switches + @option{-P}, @option{-U} and possibly the main unit when one is interested + in its closure. For instance, + @smallexample + gnat metric -Pproj + @end smallexample + + @noindent + will compute the metrics for all the immediate units of project + @code{proj}. + @smallexample + gnat metric -Pproj -U + @end smallexample + + @noindent + will compute the metrics for all the units of the closure of projects + rooted at @code{proj}. + @smallexample + gnat metric -Pproj -U main_unit + @end smallexample + + @noindent + will compute the metrics for the closure of units rooted at + @code{main_unit}. This last possibility relies implicitly + on @command{gnatbind}'s option @option{-R}. But if the argument files for the + tool invoked by the @command{gnat} driver are explicitly specified + either directly or through the tool @option{-files} option, then the tool + is called only for these explicitly specified files. + + @c --------------------------------------------- + @node The Development Environments + @section The Development Environments + @c --------------------------------------------- + + @noindent + See the appropriate manuals for more details. These environments will + store a number of settings in the project itself, when they are meant + to be shared by the whole team working on the project. Here are the + attributes defined in the package @b{IDE} in projects. + + @table @code + @item Remote_Host + This is a simple attribute. Its value is a string that designates the remote + host in a cross-compilation environment, to be used for remote compilation and + debugging. This field should not be specified when running on the local + machine. + + @item Program_Host + This is a simple attribute. Its value is a string that specifies the + name of IP address of the embedded target in a cross-compilation environment, + on which the program should execute. + + @item Communication_Protocol + This is a simple string attribute. Its value is the name of the protocol + to use to communicate with the target in a cross-compilation environment, + e.g.@: @code{"wtx"} or @code{"vxworks"}. + + @item Compiler_Command + This is an associative array attribute, whose domain is a language name. Its + value is string that denotes the command to be used to invoke the compiler. + The value of @code{Compiler_Command ("Ada")} is expected to be compatible with + gnatmake, in particular in the handling of switches. + + @item Debugger_Command + This is simple attribute, Its value is a string that specifies the name of + the debugger to be used, such as gdb, powerpc-wrs-vxworks-gdb or gdb-4. + + @item Default_Switches + This is an associative array attribute. Its indexes are the name of the + external tools that the GNAT Programming System (GPS) is supporting. Its + value is a list of switches to use when invoking that tool. + + @item Gnatlist + This is a simple attribute. Its value is a string that specifies the name + of the @command{gnatls} utility to be used to retrieve information about the + predefined path; e.g., @code{"gnatls"}, @code{"powerpc-wrs-vxworks-gnatls"}. + @item VCS_Kind + This is a simple attribute. Its value is a string used to specify the + Version Control System (VCS) to be used for this project, e.g.@: CVS, RCS + ClearCase or Perforce. + + @item VCS_File_Check + This is a simple attribute. Its value is a string that specifies the + command used by the VCS to check the validity of a file, either + when the user explicitly asks for a check, or as a sanity check before + doing the check-in. + + @item VCS_Log_Check + This is a simple attribute. Its value is a string that specifies + the command used by the VCS to check the validity of a log file. + + @item VCS_Repository_Root + The VCS repository root path. This is used to create tags or branches + of the repository. For subversion the value should be the @code{URL} + as specified to check-out the working copy of the repository. + + @item VCS_Patch_Root + The local root directory to use for building patch file. All patch chunks + will be relative to this path. The root project directory is used if + this value is not defined. + + @end table + + @c --------------------------------------------- + @node Cleaning up with GPRclean + @section Cleaning up with GPRclean + @c --------------------------------------------- + + @noindent + The GPRclean tool removes the files created by GPRbuild. + At a minimum, to invoke GPRclean you must specify a main project file + in a command such as @code{gprclean proj.gpr} or @code{gprclean -P proj.gpr}. + + Examples of invocation of GPRclean: + + @smallexample + gprclean -r prj1.gpr + gprclean -c -P prj2.gpr + @end smallexample + + @menu + * Switches for GPRclean:: + @end menu + + @c --------------------------------------------- + @node Switches for GPRclean + @subsection Switches for GPRclean + @c --------------------------------------------- + + @noindent + The switches for GPRclean are: + + @itemize @bullet + @item @option{--config=
} : Specify the + configuration project file name + + @item @option{--autoconf=} + + This specifies a configuration project file name that already exists or will + be created automatically. Option @option{--autoconf=} + cannot be specified more than once. If the configuration project file + specified with @option{--autoconf=} exists, then it is used. Otherwise, + @value{gprconfig} is invoked to create it automatically. + + @item @option{-c} : Only delete compiler-generated files. Do not delete + executables and libraries. + + @item @option{-f} : Force deletions of unwritable files + + @item @option{-F} : Display full project path name in brief error messages + + @item @option{-h} : Display this message + + @item @option{-n} : Do not delete files, only list files to delete + + @item @option{-P} : Use Project File @emph{}. + + @item @option{-q} : Be quiet/terse. There is no output, except to report + problems. + + @item @option{-r} : (recursive) Clean all projects referenced by the main + project directly or indirectly. Without this switch, GPRclean only + cleans the main project. + + @item @option{-v} : Verbose mode + + @item @option{-vPx} : Specify verbosity when parsing Project Files. + x = 0 (default), 1 or 2. + + @item @option{-Xnm=val} : Specify an external reference for Project Files. + + @end itemize + + + diff -Nrcpad gcc-4.5.2/gcc/ada/put_scos.adb gcc-4.6.0/gcc/ada/put_scos.adb *** gcc-4.5.2/gcc/ada/put_scos.adb Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/put_scos.adb Thu Jun 17 07:42:04 2010 *************** *** 26,31 **** --- 26,63 ---- with SCOs; use SCOs; procedure Put_SCOs is + Ctr : Nat; + + procedure Output_Range (T : SCO_Table_Entry); + -- Outputs T.From and T.To in line:col-line:col format + + procedure Output_Source_Location (Loc : Source_Location); + -- Output source location in line:col format + + ------------------ + -- Output_Range -- + ------------------ + + procedure Output_Range (T : SCO_Table_Entry) is + begin + Output_Source_Location (T.From); + Write_Info_Char ('-'); + Output_Source_Location (T.To); + end Output_Range; + + ---------------------------- + -- Output_Source_Location -- + ---------------------------- + + procedure Output_Source_Location (Loc : Source_Location) is + begin + Write_Info_Nat (Nat (Loc.Line)); + Write_Info_Char (':'); + Write_Info_Nat (Nat (Loc.Col)); + end Output_Source_Location; + + -- Start of processing for Put_SCOs + begin -- Loop through entries in SCO_Unit_Table *************** begin *** 64,98 **** Output_SCO_Line : declare T : SCO_Table_Entry renames SCO_Table.Table (Start); - procedure Output_Range (T : SCO_Table_Entry); - -- Outputs T.From and T.To in line:col-line:col format - - ------------------ - -- Output_Range -- - ------------------ - - procedure Output_Range (T : SCO_Table_Entry) is - begin - Write_Info_Nat (Nat (T.From.Line)); - Write_Info_Char (':'); - Write_Info_Nat (Nat (T.From.Col)); - Write_Info_Char ('-'); - Write_Info_Nat (Nat (T.To.Line)); - Write_Info_Char (':'); - Write_Info_Nat (Nat (T.To.Col)); - end Output_Range; - - -- Start of processing for Output_SCO_Line - begin - Write_Info_Initiate ('C'); - Write_Info_Char (T.C1); - case T.C1 is -- Statements when 'S' => loop Write_Info_Char (' '); --- 96,111 ---- Output_SCO_Line : declare T : SCO_Table_Entry renames SCO_Table.Table (Start); begin case T.C1 is -- Statements when 'S' => + Write_Info_Initiate ('C'); + Write_Info_Char ('S'); + + Ctr := 0; loop Write_Info_Char (' '); *************** begin *** 105,112 **** --- 118,139 ---- Start := Start + 1; pragma Assert (SCO_Table.Table (Start).C1 = 's'); + + Ctr := Ctr + 1; + + -- Up to 6 items on a line, if more than 6 items, + -- continuation lines are marked Cs. + + if Ctr = 6 then + Write_Info_Terminate; + Write_Info_Initiate ('C'); + Write_Info_Char ('s'); + Ctr := 0; + end if; end loop; + Write_Info_Terminate; + -- Statement continuations should not occur since they -- are supposed to have been handled in the loop above. *************** begin *** 116,156 **** -- Decision when 'I' | 'E' | 'P' | 'W' | 'X' => ! if T.C2 = ' ' then ! Start := Start + 1; ! end if; ! -- Loop through table entries for this decision ! loop ! declare ! T : SCO_Table_Entry renames SCO_Table.Table (Start); ! begin Write_Info_Char (' '); ! if T.C1 = '!' or else ! T.C1 = '^' or else ! T.C1 = '&' or else ! T.C1 = '|' ! then ! Write_Info_Char (T.C1); ! else ! Write_Info_Char (T.C2); ! Output_Range (T); ! end if; ! exit when T.Last; ! Start := Start + 1; ! end; ! end loop; when others => raise Program_Error; end case; - - Write_Info_Terminate; end Output_SCO_Line; Start := Start + 1; --- 143,201 ---- -- Decision when 'I' | 'E' | 'P' | 'W' | 'X' => ! Start := Start + 1; ! -- For disabled pragma, skip decision output ! if T.C1 = 'P' and then T.C2 = 'd' then ! while not SCO_Table.Table (Start).Last loop ! Start := Start + 1; ! end loop; ! -- For all other cases output decision line ! ! else ! Write_Info_Initiate ('C'); ! Write_Info_Char (T.C1); ! ! if T.C1 /= 'X' then Write_Info_Char (' '); + Output_Source_Location (T.From); + end if; ! -- Loop through table entries for this decision ! loop ! declare ! T : SCO_Table_Entry ! renames SCO_Table.Table (Start); ! begin ! Write_Info_Char (' '); ! ! if T.C1 = '!' or else ! T.C1 = '&' or else ! T.C1 = '|' ! then ! Write_Info_Char (T.C1); ! Output_Source_Location (T.From); ! ! else ! Write_Info_Char (T.C2); ! Output_Range (T); ! end if; ! ! exit when T.Last; ! Start := Start + 1; ! end; ! end loop; ! ! Write_Info_Terminate; ! end if; when others => raise Program_Error; end case; end Output_SCO_Line; Start := Start + 1; diff -Nrcpad gcc-4.5.2/gcc/ada/raise-gcc.c gcc-4.6.0/gcc/ada/raise-gcc.c *** gcc-4.5.2/gcc/ada/raise-gcc.c Tue Oct 27 19:41:13 2009 --- gcc-4.6.0/gcc/ada/raise-gcc.c Tue Oct 26 10:52:27 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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- * *************** db_phases (int phases) *** 407,413 **** =================================== The major point of this unit is to provide an exception propagation ! personality routine for Ada. This is __gnat_eh_personality. It is provided with a pointer to the propagated exception, an unwind context describing a location the propagation is going through, and a --- 407,413 ---- =================================== The major point of this unit is to provide an exception propagation ! personality routine for Ada. This is __gnat_personality_v0. It is provided with a pointer to the propagated exception, an unwind context describing a location the propagation is going through, and a *************** db_phases (int phases) *** 440,446 **** | | (Ada frame) | ! +--> __gnat_eh_personality (context, exception) | +--> get_region_descriptor_for (context) | --- 440,446 ---- | | (Ada frame) | ! +--> __gnat_personality_v0 (context, exception) | +--> get_region_descriptor_for (context) | *************** extern void __gnat_notify_unhandled_exce *** 1028,1036 **** GNU-Ada exceptions are met. */ #ifdef __USING_SJLJ_EXCEPTIONS__ ! #define PERSONALITY_FUNCTION __gnat_eh_personality_sj #else ! #define PERSONALITY_FUNCTION __gnat_eh_personality #endif /* Major tweak for ia64-vms : the CHF propagation phase calls this personality --- 1028,1036 ---- GNU-Ada exceptions are met. */ #ifdef __USING_SJLJ_EXCEPTIONS__ ! #define PERSONALITY_FUNCTION __gnat_personality_sj0 #else ! #define PERSONALITY_FUNCTION __gnat_personality_v0 #endif /* Major tweak for ia64-vms : the CHF propagation phase calls this personality diff -Nrcpad gcc-4.5.2/gcc/ada/raise.h gcc-4.6.0/gcc/ada/raise.h *** gcc-4.5.2/gcc/ada/raise.h Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/raise.h Mon Jun 14 13:32:14 2010 *************** *** 29,35 **** * * ****************************************************************************/ - /* C counterparts of what System.Standard_Library defines. */ typedef unsigned Exception_Code; --- 29,34 ---- *************** struct Exception_Data *** 46,61 **** typedef struct Exception_Data *Exception_Id; - struct Exception_Occurrence - { - int Max_Length; - Exception_Id Id; - int Msg_Length; - char Msg[0]; - }; - - typedef struct Exception_Occurrence *Exception_Occurrence_Access; - extern void _gnat_builtin_longjmp (void *, int); extern void __gnat_unhandled_terminate (void); extern void *__gnat_malloc (__SIZE_TYPE__); --- 45,50 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/repinfo.adb gcc-4.6.0/gcc/ada/repinfo.adb *** gcc-4.5.2/gcc/ada/repinfo.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/repinfo.adb Fri Sep 10 11:01:37 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2010, 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- -- *************** package body Repinfo is *** 403,409 **** if List_Representation_Info >= 2 then List_Object_Info (E); end if; - end if; -- Recurse into nested package, but not if they are package --- 403,408 ---- *************** package body Repinfo is *** 1055,1060 **** --- 1054,1092 ---- Write_Str ("'Alignment use "); Write_Val (Alignment (Ent)); Write_Line (";"); + + -- Special stuff for fixed-point + + if Is_Fixed_Point_Type (Ent) then + + -- Write small (always a static constant) + + Write_Str ("for "); + List_Name (Ent); + Write_Str ("'Small use "); + UR_Write (Small_Value (Ent)); + Write_Line (";"); + + -- Write range if static + + declare + R : constant Node_Id := Scalar_Range (Ent); + + begin + if Nkind (Low_Bound (R)) = N_Real_Literal + and then + Nkind (High_Bound (R)) = N_Real_Literal + then + Write_Str ("for "); + List_Name (Ent); + Write_Str ("'Range use "); + UR_Write (Realval (Low_Bound (R))); + Write_Str (" .. "); + UR_Write (Realval (High_Bound (R))); + Write_Line (";"); + end if; + end; + end if; end List_Type_Info; ---------------------- *************** package body Repinfo is *** 1088,1095 **** -- Internal recursive routine to evaluate tree function W (Val : Uint) return Word; ! -- Convert Val to Word, assuming Val is always in the Int range. This is ! -- a helper function for the evaluation of bitwise expressions like -- 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 --- 1120,1127 ---- -- Internal recursive routine to evaluate tree function W (Val : Uint) return Word; ! -- Convert Val to Word, assuming Val is always in the Int range. This ! -- is a helper function for the evaluation of bitwise expressions like -- 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 diff -Nrcpad gcc-4.5.2/gcc/ada/restrict.adb gcc-4.6.0/gcc/ada/restrict.adb *** gcc-4.5.2/gcc/ada/restrict.adb Fri Apr 17 09:57:27 2009 --- gcc-4.6.0/gcc/ada/restrict.adb Thu Oct 7 12:59:00 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,30 **** --- 25,31 ---- with Atree; use Atree; with Casing; use Casing; + with Einfo; use Einfo; with Errout; use Errout; with Debug; use Debug; with Fname; use Fname; *************** with Opt; use Opt; *** 34,39 **** --- 35,41 ---- with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; + with Stand; use Stand; with Uname; use Uname; package body Restrict is *************** package body Restrict is *** 121,126 **** --- 123,168 ---- Check_Restriction (No_Implicit_Heap_Allocations, N); end Check_No_Implicit_Heap_Alloc; + ----------------------------------- + -- Check_Obsolescent_2005_Entity -- + ----------------------------------- + + procedure Check_Obsolescent_2005_Entity (E : Entity_Id; N : Node_Id) is + function Chars_Is (E : Entity_Id; S : String) return Boolean; + -- Return True iff Chars (E) matches S (given in lower case) + + function Chars_Is (E : Entity_Id; S : String) return Boolean is + Nam : constant Name_Id := Chars (E); + begin + if Length_Of_Name (Nam) /= S'Length then + return False; + else + return Get_Name_String (Nam) = S; + end if; + end Chars_Is; + + -- Start of processing for Check_Obsolescent_2005_Entity + + begin + if Restriction_Check_Required (No_Obsolescent_Features) + and then Ada_Version >= Ada_2005 + and then Chars_Is (Scope (E), "handling") + and then Chars_Is (Scope (Scope (E)), "characters") + and then Chars_Is (Scope (Scope (Scope (E))), "ada") + and then Scope (Scope (Scope (Scope (E)))) = Standard_Standard + then + if Chars_Is (E, "is_character") or else + Chars_Is (E, "is_string") or else + Chars_Is (E, "to_character") or else + Chars_Is (E, "to_string") or else + Chars_Is (E, "to_wide_character") or else + Chars_Is (E, "to_wide_string") + then + Check_Restriction (No_Obsolescent_Features, N); + end if; + end if; + end Check_Obsolescent_2005_Entity; + --------------------------- -- Check_Restricted_Unit -- --------------------------- *************** package body Restrict is *** 256,261 **** --- 298,311 ---- -- Start of processing for Check_Restriction begin + -- In CodePeer mode, we do not want to check for any restriction, or set + -- additional restrictions other than those already set in gnat1drv.adb + -- so that we have consistency between each compilation. + + if CodePeer_Mode then + return; + end if; + if UI_Is_In_Int_Range (V) then VV := Integer (UI_To_Int (V)); else *************** package body Restrict is *** 347,352 **** --- 397,425 ---- end loop; end Check_Restriction_No_Dependence; + -------------------------------------- + -- Check_Wide_Character_Restriction -- + -------------------------------------- + + procedure Check_Wide_Character_Restriction (E : Entity_Id; N : Node_Id) is + begin + if Restriction_Check_Required (No_Wide_Characters) + and then Comes_From_Source (N) + then + declare + T : constant Entity_Id := Root_Type (E); + begin + if T = Standard_Wide_Character or else + T = Standard_Wide_String or else + T = Standard_Wide_Wide_Character or else + T = Standard_Wide_Wide_String + then + Check_Restriction (No_Wide_Characters, N); + end if; + end; + end if; + end Check_Wide_Character_Restriction; + ---------------------------------------- -- Cunit_Boolean_Restrictions_Restore -- ---------------------------------------- *************** package body Restrict is *** 513,518 **** --- 586,600 ---- return Restrictions.Set (R) and then not Restriction_Warnings (R); end Restriction_Active; + -------------------------------- + -- Restriction_Check_Required -- + -------------------------------- + + function Restriction_Check_Required (R : All_Restrictions) return Boolean is + begin + return Restrictions.Set (R); + end Restriction_Check_Required; + --------------------- -- Restriction_Msg -- --------------------- *************** package body Restrict is *** 603,609 **** Error_Msg_Sloc := No_Location; end if; ! -- Case of parametrized restriction if R in All_Parameter_Restrictions then Add_Char ('`'); --- 685,691 ---- Error_Msg_Sloc := No_Location; end if; ! -- Case of parameterized restriction if R in All_Parameter_Restrictions then Add_Char ('`'); diff -Nrcpad gcc-4.5.2/gcc/ada/restrict.ads gcc-4.6.0/gcc/ada/restrict.ads *** gcc-4.5.2/gcc/ada/restrict.ads Mon Aug 4 08:37:31 2008 --- gcc-4.6.0/gcc/ada/restrict.ads Thu Sep 9 09:57:00 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Restrict is *** 230,235 **** --- 230,250 ---- -- Equivalent to Check_Restriction (No_Implicit_Heap_Allocations, N). -- Provided for easy use by back end, which has to check this restriction. + procedure Check_Obsolescent_2005_Entity (E : Entity_Id; N : Node_Id); + -- This routine checks if the entity E is one of the obsolescent entries + -- in Ada.Characters.Handling in Ada 2005 and No_Obsolescent_Features + -- restriction is active. If so an appropriate message is given. N is + -- the node on which the message is to be placed. It's a bit kludgy to + -- have this highly specialized routine rather than some wonderful general + -- mechanism (e.g. a special pragma) to handle this case, but there are + -- only six cases, and it is not worth the effort to do something general. + + procedure Check_Wide_Character_Restriction (E : Entity_Id; N : Node_Id); + -- This procedure checks if the No_Wide_Character restriction is active, + -- and if so, if N Comes_From_Source, and the root type of E is one of + -- [Wide_]Wide_Character or [Wide_]Wide_String, then the restriction + -- violation is recorded, and an appropriate message given. + function Cunit_Boolean_Restrictions_Save return Save_Cunit_Boolean_Restrictions; -- This function saves the compilation unit restriction settings, and *************** package Restrict is *** 277,283 **** -- used where the compiled code depends on whether the restriction is -- active. Always use Check_Restriction to record a violation. Note that -- this returns False if we only have a Restriction_Warnings set, since ! -- restriction warnings should never affect generated code. function Restricted_Profile return Boolean; -- Tests if set of restrictions corresponding to Profile (Restricted) is --- 292,310 ---- -- used where the compiled code depends on whether the restriction is -- active. Always use Check_Restriction to record a violation. Note that -- this returns False if we only have a Restriction_Warnings set, since ! -- restriction warnings should never affect generated code. If you want ! -- to know if a call to Check_Restriction is needed then use the function ! -- Restriction_Check_Required instead. ! ! function Restriction_Check_Required (R : All_Restrictions) return Boolean; ! pragma Inline (Restriction_Check_Required); ! -- Determines if either a Restriction_Warnings or Restrictions pragma has ! -- been given for the specified restriction. If true, then a subsequent ! -- call to Check_Restriction is required if the restriction is violated. ! -- This must not be used to guard code generation that depends on whether ! -- a restriction is active (see Restriction_Active above). Typically it ! -- is used to avoid complex code to determine if a restriction is violated, ! -- executing this code only if needed. function Restricted_Profile return Boolean; -- Tests if set of restrictions corresponding to Profile (Restricted) is diff -Nrcpad gcc-4.5.2/gcc/ada/rtsfind.adb gcc-4.6.0/gcc/ada/rtsfind.adb *** gcc-4.5.2/gcc/ada/rtsfind.adb Mon Jul 13 12:45:02 2009 --- gcc-4.6.0/gcc/ada/rtsfind.adb Fri Jun 18 09:53:00 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Rtsfind is *** 1333,1340 **** -- The RT_Unit_Table entry that may need updating begin ! -- If entry is not set, set it now, and indicate that it ! -- was loaded through an explicit context clause.. if No (U.Entity) then U := (Entity => E, --- 1333,1340 ---- -- The RT_Unit_Table entry that may need updating begin ! -- If entry is not set, set it now, and indicate that it was ! -- loaded through an explicit context clause. if No (U.Entity) then U := (Entity => E, diff -Nrcpad gcc-4.5.2/gcc/ada/rtsfind.ads gcc-4.6.0/gcc/ada/rtsfind.ads *** gcc-4.5.2/gcc/ada/rtsfind.ads Mon Jul 13 09:28:05 2009 --- gcc-4.6.0/gcc/ada/rtsfind.ads Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Rtsfind is *** 265,270 **** --- 265,271 ---- System_Machine_Code, System_Mantissa, System_Memcop, + System_Multiprocessors, System_Pack_03, System_Pack_05, System_Pack_06, *************** package Rtsfind is *** 536,542 **** RO_RT_Delay_Until, -- Ada.Real_Time.Delays RO_RT_To_Duration, -- Ada.Real_Time.Delays ! RE_Timing_Event, -- Ada_Real_Time_Timing_Events RE_Root_Stream_Type, -- Ada.Streams RE_Stream_Element, -- Ada.Streams --- 537,544 ---- RO_RT_Delay_Until, -- Ada.Real_Time.Delays RO_RT_To_Duration, -- Ada.Real_Time.Delays ! RE_Set_Handler, -- Ada_Real_Time.Timing_Events ! RE_Timing_Event, -- Ada_Real_Time.Timing_Events RE_Root_Stream_Type, -- Ada.Streams RE_Stream_Element, -- Ada.Streams *************** package Rtsfind is *** 600,605 **** --- 602,608 ---- RE_Signature, -- Ada.Tags RE_SSD, -- Ada.Tags RE_TSD, -- Ada.Tags + RE_Type_Is_Abstract, -- Ada.Tags RE_Type_Specific_Data, -- Ada.Tags RE_Register_Interface_Offset, -- Ada.Tags RE_Register_Tag, -- Ada.Tags *************** package Rtsfind is *** 798,803 **** --- 801,807 ---- RE_Image_Boolean, -- System.Img_Bool RE_Image_Character, -- System.Img_Char + RE_Image_Character_05, -- System.Img_Char RE_Image_Decimal, -- System.Img_Dec *************** package Rtsfind is *** 836,841 **** --- 840,847 ---- RE_Mantissa_Value, -- System_Mantissa + RE_CPU_Range, -- System.Multiprocessors + RE_Bits_03, -- System.Pack_03 RE_Get_03, -- System.Pack_03 RE_Set_03, -- System.Pack_03 *************** package Rtsfind is *** 1132,1137 **** --- 1138,1144 ---- RE_Raise_Program_Error_Unknown_Tag, -- System.Partition_Interface RE_Register_Passive_Package, -- System.Partition_Interface RE_Register_Receiving_Stub, -- System.Partition_Interface + RE_Request, -- System.Partition_Interface RE_Request_Access, -- System.Partition_Interface RE_RCI_Locator, -- System.Partition_Interface RE_RCI_Subp_Info, -- System.Partition_Interface *************** package Rtsfind is *** 1171,1182 **** RE_NVList_Ref, -- System.Partition_Interface RE_NVList_Create, -- System.Partition_Interface RE_NVList_Add_Item, -- System.Partition_Interface - RE_Request_Create, -- System.Partition_Interface - RE_Request_Invoke, -- System.Partition_Interface RE_Request_Arguments, -- System.Partition_Interface ! RE_Request_Set_Out, -- System.Partition_Interface RE_Request_Raise_Occurrence, -- System.Partition_Interface ! RE_Request_Destroy, -- System.Partition_Interface RE_Nil_Exc_List, -- System.Partition_Interface RE_Servant, -- System.Partition_Interface RE_Move_Any_Value, -- System.Partition_Interface --- 1178,1188 ---- RE_NVList_Ref, -- System.Partition_Interface RE_NVList_Create, -- System.Partition_Interface RE_NVList_Add_Item, -- System.Partition_Interface RE_Request_Arguments, -- System.Partition_Interface ! RE_Request_Invoke, -- System.Partition_Interface RE_Request_Raise_Occurrence, -- System.Partition_Interface ! RE_Request_Set_Out, -- System.Partition_Interface ! RE_Request_Setup, -- System.Partition_Interface RE_Nil_Exc_List, -- System.Partition_Interface RE_Servant, -- System.Partition_Interface RE_Move_Any_Value, -- System.Partition_Interface *************** package Rtsfind is *** 1396,1401 **** --- 1402,1412 ---- RE_Conditional_Call, -- System.Tasking RE_Asynchronous_Call, -- System.Tasking + RE_Foreign_Task_Level, -- System.Tasking + RE_Environment_Task_Level, -- System.Tasking + RE_Independent_Task_Level, -- System.Tasking + RE_Library_Task_Level, -- System.Tasking + RE_Ada_Task_Control_Block, -- System.Tasking RE_Task_List, -- System.Tasking *************** package Rtsfind is *** 1418,1423 **** --- 1429,1436 ---- RE_Activation_Chain_Access, -- System.Tasking RE_Storage_Size, -- System.Tasking + RE_Unspecified_CPU, -- System.Tasking + RE_Abort_Defer, -- System.Soft_Links RE_Abort_Undefer, -- System.Soft_Links RE_Complete_Master, -- System.Soft_Links *************** package Rtsfind is *** 1701,1706 **** --- 1714,1720 ---- RO_RT_Delay_Until => Ada_Real_Time_Delays, RO_RT_To_Duration => Ada_Real_Time_Delays, + RE_Set_Handler => Ada_Real_Time_Timing_Events, RE_Timing_Event => Ada_Real_Time_Timing_Events, RE_Root_Stream_Type => Ada_Streams, *************** package Rtsfind is *** 1765,1770 **** --- 1779,1785 ---- RE_Signature => Ada_Tags, RE_SSD => Ada_Tags, RE_TSD => Ada_Tags, + RE_Type_Is_Abstract => Ada_Tags, RE_Type_Specific_Data => Ada_Tags, RE_Register_Interface_Offset => Ada_Tags, RE_Register_Tag => Ada_Tags, *************** package Rtsfind is *** 1963,1968 **** --- 1978,1984 ---- RE_Image_Boolean => System_Img_Bool, RE_Image_Character => System_Img_Char, + RE_Image_Character_05 => System_Img_Char, RE_Image_Decimal => System_Img_Dec, *************** package Rtsfind is *** 2001,2006 **** --- 2017,2024 ---- RE_Mantissa_Value => System_Mantissa, + RE_CPU_Range => System_Multiprocessors, + RE_Bits_03 => System_Pack_03, RE_Get_03 => System_Pack_03, RE_Set_03 => System_Pack_03, *************** package Rtsfind is *** 2297,2302 **** --- 2315,2321 ---- RE_Raise_Program_Error_Unknown_Tag => System_Partition_Interface, RE_Register_Passive_Package => System_Partition_Interface, RE_Register_Receiving_Stub => System_Partition_Interface, + RE_Request => System_Partition_Interface, RE_Request_Access => System_Partition_Interface, RE_RCI_Locator => System_Partition_Interface, RE_RCI_Subp_Info => System_Partition_Interface, *************** package Rtsfind is *** 2327,2338 **** RE_NVList_Ref => System_Partition_Interface, RE_NVList_Create => System_Partition_Interface, RE_NVList_Add_Item => System_Partition_Interface, - RE_Request_Create => System_Partition_Interface, - RE_Request_Invoke => System_Partition_Interface, RE_Request_Arguments => System_Partition_Interface, ! RE_Request_Set_Out => System_Partition_Interface, RE_Request_Raise_Occurrence => System_Partition_Interface, ! RE_Request_Destroy => System_Partition_Interface, RE_Nil_Exc_List => System_Partition_Interface, RE_Servant => System_Partition_Interface, RE_Move_Any_Value => System_Partition_Interface, --- 2346,2356 ---- RE_NVList_Ref => System_Partition_Interface, RE_NVList_Create => System_Partition_Interface, RE_NVList_Add_Item => System_Partition_Interface, RE_Request_Arguments => System_Partition_Interface, ! RE_Request_Invoke => System_Partition_Interface, RE_Request_Raise_Occurrence => System_Partition_Interface, ! RE_Request_Set_Out => System_Partition_Interface, ! RE_Request_Setup => System_Partition_Interface, RE_Nil_Exc_List => System_Partition_Interface, RE_Servant => System_Partition_Interface, RE_Move_Any_Value => System_Partition_Interface, *************** package Rtsfind is *** 2561,2566 **** --- 2579,2589 ---- RE_Conditional_Call => System_Tasking, RE_Asynchronous_Call => System_Tasking, + RE_Foreign_Task_Level => System_Tasking, + RE_Environment_Task_Level => System_Tasking, + RE_Independent_Task_Level => System_Tasking, + RE_Library_Task_Level => System_Tasking, + RE_Ada_Task_Control_Block => System_Tasking, RE_Task_List => System_Tasking, *************** package Rtsfind is *** 2583,2588 **** --- 2606,2613 ---- RE_Activation_Chain_Access => System_Tasking, RE_Storage_Size => System_Tasking, + RE_Unspecified_CPU => System_Tasking, + RE_Abort_Defer => System_Soft_Links, RE_Abort_Undefer => System_Soft_Links, RE_Complete_Master => System_Soft_Links, diff -Nrcpad gcc-4.5.2/gcc/ada/s-asthan-vms-alpha.adb gcc-4.6.0/gcc/ada/s-asthan-vms-alpha.adb *** gcc-4.5.2/gcc/ada/s-asthan-vms-alpha.adb Thu Apr 16 08:33:28 2009 --- gcc-4.6.0/gcc/ada/s-asthan-vms-alpha.adb Tue Oct 5 09:37:44 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** with System.Task_Primitives; *** 48,61 **** with System.Task_Primitives.Operations; with System.Task_Primitives.Operations.DEC; ! -- with Ada.Finalization; ! -- removed, because of problem with controlled attribute ??? ! with Ada.Task_Attributes; with Ada.Exceptions; use Ada.Exceptions; with Ada.Unchecked_Conversion; package body System.AST_Handling is --- 48,60 ---- with System.Task_Primitives.Operations; with System.Task_Primitives.Operations.DEC; ! with Ada.Finalization; with Ada.Task_Attributes; with Ada.Exceptions; use Ada.Exceptions; with Ada.Unchecked_Conversion; + with Ada.Unchecked_Deallocation; package body System.AST_Handling is *************** package body System.AST_Handling is *** 190,204 **** type AST_Handler_Vector is array (Natural range <>) of AST_Handler_Data; type AST_Handler_Vector_Ref is access all AST_Handler_Vector; ! -- type AST_Vector_Ptr is new Ada.Finalization.Controlled with record ! -- removed due to problem with controlled attribute, consequence is that ! -- we have a memory leak if a task that has AST attribute entries is ! -- terminated. ??? ! ! type AST_Vector_Ptr is record Vector : AST_Handler_Vector_Ref; end record; AST_Vector_Init : AST_Vector_Ptr; -- Initial value, treated as constant, Vector will be null --- 189,210 ---- type AST_Handler_Vector is array (Natural range <>) of AST_Handler_Data; type AST_Handler_Vector_Ref is access all AST_Handler_Vector; ! type AST_Vector_Ptr is new Ada.Finalization.Controlled with record Vector : AST_Handler_Vector_Ref; end record; + procedure Finalize (Obj : in out AST_Vector_Ptr); + -- Override Finalize so that the AST Vector gets freed. + + procedure Finalize (Obj : in out AST_Vector_Ptr) is + procedure Free is new + Ada.Unchecked_Deallocation (AST_Handler_Vector, AST_Handler_Vector_Ref); + begin + if Obj.Vector /= null then + Free (Obj.Vector); + end if; + end Finalize; + AST_Vector_Init : AST_Vector_Ptr; -- Initial value, treated as constant, Vector will be null diff -Nrcpad gcc-4.5.2/gcc/ada/s-auxdec-vms-alpha.adb gcc-4.6.0/gcc/ada/s-auxdec-vms-alpha.adb *** gcc-4.5.2/gcc/ada/s-auxdec-vms-alpha.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/s-auxdec-vms-alpha.adb Mon Dec 20 07:26:57 2010 *************** *** 0 **** --- 1,809 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- S Y S T E M . A U X _ D E C -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1992-2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- This is the Alpha/VMS version. + + pragma Style_Checks (All_Checks); + -- Turn off alpha ordering check on subprograms, this unit is laid + -- out to correspond to the declarations in the DEC 83 System unit. + + with System.Machine_Code; use System.Machine_Code; + package body System.Aux_DEC is + + ------------------------ + -- Fetch_From_Address -- + ------------------------ + + function Fetch_From_Address (A : Address) return Target is + type T_Ptr is access all Target; + function To_T_Ptr is new Ada.Unchecked_Conversion (Address, T_Ptr); + Ptr : constant T_Ptr := To_T_Ptr (A); + begin + return Ptr.all; + end Fetch_From_Address; + + ----------------------- + -- Assign_To_Address -- + ----------------------- + + procedure Assign_To_Address (A : Address; T : Target) is + type T_Ptr is access all Target; + function To_T_Ptr is new Ada.Unchecked_Conversion (Address, T_Ptr); + Ptr : constant T_Ptr := To_T_Ptr (A); + begin + Ptr.all := T; + end Assign_To_Address; + + ----------------------- + -- Clear_Interlocked -- + ----------------------- + + procedure Clear_Interlocked + (Bit : in out Boolean; + Old_Value : out Boolean) + is + use ASCII; + Clr_Bit : Boolean := Bit; + Old_Bit : Boolean; + + begin + -- All these ASM sequences should be commented. I suggest defining + -- a constant called E which is LF & HT and then you have more space + -- for line by line comments ??? + + System.Machine_Code.Asm + ( + "lda $16, %2" & LF & HT & + "mb" & LF & HT & + "sll $16, 3, $17 " & LF & HT & + "bis $31, 1, $1" & LF & HT & + "and $17, 63, $18" & LF & HT & + "bic $17, 63, $17" & LF & HT & + "sra $17, 3, $17" & LF & HT & + "bis $31, 1, %1" & LF & HT & + "sll %1, $18, $18" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, 0($17)" & LF & HT & + "and $1, $18, %1" & LF & HT & + "bic $1, $18, $1" & LF & HT & + "stq_c $1, 0($17)" & LF & HT & + "cmpeq %1, 0, %1" & LF & HT & + "beq $1, 1b" & LF & HT & + "mb" & LF & HT & + "xor %1, 1, %1" & LF & HT & + "trapb", + Outputs => (Boolean'Asm_Output ("=m", Clr_Bit), + Boolean'Asm_Output ("=r", Old_Bit)), + Inputs => Boolean'Asm_Input ("m", Clr_Bit), + Clobber => "$1, $16, $17, $18", + Volatile => True); + + Bit := Clr_Bit; + Old_Value := Old_Bit; + end Clear_Interlocked; + + procedure Clear_Interlocked + (Bit : in out Boolean; + Old_Value : out Boolean; + Retry_Count : Natural; + Success_Flag : out Boolean) + is + use ASCII; + Clr_Bit : Boolean := Bit; + Succ, Old_Bit : Boolean; + + begin + System.Machine_Code.Asm + ( + "lda $16, %3" & LF & HT & + "mb" & LF & HT & + "sll $16, 3, $18 " & LF & HT & + "bis $31, 1, %1" & LF & HT & + "and $18, 63, $19" & LF & HT & + "bic $18, 63, $18" & LF & HT & + "sra $18, 3, $18" & LF & HT & + "bis $31, %4, $17" & LF & HT & + "sll %1, $19, $19" & LF & HT & + "1:" & LF & HT & + "ldq_l %2, 0($18)" & LF & HT & + "and %2, $19, %1" & LF & HT & + "bic %2, $19, %2" & LF & HT & + "stq_c %2, 0($18)" & LF & HT & + "beq %2, 2f" & LF & HT & + "cmpeq %1, 0, %1" & LF & HT & + "br 3f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "xor %1, 1, %1" & LF & HT & + "trapb", + Outputs => (Boolean'Asm_Output ("=m", Clr_Bit), + Boolean'Asm_Output ("=r", Old_Bit), + Boolean'Asm_Output ("=r", Succ)), + Inputs => (Boolean'Asm_Input ("m", Clr_Bit), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$16, $17, $18, $19", + Volatile => True); + + Bit := Clr_Bit; + Old_Value := Old_Bit; + Success_Flag := Succ; + end Clear_Interlocked; + + --------------------- + -- Set_Interlocked -- + --------------------- + + procedure Set_Interlocked + (Bit : in out Boolean; + Old_Value : out Boolean) + is + use ASCII; + Set_Bit : Boolean := Bit; + Old_Bit : Boolean; + + begin + -- Don't we need comments on these long asm sequences??? + + System.Machine_Code.Asm + ( + "lda $16, %2" & LF & HT & + "sll $16, 3, $17 " & LF & HT & + "bis $31, 1, $1" & LF & HT & + "and $17, 63, $18" & LF & HT & + "mb" & LF & HT & + "bic $17, 63, $17" & LF & HT & + "sra $17, 3, $17" & LF & HT & + "bis $31, 1, %1" & LF & HT & + "sll %1, $18, $18" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, 0($17)" & LF & HT & + "and $1, $18, %1" & LF & HT & + "bis $1, $18, $1" & LF & HT & + "stq_c $1, 0($17)" & LF & HT & + "cmovne %1, 1, %1" & LF & HT & + "beq $1, 1b" & LF & HT & + "mb" & LF & HT & + "trapb", + Outputs => (Boolean'Asm_Output ("=m", Set_Bit), + Boolean'Asm_Output ("=r", Old_Bit)), + Inputs => Boolean'Asm_Input ("m", Set_Bit), + Clobber => "$1, $16, $17, $18", + Volatile => True); + + Bit := Set_Bit; + Old_Value := Old_Bit; + end Set_Interlocked; + + procedure Set_Interlocked + (Bit : in out Boolean; + Old_Value : out Boolean; + Retry_Count : Natural; + Success_Flag : out Boolean) + is + use ASCII; + Set_Bit : Boolean := Bit; + Succ, Old_Bit : Boolean; + + begin + System.Machine_Code.Asm + ( + "lda $16, %3" & LF & HT & + "mb" & LF & HT & + "sll $16, 3, $18 " & LF & HT & + "bis $31, 1, %1" & LF & HT & + "and $18, 63, $19" & LF & HT & + "bic $18, 63, $18" & LF & HT & + "sra $18, 3, $18" & LF & HT & + "bis $31, %4, $17" & LF & HT & + "sll %1, $19, $19" & LF & HT & + "1:" & LF & HT & + "ldq_l %2, 0($18)" & LF & HT & + "and %2, $19, %1" & LF & HT & + "bis %2, $19, %2" & LF & HT & + "stq_c %2, 0($18)" & LF & HT & + "beq %2, 2f" & LF & HT & + "cmovne %1, 1, %1" & LF & HT & + "br 3f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "trapb", + Outputs => (Boolean'Asm_Output ("=m", Set_Bit), + Boolean'Asm_Output ("=r", Old_Bit), + Boolean'Asm_Output ("=r", Succ)), + Inputs => (Boolean'Asm_Input ("m", Set_Bit), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$16, $17, $18, $19", + Volatile => True); + + Bit := Set_Bit; + Old_Value := Old_Bit; + Success_Flag := Succ; + end Set_Interlocked; + + --------------------- + -- Add_Interlocked -- + --------------------- + + procedure Add_Interlocked + (Addend : Short_Integer; + Augend : in out Aligned_Word; + Sign : out Integer) + is + use ASCII; + Overflowed : Boolean := False; + + begin + System.Machine_Code.Asm + ( + "lda $18, %0" & LF & HT & + "bic $18, 6, $21" & LF & HT & + "mb" & LF & HT & + "1:" & LF & HT & + "ldq_l $0, 0($21)" & LF & HT & + "extwl $0, $18, $19" & LF & HT & + "mskwl $0, $18, $0" & LF & HT & + "addq $19, %3, $20" & LF & HT & + "inswl $20, $18, $17" & LF & HT & + "xor $19, %3, $19" & LF & HT & + "bis $17, $0, $0" & LF & HT & + "stq_c $0, 0($21)" & LF & HT & + "beq $0, 1b" & LF & HT & + "srl $20, 16, $0" & LF & HT & + "mb" & LF & HT & + "srl $20, 12, $21" & LF & HT & + "zapnot $20, 3, $20" & LF & HT & + "and $0, 1, $0" & LF & HT & + "and $21, 8, $21" & LF & HT & + "bis $21, $0, $0" & LF & HT & + "cmpeq $20, 0, $21" & LF & HT & + "xor $20, 2, $20" & LF & HT & + "sll $21, 2, $21" & LF & HT & + "bis $21, $0, $0" & LF & HT & + "bic $20, $19, $21" & LF & HT & + "srl $21, 14, $21" & LF & HT & + "and $21, 2, $21" & LF & HT & + "bis $21, $0, $0" & LF & HT & + "and $0, 2, %2" & LF & HT & + "bne %2, 2f" & LF & HT & + "and $0, 4, %1" & LF & HT & + "cmpeq %1, 0, %1" & LF & HT & + "and $0, 8, $0" & LF & HT & + "lda $16, -1" & LF & HT & + "cmovne $0, $16, %1" & LF & HT & + "2:", + Outputs => (Aligned_Word'Asm_Output ("=m", Augend), + Integer'Asm_Output ("=r", Sign), + Boolean'Asm_Output ("=r", Overflowed)), + Inputs => (Short_Integer'Asm_Input ("r", Addend), + Aligned_Word'Asm_Input ("m", Augend)), + Clobber => "$0, $1, $16, $17, $18, $19, $20, $21", + Volatile => True); + + if Overflowed then + raise Constraint_Error; + end if; + end Add_Interlocked; + + ---------------- + -- Add_Atomic -- + ---------------- + + procedure Add_Atomic + (To : in out Aligned_Integer; + Amount : Integer) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "1:" & LF & HT & + "ldl_l $1, %0" & LF & HT & + "addl $1, %2, $0" & LF & HT & + "stl_c $0, %1" & LF & HT & + "beq $0, 1b" & LF & HT & + "mb", + Outputs => Aligned_Integer'Asm_Output ("=m", To), + Inputs => (Aligned_Integer'Asm_Input ("m", To), + Integer'Asm_Input ("rJ", Amount)), + Clobber => "$0, $1", + Volatile => True); + end Add_Atomic; + + procedure Add_Atomic + (To : in out Aligned_Integer; + Amount : Integer; + Retry_Count : Natural; + Old_Value : out Integer; + Success_Flag : out Boolean) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "bis $31, %5, $17" & LF & HT & + "1:" & LF & HT & + "ldl_l $1, %0" & LF & HT & + "addl $1, %4, $0" & LF & HT & + "stl_c $0, %3" & LF & HT & + "beq $0, 2f" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "stq $0, %2" & LF & HT & + "stl $1, %1" & LF & HT & + "br 4f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "br 3b" & LF & HT & + "4:", + Outputs => (Aligned_Integer'Asm_Output ("=m", To), + Integer'Asm_Output ("=m", Old_Value), + Boolean'Asm_Output ("=m", Success_Flag)), + Inputs => (Aligned_Integer'Asm_Input ("m", To), + Integer'Asm_Input ("rJ", Amount), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$0, $1, $17", + Volatile => True); + end Add_Atomic; + + procedure Add_Atomic + (To : in out Aligned_Long_Integer; + Amount : Long_Integer) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, %0" & LF & HT & + "addq $1, %2, $0" & LF & HT & + "stq_c $0, %1" & LF & HT & + "beq $0, 1b" & LF & HT & + "mb", + Outputs => Aligned_Long_Integer'Asm_Output ("=m", To), + Inputs => (Aligned_Long_Integer'Asm_Input ("m", To), + Long_Integer'Asm_Input ("rJ", Amount)), + Clobber => "$0, $1", + Volatile => True); + end Add_Atomic; + + procedure Add_Atomic + (To : in out Aligned_Long_Integer; + Amount : Long_Integer; + Retry_Count : Natural; + Old_Value : out Long_Integer; + Success_Flag : out Boolean) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "bis $31, %5, $17" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, %0" & LF & HT & + "addq $1, %4, $0" & LF & HT & + "stq_c $0, %3" & LF & HT & + "beq $0, 2f" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "stq $0, %2" & LF & HT & + "stq $1, %1" & LF & HT & + "br 4f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "br 3b" & LF & HT & + "4:", + Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To), + Long_Integer'Asm_Output ("=m", Old_Value), + Boolean'Asm_Output ("=m", Success_Flag)), + Inputs => (Aligned_Long_Integer'Asm_Input ("m", To), + Long_Integer'Asm_Input ("rJ", Amount), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$0, $1, $17", + Volatile => True); + end Add_Atomic; + + ---------------- + -- And_Atomic -- + ---------------- + + procedure And_Atomic + (To : in out Aligned_Integer; + From : Integer) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "1:" & LF & HT & + "ldl_l $1, %0" & LF & HT & + "and $1, %2, $0" & LF & HT & + "stl_c $0, %1" & LF & HT & + "beq $0, 1b" & LF & HT & + "mb", + Outputs => Aligned_Integer'Asm_Output ("=m", To), + Inputs => (Aligned_Integer'Asm_Input ("m", To), + Integer'Asm_Input ("rJ", From)), + Clobber => "$0, $1", + Volatile => True); + end And_Atomic; + + procedure And_Atomic + (To : in out Aligned_Integer; + From : Integer; + Retry_Count : Natural; + Old_Value : out Integer; + Success_Flag : out Boolean) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "bis $31, %5, $17" & LF & HT & + "1:" & LF & HT & + "ldl_l $1, %0" & LF & HT & + "and $1, %4, $0" & LF & HT & + "stl_c $0, %3" & LF & HT & + "beq $0, 2f" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "stq $0, %2" & LF & HT & + "stl $1, %1" & LF & HT & + "br 4f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "br 3b" & LF & HT & + "4:", + Outputs => (Aligned_Integer'Asm_Output ("=m", To), + Integer'Asm_Output ("=m", Old_Value), + Boolean'Asm_Output ("=m", Success_Flag)), + Inputs => (Aligned_Integer'Asm_Input ("m", To), + Integer'Asm_Input ("rJ", From), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$0, $1, $17", + Volatile => True); + end And_Atomic; + + procedure And_Atomic + (To : in out Aligned_Long_Integer; + From : Long_Integer) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, %0" & LF & HT & + "and $1, %2, $0" & LF & HT & + "stq_c $0, %1" & LF & HT & + "beq $0, 1b" & LF & HT & + "mb", + Outputs => Aligned_Long_Integer'Asm_Output ("=m", To), + Inputs => (Aligned_Long_Integer'Asm_Input ("m", To), + Long_Integer'Asm_Input ("rJ", From)), + Clobber => "$0, $1", + Volatile => True); + end And_Atomic; + + procedure And_Atomic + (To : in out Aligned_Long_Integer; + From : Long_Integer; + Retry_Count : Natural; + Old_Value : out Long_Integer; + Success_Flag : out Boolean) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "bis $31, %5, $17" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, %0" & LF & HT & + "and $1, %4, $0" & LF & HT & + "stq_c $0, %3" & LF & HT & + "beq $0, 2f" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "stq $0, %2" & LF & HT & + "stq $1, %1" & LF & HT & + "br 4f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "br 3b" & LF & HT & + "4:", + Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To), + Long_Integer'Asm_Output ("=m", Old_Value), + Boolean'Asm_Output ("=m", Success_Flag)), + Inputs => (Aligned_Long_Integer'Asm_Input ("m", To), + Long_Integer'Asm_Input ("rJ", From), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$0, $1, $17", + Volatile => True); + end And_Atomic; + + --------------- + -- Or_Atomic -- + --------------- + + procedure Or_Atomic + (To : in out Aligned_Integer; + From : Integer) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "1:" & LF & HT & + "ldl_l $1, %0" & LF & HT & + "bis $1, %2, $0" & LF & HT & + "stl_c $0, %1" & LF & HT & + "beq $0, 1b" & LF & HT & + "mb", + Outputs => Aligned_Integer'Asm_Output ("=m", To), + Inputs => (Aligned_Integer'Asm_Input ("m", To), + Integer'Asm_Input ("rJ", From)), + Clobber => "$0, $1", + Volatile => True); + end Or_Atomic; + + procedure Or_Atomic + (To : in out Aligned_Integer; + From : Integer; + Retry_Count : Natural; + Old_Value : out Integer; + Success_Flag : out Boolean) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "bis $31, %5, $17" & LF & HT & + "1:" & LF & HT & + "ldl_l $1, %0" & LF & HT & + "bis $1, %4, $0" & LF & HT & + "stl_c $0, %3" & LF & HT & + "beq $0, 2f" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "stq $0, %2" & LF & HT & + "stl $1, %1" & LF & HT & + "br 4f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "br 3b" & LF & HT & + "4:", + Outputs => (Aligned_Integer'Asm_Output ("=m", To), + Integer'Asm_Output ("=m", Old_Value), + Boolean'Asm_Output ("=m", Success_Flag)), + Inputs => (Aligned_Integer'Asm_Input ("m", To), + Integer'Asm_Input ("rJ", From), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$0, $1, $17", + Volatile => True); + end Or_Atomic; + + procedure Or_Atomic + (To : in out Aligned_Long_Integer; + From : Long_Integer) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, %0" & LF & HT & + "bis $1, %2, $0" & LF & HT & + "stq_c $0, %1" & LF & HT & + "beq $0, 1b" & LF & HT & + "mb", + Outputs => Aligned_Long_Integer'Asm_Output ("=m", To), + Inputs => (Aligned_Long_Integer'Asm_Input ("m", To), + Long_Integer'Asm_Input ("rJ", From)), + Clobber => "$0, $1", + Volatile => True); + end Or_Atomic; + + procedure Or_Atomic + (To : in out Aligned_Long_Integer; + From : Long_Integer; + Retry_Count : Natural; + Old_Value : out Long_Integer; + Success_Flag : out Boolean) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "mb" & LF & HT & + "bis $31, %5, $17" & LF & HT & + "1:" & LF & HT & + "ldq_l $1, %0" & LF & HT & + "bis $1, %4, $0" & LF & HT & + "stq_c $0, %3" & LF & HT & + "beq $0, 2f" & LF & HT & + "3:" & LF & HT & + "mb" & LF & HT & + "stq $0, %2" & LF & HT & + "stq $1, %1" & LF & HT & + "br 4f" & LF & HT & + "2:" & LF & HT & + "subq $17, 1, $17" & LF & HT & + "bgt $17, 1b" & LF & HT & + "br 3b" & LF & HT & + "4:", + Outputs => (Aligned_Long_Integer'Asm_Output ("=m", To), + Long_Integer'Asm_Output ("=m", Old_Value), + Boolean'Asm_Output ("=m", Success_Flag)), + Inputs => (Aligned_Long_Integer'Asm_Input ("m", To), + Long_Integer'Asm_Input ("rJ", From), + Natural'Asm_Input ("rJ", Retry_Count)), + Clobber => "$0, $1, $17", + Volatile => True); + end Or_Atomic; + + ------------ + -- Insqhi -- + ------------ + + procedure Insqhi + (Item : Address; + Header : Address; + Status : out Insq_Status) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "bis $31, %1, $17" & LF & HT & + "bis $31, %2, $16" & LF & HT & + "mb" & LF & HT & + "call_pal 0x87" & LF & HT & + "mb", + Outputs => Insq_Status'Asm_Output ("=v", Status), + Inputs => (Address'Asm_Input ("rJ", Item), + Address'Asm_Input ("rJ", Header)), + Clobber => "$16, $17", + Volatile => True); + end Insqhi; + + ------------ + -- Remqhi -- + ------------ + + procedure Remqhi + (Header : Address; + Item : out Address; + Status : out Remq_Status) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "bis $31, %2, $16" & LF & HT & + "mb" & LF & HT & + "call_pal 0x93" & LF & HT & + "mb" & LF & HT & + "bis $31, $1, %1", + Outputs => (Remq_Status'Asm_Output ("=v", Status), + Address'Asm_Output ("=r", Item)), + Inputs => Address'Asm_Input ("rJ", Header), + Clobber => "$1, $16", + Volatile => True); + end Remqhi; + + ------------ + -- Insqti -- + ------------ + + procedure Insqti + (Item : Address; + Header : Address; + Status : out Insq_Status) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "bis $31, %1, $17" & LF & HT & + "bis $31, %2, $16" & LF & HT & + "mb" & LF & HT & + "call_pal 0x88" & LF & HT & + "mb", + Outputs => Insq_Status'Asm_Output ("=v", Status), + Inputs => (Address'Asm_Input ("rJ", Item), + Address'Asm_Input ("rJ", Header)), + Clobber => "$16, $17", + Volatile => True); + end Insqti; + + ------------ + -- Remqti -- + ------------ + + procedure Remqti + (Header : Address; + Item : out Address; + Status : out Remq_Status) + is + use ASCII; + + begin + System.Machine_Code.Asm + ( + "bis $31, %2, $16" & LF & HT & + "mb" & LF & HT & + "call_pal 0x94" & LF & HT & + "mb" & LF & HT & + "bis $31, $1, %1", + Outputs => (Remq_Status'Asm_Output ("=v", Status), + Address'Asm_Output ("=r", Item)), + Inputs => Address'Asm_Input ("rJ", Header), + Clobber => "$1, $16", + Volatile => True); + end Remqti; + + end System.Aux_DEC; diff -Nrcpad gcc-4.5.2/gcc/ada/s-auxdec-vms_64.ads gcc-4.6.0/gcc/ada/s-auxdec-vms_64.ads *** gcc-4.5.2/gcc/ada/s-auxdec-vms_64.ads Mon Apr 20 08:55:51 2009 --- gcc-4.6.0/gcc/ada/s-auxdec-vms_64.ads Mon Dec 20 07:26:57 2010 *************** package System.Aux_DEC is *** 112,117 **** --- 112,120 ---- function "-" (Left : Address; Right : Address) return Integer; function "-" (Left : Address; Right : Integer) return Address; + pragma Import (Intrinsic, "+"); + pragma Import (Intrinsic, "-"); + generic type Target is private; function Fetch_From_Address (A : Address) return Target; *************** package System.Aux_DEC is *** 227,242 **** type Unsigned_Quadword_Array is array (Integer range <>) of Unsigned_Quadword; ! function To_Address (X : Integer) return Address; pragma Pure_Function (To_Address); ! function To_Address_Long (X : Unsigned_Longword) return Address; pragma Pure_Function (To_Address_Long); ! function To_Integer (X : Address) return Integer; ! function To_Unsigned_Longword (X : Address) return Unsigned_Longword; ! function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword; -- Conventional names for static subtypes of type UNSIGNED_LONGWORD --- 230,245 ---- type Unsigned_Quadword_Array is array (Integer range <>) of Unsigned_Quadword; ! function To_Address (X : Integer) return Short_Address; pragma Pure_Function (To_Address); ! function To_Address_Long (X : Unsigned_Longword) return Short_Address; pragma Pure_Function (To_Address_Long); ! function To_Integer (X : Short_Address) return Integer; ! function To_Unsigned_Longword (X : Short_Address) return Unsigned_Longword; ! function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword; -- Conventional names for static subtypes of type UNSIGNED_LONGWORD *************** private *** 461,472 **** -- them intrinsic, since the backend can handle them, but the front -- end is not prepared to deal with them, so at least inline them. ! pragma Inline_Always ("+"); ! pragma Inline_Always ("-"); ! pragma Inline_Always ("not"); ! pragma Inline_Always ("and"); ! pragma Inline_Always ("or"); ! pragma Inline_Always ("xor"); -- Other inlined subprograms --- 464,473 ---- -- them intrinsic, since the backend can handle them, but the front -- end is not prepared to deal with them, so at least inline them. ! pragma Import (Intrinsic, "not"); ! pragma Import (Intrinsic, "and"); ! pragma Import (Intrinsic, "or"); ! pragma Import (Intrinsic, "xor"); -- Other inlined subprograms *************** private *** 578,583 **** --- 579,591 ---- Mechanism => (Reference, Value, Value, Reference, Reference)); pragma Inline_Always (Or_Atomic); + -- Inline the VAX Queue Functions + + pragma Inline_Always (Insqhi); + pragma Inline_Always (Remqhi); + pragma Inline_Always (Insqti); + pragma Inline_Always (Remqti); + -- Provide proper unchecked conversion definitions for transfer -- functions. Note that we need this level of indirection because -- the formal parameter name is X and not Source (and this is indeed *************** private *** 649,679 **** -- want warnings when we compile on such systems. function To_Address_A is new ! Ada.Unchecked_Conversion (Integer, Address); pragma Pure_Function (To_Address_A); ! function To_Address (X : Integer) return Address renames To_Address_A; pragma Pure_Function (To_Address); function To_Address_Long_A is new ! Ada.Unchecked_Conversion (Unsigned_Longword, Address); pragma Pure_Function (To_Address_Long_A); ! function To_Address_Long (X : Unsigned_Longword) return Address renames To_Address_Long_A; pragma Pure_Function (To_Address_Long); function To_Integer_A is new ! Ada.Unchecked_Conversion (Address, Integer); ! function To_Integer (X : Address) return Integer renames To_Integer_A; function To_Unsigned_Longword_A is new ! Ada.Unchecked_Conversion (Address, Unsigned_Longword); ! function To_Unsigned_Longword (X : Address) return Unsigned_Longword renames To_Unsigned_Longword_A; function To_Unsigned_Longword_A is new --- 657,687 ---- -- want warnings when we compile on such systems. function To_Address_A is new ! Ada.Unchecked_Conversion (Integer, Short_Address); pragma Pure_Function (To_Address_A); ! function To_Address (X : Integer) return Short_Address renames To_Address_A; pragma Pure_Function (To_Address); function To_Address_Long_A is new ! Ada.Unchecked_Conversion (Unsigned_Longword, Short_Address); pragma Pure_Function (To_Address_Long_A); ! function To_Address_Long (X : Unsigned_Longword) return Short_Address renames To_Address_Long_A; pragma Pure_Function (To_Address_Long); function To_Integer_A is new ! Ada.Unchecked_Conversion (Short_Address, Integer); ! function To_Integer (X : Short_Address) return Integer renames To_Integer_A; function To_Unsigned_Longword_A is new ! Ada.Unchecked_Conversion (Short_Address, Unsigned_Longword); ! function To_Unsigned_Longword (X : Short_Address) return Unsigned_Longword renames To_Unsigned_Longword_A; function To_Unsigned_Longword_A is new diff -Nrcpad gcc-4.5.2/gcc/ada/s-bitops.adb gcc-4.6.0/gcc/ada/s-bitops.adb *** gcc-4.5.2/gcc/ada/s-bitops.adb Mon Nov 30 11:08:56 2009 --- gcc-4.6.0/gcc/ada/s-bitops.adb Thu Sep 9 09:44:34 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** pragma Compiler_Unit; *** 34,39 **** --- 34,40 ---- with System; use System; with System.Unsigned_Types; use System.Unsigned_Types; + with Ada.Exceptions; use Ada.Exceptions; with Ada.Unchecked_Conversion; package body System.Bit_Ops is *************** package body System.Bit_Ops is *** 72,77 **** --- 73,79 ---- ----------------------- procedure Raise_Error; + pragma No_Return (Raise_Error); -- Raise Constraint_Error, complaining about unequal lengths ------------- *************** package body System.Bit_Ops is *** 211,217 **** procedure Raise_Error is begin ! raise Constraint_Error; end Raise_Error; end System.Bit_Ops; --- 213,220 ---- procedure Raise_Error is begin ! Raise_Exception ! (Constraint_Error'Identity, "operand lengths are unequal"); end Raise_Error; end System.Bit_Ops; diff -Nrcpad gcc-4.5.2/gcc/ada/s-crc32.adb gcc-4.6.0/gcc/ada/s-crc32.adb *** gcc-4.5.2/gcc/ada/s-crc32.adb Fri Apr 17 13:15:47 2009 --- gcc-4.6.0/gcc/ada/s-crc32.adb Thu Oct 7 12:37:10 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** package body System.CRC32 is *** 130,136 **** procedure Update (C : in out CRC32; Value : Character) is V : constant CRC32 := CRC32 (Character'Pos (Value)); - begin C := Shift_Right (C, 8) xor Table (V xor (C and 16#0000_00FF#)); end Update; --- 130,135 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/s-crtl.ads gcc-4.6.0/gcc/ada/s-crtl.ads *** gcc-4.5.2/gcc/ada/s-crtl.ads Mon Nov 30 10:20:47 2009 --- gcc-4.6.0/gcc/ada/s-crtl.ads Thu Jun 17 12:26:10 2010 *************** package System.CRTL is *** 59,64 **** --- 59,67 ---- type size_t is mod 2 ** Standard'Address_Size; + type ssize_t is range -(2 ** (Standard'Address_Size - 1)) + .. +(2 ** (Standard'Address_Size - 1)) - 1; + type Filename_Encoding is (UTF8, ASCII_8bits, Unspecified); for Filename_Encoding use (UTF8 => 0, ASCII_8bits => 1, Unspecified => 2); pragma Convention (C, Filename_Encoding); *************** package System.CRTL is *** 187,196 **** function close (fd : int) return int; pragma Import (C, close, "close"); ! function read (fd : int; buffer : chars; nbytes : int) return int; pragma Import (C, read, "read"); ! function write (fd : int; buffer : chars; nbytes : int) return int; pragma Import (C, write, "write"); end System.CRTL; --- 190,199 ---- function close (fd : int) return int; pragma Import (C, close, "close"); ! function read (fd : int; buffer : chars; count : size_t) return ssize_t; pragma Import (C, read, "read"); ! function write (fd : int; buffer : chars; count : size_t) return ssize_t; pragma Import (C, write, "write"); end System.CRTL; diff -Nrcpad gcc-4.5.2/gcc/ada/s-direio.adb gcc-4.6.0/gcc/ada/s-direio.adb *** gcc-4.5.2/gcc/ada/s-direio.adb Mon Jul 13 08:39:28 2009 --- gcc-4.6.0/gcc/ada/s-direio.adb Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Direct_IO is *** 127,133 **** function End_Of_File (File : File_Type) return Boolean is begin FIO.Check_Read_Status (AP (File)); ! return Count (File.Index) > Size (File); end End_Of_File; ----------- --- 127,133 ---- function End_Of_File (File : File_Type) return Boolean is begin FIO.Check_Read_Status (AP (File)); ! return File.Index > Size (File); end End_Of_File; ----------- *************** package body System.Direct_IO is *** 137,143 **** function Index (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); ! return Count (File.Index); end Index; ---------- --- 137,143 ---- function Index (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); ! return File.Index; end Index; ---------- diff -Nrcpad gcc-4.5.2/gcc/ada/s-fatgen.adb gcc-4.6.0/gcc/ada/s-fatgen.adb *** gcc-4.5.2/gcc/ada/s-fatgen.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/s-fatgen.adb Thu Sep 9 08:57:08 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Fat_Gen is *** 162,174 **** begin if X = 0.0 then Frac := X; Expo := 0; - -- More useful would be defining Expo to be T'Machine_Emin - 1 or - -- T'Machine_Emin - T'Machine_Mantissa, which would preserve - -- monotonicity of the exponent function ??? - -- Check for infinities, transfinites, whatnot elsif X > T'Safe_Last then --- 162,173 ---- begin if X = 0.0 then + + -- The normalized exponent of zero is zero, see RM A.5.2(15) + Frac := X; Expo := 0; -- Check for infinities, transfinites, whatnot elsif X > T'Safe_Last then *************** package body System.Fat_Gen is *** 205,210 **** --- 204,210 ---- end if; -- Ax < R_Power (N) + end loop; -- 1 <= Ax < Rad *************** package body System.Fat_Gen is *** 229,234 **** --- 229,235 ---- end if; -- R_Neg_Power (N) <= Ax < 1 + end loop; end if; *************** package body System.Fat_Gen is *** 553,560 **** -- Scaling -- ------------- ! -- Return x * rad ** adjustment quickly, ! -- or quietly underflow to zero, or overflow naturally. function Scaling (X : T; Adjustment : UI) return T is begin --- 554,561 ---- -- Scaling -- ------------- ! -- Return x * rad ** adjustment quickly, or quietly underflow to zero, ! -- or overflow naturally. function Scaling (X : T; Adjustment : UI) return T is begin *************** package body System.Fat_Gen is *** 586,591 **** --- 587,593 ---- end if; -- -Log_Power (N) < Ex <= 0 + end loop; -- Ex = 0 *************** package body System.Fat_Gen is *** 611,616 **** --- 613,619 ---- end loop; -- Ex = 0 + end if; return Y; *************** package body System.Fat_Gen is *** 648,660 **** else Decompose (X, X_Frac, X_Exp); ! -- A special case, if the number we had was a negative power of ! -- two, then we want to add half of what we would otherwise add, ! -- 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 negative number (and hence a ! -- negative power of 2). if X_Frac = -0.5 then return X + Gradual_Scaling (X_Exp - T'Machine_Mantissa - 1); --- 651,663 ---- else Decompose (X, X_Frac, X_Exp); ! -- A special case, if the number we had was a negative power of two, ! -- then we want to add half of what we would otherwise add, 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 negative number (and hence a negative ! -- power of 2). if X_Frac = -0.5 then return X + Gradual_Scaling (X_Exp - T'Machine_Mantissa - 1); *************** package body System.Fat_Gen is *** 779,786 **** -- one read, but small enough so that all floating point object sizes -- are a multiple of the Float_Word'Size. ! -- The following conditions must be met for all possible ! -- instantiations of the attributes package: -- - T'Size is an integral multiple of Float_Word'Size --- 782,789 ---- -- one read, but small enough so that all floating point object sizes -- are a multiple of the Float_Word'Size. ! -- The following conditions must be met for all possible instantiations ! -- of the attributes package: -- - T'Size is an integral multiple of Float_Word'Size *************** package body System.Fat_Gen is *** 795,803 **** type Rep_Index is range 0 .. 7; Rep_Words : constant Positive := ! (T'Size + Float_Word'Size - 1) / Float_Word'Size; ! Rep_Last : constant Rep_Index := Rep_Index'Min ! (Rep_Index (Rep_Words - 1), (T'Mantissa + 16) / Float_Word'Size); -- Determine the number of Float_Words needed for representing the -- entire floating-point value. Do not take into account excessive -- padding, as occurs on IA-64 where 80 bits floats get padded to 128 --- 798,808 ---- type Rep_Index is range 0 .. 7; Rep_Words : constant Positive := ! (T'Size + Float_Word'Size - 1) / Float_Word'Size; ! Rep_Last : constant Rep_Index := ! Rep_Index'Min ! (Rep_Index (Rep_Words - 1), ! (T'Mantissa + 16) / Float_Word'Size); -- Determine the number of Float_Words needed for representing the -- entire floating-point value. Do not take into account excessive -- padding, as occurs on IA-64 where 80 bits floats get padded to 128 diff -Nrcpad gcc-4.5.2/gcc/ada/s-ficobl.ads gcc-4.6.0/gcc/ada/s-ficobl.ads *** gcc-4.5.2/gcc/ada/s-ficobl.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-ficobl.ads Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.File_Control_Block is *** 60,65 **** --- 60,66 ---- -- Used to hold name and form strings type File_Mode is (In_File, Inout_File, Out_File, Append_File); + subtype Read_File_Mode is File_Mode range In_File .. Inout_File; -- File mode (union of file modes permitted by individual packages, -- the types File_Mode in the individual packages are declared to -- allow easy conversion to and from this general type. diff -Nrcpad gcc-4.5.2/gcc/ada/s-fileio.adb gcc-4.6.0/gcc/ada/s-fileio.adb *** gcc-4.5.2/gcc/ada/s-fileio.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/s-fileio.adb Fri Sep 10 09:54:24 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.File_IO is *** 104,110 **** File_Names_Case_Sensitive : constant Boolean := Get_Case_Sensitive /= 0; -- Set to indicate whether the operating system convention is for file -- names to be case sensitive (e.g., in Unix, set True), or non case ! -- sensitive (e.g., in OS/2, set False). ----------------------- -- Local Subprograms -- --- 104,110 ---- File_Names_Case_Sensitive : constant Boolean := Get_Case_Sensitive /= 0; -- Set to indicate whether the operating system convention is for file -- names to be case sensitive (e.g., in Unix, set True), or non case ! -- sensitive (e.g., in Windows, set False). ----------------------- -- Local Subprograms -- *************** package body System.File_IO is *** 205,211 **** begin if File = null then raise Status_Error with "file not open"; ! elsif File.Mode > Inout_File then raise Mode_Error with "file not readable"; end if; end Check_Read_Status; --- 205,211 ---- begin if File = null then raise Status_Error with "file not open"; ! elsif File.Mode not in Read_File_Mode then raise Mode_Error with "file not readable"; end if; end Check_Read_Status; *************** package body System.File_IO is *** 385,391 **** end Errno_Message; function Errno_Message ! (Name : String; Errno : Integer := OS_Lib.Errno) return String is begin --- 385,391 ---- end Errno_Message; function Errno_Message ! (Name : String; Errno : Integer := OS_Lib.Errno) return String is begin *************** package body System.File_IO is *** 1183,1189 **** -- reopen. if Mode = File.Mode ! and then Mode <= Inout_File then rewind (File.Stream); --- 1183,1189 ---- -- reopen. if Mode = File.Mode ! and then Mode in Read_File_Mode then rewind (File.Stream); diff -Nrcpad gcc-4.5.2/gcc/ada/s-filofl.ads gcc-4.6.0/gcc/ada/s-filofl.ads *** gcc-4.5.2/gcc/ada/s-filofl.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-filofl.ads Fri Jun 18 12:32:53 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2005,2009 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- diff -Nrcpad gcc-4.5.2/gcc/ada/s-finimp.adb gcc-4.6.0/gcc/ada/s-finimp.adb *** gcc-4.5.2/gcc/ada/s-finimp.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-finimp.adb Mon Jun 14 12:46:56 2010 *************** package body System.Finalization_Impleme *** 332,341 **** P : Finalizable_Ptr := L; Q : Finalizable_Ptr; ! type Fake_Exception_Occurence is record Id : Exception_Id; end record; ! type Ptr is access all Fake_Exception_Occurence; function To_Ptr is new Ada.Unchecked_Conversion (Exception_Occurrence_Access, Ptr); --- 332,341 ---- P : Finalizable_Ptr := L; Q : Finalizable_Ptr; ! type Fake_Exception_Occurrence is record Id : Exception_Id; end record; ! type Ptr is access all Fake_Exception_Occurrence; function To_Ptr is new Ada.Unchecked_Conversion (Exception_Occurrence_Access, Ptr); diff -Nrcpad gcc-4.5.2/gcc/ada/s-htable.adb gcc-4.6.0/gcc/ada/s-htable.adb *** gcc-4.5.2/gcc/ada/s-htable.adb Mon Jun 22 12:24:57 2009 --- gcc-4.6.0/gcc/ada/s-htable.adb Mon Oct 11 10:43:04 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1995-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1995-2010, 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- -- *************** package body System.HTable is *** 110,116 **** function Get_Non_Null return Elmt_Ptr is begin ! while Iterator_Ptr = Null_Ptr loop if Iterator_Index = Table'Last then Iterator_Started := False; return Null_Ptr; --- 110,116 ---- function Get_Non_Null return Elmt_Ptr is begin ! while Iterator_Ptr = Null_Ptr loop if Iterator_Index = Table'Last then Iterator_Started := False; return Null_Ptr; *************** package body System.HTable is *** 246,251 **** --- 246,262 ---- end if; end Get_First; + procedure Get_First (K : in out Key; E : out Element) is + Tmp : constant Elmt_Ptr := Tab.Get_First; + begin + if Tmp = null then + E := No_Element; + else + K := Tmp.K; + E := Tmp.E; + end if; + end Get_First; + ------------- -- Get_Key -- ------------- *************** package body System.HTable is *** 269,274 **** --- 280,296 ---- end if; end Get_Next; + procedure Get_Next (K : in out Key; E : out Element) is + Tmp : constant Elmt_Ptr := Tab.Get_Next; + begin + if Tmp = null then + E := No_Element; + else + K := Tmp.K; + E := Tmp.E; + end if; + end Get_Next; + ---------- -- Next -- ---------- diff -Nrcpad gcc-4.5.2/gcc/ada/s-htable.ads gcc-4.6.0/gcc/ada/s-htable.ads *** gcc-4.5.2/gcc/ada/s-htable.ads Wed Jul 15 09:42:04 2009 --- gcc-4.6.0/gcc/ada/s-htable.ads Mon Oct 11 10:43:04 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2010, 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- -- *************** package System.HTable is *** 80,86 **** function Get (K : Key) return Element; -- Returns the Element associated with a key or No_Element if the ! -- given key has not associated element procedure Remove (K : Key); -- Removes the latest inserted element pointer associated with the --- 80,86 ---- function Get (K : Key) return Element; -- Returns the Element associated with a key or No_Element if the ! -- given key has no associated element. procedure Remove (K : Key); -- Removes the latest inserted element pointer associated with the *************** package System.HTable is *** 94,101 **** function Get_Next return Element; -- Returns a non-specified element that has not been returned by the -- same function since the last call to Get_First or No_Element if ! -- there is no such element. If there is no call to 'Set' in between -- Get_Next calls, all the elements of the HTable will be traversed. end Simple_HTable; ------------------- --- 94,117 ---- function Get_Next return Element; -- Returns a non-specified element that has not been returned by the -- same function since the last call to Get_First or No_Element if ! -- there is no such element. If there is no call to Set in between ! -- Get_Next calls, all the elements of the HTable will be traversed. ! ! procedure Get_First (K : in out Key; E : out Element); ! -- This version of the iterator returns a key/element pair. A non- ! -- specified entry is returned, and there is no guarantee that two ! -- calls to this procedure will return the same element. If the table ! -- is empty, E is set to No_Element, and K is unchanged, otherwise ! -- K and E are set to the first returned entry. ! ! procedure Get_Next (K : in out Key; E : out Element); ! -- This version of the iterator returns a key/element pair. It returns ! -- a non-specified element that has not been returned since the last ! -- call to Get_First. If there is no remaining element, then E is set ! -- to No_Element, and the value in K is unchanged, otherwise K and E ! -- are set to the next entry. If there is no call to Set in between -- Get_Next calls, all the elements of the HTable will be traversed. + end Simple_HTable; ------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/s-imgcha.adb gcc-4.6.0/gcc/ada/s-imgcha.adb *** gcc-4.5.2/gcc/ada/s-imgcha.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/s-imgcha.adb Fri Oct 8 12:34:08 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Img_Char is *** 158,161 **** --- 158,180 ---- end if; end Image_Character; + ------------------------ + -- Image_Character_05 -- + ------------------------ + + procedure Image_Character_05 + (V : Character; + S : in out String; + P : out Natural) + is + pragma Assert (S'First = 1); + begin + if V = Character'Val (16#00AD#) then + P := 11; + S (1 .. P) := "SOFT_HYPHEN"; + else + Image_Character (V, S, P); + end if; + end Image_Character_05; + end System.Img_Char; diff -Nrcpad gcc-4.5.2/gcc/ada/s-imgcha.ads gcc-4.6.0/gcc/ada/s-imgcha.ads *** gcc-4.5.2/gcc/ada/s-imgcha.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-imgcha.ads Fri Oct 8 12:34:08 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Img_Char is *** 42,45 **** --- 42,55 ---- -- setting the resulting value of P. The caller guarantees that S is -- long enough to hold the result, and that S'First is 1. + procedure Image_Character_05 + (V : Character; + S : in out String; + P : out Natural); + -- Computes Character'Image (V) and stores the result in S (1 .. P) + -- setting the resulting value of P. The caller guarantees that S is + -- long enough to hold the result, and that S'First is 1. This version + -- is for use in Ada 2005 and beyond, where soft hyphen is a non-graphic + -- and results in "SOFT_HYPHEN" as the output. + end System.Img_Char; diff -Nrcpad gcc-4.5.2/gcc/ada/s-imgwch.adb gcc-4.6.0/gcc/ada/s-imgwch.adb *** gcc-4.5.2/gcc/ada/s-imgwch.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-imgwch.adb Fri Oct 8 12:34:08 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Img_WChar is *** 61,66 **** --- 61,76 ---- P := 4; + -- Deal with annoying Ada 95 incompatibility with soft hyphen + + elsif V = Wide_Character'Val (16#00AD#) + and then not Ada_2005 + then + P := 3; + S (1) := '''; + S (2) := Character'Val (16#00AD#); + S (3) := '''; + -- Normal case, same as Wide_Wide_Character else *************** package body System.Img_WChar is *** 83,92 **** Val : Unsigned_32 := Wide_Wide_Character'Pos (V); begin ! -- If in range of standard Character, use Character routine if Val <= 16#FF# then ! Image_Character (Character'Val (Wide_Wide_Character'Pos (V)), S, P); -- Otherwise value returned is Hex_hhhhhhhh --- 93,106 ---- Val : Unsigned_32 := Wide_Wide_Character'Pos (V); begin ! -- If in range of standard Character, use Character routine. Use the ! -- Ada 2005 version, since either we are called directly in Ada 2005 ! -- mode for Wide_Wide_Character, or this is the Wide_Character case ! -- which already took care of the Soft_Hyphen glitch. if Val <= 16#FF# then ! Image_Character_05 ! (Character'Val (Wide_Wide_Character'Pos (V)), S, P); -- Otherwise value returned is Hex_hhhhhhhh diff -Nrcpad gcc-4.5.2/gcc/ada/s-interr.adb gcc-4.6.0/gcc/ada/s-interr.adb *** gcc-4.5.2/gcc/ada/s-interr.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-interr.adb Thu Jun 17 13:14:44 2010 *************** package body System.Interrupts is *** 367,377 **** -------------- procedure Finalize (Object : in out Static_Interrupt_Protection) is begin -- ??? loop to be executed only when we're not doing library level -- finalization, since in this case all interrupt tasks are gone. ! if not Interrupt_Manager'Terminated then for N in reverse Object.Previous_Handlers'Range loop Interrupt_Manager.Attach_Handler (New_Handler => Object.Previous_Handlers (N).Handler, --- 367,393 ---- -------------- procedure Finalize (Object : in out Static_Interrupt_Protection) is + function State + (Int : System.Interrupt_Management.Interrupt_ID) return Character; + pragma Import (C, State, "__gnat_get_interrupt_state"); + -- Get interrupt state for interrupt number Int. Defined in init.c + + Default : constant Character := 's'; + -- 's' Interrupt_State pragma set state to System (use "default" + -- system handler) + begin -- ??? loop to be executed only when we're not doing library level -- finalization, since in this case all interrupt tasks are gone. ! -- If the Abort_Task signal is set to system, it means that we cannot ! -- reset interrupt handlers since this would require sending the abort ! -- signal to the Server_Task ! ! if not Interrupt_Manager'Terminated ! and then State (System.Interrupt_Management.Abort_Task_Interrupt) ! /= Default ! then for N in reverse Object.Previous_Handlers'Range loop Interrupt_Manager.Attach_Handler (New_Handler => Object.Previous_Handlers (N).Handler, diff -Nrcpad gcc-4.5.2/gcc/ada/s-intman-vxworks.ads gcc-4.6.0/gcc/ada/s-intman-vxworks.ads *** gcc-4.5.2/gcc/ada/s-intman-vxworks.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-intman-vxworks.ads Tue Jun 22 08:49:11 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Interrupt_Management is *** 59,66 **** type Interrupt_Set is array (Interrupt_ID) of Boolean; ! subtype Signal_ID is Interrupt_ID ! range 0 .. Interfaces.C."-" (System.OS_Interface.NSIG, 1); type Signal_Set is array (Signal_ID) of Boolean; --- 59,65 ---- type Interrupt_Set is array (Interrupt_ID) of Boolean; ! subtype Signal_ID is Interrupt_ID range 0 .. System.OS_Interface.NSIG - 1; type Signal_Set is array (Signal_ID) of Boolean; *************** package System.Interrupt_Management is *** 74,80 **** -- convention that ID zero is not used for any "real" signals, and SIGRARE -- = 0 when SIGRARE is not one of the locally supported signals, we can -- write: ! -- Reserved (SIGRARE) := true; -- and the initialization code will be portable. Abort_Task_Interrupt : Signal_ID; --- 73,79 ---- -- convention that ID zero is not used for any "real" signals, and SIGRARE -- = 0 when SIGRARE is not one of the locally supported signals, we can -- write: ! -- Reserved (SIGRARE) := True; -- and the initialization code will be portable. Abort_Task_Interrupt : Signal_ID; diff -Nrcpad gcc-4.5.2/gcc/ada/s-multip.adb gcc-4.6.0/gcc/ada/s-multip.adb *** gcc-4.5.2/gcc/ada/s-multip.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/s-multip.adb Mon Oct 11 07:30:09 2010 *************** *** 0 **** --- 1,45 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- S Y S T E M . M U L T I P R O C E S S O R S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + ------------------------------------------------------------------------------ + + with Interfaces.C; use Interfaces.C; + + package body System.Multiprocessors is + + function Gnat_Number_Of_CPUs return int; + pragma Import (C, Gnat_Number_Of_CPUs, "__gnat_number_of_cpus"); + + -------------------- + -- Number_Of_CPUs -- + -------------------- + + function Number_Of_CPUs return CPU is + begin + return CPU (Gnat_Number_Of_CPUs); + end Number_Of_CPUs; + + end System.Multiprocessors; diff -Nrcpad gcc-4.5.2/gcc/ada/s-multip.ads gcc-4.6.0/gcc/ada/s-multip.ads *** gcc-4.5.2/gcc/ada/s-multip.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/s-multip.ads Mon Oct 11 07:30:09 2010 *************** *** 0 **** --- 1,28 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- S Y S T E M . M U L T I P R O C E S S O R S -- + -- -- + -- 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. -- + -- -- + ------------------------------------------------------------------------------ + + package System.Multiprocessors is + pragma Preelaborate (Multiprocessors); + + type CPU_Range is range 0 .. 2 ** 16 - 1; + + subtype CPU is CPU_Range range 1 .. CPU_Range'Last; + + Not_A_Specific_CPU : constant CPU_Range := 0; + + function Number_Of_CPUs return CPU; + -- Number of available CPUs + + end System.Multiprocessors; diff -Nrcpad gcc-4.5.2/gcc/ada/s-os_lib.adb gcc-4.6.0/gcc/ada/s-os_lib.adb *** gcc-4.5.2/gcc/ada/s-os_lib.adb Tue Oct 27 13:51:46 2009 --- gcc-4.6.0/gcc/ada/s-os_lib.adb Thu Jun 17 12:26:10 2010 *************** package body System.OS_Lib is *** 2309,2316 **** N : Integer) return Integer is begin ! return Integer (System.CRTL.read ! (System.CRTL.int (FD), System.CRTL.chars (A), System.CRTL.int (N))); end Read; ----------------- --- 2309,2319 ---- N : Integer) return Integer is begin ! return ! Integer (System.CRTL.read ! (System.CRTL.int (FD), ! System.CRTL.chars (A), ! System.CRTL.size_t (N))); end Read; ----------------- *************** package body System.OS_Lib is *** 2718,2725 **** N : Integer) return Integer is begin ! return Integer (System.CRTL.write ! (System.CRTL.int (FD), System.CRTL.chars (A), System.CRTL.int (N))); end Write; end System.OS_Lib; --- 2721,2731 ---- N : Integer) return Integer is begin ! return ! Integer (System.CRTL.write ! (System.CRTL.int (FD), ! System.CRTL.chars (A), ! System.CRTL.size_t (N))); end Write; end System.OS_Lib; diff -Nrcpad gcc-4.5.2/gcc/ada/s-os_lib.ads gcc-4.6.0/gcc/ada/s-os_lib.ads *** gcc-4.5.2/gcc/ada/s-os_lib.ads Tue Oct 27 13:51:46 2009 --- gcc-4.6.0/gcc/ada/s-os_lib.ads Fri Sep 10 15:14:10 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1995-2010, 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- -- *************** package System.OS_Lib is *** 203,210 **** (Name : String; Fmode : Mode) return File_Descriptor; -- Creates new file with given name for writing, returning file descriptor ! -- for subsequent use in Write calls. File descriptor returned is ! -- Invalid_FD if file cannot be successfully created. function Create_Output_Text_File (Name : String) return File_Descriptor; -- Creates new text file with given name suitable to redirect standard --- 203,211 ---- (Name : String; Fmode : Mode) return File_Descriptor; -- Creates new file with given name for writing, returning file descriptor ! -- for subsequent use in Write calls. If the file already exists, it is ! -- overwritten. File descriptor returned is Invalid_FD if file cannot be ! -- successfully created. function Create_Output_Text_File (Name : String) return File_Descriptor; -- Creates new text file with given name suitable to redirect standard *************** package System.OS_Lib is *** 687,695 **** -- (notably Unix systems) a simple file name may also work (if the -- executable can be located in the path). -- ! -- "Spawn" should be avoided in tasking applications, since there are ! -- subtle interactions between creating a process and signals/locks ! -- that can cause troubles. -- -- Note: Arguments in Args that contain spaces and/or quotes such as -- "--GCC=gcc -v" or "--GCC=""gcc -v""" are not portable across all --- 688,695 ---- -- (notably Unix systems) a simple file name may also work (if the -- executable can be located in the path). -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. -- -- Note: Arguments in Args that contain spaces and/or quotes such as -- "--GCC=gcc -v" or "--GCC=""gcc -v""" are not portable across all *************** package System.OS_Lib is *** 716,722 **** -- by the operating system, or -1 under VxWorks and any other similar -- operating systems which have no notion of separately spawnable programs. -- ! -- "Spawn" should not be used in tasking applications. procedure Spawn (Program_Name : String; --- 716,723 ---- -- by the operating system, or -1 under VxWorks and any other similar -- operating systems which have no notion of separately spawnable programs. -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. procedure Spawn (Program_Name : String; *************** package System.OS_Lib is *** 729,735 **** -- Standard Error output is also redirected. -- Return_Code is set to the status code returned by the operating system -- ! -- "Spawn" should not be used in tasking applications. procedure Spawn (Program_Name : String; --- 730,737 ---- -- Standard Error output is also redirected. -- Return_Code is set to the status code returned by the operating system -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. procedure Spawn (Program_Name : String; *************** package System.OS_Lib is *** 746,752 **** -- will be set to the status code returned by the operating system. -- Otherwise, Return_Code is undefined. -- ! -- "Spawn" should not be used in tasking applications. type Process_Id is private; -- A private type used to identify a process activated by the following --- 748,755 ---- -- will be set to the status code returned by the operating system. -- Otherwise, Return_Code is undefined. -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. type Process_Id is private; -- A private type used to identify a process activated by the following *************** package System.OS_Lib is *** 767,773 **** -- returned. Parameters are to be used as in Spawn. If Invalid_Pid is -- returned the program could not be spawned. -- ! -- "Non_Blocking_Spawn" should not be used in tasking applications. -- -- This function will always return Invalid_Pid under VxWorks, since there -- is no notion of executables under this OS. --- 770,777 ---- -- returned. Parameters are to be used as in Spawn. If Invalid_Pid is -- returned the program could not be spawned. -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. -- -- This function will always return Invalid_Pid under VxWorks, since there -- is no notion of executables under this OS. *************** package System.OS_Lib is *** 782,788 **** -- Standard Error output is also redirected. Invalid_Pid is returned -- if the program could not be spawned successfully. -- ! -- "Non_Blocking_Spawn" should not be used in tasking applications. -- -- This function will always return Invalid_Pid under VxWorks, since there -- is no notion of executables under this OS. --- 786,793 ---- -- Standard Error output is also redirected. Invalid_Pid is returned -- if the program could not be spawned successfully. -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. -- -- This function will always return Invalid_Pid under VxWorks, since there -- is no notion of executables under this OS. *************** package System.OS_Lib is *** 800,806 **** -- file could not be created or if the program could not be spawned -- successfully. -- ! -- "Non_Blocking_Spawn" should not be used in tasking applications. -- -- This function will always return Invalid_Pid under VxWorks, since there -- is no notion of executables under this OS. --- 805,812 ---- -- file could not be created or if the program could not be spawned -- successfully. -- ! -- Spawning processes from tasking programs is not recommended. See ! -- "NOTE: Spawn in tasking programs" below. -- -- This function will always return Invalid_Pid under VxWorks, since there -- is no notion of executables under this OS. *************** package System.OS_Lib is *** 826,831 **** --- 832,901 ---- -- be freed by the programmer (when it is no longer needed) to avoid -- memory leaks. + ------------------------------------- + -- NOTE: Spawn in Tasking Programs -- + ------------------------------------- + + -- Spawning processes in tasking programs using the above Spawn and + -- Non_Blocking_Spawn subprograms is not recommended, because there are + -- subtle interactions between creating a process and signals/locks that + -- can cause trouble. These issues are not specific to Ada; they depend + -- primarily on the operating system. + + -- If you need to spawn processes in a tasking program, you will need to + -- understand the semantics of your operating system, and you are likely to + -- write non-portable code, because operating systems differ in this area. + + -- The Spawn and Non_Blocking_Spawn subprograms call the following + -- operating system functions: + + -- On Windows: spawnvp (blocking) or CreateProcess (non-blocking) + + -- On Solaris: fork1, followed in the child process by execv + + -- On other Unix-like systems, and on VMS: fork, followed in the child + -- process by execv. + + -- On vxworks, nucleus, and RTX, spawning of processes is not supported + + -- For details, look at the functions __gnat_portable_spawn and + -- __gnat_portable_no_block_spawn in adaint.c. + + -- You should read the operating-system-specific documentation for the + -- above functions, paying special attention to subtle interactions with + -- threading, signals, locks, and file descriptors. Most of the issues are + -- related to the fact that on Unix, there is a window of time between fork + -- and execv; Windows does not have this problem, because spawning is done + -- in a single operation. + + -- On Posix-compliant systems, such as Linux, fork duplicates just the + -- calling thread. (On Solaris, fork1 is the Posix-compliant version of + -- fork.) + + -- You should avoid using signals while spawning. This includes signals + -- used internally by the Ada run-time system, such as timer signals used + -- to implement delay statements. + + -- It is best to spawn any subprocesses very early, before the parent + -- process creates tasks, locks, or installs signal handlers. Certainly + -- avoid doing simultaneous spawns from multiple threads of the same + -- process. + + -- There is no problem spawning a subprocess that uses tasking: the + -- problems are caused only by tasking in the parent. + + -- If the parent is using tasking, and needs to spawn subprocesses at + -- arbitrary times, one technique is for the parent to spawn (very early) + -- a particular spawn-manager subprocess whose job is to spawn other + -- processes. The spawn-manager avoids tasking. The parent sends messages + -- to the spawn-manager requesting it to spawn processes, using whatever + -- inter-process communication mechanism you like, such as sockets. + + -- In short, mixing spawning of subprocesses with tasking is a tricky + -- business, and should be avoided if possible, but if it is necessary, + -- the above guidelines should be followed, and you should beware of + -- portability problems. + ------------------- -- Miscellaneous -- ------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/s-oscons-tmplt.c gcc-4.6.0/gcc/ada/s-oscons-tmplt.c *** gcc-4.5.2/gcc/ada/s-oscons-tmplt.c Mon Nov 30 21:12:13 2009 --- gcc-4.6.0/gcc/ada/s-oscons-tmplt.c Mon Dec 20 07:26:57 2010 *************** pragma Style_Checks ("M32766"); *** 98,103 **** --- 98,119 ---- #include #include + #if defined (__alpha__) && defined (__osf__) + /** Tru64 is unable to do vector IO operations with default value of IOV_MAX, + ** so its value is redefined to a small one which is known to work properly. + **/ + #undef IOV_MAX + #define IOV_MAX 16 + #endif + + #if defined (__VMS) + /** VMS is unable to do vector IO operations with default value of IOV_MAX, + ** so its value is redefined to a small one which is known to work properly. + **/ + #undef IOV_MAX + #define IOV_MAX 16 + #endif + #if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \ defined (__nucleus__)) # define HAVE_TERMIOS *************** CND(AF_INET, "IPv4 address family") *** 932,938 **** #endif /** ! ** Tru64 UNIX V4.0F defines AF_INET6 without IPv6 support, specificially ** without struct sockaddr_in6. We use _SS_MAXSIZE (used for the definition ** of struct sockaddr_storage on Tru64 UNIX V5.1) to detect this. **/ --- 948,954 ---- #endif /** ! ** Tru64 UNIX V4.0F defines AF_INET6 without IPv6 support, specifically ** without struct sockaddr_in6. We use _SS_MAXSIZE (used for the definition ** of struct sockaddr_storage on Tru64 UNIX V5.1) to detect this. **/ *************** CND(SIZEOF_sockaddr_in6, "struct sockadd *** 1215,1240 **** #define SIZEOF_fd_set (sizeof (fd_set)) CND(SIZEOF_fd_set, "fd_set"); #define SIZEOF_struct_servent (sizeof (struct servent)) CND(SIZEOF_struct_servent, "struct servent"); /* - -- Fields of struct hostent - */ - - #ifdef __MINGW32__ - # define h_addrtype_t "short" - # define h_length_t "short" - #else - # define h_addrtype_t "int" - # define h_length_t "int" - #endif - - TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";") - TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";") - - /* - -- Fields of struct msghdr */ --- 1231,1243 ---- #define SIZEOF_fd_set (sizeof (fd_set)) CND(SIZEOF_fd_set, "fd_set"); + #define SIZEOF_struct_hostent (sizeof (struct hostent)) + CND(SIZEOF_struct_hostent, "struct hostent"); + #define SIZEOF_struct_servent (sizeof (struct servent)) CND(SIZEOF_struct_servent, "struct servent"); /* -- Fields of struct msghdr */ *************** TXT(" subtype Msg_Iovlen_T is Interfac *** 1255,1260 **** --- 1258,1264 ---- */ CND(Need_Netdb_Buffer, "Need buffer for Netdb ops") + CND(Need_Netdb_Lock, "Need lock for Netdb ops") CND(Has_Sockaddr_Len, "Sockaddr has sa_len field") /** diff -Nrcpad gcc-4.5.2/gcc/ada/s-osinte-hpux-dce.ads gcc-4.6.0/gcc/ada/s-osinte-hpux-dce.ads *** gcc-4.5.2/gcc/ada/s-osinte-hpux-dce.ads Mon Nov 23 14:56:58 2009 --- gcc-4.6.0/gcc/ada/s-osinte-hpux-dce.ads Fri Jun 18 12:32:53 2010 *************** *** 7,13 **** -- 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- -- --- 7,13 ---- -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2009, 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 -Nrcpad gcc-4.5.2/gcc/ada/s-osinte-linux.ads gcc-4.6.0/gcc/ada/s-osinte-linux.ads *** gcc-4.5.2/gcc/ada/s-osinte-linux.ads Mon Nov 23 14:56:58 2009 --- gcc-4.6.0/gcc/ada/s-osinte-linux.ads Sat Nov 27 18:34:52 2010 *************** *** 7,13 **** -- 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- -- --- 7,13 ---- -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2010, 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- -- *************** package System.OS_Interface is *** 490,500 **** (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 .. 127) of Interfaces.C.unsigned_char; pragma Convention (C, sigset_t); for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; --- 490,513 ---- (thread : pthread_t; cpusetsize : size_t; cpuset : access cpu_set_t) return int; ! pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np"); ! pragma Weak_External (pthread_setaffinity_np); ! -- Use a weak symbol because this function may be available or not, ! -- depending on the version of the system. ! ! function pthread_attr_setaffinity_np ! (attr : access pthread_attr_t; ! cpusetsize : size_t; ! cpuset : access cpu_set_t) return int; ! pragma Import (C, pthread_attr_setaffinity_np, ! "pthread_attr_setaffinity_np"); ! pragma Weak_External (pthread_attr_setaffinity_np); ! -- Use a weak symbol because this function may be available or not, ! -- depending on the version of the system. private ! type sigset_t is array (0 .. 127) of unsigned_char; pragma Convention (C, sigset_t); for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; *************** private *** 543,550 **** --- 556,567 ---- type pthread_mutex_t is new System.Linux.pthread_mutex_t; + type unsigned_long_long_t is mod 2 ** 64; + -- Interfaces.C.Extensions isn't preelaborated so cannot be with-ed + type pthread_cond_t is array (0 .. 47) of unsigned_char; pragma Convention (C, pthread_cond_t); + for pthread_cond_t'Alignment use unsigned_long_long_t'Alignment; type pthread_key_t is new unsigned; diff -Nrcpad gcc-4.5.2/gcc/ada/s-osinte-vxworks.adb gcc-4.6.0/gcc/ada/s-osinte-vxworks.adb *** gcc-4.5.2/gcc/ada/s-osinte-vxworks.adb Wed Apr 15 12:43:58 2009 --- gcc-4.6.0/gcc/ada/s-osinte-vxworks.adb Tue Oct 5 09:37:44 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2010, 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- -- *************** package body System.OS_Interface is *** 229,234 **** --- 229,243 ---- Parameter); end Interrupt_Connect; + ----------------------- + -- Interrupt_Context -- + ----------------------- + + function Interrupt_Context return int is + begin + return System.VxWorks.Ext.Interrupt_Context; + end Interrupt_Context; + -------------------------------- -- Interrupt_Number_To_Vector -- -------------------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/s-osinte-vxworks.ads gcc-4.6.0/gcc/ada/s-osinte-vxworks.ads *** gcc-4.5.2/gcc/ada/s-osinte-vxworks.ads Wed Jun 24 09:41:39 2009 --- gcc-4.6.0/gcc/ada/s-osinte-vxworks.ads Mon Dec 20 07:26:57 2010 *************** *** 7,13 **** -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2009, 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- -- --- 7,13 ---- -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2010, 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- -- *************** package System.OS_Interface is *** 471,480 **** Handler : Interrupt_Handler; Parameter : System.Address := System.Null_Address) return int; pragma Inline (Interrupt_Connect); ! -- Use this to set up an user handler. The routine installs a a user -- handler which is invoked after the OS has saved enough context for a -- high-level language routine to be safely invoked. function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Inline (Interrupt_Number_To_Vector); -- Convert a logical interrupt number to the hardware interrupt vector --- 471,485 ---- Handler : Interrupt_Handler; Parameter : System.Address := System.Null_Address) return int; pragma Inline (Interrupt_Connect); ! -- Use this to set up an user handler. The routine installs a user -- handler which is invoked after the OS has saved enough context for a -- high-level language routine to be safely invoked. + function Interrupt_Context return int; + pragma Inline (Interrupt_Context); + -- Return 1 if executing in an interrupt context; return 0 if executing in + -- a task context. + function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Inline (Interrupt_Number_To_Vector); -- Convert a logical interrupt number to the hardware interrupt vector *************** package System.OS_Interface is *** 490,497 **** -- For uniprocessor systems return ERROR status. private - type sigset_t is new unsigned_long_long; - type pid_t is new int; ERROR_PID : constant pid_t := -1; --- 495,500 ---- *************** private *** 499,502 **** --- 502,506 ---- type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; + type sigset_t is new System.VxWorks.Ext.sigset_t; end System.OS_Interface; diff -Nrcpad gcc-4.5.2/gcc/ada/s-osprim-mingw.adb gcc-4.6.0/gcc/ada/s-osprim-mingw.adb *** gcc-4.5.2/gcc/ada/s-osprim-mingw.adb Tue Jan 26 09:42:04 2010 --- gcc-4.6.0/gcc/ada/s-osprim-mingw.adb Mon Dec 20 07:26:57 2010 *************** package body System.OS_Primitives is *** 193,201 **** GetSystemTimeAsFileTime (Ctrl_Time'Access); ! -- Scan for clock tick, will take upto 16ms/1ms depending on PC. -- This cannot be an infinite loop or the system hardware is badly ! -- dammaged. loop GetSystemTimeAsFileTime (Loc_Time'Access); --- 193,201 ---- GetSystemTimeAsFileTime (Ctrl_Time'Access); ! -- Scan for clock tick, will take up to 16ms/1ms depending on PC. -- This cannot be an infinite loop or the system hardware is badly ! -- damaged. loop GetSystemTimeAsFileTime (Loc_Time'Access); diff -Nrcpad gcc-4.5.2/gcc/ada/s-pooglo.ads gcc-4.6.0/gcc/ada/s-pooglo.ads *** gcc-4.5.2/gcc/ada/s-pooglo.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-pooglo.ads Fri Sep 10 13:56:18 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Pool_Global is *** 57,69 **** (Pool : Unbounded_No_Reclaim_Pool) return System.Storage_Elements.Storage_Count; ! procedure Allocate (Pool : in out Unbounded_No_Reclaim_Pool; Address : out System.Address; Storage_Size : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count); ! procedure Deallocate (Pool : in out Unbounded_No_Reclaim_Pool; Address : System.Address; Storage_Size : System.Storage_Elements.Storage_Count; --- 57,69 ---- (Pool : Unbounded_No_Reclaim_Pool) return System.Storage_Elements.Storage_Count; ! overriding procedure Allocate (Pool : in out Unbounded_No_Reclaim_Pool; Address : out System.Address; Storage_Size : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count); ! overriding procedure Deallocate (Pool : in out Unbounded_No_Reclaim_Pool; Address : System.Address; Storage_Size : System.Storage_Elements.Storage_Count; diff -Nrcpad gcc-4.5.2/gcc/ada/s-rannum.adb gcc-4.6.0/gcc/ada/s-rannum.adb *** gcc-4.5.2/gcc/ada/s-rannum.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-rannum.adb Wed Jun 23 06:21:26 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2007,2009 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2007-2010, 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,129 **** -- -- ------------------------------------------------------------------------------ ! with Ada.Calendar; use Ada.Calendar; with Ada.Unchecked_Conversion; ! with Interfaces; use Interfaces; use Ada; package body System.Random_Numbers is ! ------------------------- ! -- Implementation Note -- ! ------------------------- ! -- The design of this spec is very awkward, as a result of Ada 95 not ! -- permitting in-out parameters for function formals (most naturally, ! -- Generator values would be passed this way). In pure Ada 95, the only ! -- solution is to use the heap and pointers, and, to avoid memory leaks, ! -- controlled types. ! -- This is awfully heavy, so what we do is to use Unrestricted_Access to ! -- get a pointer to the state in the passed Generator. This works because ! -- Generator is a limited type and will thus always be passed by reference. ! Low31_Mask : constant := 2**31-1; ! Bit31_Mask : constant := 2**31; ! Matrix_A_X : constant array (State_Val range 0 .. 1) of State_Val := ! (0, 16#9908b0df#); ! Y2K : constant Calendar.Time := ! Calendar.Time_Of ! (Year => 2000, Month => 1, Day => 1, Seconds => 0.0); ! -- First Year 2000 day ! subtype Image_String is String (1 .. Max_Image_Width); ! -- Utility functions ! procedure Init (Gen : out Generator; Initiator : Unsigned_32); -- Perform a default initialization of the state of Gen. The resulting -- state is identical for identical values of Initiator. --- 86,159 ---- -- -- ------------------------------------------------------------------------------ ! with Ada.Calendar; use Ada.Calendar; with Ada.Unchecked_Conversion; ! ! with Interfaces; use Interfaces; use Ada; package body System.Random_Numbers is ! Y2K : constant Calendar.Time := ! Calendar.Time_Of ! (Year => 2000, Month => 1, Day => 1, Seconds => 0.0); ! -- First day of Year 2000 (what is this for???) ! Image_Numeral_Length : constant := Max_Image_Width / N; ! subtype Image_String is String (1 .. Max_Image_Width); ! ---------------------------- ! -- Algorithmic Parameters -- ! ---------------------------- ! Lower_Mask : constant := 2**31-1; ! Upper_Mask : constant := 2**31; ! Matrix_A : constant array (State_Val range 0 .. 1) of State_Val ! := (0, 16#9908b0df#); ! -- The twist transformation is represented by a matrix of the form ! -- ! -- [ 0 I(31) ] ! -- [ _a ] ! -- ! -- where 0 is a 31x31 block of 0s, I(31) is the 31x31 identity matrix and ! -- _a is a particular bit row-vector, represented here by a 32-bit integer. ! -- If integer x represents a row vector of bits (with x(0), the units bit, ! -- last), then ! -- x * A = [0 x(31..1)] xor Matrix_A(x(0)). ! U : constant := 11; ! S : constant := 7; ! B_Mask : constant := 16#9d2c5680#; ! T : constant := 15; ! C_Mask : constant := 16#efc60000#; ! L : constant := 18; ! -- The tempering shifts and bit masks, in the order applied ! Seed0 : constant := 5489; ! -- Default seed, used to initialize the state vector when Reset not called ! Seed1 : constant := 19650218; ! -- Seed used to initialize the state vector when calling Reset with an ! -- initialization vector. ! Mult0 : constant := 1812433253; ! -- Multiplier for a modified linear congruential generator used to ! -- initialize the state vector when calling Reset with a single integer ! -- seed. ! ! Mult1 : constant := 1664525; ! Mult2 : constant := 1566083941; ! -- Multipliers for two modified linear congruential generators used to ! -- initialize the state vector when calling Reset with an initialization ! -- vector. ! ! ----------------------- ! -- Local Subprograms -- ! ----------------------- ! ! procedure Init (Gen : Generator; Initiator : Unsigned_32); -- Perform a default initialization of the state of Gen. The resulting -- state is identical for identical values of Initiator. *************** package body System.Random_Numbers is *** 147,221 **** ------------ function Random (Gen : Generator) return Unsigned_32 is ! G : Generator renames Gen'Unrestricted_Access.all; Y : State_Val; ! I : Integer; begin I := G.I; if I < N - M then ! Y := (G.S (I) and Bit31_Mask) or (G.S (I + 1) and Low31_Mask); ! Y := G.S (I + M) xor Shift_Right (Y, 1) xor Matrix_A_X (Y and 1); I := I + 1; elsif I < N - 1 then ! Y := (G.S (I) and Bit31_Mask) or (G.S (I + 1) and Low31_Mask); Y := G.S (I + (M - N)) xor Shift_Right (Y, 1) ! xor Matrix_A_X (Y and 1); I := I + 1; elsif I = N - 1 then ! Y := (G.S (I) and Bit31_Mask) or (G.S (0) and Low31_Mask); ! Y := G.S (M - 1) xor Shift_Right (Y, 1) xor Matrix_A_X (Y and 1); I := 0; else ! Init (G, 5489); return Random (Gen); end if; G.S (G.I) := Y; G.I := I; ! Y := Y xor Shift_Right (Y, 11); ! Y := Y xor (Shift_Left (Y, 7) and 16#9d2c5680#); ! Y := Y xor (Shift_Left (Y, 15) and 16#efc60000#); ! Y := Y xor Shift_Right (Y, 18); return Y; end Random; ! function Random (Gen : Generator) return Float is ! -- Note: The application of Float'Machine (...) is necessary to avoid ! -- returning extra significand bits. Without it, the function's value ! -- will change if it is spilled, for example, causing ! -- gratuitous nondeterminism. - Result : constant Float := - Float'Machine - (Float (Unsigned_32'(Random (Gen))) * 2.0 ** (-32)); begin ! if Result < 1.0 then ! return Result; else ! return Float'Adjacent (1.0, 0.0); end if; end Random; function Random (Gen : Generator) return Long_Float is ! Result : constant Long_Float := ! Long_Float'Machine ((Long_Float (Unsigned_32'(Random (Gen))) ! * 2.0 ** (-32)) ! + (Long_Float (Unsigned_32'(Random (Gen))) * 2.0 ** (-64))); begin ! if Result < 1.0 then ! return Result; ! else ! return Long_Float'Adjacent (1.0, 0.0); ! end if; end Random; function Random (Gen : Generator) return Unsigned_64 is --- 177,384 ---- ------------ function Random (Gen : Generator) return Unsigned_32 is ! G : Generator renames Gen.Writable.Self.all; Y : State_Val; ! I : Integer; -- should avoid use of identifier I ??? begin I := G.I; if I < N - M then ! Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask); ! Y := G.S (I + M) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1); I := I + 1; elsif I < N - 1 then ! Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask); Y := G.S (I + (M - N)) xor Shift_Right (Y, 1) ! xor Matrix_A (Y and 1); I := I + 1; elsif I = N - 1 then ! Y := (G.S (I) and Upper_Mask) or (G.S (0) and Lower_Mask); ! Y := G.S (M - 1) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1); I := 0; else ! Init (G, Seed0); return Random (Gen); end if; G.S (G.I) := Y; G.I := I; ! Y := Y xor Shift_Right (Y, U); ! Y := Y xor (Shift_Left (Y, S) and B_Mask); ! Y := Y xor (Shift_Left (Y, T) and C_Mask); ! Y := Y xor Shift_Right (Y, L); return Y; end Random; ! generic ! type Unsigned is mod <>; ! type Real is digits <>; ! with function Random (G : Generator) return Unsigned is <>; ! function Random_Float_Template (Gen : Generator) return Real; ! pragma Inline (Random_Float_Template); ! -- Template for a random-number generator implementation that delivers ! -- values of type Real in the range [0 .. 1], using values from Gen, ! -- assuming that Unsigned is large enough to hold the bits of a mantissa ! -- for type Real. ! --------------------------- ! -- Random_Float_Template -- ! --------------------------- ! ! function Random_Float_Template (Gen : Generator) return Real is ! ! pragma Compile_Time_Error ! (Unsigned'Last <= 2**(Real'Machine_Mantissa - 1), ! "insufficiently large modular type used to hold mantissa"); begin ! -- This code generates random floating-point numbers from unsigned ! -- integers. Assuming that Real'Machine_Radix = 2, it can deliver all ! -- machine values of type Real (as implied by Real'Machine_Mantissa and ! -- Real'Machine_Emin), which is not true of the standard method (to ! -- which we fall back for non-binary radix): computing Real() / (+1). To do so, we first extract an ! -- (M-1)-bit significand (where M is Real'Machine_Mantissa), and then ! -- decide on a normalized exponent by repeated coin flips, decrementing ! -- from 0 as long as we flip heads (1 bits). This process yields the ! -- proper geometric distribution for the exponent: in a uniformly ! -- distributed set of floating-point numbers, 1/2 of them will be in ! -- (0.5, 1], 1/4 will be in (0.25, 0.5], and so forth. It makes a ! -- further adjustment at binade boundaries (see comments below) to give ! -- the effect of selecting a uniformly distributed real deviate in ! -- [0..1] and then rounding to the nearest representable floating-point ! -- number. The algorithm attempts to be stingy with random integers. In ! -- the worst case, it can consume roughly -Real'Machine_Emin/32 32-bit ! -- integers, but this case occurs with probability around ! -- 2**Machine_Emin, and the expected number of calls to integer-valued ! -- Random is 1. For another discussion of the issues addressed by this ! -- process, see Allen Downey's unpublished paper at ! -- http://allendowney.com/research/rand/downey07randfloat.pdf. ! ! if Real'Machine_Radix /= 2 then ! return Real'Machine ! (Real (Unsigned'(Random (Gen))) * 2.0**(-Unsigned'Size)); ! else ! declare ! type Bit_Count is range 0 .. 4; ! ! subtype T is Real'Base; ! ! Trailing_Ones : constant array (Unsigned_32 range 0 .. 15) ! of Bit_Count := ! (2#00000# => 0, 2#00001# => 1, 2#00010# => 0, 2#00011# => 2, ! 2#00100# => 0, 2#00101# => 1, 2#00110# => 0, 2#00111# => 3, ! 2#01000# => 0, 2#01001# => 1, 2#01010# => 0, 2#01011# => 2, ! 2#01100# => 0, 2#01101# => 1, 2#01110# => 0, 2#01111# => 4); ! ! Pow_Tab : constant array (Bit_Count range 0 .. 3) of Real ! := (0 => 2.0**(0 - T'Machine_Mantissa), ! 1 => 2.0**(-1 - T'Machine_Mantissa), ! 2 => 2.0**(-2 - T'Machine_Mantissa), ! 3 => 2.0**(-3 - T'Machine_Mantissa)); ! ! Extra_Bits : constant Natural := ! (Unsigned'Size - T'Machine_Mantissa + 1); ! -- Random bits left over after selecting mantissa ! ! Mantissa : Unsigned; ! ! X : Real; -- Scaled mantissa ! R : Unsigned_32; -- Supply of random bits ! R_Bits : Natural; -- Number of bits left in R ! K : Bit_Count; -- Next decrement to exponent ! ! begin ! Mantissa := Random (Gen) / 2**Extra_Bits; ! R := Unsigned_32 (Mantissa mod 2**Extra_Bits); ! R_Bits := Extra_Bits; ! X := Real (2**(T'Machine_Mantissa - 1) + Mantissa); -- Exact ! ! if Extra_Bits < 4 and then R < 2 ** Extra_Bits - 1 then ! ! -- We got lucky and got a zero in our few extra bits ! ! K := Trailing_Ones (R); ! ! else ! Find_Zero : loop ! ! -- R has R_Bits unprocessed random bits, a multiple of 4. ! -- X needs to be halved for each trailing one bit. The ! -- process stops as soon as a 0 bit is found. If R_Bits ! -- becomes zero, reload R. ! ! -- Process 4 bits at a time for speed: the two iterations ! -- on average with three tests each was still too slow, ! -- probably because the branches are not predictable. ! -- This loop now will only execute once 94% of the cases, ! -- doing more bits at a time will not help. ! ! while R_Bits >= 4 loop ! K := Trailing_Ones (R mod 16); ! ! exit Find_Zero when K < 4; -- Exits 94% of the time ! ! R_Bits := R_Bits - 4; ! X := X / 16.0; ! R := R / 16; ! end loop; ! ! -- Do not allow us to loop endlessly even in the (very ! -- unlikely) case that Random (Gen) keeps yielding all ones. ! ! exit Find_Zero when X = 0.0; ! R := Random (Gen); ! R_Bits := 32; ! end loop Find_Zero; ! end if; ! ! -- K has the count of trailing ones not reflected yet in X. The ! -- following multiplication takes care of that, as well as the ! -- correction to move the radix point to the left of the mantissa. ! -- Doing it at the end avoids repeated rounding errors in the ! -- exceedingly unlikely case of ever having a subnormal result. ! ! X := X * Pow_Tab (K); ! ! -- The smallest value in each binade is rounded to by 0.75 of ! -- the span of real numbers as its next larger neighbor, and ! -- 1.0 is rounded to by half of the span of real numbers as its ! -- next smaller neighbor. To account for this, when we encounter ! -- the smallest number in a binade, we substitute the smallest ! -- value in the next larger binade with probability 1/2. ! ! if Mantissa = 0 and then Unsigned_32'(Random (Gen)) mod 2 = 0 then ! X := 2.0 * X; ! end if; ! ! return X; ! end; end if; + end Random_Float_Template; + + ------------ + -- Random -- + ------------ + + function Random (Gen : Generator) return Float is + function F is new Random_Float_Template (Unsigned_32, Float); + begin + return F (Gen); end Random; function Random (Gen : Generator) return Long_Float is ! function F is new Random_Float_Template (Unsigned_64, Long_Float); begin ! return F (Gen); end Random; function Random (Gen : Generator) return Unsigned_64 is *************** package body System.Random_Numbers is *** 244,253 **** declare -- In the 64-bit case, we have to be careful, since not all 64-bit -- unsigned values are representable in GNAT's root_integer type. ! -- Ignore different-size warnings here; since GNAT's handling -- is correct. ! pragma Warnings ("Z"); function Conv_To_Unsigned is new Unchecked_Conversion (Result_Subtype'Base, Unsigned_64); function Conv_To_Result is --- 407,416 ---- declare -- In the 64-bit case, we have to be careful, since not all 64-bit -- unsigned values are representable in GNAT's root_integer type. ! -- Ignore different-size warnings here since GNAT's handling -- is correct. ! pragma Warnings ("Z"); -- better to use msg string! ??? function Conv_To_Unsigned is new Unchecked_Conversion (Result_Subtype'Base, Unsigned_64); function Conv_To_Result is *************** package body System.Random_Numbers is *** 320,344 **** -- Reset -- ----------- ! procedure Reset (Gen : out Generator) is ! X : constant Unsigned_32 := Unsigned_32 ((Calendar.Clock - Y2K) * 64.0); begin Init (Gen, X); end Reset; ! procedure Reset (Gen : out Generator; Initiator : Integer_32) is begin Init (Gen, To_Unsigned (Initiator)); end Reset; ! procedure Reset (Gen : out Generator; Initiator : Unsigned_32) is begin Init (Gen, Initiator); end Reset; ! procedure Reset (Gen : out Generator; Initiator : Integer) is begin ! pragma Warnings ("C"); -- This is probably an unnecessary precaution against future change, but -- since the test is a static expression, no extra code is involved. --- 483,512 ---- -- Reset -- ----------- ! procedure Reset (Gen : Generator) is ! Clock : constant Time := Calendar.Clock; ! Duration_Since_Y2K : constant Duration := Clock - Y2K; ! ! X : constant Unsigned_32 := ! Unsigned_32'Mod (Unsigned_64 (Duration_Since_Y2K) * 64); ! begin Init (Gen, X); end Reset; ! procedure Reset (Gen : Generator; Initiator : Integer_32) is begin Init (Gen, To_Unsigned (Initiator)); end Reset; ! procedure Reset (Gen : Generator; Initiator : Unsigned_32) is begin Init (Gen, Initiator); end Reset; ! procedure Reset (Gen : Generator; Initiator : Integer) is begin ! pragma Warnings (Off, "condition is always *"); -- This is probably an unnecessary precaution against future change, but -- since the test is a static expression, no extra code is involved. *************** package body System.Random_Numbers is *** 358,387 **** end; end if; ! pragma Warnings ("c"); end Reset; ! procedure Reset (Gen : out Generator; Initiator : Initialization_Vector) is I, J : Integer; begin ! Init (Gen, 19650218); I := 1; J := 0; if Initiator'Length > 0 then for K in reverse 1 .. Integer'Max (N, Initiator'Length) loop ! Gen.S (I) := ! (Gen.S (I) ! xor ((Gen.S (I - 1) xor Shift_Right (Gen.S (I - 1), 30)) ! * 1664525)) + Initiator (J + Initiator'First) + Unsigned_32 (J); I := I + 1; J := J + 1; if I >= N then ! Gen.S (0) := Gen.S (N - 1); I := 1; end if; --- 526,555 ---- end; end if; ! pragma Warnings (On, "condition is always *"); end Reset; ! procedure Reset (Gen : Generator; Initiator : Initialization_Vector) is ! G : Generator renames Gen.Writable.Self.all; I, J : Integer; begin ! Init (G, Seed1); I := 1; J := 0; if Initiator'Length > 0 then for K in reverse 1 .. Integer'Max (N, Initiator'Length) loop ! G.S (I) := ! (G.S (I) xor ((G.S (I - 1) ! xor Shift_Right (G.S (I - 1), 30)) * Mult1)) + Initiator (J + Initiator'First) + Unsigned_32 (J); I := I + 1; J := J + 1; if I >= N then ! G.S (0) := G.S (N - 1); I := 1; end if; *************** package body System.Random_Numbers is *** 392,430 **** end if; for K in reverse 1 .. N - 1 loop ! Gen.S (I) := ! (Gen.S (I) xor ((Gen.S (I - 1) ! xor Shift_Right (Gen.S (I - 1), 30)) * 1566083941)) - Unsigned_32 (I); I := I + 1; if I >= N then ! Gen.S (0) := Gen.S (N - 1); I := 1; end if; end loop; ! Gen.S (0) := Bit31_Mask; end Reset; ! procedure Reset (Gen : out Generator; From_State : Generator) is begin ! Gen.S := From_State.S; ! Gen.I := From_State.I; end Reset; ! procedure Reset (Gen : out Generator; From_State : State) is begin ! Gen.I := 0; ! Gen.S := From_State; end Reset; ! procedure Reset (Gen : out Generator; From_Image : String) is begin ! Gen.I := 0; for J in 0 .. N - 1 loop ! Gen.S (J) := Extract_Value (From_Image, J); end loop; end Reset; --- 560,601 ---- end if; for K in reverse 1 .. N - 1 loop ! G.S (I) := ! (G.S (I) xor ((G.S (I - 1) ! xor Shift_Right (G.S (I - 1), 30)) * Mult2)) - Unsigned_32 (I); I := I + 1; if I >= N then ! G.S (0) := G.S (N - 1); I := 1; end if; end loop; ! G.S (0) := Upper_Mask; end Reset; ! procedure Reset (Gen : Generator; From_State : Generator) is ! G : Generator renames Gen.Writable.Self.all; begin ! G.S := From_State.S; ! G.I := From_State.I; end Reset; ! procedure Reset (Gen : Generator; From_State : State) is ! G : Generator renames Gen.Writable.Self.all; begin ! G.I := 0; ! G.S := From_State; end Reset; ! procedure Reset (Gen : Generator; From_Image : String) is ! G : Generator renames Gen.Writable.Self.all; begin ! G.I := 0; for J in 0 .. N - 1 loop ! G.S (J) := Extract_Value (From_Image, J); end loop; end Reset; *************** package body System.Random_Numbers is *** 468,474 **** begin Result := (others => ' '); - for J in 0 .. N - 1 loop Insert_Image (Result, J, Gen.S ((J + Gen.I) mod N)); end loop; --- 639,644 ---- *************** package body System.Random_Numbers is *** 493,510 **** -- Init -- ---------- ! procedure Init (Gen : out Generator; Initiator : Unsigned_32) is begin ! Gen.S (0) := Initiator; for I in 1 .. N - 1 loop ! Gen.S (I) := ! 1812433253 ! * (Gen.S (I - 1) xor Shift_Right (Gen.S (I - 1), 30)) + Unsigned_32 (I); end loop; ! Gen.I := 0; end Init; ------------------ --- 663,680 ---- -- Init -- ---------- ! procedure Init (Gen : Generator; Initiator : Unsigned_32) is ! G : Generator renames Gen.Writable.Self.all; begin ! G.S (0) := Initiator; for I in 1 .. N - 1 loop ! G.S (I) := ! (G.S (I - 1) xor Shift_Right (G.S (I - 1), 30)) * Mult0 + Unsigned_32 (I); end loop; ! G.I := 0; end Init; ------------------ *************** package body System.Random_Numbers is *** 526,534 **** ------------------- function Extract_Value (S : String; Index : Integer) return State_Val is begin ! return State_Val'Value (S (S'First + Index * 11 .. ! S'First + Index * 11 + 11)); end Extract_Value; - end System.Random_Numbers; --- 696,703 ---- ------------------- function Extract_Value (S : String; Index : Integer) return State_Val is + Start : constant Integer := S'First + Index * Image_Numeral_Length; begin ! return State_Val'Value (S (Start .. Start + Image_Numeral_Length - 1)); end Extract_Value; end System.Random_Numbers; diff -Nrcpad gcc-4.5.2/gcc/ada/s-rannum.ads gcc-4.6.0/gcc/ada/s-rannum.ads *** gcc-4.5.2/gcc/ada/s-rannum.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-rannum.ads Wed Jun 23 05:40:52 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2007,2009 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2007-2010, 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- -- *************** package System.Random_Numbers is *** 88,114 **** -- in Reset). In general, there is little point in providing more than -- a certain number of values (currently 624). ! procedure Reset (Gen : out Generator); -- Re-initialize the state of Gen from the time of day ! procedure Reset (Gen : out Generator; Initiator : Initialization_Vector); ! procedure Reset (Gen : out Generator; Initiator : Interfaces.Integer_32); ! procedure Reset (Gen : out Generator; Initiator : Interfaces.Unsigned_32); ! procedure Reset (Gen : out Generator; Initiator : Integer); -- Re-initialize Gen based on the Initiator in various ways. Identical -- values of Initiator cause identical sequences of values. ! procedure Reset (Gen : out Generator; From_State : Generator); -- Causes the state of Gen to be identical to that of From_State; Gen -- and From_State will produce identical sequences of values subsequently. ! procedure Reset (Gen : out Generator; From_State : State); procedure Save (Gen : Generator; To_State : out State); -- The sequence -- Save (Gen2, S); Reset (Gen1, S) -- has the same effect as Reset (Gen2, Gen1). ! procedure Reset (Gen : out Generator; From_Image : String); function Image (Gen : Generator) return String; -- The call -- Reset (Gen2, Image (Gen1)) --- 88,114 ---- -- in Reset). In general, there is little point in providing more than -- a certain number of values (currently 624). ! procedure Reset (Gen : Generator); -- Re-initialize the state of Gen from the time of day ! procedure Reset (Gen : Generator; Initiator : Initialization_Vector); ! procedure Reset (Gen : Generator; Initiator : Interfaces.Integer_32); ! procedure Reset (Gen : Generator; Initiator : Interfaces.Unsigned_32); ! procedure Reset (Gen : Generator; Initiator : Integer); -- Re-initialize Gen based on the Initiator in various ways. Identical -- values of Initiator cause identical sequences of values. ! procedure Reset (Gen : Generator; From_State : Generator); -- Causes the state of Gen to be identical to that of From_State; Gen -- and From_State will produce identical sequences of values subsequently. ! procedure Reset (Gen : Generator; From_State : State); procedure Save (Gen : Generator; To_State : out State); -- The sequence -- Save (Gen2, S); Reset (Gen1, S) -- has the same effect as Reset (Gen2, Gen1). ! procedure Reset (Gen : Generator; From_Image : String); function Image (Gen : Generator) return String; -- The call -- Reset (Gen2, Image (Gen1)) *************** private *** 135,146 **** subtype State_Val is Interfaces.Unsigned_32; type State is array (0 .. N - 1) of State_Val; type Generator is limited record S : State := (others => 0); -- The shift register, a circular buffer I : Integer := N; ! -- Current starting position in shift register S end record; end System.Random_Numbers; --- 135,153 ---- subtype State_Val is Interfaces.Unsigned_32; type State is array (0 .. N - 1) of State_Val; + type Writable_Access (Self : access Generator) is limited null record; + -- Auxiliary type to make Generator a self-referential type + type Generator is limited record + Writable : Writable_Access (Generator'Access); + -- This self reference allows functions to modify Generator arguments + S : State := (others => 0); -- The shift register, a circular buffer I : Integer := N; ! -- Current starting position in shift register S (N means uninitialized) ! -- We should avoid using the identifier I here ??? end record; end System.Random_Numbers; diff -Nrcpad gcc-4.5.2/gcc/ada/s-regexp.adb gcc-4.6.0/gcc/ada/s-regexp.adb *** gcc-4.5.2/gcc/ada/s-regexp.adb Thu Jul 23 12:32:41 2009 --- gcc-4.6.0/gcc/ada/s-regexp.adb Mon Dec 20 07:26:57 2010 *************** package body System.Regexp is *** 196,213 **** Past_Elmt : Boolean := False; -- Set to True everywhere an elmt has been parsed, if Glob=False, ! -- meaning there can be now an occurence of '*', '+' and '?'. Past_Term : Boolean := False; -- Set to True everywhere a term has been parsed, if Glob=False, ! -- meaning there can be now an occurence of '|'. Parenthesis_Level : Integer := 0; Curly_Level : Integer := 0; Last_Open : Integer := S'First - 1; ! -- The last occurence of an opening parenthesis, if Glob=False, ! -- or the last occurence of an opening curly brace, if Glob=True. procedure Raise_Exception_If_No_More_Chars (K : Integer := 0); -- If no more characters are raised, call Raise_Exception --- 196,213 ---- Past_Elmt : Boolean := False; -- Set to True everywhere an elmt has been parsed, if Glob=False, ! -- meaning there can be now an occurrence of '*', '+' and '?'. Past_Term : Boolean := False; -- Set to True everywhere a term has been parsed, if Glob=False, ! -- meaning there can be now an occurrence of '|'. Parenthesis_Level : Integer := 0; Curly_Level : Integer := 0; Last_Open : Integer := S'First - 1; ! -- The last occurrence of an opening parenthesis, if Glob=False, ! -- or the last occurrence of an opening curly brace, if Glob=True. procedure Raise_Exception_If_No_More_Chars (K : Integer := 0); -- If no more characters are raised, call Raise_Exception diff -Nrcpad gcc-4.5.2/gcc/ada/s-regpat.adb gcc-4.6.0/gcc/ada/s-regpat.adb *** gcc-4.5.2/gcc/ada/s-regpat.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/s-regpat.adb Mon Jun 21 14:23:35 2010 *************** *** 7,13 **** -- B o d y -- -- -- -- Copyright (C) 1986 by University of Toronto. -- ! -- Copyright (C) 1999-2009, 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- -- --- 7,13 ---- -- B o d y -- -- -- -- Copyright (C) 1986 by University of Toronto. -- ! -- Copyright (C) 1999-2010, 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- -- *************** with Ada.Unchecked_Conversion; *** 47,58 **** package body System.Regpat is ! MAGIC : constant Character := Character'Val (10#0234#); ! -- The first byte of the regexp internal "program" is actually ! -- this magic number; the start node begins in the second byte. ! -- ! -- This is used to make sure that a regular expression was correctly ! -- compiled. ---------------------------- -- Implementation details -- --- 47,56 ---- package body System.Regpat is ! Debug : constant Boolean := False; ! -- Set to True to activate debug traces. This is normally set to constant ! -- False to simply delete all the trace code. It is to be edited to True ! -- for internal debugging of the package. ---------------------------- -- Implementation details -- *************** package body System.Regpat is *** 76,96 **** -- You can see the exact byte-compiled version by using the Dump -- subprogram. However, here are a few examples: ! -- (a|b): 1 : MAGIC ! -- 2 : BRANCH (next at 10) ! -- 5 : EXACT (next at 18) operand=a ! -- 10 : BRANCH (next at 18) ! -- 13 : EXACT (next at 18) operand=b ! -- 18 : EOP (next at 0) -- ! -- (ab)*: 1 : MAGIC ! -- 2 : CURLYX (next at 26) { 0, 32767} ! -- 9 : OPEN 1 (next at 13) ! -- 13 : EXACT (next at 19) operand=ab ! -- 19 : CLOSE 1 (next at 23) ! -- 23 : WHILEM (next at 0) ! -- 26 : NOTHING (next at 29) ! -- 29 : EOP (next at 0) -- The opcodes are: --- 74,92 ---- -- You can see the exact byte-compiled version by using the Dump -- subprogram. However, here are a few examples: ! -- (a|b): 1 : BRANCH (next at 9) ! -- 4 : EXACT (next at 17) operand=a ! -- 9 : BRANCH (next at 17) ! -- 12 : EXACT (next at 17) operand=b ! -- 17 : EOP (next at 0) -- ! -- (ab)*: 1 : CURLYX (next at 25) { 0, 32767} ! -- 8 : OPEN 1 (next at 12) ! -- 12 : EXACT (next at 18) operand=ab ! -- 18 : CLOSE 1 (next at 22) ! -- 22 : WHILEM (next at 0) ! -- 25 : NOTHING (next at 28) ! -- 28 : EOP (next at 0) -- The opcodes are: *************** package body System.Regpat is *** 186,191 **** --- 182,193 ---- -- Using two bytes for the "next" pointer is vast overkill for most -- things, but allows patterns to get big without disasters. + Next_Pointer_Bytes : constant := 3; + -- Points after the "next pointer" data. An instruction is therefore: + -- 1 byte: instruction opcode + -- 2 bytes: pointer to next instruction + -- * bytes: optional data for the instruction + ----------------------- -- Character classes -- ----------------------- *************** package body System.Regpat is *** 279,289 **** Op : out Character_Class); -- Return a pointer to the string argument of the node at P - function Get_Next_Offset - (Program : Program_Data; - IP : Pointer) return Pointer; - -- Get the offset field of a node. Used by Get_Next - function Get_Next (Program : Program_Data; IP : Pointer) return Pointer; --- 281,286 ---- *************** package body System.Regpat is *** 303,309 **** pragma Inline (Is_Alnum); pragma Inline (Is_White_Space); pragma Inline (Get_Next); - pragma Inline (Get_Next_Offset); pragma Inline (Operand); pragma Inline (Read_Natural); pragma Inline (String_Length); --- 300,305 ---- *************** package body System.Regpat is *** 318,323 **** --- 314,336 ---- Worst_Expression : constant Expression_Flags := (others => False); -- Worst case + procedure Dump_Until + (Program : Program_Data; + Index : in out Pointer; + Till : Pointer; + Indent : Natural; + Do_Print : Boolean := True); + -- Dump the program until the node Till (not included) is met. Every line + -- is indented with Index spaces at the beginning Dumps till the end if + -- Till is 0. + + procedure Dump_Operation + (Program : Program_Data; + Index : Pointer; + Indent : Natural); + -- Same as above, but only dumps a single operation, and compute its + -- indentation from the program. + --------- -- "=" -- --------- *************** package body System.Regpat is *** 340,346 **** (Program_Data, Character_Class); begin ! Op (0 .. 31) := Convert (Program (P + 3 .. P + 34)); end Bitmap_Operand; ------------- --- 353,359 ---- (Program_Data, Character_Class); begin ! Op (0 .. 31) := Convert (Program (P + Next_Pointer_Bytes .. P + 34)); end Bitmap_Operand; ------------- *************** package body System.Regpat is *** 369,375 **** PM : Pattern_Matcher renames Matcher; Program : Program_Data renames PM.Program; - Emit_Code : constant Boolean := PM.Size > 0; Emit_Ptr : Pointer := Program_First; Parse_Pos : Natural := Expression'First; -- Input-scan pointer --- 382,387 ---- *************** package body System.Regpat is *** 421,441 **** (Expr_Flags : out Expression_Flags; IP : out Pointer); -- Parse_Atom is the lowest level parse procedure. ! -- Optimization: gobbles an entire sequence of ordinary characters ! -- so that it can turn them into a single node, which is smaller to ! -- store and faster to run. Backslashed characters are exceptions, ! -- each becoming a separate node; the code is simpler that way and ! -- it's not worth fixing. procedure Insert_Operator (Op : Opcode; Operand : Pointer; Greedy : Boolean := True); ! -- Insert_Operator inserts an operator in front of an ! -- already-emitted operand and relocates the operand. ! -- This applies to PLUS and STAR. -- If Minmod is True, then the operator is non-greedy. procedure Insert_Curly_Operator (Op : Opcode; Min : Natural; --- 433,463 ---- (Expr_Flags : out Expression_Flags; IP : out Pointer); -- Parse_Atom is the lowest level parse procedure. ! -- ! -- Optimization: Gobbles an entire sequence of ordinary characters so ! -- that it can turn them into a single node, which is smaller to store ! -- and faster to run. Backslashed characters are exceptions, each ! -- becoming a separate node; the code is simpler that way and it's ! -- not worth fixing. procedure Insert_Operator (Op : Opcode; Operand : Pointer; Greedy : Boolean := True); ! -- Insert_Operator inserts an operator in front of an already-emitted ! -- operand and relocates the operand. This applies to PLUS and STAR. -- If Minmod is True, then the operator is non-greedy. + function Insert_Operator_Before + (Op : Opcode; + Operand : Pointer; + Greedy : Boolean; + Opsize : Pointer) return Pointer; + -- Insert an operator before Operand (and move the latter forward in the + -- program). Opsize is the size needed to represent the operator. This + -- returns the position at which the operator was inserted, and moves + -- Emit_Ptr after the new position of the operand. + procedure Insert_Curly_Operator (Op : Opcode; Min : Natural; *************** package body System.Regpat is *** 451,459 **** procedure Link_Operand_Tail (P, Val : Pointer); -- 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 - procedure Fail (M : String); pragma No_Return (Fail); -- Fail with a diagnostic message, if possible --- 473,478 ---- *************** package body System.Regpat is *** 513,519 **** procedure Emit (B : Character) is begin ! if Emit_Code then Program (Emit_Ptr) := B; end if; --- 532,538 ---- procedure Emit (B : Character) is begin ! if Emit_Ptr <= PM.Size then Program (Emit_Ptr) := B; end if; *************** package body System.Regpat is *** 531,537 **** (Character_Class, Program31); begin ! if Emit_Code then Program (Emit_Ptr .. Emit_Ptr + 31) := Convert (Bitmap); end if; --- 550,561 ---- (Character_Class, Program31); begin ! -- What is the mysterious constant 31 here??? Can't it be expressed ! -- symbolically (size of integer - 1 or some such???). In any case ! -- it should be declared as a constant (and referenced presumably ! -- as this constant + 1 below. ! ! if Emit_Ptr + 31 <= PM.Size then Program (Emit_Ptr .. Emit_Ptr + 31) := Convert (Bitmap); end if; *************** package body System.Regpat is *** 544,550 **** procedure Emit_Natural (IP : Pointer; N : Natural) is begin ! if Emit_Code then Program (IP + 1) := Character'Val (N / 256); Program (IP) := Character'Val (N mod 256); end if; --- 568,574 ---- procedure Emit_Natural (IP : Pointer; N : Natural) is begin ! if IP + 1 <= PM.Size then Program (IP + 1) := Character'Val (N / 256); Program (IP) := Character'Val (N mod 256); end if; *************** package body System.Regpat is *** 558,570 **** Result : constant Pointer := Emit_Ptr; begin ! if Emit_Code then Program (Emit_Ptr) := Character'Val (Opcode'Pos (Op)); Program (Emit_Ptr + 1) := ASCII.NUL; Program (Emit_Ptr + 2) := ASCII.NUL; end if; ! Emit_Ptr := Emit_Ptr + 3; return Result; end Emit_Node; --- 582,594 ---- Result : constant Pointer := Emit_Ptr; begin ! if Emit_Ptr + 2 <= PM.Size then Program (Emit_Ptr) := Character'Val (Opcode'Pos (Op)); Program (Emit_Ptr + 1) := ASCII.NUL; Program (Emit_Ptr + 2) := ASCII.NUL; end if; ! Emit_Ptr := Emit_Ptr + Next_Pointer_Bytes; return Result; end Emit_Node; *************** package body System.Regpat is *** 639,659 **** Operand : Pointer; Greedy : Boolean := True) is - Dest : constant Pointer := Emit_Ptr; Old : Pointer; ! Size : Pointer := 7; begin ! -- If the operand is not greedy, insert an extra operand before it if not Greedy then ! Size := Size + 3; end if; -- Move the operand in the byte-compilation, so that we can insert -- the operator before it. ! if Emit_Code then Program (Operand + Size .. Emit_Ptr + Size) := Program (Operand .. Emit_Ptr); end if; --- 663,700 ---- Operand : Pointer; Greedy : Boolean := True) is Old : Pointer; ! begin ! Old := Insert_Operator_Before (Op, Operand, Greedy, Opsize => 7); ! Emit_Natural (Old + Next_Pointer_Bytes, Min); ! Emit_Natural (Old + Next_Pointer_Bytes + 2, Max); ! end Insert_Curly_Operator; ! ! ---------------------------- ! -- Insert_Operator_Before -- ! ---------------------------- ! ! function Insert_Operator_Before ! (Op : Opcode; ! Operand : Pointer; ! Greedy : Boolean; ! Opsize : Pointer) return Pointer ! is ! Dest : constant Pointer := Emit_Ptr; ! Old : Pointer; ! Size : Pointer := Opsize; begin ! -- If not greedy, we have to emit another opcode first if not Greedy then ! Size := Size + Next_Pointer_Bytes; end if; -- Move the operand in the byte-compilation, so that we can insert -- the operator before it. ! if Emit_Ptr + Size <= PM.Size then Program (Operand + Size .. Emit_Ptr + Size) := Program (Operand .. Emit_Ptr); end if; *************** package body System.Regpat is *** 665,679 **** if not Greedy then Old := Emit_Node (MINMOD); ! Link_Tail (Old, Old + 3); end if; Old := Emit_Node (Op); - Emit_Natural (Old + 3, Min); - Emit_Natural (Old + 5, Max); - Emit_Ptr := Dest + Size; ! end Insert_Curly_Operator; --------------------- -- Insert_Operator -- --- 706,718 ---- if not Greedy then Old := Emit_Node (MINMOD); ! Link_Tail (Old, Old + Next_Pointer_Bytes); end if; Old := Emit_Node (Op); Emit_Ptr := Dest + Size; ! return Old; ! end Insert_Operator_Before; --------------------- -- Insert_Operator -- *************** package body System.Regpat is *** 684,723 **** Operand : Pointer; Greedy : Boolean := True) is - Dest : constant Pointer := Emit_Ptr; - Old : Pointer; - Size : Pointer := 3; - Discard : Pointer; pragma Warnings (Off, Discard); - begin ! -- If not greedy, we have to emit another opcode first ! ! if not Greedy then ! Size := Size + 3; ! end if; ! ! -- Move the operand in the byte-compilation, so that we can insert ! -- the operator before it. ! ! if Emit_Code then ! Program (Operand + Size .. Emit_Ptr + Size) := ! Program (Operand .. Emit_Ptr); ! end if; ! ! -- Insert the operator at the position previously occupied by the ! -- operand. ! ! Emit_Ptr := Operand; ! ! if not Greedy then ! Old := Emit_Node (MINMOD); ! Link_Tail (Old, Old + 3); ! end if; ! ! Discard := Emit_Node (Op); ! Emit_Ptr := Dest + Size; end Insert_Operator; ----------------------- --- 723,733 ---- Operand : Pointer; Greedy : Boolean := True) is Discard : Pointer; pragma Warnings (Off, Discard); begin ! Discard := Insert_Operator_Before ! (Op, Operand, Greedy, Opsize => Next_Pointer_Bytes); end Insert_Operator; ----------------------- *************** package body System.Regpat is *** 784,790 **** procedure Link_Operand_Tail (P, Val : Pointer) is begin ! if Emit_Code and then Program (P) = BRANCH then Link_Tail (Operand (P), Val); end if; end Link_Operand_Tail; --- 794,800 ---- procedure Link_Operand_Tail (P, Val : Pointer) is begin ! if P <= PM.Size and then Program (P) = BRANCH then Link_Tail (Operand (P), Val); end if; end Link_Operand_Tail; *************** package body System.Regpat is *** 799,814 **** Offset : Pointer; begin ! if not Emit_Code then ! return; ! end if; ! ! -- Find last node Scan := P; ! loop ! Temp := Next_Instruction (Scan); ! exit when Temp = 0; Scan := Temp; end loop; --- 809,821 ---- Offset : Pointer; begin ! -- Find last node (the size of the pattern matcher might be too ! -- small, so don't try to read past its end). Scan := P; ! while Scan + Next_Pointer_Bytes <= PM.Size loop ! Temp := Get_Next (Program, Scan); ! exit when Temp = Scan; Scan := Temp; end loop; *************** package body System.Regpat is *** 817,863 **** Emit_Natural (Scan + 1, Natural (Offset)); end Link_Tail; - ---------------------- - -- Next_Instruction -- - ---------------------- - - function Next_Instruction (P : Pointer) return Pointer is - Offset : Pointer; - - begin - if not Emit_Code then - return 0; - end if; - - Offset := Get_Next_Offset (Program, P); - - if Offset = 0 then - return 0; - end if; - - return P + Offset; - end Next_Instruction; - ----------- -- Parse -- ----------- ! -- Combining parenthesis handling with the base level ! -- of regular expression is a trifle forced, but the ! -- need to tie the tails of the branches to what follows ! -- makes it hard to avoid. procedure Parse ! (Parenthesized : Boolean; ! Flags : out Expression_Flags; ! IP : out Pointer) is ! E : String renames Expression; ! Br : Pointer; ! Ender : Pointer; ! Par_No : Natural; ! New_Flags : Expression_Flags; ! Have_Branch : Boolean := False; begin Flags := (Has_Width => True, others => False); -- Tentatively --- 824,848 ---- Emit_Natural (Scan + 1, Natural (Offset)); end Link_Tail; ----------- -- Parse -- ----------- ! -- Combining parenthesis handling with the base level of regular ! -- expression is a trifle forced, but the need to tie the tails of the ! -- the branches to what follows makes it hard to avoid. procedure Parse ! (Parenthesized : Boolean; ! Flags : out Expression_Flags; ! IP : out Pointer) is ! E : String renames Expression; ! Br, Br2 : Pointer; ! Ender : Pointer; ! Par_No : Natural; ! New_Flags : Expression_Flags; ! Have_Branch : Boolean := False; begin Flags := (Has_Width => True, others => False); -- Tentatively *************** package body System.Regpat is *** 938,952 **** Link_Tail (IP, Ender); ! if Have_Branch then -- Hook the tails of the branches to the closing node Br := IP; loop - exit when Br = 0; Link_Operand_Tail (Br, Ender); ! Br := Next_Instruction (Br); end loop; end if; --- 923,938 ---- Link_Tail (IP, Ender); ! if Have_Branch and then Emit_Ptr <= PM.Size then -- Hook the tails of the branches to the closing node Br := IP; loop Link_Operand_Tail (Br, Ender); ! Br2 := Get_Next (Program, Br); ! exit when Br2 = Br; ! Br := Br2; end loop; end if; *************** package body System.Regpat is *** 1639,1651 **** -- is an initial string to emit, do it now. if Has_Special_Operator ! and then Emit_Ptr >= Length_Ptr + 3 then Emit_Ptr := Emit_Ptr - 1; Parse_Pos := Start_Pos; end if; ! if Emit_Code then Program (Length_Ptr) := Character'Val (Emit_Ptr - Length_Ptr - 2); end if; --- 1625,1637 ---- -- is an initial string to emit, do it now. if Has_Special_Operator ! and then Emit_Ptr >= Length_Ptr + Next_Pointer_Bytes then Emit_Ptr := Emit_Ptr - 1; Parse_Pos := Start_Pos; end if; ! if Length_Ptr <= PM.Size then Program (Length_Ptr) := Character'Val (Emit_Ptr - Length_Ptr - 2); end if; *************** package body System.Regpat is *** 1987,1993 **** -- Start of processing for Compile begin - Emit (MAGIC); Parse (False, Expr_Flags, Result); if Result = 0 then --- 1973,1978 ---- *************** package body System.Regpat is *** 1999,2005 **** -- Do we want to actually compile the expression, or simply get the -- code size ??? ! if Emit_Code then Optimize (PM); end if; --- 1984,1990 ---- -- Do we want to actually compile the expression, or simply get the -- code size ??? ! if Emit_Ptr <= PM.Size then Optimize (PM); end if; *************** package body System.Regpat is *** 2010,2028 **** (Expression : String; Flags : Regexp_Flags := No_Flags) return Pattern_Matcher is Size : Program_Size; - Dummy : Pattern_Matcher (0); - pragma Unreferenced (Dummy); begin Compile (Dummy, Expression, Size, Flags); ! declare ! Result : Pattern_Matcher (Size); ! begin ! Compile (Result, Expression, Size, Flags); ! return Result; ! end; end Compile; procedure Compile --- 1995,2032 ---- (Expression : String; Flags : Regexp_Flags := No_Flags) return Pattern_Matcher is + -- Assume the compiled regexp will fit in 1000 chars. If it does not we + -- will have to compile a second time once the correct size is known. If + -- it fits, we save a significant amount of time by avoiding the second + -- compilation. + + Dummy : Pattern_Matcher (1000); Size : Program_Size; begin Compile (Dummy, Expression, Size, Flags); ! if Size <= Dummy.Size then ! return Pattern_Matcher' ! (Size => Size, ! First => Dummy.First, ! Anchored => Dummy.Anchored, ! Must_Have => Dummy.Must_Have, ! Must_Have_Length => Dummy.Must_Have_Length, ! Paren_Count => Dummy.Paren_Count, ! Flags => Dummy.Flags, ! Program => Dummy.Program ! (Dummy.Program'First .. Dummy.Program'First + Size - 1)); ! else ! -- We have to recompile now that we know the size ! -- ??? Can we use Ada05's return construct ? ! declare ! Result : Pattern_Matcher (Size); ! begin ! Compile (Result, Expression, Size, Flags); ! return Result; ! end; ! end if; end Compile; procedure Compile *************** package body System.Regpat is *** 2031,2123 **** Flags : Regexp_Flags := No_Flags) is Size : Program_Size; ! pragma Unreferenced (Size); begin Compile (Matcher, Expression, Size, Flags); end Compile; ! ---------- ! -- Dump -- ! ---------- ! procedure Dump (Self : Pattern_Matcher) is ! Op : Opcode; ! Program : Program_Data renames Self.Program; ! procedure Dump_Until ! (Start : Pointer; ! Till : Pointer; ! Indent : Natural := 0); ! -- Dump the program until the node Till (not included) is met. ! -- Every line is indented with Index spaces at the beginning ! -- Dumps till the end if Till is 0. ! ---------------- ! -- Dump_Until -- ! ---------------- ! procedure Dump_Until ! (Start : Pointer; ! Till : Pointer; ! Indent : Natural := 0) ! is ! Next : Pointer; ! Index : Pointer; ! Local_Indent : Natural := Indent; ! Length : Pointer; begin ! Index := Start; ! while Index < Till loop ! Op := Opcode'Val (Character'Pos ((Self.Program (Index)))); ! if Op = CLOSE then ! Local_Indent := Local_Indent - 3; ! end if; ! declare ! Point : constant String := Pointer'Image (Index); ! begin ! for J in 1 .. 6 - Point'Length loop ! Put (' '); ! end loop; ! Put (Point ! & " : " ! & (1 .. Local_Indent => ' ') ! & Opcode'Image (Op)); end; -- Print the parenthesis number if Op = OPEN or else Op = CLOSE or else Op = REFF then ! Put (Natural'Image (Character'Pos (Program (Index + 3)))); end if; - Next := Index + Get_Next_Offset (Program, Index); - if Next = Index then ! Put (" (next at 0)"); else ! Put (" (next at " & Pointer'Image (Next) & ")"); end if; ! case Op is ! ! -- Character class operand ! ! when ANYOF => null; ! declare ! Bitmap : Character_Class; ! Last : Character := ASCII.NUL; ! Current : Natural := 0; ! Current_Char : Character; ! begin ! Bitmap_Operand (Program, Index, Bitmap); ! Put (" operand="); while Current <= 255 loop Current_Char := Character'Val (Current); --- 2035,2141 ---- Flags : Regexp_Flags := No_Flags) is Size : Program_Size; ! begin Compile (Matcher, Expression, Size, Flags); + + if Size > Matcher.Size then + raise Expression_Error with "Pattern_Matcher is too small"; + end if; end Compile; ! -------------------- ! -- Dump_Operation -- ! -------------------- ! procedure Dump_Operation ! (Program : Program_Data; ! Index : Pointer; ! Indent : Natural) ! is ! Current : Pointer := Index; ! begin ! Dump_Until (Program, Current, Current + 1, Indent); ! end Dump_Operation; ! ---------------- ! -- Dump_Until -- ! ---------------- ! procedure Dump_Until ! (Program : Program_Data; ! Index : in out Pointer; ! Till : Pointer; ! Indent : Natural; ! Do_Print : Boolean := True) ! is ! function Image (S : String) return String; ! -- Remove leading space ! ----------- ! -- Image -- ! ----------- + function Image (S : String) return String is begin ! if S (S'First) = ' ' then ! return S (S'First + 1 .. S'Last); ! else ! return S; ! end if; ! end Image; ! -- Local variables ! Op : Opcode; ! Next : Pointer; ! Length : Pointer; ! Local_Indent : Natural := Indent; ! -- Start of processing for Dump_Until ! begin ! while Index < Till loop ! Op := Opcode'Val (Character'Pos ((Program (Index)))); ! Next := Get_Next (Program, Index); ! ! if Do_Print then ! declare ! Point : constant String := Pointer'Image (Index); ! begin ! Put ((1 .. 4 - Point'Length => ' ') ! & Point & ":" ! & (1 .. Local_Indent * 2 => ' ') & Opcode'Image (Op)); end; -- Print the parenthesis number if Op = OPEN or else Op = CLOSE or else Op = REFF then ! Put (Image (Natural'Image ! (Character'Pos ! (Program (Index + Next_Pointer_Bytes))))); end if; if Next = Index then ! Put (" (-)"); else ! Put (" (" & Image (Pointer'Image (Next)) & ")"); end if; + end if; ! case Op is ! when ANYOF => ! declare ! Bitmap : Character_Class; ! Last : Character := ASCII.NUL; ! Current : Natural := 0; ! Current_Char : Character; ! begin ! Bitmap_Operand (Program, Index, Bitmap); ! if Do_Print then ! Put ("["); while Current <= 255 loop Current_Char := Character'Val (Current); *************** package body System.Regpat is *** 2135,2151 **** Current_Char := Character'Val (Current); exit when not Get_From_Class (Bitmap, Current_Char); - end loop; ! if Last <= ' ' then Put (Last'Img); else Put (Last); end if; if Character'Succ (Last) /= Current_Char then ! Put ("-" & Character'Pred (Current_Char)); end if; else --- 2153,2168 ---- Current_Char := Character'Val (Current); exit when not Get_From_Class (Bitmap, Current_Char); end loop; ! if not Is_Graphic (Last) then Put (Last'Img); else Put (Last); end if; if Character'Succ (Last) /= Current_Char then ! Put ("\-" & Character'Pred (Current_Char)); end if; else *************** package body System.Regpat is *** 2153,2228 **** end if; end loop; ! New_Line; ! Index := Index + 3 + Bitmap'Length; ! end; ! -- string operand ! when EXACT | EXACTF => ! Length := String_Length (Program, Index); ! Put (" operand (length:" & Program_Size'Image (Length + 1) ! & ") =" ! & String (Program (String_Operand (Index) ! .. String_Operand (Index) ! + Length))); ! Index := String_Operand (Index) + Length + 1; ! New_Line; -- Node operand ! when BRANCH => New_Line; ! Dump_Until (Index + 3, Next, Local_Indent + 3); ! Index := Next; ! when STAR | PLUS => ! New_Line; ! -- Only one instruction ! Dump_Until (Index + 3, Index + 4, Local_Indent + 3); ! Index := Next; ! when CURLY | CURLYX => ! Put (" {" ! & Natural'Image (Read_Natural (Program, Index + 3)) ! & "," ! & Natural'Image (Read_Natural (Program, Index + 5)) ! & "}"); New_Line; ! Dump_Until (Index + 7, Next, Local_Indent + 3); ! Index := Next; ! when OPEN => ! New_Line; ! Index := Index + 4; ! Local_Indent := Local_Indent + 3; ! when CLOSE | REFF => New_Line; ! Index := Index + 4; ! when EOP => ! Index := Index + 3; ! New_Line; ! exit; ! -- No operand ! when others => ! Index := Index + 3; New_Line; ! end case; ! end loop; ! end Dump_Until; -- Start of processing for Dump begin - pragma Assert (Self.Program (Program_First) = MAGIC, - "Corrupted Pattern_Matcher"); - Put_Line ("Must start with (Self.First) = " & Character'Image (Self.First)); --- 2170,2262 ---- end if; end loop; ! Put_Line ("]"); ! end if; ! Index := Index + Next_Pointer_Bytes + Bitmap'Length; ! end; ! when EXACT | EXACTF => ! Length := String_Length (Program, Index); ! if Do_Print then ! Put (" (" & Image (Program_Size'Image (Length + 1)) ! & " chars) <" ! & String (Program (String_Operand (Index) ! .. String_Operand (Index) ! + Length))); ! Put_Line (">"); ! end if; ! ! Index := String_Operand (Index) + Length + 1; -- Node operand ! when BRANCH | STAR | PLUS => ! if Do_Print then New_Line; ! end if; ! Index := Index + Next_Pointer_Bytes; ! Dump_Until (Program, Index, Pointer'Min (Next, Till), ! Local_Indent + 1, Do_Print); ! when CURLY | CURLYX => ! if Do_Print then ! Put_Line ! (" {" ! & Image (Natural'Image ! (Read_Natural (Program, Index + Next_Pointer_Bytes))) ! & "," ! & Image (Natural'Image (Read_Natural (Program, Index + 5))) ! & "}"); ! end if; ! Index := Index + 7; ! Dump_Until (Program, Index, Pointer'Min (Next, Till), ! Local_Indent + 1, Do_Print); ! when OPEN => ! if Do_Print then New_Line; ! end if; ! Index := Index + 4; ! Local_Indent := Local_Indent + 1; ! when CLOSE | REFF => ! if Do_Print then New_Line; ! end if; ! Index := Index + 4; ! if Op = CLOSE then ! Local_Indent := Local_Indent - 1; ! end if; ! when others => ! Index := Index + Next_Pointer_Bytes; ! ! if Do_Print then New_Line; ! end if; ! ! exit when Op = EOP; ! end case; ! end loop; ! end Dump_Until; ! ! ---------- ! -- Dump -- ! ---------- ! ! procedure Dump (Self : Pattern_Matcher) is ! Program : Program_Data renames Self.Program; ! Index : Pointer := Program'First; -- Start of processing for Dump begin Put_Line ("Must start with (Self.First) = " & Character'Image (Self.First)); *************** package body System.Regpat is *** 2238,2245 **** Put_Line (" Multiple_Lines mode"); end if; ! Put_Line (" 1 : MAGIC"); ! Dump_Until (Program_First + 1, Self.Program'Last + 1); end Dump; -------------------- --- 2272,2278 ---- Put_Line (" Multiple_Lines mode"); end if; ! Dump_Until (Program, Index, Self.Program'Last + 1, 0); end Dump; -------------------- *************** package body System.Regpat is *** 2261,2287 **** -------------- function Get_Next (Program : Program_Data; IP : Pointer) return Pointer is - Offset : constant Pointer := Get_Next_Offset (Program, IP); begin ! if Offset = 0 then ! return 0; ! else ! return IP + Offset; ! end if; end Get_Next; - --------------------- - -- Get_Next_Offset -- - --------------------- - - function Get_Next_Offset - (Program : Program_Data; - IP : Pointer) return Pointer - is - begin - return Pointer (Read_Natural (Program, IP + 1)); - end Get_Next_Offset; - -------------- -- Is_Alnum -- -------------- --- 2294,2303 ---- -------------- function Get_Next (Program : Program_Data; IP : Pointer) return Pointer is begin ! return IP + Pointer (Read_Natural (Program, IP + 1)); end Get_Next; -------------- -- Is_Alnum -- -------------- *************** package body System.Regpat is *** 2401,2409 **** -- using a loop instead of recursion. -- Why is the above comment part of the spec rather than body ??? ! function Match_Whilem (IP : Pointer) return Boolean; ! -- Return True if a WHILEM matches ! -- How come IP is unreferenced in the body ??? function Recurse_Match (IP : Pointer; From : Natural) return Boolean; pragma Inline (Recurse_Match); --- 2417,2424 ---- -- using a loop instead of recursion. -- Why is the above comment part of the spec rather than body ??? ! function Match_Whilem return Boolean; ! -- Return True if a WHILEM matches the Current_Curly function Recurse_Match (IP : Pointer; From : Natural) return Boolean; pragma Inline (Recurse_Match); *************** package body System.Regpat is *** 2418,2423 **** --- 2433,2443 ---- Greedy : Boolean) return Boolean; -- Return True it the simple operator (possibly non-greedy) matches + Dump_Indent : Integer := -1; + procedure Dump_Current (Scan : Pointer; Prefix : Boolean := True); + procedure Dump_Error (Msg : String); + -- Debug: print the current context + pragma Inline (Index); pragma Inline (Repeat); *************** package body System.Regpat is *** 2446,2460 **** ------------------- function Recurse_Match (IP : Pointer; From : Natural) return Boolean is ! L : constant Natural := Last_Paren; ! Tmp_F : constant Match_Array := Matches_Full (From + 1 .. Matches_Full'Last); - Start : constant Natural_Array := Matches_Tmp (From + 1 .. Matches_Tmp'Last); Input : constant Natural := Input_Pos; begin if Match (IP) then return True; --- 2466,2480 ---- ------------------- function Recurse_Match (IP : Pointer; From : Natural) return Boolean is ! L : constant Natural := Last_Paren; Tmp_F : constant Match_Array := Matches_Full (From + 1 .. Matches_Full'Last); Start : constant Natural_Array := Matches_Tmp (From + 1 .. Matches_Tmp'Last); Input : constant Natural := Input_Pos; + Dump_Indent_Save : constant Integer := Dump_Indent; + begin if Match (IP) then return True; *************** package body System.Regpat is *** 2464,2472 **** --- 2484,2528 ---- Matches_Full (Tmp_F'Range) := Tmp_F; Matches_Tmp (Start'Range) := Start; Input_Pos := Input; + Dump_Indent := Dump_Indent_Save; return False; end Recurse_Match; + ------------------ + -- Dump_Current -- + ------------------ + + procedure Dump_Current (Scan : Pointer; Prefix : Boolean := True) is + Length : constant := 10; + Pos : constant String := Integer'Image (Input_Pos); + + begin + if Prefix then + Put ((1 .. 5 - Pos'Length => ' ')); + Put (Pos & " <" + & Data (Input_Pos + .. Integer'Min (Last_In_Data, Input_Pos + Length - 1))); + Put ((1 .. Length - 1 - Last_In_Data + Input_Pos => ' ')); + Put ("> |"); + + else + Put (" "); + end if; + + Dump_Operation (Program, Scan, Indent => Dump_Indent); + end Dump_Current; + + ---------------- + -- Dump_Error -- + ---------------- + + procedure Dump_Error (Msg : String) is + begin + Put (" | "); + Put ((1 .. Dump_Indent * 2 => ' ')); + Put_Line (Msg); + end Dump_Error; + ----------- -- Match -- ----------- *************** package body System.Regpat is *** 2475,2482 **** --- 2531,2541 ---- Scan : Pointer := IP; Next : Pointer; Op : Opcode; + Result : Boolean; begin + Dump_Indent := Dump_Indent + 1; + State_Machine : loop pragma Assert (Scan /= 0); *************** package body System.Regpat is *** 2485,2497 **** Op := Opcode'Val (Character'Pos (Program (Scan))); ! -- Calculate offset of next instruction. ! -- Second character is most significant in Program_Data. Next := Get_Next (Program, Scan); case Op is when EOP => return True; -- Success ! when BRANCH => --- 2544,2561 ---- Op := Opcode'Val (Character'Pos (Program (Scan))); ! -- Calculate offset of next instruction. Second character is most ! -- significant in Program_Data. Next := Get_Next (Program, Scan); + if Debug then + Dump_Current (Scan); + end if; + case Op is when EOP => + Dump_Indent := Dump_Indent - 1; return True; -- Success ! when BRANCH => *************** package body System.Regpat is *** 2501,2506 **** --- 2565,2571 ---- else loop if Recurse_Match (Operand (Scan), 0) then + Dump_Indent := Dump_Indent - 1; return True; end if; *************** package body System.Regpat is *** 2517,2523 **** when BOL => exit State_Machine when Input_Pos /= BOL_Pos and then ((Self.Flags and Multiple_Lines) = 0 ! or else Data (Input_Pos - 1) /= ASCII.LF); when MBOL => exit State_Machine when Input_Pos /= BOL_Pos --- 2582,2588 ---- when BOL => exit State_Machine when Input_Pos /= BOL_Pos and then ((Self.Flags and Multiple_Lines) = 0 ! or else Data (Input_Pos - 1) /= ASCII.LF); when MBOL => exit State_Machine when Input_Pos /= BOL_Pos *************** package body System.Regpat is *** 2529,2535 **** when EOL => exit State_Machine when Input_Pos <= Data'Last and then ((Self.Flags and Multiple_Lines) = 0 ! or else Data (Input_Pos) /= ASCII.LF); when MEOL => exit State_Machine when Input_Pos <= Data'Last --- 2594,2600 ---- when EOL => exit State_Machine when Input_Pos <= Data'Last and then ((Self.Flags and Multiple_Lines) = 0 ! or else Data (Input_Pos) /= ASCII.LF); when MEOL => exit State_Machine when Input_Pos <= Data'Last *************** package body System.Regpat is *** 2610,2616 **** declare Opnd : Pointer := String_Operand (Scan); Current : Positive := Input_Pos; - Last : constant Pointer := Opnd + String_Length (Program, Scan); --- 2675,2680 ---- *************** package body System.Regpat is *** 2686,2691 **** --- 2750,2761 ---- -- If we haven't seen that parenthesis yet if Last_Paren < No then + Dump_Indent := Dump_Indent - 1; + + if Debug then + Dump_Error ("REFF: No match, backtracking"); + end if; + return False; end if; *************** package body System.Regpat is *** 2695,2700 **** --- 2765,2776 ---- if Input_Pos > Last_In_Data or else Data (Input_Pos) /= Data (Data_Pos) then + Dump_Indent := Dump_Indent - 1; + + if Debug then + Dump_Error ("REFF: No match, backtracking"); + end if; + return False; end if; *************** package body System.Regpat is *** 2711,2717 **** Greed : constant Boolean := Greedy; begin Greedy := True; ! return Match_Simple_Operator (Op, Scan, Next, Greed); end; when CURLYX => --- 2787,2795 ---- Greed : constant Boolean := Greedy; begin Greedy := True; ! Result := Match_Simple_Operator (Op, Scan, Next, Greed); ! Dump_Indent := Dump_Indent - 1; ! return Result; end; when CURLYX => *************** package body System.Regpat is *** 2725,2733 **** declare Min : constant Natural := ! Read_Natural (Program, Scan + 3); Max : constant Natural := ! Read_Natural (Program, Scan + 5); Cc : aliased Current_Curly_Record; Has_Match : Boolean; --- 2803,2812 ---- declare Min : constant Natural := ! Read_Natural (Program, Scan + Next_Pointer_Bytes); Max : constant Natural := ! Read_Natural ! (Program, Scan + Next_Pointer_Bytes + 2); Cc : aliased Current_Curly_Record; Has_Match : Boolean; *************** package body System.Regpat is *** 2742,2766 **** Next => Next, Lastloc => 0, Old_Cc => Current_Curly); Current_Curly := Cc'Unchecked_Access; ! Has_Match := Match (Next - 3); -- Start on the WHILEM Current_Curly := Cc.Old_Cc; return Has_Match; end; when WHILEM => ! return Match_Whilem (IP); end case; Scan := Next; end loop State_Machine; ! -- If we get here, there is no match. ! -- For successful matches when EOP is the terminating point. return False; end Match; --- 2821,2866 ---- Next => Next, Lastloc => 0, Old_Cc => Current_Curly); + Greedy := True; Current_Curly := Cc'Unchecked_Access; ! Has_Match := Match (Next - Next_Pointer_Bytes); -- Start on the WHILEM Current_Curly := Cc.Old_Cc; + Dump_Indent := Dump_Indent - 1; + + if not Has_Match then + if Debug then + Dump_Error ("CURLYX failed..."); + end if; + end if; + return Has_Match; end; when WHILEM => ! Result := Match_Whilem; ! Dump_Indent := Dump_Indent - 1; ! ! if Debug and then not Result then ! Dump_Error ("WHILEM: no match, backtracking"); ! end if; ! ! return Result; end case; Scan := Next; end loop State_Machine; ! if Debug then ! Dump_Error ("failed..."); ! Dump_Indent := Dump_Indent - 1; ! end if; ! ! -- If we get here, there is no match. For successful matches when EOP ! -- is the terminating point. return False; end Match; *************** package body System.Regpat is *** 2786,2793 **** Save : constant Natural := Input_Pos; begin ! -- Lookahead to avoid useless match attempts ! -- when we know what character comes next. if Program (Next) = EXACT then Next_Char := Program (String_Operand (Next)); --- 2886,2893 ---- Save : constant Natural := Input_Pos; begin ! -- Lookahead to avoid useless match attempts when we know what ! -- character comes next. if Program (Next) = EXACT then Next_Char := Program (String_Operand (Next)); *************** package body System.Regpat is *** 2806,2826 **** Operand_Code := Operand (Scan); when others => ! Min := Read_Natural (Program, Scan + 3); ! Max := Read_Natural (Program, Scan + 5); Operand_Code := Scan + 7; end case; -- Non greedy operators if not Greedy then ! -- Test the minimal repetitions ! if Min /= 0 ! and then Repeat (Operand_Code, Min) < Min ! then ! return False; end if; Old := Input_Pos; --- 2906,2936 ---- Operand_Code := Operand (Scan); when others => ! Min := Read_Natural (Program, Scan + Next_Pointer_Bytes); ! Max := Read_Natural (Program, Scan + Next_Pointer_Bytes + 2); Operand_Code := Scan + 7; end case; + if Debug then + Dump_Current (Operand_Code, Prefix => False); + end if; + -- Non greedy operators if not Greedy then ! -- Test we can repeat at least Min times ! if Min /= 0 then ! No := Repeat (Operand_Code, Min); ! ! if No < Min then ! if Debug then ! Dump_Error ("failed... matched" & No'Img & " times"); ! end if; ! ! return False; ! end if; end if; Old := Input_Pos; *************** package body System.Regpat is *** 2828,2833 **** --- 2938,2944 ---- -- Find the place where 'next' could work if Next_Char_Known then + -- Last position to check if Max = Natural'Last then *************** package body System.Regpat is *** 2842,2847 **** --- 2953,2962 ---- -- Look for the first possible opportunity + if Debug then + Dump_Error ("Next_Char must be " & Next_Char); + end if; + loop -- Find the next possible position *************** package body System.Regpat is *** 2855,2862 **** return False; end if; ! -- Check that we still match if we stop ! -- at the position we just found. declare Num : constant Natural := Input_Pos - Old; --- 2970,2977 ---- return False; end if; ! -- Check that we still match if we stop at the position we ! -- just found. declare Num : constant Natural := Input_Pos - Old; *************** package body System.Regpat is *** 2864,2869 **** --- 2979,2988 ---- begin Input_Pos := Old; + if Debug then + Dump_Error ("Would we still match at that position?"); + end if; + if Repeat (Operand_Code, Num) < Num then return False; end if; *************** package body System.Regpat is *** 2879,2892 **** Input_Pos := Input_Pos + 1; end loop; ! -- We know what the next character is else while Max >= Min loop -- If the next character matches ! if Match (Next) then return True; end if; --- 2998,3015 ---- Input_Pos := Input_Pos + 1; end loop; ! -- We do not know what the next character is else while Max >= Min loop + if Debug then + Dump_Error ("Non-greedy repeat, N=" & Min'Img); + Dump_Error ("Do we still match Next if we stop here?"); + end if; -- If the next character matches ! if Recurse_Match (Next, 1) then return True; end if; *************** package body System.Regpat is *** 2897,2902 **** --- 3020,3029 ---- if Repeat (Operand_Code, 1) /= 0 then Min := Min + 1; else + if Debug then + Dump_Error ("Non-greedy repeat failed..."); + end if; + return False; end if; end loop; *************** package body System.Regpat is *** 2909,2920 **** else No := Repeat (Operand_Code, Max); ! -- ??? Perl has some special code here in case the ! -- next instruction is of type EOL, since $ and \Z ! -- can match before *and* after newline at the end. ! -- ??? Perl has some special code here in case (paren) ! -- is True. -- Else, if we don't have any parenthesis --- 3036,3050 ---- else No := Repeat (Operand_Code, Max); ! if Debug and then No < Min then ! Dump_Error ("failed... matched" & No'Img & " times"); ! end if; ! -- ??? Perl has some special code here in case the next ! -- instruction is of type EOL, since $ and \Z can match before ! -- *and* after newline at the end. ! ! -- ??? Perl has some special code here in case (paren) is True -- Else, if we don't have any parenthesis *************** package body System.Regpat is *** 2948,2957 **** -- tree by recursing ever deeper. And if it fails, we have to reset -- our parent's current state that we can try again after backing off. ! function Match_Whilem (IP : Pointer) return Boolean is ! pragma Unreferenced (IP); ! Cc : constant Current_Curly_Access := Current_Curly; N : constant Natural := Cc.Cur + 1; Ln : Natural := 0; --- 3078,3086 ---- -- tree by recursing ever deeper. And if it fails, we have to reset -- our parent's current state that we can try again after backing off. ! function Match_Whilem return Boolean is Cc : constant Current_Curly_Access := Current_Curly; + N : constant Natural := Cc.Cur + 1; Ln : Natural := 0; *************** package body System.Regpat is *** 2991,3002 **** --- 3120,3141 ---- Cc.Cur := N; Cc.Lastloc := Input_Pos; + if Debug then + Dump_Error + ("Tests that we match at least" & Cc.Min'Img & " N=" & N'Img); + end if; + if Match (Cc.Scan) then return True; end if; Cc.Cur := N - 1; Cc.Lastloc := Lastloc; + + if Debug then + Dump_Error ("failed..."); + end if; + return False; end if; *************** package body System.Regpat is *** 3022,3027 **** --- 3161,3169 ---- -- Maximum greed exceeded ? if N >= Cc.Max then + if Debug then + Dump_Error ("failed..."); + end if; return False; end if; *************** package body System.Regpat is *** 3029,3034 **** --- 3171,3180 ---- Cc.Cur := N; Cc.Lastloc := Input_Pos; + if Debug then + Dump_Error ("Next failed, what about Current?"); + end if; + if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then return True; end if; *************** package body System.Regpat is *** 3044,3049 **** --- 3190,3199 ---- Cc.Cur := N; Cc.Lastloc := Input_Pos; + if Debug then + Dump_Error ("Recurse at current position"); + end if; + if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then return True; end if; *************** package body System.Regpat is *** 3057,3062 **** --- 3207,3216 ---- Ln := Current_Curly.Cur; end if; + if Debug then + Dump_Error ("Failed matching for later positions"); + end if; + if Match (Cc.Next) then return True; end if; *************** package body System.Regpat is *** 3068,3073 **** --- 3222,3232 ---- Current_Curly := Cc; Cc.Cur := N - 1; Cc.Lastloc := Lastloc; + + if Debug then + Dump_Error ("failed..."); + end if; + return False; end Match_Whilem; *************** package body System.Regpat is *** 3200,3206 **** Last_Paren := 0; Matches_Full := (others => No_Match); ! if Match (Program_First + 1) then Matches_Full (0) := (Pos, Input_Pos - 1); return True; end if; --- 3359,3365 ---- Last_Paren := 0; Matches_Full := (others => No_Match); ! if Match (Program_First) then Matches_Full (0) := (Pos, Input_Pos - 1); return True; end if; *************** package body System.Regpat is *** 3218,3229 **** return; end if; - -- Check validity of program - - pragma Assert - (Program (Program_First) = MAGIC, - "Corrupted Pattern_Matcher"); - -- If there is a "must appear" string, look for it if Self.Must_Have_Length > 0 then --- 3377,3382 ---- *************** package body System.Regpat is *** 3430,3436 **** function Operand (P : Pointer) return Pointer is begin ! return P + 3; end Operand; -------------- --- 3583,3589 ---- function Operand (P : Pointer) return Pointer is begin ! return P + Next_Pointer_Bytes; end Operand; -------------- *************** package body System.Regpat is *** 3452,3458 **** Self.Must_Have := Program'Last + 1; Self.Must_Have_Length := 0; ! Scan := Program_First + 1; -- First instruction (can be anything) if Program (Scan) = EXACT then Self.First := Program (String_Operand (Scan)); --- 3605,3611 ---- Self.Must_Have := Program'Last + 1; Self.Must_Have_Length := 0; ! Scan := Program_First; -- First instruction (can be anything) if Program (Scan) = EXACT then Self.First := Program (String_Operand (Scan)); *************** package body System.Regpat is *** 3547,3553 **** is begin pragma Assert (Program (P) = EXACT or else Program (P) = EXACTF); ! return Character'Pos (Program (P + 3)); end String_Length; -------------------- --- 3700,3706 ---- is begin pragma Assert (Program (P) = EXACT or else Program (P) = EXACTF); ! return Character'Pos (Program (P + Next_Pointer_Bytes)); end String_Length; -------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/s-rident.ads gcc-4.6.0/gcc/ada/s-rident.ads *** gcc-4.5.2/gcc/ada/s-rident.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-rident.ads Mon Oct 18 10:34:56 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Rident is *** 62,69 **** --- 62,72 ---- No_Abort_Statements, -- (RM D.7(5), H.4(3)) No_Access_Subprograms, -- (RM H.4(17)) No_Allocators, -- (RM H.4(7)) + No_Allocators_After_Elaboration, -- Ada 2012 (RM D.7(19.1/2)) + No_Anonymous_Allocators, -- Ada 2012 (RM H.4(8/1)) No_Asynchronous_Control, -- (RM D.7(10)) No_Calendar, -- GNAT + No_Default_Stream_Attributes, -- Ada 2012 (RM 13.12.1(4/2)) No_Delay, -- (RM H.4(21)) No_Direct_Boolean_Operators, -- GNAT No_Dispatch, -- (RM H.4(19)) *************** package System.Rident is *** 327,333 **** -- value of the parameter permitted by the profile. end record; ! Profile_Info : array (Profile_Name_Actual) of Profile_Data := -- Restricted Profile --- 330,336 ---- -- value of the parameter permitted by the profile. end record; ! Profile_Info : constant array (Profile_Name_Actual) of Profile_Data := -- Restricted Profile diff -Nrcpad gcc-4.5.2/gcc/ada/s-shasto.adb gcc-4.6.0/gcc/ada/s-shasto.adb *** gcc-4.5.2/gcc/ada/s-shasto.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-shasto.adb Fri Jun 18 09:53:00 2010 *************** *** 6,13 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,13 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body System.Shared_Storage is *** 88,95 **** Item : AS.Stream_Element_Array); subtype Hash_Header is Natural range 0 .. 30; ! -- Number of hash headers, related (for efficiency purposes only) ! -- to the maximum number of lock files.. type Shared_Var_File_Entry; type Shared_Var_File_Entry_Ptr is access Shared_Var_File_Entry; --- 88,95 ---- Item : AS.Stream_Element_Array); subtype Hash_Header is Natural range 0 .. 30; ! -- Number of hash headers, related (for efficiency purposes only) to the ! -- maximum number of lock files. type Shared_Var_File_Entry; type Shared_Var_File_Entry_Ptr is access Shared_Var_File_Entry; diff -Nrcpad gcc-4.5.2/gcc/ada/s-stalib.ads gcc-4.6.0/gcc/ada/s-stalib.ads *** gcc-4.5.2/gcc/ada/s-stalib.ads Wed Apr 22 09:57:03 2009 --- gcc-4.6.0/gcc/ada/s-stalib.ads Thu Oct 21 10:25:12 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,43 **** -- are required to be part of every Ada program. A special mechanism is -- required to ensure that these are loaded, since it may be the case in -- some programs that the only references to these required packages are ! -- from C code or from code generated directly by Gigi, an in both cases -- the binder is not aware of such references. -- System.Standard_Library also includes data that must be present in every ! -- program, in particular the definitions of all the standard and also some -- subprograms that must be present in every program. -- The binder unconditionally includes s-stalib.ali, which ensures that this --- 33,43 ---- -- are required to be part of every Ada program. A special mechanism is -- required to ensure that these are loaded, since it may be the case in -- some programs that the only references to these required packages are ! -- from C code or from code generated directly by Gigi, and in both cases -- the binder is not aware of such references. -- System.Standard_Library also includes data that must be present in every ! -- program, in particular data for all the standard exceptions, and also some -- subprograms that must be present in every program. -- The binder unconditionally includes s-stalib.ali, which ensures that this diff -Nrcpad gcc-4.5.2/gcc/ada/s-stausa.adb gcc-4.6.0/gcc/ada/s-stausa.adb *** gcc-4.5.2/gcc/ada/s-stausa.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-stausa.adb Mon Oct 18 10:34:56 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package body System.Stack_Usage is *** 232,238 **** "ENVIRONMENT TASK", My_Stack_Size, My_Stack_Size, ! System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address)); Fill_Stack (Environment_Task_Analyzer); --- 232,239 ---- "ENVIRONMENT TASK", My_Stack_Size, My_Stack_Size, ! System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address), ! 0); Fill_Stack (Environment_Task_Analyzer); *************** package body System.Stack_Usage is *** 259,314 **** Stack_Used_When_Filling : Integer; Current_Stack_Level : aliased Integer; begin ! -- Readjust the pattern size. When we arrive in this function, there is ! -- already a given amount of stack used, that we won't analyze. ! Stack_Used_When_Filling := ! Stack_Size ! (Analyzer.Bottom_Of_Stack, ! To_Stack_Address (Current_Stack_Level'Address)) ! + Natural (Current_Stack_Level'Size); ! if Stack_Used_When_Filling > Analyzer.Pattern_Size then ! -- In this case, the known size of the stack is too small, we've ! -- already taken more than expected, so there's no possible ! -- computation - Analyzer.Pattern_Size := 0; else ! Analyzer.Pattern_Size := ! Analyzer.Pattern_Size - Stack_Used_When_Filling; ! end if; ! declare ! Stack : aliased Stack_Slots ! (1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern); ! begin ! Stack := (others => Analyzer.Pattern); ! Analyzer.Stack_Overlay_Address := Stack'Address; ! if Analyzer.Pattern_Size /= 0 then ! Analyzer.Bottom_Pattern_Mark := ! To_Stack_Address (Stack (Bottom_Slot_Index_In (Stack))'Address); ! Analyzer.Top_Pattern_Mark := ! To_Stack_Address (Stack (Top_Slot_Index_In (Stack))'Address); else ! Analyzer.Bottom_Pattern_Mark := To_Stack_Address (Stack'Address); ! Analyzer.Top_Pattern_Mark := To_Stack_Address (Stack'Address); end if; ! -- If Arr has been packed, the following assertion must be true (we ! -- add the size of the element whose address is: ! -- Min (Analyzer.Inner_Pattern_Mark, Analyzer.Outer_Pattern_Mark)): ! pragma Assert ! (Analyzer.Pattern_Size = 0 or else ! Analyzer.Pattern_Size = ! Stack_Size ! (Analyzer.Top_Pattern_Mark, Analyzer.Bottom_Pattern_Mark)); ! end; end Fill_Stack; ------------------------- --- 260,355 ---- Stack_Used_When_Filling : Integer; Current_Stack_Level : aliased Integer; + Guard : constant Integer := 256; + -- Guard space between the Current_Stack_Level'Address and the last + -- allocated byte on the stack. + begin ! -- Easiest and most accurate method: the top of the stack is known. ! if Analyzer.Top_Pattern_Mark /= 0 then ! Analyzer.Pattern_Size := ! Stack_Size (Analyzer.Top_Pattern_Mark, ! To_Stack_Address (Current_Stack_Level'Address)) ! - Guard; ! if System.Parameters.Stack_Grows_Down then ! Analyzer.Stack_Overlay_Address := ! To_Address (Analyzer.Top_Pattern_Mark); ! else ! Analyzer.Stack_Overlay_Address := ! To_Address (Analyzer.Top_Pattern_Mark ! - Stack_Address (Analyzer.Pattern_Size)); ! end if; ! ! declare ! Pattern : aliased Stack_Slots ! (1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern); ! for Pattern'Address use Analyzer.Stack_Overlay_Address; ! ! begin ! if System.Parameters.Stack_Grows_Down then ! for J in reverse Pattern'Range loop ! Pattern (J) := Analyzer.Pattern; ! end loop; ! ! Analyzer.Bottom_Pattern_Mark := ! To_Stack_Address (Pattern (Pattern'Last)'Address); ! ! else ! for J in Pattern'Range loop ! Pattern (J) := Analyzer.Pattern; ! end loop; ! ! Analyzer.Bottom_Pattern_Mark := ! To_Stack_Address (Pattern (Pattern'First)'Address); ! end if; ! end; else ! -- Readjust the pattern size. When we arrive in this function, there ! -- is already a given amount of stack used, that we won't analyze. ! Stack_Used_When_Filling := ! Stack_Size (Analyzer.Bottom_Of_Stack, ! To_Stack_Address (Current_Stack_Level'Address)); ! if Stack_Used_When_Filling > Analyzer.Pattern_Size then ! -- In this case, the known size of the stack is too small, we've ! -- already taken more than expected, so there's no possible ! -- computation ! Analyzer.Pattern_Size := 0; else ! Analyzer.Pattern_Size := ! Analyzer.Pattern_Size - Stack_Used_When_Filling; end if; ! declare ! Stack : aliased Stack_Slots ! (1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern); ! begin ! Stack := (others => Analyzer.Pattern); ! ! Analyzer.Stack_Overlay_Address := Stack'Address; ! ! if Analyzer.Pattern_Size /= 0 then ! Analyzer.Bottom_Pattern_Mark := ! To_Stack_Address ! (Stack (Bottom_Slot_Index_In (Stack))'Address); ! Analyzer.Top_Pattern_Mark := ! To_Stack_Address ! (Stack (Top_Slot_Index_In (Stack))'Address); ! else ! Analyzer.Bottom_Pattern_Mark := ! To_Stack_Address (Stack'Address); ! Analyzer.Top_Pattern_Mark := ! To_Stack_Address (Stack'Address); ! end if; ! end; ! end if; end Fill_Stack; ------------------------- *************** package body System.Stack_Usage is *** 321,337 **** My_Stack_Size : Natural; Max_Pattern_Size : Natural; Bottom : Stack_Address; Pattern : Unsigned_32 := 16#DEAD_BEEF#) is begin -- Initialize the analyzer fields ! Analyzer.Bottom_Of_Stack := Bottom; ! Analyzer.Stack_Size := My_Stack_Size; ! Analyzer.Pattern_Size := Max_Pattern_Size; ! Analyzer.Pattern := Pattern; ! Analyzer.Result_Id := Next_Id; ! Analyzer.Task_Name := (others => ' '); -- Compute the task name, and truncate if bigger than Task_Name_Length --- 362,380 ---- My_Stack_Size : Natural; Max_Pattern_Size : Natural; Bottom : Stack_Address; + Top : Stack_Address; Pattern : Unsigned_32 := 16#DEAD_BEEF#) is begin -- Initialize the analyzer fields ! Analyzer.Bottom_Of_Stack := Bottom; ! Analyzer.Stack_Size := My_Stack_Size; ! Analyzer.Pattern_Size := Max_Pattern_Size; ! Analyzer.Pattern := Pattern; ! Analyzer.Result_Id := Next_Id; ! Analyzer.Task_Name := (others => ' '); ! Analyzer.Top_Pattern_Mark := Top; -- Compute the task name, and truncate if bigger than Task_Name_Length diff -Nrcpad gcc-4.5.2/gcc/ada/s-stausa.ads gcc-4.6.0/gcc/ada/s-stausa.ads *** gcc-4.5.2/gcc/ada/s-stausa.ads Wed Apr 29 10:30:53 2009 --- gcc-4.6.0/gcc/ada/s-stausa.ads Mon Oct 18 10:18:07 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2004-2010, 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- -- *************** package System.Stack_Usage is *** 218,227 **** -- | of Fill_Stack | | -- | (deallocated at | | -- | the end of the call) | | ! -- ^ | | ! -- Analyzer.Bottom_Of_Stack ^ | ! -- Analyzer.Bottom_Pattern_Mark ^ ! -- Analyzer.Top_Pattern_Mark procedure Initialize_Analyzer (Analyzer : in out Stack_Analyzer; --- 218,228 ---- -- | of Fill_Stack | | -- | (deallocated at | | -- | the end of the call) | | ! -- ^ | ^ ! -- Analyzer.Bottom_Of_Stack | Analyzer.Top_Pattern_Mark ! -- ^ ! -- Analyzer.Bottom_Pattern_Mark ! -- procedure Initialize_Analyzer (Analyzer : in out Stack_Analyzer; *************** package System.Stack_Usage is *** 229,234 **** --- 230,236 ---- My_Stack_Size : Natural; Max_Pattern_Size : Natural; Bottom : Stack_Address; + Top : Stack_Address; Pattern : Interfaces.Unsigned_32 := 16#DEAD_BEEF#); -- Should be called before any use of a Stack_Analyzer, to initialize it. -- Max_Pattern_Size is the size of the pattern zone, might be smaller than diff -Nrcpad gcc-4.5.2/gcc/ada/s-stchop.adb gcc-4.6.0/gcc/ada/s-stchop.adb *** gcc-4.5.2/gcc/ada/s-stchop.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-stchop.adb Tue Jun 22 17:04:37 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2010, 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- -- *************** package body System.Stack_Checking.Opera *** 48,75 **** function Set_Stack_Info (Stack : not null access Stack_Access) return Stack_Access; - -- The function Set_Stack_Info is the actual function that updates the -- cache containing a pointer to the Stack_Info. It may also be used for -- detecting asynchronous abort in combination with Invalidate_Self_Cache. ! -- Set_Stack_Info should do the following things in order: -- 1) Get the Stack_Access value for the current task -- 2) Set Stack.all to the value obtained in 1) -- 3) Optionally Poll to check for asynchronous abort ! -- This order is important because if at any time a write to the stack -- cache is pending, that write should be followed by a Poll to prevent -- loosing signals. ! -- Note: This function must be compiled with Polling turned off ! ! -- Note: on systems like VxWorks and OS/2 with real thread-local storage, ! -- Set_Stack_Info should return an access value for such local ! -- storage. In those cases the cache will always be up-to-date. ! ! -- The following constants should be imported from some system-specific ! -- constants package. The constants must be static for performance reasons. ---------------------------- -- Invalidate_Stack_Cache -- --- 48,71 ---- function Set_Stack_Info (Stack : not null access Stack_Access) return Stack_Access; -- The function Set_Stack_Info is the actual function that updates the -- cache containing a pointer to the Stack_Info. It may also be used for -- detecting asynchronous abort in combination with Invalidate_Self_Cache. ! -- -- Set_Stack_Info should do the following things in order: -- 1) Get the Stack_Access value for the current task -- 2) Set Stack.all to the value obtained in 1) -- 3) Optionally Poll to check for asynchronous abort ! -- -- This order is important because if at any time a write to the stack -- cache is pending, that write should be followed by a Poll to prevent -- loosing signals. ! -- -- Note: This function must be compiled with Polling turned off ! -- ! -- Note: on systems with real thread-local storage, Set_Stack_Info should ! -- return an access value for such local storage. In those cases the cache ! -- will always be up-to-date. ---------------------------- -- Invalidate_Stack_Cache -- diff -Nrcpad gcc-4.5.2/gcc/ada/s-stoele.adb gcc-4.6.0/gcc/ada/s-stoele.adb *** gcc-4.5.2/gcc/ada/s-stoele.adb Fri Apr 17 13:07:12 2009 --- gcc-4.6.0/gcc/ada/s-stoele.adb Thu Jun 17 15:23:55 2010 *************** package body System.Storage_Elements is *** 37,42 **** --- 37,46 ---- pragma Suppress (All_Checks); + -- Conversion to/from address + + -- Note qualification below of To_Address to avoid ambiguities on VMS + function To_Address is new Ada.Unchecked_Conversion (Storage_Offset, Address); function To_Offset is *************** package body System.Storage_Elements is *** 47,84 **** -- These functions must be place first because they are inlined_always -- and are used and inlined in other subprograms defined in this unit. ! function To_Integer (Value : Address) return Integer_Address is ! begin ! return Integer_Address (Value); ! end To_Integer; function To_Address (Value : Integer_Address) return Address is begin return Address (Value); end To_Address; -- Address arithmetic function "+" (Left : Address; Right : Storage_Offset) return Address is begin ! return To_Address (To_Integer (Left) + To_Integer (To_Address (Right))); end "+"; function "+" (Left : Storage_Offset; Right : Address) return Address is begin ! return To_Address (To_Integer (To_Address (Left)) + To_Integer (Right)); end "+"; function "-" (Left : Address; Right : Storage_Offset) return Address is begin ! return To_Address (To_Integer (Left) - To_Integer (To_Address (Right))); end "-"; function "-" (Left, Right : Address) return Storage_Offset is begin ! return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right))); end "-"; function "mod" (Left : Address; Right : Storage_Offset) return Storage_Offset --- 51,112 ---- -- These functions must be place first because they are inlined_always -- and are used and inlined in other subprograms defined in this unit. ! ---------------- ! -- To_Address -- ! ---------------- function To_Address (Value : Integer_Address) return Address is begin return Address (Value); end To_Address; + ---------------- + -- To_Integer -- + ---------------- + + function To_Integer (Value : Address) return Integer_Address is + begin + return Integer_Address (Value); + end To_Integer; + -- Address arithmetic + --------- + -- "+" -- + --------- + function "+" (Left : Address; Right : Storage_Offset) return Address is begin ! return Storage_Elements.To_Address ! (To_Integer (Left) + To_Integer (To_Address (Right))); end "+"; function "+" (Left : Storage_Offset; Right : Address) return Address is begin ! return Storage_Elements.To_Address ! (To_Integer (To_Address (Left)) + To_Integer (Right)); end "+"; + --------- + -- "-" -- + --------- + function "-" (Left : Address; Right : Storage_Offset) return Address is begin ! return Storage_Elements.To_Address ! (To_Integer (Left) - To_Integer (To_Address (Right))); end "-"; function "-" (Left, Right : Address) return Storage_Offset is begin ! return To_Offset (Storage_Elements.To_Address ! (To_Integer (Left) - To_Integer (Right))); end "-"; + ----------- + -- "mod" -- + ----------- + function "mod" (Left : Address; Right : Storage_Offset) return Storage_Offset *************** package body System.Storage_Elements is *** 98,101 **** --- 126,130 ---- raise Constraint_Error; end if; end "mod"; + end System.Storage_Elements; diff -Nrcpad gcc-4.5.2/gcc/ada/s-stratt-xdr.adb gcc-4.6.0/gcc/ada/s-stratt-xdr.adb *** gcc-4.5.2/gcc/ada/s-stratt-xdr.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/s-stratt-xdr.adb Thu Sep 9 12:31:35 2010 *************** *** 0 **** --- 1,1891 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT RUN-TIME COMPONENTS -- + -- -- + -- S Y S T E M . S T R E A M _ A T T R I B U T E S -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 1996-2010, 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- -- + -- 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- 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 endianness. + + with Ada.IO_Exceptions; + with Ada.Streams; use Ada.Streams; + with Ada.Unchecked_Conversion; + + package body System.Stream_Attributes is + + pragma Suppress (Range_Check); + pragma Suppress (Overflow_Check); + + use UST; + + Data_Error : exception renames Ada.IO_Exceptions.End_Error; + -- Exception raised if insufficient data read (End_Error is mandated by + -- AI95-00132). + + SU : constant := System.Storage_Unit; + -- The code in this body assumes that SU = 8 + + BB : constant := 2 ** SU; -- Byte base + BL : constant := 2 ** SU - 1; -- Byte last + BS : constant := 2 ** (SU - 1); -- Byte sign + + US : constant := Unsigned'Size; -- Unsigned size + UB : constant := (US - 1) / SU + 1; -- Unsigned byte + UL : constant := 2 ** US - 1; -- Unsigned last + + subtype SE is Ada.Streams.Stream_Element; + subtype SEA is Ada.Streams.Stream_Element_Array; + subtype SEO is Ada.Streams.Stream_Element_Offset; + + generic function UC renames Ada.Unchecked_Conversion; + + type Field_Type is + record + E_Size : Integer; -- Exponent bit size + E_Bias : Integer; -- Exponent bias + 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 completely used + F_Bytes : SEO; -- N. of fraction bytes completely used + F_Bits : Integer; -- N. of bits used on first fraction word + end record; + + type Precision is (Single, Double, Quadruple); + + Fields : constant array (Precision) of Field_Type := ( + + -- Single precision + + (E_Size => 8, + E_Bias => 127, + F_Size => 23, + E_Last => 2 ** 8 - 1, + F_Mask => 16#7F#, -- 2 ** 7 - 1, + E_Bytes => 2, + F_Bytes => 3, + F_Bits => 23 mod US), + + -- Double precision + + (E_Size => 11, + E_Bias => 1023, + F_Size => 52, + E_Last => 2 ** 11 - 1, + F_Mask => 16#0F#, -- 2 ** 4 - 1, + E_Bytes => 2, + F_Bytes => 7, + F_Bits => 52 mod US), + + -- Quadruple precision + + (E_Size => 15, + E_Bias => 16383, + F_Size => 112, + E_Last => 2 ** 8 - 1, + F_Mask => 16#FF#, -- 2 ** 8 - 1, + E_Bytes => 2, + F_Bytes => 14, + F_Bits => 112 mod US)); + + -- The representation of all items requires a multiple of four bytes + -- (or 32 bits) of data. The bytes are numbered 0 through n-1. The bytes + -- are read or written to some byte stream such that byte m always + -- precedes byte m+1. If the n bytes needed to contain the data are not + -- a multiple of four, then the n bytes are followed by enough (0 to 3) + -- residual zero bytes, r, to make the total byte count a multiple of 4. + + -- An XDR signed integer is a 32-bit datum that encodes an integer + -- in the range [-2147483648,2147483647]. The integer is represented + -- in two's complement notation. The most and least significant bytes + -- are 0 and 3, respectively. Integers are declared as follows: + + -- (MSB) (LSB) + -- +-------+-------+-------+-------+ + -- |byte 0 |byte 1 |byte 2 |byte 3 | + -- +-------+-------+-------+-------+ + -- <------------32 bits------------> + + SSI_L : constant := 1; + SI_L : constant := 2; + I_L : constant := 4; + LI_L : constant := 8; + LLI_L : constant := 8; + + subtype XDR_S_SSI is SEA (1 .. SSI_L); + subtype XDR_S_SI is SEA (1 .. SI_L); + subtype XDR_S_I is SEA (1 .. I_L); + subtype XDR_S_LI is SEA (1 .. LI_L); + subtype XDR_S_LLI is SEA (1 .. LLI_L); + + function Short_Short_Integer_To_XDR_S_SSI is + new Ada.Unchecked_Conversion (Short_Short_Integer, XDR_S_SSI); + function XDR_S_SSI_To_Short_Short_Integer is + new Ada.Unchecked_Conversion (XDR_S_SSI, Short_Short_Integer); + + function Short_Integer_To_XDR_S_SI is + new Ada.Unchecked_Conversion (Short_Integer, XDR_S_SI); + function XDR_S_SI_To_Short_Integer is + new Ada.Unchecked_Conversion (XDR_S_SI, Short_Integer); + + function Integer_To_XDR_S_I is + new Ada.Unchecked_Conversion (Integer, XDR_S_I); + function XDR_S_I_To_Integer is + new Ada.Unchecked_Conversion (XDR_S_I, Integer); + + function Long_Long_Integer_To_XDR_S_LI is + new Ada.Unchecked_Conversion (Long_Long_Integer, XDR_S_LI); + function XDR_S_LI_To_Long_Long_Integer is + new Ada.Unchecked_Conversion (XDR_S_LI, Long_Long_Integer); + + function Long_Long_Integer_To_XDR_S_LLI is + new Ada.Unchecked_Conversion (Long_Long_Integer, XDR_S_LLI); + function XDR_S_LLI_To_Long_Long_Integer is + new Ada.Unchecked_Conversion (XDR_S_LLI, Long_Long_Integer); + + -- An XDR unsigned integer is a 32-bit datum that encodes a nonnegative + -- integer in the range [0,4294967295]. It is represented by an unsigned + -- binary number whose most and least significant bytes are 0 and 3, + -- respectively. An unsigned integer is declared as follows: + + -- (MSB) (LSB) + -- +-------+-------+-------+-------+ + -- |byte 0 |byte 1 |byte 2 |byte 3 | + -- +-------+-------+-------+-------+ + -- <------------32 bits------------> + + SSU_L : constant := 1; + SU_L : constant := 2; + U_L : constant := 4; + LU_L : constant := 8; + LLU_L : constant := 8; + + subtype XDR_S_SSU is SEA (1 .. SSU_L); + subtype XDR_S_SU is SEA (1 .. SU_L); + subtype XDR_S_U is SEA (1 .. U_L); + subtype XDR_S_LU is SEA (1 .. LU_L); + subtype XDR_S_LLU is SEA (1 .. LLU_L); + + type XDR_SSU is mod BB ** SSU_L; + type XDR_SU is mod BB ** SU_L; + type XDR_U is mod BB ** U_L; + + function Short_Unsigned_To_XDR_S_SU is + new Ada.Unchecked_Conversion (Short_Unsigned, XDR_S_SU); + function XDR_S_SU_To_Short_Unsigned is + new Ada.Unchecked_Conversion (XDR_S_SU, Short_Unsigned); + + function Unsigned_To_XDR_S_U is + new Ada.Unchecked_Conversion (Unsigned, XDR_S_U); + function XDR_S_U_To_Unsigned is + new Ada.Unchecked_Conversion (XDR_S_U, Unsigned); + + function Long_Long_Unsigned_To_XDR_S_LU is + new Ada.Unchecked_Conversion (Long_Long_Unsigned, XDR_S_LU); + function XDR_S_LU_To_Long_Long_Unsigned is + new Ada.Unchecked_Conversion (XDR_S_LU, Long_Long_Unsigned); + + function Long_Long_Unsigned_To_XDR_S_LLU is + new Ada.Unchecked_Conversion (Long_Long_Unsigned, XDR_S_LLU); + function XDR_S_LLU_To_Long_Long_Unsigned is + new Ada.Unchecked_Conversion (XDR_S_LLU, Long_Long_Unsigned); + + -- The standard defines the floating-point data type "float" (32 bits + -- or 4 bytes). The encoding used is the IEEE standard for normalized + -- single-precision floating-point numbers. + + -- The standard defines the encoding used for the double-precision + -- floating-point data type "double" (64 bits or 8 bytes). The encoding + -- used is the IEEE standard for normalized double-precision floating-point + -- numbers. + + SF_L : constant := 4; -- Single precision + F_L : constant := 4; -- Single precision + LF_L : constant := 8; -- Double precision + LLF_L : constant := 16; -- Quadruple precision + + TM_L : constant := 8; + subtype XDR_S_TM is SEA (1 .. TM_L); + type XDR_TM is mod BB ** TM_L; + + type XDR_SA is mod 2 ** Standard'Address_Size; + function To_XDR_SA is new UC (System.Address, XDR_SA); + function To_XDR_SA is new UC (XDR_SA, System.Address); + + -- Enumerations have the same representation as signed integers. + -- Enumerations are handy for describing subsets of the integers. + + -- Booleans are important enough and occur frequently enough to warrant + -- their own explicit type in the standard. Booleans are declared as + -- an enumeration, with FALSE = 0 and TRUE = 1. + + -- The standard defines a string of n (numbered 0 through n-1) ASCII + -- bytes to be the number n encoded as an unsigned integer (as described + -- above), and followed by the n bytes of the string. Byte m of the string + -- always precedes byte m+1 of the string, and byte 0 of the string always + -- follows the string's length. If n is not a multiple of four, then the + -- n bytes are followed by enough (0 to 3) residual zero bytes, r, to make + -- the total byte count a multiple of four. + + -- To fit with XDR string, do not consider character as an enumeration + -- type. + + C_L : constant := 1; + subtype XDR_S_C is SEA (1 .. C_L); + + -- Consider Wide_Character as an enumeration type + + WC_L : constant := 4; + 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 + -- conversions. + + 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 -- + ---------- + + function I_AD (Stream : not null access RST) return Fat_Pointer is + FP : Fat_Pointer; + + begin + FP.P1 := I_AS (Stream).P1; + FP.P2 := I_AS (Stream).P1; + + return FP; + end I_AD; + + ---------- + -- I_AS -- + ---------- + + function I_AS (Stream : not null access RST) return Thin_Pointer is + S : XDR_S_TM; + L : SEO; + U : XDR_TM := 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_TM (S (N)); + end loop; + + return (P1 => To_XDR_SA (XDR_SA (U))); + end if; + end I_AS; + + --------- + -- I_B -- + --------- + + function I_B (Stream : not null access RST) return Boolean is + begin + case I_SSU (Stream) is + when 0 => return False; + when 1 => return True; + when others => raise Data_Error; + end case; + end I_B; + + --------- + -- I_C -- + --------- + + function I_C (Stream : not null access RST) return Character is + S : XDR_S_C; + L : SEO; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + else + -- Use Ada requirements on Character representation clause + + return Character'Val (S (1)); + end if; + end I_C; + + --------- + -- I_F -- + --------- + + function I_F (Stream : not null access RST) return Float is + I : constant Precision := Single; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Last : Integer renames Fields (I).E_Last; + F_Mask : SE renames Fields (I).F_Mask; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + + Positive : Boolean; + Exponent : Long_Unsigned; + Fraction : Long_Unsigned; + Result : Float; + S : SEA (1 .. F_L); + L : SEO; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + end if; + + -- Extract Fraction, Sign and Exponent + + Fraction := Long_Unsigned (S (F_L + 1 - F_Bytes) and F_Mask); + for N in F_L + 2 - F_Bytes .. F_L loop + Fraction := Fraction * BB + Long_Unsigned (S (N)); + end loop; + Result := Float'Scaling (Float (Fraction), -F_Size); + + if BS <= S (1) then + Positive := False; + Exponent := Long_Unsigned (S (1) - BS); + else + Positive := True; + Exponent := Long_Unsigned (S (1)); + end if; + + for N in 2 .. E_Bytes loop + Exponent := Exponent * BB + Long_Unsigned (S (N)); + end loop; + Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + + -- NaN or Infinities + + if Integer (Exponent) = E_Last then + raise Constraint_Error; + + elsif Exponent = 0 then + + -- Signed zeros + + if Fraction = 0 then + null; + + -- Denormalized float + + else + Result := Float'Scaling (Result, 1 - E_Bias); + end if; + + -- Normalized float + + else + Result := Float'Scaling + (1.0 + Result, Integer (Exponent) - E_Bias); + end if; + + if not Positive then + Result := -Result; + end if; + + return Result; + end I_F; + + --------- + -- I_I -- + --------- + + function I_I (Stream : not null access RST) return Integer is + S : XDR_S_I; + L : SEO; + U : XDR_U := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return XDR_S_I_To_Integer (S); + + else + for N in S'Range loop + U := U * BB + XDR_U (S (N)); + end loop; + + -- Test sign and apply two complement notation + + if S (1) < BL then + return Integer (U); + + else + return Integer (-((XDR_U'Last xor U) + 1)); + end if; + end if; + end I_I; + + ---------- + -- I_LF -- + ---------- + + function I_LF (Stream : not null access RST) return Long_Float is + I : constant Precision := Double; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Last : Integer renames Fields (I).E_Last; + F_Mask : SE renames Fields (I).F_Mask; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + + Positive : Boolean; + Exponent : Long_Unsigned; + Fraction : Long_Long_Unsigned; + Result : Long_Float; + S : SEA (1 .. LF_L); + L : SEO; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + end if; + + -- Extract Fraction, Sign and Exponent + + Fraction := Long_Long_Unsigned (S (LF_L + 1 - F_Bytes) and F_Mask); + for N in LF_L + 2 - F_Bytes .. LF_L loop + Fraction := Fraction * BB + Long_Long_Unsigned (S (N)); + end loop; + + Result := Long_Float'Scaling (Long_Float (Fraction), -F_Size); + + if BS <= S (1) then + Positive := False; + Exponent := Long_Unsigned (S (1) - BS); + else + Positive := True; + Exponent := Long_Unsigned (S (1)); + end if; + + for N in 2 .. E_Bytes loop + Exponent := Exponent * BB + Long_Unsigned (S (N)); + end loop; + + Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + + -- NaN or Infinities + + if Integer (Exponent) = E_Last then + raise Constraint_Error; + + elsif Exponent = 0 then + + -- Signed zeros + + if Fraction = 0 then + null; + + -- Denormalized float + + else + Result := Long_Float'Scaling (Result, 1 - E_Bias); + end if; + + -- Normalized float + + else + Result := Long_Float'Scaling + (1.0 + Result, Integer (Exponent) - E_Bias); + end if; + + if not Positive then + Result := -Result; + end if; + + return Result; + end I_LF; + + ---------- + -- I_LI -- + ---------- + + function I_LI (Stream : not null access RST) return Long_Integer is + S : XDR_S_LI; + L : SEO; + U : Unsigned := 0; + X : Long_Unsigned := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return Long_Integer (XDR_S_LI_To_Long_Long_Integer (S)); + + else + + -- Compute using machine unsigned + -- rather than long_long_unsigned + + for N in S'Range loop + U := U * BB + Unsigned (S (N)); + + -- We have filled an unsigned + + if N mod UB = 0 then + X := Shift_Left (X, US) + Long_Unsigned (U); + U := 0; + end if; + end loop; + + -- Test sign and apply two complement notation + + if S (1) < BL then + return Long_Integer (X); + else + return Long_Integer (-((Long_Unsigned'Last xor X) + 1)); + end if; + + end if; + end I_LI; + + ----------- + -- I_LLF -- + ----------- + + function I_LLF (Stream : not null access RST) return Long_Long_Float is + I : constant Precision := Quadruple; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Last : Integer renames Fields (I).E_Last; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + + Positive : Boolean; + Exponent : Long_Unsigned; + Fraction_1 : Long_Long_Unsigned := 0; + Fraction_2 : Long_Long_Unsigned := 0; + Result : Long_Long_Float; + HF : constant Natural := F_Size / 2; + S : SEA (1 .. LLF_L); + L : SEO; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + end if; + + -- Extract Fraction, Sign and Exponent + + for I in LLF_L - F_Bytes + 1 .. LLF_L - 7 loop + Fraction_1 := Fraction_1 * BB + Long_Long_Unsigned (S (I)); + end loop; + + for I in SEO (LLF_L - 6) .. SEO (LLF_L) loop + Fraction_2 := Fraction_2 * BB + Long_Long_Unsigned (S (I)); + end loop; + + Result := Long_Long_Float'Scaling (Long_Long_Float (Fraction_2), -HF); + Result := Long_Long_Float (Fraction_1) + Result; + Result := Long_Long_Float'Scaling (Result, HF - F_Size); + + if BS <= S (1) then + Positive := False; + Exponent := Long_Unsigned (S (1) - BS); + else + Positive := True; + Exponent := Long_Unsigned (S (1)); + end if; + + for N in 2 .. E_Bytes loop + Exponent := Exponent * BB + Long_Unsigned (S (N)); + end loop; + + Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + + -- NaN or Infinities + + if Integer (Exponent) = E_Last then + raise Constraint_Error; + + elsif Exponent = 0 then + + -- Signed zeros + + if Fraction_1 = 0 and then Fraction_2 = 0 then + null; + + -- Denormalized float + + else + Result := Long_Long_Float'Scaling (Result, 1 - E_Bias); + end if; + + -- Normalized float + + else + Result := Long_Long_Float'Scaling + (1.0 + Result, Integer (Exponent) - E_Bias); + end if; + + if not Positive then + Result := -Result; + end if; + + return Result; + end I_LLF; + + ----------- + -- I_LLI -- + ----------- + + function I_LLI (Stream : not null access RST) return Long_Long_Integer is + S : XDR_S_LLI; + L : SEO; + U : Unsigned := 0; + X : Long_Long_Unsigned := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return XDR_S_LLI_To_Long_Long_Integer (S); + + else + -- Compute using machine unsigned for computing + -- rather than long_long_unsigned. + + for N in S'Range loop + U := U * BB + Unsigned (S (N)); + + -- We have filled an unsigned + + if N mod UB = 0 then + X := Shift_Left (X, US) + Long_Long_Unsigned (U); + U := 0; + end if; + end loop; + + -- Test sign and apply two complement notation + + if S (1) < BL then + return Long_Long_Integer (X); + else + return Long_Long_Integer (-((Long_Long_Unsigned'Last xor X) + 1)); + end if; + end if; + end I_LLI; + + ----------- + -- I_LLU -- + ----------- + + function I_LLU (Stream : not null access RST) return Long_Long_Unsigned is + S : XDR_S_LLU; + L : SEO; + U : Unsigned := 0; + X : Long_Long_Unsigned := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return XDR_S_LLU_To_Long_Long_Unsigned (S); + + else + -- Compute using machine unsigned + -- rather than long_long_unsigned. + + for N in S'Range loop + U := U * BB + Unsigned (S (N)); + + -- We have filled an unsigned + + if N mod UB = 0 then + X := Shift_Left (X, US) + Long_Long_Unsigned (U); + U := 0; + end if; + end loop; + + return X; + end if; + end I_LLU; + + ---------- + -- I_LU -- + ---------- + + function I_LU (Stream : not null access RST) return Long_Unsigned is + S : XDR_S_LU; + L : SEO; + U : Unsigned := 0; + X : Long_Unsigned := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return Long_Unsigned (XDR_S_LU_To_Long_Long_Unsigned (S)); + + else + -- Compute using machine unsigned + -- rather than long_unsigned. + + for N in S'Range loop + U := U * BB + Unsigned (S (N)); + + -- We have filled an unsigned + + if N mod UB = 0 then + X := Shift_Left (X, US) + Long_Unsigned (U); + U := 0; + end if; + end loop; + + return X; + end if; + end I_LU; + + ---------- + -- I_SF -- + ---------- + + function I_SF (Stream : not null access RST) return Short_Float is + I : constant Precision := Single; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Last : Integer renames Fields (I).E_Last; + F_Mask : SE renames Fields (I).F_Mask; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + + Exponent : Long_Unsigned; + Fraction : Long_Unsigned; + Positive : Boolean; + Result : Short_Float; + S : SEA (1 .. SF_L); + L : SEO; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + end if; + + -- Extract Fraction, Sign and Exponent + + Fraction := Long_Unsigned (S (SF_L + 1 - F_Bytes) and F_Mask); + for N in SF_L + 2 - F_Bytes .. SF_L loop + Fraction := Fraction * BB + Long_Unsigned (S (N)); + end loop; + Result := Short_Float'Scaling (Short_Float (Fraction), -F_Size); + + if BS <= S (1) then + Positive := False; + Exponent := Long_Unsigned (S (1) - BS); + else + Positive := True; + Exponent := Long_Unsigned (S (1)); + end if; + + for N in 2 .. E_Bytes loop + Exponent := Exponent * BB + Long_Unsigned (S (N)); + end loop; + Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + + -- NaN or Infinities + + if Integer (Exponent) = E_Last then + raise Constraint_Error; + + elsif Exponent = 0 then + + -- Signed zeros + + if Fraction = 0 then + null; + + -- Denormalized float + + else + Result := Short_Float'Scaling (Result, 1 - E_Bias); + end if; + + -- Normalized float + + else + Result := Short_Float'Scaling + (1.0 + Result, Integer (Exponent) - E_Bias); + end if; + + if not Positive then + Result := -Result; + end if; + + return Result; + end I_SF; + + ---------- + -- I_SI -- + ---------- + + function I_SI (Stream : not null access RST) return Short_Integer is + S : XDR_S_SI; + L : SEO; + U : XDR_SU := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return XDR_S_SI_To_Short_Integer (S); + + else + for N in S'Range loop + U := U * BB + XDR_SU (S (N)); + end loop; + + -- Test sign and apply two complement notation + + if S (1) < BL then + return Short_Integer (U); + else + return Short_Integer (-((XDR_SU'Last xor U) + 1)); + end if; + end if; + end I_SI; + + ----------- + -- I_SSI -- + ----------- + + function I_SSI (Stream : not null access RST) return Short_Short_Integer is + S : XDR_S_SSI; + L : SEO; + U : XDR_SSU; + + begin + Ada.Streams.Read (Stream.all, S, L); + + 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)); + + -- Test sign and apply two complement notation + + if S (1) < BL then + return Short_Short_Integer (U); + else + return Short_Short_Integer (-((XDR_SSU'Last xor U) + 1)); + end if; + end if; + end I_SSI; + + ----------- + -- I_SSU -- + ----------- + + function I_SSU (Stream : not null access RST) return Short_Short_Unsigned is + S : XDR_S_SSU; + L : SEO; + U : XDR_SSU := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + else + U := XDR_SSU (S (1)); + return Short_Short_Unsigned (U); + end if; + end I_SSU; + + ---------- + -- I_SU -- + ---------- + + function I_SU (Stream : not null access RST) return Short_Unsigned is + S : XDR_S_SU; + L : SEO; + U : XDR_SU := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + 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)); + end loop; + + return Short_Unsigned (U); + end if; + end I_SU; + + --------- + -- I_U -- + --------- + + function I_U (Stream : not null access RST) return Unsigned is + S : XDR_S_U; + L : SEO; + U : XDR_U := 0; + + begin + Ada.Streams.Read (Stream.all, S, L); + + if L /= S'Last then + raise Data_Error; + + elsif Optimize_Integers then + return XDR_S_U_To_Unsigned (S); + + else + for N in S'Range loop + U := U * BB + XDR_U (S (N)); + end loop; + + return Unsigned (U); + end if; + end I_U; + + ---------- + -- I_WC -- + ---------- + + function I_WC (Stream : not null access RST) return Wide_Character is + S : XDR_S_WC; + L : SEO; + U : XDR_WC := 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_WC (S (N)); + end loop; + + -- Use Ada requirements on Wide_Character representation clause + + return Wide_Character'Val (U); + 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 -- + ---------- + + procedure W_AD (Stream : not null access RST; Item : Fat_Pointer) is + S : XDR_S_TM; + U : XDR_TM; + + begin + U := XDR_TM (To_XDR_SA (Item.P1)); + for N in reverse S'Range loop + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + Ada.Streams.Write (Stream.all, S); + + U := XDR_TM (To_XDR_SA (Item.P2)); + 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_AD; + + ---------- + -- W_AS -- + ---------- + + procedure W_AS (Stream : not null access RST; Item : Thin_Pointer) is + S : XDR_S_TM; + U : XDR_TM := XDR_TM (To_XDR_SA (Item.P1)); + + begin + 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_AS; + + --------- + -- W_B -- + --------- + + procedure W_B (Stream : not null access RST; Item : Boolean) is + begin + if Item then + W_SSU (Stream, 1); + else + W_SSU (Stream, 0); + end if; + end W_B; + + --------- + -- W_C -- + --------- + + procedure W_C (Stream : not null access RST; Item : Character) is + S : XDR_S_C; + + pragma Assert (C_L = 1); + + begin + -- Use Ada requirements on Character representation clause + + S (1) := SE (Character'Pos (Item)); + + Ada.Streams.Write (Stream.all, S); + end W_C; + + --------- + -- W_F -- + --------- + + procedure W_F (Stream : not null access RST; Item : Float) is + I : constant Precision := Single; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + F_Mask : SE renames Fields (I).F_Mask; + + Exponent : Long_Unsigned; + Fraction : Long_Unsigned; + Positive : Boolean; + E : Integer; + F : Float; + S : SEA (1 .. F_L) := (others => 0); + + begin + if not Item'Valid then + raise Constraint_Error; + end if; + + -- Compute Sign + + Positive := (0.0 <= Item); + F := abs (Item); + + -- Signed zero + + if F = 0.0 then + Exponent := 0; + Fraction := 0; + + else + E := Float'Exponent (F) - 1; + + -- Denormalized float + + if E <= -E_Bias then + F := Float'Scaling (F, F_Size + E_Bias - 1); + E := -E_Bias; + else + F := Float'Scaling (Float'Fraction (F), F_Size + 1); + end if; + + -- Compute Exponent and Fraction + + Exponent := Long_Unsigned (E + E_Bias); + Fraction := Long_Unsigned (F * 2.0) / 2; + end if; + + -- Store Fraction + + for I in reverse F_L - F_Bytes + 1 .. F_L loop + S (I) := SE (Fraction mod BB); + Fraction := Fraction / BB; + end loop; + + -- Remove implicit bit + + S (F_L - F_Bytes + 1) := S (F_L - F_Bytes + 1) and F_Mask; + + -- Store Exponent (not always at the beginning of a byte) + + Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + for N in reverse 1 .. E_Bytes loop + S (N) := SE (Exponent mod BB) + S (N); + Exponent := Exponent / BB; + end loop; + + -- Store Sign + + if not Positive then + S (1) := S (1) + BS; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_F; + + --------- + -- W_I -- + --------- + + procedure W_I (Stream : not null access RST; Item : Integer) is + S : XDR_S_I; + U : XDR_U; + + begin + if Optimize_Integers then + S := Integer_To_XDR_S_I (Item); + + else + -- Test sign and apply two complement notation + + U := (if Item < 0 + then XDR_U'Last xor XDR_U (-(Item + 1)) + else XDR_U (Item)); + + for N in reverse S'Range loop + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_I; + + ---------- + -- W_LF -- + ---------- + + procedure W_LF (Stream : not null access RST; Item : Long_Float) is + I : constant Precision := Double; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + F_Mask : SE renames Fields (I).F_Mask; + + Exponent : Long_Unsigned; + Fraction : Long_Long_Unsigned; + Positive : Boolean; + E : Integer; + F : Long_Float; + S : SEA (1 .. LF_L) := (others => 0); + + begin + if not Item'Valid then + raise Constraint_Error; + end if; + + -- Compute Sign + + Positive := (0.0 <= Item); + F := abs (Item); + + -- Signed zero + + if F = 0.0 then + Exponent := 0; + Fraction := 0; + + else + E := Long_Float'Exponent (F) - 1; + + -- Denormalized float + + if E <= -E_Bias then + E := -E_Bias; + F := Long_Float'Scaling (F, F_Size + E_Bias - 1); + else + F := Long_Float'Scaling (F, F_Size - E); + end if; + + -- Compute Exponent and Fraction + + Exponent := Long_Unsigned (E + E_Bias); + Fraction := Long_Long_Unsigned (F * 2.0) / 2; + end if; + + -- Store Fraction + + for I in reverse LF_L - F_Bytes + 1 .. LF_L loop + S (I) := SE (Fraction mod BB); + Fraction := Fraction / BB; + end loop; + + -- Remove implicit bit + + S (LF_L - F_Bytes + 1) := S (LF_L - F_Bytes + 1) and F_Mask; + + -- Store Exponent (not always at the beginning of a byte) + + Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + for N in reverse 1 .. E_Bytes loop + S (N) := SE (Exponent mod BB) + S (N); + Exponent := Exponent / BB; + end loop; + + -- Store Sign + + if not Positive then + S (1) := S (1) + BS; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_LF; + + ---------- + -- W_LI -- + ---------- + + procedure W_LI (Stream : not null access RST; Item : Long_Integer) is + S : XDR_S_LI; + U : Unsigned; + X : Long_Unsigned; + + begin + if Optimize_Integers then + S := Long_Long_Integer_To_XDR_S_LI (Long_Long_Integer (Item)); + + else + -- Test sign and apply two complement notation + + if Item < 0 then + X := Long_Unsigned'Last xor Long_Unsigned (-(Item + 1)); + else + X := Long_Unsigned (Item); + end if; + + -- Compute using machine unsigned rather than long_unsigned + + for N in reverse S'Range loop + + -- We have filled an unsigned + + if (LU_L - N) mod UB = 0 then + U := Unsigned (X and UL); + X := Shift_Right (X, US); + end if; + + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_LI; + + ----------- + -- W_LLF -- + ----------- + + procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float) is + I : constant Precision := Quadruple; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + + HFS : constant Integer := F_Size / 2; + + Exponent : Long_Unsigned; + Fraction_1 : Long_Long_Unsigned; + Fraction_2 : Long_Long_Unsigned; + Positive : Boolean; + E : Integer; + F : Long_Long_Float := Item; + S : SEA (1 .. LLF_L) := (others => 0); + + begin + if not Item'Valid then + raise Constraint_Error; + end if; + + -- Compute Sign + + Positive := (0.0 <= Item); + if F < 0.0 then + F := -Item; + end if; + + -- Signed zero + + if F = 0.0 then + Exponent := 0; + Fraction_1 := 0; + Fraction_2 := 0; + + else + E := Long_Long_Float'Exponent (F) - 1; + + -- Denormalized float + + if E <= -E_Bias then + F := Long_Long_Float'Scaling (F, E_Bias - 1); + E := -E_Bias; + else + F := Long_Long_Float'Scaling + (Long_Long_Float'Fraction (F), 1); + end if; + + -- Compute Exponent and Fraction + + Exponent := Long_Unsigned (E + E_Bias); + F := Long_Long_Float'Scaling (F, F_Size - HFS); + Fraction_1 := Long_Long_Unsigned (Long_Long_Float'Floor (F)); + F := F - Long_Long_Float (Fraction_1); + F := Long_Long_Float'Scaling (F, HFS); + Fraction_2 := Long_Long_Unsigned (Long_Long_Float'Floor (F)); + end if; + + -- Store Fraction_1 + + for I in reverse LLF_L - F_Bytes + 1 .. LLF_L - 7 loop + S (I) := SE (Fraction_1 mod BB); + Fraction_1 := Fraction_1 / BB; + end loop; + + -- Store Fraction_2 + + for I in reverse LLF_L - 6 .. LLF_L loop + S (SEO (I)) := SE (Fraction_2 mod BB); + Fraction_2 := Fraction_2 / BB; + end loop; + + -- Store Exponent (not always at the beginning of a byte) + + Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + for N in reverse 1 .. E_Bytes loop + S (N) := SE (Exponent mod BB) + S (N); + Exponent := Exponent / BB; + end loop; + + -- Store Sign + + if not Positive then + S (1) := S (1) + BS; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_LLF; + + ----------- + -- W_LLI -- + ----------- + + procedure W_LLI + (Stream : not null access RST; + Item : Long_Long_Integer) + is + S : XDR_S_LLI; + U : Unsigned; + X : Long_Long_Unsigned; + + begin + if Optimize_Integers then + S := Long_Long_Integer_To_XDR_S_LLI (Item); + + else + -- Test sign and apply two complement notation + + if Item < 0 then + X := Long_Long_Unsigned'Last xor Long_Long_Unsigned (-(Item + 1)); + else + X := Long_Long_Unsigned (Item); + end if; + + -- Compute using machine unsigned rather than long_long_unsigned + + for N in reverse S'Range loop + + -- We have filled an unsigned + + if (LLU_L - N) mod UB = 0 then + U := Unsigned (X and UL); + X := Shift_Right (X, US); + end if; + + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_LLI; + + ----------- + -- W_LLU -- + ----------- + + procedure W_LLU + (Stream : not null access RST; + Item : Long_Long_Unsigned) + is + S : XDR_S_LLU; + U : Unsigned; + X : Long_Long_Unsigned := Item; + + begin + if Optimize_Integers then + S := Long_Long_Unsigned_To_XDR_S_LLU (Item); + + else + -- Compute using machine unsigned rather than long_long_unsigned + + for N in reverse S'Range loop + + -- We have filled an unsigned + + if (LLU_L - N) mod UB = 0 then + U := Unsigned (X and UL); + X := Shift_Right (X, US); + end if; + + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_LLU; + + ---------- + -- W_LU -- + ---------- + + procedure W_LU (Stream : not null access RST; Item : Long_Unsigned) is + S : XDR_S_LU; + U : Unsigned; + X : Long_Unsigned := Item; + + 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 + + for N in reverse S'Range loop + + -- We have filled an unsigned + + if (LU_L - N) mod UB = 0 then + U := Unsigned (X and UL); + X := Shift_Right (X, US); + end if; + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_LU; + + ---------- + -- W_SF -- + ---------- + + procedure W_SF (Stream : not null access RST; Item : Short_Float) is + I : constant Precision := Single; + E_Size : Integer renames Fields (I).E_Size; + E_Bias : Integer renames Fields (I).E_Bias; + E_Bytes : SEO renames Fields (I).E_Bytes; + F_Bytes : SEO renames Fields (I).F_Bytes; + F_Size : Integer renames Fields (I).F_Size; + F_Mask : SE renames Fields (I).F_Mask; + + Exponent : Long_Unsigned; + Fraction : Long_Unsigned; + Positive : Boolean; + E : Integer; + F : Short_Float; + S : SEA (1 .. SF_L) := (others => 0); + + begin + if not Item'Valid then + raise Constraint_Error; + end if; + + -- Compute Sign + + Positive := (0.0 <= Item); + F := abs (Item); + + -- Signed zero + + if F = 0.0 then + Exponent := 0; + Fraction := 0; + + else + E := Short_Float'Exponent (F) - 1; + + -- Denormalized float + + if E <= -E_Bias then + E := -E_Bias; + F := Short_Float'Scaling (F, F_Size + E_Bias - 1); + else + F := Short_Float'Scaling (F, F_Size - E); + end if; + + -- Compute Exponent and Fraction + + Exponent := Long_Unsigned (E + E_Bias); + Fraction := Long_Unsigned (F * 2.0) / 2; + end if; + + -- Store Fraction + + for I in reverse SF_L - F_Bytes + 1 .. SF_L loop + S (I) := SE (Fraction mod BB); + Fraction := Fraction / BB; + end loop; + + -- Remove implicit bit + + S (SF_L - F_Bytes + 1) := S (SF_L - F_Bytes + 1) and F_Mask; + + -- Store Exponent (not always at the beginning of a byte) + + Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); + for N in reverse 1 .. E_Bytes loop + S (N) := SE (Exponent mod BB) + S (N); + Exponent := Exponent / BB; + end loop; + + -- Store Sign + + if not Positive then + S (1) := S (1) + BS; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_SF; + + ---------- + -- W_SI -- + ---------- + + procedure W_SI (Stream : not null access RST; Item : Short_Integer) is + S : XDR_S_SI; + U : XDR_SU; + + begin + if Optimize_Integers then + S := Short_Integer_To_XDR_S_SI (Item); + + else + -- Test sign and apply two complement's notation + + U := (if Item < 0 + then XDR_SU'Last xor XDR_SU (-(Item + 1)) + else XDR_SU (Item)); + + for N in reverse S'Range loop + S (N) := SE (U mod BB); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_SI; + + ----------- + -- W_SSI -- + ----------- + + procedure W_SSI + (Stream : not null access RST; + Item : Short_Short_Integer) + is + S : XDR_S_SSI; + U : XDR_SSU; + + begin + if Optimize_Integers then + S := Short_Short_Integer_To_XDR_S_SSI (Item); + + else + -- Test sign and apply two complement's notation + + U := (if Item < 0 + then XDR_SSU'Last xor XDR_SSU (-(Item + 1)) + else XDR_SSU (Item)); + + S (1) := SE (U); + end if; + + Ada.Streams.Write (Stream.all, S); + end W_SSI; + + ----------- + -- W_SSU -- + ----------- + + procedure W_SSU + (Stream : not null access RST; + Item : Short_Short_Unsigned) + is + U : constant XDR_SSU := XDR_SSU (Item); + S : XDR_S_SSU; + + begin + S (1) := SE (U); + Ada.Streams.Write (Stream.all, S); + end W_SSU; + + ---------- + -- W_SU -- + ---------- + + procedure W_SU (Stream : not null access RST; Item : Short_Unsigned) is + S : XDR_S_SU; + U : XDR_SU := XDR_SU (Item); + + 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); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_SU; + + --------- + -- W_U -- + --------- + + procedure W_U (Stream : not null access RST; Item : Unsigned) is + S : XDR_S_U; + U : XDR_U := XDR_U (Item); + + 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); + U := U / BB; + end loop; + + if U /= 0 then + raise Data_Error; + end if; + end if; + + Ada.Streams.Write (Stream.all, S); + end W_U; + + ---------- + -- W_WC -- + ---------- + + procedure W_WC (Stream : not null access RST; Item : Wide_Character) is + S : XDR_S_WC; + U : XDR_WC; + + begin + -- Use Ada requirements on Wide_Character representation clause + + U := XDR_WC (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_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 -Nrcpad gcc-4.5.2/gcc/ada/s-stratt.ads gcc-4.6.0/gcc/ada/s-stratt.ads *** gcc-4.5.2/gcc/ada/s-stratt.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-stratt.ads Thu Sep 9 12:31:35 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Stream_Attributes is *** 157,166 **** 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); --- 157,166 ---- function Block_IO_OK return Boolean; -- Package System.Stream_Attributes has several bodies - the default one ! -- distributed with GNAT, and s-stratt-xdr.adb, which is based on the XDR ! -- standard. Both bodies share the same spec. The role of this function is ! -- to indicate whether the current version of System.Stream_Attributes ! -- supports block IO. private pragma Inline (I_AD); diff -Nrcpad gcc-4.5.2/gcc/ada/s-strxdr.adb gcc-4.6.0/gcc/ada/s-strxdr.adb *** gcc-4.5.2/gcc/ada/s-strxdr.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-strxdr.adb Thu Jan 1 00:00:00 1970 *************** *** 1,1891 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT RUN-TIME COMPONENTS -- - -- -- - -- S Y S T E M . S T R E A M _ A T T R I B U T E S -- - -- -- - -- B o d y -- - -- -- - -- Copyright (C) 1996-2009, 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- -- - -- 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. -- - -- -- - -- As a special exception under Section 7 of GPL version 3, you are granted -- - -- additional permissions described in the GCC Runtime Library Exception, -- - -- version 3.1, as published by the Free Software Foundation. -- - -- -- - -- You should have received a copy of the GNU General Public License and -- - -- a copy of the GCC Runtime Library Exception along with this program; -- - -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- - -- . -- - -- -- - -- GNAT was originally developed by the GNAT team at New York University. -- - -- Extensive contributions were provided by Ada Core Technologies Inc. -- - -- -- - ------------------------------------------------------------------------------ - - -- 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 endianness. - - with Ada.IO_Exceptions; - with Ada.Streams; use Ada.Streams; - with Ada.Unchecked_Conversion; - - package body System.Stream_Attributes is - - pragma Suppress (Range_Check); - pragma Suppress (Overflow_Check); - - use UST; - - Data_Error : exception renames Ada.IO_Exceptions.End_Error; - -- Exception raised if insufficient data read (End_Error is mandated by - -- AI95-00132). - - SU : constant := System.Storage_Unit; - -- The code in this body assumes that SU = 8 - - BB : constant := 2 ** SU; -- Byte base - BL : constant := 2 ** SU - 1; -- Byte last - BS : constant := 2 ** (SU - 1); -- Byte sign - - US : constant := Unsigned'Size; -- Unsigned size - UB : constant := (US - 1) / SU + 1; -- Unsigned byte - UL : constant := 2 ** US - 1; -- Unsigned last - - subtype SE is Ada.Streams.Stream_Element; - subtype SEA is Ada.Streams.Stream_Element_Array; - subtype SEO is Ada.Streams.Stream_Element_Offset; - - generic function UC renames Ada.Unchecked_Conversion; - - type Field_Type is - record - E_Size : Integer; -- Exponent bit size - E_Bias : Integer; -- Exponent bias - 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 completely used - F_Bytes : SEO; -- N. of fraction bytes completely used - F_Bits : Integer; -- N. of bits used on first fraction word - end record; - - type Precision is (Single, Double, Quadruple); - - Fields : constant array (Precision) of Field_Type := ( - - -- Single precision - - (E_Size => 8, - E_Bias => 127, - F_Size => 23, - E_Last => 2 ** 8 - 1, - F_Mask => 16#7F#, -- 2 ** 7 - 1, - E_Bytes => 2, - F_Bytes => 3, - F_Bits => 23 mod US), - - -- Double precision - - (E_Size => 11, - E_Bias => 1023, - F_Size => 52, - E_Last => 2 ** 11 - 1, - F_Mask => 16#0F#, -- 2 ** 4 - 1, - E_Bytes => 2, - F_Bytes => 7, - F_Bits => 52 mod US), - - -- Quadruple precision - - (E_Size => 15, - E_Bias => 16383, - F_Size => 112, - E_Last => 2 ** 8 - 1, - F_Mask => 16#FF#, -- 2 ** 8 - 1, - E_Bytes => 2, - F_Bytes => 14, - F_Bits => 112 mod US)); - - -- The representation of all items requires a multiple of four bytes - -- (or 32 bits) of data. The bytes are numbered 0 through n-1. The bytes - -- are read or written to some byte stream such that byte m always - -- precedes byte m+1. If the n bytes needed to contain the data are not - -- a multiple of four, then the n bytes are followed by enough (0 to 3) - -- residual zero bytes, r, to make the total byte count a multiple of 4. - - -- An XDR signed integer is a 32-bit datum that encodes an integer - -- in the range [-2147483648,2147483647]. The integer is represented - -- in two's complement notation. The most and least significant bytes - -- are 0 and 3, respectively. Integers are declared as follows: - - -- (MSB) (LSB) - -- +-------+-------+-------+-------+ - -- |byte 0 |byte 1 |byte 2 |byte 3 | - -- +-------+-------+-------+-------+ - -- <------------32 bits------------> - - SSI_L : constant := 1; - SI_L : constant := 2; - I_L : constant := 4; - LI_L : constant := 8; - LLI_L : constant := 8; - - subtype XDR_S_SSI is SEA (1 .. SSI_L); - subtype XDR_S_SI is SEA (1 .. SI_L); - subtype XDR_S_I is SEA (1 .. I_L); - subtype XDR_S_LI is SEA (1 .. LI_L); - subtype XDR_S_LLI is SEA (1 .. LLI_L); - - function Short_Short_Integer_To_XDR_S_SSI is - new Ada.Unchecked_Conversion (Short_Short_Integer, XDR_S_SSI); - function XDR_S_SSI_To_Short_Short_Integer is - new Ada.Unchecked_Conversion (XDR_S_SSI, Short_Short_Integer); - - function Short_Integer_To_XDR_S_SI is - new Ada.Unchecked_Conversion (Short_Integer, XDR_S_SI); - function XDR_S_SI_To_Short_Integer is - new Ada.Unchecked_Conversion (XDR_S_SI, Short_Integer); - - function Integer_To_XDR_S_I is - new Ada.Unchecked_Conversion (Integer, XDR_S_I); - function XDR_S_I_To_Integer is - new Ada.Unchecked_Conversion (XDR_S_I, Integer); - - function Long_Long_Integer_To_XDR_S_LI is - new Ada.Unchecked_Conversion (Long_Long_Integer, XDR_S_LI); - function XDR_S_LI_To_Long_Long_Integer is - new Ada.Unchecked_Conversion (XDR_S_LI, Long_Long_Integer); - - function Long_Long_Integer_To_XDR_S_LLI is - new Ada.Unchecked_Conversion (Long_Long_Integer, XDR_S_LLI); - function XDR_S_LLI_To_Long_Long_Integer is - new Ada.Unchecked_Conversion (XDR_S_LLI, Long_Long_Integer); - - -- An XDR unsigned integer is a 32-bit datum that encodes a nonnegative - -- integer in the range [0,4294967295]. It is represented by an unsigned - -- binary number whose most and least significant bytes are 0 and 3, - -- respectively. An unsigned integer is declared as follows: - - -- (MSB) (LSB) - -- +-------+-------+-------+-------+ - -- |byte 0 |byte 1 |byte 2 |byte 3 | - -- +-------+-------+-------+-------+ - -- <------------32 bits------------> - - SSU_L : constant := 1; - SU_L : constant := 2; - U_L : constant := 4; - LU_L : constant := 8; - LLU_L : constant := 8; - - subtype XDR_S_SSU is SEA (1 .. SSU_L); - subtype XDR_S_SU is SEA (1 .. SU_L); - subtype XDR_S_U is SEA (1 .. U_L); - subtype XDR_S_LU is SEA (1 .. LU_L); - subtype XDR_S_LLU is SEA (1 .. LLU_L); - - type XDR_SSU is mod BB ** SSU_L; - type XDR_SU is mod BB ** SU_L; - type XDR_U is mod BB ** U_L; - - function Short_Unsigned_To_XDR_S_SU is - new Ada.Unchecked_Conversion (Short_Unsigned, XDR_S_SU); - function XDR_S_SU_To_Short_Unsigned is - new Ada.Unchecked_Conversion (XDR_S_SU, Short_Unsigned); - - function Unsigned_To_XDR_S_U is - new Ada.Unchecked_Conversion (Unsigned, XDR_S_U); - function XDR_S_U_To_Unsigned is - new Ada.Unchecked_Conversion (XDR_S_U, Unsigned); - - function Long_Long_Unsigned_To_XDR_S_LU is - new Ada.Unchecked_Conversion (Long_Long_Unsigned, XDR_S_LU); - function XDR_S_LU_To_Long_Long_Unsigned is - new Ada.Unchecked_Conversion (XDR_S_LU, Long_Long_Unsigned); - - function Long_Long_Unsigned_To_XDR_S_LLU is - new Ada.Unchecked_Conversion (Long_Long_Unsigned, XDR_S_LLU); - function XDR_S_LLU_To_Long_Long_Unsigned is - new Ada.Unchecked_Conversion (XDR_S_LLU, Long_Long_Unsigned); - - -- The standard defines the floating-point data type "float" (32 bits - -- or 4 bytes). The encoding used is the IEEE standard for normalized - -- single-precision floating-point numbers. - - -- The standard defines the encoding used for the double-precision - -- floating-point data type "double" (64 bits or 8 bytes). The encoding - -- used is the IEEE standard for normalized double-precision floating-point - -- numbers. - - SF_L : constant := 4; -- Single precision - F_L : constant := 4; -- Single precision - LF_L : constant := 8; -- Double precision - LLF_L : constant := 16; -- Quadruple precision - - TM_L : constant := 8; - subtype XDR_S_TM is SEA (1 .. TM_L); - type XDR_TM is mod BB ** TM_L; - - type XDR_SA is mod 2 ** Standard'Address_Size; - function To_XDR_SA is new UC (System.Address, XDR_SA); - function To_XDR_SA is new UC (XDR_SA, System.Address); - - -- Enumerations have the same representation as signed integers. - -- Enumerations are handy for describing subsets of the integers. - - -- Booleans are important enough and occur frequently enough to warrant - -- their own explicit type in the standard. Booleans are declared as - -- an enumeration, with FALSE = 0 and TRUE = 1. - - -- The standard defines a string of n (numbered 0 through n-1) ASCII - -- bytes to be the number n encoded as an unsigned integer (as described - -- above), and followed by the n bytes of the string. Byte m of the string - -- always precedes byte m+1 of the string, and byte 0 of the string always - -- follows the string's length. If n is not a multiple of four, then the - -- n bytes are followed by enough (0 to 3) residual zero bytes, r, to make - -- the total byte count a multiple of four. - - -- To fit with XDR string, do not consider character as an enumeration - -- type. - - C_L : constant := 1; - subtype XDR_S_C is SEA (1 .. C_L); - - -- Consider Wide_Character as an enumeration type - - WC_L : constant := 4; - 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 - -- conversions. - - 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 -- - ---------- - - function I_AD (Stream : not null access RST) return Fat_Pointer is - FP : Fat_Pointer; - - begin - FP.P1 := I_AS (Stream).P1; - FP.P2 := I_AS (Stream).P1; - - return FP; - end I_AD; - - ---------- - -- I_AS -- - ---------- - - function I_AS (Stream : not null access RST) return Thin_Pointer is - S : XDR_S_TM; - L : SEO; - U : XDR_TM := 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_TM (S (N)); - end loop; - - return (P1 => To_XDR_SA (XDR_SA (U))); - end if; - end I_AS; - - --------- - -- I_B -- - --------- - - function I_B (Stream : not null access RST) return Boolean is - begin - case I_SSU (Stream) is - when 0 => return False; - when 1 => return True; - when others => raise Data_Error; - end case; - end I_B; - - --------- - -- I_C -- - --------- - - function I_C (Stream : not null access RST) return Character is - S : XDR_S_C; - L : SEO; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - else - -- Use Ada requirements on Character representation clause - - return Character'Val (S (1)); - end if; - end I_C; - - --------- - -- I_F -- - --------- - - function I_F (Stream : not null access RST) return Float is - I : constant Precision := Single; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Last : Integer renames Fields (I).E_Last; - F_Mask : SE renames Fields (I).F_Mask; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - - Positive : Boolean; - Exponent : Long_Unsigned; - Fraction : Long_Unsigned; - Result : Float; - S : SEA (1 .. F_L); - L : SEO; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - end if; - - -- Extract Fraction, Sign and Exponent - - Fraction := Long_Unsigned (S (F_L + 1 - F_Bytes) and F_Mask); - for N in F_L + 2 - F_Bytes .. F_L loop - Fraction := Fraction * BB + Long_Unsigned (S (N)); - end loop; - Result := Float'Scaling (Float (Fraction), -F_Size); - - if BS <= S (1) then - Positive := False; - Exponent := Long_Unsigned (S (1) - BS); - else - Positive := True; - Exponent := Long_Unsigned (S (1)); - end if; - - for N in 2 .. E_Bytes loop - Exponent := Exponent * BB + Long_Unsigned (S (N)); - end loop; - Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - - -- NaN or Infinities - - if Integer (Exponent) = E_Last then - raise Constraint_Error; - - elsif Exponent = 0 then - - -- Signed zeros - - if Fraction = 0 then - null; - - -- Denormalized float - - else - Result := Float'Scaling (Result, 1 - E_Bias); - end if; - - -- Normalized float - - else - Result := Float'Scaling - (1.0 + Result, Integer (Exponent) - E_Bias); - end if; - - if not Positive then - Result := -Result; - end if; - - return Result; - end I_F; - - --------- - -- I_I -- - --------- - - function I_I (Stream : not null access RST) return Integer is - S : XDR_S_I; - L : SEO; - U : XDR_U := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return XDR_S_I_To_Integer (S); - - else - for N in S'Range loop - U := U * BB + XDR_U (S (N)); - end loop; - - -- Test sign and apply two complement notation - - if S (1) < BL then - return Integer (U); - - else - return Integer (-((XDR_U'Last xor U) + 1)); - end if; - end if; - end I_I; - - ---------- - -- I_LF -- - ---------- - - function I_LF (Stream : not null access RST) return Long_Float is - I : constant Precision := Double; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Last : Integer renames Fields (I).E_Last; - F_Mask : SE renames Fields (I).F_Mask; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - - Positive : Boolean; - Exponent : Long_Unsigned; - Fraction : Long_Long_Unsigned; - Result : Long_Float; - S : SEA (1 .. LF_L); - L : SEO; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - end if; - - -- Extract Fraction, Sign and Exponent - - Fraction := Long_Long_Unsigned (S (LF_L + 1 - F_Bytes) and F_Mask); - for N in LF_L + 2 - F_Bytes .. LF_L loop - Fraction := Fraction * BB + Long_Long_Unsigned (S (N)); - end loop; - - Result := Long_Float'Scaling (Long_Float (Fraction), -F_Size); - - if BS <= S (1) then - Positive := False; - Exponent := Long_Unsigned (S (1) - BS); - else - Positive := True; - Exponent := Long_Unsigned (S (1)); - end if; - - for N in 2 .. E_Bytes loop - Exponent := Exponent * BB + Long_Unsigned (S (N)); - end loop; - - Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - - -- NaN or Infinities - - if Integer (Exponent) = E_Last then - raise Constraint_Error; - - elsif Exponent = 0 then - - -- Signed zeros - - if Fraction = 0 then - null; - - -- Denormalized float - - else - Result := Long_Float'Scaling (Result, 1 - E_Bias); - end if; - - -- Normalized float - - else - Result := Long_Float'Scaling - (1.0 + Result, Integer (Exponent) - E_Bias); - end if; - - if not Positive then - Result := -Result; - end if; - - return Result; - end I_LF; - - ---------- - -- I_LI -- - ---------- - - function I_LI (Stream : not null access RST) return Long_Integer is - S : XDR_S_LI; - L : SEO; - U : Unsigned := 0; - X : Long_Unsigned := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return Long_Integer (XDR_S_LI_To_Long_Long_Integer (S)); - - else - - -- Compute using machine unsigned - -- rather than long_long_unsigned - - for N in S'Range loop - U := U * BB + Unsigned (S (N)); - - -- We have filled an unsigned - - if N mod UB = 0 then - X := Shift_Left (X, US) + Long_Unsigned (U); - U := 0; - end if; - end loop; - - -- Test sign and apply two complement notation - - if S (1) < BL then - return Long_Integer (X); - else - return Long_Integer (-((Long_Unsigned'Last xor X) + 1)); - end if; - - end if; - end I_LI; - - ----------- - -- I_LLF -- - ----------- - - function I_LLF (Stream : not null access RST) return Long_Long_Float is - I : constant Precision := Quadruple; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Last : Integer renames Fields (I).E_Last; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - - Positive : Boolean; - Exponent : Long_Unsigned; - Fraction_1 : Long_Long_Unsigned := 0; - Fraction_2 : Long_Long_Unsigned := 0; - Result : Long_Long_Float; - HF : constant Natural := F_Size / 2; - S : SEA (1 .. LLF_L); - L : SEO; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - end if; - - -- Extract Fraction, Sign and Exponent - - for I in LLF_L - F_Bytes + 1 .. LLF_L - 7 loop - Fraction_1 := Fraction_1 * BB + Long_Long_Unsigned (S (I)); - end loop; - - for I in SEO (LLF_L - 6) .. SEO (LLF_L) loop - Fraction_2 := Fraction_2 * BB + Long_Long_Unsigned (S (I)); - end loop; - - Result := Long_Long_Float'Scaling (Long_Long_Float (Fraction_2), -HF); - Result := Long_Long_Float (Fraction_1) + Result; - Result := Long_Long_Float'Scaling (Result, HF - F_Size); - - if BS <= S (1) then - Positive := False; - Exponent := Long_Unsigned (S (1) - BS); - else - Positive := True; - Exponent := Long_Unsigned (S (1)); - end if; - - for N in 2 .. E_Bytes loop - Exponent := Exponent * BB + Long_Unsigned (S (N)); - end loop; - - Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - - -- NaN or Infinities - - if Integer (Exponent) = E_Last then - raise Constraint_Error; - - elsif Exponent = 0 then - - -- Signed zeros - - if Fraction_1 = 0 and then Fraction_2 = 0 then - null; - - -- Denormalized float - - else - Result := Long_Long_Float'Scaling (Result, 1 - E_Bias); - end if; - - -- Normalized float - - else - Result := Long_Long_Float'Scaling - (1.0 + Result, Integer (Exponent) - E_Bias); - end if; - - if not Positive then - Result := -Result; - end if; - - return Result; - end I_LLF; - - ----------- - -- I_LLI -- - ----------- - - function I_LLI (Stream : not null access RST) return Long_Long_Integer is - S : XDR_S_LLI; - L : SEO; - U : Unsigned := 0; - X : Long_Long_Unsigned := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return XDR_S_LLI_To_Long_Long_Integer (S); - - else - -- Compute using machine unsigned for computing - -- rather than long_long_unsigned. - - for N in S'Range loop - U := U * BB + Unsigned (S (N)); - - -- We have filled an unsigned - - if N mod UB = 0 then - X := Shift_Left (X, US) + Long_Long_Unsigned (U); - U := 0; - end if; - end loop; - - -- Test sign and apply two complement notation - - if S (1) < BL then - return Long_Long_Integer (X); - else - return Long_Long_Integer (-((Long_Long_Unsigned'Last xor X) + 1)); - end if; - end if; - end I_LLI; - - ----------- - -- I_LLU -- - ----------- - - function I_LLU (Stream : not null access RST) return Long_Long_Unsigned is - S : XDR_S_LLU; - L : SEO; - U : Unsigned := 0; - X : Long_Long_Unsigned := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return XDR_S_LLU_To_Long_Long_Unsigned (S); - - else - -- Compute using machine unsigned - -- rather than long_long_unsigned. - - for N in S'Range loop - U := U * BB + Unsigned (S (N)); - - -- We have filled an unsigned - - if N mod UB = 0 then - X := Shift_Left (X, US) + Long_Long_Unsigned (U); - U := 0; - end if; - end loop; - - return X; - end if; - end I_LLU; - - ---------- - -- I_LU -- - ---------- - - function I_LU (Stream : not null access RST) return Long_Unsigned is - S : XDR_S_LU; - L : SEO; - U : Unsigned := 0; - X : Long_Unsigned := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return Long_Unsigned (XDR_S_LU_To_Long_Long_Unsigned (S)); - - else - -- Compute using machine unsigned - -- rather than long_unsigned. - - for N in S'Range loop - U := U * BB + Unsigned (S (N)); - - -- We have filled an unsigned - - if N mod UB = 0 then - X := Shift_Left (X, US) + Long_Unsigned (U); - U := 0; - end if; - end loop; - - return X; - end if; - end I_LU; - - ---------- - -- I_SF -- - ---------- - - function I_SF (Stream : not null access RST) return Short_Float is - I : constant Precision := Single; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Last : Integer renames Fields (I).E_Last; - F_Mask : SE renames Fields (I).F_Mask; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - - Exponent : Long_Unsigned; - Fraction : Long_Unsigned; - Positive : Boolean; - Result : Short_Float; - S : SEA (1 .. SF_L); - L : SEO; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - end if; - - -- Extract Fraction, Sign and Exponent - - Fraction := Long_Unsigned (S (SF_L + 1 - F_Bytes) and F_Mask); - for N in SF_L + 2 - F_Bytes .. SF_L loop - Fraction := Fraction * BB + Long_Unsigned (S (N)); - end loop; - Result := Short_Float'Scaling (Short_Float (Fraction), -F_Size); - - if BS <= S (1) then - Positive := False; - Exponent := Long_Unsigned (S (1) - BS); - else - Positive := True; - Exponent := Long_Unsigned (S (1)); - end if; - - for N in 2 .. E_Bytes loop - Exponent := Exponent * BB + Long_Unsigned (S (N)); - end loop; - Exponent := Shift_Right (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - - -- NaN or Infinities - - if Integer (Exponent) = E_Last then - raise Constraint_Error; - - elsif Exponent = 0 then - - -- Signed zeros - - if Fraction = 0 then - null; - - -- Denormalized float - - else - Result := Short_Float'Scaling (Result, 1 - E_Bias); - end if; - - -- Normalized float - - else - Result := Short_Float'Scaling - (1.0 + Result, Integer (Exponent) - E_Bias); - end if; - - if not Positive then - Result := -Result; - end if; - - return Result; - end I_SF; - - ---------- - -- I_SI -- - ---------- - - function I_SI (Stream : not null access RST) return Short_Integer is - S : XDR_S_SI; - L : SEO; - U : XDR_SU := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return XDR_S_SI_To_Short_Integer (S); - - else - for N in S'Range loop - U := U * BB + XDR_SU (S (N)); - end loop; - - -- Test sign and apply two complement notation - - if S (1) < BL then - return Short_Integer (U); - else - return Short_Integer (-((XDR_SU'Last xor U) + 1)); - end if; - end if; - end I_SI; - - ----------- - -- I_SSI -- - ----------- - - function I_SSI (Stream : not null access RST) return Short_Short_Integer is - S : XDR_S_SSI; - L : SEO; - U : XDR_SSU; - - begin - Ada.Streams.Read (Stream.all, S, L); - - 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)); - - -- Test sign and apply two complement notation - - if S (1) < BL then - return Short_Short_Integer (U); - else - return Short_Short_Integer (-((XDR_SSU'Last xor U) + 1)); - end if; - end if; - end I_SSI; - - ----------- - -- I_SSU -- - ----------- - - function I_SSU (Stream : not null access RST) return Short_Short_Unsigned is - S : XDR_S_SSU; - L : SEO; - U : XDR_SSU := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - else - U := XDR_SSU (S (1)); - return Short_Short_Unsigned (U); - end if; - end I_SSU; - - ---------- - -- I_SU -- - ---------- - - function I_SU (Stream : not null access RST) return Short_Unsigned is - S : XDR_S_SU; - L : SEO; - U : XDR_SU := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - 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)); - end loop; - - return Short_Unsigned (U); - end if; - end I_SU; - - --------- - -- I_U -- - --------- - - function I_U (Stream : not null access RST) return Unsigned is - S : XDR_S_U; - L : SEO; - U : XDR_U := 0; - - begin - Ada.Streams.Read (Stream.all, S, L); - - if L /= S'Last then - raise Data_Error; - - elsif Optimize_Integers then - return XDR_S_U_To_Unsigned (S); - - else - for N in S'Range loop - U := U * BB + XDR_U (S (N)); - end loop; - - return Unsigned (U); - end if; - end I_U; - - ---------- - -- I_WC -- - ---------- - - function I_WC (Stream : not null access RST) return Wide_Character is - S : XDR_S_WC; - L : SEO; - U : XDR_WC := 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_WC (S (N)); - end loop; - - -- Use Ada requirements on Wide_Character representation clause - - return Wide_Character'Val (U); - 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 -- - ---------- - - procedure W_AD (Stream : not null access RST; Item : Fat_Pointer) is - S : XDR_S_TM; - U : XDR_TM; - - begin - U := XDR_TM (To_XDR_SA (Item.P1)); - for N in reverse S'Range loop - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - Ada.Streams.Write (Stream.all, S); - - U := XDR_TM (To_XDR_SA (Item.P2)); - 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_AD; - - ---------- - -- W_AS -- - ---------- - - procedure W_AS (Stream : not null access RST; Item : Thin_Pointer) is - S : XDR_S_TM; - U : XDR_TM := XDR_TM (To_XDR_SA (Item.P1)); - - begin - 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_AS; - - --------- - -- W_B -- - --------- - - procedure W_B (Stream : not null access RST; Item : Boolean) is - begin - if Item then - W_SSU (Stream, 1); - else - W_SSU (Stream, 0); - end if; - end W_B; - - --------- - -- W_C -- - --------- - - procedure W_C (Stream : not null access RST; Item : Character) is - S : XDR_S_C; - - pragma Assert (C_L = 1); - - begin - -- Use Ada requirements on Character representation clause - - S (1) := SE (Character'Pos (Item)); - - Ada.Streams.Write (Stream.all, S); - end W_C; - - --------- - -- W_F -- - --------- - - procedure W_F (Stream : not null access RST; Item : Float) is - I : constant Precision := Single; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - F_Mask : SE renames Fields (I).F_Mask; - - Exponent : Long_Unsigned; - Fraction : Long_Unsigned; - Positive : Boolean; - E : Integer; - F : Float; - S : SEA (1 .. F_L) := (others => 0); - - begin - if not Item'Valid then - raise Constraint_Error; - end if; - - -- Compute Sign - - Positive := (0.0 <= Item); - F := abs (Item); - - -- Signed zero - - if F = 0.0 then - Exponent := 0; - Fraction := 0; - - else - E := Float'Exponent (F) - 1; - - -- Denormalized float - - if E <= -E_Bias then - F := Float'Scaling (F, F_Size + E_Bias - 1); - E := -E_Bias; - else - F := Float'Scaling (Float'Fraction (F), F_Size + 1); - end if; - - -- Compute Exponent and Fraction - - Exponent := Long_Unsigned (E + E_Bias); - Fraction := Long_Unsigned (F * 2.0) / 2; - end if; - - -- Store Fraction - - for I in reverse F_L - F_Bytes + 1 .. F_L loop - S (I) := SE (Fraction mod BB); - Fraction := Fraction / BB; - end loop; - - -- Remove implicit bit - - S (F_L - F_Bytes + 1) := S (F_L - F_Bytes + 1) and F_Mask; - - -- Store Exponent (not always at the beginning of a byte) - - Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - for N in reverse 1 .. E_Bytes loop - S (N) := SE (Exponent mod BB) + S (N); - Exponent := Exponent / BB; - end loop; - - -- Store Sign - - if not Positive then - S (1) := S (1) + BS; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_F; - - --------- - -- W_I -- - --------- - - procedure W_I (Stream : not null access RST; Item : Integer) is - S : XDR_S_I; - U : XDR_U; - - begin - if Optimize_Integers then - S := Integer_To_XDR_S_I (Item); - - else - -- Test sign and apply two complement notation - - U := (if Item < 0 - then XDR_U'Last xor XDR_U (-(Item + 1)) - else XDR_U (Item)); - - for N in reverse S'Range loop - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_I; - - ---------- - -- W_LF -- - ---------- - - procedure W_LF (Stream : not null access RST; Item : Long_Float) is - I : constant Precision := Double; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - F_Mask : SE renames Fields (I).F_Mask; - - Exponent : Long_Unsigned; - Fraction : Long_Long_Unsigned; - Positive : Boolean; - E : Integer; - F : Long_Float; - S : SEA (1 .. LF_L) := (others => 0); - - begin - if not Item'Valid then - raise Constraint_Error; - end if; - - -- Compute Sign - - Positive := (0.0 <= Item); - F := abs (Item); - - -- Signed zero - - if F = 0.0 then - Exponent := 0; - Fraction := 0; - - else - E := Long_Float'Exponent (F) - 1; - - -- Denormalized float - - if E <= -E_Bias then - E := -E_Bias; - F := Long_Float'Scaling (F, F_Size + E_Bias - 1); - else - F := Long_Float'Scaling (F, F_Size - E); - end if; - - -- Compute Exponent and Fraction - - Exponent := Long_Unsigned (E + E_Bias); - Fraction := Long_Long_Unsigned (F * 2.0) / 2; - end if; - - -- Store Fraction - - for I in reverse LF_L - F_Bytes + 1 .. LF_L loop - S (I) := SE (Fraction mod BB); - Fraction := Fraction / BB; - end loop; - - -- Remove implicit bit - - S (LF_L - F_Bytes + 1) := S (LF_L - F_Bytes + 1) and F_Mask; - - -- Store Exponent (not always at the beginning of a byte) - - Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - for N in reverse 1 .. E_Bytes loop - S (N) := SE (Exponent mod BB) + S (N); - Exponent := Exponent / BB; - end loop; - - -- Store Sign - - if not Positive then - S (1) := S (1) + BS; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_LF; - - ---------- - -- W_LI -- - ---------- - - procedure W_LI (Stream : not null access RST; Item : Long_Integer) is - S : XDR_S_LI; - U : Unsigned; - X : Long_Unsigned; - - begin - if Optimize_Integers then - S := Long_Long_Integer_To_XDR_S_LI (Long_Long_Integer (Item)); - - else - -- Test sign and apply two complement notation - - if Item < 0 then - X := Long_Unsigned'Last xor Long_Unsigned (-(Item + 1)); - else - X := Long_Unsigned (Item); - end if; - - -- Compute using machine unsigned rather than long_unsigned - - for N in reverse S'Range loop - - -- We have filled an unsigned - - if (LU_L - N) mod UB = 0 then - U := Unsigned (X and UL); - X := Shift_Right (X, US); - end if; - - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_LI; - - ----------- - -- W_LLF -- - ----------- - - procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float) is - I : constant Precision := Quadruple; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - - HFS : constant Integer := F_Size / 2; - - Exponent : Long_Unsigned; - Fraction_1 : Long_Long_Unsigned; - Fraction_2 : Long_Long_Unsigned; - Positive : Boolean; - E : Integer; - F : Long_Long_Float := Item; - S : SEA (1 .. LLF_L) := (others => 0); - - begin - if not Item'Valid then - raise Constraint_Error; - end if; - - -- Compute Sign - - Positive := (0.0 <= Item); - if F < 0.0 then - F := -Item; - end if; - - -- Signed zero - - if F = 0.0 then - Exponent := 0; - Fraction_1 := 0; - Fraction_2 := 0; - - else - E := Long_Long_Float'Exponent (F) - 1; - - -- Denormalized float - - if E <= -E_Bias then - F := Long_Long_Float'Scaling (F, E_Bias - 1); - E := -E_Bias; - else - F := Long_Long_Float'Scaling - (Long_Long_Float'Fraction (F), 1); - end if; - - -- Compute Exponent and Fraction - - Exponent := Long_Unsigned (E + E_Bias); - F := Long_Long_Float'Scaling (F, F_Size - HFS); - Fraction_1 := Long_Long_Unsigned (Long_Long_Float'Floor (F)); - F := Long_Long_Float (F - Long_Long_Float (Fraction_1)); - F := Long_Long_Float'Scaling (F, HFS); - Fraction_2 := Long_Long_Unsigned (Long_Long_Float'Floor (F)); - end if; - - -- Store Fraction_1 - - for I in reverse LLF_L - F_Bytes + 1 .. LLF_L - 7 loop - S (I) := SE (Fraction_1 mod BB); - Fraction_1 := Fraction_1 / BB; - end loop; - - -- Store Fraction_2 - - for I in reverse LLF_L - 6 .. LLF_L loop - S (SEO (I)) := SE (Fraction_2 mod BB); - Fraction_2 := Fraction_2 / BB; - end loop; - - -- Store Exponent (not always at the beginning of a byte) - - Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - for N in reverse 1 .. E_Bytes loop - S (N) := SE (Exponent mod BB) + S (N); - Exponent := Exponent / BB; - end loop; - - -- Store Sign - - if not Positive then - S (1) := S (1) + BS; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_LLF; - - ----------- - -- W_LLI -- - ----------- - - procedure W_LLI - (Stream : not null access RST; - Item : Long_Long_Integer) - is - S : XDR_S_LLI; - U : Unsigned; - X : Long_Long_Unsigned; - - begin - if Optimize_Integers then - S := Long_Long_Integer_To_XDR_S_LLI (Item); - - else - -- Test sign and apply two complement notation - - if Item < 0 then - X := Long_Long_Unsigned'Last xor Long_Long_Unsigned (-(Item + 1)); - else - X := Long_Long_Unsigned (Item); - end if; - - -- Compute using machine unsigned rather than long_long_unsigned - - for N in reverse S'Range loop - - -- We have filled an unsigned - - if (LLU_L - N) mod UB = 0 then - U := Unsigned (X and UL); - X := Shift_Right (X, US); - end if; - - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_LLI; - - ----------- - -- W_LLU -- - ----------- - - procedure W_LLU - (Stream : not null access RST; - Item : Long_Long_Unsigned) - is - S : XDR_S_LLU; - U : Unsigned; - X : Long_Long_Unsigned := Item; - - begin - if Optimize_Integers then - S := Long_Long_Unsigned_To_XDR_S_LLU (Item); - - else - -- Compute using machine unsigned rather than long_long_unsigned - - for N in reverse S'Range loop - - -- We have filled an unsigned - - if (LLU_L - N) mod UB = 0 then - U := Unsigned (X and UL); - X := Shift_Right (X, US); - end if; - - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_LLU; - - ---------- - -- W_LU -- - ---------- - - procedure W_LU (Stream : not null access RST; Item : Long_Unsigned) is - S : XDR_S_LU; - U : Unsigned; - X : Long_Unsigned := Item; - - 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 - - for N in reverse S'Range loop - - -- We have filled an unsigned - - if (LU_L - N) mod UB = 0 then - U := Unsigned (X and UL); - X := Shift_Right (X, US); - end if; - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_LU; - - ---------- - -- W_SF -- - ---------- - - procedure W_SF (Stream : not null access RST; Item : Short_Float) is - I : constant Precision := Single; - E_Size : Integer renames Fields (I).E_Size; - E_Bias : Integer renames Fields (I).E_Bias; - E_Bytes : SEO renames Fields (I).E_Bytes; - F_Bytes : SEO renames Fields (I).F_Bytes; - F_Size : Integer renames Fields (I).F_Size; - F_Mask : SE renames Fields (I).F_Mask; - - Exponent : Long_Unsigned; - Fraction : Long_Unsigned; - Positive : Boolean; - E : Integer; - F : Short_Float; - S : SEA (1 .. SF_L) := (others => 0); - - begin - if not Item'Valid then - raise Constraint_Error; - end if; - - -- Compute Sign - - Positive := (0.0 <= Item); - F := abs (Item); - - -- Signed zero - - if F = 0.0 then - Exponent := 0; - Fraction := 0; - - else - E := Short_Float'Exponent (F) - 1; - - -- Denormalized float - - if E <= -E_Bias then - E := -E_Bias; - F := Short_Float'Scaling (F, F_Size + E_Bias - 1); - else - F := Short_Float'Scaling (F, F_Size - E); - end if; - - -- Compute Exponent and Fraction - - Exponent := Long_Unsigned (E + E_Bias); - Fraction := Long_Unsigned (F * 2.0) / 2; - end if; - - -- Store Fraction - - for I in reverse SF_L - F_Bytes + 1 .. SF_L loop - S (I) := SE (Fraction mod BB); - Fraction := Fraction / BB; - end loop; - - -- Remove implicit bit - - S (SF_L - F_Bytes + 1) := S (SF_L - F_Bytes + 1) and F_Mask; - - -- Store Exponent (not always at the beginning of a byte) - - Exponent := Shift_Left (Exponent, Integer (E_Bytes) * SU - E_Size - 1); - for N in reverse 1 .. E_Bytes loop - S (N) := SE (Exponent mod BB) + S (N); - Exponent := Exponent / BB; - end loop; - - -- Store Sign - - if not Positive then - S (1) := S (1) + BS; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_SF; - - ---------- - -- W_SI -- - ---------- - - procedure W_SI (Stream : not null access RST; Item : Short_Integer) is - S : XDR_S_SI; - U : XDR_SU; - - begin - if Optimize_Integers then - S := Short_Integer_To_XDR_S_SI (Item); - - else - -- Test sign and apply two complement's notation - - U := (if Item < 0 - then XDR_SU'Last xor XDR_SU (-(Item + 1)) - else XDR_SU (Item)); - - for N in reverse S'Range loop - S (N) := SE (U mod BB); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_SI; - - ----------- - -- W_SSI -- - ----------- - - procedure W_SSI - (Stream : not null access RST; - Item : Short_Short_Integer) - is - S : XDR_S_SSI; - U : XDR_SSU; - - begin - if Optimize_Integers then - S := Short_Short_Integer_To_XDR_S_SSI (Item); - - else - -- Test sign and apply two complement's notation - - U := (if Item < 0 - then XDR_SSU'Last xor XDR_SSU (-(Item + 1)) - else XDR_SSU (Item)); - - S (1) := SE (U); - end if; - - Ada.Streams.Write (Stream.all, S); - end W_SSI; - - ----------- - -- W_SSU -- - ----------- - - procedure W_SSU - (Stream : not null access RST; - Item : Short_Short_Unsigned) - is - U : constant XDR_SSU := XDR_SSU (Item); - S : XDR_S_SSU; - - begin - S (1) := SE (U); - Ada.Streams.Write (Stream.all, S); - end W_SSU; - - ---------- - -- W_SU -- - ---------- - - procedure W_SU (Stream : not null access RST; Item : Short_Unsigned) is - S : XDR_S_SU; - U : XDR_SU := XDR_SU (Item); - - 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); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_SU; - - --------- - -- W_U -- - --------- - - procedure W_U (Stream : not null access RST; Item : Unsigned) is - S : XDR_S_U; - U : XDR_U := XDR_U (Item); - - 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); - U := U / BB; - end loop; - - if U /= 0 then - raise Data_Error; - end if; - end if; - - Ada.Streams.Write (Stream.all, S); - end W_U; - - ---------- - -- W_WC -- - ---------- - - procedure W_WC (Stream : not null access RST; Item : Wide_Character) is - S : XDR_S_WC; - U : XDR_WC; - - begin - -- Use Ada requirements on Wide_Character representation clause - - U := XDR_WC (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_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; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/s-ststop.adb gcc-4.6.0/gcc/ada/s-ststop.adb *** gcc-4.5.2/gcc/ada/s-ststop.adb Fri Apr 17 13:07:12 2009 --- gcc-4.6.0/gcc/ada/s-ststop.adb Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2008-2010, 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- -- *************** package body System.Strings.Stream_Ops i *** 216,222 **** Rem_Size : constant Natural := Block_Size mod Default_Block_Size; ! -- String indices Low : Positive := Item'First; High : Positive := Low + C_In_Default_Block - 1; --- 216,222 ---- Rem_Size : constant Natural := Block_Size mod Default_Block_Size; ! -- String indexes Low : Positive := Item'First; High : Positive := Low + C_In_Default_Block - 1; *************** package body System.Strings.Stream_Ops i *** 338,344 **** Rem_Size : constant Natural := Block_Size mod Default_Block_Size; ! -- String indices Low : Positive := Item'First; High : Positive := Low + C_In_Default_Block - 1; --- 338,344 ---- Rem_Size : constant Natural := Block_Size mod Default_Block_Size; ! -- String indexes Low : Positive := Item'First; High : Positive := Low + C_In_Default_Block - 1; diff -Nrcpad gcc-4.5.2/gcc/ada/s-stusta.adb gcc-4.6.0/gcc/ada/s-stusta.adb *** gcc-4.5.2/gcc/ada/s-stusta.adb Wed Apr 29 10:50:37 2009 --- gcc-4.6.0/gcc/ada/s-stusta.adb Mon Dec 20 07:26:57 2010 *************** package body System.Stack_Usage.Tasking *** 51,57 **** -- System.Stack_Usage.Result_Array procedure Compute_Current_Task; ! -- Compute the stack usage for a given task and saves it in the a precise -- slot in System.Stack_Usage.Result_Array; procedure Report_Impl (All_Tasks : Boolean; Do_Print : Boolean); --- 51,57 ---- -- System.Stack_Usage.Result_Array procedure Compute_Current_Task; ! -- Compute the stack usage for a given task and saves it in the precise -- slot in System.Stack_Usage.Result_Array; procedure Report_Impl (All_Tasks : Boolean; Do_Print : Boolean); diff -Nrcpad gcc-4.5.2/gcc/ada/s-taenca.adb gcc-4.6.0/gcc/ada/s-taenca.adb *** gcc-4.5.2/gcc/ada/s-taenca.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-taenca.adb Thu Sep 9 13:53:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Tasking.Entry_Calls *** 590,595 **** --- 590,602 ---- Entry_Call.Cancellation_Attempted := True; + -- Reset Entry_Call.State so that the call is marked as cancelled + -- by Check_Pending_Actions_For_Entry_Call below. + + if Entry_Call.State < Was_Abortable then + Entry_Call.State := Now_Abortable; + end if; + if Self_Id.Pending_ATC_Level >= Entry_Call.Level then Self_Id.Pending_ATC_Level := Entry_Call.Level - 1; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/s-taprop-linux.adb gcc-4.6.0/gcc/ada/s-taprop-linux.adb *** gcc-4.5.2/gcc/ada/s-taprop-linux.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-taprop-linux.adb Mon Oct 18 13:54:23 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with System.Tasking.Debug; *** 48,53 **** --- 48,54 ---- with System.Interrupt_Management; with System.OS_Primitives; with System.Stack_Checking.Operations; + with System.Multiprocessors; with System.Soft_Links; -- We use System.Soft_Links instead of System.Tasking.Initialization *************** package body System.Task_Primitives.Oper *** 717,723 **** Specific.Set (Self_ID); ! if Use_Alternate_Stack then declare Stack : aliased stack_t; Result : Interfaces.C.int; --- 718,726 ---- Specific.Set (Self_ID); ! if Use_Alternate_Stack ! and then Self_ID.Common.Task_Alternate_Stack /= Null_Address ! then declare Stack : aliased stack_t; Result : Interfaces.C.int; *************** package body System.Task_Primitives.Oper *** 817,822 **** --- 820,827 ---- Adjusted_Stack_Size : Interfaces.C.size_t; Result : Interfaces.C.int; + use type System.Multiprocessors.CPU_Range; + begin Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size + Alternate_Stack_Size); *************** package body System.Task_Primitives.Oper *** 839,844 **** --- 844,889 ---- (Attributes'Access, PTHREAD_CREATE_DETACHED); pragma Assert (Result = 0); + -- Set the required attributes for the creation of the thread + + -- Note: Previously, we called pthread_setaffinity_np (after thread + -- creation but before thread activation) to set the affinity but it was + -- not behaving as expected. Setting the required attributes for the + -- creation of the thread works correctly and it is more appropriate. + + -- Do nothing if required support not provided by the operating system + + if pthread_attr_setaffinity_np'Address = System.Null_Address then + null; + + -- Support is available + + elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then + declare + CPU_Set : aliased cpu_set_t := (bits => (others => False)); + begin + CPU_Set.bits (Integer (T.Common.Base_CPU)) := True; + Result := + pthread_attr_setaffinity_np + (Attributes'Access, + CPU_SETSIZE / 8, + CPU_Set'Access); + pragma Assert (Result = 0); + end; + + -- Handle Task_Info + + elsif T.Common.Task_Info /= null + and then T.Common.Task_Info.CPU_Affinity /= Task_Info.Any_CPU + then + Result := + pthread_attr_setaffinity_np + (Attributes'Access, + CPU_SETSIZE / 8, + T.Common.Task_Info.CPU_Affinity'Access); + pragma Assert (Result = 0); + end if; + -- Since the initial signal mask of a thread is inherited from the -- creator, and the Environment task has all its signals masked, we -- do not need to manipulate caller's signal mask at this point. *************** package body System.Task_Primitives.Oper *** 861,879 **** Succeeded := True; - -- Handle Task_Info - - if T.Common.Task_Info /= null then - if T.Common.Task_Info.CPU_Affinity /= Task_Info.Any_CPU then - Result := - pthread_setaffinity_np - (T.Common.LL.Thread, - CPU_SETSIZE / 8, - T.Common.Task_Info.CPU_Affinity'Access); - pragma Assert (Result = 0); - end if; - end if; - Result := pthread_attr_destroy (Attributes'Access); pragma Assert (Result = 0); --- 906,911 ---- *************** package body System.Task_Primitives.Oper *** 1236,1241 **** --- 1268,1275 ---- -- 's' Interrupt_State pragma set state to System (use "default" -- system handler) + use type System.Multiprocessors.CPU_Range; + begin Environment_Task_Id := Environment_Task; *************** package body System.Task_Primitives.Oper *** 1296,1301 **** --- 1330,1354 ---- pragma Assert (Result = 0); Abort_Handler_Installed := True; end if; + + -- pragma CPU for the environment task + + if pthread_setaffinity_np'Address /= System.Null_Address + and then Environment_Task.Common.Base_CPU /= + System.Multiprocessors.Not_A_Specific_CPU + then + declare + CPU_Set : aliased cpu_set_t := (bits => (others => False)); + begin + CPU_Set.bits (Integer (Environment_Task.Common.Base_CPU)) := True; + Result := + pthread_setaffinity_np + (Environment_Task.Common.LL.Thread, + CPU_SETSIZE / 8, + CPU_Set'Access); + pragma Assert (Result = 0); + end; + end if; end Initialize; end System.Task_Primitives.Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/s-taprop-mingw.adb gcc-4.6.0/gcc/ada/s-taprop-mingw.adb *** gcc-4.5.2/gcc/ada/s-taprop-mingw.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/s-taprop-mingw.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Ada.Unchecked_Deallocation; *** 43,48 **** --- 43,49 ---- with Interfaces.C; with Interfaces.C.Strings; + with System.Multiprocessors; with System.Tasking.Debug; with System.OS_Primitives; with System.Task_Info; *************** package body System.Task_Primitives.Oper *** 794,799 **** --- 795,803 ---- pragma Import (C, Init_Float, "__gnat_init_float"); -- Properly initializes the FPU for x86 systems + procedure Get_Stack_Bounds (Base : Address; Limit : Address); + pragma Import (C, Get_Stack_Bounds, "__gnat_get_stack_bounds"); + -- Get stack boundaries begin Specific.Set (Self_ID); Init_Float; *************** package body System.Task_Primitives.Oper *** 806,811 **** --- 810,819 ---- end if; Self_ID.Common.LL.Thread_Id := GetCurrentThreadId; + + Get_Stack_Bounds + (Self_ID.Common.Compiler_Data.Pri_Stack_Info.Base'Address, + Self_ID.Common.Compiler_Data.Pri_Stack_Info.Limit'Address); end Enter_Task; -------------- *************** package body System.Task_Primitives.Oper *** 883,888 **** --- 891,898 ---- Result : DWORD; Entry_Point : PTHREAD_START_ROUTINE; + use type System.Multiprocessors.CPU_Range; + begin pTaskParameter := To_Address (T); *************** package body System.Task_Primitives.Oper *** 918,923 **** --- 928,942 ---- T.Common.LL.Thread := hTask; + -- Note: it would be useful to initialize Thread_Id right away to avoid + -- a race condition in gdb where Thread_ID may not have the right value + -- yet, but GetThreadId is a Vista specific API, not available under XP: + -- T.Common.LL.Thread_Id := GetThreadId (hTask); so instead we set the + -- field to 0 to avoid having a random value. Thread_Id is initialized + -- in Enter_Task anyway. + + T.Common.LL.Thread_Id := 0; + -- Step 3: set its priority (child has inherited priority from parent) Set_Priority (T, Priority); *************** package body System.Task_Primitives.Oper *** 927,948 **** or else Get_Policy (Priority) = 'F' then -- Here we need Annex D semantics so we disable the NT priority ! -- 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 => Win32.TRUE); end if; ! -- Step 4: Handle Task_Info ! if T.Common.Task_Info /= null then if T.Common.Task_Info.CPU /= Task_Info.Any_CPU then Result := SetThreadIdealProcessor (hTask, T.Common.Task_Info.CPU); pragma Assert (Result = 1); end if; end if; ! -- Step 5: Now, start it for good: Result := ResumeThread (hTask); pragma Assert (Result = 1); --- 946,976 ---- or else Get_Policy (Priority) = 'F' then -- Here we need Annex D semantics so we disable the NT priority ! -- 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 => Win32.TRUE); end if; ! -- Step 4: Handle pragma CPU and Task_Info ! if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then ! ! -- The CPU numbering in pragma CPU starts at 1 while the subprogram ! -- to set the affinity starts at 0, therefore we must subtract 1. ! ! Result := SetThreadIdealProcessor ! (hTask, ProcessorId (T.Common.Base_CPU) - 1); ! pragma Assert (Result = 1); ! ! elsif T.Common.Task_Info /= null then if T.Common.Task_Info.CPU /= Task_Info.Any_CPU then Result := SetThreadIdealProcessor (hTask, T.Common.Task_Info.CPU); pragma Assert (Result = 1); end if; end if; ! -- Step 5: Now, start it for good Result := ResumeThread (hTask); pragma Assert (Result = 1); *************** package body System.Task_Primitives.Oper *** 1046,1051 **** --- 1074,1083 ---- Discard : BOOL; pragma Unreferenced (Discard); + Result : DWORD; + + use type System.Multiprocessors.CPU_Range; + begin Environment_Task_Id := Environment_Task; OS_Primitives.Initialize; *************** package body System.Task_Primitives.Oper *** 1076,1081 **** --- 1108,1128 ---- Environment_Task.Known_Tasks_Index := Known_Tasks'First; Enter_Task (Environment_Task); + + -- pragma CPU for the environment task + + if Environment_Task.Common.Base_CPU /= + System.Multiprocessors.Not_A_Specific_CPU + then + -- The CPU numbering in pragma CPU starts at 1 while the subprogram + -- to set the affinity starts at 0, therefore we must subtract 1. + + Result := + SetThreadIdealProcessor + (Environment_Task.Common.LL.Thread, + ProcessorId (Environment_Task.Common.Base_CPU) - 1); + pragma Assert (Result = 1); + end if; end Initialize; --------------------- *************** package body System.Task_Primitives.Oper *** 1122,1127 **** --- 1169,1175 ---- procedure Finalize (S : in out Suspension_Object) is Result : BOOL; + begin -- Destroy internal mutex *************** package body System.Task_Primitives.Oper *** 1200,1205 **** --- 1248,1254 ---- procedure Suspend_Until_True (S : in out Suspension_Object) is Result : DWORD; Result_Bool : BOOL; + begin SSL.Abort_Defer.all; diff -Nrcpad gcc-4.5.2/gcc/ada/s-taprop-solaris.adb gcc-4.6.0/gcc/ada/s-taprop-solaris.adb *** gcc-4.5.2/gcc/ada/s-taprop-solaris.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-taprop-solaris.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Ada.Unchecked_Deallocation; *** 42,47 **** --- 42,48 ---- with Interfaces.C; + with System.Multiprocessors; with System.Tasking.Debug; with System.Interrupt_Management; with System.OS_Primitives; *************** package body System.Task_Primitives.Oper *** 866,877 **** Last_Proc : processorid_t; -- Last processor # use System.Task_Info; begin Self_ID.Common.LL.Thread := thr_self; Self_ID.Common.LL.LWP := lwp_self; ! if Self_ID.Common.Task_Info /= null then if Self_ID.Common.Task_Info.New_LWP and then Self_ID.Common.Task_Info.CPU /= CPU_UNCHANGED then --- 867,896 ---- Last_Proc : processorid_t; -- Last processor # use System.Task_Info; + use type System.Multiprocessors.CPU_Range; + begin Self_ID.Common.LL.Thread := thr_self; Self_ID.Common.LL.LWP := lwp_self; ! -- pragma CPU ! ! if Self_ID.Common.Base_CPU /= ! System.Multiprocessors.Not_A_Specific_CPU ! then ! -- The CPU numbering in pragma CPU starts at 1 while the subprogram ! -- to set the affinity starts at 0, therefore we must subtract 1. ! ! Result := ! processor_bind ! (P_LWPID, P_MYID, processorid_t (Self_ID.Common.Base_CPU) - 1, ! null); ! pragma Assert (Result = 0); ! ! -- Task_Info ! ! elsif Self_ID.Common.Task_Info /= null then if Self_ID.Common.Task_Info.New_LWP and then Self_ID.Common.Task_Info.CPU /= CPU_UNCHANGED then diff -Nrcpad gcc-4.5.2/gcc/ada/s-taprop-vxworks.adb gcc-4.6.0/gcc/ada/s-taprop-vxworks.adb *** gcc-4.5.2/gcc/ada/s-taprop-vxworks.adb Mon Nov 30 10:45:39 2009 --- gcc-4.6.0/gcc/ada/s-taprop-vxworks.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Ada.Unchecked_Deallocation; *** 43,48 **** --- 43,49 ---- with Interfaces.C; + with System.Multiprocessors; with System.Tasking.Debug; with System.Interrupt_Management; *************** package body System.Task_Primitives.Oper *** 99,108 **** Dispatching_Policy : Character; pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy"); - function Get_Policy (Prio : System.Any_Priority) return Character; - pragma Import (C, Get_Policy, "__gnat_get_specific_dispatching"); - -- Get priority specific dispatching policy - Mutex_Protocol : Priority_Type; Foreign_Task_Elaborated : aliased Boolean := True; --- 100,105 ---- *************** package body System.Task_Primitives.Oper *** 167,172 **** --- 164,173 ---- procedure Install_Signal_Handlers; -- Install the default signal handlers for the current task + function Is_Task_Context return Boolean; + -- This function returns True if the current execution is in the context + -- of a task, and False if it is an interrupt context. + function To_Address is new Ada.Unchecked_Conversion (Task_Id, System.Address); *************** package body System.Task_Primitives.Oper *** 734,753 **** -- Set_Priority -- ------------------ - type Prio_Array_Type is array (System.Any_Priority) of Integer; - pragma Atomic_Components (Prio_Array_Type); - - Prio_Array : Prio_Array_Type; - -- Global array containing the id of the currently running task for each - -- priority. Note that we assume that we are on a single processor with - -- run-till-blocked scheduling. - procedure Set_Priority (T : Task_Id; Prio : System.Any_Priority; Loss_Of_Inheritance : Boolean := False) is ! Array_Item : Integer; Result : int; begin --- 735,747 ---- -- Set_Priority -- ------------------ procedure Set_Priority (T : Task_Id; Prio : System.Any_Priority; Loss_Of_Inheritance : Boolean := False) is ! pragma Unreferenced (Loss_Of_Inheritance); ! Result : int; begin *************** package body System.Task_Primitives.Oper *** 756,788 **** (T.Common.LL.Thread, To_VxWorks_Priority (int (Prio))); pragma Assert (Result = 0); ! if (Dispatching_Policy = 'F' or else Get_Policy (Prio) = 'F') ! and then Loss_Of_Inheritance ! and then Prio < T.Common.Current_Priority ! then ! -- Annex D requirement (RM D.2.2(9)): ! ! -- If the task drops its priority due to the loss of inherited ! -- priority, it is added at the head of the ready queue for its ! -- new active priority. ! ! Array_Item := Prio_Array (T.Common.Base_Priority) + 1; ! Prio_Array (T.Common.Base_Priority) := Array_Item; ! ! loop ! -- Give some processes a chance to arrive ! ! taskDelay (0); ! ! -- Then wait for our turn to proceed ! ! exit when Array_Item = Prio_Array (T.Common.Base_Priority) ! or else Prio_Array (T.Common.Base_Priority) = 1; ! end loop; ! Prio_Array (T.Common.Base_Priority) := ! Prio_Array (T.Common.Base_Priority) - 1; ! end if; T.Common.Current_Priority := Prio; end Set_Priority; --- 750,765 ---- (T.Common.LL.Thread, To_VxWorks_Priority (int (Prio))); pragma Assert (Result = 0); ! -- Note: in VxWorks 6.6 (or earlier), the task is placed at the end of ! -- the priority queue instead of the head. This is not the behavior ! -- required by Annex D (RM D.2.3(5/2)), but we consider it an acceptable ! -- variation (RM 1.1.3(6)), given this is the built-in behavior of the ! -- operating system. VxWorks versions starting from 6.7 implement the ! -- required Annex D semantics. ! -- In older versions we attempted to better approximate the Annex D ! -- required behavior, but this simulation was not entirely accurate, ! -- and it seems better to live with the standard VxWorks semantics. T.Common.Current_Priority := Prio; end Set_Priority; *************** package body System.Task_Primitives.Oper *** 892,900 **** Succeeded : out Boolean) is Adjusted_Stack_Size : size_t; ! Result : int; use System.Task_Info; begin -- Ask for four extra bytes of stack space so that the ATCB pointer can --- 869,878 ---- Succeeded : out Boolean) is Adjusted_Stack_Size : size_t; ! Result : int := 0; use System.Task_Info; + use type System.Multiprocessors.CPU_Range; begin -- Ask for four extra bytes of stack space so that the ATCB pointer can *************** package body System.Task_Primitives.Oper *** 960,973 **** -- Set processor affinity ! if T.Common.Task_Info /= Unspecified_Task_Info then Result := taskCpuAffinitySet (T.Common.LL.Thread, T.Common.Task_Info); ! if Result = -1 then ! taskDelete (T.Common.LL.Thread); ! T.Common.LL.Thread := -1; ! end if; end if; if T.Common.LL.Thread = -1 then --- 938,955 ---- -- Set processor affinity ! if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then ! Result := ! taskCpuAffinitySet (T.Common.LL.Thread, int (T.Common.Base_CPU)); ! ! elsif T.Common.Task_Info /= Unspecified_Task_Info then Result := taskCpuAffinitySet (T.Common.LL.Thread, T.Common.Task_Info); + end if; ! if Result = -1 then ! taskDelete (T.Common.LL.Thread); ! T.Common.LL.Thread := -1; end if; if T.Common.LL.Thread = -1 then *************** package body System.Task_Primitives.Oper *** 1123,1129 **** Result : STATUS; begin ! SSL.Abort_Defer.all; Result := semTake (S.L, WAIT_FOREVER); pragma Assert (Result = OK); --- 1105,1116 ---- Result : STATUS; begin ! -- Set_True can be called from an interrupt context, in which case ! -- Abort_Defer is undefined. ! ! if Is_Task_Context then ! SSL.Abort_Defer.all; ! end if; Result := semTake (S.L, WAIT_FOREVER); pragma Assert (Result = OK); *************** package body System.Task_Primitives.Oper *** 1146,1152 **** Result := semGive (S.L); pragma Assert (Result = OK); ! SSL.Abort_Undefer.all; end Set_True; ------------------------ --- 1133,1145 ---- Result := semGive (S.L); pragma Assert (Result = OK); ! -- Set_True can be called from an interrupt context, in which case ! -- Abort_Undefer is undefined. ! ! if Is_Task_Context then ! SSL.Abort_Undefer.all; ! end if; ! end Set_True; ------------------------ *************** package body System.Task_Primitives.Oper *** 1344,1349 **** --- 1337,1351 ---- end if; end Continue_Task; + --------------------- + -- Is_Task_Context -- + --------------------- + + function Is_Task_Context return Boolean is + begin + return System.OS_Interface.Interrupt_Context /= 1; + end Is_Task_Context; + ---------------- -- Initialize -- ---------------- *************** package body System.Task_Primitives.Oper *** 1351,1356 **** --- 1353,1360 ---- procedure Initialize (Environment_Task : Task_Id) is Result : int; + use type System.Multiprocessors.CPU_Range; + begin Environment_Task_Id := Environment_Task; *************** package body System.Task_Primitives.Oper *** 1397,1402 **** --- 1401,1418 ---- Environment_Task.Known_Tasks_Index := Known_Tasks'First; Enter_Task (Environment_Task); + + -- Set processor affinity + + if Environment_Task.Common.Base_CPU /= + System.Multiprocessors.Not_A_Specific_CPU + then + Result := + taskCpuAffinitySet + (Environment_Task.Common.LL.Thread, + int (Environment_Task.Common.Base_CPU)); + pragma Assert (Result /= -1); + end if; end Initialize; end System.Task_Primitives.Operations; diff -Nrcpad gcc-4.5.2/gcc/ada/s-tarest.adb gcc-4.6.0/gcc/ada/s-tarest.adb *** gcc-4.5.2/gcc/ada/s-tarest.adb Mon Nov 30 10:28:23 2009 --- gcc-4.6.0/gcc/ada/s-tarest.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2010, 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- -- *************** package body System.Tasking.Restricted.S *** 458,463 **** --- 458,464 ---- Stack_Address : System.Address; Size : System.Parameters.Size_Type; Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; State : Task_Procedure_Access; Discriminants : System.Address; Elaborated : Access_Boolean; *************** package body System.Tasking.Restricted.S *** 467,472 **** --- 468,474 ---- is Self_ID : constant Task_Id := STPO.Self; Base_Priority : System.Any_Priority; + Base_CPU : System.Multiprocessors.CPU_Range; Success : Boolean; Len : Integer; *************** package body System.Tasking.Restricted.S *** 481,486 **** --- 483,503 ---- then Self_ID.Common.Base_Priority else System.Any_Priority (Priority)); + if CPU /= Unspecified_CPU + and then (CPU < Integer (System.Multiprocessors.CPU_Range'First) + or else CPU > Integer (System.Multiprocessors.CPU_Range'Last) + or else CPU > Integer (System.Multiprocessors.Number_Of_CPUs)) + then + raise Tasking_Error with "CPU not in range"; + + -- Normal CPU affinity + else + Base_CPU := + (if CPU = Unspecified_CPU + then Self_ID.Common.Base_CPU + else System.Multiprocessors.CPU_Range (CPU)); + end if; + if Single_Lock then Lock_RTS; end if; *************** package body System.Tasking.Restricted.S *** 492,498 **** Initialize_ATCB (Self_ID, State, Discriminants, Self_ID, Elaborated, Base_Priority, ! Task_Info, Size, Created_Task, Success); -- If we do our job right then there should never be any failures, which -- was probably said about the Titanic; so just to be safe, let's retain --- 509,515 ---- Initialize_ATCB (Self_ID, State, Discriminants, Self_ID, Elaborated, Base_Priority, ! Base_CPU, Task_Info, Size, Created_Task, Success); -- If we do our job right then there should never be any failures, which -- was probably said about the Titanic; so just to be safe, let's retain diff -Nrcpad gcc-4.5.2/gcc/ada/s-tarest.ads gcc-4.6.0/gcc/ada/s-tarest.ads *** gcc-4.5.2/gcc/ada/s-tarest.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-tarest.ads Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Tasking.Restricted.Stages *** 87,95 **** -- system__tasking__ada_task_control_blockIP (_init._atcb, 0); -- _init._task_id := _init._atcb'unchecked_access; -- create_restricted_task (unspecified_priority, tZ, ! -- unspecified_task_info, task_procedure_access!(tB'address), ! -- _init'address, tE'unchecked_access, _chain, _task_name, _init. ! -- _task_id); -- return; -- end tVIP; --- 87,95 ---- -- system__tasking__ada_task_control_blockIP (_init._atcb, 0); -- _init._task_id := _init._atcb'unchecked_access; -- create_restricted_task (unspecified_priority, tZ, ! -- unspecified_task_info, unspecified_cpu, ! -- task_procedure_access!(tB'address), _init'address, ! -- tE'unchecked_access, _chain, _task_name, _init._task_id); -- return; -- end tVIP; *************** package System.Tasking.Restricted.Stages *** 127,132 **** --- 127,133 ---- Stack_Address : System.Address; Size : System.Parameters.Size_Type; Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; State : Task_Procedure_Access; Discriminants : System.Address; Elaborated : Access_Boolean; *************** package System.Tasking.Restricted.Stages *** 149,154 **** --- 150,160 ---- -- Task_Info is the task info associated with the created task, or -- Unspecified_Task_Info if none. -- + -- CPU is the task affinity. We pass it as an Integer to avoid an explicit + -- dependency from System.Multiprocessors when not needed. Static range + -- checks are performed when analyzing the pragma, and dynamic ones are + -- performed before setting the affinity at run time. + -- -- State is the compiler generated task's procedure body -- -- Discriminants is a pointer to a limited record whose discriminants are diff -Nrcpad gcc-4.5.2/gcc/ada/s-tasdeb.adb gcc-4.6.0/gcc/ada/s-tasdeb.adb *** gcc-4.5.2/gcc/ada/s-tasdeb.adb Thu Apr 16 09:34:40 2009 --- gcc-4.6.0/gcc/ada/s-tasdeb.adb Thu Jun 17 12:26:10 2010 *************** package body System.Tasking.Debug is *** 362,371 **** ----------- procedure Write (Fd : Integer; S : String; Count : Integer) is ! Discard : Integer; pragma Unreferenced (Discard); begin ! Discard := System.CRTL.write (Fd, S (S'First)'Address, Count); -- Is it really right to ignore write errors here ??? end Write; --- 362,372 ---- ----------- procedure Write (Fd : Integer; S : String; Count : Integer) is ! Discard : System.CRTL.ssize_t; pragma Unreferenced (Discard); begin ! Discard := System.CRTL.write (Fd, S (S'First)'Address, ! System.CRTL.size_t (Count)); -- Is it really right to ignore write errors here ??? end Write; diff -Nrcpad gcc-4.5.2/gcc/ada/s-taskin.adb gcc-4.6.0/gcc/ada/s-taskin.adb *** gcc-4.5.2/gcc/ada/s-taskin.adb Mon Jul 13 08:39:28 2009 --- gcc-4.6.0/gcc/ada/s-taskin.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Tasking is *** 98,103 **** --- 98,104 ---- Parent : Task_Id; Elaborated : Access_Boolean; Base_Priority : System.Any_Priority; + Base_CPU : System.Multiprocessors.CPU_Range; Task_Info : System.Task_Info.Task_Info_Type; Stack_Size : System.Parameters.Size_Type; T : Task_Id; *************** package body System.Tasking is *** 119,124 **** --- 120,126 ---- T.Common.Parent := Parent; T.Common.Base_Priority := Base_Priority; + T.Common.Base_CPU := Base_CPU; T.Common.Current_Priority := 0; T.Common.Protected_Action_Nesting := 0; T.Common.Call := null; *************** package body System.Tasking is *** 170,181 **** --- 172,190 ---- -- because we use the value -1 to indicate the default main priority, and -- that is of course not in Priority'range. + Main_CPU : Integer; + pragma Import (C, Main_CPU, "__gl_main_cpu"); + -- Affinity for main task. Note that this is of type Integer, not + -- CPU_Range, because we use the value -1 to indicate the unassigned + -- affinity, and that is of course not in CPU_Range'Range. + Initialized : Boolean := False; -- Used to prevent multiple calls to Initialize procedure Initialize is T : Task_Id; Base_Priority : Any_Priority; + Base_CPU : System.Multiprocessors.CPU_Range; Success : Boolean; begin *************** package body System.Tasking is *** 192,200 **** then Default_Priority else Priority (Main_Priority)); T := STPO.New_ATCB (0); Initialize_ATCB ! (null, null, Null_Address, Null_Task, null, Base_Priority, Task_Info.Unspecified_Task_Info, 0, T, Success); pragma Assert (Success); --- 201,214 ---- then Default_Priority else Priority (Main_Priority)); + Base_CPU := + (if Main_CPU = Unspecified_CPU + then System.Multiprocessors.Not_A_Specific_CPU + else System.Multiprocessors.CPU_Range (Main_CPU)); + T := STPO.New_ATCB (0); Initialize_ATCB ! (null, null, Null_Address, Null_Task, null, Base_Priority, Base_CPU, Task_Info.Unspecified_Task_Info, 0, T, Success); pragma Assert (Success); diff -Nrcpad gcc-4.5.2/gcc/ada/s-taskin.ads gcc-4.6.0/gcc/ada/s-taskin.ads *** gcc-4.5.2/gcc/ada/s-taskin.ads Tue Jul 7 12:42:43 2009 --- gcc-4.6.0/gcc/ada/s-taskin.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with System.Task_Info; *** 42,47 **** --- 42,48 ---- with System.Soft_Links; with System.Task_Primitives; with System.Stack_Usage; + with System.Multiprocessors; package System.Tasking is pragma Preelaborate; *************** package System.Tasking is *** 282,313 **** Cancelled -- the call was asynchronous, and was cancelled ); ! -- Never_Abortable is used for calls that are made in a abort ! -- deferred region (see ARM 9.8(5-11), 9.8 (20)). ! -- Such a call is never abortable. ! -- The Was_ vs. Not_Yet_ distinction is needed to decide whether it ! -- is OK to advance into the abortable part of an async. select stmt. ! -- That is allowed iff the mode is Now_ or Was_. ! -- Done indicates the call has been completed, without cancellation, ! -- or no call has been made yet at this ATC nesting level, ! -- and so aborting the call is no longer an issue. ! -- Completion of the call does not necessarily indicate "success"; ! -- the call may be returning an exception if Exception_To_Raise is ! -- non-null. ! -- Cancelled indicates the call was cancelled, ! -- and so aborting the call is no longer an issue. ! -- The call is on an entry queue unless ! -- State >= Done, in which case it may or may not be still Onqueue. ! -- Please do not modify the order of the values, without checking ! -- all uses of this type. We rely on partial "monotonicity" of ! -- Entry_Call_Record.State to avoid locking when we access this ! -- value for certain tests. In particular: -- 1) Once State >= Done, we can rely that the call has been -- completed. If State >= Done, it will not --- 283,313 ---- Cancelled -- the call was asynchronous, and was cancelled ); + pragma Ordered (Entry_Call_State); ! -- Never_Abortable is used for calls that are made in a abort deferred ! -- region (see ARM 9.8(5-11), 9.8 (20)). Such a call is never abortable. ! -- The Was_ vs. Not_Yet_ distinction is needed to decide whether it is OK ! -- to advance into the abortable part of an async. select stmt. That is ! -- allowed iff the mode is Now_ or Was_. ! -- Done indicates the call has been completed, without cancellation, or no ! -- call has been made yet at this ATC nesting level, and so aborting the ! -- call is no longer an issue. Completion of the call does not necessarily ! -- indicate "success"; the call may be returning an exception if ! -- Exception_To_Raise is non-null. ! -- Cancelled indicates the call was cancelled, and so aborting the call is ! -- no longer an issue. ! -- The call is on an entry queue unless State >= Done, in which case it may ! -- or may not be still Onqueue. ! -- Please do not modify the order of the values, without checking all uses ! -- of this type. We rely on partial "monotonicity" of ! -- Entry_Call_Record.State to avoid locking when we access this value for ! -- certain tests. In particular: -- 1) Once State >= Done, we can rely that the call has been -- completed. If State >= Done, it will not *************** package System.Tasking is *** 465,470 **** --- 465,475 ---- -- -- Protection: Only written by Self, accessed by anyone + Base_CPU : System.Multiprocessors.CPU_Range; + -- Base CPU, only changed via dispatching domains package. + -- + -- Protection: Self.L + Current_Priority : System.Any_Priority; -- Active priority, except that the effects of protected object -- priority ceilings are not reflected. This only reflects explicit *************** package System.Tasking is *** 695,703 **** Independent_Task_Level : constant Master_Level := 2; Library_Task_Level : constant Master_Level := 3; ! ------------------------------ ! -- Task size, priority info -- ! ------------------------------ Unspecified_Priority : constant Integer := System.Priority'First - 1; --- 700,708 ---- Independent_Task_Level : constant Master_Level := 2; Library_Task_Level : constant Master_Level := 3; ! ------------------- ! -- Priority info -- ! ------------------- Unspecified_Priority : constant Integer := System.Priority'First - 1; *************** package System.Tasking is *** 707,712 **** --- 712,724 ---- subtype Rendezvous_Priority is Integer range Priority_Not_Boosted .. System.Any_Priority'Last; + ------------------- + -- Affinity info -- + ------------------- + + Unspecified_CPU : constant := -1; + -- No affinity specified + ------------------------------------ -- Rendezvous related definitions -- ------------------------------------ *************** package System.Tasking is *** 858,864 **** type Direct_Index is range 0 .. Parameters.Default_Attribute_Count; subtype Direct_Index_Range is Direct_Index range 1 .. Direct_Index'Last; ! -- Attributes with indices in this range are stored directly in the task -- control block. Such attributes must be Address-sized. Other attributes -- will be held in dynamically allocated records chained off of the task -- control block. --- 870,876 ---- type Direct_Index is range 0 .. Parameters.Default_Attribute_Count; subtype Direct_Index_Range is Direct_Index range 1 .. Direct_Index'Last; ! -- Attributes with indexes in this range are stored directly in the task -- control block. Such attributes must be Address-sized. Other attributes -- will be held in dynamically allocated records chained off of the task -- control block. *************** package System.Tasking is *** 1092,1097 **** --- 1104,1110 ---- Parent : Task_Id; Elaborated : Access_Boolean; Base_Priority : System.Any_Priority; + Base_CPU : System.Multiprocessors.CPU_Range; Task_Info : System.Task_Info.Task_Info_Type; Stack_Size : System.Parameters.Size_Type; T : Task_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/s-tasren.adb gcc-4.6.0/gcc/ada/s-tasren.adb *** gcc-4.5.2/gcc/ada/s-tasren.adb Mon Jul 13 08:39:28 2009 --- gcc-4.6.0/gcc/ada/s-tasren.adb Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Tasking.Rendezvous i *** 1268,1274 **** if Old_State /= Entry_Call.State and then Entry_Call.State = Now_Abortable ! and then Entry_Call.Mode > Simple_Call and then Entry_Call.Self /= Self_ID -- Asynchronous_Call or Conditional_Call --- 1268,1274 ---- if Old_State /= Entry_Call.State and then Entry_Call.State = Now_Abortable ! and then Entry_Call.Mode /= Simple_Call and then Entry_Call.Self /= Self_ID -- Asynchronous_Call or Conditional_Call diff -Nrcpad gcc-4.5.2/gcc/ada/s-tassta.adb gcc-4.6.0/gcc/ada/s-tassta.adb *** gcc-4.5.2/gcc/ada/s-tassta.adb Mon Nov 30 10:49:27 2009 --- gcc-4.6.0/gcc/ada/s-tassta.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Tasking.Stages is *** 473,478 **** --- 473,479 ---- (Priority : Integer; Size : System.Parameters.Size_Type; Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; Relative_Deadline : Ada.Real_Time.Time_Span; Num_Entries : Task_Entry_Index; Master : Master_Level; *************** package body System.Tasking.Stages is *** 489,494 **** --- 490,496 ---- Success : Boolean; Base_Priority : System.Any_Priority; Len : Natural; + Base_CPU : System.Multiprocessors.CPU_Range; pragma Unreferenced (Relative_Deadline); -- EDF scheduling is not supported by any of the target platforms so *************** package body System.Tasking.Stages is *** 522,527 **** --- 524,544 ---- then Self_ID.Common.Base_Priority else System.Any_Priority (Priority)); + if CPU /= Unspecified_CPU + and then (CPU < Integer (System.Multiprocessors.CPU_Range'First) + or else CPU > Integer (System.Multiprocessors.CPU_Range'Last) + or else CPU > Integer (System.Multiprocessors.Number_Of_CPUs)) + then + raise Tasking_Error with "CPU not in range"; + + -- Normal CPU affinity + else + Base_CPU := + (if CPU = Unspecified_CPU + then Self_ID.Common.Base_CPU + else System.Multiprocessors.CPU_Range (CPU)); + end if; + -- Find parent P of new Task, via master level number P := Self_ID; *************** package body System.Tasking.Stages is *** 570,576 **** end if; Initialize_ATCB (Self_ID, State, Discriminants, P, Elaborated, ! Base_Priority, Task_Info, Size, T, Success); if not Success then Free (T); --- 587,593 ---- end if; Initialize_ATCB (Self_ID, State, Discriminants, P, Elaborated, ! Base_Priority, Base_CPU, Task_Info, Size, T, Success); if not Success then Free (T); *************** package body System.Tasking.Stages is *** 1093,1103 **** -- Assume a size of the stack taken at this stage - Overflow_Guard := - (if Size < Small_Stack_Limit - then Small_Overflow_Guard - else Big_Overflow_Guard); - if not Parameters.Sec_Stack_Dynamic then Self_ID.Common.Compiler_Data.Sec_Stack_Addr := Secondary_Stack'Address; --- 1110,1115 ---- *************** package body System.Tasking.Stages is *** 1109,1117 **** Self_ID.Common.Task_Alternate_Stack := Task_Alternate_Stack'Address; end if; ! Size := Size - Overflow_Guard; if System.Stack_Usage.Is_Enabled then STPO.Lock_RTS; Initialize_Analyzer (Self_ID.Common.Analyzer, --- 1121,1144 ---- Self_ID.Common.Task_Alternate_Stack := Task_Alternate_Stack'Address; end if; ! -- Set the guard page at the bottom of the stack. The call to unprotect ! -- the page is done in Terminate_Task ! ! Stack_Guard (Self_ID, True); ! ! -- Initialize low-level TCB components, that cannot be initialized by ! -- the creator. Enter_Task sets Self_ID.LL.Thread ! ! Enter_Task (Self_ID); ! ! -- Initialize dynamic stack usage if System.Stack_Usage.Is_Enabled then + Overflow_Guard := + (if Size < Small_Stack_Limit + then Small_Overflow_Guard + else Big_Overflow_Guard); + STPO.Lock_RTS; Initialize_Analyzer (Self_ID.Common.Analyzer, *************** package body System.Tasking.Stages is *** 1119,1140 **** (1 .. Self_ID.Common.Task_Image_Len), Natural (Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size), ! Size, ! SSE.To_Integer (Bottom_Of_Stack'Address)); STPO.Unlock_RTS; Fill_Stack (Self_ID.Common.Analyzer); end if; - -- Set the guard page at the bottom of the stack. The call to unprotect - -- the page is done in Terminate_Task - - Stack_Guard (Self_ID, True); - - -- Initialize low-level TCB components, that cannot be initialized by - -- the creator. Enter_Task sets Self_ID.LL.Thread - - Enter_Task (Self_ID); - -- We setup the SEH (Structured Exception Handling) handler if supported -- on the target. --- 1146,1159 ---- (1 .. Self_ID.Common.Task_Image_Len), Natural (Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size), ! Size - Overflow_Guard, ! SSE.To_Integer (Bottom_Of_Stack'Address), ! SSE.To_Integer ! (Self_ID.Common.Compiler_Data.Pri_Stack_Info.Limit)); STPO.Unlock_RTS; Fill_Stack (Self_ID.Common.Analyzer); end if; -- We setup the SEH (Structured Exception Handling) handler if supported -- on the target. diff -Nrcpad gcc-4.5.2/gcc/ada/s-tassta.ads gcc-4.6.0/gcc/ada/s-tassta.ads *** gcc-4.5.2/gcc/ada/s-tassta.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-tassta.ads Mon Oct 18 10:34:56 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package System.Tasking.Stages is *** 81,90 **** -- _init.discr := discr; -- _init._task_id := null; -- create_task (unspecified_priority, tZ, ! -- 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; -- end tVIP; -- ] --- 81,90 ---- -- _init.discr := discr; -- _init._task_id := null; -- create_task (unspecified_priority, tZ, ! -- unspecified_task_info, unspecified_cpu, ! -- 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; -- end tVIP; -- ] *************** package System.Tasking.Stages is *** 170,175 **** --- 170,176 ---- (Priority : Integer; Size : System.Parameters.Size_Type; Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; Relative_Deadline : Ada.Real_Time.Time_Span; Num_Entries : Task_Entry_Index; Master : Master_Level; *************** package System.Tasking.Stages is *** 183,193 **** -- Compiler interface only. Do not call from within the RTS. -- This must be called to create a new task. -- ! -- Priority is the task's priority (assumed to be in the ! -- System.Any_Priority'Range) -- 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 --- 184,198 ---- -- Compiler interface only. Do not call from within the RTS. -- This must be called to create a new task. -- ! -- Priority is the task's priority (assumed to be in range of type ! -- System.Any_Priority) -- 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. + -- CPU is the task affinity. Passed as an Integer because the undefined + -- value is not in the range of CPU_Range. Static range checks are + -- performed when analyzing the pragma, and dynamic ones are performed + -- before setting the affinity at run time. -- 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 diff -Nrcpad gcc-4.5.2/gcc/ada/s-tataat.ads gcc-4.6.0/gcc/ada/s-tataat.ads *** gcc-4.5.2/gcc/ada/s-tataat.ads Wed Mar 26 07:35:19 2008 --- gcc-4.6.0/gcc/ada/s-tataat.ads Thu Oct 21 10:14:06 2010 *************** *** 7,13 **** -- 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- -- --- 7,13 ---- -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- ! -- Copyright (C) 1995-2010, 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- -- *************** package System.Tasking.Task_Attributes i *** 107,113 **** -- Ensure that the designated object is always strictly enough aligned. In_Use : Direct_Index_Vector := 0; ! -- Set True for direct indices that are already used (True??? type???) All_Attributes : Access_Instance; -- A linked list of all indirectly access attributes, which includes all --- 107,113 ---- -- Ensure that the designated object is always strictly enough aligned. In_Use : Direct_Index_Vector := 0; ! -- Set True for direct indexes that are already used (True??? type???) All_Attributes : Access_Instance; -- A linked list of all indirectly access attributes, which includes all diff -Nrcpad gcc-4.5.2/gcc/ada/s-tpoben.adb gcc-4.6.0/gcc/ada/s-tpoben.adb *** gcc-4.5.2/gcc/ada/s-tpoben.adb Tue Jan 26 10:02:11 2010 --- gcc-4.6.0/gcc/ada/s-tpoben.adb Fri Jun 18 19:48:43 2010 *************** package body System.Tasking.Protected_Ob *** 226,237 **** raise Program_Error; end if; - -- pragma Assert (Self_Id.Deferral_Level = 0); -- If a PO is created from a controlled operation, abort is already ! -- deferred at this point, so we need to use Defer_Abort_Nestable ! -- In some cases, the above assertion can be useful to spot ! -- inconsistencies, outside the above scenario involving controlled ! -- types. Initialization.Defer_Abort_Nestable (Self_ID); Initialize_Lock (Init_Priority, Object.L'Access); --- 226,237 ---- raise Program_Error; end if; -- If a PO is created from a controlled operation, abort is already ! -- deferred at this point, so we need to use Defer_Abort_Nestable. In ! -- some cases, the following assertion can help to spot inconsistencies, ! -- outside the above scenario involving controlled types. ! ! -- pragma Assert (Self_Id.Deferral_Level = 0); Initialization.Defer_Abort_Nestable (Self_ID); Initialize_Lock (Init_Priority, Object.L'Access); diff -Nrcpad gcc-4.5.2/gcc/ada/s-tpobop.adb gcc-4.6.0/gcc/ada/s-tpobop.adb *** gcc-4.5.2/gcc/ada/s-tpobop.adb Mon Jul 13 08:39:28 2009 --- gcc-4.6.0/gcc/ada/s-tpobop.adb Thu Sep 9 13:53:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body System.Tasking.Protected_Ob *** 646,671 **** end if; end if; ! elsif Mode < Asynchronous_Call then ! ! -- Simple_Call or Conditional_Call ! ! if Single_Lock then ! STPO.Lock_RTS; ! Entry_Calls.Wait_For_Completion (Entry_Call); ! STPO.Unlock_RTS; ! else ! STPO.Write_Lock (Self_ID); ! Entry_Calls.Wait_For_Completion (Entry_Call); ! STPO.Unlock (Self_ID); ! end if; ! Block.Cancelled := Entry_Call.State = Cancelled; ! else ! pragma Assert (False); ! null; end if; Initialization.Undefer_Abort_Nestable (Self_ID); --- 646,671 ---- end if; end if; ! else ! case Mode is ! when Simple_Call | Conditional_Call => ! if Single_Lock then ! STPO.Lock_RTS; ! Entry_Calls.Wait_For_Completion (Entry_Call); ! STPO.Unlock_RTS; ! else ! STPO.Write_Lock (Self_ID); ! Entry_Calls.Wait_For_Completion (Entry_Call); ! STPO.Unlock (Self_ID); ! end if; ! Block.Cancelled := Entry_Call.State = Cancelled; ! when Asynchronous_Call | Timed_Call => ! pragma Assert (False); ! null; ! end case; end if; Initialization.Undefer_Abort_Nestable (Self_ID); *************** package body System.Tasking.Protected_Ob *** 958,964 **** Send_Trace_Info (POT_Call, Entry_Index (E), Timeout); end if; ! Initialization.Defer_Abort (Self_Id); Lock_Entries (Object, Ceiling_Violation); if Ceiling_Violation then --- 958,964 ---- Send_Trace_Info (POT_Call, Entry_Index (E), Timeout); end if; ! Initialization.Defer_Abort_Nestable (Self_Id); Lock_Entries (Object, Ceiling_Violation); if Ceiling_Violation then *************** package body System.Tasking.Protected_Ob *** 1009,1015 **** end if; Entry_Call_Successful := Entry_Call.State = Done; ! Initialization.Undefer_Abort (Self_Id); Entry_Calls.Check_Exception (Self_Id, Entry_Call); return; end if; --- 1009,1015 ---- end if; Entry_Call_Successful := Entry_Call.State = Done; ! Initialization.Undefer_Abort_Nestable (Self_Id); Entry_Calls.Check_Exception (Self_Id, Entry_Call); return; end if; *************** package body System.Tasking.Protected_Ob *** 1025,1031 **** -- ??? Do we need to yield in case Yielded is False ! Initialization.Undefer_Abort (Self_Id); Entry_Call_Successful := Entry_Call.State = Done; Entry_Calls.Check_Exception (Self_Id, Entry_Call); end Timed_Protected_Entry_Call; --- 1025,1031 ---- -- ??? Do we need to yield in case Yielded is False ! Initialization.Undefer_Abort_Nestable (Self_Id); Entry_Call_Successful := Entry_Call.State = Done; Entry_Calls.Check_Exception (Self_Id, Entry_Call); end Timed_Protected_Entry_Call; diff -Nrcpad gcc-4.5.2/gcc/ada/s-tporft.adb gcc-4.6.0/gcc/ada/s-tporft.adb *** gcc-4.5.2/gcc/ada/s-tporft.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-tporft.adb Mon Oct 18 10:27:48 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2002-2010, 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- -- *************** with System.Task_Info; *** 35,40 **** --- 35,42 ---- with System.Soft_Links; -- used to initialize TSD for a C thread, in function Self + with System.Multiprocessors; + separate (System.Task_Primitives.Operations) function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id is Local_ATCB : aliased Ada_Task_Control_Block (0); *************** begin *** 63,70 **** System.Tasking.Initialize_ATCB (Self_Id, null, Null_Address, Null_Task, Foreign_Task_Elaborated'Access, ! System.Priority'First, Task_Info.Unspecified_Task_Info, 0, Self_Id, ! Succeeded); Unlock_RTS; pragma Assert (Succeeded); --- 65,72 ---- System.Tasking.Initialize_ATCB (Self_Id, null, Null_Address, Null_Task, Foreign_Task_Elaborated'Access, ! System.Priority'First, System.Multiprocessors.Not_A_Specific_CPU, ! Task_Info.Unspecified_Task_Info, 0, Self_Id, Succeeded); Unlock_RTS; pragma Assert (Succeeded); *************** begin *** 86,101 **** Self_Id.Deferral_Level := 0; System.Soft_Links.Create_TSD (Self_Id.Common.Compiler_Data); -- ??? ! -- The following call is commented out to avoid dependence on ! -- the System.Tasking.Initialization package. ! -- It seems that if we want Ada.Task_Attributes to work correctly ! -- for C threads we will need to raise the visibility of this soft ! -- link to System.Soft_Links. ! -- We are putting that off until this new functionality is otherwise ! -- stable. -- System.Tasking.Initialization.Initialize_Attributes_Link.all (T); --- 88,105 ---- Self_Id.Deferral_Level := 0; + -- We do not provide an alternate stack for foreign threads + + Self_Id.Common.Task_Alternate_Stack := Null_Address; + System.Soft_Links.Create_TSD (Self_Id.Common.Compiler_Data); -- ??? ! -- The following call is commented out to avoid dependence on the ! -- System.Tasking.Initialization package. It seems that if we want ! -- Ada.Task_Attributes to work correctly for C threads we will need to ! -- raise the visibility of this soft link to System.Soft_Links. We are ! -- putting that off until this new functionality is otherwise stable. -- System.Tasking.Initialization.Initialize_Attributes_Link.all (T); diff -Nrcpad gcc-4.5.2/gcc/ada/s-utf_32.adb gcc-4.6.0/gcc/ada/s-utf_32.adb *** gcc-4.5.2/gcc/ada/s-utf_32.adb Fri Apr 17 13:07:12 2009 --- gcc-4.6.0/gcc/ada/s-utf_32.adb Thu Oct 7 09:16:06 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** package body System.UTF_32 is *** 4232,4246 **** -- The following two tables define the mapping to upper case. The first -- table gives the ranges of lower case letters. The corresponding entry ! -- in Uppercase_Adjust shows the amount to be added (or subtracted) from ! -- the code value to get the corresponding upper case letter. ! ! -- Note that this folding is not reversible, for example lower case ! -- dotless i folds to normal upper case I, and that cannot be reversed. Lower_Case_Letters : constant UTF_32_Ranges := ( (16#00061#, 16#0007A#), -- LATIN SMALL LETTER A .. LATIN SMALL LETTER Z - (16#000B5#, 16#000B5#), -- MICRO SIGN .. MICRO SIGN (16#000E0#, 16#000F6#), -- LATIN SMALL LETTER A WITH GRAVE .. LATIN SMALL LETTER O WITH DIAERESIS (16#000F8#, 16#000FE#), -- LATIN SMALL LETTER O WITH STROKE .. LATIN SMALL LETTER THORN (16#000FF#, 16#000FF#), -- LATIN SMALL LETTER Y WITH DIAERESIS .. LATIN SMALL LETTER Y WITH DIAERESIS --- 4232,4247 ---- -- The following two tables define the mapping to upper case. The first -- table gives the ranges of lower case letters. The corresponding entry ! -- in Uppercase_Adjust shows the amount to be added to (or subtracted from ! -- if the value is negative) the code value to get the corresponding upper ! -- case letter. ! -- ! -- An entry is in this table if its 10646 has the string SMALL LETTER ! -- the name, and there is a corresponding entry which has the string ! -- CAPITAL LETTER in its name. Lower_Case_Letters : constant UTF_32_Ranges := ( (16#00061#, 16#0007A#), -- LATIN SMALL LETTER A .. LATIN SMALL LETTER Z (16#000E0#, 16#000F6#), -- LATIN SMALL LETTER A WITH GRAVE .. LATIN SMALL LETTER O WITH DIAERESIS (16#000F8#, 16#000FE#), -- LATIN SMALL LETTER O WITH STROKE .. LATIN SMALL LETTER THORN (16#000FF#, 16#000FF#), -- LATIN SMALL LETTER Y WITH DIAERESIS .. LATIN SMALL LETTER Y WITH DIAERESIS *************** package body System.UTF_32 is *** 4268,4275 **** (16#0012B#, 16#0012B#), -- LATIN SMALL LETTER I WITH MACRON .. LATIN SMALL LETTER I WITH MACRON (16#0012D#, 16#0012D#), -- LATIN SMALL LETTER I WITH BREVE .. LATIN SMALL LETTER I WITH BREVE (16#0012F#, 16#0012F#), -- LATIN SMALL LETTER I WITH OGONEK .. LATIN SMALL LETTER I WITH OGONEK ! (16#00131#, 16#00131#), -- LATIN SMALL LETTER DOTLESS I .. LATIN SMALL LETTER DOTLESS I ! (16#00133#, 16#00133#), -- LATIN SMALL LIGATURE IJ .. LATIN SMALL LIGATURE IJ (16#00135#, 16#00135#), -- LATIN SMALL LETTER J WITH CIRCUMFLEX .. LATIN SMALL LETTER J WITH CIRCUMFLEX (16#00137#, 16#00137#), -- LATIN SMALL LETTER K WITH CEDILLA .. LATIN SMALL LETTER K WITH CEDILLA (16#0013A#, 16#0013A#), -- LATIN SMALL LETTER L WITH ACUTE .. LATIN SMALL LETTER L WITH ACUTE --- 4269,4275 ---- (16#0012B#, 16#0012B#), -- LATIN SMALL LETTER I WITH MACRON .. LATIN SMALL LETTER I WITH MACRON (16#0012D#, 16#0012D#), -- LATIN SMALL LETTER I WITH BREVE .. LATIN SMALL LETTER I WITH BREVE (16#0012F#, 16#0012F#), -- LATIN SMALL LETTER I WITH OGONEK .. LATIN SMALL LETTER I WITH OGONEK ! (16#00133#, 16#00133#), -- LATIN SMALL LETTER I J .. LATIN SMALL LETTER I J (16#00135#, 16#00135#), -- LATIN SMALL LETTER J WITH CIRCUMFLEX .. LATIN SMALL LETTER J WITH CIRCUMFLEX (16#00137#, 16#00137#), -- LATIN SMALL LETTER K WITH CEDILLA .. LATIN SMALL LETTER K WITH CEDILLA (16#0013A#, 16#0013A#), -- LATIN SMALL LETTER L WITH ACUTE .. LATIN SMALL LETTER L WITH ACUTE *************** package body System.UTF_32 is *** 4284,4290 **** (16#0014D#, 16#0014D#), -- LATIN SMALL LETTER O WITH MACRON .. LATIN SMALL LETTER O WITH MACRON (16#0014F#, 16#0014F#), -- LATIN SMALL LETTER O WITH BREVE .. LATIN SMALL LETTER O WITH BREVE (16#00151#, 16#00151#), -- LATIN SMALL LETTER O WITH DOUBLE ACUTE .. LATIN SMALL LETTER O WITH DOUBLE ACUTE ! (16#00153#, 16#00153#), -- LATIN SMALL LIGATURE OE .. LATIN SMALL LIGATURE OE (16#00155#, 16#00155#), -- LATIN SMALL LETTER R WITH ACUTE .. LATIN SMALL LETTER R WITH ACUTE (16#00157#, 16#00157#), -- LATIN SMALL LETTER R WITH CEDILLA .. LATIN SMALL LETTER R WITH CEDILLA (16#00159#, 16#00159#), -- LATIN SMALL LETTER R WITH CARON .. LATIN SMALL LETTER R WITH CARON --- 4284,4290 ---- (16#0014D#, 16#0014D#), -- LATIN SMALL LETTER O WITH MACRON .. LATIN SMALL LETTER O WITH MACRON (16#0014F#, 16#0014F#), -- LATIN SMALL LETTER O WITH BREVE .. LATIN SMALL LETTER O WITH BREVE (16#00151#, 16#00151#), -- LATIN SMALL LETTER O WITH DOUBLE ACUTE .. LATIN SMALL LETTER O WITH DOUBLE ACUTE ! (16#00153#, 16#00153#), -- LATIN SMALL LETTER O E .. LATIN SMALL LETTER O E (16#00155#, 16#00155#), -- LATIN SMALL LETTER R WITH ACUTE .. LATIN SMALL LETTER R WITH ACUTE (16#00157#, 16#00157#), -- LATIN SMALL LETTER R WITH CEDILLA .. LATIN SMALL LETTER R WITH CEDILLA (16#00159#, 16#00159#), -- LATIN SMALL LETTER R WITH CARON .. LATIN SMALL LETTER R WITH CARON *************** package body System.UTF_32 is *** 4306,4318 **** (16#0017A#, 16#0017A#), -- LATIN SMALL LETTER Z WITH ACUTE .. LATIN SMALL LETTER Z WITH ACUTE (16#0017C#, 16#0017C#), -- LATIN SMALL LETTER Z WITH DOT ABOVE .. LATIN SMALL LETTER Z WITH DOT ABOVE (16#0017E#, 16#0017E#), -- LATIN SMALL LETTER Z WITH CARON .. LATIN SMALL LETTER Z WITH CARON - (16#0017F#, 16#0017F#), -- LATIN SMALL LETTER LONG S .. LATIN SMALL LETTER LONG S (16#00183#, 16#00183#), -- LATIN SMALL LETTER B WITH TOPBAR .. LATIN SMALL LETTER B WITH TOPBAR (16#00185#, 16#00185#), -- LATIN SMALL LETTER TONE SIX .. LATIN SMALL LETTER TONE SIX (16#00188#, 16#00188#), -- LATIN SMALL LETTER C WITH HOOK .. LATIN SMALL LETTER C WITH HOOK (16#0018C#, 16#0018C#), -- LATIN SMALL LETTER D WITH TOPBAR .. LATIN SMALL LETTER D WITH TOPBAR (16#00192#, 16#00192#), -- LATIN SMALL LETTER F WITH HOOK .. LATIN SMALL LETTER F WITH HOOK - (16#00195#, 16#00195#), -- LATIN SMALL LETTER HV .. LATIN SMALL LETTER HV (16#00199#, 16#00199#), -- LATIN SMALL LETTER K WITH HOOK .. LATIN SMALL LETTER K WITH HOOK (16#0019E#, 16#0019E#), -- LATIN SMALL LETTER N WITH LONG RIGHT LEG .. LATIN SMALL LETTER N WITH LONG RIGHT LEG (16#001A1#, 16#001A1#), -- LATIN SMALL LETTER O WITH HORN .. LATIN SMALL LETTER O WITH HORN --- 4306,4316 ---- *************** package body System.UTF_32 is *** 4325,4336 **** (16#001B6#, 16#001B6#), -- LATIN SMALL LETTER Z WITH STROKE .. LATIN SMALL LETTER Z WITH STROKE (16#001B9#, 16#001B9#), -- LATIN SMALL LETTER EZH REVERSED .. LATIN SMALL LETTER EZH REVERSED (16#001BD#, 16#001BD#), -- LATIN SMALL LETTER TONE FIVE .. LATIN SMALL LETTER TONE FIVE - (16#001BF#, 16#001BF#), -- LATIN LETTER WYNN .. LATIN LETTER WYNN - (16#001C5#, 16#001C5#), -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON .. LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON (16#001C6#, 16#001C6#), -- LATIN SMALL LETTER DZ WITH CARON .. LATIN SMALL LETTER DZ WITH CARON - (16#001C8#, 16#001C8#), -- LATIN CAPITAL LETTER L WITH SMALL LETTER J .. LATIN CAPITAL LETTER L WITH SMALL LETTER J (16#001C9#, 16#001C9#), -- LATIN SMALL LETTER LJ .. LATIN SMALL LETTER LJ - (16#001CB#, 16#001CB#), -- LATIN CAPITAL LETTER N WITH SMALL LETTER J .. LATIN CAPITAL LETTER N WITH SMALL LETTER J (16#001CC#, 16#001CC#), -- LATIN SMALL LETTER NJ .. LATIN SMALL LETTER NJ (16#001CE#, 16#001CE#), -- LATIN SMALL LETTER A WITH CARON .. LATIN SMALL LETTER A WITH CARON (16#001D0#, 16#001D0#), -- LATIN SMALL LETTER I WITH CARON .. LATIN SMALL LETTER I WITH CARON --- 4323,4330 ---- *************** package body System.UTF_32 is *** 4340,4346 **** (16#001D8#, 16#001D8#), -- LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE .. LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE (16#001DA#, 16#001DA#), -- LATIN SMALL LETTER U WITH DIAERESIS AND CARON .. LATIN SMALL LETTER U WITH DIAERESIS AND CARON (16#001DC#, 16#001DC#), -- LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE .. LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE - (16#001DD#, 16#001DD#), -- LATIN SMALL LETTER TURNED E .. LATIN SMALL LETTER TURNED E (16#001DF#, 16#001DF#), -- LATIN SMALL LETTER A WITH DIAERESIS AND MACRON .. LATIN SMALL LETTER A WITH DIAERESIS AND MACRON (16#001E1#, 16#001E1#), -- LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON .. LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON (16#001E3#, 16#001E3#), -- LATIN SMALL LETTER AE WITH MACRON .. LATIN SMALL LETTER AE WITH MACRON --- 4334,4339 ---- *************** package body System.UTF_32 is *** 4350,4356 **** (16#001EB#, 16#001EB#), -- LATIN SMALL LETTER O WITH OGONEK .. LATIN SMALL LETTER O WITH OGONEK (16#001ED#, 16#001ED#), -- LATIN SMALL LETTER O WITH OGONEK AND MACRON .. LATIN SMALL LETTER O WITH OGONEK AND MACRON (16#001EF#, 16#001EF#), -- LATIN SMALL LETTER EZH WITH CARON .. LATIN SMALL LETTER EZH WITH CARON - (16#001F2#, 16#001F2#), -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z .. LATIN CAPITAL LETTER D WITH SMALL LETTER Z (16#001F3#, 16#001F3#), -- LATIN SMALL LETTER DZ .. LATIN SMALL LETTER DZ (16#001F5#, 16#001F5#), -- LATIN SMALL LETTER G WITH ACUTE .. LATIN SMALL LETTER G WITH ACUTE (16#001F9#, 16#001F9#), -- LATIN SMALL LETTER N WITH GRAVE .. LATIN SMALL LETTER N WITH GRAVE --- 4343,4348 ---- *************** package body System.UTF_32 is *** 4384,4391 **** (16#00233#, 16#00233#), -- LATIN SMALL LETTER Y WITH MACRON .. LATIN SMALL LETTER Y WITH MACRON (16#00253#, 16#00253#), -- LATIN SMALL LETTER B WITH HOOK .. LATIN SMALL LETTER B WITH HOOK (16#00254#, 16#00254#), -- LATIN SMALL LETTER OPEN O .. LATIN SMALL LETTER OPEN O ! (16#00256#, 16#00257#), -- LATIN SMALL LETTER D WITH TAIL .. LATIN SMALL LETTER D WITH HOOK ! (16#00259#, 16#00259#), -- LATIN SMALL LETTER SCHWA .. LATIN SMALL LETTER SCHWA (16#0025B#, 16#0025B#), -- LATIN SMALL LETTER OPEN E .. LATIN SMALL LETTER OPEN E (16#00260#, 16#00260#), -- LATIN SMALL LETTER G WITH HOOK .. LATIN SMALL LETTER G WITH HOOK (16#00263#, 16#00263#), -- LATIN SMALL LETTER GAMMA .. LATIN SMALL LETTER GAMMA --- 4376,4383 ---- (16#00233#, 16#00233#), -- LATIN SMALL LETTER Y WITH MACRON .. LATIN SMALL LETTER Y WITH MACRON (16#00253#, 16#00253#), -- LATIN SMALL LETTER B WITH HOOK .. LATIN SMALL LETTER B WITH HOOK (16#00254#, 16#00254#), -- LATIN SMALL LETTER OPEN O .. LATIN SMALL LETTER OPEN O ! (16#00257#, 16#00257#), -- LATIN SMALL LETTER D WITH HOOK .. LATIN SMALL LETTER D WITH HOOK ! (16#00258#, 16#00259#), -- LATIN SMALL LETTER REVERSED E .. LATIN SMALL LETTER SCHWA (16#0025B#, 16#0025B#), -- LATIN SMALL LETTER OPEN E .. LATIN SMALL LETTER OPEN E (16#00260#, 16#00260#), -- LATIN SMALL LETTER G WITH HOOK .. LATIN SMALL LETTER G WITH HOOK (16#00263#, 16#00263#), -- LATIN SMALL LETTER GAMMA .. LATIN SMALL LETTER GAMMA *************** package body System.UTF_32 is *** 4393,4400 **** (16#00269#, 16#00269#), -- LATIN SMALL LETTER IOTA .. LATIN SMALL LETTER IOTA (16#0026F#, 16#0026F#), -- LATIN SMALL LETTER TURNED M .. LATIN SMALL LETTER TURNED M (16#00272#, 16#00272#), -- LATIN SMALL LETTER N WITH LEFT HOOK .. LATIN SMALL LETTER N WITH LEFT HOOK - (16#00275#, 16#00275#), -- LATIN SMALL LETTER BARRED O .. LATIN SMALL LETTER BARRED O - (16#00280#, 16#00280#), -- LATIN LETTER SMALL CAPITAL R .. LATIN LETTER SMALL CAPITAL R (16#00283#, 16#00283#), -- LATIN SMALL LETTER ESH .. LATIN SMALL LETTER ESH (16#00288#, 16#00288#), -- LATIN SMALL LETTER T WITH RETROFLEX HOOK .. LATIN SMALL LETTER T WITH RETROFLEX HOOK (16#0028A#, 16#0028B#), -- LATIN SMALL LETTER UPSILON .. LATIN SMALL LETTER V WITH HOOK --- 4385,4390 ---- *************** package body System.UTF_32 is *** 4402,4416 **** (16#003AC#, 16#003AC#), -- GREEK SMALL LETTER ALPHA WITH TONOS .. GREEK SMALL LETTER ALPHA WITH TONOS (16#003AD#, 16#003AF#), -- GREEK SMALL LETTER EPSILON WITH TONOS .. GREEK SMALL LETTER IOTA WITH TONOS (16#003B1#, 16#003C1#), -- GREEK SMALL LETTER ALPHA .. GREEK SMALL LETTER RHO - (16#003C2#, 16#003C2#), -- GREEK SMALL LETTER FINAL SIGMA .. GREEK SMALL LETTER FINAL SIGMA (16#003C3#, 16#003CB#), -- GREEK SMALL LETTER SIGMA .. GREEK SMALL LETTER UPSILON WITH DIALYTIKA (16#003CC#, 16#003CC#), -- GREEK SMALL LETTER OMICRON WITH TONOS .. GREEK SMALL LETTER OMICRON WITH TONOS (16#003CD#, 16#003CE#), -- GREEK SMALL LETTER UPSILON WITH TONOS .. GREEK SMALL LETTER OMEGA WITH TONOS - (16#003D0#, 16#003D0#), -- GREEK BETA SYMBOL .. GREEK BETA SYMBOL - (16#003D1#, 16#003D1#), -- GREEK THETA SYMBOL .. GREEK THETA SYMBOL - (16#003D5#, 16#003D5#), -- GREEK PHI SYMBOL .. GREEK PHI SYMBOL - (16#003D6#, 16#003D6#), -- GREEK PI SYMBOL .. GREEK PI SYMBOL - (16#003D9#, 16#003D9#), -- GREEK SMALL LETTER ARCHAIC KOPPA .. GREEK SMALL LETTER ARCHAIC KOPPA (16#003DB#, 16#003DB#), -- GREEK SMALL LETTER STIGMA .. GREEK SMALL LETTER STIGMA (16#003DD#, 16#003DD#), -- GREEK SMALL LETTER DIGAMMA .. GREEK SMALL LETTER DIGAMMA (16#003DF#, 16#003DF#), -- GREEK SMALL LETTER KOPPA .. GREEK SMALL LETTER KOPPA --- 4392,4400 ---- *************** package body System.UTF_32 is *** 4422,4431 **** (16#003EB#, 16#003EB#), -- COPTIC SMALL LETTER GANGIA .. COPTIC SMALL LETTER GANGIA (16#003ED#, 16#003ED#), -- COPTIC SMALL LETTER SHIMA .. COPTIC SMALL LETTER SHIMA (16#003EF#, 16#003EF#), -- COPTIC SMALL LETTER DEI .. COPTIC SMALL LETTER DEI ! (16#003F0#, 16#003F0#), -- GREEK KAPPA SYMBOL .. GREEK KAPPA SYMBOL ! (16#003F1#, 16#003F1#), -- GREEK RHO SYMBOL .. GREEK RHO SYMBOL ! (16#003F2#, 16#003F2#), -- GREEK LUNATE SIGMA SYMBOL .. GREEK LUNATE SIGMA SYMBOL ! (16#003F5#, 16#003F5#), -- GREEK LUNATE EPSILON SYMBOL .. GREEK LUNATE EPSILON SYMBOL (16#00430#, 16#0044F#), -- CYRILLIC SMALL LETTER A .. CYRILLIC SMALL LETTER YA (16#00450#, 16#0045F#), -- CYRILLIC SMALL LETTER IE WITH GRAVE .. CYRILLIC SMALL LETTER DZHE (16#00461#, 16#00461#), -- CYRILLIC SMALL LETTER OMEGA .. CYRILLIC SMALL LETTER OMEGA --- 4406,4413 ---- (16#003EB#, 16#003EB#), -- COPTIC SMALL LETTER GANGIA .. COPTIC SMALL LETTER GANGIA (16#003ED#, 16#003ED#), -- COPTIC SMALL LETTER SHIMA .. COPTIC SMALL LETTER SHIMA (16#003EF#, 16#003EF#), -- COPTIC SMALL LETTER DEI .. COPTIC SMALL LETTER DEI ! (16#003F8#, 16#003F8#), -- GREEK SMALL LETTER SHO .. GREEK SMALL LETTER SHO ! (16#003FB#, 16#003FB#), -- GREEK SMALL LETTER SAN .. GREEK SMALL LETTER SAN (16#00430#, 16#0044F#), -- CYRILLIC SMALL LETTER A .. CYRILLIC SMALL LETTER YA (16#00450#, 16#0045F#), -- CYRILLIC SMALL LETTER IE WITH GRAVE .. CYRILLIC SMALL LETTER DZHE (16#00461#, 16#00461#), -- CYRILLIC SMALL LETTER OMEGA .. CYRILLIC SMALL LETTER OMEGA *************** package body System.UTF_32 is *** 4458,4464 **** (16#0049F#, 16#0049F#), -- CYRILLIC SMALL LETTER KA WITH STROKE .. CYRILLIC SMALL LETTER KA WITH STROKE (16#004A1#, 16#004A1#), -- CYRILLIC SMALL LETTER BASHKIR KA .. CYRILLIC SMALL LETTER BASHKIR KA (16#004A3#, 16#004A3#), -- CYRILLIC SMALL LETTER EN WITH DESCENDER .. CYRILLIC SMALL LETTER EN WITH DESCENDER ! (16#004A5#, 16#004A5#), -- CYRILLIC SMALL LIGATURE EN GHE .. CYRILLIC SMALL LIGATURE EN GHE (16#004A7#, 16#004A7#), -- CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK .. CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK (16#004A9#, 16#004A9#), -- CYRILLIC SMALL LETTER ABKHASIAN HA .. CYRILLIC SMALL LETTER ABKHASIAN HA (16#004AB#, 16#004AB#), -- CYRILLIC SMALL LETTER ES WITH DESCENDER .. CYRILLIC SMALL LETTER ES WITH DESCENDER --- 4440,4446 ---- (16#0049F#, 16#0049F#), -- CYRILLIC SMALL LETTER KA WITH STROKE .. CYRILLIC SMALL LETTER KA WITH STROKE (16#004A1#, 16#004A1#), -- CYRILLIC SMALL LETTER BASHKIR KA .. CYRILLIC SMALL LETTER BASHKIR KA (16#004A3#, 16#004A3#), -- CYRILLIC SMALL LETTER EN WITH DESCENDER .. CYRILLIC SMALL LETTER EN WITH DESCENDER ! (16#004A5#, 16#004A5#), -- CYRILLIC SMALL LETTER EN GE .. CYRILLIC SMALL LETTER EN GE (16#004A7#, 16#004A7#), -- CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK .. CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK (16#004A9#, 16#004A9#), -- CYRILLIC SMALL LETTER ABKHASIAN HA .. CYRILLIC SMALL LETTER ABKHASIAN HA (16#004AB#, 16#004AB#), -- CYRILLIC SMALL LETTER ES WITH DESCENDER .. CYRILLIC SMALL LETTER ES WITH DESCENDER *************** package body System.UTF_32 is *** 4466,4472 **** (16#004AF#, 16#004AF#), -- CYRILLIC SMALL LETTER STRAIGHT U .. CYRILLIC SMALL LETTER STRAIGHT U (16#004B1#, 16#004B1#), -- CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE .. CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE (16#004B3#, 16#004B3#), -- CYRILLIC SMALL LETTER HA WITH DESCENDER .. CYRILLIC SMALL LETTER HA WITH DESCENDER ! (16#004B5#, 16#004B5#), -- CYRILLIC SMALL LIGATURE TE TSE .. CYRILLIC SMALL LIGATURE TE TSE (16#004B7#, 16#004B7#), -- CYRILLIC SMALL LETTER CHE WITH DESCENDER .. CYRILLIC SMALL LETTER CHE WITH DESCENDER (16#004B9#, 16#004B9#), -- CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE .. CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE (16#004BB#, 16#004BB#), -- CYRILLIC SMALL LETTER SHHA .. CYRILLIC SMALL LETTER SHHA --- 4448,4454 ---- (16#004AF#, 16#004AF#), -- CYRILLIC SMALL LETTER STRAIGHT U .. CYRILLIC SMALL LETTER STRAIGHT U (16#004B1#, 16#004B1#), -- CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE .. CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE (16#004B3#, 16#004B3#), -- CYRILLIC SMALL LETTER HA WITH DESCENDER .. CYRILLIC SMALL LETTER HA WITH DESCENDER ! (16#004B5#, 16#004B5#), -- CYRILLIC SMALL LETTER TE TSE .. CYRILLIC SMALL LETTER TE TSE (16#004B7#, 16#004B7#), -- CYRILLIC SMALL LETTER CHE WITH DESCENDER .. CYRILLIC SMALL LETTER CHE WITH DESCENDER (16#004B9#, 16#004B9#), -- CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE .. CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE (16#004BB#, 16#004BB#), -- CYRILLIC SMALL LETTER SHHA .. CYRILLIC SMALL LETTER SHHA *************** package body System.UTF_32 is *** 4481,4487 **** (16#004CE#, 16#004CE#), -- CYRILLIC SMALL LETTER EM WITH TAIL .. CYRILLIC SMALL LETTER EM WITH TAIL (16#004D1#, 16#004D1#), -- CYRILLIC SMALL LETTER A WITH BREVE .. CYRILLIC SMALL LETTER A WITH BREVE (16#004D3#, 16#004D3#), -- CYRILLIC SMALL LETTER A WITH DIAERESIS .. CYRILLIC SMALL LETTER A WITH DIAERESIS - (16#004D5#, 16#004D5#), -- CYRILLIC SMALL LIGATURE A IE .. CYRILLIC SMALL LIGATURE A IE (16#004D7#, 16#004D7#), -- CYRILLIC SMALL LETTER IE WITH BREVE .. CYRILLIC SMALL LETTER IE WITH BREVE (16#004D9#, 16#004D9#), -- CYRILLIC SMALL LETTER SCHWA .. CYRILLIC SMALL LETTER SCHWA (16#004DB#, 16#004DB#), -- CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS .. CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS --- 4463,4468 ---- *************** package body System.UTF_32 is *** 4508,4513 **** --- 4489,4495 ---- (16#0050D#, 16#0050D#), -- CYRILLIC SMALL LETTER KOMI SJE .. CYRILLIC SMALL LETTER KOMI SJE (16#0050F#, 16#0050F#), -- CYRILLIC SMALL LETTER KOMI TJE .. CYRILLIC SMALL LETTER KOMI TJE (16#00561#, 16#00586#), -- ARMENIAN SMALL LETTER AYB .. ARMENIAN SMALL LETTER FEH + (16#010D0#, 16#010F5#), -- GEORGIAN SMALL LETTER AN .. GEORGIAN SMALL LETTER HOE (16#01E01#, 16#01E01#), -- LATIN SMALL LETTER A WITH RING BELOW .. LATIN SMALL LETTER A WITH RING BELOW (16#01E03#, 16#01E03#), -- LATIN SMALL LETTER B WITH DOT ABOVE .. LATIN SMALL LETTER B WITH DOT ABOVE (16#01E05#, 16#01E05#), -- LATIN SMALL LETTER B WITH DOT BELOW .. LATIN SMALL LETTER B WITH DOT BELOW *************** package body System.UTF_32 is *** 4583,4589 **** (16#01E91#, 16#01E91#), -- LATIN SMALL LETTER Z WITH CIRCUMFLEX .. LATIN SMALL LETTER Z WITH CIRCUMFLEX (16#01E93#, 16#01E93#), -- LATIN SMALL LETTER Z WITH DOT BELOW .. LATIN SMALL LETTER Z WITH DOT BELOW (16#01E95#, 16#01E95#), -- LATIN SMALL LETTER Z WITH LINE BELOW .. LATIN SMALL LETTER Z WITH LINE BELOW - (16#01E9B#, 16#01E9B#), -- LATIN SMALL LETTER LONG S WITH DOT ABOVE .. LATIN SMALL LETTER LONG S WITH DOT ABOVE (16#01EA1#, 16#01EA1#), -- LATIN SMALL LETTER A WITH DOT BELOW .. LATIN SMALL LETTER A WITH DOT BELOW (16#01EA3#, 16#01EA3#), -- LATIN SMALL LETTER A WITH HOOK ABOVE .. LATIN SMALL LETTER A WITH HOOK ABOVE (16#01EA5#, 16#01EA5#), -- LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE .. LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE --- 4565,4570 ---- *************** package body System.UTF_32 is *** 4645,4668 **** (16#01F78#, 16#01F79#), -- GREEK SMALL LETTER OMICRON WITH VARIA .. GREEK SMALL LETTER OMICRON WITH OXIA (16#01F7A#, 16#01F7B#), -- GREEK SMALL LETTER UPSILON WITH VARIA .. GREEK SMALL LETTER UPSILON WITH OXIA (16#01F7C#, 16#01F7D#), -- GREEK SMALL LETTER OMEGA WITH VARIA .. GREEK SMALL LETTER OMEGA WITH OXIA - (16#01F80#, 16#01F87#), -- GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI .. GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI - (16#01F90#, 16#01F97#), -- GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI .. GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI - (16#01FA0#, 16#01FA7#), -- GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI .. GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI (16#01FB0#, 16#01FB1#), -- GREEK SMALL LETTER ALPHA WITH VRACHY .. GREEK SMALL LETTER ALPHA WITH MACRON - (16#01FB3#, 16#01FB3#), -- GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI .. GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI - (16#01FBE#, 16#01FBE#), -- GREEK PROSGEGRAMMENI .. GREEK PROSGEGRAMMENI - (16#01FC3#, 16#01FC3#), -- GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI .. GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI (16#01FD0#, 16#01FD1#), -- GREEK SMALL LETTER IOTA WITH VRACHY .. GREEK SMALL LETTER IOTA WITH MACRON (16#01FE0#, 16#01FE1#), -- GREEK SMALL LETTER UPSILON WITH VRACHY .. GREEK SMALL LETTER UPSILON WITH MACRON (16#01FE5#, 16#01FE5#), -- GREEK SMALL LETTER RHO WITH DASIA .. GREEK SMALL LETTER RHO WITH DASIA ! (16#01FF3#, 16#01FF3#), -- GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI .. GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI (16#0FF41#, 16#0FF5A#), -- FULLWIDTH LATIN SMALL LETTER A .. FULLWIDTH LATIN SMALL LETTER Z ! (16#10428#, 16#1044D#)); -- DESERET SMALL LETTER LONG I .. DESERET SMALL LETTER ENG ! Upper_Case_Adjust : constant array (Lower_Case_Letters'Range) of UTF_32'Base := ( -32, -- LATIN SMALL LETTER A .. LATIN SMALL LETTER Z - 743, -- MICRO SIGN .. MICRO SIGN -32, -- LATIN SMALL LETTER A WITH GRAVE .. LATIN SMALL LETTER O WITH DIAERESIS -32, -- LATIN SMALL LETTER O WITH STROKE .. LATIN SMALL LETTER THORN 121, -- LATIN SMALL LETTER Y WITH DIAERESIS .. LATIN SMALL LETTER Y WITH DIAERESIS --- 4626,4643 ---- (16#01F78#, 16#01F79#), -- GREEK SMALL LETTER OMICRON WITH VARIA .. GREEK SMALL LETTER OMICRON WITH OXIA (16#01F7A#, 16#01F7B#), -- GREEK SMALL LETTER UPSILON WITH VARIA .. GREEK SMALL LETTER UPSILON WITH OXIA (16#01F7C#, 16#01F7D#), -- GREEK SMALL LETTER OMEGA WITH VARIA .. GREEK SMALL LETTER OMEGA WITH OXIA (16#01FB0#, 16#01FB1#), -- GREEK SMALL LETTER ALPHA WITH VRACHY .. GREEK SMALL LETTER ALPHA WITH MACRON (16#01FD0#, 16#01FD1#), -- GREEK SMALL LETTER IOTA WITH VRACHY .. GREEK SMALL LETTER IOTA WITH MACRON (16#01FE0#, 16#01FE1#), -- GREEK SMALL LETTER UPSILON WITH VRACHY .. GREEK SMALL LETTER UPSILON WITH MACRON (16#01FE5#, 16#01FE5#), -- GREEK SMALL LETTER RHO WITH DASIA .. GREEK SMALL LETTER RHO WITH DASIA ! (16#024D0#, 16#024E9#), -- CIRCLED LATIN SMALL LETTER A .. CIRCLED LATIN SMALL LETTER Z (16#0FF41#, 16#0FF5A#), -- FULLWIDTH LATIN SMALL LETTER A .. FULLWIDTH LATIN SMALL LETTER Z ! (16#10428#, 16#1044F#), -- DESERET SMALL LETTER LONG I .. DESERET SMALL LETTER EW ! (16#E0061#, 16#E007A#)); -- TAG LATIN SMALL LETTER A .. TAG LATIN SMALL LETTER Z ! Lower_Case_Adjust : constant array (Lower_Case_Letters'Range) of UTF_32'Base := ( -32, -- LATIN SMALL LETTER A .. LATIN SMALL LETTER Z -32, -- LATIN SMALL LETTER A WITH GRAVE .. LATIN SMALL LETTER O WITH DIAERESIS -32, -- LATIN SMALL LETTER O WITH STROKE .. LATIN SMALL LETTER THORN 121, -- LATIN SMALL LETTER Y WITH DIAERESIS .. LATIN SMALL LETTER Y WITH DIAERESIS *************** package body System.UTF_32 is *** 4690,4697 **** -1, -- LATIN SMALL LETTER I WITH MACRON .. LATIN SMALL LETTER I WITH MACRON -1, -- LATIN SMALL LETTER I WITH BREVE .. LATIN SMALL LETTER I WITH BREVE -1, -- LATIN SMALL LETTER I WITH OGONEK .. LATIN SMALL LETTER I WITH OGONEK ! -232, -- LATIN SMALL LETTER DOTLESS I .. LATIN SMALL LETTER DOTLESS I ! -1, -- LATIN SMALL LIGATURE IJ .. LATIN SMALL LIGATURE IJ -1, -- LATIN SMALL LETTER J WITH CIRCUMFLEX .. LATIN SMALL LETTER J WITH CIRCUMFLEX -1, -- LATIN SMALL LETTER K WITH CEDILLA .. LATIN SMALL LETTER K WITH CEDILLA -1, -- LATIN SMALL LETTER L WITH ACUTE .. LATIN SMALL LETTER L WITH ACUTE --- 4665,4671 ---- -1, -- LATIN SMALL LETTER I WITH MACRON .. LATIN SMALL LETTER I WITH MACRON -1, -- LATIN SMALL LETTER I WITH BREVE .. LATIN SMALL LETTER I WITH BREVE -1, -- LATIN SMALL LETTER I WITH OGONEK .. LATIN SMALL LETTER I WITH OGONEK ! -1, -- LATIN SMALL LETTER I J .. LATIN SMALL LETTER I J -1, -- LATIN SMALL LETTER J WITH CIRCUMFLEX .. LATIN SMALL LETTER J WITH CIRCUMFLEX -1, -- LATIN SMALL LETTER K WITH CEDILLA .. LATIN SMALL LETTER K WITH CEDILLA -1, -- LATIN SMALL LETTER L WITH ACUTE .. LATIN SMALL LETTER L WITH ACUTE *************** package body System.UTF_32 is *** 4706,4712 **** -1, -- LATIN SMALL LETTER O WITH MACRON .. LATIN SMALL LETTER O WITH MACRON -1, -- LATIN SMALL LETTER O WITH BREVE .. LATIN SMALL LETTER O WITH BREVE -1, -- LATIN SMALL LETTER O WITH DOUBLE ACUTE .. LATIN SMALL LETTER O WITH DOUBLE ACUTE ! -1, -- LATIN SMALL LIGATURE OE .. LATIN SMALL LIGATURE OE -1, -- LATIN SMALL LETTER R WITH ACUTE .. LATIN SMALL LETTER R WITH ACUTE -1, -- LATIN SMALL LETTER R WITH CEDILLA .. LATIN SMALL LETTER R WITH CEDILLA -1, -- LATIN SMALL LETTER R WITH CARON .. LATIN SMALL LETTER R WITH CARON --- 4680,4686 ---- -1, -- LATIN SMALL LETTER O WITH MACRON .. LATIN SMALL LETTER O WITH MACRON -1, -- LATIN SMALL LETTER O WITH BREVE .. LATIN SMALL LETTER O WITH BREVE -1, -- LATIN SMALL LETTER O WITH DOUBLE ACUTE .. LATIN SMALL LETTER O WITH DOUBLE ACUTE ! -1, -- LATIN SMALL LETTER O E .. LATIN SMALL LETTER O E -1, -- LATIN SMALL LETTER R WITH ACUTE .. LATIN SMALL LETTER R WITH ACUTE -1, -- LATIN SMALL LETTER R WITH CEDILLA .. LATIN SMALL LETTER R WITH CEDILLA -1, -- LATIN SMALL LETTER R WITH CARON .. LATIN SMALL LETTER R WITH CARON *************** package body System.UTF_32 is *** 4728,4740 **** -1, -- LATIN SMALL LETTER Z WITH ACUTE .. LATIN SMALL LETTER Z WITH ACUTE -1, -- LATIN SMALL LETTER Z WITH DOT ABOVE .. LATIN SMALL LETTER Z WITH DOT ABOVE -1, -- LATIN SMALL LETTER Z WITH CARON .. LATIN SMALL LETTER Z WITH CARON - -300, -- LATIN SMALL LETTER LONG S .. LATIN SMALL LETTER LONG S -1, -- LATIN SMALL LETTER B WITH TOPBAR .. LATIN SMALL LETTER B WITH TOPBAR -1, -- LATIN SMALL LETTER TONE SIX .. LATIN SMALL LETTER TONE SIX -1, -- LATIN SMALL LETTER C WITH HOOK .. LATIN SMALL LETTER C WITH HOOK -1, -- LATIN SMALL LETTER D WITH TOPBAR .. LATIN SMALL LETTER D WITH TOPBAR -1, -- LATIN SMALL LETTER F WITH HOOK .. LATIN SMALL LETTER F WITH HOOK - 97, -- LATIN SMALL LETTER HV .. LATIN SMALL LETTER HV -1, -- LATIN SMALL LETTER K WITH HOOK .. LATIN SMALL LETTER K WITH HOOK 130, -- LATIN SMALL LETTER N WITH LONG RIGHT LEG .. LATIN SMALL LETTER N WITH LONG RIGHT LEG -1, -- LATIN SMALL LETTER O WITH HORN .. LATIN SMALL LETTER O WITH HORN --- 4702,4712 ---- *************** package body System.UTF_32 is *** 4747,4758 **** -1, -- LATIN SMALL LETTER Z WITH STROKE .. LATIN SMALL LETTER Z WITH STROKE -1, -- LATIN SMALL LETTER EZH REVERSED .. LATIN SMALL LETTER EZH REVERSED -1, -- LATIN SMALL LETTER TONE FIVE .. LATIN SMALL LETTER TONE FIVE - 56, -- LATIN LETTER WYNN .. LATIN LETTER WYNN - -1, -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON .. LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON -2, -- LATIN SMALL LETTER DZ WITH CARON .. LATIN SMALL LETTER DZ WITH CARON - -1, -- LATIN CAPITAL LETTER L WITH SMALL LETTER J .. LATIN CAPITAL LETTER L WITH SMALL LETTER J -2, -- LATIN SMALL LETTER LJ .. LATIN SMALL LETTER LJ - -1, -- LATIN CAPITAL LETTER N WITH SMALL LETTER J .. LATIN CAPITAL LETTER N WITH SMALL LETTER J -2, -- LATIN SMALL LETTER NJ .. LATIN SMALL LETTER NJ -1, -- LATIN SMALL LETTER A WITH CARON .. LATIN SMALL LETTER A WITH CARON -1, -- LATIN SMALL LETTER I WITH CARON .. LATIN SMALL LETTER I WITH CARON --- 4719,4726 ---- *************** package body System.UTF_32 is *** 4762,4768 **** -1, -- LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE .. LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE -1, -- LATIN SMALL LETTER U WITH DIAERESIS AND CARON .. LATIN SMALL LETTER U WITH DIAERESIS AND CARON -1, -- LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE .. LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE - -79, -- LATIN SMALL LETTER TURNED E .. LATIN SMALL LETTER TURNED E -1, -- LATIN SMALL LETTER A WITH DIAERESIS AND MACRON .. LATIN SMALL LETTER A WITH DIAERESIS AND MACRON -1, -- LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON .. LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON -1, -- LATIN SMALL LETTER AE WITH MACRON .. LATIN SMALL LETTER AE WITH MACRON --- 4730,4735 ---- *************** package body System.UTF_32 is *** 4772,4778 **** -1, -- LATIN SMALL LETTER O WITH OGONEK .. LATIN SMALL LETTER O WITH OGONEK -1, -- LATIN SMALL LETTER O WITH OGONEK AND MACRON .. LATIN SMALL LETTER O WITH OGONEK AND MACRON -1, -- LATIN SMALL LETTER EZH WITH CARON .. LATIN SMALL LETTER EZH WITH CARON - -1, -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z .. LATIN CAPITAL LETTER D WITH SMALL LETTER Z -2, -- LATIN SMALL LETTER DZ .. LATIN SMALL LETTER DZ -1, -- LATIN SMALL LETTER G WITH ACUTE .. LATIN SMALL LETTER G WITH ACUTE -1, -- LATIN SMALL LETTER N WITH GRAVE .. LATIN SMALL LETTER N WITH GRAVE --- 4739,4744 ---- *************** package body System.UTF_32 is *** 4806,4813 **** -1, -- LATIN SMALL LETTER Y WITH MACRON .. LATIN SMALL LETTER Y WITH MACRON -210, -- LATIN SMALL LETTER B WITH HOOK .. LATIN SMALL LETTER B WITH HOOK -206, -- LATIN SMALL LETTER OPEN O .. LATIN SMALL LETTER OPEN O ! -205, -- LATIN SMALL LETTER D WITH TAIL .. LATIN SMALL LETTER D WITH HOOK ! -202, -- LATIN SMALL LETTER SCHWA .. LATIN SMALL LETTER SCHWA -203, -- LATIN SMALL LETTER OPEN E .. LATIN SMALL LETTER OPEN E -205, -- LATIN SMALL LETTER G WITH HOOK .. LATIN SMALL LETTER G WITH HOOK -207, -- LATIN SMALL LETTER GAMMA .. LATIN SMALL LETTER GAMMA --- 4772,4779 ---- -1, -- LATIN SMALL LETTER Y WITH MACRON .. LATIN SMALL LETTER Y WITH MACRON -210, -- LATIN SMALL LETTER B WITH HOOK .. LATIN SMALL LETTER B WITH HOOK -206, -- LATIN SMALL LETTER OPEN O .. LATIN SMALL LETTER OPEN O ! -205, -- LATIN SMALL LETTER D WITH HOOK .. LATIN SMALL LETTER D WITH HOOK ! -202, -- LATIN SMALL LETTER REVERSED E .. LATIN SMALL LETTER SCHWA -203, -- LATIN SMALL LETTER OPEN E .. LATIN SMALL LETTER OPEN E -205, -- LATIN SMALL LETTER G WITH HOOK .. LATIN SMALL LETTER G WITH HOOK -207, -- LATIN SMALL LETTER GAMMA .. LATIN SMALL LETTER GAMMA *************** package body System.UTF_32 is *** 4815,4822 **** -211, -- LATIN SMALL LETTER IOTA .. LATIN SMALL LETTER IOTA -211, -- LATIN SMALL LETTER TURNED M .. LATIN SMALL LETTER TURNED M -213, -- LATIN SMALL LETTER N WITH LEFT HOOK .. LATIN SMALL LETTER N WITH LEFT HOOK - -214, -- LATIN SMALL LETTER BARRED O .. LATIN SMALL LETTER BARRED O - -218, -- LATIN LETTER SMALL CAPITAL R .. LATIN LETTER SMALL CAPITAL R -218, -- LATIN SMALL LETTER ESH .. LATIN SMALL LETTER ESH -218, -- LATIN SMALL LETTER T WITH RETROFLEX HOOK .. LATIN SMALL LETTER T WITH RETROFLEX HOOK -217, -- LATIN SMALL LETTER UPSILON .. LATIN SMALL LETTER V WITH HOOK --- 4781,4786 ---- *************** package body System.UTF_32 is *** 4824,4838 **** -38, -- GREEK SMALL LETTER ALPHA WITH TONOS .. GREEK SMALL LETTER ALPHA WITH TONOS -37, -- GREEK SMALL LETTER EPSILON WITH TONOS .. GREEK SMALL LETTER IOTA WITH TONOS -32, -- GREEK SMALL LETTER ALPHA .. GREEK SMALL LETTER RHO - -31, -- GREEK SMALL LETTER FINAL SIGMA .. GREEK SMALL LETTER FINAL SIGMA -32, -- GREEK SMALL LETTER SIGMA .. GREEK SMALL LETTER UPSILON WITH DIALYTIKA -64, -- GREEK SMALL LETTER OMICRON WITH TONOS .. GREEK SMALL LETTER OMICRON WITH TONOS -63, -- GREEK SMALL LETTER UPSILON WITH TONOS .. GREEK SMALL LETTER OMEGA WITH TONOS - -62, -- GREEK BETA SYMBOL .. GREEK BETA SYMBOL - -57, -- GREEK THETA SYMBOL .. GREEK THETA SYMBOL - -47, -- GREEK PHI SYMBOL .. GREEK PHI SYMBOL - -54, -- GREEK PI SYMBOL .. GREEK PI SYMBOL - -1, -- GREEK SMALL LETTER ARCHAIC KOPPA .. GREEK SMALL LETTER ARCHAIC KOPPA -1, -- GREEK SMALL LETTER STIGMA .. GREEK SMALL LETTER STIGMA -1, -- GREEK SMALL LETTER DIGAMMA .. GREEK SMALL LETTER DIGAMMA -1, -- GREEK SMALL LETTER KOPPA .. GREEK SMALL LETTER KOPPA --- 4788,4796 ---- *************** package body System.UTF_32 is *** 4844,4853 **** -1, -- COPTIC SMALL LETTER GANGIA .. COPTIC SMALL LETTER GANGIA -1, -- COPTIC SMALL LETTER SHIMA .. COPTIC SMALL LETTER SHIMA -1, -- COPTIC SMALL LETTER DEI .. COPTIC SMALL LETTER DEI ! -86, -- GREEK KAPPA SYMBOL .. GREEK KAPPA SYMBOL ! -80, -- GREEK RHO SYMBOL .. GREEK RHO SYMBOL ! -79, -- GREEK LUNATE SIGMA SYMBOL .. GREEK LUNATE SIGMA SYMBOL ! -96, -- GREEK LUNATE EPSILON SYMBOL .. GREEK LUNATE EPSILON SYMBOL -32, -- CYRILLIC SMALL LETTER A .. CYRILLIC SMALL LETTER YA -80, -- CYRILLIC SMALL LETTER IE WITH GRAVE .. CYRILLIC SMALL LETTER DZHE -1, -- CYRILLIC SMALL LETTER OMEGA .. CYRILLIC SMALL LETTER OMEGA --- 4802,4809 ---- -1, -- COPTIC SMALL LETTER GANGIA .. COPTIC SMALL LETTER GANGIA -1, -- COPTIC SMALL LETTER SHIMA .. COPTIC SMALL LETTER SHIMA -1, -- COPTIC SMALL LETTER DEI .. COPTIC SMALL LETTER DEI ! -1, -- GREEK SMALL LETTER SHO .. GREEK SMALL LETTER SHO ! -1, -- GREEK SMALL LETTER SAN .. GREEK SMALL LETTER SAN -32, -- CYRILLIC SMALL LETTER A .. CYRILLIC SMALL LETTER YA -80, -- CYRILLIC SMALL LETTER IE WITH GRAVE .. CYRILLIC SMALL LETTER DZHE -1, -- CYRILLIC SMALL LETTER OMEGA .. CYRILLIC SMALL LETTER OMEGA *************** package body System.UTF_32 is *** 4880,4886 **** -1, -- CYRILLIC SMALL LETTER KA WITH STROKE .. CYRILLIC SMALL LETTER KA WITH STROKE -1, -- CYRILLIC SMALL LETTER BASHKIR KA .. CYRILLIC SMALL LETTER BASHKIR KA -1, -- CYRILLIC SMALL LETTER EN WITH DESCENDER .. CYRILLIC SMALL LETTER EN WITH DESCENDER ! -1, -- CYRILLIC SMALL LIGATURE EN GHE .. CYRILLIC SMALL LIGATURE EN GHE -1, -- CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK .. CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK -1, -- CYRILLIC SMALL LETTER ABKHASIAN HA .. CYRILLIC SMALL LETTER ABKHASIAN HA -1, -- CYRILLIC SMALL LETTER ES WITH DESCENDER .. CYRILLIC SMALL LETTER ES WITH DESCENDER --- 4836,4842 ---- -1, -- CYRILLIC SMALL LETTER KA WITH STROKE .. CYRILLIC SMALL LETTER KA WITH STROKE -1, -- CYRILLIC SMALL LETTER BASHKIR KA .. CYRILLIC SMALL LETTER BASHKIR KA -1, -- CYRILLIC SMALL LETTER EN WITH DESCENDER .. CYRILLIC SMALL LETTER EN WITH DESCENDER ! -1, -- CYRILLIC SMALL LETTER EN GE .. CYRILLIC SMALL LETTER EN GE -1, -- CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK .. CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK -1, -- CYRILLIC SMALL LETTER ABKHASIAN HA .. CYRILLIC SMALL LETTER ABKHASIAN HA -1, -- CYRILLIC SMALL LETTER ES WITH DESCENDER .. CYRILLIC SMALL LETTER ES WITH DESCENDER *************** package body System.UTF_32 is *** 4888,4894 **** -1, -- CYRILLIC SMALL LETTER STRAIGHT U .. CYRILLIC SMALL LETTER STRAIGHT U -1, -- CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE .. CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE -1, -- CYRILLIC SMALL LETTER HA WITH DESCENDER .. CYRILLIC SMALL LETTER HA WITH DESCENDER ! -1, -- CYRILLIC SMALL LIGATURE TE TSE .. CYRILLIC SMALL LIGATURE TE TSE -1, -- CYRILLIC SMALL LETTER CHE WITH DESCENDER .. CYRILLIC SMALL LETTER CHE WITH DESCENDER -1, -- CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE .. CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE -1, -- CYRILLIC SMALL LETTER SHHA .. CYRILLIC SMALL LETTER SHHA --- 4844,4850 ---- -1, -- CYRILLIC SMALL LETTER STRAIGHT U .. CYRILLIC SMALL LETTER STRAIGHT U -1, -- CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE .. CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE -1, -- CYRILLIC SMALL LETTER HA WITH DESCENDER .. CYRILLIC SMALL LETTER HA WITH DESCENDER ! -1, -- CYRILLIC SMALL LETTER TE TSE .. CYRILLIC SMALL LETTER TE TSE -1, -- CYRILLIC SMALL LETTER CHE WITH DESCENDER .. CYRILLIC SMALL LETTER CHE WITH DESCENDER -1, -- CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE .. CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE -1, -- CYRILLIC SMALL LETTER SHHA .. CYRILLIC SMALL LETTER SHHA *************** package body System.UTF_32 is *** 4903,4909 **** -1, -- CYRILLIC SMALL LETTER EM WITH TAIL .. CYRILLIC SMALL LETTER EM WITH TAIL -1, -- CYRILLIC SMALL LETTER A WITH BREVE .. CYRILLIC SMALL LETTER A WITH BREVE -1, -- CYRILLIC SMALL LETTER A WITH DIAERESIS .. CYRILLIC SMALL LETTER A WITH DIAERESIS - -1, -- CYRILLIC SMALL LIGATURE A IE .. CYRILLIC SMALL LIGATURE A IE -1, -- CYRILLIC SMALL LETTER IE WITH BREVE .. CYRILLIC SMALL LETTER IE WITH BREVE -1, -- CYRILLIC SMALL LETTER SCHWA .. CYRILLIC SMALL LETTER SCHWA -1, -- CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS .. CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS --- 4859,4864 ---- *************** package body System.UTF_32 is *** 4930,4935 **** --- 4885,4891 ---- -1, -- CYRILLIC SMALL LETTER KOMI SJE .. CYRILLIC SMALL LETTER KOMI SJE -1, -- CYRILLIC SMALL LETTER KOMI TJE .. CYRILLIC SMALL LETTER KOMI TJE -48, -- ARMENIAN SMALL LETTER AYB .. ARMENIAN SMALL LETTER FEH + -48, -- GEORGIAN SMALL LETTER AN .. GEORGIAN SMALL LETTER HOE -1, -- LATIN SMALL LETTER A WITH RING BELOW .. LATIN SMALL LETTER A WITH RING BELOW -1, -- LATIN SMALL LETTER B WITH DOT ABOVE .. LATIN SMALL LETTER B WITH DOT ABOVE -1, -- LATIN SMALL LETTER B WITH DOT BELOW .. LATIN SMALL LETTER B WITH DOT BELOW *************** package body System.UTF_32 is *** 5005,5011 **** -1, -- LATIN SMALL LETTER Z WITH CIRCUMFLEX .. LATIN SMALL LETTER Z WITH CIRCUMFLEX -1, -- LATIN SMALL LETTER Z WITH DOT BELOW .. LATIN SMALL LETTER Z WITH DOT BELOW -1, -- LATIN SMALL LETTER Z WITH LINE BELOW .. LATIN SMALL LETTER Z WITH LINE BELOW - -59, -- LATIN SMALL LETTER LONG S WITH DOT ABOVE .. LATIN SMALL LETTER LONG S WITH DOT ABOVE -1, -- LATIN SMALL LETTER A WITH DOT BELOW .. LATIN SMALL LETTER A WITH DOT BELOW -1, -- LATIN SMALL LETTER A WITH HOOK ABOVE .. LATIN SMALL LETTER A WITH HOOK ABOVE -1, -- LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE .. LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE --- 4961,4966 ---- *************** package body System.UTF_32 is *** 5067,5086 **** 128, -- GREEK SMALL LETTER OMICRON WITH VARIA .. GREEK SMALL LETTER OMICRON WITH OXIA 112, -- GREEK SMALL LETTER UPSILON WITH VARIA .. GREEK SMALL LETTER UPSILON WITH OXIA 126, -- GREEK SMALL LETTER OMEGA WITH VARIA .. GREEK SMALL LETTER OMEGA WITH OXIA - 8, -- GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI .. GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI - 8, -- GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI .. GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI - 8, -- GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI .. GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI 8, -- GREEK SMALL LETTER ALPHA WITH VRACHY .. GREEK SMALL LETTER ALPHA WITH MACRON - 9, -- GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI .. GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI - -7205, -- GREEK PROSGEGRAMMENI .. GREEK PROSGEGRAMMENI - 9, -- GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI .. GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI 8, -- GREEK SMALL LETTER IOTA WITH VRACHY .. GREEK SMALL LETTER IOTA WITH MACRON 8, -- GREEK SMALL LETTER UPSILON WITH VRACHY .. GREEK SMALL LETTER UPSILON WITH MACRON 7, -- GREEK SMALL LETTER RHO WITH DASIA .. GREEK SMALL LETTER RHO WITH DASIA ! 9, -- GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI .. GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI -32, -- FULLWIDTH LATIN SMALL LETTER A .. FULLWIDTH LATIN SMALL LETTER Z ! -40); -- DESERET SMALL LETTER LONG I .. DESERET SMALL LETTER ENG ----------------------- -- Local Subprograms -- --- 5022,6107 ---- 128, -- GREEK SMALL LETTER OMICRON WITH VARIA .. GREEK SMALL LETTER OMICRON WITH OXIA 112, -- GREEK SMALL LETTER UPSILON WITH VARIA .. GREEK SMALL LETTER UPSILON WITH OXIA 126, -- GREEK SMALL LETTER OMEGA WITH VARIA .. GREEK SMALL LETTER OMEGA WITH OXIA 8, -- GREEK SMALL LETTER ALPHA WITH VRACHY .. GREEK SMALL LETTER ALPHA WITH MACRON 8, -- GREEK SMALL LETTER IOTA WITH VRACHY .. GREEK SMALL LETTER IOTA WITH MACRON 8, -- GREEK SMALL LETTER UPSILON WITH VRACHY .. GREEK SMALL LETTER UPSILON WITH MACRON 7, -- GREEK SMALL LETTER RHO WITH DASIA .. GREEK SMALL LETTER RHO WITH DASIA ! -26, -- CIRCLED LATIN SMALL LETTER A .. CIRCLED LATIN SMALL LETTER Z -32, -- FULLWIDTH LATIN SMALL LETTER A .. FULLWIDTH LATIN SMALL LETTER Z ! -40, -- DESERET SMALL LETTER LONG I .. DESERET SMALL LETTER EW ! -32); -- TAG LATIN SMALL LETTER A .. TAG LATIN SMALL LETTER Z ! ! -- The following is a list of the 10646 names for SMALL LETTER entries ! -- that have no matching CAPITAL LETTER entry and are thus not folded ! ! -- LATIN SMALL LETTER SHARP S ! -- LATIN SMALL LETTER DOTLESS I ! -- LATIN SMALL LETTER KRA ! -- LATIN SMALL LETTER N PRECEDED BY APOSTROPHE ! -- LATIN SMALL LETTER LONG S ! -- LATIN SMALL LETTER B WITH STROKE ! -- LATIN SMALL LETTER TURNED DELTA ! -- LATIN SMALL LETTER HV ! -- LATIN SMALL LETTER L WITH BAR ! -- LATIN SMALL LETTER LAMBDA WITH STROKE ! -- LATIN SMALL LETTER T WITH PALATAL HOOK ! -- LATIN SMALL LETTER EZH WITH TAIL ! -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON ! -- LATIN CAPITAL LETTER L WITH SMALL LETTER J ! -- LATIN CAPITAL LETTER N WITH SMALL LETTER J ! -- LATIN SMALL LETTER TURNED E ! -- LATIN SMALL LETTER J WITH CARON ! -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z ! -- LATIN SMALL LETTER D WITH CURL ! -- LATIN SMALL LETTER L WITH CURL ! -- LATIN SMALL LETTER N WITH CURL ! -- LATIN SMALL LETTER T WITH CURL ! -- LATIN SMALL LETTER TURNED A ! -- LATIN SMALL LETTER ALPHA ! -- LATIN SMALL LETTER TURNED ALPHA ! -- LATIN SMALL LETTER C WITH CURL ! -- LATIN SMALL LETTER D WITH TAIL ! -- LATIN SMALL LETTER SCHWA WITH HOOK ! -- LATIN SMALL LETTER REVERSED OPEN E ! -- LATIN SMALL LETTER REVERSED OPEN E WITH HOOK ! -- LATIN SMALL LETTER CLOSED REVERSED OPEN E ! -- LATIN SMALL LETTER DOTLESS J WITH STROKE ! -- LATIN SMALL LETTER SCRIPT G ! -- LATIN SMALL LETTER RAMS HORN ! -- LATIN SMALL LETTER TURNED H ! -- LATIN SMALL LETTER H WITH HOOK ! -- LATIN SMALL LETTER HENG WITH HOOK ! -- LATIN SMALL LETTER L WITH MIDDLE TILDE ! -- LATIN SMALL LETTER L WITH BELT ! -- LATIN SMALL LETTER L WITH RETROFLEX HOOK ! -- LATIN SMALL LETTER LEZH ! -- LATIN SMALL LETTER TURNED M WITH LONG LEG ! -- LATIN SMALL LETTER M WITH HOOK ! -- LATIN SMALL LETTER N WITH RETROFLEX HOOK ! -- LATIN SMALL LETTER BARRED O ! -- LATIN SMALL LETTER CLOSED OMEGA ! -- LATIN SMALL LETTER PHI ! -- LATIN SMALL LETTER TURNED R ! -- LATIN SMALL LETTER TURNED R WITH LONG LEG ! -- LATIN SMALL LETTER TURNED R WITH HOOK ! -- LATIN SMALL LETTER R WITH LONG LEG ! -- LATIN SMALL LETTER R WITH TAIL ! -- LATIN SMALL LETTER R WITH FISHHOOK ! -- LATIN SMALL LETTER REVERSED R WITH FISHHOOK ! -- LATIN SMALL LETTER S WITH HOOK ! -- LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK ! -- LATIN SMALL LETTER SQUAT REVERSED ESH ! -- LATIN SMALL LETTER ESH WITH CURL ! -- LATIN SMALL LETTER TURNED T ! -- LATIN SMALL LETTER U BAR ! -- LATIN SMALL LETTER TURNED V ! -- LATIN SMALL LETTER TURNED W ! -- LATIN SMALL LETTER TURNED Y ! -- LATIN SMALL LETTER Z WITH RETROFLEX HOOK ! -- LATIN SMALL LETTER Z WITH CURL ! -- LATIN SMALL LETTER EZH WITH CURL ! -- LATIN SMALL LETTER CLOSED OPEN E ! -- LATIN SMALL LETTER J WITH CROSSED-TAIL ! -- LATIN SMALL LETTER TURNED K ! -- LATIN SMALL LETTER Q WITH HOOK ! -- LATIN SMALL LETTER DZ DIGRAPH ! -- LATIN SMALL LETTER DEZH DIGRAPH ! -- LATIN SMALL LETTER DZ DIGRAPH WITH CURL ! -- LATIN SMALL LETTER TS DIGRAPH ! -- LATIN SMALL LETTER TESH DIGRAPH ! -- LATIN SMALL LETTER TC DIGRAPH WITH CURL ! -- LATIN SMALL LETTER FENG DIGRAPH ! -- LATIN SMALL LETTER LS DIGRAPH ! -- LATIN SMALL LETTER LZ DIGRAPH ! -- LATIN SMALL LETTER TURNED H WITH FISHHOOK ! -- LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL ! -- COMBINING LATIN SMALL LETTER A ! -- COMBINING LATIN SMALL LETTER E ! -- COMBINING LATIN SMALL LETTER I ! -- COMBINING LATIN SMALL LETTER O ! -- COMBINING LATIN SMALL LETTER U ! -- COMBINING LATIN SMALL LETTER C ! -- COMBINING LATIN SMALL LETTER D ! -- COMBINING LATIN SMALL LETTER H ! -- COMBINING LATIN SMALL LETTER M ! -- COMBINING LATIN SMALL LETTER R ! -- COMBINING LATIN SMALL LETTER T ! -- COMBINING LATIN SMALL LETTER V ! -- COMBINING LATIN SMALL LETTER X ! -- GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! -- GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! -- GREEK SMALL LETTER FINAL SIGMA ! -- GREEK SMALL LETTER CURLED BETA ! -- GREEK SMALL LETTER SCRIPT THETA ! -- GREEK SMALL LETTER SCRIPT PHI ! -- GREEK SMALL LETTER OMEGA PI ! -- GREEK SMALL LETTER ARCHAIC KOPPA ! -- GREEK SMALL LETTER SCRIPT KAPPA ! -- GREEK SMALL LETTER TAILED RHO ! -- GREEK SMALL LETTER LUNATE SIGMA ! -- GEORGIAN SMALL LETTER FI ! -- LIMBU SMALL LETTER KA ! -- LIMBU SMALL LETTER NGA ! -- LIMBU SMALL LETTER ANUSVARA ! -- LIMBU SMALL LETTER TA ! -- LIMBU SMALL LETTER NA ! -- LIMBU SMALL LETTER PA ! -- LIMBU SMALL LETTER MA ! -- LIMBU SMALL LETTER RA ! -- LIMBU SMALL LETTER LA ! -- LATIN SMALL LETTER TURNED AE ! -- LATIN SMALL LETTER TURNED OPEN E ! -- LATIN SMALL LETTER TURNED I ! -- LATIN SMALL LETTER SIDEWAYS O ! -- LATIN SMALL LETTER SIDEWAYS OPEN O ! -- LATIN SMALL LETTER SIDEWAYS O WITH STROKE ! -- LATIN SMALL LETTER TURNED OE ! -- LATIN SMALL LETTER TOP HALF O ! -- LATIN SMALL LETTER BOTTOM HALF O ! -- LATIN SMALL LETTER SIDEWAYS U ! -- LATIN SMALL LETTER SIDEWAYS DIAERESIZED U ! -- LATIN SMALL LETTER SIDEWAYS TURNED M ! -- LATIN SUBSCRIPT SMALL LETTER I ! -- LATIN SUBSCRIPT SMALL LETTER R ! -- LATIN SUBSCRIPT SMALL LETTER U ! -- LATIN SUBSCRIPT SMALL LETTER V ! -- GREEK SUBSCRIPT SMALL LETTER BETA ! -- GREEK SUBSCRIPT SMALL LETTER GAMMA ! -- GREEK SUBSCRIPT SMALL LETTER RHO ! -- GREEK SUBSCRIPT SMALL LETTER PHI ! -- GREEK SUBSCRIPT SMALL LETTER CHI ! -- LATIN SMALL LETTER UE ! -- LATIN SMALL LETTER H WITH LINE BELOW ! -- LATIN SMALL LETTER T WITH DIAERESIS ! -- LATIN SMALL LETTER W WITH RING ABOVE ! -- LATIN SMALL LETTER Y WITH RING ABOVE ! -- LATIN SMALL LETTER A WITH RIGHT HALF RING ! -- LATIN SMALL LETTER LONG S WITH DOT ABOVE ! -- GREEK SMALL LETTER UPSILON WITH PSILI ! -- GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA ! -- GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA ! -- GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI ! -- GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ALPHA WITH PERISPOMENI ! -- GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER ETA WITH PERISPOMENI ! -- GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA ! -- GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA ! -- GREEK SMALL LETTER IOTA WITH PERISPOMENI ! -- GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI ! -- GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA ! -- GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA ! -- GREEK SMALL LETTER RHO WITH PSILI ! -- GREEK SMALL LETTER UPSILON WITH PERISPOMENI ! -- GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI ! -- GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI ! -- GREEK SMALL LETTER OMEGA WITH PERISPOMENI ! -- GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI ! -- SUPERSCRIPT LATIN SMALL LETTER I ! -- SUPERSCRIPT LATIN SMALL LETTER N ! -- TURNED GREEK SMALL LETTER IOTA ! -- PARENTHESIZED LATIN SMALL LETTER A ! -- PARENTHESIZED LATIN SMALL LETTER B ! -- PARENTHESIZED LATIN SMALL LETTER C ! -- PARENTHESIZED LATIN SMALL LETTER D ! -- PARENTHESIZED LATIN SMALL LETTER E ! -- PARENTHESIZED LATIN SMALL LETTER F ! -- PARENTHESIZED LATIN SMALL LETTER G ! -- PARENTHESIZED LATIN SMALL LETTER H ! -- PARENTHESIZED LATIN SMALL LETTER I ! -- PARENTHESIZED LATIN SMALL LETTER J ! -- PARENTHESIZED LATIN SMALL LETTER K ! -- PARENTHESIZED LATIN SMALL LETTER L ! -- PARENTHESIZED LATIN SMALL LETTER M ! -- PARENTHESIZED LATIN SMALL LETTER N ! -- PARENTHESIZED LATIN SMALL LETTER O ! -- PARENTHESIZED LATIN SMALL LETTER P ! -- PARENTHESIZED LATIN SMALL LETTER Q ! -- PARENTHESIZED LATIN SMALL LETTER R ! -- PARENTHESIZED LATIN SMALL LETTER S ! -- PARENTHESIZED LATIN SMALL LETTER T ! -- PARENTHESIZED LATIN SMALL LETTER U ! -- PARENTHESIZED LATIN SMALL LETTER V ! -- PARENTHESIZED LATIN SMALL LETTER W ! -- PARENTHESIZED LATIN SMALL LETTER X ! -- PARENTHESIZED LATIN SMALL LETTER Y ! -- PARENTHESIZED LATIN SMALL LETTER Z + -- The following two tables define the mapping to lower case. The first + -- table gives the ranges of upper case letters. The corresponding entry + -- in Lower_Case_Adjust shows the amount to be added to (or subtracted from + -- if the value is negative) the code value to get the corresponding lower + -- case letter. + + -- An entry is in this table if its 10646 has the string CAPITAL LETTER + -- the name, and there is a corresponding entry which has the string + -- SMALL LETTER in its name. + + Upper_Case_Letters : constant UTF_32_Ranges := ( + (16#00041#, 16#0005A#), -- LATIN CAPITAL LETTER A .. LATIN CAPITAL LETTER Z + (16#000C0#, 16#000D6#), -- LATIN CAPITAL LETTER A WITH GRAVE .. LATIN CAPITAL LETTER O WITH DIAERESIS + (16#000D8#, 16#000DE#), -- LATIN CAPITAL LETTER O WITH STROKE .. LATIN CAPITAL LETTER THORN + (16#00100#, 16#00100#), -- LATIN CAPITAL LETTER A WITH MACRON .. LATIN CAPITAL LETTER A WITH MACRON + (16#00102#, 16#00102#), -- LATIN CAPITAL LETTER A WITH BREVE .. LATIN CAPITAL LETTER A WITH BREVE + (16#00104#, 16#00104#), -- LATIN CAPITAL LETTER A WITH OGONEK .. LATIN CAPITAL LETTER A WITH OGONEK + (16#00106#, 16#00106#), -- LATIN CAPITAL LETTER C WITH ACUTE .. LATIN CAPITAL LETTER C WITH ACUTE + (16#00108#, 16#00108#), -- LATIN CAPITAL LETTER C WITH CIRCUMFLEX .. LATIN CAPITAL LETTER C WITH CIRCUMFLEX + (16#0010A#, 16#0010A#), -- LATIN CAPITAL LETTER C WITH DOT ABOVE .. LATIN CAPITAL LETTER C WITH DOT ABOVE + (16#0010C#, 16#0010C#), -- LATIN CAPITAL LETTER C WITH CARON .. LATIN CAPITAL LETTER C WITH CARON + (16#0010E#, 16#0010E#), -- LATIN CAPITAL LETTER D WITH CARON .. LATIN CAPITAL LETTER D WITH CARON + (16#00110#, 16#00110#), -- LATIN CAPITAL LETTER D WITH STROKE .. LATIN CAPITAL LETTER D WITH STROKE + (16#00112#, 16#00112#), -- LATIN CAPITAL LETTER E WITH MACRON .. LATIN CAPITAL LETTER E WITH MACRON + (16#00114#, 16#00114#), -- LATIN CAPITAL LETTER E WITH BREVE .. LATIN CAPITAL LETTER E WITH BREVE + (16#00116#, 16#00116#), -- LATIN CAPITAL LETTER E WITH DOT ABOVE .. LATIN CAPITAL LETTER E WITH DOT ABOVE + (16#00118#, 16#00118#), -- LATIN CAPITAL LETTER E WITH OGONEK .. LATIN CAPITAL LETTER E WITH OGONEK + (16#0011A#, 16#0011A#), -- LATIN CAPITAL LETTER E WITH CARON .. LATIN CAPITAL LETTER E WITH CARON + (16#0011C#, 16#0011C#), -- LATIN CAPITAL LETTER G WITH CIRCUMFLEX .. LATIN CAPITAL LETTER G WITH CIRCUMFLEX + (16#0011E#, 16#0011E#), -- LATIN CAPITAL LETTER G WITH BREVE .. LATIN CAPITAL LETTER G WITH BREVE + (16#00120#, 16#00120#), -- LATIN CAPITAL LETTER G WITH DOT ABOVE .. LATIN CAPITAL LETTER G WITH DOT ABOVE + (16#00122#, 16#00122#), -- LATIN CAPITAL LETTER G WITH CEDILLA .. LATIN CAPITAL LETTER G WITH CEDILLA + (16#00124#, 16#00124#), -- LATIN CAPITAL LETTER H WITH CIRCUMFLEX .. LATIN CAPITAL LETTER H WITH CIRCUMFLEX + (16#00126#, 16#00126#), -- LATIN CAPITAL LETTER H WITH STROKE .. LATIN CAPITAL LETTER H WITH STROKE + (16#00128#, 16#00128#), -- LATIN CAPITAL LETTER I WITH TILDE .. LATIN CAPITAL LETTER I WITH TILDE + (16#0012A#, 16#0012A#), -- LATIN CAPITAL LETTER I WITH MACRON .. LATIN CAPITAL LETTER I WITH MACRON + (16#0012C#, 16#0012C#), -- LATIN CAPITAL LETTER I WITH BREVE .. LATIN CAPITAL LETTER I WITH BREVE + (16#0012E#, 16#0012E#), -- LATIN CAPITAL LETTER I WITH OGONEK .. LATIN CAPITAL LETTER I WITH OGONEK + (16#00132#, 16#00132#), -- LATIN CAPITAL LETTER I J .. LATIN CAPITAL LETTER I J + (16#00134#, 16#00134#), -- LATIN CAPITAL LETTER J WITH CIRCUMFLEX .. LATIN CAPITAL LETTER J WITH CIRCUMFLEX + (16#00136#, 16#00136#), -- LATIN CAPITAL LETTER K WITH CEDILLA .. LATIN CAPITAL LETTER K WITH CEDILLA + (16#00139#, 16#00139#), -- LATIN CAPITAL LETTER L WITH ACUTE .. LATIN CAPITAL LETTER L WITH ACUTE + (16#0013B#, 16#0013B#), -- LATIN CAPITAL LETTER L WITH CEDILLA .. LATIN CAPITAL LETTER L WITH CEDILLA + (16#0013D#, 16#0013D#), -- LATIN CAPITAL LETTER L WITH CARON .. LATIN CAPITAL LETTER L WITH CARON + (16#0013F#, 16#0013F#), -- LATIN CAPITAL LETTER L WITH MIDDLE DOT .. LATIN CAPITAL LETTER L WITH MIDDLE DOT + (16#00141#, 16#00141#), -- LATIN CAPITAL LETTER L WITH STROKE .. LATIN CAPITAL LETTER L WITH STROKE + (16#00143#, 16#00143#), -- LATIN CAPITAL LETTER N WITH ACUTE .. LATIN CAPITAL LETTER N WITH ACUTE + (16#00145#, 16#00145#), -- LATIN CAPITAL LETTER N WITH CEDILLA .. LATIN CAPITAL LETTER N WITH CEDILLA + (16#00147#, 16#00147#), -- LATIN CAPITAL LETTER N WITH CARON .. LATIN CAPITAL LETTER N WITH CARON + (16#0014A#, 16#0014A#), -- LATIN CAPITAL LETTER ENG .. LATIN CAPITAL LETTER ENG + (16#0014C#, 16#0014C#), -- LATIN CAPITAL LETTER O WITH MACRON .. LATIN CAPITAL LETTER O WITH MACRON + (16#0014E#, 16#0014E#), -- LATIN CAPITAL LETTER O WITH BREVE .. LATIN CAPITAL LETTER O WITH BREVE + (16#00150#, 16#00150#), -- LATIN CAPITAL LETTER O WITH DOUBLE ACUTE .. LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + (16#00152#, 16#00152#), -- LATIN CAPITAL LETTER O E .. LATIN CAPITAL LETTER O E + (16#00154#, 16#00154#), -- LATIN CAPITAL LETTER R WITH ACUTE .. LATIN CAPITAL LETTER R WITH ACUTE + (16#00156#, 16#00156#), -- LATIN CAPITAL LETTER R WITH CEDILLA .. LATIN CAPITAL LETTER R WITH CEDILLA + (16#00158#, 16#00158#), -- LATIN CAPITAL LETTER R WITH CARON .. LATIN CAPITAL LETTER R WITH CARON + (16#0015A#, 16#0015A#), -- LATIN CAPITAL LETTER S WITH ACUTE .. LATIN CAPITAL LETTER S WITH ACUTE + (16#0015C#, 16#0015C#), -- LATIN CAPITAL LETTER S WITH CIRCUMFLEX .. LATIN CAPITAL LETTER S WITH CIRCUMFLEX + (16#0015E#, 16#0015E#), -- LATIN CAPITAL LETTER S WITH CEDILLA .. LATIN CAPITAL LETTER S WITH CEDILLA + (16#00160#, 16#00160#), -- LATIN CAPITAL LETTER S WITH CARON .. LATIN CAPITAL LETTER S WITH CARON + (16#00162#, 16#00162#), -- LATIN CAPITAL LETTER T WITH CEDILLA .. LATIN CAPITAL LETTER T WITH CEDILLA + (16#00164#, 16#00164#), -- LATIN CAPITAL LETTER T WITH CARON .. LATIN CAPITAL LETTER T WITH CARON + (16#00166#, 16#00166#), -- LATIN CAPITAL LETTER T WITH STROKE .. LATIN CAPITAL LETTER T WITH STROKE + (16#00168#, 16#00168#), -- LATIN CAPITAL LETTER U WITH TILDE .. LATIN CAPITAL LETTER U WITH TILDE + (16#0016A#, 16#0016A#), -- LATIN CAPITAL LETTER U WITH MACRON .. LATIN CAPITAL LETTER U WITH MACRON + (16#0016C#, 16#0016C#), -- LATIN CAPITAL LETTER U WITH BREVE .. LATIN CAPITAL LETTER U WITH BREVE + (16#0016E#, 16#0016E#), -- LATIN CAPITAL LETTER U WITH RING ABOVE .. LATIN CAPITAL LETTER U WITH RING ABOVE + (16#00170#, 16#00170#), -- LATIN CAPITAL LETTER U WITH DOUBLE ACUTE .. LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + (16#00172#, 16#00172#), -- LATIN CAPITAL LETTER U WITH OGONEK .. LATIN CAPITAL LETTER U WITH OGONEK + (16#00174#, 16#00174#), -- LATIN CAPITAL LETTER W WITH CIRCUMFLEX .. LATIN CAPITAL LETTER W WITH CIRCUMFLEX + (16#00176#, 16#00176#), -- LATIN CAPITAL LETTER Y WITH CIRCUMFLEX .. LATIN CAPITAL LETTER Y WITH CIRCUMFLEX + (16#00178#, 16#00178#), -- LATIN CAPITAL LETTER Y WITH DIAERESIS .. LATIN CAPITAL LETTER Y WITH DIAERESIS + (16#00179#, 16#00179#), -- LATIN CAPITAL LETTER Z WITH ACUTE .. LATIN CAPITAL LETTER Z WITH ACUTE + (16#0017B#, 16#0017B#), -- LATIN CAPITAL LETTER Z WITH DOT ABOVE .. LATIN CAPITAL LETTER Z WITH DOT ABOVE + (16#0017D#, 16#0017D#), -- LATIN CAPITAL LETTER Z WITH CARON .. LATIN CAPITAL LETTER Z WITH CARON + (16#00181#, 16#00181#), -- LATIN CAPITAL LETTER B WITH HOOK .. LATIN CAPITAL LETTER B WITH HOOK + (16#00182#, 16#00182#), -- LATIN CAPITAL LETTER B WITH TOPBAR .. LATIN CAPITAL LETTER B WITH TOPBAR + (16#00184#, 16#00184#), -- LATIN CAPITAL LETTER TONE SIX .. LATIN CAPITAL LETTER TONE SIX + (16#00186#, 16#00186#), -- LATIN CAPITAL LETTER OPEN O .. LATIN CAPITAL LETTER OPEN O + (16#00187#, 16#00187#), -- LATIN CAPITAL LETTER C WITH HOOK .. LATIN CAPITAL LETTER C WITH HOOK + (16#0018A#, 16#0018A#), -- LATIN CAPITAL LETTER D WITH HOOK .. LATIN CAPITAL LETTER D WITH HOOK + (16#0018B#, 16#0018B#), -- LATIN CAPITAL LETTER D WITH TOPBAR .. LATIN CAPITAL LETTER D WITH TOPBAR + (16#0018E#, 16#0018F#), -- LATIN CAPITAL LETTER REVERSED E .. LATIN CAPITAL LETTER SCHWA + (16#00190#, 16#00190#), -- LATIN CAPITAL LETTER OPEN E .. LATIN CAPITAL LETTER OPEN E + (16#00191#, 16#00191#), -- LATIN CAPITAL LETTER F WITH HOOK .. LATIN CAPITAL LETTER F WITH HOOK + (16#00193#, 16#00193#), -- LATIN CAPITAL LETTER G WITH HOOK .. LATIN CAPITAL LETTER G WITH HOOK + (16#00194#, 16#00194#), -- LATIN CAPITAL LETTER GAMMA .. LATIN CAPITAL LETTER GAMMA + (16#00196#, 16#00196#), -- LATIN CAPITAL LETTER IOTA .. LATIN CAPITAL LETTER IOTA + (16#00197#, 16#00197#), -- LATIN CAPITAL LETTER I WITH STROKE .. LATIN CAPITAL LETTER I WITH STROKE + (16#00198#, 16#00198#), -- LATIN CAPITAL LETTER K WITH HOOK .. LATIN CAPITAL LETTER K WITH HOOK + (16#0019C#, 16#0019C#), -- LATIN CAPITAL LETTER TURNED M .. LATIN CAPITAL LETTER TURNED M + (16#0019D#, 16#0019D#), -- LATIN CAPITAL LETTER N WITH LEFT HOOK .. LATIN CAPITAL LETTER N WITH LEFT HOOK + (16#001A0#, 16#001A0#), -- LATIN CAPITAL LETTER O WITH HORN .. LATIN CAPITAL LETTER O WITH HORN + (16#001A2#, 16#001A2#), -- LATIN CAPITAL LETTER OI .. LATIN CAPITAL LETTER OI + (16#001A4#, 16#001A4#), -- LATIN CAPITAL LETTER P WITH HOOK .. LATIN CAPITAL LETTER P WITH HOOK + (16#001A7#, 16#001A7#), -- LATIN CAPITAL LETTER TONE TWO .. LATIN CAPITAL LETTER TONE TWO + (16#001A9#, 16#001A9#), -- LATIN CAPITAL LETTER ESH .. LATIN CAPITAL LETTER ESH + (16#001AC#, 16#001AC#), -- LATIN CAPITAL LETTER T WITH HOOK .. LATIN CAPITAL LETTER T WITH HOOK + (16#001AE#, 16#001AE#), -- LATIN CAPITAL LETTER T WITH RETROFLEX HOOK .. LATIN CAPITAL LETTER T WITH RETROFLEX HOOK + (16#001AF#, 16#001AF#), -- LATIN CAPITAL LETTER U WITH HORN .. LATIN CAPITAL LETTER U WITH HORN + (16#001B1#, 16#001B2#), -- LATIN CAPITAL LETTER UPSILON .. LATIN CAPITAL LETTER V WITH HOOK + (16#001B3#, 16#001B3#), -- LATIN CAPITAL LETTER Y WITH HOOK .. LATIN CAPITAL LETTER Y WITH HOOK + (16#001B5#, 16#001B5#), -- LATIN CAPITAL LETTER Z WITH STROKE .. LATIN CAPITAL LETTER Z WITH STROKE + (16#001B7#, 16#001B7#), -- LATIN CAPITAL LETTER EZH .. LATIN CAPITAL LETTER EZH + (16#001B8#, 16#001B8#), -- LATIN CAPITAL LETTER EZH REVERSED .. LATIN CAPITAL LETTER EZH REVERSED + (16#001BC#, 16#001BC#), -- LATIN CAPITAL LETTER TONE FIVE .. LATIN CAPITAL LETTER TONE FIVE + (16#001C4#, 16#001C4#), -- LATIN CAPITAL LETTER DZ WITH CARON .. LATIN CAPITAL LETTER DZ WITH CARON + (16#001C7#, 16#001C7#), -- LATIN CAPITAL LETTER LJ .. LATIN CAPITAL LETTER LJ + (16#001CA#, 16#001CA#), -- LATIN CAPITAL LETTER NJ .. LATIN CAPITAL LETTER NJ + (16#001CD#, 16#001CD#), -- LATIN CAPITAL LETTER A WITH CARON .. LATIN CAPITAL LETTER A WITH CARON + (16#001CF#, 16#001CF#), -- LATIN CAPITAL LETTER I WITH CARON .. LATIN CAPITAL LETTER I WITH CARON + (16#001D1#, 16#001D1#), -- LATIN CAPITAL LETTER O WITH CARON .. LATIN CAPITAL LETTER O WITH CARON + (16#001D3#, 16#001D3#), -- LATIN CAPITAL LETTER U WITH CARON .. LATIN CAPITAL LETTER U WITH CARON + (16#001D5#, 16#001D5#), -- LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON .. LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON + (16#001D7#, 16#001D7#), -- LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE .. LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE + (16#001D9#, 16#001D9#), -- LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON .. LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON + (16#001DB#, 16#001DB#), -- LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE .. LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE + (16#001DE#, 16#001DE#), -- LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON .. LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON + (16#001E0#, 16#001E0#), -- LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON .. LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON + (16#001E2#, 16#001E2#), -- LATIN CAPITAL LETTER AE WITH MACRON .. LATIN CAPITAL LETTER AE WITH MACRON + (16#001E4#, 16#001E4#), -- LATIN CAPITAL LETTER G WITH STROKE .. LATIN CAPITAL LETTER G WITH STROKE + (16#001E6#, 16#001E6#), -- LATIN CAPITAL LETTER G WITH CARON .. LATIN CAPITAL LETTER G WITH CARON + (16#001E8#, 16#001E8#), -- LATIN CAPITAL LETTER K WITH CARON .. LATIN CAPITAL LETTER K WITH CARON + (16#001EA#, 16#001EA#), -- LATIN CAPITAL LETTER O WITH OGONEK .. LATIN CAPITAL LETTER O WITH OGONEK + (16#001EC#, 16#001EC#), -- LATIN CAPITAL LETTER O WITH OGONEK AND MACRON .. LATIN CAPITAL LETTER O WITH OGONEK AND MACRON + (16#001EE#, 16#001EE#), -- LATIN CAPITAL LETTER EZH WITH CARON .. LATIN CAPITAL LETTER EZH WITH CARON + (16#001F1#, 16#001F1#), -- LATIN CAPITAL LETTER DZ .. LATIN CAPITAL LETTER DZ + (16#001F4#, 16#001F4#), -- LATIN CAPITAL LETTER G WITH ACUTE .. LATIN CAPITAL LETTER G WITH ACUTE + (16#001F8#, 16#001F8#), -- LATIN CAPITAL LETTER N WITH GRAVE .. LATIN CAPITAL LETTER N WITH GRAVE + (16#001FA#, 16#001FA#), -- LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE .. LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE + (16#001FC#, 16#001FC#), -- LATIN CAPITAL LETTER AE WITH ACUTE .. LATIN CAPITAL LETTER AE WITH ACUTE + (16#001FE#, 16#001FE#), -- LATIN CAPITAL LETTER O WITH STROKE AND ACUTE .. LATIN CAPITAL LETTER O WITH STROKE AND ACUTE + (16#00200#, 16#00200#), -- LATIN CAPITAL LETTER A WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER A WITH DOUBLE GRAVE + (16#00202#, 16#00202#), -- LATIN CAPITAL LETTER A WITH INVERTED BREVE .. LATIN CAPITAL LETTER A WITH INVERTED BREVE + (16#00204#, 16#00204#), -- LATIN CAPITAL LETTER E WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER E WITH DOUBLE GRAVE + (16#00206#, 16#00206#), -- LATIN CAPITAL LETTER E WITH INVERTED BREVE .. LATIN CAPITAL LETTER E WITH INVERTED BREVE + (16#00208#, 16#00208#), -- LATIN CAPITAL LETTER I WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER I WITH DOUBLE GRAVE + (16#0020A#, 16#0020A#), -- LATIN CAPITAL LETTER I WITH INVERTED BREVE .. LATIN CAPITAL LETTER I WITH INVERTED BREVE + (16#0020C#, 16#0020C#), -- LATIN CAPITAL LETTER O WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER O WITH DOUBLE GRAVE + (16#0020E#, 16#0020E#), -- LATIN CAPITAL LETTER O WITH INVERTED BREVE .. LATIN CAPITAL LETTER O WITH INVERTED BREVE + (16#00210#, 16#00210#), -- LATIN CAPITAL LETTER R WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER R WITH DOUBLE GRAVE + (16#00212#, 16#00212#), -- LATIN CAPITAL LETTER R WITH INVERTED BREVE .. LATIN CAPITAL LETTER R WITH INVERTED BREVE + (16#00214#, 16#00214#), -- LATIN CAPITAL LETTER U WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER U WITH DOUBLE GRAVE + (16#00216#, 16#00216#), -- LATIN CAPITAL LETTER U WITH INVERTED BREVE .. LATIN CAPITAL LETTER U WITH INVERTED BREVE + (16#00218#, 16#00218#), -- LATIN CAPITAL LETTER S WITH COMMA BELOW .. LATIN CAPITAL LETTER S WITH COMMA BELOW + (16#0021A#, 16#0021A#), -- LATIN CAPITAL LETTER T WITH COMMA BELOW .. LATIN CAPITAL LETTER T WITH COMMA BELOW + (16#0021C#, 16#0021C#), -- LATIN CAPITAL LETTER YOGH .. LATIN CAPITAL LETTER YOGH + (16#0021E#, 16#0021E#), -- LATIN CAPITAL LETTER H WITH CARON .. LATIN CAPITAL LETTER H WITH CARON + (16#00220#, 16#00220#), -- LATIN CAPITAL LETTER N WITH LONG RIGHT LEG .. LATIN CAPITAL LETTER N WITH LONG RIGHT LEG + (16#00222#, 16#00222#), -- LATIN CAPITAL LETTER OU .. LATIN CAPITAL LETTER OU + (16#00224#, 16#00224#), -- LATIN CAPITAL LETTER Z WITH HOOK .. LATIN CAPITAL LETTER Z WITH HOOK + (16#00226#, 16#00226#), -- LATIN CAPITAL LETTER A WITH DOT ABOVE .. LATIN CAPITAL LETTER A WITH DOT ABOVE + (16#00228#, 16#00228#), -- LATIN CAPITAL LETTER E WITH CEDILLA .. LATIN CAPITAL LETTER E WITH CEDILLA + (16#0022A#, 16#0022A#), -- LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON .. LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON + (16#0022C#, 16#0022C#), -- LATIN CAPITAL LETTER O WITH TILDE AND MACRON .. LATIN CAPITAL LETTER O WITH TILDE AND MACRON + (16#0022E#, 16#0022E#), -- LATIN CAPITAL LETTER O WITH DOT ABOVE .. LATIN CAPITAL LETTER O WITH DOT ABOVE + (16#00230#, 16#00230#), -- LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON .. LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON + (16#00232#, 16#00232#), -- LATIN CAPITAL LETTER Y WITH MACRON .. LATIN CAPITAL LETTER Y WITH MACRON + (16#00386#, 16#00386#), -- GREEK CAPITAL LETTER ALPHA WITH TONOS .. GREEK CAPITAL LETTER ALPHA WITH TONOS + (16#00388#, 16#0038A#), -- GREEK CAPITAL LETTER EPSILON WITH TONOS .. GREEK CAPITAL LETTER IOTA WITH TONOS + (16#0038C#, 16#0038C#), -- GREEK CAPITAL LETTER OMICRON WITH TONOS .. GREEK CAPITAL LETTER OMICRON WITH TONOS + (16#0038E#, 16#0038F#), -- GREEK CAPITAL LETTER UPSILON WITH TONOS .. GREEK CAPITAL LETTER OMEGA WITH TONOS + (16#00391#, 16#003A1#), -- GREEK CAPITAL LETTER ALPHA .. GREEK CAPITAL LETTER RHO + (16#003A3#, 16#003AB#), -- GREEK CAPITAL LETTER SIGMA .. GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + (16#003DA#, 16#003DA#), -- GREEK CAPITAL LETTER STIGMA .. GREEK CAPITAL LETTER STIGMA + (16#003DC#, 16#003DC#), -- GREEK CAPITAL LETTER DIGAMMA .. GREEK CAPITAL LETTER DIGAMMA + (16#003DE#, 16#003DE#), -- GREEK CAPITAL LETTER KOPPA .. GREEK CAPITAL LETTER KOPPA + (16#003E0#, 16#003E0#), -- GREEK CAPITAL LETTER SAMPI .. GREEK CAPITAL LETTER SAMPI + (16#003E2#, 16#003E2#), -- COPTIC CAPITAL LETTER SHEI .. COPTIC CAPITAL LETTER SHEI + (16#003E4#, 16#003E4#), -- COPTIC CAPITAL LETTER FEI .. COPTIC CAPITAL LETTER FEI + (16#003E6#, 16#003E6#), -- COPTIC CAPITAL LETTER KHEI .. COPTIC CAPITAL LETTER KHEI + (16#003E8#, 16#003E8#), -- COPTIC CAPITAL LETTER HORI .. COPTIC CAPITAL LETTER HORI + (16#003EA#, 16#003EA#), -- COPTIC CAPITAL LETTER GANGIA .. COPTIC CAPITAL LETTER GANGIA + (16#003EC#, 16#003EC#), -- COPTIC CAPITAL LETTER SHIMA .. COPTIC CAPITAL LETTER SHIMA + (16#003EE#, 16#003EE#), -- COPTIC CAPITAL LETTER DEI .. COPTIC CAPITAL LETTER DEI + (16#003F7#, 16#003F7#), -- GREEK CAPITAL LETTER SHO .. GREEK CAPITAL LETTER SHO + (16#003FA#, 16#003FA#), -- GREEK CAPITAL LETTER SAN .. GREEK CAPITAL LETTER SAN + (16#00400#, 16#0040F#), -- CYRILLIC CAPITAL LETTER IE WITH GRAVE .. CYRILLIC CAPITAL LETTER DZHE + (16#00410#, 16#0042F#), -- CYRILLIC CAPITAL LETTER A .. CYRILLIC CAPITAL LETTER YA + (16#00460#, 16#00460#), -- CYRILLIC CAPITAL LETTER OMEGA .. CYRILLIC CAPITAL LETTER OMEGA + (16#00462#, 16#00462#), -- CYRILLIC CAPITAL LETTER YAT .. CYRILLIC CAPITAL LETTER YAT + (16#00464#, 16#00464#), -- CYRILLIC CAPITAL LETTER IOTIFIED E .. CYRILLIC CAPITAL LETTER IOTIFIED E + (16#00466#, 16#00466#), -- CYRILLIC CAPITAL LETTER LITTLE YUS .. CYRILLIC CAPITAL LETTER LITTLE YUS + (16#00468#, 16#00468#), -- CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS .. CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS + (16#0046A#, 16#0046A#), -- CYRILLIC CAPITAL LETTER BIG YUS .. CYRILLIC CAPITAL LETTER BIG YUS + (16#0046C#, 16#0046C#), -- CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS .. CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS + (16#0046E#, 16#0046E#), -- CYRILLIC CAPITAL LETTER KSI .. CYRILLIC CAPITAL LETTER KSI + (16#00470#, 16#00470#), -- CYRILLIC CAPITAL LETTER PSI .. CYRILLIC CAPITAL LETTER PSI + (16#00472#, 16#00472#), -- CYRILLIC CAPITAL LETTER FITA .. CYRILLIC CAPITAL LETTER FITA + (16#00474#, 16#00474#), -- CYRILLIC CAPITAL LETTER IZHITSA .. CYRILLIC CAPITAL LETTER IZHITSA + (16#00476#, 16#00476#), -- CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT .. CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT + (16#00478#, 16#00478#), -- CYRILLIC CAPITAL LETTER UK .. CYRILLIC CAPITAL LETTER UK + (16#0047A#, 16#0047A#), -- CYRILLIC CAPITAL LETTER ROUND OMEGA .. CYRILLIC CAPITAL LETTER ROUND OMEGA + (16#0047C#, 16#0047C#), -- CYRILLIC CAPITAL LETTER OMEGA WITH TITLO .. CYRILLIC CAPITAL LETTER OMEGA WITH TITLO + (16#0047E#, 16#0047E#), -- CYRILLIC CAPITAL LETTER OT .. CYRILLIC CAPITAL LETTER OT + (16#00480#, 16#00480#), -- CYRILLIC CAPITAL LETTER KOPPA .. CYRILLIC CAPITAL LETTER KOPPA + (16#0048A#, 16#0048A#), -- CYRILLIC CAPITAL LETTER SHORT I WITH TAIL .. CYRILLIC CAPITAL LETTER SHORT I WITH TAIL + (16#0048C#, 16#0048C#), -- CYRILLIC CAPITAL LETTER SEMISOFT SIGN .. CYRILLIC CAPITAL LETTER SEMISOFT SIGN + (16#0048E#, 16#0048E#), -- CYRILLIC CAPITAL LETTER ER WITH TICK .. CYRILLIC CAPITAL LETTER ER WITH TICK + (16#00490#, 16#00490#), -- CYRILLIC CAPITAL LETTER GHE WITH UPTURN .. CYRILLIC CAPITAL LETTER GHE WITH UPTURN + (16#00492#, 16#00492#), -- CYRILLIC CAPITAL LETTER GHE WITH STROKE .. CYRILLIC CAPITAL LETTER GHE WITH STROKE + (16#00494#, 16#00494#), -- CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK .. CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK + (16#00496#, 16#00496#), -- CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER .. CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER + (16#00498#, 16#00498#), -- CYRILLIC CAPITAL LETTER ZE WITH DESCENDER .. CYRILLIC CAPITAL LETTER ZE WITH DESCENDER + (16#0049A#, 16#0049A#), -- CYRILLIC CAPITAL LETTER KA WITH DESCENDER .. CYRILLIC CAPITAL LETTER KA WITH DESCENDER + (16#0049C#, 16#0049C#), -- CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE .. CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE + (16#0049E#, 16#0049E#), -- CYRILLIC CAPITAL LETTER KA WITH STROKE .. CYRILLIC CAPITAL LETTER KA WITH STROKE + (16#004A0#, 16#004A0#), -- CYRILLIC CAPITAL LETTER BASHKIR KA .. CYRILLIC CAPITAL LETTER BASHKIR KA + (16#004A2#, 16#004A2#), -- CYRILLIC CAPITAL LETTER EN WITH DESCENDER .. CYRILLIC CAPITAL LETTER EN WITH DESCENDER + (16#004A4#, 16#004A4#), -- CYRILLIC CAPITAL LETTER EN GE .. CYRILLIC CAPITAL LETTER EN GE + (16#004A6#, 16#004A6#), -- CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK .. CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK + (16#004A8#, 16#004A8#), -- CYRILLIC CAPITAL LETTER ABKHASIAN HA .. CYRILLIC CAPITAL LETTER ABKHASIAN HA + (16#004AA#, 16#004AA#), -- CYRILLIC CAPITAL LETTER ES WITH DESCENDER .. CYRILLIC CAPITAL LETTER ES WITH DESCENDER + (16#004AC#, 16#004AC#), -- CYRILLIC CAPITAL LETTER TE WITH DESCENDER .. CYRILLIC CAPITAL LETTER TE WITH DESCENDER + (16#004AE#, 16#004AE#), -- CYRILLIC CAPITAL LETTER STRAIGHT U .. CYRILLIC CAPITAL LETTER STRAIGHT U + (16#004B0#, 16#004B0#), -- CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE .. CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE + (16#004B2#, 16#004B2#), -- CYRILLIC CAPITAL LETTER HA WITH DESCENDER .. CYRILLIC CAPITAL LETTER HA WITH DESCENDER + (16#004B4#, 16#004B4#), -- CYRILLIC CAPITAL LETTER TE TSE .. CYRILLIC CAPITAL LETTER TE TSE + (16#004B6#, 16#004B6#), -- CYRILLIC CAPITAL LETTER CHE WITH DESCENDER .. CYRILLIC CAPITAL LETTER CHE WITH DESCENDER + (16#004B8#, 16#004B8#), -- CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE .. CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE + (16#004BA#, 16#004BA#), -- CYRILLIC CAPITAL LETTER SHHA .. CYRILLIC CAPITAL LETTER SHHA + (16#004BC#, 16#004BC#), -- CYRILLIC CAPITAL LETTER ABKHASIAN CHE .. CYRILLIC CAPITAL LETTER ABKHASIAN CHE + (16#004BE#, 16#004BE#), -- CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER .. CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER + (16#004C1#, 16#004C1#), -- CYRILLIC CAPITAL LETTER ZHE WITH BREVE .. CYRILLIC CAPITAL LETTER ZHE WITH BREVE + (16#004C3#, 16#004C3#), -- CYRILLIC CAPITAL LETTER KA WITH HOOK .. CYRILLIC CAPITAL LETTER KA WITH HOOK + (16#004C5#, 16#004C5#), -- CYRILLIC CAPITAL LETTER EL WITH TAIL .. CYRILLIC CAPITAL LETTER EL WITH TAIL + (16#004C7#, 16#004C7#), -- CYRILLIC CAPITAL LETTER EN WITH HOOK .. CYRILLIC CAPITAL LETTER EN WITH HOOK + (16#004C9#, 16#004C9#), -- CYRILLIC CAPITAL LETTER EN WITH TAIL .. CYRILLIC CAPITAL LETTER EN WITH TAIL + (16#004CB#, 16#004CB#), -- CYRILLIC CAPITAL LETTER KHAKASSIAN CHE .. CYRILLIC CAPITAL LETTER KHAKASSIAN CHE + (16#004CD#, 16#004CD#), -- CYRILLIC CAPITAL LETTER EM WITH TAIL .. CYRILLIC CAPITAL LETTER EM WITH TAIL + (16#004D0#, 16#004D0#), -- CYRILLIC CAPITAL LETTER A WITH BREVE .. CYRILLIC CAPITAL LETTER A WITH BREVE + (16#004D2#, 16#004D2#), -- CYRILLIC CAPITAL LETTER A WITH DIAERESIS .. CYRILLIC CAPITAL LETTER A WITH DIAERESIS + (16#004D6#, 16#004D6#), -- CYRILLIC CAPITAL LETTER IE WITH BREVE .. CYRILLIC CAPITAL LETTER IE WITH BREVE + (16#004D8#, 16#004D8#), -- CYRILLIC CAPITAL LETTER SCHWA .. CYRILLIC CAPITAL LETTER SCHWA + (16#004DA#, 16#004DA#), -- CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS .. CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS + (16#004DC#, 16#004DC#), -- CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS .. CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS + (16#004DE#, 16#004DE#), -- CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS .. CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS + (16#004E0#, 16#004E0#), -- CYRILLIC CAPITAL LETTER ABKHASIAN DZE .. CYRILLIC CAPITAL LETTER ABKHASIAN DZE + (16#004E2#, 16#004E2#), -- CYRILLIC CAPITAL LETTER I WITH MACRON .. CYRILLIC CAPITAL LETTER I WITH MACRON + (16#004E4#, 16#004E4#), -- CYRILLIC CAPITAL LETTER I WITH DIAERESIS .. CYRILLIC CAPITAL LETTER I WITH DIAERESIS + (16#004E6#, 16#004E6#), -- CYRILLIC CAPITAL LETTER O WITH DIAERESIS .. CYRILLIC CAPITAL LETTER O WITH DIAERESIS + (16#004E8#, 16#004E8#), -- CYRILLIC CAPITAL LETTER BARRED O .. CYRILLIC CAPITAL LETTER BARRED O + (16#004EA#, 16#004EA#), -- CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS .. CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS + (16#004EC#, 16#004EC#), -- CYRILLIC CAPITAL LETTER E WITH DIAERESIS .. CYRILLIC CAPITAL LETTER E WITH DIAERESIS + (16#004EE#, 16#004EE#), -- CYRILLIC CAPITAL LETTER U WITH MACRON .. CYRILLIC CAPITAL LETTER U WITH MACRON + (16#004F0#, 16#004F0#), -- CYRILLIC CAPITAL LETTER U WITH DIAERESIS .. CYRILLIC CAPITAL LETTER U WITH DIAERESIS + (16#004F2#, 16#004F2#), -- CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE .. CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE + (16#004F4#, 16#004F4#), -- CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS .. CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS + (16#004F8#, 16#004F8#), -- CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS .. CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS + (16#00500#, 16#00500#), -- CYRILLIC CAPITAL LETTER KOMI DE .. CYRILLIC CAPITAL LETTER KOMI DE + (16#00502#, 16#00502#), -- CYRILLIC CAPITAL LETTER KOMI DJE .. CYRILLIC CAPITAL LETTER KOMI DJE + (16#00504#, 16#00504#), -- CYRILLIC CAPITAL LETTER KOMI ZJE .. CYRILLIC CAPITAL LETTER KOMI ZJE + (16#00506#, 16#00506#), -- CYRILLIC CAPITAL LETTER KOMI DZJE .. CYRILLIC CAPITAL LETTER KOMI DZJE + (16#00508#, 16#00508#), -- CYRILLIC CAPITAL LETTER KOMI LJE .. CYRILLIC CAPITAL LETTER KOMI LJE + (16#0050A#, 16#0050A#), -- CYRILLIC CAPITAL LETTER KOMI NJE .. CYRILLIC CAPITAL LETTER KOMI NJE + (16#0050C#, 16#0050C#), -- CYRILLIC CAPITAL LETTER KOMI SJE .. CYRILLIC CAPITAL LETTER KOMI SJE + (16#0050E#, 16#0050E#), -- CYRILLIC CAPITAL LETTER KOMI TJE .. CYRILLIC CAPITAL LETTER KOMI TJE + (16#00531#, 16#00556#), -- ARMENIAN CAPITAL LETTER AYB .. ARMENIAN CAPITAL LETTER FEH + (16#010A0#, 16#010C5#), -- GEORGIAN CAPITAL LETTER AN .. GEORGIAN CAPITAL LETTER HOE + (16#01E00#, 16#01E00#), -- LATIN CAPITAL LETTER A WITH RING BELOW .. LATIN CAPITAL LETTER A WITH RING BELOW + (16#01E02#, 16#01E02#), -- LATIN CAPITAL LETTER B WITH DOT ABOVE .. LATIN CAPITAL LETTER B WITH DOT ABOVE + (16#01E04#, 16#01E04#), -- LATIN CAPITAL LETTER B WITH DOT BELOW .. LATIN CAPITAL LETTER B WITH DOT BELOW + (16#01E06#, 16#01E06#), -- LATIN CAPITAL LETTER B WITH LINE BELOW .. LATIN CAPITAL LETTER B WITH LINE BELOW + (16#01E08#, 16#01E08#), -- LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE .. LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE + (16#01E0A#, 16#01E0A#), -- LATIN CAPITAL LETTER D WITH DOT ABOVE .. LATIN CAPITAL LETTER D WITH DOT ABOVE + (16#01E0C#, 16#01E0C#), -- LATIN CAPITAL LETTER D WITH DOT BELOW .. LATIN CAPITAL LETTER D WITH DOT BELOW + (16#01E0E#, 16#01E0E#), -- LATIN CAPITAL LETTER D WITH LINE BELOW .. LATIN CAPITAL LETTER D WITH LINE BELOW + (16#01E10#, 16#01E10#), -- LATIN CAPITAL LETTER D WITH CEDILLA .. LATIN CAPITAL LETTER D WITH CEDILLA + (16#01E12#, 16#01E12#), -- LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW + (16#01E14#, 16#01E14#), -- LATIN CAPITAL LETTER E WITH MACRON AND GRAVE .. LATIN CAPITAL LETTER E WITH MACRON AND GRAVE + (16#01E16#, 16#01E16#), -- LATIN CAPITAL LETTER E WITH MACRON AND ACUTE .. LATIN CAPITAL LETTER E WITH MACRON AND ACUTE + (16#01E18#, 16#01E18#), -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW + (16#01E1A#, 16#01E1A#), -- LATIN CAPITAL LETTER E WITH TILDE BELOW .. LATIN CAPITAL LETTER E WITH TILDE BELOW + (16#01E1C#, 16#01E1C#), -- LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE .. LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE + (16#01E1E#, 16#01E1E#), -- LATIN CAPITAL LETTER F WITH DOT ABOVE .. LATIN CAPITAL LETTER F WITH DOT ABOVE + (16#01E20#, 16#01E20#), -- LATIN CAPITAL LETTER G WITH MACRON .. LATIN CAPITAL LETTER G WITH MACRON + (16#01E22#, 16#01E22#), -- LATIN CAPITAL LETTER H WITH DOT ABOVE .. LATIN CAPITAL LETTER H WITH DOT ABOVE + (16#01E24#, 16#01E24#), -- LATIN CAPITAL LETTER H WITH DOT BELOW .. LATIN CAPITAL LETTER H WITH DOT BELOW + (16#01E26#, 16#01E26#), -- LATIN CAPITAL LETTER H WITH DIAERESIS .. LATIN CAPITAL LETTER H WITH DIAERESIS + (16#01E28#, 16#01E28#), -- LATIN CAPITAL LETTER H WITH CEDILLA .. LATIN CAPITAL LETTER H WITH CEDILLA + (16#01E2A#, 16#01E2A#), -- LATIN CAPITAL LETTER H WITH BREVE BELOW .. LATIN CAPITAL LETTER H WITH BREVE BELOW + (16#01E2C#, 16#01E2C#), -- LATIN CAPITAL LETTER I WITH TILDE BELOW .. LATIN CAPITAL LETTER I WITH TILDE BELOW + (16#01E2E#, 16#01E2E#), -- LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE .. LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE + (16#01E30#, 16#01E30#), -- LATIN CAPITAL LETTER K WITH ACUTE .. LATIN CAPITAL LETTER K WITH ACUTE + (16#01E32#, 16#01E32#), -- LATIN CAPITAL LETTER K WITH DOT BELOW .. LATIN CAPITAL LETTER K WITH DOT BELOW + (16#01E34#, 16#01E34#), -- LATIN CAPITAL LETTER K WITH LINE BELOW .. LATIN CAPITAL LETTER K WITH LINE BELOW + (16#01E36#, 16#01E36#), -- LATIN CAPITAL LETTER L WITH DOT BELOW .. LATIN CAPITAL LETTER L WITH DOT BELOW + (16#01E38#, 16#01E38#), -- LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON .. LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON + (16#01E3A#, 16#01E3A#), -- LATIN CAPITAL LETTER L WITH LINE BELOW .. LATIN CAPITAL LETTER L WITH LINE BELOW + (16#01E3C#, 16#01E3C#), -- LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW + (16#01E3E#, 16#01E3E#), -- LATIN CAPITAL LETTER M WITH ACUTE .. LATIN CAPITAL LETTER M WITH ACUTE + (16#01E40#, 16#01E40#), -- LATIN CAPITAL LETTER M WITH DOT ABOVE .. LATIN CAPITAL LETTER M WITH DOT ABOVE + (16#01E42#, 16#01E42#), -- LATIN CAPITAL LETTER M WITH DOT BELOW .. LATIN CAPITAL LETTER M WITH DOT BELOW + (16#01E44#, 16#01E44#), -- LATIN CAPITAL LETTER N WITH DOT ABOVE .. LATIN CAPITAL LETTER N WITH DOT ABOVE + (16#01E46#, 16#01E46#), -- LATIN CAPITAL LETTER N WITH DOT BELOW .. LATIN CAPITAL LETTER N WITH DOT BELOW + (16#01E48#, 16#01E48#), -- LATIN CAPITAL LETTER N WITH LINE BELOW .. LATIN CAPITAL LETTER N WITH LINE BELOW + (16#01E4A#, 16#01E4A#), -- LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW + (16#01E4C#, 16#01E4C#), -- LATIN CAPITAL LETTER O WITH TILDE AND ACUTE .. LATIN CAPITAL LETTER O WITH TILDE AND ACUTE + (16#01E4E#, 16#01E4E#), -- LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS .. LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS + (16#01E50#, 16#01E50#), -- LATIN CAPITAL LETTER O WITH MACRON AND GRAVE .. LATIN CAPITAL LETTER O WITH MACRON AND GRAVE + (16#01E52#, 16#01E52#), -- LATIN CAPITAL LETTER O WITH MACRON AND ACUTE .. LATIN CAPITAL LETTER O WITH MACRON AND ACUTE + (16#01E54#, 16#01E54#), -- LATIN CAPITAL LETTER P WITH ACUTE .. LATIN CAPITAL LETTER P WITH ACUTE + (16#01E56#, 16#01E56#), -- LATIN CAPITAL LETTER P WITH DOT ABOVE .. LATIN CAPITAL LETTER P WITH DOT ABOVE + (16#01E58#, 16#01E58#), -- LATIN CAPITAL LETTER R WITH DOT ABOVE .. LATIN CAPITAL LETTER R WITH DOT ABOVE + (16#01E5A#, 16#01E5A#), -- LATIN CAPITAL LETTER R WITH DOT BELOW .. LATIN CAPITAL LETTER R WITH DOT BELOW + (16#01E5C#, 16#01E5C#), -- LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON .. LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON + (16#01E5E#, 16#01E5E#), -- LATIN CAPITAL LETTER R WITH LINE BELOW .. LATIN CAPITAL LETTER R WITH LINE BELOW + (16#01E60#, 16#01E60#), -- LATIN CAPITAL LETTER S WITH DOT ABOVE .. LATIN CAPITAL LETTER S WITH DOT ABOVE + (16#01E62#, 16#01E62#), -- LATIN CAPITAL LETTER S WITH DOT BELOW .. LATIN CAPITAL LETTER S WITH DOT BELOW + (16#01E64#, 16#01E64#), -- LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE .. LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE + (16#01E66#, 16#01E66#), -- LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE .. LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE + (16#01E68#, 16#01E68#), -- LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE .. LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE + (16#01E6A#, 16#01E6A#), -- LATIN CAPITAL LETTER T WITH DOT ABOVE .. LATIN CAPITAL LETTER T WITH DOT ABOVE + (16#01E6C#, 16#01E6C#), -- LATIN CAPITAL LETTER T WITH DOT BELOW .. LATIN CAPITAL LETTER T WITH DOT BELOW + (16#01E6E#, 16#01E6E#), -- LATIN CAPITAL LETTER T WITH LINE BELOW .. LATIN CAPITAL LETTER T WITH LINE BELOW + (16#01E70#, 16#01E70#), -- LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW + (16#01E72#, 16#01E72#), -- LATIN CAPITAL LETTER U WITH DIAERESIS BELOW .. LATIN CAPITAL LETTER U WITH DIAERESIS BELOW + (16#01E74#, 16#01E74#), -- LATIN CAPITAL LETTER U WITH TILDE BELOW .. LATIN CAPITAL LETTER U WITH TILDE BELOW + (16#01E76#, 16#01E76#), -- LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW + (16#01E78#, 16#01E78#), -- LATIN CAPITAL LETTER U WITH TILDE AND ACUTE .. LATIN CAPITAL LETTER U WITH TILDE AND ACUTE + (16#01E7A#, 16#01E7A#), -- LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS .. LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS + (16#01E7C#, 16#01E7C#), -- LATIN CAPITAL LETTER V WITH TILDE .. LATIN CAPITAL LETTER V WITH TILDE + (16#01E7E#, 16#01E7E#), -- LATIN CAPITAL LETTER V WITH DOT BELOW .. LATIN CAPITAL LETTER V WITH DOT BELOW + (16#01E80#, 16#01E80#), -- LATIN CAPITAL LETTER W WITH GRAVE .. LATIN CAPITAL LETTER W WITH GRAVE + (16#01E82#, 16#01E82#), -- LATIN CAPITAL LETTER W WITH ACUTE .. LATIN CAPITAL LETTER W WITH ACUTE + (16#01E84#, 16#01E84#), -- LATIN CAPITAL LETTER W WITH DIAERESIS .. LATIN CAPITAL LETTER W WITH DIAERESIS + (16#01E86#, 16#01E86#), -- LATIN CAPITAL LETTER W WITH DOT ABOVE .. LATIN CAPITAL LETTER W WITH DOT ABOVE + (16#01E88#, 16#01E88#), -- LATIN CAPITAL LETTER W WITH DOT BELOW .. LATIN CAPITAL LETTER W WITH DOT BELOW + (16#01E8A#, 16#01E8A#), -- LATIN CAPITAL LETTER X WITH DOT ABOVE .. LATIN CAPITAL LETTER X WITH DOT ABOVE + (16#01E8C#, 16#01E8C#), -- LATIN CAPITAL LETTER X WITH DIAERESIS .. LATIN CAPITAL LETTER X WITH DIAERESIS + (16#01E8E#, 16#01E8E#), -- LATIN CAPITAL LETTER Y WITH DOT ABOVE .. LATIN CAPITAL LETTER Y WITH DOT ABOVE + (16#01E90#, 16#01E90#), -- LATIN CAPITAL LETTER Z WITH CIRCUMFLEX .. LATIN CAPITAL LETTER Z WITH CIRCUMFLEX + (16#01E92#, 16#01E92#), -- LATIN CAPITAL LETTER Z WITH DOT BELOW .. LATIN CAPITAL LETTER Z WITH DOT BELOW + (16#01E94#, 16#01E94#), -- LATIN CAPITAL LETTER Z WITH LINE BELOW .. LATIN CAPITAL LETTER Z WITH LINE BELOW + (16#01EA0#, 16#01EA0#), -- LATIN CAPITAL LETTER A WITH DOT BELOW .. LATIN CAPITAL LETTER A WITH DOT BELOW + (16#01EA2#, 16#01EA2#), -- LATIN CAPITAL LETTER A WITH HOOK ABOVE .. LATIN CAPITAL LETTER A WITH HOOK ABOVE + (16#01EA4#, 16#01EA4#), -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE + (16#01EA6#, 16#01EA6#), -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE + (16#01EA8#, 16#01EA8#), -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE + (16#01EAA#, 16#01EAA#), -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE + (16#01EAC#, 16#01EAC#), -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW + (16#01EAE#, 16#01EAE#), -- LATIN CAPITAL LETTER A WITH BREVE AND ACUTE .. LATIN CAPITAL LETTER A WITH BREVE AND ACUTE + (16#01EB0#, 16#01EB0#), -- LATIN CAPITAL LETTER A WITH BREVE AND GRAVE .. LATIN CAPITAL LETTER A WITH BREVE AND GRAVE + (16#01EB2#, 16#01EB2#), -- LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE .. LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE + (16#01EB4#, 16#01EB4#), -- LATIN CAPITAL LETTER A WITH BREVE AND TILDE .. LATIN CAPITAL LETTER A WITH BREVE AND TILDE + (16#01EB6#, 16#01EB6#), -- LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW .. LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW + (16#01EB8#, 16#01EB8#), -- LATIN CAPITAL LETTER E WITH DOT BELOW .. LATIN CAPITAL LETTER E WITH DOT BELOW + (16#01EBA#, 16#01EBA#), -- LATIN CAPITAL LETTER E WITH HOOK ABOVE .. LATIN CAPITAL LETTER E WITH HOOK ABOVE + (16#01EBC#, 16#01EBC#), -- LATIN CAPITAL LETTER E WITH TILDE .. LATIN CAPITAL LETTER E WITH TILDE + (16#01EBE#, 16#01EBE#), -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE + (16#01EC0#, 16#01EC0#), -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE + (16#01EC2#, 16#01EC2#), -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE + (16#01EC4#, 16#01EC4#), -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE + (16#01EC6#, 16#01EC6#), -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW + (16#01EC8#, 16#01EC8#), -- LATIN CAPITAL LETTER I WITH HOOK ABOVE .. LATIN CAPITAL LETTER I WITH HOOK ABOVE + (16#01ECA#, 16#01ECA#), -- LATIN CAPITAL LETTER I WITH DOT BELOW .. LATIN CAPITAL LETTER I WITH DOT BELOW + (16#01ECC#, 16#01ECC#), -- LATIN CAPITAL LETTER O WITH DOT BELOW .. LATIN CAPITAL LETTER O WITH DOT BELOW + (16#01ECE#, 16#01ECE#), -- LATIN CAPITAL LETTER O WITH HOOK ABOVE .. LATIN CAPITAL LETTER O WITH HOOK ABOVE + (16#01ED0#, 16#01ED0#), -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE + (16#01ED2#, 16#01ED2#), -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE + (16#01ED4#, 16#01ED4#), -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE + (16#01ED6#, 16#01ED6#), -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE + (16#01ED8#, 16#01ED8#), -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW + (16#01EDA#, 16#01EDA#), -- LATIN CAPITAL LETTER O WITH HORN AND ACUTE .. LATIN CAPITAL LETTER O WITH HORN AND ACUTE + (16#01EDC#, 16#01EDC#), -- LATIN CAPITAL LETTER O WITH HORN AND GRAVE .. LATIN CAPITAL LETTER O WITH HORN AND GRAVE + (16#01EDE#, 16#01EDE#), -- LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE .. LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE + (16#01EE0#, 16#01EE0#), -- LATIN CAPITAL LETTER O WITH HORN AND TILDE .. LATIN CAPITAL LETTER O WITH HORN AND TILDE + (16#01EE2#, 16#01EE2#), -- LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW .. LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW + (16#01EE4#, 16#01EE4#), -- LATIN CAPITAL LETTER U WITH DOT BELOW .. LATIN CAPITAL LETTER U WITH DOT BELOW + (16#01EE6#, 16#01EE6#), -- LATIN CAPITAL LETTER U WITH HOOK ABOVE .. LATIN CAPITAL LETTER U WITH HOOK ABOVE + (16#01EE8#, 16#01EE8#), -- LATIN CAPITAL LETTER U WITH HORN AND ACUTE .. LATIN CAPITAL LETTER U WITH HORN AND ACUTE + (16#01EEA#, 16#01EEA#), -- LATIN CAPITAL LETTER U WITH HORN AND GRAVE .. LATIN CAPITAL LETTER U WITH HORN AND GRAVE + (16#01EEC#, 16#01EEC#), -- LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE .. LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE + (16#01EEE#, 16#01EEE#), -- LATIN CAPITAL LETTER U WITH HORN AND TILDE .. LATIN CAPITAL LETTER U WITH HORN AND TILDE + (16#01EF0#, 16#01EF0#), -- LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW .. LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW + (16#01EF2#, 16#01EF2#), -- LATIN CAPITAL LETTER Y WITH GRAVE .. LATIN CAPITAL LETTER Y WITH GRAVE + (16#01EF4#, 16#01EF4#), -- LATIN CAPITAL LETTER Y WITH DOT BELOW .. LATIN CAPITAL LETTER Y WITH DOT BELOW + (16#01EF6#, 16#01EF6#), -- LATIN CAPITAL LETTER Y WITH HOOK ABOVE .. LATIN CAPITAL LETTER Y WITH HOOK ABOVE + (16#01EF8#, 16#01EF8#), -- LATIN CAPITAL LETTER Y WITH TILDE .. LATIN CAPITAL LETTER Y WITH TILDE + (16#01F08#, 16#01F0F#), -- GREEK CAPITAL LETTER ALPHA WITH PSILI .. GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI + (16#01F18#, 16#01F1D#), -- GREEK CAPITAL LETTER EPSILON WITH PSILI .. GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA + (16#01F28#, 16#01F2F#), -- GREEK CAPITAL LETTER ETA WITH PSILI .. GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI + (16#01F38#, 16#01F3F#), -- GREEK CAPITAL LETTER IOTA WITH PSILI .. GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI + (16#01F48#, 16#01F4D#), -- GREEK CAPITAL LETTER OMICRON WITH PSILI .. GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA + (16#01F59#, 16#01F59#), -- GREEK CAPITAL LETTER UPSILON WITH DASIA .. GREEK CAPITAL LETTER UPSILON WITH DASIA + (16#01F5B#, 16#01F5B#), -- GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA .. GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA + (16#01F5D#, 16#01F5D#), -- GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA .. GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA + (16#01F5F#, 16#01F5F#), -- GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI .. GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI + (16#01F68#, 16#01F6F#), -- GREEK CAPITAL LETTER OMEGA WITH PSILI .. GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI + (16#01FB8#, 16#01FB9#), -- GREEK CAPITAL LETTER ALPHA WITH VRACHY .. GREEK CAPITAL LETTER ALPHA WITH MACRON + (16#01FBA#, 16#01FBB#), -- GREEK CAPITAL LETTER ALPHA WITH VARIA .. GREEK CAPITAL LETTER ALPHA WITH OXIA + (16#01FC8#, 16#01FCB#), -- GREEK CAPITAL LETTER EPSILON WITH VARIA .. GREEK CAPITAL LETTER ETA WITH OXIA + (16#01FD8#, 16#01FD9#), -- GREEK CAPITAL LETTER IOTA WITH VRACHY .. GREEK CAPITAL LETTER IOTA WITH MACRON + (16#01FDA#, 16#01FDB#), -- GREEK CAPITAL LETTER IOTA WITH VARIA .. GREEK CAPITAL LETTER IOTA WITH OXIA + (16#01FE8#, 16#01FE9#), -- GREEK CAPITAL LETTER UPSILON WITH VRACHY .. GREEK CAPITAL LETTER UPSILON WITH MACRON + (16#01FEA#, 16#01FEB#), -- GREEK CAPITAL LETTER UPSILON WITH VARIA .. GREEK CAPITAL LETTER UPSILON WITH OXIA + (16#01FEC#, 16#01FEC#), -- GREEK CAPITAL LETTER RHO WITH DASIA .. GREEK CAPITAL LETTER RHO WITH DASIA + (16#01FF8#, 16#01FF9#), -- GREEK CAPITAL LETTER OMICRON WITH VARIA .. GREEK CAPITAL LETTER OMICRON WITH OXIA + (16#01FFA#, 16#01FFB#), -- GREEK CAPITAL LETTER OMEGA WITH VARIA .. GREEK CAPITAL LETTER OMEGA WITH OXIA + (16#024B6#, 16#024CF#), -- CIRCLED LATIN CAPITAL LETTER A .. CIRCLED LATIN CAPITAL LETTER Z + (16#0FF21#, 16#0FF3A#), -- FULLWIDTH LATIN CAPITAL LETTER A .. FULLWIDTH LATIN CAPITAL LETTER Z + (16#10400#, 16#10427#), -- DESERET CAPITAL LETTER LONG I .. DESERET CAPITAL LETTER EW + (16#E0041#, 16#E005A#)); -- TAG LATIN CAPITAL LETTER A .. TAG LATIN CAPITAL LETTER Z + + Upper_Case_Adjust : constant array (Lower_Case_Letters'Range) + of UTF_32'Base := ( + 32, -- LATIN CAPITAL LETTER A .. LATIN CAPITAL LETTER Z + 32, -- LATIN CAPITAL LETTER A WITH GRAVE .. LATIN CAPITAL LETTER O WITH DIAERESIS + 32, -- LATIN CAPITAL LETTER O WITH STROKE .. LATIN CAPITAL LETTER THORN + 1, -- LATIN CAPITAL LETTER A WITH MACRON .. LATIN CAPITAL LETTER A WITH MACRON + 1, -- LATIN CAPITAL LETTER A WITH BREVE .. LATIN CAPITAL LETTER A WITH BREVE + 1, -- LATIN CAPITAL LETTER A WITH OGONEK .. LATIN CAPITAL LETTER A WITH OGONEK + 1, -- LATIN CAPITAL LETTER C WITH ACUTE .. LATIN CAPITAL LETTER C WITH ACUTE + 1, -- LATIN CAPITAL LETTER C WITH CIRCUMFLEX .. LATIN CAPITAL LETTER C WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER C WITH DOT ABOVE .. LATIN CAPITAL LETTER C WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER C WITH CARON .. LATIN CAPITAL LETTER C WITH CARON + 1, -- LATIN CAPITAL LETTER D WITH CARON .. LATIN CAPITAL LETTER D WITH CARON + 1, -- LATIN CAPITAL LETTER D WITH STROKE .. LATIN CAPITAL LETTER D WITH STROKE + 1, -- LATIN CAPITAL LETTER E WITH MACRON .. LATIN CAPITAL LETTER E WITH MACRON + 1, -- LATIN CAPITAL LETTER E WITH BREVE .. LATIN CAPITAL LETTER E WITH BREVE + 1, -- LATIN CAPITAL LETTER E WITH DOT ABOVE .. LATIN CAPITAL LETTER E WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER E WITH OGONEK .. LATIN CAPITAL LETTER E WITH OGONEK + 1, -- LATIN CAPITAL LETTER E WITH CARON .. LATIN CAPITAL LETTER E WITH CARON + 1, -- LATIN CAPITAL LETTER G WITH CIRCUMFLEX .. LATIN CAPITAL LETTER G WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER G WITH BREVE .. LATIN CAPITAL LETTER G WITH BREVE + 1, -- LATIN CAPITAL LETTER G WITH DOT ABOVE .. LATIN CAPITAL LETTER G WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER G WITH CEDILLA .. LATIN CAPITAL LETTER G WITH CEDILLA + 1, -- LATIN CAPITAL LETTER H WITH CIRCUMFLEX .. LATIN CAPITAL LETTER H WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER H WITH STROKE .. LATIN CAPITAL LETTER H WITH STROKE + 1, -- LATIN CAPITAL LETTER I WITH TILDE .. LATIN CAPITAL LETTER I WITH TILDE + 1, -- LATIN CAPITAL LETTER I WITH MACRON .. LATIN CAPITAL LETTER I WITH MACRON + 1, -- LATIN CAPITAL LETTER I WITH BREVE .. LATIN CAPITAL LETTER I WITH BREVE + 1, -- LATIN CAPITAL LETTER I WITH OGONEK .. LATIN CAPITAL LETTER I WITH OGONEK + 1, -- LATIN CAPITAL LETTER I J .. LATIN CAPITAL LETTER I J + 1, -- LATIN CAPITAL LETTER J WITH CIRCUMFLEX .. LATIN CAPITAL LETTER J WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER K WITH CEDILLA .. LATIN CAPITAL LETTER K WITH CEDILLA + 1, -- LATIN CAPITAL LETTER L WITH ACUTE .. LATIN CAPITAL LETTER L WITH ACUTE + 1, -- LATIN CAPITAL LETTER L WITH CEDILLA .. LATIN CAPITAL LETTER L WITH CEDILLA + 1, -- LATIN CAPITAL LETTER L WITH CARON .. LATIN CAPITAL LETTER L WITH CARON + 1, -- LATIN CAPITAL LETTER L WITH MIDDLE DOT .. LATIN CAPITAL LETTER L WITH MIDDLE DOT + 1, -- LATIN CAPITAL LETTER L WITH STROKE .. LATIN CAPITAL LETTER L WITH STROKE + 1, -- LATIN CAPITAL LETTER N WITH ACUTE .. LATIN CAPITAL LETTER N WITH ACUTE + 1, -- LATIN CAPITAL LETTER N WITH CEDILLA .. LATIN CAPITAL LETTER N WITH CEDILLA + 1, -- LATIN CAPITAL LETTER N WITH CARON .. LATIN CAPITAL LETTER N WITH CARON + 1, -- LATIN CAPITAL LETTER ENG .. LATIN CAPITAL LETTER ENG + 1, -- LATIN CAPITAL LETTER O WITH MACRON .. LATIN CAPITAL LETTER O WITH MACRON + 1, -- LATIN CAPITAL LETTER O WITH BREVE .. LATIN CAPITAL LETTER O WITH BREVE + 1, -- LATIN CAPITAL LETTER O WITH DOUBLE ACUTE .. LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + 1, -- LATIN CAPITAL LETTER O E .. LATIN CAPITAL LETTER O E + 1, -- LATIN CAPITAL LETTER R WITH ACUTE .. LATIN CAPITAL LETTER R WITH ACUTE + 1, -- LATIN CAPITAL LETTER R WITH CEDILLA .. LATIN CAPITAL LETTER R WITH CEDILLA + 1, -- LATIN CAPITAL LETTER R WITH CARON .. LATIN CAPITAL LETTER R WITH CARON + 1, -- LATIN CAPITAL LETTER S WITH ACUTE .. LATIN CAPITAL LETTER S WITH ACUTE + 1, -- LATIN CAPITAL LETTER S WITH CIRCUMFLEX .. LATIN CAPITAL LETTER S WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER S WITH CEDILLA .. LATIN CAPITAL LETTER S WITH CEDILLA + 1, -- LATIN CAPITAL LETTER S WITH CARON .. LATIN CAPITAL LETTER S WITH CARON + 1, -- LATIN CAPITAL LETTER T WITH CEDILLA .. LATIN CAPITAL LETTER T WITH CEDILLA + 1, -- LATIN CAPITAL LETTER T WITH CARON .. LATIN CAPITAL LETTER T WITH CARON + 1, -- LATIN CAPITAL LETTER T WITH STROKE .. LATIN CAPITAL LETTER T WITH STROKE + 1, -- LATIN CAPITAL LETTER U WITH TILDE .. LATIN CAPITAL LETTER U WITH TILDE + 1, -- LATIN CAPITAL LETTER U WITH MACRON .. LATIN CAPITAL LETTER U WITH MACRON + 1, -- LATIN CAPITAL LETTER U WITH BREVE .. LATIN CAPITAL LETTER U WITH BREVE + 1, -- LATIN CAPITAL LETTER U WITH RING ABOVE .. LATIN CAPITAL LETTER U WITH RING ABOVE + 1, -- LATIN CAPITAL LETTER U WITH DOUBLE ACUTE .. LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + 1, -- LATIN CAPITAL LETTER U WITH OGONEK .. LATIN CAPITAL LETTER U WITH OGONEK + 1, -- LATIN CAPITAL LETTER W WITH CIRCUMFLEX .. LATIN CAPITAL LETTER W WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER Y WITH CIRCUMFLEX .. LATIN CAPITAL LETTER Y WITH CIRCUMFLEX + -121, -- LATIN CAPITAL LETTER Y WITH DIAERESIS .. LATIN CAPITAL LETTER Y WITH DIAERESIS + 1, -- LATIN CAPITAL LETTER Z WITH ACUTE .. LATIN CAPITAL LETTER Z WITH ACUTE + 1, -- LATIN CAPITAL LETTER Z WITH DOT ABOVE .. LATIN CAPITAL LETTER Z WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER Z WITH CARON .. LATIN CAPITAL LETTER Z WITH CARON + 210, -- LATIN CAPITAL LETTER B WITH HOOK .. LATIN CAPITAL LETTER B WITH HOOK + 1, -- LATIN CAPITAL LETTER B WITH TOPBAR .. LATIN CAPITAL LETTER B WITH TOPBAR + 1, -- LATIN CAPITAL LETTER TONE SIX .. LATIN CAPITAL LETTER TONE SIX + 206, -- LATIN CAPITAL LETTER OPEN O .. LATIN CAPITAL LETTER OPEN O + 1, -- LATIN CAPITAL LETTER C WITH HOOK .. LATIN CAPITAL LETTER C WITH HOOK + 205, -- LATIN CAPITAL LETTER D WITH HOOK .. LATIN CAPITAL LETTER D WITH HOOK + 1, -- LATIN CAPITAL LETTER D WITH TOPBAR .. LATIN CAPITAL LETTER D WITH TOPBAR + 202, -- LATIN CAPITAL LETTER REVERSED E .. LATIN CAPITAL LETTER SCHWA + 203, -- LATIN CAPITAL LETTER OPEN E .. LATIN CAPITAL LETTER OPEN E + 1, -- LATIN CAPITAL LETTER F WITH HOOK .. LATIN CAPITAL LETTER F WITH HOOK + 205, -- LATIN CAPITAL LETTER G WITH HOOK .. LATIN CAPITAL LETTER G WITH HOOK + 207, -- LATIN CAPITAL LETTER GAMMA .. LATIN CAPITAL LETTER GAMMA + 211, -- LATIN CAPITAL LETTER IOTA .. LATIN CAPITAL LETTER IOTA + 209, -- LATIN CAPITAL LETTER I WITH STROKE .. LATIN CAPITAL LETTER I WITH STROKE + 1, -- LATIN CAPITAL LETTER K WITH HOOK .. LATIN CAPITAL LETTER K WITH HOOK + 211, -- LATIN CAPITAL LETTER TURNED M .. LATIN CAPITAL LETTER TURNED M + 213, -- LATIN CAPITAL LETTER N WITH LEFT HOOK .. LATIN CAPITAL LETTER N WITH LEFT HOOK + 1, -- LATIN CAPITAL LETTER O WITH HORN .. LATIN CAPITAL LETTER O WITH HORN + 1, -- LATIN CAPITAL LETTER OI .. LATIN CAPITAL LETTER OI + 1, -- LATIN CAPITAL LETTER P WITH HOOK .. LATIN CAPITAL LETTER P WITH HOOK + 1, -- LATIN CAPITAL LETTER TONE TWO .. LATIN CAPITAL LETTER TONE TWO + 218, -- LATIN CAPITAL LETTER ESH .. LATIN CAPITAL LETTER ESH + 1, -- LATIN CAPITAL LETTER T WITH HOOK .. LATIN CAPITAL LETTER T WITH HOOK + 218, -- LATIN CAPITAL LETTER T WITH RETROFLEX HOOK .. LATIN CAPITAL LETTER T WITH RETROFLEX HOOK + 1, -- LATIN CAPITAL LETTER U WITH HORN .. LATIN CAPITAL LETTER U WITH HORN + 217, -- LATIN CAPITAL LETTER UPSILON .. LATIN CAPITAL LETTER V WITH HOOK + 1, -- LATIN CAPITAL LETTER Y WITH HOOK .. LATIN CAPITAL LETTER Y WITH HOOK + 1, -- LATIN CAPITAL LETTER Z WITH STROKE .. LATIN CAPITAL LETTER Z WITH STROKE + 219, -- LATIN CAPITAL LETTER EZH .. LATIN CAPITAL LETTER EZH + 1, -- LATIN CAPITAL LETTER EZH REVERSED .. LATIN CAPITAL LETTER EZH REVERSED + 1, -- LATIN CAPITAL LETTER TONE FIVE .. LATIN CAPITAL LETTER TONE FIVE + 2, -- LATIN CAPITAL LETTER DZ WITH CARON .. LATIN CAPITAL LETTER DZ WITH CARON + 2, -- LATIN CAPITAL LETTER LJ .. LATIN CAPITAL LETTER LJ + 2, -- LATIN CAPITAL LETTER NJ .. LATIN CAPITAL LETTER NJ + 1, -- LATIN CAPITAL LETTER A WITH CARON .. LATIN CAPITAL LETTER A WITH CARON + 1, -- LATIN CAPITAL LETTER I WITH CARON .. LATIN CAPITAL LETTER I WITH CARON + 1, -- LATIN CAPITAL LETTER O WITH CARON .. LATIN CAPITAL LETTER O WITH CARON + 1, -- LATIN CAPITAL LETTER U WITH CARON .. LATIN CAPITAL LETTER U WITH CARON + 1, -- LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON .. LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON + 1, -- LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE .. LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE + 1, -- LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON .. LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON + 1, -- LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE .. LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE + 1, -- LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON .. LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON + 1, -- LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON .. LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON + 1, -- LATIN CAPITAL LETTER AE WITH MACRON .. LATIN CAPITAL LETTER AE WITH MACRON + 1, -- LATIN CAPITAL LETTER G WITH STROKE .. LATIN CAPITAL LETTER G WITH STROKE + 1, -- LATIN CAPITAL LETTER G WITH CARON .. LATIN CAPITAL LETTER G WITH CARON + 1, -- LATIN CAPITAL LETTER K WITH CARON .. LATIN CAPITAL LETTER K WITH CARON + 1, -- LATIN CAPITAL LETTER O WITH OGONEK .. LATIN CAPITAL LETTER O WITH OGONEK + 1, -- LATIN CAPITAL LETTER O WITH OGONEK AND MACRON .. LATIN CAPITAL LETTER O WITH OGONEK AND MACRON + 1, -- LATIN CAPITAL LETTER EZH WITH CARON .. LATIN CAPITAL LETTER EZH WITH CARON + 2, -- LATIN CAPITAL LETTER DZ .. LATIN CAPITAL LETTER DZ + 1, -- LATIN CAPITAL LETTER G WITH ACUTE .. LATIN CAPITAL LETTER G WITH ACUTE + 1, -- LATIN CAPITAL LETTER N WITH GRAVE .. LATIN CAPITAL LETTER N WITH GRAVE + 1, -- LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE .. LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE + 1, -- LATIN CAPITAL LETTER AE WITH ACUTE .. LATIN CAPITAL LETTER AE WITH ACUTE + 1, -- LATIN CAPITAL LETTER O WITH STROKE AND ACUTE .. LATIN CAPITAL LETTER O WITH STROKE AND ACUTE + 1, -- LATIN CAPITAL LETTER A WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER A WITH DOUBLE GRAVE + 1, -- LATIN CAPITAL LETTER A WITH INVERTED BREVE .. LATIN CAPITAL LETTER A WITH INVERTED BREVE + 1, -- LATIN CAPITAL LETTER E WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER E WITH DOUBLE GRAVE + 1, -- LATIN CAPITAL LETTER E WITH INVERTED BREVE .. LATIN CAPITAL LETTER E WITH INVERTED BREVE + 1, -- LATIN CAPITAL LETTER I WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER I WITH DOUBLE GRAVE + 1, -- LATIN CAPITAL LETTER I WITH INVERTED BREVE .. LATIN CAPITAL LETTER I WITH INVERTED BREVE + 1, -- LATIN CAPITAL LETTER O WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER O WITH DOUBLE GRAVE + 1, -- LATIN CAPITAL LETTER O WITH INVERTED BREVE .. LATIN CAPITAL LETTER O WITH INVERTED BREVE + 1, -- LATIN CAPITAL LETTER R WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER R WITH DOUBLE GRAVE + 1, -- LATIN CAPITAL LETTER R WITH INVERTED BREVE .. LATIN CAPITAL LETTER R WITH INVERTED BREVE + 1, -- LATIN CAPITAL LETTER U WITH DOUBLE GRAVE .. LATIN CAPITAL LETTER U WITH DOUBLE GRAVE + 1, -- LATIN CAPITAL LETTER U WITH INVERTED BREVE .. LATIN CAPITAL LETTER U WITH INVERTED BREVE + 1, -- LATIN CAPITAL LETTER S WITH COMMA BELOW .. LATIN CAPITAL LETTER S WITH COMMA BELOW + 1, -- LATIN CAPITAL LETTER T WITH COMMA BELOW .. LATIN CAPITAL LETTER T WITH COMMA BELOW + 1, -- LATIN CAPITAL LETTER YOGH .. LATIN CAPITAL LETTER YOGH + 1, -- LATIN CAPITAL LETTER H WITH CARON .. LATIN CAPITAL LETTER H WITH CARON + -130, -- LATIN CAPITAL LETTER N WITH LONG RIGHT LEG .. LATIN CAPITAL LETTER N WITH LONG RIGHT LEG + 1, -- LATIN CAPITAL LETTER OU .. LATIN CAPITAL LETTER OU + 1, -- LATIN CAPITAL LETTER Z WITH HOOK .. LATIN CAPITAL LETTER Z WITH HOOK + 1, -- LATIN CAPITAL LETTER A WITH DOT ABOVE .. LATIN CAPITAL LETTER A WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER E WITH CEDILLA .. LATIN CAPITAL LETTER E WITH CEDILLA + 1, -- LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON .. LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON + 1, -- LATIN CAPITAL LETTER O WITH TILDE AND MACRON .. LATIN CAPITAL LETTER O WITH TILDE AND MACRON + 1, -- LATIN CAPITAL LETTER O WITH DOT ABOVE .. LATIN CAPITAL LETTER O WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON .. LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON + 1, -- LATIN CAPITAL LETTER Y WITH MACRON .. LATIN CAPITAL LETTER Y WITH MACRON + 38, -- GREEK CAPITAL LETTER ALPHA WITH TONOS .. GREEK CAPITAL LETTER ALPHA WITH TONOS + 37, -- GREEK CAPITAL LETTER EPSILON WITH TONOS .. GREEK CAPITAL LETTER IOTA WITH TONOS + 64, -- GREEK CAPITAL LETTER OMICRON WITH TONOS .. GREEK CAPITAL LETTER OMICRON WITH TONOS + 63, -- GREEK CAPITAL LETTER UPSILON WITH TONOS .. GREEK CAPITAL LETTER OMEGA WITH TONOS + 32, -- GREEK CAPITAL LETTER ALPHA .. GREEK CAPITAL LETTER RHO + 32, -- GREEK CAPITAL LETTER SIGMA .. GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + 1, -- GREEK CAPITAL LETTER STIGMA .. GREEK CAPITAL LETTER STIGMA + 1, -- GREEK CAPITAL LETTER DIGAMMA .. GREEK CAPITAL LETTER DIGAMMA + 1, -- GREEK CAPITAL LETTER KOPPA .. GREEK CAPITAL LETTER KOPPA + 1, -- GREEK CAPITAL LETTER SAMPI .. GREEK CAPITAL LETTER SAMPI + 1, -- COPTIC CAPITAL LETTER SHEI .. COPTIC CAPITAL LETTER SHEI + 1, -- COPTIC CAPITAL LETTER FEI .. COPTIC CAPITAL LETTER FEI + 1, -- COPTIC CAPITAL LETTER KHEI .. COPTIC CAPITAL LETTER KHEI + 1, -- COPTIC CAPITAL LETTER HORI .. COPTIC CAPITAL LETTER HORI + 1, -- COPTIC CAPITAL LETTER GANGIA .. COPTIC CAPITAL LETTER GANGIA + 1, -- COPTIC CAPITAL LETTER SHIMA .. COPTIC CAPITAL LETTER SHIMA + 1, -- COPTIC CAPITAL LETTER DEI .. COPTIC CAPITAL LETTER DEI + 1, -- GREEK CAPITAL LETTER SHO .. GREEK CAPITAL LETTER SHO + 1, -- GREEK CAPITAL LETTER SAN .. GREEK CAPITAL LETTER SAN + 80, -- CYRILLIC CAPITAL LETTER IE WITH GRAVE .. CYRILLIC CAPITAL LETTER DZHE + 32, -- CYRILLIC CAPITAL LETTER A .. CYRILLIC CAPITAL LETTER YA + 1, -- CYRILLIC CAPITAL LETTER OMEGA .. CYRILLIC CAPITAL LETTER OMEGA + 1, -- CYRILLIC CAPITAL LETTER YAT .. CYRILLIC CAPITAL LETTER YAT + 1, -- CYRILLIC CAPITAL LETTER IOTIFIED E .. CYRILLIC CAPITAL LETTER IOTIFIED E + 1, -- CYRILLIC CAPITAL LETTER LITTLE YUS .. CYRILLIC CAPITAL LETTER LITTLE YUS + 1, -- CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS .. CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS + 1, -- CYRILLIC CAPITAL LETTER BIG YUS .. CYRILLIC CAPITAL LETTER BIG YUS + 1, -- CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS .. CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS + 1, -- CYRILLIC CAPITAL LETTER KSI .. CYRILLIC CAPITAL LETTER KSI + 1, -- CYRILLIC CAPITAL LETTER PSI .. CYRILLIC CAPITAL LETTER PSI + 1, -- CYRILLIC CAPITAL LETTER FITA .. CYRILLIC CAPITAL LETTER FITA + 1, -- CYRILLIC CAPITAL LETTER IZHITSA .. CYRILLIC CAPITAL LETTER IZHITSA + 1, -- CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT .. CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT + 1, -- CYRILLIC CAPITAL LETTER UK .. CYRILLIC CAPITAL LETTER UK + 1, -- CYRILLIC CAPITAL LETTER ROUND OMEGA .. CYRILLIC CAPITAL LETTER ROUND OMEGA + 1, -- CYRILLIC CAPITAL LETTER OMEGA WITH TITLO .. CYRILLIC CAPITAL LETTER OMEGA WITH TITLO + 1, -- CYRILLIC CAPITAL LETTER OT .. CYRILLIC CAPITAL LETTER OT + 1, -- CYRILLIC CAPITAL LETTER KOPPA .. CYRILLIC CAPITAL LETTER KOPPA + 1, -- CYRILLIC CAPITAL LETTER SHORT I WITH TAIL .. CYRILLIC CAPITAL LETTER SHORT I WITH TAIL + 1, -- CYRILLIC CAPITAL LETTER SEMISOFT SIGN .. CYRILLIC CAPITAL LETTER SEMISOFT SIGN + 1, -- CYRILLIC CAPITAL LETTER ER WITH TICK .. CYRILLIC CAPITAL LETTER ER WITH TICK + 1, -- CYRILLIC CAPITAL LETTER GHE WITH UPTURN .. CYRILLIC CAPITAL LETTER GHE WITH UPTURN + 1, -- CYRILLIC CAPITAL LETTER GHE WITH STROKE .. CYRILLIC CAPITAL LETTER GHE WITH STROKE + 1, -- CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK .. CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK + 1, -- CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER .. CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER ZE WITH DESCENDER .. CYRILLIC CAPITAL LETTER ZE WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER KA WITH DESCENDER .. CYRILLIC CAPITAL LETTER KA WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE .. CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE + 1, -- CYRILLIC CAPITAL LETTER KA WITH STROKE .. CYRILLIC CAPITAL LETTER KA WITH STROKE + 1, -- CYRILLIC CAPITAL LETTER BASHKIR KA .. CYRILLIC CAPITAL LETTER BASHKIR KA + 1, -- CYRILLIC CAPITAL LETTER EN WITH DESCENDER .. CYRILLIC CAPITAL LETTER EN WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER EN GE .. CYRILLIC CAPITAL LETTER EN GE + 1, -- CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK .. CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK + 1, -- CYRILLIC CAPITAL LETTER ABKHASIAN HA .. CYRILLIC CAPITAL LETTER ABKHASIAN HA + 1, -- CYRILLIC CAPITAL LETTER ES WITH DESCENDER .. CYRILLIC CAPITAL LETTER ES WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER TE WITH DESCENDER .. CYRILLIC CAPITAL LETTER TE WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER STRAIGHT U .. CYRILLIC CAPITAL LETTER STRAIGHT U + 1, -- CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE .. CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE + 1, -- CYRILLIC CAPITAL LETTER HA WITH DESCENDER .. CYRILLIC CAPITAL LETTER HA WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER TE TSE .. CYRILLIC CAPITAL LETTER TE TSE + 1, -- CYRILLIC CAPITAL LETTER CHE WITH DESCENDER .. CYRILLIC CAPITAL LETTER CHE WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE .. CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE + 1, -- CYRILLIC CAPITAL LETTER SHHA .. CYRILLIC CAPITAL LETTER SHHA + 1, -- CYRILLIC CAPITAL LETTER ABKHASIAN CHE .. CYRILLIC CAPITAL LETTER ABKHASIAN CHE + 1, -- CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER .. CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER + 1, -- CYRILLIC CAPITAL LETTER ZHE WITH BREVE .. CYRILLIC CAPITAL LETTER ZHE WITH BREVE + 1, -- CYRILLIC CAPITAL LETTER KA WITH HOOK .. CYRILLIC CAPITAL LETTER KA WITH HOOK + 1, -- CYRILLIC CAPITAL LETTER EL WITH TAIL .. CYRILLIC CAPITAL LETTER EL WITH TAIL + 1, -- CYRILLIC CAPITAL LETTER EN WITH HOOK .. CYRILLIC CAPITAL LETTER EN WITH HOOK + 1, -- CYRILLIC CAPITAL LETTER EN WITH TAIL .. CYRILLIC CAPITAL LETTER EN WITH TAIL + 1, -- CYRILLIC CAPITAL LETTER KHAKASSIAN CHE .. CYRILLIC CAPITAL LETTER KHAKASSIAN CHE + 1, -- CYRILLIC CAPITAL LETTER EM WITH TAIL .. CYRILLIC CAPITAL LETTER EM WITH TAIL + 1, -- CYRILLIC CAPITAL LETTER A WITH BREVE .. CYRILLIC CAPITAL LETTER A WITH BREVE + 1, -- CYRILLIC CAPITAL LETTER A WITH DIAERESIS .. CYRILLIC CAPITAL LETTER A WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER IE WITH BREVE .. CYRILLIC CAPITAL LETTER IE WITH BREVE + 1, -- CYRILLIC CAPITAL LETTER SCHWA .. CYRILLIC CAPITAL LETTER SCHWA + 1, -- CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS .. CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS .. CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS .. CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER ABKHASIAN DZE .. CYRILLIC CAPITAL LETTER ABKHASIAN DZE + 1, -- CYRILLIC CAPITAL LETTER I WITH MACRON .. CYRILLIC CAPITAL LETTER I WITH MACRON + 1, -- CYRILLIC CAPITAL LETTER I WITH DIAERESIS .. CYRILLIC CAPITAL LETTER I WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER O WITH DIAERESIS .. CYRILLIC CAPITAL LETTER O WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER BARRED O .. CYRILLIC CAPITAL LETTER BARRED O + 1, -- CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS .. CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER E WITH DIAERESIS .. CYRILLIC CAPITAL LETTER E WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER U WITH MACRON .. CYRILLIC CAPITAL LETTER U WITH MACRON + 1, -- CYRILLIC CAPITAL LETTER U WITH DIAERESIS .. CYRILLIC CAPITAL LETTER U WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE .. CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE + 1, -- CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS .. CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS .. CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS + 1, -- CYRILLIC CAPITAL LETTER KOMI DE .. CYRILLIC CAPITAL LETTER KOMI DE + 1, -- CYRILLIC CAPITAL LETTER KOMI DJE .. CYRILLIC CAPITAL LETTER KOMI DJE + 1, -- CYRILLIC CAPITAL LETTER KOMI ZJE .. CYRILLIC CAPITAL LETTER KOMI ZJE + 1, -- CYRILLIC CAPITAL LETTER KOMI DZJE .. CYRILLIC CAPITAL LETTER KOMI DZJE + 1, -- CYRILLIC CAPITAL LETTER KOMI LJE .. CYRILLIC CAPITAL LETTER KOMI LJE + 1, -- CYRILLIC CAPITAL LETTER KOMI NJE .. CYRILLIC CAPITAL LETTER KOMI NJE + 1, -- CYRILLIC CAPITAL LETTER KOMI SJE .. CYRILLIC CAPITAL LETTER KOMI SJE + 1, -- CYRILLIC CAPITAL LETTER KOMI TJE .. CYRILLIC CAPITAL LETTER KOMI TJE + 48, -- ARMENIAN CAPITAL LETTER AYB .. ARMENIAN CAPITAL LETTER FEH + 48, -- GEORGIAN CAPITAL LETTER AN .. GEORGIAN CAPITAL LETTER HOE + 1, -- LATIN CAPITAL LETTER A WITH RING BELOW .. LATIN CAPITAL LETTER A WITH RING BELOW + 1, -- LATIN CAPITAL LETTER B WITH DOT ABOVE .. LATIN CAPITAL LETTER B WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER B WITH DOT BELOW .. LATIN CAPITAL LETTER B WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER B WITH LINE BELOW .. LATIN CAPITAL LETTER B WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE .. LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE + 1, -- LATIN CAPITAL LETTER D WITH DOT ABOVE .. LATIN CAPITAL LETTER D WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER D WITH DOT BELOW .. LATIN CAPITAL LETTER D WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER D WITH LINE BELOW .. LATIN CAPITAL LETTER D WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER D WITH CEDILLA .. LATIN CAPITAL LETTER D WITH CEDILLA + 1, -- LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW + 1, -- LATIN CAPITAL LETTER E WITH MACRON AND GRAVE .. LATIN CAPITAL LETTER E WITH MACRON AND GRAVE + 1, -- LATIN CAPITAL LETTER E WITH MACRON AND ACUTE .. LATIN CAPITAL LETTER E WITH MACRON AND ACUTE + 1, -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW + 1, -- LATIN CAPITAL LETTER E WITH TILDE BELOW .. LATIN CAPITAL LETTER E WITH TILDE BELOW + 1, -- LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE .. LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE + 1, -- LATIN CAPITAL LETTER F WITH DOT ABOVE .. LATIN CAPITAL LETTER F WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER G WITH MACRON .. LATIN CAPITAL LETTER G WITH MACRON + 1, -- LATIN CAPITAL LETTER H WITH DOT ABOVE .. LATIN CAPITAL LETTER H WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER H WITH DOT BELOW .. LATIN CAPITAL LETTER H WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER H WITH DIAERESIS .. LATIN CAPITAL LETTER H WITH DIAERESIS + 1, -- LATIN CAPITAL LETTER H WITH CEDILLA .. LATIN CAPITAL LETTER H WITH CEDILLA + 1, -- LATIN CAPITAL LETTER H WITH BREVE BELOW .. LATIN CAPITAL LETTER H WITH BREVE BELOW + 1, -- LATIN CAPITAL LETTER I WITH TILDE BELOW .. LATIN CAPITAL LETTER I WITH TILDE BELOW + 1, -- LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE .. LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE + 1, -- LATIN CAPITAL LETTER K WITH ACUTE .. LATIN CAPITAL LETTER K WITH ACUTE + 1, -- LATIN CAPITAL LETTER K WITH DOT BELOW .. LATIN CAPITAL LETTER K WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER K WITH LINE BELOW .. LATIN CAPITAL LETTER K WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER L WITH DOT BELOW .. LATIN CAPITAL LETTER L WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON .. LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON + 1, -- LATIN CAPITAL LETTER L WITH LINE BELOW .. LATIN CAPITAL LETTER L WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW + 1, -- LATIN CAPITAL LETTER M WITH ACUTE .. LATIN CAPITAL LETTER M WITH ACUTE + 1, -- LATIN CAPITAL LETTER M WITH DOT ABOVE .. LATIN CAPITAL LETTER M WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER M WITH DOT BELOW .. LATIN CAPITAL LETTER M WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER N WITH DOT ABOVE .. LATIN CAPITAL LETTER N WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER N WITH DOT BELOW .. LATIN CAPITAL LETTER N WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER N WITH LINE BELOW .. LATIN CAPITAL LETTER N WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW + 1, -- LATIN CAPITAL LETTER O WITH TILDE AND ACUTE .. LATIN CAPITAL LETTER O WITH TILDE AND ACUTE + 1, -- LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS .. LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS + 1, -- LATIN CAPITAL LETTER O WITH MACRON AND GRAVE .. LATIN CAPITAL LETTER O WITH MACRON AND GRAVE + 1, -- LATIN CAPITAL LETTER O WITH MACRON AND ACUTE .. LATIN CAPITAL LETTER O WITH MACRON AND ACUTE + 1, -- LATIN CAPITAL LETTER P WITH ACUTE .. LATIN CAPITAL LETTER P WITH ACUTE + 1, -- LATIN CAPITAL LETTER P WITH DOT ABOVE .. LATIN CAPITAL LETTER P WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER R WITH DOT ABOVE .. LATIN CAPITAL LETTER R WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER R WITH DOT BELOW .. LATIN CAPITAL LETTER R WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON .. LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON + 1, -- LATIN CAPITAL LETTER R WITH LINE BELOW .. LATIN CAPITAL LETTER R WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER S WITH DOT ABOVE .. LATIN CAPITAL LETTER S WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER S WITH DOT BELOW .. LATIN CAPITAL LETTER S WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE .. LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE + 1, -- LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE .. LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE + 1, -- LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE .. LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE + 1, -- LATIN CAPITAL LETTER T WITH DOT ABOVE .. LATIN CAPITAL LETTER T WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER T WITH DOT BELOW .. LATIN CAPITAL LETTER T WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER T WITH LINE BELOW .. LATIN CAPITAL LETTER T WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW + 1, -- LATIN CAPITAL LETTER U WITH DIAERESIS BELOW .. LATIN CAPITAL LETTER U WITH DIAERESIS BELOW + 1, -- LATIN CAPITAL LETTER U WITH TILDE BELOW .. LATIN CAPITAL LETTER U WITH TILDE BELOW + 1, -- LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW .. LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW + 1, -- LATIN CAPITAL LETTER U WITH TILDE AND ACUTE .. LATIN CAPITAL LETTER U WITH TILDE AND ACUTE + 1, -- LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS .. LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS + 1, -- LATIN CAPITAL LETTER V WITH TILDE .. LATIN CAPITAL LETTER V WITH TILDE + 1, -- LATIN CAPITAL LETTER V WITH DOT BELOW .. LATIN CAPITAL LETTER V WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER W WITH GRAVE .. LATIN CAPITAL LETTER W WITH GRAVE + 1, -- LATIN CAPITAL LETTER W WITH ACUTE .. LATIN CAPITAL LETTER W WITH ACUTE + 1, -- LATIN CAPITAL LETTER W WITH DIAERESIS .. LATIN CAPITAL LETTER W WITH DIAERESIS + 1, -- LATIN CAPITAL LETTER W WITH DOT ABOVE .. LATIN CAPITAL LETTER W WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER W WITH DOT BELOW .. LATIN CAPITAL LETTER W WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER X WITH DOT ABOVE .. LATIN CAPITAL LETTER X WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER X WITH DIAERESIS .. LATIN CAPITAL LETTER X WITH DIAERESIS + 1, -- LATIN CAPITAL LETTER Y WITH DOT ABOVE .. LATIN CAPITAL LETTER Y WITH DOT ABOVE + 1, -- LATIN CAPITAL LETTER Z WITH CIRCUMFLEX .. LATIN CAPITAL LETTER Z WITH CIRCUMFLEX + 1, -- LATIN CAPITAL LETTER Z WITH DOT BELOW .. LATIN CAPITAL LETTER Z WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER Z WITH LINE BELOW .. LATIN CAPITAL LETTER Z WITH LINE BELOW + 1, -- LATIN CAPITAL LETTER A WITH DOT BELOW .. LATIN CAPITAL LETTER A WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER A WITH HOOK ABOVE .. LATIN CAPITAL LETTER A WITH HOOK ABOVE + 1, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE + 1, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE + 1, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE + 1, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE + 1, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW .. LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW + 1, -- LATIN CAPITAL LETTER A WITH BREVE AND ACUTE .. LATIN CAPITAL LETTER A WITH BREVE AND ACUTE + 1, -- LATIN CAPITAL LETTER A WITH BREVE AND GRAVE .. LATIN CAPITAL LETTER A WITH BREVE AND GRAVE + 1, -- LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE .. LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE + 1, -- LATIN CAPITAL LETTER A WITH BREVE AND TILDE .. LATIN CAPITAL LETTER A WITH BREVE AND TILDE + 1, -- LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW .. LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW + 1, -- LATIN CAPITAL LETTER E WITH DOT BELOW .. LATIN CAPITAL LETTER E WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER E WITH HOOK ABOVE .. LATIN CAPITAL LETTER E WITH HOOK ABOVE + 1, -- LATIN CAPITAL LETTER E WITH TILDE .. LATIN CAPITAL LETTER E WITH TILDE + 1, -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE + 1, -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE + 1, -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE + 1, -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE + 1, -- LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW .. LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW + 1, -- LATIN CAPITAL LETTER I WITH HOOK ABOVE .. LATIN CAPITAL LETTER I WITH HOOK ABOVE + 1, -- LATIN CAPITAL LETTER I WITH DOT BELOW .. LATIN CAPITAL LETTER I WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER O WITH DOT BELOW .. LATIN CAPITAL LETTER O WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER O WITH HOOK ABOVE .. LATIN CAPITAL LETTER O WITH HOOK ABOVE + 1, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE + 1, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE + 1, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE + 1, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE + 1, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW .. LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW + 1, -- LATIN CAPITAL LETTER O WITH HORN AND ACUTE .. LATIN CAPITAL LETTER O WITH HORN AND ACUTE + 1, -- LATIN CAPITAL LETTER O WITH HORN AND GRAVE .. LATIN CAPITAL LETTER O WITH HORN AND GRAVE + 1, -- LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE .. LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE + 1, -- LATIN CAPITAL LETTER O WITH HORN AND TILDE .. LATIN CAPITAL LETTER O WITH HORN AND TILDE + 1, -- LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW .. LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW + 1, -- LATIN CAPITAL LETTER U WITH DOT BELOW .. LATIN CAPITAL LETTER U WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER U WITH HOOK ABOVE .. LATIN CAPITAL LETTER U WITH HOOK ABOVE + 1, -- LATIN CAPITAL LETTER U WITH HORN AND ACUTE .. LATIN CAPITAL LETTER U WITH HORN AND ACUTE + 1, -- LATIN CAPITAL LETTER U WITH HORN AND GRAVE .. LATIN CAPITAL LETTER U WITH HORN AND GRAVE + 1, -- LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE .. LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE + 1, -- LATIN CAPITAL LETTER U WITH HORN AND TILDE .. LATIN CAPITAL LETTER U WITH HORN AND TILDE + 1, -- LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW .. LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW + 1, -- LATIN CAPITAL LETTER Y WITH GRAVE .. LATIN CAPITAL LETTER Y WITH GRAVE + 1, -- LATIN CAPITAL LETTER Y WITH DOT BELOW .. LATIN CAPITAL LETTER Y WITH DOT BELOW + 1, -- LATIN CAPITAL LETTER Y WITH HOOK ABOVE .. LATIN CAPITAL LETTER Y WITH HOOK ABOVE + 1, -- LATIN CAPITAL LETTER Y WITH TILDE .. LATIN CAPITAL LETTER Y WITH TILDE + -8, -- GREEK CAPITAL LETTER ALPHA WITH PSILI .. GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI + -8, -- GREEK CAPITAL LETTER EPSILON WITH PSILI .. GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA + -8, -- GREEK CAPITAL LETTER ETA WITH PSILI .. GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI + -8, -- GREEK CAPITAL LETTER IOTA WITH PSILI .. GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI + -8, -- GREEK CAPITAL LETTER OMICRON WITH PSILI .. GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA + -8, -- GREEK CAPITAL LETTER UPSILON WITH DASIA .. GREEK CAPITAL LETTER UPSILON WITH DASIA + -8, -- GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA .. GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA + -8, -- GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA .. GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA + -8, -- GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI .. GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI + -8, -- GREEK CAPITAL LETTER OMEGA WITH PSILI .. GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI + -8, -- GREEK CAPITAL LETTER ALPHA WITH VRACHY .. GREEK CAPITAL LETTER ALPHA WITH MACRON + -74, -- GREEK CAPITAL LETTER ALPHA WITH VARIA .. GREEK CAPITAL LETTER ALPHA WITH OXIA + -86, -- GREEK CAPITAL LETTER EPSILON WITH VARIA .. GREEK CAPITAL LETTER ETA WITH OXIA + -8, -- GREEK CAPITAL LETTER IOTA WITH VRACHY .. GREEK CAPITAL LETTER IOTA WITH MACRON + -100, -- GREEK CAPITAL LETTER IOTA WITH VARIA .. GREEK CAPITAL LETTER IOTA WITH OXIA + -8, -- GREEK CAPITAL LETTER UPSILON WITH VRACHY .. GREEK CAPITAL LETTER UPSILON WITH MACRON + -112, -- GREEK CAPITAL LETTER UPSILON WITH VARIA .. GREEK CAPITAL LETTER UPSILON WITH OXIA + -7, -- GREEK CAPITAL LETTER RHO WITH DASIA .. GREEK CAPITAL LETTER RHO WITH DASIA + -128, -- GREEK CAPITAL LETTER OMICRON WITH VARIA .. GREEK CAPITAL LETTER OMICRON WITH OXIA + -126, -- GREEK CAPITAL LETTER OMEGA WITH VARIA .. GREEK CAPITAL LETTER OMEGA WITH OXIA + 26, -- CIRCLED LATIN CAPITAL LETTER A .. CIRCLED LATIN CAPITAL LETTER Z + 32, -- FULLWIDTH LATIN CAPITAL LETTER A .. FULLWIDTH LATIN CAPITAL LETTER Z + 40, -- DESERET CAPITAL LETTER LONG I .. DESERET CAPITAL LETTER EW + 32); -- TAG LATIN CAPITAL LETTER A .. TAG LATIN CAPITAL LETTER Z + + -- The following is a list of the 10646 names for CAPITAL LETTER entries + -- that have no matching SMALL LETTER entry and are thus not folded + + -- LATIN CAPITAL LETTER I WITH DOT ABOVE + -- LATIN CAPITAL LETTER AFRICAN D + -- LATIN CAPITAL LETTER O WITH MIDDLE TILDE + -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON + -- LATIN CAPITAL LETTER L WITH SMALL LETTER J + -- LATIN CAPITAL LETTER N WITH SMALL LETTER J + -- LATIN CAPITAL LETTER D WITH SMALL LETTER Z + -- LATIN CAPITAL LETTER HWAIR + -- LATIN CAPITAL LETTER WYNN + -- GREEK CAPITAL LETTER UPSILON HOOK + -- GREEK CAPITAL LETTER UPSILON HOOK TONOS + -- GREEK CAPITAL LETTER UPSILON HOOK DIAERESIS + -- GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI + -- GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI + -- GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI ----------------------- -- Local Subprograms -- *************** package body System.UTF_32 is *** 5290,5295 **** --- 6311,6330 ---- end Range_Search; -------------------------- + -- UTF_32_To_Lower_Case -- + -------------------------- + + function UTF_32_To_Lower_Case (U : UTF_32) return UTF_32 is + Index : constant Integer := Range_Search (U, Upper_Case_Letters); + begin + if Index = 0 then + return U; + else + return U + Upper_Case_Adjust (Index); + end if; + end UTF_32_To_Lower_Case; + + -------------------------- -- UTF_32_To_Upper_Case -- -------------------------- *************** package body System.UTF_32 is *** 5299,5305 **** if Index = 0 then return U; else ! return U + Upper_Case_Adjust (Index); end if; end UTF_32_To_Upper_Case; --- 6334,6340 ---- if Index = 0 then return U; else ! return U + Lower_Case_Adjust (Index); end if; end UTF_32_To_Upper_Case; diff -Nrcpad gcc-4.5.2/gcc/ada/s-utf_32.ads gcc-4.6.0/gcc/ada/s-utf_32.ads *** gcc-4.5.2/gcc/ada/s-utf_32.ads Fri Apr 17 13:07:12 2009 --- gcc-4.6.0/gcc/ada/s-utf_32.ads Thu Oct 7 09:16:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2005-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2005-2010, 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- -- *************** package System.UTF_32 is *** 185,197 **** -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all ! -- letters to upper case using this routine. function UTF_32_To_Upper_Case (U : UTF_32) return UTF_32; pragma Inline (UTF_32_To_Upper_Case); ! -- If U represents a lower case letter, returns the corresponding upper ! -- case letter, otherwise U is returned unchanged. The folding is locale ! -- independent as defined by documents referenced in the note in section ! -- 1 of ISO/IEC 10646:2003 end System.UTF_32; --- 185,211 ---- -- The following function is used to fold to upper case, as required by -- the Ada 2005 standard rules for identifier case folding. Two -- identifiers are equivalent if they are identical after folding all ! -- letters to upper case using this routine. A corresponding routine to ! -- fold to lower case is also provided. ! ! function UTF_32_To_Lower_Case (U : UTF_32) return UTF_32; ! pragma Inline (UTF_32_To_Lower_Case); ! -- If U represents an upper case letter, returns the corresponding lower ! -- case letter, otherwise U is returned unchanged. The folding rule is ! -- simply that if the code corresponds to a 10646 entry whose name contains ! -- the string CAPITAL LETTER, and there is a corresponding entry whose name ! -- is the same but with CAPITAL LETTER replaced by SMALL LETTER, then the ! -- code is folded to this SMALL LETTER code. Otherwise the input code is ! -- returned unchanged. function UTF_32_To_Upper_Case (U : UTF_32) return UTF_32; pragma Inline (UTF_32_To_Upper_Case); ! -- If U represents a lower case letter, returns the corresponding lower ! -- case letter, otherwise U is returned unchanged. The folding rule is ! -- simply that if the code corresponds to a 10646 entry whose name contains ! -- the string SMALL LETTER, and there is a corresponding entry whose name ! -- is the same but with SMALL LETTER replaced by CAPITAL LETTER, then the ! -- code is folded to this CAPITAL LETTER code. Otherwise the input code is ! -- returned unchanged. end System.UTF_32; diff -Nrcpad gcc-4.5.2/gcc/ada/s-valcha.adb gcc-4.6.0/gcc/ada/s-valcha.adb *** gcc-4.5.2/gcc/ada/s-valcha.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/s-valcha.adb Fri Oct 8 12:34:08 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body System.Val_Char is *** 65,70 **** --- 65,74 ---- end if; end loop; + if S (F .. L) = "SOFT_HYPHEN" then + return Character'Val (16#AD#); + end if; + raise Constraint_Error; end if; end Value_Character; diff -Nrcpad gcc-4.5.2/gcc/ada/s-vxwext-kernel.ads gcc-4.6.0/gcc/ada/s-vxwext-kernel.ads *** gcc-4.5.2/gcc/ada/s-vxwext-kernel.ads Wed Jul 22 15:13:23 2009 --- gcc-4.6.0/gcc/ada/s-vxwext-kernel.ads Tue Oct 5 09:37:44 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2010, 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- -- *************** package System.VxWorks.Ext is *** 39,44 **** --- 39,46 ---- subtype SEM_ID is Long_Integer; -- typedef struct semaphore *SEM_ID; + type sigset_t is mod 2 ** Long_Long_Integer'Size; + type t_id is new Long_Integer; subtype int is Interfaces.C.int; *************** package System.VxWorks.Ext is *** 59,64 **** --- 61,69 ---- Parameter : System.Address := System.Null_Address) return int; pragma Import (C, Interrupt_Connect, "intConnect"); + function Interrupt_Context return int; + pragma Import (C, Interrupt_Context, "intContext"); + function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Import (C, Interrupt_Number_To_Vector, "__gnat_inum_to_ivec"); diff -Nrcpad gcc-4.5.2/gcc/ada/s-vxwext-rtp.adb gcc-4.6.0/gcc/ada/s-vxwext-rtp.adb *** gcc-4.5.2/gcc/ada/s-vxwext-rtp.adb Wed Jun 24 09:41:39 2009 --- gcc-4.6.0/gcc/ada/s-vxwext-rtp.adb Mon Oct 18 09:37:14 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2008-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2008-2010, 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- -- *************** *** 26,32 **** -- -- ------------------------------------------------------------------------------ ! -- This package provides vxworks specific support functions needed -- by System.OS_Interface. -- This is the VxWorks 6 RTP version of this package --- 26,32 ---- -- -- ------------------------------------------------------------------------------ ! -- This package provides VxWorks specific support functions needed -- by System.OS_Interface. -- This is the VxWorks 6 RTP version of this package *************** package body System.VxWorks.Ext is *** 53,84 **** return ERROR; end Int_Unlock; ! -------------------- ! -- Set_Time_Slice -- ! -------------------- ! ! function Set_Time_Slice (ticks : int) return int is ! pragma Unreferenced (ticks); ! begin ! return ERROR; ! end Set_Time_Slice; function Interrupt_Connect (Vector : Interrupt_Vector; Handler : Interrupt_Handler; ! Parameter : System.Address := System.Null_Address) return int is pragma Unreferenced (Vector, Handler, Parameter); begin return ERROR; end Interrupt_Connect; function Interrupt_Number_To_Vector ! (intNum : int) return Interrupt_Vector is pragma Unreferenced (intNum); begin return 0; end Interrupt_Number_To_Vector; ------------------------ -- taskCpuAffinitySet -- ------------------------ --- 53,116 ---- return ERROR; end Int_Unlock; ! ----------------------- ! -- Interrupt_Connect -- ! ----------------------- function Interrupt_Connect (Vector : Interrupt_Vector; Handler : Interrupt_Handler; ! Parameter : System.Address := System.Null_Address) return int ! is pragma Unreferenced (Vector, Handler, Parameter); begin return ERROR; end Interrupt_Connect; + ----------------------- + -- Interrupt_Context -- + ----------------------- + + function Interrupt_Context return int is + begin + -- For RTPs, never in an interrupt context + + return 0; + end Interrupt_Context; + + -------------------------------- + -- Interrupt_Number_To_Vector -- + -------------------------------- + function Interrupt_Number_To_Vector ! (intNum : int) return Interrupt_Vector ! is pragma Unreferenced (intNum); begin return 0; end Interrupt_Number_To_Vector; + --------------- + -- semDelete -- + --------------- + + function semDelete (Sem : SEM_ID) return int is + function OS_semDelete (Sem : SEM_ID) return int; + pragma Import (C, OS_semDelete, "semDelete"); + begin + return OS_semDelete (Sem); + end semDelete; + + -------------------- + -- Set_Time_Slice -- + -------------------- + + function Set_Time_Slice (ticks : int) return int is + pragma Unreferenced (ticks); + begin + return ERROR; + end Set_Time_Slice; + ------------------------ -- taskCpuAffinitySet -- ------------------------ diff -Nrcpad gcc-4.5.2/gcc/ada/s-vxwext-rtp.ads gcc-4.6.0/gcc/ada/s-vxwext-rtp.ads *** gcc-4.5.2/gcc/ada/s-vxwext-rtp.ads Thu Jun 25 08:24:34 2009 --- gcc-4.6.0/gcc/ada/s-vxwext-rtp.ads Mon Oct 18 09:37:14 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2010, 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- -- *************** package System.VxWorks.Ext is *** 39,44 **** --- 39,46 ---- subtype SEM_ID is Long_Integer; -- typedef struct semaphore *SEM_ID; + type sigset_t is mod 2 ** Long_Long_Integer'Size; + type t_id is new Long_Integer; subtype int is Interfaces.C.int; *************** package System.VxWorks.Ext is *** 59,70 **** Parameter : System.Address := System.Null_Address) return int; pragma Convention (C, Interrupt_Connect); function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Convention (C, Interrupt_Number_To_Vector); function semDelete (Sem : SEM_ID) return int; ! pragma Import (C, semDelete, "semDelete"); function Task_Cont (tid : t_id) return int; pragma Import (C, Task_Cont, "taskResume"); --- 61,75 ---- Parameter : System.Address := System.Null_Address) return int; pragma Convention (C, Interrupt_Connect); + function Interrupt_Context return int; + pragma Convention (C, Interrupt_Context); + function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Convention (C, Interrupt_Number_To_Vector); function semDelete (Sem : SEM_ID) return int; ! pragma Convention (C, semDelete); function Task_Cont (tid : t_id) return int; pragma Import (C, Task_Cont, "taskResume"); diff -Nrcpad gcc-4.5.2/gcc/ada/s-vxwext.ads gcc-4.6.0/gcc/ada/s-vxwext.ads *** gcc-4.5.2/gcc/ada/s-vxwext.ads Mon Nov 30 16:21:19 2009 --- gcc-4.6.0/gcc/ada/s-vxwext.ads Tue Oct 5 09:37:44 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2008-2010, 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- -- *************** package System.VxWorks.Ext is *** 39,45 **** --- 39,48 ---- subtype SEM_ID is Long_Integer; -- typedef struct semaphore *SEM_ID; + type sigset_t is mod 2 ** Interfaces.C.long'Size; + type t_id is new Long_Integer; + subtype int is Interfaces.C.int; type Interrupt_Handler is access procedure (parameter : System.Address); *************** package System.VxWorks.Ext is *** 59,64 **** --- 62,70 ---- Parameter : System.Address := System.Null_Address) return int; pragma Import (C, Interrupt_Connect, "intConnect"); + function Interrupt_Context return int; + pragma Import (C, Interrupt_Context, "intContext"); + function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Import (C, Interrupt_Number_To_Vector, "__gnat_inum_to_ivec"); diff -Nrcpad gcc-4.5.2/gcc/ada/scans.adb gcc-4.6.0/gcc/ada/scans.adb *** gcc-4.5.2/gcc/ada/scans.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/scans.adb Tue Oct 19 12:29:25 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Scans is *** 118,123 **** --- 118,130 ---- Set_Reserved (Name_Reverse, Tok_Reverse); Set_Reserved (Name_Select, Tok_Select); Set_Reserved (Name_Separate, Tok_Separate); + + -- We choose to make Some into a non-reserved word, so it is handled + -- like a regular identifier in most contexts. Uncomment the following + -- line if a pedantic Ada2012 mode is required. + + -- Set_Reserved (Name_Some, Tok_Some); + Set_Reserved (Name_Subtype, Tok_Subtype); Set_Reserved (Name_Tagged, Tok_Tagged); Set_Reserved (Name_Task, Tok_Task); diff -Nrcpad gcc-4.5.2/gcc/ada/scans.ads gcc-4.6.0/gcc/ada/scans.ads *** gcc-4.5.2/gcc/ada/scans.ads Mon Nov 30 14:09:30 2009 --- gcc-4.6.0/gcc/ada/scans.ads Tue Oct 19 12:29:25 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Scans is *** 130,135 **** --- 130,136 ---- Tok_Record, -- RECORD Eterm, Sterm Tok_Renames, -- RENAMES Eterm, Sterm Tok_Reverse, -- REVERSE Eterm, Sterm + Tok_Some, -- SOME Eterm, Sterm Tok_Tagged, -- TAGGED Eterm, Sterm Tok_Then, -- THEN Eterm, Sterm *************** package Scans is *** 192,198 **** Tok_Project, Tok_Extends, Tok_External, ! -- These three entries represent keywords for the project file language -- and can be returned only in the case of scanning project files. Tok_Comment, --- 193,200 ---- Tok_Project, Tok_Extends, Tok_External, ! Tok_External_As_List, ! -- These four entries represent keywords for the project file language -- and can be returned only in the case of scanning project files. Tok_Comment, *************** package Scans is *** 415,441 **** -- We do things this way to minimize the impact on comment scanning. Character_Code : Char_Code; ! -- Valid only when Token is Tok_Char_Literal Real_Literal_Value : Ureal; ! -- Valid only when Token is Tok_Real_Literal Int_Literal_Value : Uint; ! -- Valid only when Token = Tok_Integer_Literal; String_Literal_Id : String_Id; - -- Id for currently scanned string value. -- Valid only when Token = Tok_String_Literal or Tok_Operator_Symbol. Wide_Character_Found : Boolean := False; ! -- Set True if wide character found (i.e. a character that does not fit ! -- in Character, but fits in Wide_Wide_Character). ! -- Valid only when Token = Tok_String_Literal. Wide_Wide_Character_Found : Boolean := False; ! -- Set True if wide wide character found (i.e. a character that does ! -- not fit in Character or Wide_Character). ! -- Valid only when Token = Tok_String_Literal. Special_Character : Character; -- Valid only when Token = Tok_Special. Returns one of the characters --- 417,450 ---- -- We do things this way to minimize the impact on comment scanning. Character_Code : Char_Code; ! -- Valid only when Token is Tok_Char_Literal. Contains the value of the ! -- scanned literal. Real_Literal_Value : Ureal; ! -- Valid only when Token is Tok_Real_Literal, contains the value of the ! -- scanned literal. Int_Literal_Value : Uint; ! -- Valid only when Token = Tok_Integer_Literal, contains the value of the ! -- scanned literal. ! ! Based_Literal_Uses_Colon : Boolean; ! -- Valid only when Token = Tok_Integer_Literal or Tok_Real_Literal. Set ! -- True only for the case of a based literal using ':' instead of '#'. String_Literal_Id : String_Id; -- Valid only when Token = Tok_String_Literal or Tok_Operator_Symbol. + -- Contains the Id for currently scanned string value. Wide_Character_Found : Boolean := False; ! -- Valid only when Token = Tok_String_Literal. Set True if wide character ! -- found (i.e. a character that does not fit in Character, but fits in ! -- Wide_Wide_Character). Wide_Wide_Character_Found : Boolean := False; ! -- Valid only when Token = Tok_String_Literal. Set True if wide wide ! -- character found (i.e. a character that does not fit in Character or ! -- Wide_Character). Special_Character : Character; -- Valid only when Token = Tok_Special. Returns one of the characters diff -Nrcpad gcc-4.5.2/gcc/ada/scil_ll.adb gcc-4.6.0/gcc/ada/scil_ll.adb *** gcc-4.5.2/gcc/ada/scil_ll.adb Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/scil_ll.adb Wed Jun 23 06:50:13 2010 *************** *** 0 **** --- 1,144 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- S C I L _ L L -- + -- -- + -- B o d y -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + with Alloc; use Alloc; + with Atree; use Atree; + with Opt; use Opt; + with Sinfo; use Sinfo; + with Table; + + package body SCIL_LL is + + procedure Copy_SCIL_Node (Target : Node_Id; Source : Node_Id); + -- Copy the SCIL field from Source to Target (it is used as the argument + -- for a call to Set_Reporting_Proc in package atree). + + function SCIL_Nodes_Table_Size return Pos; + -- Used to initialize the table of SCIL nodes because we do not want + -- to consume memory for this table if it is not required. + + ---------------------------- + -- SCIL_Nodes_Table_Size -- + ---------------------------- + + function SCIL_Nodes_Table_Size return Pos is + begin + if Generate_SCIL then + return Alloc.Orig_Nodes_Initial; + else + return 1; + end if; + end SCIL_Nodes_Table_Size; + + package SCIL_Nodes is new Table.Table ( + Table_Component_Type => Node_Id, + Table_Index_Type => Node_Id'Base, + Table_Low_Bound => First_Node_Id, + Table_Initial => SCIL_Nodes_Table_Size, + Table_Increment => Alloc.Orig_Nodes_Increment, + Table_Name => "SCIL_Nodes"); + -- This table records the value of attribute SCIL_Node of all the + -- tree nodes. + + -------------------- + -- Copy_SCIL_Node -- + -------------------- + + procedure Copy_SCIL_Node (Target : Node_Id; Source : Node_Id) is + begin + Set_SCIL_Node (Target, Get_SCIL_Node (Source)); + end Copy_SCIL_Node; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize is + begin + SCIL_Nodes.Init; + Set_Reporting_Proc (Copy_SCIL_Node'Access); + end Initialize; + + ------------------- + -- Get_SCIL_Node -- + ------------------- + + function Get_SCIL_Node (N : Node_Id) return Node_Id is + begin + if Generate_SCIL + and then Present (N) + then + return SCIL_Nodes.Table (N); + else + return Empty; + end if; + end Get_SCIL_Node; + + ------------------- + -- Set_SCIL_Node -- + ------------------- + + procedure Set_SCIL_Node (N : Node_Id; Value : Node_Id) is + begin + pragma Assert (Generate_SCIL); + + if Present (Value) then + case Nkind (Value) is + when N_SCIL_Dispatch_Table_Tag_Init => + pragma Assert (Nkind (N) = N_Object_Declaration); + null; + + when N_SCIL_Dispatching_Call => + pragma Assert (Nkind_In (N, N_Function_Call, + N_Procedure_Call_Statement)); + null; + + when N_SCIL_Membership_Test => + pragma Assert (Nkind_In (N, N_Identifier, + N_And_Then, + N_Or_Else, + N_Expression_With_Actions)); + null; + + when others => + pragma Assert (False); + raise Program_Error; + end case; + end if; + + if Atree.Last_Node_Id > SCIL_Nodes.Last then + SCIL_Nodes.Set_Last (Atree.Last_Node_Id); + end if; + + SCIL_Nodes.Set_Item (N, Value); + end Set_SCIL_Node; + + end SCIL_LL; diff -Nrcpad gcc-4.5.2/gcc/ada/scil_ll.ads gcc-4.6.0/gcc/ada/scil_ll.ads *** gcc-4.5.2/gcc/ada/scil_ll.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/scil_ll.ads Wed Jun 23 06:11:20 2010 *************** *** 0 **** --- 1,48 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- S C I L _ L L -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2010, 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. -- + -- -- + -- As a special exception under Section 7 of GPL version 3, you are granted -- + -- additional permissions described in the GCC Runtime Library Exception, -- + -- version 3.1, as published by the Free Software Foundation. -- + -- -- + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- + -- . -- + -- -- + -- GNAT was originally developed by the GNAT team at New York University. -- + -- Extensive contributions were provided by Ada Core Technologies Inc. -- + -- -- + ------------------------------------------------------------------------------ + + -- This package extends the tree nodes with a field that is used to reference + -- the SCIL node. + + with Types; use Types; + + package SCIL_LL is + + function Get_SCIL_Node (N : Node_Id) return Node_Id; + -- Read the value of attribute SCIL node + + procedure Set_SCIL_Node (N : Node_Id; Value : Node_Id); + -- Set the value of attribute SCIL node + + procedure Initialize; + -- Initialize the table of SCIL nodes + + end SCIL_LL; diff -Nrcpad gcc-4.5.2/gcc/ada/scn.adb gcc-4.6.0/gcc/ada/scn.adb *** gcc-4.5.2/gcc/ada/scn.adb Mon Nov 30 14:09:30 2009 --- gcc-4.6.0/gcc/ada/scn.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Scn is *** 44,53 **** use ASCII; - Obsolescent_Check_Flag : Boolean := True; - -- Obsolescent check activation. Set to False during integrated - -- preprocessing. - Used_As_Identifier : array (Token_Type) of Boolean; -- Flags set True if a given keyword is used as an identifier (used to -- make sure that we only post an error message for incorrect use of a --- 44,49 ---- *************** package body Scn is *** 340,367 **** end loop; end Initialize_Scanner; - ----------------------- - -- Obsolescent_Check -- - ----------------------- - - procedure Obsolescent_Check (S : Source_Ptr) is - begin - if Obsolescent_Check_Flag then - -- This is a pain in the neck case, since we normally need a node to - -- call Check_Restrictions, and all we have is a source pointer. The - -- easiest thing is to construct a dummy node. A bit kludgy, but this - -- is a marginal case. It's not worth trying to do things more - -- cleanly. - - Check_Restriction (No_Obsolescent_Features, New_Node (N_Empty, S)); - end if; - end Obsolescent_Check; - --------------- -- Post_Scan -- --------------- procedure Post_Scan is begin case Token is when Tok_Char_Literal => --- 336,396 ---- end loop; end Initialize_Scanner; --------------- -- Post_Scan -- --------------- procedure Post_Scan is + procedure Check_Obsolescent_Features_Restriction (S : Source_Ptr); + -- This checks for Obsolescent_Features restriction being active, and + -- if so, flags the restriction as occurring at the given scan location. + + procedure Check_Obsolete_Base_Char; + -- Check for numeric literal using ':' instead of '#' for based case + + -------------------------------------------- + -- Check_Obsolescent_Features_Restriction -- + -------------------------------------------- + + procedure Check_Obsolescent_Features_Restriction (S : Source_Ptr) is + begin + -- Normally we have a node handy for posting restrictions. We don't + -- have such a node here, so construct a dummy one with the right + -- scan pointer. This is only used to get the Sloc value anyway. + + Check_Restriction (No_Obsolescent_Features, New_Node (N_Empty, S)); + end Check_Obsolescent_Features_Restriction; + + ------------------------------ + -- Check_Obsolete_Base_Char -- + ------------------------------ + + procedure Check_Obsolete_Base_Char is + S : Source_Ptr; + + begin + if Based_Literal_Uses_Colon then + + -- Find the : for the restriction or warning message + + S := Token_Ptr; + while Source (S) /= ':' loop + S := S + 1; + end loop; + + Check_Obsolescent_Features_Restriction (S); + + if Warn_On_Obsolescent_Feature then + Error_Msg + ("use of "":"" is an obsolescent feature (RM J.2(3))?", S); + Error_Msg + ("\use ""'#"" instead?", S); + end if; + end if; + end Check_Obsolete_Base_Char; + + -- Start of processing for Post_Scan + begin case Token is when Tok_Char_Literal => *************** package body Scn is *** 376,385 **** --- 405,416 ---- when Tok_Real_Literal => Token_Node := New_Node (N_Real_Literal, Token_Ptr); Set_Realval (Token_Node, Real_Literal_Value); + Check_Obsolete_Base_Char; when Tok_Integer_Literal => Token_Node := New_Node (N_Integer_Literal, Token_Ptr); Set_Intval (Token_Node, Int_Literal_Value); + Check_Obsolete_Base_Char; when Tok_String_Literal => Token_Node := New_Node (N_String_Literal, Token_Ptr); *************** package body Scn is *** 389,399 **** --- 420,451 ---- (Token_Node, Wide_Wide_Character_Found); Set_Strval (Token_Node, String_Literal_Id); + if Source (Token_Ptr) = '%' then + Check_Obsolescent_Features_Restriction (Token_Ptr); + + if Warn_On_Obsolescent_Feature then + Error_Msg_SC + ("use of ""'%"" is an obsolescent feature (RM J.2(4))?"); + Error_Msg_SC ("\use """""" instead?"); + end if; + end if; + when Tok_Operator_Symbol => Token_Node := New_Node (N_Operator_Symbol, Token_Ptr); Set_Chars (Token_Node, Token_Name); Set_Strval (Token_Node, String_Literal_Id); + when Tok_Vertical_Bar => + if Source (Token_Ptr) = '!' then + Check_Obsolescent_Features_Restriction (Token_Ptr); + + if Warn_On_Obsolescent_Feature then + Error_Msg_SC + ("use of ""'!"" is an obsolescent feature (RM J.2(2))?"); + Error_Msg_SC ("\use ""'|"" instead?"); + end if; + end if; + when others => null; end case; *************** package body Scn is *** 420,428 **** Token_Name := Name_Find; if not Used_As_Identifier (Token) or else Force_Msg then ! Error_Msg_Name_1 := Token_Name; ! Error_Msg_SC ("reserved word* cannot be used as identifier!"); ! Used_As_Identifier (Token) := True; end if; Token := Tok_Identifier; --- 472,489 ---- Token_Name := Name_Find; if not Used_As_Identifier (Token) or else Force_Msg then ! ! -- If "some" is made into a reserved work in Ada2012, the following ! -- check will make it into a regular identifier in earlier versions ! -- of the language. ! ! if Token = Tok_Some and then Ada_Version < Ada_2012 then ! null; ! else ! Error_Msg_Name_1 := Token_Name; ! Error_Msg_SC ("reserved word* cannot be used as identifier!"); ! Used_As_Identifier (Token) := True; ! end if; end if; Token := Tok_Identifier; *************** package body Scn is *** 430,442 **** Set_Chars (Token_Node, Token_Name); end Scan_Reserved_Identifier; - --------------------------- - -- Set_Obsolescent_Check -- - --------------------------- - - procedure Set_Obsolescent_Check (Value : Boolean) is - begin - Obsolescent_Check_Flag := Value; - end Set_Obsolescent_Check; - end Scn; --- 491,494 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/scn.ads gcc-4.6.0/gcc/ada/scn.ads *** gcc-4.5.2/gcc/ada/scn.ads Fri Apr 10 13:32:09 2009 --- gcc-4.6.0/gcc/ada/scn.ads Thu Sep 9 12:31:35 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Scn is *** 47,61 **** -- Determines the casing style of the current token, which is -- either a keyword or an identifier. See also package Casing. - procedure Obsolescent_Check (S : Source_Ptr); - -- Called to handle pragma restrictions check for usage of obsolescent - -- character replacements during the scan. - - procedure Set_Obsolescent_Check (Value : Boolean); - -- Activate or not obsolescent check - procedure Post_Scan; - pragma Inline (Post_Scan); -- Create nodes for tokens: Char_Literal, Identifier, Real_Literal, -- Integer_Literal, String_Literal and Operator_Symbol. --- 47,53 ---- *************** package Scn is *** 75,87 **** -- generic package Scng with routines appropriate to the compiler package Scanner is new Scng ! (Post_Scan => Post_Scan, ! Error_Msg => Error_Msg, ! Error_Msg_S => Error_Msg_S, ! Error_Msg_SC => Error_Msg_SC, ! Error_Msg_SP => Error_Msg_SP, ! Obsolescent_Check => Obsolescent_Check, ! Style => Style.Style_Inst); procedure Scan renames Scanner.Scan; -- Scan scans out the next token, and advances the scan state accordingly --- 67,78 ---- -- generic package Scng with routines appropriate to the compiler package Scanner is new Scng ! (Post_Scan => Post_Scan, ! Error_Msg => Error_Msg, ! Error_Msg_S => Error_Msg_S, ! Error_Msg_SC => Error_Msg_SC, ! Error_Msg_SP => Error_Msg_SP, ! Style => Style.Style_Inst); procedure Scan renames Scanner.Scan; -- Scan scans out the next token, and advances the scan state accordingly diff -Nrcpad gcc-4.5.2/gcc/ada/scng.adb gcc-4.6.0/gcc/ada/scng.adb *** gcc-4.5.2/gcc/ada/scng.adb Mon Nov 30 14:09:30 2009 --- gcc-4.6.0/gcc/ada/scng.adb Tue Oct 26 13:15:05 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Uintp; use Uintp; *** 37,45 **** --- 37,48 ---- with Urealp; use Urealp; with Widechar; use Widechar; + pragma Warnings (Off); + -- This package is used also by gnatcoll with System.CRC32; with System.UTF_32; use System.UTF_32; with System.WCh_Con; use System.WCh_Con; + pragma Warnings (On); package body Scng is *************** package body Scng is *** 61,66 **** --- 64,85 ---- procedure Accumulate_Token_Checksum; pragma Inline (Accumulate_Token_Checksum); + -- Called after each numeric literal and identifier/keyword. For keywords, + -- the token used is Tok_Identifier. This allows to detect additional + -- spaces added in sources when using the builder switch -m. + + procedure Accumulate_Token_Checksum_GNAT_6_3; + -- Used in place of Accumulate_Token_Checksum for GNAT versions 5.04 to + -- 6.3, when Tok_Some was not included in Token_Type and the actual + -- Token_Type was used for keywords. This procedure is never used in the + -- compiler or gnatmake, only in gprbuild. + + procedure Accumulate_Token_Checksum_GNAT_5_03; + -- Used in place of Accumulate_Token_Checksum for GNAT version 5.03, when + -- Tok_Interface, Tok_Some, Tok_Synchronized and Tok_Overriding were not + -- included in Token_Type and the actual Token_Type was used for keywords. + -- This procedure is never used in the compiler or gnatmake, only in + -- gprbuild. procedure Accumulate_Checksum (C : Character); pragma Inline (Accumulate_Checksum); *************** package body Scng is *** 117,122 **** --- 136,262 ---- Character'Val (Token_Type'Pos (Token))); end Accumulate_Token_Checksum; + ---------------------------------------- + -- Accumulate_Token_Checksum_GNAT_6_3 -- + ---------------------------------------- + + procedure Accumulate_Token_Checksum_GNAT_6_3 is + begin + -- Individual values of Token_Type are used, instead of subranges, so + -- that additions or suppressions of enumerated values in type + -- Token_Type are detected by the compiler. + + case Token is + when Tok_Integer_Literal | Tok_Real_Literal | Tok_String_Literal | + Tok_Char_Literal | Tok_Operator_Symbol | Tok_Identifier | + Tok_Double_Asterisk | Tok_Ampersand | Tok_Minus | Tok_Plus | + Tok_Asterisk | Tok_Mod | Tok_Rem | Tok_Slash | Tok_New | + Tok_Abs | Tok_Others | Tok_Null | Tok_Dot | Tok_Apostrophe | + Tok_Left_Paren | Tok_Delta | Tok_Digits | Tok_Range | + Tok_Right_Paren | Tok_Comma | Tok_And | Tok_Or | Tok_Xor | + Tok_Less | Tok_Equal | Tok_Greater | Tok_Not_Equal | + Tok_Greater_Equal | Tok_Less_Equal | Tok_In | Tok_Not | + Tok_Box | Tok_Colon_Equal | Tok_Colon | Tok_Greater_Greater | + Tok_Abstract | Tok_Access | Tok_Aliased | Tok_All | Tok_Array | + Tok_At | Tok_Body | Tok_Constant | Tok_Do | Tok_Is | + Tok_Interface | Tok_Limited | Tok_Of | Tok_Out | Tok_Record | + Tok_Renames | Tok_Reverse => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token))); + + when Tok_Some => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Tok_Identifier))); + + when Tok_Tagged | Tok_Then | Tok_Less_Less | Tok_Abort | Tok_Accept | + Tok_Case | Tok_Delay | Tok_Else | Tok_Elsif | Tok_End | + Tok_Exception | Tok_Exit | Tok_Goto | Tok_If | Tok_Pragma | + Tok_Raise | Tok_Requeue | Tok_Return | Tok_Select | + Tok_Terminate | Tok_Until | Tok_When | Tok_Begin | Tok_Declare | + Tok_For | Tok_Loop | Tok_While | Tok_Entry | Tok_Protected | + Tok_Task | Tok_Type | Tok_Subtype | Tok_Overriding | + Tok_Synchronized | Tok_Use | Tok_Function | Tok_Generic | + Tok_Package | Tok_Procedure | Tok_Private | Tok_With | + Tok_Separate | Tok_EOF | Tok_Semicolon | Tok_Arrow | + Tok_Vertical_Bar | Tok_Dot_Dot | Tok_Project | Tok_Extends | + Tok_External | Tok_External_As_List | Tok_Comment | + Tok_End_Of_Line | Tok_Special | No_Token => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token_Type'Pred (Token)))); + end case; + end Accumulate_Token_Checksum_GNAT_6_3; + + ----------------------------------------- + -- Accumulate_Token_Checksum_GNAT_5_03 -- + ----------------------------------------- + + procedure Accumulate_Token_Checksum_GNAT_5_03 is + begin + -- Individual values of Token_Type are used, instead of subranges, so + -- that additions or suppressions of enumerated values in type + -- Token_Type are detected by the compiler. + + case Token is + when Tok_Integer_Literal | Tok_Real_Literal | Tok_String_Literal | + Tok_Char_Literal | Tok_Operator_Symbol | Tok_Identifier | + Tok_Double_Asterisk | Tok_Ampersand | Tok_Minus | Tok_Plus | + Tok_Asterisk | Tok_Mod | Tok_Rem | Tok_Slash | Tok_New | + Tok_Abs | Tok_Others | Tok_Null | Tok_Dot | Tok_Apostrophe | + Tok_Left_Paren | Tok_Delta | Tok_Digits | Tok_Range | + Tok_Right_Paren | Tok_Comma | Tok_And | Tok_Or | Tok_Xor | + Tok_Less | Tok_Equal | Tok_Greater | Tok_Not_Equal | + Tok_Greater_Equal | Tok_Less_Equal | Tok_In | Tok_Not | + Tok_Box | Tok_Colon_Equal | Tok_Colon | Tok_Greater_Greater | + Tok_Abstract | Tok_Access | Tok_Aliased | Tok_All | Tok_Array | + Tok_At | Tok_Body | Tok_Constant | Tok_Do | Tok_Is => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token))); + + when Tok_Interface | Tok_Some | Tok_Overriding | Tok_Synchronized => + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Tok_Identifier))); + + when Tok_Limited | Tok_Of | Tok_Out | Tok_Record | + Tok_Renames | Tok_Reverse => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token) - 1)); + + when Tok_Tagged | Tok_Then | Tok_Less_Less | Tok_Abort | Tok_Accept | + Tok_Case | Tok_Delay | Tok_Else | Tok_Elsif | Tok_End | + Tok_Exception | Tok_Exit | Tok_Goto | Tok_If | Tok_Pragma | + Tok_Raise | Tok_Requeue | Tok_Return | Tok_Select | + Tok_Terminate | Tok_Until | Tok_When | Tok_Begin | Tok_Declare | + Tok_For | Tok_Loop | Tok_While | Tok_Entry | Tok_Protected | + Tok_Task | Tok_Type | Tok_Subtype => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token) - 2)); + + when Tok_Use | Tok_Function | Tok_Generic | + Tok_Package | Tok_Procedure | Tok_Private | Tok_With | + Tok_Separate | Tok_EOF | Tok_Semicolon | Tok_Arrow | + Tok_Vertical_Bar | Tok_Dot_Dot | Tok_Project | Tok_Extends | + Tok_External | Tok_External_As_List | Tok_Comment | + Tok_End_Of_Line | Tok_Special | No_Token => + + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token) - 4)); + end case; + end Accumulate_Token_Checksum_GNAT_5_03; + ---------------------------- -- Determine_Token_Casing -- ---------------------------- *************** package body Scng is *** 238,243 **** --- 378,391 ---- -- past the closing quote of the string literal, Token and Token_Node -- are set appropriately, and the checksum is updated. + procedure Skip_Other_Format_Characters; + -- Skips past any "other format" category characters at the current + -- cursor location (does not skip past spaces or any other characters). + + function Start_Of_Wide_Character return Boolean; + -- Returns True if the scan pointer is pointing to the start of a wide + -- character sequence, does not modify the scan pointer in any case. + ----------------------- -- Check_End_Of_Line -- ----------------------- *************** package body Scng is *** 325,331 **** and then Source (Scan_Ptr + 2) = C then Scan_Ptr := Scan_Ptr + 1; ! Error_Msg_S ("no space allowed here"); Scan_Ptr := Scan_Ptr + 2; return True; --- 473,480 ---- and then Source (Scan_Ptr + 2) = C then Scan_Ptr := Scan_Ptr + 1; ! Error_Msg_S -- CODEFIX ! ("no space allowed here"); Scan_Ptr := Scan_Ptr + 2; return True; *************** package body Scng is *** 380,395 **** Error_Msg_S -- CODEFIX ("two consecutive underlines not permitted"); else ! Error_Msg_S -- CODEFIX??? ! ("underline cannot follow punctuation character"); end if; else if Source (Scan_Ptr - 1) = '_' then ! Error_Msg_S -- CODEFIX??? ! ("punctuation character cannot follow underline"); else ! Error_Msg_S -- CODEFIX??? ("two consecutive punctuation characters not permitted"); end if; end if; --- 529,542 ---- Error_Msg_S -- CODEFIX ("two consecutive underlines not permitted"); else ! Error_Msg_S ("underline cannot follow punctuation character"); end if; else if Source (Scan_Ptr - 1) = '_' then ! Error_Msg_S ("punctuation character cannot follow underline"); else ! Error_Msg_S ("two consecutive punctuation characters not permitted"); end if; end if; *************** package body Scng is *** 514,519 **** --- 661,667 ---- Base := 10; UI_Base := Uint_10; UI_Int_Value := Uint_0; + Based_Literal_Uses_Colon := False; Scale := 0; Scan_Integer; Point_Scanned := False; *************** package body Scng is *** 566,586 **** or else Source (Scan_Ptr + 1) in 'a' .. 'z')) then - if C = ':' then - Obsolescent_Check (Scan_Ptr); - - if Warn_On_Obsolescent_Feature then - Error_Msg_S - ("use of "":"" is an obsolescent feature (RM J.2(3))?"); - Error_Msg_S - ("\use ""'#"" instead?"); - end if; - end if; - Accumulate_Checksum (C); Base_Char := C; UI_Base := UI_Int_Value; if UI_Base < 2 or else UI_Base > 16 then Error_Msg_SC ("base not 2-16"); UI_Base := Uint_16; --- 714,727 ---- or else Source (Scan_Ptr + 1) in 'a' .. 'z')) then Accumulate_Checksum (C); Base_Char := C; UI_Base := UI_Int_Value; + if Base_Char = ':' then + Based_Literal_Uses_Colon := True; + end if; + if UI_Base < 2 or else UI_Base > 16 then Error_Msg_SC ("base not 2-16"); UI_Base := Uint_16; *************** package body Scng is *** 658,666 **** elsif not Identifier_Char (C) then if Base_Char = '#' then ! Error_Msg_S ("missing '#"); else ! Error_Msg_S ("missing ':"); end if; exit; --- 799,809 ---- elsif not Identifier_Char (C) then if Base_Char = '#' then ! Error_Msg_S -- CODEFIX ! ("missing '#"); else ! Error_Msg_S -- CODEFIX ! ("missing ':"); end if; exit; *************** package body Scng is *** 749,755 **** end if; end if; ! Accumulate_Token_Checksum; return; end Nlit; --- 892,900 ---- end if; end if; ! if Checksum_Accumulate_Token_Checksum then ! Accumulate_Token_Checksum; ! end if; return; end Nlit; *************** package body Scng is *** 875,881 **** end if; end if; ! Error_Msg_S -- CODEFIX ("missing string quote"); end Error_Unterminated_String; --- 1020,1026 ---- end if; end if; ! Error_Msg_S -- CODEFIX ("missing string quote"); end Error_Unterminated_String; *************** package body Scng is *** 1042,1056 **** Code := Get_Char_Code (C); Scan_Ptr := Scan_Ptr + 1; ! elsif (C = ESC ! and then Wide_Character_Encoding_Method ! in WC_ESC_Encoding_Method) ! or else (C in Upper_Half_Character ! and then Upper_Half_Encoding) ! or else (C = '[' ! and then Source (Scan_Ptr + 1) = '"' ! and then Identifier_Char (Source (Scan_Ptr + 2))) ! then Wptr := Scan_Ptr; Scan_Wide (Source, Scan_Ptr, Code, Err); --- 1187,1193 ---- Code := Get_Char_Code (C); Scan_Ptr := Scan_Ptr + 1; ! elsif Start_Of_Wide_Character then Wptr := Scan_Ptr; Scan_Wide (Source, Scan_Ptr, Code, Err); *************** package body Scng is *** 1065,1071 **** -- but in Ada 2005, the set of characters allowed has been -- restricted to graphic characters. ! if Ada_Version >= Ada_05 and then Is_UTF_32_Non_Graphic (UTF_32 (Code)) then Error_Msg --- 1202,1208 ---- -- but in Ada 2005, the set of characters allowed has been -- restricted to graphic characters. ! if Ada_Version >= Ada_2005 and then Is_UTF_32_Non_Graphic (UTF_32 (Code)) then Error_Msg *************** package body Scng is *** 1112,1117 **** --- 1249,1310 ---- return; end Slit; + ---------------------------------- + -- Skip_Other_Format_Characters -- + ---------------------------------- + + procedure Skip_Other_Format_Characters is + P : Source_Ptr; + Code : Char_Code; + Err : Boolean; + + begin + while Start_Of_Wide_Character loop + P := Scan_Ptr; + Scan_Wide (Source, Scan_Ptr, Code, Err); + + if not Is_UTF_32_Other (UTF_32 (Code)) then + Scan_Ptr := P; + return; + end if; + end loop; + end Skip_Other_Format_Characters; + + ----------------------------- + -- Start_Of_Wide_Character -- + ----------------------------- + + function Start_Of_Wide_Character return Boolean is + C : constant Character := Source (Scan_Ptr); + + begin + -- ESC encoding method with ESC present + + if C = ESC + and then Wide_Character_Encoding_Method in WC_ESC_Encoding_Method + then + return True; + + -- Upper half character with upper half encoding + + elsif C in Upper_Half_Character and then Upper_Half_Encoding then + return True; + + -- Brackets encoding + + elsif C = '[' + and then Source (Scan_Ptr + 1) = '"' + and then Identifier_Char (Source (Scan_Ptr + 2)) + then + return True; + + -- Not the start of a wide character + + else + return False; + end if; + end Start_Of_Wide_Character; + -- Start of processing for Scan begin *************** package body Scng is *** 1215,1221 **** Accumulate_Checksum ('&'); if Source (Scan_Ptr + 1) = '&' then ! Error_Msg_S ("'&'& should be `AND THEN`"); Scan_Ptr := Scan_Ptr + 2; Token := Tok_And; return; --- 1408,1415 ---- Accumulate_Checksum ('&'); if Source (Scan_Ptr + 1) = '&' then ! Error_Msg_S -- CODEFIX ! ("'&'& should be `AND THEN`"); Scan_Ptr := Scan_Ptr + 2; Token := Tok_And; return; *************** package body Scng is *** 1263,1269 **** and then Source (Scan_Ptr + 2) /= '-' then Token := Tok_Colon_Equal; ! Error_Msg (":- should be :=", Scan_Ptr); Scan_Ptr := Scan_Ptr + 2; return; --- 1457,1464 ---- and then Source (Scan_Ptr + 2) /= '-' then Token := Tok_Colon_Equal; ! Error_Msg -- CODEFIX ! (":- should be :=", Scan_Ptr); Scan_Ptr := Scan_Ptr + 2; return; *************** package body Scng is *** 1367,1373 **** return; elsif Source (Scan_Ptr + 1) = '=' then ! Error_Msg_S ("== should be ="); Scan_Ptr := Scan_Ptr + 1; end if; --- 1562,1569 ---- return; elsif Source (Scan_Ptr + 1) = '=' then ! Error_Msg_S -- CODEFIX ! ("== should be ="); Scan_Ptr := Scan_Ptr + 1; end if; *************** package body Scng is *** 1513,1524 **** -- If we have a wide character, we have to scan it out, -- because it might be a legitimate line terminator ! elsif (Source (Scan_Ptr) = ESC ! and then Identifier_Char (ESC)) ! or else ! (Source (Scan_Ptr) in Upper_Half_Character ! and then Upper_Half_Encoding) ! then declare Wptr : constant Source_Ptr := Scan_Ptr; Code : Char_Code; --- 1709,1715 ---- -- If we have a wide character, we have to scan it out, -- because it might be a legitimate line terminator ! elsif Start_Of_Wide_Character then declare Wptr : constant Source_Ptr := Scan_Ptr; Code : Char_Code; *************** package body Scng is *** 1573,1597 **** end if; end Minus_Case; ! -- Double quote starting a string literal ! ! when '"' => ! Slit; ! Post_Scan; ! return; ! ! -- Percent starting a string literal ! ! when '%' => ! Obsolescent_Check (Token_Ptr); ! ! if Warn_On_Obsolescent_Feature then ! Error_Msg_S ! ("use of ""'%"" is an obsolescent feature (RM J.2(4))?"); ! Error_Msg_S ! ("\use """""" instead?"); ! end if; Slit; Post_Scan; return; --- 1764,1772 ---- end if; end Minus_Case; ! -- Double quote or percent starting a string literal + when '"' | '%' => Slit; Post_Scan; return; *************** package body Scng is *** 1642,1659 **** else -- Case of wide character literal ! if (Source (Scan_Ptr) = ESC ! and then ! Wide_Character_Encoding_Method in WC_ESC_Encoding_Method) ! or else ! (Source (Scan_Ptr) in Upper_Half_Character ! and then ! Upper_Half_Encoding) ! or else ! (Source (Scan_Ptr) = '[' ! and then ! Source (Scan_Ptr + 1) = '"') ! then Wptr := Scan_Ptr; Scan_Wide (Source, Scan_Ptr, Code, Err); Accumulate_Checksum (Code); --- 1817,1823 ---- else -- Case of wide character literal ! if Start_Of_Wide_Character then Wptr := Scan_Ptr; Scan_Wide (Source, Scan_Ptr, Code, Err); Accumulate_Checksum (Code); *************** package body Scng is *** 1666,1681 **** -- literal, but in Ada 2005, the set of characters allowed -- is restricted to graphic characters. ! elsif Ada_Version >= Ada_05 and then Is_UTF_32_Non_Graphic (UTF_32 (Code)) then ! Error_Msg ("(Ada 2005) non-graphic character not permitted " & "in character literal", Wptr); end if; if Source (Scan_Ptr) /= ''' then ! Error_Msg_S ("missing apostrophe"); else Scan_Ptr := Scan_Ptr + 1; end if; --- 1830,1845 ---- -- literal, but in Ada 2005, the set of characters allowed -- is restricted to graphic characters. ! elsif Ada_Version >= Ada_2005 and then Is_UTF_32_Non_Graphic (UTF_32 (Code)) then ! Error_Msg -- CODEFIX???? ("(Ada 2005) non-graphic character not permitted " & "in character literal", Wptr); end if; if Source (Scan_Ptr) /= ''' then ! Error_Msg_S ("missing apostrophe"); else Scan_Ptr := Scan_Ptr + 1; end if; *************** package body Scng is *** 1789,1795 **** -- Special check for || to give nice message if Source (Scan_Ptr + 1) = '|' then ! Error_Msg_S ("""'|'|"" should be `OR ELSE`"); Scan_Ptr := Scan_Ptr + 2; Token := Tok_Or; return; --- 1953,1960 ---- -- Special check for || to give nice message if Source (Scan_Ptr + 1) = '|' then ! Error_Msg_S -- CODEFIX ! ("""'|'|"" should be `OR ELSE`"); Scan_Ptr := Scan_Ptr + 2; Token := Tok_Or; return; *************** package body Scng is *** 1802,1807 **** --- 1967,1973 ---- Style.Check_Vertical_Bar; end if; + Post_Scan; return; end if; end Vertical_Bar_Case; *************** package body Scng is *** 1810,1826 **** when '!' => Exclamation_Case : begin Accumulate_Checksum ('!'); - Obsolescent_Check (Token_Ptr); - - if Warn_On_Obsolescent_Feature then - Error_Msg_S - ("use of ""'!"" is an obsolescent feature (RM J.2(2))?"); - Error_Msg_S - ("\use ""'|"" instead?"); - end if; if Source (Scan_Ptr + 1) = '=' then ! Error_Msg_S ("'!= should be /="); Scan_Ptr := Scan_Ptr + 2; Token := Tok_Not_Equal; return; --- 1976,1985 ---- when '!' => Exclamation_Case : begin Accumulate_Checksum ('!'); if Source (Scan_Ptr + 1) = '=' then ! Error_Msg_S -- CODEFIX ! ("'!= should be /="); Scan_Ptr := Scan_Ptr + 2; Token := Tok_Not_Equal; return; *************** package body Scng is *** 1828,1833 **** --- 1987,1993 ---- else Scan_Ptr := Scan_Ptr + 1; Token := Tok_Vertical_Bar; + Post_Scan; return; end if; end Exclamation_Case; *************** package body Scng is *** 1892,1897 **** --- 2052,2061 ---- Nlit; + -- Check for proper delimiter, ignoring other format characters + + Skip_Other_Format_Characters; + if Identifier_Char (Source (Scan_Ptr)) then Error_Msg_S ("delimiter required between literal and identifier"); *************** package body Scng is *** 2059,2064 **** --- 2223,2234 ---- elsif Is_UTF_32_Space (Cat) then goto Scan_Next_Character; + -- If other format character, ignore and keep scanning (again we + -- do not include in the checksum) (this is for AI-0079). + + elsif Is_UTF_32_Other (Cat) then + goto Scan_Next_Character; + -- If OK wide line terminator, terminate current line elsif Is_UTF_32_Line_Terminator (UTF_32 (Code)) then *************** package body Scng is *** 2068,2075 **** -- Punctuation is an error (at start of identifier) elsif Is_UTF_32_Punctuation (Cat) then ! Error_Msg ! ("identifier cannot start with punctuation", Wptr); Scan_Ptr := Wptr; Name_Len := 0; Underline_Found := False; --- 2238,2244 ---- -- Punctuation is an error (at start of identifier) elsif Is_UTF_32_Punctuation (Cat) then ! Error_Msg ("identifier cannot start with punctuation", Wptr); Scan_Ptr := Wptr; Name_Len := 0; Underline_Found := False; *************** package body Scng is *** 2078,2095 **** -- Mark character is an error (at start of identifier) elsif Is_UTF_32_Mark (Cat) then ! Error_Msg ! ("identifier cannot start with mark character", Wptr); ! Scan_Ptr := Wptr; ! Name_Len := 0; ! Underline_Found := False; ! goto Scan_Identifier; ! ! -- Other format character is an error (at start of identifier) ! ! elsif Is_UTF_32_Other (Cat) then ! Error_Msg ! ("identifier cannot start with other format character", Wptr); Scan_Ptr := Wptr; Name_Len := 0; Underline_Found := False; --- 2247,2253 ---- -- Mark character is an error (at start of identifier) elsif Is_UTF_32_Mark (Cat) then ! Error_Msg ("identifier cannot start with mark character", Wptr); Scan_Ptr := Wptr; Name_Len := 0; Underline_Found := False; *************** package body Scng is *** 2277,2282 **** --- 2435,2467 ---- -- Here if not a normal identifier character else + Cat := Get_Category (UTF_32 (Code)); + + -- Wide character in Unicode category "Other, Format" + -- is not accepted in an identifier. This is because it + -- it is considered a security risk (AI-0091). + + -- However, it is OK for such a character to appear at + -- the end of an identifier. + + if Is_UTF_32_Other (Cat) then + if not Identifier_Char (Source (Scan_Ptr)) then + goto Scan_Identifier_Complete; + else + Error_Msg + ("identifier cannot contain other_format " + & "character", Wptr); + goto Scan_Identifier; + end if; + + -- Wide character in category Separator,Space terminates + + elsif Is_UTF_32_Space (Cat) then + goto Scan_Identifier_Complete; + end if; + + -- Here if wide character is part of the identifier + -- Make sure we are allowing wide characters in -- identifiers. Note that we allow wide character -- notation for an OK identifier character. This in *************** package body Scng is *** 2286,2299 **** -- Wide characters are always allowed in Ada 2005 if Identifier_Character_Set /= 'w' ! and then Ada_Version < Ada_05 then Error_Msg ! ("wide character not allowed in identifier", Wptr); end if; - Cat := Get_Category (UTF_32 (Code)); - -- If OK letter, store it folding to upper case. Note -- that we include the folded letter in the checksum. --- 2471,2482 ---- -- Wide characters are always allowed in Ada 2005 if Identifier_Character_Set /= 'w' ! and then Ada_Version < Ada_2005 then Error_Msg ! ("wide character not allowed in identifier", Wptr); end if; -- If OK letter, store it folding to upper case. Note -- that we include the folded letter in the checksum. *************** package body Scng is *** 2333,2355 **** Underline_Found := True; end if; - -- 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. - - -- Note that it is correct (see AI-395) to simply strip - -- other format characters, before testing for double - -- underlines, or for reserved words). - - elsif Is_UTF_32_Other (Cat) then - null; - - -- Wide character in category Separator,Space terminates - - elsif Is_UTF_32_Space (Cat) then - goto Scan_Identifier_Complete; - -- Any other wide character is not acceptable else --- 2516,2521 ---- *************** package body Scng is *** 2383,2392 **** end if; end if; -- Here is where we check if it was a keyword if Is_Keyword_Name (Token_Name) then ! Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name)); -- Keyword style checks --- 2549,2577 ---- end if; end if; + -- We will assume it is an identifier, not a keyword, so that the + -- checksum is independent of the Ada version. + + Token := Tok_Identifier; + -- Here is where we check if it was a keyword if Is_Keyword_Name (Token_Name) then ! if Opt.Checksum_GNAT_6_3 then ! Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name)); ! ! if Checksum_Accumulate_Token_Checksum then ! if Checksum_GNAT_5_03 then ! Accumulate_Token_Checksum_GNAT_5_03; ! else ! Accumulate_Token_Checksum_GNAT_6_3; ! end if; ! end if; ! ! else ! Accumulate_Token_Checksum; ! Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name)); ! end if; -- Keyword style checks *************** package body Scng is *** 2438,2451 **** -- corresponding keyword. Token_Name := No_Name; - Accumulate_Token_Checksum; return; -- It is an identifier after all else ! Token := Tok_Identifier; ! Accumulate_Token_Checksum; Post_Scan; return; end if; --- 2623,2637 ---- -- corresponding keyword. Token_Name := No_Name; return; -- It is an identifier after all else ! if Checksum_Accumulate_Token_Checksum then ! Accumulate_Token_Checksum; ! end if; ! Post_Scan; return; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/scng.ads gcc-4.6.0/gcc/ada/scng.ads *** gcc-4.5.2/gcc/ada/scng.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/scng.ads Thu Sep 9 12:31:35 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,31 **** -- -- ------------------------------------------------------------------------------ ! -- This package contains a generic lexical analyzer. This is used ! -- for scanning Ada source files or text files with an Ada-like syntax, ! -- such as project files. It is instantiated in Scn and Prj.Err. with Casing; use Casing; with Styleg; --- 23,31 ---- -- -- ------------------------------------------------------------------------------ ! -- This package contains a generic lexical analyzer. This is used for scanning ! -- Ada source files or text files with an Ada-like syntax, such as project ! -- files. It is instantiated in Scn and Prj.Err. with Casing; use Casing; with Styleg; *************** with Types; use Types; *** 33,41 **** generic with procedure Post_Scan; ! -- Procedure called by Scan for the following tokens: ! -- Tok_Char_Literal, Tok_Identifier, Tok_Real_Literal, Tok_Real_Literal, ! -- Tok_Integer_Literal, Tok_String_Literal, Tok_Operator_Symbol. with procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr); -- Output a message at specified location --- 33,42 ---- generic with procedure Post_Scan; ! -- Procedure called by Scan for the following tokens: Tok_Char_Literal, ! -- Tok_Identifier, Tok_Real_Literal, Tok_Real_Literal, Tok_Integer_Literal, ! -- Tok_String_Literal, Tok_Operator_Symbol, and Tok_Vertical_Bar. Used to ! -- build Token_Node and also check for obsolescent features. with procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr); -- Output a message at specified location *************** generic *** 49,58 **** with procedure Error_Msg_SP (Msg : String); -- Output a message at the start of the previous token - with procedure Obsolescent_Check (S : Source_Ptr); - -- Called when one of the obsolescent character replacements is - -- used with S pointing to the character in question. - with package Style is new Styleg (Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP); -- Instantiation of Styleg with the same error reporting routines --- 50,55 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/scos.ads gcc-4.6.0/gcc/ada/scos.ads *** gcc-4.5.2/gcc/ada/scos.ads Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/scos.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2009-2010, 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- -- *************** package SCOs is *** 148,168 **** -- o object declaration -- r renaming declaration -- i generic instantiation ! -- C CASE statement (includes only the expression) -- E EXIT statement ! -- F FOR loop statement (includes only the iteration scheme) ! -- I IF statement (includes only the condition [in the RM sense, which ! -- is a decision in the SCO sense]) -- P PRAGMA -- R extended RETURN statement ! -- W WHILE loop statement (includes only the condition) ! -- and is omitted for all other cases. -- Decisions -- Note: in the following description, logical operator includes only the ! -- short circuited forms and NOT (so can be only NOT, AND THEN, OR ELSE). -- The reason that we can exclude AND/OR/XOR is that we expect SCO's to -- be generated using the restriction No_Direct_Boolean_Operators if we -- are interested in decision coverage, which does not permit the use of --- 148,174 ---- -- o object declaration -- r renaming declaration -- i generic instantiation ! -- C CASE statement (from CASE through end of expression) -- E EXIT statement ! -- F FOR loop statement (from FOR through end of iteration scheme) ! -- I IF statement (from IF through end of condition) -- P PRAGMA -- R extended RETURN statement ! -- W WHILE loop statement (from WHILE through end of condition) ! -- Note: for I and W, condition above is in the RM syntax sense (this ! -- condition is a decision in SCO terminology). ! ! -- and is omitted for all other cases ! ! -- Note: up to 6 entries can appear on a single CS line. If more than 6 ! -- entries appear in one logical statement sequence, continuation lines ! -- are marked by Cs and appear immediately after the CS line. -- Decisions -- Note: in the following description, logical operator includes only the ! -- short-circuited forms and NOT (so can be only NOT, AND THEN, OR ELSE). -- The reason that we can exclude AND/OR/XOR is that we expect SCO's to -- be generated using the restriction No_Direct_Boolean_Operators if we -- are interested in decision coverage, which does not permit the use of *************** package SCOs is *** 171,188 **** -- we are generating SCO's only for simple coverage, then we are not -- interested in decisions in any case. ! -- Decisions are either simple or complex. A simple decision is a boolean ! -- expresssion that occurs in the context of a control structure in the ! -- source program, including WHILE, IF, EXIT WHEN, or in an Assert, ! -- Check, Pre_Condition or Post_Condition pragma. For pragmas, decision ! -- SCOs are generated only if the corresponding pragma is enabled. Note ! -- that a boolean expression in any other context, for example as right ! -- hand side of an assignment, is not considered to be a simple decision. ! -- A complex decision is an occurrence of a logical operator which is not ! -- itself an operand of some other logical operator. If any operand of ! -- the logical operator is itself a logical operator, this is not a ! -- separate decision, it is part of the same decision. -- So for example, if we have --- 177,203 ---- -- we are generating SCO's only for simple coverage, then we are not -- interested in decisions in any case. ! -- Note: the reason we include NOT is for informational purposes. The ! -- presence of NOT does not generate additional coverage obligations, ! -- but if we know where the NOT's are, the coverage tool can generate ! -- more accurate diagnostics on uncovered tests. ! -- A top level boolean expression is a boolean expression that is not an ! -- operand of a logical operator. ! ! -- Decisions are either simple or complex. A simple decision is a top ! -- level boolean expression that has only one condition and that occurs ! -- in the context of a control structure in the source program, including ! -- WHILE, IF, EXIT WHEN, or in an Assert, Check, Pre_Condition or ! -- Post_Condition pragma. For pragmas, decision SCOs are generated only ! -- if the corresponding pragma is enabled. Note that a top level boolean ! -- expression with only one condition that occurs in any other context, ! -- for example as right hand side of an assignment, is not considered to ! -- be a (simple) decision. ! ! -- A complex decision is a top level boolean expression that has more ! -- than one condition. A complex decision may occur in any boolean ! -- expression context. -- So for example, if we have *************** package SCOs is *** 201,207 **** -- For each decision, a decision line is generated with the form: ! -- C*sloc expression -- Here * is one of the following characters: --- 216,222 ---- -- For each decision, a decision line is generated with the form: ! -- C* sloc expression [chaining] -- Here * is one of the following characters: *************** package SCOs is *** 214,223 **** -- For I, E, P, W, sloc is the source location of the IF, EXIT, PRAGMA or -- WHILE token. ! -- For X, sloc is omitted. -- The expression is a prefix polish form indicating the structure of ! -- the decision, including logical operators and short circuit forms. -- The following is a grammar showing the structure of expression: -- expression ::= term (if expr is not logical operator) --- 229,238 ---- -- For I, E, P, W, sloc is the source location of the IF, EXIT, PRAGMA or -- WHILE token. ! -- For X, sloc is omitted -- The expression is a prefix polish form indicating the structure of ! -- the decision, including logical operators and short-circuit forms. -- The following is a grammar showing the structure of expression: -- expression ::= term (if expr is not logical operator) *************** package SCOs is *** 225,231 **** -- expression ::= |sloc term term (if expr is OR or OR ELSE) -- expression ::= !sloc term (if expr is NOT) ! -- In the last four cases, sloc is the source location of the AND, OR, -- or NOT token, respectively. -- term ::= element --- 240,246 ---- -- expression ::= |sloc term term (if expr is OR or OR ELSE) -- expression ::= !sloc term (if expr is NOT) ! -- In the last three cases, sloc is the source location of the AND, OR, -- or NOT token, respectively. -- term ::= element *************** package SCOs is *** 242,255 **** -- where t/f are used to mark a condition that has been recognized by -- the compiler as always being true or false. ! -- & indicates AND THEN connecting two conditions. ! -- | indicates OR ELSE connecting two conditions. ! -- ! indicates NOT applied to the expression. ! -- In the context of Couverture, the No_Direct_Boolean_Opeartors ! -- restriction is assumed, and no other operator can appear. --------------------------------------------------------------------- -- Internal table used to store Source Coverage Obligations (SCOs) -- --- 257,325 ---- -- where t/f are used to mark a condition that has been recognized by -- the compiler as always being true or false. ! -- & indicates AND THEN connecting two conditions ! -- | indicates OR ELSE connecting two conditions ! -- ! indicates NOT applied to the expression ! -- Note that complex decisions do NOT include non-short-circuited logical ! -- operators (AND/XOR/OR). In the context of existing coverage tools the ! -- No_Direct_Boolean_Operators restriction is assumed, so these operators ! -- cannot appear in the source in any case. ! ! -- The SCO line for a decision always occurs after the CS line for the ! -- enclosing statement. The SCO line for a nested decision always occurs ! -- after the line for the enclosing decision. ! ! -- Note that membership tests are considered to be a single simple ! -- condition, and that is true even if the Ada 2005 set membership ! -- form is used, e.g. A in (2,7,11.15). ! ! -- The expression can be followed by chaining indicators of the form ! -- Tsloc-range or Fsloc-range. ! ! -- T* is present when the statement with the given sloc range is executed ! -- if, and only if, the decision evaluates to TRUE. ! ! -- F* is present when the statement with the given sloc range is executed ! -- if, and only if, the decision evaluates to FALSE. ! ! -- For an IF statement or ELSIF part, a T chaining indicator is always ! -- present, with the sloc range of the first statement in the ! -- corresponding sequence. ! ! -- For an ELSE part, the last decision in the IF statement (that of the ! -- last ELSIF part, if any, or that of the IF statement if there is no ! -- ELSIF part) has an F chaining indicator with the sloc range of the ! -- first statement in the sequence of the ELSE part. ! ! -- For a WHILE loop, a T chaining indicator is always present, with the ! -- sloc range of the first statement in the loop, but no F chaining ! -- indicator is ever present. ! ! -- For an EXIT WHEN statement, an F chaining indicator is present if ! -- there is an immediately following sequence in the same sequence of ! -- statements. ! ! -- In all other cases, chaining indicators are omitted ! ! -- Case Expressions ! ! -- For case statements, we rely on statement coverage to make sure that ! -- all branches of a case statement are covered, but that does not work ! -- for case expressions, since the entire expression is contained in a ! -- single statement. However, for complete coverage we really should be ! -- able to check that every branch of the case statement is covered, so ! -- we generate a SCO of the form: ! ! -- CC sloc-range sloc-range ... ! ! -- where sloc-range covers the range of the case expression ! ! -- Note: up to 6 entries can appear on a single CC line. If more than 6 ! -- entries appear in one logical statement sequence, continuation lines ! -- are marked by Cc and appear immediately after the CC line. --------------------------------------------------------------------- -- Internal table used to store Source Coverage Obligations (SCOs) -- *************** package SCOs is *** 289,307 **** -- Note: successive statements (possibly interspersed with entries of -- other kinds, that are ignored for this purpose), starting with one -- labeled with C1 = 'S', up to and including the first one labeled with ! -- Last=True, indicate the sequence to be output for a sequence of ! -- statements on a single CS line. ! -- Decision ! -- C1 = decision type code -- C2 = ' ' ! -- From = location of IF/EXIT/PRAGMA/WHILE token, ! -- No_Source_Location for X -- To = No_Source_Location -- Last = unused -- Operator ! -- C1 = '!', '^', '&', '|' -- C2 = ' ' -- From = location of NOT/AND/OR token -- To = No_Source_Location --- 359,403 ---- -- Note: successive statements (possibly interspersed with entries of -- other kinds, that are ignored for this purpose), starting with one -- labeled with C1 = 'S', up to and including the first one labeled with ! -- Last = True, indicate the sequence to be output for a sequence of ! -- statements on a single CS line (possibly followed by Cs continuation ! -- lines). ! -- Decision (IF/EXIT/WHILE) ! -- C1 = 'I'/'E'/'W' (for IF/EXIT/WHILE) -- C2 = ' ' ! -- From = IF/EXIT/WHILE token ! -- To = No_Source_Location ! -- Last = unused ! ! -- Decision (PRAGMA) ! -- C1 = 'P' ! -- C2 = 'e'/'d' for enabled/disabled ! -- From = PRAGMA token ! -- To = No_Source_Location ! -- Last = unused ! ! -- Note: when the parse tree is first scanned, we unconditionally build ! -- a pragma decision entry for any decision in a pragma (here as always ! -- in SCO contexts, the only pragmas with decisions are Assert, Check, ! -- Precondition and Postcondition), and we mark the pragma as disabled. ! -- ! -- During analysis, if the pragma is enabled, Set_SCO_Pragma_Enabled to ! -- mark the SCO decision table entry as enabled (C2 set to 'e'). Then ! -- in Put_SCOs, we only output the decision for a pragma if C2 is 'e'. ! -- ! -- When we read SCOs from an ALI file (in Get_SCOs), we always set C2 ! -- to 'e', since clearly the pragma is enabled if it was written out. ! ! -- Decision (Expression) ! -- C1 = 'X' ! -- C2 = ' ' ! -- From = No_Source_Location -- To = No_Source_Location -- Last = unused -- Operator ! -- C1 = '!', '&', '|' -- C2 = ' ' -- From = location of NOT/AND/OR token -- To = No_Source_Location *************** package SCOs is *** 314,323 **** -- To = ending source location -- Last = False for all but the last entry, True for last entry -- Note: the sequence starting with a decision, and continuing with -- operators and elements up to and including the first one labeled with ! -- Last = True, indicate the sequence to be output for a complex decision ! -- on a single CD decision line. ---------------- -- Unit Table -- --- 410,424 ---- -- To = ending source location -- Last = False for all but the last entry, True for last entry + -- Element (chaining indicator) + -- C1 = 'H' (cHain) + -- C2 = 'T' or 'F' (chaining on decision true/false) + -- From = starting source location of chained statement + -- To = ending source location of chained statement + -- Note: the sequence starting with a decision, and continuing with -- operators and elements up to and including the first one labeled with ! -- Last = True, indicate the sequence to be output on one decision line. ---------------- -- Unit Table -- diff -Nrcpad gcc-4.5.2/gcc/ada/sem.adb gcc-4.6.0/gcc/ada/sem.adb *** gcc-4.5.2/gcc/ada/sem.adb Mon Nov 30 11:55:21 2009 --- gcc-4.6.0/gcc/ada/sem.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem is *** 67,75 **** -- Controls debugging printouts for Walk_Library_Items Outer_Generic_Scope : Entity_Id := Empty; ! -- Global reference to the outer scope that is generic. In a non ! -- generic context, it is empty. At the moment, it is only used ! -- for avoiding freezing of external references in generics. Comp_Unit_List : Elist_Id := No_Elist; -- Used by Walk_Library_Items. This is a list of N_Compilation_Unit nodes --- 67,75 ---- -- Controls debugging printouts for Walk_Library_Items Outer_Generic_Scope : Entity_Id := Empty; ! -- Global reference to the outer scope that is generic. In a non-generic ! -- context, it is empty. At the moment, it is only used for avoiding ! -- freezing of external references in generics. Comp_Unit_List : Elist_Id := No_Elist; -- Used by Walk_Library_Items. This is a list of N_Compilation_Unit nodes *************** package body Sem is *** 80,88 **** generic with procedure Action (Withed_Unit : Node_Id); procedure Walk_Withs_Immediate (CU : Node_Id; Include_Limited : Boolean); ! -- Walk all the with clauses of CU, and call Action for the with'ed ! -- unit. Ignore limited withs, unless Include_Limited is True. ! -- CU must be an N_Compilation_Unit. generic with procedure Action (Withed_Unit : Node_Id); --- 80,88 ---- generic with procedure Action (Withed_Unit : Node_Id); procedure Walk_Withs_Immediate (CU : Node_Id; Include_Limited : Boolean); ! -- Walk all the with clauses of CU, and call Action for the with'ed unit. ! -- Ignore limited withs, unless Include_Limited is True. CU must be an ! -- N_Compilation_Unit. generic with procedure Action (Withed_Unit : Node_Id); *************** package body Sem is *** 158,163 **** --- 158,166 ---- when N_Block_Statement => Analyze_Block_Statement (N); + when N_Case_Expression => + Analyze_Case_Expression (N); + when N_Case_Statement => Analyze_Case_Statement (N); *************** package body Sem is *** 221,226 **** --- 224,232 ---- when N_Explicit_Dereference => Analyze_Explicit_Dereference (N); + when N_Expression_With_Actions => + Analyze_Expression_With_Actions (N); + when N_Extended_Return_Statement => Analyze_Extended_Return_Statement (N); *************** package body Sem is *** 231,240 **** Analyze_Formal_Object_Declaration (N); when N_Formal_Package_Declaration => ! Analyze_Formal_Package (N); when N_Formal_Subprogram_Declaration => ! Analyze_Formal_Subprogram (N); when N_Formal_Type_Declaration => Analyze_Formal_Type_Declaration (N); --- 237,246 ---- Analyze_Formal_Object_Declaration (N); when N_Formal_Package_Declaration => ! Analyze_Formal_Package_Declaration (N); when N_Formal_Subprogram_Declaration => ! Analyze_Formal_Subprogram_Declaration (N); when N_Formal_Type_Declaration => Analyze_Formal_Type_Declaration (N); *************** package body Sem is *** 246,252 **** Analyze_Freeze_Entity (N); when N_Full_Type_Declaration => ! Analyze_Type_Declaration (N); when N_Function_Call => Analyze_Function_Call (N); --- 252,258 ---- Analyze_Freeze_Entity (N); when N_Full_Type_Declaration => ! Analyze_Full_Type_Declaration (N); when N_Function_Call => Analyze_Function_Call (N); *************** package body Sem is *** 296,301 **** --- 302,310 ---- when N_Integer_Literal => Analyze_Integer_Literal (N); + when N_Iterator_Specification => + Analyze_Iterator_Specification (N); + when N_Itype_Reference => Analyze_Itype_Reference (N); *************** package body Sem is *** 431,436 **** --- 440,448 ---- when N_Parameter_Association => Analyze_Parameter_Association (N); + when N_Parameterized_Expression => + Analyze_Parameterized_Expression (N); + when N_Pragma => Analyze_Pragma (N); *************** package body Sem is *** 456,466 **** Analyze_Protected_Definition (N); when N_Protected_Type_Declaration => ! Analyze_Protected_Type (N); when N_Qualified_Expression => Analyze_Qualified_Expression (N); when N_Raise_Statement => Analyze_Raise_Statement (N); --- 468,481 ---- Analyze_Protected_Definition (N); when N_Protected_Type_Declaration => ! Analyze_Protected_Type_Declaration (N); when N_Qualified_Expression => Analyze_Qualified_Expression (N); + when N_Quantified_Expression => + Analyze_Quantified_Expression (N); + when N_Raise_Statement => Analyze_Raise_Statement (N); *************** package body Sem is *** 496,505 **** Analyze_Selective_Accept (N); when N_Single_Protected_Declaration => ! Analyze_Single_Protected (N); when N_Single_Task_Declaration => ! Analyze_Single_Task (N); when N_Slice => Analyze_Slice (N); --- 511,520 ---- Analyze_Selective_Accept (N); when N_Single_Protected_Declaration => ! Analyze_Single_Protected_Declaration (N); when N_Single_Task_Declaration => ! Analyze_Single_Task_Declaration (N); when N_Slice => Analyze_Slice (N); *************** package body Sem is *** 541,547 **** Analyze_Task_Definition (N); when N_Task_Type_Declaration => ! Analyze_Task_Type (N); when N_Terminate_Alternative => Analyze_Terminate_Alternative (N); --- 556,562 ---- Analyze_Task_Definition (N); when N_Task_Type_Declaration => ! Analyze_Task_Type_Declaration (N); when N_Terminate_Alternative => Analyze_Terminate_Alternative (N); *************** package body Sem is *** 576,589 **** when N_With_Clause => Analyze_With_Clause (N); ! -- A call to analyze the Empty node is an error, but most likely ! -- it is an error caused by an attempt to analyze a malformed ! -- piece of tree caused by some other error, so if there have ! -- 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 --- 591,604 ---- when N_With_Clause => Analyze_With_Clause (N); ! -- A call to analyze the Empty node is an error, but most likely it ! -- is an error caused by an attempt to analyze a malformed piece of ! -- tree caused by some other error, so if there have 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 *************** package body Sem is *** 609,619 **** -- analyzed. when ! N_SCIL_Dispatch_Table_Object_Init | ! N_SCIL_Dispatch_Table_Tag_Init | ! N_SCIL_Dispatching_Call | ! N_SCIL_Membership_Test | ! N_SCIL_Tag_Init => null; -- For the remaining node types, we generate compiler abort, because --- 624,632 ---- -- analyzed. when ! N_SCIL_Dispatch_Table_Tag_Init | ! N_SCIL_Dispatching_Call | ! N_SCIL_Membership_Test => null; -- For the remaining node types, we generate compiler abort, because *************** package body Sem is *** 629,634 **** --- 642,649 ---- N_Access_Function_Definition | N_Access_Procedure_Definition | N_Access_To_Object_Definition | + N_Aspect_Specification | + N_Case_Expression_Alternative | N_Case_Statement_Alternative | N_Compilation_Unit_Aux | N_Component_Association | *************** package body Sem is *** 841,847 **** return; end if; ! -- Now search the global entity suppress table for a matching entry -- We also search this in reverse order so that if there are multiple -- pragmas for the same entity, the last one applies. --- 856,862 ---- return; end if; ! -- Now search the global entity suppress table for a matching entry. -- We also search this in reverse order so that if there are multiple -- pragmas for the same entity, the last one applies. *************** package body Sem is *** 1109,1120 **** Node := First (L); Insert_List_After (N, L); ! -- Now just analyze from the original first node until we get to ! -- the successor of the original insertion point (which may be ! -- Empty if the insertion point was at the end of the list). Note ! -- that this properly handles the case where any of the analyze ! -- calls result in the insertion of nodes after the analyzed ! -- node (possibly calling this routine recursively). while Node /= After loop Analyze (Node); --- 1124,1135 ---- Node := First (L); Insert_List_After (N, L); ! -- Now just analyze from the original first node until we get to the ! -- successor of the original insertion point (which may be Empty if ! -- the insertion point was at the end of the list). Note that this ! -- properly handles the case where any of the analyze calls result in ! -- the insertion of nodes after the analyzed node (possibly calling ! -- this routine recursively). while Node /= After loop Analyze (Node); *************** package body Sem is *** 1160,1168 **** begin if Is_Non_Empty_List (L) then ! -- Capture the Node_Id of the first list node to be inserted. ! -- This will still be the first node after the insert operation, ! -- since Insert_List_After does not modify the Node_Id values. Node := First (L); Insert_List_Before (N, L); --- 1175,1183 ---- begin if Is_Non_Empty_List (L) then ! -- Capture the Node_Id of the first list node to be inserted. This ! -- will still be the first node after the insert operation, since ! -- Insert_List_After does not modify the Node_Id values. Node := First (L); Insert_List_Before (N, L); *************** package body Sem is *** 1217,1225 **** Ptr : Suppress_Stack_Entry_Ptr; begin ! -- First search the local entity suppress stack, we search this from the ! -- top of the stack down, so that we get the innermost entry that ! -- applies to this case if there are nested entries. Ptr := Local_Suppress_Stack_Top; while Ptr /= null loop --- 1232,1240 ---- Ptr : Suppress_Stack_Entry_Ptr; begin ! -- First search the local entity suppress stack. We search this from the ! -- top of the stack down so that we get the innermost entry that applies ! -- to this case if there are nested entries. Ptr := Local_Suppress_Stack_Top; while Ptr /= null loop *************** package body Sem is *** 1232,1238 **** Ptr := Ptr.Prev; end loop; ! -- Now search the global entity suppress table for a matching entry -- We also search this from the top down so that if there are multiple -- pragmas for the same entity, the last one applies (not clear what -- or whether the RM specifies this handling, but it seems reasonable). --- 1247,1253 ---- Ptr := Ptr.Prev; end loop; ! -- Now search the global entity suppress table for a matching entry. -- We also search this from the top down so that if there are multiple -- pragmas for the same entity, the last one applies (not clear what -- or whether the RM specifies this handling, but it seems reasonable). *************** package body Sem is *** 1322,1331 **** procedure Semantics (Comp_Unit : Node_Id) is -- The following locations save the corresponding global flags and ! -- variables so that they can be restored on completion. This is ! -- needed so that calls to Rtsfind start with the proper default ! -- 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; --- 1337,1346 ---- procedure Semantics (Comp_Unit : Node_Id) is -- The following locations save the corresponding global flags and ! -- variables so that they can be restored on completion. This is needed ! -- so that calls to Rtsfind start with the proper default 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; *************** package body Sem is *** 1343,1354 **** -- context, is compiled with expansion disabled. Save_Config_Switches : Config_Switches_Type; ! -- Variable used to save values of config switches while we analyze ! -- the new unit, to be restored on exit for proper recursive behavior. procedure Do_Analyze; ! -- Procedure to analyze the compilation unit. This is called more ! -- than once when the high level optimizer is activated. ---------------- -- Do_Analyze -- --- 1358,1369 ---- -- context, is compiled with expansion disabled. Save_Config_Switches : Config_Switches_Type; ! -- Variable used to save values of config switches while we analyze the ! -- new unit, to be restored on exit for proper recursive behavior. procedure Do_Analyze; ! -- Procedure to analyze the compilation unit. This is called more than ! -- once when the high level optimizer is activated. ---------------- -- Do_Analyze -- *************** package body Sem is *** 1447,1462 **** end if; -- Do analysis, and then append the compilation unit onto the ! -- Comp_Unit_List, if appropriate. This is done after analysis, so ! -- if this unit depends on some others, they have already been ! -- appended. We ignore bodies, except for the main unit itself. We ! -- have also to guard against ill-formed subunits that have an ! -- improper context. Do_Analyze; if Present (Comp_Unit) and then Nkind (Unit (Comp_Unit)) in N_Proper_Body and then not In_Extended_Main_Source_Unit (Comp_Unit) then null; --- 1462,1479 ---- end if; -- Do analysis, and then append the compilation unit onto the ! -- Comp_Unit_List, if appropriate. This is done after analysis, ! -- so if this unit depends on some others, they have already been ! -- appended. We ignore bodies, except for the main unit itself, and ! -- for subprogram bodies that act as specs. We have also to guard ! -- against ill-formed subunits that have an improper context. Do_Analyze; if Present (Comp_Unit) and then Nkind (Unit (Comp_Unit)) in N_Proper_Body + and then (Nkind (Unit (Comp_Unit)) /= N_Subprogram_Body + or else not Acts_As_Spec (Comp_Unit)) and then not In_Extended_Main_Source_Unit (Comp_Unit) then null; *************** package body Sem is *** 1517,1522 **** --- 1534,1542 ---- procedure Walk_Library_Items is type Unit_Number_Set is array (Main_Unit .. Last_Unit) of Boolean; pragma Pack (Unit_Number_Set); + + Main_CU : constant Node_Id := Cunit (Main_Unit); + Seen, Done : Unit_Number_Set := (others => False); -- Seen (X) is True after we have seen unit X in the walk. This is used -- to prevent processing the same unit more than once. Done (X) is True *************** package body Sem is *** 1528,1533 **** --- 1548,1569 ---- -- This is needed because the spec of the main unit may appear in the -- context of some other unit. We do not want this to force processing -- of the main body before all other units have been processed. + -- + -- Another circularity pattern occurs when the main unit is a child unit + -- and the body of an ancestor has a with-clause of the main unit or on + -- one of its children. In both cases the body in question has a with- + -- clause on the main unit, and must be excluded from the traversal. In + -- some convoluted cases this may lead to a CodePeer error because the + -- spec of a subprogram declared in an instance within the parent will + -- not be seen in the main unit. + + function Depends_On_Main (CU : Node_Id) return Boolean; + -- The body of a unit that is withed by the spec of the main unit may in + -- turn have a with_clause on that spec. In that case do not traverse + -- the body, to prevent loops. It can also happen that the main body has + -- a with_clause on a child, which of course has an implicit with on its + -- parent. It's OK to traverse the child body if the main spec has been + -- processed, otherwise we also have a circularity to avoid. procedure Do_Action (CU : Node_Id; Item : Node_Id); -- Calls Action, with some validity checks *************** package body Sem is *** 1537,1542 **** --- 1573,1622 ---- -- this unit. If it's an instance body, do the spec first. If it is -- an instance spec, do the body last. + procedure Do_Withed_Unit (Withed_Unit : Node_Id); + -- Apply Do_Unit_And_Dependents to a unit in a context clause. + + procedure Process_Bodies_In_Context (Comp : Node_Id); + -- The main unit and its spec may depend on bodies that contain generics + -- that are instantiated in them. Iterate through the corresponding + -- contexts before processing main (spec/body) itself, to process bodies + -- that may be present, together with their context. The spec of main + -- is processed wherever it appears in the list of units, while the body + -- is processed as the last unit in the list. + + --------------------- + -- Depends_On_Main -- + --------------------- + + function Depends_On_Main (CU : Node_Id) return Boolean is + CL : Node_Id; + MCU : constant Node_Id := Unit (Main_CU); + + begin + CL := First (Context_Items (CU)); + + -- Problem does not arise with main subprograms + + if + not Nkind_In (MCU, N_Package_Body, N_Package_Declaration) + then + return False; + end if; + + while Present (CL) loop + if Nkind (CL) = N_With_Clause + and then Library_Unit (CL) = Main_CU + and then not Done (Get_Cunit_Unit_Number (Library_Unit (CL))) + then + return True; + end if; + + Next (CL); + end loop; + + return False; + end Depends_On_Main; + --------------- -- Do_Action -- --------------- *************** package body Sem is *** 1565,1576 **** when N_Package_Body => ! -- Package bodies are processed immediately after the ! -- corresponding spec. null; ! when N_Subprogram_Body => -- A subprogram body must be the main unit --- 1645,1656 ---- when N_Package_Body => ! -- Package bodies are processed separately if the main unit ! -- depends on them. null; ! when N_Subprogram_Body => -- A subprogram body must be the main unit *************** package body Sem is *** 1578,1591 **** or else CU = Cunit (Main_Unit)); null; - -- All other cases cannot happen - when N_Function_Instantiation | N_Procedure_Instantiation | N_Package_Instantiation => ! pragma Assert (False, "instantiation"); null; when N_Subunit => pragma Assert (False, "subunit"); null; --- 1658,1674 ---- or else CU = Cunit (Main_Unit)); null; when N_Function_Instantiation | N_Procedure_Instantiation | N_Package_Instantiation => ! ! -- Can only happen if some generic body (needed for gnat2scil ! -- traversal, but not by GNAT) is not available, ignore. ! null; + -- All other cases cannot happen + when N_Subunit => pragma Assert (False, "subunit"); null; *************** package body Sem is *** 1622,1627 **** --- 1705,1711 ---- (Unit (Withed_Unit), N_Generic_Package_Declaration, N_Package_Body, + N_Package_Renaming_Declaration, N_Subprogram_Body) then Write_Unit_Name *************** package body Sem is *** 1647,1658 **** Write_Unit_Info (Unit_Num, Item, Withs => True); end if; ! -- Main unit should come last (except in the case where we -- skipped System_Aux_Id, in which case we missed the things it ! -- depends on). pragma Assert ! (not Done (Main_Unit) or else Present (System_Aux_Id)); -- We shouldn't do the same thing twice --- 1731,1744 ---- Write_Unit_Info (Unit_Num, Item, Withs => True); end if; ! -- Main unit should come last, except in the case where we -- skipped System_Aux_Id, in which case we missed the things it ! -- depends on, and in the case of parent bodies if present. pragma Assert ! (not Done (Main_Unit) ! or else Present (System_Aux_Id) ! or else Nkind (Item) = N_Package_Body); -- We shouldn't do the same thing twice *************** package body Sem is *** 1677,1714 **** Action (Item); end Do_Action; ! ---------------------------- ! -- Do_Unit_And_Dependents -- ! ---------------------------- ! ! procedure Do_Unit_And_Dependents (CU : Node_Id; Item : Node_Id) is ! Unit_Num : constant Unit_Number_Type := ! Get_Cunit_Unit_Number (CU); ! procedure Do_Withed_Unit (Withed_Unit : Node_Id); ! -- Pass the buck to Do_Unit_And_Dependents ! -------------------- ! -- Do_Withed_Unit -- ! -------------------- ! procedure Do_Withed_Unit (Withed_Unit : Node_Id) is ! Save_Do_Main : constant Boolean := Do_Main; ! begin ! -- Do not process the main unit if coming from a with_clause, ! -- as would happen with a parent body that has a child spec ! -- in its context. ! Do_Main := False; ! Do_Unit_And_Dependents (Withed_Unit, Unit (Withed_Unit)); ! Do_Main := Save_Do_Main; ! end Do_Withed_Unit; procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit); - -- Start of processing for Do_Unit_And_Dependents - begin if not Seen (Unit_Num) then --- 1763,1801 ---- Action (Item); end Do_Action; ! -------------------- ! -- Do_Withed_Unit -- ! -------------------- ! procedure Do_Withed_Unit (Withed_Unit : Node_Id) is ! begin ! Do_Unit_And_Dependents (Withed_Unit, Unit (Withed_Unit)); ! -- If the unit in the with_clause is a generic instance, the clause ! -- now denotes the instance body. Traverse the corresponding spec ! -- because there may be no other dependence that will force the ! -- traversal of its own context. ! if Nkind (Unit (Withed_Unit)) = N_Package_Body ! and then Is_Generic_Instance ! (Defining_Entity (Unit (Library_Unit (Withed_Unit)))) ! then ! Do_Withed_Unit (Library_Unit (Withed_Unit)); ! end if; ! end Do_Withed_Unit; ! ---------------------------- ! -- Do_Unit_And_Dependents -- ! ---------------------------- ! procedure Do_Unit_And_Dependents (CU : Node_Id; Item : Node_Id) is ! Unit_Num : constant Unit_Number_Type := Get_Cunit_Unit_Number (CU); ! Child : Node_Id; ! Body_U : Unit_Number_Type; ! Parent_CU : Node_Id; procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit); begin if not Seen (Unit_Num) then *************** package body Sem is *** 1716,1814 **** Do_Withed_Units (CU, Include_Limited => False); ! -- Process the unit if it is a spec. If it is the main unit, ! -- process it only if we have done all other units. if not Nkind_In (Item, N_Package_Body, N_Subprogram_Body) or else Acts_As_Spec (CU) then ! if CU = Cunit (Main_Unit) and then not Do_Main then Seen (Unit_Num) := False; else Seen (Unit_Num) := True; Do_Action (CU, Item); Done (Unit_Num) := True; end if; end if; end if; ! -- Process bodies. The spec, if present, has been processed already. ! -- A body appears if it is the main, or the body of a spec that is ! -- in the context of the main unit, and that is instantiated, or else ! -- contains a generic that is instantiated, or a subprogram that is ! -- or a subprogram that is inlined in the main unit. ! -- We exclude bodies that may appear in a circular dependency list, ! -- where spec A depends on spec B and body of B depends on spec A. ! -- This is not an elaboration issue, but body B must be excluded ! -- from the processing. ! declare ! Body_Unit : Node_Id := Empty; ! Body_Num : Unit_Number_Type; ! function Circular_Dependence (B : Node_Id) return Boolean; ! -- Check whether this body depends on a spec that is pending, ! -- that is to say has been seen but not processed yet. ! ------------------------- ! -- Circular_Dependence -- ! ------------------------- ! function Circular_Dependence (B : Node_Id) return Boolean is ! Item : Node_Id; ! UN : Unit_Number_Type; ! begin ! Item := First (Context_Items (B)); ! while Present (Item) loop ! if Nkind (Item) = N_With_Clause then ! UN := Get_Cunit_Unit_Number (Library_Unit (Item)); ! if Seen (UN) ! and then not Done (UN) ! then ! return True; ! end if; end if; ! ! Next (Item); ! end loop; ! ! return False; ! end Circular_Dependence; ! ! begin ! if Nkind (Item) = N_Package_Declaration then ! Body_Unit := Library_Unit (CU); ! ! elsif Nkind_In (Item, N_Package_Body, N_Subprogram_Body) then ! Body_Unit := CU; end if; ! if Present (Body_Unit) ! ! -- Since specs and bodies are not done at the same time, ! -- guard against listing a body more than once. Bodies are ! -- only processed when the main unit is being processed, ! -- after all other units in the list. The DEC extension ! -- to System is excluded because of circularities. ! ! and then not Seen (Get_Cunit_Unit_Number (Body_Unit)) ! and then ! (No (System_Aux_Id) ! or else Unit_Num /= Get_Source_Unit (System_Aux_Id)) ! and then not Circular_Dependence (Body_Unit) ! and then Do_Main ! then ! Body_Num := Get_Cunit_Unit_Number (Body_Unit); ! Seen (Body_Num) := True; ! Do_Action (Body_Unit, Unit (Body_Unit)); ! Done (Body_Num) := True; ! end if; ! end; ! end Do_Unit_And_Dependents; -- Local Declarations --- 1803,1912 ---- Do_Withed_Units (CU, Include_Limited => False); ! -- Process the unit if it is a spec or the main unit, if it ! -- has no previous spec or we have done all other units. if not Nkind_In (Item, N_Package_Body, N_Subprogram_Body) or else Acts_As_Spec (CU) then ! if CU = Cunit (Main_Unit) ! and then not Do_Main ! then Seen (Unit_Num) := False; else Seen (Unit_Num) := True; + + if CU = Library_Unit (Main_CU) then + Process_Bodies_In_Context (CU); + + -- If main is a child unit, examine parent unit contexts + -- to see if they include instantiated units. Also, if + -- the parent itself is an instance, process its body + -- because it may contain subprograms that are called + -- in the main unit. + + if Is_Child_Unit (Cunit_Entity (Main_Unit)) then + Child := Cunit_Entity (Main_Unit); + while Is_Child_Unit (Child) loop + Parent_CU := + Cunit + (Get_Cunit_Entity_Unit_Number (Scope (Child))); + Process_Bodies_In_Context (Parent_CU); + + if Nkind (Unit (Parent_CU)) = N_Package_Body + and then + Nkind (Original_Node (Unit (Parent_CU))) + = N_Package_Instantiation + and then + not Seen (Get_Cunit_Unit_Number (Parent_CU)) + then + Body_U := Get_Cunit_Unit_Number (Parent_CU); + Seen (Body_U) := True; + Do_Action (Parent_CU, Unit (Parent_CU)); + Done (Body_U) := True; + end if; + + Child := Scope (Child); + end loop; + end if; + end if; + Do_Action (CU, Item); Done (Unit_Num) := True; end if; end if; end if; + end Do_Unit_And_Dependents; ! ------------------------------- ! -- Process_Bodies_In_Context -- ! ------------------------------- ! procedure Process_Bodies_In_Context (Comp : Node_Id) is ! Body_CU : Node_Id; ! Body_U : Unit_Number_Type; ! Clause : Node_Id; ! Spec : Node_Id; ! procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit); ! -- Start of processing for Process_Bodies_In_Context ! begin ! Clause := First (Context_Items (Comp)); ! while Present (Clause) loop ! if Nkind (Clause) = N_With_Clause then ! Spec := Library_Unit (Clause); ! Body_CU := Library_Unit (Spec); ! -- If we are processing the spec of the main unit, load bodies ! -- only if the with_clause indicates that it forced the loading ! -- of the body for a generic instantiation. Note that bodies of ! -- parents that are instances have been loaded already. ! if Present (Body_CU) ! and then Body_CU /= Cunit (Main_Unit) ! and then Nkind (Unit (Body_CU)) /= N_Subprogram_Body ! and then (Nkind (Unit (Comp)) /= N_Package_Declaration ! or else Present (Withed_Body (Clause))) ! then ! Body_U := Get_Cunit_Unit_Number (Body_CU); ! if not Seen (Body_U) ! and then not Depends_On_Main (Body_CU) ! then ! Seen (Body_U) := True; ! Do_Withed_Units (Body_CU, Include_Limited => False); ! Do_Action (Body_CU, Unit (Body_CU)); ! Done (Body_U) := True; end if; ! end if; end if; ! Next (Clause); ! end loop; ! end Process_Bodies_In_Context; -- Local Declarations *************** package body Sem is *** 1848,1905 **** end; end loop; ! -- Now traverse compilation units in order Cur := First_Elmt (Comp_Unit_List); while Present (Cur) loop declare ! CU : constant Node_Id := Node (Cur); ! N : constant Node_Id := Unit (CU); begin pragma Assert (Nkind (CU) = N_Compilation_Unit); case Nkind (N) is ! -- If it's a body, ignore it. Bodies appear in the list only ! -- because of inlining/instantiations, and they are processed ! -- immediately after the corresponding specs. The main unit is ! -- processed separately after all other units. ! when N_Package_Body | N_Subprogram_Body => ! null; ! -- It's a spec, so just do it when others => ! Do_Unit_And_Dependents (CU, N); end case; end; Next_Elmt (Cur); end loop; if not Done (Main_Unit) then Do_Main := True; ! declare ! Main_CU : constant Node_Id := Cunit (Main_Unit); begin ! -- If the main unit is an instantiation, the body appears before ! -- the instance spec, which is added later to the unit list. Do ! -- the spec if present, body will follow. ! if Nkind (Original_Node (Unit (Main_CU))) ! in N_Generic_Instantiation ! and then Present (Library_Unit (Main_CU)) ! then ! Do_Unit_And_Dependents ! (Library_Unit (Main_CU), Unit (Library_Unit (Main_CU))); ! else ! Do_Unit_And_Dependents (Main_CU, Unit (Main_CU)); end if; ! end; end if; if Debug_Unit_Walk then --- 1946,2105 ---- end; end loop; ! -- Now traverse compilation units (specs) in order Cur := First_Elmt (Comp_Unit_List); while Present (Cur) loop declare ! CU : constant Node_Id := Node (Cur); ! N : constant Node_Id := Unit (CU); ! Par : Entity_Id; begin pragma Assert (Nkind (CU) = N_Compilation_Unit); case Nkind (N) is ! -- If it is a subprogram body, process it if it has no ! -- separate spec. ! -- If it's a package body, ignore it, unless it is a body ! -- created for an instance that is the main unit. In the case ! -- of subprograms, the body is the wrapper package. In case of ! -- a package, the original file carries the body, and the spec ! -- appears as a later entry in the units list. ! -- Otherwise bodies appear in the list only because of inlining ! -- or instantiations, and they are processed only if relevant. ! -- The flag Withed_Body on a context clause indicates that a ! -- unit contains an instantiation that may be needed later, ! -- and therefore the body that contains the generic body (and ! -- its context) must be traversed immediately after the ! -- corresponding spec (see Do_Unit_And_Dependents). ! ! -- The main unit itself is processed separately after all other ! -- specs, and relevant bodies are examined in Process_Main. ! ! when N_Subprogram_Body => ! if Acts_As_Spec (N) then ! Do_Unit_And_Dependents (CU, N); ! end if; ! ! when N_Package_Body => ! if CU = Main_CU ! and then Nkind (Original_Node (Unit (Main_CU))) in ! N_Generic_Instantiation ! and then Present (Library_Unit (Main_CU)) ! then ! Do_Unit_And_Dependents ! (Library_Unit (Main_CU), ! Unit (Library_Unit (Main_CU))); ! end if; ! ! -- It's a spec, process it, and the units it depends on, ! -- unless it is a descendent of the main unit. This can ! -- happen when the body of a parent depends on some other ! -- descendent. when others => ! Par := Scope (Defining_Entity (Unit (CU))); ! ! if Is_Child_Unit (Defining_Entity (Unit (CU))) then ! while Present (Par) ! and then Par /= Standard_Standard ! and then Par /= Cunit_Entity (Main_Unit) ! loop ! Par := Scope (Par); ! end loop; ! end if; ! ! if Par /= Cunit_Entity (Main_Unit) then ! Do_Unit_And_Dependents (CU, N); ! end if; end case; end; Next_Elmt (Cur); end loop; + -- Now process package bodies on which main depends, followed by bodies + -- of parents, if present, and finally main itself. + if not Done (Main_Unit) then Do_Main := True; ! Process_Main : declare ! Parent_CU : Node_Id; ! Body_CU : Node_Id; ! Body_U : Unit_Number_Type; ! Child : Entity_Id; ! ! function Is_Subunit_Of_Main (U : Node_Id) return Boolean; ! -- If the main unit has subunits, their context may include ! -- bodies that are needed in the body of main. We must examine ! -- the context of the subunits, which are otherwise not made ! -- explicit in the main unit. ! ! ------------------------ ! -- Is_Subunit_Of_Main -- ! ------------------------ ! ! function Is_Subunit_Of_Main (U : Node_Id) return Boolean is ! Lib : Node_Id; ! begin ! if No (U) then ! return False; ! else ! Lib := Library_Unit (U); ! return Nkind (Unit (U)) = N_Subunit ! and then ! (Lib = Cunit (Main_Unit) ! or else Is_Subunit_Of_Main (Lib)); ! end if; ! end Is_Subunit_Of_Main; ! ! -- Start of processing for Process_Main begin ! Process_Bodies_In_Context (Main_CU); ! for Unit_Num in Done'Range loop ! if Is_Subunit_Of_Main (Cunit (Unit_Num)) then ! Process_Bodies_In_Context (Cunit (Unit_Num)); ! end if; ! end loop; ! ! -- If the main unit is a child unit, parent bodies may be present ! -- because they export instances or inlined subprograms. Check for ! -- presence of these, which are not present in context clauses. ! -- Note that if the parents are instances, their bodies have been ! -- processed before the main spec, because they may be needed ! -- therein, so the following loop only affects non-instances. ! ! if Is_Child_Unit (Cunit_Entity (Main_Unit)) then ! Child := Cunit_Entity (Main_Unit); ! while Is_Child_Unit (Child) loop ! Parent_CU := ! Cunit (Get_Cunit_Entity_Unit_Number (Scope (Child))); ! Body_CU := Library_Unit (Parent_CU); ! ! if Present (Body_CU) ! and then not Seen (Get_Cunit_Unit_Number (Body_CU)) ! and then not Depends_On_Main (Body_CU) ! then ! Body_U := Get_Cunit_Unit_Number (Body_CU); ! Seen (Body_U) := True; ! Do_Action (Body_CU, Unit (Body_CU)); ! Done (Body_U) := True; ! end if; ! ! Child := Scope (Child); ! end loop; end if; ! ! Do_Action (Main_CU, Unit (Main_CU)); ! Done (Main_Unit) := True; ! end Process_Main; end if; if Debug_Unit_Walk then *************** package body Sem is *** 1996,2001 **** --- 2196,2203 ---- pragma Assert (Nkind (CU) = N_Compilation_Unit); Context_Item : Node_Id; + Lib_Unit : Node_Id; + Body_CU : Node_Id; begin Context_Item := First (Context_Items (CU)); *************** package body Sem is *** 2004,2010 **** and then (Include_Limited or else not Limited_Present (Context_Item)) then ! Action (Library_Unit (Context_Item)); end if; Context_Item := Next (Context_Item); --- 2206,2237 ---- and then (Include_Limited or else not Limited_Present (Context_Item)) then ! Lib_Unit := Library_Unit (Context_Item); ! Action (Lib_Unit); ! ! -- If the context item indicates that a package body is needed ! -- because of an instantiation in CU, traverse the body now, even ! -- if CU is not related to the main unit. If the generic itself ! -- appears in a package body, the context item is this body, and ! -- it already appears in the traversal order, so we only need to ! -- examine the case of a context item being a package declaration. ! ! if Present (Withed_Body (Context_Item)) ! and then Nkind (Unit (Lib_Unit)) = N_Package_Declaration ! and then Present (Corresponding_Body (Unit (Lib_Unit))) ! then ! Body_CU := ! Parent ! (Unit_Declaration_Node ! (Corresponding_Body (Unit (Lib_Unit)))); ! ! -- A body may have an implicit with on its own spec, in which ! -- case we must ignore this context item to prevent looping. ! ! if Unit (CU) /= Unit (Body_CU) then ! Action (Body_CU); ! end if; ! end if; end if; Context_Item := Next (Context_Item); diff -Nrcpad gcc-4.5.2/gcc/ada/sem.ads gcc-4.6.0/gcc/ada/sem.ads *** gcc-4.5.2/gcc/ada/sem.ads Fri Jun 19 12:29:26 2009 --- gcc-4.6.0/gcc/ada/sem.ads Mon Oct 18 14:05:56 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem is *** 462,467 **** --- 462,470 ---- Save_Check_Policy_List : Node_Id; -- Save contents of Check_Policy_List on entry to restore on exit + Save_Default_Storage_Pool : Node_Id; + -- Save contents of Default_Storage_Pool on entry to restore on exit + Is_Transient : Boolean; -- Marks transient scopes (see Exp_Ch7 body for details) diff -Nrcpad gcc-4.5.2/gcc/ada/sem_aggr.adb gcc-4.6.0/gcc/ada/sem_aggr.adb *** gcc-4.5.2/gcc/ada/sem_aggr.adb Tue Jan 26 09:42:04 2010 --- gcc-4.6.0/gcc/ada/sem_aggr.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sinfo; use Sinfo; *** 54,59 **** --- 54,60 ---- with Snames; use Snames; with Stringt; use Stringt; with Stand; use Stand; + with Style; use Style; with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; *************** package body Sem_Aggr is *** 525,534 **** Is_Fully_Positional : Boolean := True; procedure Collect_Aggr_Bounds (N : Node_Id; Dim : Pos); ! -- N is an array (sub-)aggregate. Dim is the dimension corresponding to ! -- (sub-)aggregate N. This procedure collects the constrained N_Range ! -- nodes corresponding to each index dimension of our aggregate itype. ! -- These N_Range nodes are collected in Aggr_Range above. -- -- Likewise collect in Aggr_Low & Aggr_High above the low and high -- bounds of each index dimension. If, when collecting, two bounds --- 526,536 ---- Is_Fully_Positional : Boolean := True; procedure Collect_Aggr_Bounds (N : Node_Id; Dim : Pos); ! -- N is an array (sub-)aggregate. Dim is the dimension corresponding ! -- to (sub-)aggregate N. This procedure collects and removes the side ! -- effects of the constrained N_Range nodes corresponding to each index ! -- dimension of our aggregate itype. These N_Range nodes are collected ! -- in Aggr_Range above. -- -- Likewise collect in Aggr_Low & Aggr_High above the low and high -- bounds of each index dimension. If, when collecting, two bounds *************** package body Sem_Aggr is *** 551,556 **** --- 553,561 ---- Expr : Node_Id; begin + Remove_Side_Effects (This_Low, Variable_Ref => True); + Remove_Side_Effects (This_High, Variable_Ref => True); + -- Collect the first N_Range for a given dimension that you find. -- For a given dimension they must be all equal anyway. *************** package body Sem_Aggr is *** 568,574 **** Set_Raises_Constraint_Error (N); Error_Msg_N ("sub-aggregate low bound mismatch?", N); Error_Msg_N ! ("\Constraint_Error will be raised at run-time?", N); end if; end if; --- 573,579 ---- Set_Raises_Constraint_Error (N); Error_Msg_N ("sub-aggregate low bound mismatch?", N); Error_Msg_N ! ("\Constraint_Error will be raised at run time?", N); end if; end if; *************** package body Sem_Aggr is *** 582,588 **** Set_Raises_Constraint_Error (N); Error_Msg_N ("sub-aggregate high bound mismatch?", N); Error_Msg_N ! ("\Constraint_Error will be raised at run-time?", N); end if; end if; end if; --- 587,593 ---- Set_Raises_Constraint_Error (N); Error_Msg_N ("sub-aggregate high bound mismatch?", N); Error_Msg_N ! ("\Constraint_Error will be raised at run time?", N); end if; end if; end if; *************** package body Sem_Aggr is *** 631,637 **** Set_Parent (Index_Constraints, N); Collect_Aggr_Bounds (N, 1); ! -- Build the list of constrained indices of our aggregate itype for J in 1 .. Aggr_Dimension loop Create_Index : declare --- 636,642 ---- Set_Parent (Index_Constraints, N); Collect_Aggr_Bounds (N, 1); ! -- Build the list of constrained indexes of our aggregate itype for J in 1 .. Aggr_Dimension loop Create_Index : declare *************** package body Sem_Aggr is *** 886,892 **** ----------------------- procedure Resolve_Aggregate (N : Node_Id; Typ : Entity_Id) is ! Pkind : constant Node_Kind := Nkind (Parent (N)); Aggr_Subtyp : Entity_Id; -- The actual aggregate subtype. This is not necessarily the same as Typ --- 891,898 ---- ----------------------- procedure Resolve_Aggregate (N : Node_Id; Typ : Entity_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Pkind : constant Node_Kind := Nkind (Parent (N)); Aggr_Subtyp : Entity_Id; -- The actual aggregate subtype. This is not necessarily the same as Typ *************** package body Sem_Aggr is *** 916,922 **** -- Ada 2005 (AI-287): Limited aggregates allowed ! if Is_Limited_Type (Typ) and then Ada_Version < Ada_05 then Error_Msg_N ("aggregate type cannot be limited", N); Explain_Limited_Type (Typ, N); --- 922,928 ---- -- Ada 2005 (AI-287): Limited aggregates allowed ! if Is_Limited_Type (Typ) and then Ada_Version < Ada_2005 then Error_Msg_N ("aggregate type cannot be limited", N); Explain_Limited_Type (Typ, N); *************** package body Sem_Aggr is *** 973,980 **** Next (Expr); end loop; ! Rewrite (N, ! Make_String_Literal (Sloc (N), End_String)); Analyze_And_Resolve (N, Typ); return; --- 979,985 ---- Next (Expr); end loop; ! Rewrite (N, Make_String_Literal (Loc, End_String)); Analyze_And_Resolve (N, Typ); return; *************** package body Sem_Aggr is *** 994,1009 **** -- subtype for the final aggregate. begin ! -- In the following we determine whether an others choice is -- allowed inside the array aggregate. The test checks the context -- in which the array aggregate occurs. If the context does not ! -- permit it, or the aggregate type is unconstrained, an others -- choice is not allowed. -- If expansion is disabled (generic context, or semantics-only -- mode) actual subtypes cannot be constructed, and the type of an -- object may be its unconstrained nominal type. However, if the ! -- context is an assignment, we assume that "others" is allowed, -- because the target of the assignment will have a constrained -- subtype when fully compiled. --- 999,1014 ---- -- subtype for the final aggregate. begin ! -- In the following we determine whether an OTHERS choice is -- allowed inside the array aggregate. The test checks the context -- in which the array aggregate occurs. If the context does not ! -- permit it, or the aggregate type is unconstrained, an OTHERS -- choice is not allowed. -- If expansion is disabled (generic context, or semantics-only -- mode) actual subtypes cannot be constructed, and the type of an -- object may be its unconstrained nominal type. However, if the ! -- context is an assignment, we assume that OTHERS is allowed, -- because the target of the assignment will have a constrained -- subtype when fully compiled. *************** package body Sem_Aggr is *** 1049,1054 **** --- 1054,1060 ---- Index_Constr => First_Index (Typ), Component_Typ => Component_Type (Typ), Others_Allowed => True); + else Aggr_Resolved := Resolve_Array_Aggregate *************** package body Sem_Aggr is *** 1087,1093 **** if Raises_Constraint_Error (N) then Aggr_Subtyp := Etype (N); Rewrite (N, ! Make_Raise_Constraint_Error (Sloc (N), Reason => CE_Range_Check_Failed)); Set_Raises_Constraint_Error (N); Set_Etype (N, Aggr_Subtyp); --- 1093,1099 ---- if Raises_Constraint_Error (N) then Aggr_Subtyp := Etype (N); Rewrite (N, ! Make_Raise_Constraint_Error (Loc, Reason => CE_Range_Check_Failed)); Set_Raises_Constraint_Error (N); Set_Etype (N, Aggr_Subtyp); *************** package body Sem_Aggr is *** 1128,1137 **** -- analyzed expression. procedure Check_Bound (BH : Node_Id; AH : in out Node_Id); ! -- Checks that AH (the upper bound of an array aggregate) is <= BH ! -- (the upper bound of the index base type). If the check fails a ! -- warning is emitted, the Raises_Constraint_Error flag of N is set, ! -- and AH is replaced with a duplicate of BH. procedure Check_Bounds (L, H : Node_Id; AL, AH : Node_Id); -- Checks that range AL .. AH is compatible with range L .. H. Emits a --- 1134,1143 ---- -- analyzed expression. procedure Check_Bound (BH : Node_Id; AH : in out Node_Id); ! -- Checks that AH (the upper bound of an array aggregate) is less than ! -- or equal to BH (the upper bound of the index base type). If the check ! -- fails, a warning is emitted, the Raises_Constraint_Error flag of N is ! -- set, and AH is replaced with a duplicate of BH. procedure Check_Bounds (L, H : Node_Id; AL, AH : Node_Id); -- Checks that range AL .. AH is compatible with range L .. H. Emits a *************** package body Sem_Aggr is *** 1155,1161 **** -- 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 choice). -- In this event we do not resolve Expr unless expansion is disabled. -- To know why, see the DELAYED COMPONENT RESOLUTION note above. --- 1161,1167 ---- -- 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 choice). -- In this event we do not resolve Expr unless expansion is disabled. -- To know why, see the DELAYED COMPONENT RESOLUTION note above. *************** package body Sem_Aggr is *** 1206,1213 **** if not Is_Enumeration_Type (Index_Base) then Expr := Make_Op_Add (Loc, ! Left_Opnd => Duplicate_Subexpr (To), ! Right_Opnd => Make_Integer_Literal (Loc, Val)); -- If we are dealing with enumeration return -- Index_Typ'Val (Index_Typ'Pos (To) + Val) --- 1212,1219 ---- if not Is_Enumeration_Type (Index_Base) then Expr := Make_Op_Add (Loc, ! Left_Opnd => Duplicate_Subexpr (To), ! Right_Opnd => Make_Integer_Literal (Loc, Val)); -- If we are dealing with enumeration return -- Index_Typ'Val (Index_Typ'Pos (To) + Val) *************** package body Sem_Aggr is *** 1231,1236 **** --- 1237,1266 ---- Prefix => New_Reference_To (Index_Typ, Loc), Attribute_Name => Name_Val, Expressions => New_List (Expr_Pos)); + + -- If the index type has a non standard representation, the + -- attributes 'Val and 'Pos expand into function calls and the + -- resulting expression is considered non-safe for reevaluation + -- by the backend. Relocate it into a constant temporary in order + -- to make it safe for reevaluation. + + if Has_Non_Standard_Rep (Etype (N)) then + declare + Def_Id : Entity_Id; + + begin + Def_Id := Make_Temporary (Loc, 'R', Expr); + Set_Etype (Def_Id, Index_Typ); + Insert_Action (N, + Make_Object_Declaration (Loc, + Defining_Identifier => Def_Id, + Object_Definition => New_Reference_To (Index_Typ, Loc), + Constant_Present => True, + Expression => Relocate_Node (Expr))); + + Expr := New_Reference_To (Def_Id, Loc); + end; + end if; end if; return Expr; *************** package body Sem_Aggr is *** 1254,1263 **** if OK_BH and then OK_AH and then Val_BH < Val_AH then Set_Raises_Constraint_Error (N); Error_Msg_N ("upper bound out of range?", AH); ! Error_Msg_N ("\Constraint_Error will be raised at run-time?", AH); -- You need to set AH to BH or else in the case of enumerations ! -- indices we will not be able to resolve the aggregate bounds. AH := Duplicate_Subexpr (BH); end if; --- 1284,1293 ---- if OK_BH and then OK_AH and then Val_BH < Val_AH then Set_Raises_Constraint_Error (N); Error_Msg_N ("upper bound out of range?", AH); ! Error_Msg_N ("\Constraint_Error will be raised at run time?", AH); -- You need to set AH to BH or else in the case of enumerations ! -- indexes we will not be able to resolve the aggregate bounds. AH := Duplicate_Subexpr (BH); end if; *************** package body Sem_Aggr is *** 1297,1309 **** if OK_L and then Val_L > Val_AL then Set_Raises_Constraint_Error (N); Error_Msg_N ("lower bound of aggregate out of range?", N); ! Error_Msg_N ("\Constraint_Error will be raised at run-time?", N); end if; if OK_H and then Val_H < Val_AH then Set_Raises_Constraint_Error (N); Error_Msg_N ("upper bound of aggregate out of range?", N); ! Error_Msg_N ("\Constraint_Error will be raised at run-time?", N); end if; end Check_Bounds; --- 1327,1339 ---- if OK_L and then Val_L > Val_AL then Set_Raises_Constraint_Error (N); Error_Msg_N ("lower bound of aggregate out of range?", N); ! Error_Msg_N ("\Constraint_Error will be raised at run time?", N); end if; if OK_H and then Val_H < Val_AH then Set_Raises_Constraint_Error (N); Error_Msg_N ("upper bound of aggregate out of range?", N); ! Error_Msg_N ("\Constraint_Error will be raised at run time?", N); end if; end Check_Bounds; *************** package body Sem_Aggr is *** 1343,1349 **** if Range_Len < Len then Set_Raises_Constraint_Error (N); Error_Msg_N ("too many elements?", N); ! Error_Msg_N ("\Constraint_Error will be raised at run-time?", N); end if; end Check_Length; --- 1373,1379 ---- if Range_Len < Len then Set_Raises_Constraint_Error (N); Error_Msg_N ("too many elements?", N); ! Error_Msg_N ("\Constraint_Error will be raised at run time?", N); end if; end Check_Length; *************** package body Sem_Aggr is *** 1410,1415 **** --- 1440,1453 ---- -- Set to False if resolution of the expression failed begin + -- Defend against previous errors + + if Nkind (Expr) = N_Error + or else Error_Posted (Expr) + then + return True; + end if; + -- If the array type against which we are resolving the aggregate -- has several dimensions, the expressions nested inside the -- aggregate must be further aggregates (or strings). *************** package body Sem_Aggr is *** 1443,1450 **** -- a missing component association for a 1-aggregate. if Paren_Count (Expr) > 0 then ! Error_Msg_N ("\if single-component aggregate is intended," ! & " write e.g. (1 ='> ...)", Expr); end if; return Failure; end if; --- 1481,1489 ---- -- a missing component association for a 1-aggregate. if Paren_Count (Expr) > 0 then ! Error_Msg_N ! ("\if single-component aggregate is intended," ! & " write e.g. (1 ='> ...)", Expr); end if; return Failure; end if; *************** package body Sem_Aggr is *** 1744,1750 **** -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 and then Known_Null (Expression (Assoc)) then Check_Can_Never_Be_Null (Etype (N), Expression (Assoc)); --- 1783,1789 ---- -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_2005 and then Known_Null (Expression (Assoc)) then Check_Can_Never_Be_Null (Etype (N), Expression (Assoc)); *************** package body Sem_Aggr is *** 1785,1790 **** --- 1824,1842 ---- Expander_Mode_Save_And_Set (False); Full_Analysis := False; Analyze (Expr); + + -- If the expression is a literal, propagate this info + -- to the expression in the association, to enable some + -- optimizations downstream. + + if Is_Entity_Name (Expr) + and then Present (Entity (Expr)) + and then Ekind (Entity (Expr)) = E_Enumeration_Literal + then + Analyze_And_Resolve + (Expression (Assoc), Component_Typ); + end if; + Full_Analysis := Save_Analysis; Expander_Mode_Restore; *************** package body Sem_Aggr is *** 1798,1805 **** elsif Is_Tagged_Type (Etype (Expression (Assoc))) then Check_Dynamically_Tagged_Expression ! (Expr => Expression (Assoc), ! Typ => Component_Type (Etype (N)), Related_Nod => N); end if; --- 1850,1857 ---- elsif Is_Tagged_Type (Etype (Expression (Assoc))) then Check_Dynamically_Tagged_Expression ! (Expr => Expression (Assoc), ! Typ => Component_Type (Etype (N)), Related_Nod => N); end if; *************** package body Sem_Aggr is *** 2033,2039 **** -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 and then Known_Null (Expr) then Check_Can_Never_Be_Null (Etype (N), Expr); --- 2085,2091 ---- -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_2005 and then Known_Null (Expr) then Check_Can_Never_Be_Null (Etype (N), Expr); *************** package body Sem_Aggr is *** 2060,2066 **** -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 and then Known_Null (Assoc) then Check_Can_Never_Be_Null (Etype (N), Expression (Assoc)); --- 2112,2118 ---- -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_2005 and then Known_Null (Assoc) then Check_Can_Never_Be_Null (Etype (N), Expression (Assoc)); *************** package body Sem_Aggr is *** 2288,2293 **** --- 2340,2357 ---- then A_Type := Etype (Imm_Type); return True; + + -- The parent type may be a private extension. The aggregate is + -- legal if the type of the aggregate is an extension of it that + -- is not a private extension. + + elsif Is_Private_Type (A_Type) + and then not Is_Private_Type (Imm_Type) + and then Present (Full_View (A_Type)) + and then Base_Type (Full_View (A_Type)) = Etype (Imm_Type) + then + return True; + else Imm_Type := Etype (Base_Type (Imm_Type)); end if; *************** package body Sem_Aggr is *** 2316,2322 **** -- Ada 2005 (AI-287): Limited aggregates are allowed ! if Ada_Version < Ada_05 then Error_Msg_N ("aggregate type cannot be limited", N); Explain_Limited_Type (Typ, N); return; --- 2380,2386 ---- -- Ada 2005 (AI-287): Limited aggregates are allowed ! if Ada_Version < Ada_2005 then Error_Msg_N ("aggregate type cannot be limited", N); Explain_Limited_Type (Typ, N); return; *************** package body Sem_Aggr is *** 2356,2362 **** -- Only consider limited interpretations in the Ada 2005 case if Is_Tagged_Type (It.Typ) ! and then (Ada_Version >= Ada_05 or else not Is_Limited_Type (It.Typ)) then if A_Type /= Any_Type then --- 2420,2426 ---- -- Only consider limited interpretations in the Ada 2005 case if Is_Tagged_Type (It.Typ) ! and then (Ada_Version >= Ada_2005 or else not Is_Limited_Type (It.Typ)) then if A_Type /= Any_Type then *************** package body Sem_Aggr is *** 2371,2377 **** end loop; if A_Type = Any_Type then ! if Ada_Version >= Ada_05 then Error_Msg_N ("ancestor part must be of a tagged type", A); else Error_Msg_N --- 2435,2441 ---- end loop; if A_Type = Any_Type then ! if Ada_Version >= Ada_2005 then Error_Msg_N ("ancestor part must be of a tagged type", A); else Error_Msg_N *************** package body Sem_Aggr is *** 2403,2408 **** --- 2467,2502 ---- Error_Msg_N ("type of limited ancestor part must be constrained", A); + -- Reject the use of CPP constructors that leave objects partially + -- initialized. For example: + + -- type CPP_Root is tagged limited record ... + -- pragma Import (CPP, CPP_Root); + + -- type CPP_DT is new CPP_Root and Iface ... + -- pragma Import (CPP, CPP_DT); + + -- type Ada_DT is new CPP_DT with ... + + -- Obj : Ada_DT := Ada_DT'(New_CPP_Root with others => <>); + + -- Using the constructor of CPP_Root the slots of the dispatch + -- table of CPP_DT cannot be set, and the secondary tag of + -- CPP_DT is unknown. + + elsif Nkind (A) = N_Function_Call + and then Is_CPP_Constructor_Call (A) + and then Enclosing_CPP_Parent (Typ) /= A_Type + then + Error_Msg_NE + ("?must use 'C'P'P constructor for type &", A, + Enclosing_CPP_Parent (Typ)); + + -- The following call is not needed if the previous warning + -- is promoted to an error. + + Resolve_Record_Aggregate (N, Typ); + elsif Is_Class_Wide_Type (Etype (A)) and then Nkind (Original_Node (A)) = N_Function_Call then *************** package body Sem_Aggr is *** 2488,2508 **** -- whose value may already have been specified by N's ancestor part. -- This routine checks whether this is indeed the case and if so returns -- False, signaling that no value for Discr should appear in N's ! -- aggregate part. Also, in this case, the routine appends ! -- New_Assoc_List Discr the discriminant value specified in the ancestor ! -- part. ! -- Can't parse previous sentence, appends what where??? function Get_Value (Compon : Node_Id; From : List_Id; Consider_Others_Choice : Boolean := False) return Node_Id; ! -- Given a record component stored in parameter Compon, the following ! -- function returns its value as it appears in the list From, which is ! -- a list of N_Component_Association nodes. ! -- What is this referring to??? There is no "following function" in ! -- sight??? -- If no component association has a choice for the searched component, -- the value provided by the others choice is returned, if there is one, -- and Consider_Others_Choice is set to true. Otherwise Empty is --- 2582,2605 ---- -- whose value may already have been specified by N's ancestor part. -- This routine checks whether this is indeed the case and if so returns -- False, signaling that no value for Discr should appear in N's ! -- aggregate part. Also, in this case, the routine appends to ! -- New_Assoc_List the discriminant value specified in the ancestor part. ! -- ! -- If the aggregate is in a context with expansion delayed, it will be ! -- reanalyzed. The inherited discriminant values must not be reinserted ! -- in the component list to prevent spurious errors, but they must be ! -- present on first analysis to build the proper subtype indications. ! -- The flag Inherited_Discriminant is used to prevent the re-insertion. function Get_Value (Compon : Node_Id; From : List_Id; Consider_Others_Choice : Boolean := False) return Node_Id; ! -- Given a record component stored in parameter Compon, this function ! -- returns its value as it appears in the list From, which is a list ! -- of N_Component_Association nodes. ! -- -- If no component association has a choice for the searched component, -- the value provided by the others choice is returned, if there is one, -- and Consider_Others_Choice is set to true. Otherwise Empty is *************** package body Sem_Aggr is *** 2556,2561 **** --- 2653,2659 ---- Loc : Source_Ptr; Ancestor : Node_Id; + Comp_Assoc : Node_Id; Discr_Expr : Node_Id; Ancestor_Typ : Entity_Id; *************** package body Sem_Aggr is *** 2570,2575 **** --- 2668,2688 ---- return True; end if; + -- Check whether inherited discriminant values have already been + -- inserted in the aggregate. This will be the case if we are + -- re-analyzing an aggregate whose expansion was delayed. + + if Present (Component_Associations (N)) then + Comp_Assoc := First (Component_Associations (N)); + while Present (Comp_Assoc) loop + if Inherited_Discriminant (Comp_Assoc) then + return True; + end if; + + Next (Comp_Assoc); + end loop; + end if; + Ancestor := Ancestor_Part (N); Ancestor_Typ := Etype (Ancestor); Loc := Sloc (Ancestor); *************** package body Sem_Aggr is *** 2627,2632 **** --- 2740,2746 ---- end if; Resolve_Aggr_Expr (Discr_Expr, Discr); + Set_Inherited_Discriminant (Last (New_Assoc_List)); return False; end if; *************** package body Sem_Aggr is *** 2720,2726 **** -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 and then Known_Null (Expression (Assoc)) then Check_Can_Never_Be_Null (Compon, Expression (Assoc)); --- 2834,2840 ---- -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_2005 and then Known_Null (Expression (Assoc)) then Check_Can_Never_Be_Null (Compon, Expression (Assoc)); *************** package body Sem_Aggr is *** 2962,2968 **** -- aggregate for a null record type was established by AI05-016. elsif No (First_Entity (Typ)) ! and then Ada_Version < Ada_05 then Error_Msg_N ("record aggregate must be null", N); return; --- 3076,3082 ---- -- aggregate for a null record type was established by AI05-016. elsif No (First_Entity (Typ)) ! and then Ada_Version < Ada_2005 then Error_Msg_N ("record aggregate must be null", N); return; *************** package body Sem_Aggr is *** 2991,3003 **** if Selector_Name /= First (Choices (Assoc)) or else Present (Next (Selector_Name)) then ! Error_Msg_N ("OTHERS must appear alone in a choice list", ! Selector_Name); return; elsif Present (Next (Assoc)) then ! Error_Msg_N ("OTHERS must appear last in an aggregate", ! Selector_Name); return; -- (Ada2005): If this is an association with a box, --- 3105,3119 ---- if Selector_Name /= First (Choices (Assoc)) or else Present (Next (Selector_Name)) then ! Error_Msg_N ! ("OTHERS must appear alone in a choice list", ! Selector_Name); return; elsif Present (Next (Assoc)) then ! Error_Msg_N ! ("OTHERS must appear last in an aggregate", ! Selector_Name); return; -- (Ada2005): If this is an association with a box, *************** package body Sem_Aggr is *** 3057,3063 **** -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 and then Known_Null (Positional_Expr) then Check_Can_Never_Be_Null (Discrim, Positional_Expr); --- 3173,3179 ---- -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_2005 and then Known_Null (Positional_Expr) then Check_Can_Never_Be_Null (Discrim, Positional_Expr); *************** package body Sem_Aggr is *** 3213,3230 **** Error_Msg_NE ("type of aggregate has private ancestor&!", N, Root_Typ); ! Error_Msg_N ("must use extension aggregate!", N); return; end if; Dnode := Declaration_Node (Base_Type (Root_Typ)); ! -- If we don't get a full declaration, then we have some ! -- error which will get signalled later so skip this part. ! -- Otherwise, gather components of root that apply to the ! -- aggregate type. We use the base type in case there is an ! -- applicable stored constraint that renames the discriminants ! -- of the root. if Nkind (Dnode) = N_Full_Type_Declaration then Record_Def := Type_Definition (Dnode); --- 3329,3345 ---- Error_Msg_NE ("type of aggregate has private ancestor&!", N, Root_Typ); ! Error_Msg_N ("must use extension aggregate!", N); return; end if; Dnode := Declaration_Node (Base_Type (Root_Typ)); ! -- If we don't get a full declaration, then we have some error ! -- which will get signalled later so skip this part. Otherwise ! -- gather components of root that apply to the aggregate type. ! -- We use the base type in case there is an applicable stored ! -- constraint that renames the discriminants of the root. if Nkind (Dnode) = N_Full_Type_Declaration then Record_Def := Type_Definition (Dnode); *************** package body Sem_Aggr is *** 3259,3264 **** --- 3374,3388 ---- Ancestor_Part (N), Parent_Typ); return; end if; + + -- The current view of ancestor part may be a private type, + -- while the context type is always non-private. + + elsif Is_Private_Type (Root_Typ) + and then Present (Full_View (Root_Typ)) + and then Nkind (N) = N_Extension_Aggregate + then + exit when Base_Type (Full_View (Root_Typ)) = Parent_Typ; end if; end loop; *************** package body Sem_Aggr is *** 3332,3338 **** -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 and then Known_Null (Positional_Expr) then Check_Can_Never_Be_Null (Component, Positional_Expr); --- 3456,3462 ---- -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_2005 and then Known_Null (Positional_Expr) then Check_Can_Never_Be_Null (Component, Positional_Expr); *************** package body Sem_Aggr is *** 3453,3467 **** -- for the rest, if other components are present. -- The type of the aggregate is the known subtype of -- the component. The capture of discriminants must ! -- be recursive because subcomponents may be contrained -- (transitively) by discriminants of enclosing types. -- For a private type with discriminants, a call to the -- initialization procedure will be generated, and no -- subaggregate is needed. Capture_Discriminants : declare ! Loc : constant Source_Ptr := Sloc (N); ! Expr : Node_Id; procedure Add_Discriminant_Values (New_Aggr : Node_Id; --- 3577,3591 ---- -- for the rest, if other components are present. -- The type of the aggregate is the known subtype of -- the component. The capture of discriminants must ! -- be recursive because subcomponents may be constrained -- (transitively) by discriminants of enclosing types. -- For a private type with discriminants, a call to the -- initialization procedure will be generated, and no -- subaggregate is needed. Capture_Discriminants : declare ! Loc : constant Source_Ptr := Sloc (N); ! Expr : Node_Id; procedure Add_Discriminant_Values (New_Aggr : Node_Id; *************** package body Sem_Aggr is *** 3475,3482 **** procedure Propagate_Discriminants (Aggr : Node_Id; ! Assoc_List : List_Id; ! Comp : Entity_Id); -- Nested components may themselves be discriminated -- types constrained by outer discriminants, whose -- values must be captured before the aggregate is --- 3599,3605 ---- procedure Propagate_Discriminants (Aggr : Node_Id; ! Assoc_List : List_Id); -- Nested components may themselves be discriminated -- types constrained by outer discriminants, whose -- values must be captured before the aggregate is *************** package body Sem_Aggr is *** 3558,3585 **** procedure Propagate_Discriminants (Aggr : Node_Id; ! Assoc_List : List_Id; ! Comp : Entity_Id) is ! Inner_Comp : Entity_Id; ! Comp_Type : Entity_Id; Needs_Box : Boolean := False; ! New_Aggr : Node_Id; ! begin ! Inner_Comp := First_Component (Etype (Comp)); ! while Present (Inner_Comp) loop ! Comp_Type := Etype (Inner_Comp); ! if Is_Record_Type (Comp_Type) ! and then Has_Discriminants (Comp_Type) then New_Aggr := Make_Aggregate (Loc, New_List, New_List); ! Set_Etype (New_Aggr, Comp_Type); Add_Association ! (Inner_Comp, New_Aggr, Component_Associations (Aggr)); -- Collect discriminant values and recurse --- 3681,3722 ---- procedure Propagate_Discriminants (Aggr : Node_Id; ! Assoc_List : List_Id) is ! Aggr_Type : constant Entity_Id := ! Base_Type (Etype (Aggr)); ! Def_Node : constant Node_Id := ! Type_Definition ! (Declaration_Node (Aggr_Type)); ! ! Comp : Node_Id; ! Comp_Elmt : Elmt_Id; ! Components : constant Elist_Id := New_Elmt_List; Needs_Box : Boolean := False; ! Errors : Boolean; ! procedure Process_Component (Comp : Entity_Id); ! -- Add one component with a box association to the ! -- inner aggregate, and recurse if component is ! -- itself composite. ! ------------------------ ! -- Process_Component -- ! ------------------------ ! procedure Process_Component (Comp : Entity_Id) is ! T : constant Entity_Id := Etype (Comp); ! New_Aggr : Node_Id; ! ! begin ! if Is_Record_Type (T) ! and then Has_Discriminants (T) then New_Aggr := Make_Aggregate (Loc, New_List, New_List); ! Set_Etype (New_Aggr, T); Add_Association ! (Comp, New_Aggr, Component_Associations (Aggr)); -- Collect discriminant values and recurse *************** package body Sem_Aggr is *** 3587,3600 **** Add_Discriminant_Values (New_Aggr, Assoc_List); Propagate_Discriminants ! (New_Aggr, Assoc_List, Inner_Comp); else Needs_Box := True; end if; ! Next_Component (Inner_Comp); ! end loop; if Needs_Box then Append --- 3724,3778 ---- Add_Discriminant_Values (New_Aggr, Assoc_List); Propagate_Discriminants ! (New_Aggr, Assoc_List); else Needs_Box := True; end if; + end Process_Component; ! -- Start of processing for Propagate_Discriminants ! ! begin ! -- The component type may be a variant type, so ! -- collect the components that are ruled by the ! -- known values of the discriminants. Their values ! -- have already been inserted into the component ! -- list of the current aggregate. ! ! if Nkind (Def_Node) = N_Record_Definition ! and then ! Present (Component_List (Def_Node)) ! and then ! Present ! (Variant_Part (Component_List (Def_Node))) ! then ! Gather_Components (Aggr_Type, ! Component_List (Def_Node), ! Governed_By => Component_Associations (Aggr), ! Into => Components, ! Report_Errors => Errors); ! ! Comp_Elmt := First_Elmt (Components); ! while Present (Comp_Elmt) loop ! if ! Ekind (Node (Comp_Elmt)) /= E_Discriminant ! then ! Process_Component (Node (Comp_Elmt)); ! end if; ! ! Next_Elmt (Comp_Elmt); ! end loop; ! ! -- No variant part, iterate over all components ! ! else ! Comp := First_Component (Etype (Aggr)); ! while Present (Comp) loop ! Process_Component (Comp); ! Next_Component (Comp); ! end loop; ! end if; if Needs_Box then Append *************** package body Sem_Aggr is *** 3607,3636 **** end if; end Propagate_Discriminants; begin Expr := Make_Aggregate (Loc, New_List, New_List); Set_Etype (Expr, Ctyp); ! -- If the enclosing type has discriminants, they ! -- have been collected in the aggregate earlier, and ! -- they may appear as constraints of subcomponents. -- Similarly if this component has discriminants, they -- might in turn be propagated to their components. if Has_Discriminants (Typ) then Add_Discriminant_Values (Expr, New_Assoc_List); ! Propagate_Discriminants ! (Expr, New_Assoc_List, Component); elsif Has_Discriminants (Ctyp) then Add_Discriminant_Values ! (Expr, Component_Associations (Expr)); Propagate_Discriminants ! (Expr, Component_Associations (Expr), Component); else declare ! Comp : Entity_Id; begin -- If the type has additional components, create --- 3785,3816 ---- end if; end Propagate_Discriminants; + -- Start of processing for Capture_Discriminants + begin Expr := Make_Aggregate (Loc, New_List, New_List); Set_Etype (Expr, Ctyp); ! -- If the enclosing type has discriminants, they have ! -- been collected in the aggregate earlier, and they ! -- may appear as constraints of subcomponents. ! -- Similarly if this component has discriminants, they -- might in turn be propagated to their components. if Has_Discriminants (Typ) then Add_Discriminant_Values (Expr, New_Assoc_List); ! Propagate_Discriminants (Expr, New_Assoc_List); elsif Has_Discriminants (Ctyp) then Add_Discriminant_Values ! (Expr, Component_Associations (Expr)); Propagate_Discriminants ! (Expr, Component_Associations (Expr)); else declare ! Comp : Entity_Id; begin -- If the type has additional components, create *************** package body Sem_Aggr is *** 3737,3743 **** New_Assoc := First (New_Assoc_List); while Present (New_Assoc) loop Component := First (Choices (New_Assoc)); ! exit when Chars (Selectr) = Chars (Component); Next (New_Assoc); end loop; --- 3917,3931 ---- New_Assoc := First (New_Assoc_List); while Present (New_Assoc) loop Component := First (Choices (New_Assoc)); ! ! if Chars (Selectr) = Chars (Component) then ! if Style_Check then ! Check_Identifier (Selectr, Entity (Component)); ! end if; ! ! exit; ! end if; ! Next (New_Assoc); end loop; *************** package body Sem_Aggr is *** 3801,3808 **** elsif No (Typech) then Typech := Base_Type (Etype (Component)); elsif Typech /= Base_Type (Etype (Component)) then ! if not Box_Present (Parent (Selectr)) then Error_Msg_N ("components in choice list must have same type", Selectr); --- 3989,4011 ---- elsif No (Typech) then Typech := Base_Type (Etype (Component)); + -- AI05-0199: In Ada 2012, several components of anonymous + -- access types can appear in a choice list, as long as the + -- designated types match. + elsif Typech /= Base_Type (Etype (Component)) then ! if Ada_Version >= Ada_2012 ! and then Ekind (Typech) = E_Anonymous_Access_Type ! and then ! Ekind (Etype (Component)) = E_Anonymous_Access_Type ! and then Base_Type (Designated_Type (Typech)) = ! Base_Type (Designated_Type (Etype (Component))) ! and then ! Subtypes_Statically_Match (Typech, (Etype (Component))) ! then ! null; ! ! elsif not Box_Present (Parent (Selectr)) then Error_Msg_N ("components in choice list must have same type", Selectr); *************** package body Sem_Aggr is *** 3839,3845 **** begin pragma Assert ! (Ada_Version >= Ada_05 and then Present (Expr) and then Known_Null (Expr)); --- 4042,4048 ---- begin pragma Assert ! (Ada_Version >= Ada_2005 and then Present (Expr) and then Known_Null (Expr)); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_attr.adb gcc-4.6.0/gcc/ada/sem_attr.adb *** gcc-4.5.2/gcc/ada/sem_attr.adb Wed Oct 28 13:31:51 2009 --- gcc-4.6.0/gcc/ada/sem_attr.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Style; *** 66,72 **** with Stylesw; use Stylesw; with Targparm; use Targparm; with Ttypes; use Ttypes; - with Ttypef; use Ttypef; with Tbuild; use Tbuild; with Uintp; use Uintp; with Urealp; use Urealp; --- 66,71 ---- *************** package body Sem_Attr is *** 136,141 **** --- 135,141 ---- Attribute_05 : constant Attribute_Class_Array := Attribute_Class_Array'( Attribute_Machine_Rounding | + Attribute_Mod | Attribute_Priority | Attribute_Stream_Size | Attribute_Wide_Wide_Width => True, *************** package body Sem_Attr is *** 211,216 **** --- 211,223 ---- -- Used for Access, Unchecked_Access, Unrestricted_Access attributes. -- Internally, Id distinguishes which of the three cases is involved. + procedure Bad_Attribute_For_Predicate; + -- Output error message for use of a predicate (First, Last, Range) not + -- allowed with a type that has predicates. If the type is a generic + -- actual, then the message is a warning, and we generate code to raise + -- program error with an appropriate reason. No error message is given + -- for internally generated uses of the attributes. + procedure Check_Array_Or_Scalar_Type; -- Common procedure used by First, Last, Range attribute to check -- that the prefix is a constrained array or scalar type, or a name *************** package body Sem_Attr is *** 583,588 **** --- 590,599 ---- Check_For_Eliminated_Subprogram (P, Entity (P)); + -- Check for obsolescent subprogram reference + + Check_Obsolescent_2005_Entity (Entity (P), P); + -- Build the appropriate subprogram type Build_Access_Subprogram_Type (P); *************** package body Sem_Attr is *** 692,697 **** --- 703,714 ---- ("current instance attribute must appear alone", N); end if; + if Is_CPP_Class (Root_Type (Typ)) then + Error_Msg_N + ("?current instance unsupported for derivations of " + & "'C'P'P types", N); + end if; + -- OK if we are in initialization procedure for the type -- in question, in which case the reference to the type -- is rewritten as a reference to the current object. *************** package body Sem_Attr is *** 719,725 **** -- expression comes from source, e.g. when a single component -- association in an aggregate has a box association. ! elsif Ada_Version >= Ada_05 and then OK_Self_Reference then null; --- 736,742 ---- -- expression comes from source, e.g. when a single component -- association in an aggregate has a box association. ! elsif Ada_Version >= Ada_2005 and then OK_Self_Reference then null; *************** package body Sem_Attr is *** 816,821 **** --- 833,851 ---- end if; end Analyze_Access_Attribute; + --------------------------------- + -- Bad_Attribute_For_Predicate -- + --------------------------------- + + procedure Bad_Attribute_For_Predicate is + begin + if Comes_From_Source (N) then + Error_Msg_Name_1 := Aname; + Bad_Predicated_Subtype_Use + ("type& has predicates, attribute % not allowed", N, P_Type); + end if; + end Bad_Attribute_For_Predicate; + -------------------------------- -- Check_Array_Or_Scalar_Type -- -------------------------------- *************** package body Sem_Attr is *** 1338,1344 **** -- S : constant Integer := X.all'Size; -- ERROR -- procedure Q (Obj : Integer := X.all'Alignment); -- ERROR ! if Ada_Version >= Ada_05 and then Nkind (P) = N_Explicit_Dereference then E := P; --- 1368,1374 ---- -- S : constant Integer := X.all'Size; -- ERROR -- procedure Q (Obj : Integer := X.all'Alignment); -- ERROR ! if Ada_Version >= Ada_2005 and then Nkind (P) = N_Explicit_Dereference then E := P; *************** package body Sem_Attr is *** 1600,1606 **** end if; -- Check special case of Exception_Id and Exception_Occurrence which ! -- are not allowed for restriction No_Exception_Regstriation. if Is_RTE (P_Type, RE_Exception_Id) or else --- 1630,1636 ---- end if; -- Check special case of Exception_Id and Exception_Occurrence which ! -- are not allowed for restriction No_Exception_Registration. if Is_RTE (P_Type, RE_Exception_Id) or else *************** package body Sem_Attr is *** 1660,1666 **** if Is_Task_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Task_Type (Designated_Type (Etype (P)))) ! or else (Ada_Version >= Ada_05 and then Ekind (Etype (P)) = E_Class_Wide_Type and then Is_Interface (Etype (P)) and then Is_Task_Interface (Etype (P))) --- 1690,1696 ---- if Is_Task_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Task_Type (Designated_Type (Etype (P)))) ! or else (Ada_Version >= Ada_2005 and then Ekind (Etype (P)) = E_Class_Wide_Type and then Is_Interface (Etype (P)) and then Is_Task_Interface (Etype (P))) *************** package body Sem_Attr is *** 1668,1674 **** Resolve (P); else ! if Ada_Version >= Ada_05 then Error_Attr_P ("prefix of % attribute must be a task or a task " & "interface class-wide object"); --- 1698,1704 ---- Resolve (P); else ! if Ada_Version >= Ada_2005 then Error_Attr_P ("prefix of % attribute must be a task or a task " & "interface class-wide object"); *************** package body Sem_Attr is *** 1968,1974 **** -- Ada 2005 (AI-345): Ensure that the compiler gives exactly the current -- output compiling in Ada 95 mode for the case of ambiguous prefixes. ! if Ada_Version < Ada_05 and then Is_Overloaded (P) and then Aname /= Name_Access and then Aname /= Name_Address --- 1998,2004 ---- -- Ada 2005 (AI-345): Ensure that the compiler gives exactly the current -- output compiling in Ada 95 mode for the case of ambiguous prefixes. ! if Ada_Version < Ada_2005 and then Is_Overloaded (P) and then Aname /= Name_Access and then Aname /= Name_Address *************** package body Sem_Attr is *** 1979,1985 **** then Error_Attr ("ambiguous prefix for % attribute", P); ! elsif Ada_Version >= Ada_05 and then Is_Overloaded (P) and then Aname /= Name_Access and then Aname /= Name_Address --- 2009,2015 ---- then Error_Attr ("ambiguous prefix for % attribute", P); ! elsif Ada_Version >= Ada_2005 and then Is_Overloaded (P) and then Aname /= Name_Access and then Aname /= Name_Address *************** package body Sem_Attr is *** 1991,1997 **** -- entry wrappers, the attributes Count, Caller and AST_Entry require -- a context check ! if Ada_Version >= Ada_05 and then (Aname = Name_Count or else Aname = Name_Caller or else Aname = Name_AST_Entry) --- 2021,2027 ---- -- entry wrappers, the attributes Count, Caller and AST_Entry require -- a context check ! if Ada_Version >= Ada_2005 and then (Aname = Name_Count or else Aname = Name_Caller or else Aname = Name_AST_Entry) *************** package body Sem_Attr is *** 2384,2391 **** and then Base_Type (Typ) = Typ and then Warn_On_Redundant_Constructs then ! Error_Msg_NE ! ("?redundant attribute, & is its own base type", N, Typ); end if; Set_Etype (N, Base_Type (Entity (P))); --- 2414,2421 ---- and then Base_Type (Typ) = Typ and then Warn_On_Redundant_Constructs then ! Error_Msg_NE -- CODEFIX ! ("?redundant attribute, & is its own base type", N, Typ); end if; Set_Etype (N, Base_Type (Entity (P))); *************** package body Sem_Attr is *** 2534,2539 **** --- 2564,2588 ---- Check_E0; Find_Type (N); + -- Applying Class to untagged incomplete type is obsolescent in Ada + -- 2005. Note that we can't test Is_Tagged_Type here on P_Type, since + -- this flag gets set by Find_Type in this situation. + + if Restriction_Check_Required (No_Obsolescent_Features) + and then Ada_Version >= Ada_2005 + and then Ekind (P_Type) = E_Incomplete_Type + then + declare + DN : constant Node_Id := Declaration_Node (P_Type); + begin + if Nkind (DN) = N_Incomplete_Type_Declaration + and then not Tagged_Present (DN) + then + Check_Restriction (No_Obsolescent_Features, P); + end if; + end; + end if; + ------------------ -- Code_Address -- ------------------ *************** package body Sem_Attr is *** 2611,2617 **** -- Case from RM J.4(2) of constrained applied to private type if Is_Entity_Name (P) and then Is_Type (Entity (P)) then ! Check_Restriction (No_Obsolescent_Features, N); if Warn_On_Obsolescent_Feature then Error_Msg_N --- 2660,2666 ---- -- Case from RM J.4(2) of constrained applied to private type if Is_Entity_Name (P) and then Is_Type (Entity (P)) then ! Check_Restriction (No_Obsolescent_Features, P); if Warn_On_Obsolescent_Feature then Error_Msg_N *************** package body Sem_Attr is *** 2775,2784 **** exit; elsif Ekind (Scope (Ent)) in Task_Kind ! and then Ekind (S) /= E_Loop ! and then Ekind (S) /= E_Block ! and then Ekind (S) /= E_Entry ! and then Ekind (S) /= E_Entry_Family then Error_Attr ("Attribute % cannot appear in inner unit", N); --- 2824,2831 ---- exit; elsif Ekind (Scope (Ent)) in Task_Kind ! and then ! not Ekind_In (S, E_Loop, E_Block, E_Entry, E_Entry_Family) then Error_Attr ("Attribute % cannot appear in inner unit", N); *************** package body Sem_Attr is *** 2804,2810 **** -- Ada 2005 (AI-345): Do not consider primitive entry -- wrappers generated for task or protected types. ! elsif Ada_Version >= Ada_05 and then not Comes_From_Source (It.Nam) then null; --- 2851,2857 ---- -- Ada 2005 (AI-345): Do not consider primitive entry -- wrappers generated for task or protected types. ! elsif Ada_Version >= Ada_2005 and then not Comes_From_Source (It.Nam) then null; *************** package body Sem_Attr is *** 2961,2967 **** Ekind (Entity (P)) /= E_Enumeration_Literal) then Error_Attr_P ! ("prefix of %attribute must be " & "discrete type/object or enum literal"); end if; end if; --- 3008,3014 ---- Ekind (Entity (P)) /= E_Enumeration_Literal) then Error_Attr_P ! ("prefix of % attribute must be " & "discrete type/object or enum literal"); end if; end if; *************** package body Sem_Attr is *** 3051,3056 **** --- 3098,3104 ---- when Attribute_First => Check_Array_Or_Scalar_Type; + Bad_Attribute_For_Predicate; --------------- -- First_Bit -- *************** package body Sem_Attr is *** 3147,3153 **** elsif Is_Task_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Task_Type (Designated_Type (Etype (P)))) ! or else (Ada_Version >= Ada_05 and then Ekind (Etype (P)) = E_Class_Wide_Type and then Is_Interface (Etype (P)) and then Is_Task_Interface (Etype (P))) --- 3195,3201 ---- elsif Is_Task_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Task_Type (Designated_Type (Etype (P)))) ! or else (Ada_Version >= Ada_2005 and then Ekind (Etype (P)) = E_Class_Wide_Type and then Is_Interface (Etype (P)) and then Is_Task_Interface (Etype (P))) *************** package body Sem_Attr is *** 3156,3162 **** Set_Etype (N, RTE (RO_AT_Task_Id)); else ! if Ada_Version >= Ada_05 then Error_Attr_P ("prefix of % attribute must be an exception, a " & "task or a task interface class-wide object"); --- 3204,3210 ---- Set_Etype (N, RTE (RO_AT_Task_Id)); else ! if Ada_Version >= Ada_2005 then Error_Attr_P ("prefix of % attribute must be an exception, a " & "task or a task interface class-wide object"); *************** package body Sem_Attr is *** 3265,3270 **** --- 3313,3319 ---- when Attribute_Last => Check_Array_Or_Scalar_Type; + Bad_Attribute_For_Predicate; -------------- -- Last_Bit -- *************** package body Sem_Attr is *** 3392,3401 **** Set_Etype (N, P_Base_Type); ---------------------------------- -- Max_Size_In_Storage_Elements -- ---------------------------------- ! when Attribute_Max_Size_In_Storage_Elements => Check_E0; Check_Type; Check_Not_Incomplete_Type; --- 3441,3452 ---- Set_Etype (N, P_Base_Type); ---------------------------------- + -- Max_Alignment_For_Allocation -- -- Max_Size_In_Storage_Elements -- ---------------------------------- ! when Attribute_Max_Alignment_For_Allocation | ! Attribute_Max_Size_In_Storage_Elements => Check_E0; Check_Type; Check_Not_Incomplete_Type; *************** package body Sem_Attr is *** 3433,3439 **** elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P)) or else UI_To_Int (Intval (E1)) < 0 then ! Error_Attr ("invalid parameter number for %attribute", E1); end if; end if; --- 3484,3490 ---- elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P)) or else UI_To_Int (Intval (E1)) < 0 then ! Error_Attr ("invalid parameter number for % attribute", E1); end if; end if; *************** package body Sem_Attr is *** 3546,3558 **** ---------------------- procedure Must_Be_Imported (Proc_Ent : Entity_Id) is ! Pent : Entity_Id := Proc_Ent; begin - while Present (Alias (Pent)) loop - Pent := Alias (Pent); - end loop; - -- Ignore check if procedure not frozen yet (we will get -- another chance when the default parameter is reanalyzed) --- 3597,3605 ---- ---------------------- procedure Must_Be_Imported (Proc_Ent : Entity_Id) is ! Pent : constant Entity_Id := Ultimate_Alias (Proc_Ent); begin -- Ignore check if procedure not frozen yet (we will get -- another chance when the default parameter is reanalyzed) *************** package body Sem_Attr is *** 3620,3625 **** --- 3667,3690 ---- --------- when Attribute_Old => + + -- The attribute reference is a primary. If expressions follow, the + -- attribute reference is an indexable object, so rewrite the node + -- accordingly. + + if Present (E1) then + Rewrite (N, + Make_Indexed_Component (Loc, + Prefix => + Make_Attribute_Reference (Loc, + Prefix => Relocate_Node (Prefix (N)), + Attribute_Name => Name_Old), + Expressions => Expressions (N))); + + Analyze (N); + return; + end if; + Check_E0; Set_Etype (N, P_Type); *************** package body Sem_Attr is *** 3644,3651 **** Subp : Entity_Id := Current_Subprogram; function Process (N : Node_Id) return Traverse_Result; ! -- Check that N does not contain references to local variables ! -- or other local entities of Subp. ------------- -- Process -- --- 3709,3716 ---- Subp : Entity_Id := Current_Subprogram; function Process (N : Node_Id) return Traverse_Result; ! -- Check that N does not contain references to local variables or ! -- other local entities of Subp. ------------- -- Process -- *************** package body Sem_Attr is *** 3654,3659 **** --- 3719,3725 ---- function Process (N : Node_Id) return Traverse_Result is begin if Is_Entity_Name (N) + and then Present (Entity (N)) and then not Is_Formal (Entity (N)) and then Enclosing_Subprogram (Entity (N)) = Subp then *************** package body Sem_Attr is *** 3680,3689 **** if Present (Enclosing_Subprogram (Current_Subprogram)) then -- Check that there is no reference to the enclosing ! -- subprogram local variables. Otherwise, we might end ! -- up being called from the enclosing subprogram and thus ! -- using 'Old on a local variable which is not defined ! -- at entry time. Subp := Enclosing_Subprogram (Current_Subprogram); Check_No_Local (P); --- 3746,3755 ---- if Present (Enclosing_Subprogram (Current_Subprogram)) then -- Check that there is no reference to the enclosing ! -- subprogram local variables. Otherwise, we might end up ! -- being called from the enclosing subprogram and thus using ! -- 'Old on a local variable which is not defined at entry ! -- time. Subp := Enclosing_Subprogram (Current_Subprogram); Check_No_Local (P); *************** package body Sem_Attr is *** 3729,3736 **** elsif Is_Entity_Name (P) and then Is_Pure (Entity (P)) then ! Error_Attr_P ! ("prefix of % attribute must not be declared pure"); end if; end if; --- 3795,3801 ---- elsif Is_Entity_Name (P) and then Is_Pure (Entity (P)) then ! Error_Attr_P ("prefix of% attribute must not be declared pure"); end if; end if; *************** package body Sem_Attr is *** 3804,3810 **** -- Ada 2005 (AI-327): Dynamic ceiling priorities when Attribute_Priority => ! if Ada_Version < Ada_05 then Error_Attr ("% attribute is allowed only in Ada 2005 mode", P); end if; --- 3869,3875 ---- -- Ada 2005 (AI-327): Dynamic ceiling priorities when Attribute_Priority => ! if Ada_Version < Ada_2005 then Error_Attr ("% attribute is allowed only in Ada 2005 mode", P); end if; *************** package body Sem_Attr is *** 3853,3858 **** --- 3918,3924 ---- when Attribute_Range => Check_Array_Or_Scalar_Type; + Bad_Attribute_For_Predicate; if Ada_Version = Ada_83 and then Is_Scalar_Type (P_Type) *************** package body Sem_Attr is *** 3952,3960 **** Error_Attr; end if; ! Rewrite (N, ! Make_Identifier (Sloc (N), ! Chars => Name_uResult)); Analyze_And_Resolve (N, Etype (PS)); else --- 4018,4024 ---- Error_Attr; end if; ! Rewrite (N, Make_Identifier (Sloc (N), Name_uResult)); Analyze_And_Resolve (N, Etype (PS)); else *************** package body Sem_Attr is *** 3985,3990 **** --- 4049,4071 ---- Resolve (N, Standard_Void_Type); Note_Possible_Modification (E2, Sure => True); + --------- + -- Ref -- + --------- + + when Attribute_Ref => + Check_E1; + Analyze (P); + + if Nkind (P) /= N_Expanded_Name + or else not Is_RTE (P_Type, RE_Address) + then + Error_Attr_P ("prefix of % attribute must be System.Address"); + end if; + + Analyze_And_Resolve (E1, Any_Integer); + Set_Etype (N, RTE (RE_Address)); + --------------- -- Remainder -- --------------- *************** package body Sem_Attr is *** 4201,4206 **** --- 4282,4291 ---- if Is_Task_Type (P_Type) then Set_Etype (N, Universal_Integer); + -- Use with tasks is an obsolescent feature + + Check_Restriction (No_Obsolescent_Features, P); + elsif Is_Access_Type (P_Type) then if Ekind (P_Type) = E_Access_Subprogram_Type then Error_Attr_P *************** package body Sem_Attr is *** 4376,4382 **** if Nkind (P) /= N_Identifier or else Chars (P) /= Name_System then ! Error_Attr_P ("prefix of %attribute must be System"); end if; Generate_Reference (RTE (RE_Address), P); --- 4461,4467 ---- if Nkind (P) /= N_Identifier or else Chars (P) /= Name_System then ! Error_Attr_P ("prefix of % attribute must be System"); end if; Generate_Reference (RTE (RE_Address), P); *************** package body Sem_Attr is *** 4420,4425 **** --- 4505,4553 ---- Check_PolyORB_Attribute; Set_Etype (N, RTE (RE_TypeCode)); + -------------- + -- Type_Key -- + -------------- + + when Attribute_Type_Key => + Check_E0; + Check_Type; + + -- This processing belongs in Eval_Attribute ??? + + declare + function Type_Key return String_Id; + -- A very preliminary implementation. For now, a signature + -- consists of only the type name. This is clearly incomplete + -- (e.g., adding a new field to a record type should change the + -- type's Type_Key attribute). + + -------------- + -- Type_Key -- + -------------- + + function Type_Key return String_Id is + Full_Name : constant String_Id := + Fully_Qualified_Name_String (Entity (P)); + + begin + -- Copy all characters in Full_Name but the trailing NUL + + Start_String; + for J in 1 .. String_Length (Full_Name) - 1 loop + Store_String_Char (Get_String_Char (Full_Name, Int (J))); + end loop; + + Store_String_Chars ("'Type_Key"); + return End_String; + end Type_Key; + + begin + Rewrite (N, Make_String_Literal (Loc, Type_Key)); + end; + + Analyze_And_Resolve (N, Standard_String); + ----------------- -- UET_Address -- ----------------- *************** package body Sem_Attr is *** 4809,4817 **** -- processing, since otherwise gigi might see an attribute which it is -- unprepared to deal with. ! function Aft_Value return Nat; ! -- Computes Aft value for current attribute prefix (used by Aft itself ! -- and also by Width for computing the Width of a fixed point type). procedure Check_Expressions; -- In case where the attribute is not foldable, the expressions, if --- 4937,4947 ---- -- processing, since otherwise gigi might see an attribute which it is -- unprepared to deal with. ! procedure Check_Concurrent_Discriminant (Bound : Node_Id); ! -- If Bound is a reference to a discriminant of a task or protected type ! -- occurring within the object's body, rewrite attribute reference into ! -- a reference to the corresponding discriminal. Use for the expansion ! -- of checks against bounds of entry family index subtypes. procedure Check_Expressions; -- In case where the attribute is not foldable, the expressions, if *************** package body Sem_Attr is *** 4829,4863 **** -- but compile time known value given by Val. It includes the -- necessary checks for out of range values. - procedure Float_Attribute_Universal_Integer - (IEEES_Val : Int; - IEEEL_Val : Int; - IEEEX_Val : Int; - VAXFF_Val : Int; - VAXDF_Val : Int; - VAXGF_Val : Int; - AAMPS_Val : Int; - AAMPL_Val : Int); - -- This procedure evaluates a float attribute with no arguments that - -- returns a universal integer result. The parameters give the values - -- for the possible floating-point root types. See ttypef for details. - -- The prefix type is a float type (and is thus not a generic type). - - procedure Float_Attribute_Universal_Real - (IEEES_Val : String; - IEEEL_Val : String; - IEEEX_Val : String; - VAXFF_Val : String; - VAXDF_Val : String; - VAXGF_Val : String; - AAMPS_Val : String; - AAMPL_Val : String); - -- This procedure evaluates a float attribute with no arguments that - -- returns a universal real result. The parameters give the values - -- required for the possible floating-point root types in string - -- format as real literals with a possible leading minus sign. - -- The prefix type is a float type (and is thus not a generic type). - function Fore_Value return Nat; -- Computes the Fore value for the current attribute prefix, which is -- known to be a static fixed-point type. Used by Fore and Width. --- 4959,4964 ---- *************** package body Sem_Attr is *** 4878,4901 **** -- Verify that the prefix of a potentially static array attribute -- satisfies the conditions of 4.9 (14). ! --------------- ! -- Aft_Value -- ! --------------- ! function Aft_Value return Nat is ! Result : Nat; ! Delta_Val : Ureal; begin ! Result := 1; ! Delta_Val := Delta_Value (P_Type); ! while Delta_Val < Ureal_Tenth loop ! Delta_Val := Delta_Val * Ureal_10; ! Result := Result + 1; ! end loop; ! return Result; ! end Aft_Value; ----------------------- -- Check_Expressions -- --- 4979,5011 ---- -- Verify that the prefix of a potentially static array attribute -- satisfies the conditions of 4.9 (14). ! ----------------------------------- ! -- Check_Concurrent_Discriminant -- ! ----------------------------------- ! procedure Check_Concurrent_Discriminant (Bound : Node_Id) is ! Tsk : Entity_Id; ! -- The concurrent (task or protected) type begin ! if Nkind (Bound) = N_Identifier ! and then Ekind (Entity (Bound)) = E_Discriminant ! and then Is_Concurrent_Record_Type (Scope (Entity (Bound))) ! then ! Tsk := Corresponding_Concurrent_Type (Scope (Entity (Bound))); ! if In_Open_Scopes (Tsk) and then Has_Completion (Tsk) then ! ! -- Find discriminant of original concurrent type, and use ! -- its current discriminal, which is the renaming within ! -- the task/protected body. ! ! Rewrite (N, ! New_Occurrence_Of ! (Find_Body_Discriminal (Entity (Bound)), Loc)); ! end if; ! end if; ! end Check_Concurrent_Discriminant; ----------------------- -- Check_Expressions -- *************** package body Sem_Attr is *** 4950,5052 **** Compile_Time_Known_Value (Type_High_Bound (Typ)); end Compile_Time_Known_Bounds; - --------------------------------------- - -- Float_Attribute_Universal_Integer -- - --------------------------------------- - - procedure Float_Attribute_Universal_Integer - (IEEES_Val : Int; - IEEEL_Val : Int; - IEEEX_Val : Int; - VAXFF_Val : Int; - VAXDF_Val : Int; - VAXGF_Val : Int; - AAMPS_Val : Int; - AAMPL_Val : Int) - is - Val : Int; - Digs : constant Nat := UI_To_Int (Digits_Value (P_Base_Type)); - - begin - if Vax_Float (P_Base_Type) then - if Digs = VAXFF_Digits then - Val := VAXFF_Val; - elsif Digs = VAXDF_Digits then - Val := VAXDF_Val; - else pragma Assert (Digs = VAXGF_Digits); - Val := VAXGF_Val; - end if; - - elsif Is_AAMP_Float (P_Base_Type) then - if Digs = AAMPS_Digits then - Val := AAMPS_Val; - else pragma Assert (Digs = AAMPL_Digits); - Val := AAMPL_Val; - end if; - - else - if Digs = IEEES_Digits then - Val := IEEES_Val; - elsif Digs = IEEEL_Digits then - Val := IEEEL_Val; - else pragma Assert (Digs = IEEEX_Digits); - Val := IEEEX_Val; - end if; - end if; - - Fold_Uint (N, UI_From_Int (Val), True); - end Float_Attribute_Universal_Integer; - - ------------------------------------ - -- Float_Attribute_Universal_Real -- - ------------------------------------ - - procedure Float_Attribute_Universal_Real - (IEEES_Val : String; - IEEEL_Val : String; - IEEEX_Val : String; - VAXFF_Val : String; - VAXDF_Val : String; - VAXGF_Val : String; - AAMPS_Val : String; - AAMPL_Val : String) - is - Val : Node_Id; - Digs : constant Nat := UI_To_Int (Digits_Value (P_Base_Type)); - - begin - if Vax_Float (P_Base_Type) then - if Digs = VAXFF_Digits then - Val := Real_Convert (VAXFF_Val); - elsif Digs = VAXDF_Digits then - Val := Real_Convert (VAXDF_Val); - else pragma Assert (Digs = VAXGF_Digits); - Val := Real_Convert (VAXGF_Val); - end if; - - elsif Is_AAMP_Float (P_Base_Type) then - if Digs = AAMPS_Digits then - Val := Real_Convert (AAMPS_Val); - else pragma Assert (Digs = AAMPL_Digits); - Val := Real_Convert (AAMPL_Val); - end if; - - else - if Digs = IEEES_Digits then - Val := Real_Convert (IEEES_Val); - elsif Digs = IEEEL_Digits then - Val := Real_Convert (IEEEL_Val); - else pragma Assert (Digs = IEEEX_Digits); - Val := Real_Convert (IEEEX_Val); - end if; - end if; - - Set_Sloc (Val, Loc); - Rewrite (N, Val); - Set_Is_Static_Expression (N, Static); - Analyze_And_Resolve (N, C_Type); - end Float_Attribute_Universal_Real; - ---------------- -- Fore_Value -- ---------------- --- 5060,5065 ---- *************** package body Sem_Attr is *** 5256,5263 **** -- Start of processing for Eval_Attribute begin ! -- Acquire first two expressions (at the moment, no attributes ! -- take more than two expressions in any case). if Present (Expressions (N)) then E1 := First (Expressions (N)); --- 5269,5310 ---- -- Start of processing for Eval_Attribute begin ! -- No folding in spec expression that comes from source where the prefix ! -- is an unfrozen entity. This avoids premature folding in cases like: ! ! -- procedure DefExprAnal is ! -- type R is new Integer; ! -- procedure P (Arg : Integer := R'Size); ! -- for R'Size use 64; ! -- procedure P (Arg : Integer := R'Size) is ! -- begin ! -- Put_Line (Arg'Img); ! -- end P; ! -- begin ! -- P; ! -- end; ! ! -- which should print 64 rather than 32. The exclusion of non-source ! -- constructs from this test comes from some internal usage in packed ! -- arrays, which otherwise fails, could use more analysis perhaps??? ! ! -- We do however go ahead with generic actual types, otherwise we get ! -- some regressions, probably these types should be frozen anyway??? ! ! if In_Spec_Expression ! and then Comes_From_Source (N) ! and then not (Is_Entity_Name (P) ! and then ! (Is_Frozen (Entity (P)) ! or else (Is_Type (Entity (P)) ! and then ! Is_Generic_Actual_Type (Entity (P))))) ! then ! return; ! end if; ! ! -- Acquire first two expressions (at the moment, no attributes take more ! -- than two expressions in any case). if Present (Expressions (N)) then E1 := First (Expressions (N)); *************** package body Sem_Attr is *** 5274,5281 **** if Id = Attribute_Enabled then - -- Evaluate the Enabled attribute - -- We skip evaluation if the expander is not active. This is not just -- an optimization. It is of key importance that we not rewrite the -- attribute in a generic template, since we want to pick up the --- 5321,5326 ---- *************** package body Sem_Attr is *** 5457,5463 **** or else Id = Attribute_Type_Class or else ! Id = Attribute_Unconstrained_Array) and then not Is_Generic_Type (P_Entity) then P_Type := P_Entity; --- 5502,5510 ---- or else Id = Attribute_Type_Class or else ! Id = Attribute_Unconstrained_Array ! or else ! Id = Attribute_Max_Alignment_For_Allocation) and then not Is_Generic_Type (P_Entity) then P_Type := P_Entity; *************** package body Sem_Attr is *** 5582,5588 **** then Static := False; ! else if not Is_Constrained (P_Type) or else (Id /= Attribute_First and then Id /= Attribute_Last and then --- 5629,5635 ---- then Static := False; ! elsif Id /= Attribute_Max_Alignment_For_Allocation then if not Is_Constrained (P_Type) or else (Id /= Attribute_First and then Id /= Attribute_Last and then *************** package body Sem_Attr is *** 5626,5635 **** while Present (N) loop Static := Static and then Is_Static_Subtype (Etype (N)); ! -- If however the index type is generic, attributes cannot ! -- be folded. ! if Is_Generic_Type (Etype (N)) and then Id /= Attribute_Component_Size then return; --- 5673,5682 ---- while Present (N) loop Static := Static and then Is_Static_Subtype (Etype (N)); ! -- If however the index type is generic, or derived from ! -- one, attributes cannot be folded. ! if Is_Generic_Type (Root_Type (Etype (N))) and then Id /= Attribute_Component_Size then return; *************** package body Sem_Attr is *** 5756,5762 **** --------- when Attribute_Aft => ! Fold_Uint (N, UI_From_Int (Aft_Value), True); --------------- -- Alignment -- --- 5803,5809 ---- --------- when Attribute_Aft => ! Fold_Uint (N, Aft_Value (P_Type), True); --------------- -- Alignment -- *************** package body Sem_Attr is *** 5984,5989 **** --- 6031,6039 ---- else Fold_Uint (N, Expr_Value (Lo_Bound), Static); end if; + + else + Check_Concurrent_Discriminant (Lo_Bound); end if; end First_Attr; *************** package body Sem_Attr is *** 6172,6177 **** --- 6222,6230 ---- else Fold_Uint (N, Expr_Value (Hi_Bound), Static); end if; + + else + Check_Concurrent_Discriminant (Hi_Bound); end if; end Last; *************** package body Sem_Attr is *** 6192,6204 **** Ind : Node_Id; begin ! -- In the case of a generic index type, the bounds may appear static ! -- but the computation is not meaningful in this case, and may ! -- generate a spurious warning. Ind := First_Index (P_Type); while Present (Ind) loop ! if Is_Generic_Type (Etype (Ind)) then return; end if; --- 6245,6257 ---- Ind : Node_Id; begin ! -- If any index type is a formal type, or derived from one, the ! -- bounds are not static. Treating them as static can produce ! -- spurious warnings or improper constant folding. Ind := First_Index (P_Type); while Present (Ind) loop ! if Is_Generic_Type (Root_Type (Etype (Ind))) then return; end if; *************** package body Sem_Attr is *** 6260,6304 **** ------------------ when Attribute_Machine_Emax => ! Float_Attribute_Universal_Integer ( ! IEEES_Machine_Emax, ! IEEEL_Machine_Emax, ! IEEEX_Machine_Emax, ! VAXFF_Machine_Emax, ! VAXDF_Machine_Emax, ! VAXGF_Machine_Emax, ! AAMPS_Machine_Emax, ! AAMPL_Machine_Emax); ------------------ -- Machine_Emin -- ------------------ when Attribute_Machine_Emin => ! Float_Attribute_Universal_Integer ( ! IEEES_Machine_Emin, ! IEEEL_Machine_Emin, ! IEEEX_Machine_Emin, ! VAXFF_Machine_Emin, ! VAXDF_Machine_Emin, ! VAXGF_Machine_Emin, ! AAMPS_Machine_Emin, ! AAMPL_Machine_Emin); ---------------------- -- Machine_Mantissa -- ---------------------- when Attribute_Machine_Mantissa => ! Float_Attribute_Universal_Integer ( ! IEEES_Machine_Mantissa, ! IEEEL_Machine_Mantissa, ! IEEEX_Machine_Mantissa, ! VAXFF_Machine_Mantissa, ! VAXDF_Machine_Mantissa, ! VAXGF_Machine_Mantissa, ! AAMPS_Machine_Mantissa, ! AAMPL_Machine_Mantissa); ----------------------- -- Machine_Overflows -- --- 6313,6333 ---- ------------------ when Attribute_Machine_Emax => ! Fold_Uint (N, Machine_Emax_Value (P_Type), Static); ------------------ -- Machine_Emin -- ------------------ when Attribute_Machine_Emin => ! Fold_Uint (N, Machine_Emin_Value (P_Type), Static); ---------------------- -- Machine_Mantissa -- ---------------------- when Attribute_Machine_Mantissa => ! Fold_Uint (N, Machine_Mantissa_Value (P_Type), Static); ----------------------- -- Machine_Overflows -- *************** package body Sem_Attr is *** 6346,6352 **** -- Note: for the folding case, it is fine to treat Machine_Rounding -- exactly the same way as Rounding, since this is one of the allowed -- behaviors, and performance is not an issue here. It might be a bit ! -- better to give the same result as it would give at run-time, even -- though the non-determinism is certainly permitted. when Attribute_Machine_Rounding => --- 6375,6381 ---- -- Note: for the folding case, it is fine to treat Machine_Rounding -- exactly the same way as Rounding, since this is one of the allowed -- behaviors, and performance is not an issue here. It might be a bit ! -- better to give the same result as it would give at run time, even -- though the non-determinism is certainly permitted. when Attribute_Machine_Rounding => *************** package body Sem_Attr is *** 6486,6491 **** --- 6515,6543 ---- end Max; ---------------------------------- + -- Max_Alignment_For_Allocation -- + ---------------------------------- + + -- Max_Alignment_For_Allocation is usually the Alignment. However, + -- arrays are allocated with dope, so we need to take into account both + -- the alignment of the array, which comes from the component alignment, + -- and the alignment of the dope. Also, if the alignment is unknown, we + -- use the max (it's OK to be pessimistic). + + when Attribute_Max_Alignment_For_Allocation => + declare + A : Uint := UI_From_Int (Ttypes.Maximum_Alignment); + begin + if Known_Alignment (P_Type) and then + (not Is_Array_Type (P_Type) or else Alignment (P_Type) > A) + then + A := Alignment (P_Type); + end if; + + Fold_Uint (N, A, Static); + end; + + ---------------------------------- -- Max_Size_In_Storage_Elements -- ---------------------------------- *************** package body Sem_Attr is *** 6566,6625 **** ---------------- when Attribute_Model_Emin => ! Float_Attribute_Universal_Integer ( ! IEEES_Model_Emin, ! IEEEL_Model_Emin, ! IEEEX_Model_Emin, ! VAXFF_Model_Emin, ! VAXDF_Model_Emin, ! VAXGF_Model_Emin, ! AAMPS_Model_Emin, ! AAMPL_Model_Emin); ------------------- -- Model_Epsilon -- ------------------- when Attribute_Model_Epsilon => ! Float_Attribute_Universal_Real ( ! IEEES_Model_Epsilon'Universal_Literal_String, ! IEEEL_Model_Epsilon'Universal_Literal_String, ! IEEEX_Model_Epsilon'Universal_Literal_String, ! VAXFF_Model_Epsilon'Universal_Literal_String, ! VAXDF_Model_Epsilon'Universal_Literal_String, ! VAXGF_Model_Epsilon'Universal_Literal_String, ! AAMPS_Model_Epsilon'Universal_Literal_String, ! AAMPL_Model_Epsilon'Universal_Literal_String); -------------------- -- Model_Mantissa -- -------------------- when Attribute_Model_Mantissa => ! Float_Attribute_Universal_Integer ( ! IEEES_Model_Mantissa, ! IEEEL_Model_Mantissa, ! IEEEX_Model_Mantissa, ! VAXFF_Model_Mantissa, ! VAXDF_Model_Mantissa, ! VAXGF_Model_Mantissa, ! AAMPS_Model_Mantissa, ! AAMPL_Model_Mantissa); ----------------- -- Model_Small -- ----------------- when Attribute_Model_Small => ! Float_Attribute_Universal_Real ( ! IEEES_Model_Small'Universal_Literal_String, ! IEEEL_Model_Small'Universal_Literal_String, ! IEEEX_Model_Small'Universal_Literal_String, ! VAXFF_Model_Small'Universal_Literal_String, ! VAXDF_Model_Small'Universal_Literal_String, ! VAXGF_Model_Small'Universal_Literal_String, ! AAMPS_Model_Small'Universal_Literal_String, ! AAMPL_Model_Small'Universal_Literal_String); ------------- -- Modulus -- --- 6618,6645 ---- ---------------- when Attribute_Model_Emin => ! Fold_Uint (N, Model_Emin_Value (P_Base_Type), Static); ------------------- -- Model_Epsilon -- ------------------- when Attribute_Model_Epsilon => ! Fold_Ureal (N, Model_Epsilon_Value (P_Base_Type), Static); -------------------- -- Model_Mantissa -- -------------------- when Attribute_Model_Mantissa => ! Fold_Uint (N, Model_Mantissa_Value (P_Base_Type), Static); ----------------- -- Model_Small -- ----------------- when Attribute_Model_Small => ! Fold_Ureal (N, Model_Small_Value (P_Base_Type), Static); ------------- -- Modulus -- *************** package body Sem_Attr is *** 6772,6777 **** --- 6792,6804 ---- end case; end; + --------- + -- Ref -- + --------- + + when Attribute_Ref => + Fold_Uint (N, Expr_Value (E1), True); + --------------- -- Remainder -- --------------- *************** package body Sem_Attr is *** 6830,6859 **** --------------- when Attribute_Safe_Emax => ! Float_Attribute_Universal_Integer ( ! IEEES_Safe_Emax, ! IEEEL_Safe_Emax, ! IEEEX_Safe_Emax, ! VAXFF_Safe_Emax, ! VAXDF_Safe_Emax, ! VAXGF_Safe_Emax, ! AAMPS_Safe_Emax, ! AAMPL_Safe_Emax); ---------------- -- Safe_First -- ---------------- when Attribute_Safe_First => ! Float_Attribute_Universal_Real ( ! IEEES_Safe_First'Universal_Literal_String, ! IEEEL_Safe_First'Universal_Literal_String, ! IEEEX_Safe_First'Universal_Literal_String, ! VAXFF_Safe_First'Universal_Literal_String, ! VAXDF_Safe_First'Universal_Literal_String, ! VAXGF_Safe_First'Universal_Literal_String, ! AAMPS_Safe_First'Universal_Literal_String, ! AAMPL_Safe_First'Universal_Literal_String); ---------------- -- Safe_Large -- --- 6857,6870 ---- --------------- when Attribute_Safe_Emax => ! Fold_Uint (N, Safe_Emax_Value (P_Type), Static); ---------------- -- Safe_First -- ---------------- when Attribute_Safe_First => ! Fold_Ureal (N, Safe_First_Value (P_Type), Static); ---------------- -- Safe_Large -- *************** package body Sem_Attr is *** 6864,6878 **** Fold_Ureal (N, Expr_Value_R (Type_High_Bound (P_Base_Type)), Static); else ! Float_Attribute_Universal_Real ( ! IEEES_Safe_Large'Universal_Literal_String, ! IEEEL_Safe_Large'Universal_Literal_String, ! IEEEX_Safe_Large'Universal_Literal_String, ! VAXFF_Safe_Large'Universal_Literal_String, ! VAXDF_Safe_Large'Universal_Literal_String, ! VAXGF_Safe_Large'Universal_Literal_String, ! AAMPS_Safe_Large'Universal_Literal_String, ! AAMPL_Safe_Large'Universal_Literal_String); end if; --------------- --- 6875,6881 ---- Fold_Ureal (N, Expr_Value_R (Type_High_Bound (P_Base_Type)), Static); else ! Fold_Ureal (N, Safe_Last_Value (P_Type), Static); end if; --------------- *************** package body Sem_Attr is *** 6880,6894 **** --------------- when Attribute_Safe_Last => ! Float_Attribute_Universal_Real ( ! IEEES_Safe_Last'Universal_Literal_String, ! IEEEL_Safe_Last'Universal_Literal_String, ! IEEEX_Safe_Last'Universal_Literal_String, ! VAXFF_Safe_Last'Universal_Literal_String, ! VAXDF_Safe_Last'Universal_Literal_String, ! VAXGF_Safe_Last'Universal_Literal_String, ! AAMPS_Safe_Last'Universal_Literal_String, ! AAMPL_Safe_Last'Universal_Literal_String); ---------------- -- Safe_Small -- --- 6883,6889 ---- --------------- when Attribute_Safe_Last => ! Fold_Ureal (N, Safe_Last_Value (P_Type), Static); ---------------- -- Safe_Small -- *************** package body Sem_Attr is *** 6906,6920 **** -- Ada 83 Safe_Small for floating-point cases else ! Float_Attribute_Universal_Real ( ! IEEES_Safe_Small'Universal_Literal_String, ! IEEEL_Safe_Small'Universal_Literal_String, ! IEEEX_Safe_Small'Universal_Literal_String, ! VAXFF_Safe_Small'Universal_Literal_String, ! VAXDF_Safe_Small'Universal_Literal_String, ! VAXGF_Safe_Small'Universal_Literal_String, ! AAMPS_Safe_Small'Universal_Literal_String, ! AAMPL_Safe_Small'Universal_Literal_String); end if; ----------- --- 6901,6907 ---- -- Ada 83 Safe_Small for floating-point cases else ! Fold_Ureal (N, Model_Small_Value (P_Type), Static); end if; ----------- *************** package body Sem_Attr is *** 7328,7334 **** -- For fixed-point type width is Fore + 1 + Aft (RM 3.5(34)) Fold_Uint ! (N, UI_From_Int (Fore_Value + 1 + Aft_Value), True); end if; -- Discrete types --- 7315,7322 ---- -- For fixed-point type width is Fore + 1 + Aft (RM 3.5(34)) Fold_Uint ! (N, UI_From_Int (Fore_Value + 1) + Aft_Value (P_Type), ! True); end if; -- Discrete types *************** package body Sem_Attr is *** 7363,7369 **** -- All wide characters look like Hex_hhhhhhhh if J > 255 then ! W := 12; else C := Character'Val (J); --- 7351,7360 ---- -- All wide characters look like Hex_hhhhhhhh if J > 255 then ! ! -- No need to compute this more than once! ! ! exit; else C := Character'Val (J); *************** package body Sem_Attr is *** 7376,7388 **** case C is when Reserved_128 | Reserved_129 | Reserved_132 | Reserved_153 - => Wt := 12; when BS | HT | LF | VT | FF | CR | SO | SI | EM | FS | GS | RS | US | RI | MW | ST | PM - => Wt := 2; when NUL | SOH | STX | ETX | EOT | --- 7367,7377 ---- *************** package body Sem_Attr is *** 7394,7406 **** SS2 | SS3 | DCS | PU1 | PU2 | STS | CCH | SPA | EPA | SOS | SCI | CSI | OSC | APC - => Wt := 3; when Space .. Tilde | No_Break_Space .. LC_Y_Diaeresis ! => Wt := 3; end case; W := Int'Max (W, Wt); --- 7383,7402 ---- SS2 | SS3 | DCS | PU1 | PU2 | STS | CCH | SPA | EPA | SOS | SCI | CSI | OSC | APC => Wt := 3; when Space .. Tilde | No_Break_Space .. LC_Y_Diaeresis + => + -- Special case of soft hyphen in Ada 2005 ! if C = Character'Val (16#AD#) ! and then Ada_Version >= Ada_2005 ! then ! Wt := 11; ! else ! Wt := 3; ! end if; end case; W := Int'Max (W, Wt); *************** package body Sem_Attr is *** 7487,7493 **** end if; end Width; ! -- The following attributes denote function that cannot be folded when Attribute_From_Any | Attribute_To_Any | --- 7483,7489 ---- end if; end Width; ! -- The following attributes denote functions that cannot be folded when Attribute_From_Any | Attribute_To_Any | *************** package body Sem_Attr is *** 7541,7546 **** --- 7537,7543 ---- Attribute_Target_Name | Attribute_Terminated | Attribute_To_Address | + Attribute_Type_Key | Attribute_UET_Address | Attribute_Unchecked_Access | Attribute_Universal_Literal_String | *************** package body Sem_Attr is *** 7645,7652 **** -- know will fail, so generate an appropriate warning. if In_Instance_Body then ! Error_Msg_F ! ("?non-local pointer cannot point to local object", P); Error_Msg_F ("\?Program_Error will be raised at run time", P); Rewrite (N, --- 7642,7648 ---- -- know will fail, so generate an appropriate warning. if In_Instance_Body then ! Error_Msg_F ("?non-local pointer cannot point to local object", P); Error_Msg_F ("\?Program_Error will be raised at run time", P); Rewrite (N, *************** package body Sem_Attr is *** 7656,7663 **** return; else ! Error_Msg_F ! ("non-local pointer cannot point to local object", P); -- Check for case where we have a missing access definition --- 7652,7658 ---- return; else ! Error_Msg_F ("non-local pointer cannot point to local object", P); -- Check for case where we have a missing access definition *************** package body Sem_Attr is *** 7686,7694 **** -- Start of processing for Resolve_Attribute begin ! -- If error during analysis, no point in continuing, except for ! -- array types, where we get better recovery by using unconstrained ! -- indices than nothing at all (see Check_Array_Type). if Error_Posted (N) and then Attr_Id /= Attribute_First --- 7681,7689 ---- -- Start of processing for Resolve_Attribute begin ! -- If error during analysis, no point in continuing, except for array ! -- types, where we get better recovery by using unconstrained indexes ! -- than nothing at all (see Check_Array_Type). if Error_Posted (N) and then Attr_Id /= Attribute_First *************** package body Sem_Attr is *** 7774,7780 **** -- 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; elsif Is_Type (Entity (P)) then --- 7769,7775 ---- -- Avoid insertion of freeze actions in spec expression mode if not In_Spec_Expression then ! Freeze_Before (N, Entity (P)); end if; elsif Is_Type (Entity (P)) then *************** package body Sem_Attr is *** 7813,7823 **** -- also be accessibility checks on those, this is where the -- checks can eventually be centralized ??? ! if Ekind (Btyp) = E_Access_Subprogram_Type ! or else ! Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type ! or else ! Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type then -- Deal with convention mismatch --- 7808,7816 ---- -- also be accessibility checks on those, this is where the -- checks can eventually be centralized ??? ! if Ekind_In (Btyp, E_Access_Subprogram_Type, ! E_Anonymous_Access_Subprogram_Type, ! E_Anonymous_Access_Protected_Subprogram_Type) then -- Deal with convention mismatch *************** package body Sem_Attr is *** 7874,7879 **** --- 7867,7873 ---- -- 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 attribute when the -- access type is a generic formal access type (since the -- level of the actual type is not known). This restriction *************** package body Sem_Attr is *** 7906,7912 **** --- 7900,7914 ---- -- when within an instance, because any violations will have -- been caught by the compilation of the generic unit. + -- Note that we relax this check in CodePeer mode for + -- compatibility with legacy code, since CodePeer is an + -- Ada source code analyzer, not a strict compiler. + -- ??? Note that a better approach would be to have a + -- separate switch to relax this rule, and enable this + -- switch in CodePeer mode. + elsif Attr_Id = Attribute_Access + and then not CodePeer_Mode and then not In_Instance and then Present (Enclosing_Generic_Unit (Entity (P))) and then Present (Enclosing_Generic_Body (N)) *************** package body Sem_Attr is *** 7923,7931 **** -- The attribute type's ultimate ancestor must be -- declared within the same generic unit as the -- subprogram is declared. The error message is ! -- specialized to say "ancestor" for the case where ! -- the access type is not its own ancestor, since ! -- saying simply "access type" would be very confusing. if Enclosing_Generic_Unit (Entity (P)) /= Enclosing_Generic_Unit (Root_Type (Btyp)) --- 7925,7933 ---- -- The attribute type's ultimate ancestor must be -- declared within the same generic unit as the -- subprogram is declared. The error message is ! -- specialized to say "ancestor" for the case where the ! -- access type is not its own ancestor, since saying ! -- simply "access type" would be very confusing. if Enclosing_Generic_Unit (Entity (P)) /= Enclosing_Generic_Unit (Root_Type (Btyp)) *************** package body Sem_Attr is *** 8066,8072 **** Des_Btyp := Designated_Type (Btyp); ! if Ada_Version >= Ada_05 and then Is_Incomplete_Type (Des_Btyp) then -- Ada 2005 (AI-412): If the (sub)type is a limited view of an --- 8068,8074 ---- Des_Btyp := Designated_Type (Btyp); ! if Ada_Version >= Ada_2005 and then Is_Incomplete_Type (Des_Btyp) then -- Ada 2005 (AI-412): If the (sub)type is a limited view of an *************** package body Sem_Attr is *** 8095,8101 **** -- components, and return objects. For a component definition -- the level is the same of the enclosing composite type. ! if Ada_Version >= Ada_05 and then Is_Local_Anonymous_Access (Btyp) and then Object_Access_Level (P) > Type_Access_Level (Btyp) and then Attr_Id = Attribute_Access --- 8097,8103 ---- -- components, and return objects. For a component definition -- the level is the same of the enclosing composite type. ! if Ada_Version >= Ada_2005 and then Is_Local_Anonymous_Access (Btyp) and then Object_Access_Level (P) > Type_Access_Level (Btyp) and then Attr_Id = Attribute_Access *************** package body Sem_Attr is *** 8202,8208 **** elsif Has_Discriminants (Designated_Type (Typ)) and then not Is_Constrained (Des_Btyp) and then ! (Ada_Version < Ada_05 or else not Has_Constrained_Partial_View (Designated_Type (Base_Type (Typ)))) --- 8204,8210 ---- elsif Has_Discriminants (Designated_Type (Typ)) and then not Is_Constrained (Des_Btyp) and then ! (Ada_Version < Ada_2005 or else not Has_Constrained_Partial_View (Designated_Type (Base_Type (Typ)))) *************** package body Sem_Attr is *** 8244,8252 **** end if; end if; ! if Ekind (Btyp) = E_Access_Protected_Subprogram_Type ! or else ! Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type then if Is_Entity_Name (P) and then not Is_Protected_Type (Scope (Entity (P))) --- 8246,8253 ---- end if; end if; ! if Ekind_In (Btyp, E_Access_Protected_Subprogram_Type, ! E_Anonymous_Access_Protected_Subprogram_Type) then if Is_Entity_Name (P) and then not Is_Protected_Type (Scope (Entity (P))) *************** package body Sem_Attr is *** 8268,8276 **** return; end if; ! elsif (Ekind (Btyp) = E_Access_Subprogram_Type ! or else ! Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type) and then Ekind (Etype (N)) = E_Access_Protected_Subprogram_Type then Error_Msg_F ("context requires a non-protected subprogram", P); --- 8269,8276 ---- return; end if; ! elsif Ekind_In (Btyp, E_Access_Subprogram_Type, ! E_Anonymous_Access_Subprogram_Type) and then Ekind (Etype (N)) = E_Access_Protected_Subprogram_Type then Error_Msg_F ("context requires a non-protected subprogram", P); *************** package body Sem_Attr is *** 8548,8561 **** -- Range -- ----------- ! -- We replace the Range attribute node with a range expression ! -- whose bounds are the 'First and 'Last attributes applied to the ! -- same prefix. The reason that we do this transformation here ! -- instead of in the expander is that it simplifies other parts of ! -- the semantic analysis which assume that the Range has been ! -- replaced; thus it must be done even when in semantic-only mode ! -- (note that the RM specifically mentions this equivalence, we ! -- take care that the prefix is only evaluated once). when Attribute_Range => Range_Attribute : declare --- 8548,8561 ---- -- Range -- ----------- ! -- We replace the Range attribute node with a range expression whose ! -- bounds are the 'First and 'Last attributes applied to the same ! -- prefix. The reason that we do this transformation here instead of ! -- in the expander is that it simplifies other parts of the semantic ! -- analysis which assume that the Range has been replaced; thus it ! -- must be done even when in semantic-only mode (note that the RM ! -- specifically mentions this equivalence, we take care that the ! -- prefix is only evaluated once). when Attribute_Range => Range_Attribute : declare *************** package body Sem_Attr is *** 8606,8611 **** --- 8606,8616 ---- Rewrite (N, Make_Range (Loc, LB, HB)); Analyze_And_Resolve (N, Typ); + -- Ensure that the expanded range does not have side effects + + Force_Evaluation (LB); + Force_Evaluation (HB); + -- Normally after resolving attribute nodes, Eval_Attribute -- is called to do any possible static evaluation of the node. -- However, here since the Range attribute has just been *************** package body Sem_Attr is *** 8799,8811 **** -- In Ada 2005, Input can invoke Read, and Output can invoke Write if Nam = TSS_Stream_Input ! and then Ada_Version >= Ada_05 and then Stream_Attribute_Available (Etyp, TSS_Stream_Read) then return True; elsif Nam = TSS_Stream_Output ! and then Ada_Version >= Ada_05 and then Stream_Attribute_Available (Etyp, TSS_Stream_Write) then return True; --- 8804,8816 ---- -- In Ada 2005, Input can invoke Read, and Output can invoke Write if Nam = TSS_Stream_Input ! and then Ada_Version >= Ada_2005 and then Stream_Attribute_Available (Etyp, TSS_Stream_Read) then return True; elsif Nam = TSS_Stream_Output ! and then Ada_Version >= Ada_2005 and then Stream_Attribute_Available (Etyp, TSS_Stream_Write) then return True; *************** package body Sem_Attr is *** 8822,8828 **** end if; end loop; ! if Ada_Version < Ada_05 then -- In Ada 95 mode, also consider a non-visible definition --- 8827,8833 ---- end if; end loop; ! if Ada_Version < Ada_2005 then -- In Ada 95 mode, also consider a non-visible definition diff -Nrcpad gcc-4.5.2/gcc/ada/sem_attr.ads gcc-4.6.0/gcc/ada/sem_attr.ads *** gcc-4.5.2/gcc/ada/sem_attr.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/sem_attr.ads Fri Oct 22 09:28:24 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Attr is *** 395,400 **** --- 395,409 ---- -- as Range applied to the array itself. The result is of type universal -- integer. + --------- + -- Ref -- + --------- + + Attribute_Ref => True, + -- System.Address'Ref (Address is the only permissible prefix) is + -- equivalent to System'To_Address, provided for compatibility with + -- other compilers. + ------------------ -- Storage_Unit -- ------------------ *************** package Sem_Attr is *** 439,445 **** ---------------- Attribute_To_Address => True, ! -- System'To_Address (Address is the only permissible prefix) is a -- function that takes any integer value, and converts it into an -- address value. The semantics is to first convert the integer value to -- type Integer_Address according to normal conversion rules, and then --- 448,454 ---- ---------------- Attribute_To_Address => True, ! -- System'To_Address (System is the only permissible prefix) is a -- function that takes any integer value, and converts it into an -- address value. The semantics is to first convert the integer value to -- type Integer_Address according to normal conversion rules, and then *************** package Sem_Attr is *** 493,507 **** ------------------------------ Attribute_Universal_Literal_String => True, ! -- The prefix of 'Universal_Literal_String must be a named number. The ! -- static result is the string consisting of the characters of the ! -- number as defined in the original source. This allows the user ! -- program to access the actual text of named numbers without ! -- intermediate conversions and without the need to enclose the strings ! -- in quotes (which would preclude their use as numbers). This is used ! -- internally for the construction of values of the floating-point ! -- attributes from the file ttypef.ads, but may also be used by user ! -- programs. ------------------------- -- Unrestricted_Access -- --- 502,513 ---- ------------------------------ Attribute_Universal_Literal_String => True, ! -- The prefix of 'Universal_Literal_String must be a named number. ! -- The static result is the string consisting of the characters of ! -- the number as defined in the original source. This allows the ! -- user program to access the actual text of named numbers without ! -- intermediate conversions and without the need to enclose the ! -- strings in quotes (which would preclude their use as numbers). ------------------------- -- Unrestricted_Access -- diff -Nrcpad gcc-4.5.2/gcc/ada/sem_aux.adb gcc-4.6.0/gcc/ada/sem_aux.adb *** gcc-4.5.2/gcc/ada/sem_aux.adb Wed Jul 29 08:43:58 2009 --- gcc-4.6.0/gcc/ada/sem_aux.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem_Aux is *** 48,54 **** -- If this is first subtype, or is a base type, then there is no -- ancestor subtype, so we return Empty to indicate this fact. ! if Is_First_Subtype (Typ) or else Typ = Base_Type (Typ) then return Empty; end if; --- 48,54 ---- -- If this is first subtype, or is a base type, then there is no -- ancestor subtype, so we return Empty to indicate this fact. ! if Is_First_Subtype (Typ) or else Is_Base_Type (Typ) then return Empty; end if; *************** package body Sem_Aux is *** 204,211 **** begin pragma Assert ! (Has_Discriminants (Typ) ! or else Has_Unknown_Discriminants (Typ)); Ent := First_Entity (Typ); --- 204,210 ---- begin pragma Assert ! (Has_Discriminants (Typ) or else Has_Unknown_Discriminants (Typ)); Ent := First_Entity (Typ); *************** package body Sem_Aux is *** 312,319 **** Ent : Entity_Id; begin ! -- If the base type has no freeze node, it is a type in Standard, ! -- and always acts as its own first subtype unless it is one of the -- predefined integer types. If the type is formal, it is also a first -- subtype, and its base type has no freeze node. On the other hand, a -- subtype of a generic formal is not its own first subtype. Its base --- 311,318 ---- Ent : Entity_Id; begin ! -- If the base type has no freeze node, it is a type in Standard, and ! -- always acts as its own first subtype, except where it is one of the -- predefined integer types. If the type is formal, it is also a first -- subtype, and its base type has no freeze node. On the other hand, a -- subtype of a generic formal is not its own first subtype. Its base *************** package body Sem_Aux is *** 321,327 **** -- the first subtype is obtained. if No (F) then - if B = Base_Type (Standard_Integer) then return Standard_Integer; --- 320,325 ---- *************** package body Sem_Aux is *** 539,544 **** --- 537,561 ---- end if; end Is_Derived_Type; + ----------------------- + -- Is_Generic_Formal -- + ----------------------- + + function Is_Generic_Formal (E : Entity_Id) return Boolean is + Kind : Node_Kind; + begin + if No (E) then + return False; + else + Kind := Nkind (Parent (E)); + return + Nkind_In (Kind, N_Formal_Object_Declaration, + N_Formal_Package_Declaration, + N_Formal_Type_Declaration) + or else Is_Formal_Subprogram (E); + end if; + end Is_Generic_Formal; + --------------------------- -- Is_Indefinite_Subtype -- --------------------------- *************** package body Sem_Aux is *** 571,594 **** end if; end Is_Indefinite_Subtype; ! -------------------------------- ! -- Is_Inherently_Limited_Type -- ! -------------------------------- ! function Is_Inherently_Limited_Type (Ent : Entity_Id) return Boolean is Btype : constant Entity_Id := Base_Type (Ent); 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; --- 588,642 ---- end if; end Is_Indefinite_Subtype; ! ------------------------------- ! -- Is_Immutably_Limited_Type -- ! ------------------------------- ! function Is_Immutably_Limited_Type (Ent : Entity_Id) return Boolean is Btype : constant Entity_Id := Base_Type (Ent); begin + if Is_Limited_Record (Btype) then + return True; + + elsif Ekind (Btype) = E_Limited_Private_Type + and then Nkind (Parent (Btype)) = N_Formal_Type_Declaration + then + return not In_Package_Body (Scope ((Btype))); + end if; + if Is_Private_Type (Btype) then ! ! -- AI05-0063: A type derived from a limited private formal type is ! -- not immutably limited in a generic body. ! ! if Is_Derived_Type (Btype) ! and then Is_Generic_Type (Etype (Btype)) ! then ! if not Is_Limited_Type (Etype (Btype)) then return False; + + -- A descendant of a limited formal type is not immutably limited + -- in the generic body, or in the body of a generic child. + + elsif Ekind (Scope (Etype (Btype))) = E_Generic_Package then + return not In_Package_Body (Scope (Btype)); + else ! return False; end if; ! ! else ! declare ! Utyp : constant Entity_Id := Underlying_Type (Btype); ! begin ! if No (Utyp) then ! return False; ! else ! return Is_Immutably_Limited_Type (Utyp); ! end if; ! end; ! end if; elsif Is_Concurrent_Type (Btype) then return True; *************** package body Sem_Aux is *** 602,612 **** -- handled as build in place even though they might return objects -- of a type that is not inherently limited. ! if Is_Limited_Record (Btype) then ! return True; ! ! elsif Is_Class_Wide_Type (Btype) then ! return Is_Inherently_Limited_Type (Root_Type (Btype)); else declare --- 650,657 ---- -- handled as build in place even though they might return objects -- of a type that is not inherently limited. ! if Is_Class_Wide_Type (Btype) then ! return Is_Immutably_Limited_Type (Root_Type (Btype)); else declare *************** package body Sem_Aux is *** 620,629 **** -- only occur in the case of a _parent component anyway). -- They don't have any components, plus it would cause this -- function to return true for nonlimited types derived from ! -- limited intefaces. if not Is_Interface (Etype (C)) ! and then Is_Inherently_Limited_Type (Etype (C)) then return True; end if; --- 665,674 ---- -- only occur in the case of a _parent component anyway). -- They don't have any components, plus it would cause this -- function to return true for nonlimited types derived from ! -- limited interfaces. if not Is_Interface (Etype (C)) ! and then Is_Immutably_Limited_Type (Etype (C)) then return True; end if; *************** package body Sem_Aux is *** 636,647 **** 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 -- --- 681,692 ---- end if; elsif Is_Array_Type (Btype) then ! return Is_Immutably_Limited_Type (Component_Type (Btype)); else return False; end if; ! end Is_Immutably_Limited_Type; --------------------- -- Is_Limited_Type -- *************** package body Sem_Aux is *** 723,728 **** --- 768,813 ---- end if; end Is_Limited_Type; + ---------------------- + -- Nearest_Ancestor -- + ---------------------- + + function Nearest_Ancestor (Typ : Entity_Id) return Entity_Id is + D : constant Node_Id := Declaration_Node (Typ); + + begin + -- If we have a subtype declaration, get the ancestor subtype + + if Nkind (D) = N_Subtype_Declaration then + if Nkind (Subtype_Indication (D)) = N_Subtype_Indication then + return Entity (Subtype_Mark (Subtype_Indication (D))); + else + return Entity (Subtype_Indication (D)); + end if; + + -- If derived type declaration, find who we are derived from + + elsif Nkind (D) = N_Full_Type_Declaration + and then Nkind (Type_Definition (D)) = N_Derived_Type_Definition + then + declare + DTD : constant Entity_Id := Type_Definition (D); + SI : constant Entity_Id := Subtype_Indication (DTD); + begin + if Is_Entity_Name (SI) then + return Entity (SI); + else + return Entity (Subtype_Mark (SI)); + end if; + end; + + -- Otherwise, nothing useful to return, return Empty + + else + return Empty; + end if; + end Nearest_Ancestor; + --------------------------- -- Nearest_Dynamic_Scope -- --------------------------- *************** package body Sem_Aux is *** 800,803 **** --- 885,904 ---- Obsolescent_Warnings.Tree_Write; end Tree_Write; + -------------------- + -- Ultimate_Alias -- + -------------------- + + function Ultimate_Alias (Prim : Entity_Id) return Entity_Id is + E : Entity_Id := Prim; + + begin + while Present (Alias (E)) loop + pragma Assert (Alias (E) /= E); + E := Alias (E); + end loop; + + return E; + end Ultimate_Alias; + end Sem_Aux; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_aux.ads gcc-4.6.0/gcc/ada/sem_aux.ads *** gcc-4.5.2/gcc/ada/sem_aux.ads Wed Jul 29 08:43:58 2009 --- gcc-4.6.0/gcc/ada/sem_aux.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Aux is *** 132,138 **** -- the entity chain of the derived type which are a copy of the -- discriminants of the root type. Furthermore their Is_Completely_Hidden -- flag is set since although they are actually stored in the object, they ! -- are not in the set of discriminants that is visble in the type. -- -- For derived untagged types, the set of stored discriminants are the real -- discriminants from Gigi's standpoint, i.e. those that will be stored in --- 132,138 ---- -- the entity chain of the derived type which are a copy of the -- discriminants of the root type. Furthermore their Is_Completely_Hidden -- flag is set since although they are actually stored in the object, they ! -- are not in the set of discriminants that is visible in the type. -- -- For derived untagged types, the set of stored discriminants are the real -- discriminants from Gigi's standpoint, i.e. those that will be stored in *************** package Sem_Aux is *** 159,178 **** -- Determines if the given entity Ent is a derived type. Result is always -- false if argument is not a type. function Is_Indefinite_Subtype (Ent : Entity_Id) return Boolean; -- Ent is any entity. Determines if given entity is an unconstrained array -- type or subtype, a discriminated record type or subtype with no initial -- discriminant values or a class wide type or subtype and returns True if -- so. False for other type entities, or any entities that are not types. ! function Is_Inherently_Limited_Type (Ent : Entity_Id) return Boolean; -- Ent is any entity. True for a type that is "inherently" limited (i.e. -- cannot become nonlimited). From the Ada 2005 RM-7.5(8.1/2), "a type with -- a part that is of a task, protected, or explicitly limited record type". -- These are the types that are defined as return-by-reference types in Ada -- 95 (see RM95-6.5(11-16)). In Ada 2005, these are the types that require -- build-in-place for function calls. Note that build-in-place is allowed ! -- for other types, too. function Is_Limited_Type (Ent : Entity_Id) return Boolean; -- Ent is any entity. Returns true if Ent is a limited type (limited --- 159,184 ---- -- Determines if the given entity Ent is a derived type. Result is always -- false if argument is not a type. + function Is_Generic_Formal (E : Entity_Id) return Boolean; + -- Determine whether E is a generic formal parameter. In particular this is + -- used to set the visibility of generic formals of a generic package + -- declared with a box or with partial parametrization. + function Is_Indefinite_Subtype (Ent : Entity_Id) return Boolean; -- Ent is any entity. Determines if given entity is an unconstrained array -- type or subtype, a discriminated record type or subtype with no initial -- discriminant values or a class wide type or subtype and returns True if -- so. False for other type entities, or any entities that are not types. ! function Is_Immutably_Limited_Type (Ent : Entity_Id) return Boolean; -- Ent is any entity. True for a type that is "inherently" limited (i.e. -- cannot become nonlimited). From the Ada 2005 RM-7.5(8.1/2), "a type with -- a part that is of a task, protected, or explicitly limited record type". -- These are the types that are defined as return-by-reference types in Ada -- 95 (see RM95-6.5(11-16)). In Ada 2005, these are the types that require -- build-in-place for function calls. Note that build-in-place is allowed ! -- for other types, too. This is also used for identifying pure procedures ! -- whose calls should not be eliminated (RM 10.2.1(18/2)). function Is_Limited_Type (Ent : Entity_Id) return Boolean; -- Ent is any entity. Returns true if Ent is a limited type (limited *************** package Sem_Aux is *** 180,185 **** --- 186,209 ---- -- composite containing a limited component, or a subtype of any of -- these types). + function Nearest_Ancestor (Typ : Entity_Id) return Entity_Id; + -- Given a subtype Typ, this function finds out the nearest ancestor from + -- which constraints and predicates are inherited. There is no simple link + -- for doing this, consider: + -- + -- subtype R is Integer range 1 .. 10; + -- type T is new R; + -- + -- In this case the nearest ancestor is R, but the Etype of T'Base will + -- point to R'Base, so we have to go rummaging in the declarations to get + -- this information. It is used for making sure we freeze this before we + -- freeze Typ, and also for retrieving inherited predicate information. + -- For the case of base types or first subtypes, there is no useful entity + -- to return, so Empty is returned. + -- + -- Note: this is similar to Ancestor_Subtype except that it also deals + -- with the case of derived types. + function Nearest_Dynamic_Scope (Ent : Entity_Id) return Entity_Id; -- This is similar to Enclosing_Dynamic_Scope except that if Ent is itself -- a dynamic scope, then it is returned. Otherwise the result is the same *************** package Sem_Aux is *** 193,196 **** --- 217,225 ---- function Number_Discriminants (Typ : Entity_Id) return Pos; -- Typ is a type with discriminants, yields number of discriminants in type + function Ultimate_Alias (Prim : Entity_Id) return Entity_Id; + pragma Inline (Ultimate_Alias); + -- Return the last entity in the chain of aliased entities of Prim. If Prim + -- has no alias return Prim. + end Sem_Aux; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_case.adb gcc-4.6.0/gcc/ada/sem_case.adb *** gcc-4.5.2/gcc/ada/sem_case.adb Mon Nov 30 09:42:59 2009 --- gcc-4.6.0/gcc/ada/sem_case.adb Tue Oct 26 10:55:01 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** with Nmake; use Nmake; *** 32,38 **** with Opt; use Opt; with Sem; use Sem; with Sem_Aux; use Sem_Aux; - with Sem_Case; use Sem_Case; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; --- 32,37 ---- *************** with Sinfo; use Sinfo; *** 43,65 **** with Tbuild; use Tbuild; with Uintp; use Uintp; with GNAT.Heap_Sort_G; package body Sem_Case is ----------------------- -- Local Subprograms -- ----------------------- - 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 algorithm - -- (this is not absolutely necessary but it makes the code more - -- efficient). - procedure Check_Choices ! (Choice_Table : in out Sort_Choice_Table_Type; Bounds_Type : Entity_Id; Subtyp : Entity_Id; Others_Present : Boolean; --- 42,72 ---- with Tbuild; use Tbuild; with Uintp; use Uintp; + with Ada.Unchecked_Deallocation; + with GNAT.Heap_Sort_G; package body Sem_Case is + type Choice_Bounds is record + Lo : Node_Id; + Hi : Node_Id; + Node : Node_Id; + end record; + -- Represent one choice bounds entry with Lo and Hi values, Node points + -- to the choice node itself. + + type Choice_Table_Type is array (Nat range <>) of Choice_Bounds; + -- Table type used to sort the choices present in a case statement, array + -- aggregate or record variant. The actual entries are stored in 1 .. Last, + -- but we have a 0 entry for convenience in sorting. + ----------------------- -- Local Subprograms -- ----------------------- procedure Check_Choices ! (Choice_Table : in out Choice_Table_Type; Bounds_Type : Entity_Id; Subtyp : Entity_Id; Others_Present : Boolean; *************** package body Sem_Case is *** 101,107 **** ------------------- procedure Check_Choices ! (Choice_Table : in out Sort_Choice_Table_Type; Bounds_Type : Entity_Id; Subtyp : Entity_Id; Others_Present : Boolean; --- 108,114 ---- ------------------- procedure Check_Choices ! (Choice_Table : in out Choice_Table_Type; Bounds_Type : Entity_Id; Subtyp : Entity_Id; Others_Present : Boolean; *************** package body Sem_Case is *** 306,313 **** Hi := Expr_Value (Choice_Table (J).Hi); if Lo <= Prev_Hi then ! Prev_Choice := Choice_Table (J - 1).Node; ! Choice := Choice_Table (J).Node; if Sloc (Prev_Choice) <= Sloc (Choice) then Error_Msg_Sloc := Sloc (Prev_Choice); --- 313,328 ---- Hi := Expr_Value (Choice_Table (J).Hi); if Lo <= Prev_Hi then ! Choice := Choice_Table (J).Node; ! ! -- Find first previous choice that overlaps ! ! for K in 1 .. J - 1 loop ! if Lo <= Expr_Value (Choice_Table (K).Hi) then ! Prev_Choice := Choice_Table (K).Node; ! exit; ! end if; ! end loop; if Sloc (Prev_Choice) <= Sloc (Choice) then Error_Msg_Sloc := Sloc (Prev_Choice); *************** package body Sem_Case is *** 321,327 **** Issue_Msg (Prev_Hi + 1, Lo - 1); end if; ! Prev_Hi := Hi; end loop; if not Others_Present and then Expr_Value (Bounds_Hi) > Hi then --- 336,344 ---- Issue_Msg (Prev_Hi + 1, Lo - 1); end if; ! if Hi > Prev_Hi then ! Prev_Hi := Hi; ! end if; end loop; if not Others_Present and then Expr_Value (Bounds_Hi) > Hi then *************** package body Sem_Case is *** 511,517 **** -- Start of processing for Expand_Others_Choice begin ! if Case_Table'Length = 0 then -- Special case: only an others case is present. -- The others case covers the full range of the type. --- 528,534 ---- -- Start of processing for Expand_Others_Choice begin ! if Case_Table'Last = 0 then -- Special case: only an others case is present. -- The others case covers the full range of the type. *************** package body Sem_Case is *** 537,545 **** Exp_Hi := Type_High_Bound (Base_Type (Choice_Type)); end if; ! Lo := Expr_Value (Case_Table (Case_Table'First).Lo); ! Hi := Expr_Value (Case_Table (Case_Table'First).Hi); ! Previous_Hi := Expr_Value (Case_Table (Case_Table'First).Hi); -- Build the node for any missing choices that are smaller than any -- explicit choices given in the case. --- 554,562 ---- Exp_Hi := Type_High_Bound (Base_Type (Choice_Type)); end if; ! Lo := Expr_Value (Case_Table (1).Lo); ! Hi := Expr_Value (Case_Table (1).Hi); ! Previous_Hi := Expr_Value (Case_Table (1).Hi); -- Build the node for any missing choices that are smaller than any -- explicit choices given in the case. *************** package body Sem_Case is *** 551,557 **** -- Build the nodes representing any missing choices that lie between -- the explicit ones given in the case. ! for J in Case_Table'First + 1 .. Case_Table'Last loop Lo := Expr_Value (Case_Table (J).Lo); Hi := Expr_Value (Case_Table (J).Hi); --- 568,574 ---- -- Build the nodes representing any missing choices that lie between -- the explicit ones given in the case. ! for J in 2 .. Case_Table'Last loop Lo := Expr_Value (Case_Table (J).Lo); Hi := Expr_Value (Case_Table (J).Hi); *************** package body Sem_Case is *** 588,594 **** procedure No_OP (C : Node_Id) is pragma Warnings (Off, C); - begin null; end No_OP; --- 605,610 ---- *************** package body Sem_Case is *** 599,604 **** --- 615,633 ---- package body Generic_Choices_Processing is + -- The following type is used to gather the entries for the choice + -- table, so that we can then allocate the right length. + + type Link; + type Link_Ptr is access all Link; + + type Link is record + Val : Choice_Bounds; + Nxt : Link_Ptr; + end record; + + procedure Free is new Ada.Unchecked_Deallocation (Link, Link_Ptr); + --------------------- -- Analyze_Choices -- --------------------- *************** package body Sem_Case is *** 606,625 **** procedure Analyze_Choices (N : Node_Id; Subtyp : Entity_Id; - Choice_Table : out Choice_Table_Type; - Last_Choice : out Nat; Raises_CE : out Boolean; Others_Present : out Boolean) is - pragma Assert (Choice_Table'First = 1); - E : Entity_Id; Enode : Node_Id; -- This is where we post error messages for bounds out of range ! Nb_Choices : constant Nat := Choice_Table'Length; ! Sort_Choice_Table : Sort_Choice_Table_Type (0 .. Nb_Choices); Choice_Type : constant Entity_Id := Base_Type (Subtyp); -- The actual type against which the discrete choices are resolved. --- 635,653 ---- procedure Analyze_Choices (N : Node_Id; Subtyp : Entity_Id; Raises_CE : out Boolean; Others_Present : out Boolean) is E : Entity_Id; Enode : Node_Id; -- This is where we post error messages for bounds out of range ! Choice_List : Link_Ptr := null; ! -- Gather list of choices ! ! Num_Choices : Nat := 0; ! -- Number of entries in Choice_List Choice_Type : constant Entity_Id := Base_Type (Subtyp); -- The actual type against which the discrete choices are resolved. *************** package body Sem_Case is *** 648,660 **** Kind : Node_Kind; -- The node kind of the current Choice Others_Choice : Node_Id := Empty; -- Remember others choice if it is present (empty otherwise) procedure Check (Choice : Node_Id; Lo, Hi : Node_Id); -- Checks the validity of the bounds of a choice. When the bounds ! -- are static and no error occurred the bounds are entered into the ! -- choices table so that they can be sorted later on. ----------- -- Check -- --- 676,692 ---- Kind : Node_Kind; -- The node kind of the current Choice + Delete_Choice : Boolean; + -- Set to True to delete the current choice + Others_Choice : Node_Id := Empty; -- Remember others choice if it is present (empty otherwise) procedure Check (Choice : Node_Id; Lo, Hi : Node_Id); -- Checks the validity of the bounds of a choice. When the bounds ! -- are static and no error occurred the bounds are collected for ! -- later entry into the choices table so that they can be sorted ! -- later on. ----------- -- Check -- *************** package body Sem_Case is *** 706,713 **** -- If the choice is an entity name, then it is a type, and we -- want to post the message on the reference to this entity. ! -- Otherwise we want to post it on the lower bound of the ! -- range. if Is_Entity_Name (Choice) then Enode := Choice; --- 738,744 ---- -- If the choice is an entity name, then it is a type, and we -- want to post the message on the reference to this entity. ! -- Otherwise post it on the lower bound of the range. if Is_Entity_Name (Choice) then Enode := Choice; *************** package body Sem_Case is *** 751,772 **** end if; end if; ! -- Store bounds in the table -- Note: we still store the bounds, even if they are out of range, -- since this may prevent unnecessary cascaded errors for values -- that are covered by such an excessive range. ! Last_Choice := Last_Choice + 1; ! Sort_Choice_Table (Last_Choice).Lo := Lo; ! Sort_Choice_Table (Last_Choice).Hi := Hi; ! Sort_Choice_Table (Last_Choice).Node := Choice; end Check; -- Start of processing for Analyze_Choices begin - Last_Choice := 0; Raises_CE := False; Others_Present := False; --- 782,801 ---- end if; end if; ! -- Collect bounds in the list -- Note: we still store the bounds, even if they are out of range, -- since this may prevent unnecessary cascaded errors for values -- that are covered by such an excessive range. ! Choice_List := ! new Link'(Val => (Lo, Hi, Choice), Nxt => Choice_List); ! Num_Choices := Num_Choices + 1; end Check; -- Start of processing for Analyze_Choices begin Raises_CE := False; Others_Present := False; *************** package body Sem_Case is *** 811,816 **** --- 840,846 ---- else Choice := First (Get_Choices (Alt)); while Present (Choice) loop + Delete_Choice := False; Analyze (Choice); Kind := Nkind (Choice); *************** package body Sem_Case is *** 834,840 **** else E := Entity (Choice); ! if not Is_Static_Subtype (E) then Process_Non_Static_Choice (Choice); else Check --- 864,912 ---- else E := Entity (Choice); ! -- Case of predicated subtype ! ! if Has_Predicates (E) then ! ! -- Use of non-static predicate is an error ! ! if not Is_Discrete_Type (E) ! or else No (Static_Predicate (E)) ! then ! Bad_Predicated_Subtype_Use ! ("cannot use subtype& with non-static " ! & "predicate as case alternative", Choice, E); ! ! -- Static predicate case ! ! else ! declare ! Copy : constant List_Id := Empty_List; ! P : Node_Id; ! C : Node_Id; ! ! begin ! -- Loop through entries in predicate list, ! -- converting to choices. Note that if the ! -- list is empty, corresponding to a False ! -- predicate, then no choices are inserted. ! ! P := First (Static_Predicate (E)); ! while Present (P) loop ! C := New_Copy (P); ! Set_Sloc (C, Sloc (Choice)); ! Append_To (Copy, C); ! Next (P); ! end loop; ! ! Insert_List_After (Choice, Copy); ! Delete_Choice := True; ! end; ! end if; ! ! -- Not predicated subtype case ! ! elsif not Is_Static_Subtype (E) then Process_Non_Static_Choice (Choice); else Check *************** package body Sem_Case is *** 848,853 **** --- 920,927 ---- Resolve_Discrete_Subtype_Indication (Choice, Expected_Type); + -- Here for other than predicated subtype case + if Etype (Choice) /= Any_Type then declare C : constant Node_Id := Constraint (Choice); *************** package body Sem_Case is *** 911,917 **** Check (Choice, Choice, Choice); end if; ! Next (Choice); end loop; Process_Associated_Node (Alt); --- 985,1002 ---- Check (Choice, Choice, Choice); end if; ! -- Move to next choice, deleting the current one if the ! -- flag requesting this deletion is set True. ! ! declare ! C : constant Node_Id := Choice; ! begin ! Next (Choice); ! ! if Delete_Choice then ! Remove (C); ! end if; ! end; end loop; Process_Associated_Node (Alt); *************** package body Sem_Case is *** 920,984 **** Next (Alt); end loop; ! Check_Choices ! (Sort_Choice_Table (0 .. Last_Choice), ! Bounds_Type, ! Subtyp, ! Others_Present or else (Choice_Type = Universal_Integer), ! N); ! ! -- Now copy the sorted discrete choices ! ! for J in 1 .. Last_Choice loop ! Choice_Table (Choice_Table'First - 1 + J) := Sort_Choice_Table (J); ! end loop; ! ! -- If no others choice we are all done, otherwise we have one more ! -- step, which is to set the Others_Discrete_Choices field of the ! -- others choice (to contain all otherwise unspecified choices). ! -- Skip this if CE is known to be raised. ! ! if Others_Present and not Raises_CE then ! Expand_Others_Choice ! (Case_Table => Choice_Table (1 .. Last_Choice), ! Others_Choice => Others_Choice, ! Choice_Type => Bounds_Type); ! end if; ! end Analyze_Choices; ! ! ----------------------- ! -- Number_Of_Choices -- ! ----------------------- ! ! function Number_Of_Choices (N : Node_Id) return Nat is ! Alt : Node_Id; ! -- A case statement alternative or a record variant ! ! Choice : Node_Id; ! Count : Nat := 0; ! begin ! if No (Get_Alternatives (N)) then ! return 0; ! end if; ! Alt := First_Non_Pragma (Get_Alternatives (N)); ! while Present (Alt) loop ! Choice := First (Get_Choices (Alt)); ! while Present (Choice) loop ! if Nkind (Choice) /= N_Others_Choice then ! Count := Count + 1; ! end if; ! Next (Choice); ! end loop; ! Next_Non_Pragma (Alt); ! end loop; ! return Count; ! end Number_Of_Choices; end Generic_Choices_Processing; --- 1005,1051 ---- Next (Alt); end loop; ! -- Now we can create the Choice_Table, since we know how long ! -- it needs to be so we can allocate exactly the right length. ! declare ! Choice_Table : Choice_Table_Type (0 .. Num_Choices); ! begin ! -- Now copy the items we collected in the linked list into this ! -- newly allocated table (leave entry 0 unused for sorting). ! declare ! T : Link_Ptr; ! begin ! for J in 1 .. Num_Choices loop ! T := Choice_List; ! Choice_List := T.Nxt; ! Choice_Table (J) := T.Val; ! Free (T); ! end loop; ! end; ! Check_Choices ! (Choice_Table, ! Bounds_Type, ! Subtyp, ! Others_Present or else (Choice_Type = Universal_Integer), ! N); ! -- If no others choice we are all done, otherwise we have one more ! -- step, which is to set the Others_Discrete_Choices field of the ! -- others choice (to contain all otherwise unspecified choices). ! -- Skip this if CE is known to be raised. ! if Others_Present and not Raises_CE then ! Expand_Others_Choice ! (Case_Table => Choice_Table, ! Others_Choice => Others_Choice, ! Choice_Type => Bounds_Type); ! end if; ! end; ! end Analyze_Choices; end Generic_Choices_Processing; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_case.ads gcc-4.6.0/gcc/ada/sem_case.ads *** gcc-4.5.2/gcc/ada/sem_case.ads Sun Apr 13 17:25:22 2008 --- gcc-4.6.0/gcc/ada/sem_case.ads Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** with Types; use Types; *** 34,49 **** package Sem_Case is - type Choice_Bounds is record - Lo : Node_Id; - Hi : Node_Id; - Node : Node_Id; - end record; - - type Choice_Table_Type is array (Pos range <>) of Choice_Bounds; - -- Table type used to sort the choices present in a case statement, - -- array aggregate or record variant. - procedure No_OP (C : Node_Id); -- The no-operation routine. Does absolutely nothing. Can be used -- in the following generic for the parameter Process_Empty_Choice. --- 34,39 ---- *************** package Sem_Case is *** 68,113 **** -- Processing to carry out for a non static Choice with procedure Process_Associated_Node (A : Node_Id); ! -- Associated to each case alternative, aggregate component -- association or record variant A there is a node or list of nodes -- that need semantic processing. This routine implements that -- processing. package Generic_Choices_Processing is - function Number_Of_Choices (N : Node_Id) return Nat; - -- Iterates through the choices of N, (N can be a case statement, - -- array aggregate or record variant), counting all the Choice nodes - -- except for the Others choice. - procedure Analyze_Choices (N : Node_Id; Subtyp : Entity_Id; - Choice_Table : out Choice_Table_Type; - Last_Choice : out Nat; Raises_CE : out Boolean; Others_Present : out Boolean); ! -- From a case statement, array aggregate or record variant N, this ! -- routine analyzes the corresponding list of discrete choices. ! -- Subtyp is the subtype of the discrete choices. The type against ! -- which the discrete choices must be resolved is its base type. ! -- ! -- On entry Choice_Table must be big enough to contain all the discrete ! -- choices encountered. The lower bound of Choice_Table must be one. ! -- ! -- On exit Choice_Table contains all the static and non empty discrete ! -- choices in sorted order. Last_Choice gives the position of the last ! -- valid choice in Choice_Table, Choice_Table'First contains the first. ! -- We can have Last_Choice < Choice_Table'Last for one (or several) of ! -- the following reasons: ! -- ! -- (a) The list of choices contained a non static choice ! -- ! -- (b) The list of choices contained an empty choice ! -- (something like "1 .. 0 => ") ! -- ! -- (c) One of the bounds of a discrete choice contains an ! -- error or raises constraint error. -- -- In one of the bounds of a discrete choice raises a constraint -- error the flag Raise_CE is set. --- 58,79 ---- -- Processing to carry out for a non static Choice with procedure Process_Associated_Node (A : Node_Id); ! -- Associated with each case alternative, aggregate component -- association or record variant A there is a node or list of nodes -- that need semantic processing. This routine implements that -- processing. package Generic_Choices_Processing is procedure Analyze_Choices (N : Node_Id; Subtyp : Entity_Id; Raises_CE : out Boolean; Others_Present : out Boolean); ! -- From a case expression, case statement, array aggregate or record ! -- variant N, this routine analyzes the corresponding list of discrete ! -- choices. Subtyp is the subtype of the discrete choices. The type ! -- against which the discrete choices must be resolved is its base type. -- -- In one of the bounds of a discrete choice raises a constraint -- error the flag Raise_CE is set. diff -Nrcpad gcc-4.5.2/gcc/ada/sem_cat.adb gcc-4.6.0/gcc/ada/sem_cat.adb *** gcc-4.5.2/gcc/ada/sem_cat.adb Mon Aug 17 10:33:58 2009 --- gcc-4.6.0/gcc/ada/sem_cat.adb Tue Oct 26 13:00:05 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem_Cat is *** 78,89 **** function In_RCI_Declaration (N : Node_Id) return Boolean; -- Determines if a declaration is within the visible part of a Remote ! -- Call Interface compilation unit, for semantic checking purposes only, -- (returns false within an instance and within the package body). function In_RT_Declaration return Boolean; ! -- Determines if current scope is within a Remote Types compilation unit, ! -- for semantic checking purposes. function Is_Non_Remote_Access_Type (E : Entity_Id) return Boolean; -- Returns true if the entity is a type whose full view is a non-remote --- 78,89 ---- function In_RCI_Declaration (N : Node_Id) return Boolean; -- Determines if a declaration is within the visible part of a Remote ! -- Call Interface compilation unit, for semantic checking purposes only -- (returns false within an instance and within the package body). function In_RT_Declaration return Boolean; ! -- Determines if current scope is within the declaration of a Remote Types ! -- unit, for semantic checking purposes. function Is_Non_Remote_Access_Type (E : Entity_Id) return Boolean; -- Returns true if the entity is a type whose full view is a non-remote *************** package body Sem_Cat is *** 206,211 **** --- 206,222 ---- and then In_Package_Body (Unit_Entity) then null; + + -- Special case: Remote_Types can depend on Preelaborated per + -- Ada 2005 AI 0206. + + elsif Unit_Category = Remote_Types + and then Is_Preelaborated (Depended_Entity) + then + null; + + -- All other cases, we do have an error + else Err := True; end if; *************** package body Sem_Cat is *** 215,224 **** if Err then ! -- 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; -- Don't give error if main unit is not an internal unit, and the -- unit generating the message is an internal unit. This is the --- 226,244 ---- if Err then ! -- These messages are warnings in GNAT mode or if the -gnateP switch ! -- was set. Otherwise these are real errors for real illegalities. ! -- The reason we suppress these errors in GNAT mode is that the run- ! -- time has several instances of violations of the categorization ! -- errors (e.g. Pure units withing Preelaborate units. All these ! -- violations are harmless in the cases where we intend them, and ! -- we suppress the warnings with Warnings (Off). In cases where we ! -- do not intend the violation, warnings are errors in GNAT mode ! -- anyway, so we will still get an error. ! ! Error_Msg_Warn := ! Treat_Categorization_Errors_As_Warnings or GNAT_Mode; -- Don't give error if main unit is not an internal unit, and the -- unit generating the message is an internal unit. This is the *************** package body Sem_Cat is *** 387,393 **** -- currently visible. return Present (Rep_Item) ! and then (Ada_Version < Ada_05 or else At_Any_Place or else not Is_Hidden (Entity (Rep_Item))); end Has_Stream_Attribute_Definition; --- 407,413 ---- -- currently visible. return Present (Rep_Item) ! and then (Ada_Version < Ada_2005 or else At_Any_Place or else not Is_Hidden (Entity (Rep_Item))); end Has_Stream_Attribute_Definition; *************** package body Sem_Cat is *** 768,774 **** -- This test is skipped in Ada 2005 (see AI-366) ! if Ada_Version < Ada_05 and then Comes_From_Source (T) and then In_Pure_Unit and then not In_Subprogram_Task_Protected_Unit --- 788,794 ---- -- This test is skipped in Ada 2005 (see AI-366) ! if Ada_Version < Ada_2005 and then Comes_From_Source (T) and then In_Pure_Unit and then not In_Subprogram_Task_Protected_Unit *************** package body Sem_Cat is *** 965,971 **** -- Don't need this check in Ada 2005 mode, where this is all taken -- care of by the mechanism for Preelaborable Initialization. ! if Ada_Version >= Ada_05 then return; end if; --- 985,991 ---- -- Don't need this check in Ada 2005 mode, where this is all taken -- care of by the mechanism for Preelaborable Initialization. ! if Ada_Version >= Ada_2005 then return; end if; *************** package body Sem_Cat is *** 1061,1088 **** -- Exclude generic specs from the checks (this will get rechecked -- on instantiations). ! if Inside_A_Generic ! and then No (Enclosing_Generic_Body (Id)) ! then return; end if; ! -- Required checks for declaration that is in a preelaborated ! -- package and is not within some subprogram. if In_Preelaborated_Unit and then not In_Subprogram_Or_Concurrent_Unit then -- Check for default initialized variable case. Note that in ! -- accordance with (RM B.1(24)) imported objects are not ! -- subject to default initialization. -- If the initialization does not come from source and is an -- aggregate, it is a static initialization that replaces an -- implicit call, and must be treated as such. if Present (E) ! and then ! (Comes_From_Source (E) or else Nkind (E) /= N_Aggregate) then null; --- 1081,1105 ---- -- Exclude generic specs from the checks (this will get rechecked -- on instantiations). ! if Inside_A_Generic and then No (Enclosing_Generic_Body (Id)) then return; end if; ! -- Required checks for declaration that is in a preelaborated package ! -- and is not within some subprogram. if In_Preelaborated_Unit and then not In_Subprogram_Or_Concurrent_Unit then -- Check for default initialized variable case. Note that in ! -- accordance with (RM B.1(24)) imported objects are not subject to ! -- default initialization. -- If the initialization does not come from source and is an -- aggregate, it is a static initialization that replaces an -- implicit call, and must be treated as such. if Present (E) ! and then (Comes_From_Source (E) or else Nkind (E) /= N_Aggregate) then null; *************** package body Sem_Cat is *** 1149,1155 **** -- marked with this pragma in the predefined library are -- not treated specially. ! if Ada_Version < Ada_05 then Error_Msg_N ("private object not allowed in preelaborated unit", N); --- 1166,1172 ---- -- marked with this pragma in the predefined library are -- not treated specially. ! if Ada_Version < Ada_2005 then Error_Msg_N ("private object not allowed in preelaborated unit", N); *************** package body Sem_Cat is *** 1182,1188 **** then Error_Msg_Sloc := Sloc (Ent); ! if Ada_Version >= Ada_05 then Error_Msg_NE ("\would be legal if pragma Preelaborable_" & "Initialization given for & #", N, Ent); --- 1199,1205 ---- then Error_Msg_Sloc := Sloc (Ent); ! if Ada_Version >= Ada_2005 then Error_Msg_NE ("\would be legal if pragma Preelaborable_" & "Initialization given for & #", N, Ent); *************** package body Sem_Cat is *** 1210,1222 **** elsif Nkind (Odf) = N_Subtype_Indication then Ent := Etype (Subtype_Mark (Odf)); ! elsif ! Nkind (Odf) = N_Constrained_Array_Definition ! then Ent := Component_Type (T); - - -- else - -- return; end if; if Is_Task_Type (Ent) --- 1227,1234 ---- elsif Nkind (Odf) = N_Subtype_Indication then Ent := Etype (Subtype_Mark (Odf)); ! elsif Nkind (Odf) = N_Constrained_Array_Definition then Ent := Component_Type (T); end if; if Is_Task_Type (Ent) *************** package body Sem_Cat is *** 1230,1238 **** end; end if; ! -- 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 --- 1242,1250 ---- end; end if; ! -- Non-static discriminants not allowed in preelaborated unit. ! -- Objects of a controlled type with a user-defined Initialize ! -- are forbidden as well. if Is_Record_Type (Etype (Id)) then declare *************** package body Sem_Cat is *** 1248,1254 **** if Nkind (PEE) = N_Full_Type_Declaration and then not Static_Discriminant_Expr ! (Discriminant_Specifications (PEE)) then Error_Msg_N ("non-static discriminant in preelaborated unit", --- 1260,1266 ---- if Nkind (PEE) = N_Full_Type_Declaration and then not Static_Discriminant_Expr ! (Discriminant_Specifications (PEE)) then Error_Msg_N ("non-static discriminant in preelaborated unit", *************** package body Sem_Cat is *** 1270,1292 **** -- except within a subprogram, generic subprogram, task unit, or -- protected unit (RM 10.2.1(16)). ! if In_Pure_Unit ! and then not In_Subprogram_Task_Protected_Unit ! then Error_Msg_N ("declaration of variable not allowed in pure unit", N); -- The visible part of an RCI library unit must not contain the -- declaration of a variable (RM E.1.3(9)) elsif In_RCI_Declaration (N) then ! Error_Msg_N ("declaration of variable not allowed in rci unit", N); -- The visible part of a Shared Passive library unit must not contain -- the declaration of a variable (RM E.2.2(7)) ! elsif In_RT_Declaration then Error_Msg_N ! ("variable declaration not allowed in remote types unit", N); end if; end Validate_Object_Declaration; --- 1282,1302 ---- -- except within a subprogram, generic subprogram, task unit, or -- protected unit (RM 10.2.1(16)). ! if In_Pure_Unit and then not In_Subprogram_Task_Protected_Unit then Error_Msg_N ("declaration of variable not allowed in pure unit", N); -- The visible part of an RCI library unit must not contain the -- declaration of a variable (RM E.1.3(9)) elsif In_RCI_Declaration (N) then ! Error_Msg_N ("visible variable not allowed in 'R'C'I unit", N); -- The visible part of a Shared Passive library unit must not contain -- the declaration of a variable (RM E.2.2(7)) ! elsif In_RT_Declaration and then not In_Private_Part (Id) then Error_Msg_N ! ("visible variable not allowed in remote types unit", N); end if; end Validate_Object_Declaration; *************** package body Sem_Cat is *** 1333,1338 **** --- 1343,1354 ---- begin Desig_Type := Etype (Designated_Type (T)); + -- No action needed for concurrent types + + if Is_Concurrent_Type (Desig_Type) then + return; + end if; + Primitive_Subprograms := Primitive_Operations (Desig_Type); Subprogram_Elmt := First_Elmt (Primitive_Subprograms); *************** package body Sem_Cat is *** 1397,1404 **** null; ! elsif Ekind (Param_Type) = E_Anonymous_Access_Type ! or else Ekind (Param_Type) = E_Anonymous_Access_Subprogram_Type then -- From RM E.2.2(14), no anonymous access parameter other than -- controlling ones may be used (because an anonymous access --- 1413,1420 ---- null; ! elsif Ekind_In (Param_Type, E_Anonymous_Access_Type, ! E_Anonymous_Access_Subprogram_Type) then -- From RM E.2.2(14), no anonymous access parameter other than -- controlling ones may be used (because an anonymous access *************** package body Sem_Cat is *** 1454,1462 **** ("limited type not allowed in rci unit", Parent (E)); Explain_Limited_Type (E, Parent (E)); ! elsif Ekind (E) = E_Generic_Function ! or else Ekind (E) = E_Generic_Package ! or else Ekind (E) = E_Generic_Procedure then Error_Msg_N ("generic declaration not allowed in rci unit", Parent (E)); --- 1470,1478 ---- ("limited type not allowed in rci unit", Parent (E)); Explain_Limited_Type (E, Parent (E)); ! elsif Ekind_In (E, E_Generic_Function, ! E_Generic_Package, ! E_Generic_Procedure) then Error_Msg_N ("generic declaration not allowed in rci unit", Parent (E)); *************** package body Sem_Cat is *** 1551,1557 **** Type_Decl := Parent (Param_Type); if Ekind (Param_Type) = E_Anonymous_Access_Type then - if K = N_Subprogram_Declaration then Error_Node := Param_Spec; end if; --- 1567,1572 ---- *************** package body Sem_Cat is *** 1609,1615 **** Base_Under_Type := Base_Type (Underlying_Type (Base_Param_Type)); ! if (Ada_Version < Ada_05 and then (No (TSS (Base_Param_Type, TSS_Stream_Read)) or else --- 1624,1630 ---- Base_Under_Type := Base_Type (Underlying_Type (Base_Param_Type)); ! if (Ada_Version < Ada_2005 and then (No (TSS (Base_Param_Type, TSS_Stream_Read)) or else *************** package body Sem_Cat is *** 1619,1625 **** or else No (TSS (Base_Under_Type, TSS_Stream_Write)))) or else ! (Ada_Version >= Ada_05 and then (No (TSS (Base_Param_Type, TSS_Stream_Read)) or else --- 1634,1640 ---- or else No (TSS (Base_Under_Type, TSS_Stream_Write)))) or else ! (Ada_Version >= Ada_2005 and then (No (TSS (Base_Param_Type, TSS_Stream_Read)) or else *************** package body Sem_Cat is *** 1639,1645 **** Error_Node := Param_Spec; end if; ! if Ada_Version >= Ada_05 then Error_Msg_N ("limited parameter in 'R'C'I unit " & "must have visible read/write attributes ", --- 1654,1660 ---- Error_Node := Param_Spec; end if; ! if Ada_Version >= Ada_2005 then Error_Msg_N ("limited parameter in 'R'C'I unit " & "must have visible read/write attributes ", *************** package body Sem_Cat is *** 1754,1761 **** -- Start of processing for Validate_Remote_Access_Object_Type_Declaration begin ! -- We are called from Analyze_Type_Declaration, and the Nkind of the ! -- given node is N_Access_To_Object_Definition. if not Comes_From_Source (T) or else (not In_RCI_Declaration (Parent (T)) --- 1769,1776 ---- -- Start of processing for Validate_Remote_Access_Object_Type_Declaration begin ! -- We are called from Analyze_Full_Type_Declaration, and the Nkind of ! -- the given node is N_Access_To_Object_Definition. if not Comes_From_Source (T) or else (not In_RCI_Declaration (Parent (T)) *************** package body Sem_Cat is *** 2003,2009 **** "non-remote access type", U_Typ); end if; ! if Ada_Version >= Ada_05 then Error_Msg_N ("\must have visible Read and Write attribute " & "definition clauses (RM E.2.2(8))", U_Typ); --- 2018,2024 ---- "non-remote access type", U_Typ); end if; ! if Ada_Version >= Ada_2005 then Error_Msg_N ("\must have visible Read and Write attribute " & "definition clauses (RM E.2.2(8))", U_Typ); *************** package body Sem_Cat is *** 2055,2061 **** -- Start of processing for Validate_SP_Access_Object_Type_Decl begin ! -- We are called from Sem_Ch3.Analyze_Type_Declaration, and the -- Nkind of the given entity is N_Access_To_Object_Definition. if not Comes_From_Source (T) --- 2070,2076 ---- -- Start of processing for Validate_SP_Access_Object_Type_Decl begin ! -- We are called from Sem_Ch3.Analyze_Full_Type_Declaration, and the -- Nkind of the given entity is N_Access_To_Object_Definition. if not Comes_From_Source (T) diff -Nrcpad gcc-4.5.2/gcc/ada/sem_cat.ads gcc-4.6.0/gcc/ada/sem_cat.ads *** gcc-4.5.2/gcc/ada/sem_cat.ads Wed Apr 29 09:45:57 2009 --- gcc-4.6.0/gcc/ada/sem_cat.ads Tue Oct 26 10:51:36 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Cat is *** 143,152 **** -- T is the entity of the declared type. procedure Validate_Static_Object_Name (N : Node_Id); ! -- In the elaboration code of a preelaborated library unit, check ! -- that we do not have the evaluation of a primary that is a name of ! -- an object, unless the name is a static expression (RM 10.2.1(8)). ! -- Non-static constant and variable are the targets, generic parameters -- are not included because the generic declaration and body are -- preelaborable. --- 143,152 ---- -- T is the entity of the declared type. procedure Validate_Static_Object_Name (N : Node_Id); ! -- In the elaboration code of a preelaborated library unit, check that we ! -- do not have the evaluation of a primary that is a name of an object, ! -- unless the name is a static expression (RM 10.2.1(8)). Non-static ! -- constant and variable are the targets, generic parameters are not -- are not included because the generic declaration and body are -- preelaborable. diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch10.adb gcc-4.6.0/gcc/ada/sem_ch10.adb *** gcc-4.5.2/gcc/ada/sem_ch10.adb Tue Jan 26 09:42:04 2010 --- gcc-4.6.0/gcc/ada/sem_ch10.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem_Ch10 is *** 86,93 **** -- included in a standalone library. procedure Check_Private_Child_Unit (N : Node_Id); ! -- If a with_clause mentions a private child unit, the compilation ! -- unit must be a member of the same family, as described in 10.1.2. procedure Check_Stub_Level (N : Node_Id); -- Verify that a stub is declared immediately within a compilation unit, --- 86,93 ---- -- included in a standalone library. procedure Check_Private_Child_Unit (N : Node_Id); ! -- If a with_clause mentions a private child unit, the compilation unit ! -- must be a member of the same family, as described in 10.1.2. procedure Check_Stub_Level (N : Node_Id); -- Verify that a stub is declared immediately within a compilation unit, *************** package body Sem_Ch10 is *** 126,133 **** -- example through a limited_with clause in a parent unit. procedure Install_Context_Clauses (N : Node_Id); ! -- Subsidiary to Install_Context and Install_Parents. Process only with_ ! -- and use_clauses for current unit and its library unit if any. procedure Install_Limited_Context_Clauses (N : Node_Id); -- Subsidiary to Install_Context. Process only limited with_clauses for --- 126,133 ---- -- example through a limited_with clause in a parent unit. procedure Install_Context_Clauses (N : Node_Id); ! -- Subsidiary to Install_Context and Install_Parents. Process all with ! -- and use clauses for current unit and its library unit if any. procedure Install_Limited_Context_Clauses (N : Node_Id); -- Subsidiary to Install_Context. Process only limited with_clauses for *************** package body Sem_Ch10 is *** 187,204 **** -- that all parents are removed in the nested case. procedure Remove_Unit_From_Visibility (Unit_Name : Entity_Id); ! -- Reset all visibility flags on unit after compiling it, either as a ! -- main unit or as a unit in the context. procedure Unchain (E : Entity_Id); -- Remove single entity from visibility list procedure Analyze_Proper_Body (N : Node_Id; Nam : Entity_Id); -- Common processing for all stubs (subprograms, tasks, packages, and ! -- protected cases). N is the stub to be analyzed. Once the subunit ! -- name is established, load and analyze. Nam is the non-overloadable ! -- entity for which the proper body provides a completion. Subprogram ! -- stubs are handled differently because they can be declarations. procedure sm; -- A dummy procedure, for debugging use, called just before analyzing the --- 187,204 ---- -- that all parents are removed in the nested case. procedure Remove_Unit_From_Visibility (Unit_Name : Entity_Id); ! -- Reset all visibility flags on unit after compiling it, either as a main ! -- unit or as a unit in the context. procedure Unchain (E : Entity_Id); -- Remove single entity from visibility list procedure Analyze_Proper_Body (N : Node_Id; Nam : Entity_Id); -- Common processing for all stubs (subprograms, tasks, packages, and ! -- protected cases). N is the stub to be analyzed. Once the subunit name ! -- is established, load and analyze. Nam is the non-overloadable entity ! -- for which the proper body provides a completion. Subprogram stubs are ! -- handled differently because they can be declarations. procedure sm; -- A dummy procedure, for debugging use, called just before analyzing the *************** package body Sem_Ch10 is *** 219,227 **** -- To support this feature, the analysis of a limited_with clause must -- create an abbreviated view of the package, without performing any ! -- semantic analysis on it. This "package abstract" contains shadow ! -- types that are in one-one correspondence with the real types in the ! -- package, and that have the properties of incomplete types. -- The implementation creates two element lists: one to chain the shadow -- entities, and one to chain the corresponding type entities in the tree --- 219,227 ---- -- To support this feature, the analysis of a limited_with clause must -- create an abbreviated view of the package, without performing any ! -- semantic analysis on it. This "package abstract" contains shadow types ! -- that are in one-one correspondence with the real types in the package, ! -- and that have the properties of incomplete types. -- The implementation creates two element lists: one to chain the shadow -- entities, and one to chain the corresponding type entities in the tree *************** package body Sem_Ch10 is *** 272,282 **** Clause : Node_Id; Used : in out Boolean; Used_Type_Or_Elab : in out Boolean); ! -- Examine the context clauses of a package body, trying to match ! -- the name entity of Clause with any list element. If the match ! -- occurs on a use package clause, set Used to True, for a use ! -- type clause, pragma Elaborate or pragma Elaborate_All, set ! -- Used_Type_Or_Elab to True. procedure Process_Spec_Clauses (Context_List : List_Id; --- 272,281 ---- Clause : Node_Id; Used : in out Boolean; Used_Type_Or_Elab : in out Boolean); ! -- Examine the context clauses of a package body, trying to match the ! -- name entity of Clause with any list element. If the match occurs ! -- on a use package clause set Used to True, for a use type clause or ! -- pragma Elaborate[_All], set Used_Type_Or_Elab to True. procedure Process_Spec_Clauses (Context_List : List_Id; *************** package body Sem_Ch10 is *** 310,321 **** Use_Item : Node_Id; function Same_Unit (N : Node_Id; P : Entity_Id) return Boolean; ! -- In an expanded name in a use clause, if the prefix is a ! -- renamed package, the entity is set to the original package ! -- as a result, when checking whether the package appears in a ! -- previous with_clause, the renaming has to be taken into ! -- account, to prevent spurious or incorrect warnings. The ! -- common case is the use of Text_IO. --------------- -- Same_Unit -- --- 309,319 ---- Use_Item : Node_Id; function Same_Unit (N : Node_Id; P : Entity_Id) return Boolean; ! -- In an expanded name in a use clause, if the prefix is a renamed ! -- package, the entity is set to the original package as a result, ! -- when checking whether the package appears in a previous with ! -- clause, the renaming has to be taken into account, to prevent ! -- spurious/incorrect warnings. A common case is use of Text_IO. --------------- -- Same_Unit -- *************** package body Sem_Ch10 is *** 441,449 **** Cont_Item := First (Context_List); while Present (Cont_Item) loop ! -- Stop the search since the context items after Cont_Item ! -- have already been examined in a previous iteration of ! -- the reverse loop in Check_Redundant_Withs. if Exit_On_Self and Cont_Item = Clause --- 439,447 ---- Cont_Item := First (Context_List); while Present (Cont_Item) loop ! -- Stop the search since the context items after Cont_Item have ! -- already been examined in a previous iteration of the reverse ! -- loop in Check_Redundant_Withs. if Exit_On_Self and Cont_Item = Clause *************** package body Sem_Ch10 is *** 466,475 **** end loop; -- Package with clause. Avoid processing self, implicitly ! -- generated with clauses or limited with clauses. Note ! -- that we examine with clauses having pragmas Elaborate ! -- or Elaborate_All applied to them due to cases such as: -- -- with Pack; -- with Pack; -- pragma Elaborate (Pack); --- 464,474 ---- end loop; -- Package with clause. Avoid processing self, implicitly ! -- generated with clauses or limited with clauses. Note that ! -- we examine with clauses having pragmas Elaborate or ! -- Elaborate_All applied to them due to cases such as: -- + -- with Pack; -- with Pack; -- pragma Elaborate (Pack); *************** package body Sem_Ch10 is *** 496,504 **** Clause := Last (Context_Items); while Present (Clause) loop ! -- Avoid checking implicitly generated with clauses, limited ! -- with clauses or withs that have pragma Elaborate or ! -- Elaborate_All applied. if Nkind (Clause) = N_With_Clause and then not Implicit_With (Clause) --- 495,502 ---- Clause := Last (Context_Items); while Present (Clause) loop ! -- Avoid checking implicitly generated with clauses, limited with ! -- clauses or withs that have pragma Elaborate or Elaborate_All. if Nkind (Clause) = N_With_Clause and then not Implicit_With (Clause) *************** package body Sem_Ch10 is *** 552,558 **** or else Used_In_Spec) then ! Error_Msg_N ("?redundant with clause in body", Clause); end if; Used_In_Body := False; --- 550,557 ---- or else Used_In_Spec) then ! Error_Msg_N -- CODEFIX ! ("?redundant with clause in body", Clause); end if; Used_In_Body := False; *************** package body Sem_Ch10 is *** 580,586 **** Exit_On_Self => True); if Withed then ! Error_Msg_N ("?redundant with clause", Clause); end if; end; end if; --- 579,586 ---- Exit_On_Self => True); if Withed then ! Error_Msg_N -- CODEFIX ! ("?redundant with clause", Clause); end if; end; end if; *************** package body Sem_Ch10 is *** 640,648 **** -- analysis of the parent, which we proceed to do. Basically this gets -- handled from the top down and we don't want to do anything at this -- 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 detected in some ancestor. if Nkind (Unit_Node) = N_Subunit and then not Analyzed (Lib_Unit) --- 640,648 ---- -- analysis of the parent, which we proceed to do. Basically this gets -- handled from the top down and we don't want to do anything at this -- 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 detected in some ancestor. if Nkind (Unit_Node) = N_Subunit and then not Analyzed (Lib_Unit) *************** package body Sem_Ch10 is *** 660,672 **** return; end if; ! -- Analyze context (this will call Sem recursively for with'ed units) ! -- To detect circularities among with-clauses that are not caught during -- loading, we set the Context_Pending flag on the current unit. If the ! -- flag is already set there is a potential circularity. ! -- We exclude predefined units from this check because they are known ! -- to be safe. We also exclude package bodies that are present because ! -- circularities between bodies are harmless (and necessary). if Context_Pending (N) then declare --- 660,672 ---- return; end if; ! -- Analyze context (this will call Sem recursively for with'ed units) To ! -- detect circularities among with-clauses that are not caught during -- loading, we set the Context_Pending flag on the current unit. If the ! -- flag is already set there is a potential circularity. We exclude ! -- predefined units from this check because they are known to be safe. ! -- We also exclude package bodies that are present because circularities ! -- between bodies are harmless (and necessary). if Context_Pending (N) then declare *************** package body Sem_Ch10 is *** 690,697 **** end if; if Circularity then ! Error_Msg_N ! ("circular dependency caused by with_clauses", N); Error_Msg_N ("\possibly missing limited_with clause" & " in one of the following", N); --- 690,696 ---- end if; if Circularity then ! Error_Msg_N ("circular dependency caused by with_clauses", N); Error_Msg_N ("\possibly missing limited_with clause" & " in one of the following", N); *************** package body Sem_Ch10 is *** 978,986 **** end if; end if; ! -- Remove unit from visibility, so that environment is clean for ! -- the next compilation, which is either the main unit or some ! -- other unit in the context. if Nkind_In (Unit_Node, N_Package_Declaration, N_Package_Renaming_Declaration, --- 977,985 ---- end if; end if; ! -- Remove unit from visibility, so that environment is clean for the ! -- next compilation, which is either the main unit or some other unit ! -- in the context. if Nkind_In (Unit_Node, N_Package_Declaration, N_Package_Renaming_Declaration, *************** package body Sem_Ch10 is *** 993,1000 **** Remove_Unit_From_Visibility (Defining_Entity (Unit_Node)); -- If the unit is an instantiation whose body will be elaborated for ! -- 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 and then not Error_Posted (Unit_Node) --- 992,999 ---- Remove_Unit_From_Visibility (Defining_Entity (Unit_Node)); -- If the unit is an instantiation whose body will be elaborated for ! -- 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 and then not Error_Posted (Unit_Node) *************** package body Sem_Ch10 is *** 1204,1212 **** -- compilation unit actions list, and analyze them. declare ! Loc : constant Source_Ptr := Sloc (N); ! L : constant List_Id := ! Freeze_Entity (Cunit_Entity (Current_Sem_Unit), Loc); begin while Is_Non_Empty_List (L) loop Insert_Library_Level_Action (Remove_Head (L)); --- 1203,1210 ---- -- compilation unit actions list, and analyze them. declare ! L : constant List_Id := ! Freeze_Entity (Cunit_Entity (Current_Sem_Unit), N); begin while Is_Non_Empty_List (L) loop Insert_Library_Level_Action (Remove_Head (L)); *************** package body Sem_Ch10 is *** 1419,1426 **** P := Parent_Spec (Unit (N)); loop if Unit (P) = Lib_U then ! Error_Msg_N ("limited with_clause of immediate " ! & "ancestor not allowed", Item); exit; end if; --- 1417,1424 ---- P := Parent_Spec (Unit (N)); loop if Unit (P) = Lib_U then ! Error_Msg_N ("limited with_clause cannot " ! & "name ancestor", Item); exit; end if; *************** package body Sem_Ch10 is *** 1579,1588 **** Comp_Unit : Node_Id; begin ! -- Try to load subunit, but ignore any errors that occur during ! -- the loading of the subunit, by using the special feature in ! -- Errout to ignore all errors. Note that Fatal_Error will still ! -- be set, so we will be able to check for this case below. if not ASIS_Mode then Ignore_Errors_Enable := Ignore_Errors_Enable + 1; --- 1577,1586 ---- Comp_Unit : Node_Id; begin ! -- Try to load subunit, but ignore any errors that occur during the ! -- loading of the subunit, by using the special feature in Errout to ! -- ignore all errors. Note that Fatal_Error will still be set, so we ! -- will be able to check for this case below. if not ASIS_Mode then Ignore_Errors_Enable := Ignore_Errors_Enable + 1; *************** package body Sem_Ch10 is *** 1712,1720 **** return; -- If the subunit is not already loaded, and we are generating code, ! -- then this is the case where compilation started from the parent, ! -- and we are generating code for an entire subunit tree. In that ! -- case we definitely need to load the subunit. -- In order to continue the analysis with the rest of the parent, -- and other subunits, we load the unit without requiring its --- 1710,1718 ---- return; -- If the subunit is not already loaded, and we are generating code, ! -- then this is the case where compilation started from the parent, and ! -- we are generating code for an entire subunit tree. In that case we ! -- definitely need to load the subunit. -- In order to continue the analysis with the rest of the parent, -- and other subunits, we load the unit without requiring its *************** package body Sem_Ch10 is *** 1723,1735 **** elsif Original_Operating_Mode = Generate_Code then ! -- If the proper body is already linked to the stub node, ! -- the stub is in a generic unit and just needs analyzing. ! -- We update the version. Although we are not technically ! -- semantically dependent on the subunit, given our approach ! -- of macro substitution of subunits, it makes sense to ! -- include it in the version identification. if Present (Library_Unit (N)) then Set_Corresponding_Stub (Unit (Library_Unit (N)), N); --- 1721,1733 ---- elsif Original_Operating_Mode = Generate_Code then ! -- If the proper body is already linked to the stub node, the stub is ! -- in a generic unit and just needs analyzing. ! -- We update the version. Although we are not strictly technically ! -- semantically dependent on the subunit, given our approach of macro ! -- substitution of subunits, it makes sense to include it in the ! -- version identification. if Present (Library_Unit (N)) then Set_Corresponding_Stub (Unit (Library_Unit (N)), N); *************** package body Sem_Ch10 is *** 1739,1754 **** -- Otherwise we must load the subunit and link to it else Unum := Load_Unit (Load_Name => Subunit_Name, Required => False, Subunit => True, Error_Node => N); ! -- Give message if we did not get the unit ! -- Emit warning even if missing subunit is not ! -- within main unit, to simplify debugging. if Original_Operating_Mode = Generate_Code and then Unum = No_Unit --- 1737,1756 ---- -- Otherwise we must load the subunit and link to it else + -- Make sure that, if the subunit is preprocessed and -gnateG is + -- specified, the preprocessed file will be written. + + Lib.Analysing_Subunit_Of_Main := True; Unum := Load_Unit (Load_Name => Subunit_Name, Required => False, Subunit => True, Error_Node => N); + Lib.Analysing_Subunit_Of_Main := False; ! -- Give message if we did not get the unit Emit warning even if ! -- missing subunit is not within main unit, to simplify debugging. if Original_Operating_Mode = Generate_Code and then Unum = No_Unit *************** package body Sem_Ch10 is *** 1762,1769 **** end if; -- Load_Unit may reset Compiler_State, since it may have been ! -- necessary to parse an additional units, so we make sure ! -- that we reset it to the Analyzing state. Compiler_State := Analyzing; --- 1764,1771 ---- end if; -- Load_Unit may reset Compiler_State, since it may have been ! -- necessary to parse an additional units, so we make sure that ! -- we reset it to the Analyzing state. Compiler_State := Analyzing; *************** package body Sem_Ch10 is *** 1823,1833 **** end if; end if; ! -- The remaining case is when the subunit is not already loaded and ! -- we are not generating code. In this case we are just performing ! -- semantic analysis on the parent, and we are not interested in ! -- the subunit. For subprograms, analyze the stub as a body. For ! -- other entities the stub has already been marked as completed. else Optional_Subunit; --- 1825,1835 ---- end if; end if; ! -- The remaining case is when the subunit is not already loaded and we ! -- are not generating code. In this case we are just performing semantic ! -- analysis on the parent, and we are not interested in the subunit. For ! -- subprograms, analyze the stub as a body. For other entities the stub ! -- has already been marked as completed. else Optional_Subunit; *************** package body Sem_Ch10 is *** 2139,2144 **** --- 2141,2159 ---- -- Start of processing for Analyze_Subunit begin + if Style_Check then + declare + Nam : Node_Id := Name (Unit (N)); + + begin + if Nkind (Nam) = N_Selected_Component then + Nam := Selector_Name (Nam); + end if; + + Check_Identifier (Nam, Par_Unit); + end; + end if; + if not Is_Empty_List (Context_Items (N)) then -- Save current use clauses *************** package body Sem_Ch10 is *** 2207,2213 **** if Present (Enclosing_Child) then Install_Siblings (Enclosing_Child, N); end if; - end if; Analyze (Proper_Body (Unit (N))); --- 2222,2227 ---- *************** package body Sem_Ch10 is *** 2256,2262 **** else Set_Scope (Defining_Entity (N), Current_Scope); Generate_Reference (Nam, Defining_Identifier (N), 'b'); ! Set_Has_Completion (Etype (Nam)); Analyze_Proper_Body (N, Etype (Nam)); -- Set elaboration flag to indicate that entity is callable. This --- 2270,2285 ---- else Set_Scope (Defining_Entity (N), Current_Scope); Generate_Reference (Nam, Defining_Identifier (N), 'b'); ! ! -- Check for duplicate stub, if so give message and terminate ! ! if Has_Completion (Etype (Nam)) then ! Error_Msg_N ("duplicate stub for task", N); ! return; ! else ! Set_Has_Completion (Etype (Nam)); ! end if; ! Analyze_Proper_Body (N, Etype (Nam)); -- Set elaboration flag to indicate that entity is callable. This *************** package body Sem_Ch10 is *** 2270,2276 **** Make_Assignment_Statement (Loc, Name => Make_Identifier (Loc, ! New_External_Name (Chars (Etype (Nam)), 'E')), Expression => New_Reference_To (Standard_True, Loc))); end if; end if; --- 2293,2299 ---- Make_Assignment_Statement (Loc, Name => Make_Identifier (Loc, ! Chars => New_External_Name (Chars (Etype (Nam)), 'E')), Expression => New_Reference_To (Standard_True, Loc))); end if; end if; *************** package body Sem_Ch10 is *** 2303,2314 **** -- Set True if the unit currently being compiled is an internal unit Save_Style_Check : constant Boolean := Opt.Style_Check; ! Save_C_Restrict : constant Save_Cunit_Boolean_Restrictions := ! 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. --- 2326,2360 ---- -- Set True if the unit currently being compiled is an internal unit Save_Style_Check : constant Boolean := Opt.Style_Check; ! Save_C_Restrict : Save_Cunit_Boolean_Restrictions; begin U := Unit (Library_Unit (N)); + -- If this is an internal unit which is a renaming, then this is a + -- violation of No_Obsolescent_Features. + + -- Note: this is not quite right if the user defines one of these units + -- himself, but that's a marginal case, and fixing it is hard ??? + + if Restriction_Check_Required (No_Obsolescent_Features) then + declare + F : constant File_Name_Type := + Unit_File_Name (Get_Source_Unit (U)); + begin + if Is_Predefined_File_Name (F, Renamings_Included => True) + and then not + Is_Predefined_File_Name (F, Renamings_Included => False) + then + Check_Restriction (No_Obsolescent_Features, N); + end if; + end; + end if; + + -- Save current restriction set, does not apply to with'ed unit + + Save_C_Restrict := Cunit_Boolean_Restrictions_Save; + -- 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. *************** package body Sem_Ch10 is *** 2339,2347 **** -- explicit with'ing of run-time units. if Configurable_Run_Time_Mode ! and then ! Is_Predefined_File_Name ! (Unit_File_Name (Get_Source_Unit (Unit (Library_Unit (N))))) then Configurable_Run_Time_Mode := False; Semantics (Library_Unit (N)); --- 2385,2391 ---- -- explicit with'ing of run-time units. if Configurable_Run_Time_Mode ! and then Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (U))) then Configurable_Run_Time_Mode := False; Semantics (Library_Unit (N)); *************** package body Sem_Ch10 is *** 2406,2416 **** "and version-dependent?", Name (N)); end if; ! elsif U_Kind = Ada_05_Unit ! and then Ada_Version < Ada_05 and then Warn_On_Ada_2005_Compatibility then Error_Msg_N ("& is an Ada 2005 unit?", Name (N)); end if; end; end if; --- 2450,2466 ---- "and version-dependent?", Name (N)); end if; ! elsif U_Kind = Ada_2005_Unit ! and then Ada_Version < Ada_2005 and then Warn_On_Ada_2005_Compatibility then Error_Msg_N ("& is an Ada 2005 unit?", Name (N)); + + elsif U_Kind = Ada_2012_Unit + and then Ada_Version < Ada_2012 + and then Warn_On_Ada_2012_Compatibility + then + Error_Msg_N ("& is an Ada 2012 unit?", Name (N)); end if; end; end if; *************** package body Sem_Ch10 is *** 2438,2443 **** --- 2488,2494 ---- elsif Unit_Kind = N_Package_Instantiation and then Nkind (U) = N_Package_Instantiation + and then Present (Instance_Spec (U)) then -- If the instance has not been rewritten as a package declaration, -- then it appeared already in a previous with clause. Retrieve *************** package body Sem_Ch10 is *** 2505,2510 **** --- 2556,2576 ---- Par_Name := Scope (E_Name); while Nkind (Pref) = N_Selected_Component loop Change_Selected_Component_To_Expanded_Name (Pref); + + if Present (Entity (Selector_Name (Pref))) + and then + Present (Renamed_Entity (Entity (Selector_Name (Pref)))) + and then Entity (Selector_Name (Pref)) /= Par_Name + then + -- The prefix is a child unit that denotes a renaming declaration. + -- Replace the prefix directly with the renamed unit, because the + -- rest of the prefix is irrelevant to the visibility of the real + -- unit. + + Rewrite (Pref, New_Occurrence_Of (Par_Name, Sloc (Pref))); + exit; + end if; + Set_Entity_With_Style_Check (Pref, Par_Name); Generate_Reference (Par_Name, Pref); *************** package body Sem_Ch10 is *** 2605,2613 **** Sub_Parent := Library_Unit (N); Curr_Unit := Defining_Entity (Unit (Library_Unit (Sub_Parent))); ! -- If the parent itself is a subunit, Curr_Unit is the entity ! -- of the enclosing body, retrieve the spec entity which is ! -- the proper ancestor we need for the following tests. if Ekind (Curr_Unit) = E_Package_Body then Curr_Unit := Spec_Entity (Curr_Unit); --- 2671,2679 ---- Sub_Parent := Library_Unit (N); Curr_Unit := Defining_Entity (Unit (Library_Unit (Sub_Parent))); ! -- If the parent itself is a subunit, Curr_Unit is the entity of the ! -- enclosing body, retrieve the spec entity which is the proper ! -- ancestor we need for the following tests. if Ekind (Curr_Unit) = E_Package_Body then Curr_Unit := Spec_Entity (Curr_Unit); *************** package body Sem_Ch10 is *** 2774,2790 **** begin if Nkind (Nam) = N_Identifier then ! -- If the parent unit P in the name of the with_clause for P.Q ! -- is a renaming of package R, then the entity of the parent is ! -- set to R, but the identifier retains Chars (P) to be consistent ! -- with the source (see details in lib-load). However, the ! -- implicit_with_clause for the parent must make the entity for ! -- P visible, because P.Q may be used as a prefix within the ! -- current unit. The entity for P is the current_entity with that ! -- name, because the package renaming declaration for it has just ! -- been analyzed. Note that this case can only happen if P.Q has ! -- already appeared in a previous with_clause in a related unit, ! -- such as the library body of the current unit. if Chars (Nam) /= Chars (Entity (Nam)) then Renaming := Current_Entity (Nam); --- 2840,2856 ---- begin if Nkind (Nam) = N_Identifier then ! -- If the parent unit P in the name of the with_clause for P.Q is ! -- a renaming of package R, then the entity of the parent is set ! -- to R, but the identifier retains Chars (P) to be consistent ! -- with the source (see details in lib-load). However the implicit ! -- with_clause for the parent must make the entity for P visible, ! -- because P.Q may be used as a prefix within the current unit. ! -- The entity for P is the current_entity with that name, because ! -- the package renaming declaration for it has just been analyzed. ! -- Note that this case can only happen if P.Q has already appeared ! -- in a previous with_clause in a related unit, such as the ! -- library body of the current unit. if Chars (Nam) /= Chars (Entity (Nam)) then Renaming := Current_Entity (Nam); *************** package body Sem_Ch10 is *** 2804,2813 **** Nkind (Unit_Declaration_Node (Entity (Selector_Name (Nam)))) = N_Package_Renaming_Declaration then ! -- The name in the with_clause is of the form A.B.C, and B ! -- is given by a renaming declaration. In that case we may ! -- not have analyzed the unit for B, but replaced it directly ! -- in lib-load with the unit it renames. We have to make A.B -- visible, so analyze the declaration for B now, in case it -- has not been done yet. --- 2870,2879 ---- Nkind (Unit_Declaration_Node (Entity (Selector_Name (Nam)))) = N_Package_Renaming_Declaration then ! -- The name in the with_clause is of the form A.B.C, and B is ! -- given by a renaming declaration. In that case we may not ! -- have analyzed the unit for B, but replaced it directly in ! -- lib-load with the unit it renames. We have to make A.B -- visible, so analyze the declaration for B now, in case it -- has not been done yet. *************** package body Sem_Ch10 is *** 3373,3378 **** --- 3439,3449 ---- -- units. The shadow entities are created when the inserted clause is -- analyzed. Implements Ada 2005 (AI-50217). + function Is_Ancestor_Unit (U1 : Node_Id; U2 : Node_Id) return Boolean; + -- When compiling a unit Q descended from some parent unit P, a limited + -- with_clause in the context of P that names some other ancestor of Q + -- must not be installed because the ancestor is immediately visible. + --------------------- -- Check_Renamings -- --------------------- *************** package body Sem_Ch10 is *** 3612,3620 **** Subunit => False, Error_Node => Nam); ! -- Do not generate a limited_with_clause on the current unit. ! -- This path is taken when a unit has a limited_with clause on ! -- one of its child units. if Unum = Current_Sem_Unit then return; --- 3683,3691 ---- Subunit => False, Error_Node => Nam); ! -- Do not generate a limited_with_clause on the current unit. This ! -- path is taken when a unit has a limited_with clause on one of its ! -- child units. if Unum = Current_Sem_Unit then return; *************** package body Sem_Ch10 is *** 3645,3650 **** --- 3716,3737 ---- New_Nodes_OK := New_Nodes_OK - 1; end Expand_Limited_With_Clause; + ---------------------- + -- Is_Ancestor_Unit -- + ---------------------- + + function Is_Ancestor_Unit (U1 : Node_Id; U2 : Node_Id) return Boolean is + E1 : constant Entity_Id := Defining_Entity (Unit (U1)); + E2 : Entity_Id; + begin + if Nkind_In (Unit (U2), N_Package_Body, N_Subprogram_Body) then + E2 := Defining_Entity (Unit (Library_Unit (U2))); + return Is_Ancestor_Package (E1, E2); + else + return False; + end if; + end Is_Ancestor_Unit; + -- Start of processing for Install_Limited_Context_Clauses begin *************** package body Sem_Ch10 is *** 3652,3657 **** --- 3739,3745 ---- while Present (Item) loop if Nkind (Item) = N_With_Clause and then Limited_Present (Item) + and then not Error_Posted (Item) then if Nkind (Name (Item)) = N_Selected_Component then Expand_Limited_With_Clause *************** package body Sem_Ch10 is *** 3678,3683 **** --- 3766,3774 ---- if Library_Unit (Item) /= Cunit (Current_Sem_Unit) and then not Limited_View_Installed (Item) + and then + not Is_Ancestor_Unit + (Library_Unit (Item), Cunit (Current_Sem_Unit)) then if not Private_Present (Item) or else Private_Present (N) *************** package body Sem_Ch10 is *** 3693,3703 **** Next (Item); end loop; ! -- Ada 2005 (AI-412): Examine the visible declarations of a package ! -- spec, looking for incomplete subtype declarations of incomplete types -- visible through a limited with clause. ! if Ada_Version >= Ada_05 and then Analyzed (N) and then Nkind (Unit (N)) = N_Package_Declaration then --- 3784,3794 ---- Next (Item); end loop; ! -- Ada 2005 (AI-412): Examine visible declarations of a package spec, ! -- looking for incomplete subtype declarations of incomplete types -- visible through a limited with clause. ! if Ada_Version >= Ada_2005 and then Analyzed (N) and then Nkind (Unit (N)) = N_Package_Declaration then *************** package body Sem_Ch10 is *** 3723,3729 **** -- Convert an incomplete subtype declaration into a -- corresponding non-limited view subtype declaration. -- This is usually the case when analyzing a body that ! -- has regular with-clauses, when the spec has limited -- ones. -- If the non-limited view is still incomplete, it is --- 3814,3820 ---- -- Convert an incomplete subtype declaration into a -- corresponding non-limited view subtype declaration. -- This is usually the case when analyzing a body that ! -- has regular with clauses, when the spec has limited -- ones. -- If the non-limited view is still incomplete, it is *************** package body Sem_Ch10 is *** 4013,4019 **** function In_Context return Boolean; -- Scan context of current unit, to check whether there is -- a with_clause on the same unit as a private with-clause ! -- on a parent, in which case child unit is visible. ---------------- -- In_Context -- --- 4104,4111 ---- function In_Context return Boolean; -- Scan context of current unit, to check whether there is -- a with_clause on the same unit as a private with-clause ! -- on a parent, in which case child unit is visible. If the ! -- unit is a grand-child, the same applies to its parent. ---------------- -- In_Context -- *************** package body Sem_Ch10 is *** 4027,4036 **** if Nkind (Clause) = N_With_Clause and then Comes_From_Source (Clause) and then Is_Entity_Name (Name (Clause)) - and then Entity (Name (Clause)) = Id and then not Private_Present (Clause) then ! return True; end if; Next (Clause); --- 4119,4133 ---- if Nkind (Clause) = N_With_Clause and then Comes_From_Source (Clause) and then Is_Entity_Name (Name (Clause)) and then not Private_Present (Clause) then ! if Entity (Name (Clause)) = Id ! or else ! (Nkind (Name (Clause)) = N_Expanded_Name ! and then Entity (Prefix (Name (Clause))) = Id) ! then ! return True; ! end if; end if; Next (Clause); *************** package body Sem_Ch10 is *** 4302,4309 **** end loop; end; ! -- Finally, check whether there are subprograms that still ! -- require a body, i.e. are not renamings or null. if not Is_Empty_Elmt_List (Subp_List) then declare --- 4399,4406 ---- end loop; end; ! -- Finally, check whether there are subprograms that still require ! -- a body, i.e. are not renamings or null. if not Is_Empty_Elmt_List (Subp_List) then declare *************** package body Sem_Ch10 is *** 4395,4402 **** return True; end if; ! -- If there are more ancestors, climb up the tree, otherwise ! -- we are done. if Is_Child_Unit (Par) then Par := Scope (Par); --- 4492,4499 ---- return True; end if; ! -- If there are more ancestors, climb up the tree, otherwise we ! -- are done. if Is_Child_Unit (Par) then Par := Scope (Par); *************** package body Sem_Ch10 is *** 4553,4562 **** -- Do not install the limited view if this is the unit being analyzed. -- This unusual case will happen when a unit has a limited_with clause ! -- on one of its children. The compilation of the child forces the ! -- load of the parent which tries to install the limited view of the ! -- child again. Installing the limited view must also be disabled ! -- when compiling the body of the child unit. if P = Cunit_Entity (Current_Sem_Unit) or else --- 4650,4659 ---- -- Do not install the limited view if this is the unit being analyzed. -- This unusual case will happen when a unit has a limited_with clause ! -- on one of its children. The compilation of the child forces the load ! -- of the parent which tries to install the limited view of the child ! -- again. Installing the limited view must also be disabled when ! -- compiling the body of the child unit. if P = Cunit_Entity (Current_Sem_Unit) or else *************** package body Sem_Ch10 is *** 4566,4576 **** return; end if; ! -- This scenario is similar to the one above, the difference is that ! -- the compilation of sibling Par.Sib forces the load of parent Par ! -- which tries to install the limited view of Lim_Pack [1]. However ! -- Par.Sib has a with clause for Lim_Pack [2] in its body, and thus ! -- needs the non-limited views of all entities from Lim_Pack. -- limited with Lim_Pack; -- [1] -- package Par is ... package Lim_Pack is ... --- 4663,4673 ---- return; end if; ! -- This scenario is similar to the one above, the difference is that the ! -- compilation of sibling Par.Sib forces the load of parent Par which ! -- tries to install the limited view of Lim_Pack [1]. However Par.Sib ! -- has a with clause for Lim_Pack [2] in its body, and thus needs the ! -- non-limited views of all entities from Lim_Pack. -- limited with Lim_Pack; -- [1] -- package Par is ... package Lim_Pack is ... *************** package body Sem_Ch10 is *** 4599,4607 **** return; end if; ! -- A common use of the limited-with is to have a limited-with ! -- in the package spec, and a normal with in its package body. ! -- For example: -- limited with X; -- [1] -- package A is ... --- 4696,4703 ---- return; end if; ! -- A common use of the limited-with is to have a limited-with in the ! -- package spec, and a normal with in its package body. For example: -- limited with X; -- [1] -- package A is ... *************** package body Sem_Ch10 is *** 4621,4627 **** (Is_Immediately_Visible (P) or else (Is_Child_Package and then Is_Visible_Child_Unit (P))) then ! return; end if; if Debug_Flag_I then --- 4717,4765 ---- (Is_Immediately_Visible (P) or else (Is_Child_Package and then Is_Visible_Child_Unit (P))) then ! ! -- The presence of both the limited and the analyzed nonlimited view ! -- may also be an error, such as an illegal context for a limited ! -- with_clause. In that case, do not process the context item at all. ! ! if Error_Posted (N) then ! return; ! end if; ! ! if Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Body then ! declare ! Item : Node_Id; ! begin ! Item := First (Context_Items (Cunit (Current_Sem_Unit))); ! while Present (Item) loop ! if Nkind (Item) = N_With_Clause ! and then Comes_From_Source (Item) ! and then Entity (Name (Item)) = P ! then ! return; ! end if; ! ! Next (Item); ! end loop; ! end; ! ! -- If this is a child body, assume that the nonlimited with_clause ! -- appears in an ancestor. Could be refined ??? ! ! if Is_Child_Unit ! (Defining_Entity ! (Unit (Library_Unit (Cunit (Current_Sem_Unit))))) ! then ! return; ! end if; ! ! else ! ! -- If in package declaration, nonlimited view brought in from ! -- parent unit or some error condition. ! ! return; ! end if; end if; if Debug_Flag_I then *************** package body Sem_Ch10 is *** 4732,4739 **** Prev := Current_Entity (Lim_Typ); E := Prev; ! -- Replace E in the homonyms list, so that the limited ! -- view becomes available. if E = Non_Limited_View (Lim_Typ) then Set_Homonym (Lim_Typ, Homonym (Prev)); --- 4870,4877 ---- Prev := Current_Entity (Lim_Typ); E := Prev; ! -- Replace E in the homonyms list, so that the limited view ! -- becomes available. if E = Non_Limited_View (Lim_Typ) then Set_Homonym (Lim_Typ, Homonym (Prev)); *************** package body Sem_Ch10 is *** 4743,4750 **** loop E := Homonym (Prev); ! -- E may have been removed when installing a ! -- previous limited_with_clause. exit when No (E); --- 4881,4888 ---- loop E := Homonym (Prev); ! -- E may have been removed when installing a previous ! -- limited_with_clause. exit when No (E); *************** package body Sem_Ch10 is *** 4786,4795 **** 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 ! -- entity of parent, if available, for higher ancestors in the name. if Nkind (Name (N)) = N_Selected_Component then declare --- 4924,4933 ---- 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 entity of ! -- parent, if available, for higher ancestors in the name. if Nkind (Name (N)) = N_Selected_Component then declare *************** package body Sem_Ch10 is *** 4945,4951 **** if Is_Child_Unit (Uname) and then Is_Visible_Child_Unit (Uname) ! and then Ada_Version >= Ada_05 then declare Decl1 : constant Node_Id := Unit_Declaration_Node (P); --- 5083,5089 ---- if Is_Child_Unit (Uname) and then Is_Visible_Child_Unit (Uname) ! and then Ada_Version >= Ada_2005 then declare Decl1 : constant Node_Id := Unit_Declaration_Node (P); *************** package body Sem_Ch10 is *** 5053,5059 **** -- If the unit is not generic, but contains a generic unit, it is loaded on -- demand, at the point of instantiation (see ch12). ! procedure Load_Needed_Body (N : Node_Id; OK : out Boolean) is Body_Name : Unit_Name_Type; Unum : Unit_Number_Type; --- 5191,5201 ---- -- If the unit is not generic, but contains a generic unit, it is loaded on -- demand, at the point of instantiation (see ch12). ! procedure Load_Needed_Body ! (N : Node_Id; ! OK : out Boolean; ! Do_Analyze : Boolean := True) ! is Body_Name : Unit_Name_Type; Unum : Unit_Number_Type; *************** package body Sem_Ch10 is *** 5086,5092 **** Write_Eol; end if; ! Semantics (Cunit (Unum)); end if; OK := True; --- 5228,5236 ---- Write_Eol; end if; ! if Do_Analyze then ! Semantics (Cunit (Unum)); ! end if; end if; OK := True; *************** package body Sem_Ch10 is *** 5346,5352 **** -- 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 --- 5490,5496 ---- -- and the full-view. if No (Class_Wide_Type (T)) then ! CW := Make_Temporary (Loc, '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 *************** package body Sem_Ch10 is *** 5398,5406 **** Sloc_Value : Source_Ptr; Id_Char : Character) return Entity_Id is ! E : constant Entity_Id := ! Make_Defining_Identifier (Sloc_Value, ! Chars => New_Internal_Name (Id_Char)); begin Set_Ekind (E, Kind); --- 5542,5548 ---- Sloc_Value : Source_Ptr; Id_Char : Character) return Entity_Id is ! E : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char); begin Set_Ekind (E, Kind); *************** package body Sem_Ch10 is *** 5475,5483 **** -- Build the header of the limited_view ! Lim_Header := ! Make_Defining_Identifier (Sloc (N), ! Chars => New_Internal_Name (Id_Char => 'Z')); Set_Ekind (Lim_Header, E_Package); Set_Is_Internal (Lim_Header); Set_Limited_View (P, Lim_Header); --- 5617,5623 ---- -- Build the header of the limited_view ! Lim_Header := Make_Temporary (Sloc (N), 'Z'); Set_Ekind (Lim_Header, E_Package); Set_Is_Internal (Lim_Header); Set_Limited_View (P, Lim_Header); *************** package body Sem_Ch10 is *** 5535,5543 **** then return True; ! elsif Ekind (E) = E_Generic_Function ! or else Ekind (E) = E_Generic_Procedure ! then return True; elsif Ekind (E) = E_Generic_Package --- 5675,5681 ---- then return True; ! elsif Ekind_In (E, E_Generic_Function, E_Generic_Procedure) then return True; elsif Ekind (E) = E_Generic_Package *************** package body Sem_Ch10 is *** 5578,5587 **** then Set_Body_Needed_For_SAL (Unit_Name); ! elsif Ekind (Unit_Name) = E_Generic_Procedure ! or else ! Ekind (Unit_Name) = E_Generic_Function ! then Set_Body_Needed_For_SAL (Unit_Name); elsif Is_Subprogram (Unit_Name) --- 5716,5722 ---- then Set_Body_Needed_For_SAL (Unit_Name); ! elsif Ekind_In (Unit_Name, E_Generic_Procedure, E_Generic_Function) then Set_Body_Needed_For_SAL (Unit_Name); elsif Is_Subprogram (Unit_Name) *************** package body Sem_Ch10 is *** 5729,5738 **** Write_Eol; end if; ! -- Prepare the removal of the shadow entities from visibility. The ! -- first element of the limited view is a header (an E_Package ! -- entity) that is used to reference the first shadow entity in the ! -- private part of the package Lim_Header := Limited_View (P); Lim_Typ := First_Entity (Lim_Header); --- 5864,5873 ---- Write_Eol; end if; ! -- Prepare the removal of the shadow entities from visibility. The first ! -- element of the limited view is a header (an E_Package entity) that is ! -- used to reference the first shadow entity in the private part of the ! -- package Lim_Header := Limited_View (P); Lim_Typ := First_Entity (Lim_Header); *************** package body Sem_Ch10 is *** 5927,5935 **** if Nkind (Item) = N_With_Clause and then Private_Present (Item) then ! -- If private_with_clause is redundant, remove it from ! -- context, as a small optimization to subsequent handling ! -- of private_with clauses in other nested packages.. if In_Regular_With_Clause (Entity (Name (Item))) then declare --- 6062,6070 ---- if Nkind (Item) = N_With_Clause and then Private_Present (Item) then ! -- If private_with_clause is redundant, remove it from context, ! -- as a small optimization to subsequent handling of private_with ! -- clauses in other nested packages. if In_Regular_With_Clause (Entity (Name (Item))) then declare diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch10.ads gcc-4.6.0/gcc/ada/sem_ch10.ads *** gcc-4.5.2/gcc/ada/sem_ch10.ads Tue Jun 23 10:15:47 2009 --- gcc-4.6.0/gcc/ada/sem_ch10.ads Mon Oct 11 10:24:08 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch10 is *** 63,73 **** -- rule imposes extra steps in order to install/remove the private_with -- 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 ! -- that contains generic units or inlined units. The body becomes ! -- part of the semantic dependency set of the unit that needs it. ! -- The returned result in OK is True if the load is successful, ! -- and False if the requested file cannot be found. end Sem_Ch10; --- 63,78 ---- -- rule imposes extra steps in order to install/remove the private_with -- clauses of an enclosing unit. ! procedure Load_Needed_Body ! (N : Node_Id; ! OK : out Boolean; ! Do_Analyze : Boolean := True); ! -- Load and analyze the body of a context unit that is generic, or that ! -- contains generic units or inlined units. The body becomes part of the ! -- semantic dependency set of the unit that needs it. The returned result ! -- in OK is True if the load is successful, and False if the requested file ! -- cannot be found. If the flag Do_Analyze is false, the unit is loaded and ! -- parsed only. This allows a selective analysis in some inlining cases ! -- where a full analysis would lead so circularities in the back-end. end Sem_Ch10; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch11.adb gcc-4.6.0/gcc/ada/sem_ch11.adb *** gcc-4.5.2/gcc/ada/sem_ch11.adb Fri Jul 10 13:18:49 2009 --- gcc-4.6.0/gcc/ada/sem_ch11.adb Mon Oct 11 10:43:04 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Checks; use Checks; with Einfo; use Einfo; *************** with Rtsfind; use Rtsfind; *** 39,44 **** --- 40,46 ---- with Sem; use Sem; with Sem_Ch5; use Sem_Ch5; with Sem_Ch8; use Sem_Ch8; + with Sem_Ch13; use Sem_Ch13; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; *************** package body Sem_Ch11 is *** 63,68 **** --- 65,71 ---- Set_Etype (Id, Standard_Exception_Type); Set_Is_Statically_Allocated (Id); Set_Is_Pure (Id, PF); + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Exception_Declaration; -------------------------------- *************** package body Sem_Ch11 is *** 538,543 **** --- 541,554 ---- end if; end if; + -- Check obsolescent use of Numeric_Error + + if Exception_Name = Standard_Numeric_Error then + Check_Restriction (No_Obsolescent_Features, Exception_Id); + end if; + + -- Kill last assignment indication + Kill_Current_Values (Last_Assignment_Only => True); end Analyze_Raise_Statement; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch12.adb gcc-4.6.0/gcc/ada/sem_ch12.adb *** gcc-4.5.2/gcc/ada/sem_ch12.adb Tue Oct 27 13:22:25 2009 --- gcc-4.6.0/gcc/ada/sem_ch12.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Einfo; use Einfo; with Elists; use Elists; *************** package body Sem_Ch12 is *** 469,480 **** -- Used to determine whether its body should be elaborated to allow -- front-end inlining. - 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 visibility - -- of generic formals of a generic package declared with a box or with - -- partial parametrization. - procedure Set_Instance_Env (Gen_Unit : Entity_Id; Act_Unit : Entity_Id); --- 470,475 ---- *************** package body Sem_Ch12 is *** 608,618 **** -- formals: the visible and private declarations themselves need not be -- created. ! -- In Ada 2005, the formal package may be only partially parametrized. In ! -- that case the visibility step must make visible those actuals whose -- corresponding formals were given with a box. A final complication ! -- involves inherited operations from formal derived types, which must be ! -- visible if the type is. function Is_In_Main_Unit (N : Node_Id) return Boolean; -- Test if given node is in the main unit --- 603,613 ---- -- formals: the visible and private declarations themselves need not be -- created. ! -- In Ada 2005, the formal package may be only partially parameterized. ! -- In that case the visibility step must make visible those actuals whose -- corresponding formals were given with a box. A final complication ! -- involves inherited operations from formal derived types, which must ! -- be visible if the type is. function Is_In_Main_Unit (N : Node_Id) return Boolean; -- Test if given node is in the main unit *************** package body Sem_Ch12 is *** 1054,1060 **** -- defining identifier for it. Decl := New_Copy_Tree (F); ! Id := Make_Defining_Identifier (Sloc (F_Id), Chars => Chars (F_Id)); if Nkind (F) in N_Formal_Subprogram_Declaration then Set_Defining_Unit_Name (Specification (Decl), Id); --- 1049,1055 ---- -- defining identifier for it. Decl := New_Copy_Tree (F); ! Id := Make_Defining_Identifier (Sloc (F_Id), Chars (F_Id)); if Nkind (F) in N_Formal_Subprogram_Declaration then Set_Defining_Unit_Name (Specification (Decl), Id); *************** package body Sem_Ch12 is *** 1380,1386 **** when N_Use_Package_Clause | N_Use_Type_Clause => if Nkind (Original_Node (I_Node)) = ! N_Formal_Package_Declaration then Append (New_Copy_Tree (Formal), Assoc); else --- 1375,1381 ---- when N_Use_Package_Clause | N_Use_Type_Clause => if Nkind (Original_Node (I_Node)) = ! N_Formal_Package_Declaration then Append (New_Copy_Tree (Formal), Assoc); else *************** package body Sem_Ch12 is *** 1867,1873 **** -- Ada 2005 (AI-287): Limited aggregates allowed in generic formals ! if Ada_Version < Ada_05 and then Is_Limited_Type (T) then Error_Msg_N ("generic formal of mode IN must not be of limited type", N); Explain_Limited_Type (T, N); --- 1862,1868 ---- -- Ada 2005 (AI-287): Limited aggregates allowed in generic formals ! if Ada_Version < Ada_2005 and then Is_Limited_Type (T) then Error_Msg_N ("generic formal of mode IN must not be of limited type", N); Explain_Limited_Type (T, N); *************** package body Sem_Ch12 is *** 1929,1934 **** --- 1924,1931 ---- ("initialization not allowed for `IN OUT` formals", N); end if; end if; + + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Formal_Object_Declaration; ---------------------------------------------- *************** package body Sem_Ch12 is *** 1972,1982 **** Check_Restriction (No_Fixed_Point, Def); end Analyze_Formal_Ordinary_Fixed_Point_Type; ! ---------------------------- ! -- Analyze_Formal_Package -- ! ---------------------------- ! procedure Analyze_Formal_Package (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Pack_Id : constant Entity_Id := Defining_Identifier (N); Formal : Entity_Id; --- 1969,1979 ---- Check_Restriction (No_Fixed_Point, Def); end Analyze_Formal_Ordinary_Fixed_Point_Type; ! ---------------------------------------- ! -- Analyze_Formal_Package_Declaration -- ! ---------------------------------------- ! procedure Analyze_Formal_Package_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Pack_Id : constant Entity_Id := Defining_Identifier (N); Formal : Entity_Id; *************** package body Sem_Ch12 is *** 2109,2128 **** -- Check for a formal package that is a package renaming if Present (Renamed_Object (Gen_Unit)) then Gen_Unit := Renamed_Object (Gen_Unit); end if; if Ekind (Gen_Unit) /= E_Generic_Package then Error_Msg_N ("expect generic package name", Gen_Id); Restore_Env; ! return; elsif Gen_Unit = Current_Scope then Error_Msg_N ("generic package cannot be used as a formal package of itself", Gen_Id); Restore_Env; ! return; elsif In_Open_Scopes (Gen_Unit) then if Is_Compilation_Unit (Gen_Unit) --- 2106,2134 ---- -- Check for a formal package that is a package renaming if Present (Renamed_Object (Gen_Unit)) then + + -- Indicate that unit is used, before replacing it with renamed + -- entity for use below. + + if In_Extended_Main_Source_Unit (N) then + Set_Is_Instantiated (Gen_Unit); + Generate_Reference (Gen_Unit, N); + end if; + Gen_Unit := Renamed_Object (Gen_Unit); end if; if Ekind (Gen_Unit) /= E_Generic_Package then Error_Msg_N ("expect generic package name", Gen_Id); Restore_Env; ! goto Leave; elsif Gen_Unit = Current_Scope then Error_Msg_N ("generic package cannot be used as a formal package of itself", Gen_Id); Restore_Env; ! goto Leave; elsif In_Open_Scopes (Gen_Unit) then if Is_Compilation_Unit (Gen_Unit) *************** package body Sem_Ch12 is *** 2142,2148 **** & "within itself", Gen_Id); Restore_Env; ! return; end if; end if; --- 2148,2154 ---- & "within itself", Gen_Id); Restore_Env; ! goto Leave; end if; end if; *************** package body Sem_Ch12 is *** 2190,2196 **** Remove_Parent; end if; ! return; end; Rewrite (N, New_N); --- 2196,2202 ---- Remove_Parent; end if; ! goto Leave; end; Rewrite (N, New_N); *************** package body Sem_Ch12 is *** 2273,2279 **** Set_Etype (Pack_Id, Standard_Void_Type); Set_Scope (Pack_Id, Scope (Formal)); Set_Has_Completion (Pack_Id, True); ! end Analyze_Formal_Package; --------------------------------- -- Analyze_Formal_Private_Type -- --- 2279,2288 ---- Set_Etype (Pack_Id, Standard_Void_Type); Set_Scope (Pack_Id, Scope (Formal)); Set_Has_Completion (Pack_Id, True); ! ! <> ! Analyze_Aspect_Specifications (N, Pack_Id, Aspect_Specifications (N)); ! end Analyze_Formal_Package_Declaration; --------------------------------- -- Analyze_Formal_Private_Type -- *************** package body Sem_Ch12 is *** 2323,2333 **** Set_Parent (Base, Parent (Def)); end Analyze_Formal_Signed_Integer_Type; ! ------------------------------- ! -- Analyze_Formal_Subprogram -- ! ------------------------------- ! procedure Analyze_Formal_Subprogram (N : Node_Id) is Spec : constant Node_Id := Specification (N); Def : constant Node_Id := Default_Name (N); Nam : constant Entity_Id := Defining_Unit_Name (Spec); --- 2332,2342 ---- Set_Parent (Base, Parent (Def)); end Analyze_Formal_Signed_Integer_Type; ! ------------------------------------------- ! -- Analyze_Formal_Subprogram_Declaration -- ! ------------------------------------------- ! procedure Analyze_Formal_Subprogram_Declaration (N : Node_Id) is Spec : constant Node_Id := Specification (N); Def : constant Node_Id := Default_Name (N); Nam : constant Entity_Id := Defining_Unit_Name (Spec); *************** package body Sem_Ch12 is *** 2340,2346 **** if Nkind (Nam) = N_Defining_Program_Unit_Name then Error_Msg_N ("name of formal subprogram must be a direct name", Nam); ! return; end if; Analyze_Subprogram_Declaration (N); --- 2349,2355 ---- if Nkind (Nam) = N_Defining_Program_Unit_Name then Error_Msg_N ("name of formal subprogram must be a direct name", Nam); ! goto Leave; end if; Analyze_Subprogram_Declaration (N); *************** package body Sem_Ch12 is *** 2384,2390 **** Analyze (Prefix (Def)); Valid_Default_Attribute (Nam, Def); ! return; end if; -- Default name may be overloaded, in which case the interpretation --- 2393,2399 ---- Analyze (Prefix (Def)); Valid_Default_Attribute (Nam, Def); ! goto Leave; end if; -- Default name may be overloaded, in which case the interpretation *************** package body Sem_Ch12 is *** 2394,2400 **** -- can be a protected operation. if Etype (Def) = Any_Type then ! return; elsif Nkind (Def) = N_Selected_Component then if not Is_Overloadable (Entity (Selector_Name (Def))) then --- 2403,2409 ---- -- can be a protected operation. if Etype (Def) = Any_Type then ! goto Leave; elsif Nkind (Def) = N_Selected_Component then if not Is_Overloadable (Entity (Selector_Name (Def))) then *************** package body Sem_Ch12 is *** 2408,2422 **** end if; elsif Nkind (Prefix (Def)) = N_Selected_Component then ! if Ekind (Entity (Selector_Name (Prefix (Def)))) ! /= E_Entry_Family then Error_Msg_N ("expect valid subprogram name as default", Def); end if; else Error_Msg_N ("expect valid subprogram name as default", Def); ! return; end if; elsif Nkind (Def) = N_Character_Literal then --- 2417,2431 ---- end if; elsif Nkind (Prefix (Def)) = N_Selected_Component then ! if Ekind (Entity (Selector_Name (Prefix (Def)))) /= ! E_Entry_Family then Error_Msg_N ("expect valid subprogram name as default", Def); end if; else Error_Msg_N ("expect valid subprogram name as default", Def); ! goto Leave; end if; elsif Nkind (Def) = N_Character_Literal then *************** package body Sem_Ch12 is *** 2429,2435 **** or else not Is_Overloadable (Entity (Def)) then Error_Msg_N ("expect valid subprogram name as default", Def); ! return; elsif not Is_Overloaded (Def) then Subp := Entity (Def); --- 2438,2444 ---- or else not Is_Overloadable (Entity (Def)) then Error_Msg_N ("expect valid subprogram name as default", Def); ! goto Leave; elsif not Is_Overloaded (Def) then Subp := Entity (Def); *************** package body Sem_Ch12 is *** 2491,2497 **** end if; end if; end if; ! end Analyze_Formal_Subprogram; ------------------------------------- -- Analyze_Formal_Type_Declaration -- --- 2500,2509 ---- end if; end if; end if; ! ! <> ! Analyze_Aspect_Specifications (N, Nam, Aspect_Specifications (N)); ! end Analyze_Formal_Subprogram_Declaration; ------------------------------------- -- Analyze_Formal_Type_Declaration -- *************** package body Sem_Ch12 is *** 2564,2569 **** --- 2576,2582 ---- end case; Set_Is_Generic_Type (T); + Analyze_Aspect_Specifications (N, T, Aspect_Specifications (N)); end Analyze_Formal_Type_Declaration; ------------------------------------ *************** package body Sem_Ch12 is *** 2592,2598 **** then Error_Msg_N ("premature usage of incomplete type", Def); ! elsif Is_Internal (Designated_Type (T)) then Error_Msg_N ("only a subtype mark is allowed in a formal", Def); end if; --- 2605,2611 ---- then Error_Msg_N ("premature usage of incomplete type", Def); ! elsif not Is_Entity_Name (Subtype_Indication (Def)) then Error_Msg_N ("only a subtype mark is allowed in a formal", Def); end if; *************** package body Sem_Ch12 is *** 2740,2745 **** --- 2753,2760 ---- Check_References (Id); end if; end if; + + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Generic_Package_Declaration; -------------------------------------------- *************** package body Sem_Ch12 is *** 2800,2809 **** --- 2815,2845 ---- if Nkind (Result_Definition (Spec)) = N_Access_Definition then Result_Type := Access_Definition (Spec, Result_Definition (Spec)); Set_Etype (Id, Result_Type); + + -- Check restriction imposed by AI05-073: a generic function + -- cannot return an abstract type or an access to such. + + -- This is a binding interpretation should it apply to earlier + -- versions of Ada as well as Ada 2012??? + + if Is_Abstract_Type (Designated_Type (Result_Type)) + and then Ada_Version >= Ada_2012 + then + Error_Msg_N ("generic function cannot have an access result" + & " that designates an abstract type", Spec); + end if; + else Find_Type (Result_Definition (Spec)); Typ := Entity (Result_Definition (Spec)); + if Is_Abstract_Type (Typ) + and then Ada_Version >= Ada_2012 + then + Error_Msg_N + ("generic function cannot have abstract result type", Spec); + end if; + -- If a null exclusion is imposed on the result type, then create -- a null-excluding itype (an access subtype) and use it as the -- function's Etype. *************** package body Sem_Ch12 is *** 2844,2849 **** --- 2880,2888 ---- End_Scope; Exit_Generic_Scope (Id); Generate_Reference_To_Formals (Id); + + List_Inherited_Pre_Post_Aspects (Id); + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Generic_Subprogram_Declaration; ----------------------------------- *************** package body Sem_Ch12 is *** 2993,2999 **** if Etype (Gen_Unit) = Any_Type then Restore_Env; ! return; elsif Ekind (Gen_Unit) /= E_Generic_Package then --- 3032,3038 ---- if Etype (Gen_Unit) = Any_Type then Restore_Env; ! goto Leave; elsif Ekind (Gen_Unit) /= E_Generic_Package then *************** package body Sem_Ch12 is *** 3008,3014 **** end if; Restore_Env; ! return; end if; if In_Extended_Main_Source_Unit (N) then --- 3047,3053 ---- end if; Restore_Env; ! goto Leave; end if; if In_Extended_Main_Source_Unit (N) then *************** package body Sem_Ch12 is *** 3051,3057 **** if In_Open_Scopes (Gen_Unit) then Error_Msg_NE ("instantiation of & within itself", N, Gen_Unit); Restore_Env; ! return; elsif Contains_Instance_Of (Gen_Unit, Current_Scope, Gen_Id) then Error_Msg_Node_2 := Current_Scope; --- 3090,3096 ---- if In_Open_Scopes (Gen_Unit) then Error_Msg_NE ("instantiation of & within itself", N, Gen_Unit); Restore_Env; ! goto Leave; elsif Contains_Instance_Of (Gen_Unit, Current_Scope, Gen_Id) then Error_Msg_Node_2 := Current_Scope; *************** package body Sem_Ch12 is *** 3059,3065 **** ("circular Instantiation: & instantiated in &!", N, Gen_Unit); Circularity_Detected := True; Restore_Env; ! return; else Gen_Decl := Unit_Declaration_Node (Gen_Unit); --- 3098,3104 ---- ("circular Instantiation: & instantiated in &!", N, Gen_Unit); Circularity_Detected := True; Restore_Env; ! goto Leave; else Gen_Decl := Unit_Declaration_Node (Gen_Unit); *************** package body Sem_Ch12 is *** 3275,3286 **** end if; end; ! -- If we are generating the calling stubs from the instantiation of ! -- a generic RCI package, we will not use the body of the generic ! -- package. if Distribution_Stub_Mode = Generate_Caller_Stub_Body ! and then Is_Compilation_Unit (Defining_Entity (N)) then Needs_Body := False; end if; --- 3314,3326 ---- end if; end; ! -- If we are generating calling stubs, we never need a body for an ! -- instantiation from source. However normal processing occurs for ! -- any generic instantiation appearing in generated code, since we ! -- do not generate stubs in that case. if Distribution_Stub_Mode = Generate_Caller_Stub_Body ! and then Comes_From_Source (N) then Needs_Body := False; end if; *************** package body Sem_Ch12 is *** 3387,3393 **** Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)); end if; end if; --- 3427,3434 ---- Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top, ! Version => Ada_Version)); end if; end if; *************** package body Sem_Ch12 is *** 3515,3520 **** --- 3556,3565 ---- Set_Defining_Identifier (N, Act_Decl_Id); end if; + <> + Analyze_Aspect_Specifications + (N, Act_Decl_Id, Aspect_Specifications (N)); + exception when Instantiation_Error => if Parent_Installed then *************** package body Sem_Ch12 is *** 3540,3547 **** Cunit_Entity (Get_Source_Unit (Gen_Unit)); Curr_Comp : constant Node_Id := Cunit (Current_Sem_Unit); Curr_Scope : Entity_Id := Empty; ! Curr_Unit : constant Entity_Id := ! Cunit_Entity (Current_Sem_Unit); Removed : Boolean := False; Num_Scopes : Int := 0; --- 3585,3591 ---- Cunit_Entity (Get_Source_Unit (Gen_Unit)); Curr_Comp : constant Node_Id := Cunit (Current_Sem_Unit); Curr_Scope : Entity_Id := Empty; ! Curr_Unit : constant Entity_Id := Cunit_Entity (Current_Sem_Unit); Removed : Boolean := False; Num_Scopes : Int := 0; *************** package body Sem_Ch12 is *** 3694,3700 **** Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)), Inlined_Body => True); Pop_Scope; --- 3738,3745 ---- Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top, ! Version => Ada_Version)), Inlined_Body => True); Pop_Scope; *************** package body Sem_Ch12 is *** 3809,3815 **** Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)), Inlined_Body => True); end if; end Inline_Instance_Body; --- 3854,3861 ---- Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top, ! Version => Ada_Version)), Inlined_Body => True); end if; end Inline_Instance_Body; *************** package body Sem_Ch12 is *** 3848,3854 **** Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top)); return True; else return False; --- 3894,3901 ---- Expander_Status => Expander_Active, Current_Sem_Unit => Current_Sem_Unit, Scope_Suppress => Scope_Suppress, ! Local_Suppress_Stack_Top => Local_Suppress_Stack_Top, ! Version => Ada_Version)); return True; else return False; *************** package body Sem_Ch12 is *** 3954,3959 **** --- 4001,4009 ---- Check_Formal_Packages (Pack_Id); Set_Is_Generic_Instance (Pack_Id, False); + -- Why do we clear Is_Generic_Instance??? We set it 20 lines + -- above??? + -- Body of the enclosing package is supplied when instantiating the -- subprogram body, after semantic analysis is completed. *************** package body Sem_Ch12 is *** 3999,4009 **** --- 4049,4062 ---- -- If the instance is a child unit, mark the Id accordingly. Mark -- the anonymous entity as well, which is the real subprogram and -- which is used when the instance appears in a context clause. + -- Similarly, propagate the Is_Eliminated flag to handle properly + -- nested eliminated subprograms. Set_Is_Child_Unit (Act_Decl_Id, Is_Child_Unit (Defining_Entity (N))); Set_Is_Child_Unit (Anon_Id, Is_Child_Unit (Defining_Entity (N))); New_Overloaded_Entity (Act_Decl_Id); Check_Eliminated (Act_Decl_Id); + Set_Is_Eliminated (Anon_Id, Is_Eliminated (Act_Decl_Id)); -- In compilation unit case, kill elaboration checks on the -- instantiation, since they are never needed -- the body is *************** package body Sem_Ch12 is *** 4072,4080 **** -- Verify that it is a generic subprogram of the right kind, and that -- it does not lead to a circular instantiation. ! if Ekind (Gen_Unit) /= E_Generic_Procedure ! and then Ekind (Gen_Unit) /= E_Generic_Function ! then Error_Msg_N ("expect generic subprogram in instantiation", Gen_Id); elsif In_Open_Scopes (Gen_Unit) then --- 4125,4131 ---- -- Verify that it is a generic subprogram of the right kind, and that -- it does not lead to a circular instantiation. ! if not Ekind_In (Gen_Unit, E_Generic_Procedure, E_Generic_Function) then Error_Msg_N ("expect generic subprogram in instantiation", Gen_Id); elsif In_Open_Scopes (Gen_Unit) then *************** package body Sem_Ch12 is *** 4127,4133 **** Error_Msg_NE ("circular Instantiation: & instantiated in &!", N, Gen_Unit); Circularity_Detected := True; ! return; end if; Gen_Decl := Unit_Declaration_Node (Gen_Unit); --- 4178,4184 ---- Error_Msg_NE ("circular Instantiation: & instantiated in &!", N, Gen_Unit); Circularity_Detected := True; ! goto Leave; end if; Gen_Decl := Unit_Declaration_Node (Gen_Unit); *************** package body Sem_Ch12 is *** 4209,4215 **** end if; if Is_Dispatching_Operation (Act_Decl_Id) ! and then Ada_Version >= Ada_05 then declare Formal : Entity_Id; --- 4260,4266 ---- end if; if Is_Dispatching_Operation (Act_Decl_Id) ! and then Ada_Version >= Ada_2005 then declare Formal : Entity_Id; *************** package body Sem_Ch12 is *** 4223,4229 **** then Error_Msg_NE ("access parameter& is controlling,", N, Formal); ! Error_Msg_NE ("\corresponding parameter of & must be" & " explicitly null-excluding", N, Gen_Id); end if; --- 4274,4281 ---- then Error_Msg_NE ("access parameter& is controlling,", N, Formal); ! Error_Msg_NE ! ("\corresponding parameter of & must be" & " explicitly null-excluding", N, Gen_Id); end if; *************** package body Sem_Ch12 is *** 4284,4289 **** --- 4336,4345 ---- Generic_Renamings_HTable.Reset; end if; + <> + Analyze_Aspect_Specifications + (N, Act_Decl_Id, Aspect_Specifications (N)); + exception when Instantiation_Error => if Parent_Installed then *************** package body Sem_Ch12 is *** 4440,4446 **** procedure Check_Access_Definition (N : Node_Id) is begin pragma Assert ! (Ada_Version >= Ada_05 and then Present (Access_Definition (N))); null; end Check_Access_Definition; --- 4496,4502 ---- procedure Check_Access_Definition (N : Node_Id) is begin pragma Assert ! (Ada_Version >= Ada_2005 and then Present (Access_Definition (N))); null; end Check_Access_Definition; *************** package body Sem_Ch12 is *** 4726,4732 **** -- 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 Ada 2005 when the ! -- formal package can be partially parametrized. if Nkind (Unit_Declaration_Node (E1)) = N_Subprogram_Renaming_Declaration --- 4782,4788 ---- -- 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 Ada 2005 when the ! -- formal package can be partially parameterized. if Nkind (Unit_Declaration_Node (E1)) = N_Subprogram_Renaming_Declaration *************** package body Sem_Ch12 is *** 4848,4855 **** --- 4904,4916 ---- -- To detect this case we have to rescan the list of formals, which -- is usually short enough to ignore the resulting inefficiency. + ----------------------------- + -- Denotes_Previous_Actual -- + ----------------------------- + function Denotes_Previous_Actual (Typ : Entity_Id) return Boolean is Prev : Entity_Id; + begin Prev := First_Entity (Instance); while Present (Prev) loop *************** package body Sem_Ch12 is *** 4859,4870 **** --- 4920,4934 ---- and then Entity (Subtype_Indication (Parent (Prev))) = Typ then return True; + elsif Prev = E then return False; + else Next_Entity (Prev); end if; end loop; + return False; end Denotes_Previous_Actual; *************** package body Sem_Ch12 is *** 5243,5248 **** --- 5307,5331 ---- then Install_Parent (Inst_Par); Parent_Installed := True; + + -- The generic unit may be the renaming of the implicit child + -- present in an instance. In that case the parent instance is + -- obtained from the name of the renamed entity. + + elsif Ekind (Entity (Gen_Id)) = E_Generic_Package + and then Present (Renamed_Entity (Entity (Gen_Id))) + and then Is_Child_Unit (Renamed_Entity (Entity (Gen_Id))) + then + declare + Renamed_Package : constant Node_Id := + Name (Parent (Entity (Gen_Id))); + begin + if Nkind (Renamed_Package) = N_Expanded_Name then + Inst_Par := Entity (Prefix (Renamed_Package)); + Install_Parent (Inst_Par); + Parent_Installed := True; + end if; + end; end if; end if; *************** package body Sem_Ch12 is *** 5418,5423 **** --- 5501,5507 ---- and then Is_Private_Type (Designated_Type (T)) and then not Has_Private_View (N) and then Present (Full_View (Designated_Type (T))) + and then Used_As_Generic_Actual (T) then Switch_View (Designated_Type (T)); *************** package body Sem_Ch12 is *** 5713,5718 **** --- 5797,5810 ---- New_N := New_Copy (N); + -- Copy aspects if present + + if Has_Aspects (N) then + Set_Has_Aspects (New_N, False); + Set_Aspect_Specifications + (New_N, Copy_Generic_List (Aspect_Specifications (N), Parent_Id)); + end if; + if Instantiating then Adjust_Instantiation_Sloc (New_N, S_Adjustment); end if; *************** package body Sem_Ch12 is *** 5874,5880 **** -- 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 permissible system might defer this analysis to the point -- of instantiation, but this seems to complicated for now. if not Instantiating then --- 5966,5972 ---- -- 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 permissive system might defer this analysis to the point -- of instantiation, but this seems to complicated for now. if not Instantiating then *************** package body Sem_Ch12 is *** 5885,5896 **** --- 5977,5995 ---- New_Body : Node_Id; begin + -- Make sure that, if it is a subunit of the main unit that is + -- preprocessed and if -gnateG is specified, the preprocessed + -- file will be written. + + Lib.Analysing_Subunit_Of_Main := + Lib.In_Extended_Main_Source_Unit (N); Unum := Load_Unit (Load_Name => Subunit_Name, Required => False, Subunit => True, Error_Node => N); + Lib.Analysing_Subunit_Of_Main := False; -- If the proper body is not found, a warning message will be -- emitted when analyzing the stub, or later at the point *************** package body Sem_Ch12 is *** 6141,6155 **** end if; end; ! elsif Nkind_In (N, N_Integer_Literal, ! N_Real_Literal, ! N_String_Literal) ! then -- No descendant fields need traversing null; ! -- For the remaining nodes, copy recursively their descendants else Copy_Descendants; --- 6240,6264 ---- end if; end; ! elsif Nkind_In (N, N_Integer_Literal, N_Real_Literal) then ! -- No descendant fields need traversing null; ! elsif Nkind (N) = N_String_Literal ! and then Present (Etype (N)) ! and then Instantiating ! then ! -- If the string is declared in an outer scope, the string_literal ! -- subtype created for it may have the wrong scope. We force the ! -- reanalysis of the constant to generate a new itype in the proper ! -- context. ! ! Set_Etype (New_N, Empty); ! Set_Analyzed (New_N, False); ! ! -- For the remaining nodes, copy their descendants recursively else Copy_Descendants; *************** package body Sem_Ch12 is *** 7853,7860 **** if not Box_Present (Formal) then declare I_Pack : constant Entity_Id := ! Make_Defining_Identifier (Sloc (Actual), ! Chars => New_Internal_Name ('P')); begin Set_Is_Internal (I_Pack); --- 7962,7968 ---- if not Box_Present (Formal) then declare I_Pack : constant Entity_Id := ! Make_Temporary (Sloc (Actual), 'P'); begin Set_Is_Internal (I_Pack); *************** package body Sem_Ch12 is *** 8153,8161 **** -- to prevent freezing anomalies. declare ! Anon_Id : constant Entity_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('E')); begin Set_Defining_Unit_Name (New_Spec, Anon_Id); Insert_Before (Instantiation_Node, Decl_Node); --- 8261,8268 ---- -- to prevent freezing anomalies. declare ! Anon_Id : constant Entity_Id := Make_Temporary (Loc, 'E'); ! begin Set_Defining_Unit_Name (New_Spec, Anon_Id); Insert_Before (Instantiation_Node, Decl_Node); *************** package body Sem_Ch12 is *** 8185,8201 **** Actual : Node_Id; Analyzed_Formal : Node_Id) return List_Id is Acc_Def : Node_Id := Empty; Act_Assoc : constant Node_Id := Parent (Actual); Actual_Decl : Node_Id := Empty; - Formal_Id : constant Entity_Id := Defining_Identifier (Formal); Decl_Node : Node_Id; Def : Node_Id; Ftyp : Entity_Id; List : constant List_Id := New_List; Loc : constant Source_Ptr := Sloc (Actual); ! Orig_Ftyp : constant Entity_Id := ! Etype (Defining_Identifier (Analyzed_Formal)); Subt_Decl : Node_Id := Empty; Subt_Mark : Node_Id := Empty; --- 8292,8309 ---- Actual : Node_Id; Analyzed_Formal : Node_Id) return List_Id is + Gen_Obj : constant Entity_Id := Defining_Identifier (Formal); + A_Gen_Obj : constant Entity_Id := + Defining_Identifier (Analyzed_Formal); Acc_Def : Node_Id := Empty; Act_Assoc : constant Node_Id := Parent (Actual); Actual_Decl : Node_Id := Empty; Decl_Node : Node_Id; Def : Node_Id; Ftyp : Entity_Id; List : constant List_Id := New_List; Loc : constant Source_Ptr := Sloc (Actual); ! Orig_Ftyp : constant Entity_Id := Etype (A_Gen_Obj); Subt_Decl : Node_Id := Empty; Subt_Mark : Node_Id := Empty; *************** package body Sem_Ch12 is *** 8209,8217 **** -- Sloc for error message on missing actual ! Error_Msg_Sloc := Sloc (Scope (Defining_Identifier (Analyzed_Formal))); ! if Get_Instance_Of (Formal_Id) /= Formal_Id then Error_Msg_N ("duplicate instantiation of generic parameter", Actual); end if; --- 8317,8325 ---- -- Sloc for error message on missing actual ! Error_Msg_Sloc := Sloc (Scope (A_Gen_Obj)); ! if Get_Instance_Of (Gen_Obj) /= Gen_Obj then Error_Msg_N ("duplicate instantiation of generic parameter", Actual); end if; *************** package body Sem_Ch12 is *** 8232,8256 **** if No (Actual) then Error_Msg_NE ("missing actual&", ! Instantiation_Node, Formal_Id); Error_Msg_NE ("\in instantiation of & declared#", ! Instantiation_Node, ! Scope (Defining_Identifier (Analyzed_Formal))); Abandon_Instantiation (Instantiation_Node); end if; if Present (Subt_Mark) then Decl_Node := Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => New_Copy (Formal_Id), Subtype_Mark => New_Copy_Tree (Subt_Mark), Name => Actual); else pragma Assert (Present (Acc_Def)); Decl_Node := Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => New_Copy (Formal_Id), Access_Definition => New_Copy_Tree (Acc_Def), Name => Actual); end if; --- 8340,8363 ---- if No (Actual) then Error_Msg_NE ("missing actual&", ! Instantiation_Node, Gen_Obj); Error_Msg_NE ("\in instantiation of & declared#", ! Instantiation_Node, Scope (A_Gen_Obj)); Abandon_Instantiation (Instantiation_Node); end if; if Present (Subt_Mark) then Decl_Node := Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => New_Copy (Gen_Obj), Subtype_Mark => New_Copy_Tree (Subt_Mark), Name => Actual); else pragma Assert (Present (Acc_Def)); Decl_Node := Make_Object_Renaming_Declaration (Loc, ! Defining_Identifier => New_Copy (Gen_Obj), Access_Definition => New_Copy_Tree (Acc_Def), Name => Actual); end if; *************** package body Sem_Ch12 is *** 8283,8293 **** end if; -- The actual has to be resolved in order to check that it is a ! -- variable (due to cases such as F(1), where F returns ! -- access to an array, and for overloaded prefixes). ! Ftyp := ! Get_Instance_Of (Etype (Defining_Identifier (Analyzed_Formal))); if Is_Private_Type (Ftyp) and then not Is_Private_Type (Etype (Actual)) --- 8390,8417 ---- end if; -- The actual has to be resolved in order to check that it is a ! -- variable (due to cases such as F (1), where F returns access to an ! -- array, and for overloaded prefixes). ! Ftyp := Get_Instance_Of (Etype (A_Gen_Obj)); ! ! -- If the type of the formal is not itself a formal, and the ! -- current unit is a child unit, the formal type must be declared ! -- in a parent, and must be retrieved by visibility. ! ! if Ftyp = Orig_Ftyp ! and then Is_Generic_Unit (Scope (Ftyp)) ! and then Is_Child_Unit (Scope (A_Gen_Obj)) ! then ! declare ! Temp : constant Node_Id := ! New_Copy_Tree (Subtype_Mark (Analyzed_Formal)); ! begin ! Set_Entity (Temp, Empty); ! Find_Type (Temp); ! Ftyp := Entity (Temp); ! end; ! end if; if Is_Private_Type (Ftyp) and then not Is_Private_Type (Etype (Actual)) *************** package body Sem_Ch12 is *** 8302,8309 **** Subt_Decl := Make_Subtype_Declaration (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, New_Internal_Name ('P')), Subtype_Indication => New_Occurrence_Of (Ftyp, Loc)); Prepend (Subt_Decl, List); --- 8426,8432 ---- Subt_Decl := Make_Subtype_Declaration (Loc, ! Defining_Identifier => Make_Temporary (Loc, 'P'), Subtype_Indication => New_Occurrence_Of (Ftyp, Loc)); Prepend (Subt_Decl, List); *************** package body Sem_Ch12 is *** 8316,8322 **** if not Denotes_Variable (Actual) then Error_Msg_NE ! ("actual for& must be a variable", Actual, Formal_Id); elsif Base_Type (Ftyp) /= Base_Type (Etype (Actual)) then --- 8439,8445 ---- if not Denotes_Variable (Actual) then Error_Msg_NE ! ("actual for& must be a variable", Actual, Gen_Obj); elsif Base_Type (Ftyp) /= Base_Type (Etype (Actual)) then *************** package body Sem_Ch12 is *** 8324,8330 **** -- the type of the actual shall resolve to a specific anonymous -- access type. ! if Ada_Version < Ada_05 or else Ekind (Base_Type (Ftyp)) /= E_Anonymous_Access_Type --- 8447,8453 ---- -- the type of the actual shall resolve to a specific anonymous -- access type. ! if Ada_Version < Ada_2005 or else Ekind (Base_Type (Ftyp)) /= E_Anonymous_Access_Type *************** package body Sem_Ch12 is *** 8333,8339 **** E_Anonymous_Access_Type then Error_Msg_NE ("type of actual does not match type of&", ! Actual, Formal_Id); end if; end if; --- 8456,8462 ---- E_Anonymous_Access_Type then Error_Msg_NE ("type of actual does not match type of&", ! Actual, Gen_Obj); end if; end if; *************** package body Sem_Ch12 is *** 8372,8378 **** Decl_Node := Make_Object_Declaration (Loc, ! Defining_Identifier => New_Copy (Formal_Id), Constant_Present => True, Null_Exclusion_Present => Null_Exclusion_Present (Formal), Object_Definition => New_Copy_Tree (Def), --- 8495,8501 ---- Decl_Node := Make_Object_Declaration (Loc, ! Defining_Identifier => New_Copy (Gen_Obj), Constant_Present => True, Null_Exclusion_Present => Null_Exclusion_Present (Formal), Object_Definition => New_Copy_Tree (Def), *************** package body Sem_Ch12 is *** 8383,8391 **** -- A generic formal object of a tagged type is defined to be -- aliased so the new constant must also be treated as aliased. ! if Is_Tagged_Type ! (Etype (Defining_Identifier (Analyzed_Formal))) ! then Set_Aliased_Present (Decl_Node); end if; --- 8506,8512 ---- -- A generic formal object of a tagged type is defined to be -- aliased so the new constant must also be treated as aliased. ! if Is_Tagged_Type (Etype (A_Gen_Obj)) then Set_Aliased_Present (Decl_Node); end if; *************** package body Sem_Ch12 is *** 8405,8415 **** end if; declare ! Formal_Object : constant Entity_Id := ! Defining_Identifier (Analyzed_Formal); ! Formal_Type : constant Entity_Id := Etype (Formal_Object); ! ! Typ : Entity_Id; begin Typ := Get_Instance_Of (Formal_Type); --- 8526,8533 ---- end if; declare ! Formal_Type : constant Entity_Id := Etype (A_Gen_Obj); ! Typ : Entity_Id; begin Typ := Get_Instance_Of (Formal_Type); *************** package body Sem_Ch12 is *** 8446,8452 **** Decl_Node := Make_Object_Declaration (Sloc (Formal), ! Defining_Identifier => New_Copy (Formal_Id), Constant_Present => True, Null_Exclusion_Present => Null_Exclusion_Present (Formal), Object_Definition => New_Copy (Def), --- 8564,8570 ---- Decl_Node := Make_Object_Declaration (Sloc (Formal), ! Defining_Identifier => New_Copy (Gen_Obj), Constant_Present => True, Null_Exclusion_Present => Null_Exclusion_Present (Formal), Object_Definition => New_Copy (Def), *************** package body Sem_Ch12 is *** 8459,8472 **** else Error_Msg_NE ("missing actual&", ! Instantiation_Node, Formal_Id); Error_Msg_NE ("\in instantiation of & declared#", ! Instantiation_Node, ! Scope (Defining_Identifier (Analyzed_Formal))); - if Is_Scalar_Type - (Etype (Defining_Identifier (Analyzed_Formal))) - then -- Create dummy constant declaration so that instance can be -- analyzed, to minimize cascaded visibility errors. --- 8577,8588 ---- else Error_Msg_NE ("missing actual&", ! Instantiation_Node, Gen_Obj); Error_Msg_NE ("\in instantiation of & declared#", ! Instantiation_Node, Scope (A_Gen_Obj)); ! ! if Is_Scalar_Type (Etype (A_Gen_Obj)) then -- Create dummy constant declaration so that instance can be -- analyzed, to minimize cascaded visibility errors. *************** package body Sem_Ch12 is *** 8478,8489 **** Decl_Node := Make_Object_Declaration (Loc, ! Defining_Identifier => New_Copy (Formal_Id), Constant_Present => True, Null_Exclusion_Present => Null_Exclusion_Present (Formal), Object_Definition => New_Copy (Def), Expression => ! Make_Attribute_Reference (Sloc (Formal_Id), Attribute_Name => Name_First, Prefix => New_Copy (Def))); --- 8594,8605 ---- Decl_Node := Make_Object_Declaration (Loc, ! Defining_Identifier => New_Copy (Gen_Obj), Constant_Present => True, Null_Exclusion_Present => Null_Exclusion_Present (Formal), Object_Definition => New_Copy (Def), Expression => ! Make_Attribute_Reference (Sloc (Gen_Obj), Attribute_Name => Name_First, Prefix => New_Copy (Def))); *************** package body Sem_Ch12 is *** 8509,8515 **** -- Otherwise, the subtype of the actual matching the formal object -- declaration shall exclude null. ! if Ada_Version >= Ada_05 and then Present (Actual_Decl) and then Nkind_In (Actual_Decl, N_Formal_Object_Declaration, --- 8625,8631 ---- -- Otherwise, the subtype of the actual matching the formal object -- declaration shall exclude null. ! if Ada_Version >= Ada_2005 and then Present (Actual_Decl) and then Nkind_In (Actual_Decl, N_Formal_Object_Declaration, *************** package body Sem_Ch12 is *** 8576,8581 **** --- 8692,8698 ---- Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top; Scope_Suppress := Body_Info.Scope_Suppress; + Opt.Ada_Version := Body_Info.Version; if No (Gen_Body_Id) then Load_Parent_Of_Generic *************** package body Sem_Ch12 is *** 8732,8742 **** -- If we have no body, and the unit requires a body, then complain. This -- complaint is suppressed if we have detected other errors (since a -- common reason for missing the body is that it had errors). elsif Unit_Requires_Body (Gen_Unit) and then not Body_Optional then ! if Serious_Errors_Detected = 0 then Error_Msg_NE ("cannot find body of generic package &", Inst_Node, Gen_Unit); --- 8849,8864 ---- -- If we have no body, and the unit requires a body, then complain. This -- complaint is suppressed if we have detected other errors (since a -- common reason for missing the body is that it had errors). + -- In CodePeer mode, a warning has been emitted already, no need for + -- further messages. elsif Unit_Requires_Body (Gen_Unit) and then not Body_Optional then ! if CodePeer_Mode then ! null; ! ! elsif Serious_Errors_Detected = 0 then Error_Msg_NE ("cannot find body of generic package &", Inst_Node, Gen_Unit); *************** package body Sem_Ch12 is *** 8832,8837 **** --- 8954,8960 ---- Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top; Scope_Suppress := Body_Info.Scope_Suppress; + Opt.Ada_Version := Body_Info.Version; if No (Gen_Body_Id) then *************** package body Sem_Ch12 is *** 9213,9220 **** elsif Ekind (A_Gen_T) = E_General_Access_Type and then Ekind (Base_Type (Act_T)) /= E_General_Access_Type then ! Error_Msg_N ("actual must be general access type!", Actual); ! Error_Msg_NE ("add ALL to }!", Actual, Act_T); Abandon_Instantiation (Actual); end if; end if; --- 9336,9345 ---- elsif Ekind (A_Gen_T) = E_General_Access_Type and then Ekind (Base_Type (Act_T)) /= E_General_Access_Type then ! Error_Msg_N -- CODEFIX ! ("actual must be general access type!", Actual); ! Error_Msg_NE -- CODEFIX ! ("add ALL to }!", Actual, Act_T); Abandon_Instantiation (Actual); end if; end if; *************** package body Sem_Ch12 is *** 9330,9336 **** I2 := First_Index (Act_T); for J in 1 .. Formal_Dimensions loop ! -- If the indices of the actual were given by a subtype_mark, -- the index was transformed into a range attribute. Retrieve -- the original type mark for checking. --- 9455,9461 ---- I2 := First_Index (Act_T); for J in 1 .. Formal_Dimensions loop ! -- If the indexes of the actual were given by a subtype_mark, -- the index was transformed into a range attribute. Retrieve -- the original type mark for checking. *************** package body Sem_Ch12 is *** 9519,9525 **** -- Ada 2005 (AI-251) ! if Ada_Version >= Ada_05 and then Is_Interface (Ancestor) then if not Interface_Present_In_Ancestor (Act_T, Ancestor) then --- 9644,9650 ---- -- Ada 2005 (AI-251) ! if Ada_Version >= Ada_2005 and then Is_Interface (Ancestor) then if not Interface_Present_In_Ancestor (Act_T, Ancestor) then *************** package body Sem_Ch12 is *** 9539,9545 **** -- that the formal type declaration has been rewritten as a private -- extension. ! if Ada_Version >= Ada_05 and then Nkind (Parent (A_Gen_T)) = N_Private_Extension_Declaration and then Synchronized_Present (Parent (A_Gen_T)) then --- 9664,9670 ---- -- that the formal type declaration has been rewritten as a private -- extension. ! if Ada_Version >= Ada_2005 and then Nkind (Parent (A_Gen_T)) = N_Private_Extension_Declaration and then Synchronized_Present (Parent (A_Gen_T)) then *************** package body Sem_Ch12 is *** 9843,9851 **** -- then so far the subprograms correspond, so -- now check that any result types correspond. ! if No (Anc_Formal) ! and then No (Act_Formal) ! then Subprograms_Correspond := True; if Ekind (Act_Subp) = E_Function then --- 9968,9974 ---- -- then so far the subprograms correspond, so -- now check that any result types correspond. ! if No (Anc_Formal) and then No (Act_Formal) then Subprograms_Correspond := True; if Ekind (Act_Subp) = E_Function then *************** package body Sem_Ch12 is *** 9923,9934 **** -- interface then the generic formal is not unless declared -- explicitly so. If not declared limited, the actual cannot be -- limited (see AI05-0087). ! -- Disable check for now, limited interfaces implemented by ! -- protected types are common, Need to update tests ??? 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, --- 10046,10059 ---- -- interface then the generic formal is not unless declared -- explicitly so. If not declared limited, the actual cannot be -- limited (see AI05-0087). ! ! -- Even though this AI is a binding interpretation, we enable the ! -- check only in Ada 2012 mode, because this improper construct ! -- shows up in user code and in existing B-tests. if Is_Limited_Type (Act_T) and then not Is_Limited_Type (A_Gen_T) ! and then Ada_Version >= Ada_2012 then Error_Msg_NE ("actual for non-limited & cannot be a limited type", Actual, *************** package body Sem_Ch12 is *** 10297,10302 **** --- 10422,10431 ---- -- parent, but the analyzed formal that includes the interface -- operations of all its progenitors. + -- Same treatment for formal private types, so we can check whether the + -- type is tagged limited when validating derivations in the private + -- part. (See AI05-096). + if Nkind (Def) = N_Formal_Derived_Type_Definition then if Present (Interface_List (Def)) then Set_Generic_Parent_Type (Decl_Node, A_Gen_T); *************** package body Sem_Ch12 is *** 10305,10311 **** end if; elsif Nkind (Def) = N_Formal_Private_Type_Definition then ! Set_Generic_Parent_Type (Decl_Node, Ancestor); end if; -- If the actual is a synchronized type that implements an interface, --- 10434,10440 ---- end if; elsif Nkind (Def) = N_Formal_Private_Type_Definition then ! Set_Generic_Parent_Type (Decl_Node, A_Gen_T); end if; -- If the actual is a synchronized type that implements an interface, *************** package body Sem_Ch12 is *** 10327,10334 **** Corr_Decl : Node_Id; begin ! New_Corr := Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); Corr_Decl := Make_Subtype_Declaration (Loc, Defining_Identifier => New_Corr, --- 10456,10462 ---- Corr_Decl : Node_Id; begin ! New_Corr := Make_Temporary (Loc, 'S'); Corr_Decl := Make_Subtype_Declaration (Loc, Defining_Identifier => New_Corr, *************** package body Sem_Ch12 is *** 10351,10379 **** return Decl_Nodes; end Instantiate_Type; - ----------------------- - -- Is_Generic_Formal -- - ----------------------- - - function Is_Generic_Formal (E : Entity_Id) return Boolean is - Kind : Node_Kind; - begin - if No (E) then - return False; - else - Kind := Nkind (Parent (E)); - return - Nkind_In (Kind, N_Formal_Object_Declaration, - N_Formal_Package_Declaration, - N_Formal_Type_Declaration) - or else - (Is_Formal_Subprogram (E) - and then - Nkind (Parent (Parent (E))) in - N_Formal_Subprogram_Declaration); - end if; - end Is_Generic_Formal; - --------------------- -- Is_In_Main_Unit -- --------------------- --- 10479,10484 ---- *************** package body Sem_Ch12 is *** 10434,10441 **** -- 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. This process is applied ! -- to both package and subprogram instances. -------------------------------- -- Collect_Previous_Instances -- --- 10539,10546 ---- -- 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. This process is applied to ! -- both package and subprogram instances. -------------------------------- -- Collect_Previous_Instances -- *************** package body Sem_Ch12 is *** 10480,10489 **** --- 10585,10602 ---- Collect_Previous_Instances (Private_Declarations (Specification (Decl))); + -- Previous non-generic bodies may contain instances as well + elsif Nkind (Decl) = N_Package_Body and then Ekind (Corresponding_Spec (Decl)) /= E_Generic_Package then Collect_Previous_Instances (Declarations (Decl)); + + elsif Nkind (Decl) = N_Subprogram_Body + and then not Acts_As_Spec (Decl) + and then not Is_Generic_Subprogram (Corresponding_Spec (Decl)) + then + Collect_Previous_Instances (Declarations (Decl)); end if; Next (Decl); *************** package body Sem_Ch12 is *** 10577,10585 **** -- enclosing body. Because the generic body we need may use -- global entities declared in the enclosing package (including -- aggregates) it is in general necessary to compile this body ! -- with expansion enabled. The exception is if we are within a ! -- generic package, in which case the usual generic rule ! -- applies. declare Exp_Status : Boolean := True; --- 10690,10697 ---- -- enclosing body. Because the generic body we need may use -- global entities declared in the enclosing package (including -- aggregates) it is in general necessary to compile this body ! -- with expansion enabled, except if we are within a generic ! -- package, in which case the usual generic rule applies. declare Exp_Status : Boolean := True; *************** package body Sem_Ch12 is *** 10648,10654 **** Get_Code_Unit (Sloc (Node (Decl))), Scope_Suppress => Scope_Suppress, Local_Suppress_Stack_Top => ! Local_Suppress_Stack_Top); -- Package instance --- 10760,10767 ---- Get_Code_Unit (Sloc (Node (Decl))), Scope_Suppress => Scope_Suppress, Local_Suppress_Stack_Top => ! Local_Suppress_Stack_Top, ! Version => Ada_Version); -- Package instance *************** package body Sem_Ch12 is *** 10688,10694 **** Get_Code_Unit (Sloc (Inst_Node)), Scope_Suppress => Scope_Suppress, Local_Suppress_Stack_Top => ! Local_Suppress_Stack_Top)), Body_Optional => Body_Optional); end; end if; --- 10801,10808 ---- Get_Code_Unit (Sloc (Inst_Node)), Scope_Suppress => Scope_Suppress, Local_Suppress_Stack_Top => ! Local_Suppress_Stack_Top, ! Version => Ada_Version)), Body_Optional => Body_Optional); end; end if; *************** package body Sem_Ch12 is *** 10711,10721 **** Get_Body_Name (Get_Unit_Name (Unit (Comp_Unit))); begin ! Error_Msg_Unit_1 := Bname; ! Error_Msg_N ("this instantiation requires$!", N); ! Error_Msg_File_1 := Get_File_Name (Bname, Subunit => False); ! Error_Msg_N ("\but file{ was not found!", N); ! raise Unrecoverable_Error; end; end if; end if; --- 10825,10844 ---- Get_Body_Name (Get_Unit_Name (Unit (Comp_Unit))); begin ! -- In CodePeer mode, the missing body may make the analysis ! -- incomplete, but we do not treat it as fatal. ! ! if CodePeer_Mode then ! return; ! ! else ! Error_Msg_Unit_1 := Bname; ! Error_Msg_N ("this instantiation requires$!", N); ! Error_Msg_File_1 := ! Get_File_Name (Bname, Subunit => False); ! Error_Msg_N ("\but file{ was not found!", N); ! raise Unrecoverable_Error; ! end if; end; end if; end if; *************** package body Sem_Ch12 is *** 11042,11047 **** --- 11165,11171 ---- -- stack contains the parent instances of the instantiation, followed by -- the original S. + Cur_P : Entity_Id; E : Entity_Id; P : Entity_Id; Hidden : Elmt_Id; *************** package body Sem_Ch12 is *** 11064,11072 **** Next_Entity (E); end loop; ! if Is_Generic_Instance (Current_Scope) ! and then P /= Current_Scope ! then -- We are within an instance of some sibling. Retain -- visibility of parent, for proper subsequent cleanup, and -- reinstall private declarations as well. --- 11188,11205 ---- Next_Entity (E); end loop; ! -- If instantiation is declared in a block, it is the enclosing ! -- scope that might be a parent instance. Note that only one ! -- block can be involved, because the parent instances have ! -- been installed within it. ! ! if Ekind (P) = E_Block then ! Cur_P := Scope (P); ! else ! Cur_P := P; ! end if; ! ! if Is_Generic_Instance (Cur_P) and then P /= Current_Scope then -- We are within an instance of some sibling. Retain -- visibility of parent, for proper subsequent cleanup, and -- reinstall private declarations as well. *************** package body Sem_Ch12 is *** 11076,11082 **** end if; -- If the ultimate parent is a top-level unit recorded in ! -- Instance_Parent_Unit, then reset its visibility to what is was -- before instantiation. (It's not clear what the purpose is of -- testing whether Scope (P) is In_Open_Scopes, but that test was -- present before the ultimate parent test was added.???) --- 11209,11215 ---- end if; -- If the ultimate parent is a top-level unit recorded in ! -- Instance_Parent_Unit, then reset its visibility to what it was -- before instantiation. (It's not clear what the purpose is of -- testing whether Scope (P) is In_Open_Scopes, but that test was -- present before the ultimate parent test was added.???) *************** package body Sem_Ch12 is *** 11219,11233 **** while Present (M) loop Typ := Node (M); ! -- Subtypes of types whose views have been exchanged, and that ! -- are defined within the instance, were not on the list of ! -- Private_Dependents on entry to the instance, so they have to be ! -- exchanged explicitly now, in order to remain consistent with the ! -- view of the parent type. ! if Ekind (Typ) = E_Private_Type ! or else Ekind (Typ) = E_Limited_Private_Type ! or else Ekind (Typ) = E_Record_Type_With_Private then Dep_Elmt := First_Elmt (Private_Dependents (Typ)); while Present (Dep_Elmt) loop --- 11352,11366 ---- while Present (M) loop Typ := Node (M); ! -- Subtypes of types whose views have been exchanged, and that are ! -- defined within the instance, were not on the Private_Dependents ! -- list on entry to the instance, so they have to be exchanged ! -- explicitly now, in order to remain consistent with the view of the ! -- parent type. ! if Ekind_In (Typ, E_Private_Type, ! E_Limited_Private_Type, ! E_Record_Type_With_Private) then Dep_Elmt := First_Elmt (Private_Dependents (Typ)); while Present (Dep_Elmt) loop *************** package body Sem_Ch12 is *** 11267,11277 **** -- An unusual case of aliasing: the actual may also be directly -- visible in the generic, and be private there, while it is fully -- visible in the context of the instance. The internal subtype ! -- is private in the instance, but has full visibility like its -- parent in the enclosing scope. This enforces the invariant that -- the privacy status of all private dependents of a type coincide -- with that of the parent type. This can only happen when a ! -- generic child unit is instantiated within sibling. if Is_Private_Type (E) and then not Is_Private_Type (Etype (E)) --- 11400,11410 ---- -- An unusual case of aliasing: the actual may also be directly -- visible in the generic, and be private there, while it is fully -- visible in the context of the instance. The internal subtype ! -- is private in the instance but has full visibility like its -- parent in the enclosing scope. This enforces the invariant that -- the privacy status of all private dependents of a type coincide -- with that of the parent type. This can only happen when a ! -- generic child unit is instantiated within a sibling. if Is_Private_Type (E) and then not Is_Private_Type (Etype (E)) *************** package body Sem_Ch12 is *** 11287,11302 **** -- a formal package, make its own formals private as well. The -- 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. -- If the actual is itself a formal package for the enclosing -- generic, or the actual for such a formal package, it remains -- visible on exit from the instance, and therefore nothing needs -- to be done either, except to keep it accessible. ! if Is_Package ! and then Renamed_Object (E) = Pack_Id ! then exit; elsif Nkind (Parent (E)) /= N_Package_Renaming_Declaration then --- 11420,11433 ---- -- a formal package, make its own formals private as well. The -- 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 it. -- If the actual is itself a formal package for the enclosing -- generic, or the actual for such a formal package, it remains -- visible on exit from the instance, and therefore nothing needs -- to be done either, except to keep it accessible. ! if Is_Package and then Renamed_Object (E) = Pack_Id then exit; elsif Nkind (Parent (E)) /= N_Package_Renaming_Declaration then *************** package body Sem_Ch12 is *** 11550,11564 **** N2 := Get_Associated_Node (N); E := Entity (N2); if Present (E) then if Is_Global (E) then Set_Global_Type (N, N2); elsif Nkind (N) = N_Op_Concat and then Is_Generic_Type (Etype (N2)) ! and then ! (Base_Type (Etype (Right_Opnd (N2))) = Etype (N2) ! or else Base_Type (Etype (Left_Opnd (N2))) = Etype (N2)) and then Is_Intrinsic_Subprogram (E) then null; --- 11681,11709 ---- N2 := Get_Associated_Node (N); E := Entity (N2); + -- If the entity is an itype created as a subtype of an access type + -- with a null exclusion restore source entity for proper visibility. + -- The itype will be created anew in the instance. + if Present (E) then + if Is_Itype (E) + and then Ekind (E) = E_Access_Subtype + and then Is_Entity_Name (N) + and then Chars (Etype (E)) = Chars (N) + then + E := Etype (E); + Set_Entity (N2, E); + Set_Etype (N2, E); + end if; + if Is_Global (E) then Set_Global_Type (N, N2); elsif Nkind (N) = N_Op_Concat and then Is_Generic_Type (Etype (N2)) ! and then (Base_Type (Etype (Right_Opnd (N2))) = Etype (N2) ! or else ! Base_Type (Etype (Left_Opnd (N2))) = Etype (N2)) and then Is_Intrinsic_Subprogram (E) then null; *************** package body Sem_Ch12 is *** 11801,11811 **** and then Is_Generic_Unit (Scope (Gen_Id)) and then In_Open_Scopes (Scope (Gen_Id)) then ! -- This is an instantiation of a child unit within a sibling, ! -- so that the generic parent is in scope. An eventual instance ! -- must occur within the scope of an instance of the parent. ! -- Make name in instance into an expanded name, to preserve the ! -- identifier of the parent, so it can be resolved subsequently. Rewrite (Name (N2), Make_Expanded_Name (Loc, --- 11946,11956 ---- and then Is_Generic_Unit (Scope (Gen_Id)) and then In_Open_Scopes (Scope (Gen_Id)) then ! -- This is an instantiation of a child unit within a sibling, so ! -- that the generic parent is in scope. An eventual instance must ! -- occur within the scope of an instance of the parent. Make name ! -- in instance into an expanded name, to preserve the identifier ! -- of the parent, so it can be resolved subsequently. Rewrite (Name (N2), Make_Expanded_Name (Loc, *************** package body Sem_Ch12 is *** 12023,12040 **** elsif Nkind (N2) = N_Explicit_Dereference then -- An identifier is rewritten as a dereference if it is the ! -- prefix in an implicit dereference. ! ! -- Check whether corresponding entity in prefix is global if Is_Entity_Name (Prefix (N2)) and then Present (Entity (Prefix (N2))) and then Is_Global (Entity (Prefix (N2))) then ! Rewrite (N, ! Make_Explicit_Dereference (Loc, ! Prefix => ! New_Occurrence_Of (Entity (Prefix (N2)), Loc))); elsif Nkind (Prefix (N2)) = N_Function_Call and then Is_Global (Entity (Name (Prefix (N2)))) then --- 12168,12184 ---- elsif Nkind (N2) = N_Explicit_Dereference then -- An identifier is rewritten as a dereference if it is the ! -- prefix in an implicit dereference (call or attribute). ! -- The analysis of an instantiation will expand the node ! -- again, so we preserve the original tree but link it to ! -- the resolved entity in case it is global. if Is_Entity_Name (Prefix (N2)) and then Present (Entity (Prefix (N2))) and then Is_Global (Entity (Prefix (N2))) then ! Set_Associated_Node (N, Prefix (N2)); ! elsif Nkind (Prefix (N2)) = N_Function_Call and then Is_Global (Entity (Name (Prefix (N2)))) then *************** package body Sem_Ch12 is *** 12156,12161 **** --- 12300,12325 ---- -- All other cases than aggregates else + -- For pragmas, we propagate the Enabled status for the + -- relevant pragmas to the original generic tree. This was + -- originally needed for SCO generation. It is no longer + -- needed there (since we use the Sloc value in calls to + -- Set_SCO_Pragma_Enabled), but it seems a generally good + -- idea to have this flag set properly. + + if Nkind (N) = N_Pragma + and then + (Pragma_Name (N) = Name_Assert or else + Pragma_Name (N) = Name_Check or else + Pragma_Name (N) = Name_Precondition or else + Pragma_Name (N) = Name_Postcondition) + and then Present (Associated_Node (Pragma_Identifier (N))) + then + Set_Pragma_Enabled (N, + Pragma_Enabled + (Parent (Associated_Node (Pragma_Identifier (N))))); + end if; + Save_Global_Descendant (Field1 (N)); Save_Global_Descendant (Field2 (N)); Save_Global_Descendant (Field3 (N)); *************** package body Sem_Ch12 is *** 12237,12255 **** Act_Unit : Entity_Id) is begin ! -- Regardless of the current mode, predefined units are analyzed in ! -- the most current Ada mode, and earlier version Ada checks do not ! -- apply to predefined units. Nothing needs to be done for non-internal ! -- units. These are always analyzed in the current mode. if Is_Internal_File_Name ! (Fname => Unit_File_Name (Get_Source_Unit (Gen_Unit)), ! Renamings_Included => True) then Set_Opt_Config_Switches (True, Current_Sem_Unit = Main_Unit); end if; ! Current_Instantiated_Parent := (Gen_Unit, Act_Unit, Assoc_Null); end Set_Instance_Env; ----------------- --- 12401,12422 ---- Act_Unit : Entity_Id) is begin ! -- Regardless of the current mode, predefined units are analyzed in the ! -- most current Ada mode, and earlier version Ada checks do not apply ! -- to predefined units. Nothing needs to be done for non-internal units. ! -- These are always analyzed in the current mode. if Is_Internal_File_Name ! (Fname => Unit_File_Name (Get_Source_Unit (Gen_Unit)), ! Renamings_Included => True) then Set_Opt_Config_Switches (True, Current_Sem_Unit = Main_Unit); end if; ! Current_Instantiated_Parent := ! (Gen_Id => Gen_Unit, ! Act_Id => Act_Unit, ! Next_In_HTable => Assoc_Null); end Set_Instance_Env; ----------------- diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch12.ads gcc-4.6.0/gcc/ada/sem_ch12.ads *** gcc-4.5.2/gcc/ada/sem_ch12.ads Fri Aug 7 09:42:01 2009 --- gcc-4.6.0/gcc/ada/sem_ch12.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch12 is *** 34,41 **** procedure Analyze_Function_Instantiation (N : Node_Id); procedure Analyze_Formal_Object_Declaration (N : Node_Id); procedure Analyze_Formal_Type_Declaration (N : Node_Id); ! procedure Analyze_Formal_Subprogram (N : Node_Id); ! procedure Analyze_Formal_Package (N : Node_Id); procedure Start_Generic; -- Must be invoked before starting to process a generic spec or body --- 34,41 ---- procedure Analyze_Function_Instantiation (N : Node_Id); procedure Analyze_Formal_Object_Declaration (N : Node_Id); procedure Analyze_Formal_Type_Declaration (N : Node_Id); ! procedure Analyze_Formal_Subprogram_Declaration (N : Node_Id); ! procedure Analyze_Formal_Package_Declaration (N : Node_Id); procedure Start_Generic; -- Must be invoked before starting to process a generic spec or body *************** package Sem_Ch12 is *** 53,59 **** -- the child unit that must be declared within. Similarly, if this is the -- name of a generic child unit within an instantiation of its own parent, -- retrieve the parent generic. If the parent is installed as a result of ! -- this call, then Parent_Installed is set True, otherwise Parent_Intalled -- is unchanged by the call. function Copy_Generic_Node --- 53,59 ---- -- the child unit that must be declared within. Similarly, if this is the -- name of a generic child unit within an instantiation of its own parent, -- retrieve the parent generic. If the parent is installed as a result of ! -- this call, then Parent_Installed is set True, otherwise Parent_Installed -- is unchanged by the call. function Copy_Generic_Node *************** package Sem_Ch12 is *** 64,70 **** -- repeatedly: once to produce a copy on which semantic analysis of -- the generic is performed, and once for each instantiation. The tree -- being copied is not semantically analyzed, except that references to ! -- global entities are marked on terminal nodes. function Get_Instance_Of (A : Entity_Id) return Entity_Id; -- Retrieve actual associated with given generic parameter. --- 64,72 ---- -- repeatedly: once to produce a copy on which semantic analysis of -- the generic is performed, and once for each instantiation. The tree -- being copied is not semantically analyzed, except that references to ! -- global entities are marked on terminal nodes. Note that this function ! -- copies any aspect specifications from the input node N to the returned ! -- node, as well as the setting of the Has_Aspects flag. function Get_Instance_Of (A : Entity_Id) return Entity_Id; -- Retrieve actual associated with given generic parameter. diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch13.adb gcc-4.6.0/gcc/ada/sem_ch13.adb *** gcc-4.5.2/gcc/ada/sem_ch13.adb Fri Aug 7 09:42:01 2009 --- gcc-4.6.0/gcc/ada/sem_ch13.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,32 **** --- 23,35 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Checks; use Checks; with Einfo; use Einfo; + with Elists; use Elists; with Errout; use Errout; + with Exp_Disp; use Exp_Disp; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Lib; use Lib; *************** with Rtsfind; use Rtsfind; *** 41,56 **** with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch3; use Sem_Ch3; with Sem_Ch8; use Sem_Ch8; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Snames; use Snames; with Stand; use Stand; with Sinfo; use Sinfo; ! with Table; with Targparm; use Targparm; with Ttypes; use Ttypes; with Tbuild; use Tbuild; --- 44,61 ---- 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_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; + with Sinput; use Sinput; with Snames; use Snames; with Stand; use Stand; with Sinfo; use Sinfo; ! with Stringt; use Stringt; with Targparm; use Targparm; with Ttypes; use Ttypes; with Tbuild; use Tbuild; *************** package body Sem_Ch13 is *** 73,81 **** -- 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 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 --- 78,107 ---- -- 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 Build_Predicate_Function (Typ : Entity_Id; N : Node_Id); ! -- If Typ has predicates (indicated by Has_Predicates being set for Typ, ! -- then either there are pragma Invariant entries on the rep chain for the ! -- type (note that Predicate aspects are converted to pragma Predicate), or ! -- there are inherited aspects from a parent type, or ancestor subtypes. ! -- This procedure builds the spec and body for the Predicate function that ! -- tests these predicates. N is the freeze node for the type. The spec of ! -- the function is inserted before the freeze node, and the body of the ! -- function is inserted after the freeze node. ! ! procedure Build_Static_Predicate ! (Typ : Entity_Id; ! Expr : Node_Id; ! Nam : Name_Id); ! -- Given a predicated type Typ, where Typ is a discrete static subtype, ! -- whose predicate expression is Expr, tests if Expr is a static predicate, ! -- and if so, builds the predicate range list. Nam is the name of the one ! -- argument to the predicate function. Occurrences of the type name in the ! -- predicate expression have been replaced by identifier references to this ! -- name, which is unique, so any identifier with Chars matching Nam must be ! -- a reference to the type. If the predicate is non-static, this procedure ! -- returns doing nothing. If the predicate is static, then the predicate ! -- list is stored in Static_Predicate (Typ), and the Expr is rewritten as ! -- a canonicalized membership operation. function Get_Alignment_Value (Expr : Node_Id) return Uint; -- Given the expression for an alignment value, returns the corresponding *************** package body Sem_Ch13 is *** 83,92 **** -- posted as required, and a value of No_Uint is returned. function Is_Operational_Item (N : Node_Id) return Boolean; ! -- A specification for a stream attribute is allowed before the full ! -- type is declared, as explained in AI-00137 and the corrigendum. ! -- Attributes that do not specify a representation characteristic are ! -- operational attributes. procedure New_Stream_Subprogram (N : Node_Id; --- 109,118 ---- -- posted as required, and a value of No_Uint is returned. function Is_Operational_Item (N : Node_Id) return Boolean; ! -- A specification for a stream attribute is allowed before the full type ! -- is declared, as explained in AI-00137 and the corrigendum. Attributes ! -- that do not specify a representation characteristic are operational ! -- attributes. procedure New_Stream_Subprogram (N : Node_Id; *************** package body Sem_Ch13 is *** 108,113 **** --- 134,160 ---- -- renaming_as_body. For tagged types, the specification is one of the -- primitive specs. + generic + with procedure Replace_Type_Reference (N : Node_Id); + procedure Replace_Type_References_Generic (N : Node_Id; TName : Name_Id); + -- This is used to scan an expression for a predicate or invariant aspect + -- replacing occurrences of the name TName (the name of the subtype to + -- which the aspect applies) with appropriate references to the parameter + -- of the predicate function or invariant procedure. The procedure passed + -- as a generic parameter does the actual replacement of node N, which is + -- either a simple direct reference to TName, or a selected component that + -- represents an appropriately qualified occurrence of TName. + + procedure Set_Biased + (E : Entity_Id; + N : Node_Id; + Msg : String; + Biased : Boolean := True); + -- If Biased is True, sets Has_Biased_Representation flag for E, and + -- outputs a warning message at node N if Warn_On_Biased_Representation is + -- is True. This warning inserts the string Msg to describe the construct + -- causing biasing. + ---------------------------------------------- -- Table for Validate_Unchecked_Conversions -- ---------------------------------------------- *************** package body Sem_Ch13 is *** 164,170 **** -- The entity of the object being overlaid Off : Boolean; ! -- Whether the address is offseted within Y end record; package Address_Clause_Checks is new Table.Table ( --- 211,217 ---- -- The entity of the object being overlaid Off : Boolean; ! -- Whether the address is offset within Y end record; package Address_Clause_Checks is new Table.Table ( *************** package body Sem_Ch13 is *** 180,444 **** ----------------------------------------- procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is ! Max_Machine_Scalar_Size : constant Uint := ! UI_From_Int ! (Standard_Long_Long_Integer_Size); ! -- We use this as the maximum machine scalar size in the sense of AI-133 ! ! Num_CC : Natural; ! Comp : Entity_Id; ! SSU : constant Uint := UI_From_Int (System_Storage_Unit); begin ! -- This first loop through components does two things. First it deals ! -- with the case of components with component clauses whose length is ! -- greater than the maximum machine scalar size (either accepting them ! -- or rejecting as needed). Second, it counts the number of components ! -- with component clauses whose length does not exceed this maximum for ! -- later processing. ! ! Num_CC := 0; ! Comp := First_Component_Or_Discriminant (R); ! while Present (Comp) loop ! declare ! CC : constant Node_Id := Component_Clause (Comp); ! begin ! if Present (CC) then ! declare ! Fbit : constant Uint := Static_Integer (First_Bit (CC)); ! begin ! -- Case of component with size > max machine scalar ! if Esize (Comp) > Max_Machine_Scalar_Size then ! -- Must begin on byte boundary ! if Fbit mod SSU /= 0 then ! Error_Msg_N ! ("illegal first bit value for reverse bit order", ! First_Bit (CC)); ! Error_Msg_Uint_1 := SSU; ! Error_Msg_Uint_2 := Max_Machine_Scalar_Size; ! Error_Msg_N ! ("\must be a multiple of ^ if size greater than ^", ! First_Bit (CC)); ! -- Must end on byte boundary ! elsif Esize (Comp) mod SSU /= 0 then ! Error_Msg_N ! ("illegal last bit value for reverse bit order", ! Last_Bit (CC)); ! Error_Msg_Uint_1 := SSU; ! Error_Msg_Uint_2 := Max_Machine_Scalar_Size; ! Error_Msg_N ! ("\must be a multiple of ^ if size greater than ^", ! Last_Bit (CC)); ! -- OK, give warning if enabled ! elsif Warn_On_Reverse_Bit_Order then Error_Msg_N ("multi-byte field specified with non-standard" ! & " Bit_Order?", CC); if Bytes_Big_Endian then Error_Msg_N ! ("\bytes are not reversed " ! & "(component is big-endian)?", CC); else Error_Msg_N ! ("\bytes are not reversed " ! & "(component is little-endian)?", CC); end if; end if; ! -- Case where size is not greater than max machine ! -- scalar. For now, we just count these. else ! Num_CC := Num_CC + 1; end if; end; end if; - end; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- We need to sort the component clauses on the basis of the Position ! -- values in the clause, so we can group clauses with the same Position. ! -- together to determine the relevant machine scalar size. ! declare ! Comps : array (0 .. Num_CC) of Entity_Id; ! -- 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; ! -- Compare routine for Sort ! procedure CP_Move (From : Natural; To : Natural); ! -- Move routine for Sort ! package Sorting is new GNAT.Heap_Sort_G (CP_Move, CP_Lt); ! Start : Natural; ! Stop : Natural; ! -- Start and stop positions in component list of set of components ! -- with the same starting position (that constitute components in ! -- a single machine scalar). ! MaxL : Uint; ! -- Maximum last bit value of any component in this set ! MSS : Uint; ! -- Corresponding machine scalar size ! ----------- ! -- CP_Lt -- ! ----------- ! function CP_Lt (Op1, Op2 : Natural) return Boolean is ! begin ! return Position (Component_Clause (Comps (Op1))) < ! Position (Component_Clause (Comps (Op2))); ! end CP_Lt; ! ------------- ! -- CP_Move -- ! ------------- ! procedure CP_Move (From : Natural; To : Natural) is ! begin ! Comps (To) := Comps (From); ! end CP_Move; ! begin ! -- Collect the component clauses ! Num_CC := 0; ! Comp := First_Component_Or_Discriminant (R); ! while Present (Comp) loop ! if Present (Component_Clause (Comp)) ! and then Esize (Comp) <= Max_Machine_Scalar_Size ! then ! Num_CC := Num_CC + 1; ! Comps (Num_CC) := Comp; ! end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- Sort by ascending position number ! Sorting.Sort (Num_CC); ! -- We now have all the components whose size does not exceed the max ! -- machine scalar value, sorted by starting position. In this loop ! -- we gather groups of clauses starting at the same position, to ! -- process them in accordance with Ada 2005 AI-133. ! Stop := 0; ! while Stop < Num_CC loop ! Start := Stop + 1; ! Stop := Start; ! MaxL := ! Static_Integer (Last_Bit (Component_Clause (Comps (Start)))); ! while Stop < Num_CC loop ! if Static_Integer ! (Position (Component_Clause (Comps (Stop + 1)))) = ! Static_Integer ! (Position (Component_Clause (Comps (Stop)))) ! then ! Stop := Stop + 1; ! MaxL := ! UI_Max ! (MaxL, ! Static_Integer ! (Last_Bit (Component_Clause (Comps (Stop))))); ! else ! exit; end if; end loop; ! -- Now we have a group of component clauses from Start to Stop ! -- whose positions are identical, and MaxL is the maximum last bit ! -- value of any of these components. ! -- We need to determine the corresponding machine scalar size. ! -- This loop assumes that machine scalar sizes are even, and that ! -- each possible machine scalar has twice as many bits as the ! -- next smaller one. ! MSS := Max_Machine_Scalar_Size; ! while MSS mod 2 = 0 ! and then (MSS / 2) >= SSU ! and then (MSS / 2) > MaxL ! loop ! MSS := MSS / 2; ! end loop; ! -- Here is where we fix up the Component_Bit_Offset value to ! -- account for the reverse bit order. Some examples of what needs ! -- to be done for the case of a machine scalar size of 8 are: ! -- First_Bit .. Last_Bit Component_Bit_Offset ! -- old new old new ! -- 0 .. 0 7 .. 7 0 7 ! -- 0 .. 1 6 .. 7 0 6 ! -- 0 .. 2 5 .. 7 0 5 ! -- 0 .. 7 0 .. 7 0 4 ! -- 1 .. 1 6 .. 6 1 6 ! -- 1 .. 4 3 .. 6 1 3 ! -- 4 .. 7 0 .. 3 4 0 ! -- The general rule is that the first bit is obtained by ! -- subtracting the old ending bit from machine scalar size - 1. ! for C in Start .. Stop loop ! declare ! Comp : constant Entity_Id := Comps (C); ! CC : constant Node_Id := Component_Clause (Comp); ! LB : constant Uint := Static_Integer (Last_Bit (CC)); ! NFB : constant Uint := MSS - Uint_1 - LB; ! NLB : constant Uint := NFB + Esize (Comp) - 1; ! Pos : constant Uint := Static_Integer (Position (CC)); begin ! if Warn_On_Reverse_Bit_Order then ! Error_Msg_Uint_1 := MSS; ! Error_Msg_N ! ("info: reverse bit order in machine " & ! "scalar of length^?", First_Bit (CC)); ! Error_Msg_Uint_1 := NFB; ! Error_Msg_Uint_2 := NLB; ! if Bytes_Big_Endian then ! Error_Msg_NE ! ("?\info: big-endian range for " ! & "component & is ^ .. ^", ! First_Bit (CC), Comp); else ! Error_Msg_NE ! ("?\info: little-endian range " ! & "for component & is ^ .. ^", ! First_Bit (CC), Comp); end if; ! end if; ! Set_Component_Bit_Offset (Comp, Pos * SSU + NFB); ! Set_Normalized_First_Bit (Comp, NFB mod SSU); ! end; ! end loop; ! end loop; ! end; end Adjust_Record_For_Reverse_Bit_Order; -------------------------------------- --- 227,663 ---- ----------------------------------------- procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is ! Comp : Node_Id; ! CC : Node_Id; begin ! -- Processing depends on version of Ada ! -- For Ada 95, we just renumber bits within a storage unit. We do the ! -- same for Ada 83 mode, since we recognize pragma Bit_Order in Ada 83, ! -- and are free to add this extension. ! if Ada_Version < Ada_2005 then ! Comp := First_Component_Or_Discriminant (R); ! while Present (Comp) loop ! CC := Component_Clause (Comp); ! -- If component clause is present, then deal with the non-default ! -- bit order case for Ada 95 mode. ! -- We only do this processing for the base type, and in fact that ! -- is important, since otherwise if there are record subtypes, we ! -- could reverse the bits once for each subtype, which is wrong. ! if Present (CC) ! and then Ekind (R) = E_Record_Type ! then ! declare ! CFB : constant Uint := Component_Bit_Offset (Comp); ! CSZ : constant Uint := Esize (Comp); ! CLC : constant Node_Id := Component_Clause (Comp); ! Pos : constant Node_Id := Position (CLC); ! FB : constant Node_Id := First_Bit (CLC); ! Storage_Unit_Offset : constant Uint := ! CFB / System_Storage_Unit; ! Start_Bit : constant Uint := ! CFB mod System_Storage_Unit; ! begin ! -- Cases where field goes over storage unit boundary ! if Start_Bit + CSZ > System_Storage_Unit then ! -- Allow multi-byte field but generate warning ! if Start_Bit mod System_Storage_Unit = 0 ! and then CSZ mod System_Storage_Unit = 0 ! then Error_Msg_N ("multi-byte field specified with non-standard" ! & " Bit_Order?", CLC); if Bytes_Big_Endian then Error_Msg_N ! ("bytes are not reversed " ! & "(component is big-endian)?", CLC); else Error_Msg_N ! ("bytes are not reversed " ! & "(component is little-endian)?", CLC); end if; + + -- Do not allow non-contiguous field + + else + Error_Msg_N + ("attempt to specify non-contiguous field " + & "not permitted", CLC); + Error_Msg_N + ("\caused by non-standard Bit_Order " + & "specified", CLC); + Error_Msg_N + ("\consider possibility of using " + & "Ada 2005 mode here", CLC); end if; ! -- Case where field fits in one storage unit else ! -- Give warning if suspicious component clause ! ! if Intval (FB) >= System_Storage_Unit ! and then Warn_On_Reverse_Bit_Order ! then ! Error_Msg_N ! ("?Bit_Order clause does not affect " & ! "byte ordering", Pos); ! Error_Msg_Uint_1 := ! Intval (Pos) + Intval (FB) / ! System_Storage_Unit; ! Error_Msg_N ! ("?position normalized to ^ before bit " & ! "order interpreted", Pos); ! end if; ! ! -- Here is where we fix up the Component_Bit_Offset value ! -- to account for the reverse bit order. Some examples of ! -- what needs to be done are: ! ! -- First_Bit .. Last_Bit Component_Bit_Offset ! -- old new old new ! ! -- 0 .. 0 7 .. 7 0 7 ! -- 0 .. 1 6 .. 7 0 6 ! -- 0 .. 2 5 .. 7 0 5 ! -- 0 .. 7 0 .. 7 0 4 ! ! -- 1 .. 1 6 .. 6 1 6 ! -- 1 .. 4 3 .. 6 1 3 ! -- 4 .. 7 0 .. 3 4 0 ! ! -- The rule is that the first bit is is obtained by ! -- subtracting the old ending bit from storage_unit - 1. ! ! Set_Component_Bit_Offset ! (Comp, ! (Storage_Unit_Offset * System_Storage_Unit) + ! (System_Storage_Unit - 1) - ! (Start_Bit + CSZ - 1)); ! ! Set_Normalized_First_Bit ! (Comp, ! Component_Bit_Offset (Comp) mod ! System_Storage_Unit); end if; end; end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- For Ada 2005, we do machine scalar processing, as fully described In ! -- AI-133. This involves gathering all components which start at the ! -- same byte offset and processing them together. Same approach is still ! -- valid in later versions including Ada 2012. ! else ! declare ! Max_Machine_Scalar_Size : constant Uint := ! UI_From_Int ! (Standard_Long_Long_Integer_Size); ! -- We use this as the maximum machine scalar size ! Num_CC : Natural; ! SSU : constant Uint := UI_From_Int (System_Storage_Unit); ! begin ! -- This first loop through components does two things. First it ! -- deals with the case of components with component clauses whose ! -- length is greater than the maximum machine scalar size (either ! -- accepting them or rejecting as needed). Second, it counts the ! -- number of components with component clauses whose length does ! -- not exceed this maximum for later processing. ! Num_CC := 0; ! Comp := First_Component_Or_Discriminant (R); ! while Present (Comp) loop ! CC := Component_Clause (Comp); ! if Present (CC) then ! declare ! Fbit : constant Uint := ! Static_Integer (First_Bit (CC)); ! Lbit : constant Uint := ! Static_Integer (Last_Bit (CC)); ! begin ! -- Case of component with last bit >= max machine scalar ! if Lbit >= Max_Machine_Scalar_Size then ! -- This is allowed only if first bit is zero, and ! -- last bit + 1 is a multiple of storage unit size. ! if Fbit = 0 and then (Lbit + 1) mod SSU = 0 then ! -- This is the case to give a warning if enabled ! if Warn_On_Reverse_Bit_Order then ! Error_Msg_N ! ("multi-byte field specified with " ! & " non-standard Bit_Order?", CC); ! if Bytes_Big_Endian then ! Error_Msg_N ! ("\bytes are not reversed " ! & "(component is big-endian)?", CC); ! else ! Error_Msg_N ! ("\bytes are not reversed " ! & "(component is little-endian)?", CC); ! end if; ! end if; ! -- Give error message for RM 13.4.1(10) violation ! else ! Error_Msg_FE ! ("machine scalar rules not followed for&", ! First_Bit (CC), Comp); ! Error_Msg_Uint_1 := Lbit; ! Error_Msg_Uint_2 := Max_Machine_Scalar_Size; ! Error_Msg_F ! ("\last bit (^) exceeds maximum machine " ! & "scalar size (^)", ! First_Bit (CC)); ! if (Lbit + 1) mod SSU /= 0 then ! Error_Msg_Uint_1 := SSU; ! Error_Msg_F ! ("\and is not a multiple of Storage_Unit (^) " ! & "('R'M 13.4.1(10))", ! First_Bit (CC)); ! else ! Error_Msg_Uint_1 := Fbit; ! Error_Msg_F ! ("\and first bit (^) is non-zero " ! & "('R'M 13.4.1(10))", ! First_Bit (CC)); ! end if; ! end if; ! -- OK case of machine scalar related component clause, ! -- For now, just count them. ! ! else ! Num_CC := Num_CC + 1; ! end if; ! end; end if; + + Next_Component_Or_Discriminant (Comp); end loop; ! -- We need to sort the component clauses on the basis of the ! -- Position values in the clause, so we can group clauses with ! -- the same Position. together to determine the relevant machine ! -- scalar size. ! Sort_CC : declare ! Comps : array (0 .. Num_CC) of Entity_Id; ! -- 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; ! -- Compare routine for Sort ! procedure CP_Move (From : Natural; To : Natural); ! -- Move routine for Sort ! package Sorting is new GNAT.Heap_Sort_G (CP_Move, CP_Lt); ! Start : Natural; ! Stop : Natural; ! -- Start and stop positions in the component list of the set of ! -- components with the same starting position (that constitute ! -- components in a single machine scalar). ! MaxL : Uint; ! -- Maximum last bit value of any component in this set ! MSS : Uint; ! -- Corresponding machine scalar size ! ----------- ! -- CP_Lt -- ! ----------- + function CP_Lt (Op1, Op2 : Natural) return Boolean is begin ! return Position (Component_Clause (Comps (Op1))) < ! Position (Component_Clause (Comps (Op2))); ! end CP_Lt; ! ------------- ! -- CP_Move -- ! ------------- ! ! procedure CP_Move (From : Natural; To : Natural) is ! begin ! Comps (To) := Comps (From); ! end CP_Move; ! ! -- Start of processing for Sort_CC ! ! begin ! -- Collect the machine scalar relevant component clauses ! ! Num_CC := 0; ! Comp := First_Component_Or_Discriminant (R); ! while Present (Comp) loop ! declare ! CC : constant Node_Id := Component_Clause (Comp); ! ! begin ! -- Collect only component clauses whose last bit is less ! -- than machine scalar size. Any component clause whose ! -- last bit exceeds this value does not take part in ! -- machine scalar layout considerations. The test for ! -- Error_Posted makes sure we exclude component clauses ! -- for which we already posted an error. ! ! if Present (CC) ! and then not Error_Posted (Last_Bit (CC)) ! and then Static_Integer (Last_Bit (CC)) < ! Max_Machine_Scalar_Size ! then ! Num_CC := Num_CC + 1; ! Comps (Num_CC) := Comp; ! end if; ! end; ! ! Next_Component_Or_Discriminant (Comp); ! end loop; ! ! -- Sort by ascending position number ! ! Sorting.Sort (Num_CC); ! ! -- We now have all the components whose size does not exceed ! -- the max machine scalar value, sorted by starting position. ! -- In this loop we gather groups of clauses starting at the ! -- same position, to process them in accordance with AI-133. ! ! Stop := 0; ! while Stop < Num_CC loop ! Start := Stop + 1; ! Stop := Start; ! MaxL := ! Static_Integer ! (Last_Bit (Component_Clause (Comps (Start)))); ! while Stop < Num_CC loop ! if Static_Integer ! (Position (Component_Clause (Comps (Stop + 1)))) = ! Static_Integer ! (Position (Component_Clause (Comps (Stop)))) ! then ! Stop := Stop + 1; ! MaxL := ! UI_Max ! (MaxL, ! Static_Integer ! (Last_Bit ! (Component_Clause (Comps (Stop))))); else ! exit; end if; ! end loop; ! -- Now we have a group of component clauses from Start to ! -- Stop whose positions are identical, and MaxL is the ! -- maximum last bit value of any of these components. ! ! -- We need to determine the corresponding machine scalar ! -- size. This loop assumes that machine scalar sizes are ! -- even, and that each possible machine scalar has twice ! -- as many bits as the next smaller one. ! ! MSS := Max_Machine_Scalar_Size; ! while MSS mod 2 = 0 ! and then (MSS / 2) >= SSU ! and then (MSS / 2) > MaxL ! loop ! MSS := MSS / 2; ! end loop; ! ! -- Here is where we fix up the Component_Bit_Offset value ! -- to account for the reverse bit order. Some examples of ! -- what needs to be done for the case of a machine scalar ! -- size of 8 are: ! ! -- First_Bit .. Last_Bit Component_Bit_Offset ! -- old new old new ! ! -- 0 .. 0 7 .. 7 0 7 ! -- 0 .. 1 6 .. 7 0 6 ! -- 0 .. 2 5 .. 7 0 5 ! -- 0 .. 7 0 .. 7 0 4 ! ! -- 1 .. 1 6 .. 6 1 6 ! -- 1 .. 4 3 .. 6 1 3 ! -- 4 .. 7 0 .. 3 4 0 ! ! -- The rule is that the first bit is obtained by subtracting ! -- the old ending bit from machine scalar size - 1. ! ! for C in Start .. Stop loop ! declare ! Comp : constant Entity_Id := Comps (C); ! CC : constant Node_Id := ! Component_Clause (Comp); ! LB : constant Uint := ! Static_Integer (Last_Bit (CC)); ! NFB : constant Uint := MSS - Uint_1 - LB; ! NLB : constant Uint := NFB + Esize (Comp) - 1; ! Pos : constant Uint := ! Static_Integer (Position (CC)); ! ! begin ! if Warn_On_Reverse_Bit_Order then ! Error_Msg_Uint_1 := MSS; ! Error_Msg_N ! ("info: reverse bit order in machine " & ! "scalar of length^?", First_Bit (CC)); ! Error_Msg_Uint_1 := NFB; ! Error_Msg_Uint_2 := NLB; ! ! if Bytes_Big_Endian then ! Error_Msg_NE ! ("?\info: big-endian range for " ! & "component & is ^ .. ^", ! First_Bit (CC), Comp); ! else ! Error_Msg_NE ! ("?\info: little-endian range " ! & "for component & is ^ .. ^", ! First_Bit (CC), Comp); ! end if; ! end if; ! ! Set_Component_Bit_Offset (Comp, Pos * SSU + NFB); ! Set_Normalized_First_Bit (Comp, NFB mod SSU); ! end; ! end loop; ! end loop; ! end Sort_CC; ! end; ! end if; end Adjust_Record_For_Reverse_Bit_Order; -------------------------------------- *************** package body Sem_Ch13 is *** 460,465 **** --- 679,1192 ---- end if; end Alignment_Check_For_Esize_Change; + ----------------------------------- + -- Analyze_Aspect_Specifications -- + ----------------------------------- + + procedure Analyze_Aspect_Specifications + (N : Node_Id; + E : Entity_Id; + L : List_Id) + is + Aspect : Node_Id; + Aitem : Node_Id; + Ent : Node_Id; + + Ins_Node : Node_Id := N; + -- Insert pragmas (except Pre/Post/Invariant/Predicate) after this node + + -- The general processing involves building an attribute definition + -- clause or a pragma node that corresponds to the access type. Then + -- one of two things happens: + + -- If we are required to delay the evaluation of this aspect to the + -- freeze point, we preanalyze the relevant argument, and then attach + -- the corresponding pragma/attribute definition clause to the aspect + -- specification node, which is then placed in the Rep Item chain. + -- In this case we mark the entity with the Has_Delayed_Aspects flag, + -- and we evaluate the rep item at the freeze point. + + -- If no delay is required, we just insert the pragma or attribute + -- after the declaration, and it will get processed by the normal + -- circuit. The From_Aspect_Specification flag is set on the pragma + -- or attribute definition node in either case to activate special + -- processing (e.g. not traversing the list of homonyms for inline). + + Delay_Required : Boolean; + -- Set True if delay is required + + begin + -- Return if no aspects + + if L = No_List then + return; + end if; + + -- Return if already analyzed (avoids duplicate calls in some cases + -- where type declarations get rewritten and processed twice). + + if Analyzed (N) then + return; + end if; + + -- Loop through aspects + + Aspect := First (L); + while Present (Aspect) loop + declare + Loc : constant Source_Ptr := Sloc (Aspect); + Id : constant Node_Id := Identifier (Aspect); + Expr : constant Node_Id := Expression (Aspect); + Nam : constant Name_Id := Chars (Id); + A_Id : constant Aspect_Id := Get_Aspect_Id (Nam); + Anod : Node_Id; + T : Entity_Id; + + Eloc : Source_Ptr := Sloc (Expr); + -- Source location of expression, modified when we split PPC's + + begin + Set_Entity (Aspect, E); + Ent := New_Occurrence_Of (E, Sloc (Id)); + + -- Check for duplicate aspect. Note that the Comes_From_Source + -- test allows duplicate Pre/Post's that we generate internally + -- to escape being flagged here. + + Anod := First (L); + while Anod /= Aspect loop + if Nam = Chars (Identifier (Anod)) + and then Comes_From_Source (Aspect) + then + Error_Msg_Name_1 := Nam; + Error_Msg_Sloc := Sloc (Anod); + + -- Case of same aspect specified twice + + if Class_Present (Anod) = Class_Present (Aspect) then + if not Class_Present (Anod) then + Error_Msg_NE + ("aspect% for & previously given#", + Id, E); + else + Error_Msg_NE + ("aspect `%''Class` for & previously given#", + Id, E); + end if; + + -- Case of Pre and Pre'Class both specified + + elsif Nam = Name_Pre then + if Class_Present (Aspect) then + Error_Msg_NE + ("aspect `Pre''Class` for & is not allowed here", + Id, E); + Error_Msg_NE + ("\since aspect `Pre` previously given#", + Id, E); + + else + Error_Msg_NE + ("aspect `Pre` for & is not allowed here", + Id, E); + Error_Msg_NE + ("\since aspect `Pre''Class` previously given#", + Id, E); + end if; + end if; + + goto Continue; + end if; + + Next (Anod); + end loop; + + -- Processing based on specific aspect + + case A_Id is + + -- No_Aspect should be impossible + + when No_Aspect => + raise Program_Error; + + -- Aspects taking an optional boolean argument. For all of + -- these we just create a matching pragma and insert it, + -- setting flag Cancel_Aspect if the expression is False. + + when Aspect_Ada_2005 | + Aspect_Ada_2012 | + Aspect_Atomic | + Aspect_Atomic_Components | + Aspect_Discard_Names | + Aspect_Favor_Top_Level | + Aspect_Inline | + Aspect_Inline_Always | + Aspect_No_Return | + Aspect_Pack | + Aspect_Persistent_BSS | + Aspect_Preelaborable_Initialization | + Aspect_Pure_Function | + Aspect_Shared | + Aspect_Suppress_Debug_Info | + Aspect_Unchecked_Union | + Aspect_Universal_Aliasing | + Aspect_Unmodified | + Aspect_Unreferenced | + Aspect_Unreferenced_Objects | + Aspect_Volatile | + Aspect_Volatile_Components => + + -- Build corresponding pragma node + + Aitem := + Make_Pragma (Loc, + Pragma_Argument_Associations => New_List (Ent), + Pragma_Identifier => + Make_Identifier (Sloc (Id), Chars (Id))); + + -- Deal with missing expression case, delay never needed + + if No (Expr) then + Delay_Required := False; + + -- Expression is present + + else + Preanalyze_Spec_Expression (Expr, Standard_Boolean); + + -- If preanalysis gives a static expression, we don't + -- need to delay (this will happen often in practice). + + if Is_OK_Static_Expression (Expr) then + Delay_Required := False; + + if Is_False (Expr_Value (Expr)) then + Set_Aspect_Cancel (Aitem); + end if; + + -- If we don't get a static expression, then delay, the + -- expression may turn out static by freeze time. + + else + Delay_Required := True; + end if; + end if; + + -- Aspects corresponding to attribute definition clauses + + when Aspect_Address | + Aspect_Alignment | + Aspect_Bit_Order | + Aspect_Component_Size | + Aspect_External_Tag | + Aspect_Machine_Radix | + Aspect_Object_Size | + Aspect_Size | + Aspect_Storage_Pool | + Aspect_Storage_Size | + Aspect_Stream_Size | + Aspect_Value_Size => + + -- Preanalyze the expression with the appropriate type + + case A_Id is + when Aspect_Address => + T := RTE (RE_Address); + when Aspect_Bit_Order => + T := RTE (RE_Bit_Order); + when Aspect_External_Tag => + T := Standard_String; + when Aspect_Storage_Pool => + T := Class_Wide_Type (RTE (RE_Root_Storage_Pool)); + when others => + T := Any_Integer; + end case; + + Preanalyze_Spec_Expression (Expr, T); + + -- Construct the attribute definition clause + + Aitem := + Make_Attribute_Definition_Clause (Loc, + Name => Ent, + Chars => Chars (Id), + Expression => Relocate_Node (Expr)); + + -- We do not need a delay if we have a static expression + + if Is_OK_Static_Expression (Expression (Aitem)) then + Delay_Required := False; + + -- Here a delay is required + + else + Delay_Required := True; + end if; + + -- Aspects corresponding to pragmas with two arguments, where + -- the first argument is a local name referring to the entity, + -- and the second argument is the aspect definition expression. + + when Aspect_Suppress | + Aspect_Unsuppress => + + -- Construct the pragma + + Aitem := + Make_Pragma (Loc, + Pragma_Argument_Associations => New_List ( + New_Occurrence_Of (E, Eloc), + Relocate_Node (Expr)), + Pragma_Identifier => + Make_Identifier (Sloc (Id), Chars (Id))); + + -- We don't have to play the delay game here, since the only + -- values are check names which don't get analyzed anyway. + + Delay_Required := False; + + -- Aspects corresponding to stream routines + + when Aspect_Input | + Aspect_Output | + Aspect_Read | + Aspect_Write => + + -- Construct the attribute definition clause + + Aitem := + Make_Attribute_Definition_Clause (Loc, + Name => Ent, + Chars => Chars (Id), + Expression => Relocate_Node (Expr)); + + -- These are always delayed (typically the subprogram that + -- is referenced cannot have been declared yet, since it has + -- a reference to the type for which this aspect is defined. + + Delay_Required := True; + + -- Aspects corresponding to pragmas with two arguments, where + -- the second argument is a local name referring to the entity, + -- and the first argument is the aspect definition expression. + + when Aspect_Warnings => + + -- Construct the pragma + + Aitem := + Make_Pragma (Loc, + Pragma_Argument_Associations => New_List ( + Relocate_Node (Expr), + New_Occurrence_Of (E, Eloc)), + Pragma_Identifier => + Make_Identifier (Sloc (Id), Chars (Id)), + Class_Present => Class_Present (Aspect)); + + -- We don't have to play the delay game here, since the only + -- values are check names which don't get analyzed anyway. + + Delay_Required := False; + + -- Aspects Pre/Post generate Precondition/Postcondition pragmas + -- with a first argument that is the expression, and a second + -- argument that is an informative message if the test fails. + -- This is inserted right after the declaration, to get the + -- required pragma placement. The processing for the pragmas + -- takes care of the required delay. + + when Aspect_Pre | Aspect_Post => declare + Pname : Name_Id; + + begin + if A_Id = Aspect_Pre then + Pname := Name_Precondition; + else + Pname := Name_Postcondition; + end if; + + -- If the expressions is of the form A and then B, then + -- we generate separate Pre/Post aspects for the separate + -- clauses. Since we allow multiple pragmas, there is no + -- problem in allowing multiple Pre/Post aspects internally. + + -- We do not do this for Pre'Class, since we have to put + -- these conditions together in a complex OR expression + + if Pname = Name_Postcondition + or else not Class_Present (Aspect) + then + while Nkind (Expr) = N_And_Then loop + Insert_After (Aspect, + Make_Aspect_Specification (Sloc (Right_Opnd (Expr)), + Identifier => Identifier (Aspect), + Expression => Relocate_Node (Right_Opnd (Expr)), + Class_Present => Class_Present (Aspect), + Split_PPC => True)); + Rewrite (Expr, Relocate_Node (Left_Opnd (Expr))); + Eloc := Sloc (Expr); + end loop; + end if; + + -- Build the precondition/postcondition pragma + + Aitem := + Make_Pragma (Loc, + Pragma_Identifier => + Make_Identifier (Sloc (Id), Pname), + Class_Present => Class_Present (Aspect), + Split_PPC => Split_PPC (Aspect), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Eloc, + Chars => Name_Check, + Expression => Relocate_Node (Expr)))); + + -- Add message unless exception messages are suppressed + + if not Opt.Exception_Locations_Suppressed then + Append_To (Pragma_Argument_Associations (Aitem), + Make_Pragma_Argument_Association (Eloc, + Chars => Name_Message, + Expression => + Make_String_Literal (Eloc, + Strval => "failed " + & Get_Name_String (Pname) + & " from " + & Build_Location_String (Eloc)))); + end if; + + Set_From_Aspect_Specification (Aitem, True); + + -- For Pre/Post cases, insert immediately after the entity + -- declaration, since that is the required pragma placement. + -- Note that for these aspects, we do not have to worry + -- about delay issues, since the pragmas themselves deal + -- with delay of visibility for the expression analysis. + + -- If the entity is a library-level subprogram, the pre/ + -- postconditions must be treated as late pragmas. + + if Nkind (Parent (N)) = N_Compilation_Unit then + Add_Global_Declaration (Aitem); + else + Insert_After (N, Aitem); + end if; + + goto Continue; + end; + + -- Invariant aspects generate a corresponding pragma with a + -- first argument that is the entity, a second argument that is + -- the expression and a third argument that is an appropriate + -- message. This is inserted right after the declaration, to + -- get the required pragma placement. The pragma processing + -- takes care of the required delay. + + when Aspect_Invariant => + + -- Construct the pragma + + Aitem := + Make_Pragma (Loc, + Pragma_Argument_Associations => + New_List (Ent, Relocate_Node (Expr)), + Class_Present => Class_Present (Aspect), + Pragma_Identifier => + Make_Identifier (Sloc (Id), Name_Invariant)); + + -- Add message unless exception messages are suppressed + + if not Opt.Exception_Locations_Suppressed then + Append_To (Pragma_Argument_Associations (Aitem), + Make_Pragma_Argument_Association (Eloc, + Chars => Name_Message, + Expression => + Make_String_Literal (Eloc, + Strval => "failed invariant from " + & Build_Location_String (Eloc)))); + end if; + + Set_From_Aspect_Specification (Aitem, True); + + -- For Invariant case, insert immediately after the entity + -- declaration. We do not have to worry about delay issues + -- since the pragma processing takes care of this. + + Insert_After (N, Aitem); + goto Continue; + + -- Predicate aspects generate a corresponding pragma with a + -- first argument that is the entity, and the second argument + -- is the expression. This is inserted immediately after the + -- declaration, to get the required pragma placement. The + -- pragma processing takes care of the required delay. + + when Aspect_Predicate => + + -- Construct the pragma + + Aitem := + Make_Pragma (Loc, + Pragma_Argument_Associations => + New_List (Ent, Relocate_Node (Expr)), + Class_Present => Class_Present (Aspect), + Pragma_Identifier => + Make_Identifier (Sloc (Id), Name_Predicate)); + + Set_From_Aspect_Specification (Aitem, True); + + -- Make sure we have a freeze node (it might otherwise be + -- missing in cases like subtype X is Y, and we would not + -- have a place to build the predicate function). + + Ensure_Freeze_Node (E); + + -- For Predicate case, insert immediately after the entity + -- declaration. We do not have to worry about delay issues + -- since the pragma processing takes care of this. + + Insert_After (N, Aitem); + goto Continue; + end case; + + Set_From_Aspect_Specification (Aitem, True); + + -- If a delay is required, we delay the freeze (not much point in + -- delaying the aspect if we don't delay the freeze!). The pragma + -- or clause is then attached to the aspect specification which + -- is placed in the rep item list. + + if Delay_Required then + Ensure_Freeze_Node (E); + Set_Is_Delayed_Aspect (Aitem); + Set_Has_Delayed_Aspects (E); + Set_Aspect_Rep_Item (Aspect, Aitem); + Record_Rep_Item (E, Aspect); + + -- If no delay required, insert the pragma/clause in the tree + + else + -- For Pre/Post cases, insert immediately after the entity + -- declaration, since that is the required pragma placement. + + if A_Id = Aspect_Pre or else A_Id = Aspect_Post then + Insert_After (N, Aitem); + + -- For all other cases, insert in sequence + + else + Insert_After (Ins_Node, Aitem); + Ins_Node := Aitem; + end if; + end if; + end; + + <> + Next (Aspect); + end loop; + end Analyze_Aspect_Specifications; + ----------------------- -- Analyze_At_Clause -- ----------------------- *************** package body Sem_Ch13 is *** 526,531 **** --- 1253,1264 ---- -- Common processing for 'Read, 'Write, 'Input and 'Output attribute -- definition clauses. + function Duplicate_Clause return Boolean; + -- This routine checks if the aspect for U_Ent being given by attribute + -- definition clause N is for an aspect that has already been specified, + -- and if so gives an error message. If there is a duplicate, True is + -- returned, otherwise if there is no error, False is returned. + ----------------------------------- -- Analyze_Stream_TSS_Definition -- ----------------------------------- *************** package body Sem_Ch13 is *** 662,667 **** --- 1395,1434 ---- end if; end Analyze_Stream_TSS_Definition; + ---------------------- + -- Duplicate_Clause -- + ---------------------- + + function Duplicate_Clause return Boolean is + A : Node_Id; + + begin + -- Nothing to do if this attribute definition clause comes from + -- an aspect specification, since we could not be duplicating an + -- explicit clause, and we dealt with the case of duplicated aspects + -- in Analyze_Aspect_Specifications. + + if From_Aspect_Specification (N) then + return False; + end if; + + -- Otherwise current clause may duplicate previous clause or a + -- previously given aspect specification for the same aspect. + + A := Get_Rep_Item_For_Entity (U_Ent, Chars (N)); + + if Present (A) then + if Entity (A) = U_Ent then + Error_Msg_Name_1 := Chars (N); + Error_Msg_Sloc := Sloc (A); + Error_Msg_NE ("aspect% for & previously given#", N, U_Ent); + return True; + end if; + end if; + + return False; + end Duplicate_Clause; + -- Start of processing for Analyze_Attribute_Definition_Clause begin *************** package body Sem_Ch13 is *** 704,710 **** Attribute_Write => null; ! -- Other cases are errors, which will be caught below when others => null; --- 1471,1478 ---- Attribute_Write => null; ! -- Other cases are errors ("attribute& cannot be set with ! -- definition clause"), which will be caught below. when others => null; *************** package body Sem_Ch13 is *** 769,774 **** --- 1537,1544 ---- return; end if; + Set_Entity (N, U_Ent); + -- Switch on particular attribute case Id is *************** package body Sem_Ch13 is *** 803,819 **** -- it imported. if Ignore_Rep_Clauses then ! if Ekind (U_Ent) = E_Variable ! or else Ekind (U_Ent) = E_Constant ! then Record_Rep_Item (U_Ent, N); end if; return; end if; ! if Present (Address_Clause (U_Ent)) then ! Error_Msg_N ("address already given for &", Nam); -- Case of address clause for subprogram --- 1573,1587 ---- -- it imported. if Ignore_Rep_Clauses then ! if Ekind_In (U_Ent, E_Variable, E_Constant) then Record_Rep_Item (U_Ent, N); end if; return; end if; ! if Duplicate_Clause then ! null; -- Case of address clause for subprogram *************** package body Sem_Ch13 is *** 1026,1038 **** -- check till after code generation to take full advantage -- of the annotation done by the back end. This entry is -- only made if the address clause comes from source. if Address_Clause_Overlay_Warnings and then Comes_From_Source (N) and then Present (O_Ent) and then Is_Object (O_Ent) then ! Address_Clause_Checks.Append ((N, U_Ent, O_Ent, Off)); -- If variable overlays a constant view, and we are -- warning on overlays, then mark the variable as --- 1794,1812 ---- -- check till after code generation to take full advantage -- of the annotation done by the back end. This entry is -- only made if the address clause comes from source. + -- If the entity has a generic type, the check will be + -- performed in the instance if the actual type justifies + -- it, and we do not insert the clause in the table to + -- prevent spurious warnings. if Address_Clause_Overlay_Warnings and then Comes_From_Source (N) and then Present (O_Ent) and then Is_Object (O_Ent) then ! if not Is_Generic_Type (Etype (U_Ent)) then ! Address_Clause_Checks.Append ((N, U_Ent, O_Ent, Off)); ! end if; -- If variable overlays a constant view, and we are -- warning on overlays, then mark the variable as *************** package body Sem_Ch13 is *** 1072,1080 **** then Error_Msg_N ("alignment cannot be given for &", Nam); ! elsif Has_Alignment_Clause (U_Ent) then ! Error_Msg_Sloc := Sloc (Alignment_Clause (U_Ent)); ! Error_Msg_N ("alignment clause previously given#", N); elsif Align /= No_Uint then Set_Has_Alignment_Clause (U_Ent); --- 1846,1853 ---- then Error_Msg_N ("alignment cannot be given for &", Nam); ! elsif Duplicate_Clause then ! null; elsif Align /= No_Uint then Set_Has_Alignment_Clause (U_Ent); *************** package body Sem_Ch13 is *** 1103,1108 **** --- 1876,1884 ---- Error_Msg_N ("Bit_Order can only be defined for record type", Nam); + elsif Duplicate_Clause then + null; + else Analyze_And_Resolve (Expr, RTE (RE_Bit_Order)); *************** package body Sem_Ch13 is *** 1129,1134 **** --- 1905,1911 ---- when Attribute_Component_Size => Component_Size_Case : declare Csize : constant Uint := Static_Integer (Expr); + Ctyp : Entity_Id; Btype : Entity_Id; Biased : Boolean; New_Ctyp : Entity_Id; *************** package body Sem_Ch13 is *** 1141,1170 **** end if; Btype := Base_Type (U_Ent); ! if Has_Component_Size_Clause (Btype) then ! Error_Msg_N ! ("component size clause for& previously given", Nam); ! elsif Csize /= No_Uint then ! Check_Size (Expr, Component_Type (Btype), Csize, Biased); ! if Has_Aliased_Components (Btype) ! and then Csize < 32 ! and then Csize /= 8 ! and then Csize /= 16 ! then ! Error_Msg_N ! ("component size incorrect for aliased components", N); ! return; ! end if; ! -- For the biased case, build a declaration for a subtype ! -- that will be used to represent the biased subtype that ! -- reflects the biased representation of components. We need ! -- this subtype to get proper conversions on referencing ! -- elements of the array. Note that component size clauses ! -- are ignored in VM mode. if VM_Target = No_VM then if Biased then --- 1918,1939 ---- end if; Btype := Base_Type (U_Ent); + Ctyp := Component_Type (Btype); ! if Duplicate_Clause then ! null; ! elsif Rep_Item_Too_Early (Btype, N) then ! null; ! elsif Csize /= No_Uint then ! Check_Size (Expr, Ctyp, Csize, Biased); ! -- For the biased case, build a declaration for a subtype that ! -- will be used to represent the biased subtype that reflects ! -- the biased representation of components. We need the subtype ! -- to get proper conversions on referencing elements of the ! -- array. Note: component size clauses are ignored in VM mode. if VM_Target = No_VM then if Biased then *************** package body Sem_Ch13 is *** 1186,1202 **** Set_Esize (New_Ctyp, Csize); Set_RM_Size (New_Ctyp, Csize); Init_Alignment (New_Ctyp); - Set_Has_Biased_Representation (New_Ctyp, True); Set_Is_Itype (New_Ctyp, True); Set_Associated_Node_For_Itype (New_Ctyp, U_Ent); Set_Component_Type (Btype, New_Ctyp); ! ! if Warn_On_Biased_Representation then ! Error_Msg_N ! ("?component size clause forces biased " ! & "representation", N); ! end if; end if; Set_Component_Size (Btype, Csize); --- 1955,1965 ---- Set_Esize (New_Ctyp, Csize); Set_RM_Size (New_Ctyp, Csize); Init_Alignment (New_Ctyp); Set_Is_Itype (New_Ctyp, True); Set_Associated_Node_For_Itype (New_Ctyp, U_Ent); Set_Component_Type (Btype, New_Ctyp); ! Set_Biased (New_Ctyp, N, "component size clause"); end if; Set_Component_Size (Btype, Csize); *************** package body Sem_Ch13 is *** 1213,1220 **** end if; end if; Set_Has_Component_Size_Clause (Btype, True); ! Set_Has_Non_Standard_Rep (Btype, True); end if; end Component_Size_Case; --- 1976,1994 ---- end if; end if; + -- Deal with warning on overridden size + + if Warn_On_Overridden_Size + and then Has_Size_Clause (Ctyp) + and then RM_Size (Ctyp) /= Csize + then + Error_Msg_NE + ("?component size overrides size clause for&", + N, Ctyp); + end if; + Set_Has_Component_Size_Clause (Btype, True); ! Set_Has_Non_Standard_Rep (Btype, True); end if; end Component_Size_Case; *************** package body Sem_Ch13 is *** 1228,1255 **** Error_Msg_N ("should be a tagged type", Nam); end if; ! Analyze_And_Resolve (Expr, Standard_String); ! ! if not Is_Static_Expression (Expr) then ! Flag_Non_Static_Expr ! ("static string required for tag name!", Nam); ! end if; - if VM_Target = No_VM then - Set_Has_External_Tag_Rep_Clause (U_Ent); else ! Error_Msg_Name_1 := Attr; ! Error_Msg_N ! ("% attribute unsupported in this configuration", Nam); ! end if; ! if not Is_Library_Level_Entity (U_Ent) then ! Error_Msg_NE ! ("?non-unique external tag supplied for &", N, U_Ent); ! Error_Msg_N ! ("?\same external tag applies to all subprogram calls", N); ! Error_Msg_N ! ("?\corresponding internal tag cannot be obtained", N); end if; end External_Tag; --- 2002,2034 ---- Error_Msg_N ("should be a tagged type", Nam); end if; ! if Duplicate_Clause then ! null; else ! Analyze_And_Resolve (Expr, Standard_String); ! if not Is_Static_Expression (Expr) then ! Flag_Non_Static_Expr ! ("static string required for tag name!", Nam); ! end if; ! ! if VM_Target = No_VM then ! Set_Has_External_Tag_Rep_Clause (U_Ent); ! else ! Error_Msg_Name_1 := Attr; ! Error_Msg_N ! ("% attribute unsupported in this configuration", Nam); ! end if; ! ! if not Is_Library_Level_Entity (U_Ent) then ! Error_Msg_NE ! ("?non-unique external tag supplied for &", N, U_Ent); ! Error_Msg_N ! ("?\same external tag applies to all subprogram calls", N); ! Error_Msg_N ! ("?\corresponding internal tag cannot be obtained", N); ! end if; end if; end External_Tag; *************** package body Sem_Ch13 is *** 1274,1282 **** if not Is_Decimal_Fixed_Point_Type (U_Ent) then Error_Msg_N ("decimal fixed-point type expected for &", Nam); ! elsif Has_Machine_Radix_Clause (U_Ent) then ! Error_Msg_Sloc := Sloc (Alignment_Clause (U_Ent)); ! Error_Msg_N ("machine radix clause previously given#", N); elsif Radix /= No_Uint then Set_Has_Machine_Radix_Clause (U_Ent); --- 2053,2060 ---- if not Is_Decimal_Fixed_Point_Type (U_Ent) then Error_Msg_N ("decimal fixed-point type expected for &", Nam); ! elsif Duplicate_Clause then ! null; elsif Radix /= No_Uint then Set_Has_Machine_Radix_Clause (U_Ent); *************** package body Sem_Ch13 is *** 1308,1315 **** if not Is_Type (U_Ent) then Error_Msg_N ("Object_Size cannot be given for &", Nam); ! elsif Has_Object_Size_Clause (U_Ent) then ! Error_Msg_N ("Object_Size already given for &", Nam); else Check_Size (Expr, U_Ent, Size, Biased); --- 2086,2093 ---- if not Is_Type (U_Ent) then Error_Msg_N ("Object_Size cannot be given for &", Nam); ! elsif Duplicate_Clause then ! null; else Check_Size (Expr, U_Ent, Size, Biased); *************** package body Sem_Ch13 is *** 1363,1370 **** begin FOnly := True; ! if Has_Size_Clause (U_Ent) then ! Error_Msg_N ("size already given for &", Nam); elsif not Is_Type (U_Ent) and then Ekind (U_Ent) /= E_Variable --- 2141,2148 ---- begin FOnly := True; ! if Duplicate_Clause then ! null; elsif not Is_Type (U_Ent) and then Ekind (U_Ent) /= E_Variable *************** package body Sem_Ch13 is *** 1379,1384 **** --- 2157,2173 ---- ("size cannot be given for unconstrained array", Nam); elsif Size /= No_Uint then + + if VM_Target /= No_VM and then not GNAT_Mode then + + -- Size clause is not handled properly on VM targets. + -- Display a warning unless we are in GNAT mode, in which + -- case this is useless. + + Error_Msg_N + ("?size clauses are ignored in this configuration", N); + end if; + if Is_Type (U_Ent) then Etyp := U_Ent; else *************** package body Sem_Ch13 is *** 1396,1407 **** or else Has_Small_Clause (U_Ent) then Check_Size (Expr, Etyp, Size, Biased); ! Set_Has_Biased_Representation (U_Ent, Biased); ! ! if Biased and Warn_On_Biased_Representation then ! Error_Msg_N ! ("?size clause forces biased representation", N); ! end if; end if; -- For types set RM_Size and Esize if possible --- 2185,2191 ---- or else Has_Small_Clause (U_Ent) then Check_Size (Expr, Etyp, Size, Biased); ! Set_Biased (U_Ent, N, "size clause", Biased); end if; -- For types set RM_Size and Esize if possible *************** package body Sem_Ch13 is *** 1528,1535 **** Nam); return; ! elsif Ekind (U_Ent) /= E_Access_Type ! and then Ekind (U_Ent) /= E_General_Access_Type then Error_Msg_N ("storage pool can only be given for access types", Nam); --- 2312,2319 ---- Nam); return; ! elsif not ! Ekind_In (U_Ent, E_Access_Type, E_General_Access_Type) then Error_Msg_N ("storage pool can only be given for access types", Nam); *************** package body Sem_Ch13 is *** 1540,1547 **** ("storage pool cannot be given for a derived access type", Nam); ! elsif Has_Storage_Size_Clause (U_Ent) then ! Error_Msg_N ("storage size already given for &", Nam); return; elsif Present (Associated_Storage_Pool (U_Ent)) then --- 2324,2330 ---- ("storage pool cannot be given for a derived access type", Nam); ! elsif Duplicate_Clause then return; elsif Present (Associated_Storage_Pool (U_Ent)) then *************** package body Sem_Ch13 is *** 1586,1594 **** if not Is_Entity_Name (Expr) and then Is_Object_Reference (Expr) then ! Pool := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('P')); declare Rnode : constant Node_Id := --- 2369,2375 ---- if not Is_Entity_Name (Expr) and then Is_Object_Reference (Expr) then ! Pool := Make_Temporary (Loc, 'P', Expr); declare Rnode : constant Node_Id := *************** package body Sem_Ch13 is *** 1596,1602 **** Defining_Identifier => Pool, Subtype_Mark => New_Occurrence_Of (Etype (Expr), Loc), ! Name => Expr); begin Insert_Before (N, Rnode); --- 2377,2383 ---- Defining_Identifier => Pool, Subtype_Mark => New_Occurrence_Of (Etype (Expr), Loc), ! Name => Expr); begin Insert_Before (N, Rnode); *************** package body Sem_Ch13 is *** 1656,1663 **** Error_Msg_N ("storage size clause for task is an " & "obsolescent feature (RM J.9)?", N); ! Error_Msg_N ! ("\use Storage_Size pragma instead?", N); end if; FOnly := True; --- 2437,2443 ---- Error_Msg_N ("storage size clause for task is an " & "obsolescent feature (RM J.9)?", N); ! Error_Msg_N ("\use Storage_Size pragma instead?", N); end if; FOnly := True; *************** package body Sem_Ch13 is *** 1673,1680 **** ("storage size cannot be given for a derived access type", Nam); ! elsif Has_Storage_Size_Clause (Btype) then ! Error_Msg_N ("storage size already given for &", Nam); else Analyze_And_Resolve (Expr, Any_Integer); --- 2453,2460 ---- ("storage size cannot be given for a derived access type", Nam); ! elsif Duplicate_Clause then ! null; else Analyze_And_Resolve (Expr, Any_Integer); *************** package body Sem_Ch13 is *** 1685,1691 **** return; end if; ! if Compile_Time_Known_Value (Expr) and then Expr_Value (Expr) = 0 then Set_No_Pool_Assigned (Btype); --- 2465,2471 ---- return; end if; ! if Is_OK_Static_Expression (Expr) and then Expr_Value (Expr) = 0 then Set_No_Pool_Assigned (Btype); *************** package body Sem_Ch13 is *** 1718,1725 **** Check_Restriction (No_Implementation_Attributes, N); end if; ! if Has_Stream_Size_Clause (U_Ent) then ! Error_Msg_N ("Stream_Size already given for &", Nam); elsif Is_Elementary_Type (U_Ent) then if Size /= System_Storage_Unit --- 2498,2505 ---- Check_Restriction (No_Implementation_Attributes, N); end if; ! if Duplicate_Clause then ! null; elsif Is_Elementary_Type (U_Ent) then if Size /= System_Storage_Unit *************** package body Sem_Ch13 is *** 1763,1773 **** if not Is_Type (U_Ent) then Error_Msg_N ("Value_Size cannot be given for &", Nam); ! elsif Present ! (Get_Attribute_Definition_Clause ! (U_Ent, Attribute_Value_Size)) ! then ! Error_Msg_N ("Value_Size already given for &", Nam); elsif Is_Array_Type (U_Ent) and then not Is_Constrained (U_Ent) --- 2543,2550 ---- if not Is_Type (U_Ent) then Error_Msg_N ("Value_Size cannot be given for &", Nam); ! elsif Duplicate_Clause then ! null; elsif Is_Array_Type (U_Ent) and then not Is_Constrained (U_Ent) *************** package body Sem_Ch13 is *** 1778,1789 **** else if Is_Elementary_Type (U_Ent) then Check_Size (Expr, U_Ent, Size, Biased); ! Set_Has_Biased_Representation (U_Ent, Biased); ! ! if Biased and Warn_On_Biased_Representation then ! Error_Msg_N ! ("?value size clause forces biased representation", N); ! end if; end if; Set_RM_Size (U_Ent, Size); --- 2555,2561 ---- else if Is_Elementary_Type (U_Ent) then Check_Size (Expr, U_Ent, Size, Biased); ! Set_Biased (U_Ent, N, "value size clause", Biased); end if; Set_RM_Size (U_Ent, Size); *************** package body Sem_Ch13 is *** 1923,1932 **** Val : Uint; Err : Boolean := False; ! Lo : constant Uint := Expr_Value (Type_Low_Bound (Universal_Integer)); ! Hi : constant Uint := Expr_Value (Type_High_Bound (Universal_Integer)); Min : Uint; Max : Uint; begin if Ignore_Rep_Clauses then --- 2695,2710 ---- Val : Uint; Err : Boolean := False; ! Lo : constant Uint := Expr_Value (Type_Low_Bound (Universal_Integer)); ! Hi : constant Uint := Expr_Value (Type_High_Bound (Universal_Integer)); ! -- Allowed range of universal integer (= allowed range of enum lit vals) ! Min : Uint; Max : Uint; + -- Minimum and maximum values of entries + + Max_Node : Node_Id; + -- Pointer to node for literal providing max value begin if Ignore_Rep_Clauses then *************** package body Sem_Ch13 is *** 2085,2091 **** Err := True; end if; ! Set_Enumeration_Rep_Expr (Elit, Choice); Expr := Expression (Assoc); Val := Static_Integer (Expr); --- 2863,2869 ---- Err := True; end if; ! Set_Enumeration_Rep_Expr (Elit, Expression (Assoc)); Expr := Expression (Assoc); Val := Static_Integer (Expr); *************** package body Sem_Ch13 is *** 2131,2145 **** if Max /= No_Uint and then Val <= Max then Error_Msg_NE ("enumeration value for& not ordered!", ! Enumeration_Rep_Expr (Elit), Elit); end if; Max := Val; end if; ! -- If there is at least one literal whose representation ! -- is not equal to the Pos value, then note that this ! -- enumeration type has a non-standard representation. if Val /= Enumeration_Pos (Elit) then Set_Has_Non_Standard_Rep (Base_Type (Enumtype)); --- 2909,2924 ---- if Max /= No_Uint and then Val <= Max then Error_Msg_NE ("enumeration value for& not ordered!", ! Enumeration_Rep_Expr (Elit), Elit); end if; + Max_Node := Enumeration_Rep_Expr (Elit); Max := Val; end if; ! -- If there is at least one literal whose representation is not ! -- equal to the Pos value, then note that this enumeration type ! -- has a non-standard representation. if Val /= Enumeration_Pos (Elit) then Set_Has_Non_Standard_Rep (Base_Type (Enumtype)); *************** package body Sem_Ch13 is *** 2156,2173 **** begin if Has_Size_Clause (Enumtype) then ! if Esize (Enumtype) >= Minsize then null; else Minsize := UI_From_Int (Minimum_Size (Enumtype, Biased => True)); ! if Esize (Enumtype) < Minsize then ! Error_Msg_N ("previously given size is too small", N); else ! Set_Has_Biased_Representation (Enumtype); end if; end if; --- 2935,2966 ---- begin if Has_Size_Clause (Enumtype) then ! ! -- All OK, if size is OK now ! ! if RM_Size (Enumtype) >= Minsize then null; else + -- Try if we can get by with biasing + Minsize := UI_From_Int (Minimum_Size (Enumtype, Biased => True)); ! -- Error message if even biasing does not work ! ! if RM_Size (Enumtype) < Minsize then ! Error_Msg_Uint_1 := RM_Size (Enumtype); ! Error_Msg_Uint_2 := Max; ! Error_Msg_N ! ("previously given size (^) is too small " ! & "for this value (^)", Max_Node); ! ! -- If biasing worked, indicate that we now have biased rep else ! Set_Biased ! (Enumtype, Size_Clause (Enumtype), "size clause"); end if; end if; *************** package body Sem_Ch13 is *** 2206,2272 **** E : constant Entity_Id := Entity (N); begin -- For tagged types covering interfaces add internal entities that link -- the primitives of the interfaces with the primitives that cover them. - -- Note: These entities were originally generated only when generating -- code because their main purpose was to provide support to initialize -- the secondary dispatch tables. They are now generated also when -- compiling with no code generation to provide ASIS the relationship ! -- between interface primitives and tagged type primitives. ! if Ada_Version >= Ada_05 and then Ekind (E) = E_Record_Type and then Is_Tagged_Type (E) and then not Is_Interface (E) and then Has_Interfaces (E) then Add_Internal_Interface_Entities (E); end if; end Analyze_Freeze_Entity; ------------------------------------------ -- Analyze_Record_Representation_Clause -- ------------------------------------------ procedure Analyze_Record_Representation_Clause (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! Ident : constant Node_Id := Identifier (N); ! Rectype : Entity_Id; ! Fent : Entity_Id; CC : Node_Id; ! Posit : Uint; Fbit : Uint; - Lbit : Uint; Hbit : Uint := Uint_0; ! Comp : Entity_Id; Ocomp : Entity_Id; ! Pcomp : Entity_Id; ! Biased : Boolean; ! ! Max_Bit_So_Far : Uint; ! -- Records the maximum bit position so far. If all field positions ! -- are monotonically increasing, then we can skip the circuit for ! -- checking for overlap, since no overlap is possible. ! ! Tagged_Parent : Entity_Id := Empty; ! -- This is set in the case of a derived tagged type for which we have ! -- Is_Fully_Repped_Tagged_Type True (indicating that all components are ! -- positioned by record representation clauses). In this case we must ! -- check for overlap between components of this tagged type, and the ! -- components of its parent. Tagged_Parent will point to this parent ! -- type. For all other cases Tagged_Parent is left set to Empty. ! ! Parent_Last_Bit : Uint; ! -- Relevant only if Tagged_Parent is set, Parent_Last_Bit indicates the ! -- last bit position for any field in the parent type. We only need to ! -- check overlap for fields starting below this point. ! ! Overlap_Check_Required : Boolean; ! -- Used to keep track of whether or not an overlap check is required ! ! Ccount : Natural := 0; ! -- Number of component clauses in record rep clause CR_Pragma : Node_Id := Empty; -- Points to N_Pragma node if Complete_Representation pragma present --- 2999,3130 ---- E : constant Entity_Id := Entity (N); begin + -- Remember that we are processing a freezing entity. Required to + -- ensure correct decoration of internal entities associated with + -- interfaces (see New_Overloaded_Entity). + + Inside_Freezing_Actions := Inside_Freezing_Actions + 1; + -- For tagged types covering interfaces add internal entities that link -- the primitives of the interfaces with the primitives that cover them. -- Note: These entities were originally generated only when generating -- code because their main purpose was to provide support to initialize -- the secondary dispatch tables. They are now generated also when -- compiling with no code generation to provide ASIS the relationship ! -- between interface primitives and tagged type primitives. They are ! -- also used to locate primitives covering interfaces when processing ! -- generics (see Derive_Subprograms). ! if Ada_Version >= Ada_2005 and then Ekind (E) = E_Record_Type and then Is_Tagged_Type (E) and then not Is_Interface (E) and then Has_Interfaces (E) then + -- This would be a good common place to call the routine that checks + -- overriding of interface primitives (and thus factorize calls to + -- Check_Abstract_Overriding located at different contexts in the + -- compiler). However, this is not possible because it causes + -- spurious errors in case of late overriding. + Add_Internal_Interface_Entities (E); end if; + + -- Check CPP types + + if Ekind (E) = E_Record_Type + and then Is_CPP_Class (E) + and then Is_Tagged_Type (E) + and then Tagged_Type_Expansion + and then Expander_Active + then + if CPP_Num_Prims (E) = 0 then + + -- If the CPP type has user defined components then it must import + -- primitives from C++. This is required because if the C++ class + -- has no primitives then the C++ compiler does not added the _tag + -- component to the type. + + pragma Assert (Chars (First_Entity (E)) = Name_uTag); + + if First_Entity (E) /= Last_Entity (E) then + Error_Msg_N + ("?'C'P'P type must import at least one primitive from C++", + E); + end if; + end if; + + -- Check that all its primitives are abstract or imported from C++. + -- Check also availability of the C++ constructor. + + declare + Has_Constructors : constant Boolean := Has_CPP_Constructors (E); + Elmt : Elmt_Id; + Error_Reported : Boolean := False; + Prim : Node_Id; + + begin + Elmt := First_Elmt (Primitive_Operations (E)); + while Present (Elmt) loop + Prim := Node (Elmt); + + if Comes_From_Source (Prim) then + if Is_Abstract_Subprogram (Prim) then + null; + + elsif not Is_Imported (Prim) + or else Convention (Prim) /= Convention_CPP + then + Error_Msg_N + ("?primitives of 'C'P'P types must be imported from C++" + & " or abstract", Prim); + + elsif not Has_Constructors + and then not Error_Reported + then + Error_Msg_Name_1 := Chars (E); + Error_Msg_N + ("?'C'P'P constructor required for type %", Prim); + Error_Reported := True; + end if; + end if; + + Next_Elmt (Elmt); + end loop; + end; + end if; + + Inside_Freezing_Actions := Inside_Freezing_Actions - 1; + + -- If we have a type with predicates, build predicate function + + if Is_Type (E) and then Has_Predicates (E) then + Build_Predicate_Function (E, N); + end if; end Analyze_Freeze_Entity; ------------------------------------------ -- Analyze_Record_Representation_Clause -- ------------------------------------------ + -- Note: we check as much as we can here, but we can't do any checks + -- based on the position values (e.g. overlap checks) until freeze time + -- because especially in Ada 2005 (machine scalar mode), the processing + -- for non-standard bit order can substantially change the positions. + -- See procedure Check_Record_Representation_Clause (called from Freeze) + -- for the remainder of this processing. + procedure Analyze_Record_Representation_Clause (N : Node_Id) is ! Ident : constant Node_Id := Identifier (N); ! Biased : Boolean; CC : Node_Id; ! Comp : Entity_Id; Fbit : Uint; Hbit : Uint := Uint_0; ! Lbit : Uint; Ocomp : Entity_Id; ! Posit : Uint; ! Rectype : Entity_Id; CR_Pragma : Node_Id := Empty; -- Points to N_Pragma node if Complete_Representation pragma present *************** package body Sem_Ch13 is *** 2294,2303 **** ("record type required, found}", Ident, First_Subtype (Rectype)); return; - elsif Is_Unchecked_Union (Rectype) then - Error_Msg_N - ("record rep clause not allowed for Unchecked_Union", N); - elsif Scope (Rectype) /= Current_Scope then Error_Msg_N ("type must be declared in this scope", N); return; --- 3152,3157 ---- *************** package body Sem_Ch13 is *** 2364,2370 **** -- Get the alignment value to perform error checking Mod_Val := Get_Alignment_Value (Expression (M)); - end if; end; end if; --- 3218,3223 ---- *************** package body Sem_Ch13 is *** 2383,2421 **** end loop; end if; - -- See if we have a fully repped derived tagged type - - declare - PS : constant Entity_Id := Parent_Subtype (Rectype); - - begin - if Present (PS) and then Is_Fully_Repped_Tagged_Type (PS) then - Tagged_Parent := PS; - - -- Find maximum bit of any component of the parent type - - Parent_Last_Bit := UI_From_Int (System_Address_Size - 1); - Pcomp := First_Entity (Tagged_Parent); - while Present (Pcomp) loop - if Ekind (Pcomp) = E_Discriminant - or else - Ekind (Pcomp) = E_Component - then - if Component_Bit_Offset (Pcomp) /= No_Uint - and then Known_Static_Esize (Pcomp) - then - Parent_Last_Bit := - UI_Max - (Parent_Last_Bit, - Component_Bit_Offset (Pcomp) + Esize (Pcomp) - 1); - end if; - - Next_Entity (Pcomp); - end if; - end loop; - end if; - end; - -- All done if no component clauses CC := First (Component_Clauses (N)); --- 3236,3241 ---- *************** package body Sem_Ch13 is *** 2424,2474 **** return; end if; - -- If a tag is present, then create a component clause that places it - -- at the start of the record (otherwise gigi may place it after other - -- fields that have rep clauses). - - Fent := First_Entity (Rectype); - - if Nkind (Fent) = N_Defining_Identifier - and then Chars (Fent) = Name_uTag - then - Set_Component_Bit_Offset (Fent, Uint_0); - Set_Normalized_Position (Fent, Uint_0); - Set_Normalized_First_Bit (Fent, Uint_0); - Set_Normalized_Position_Max (Fent, Uint_0); - Init_Esize (Fent, System_Address_Size); - - Set_Component_Clause (Fent, - Make_Component_Clause (Loc, - Component_Name => - Make_Identifier (Loc, - Chars => Name_uTag), - - Position => - Make_Integer_Literal (Loc, - Intval => Uint_0), - - First_Bit => - Make_Integer_Literal (Loc, - Intval => Uint_0), - - Last_Bit => - Make_Integer_Literal (Loc, - UI_From_Int (System_Address_Size)))); - - Ccount := Ccount + 1; - end if; - -- A representation like this applies to the base type Set_Has_Record_Rep_Clause (Base_Type (Rectype)); Set_Has_Non_Standard_Rep (Base_Type (Rectype)); Set_Has_Specified_Layout (Base_Type (Rectype)); - Max_Bit_So_Far := Uint_Minus_1; - Overlap_Check_Required := False; - -- Process the component clauses while Present (CC) loop --- 3244,3255 ---- *************** package body Sem_Ch13 is *** 2487,2493 **** -- Processing for real component clause else - Ccount := Ccount + 1; Posit := Static_Integer (Position (CC)); Fbit := Static_Integer (First_Bit (CC)); Lbit := Static_Integer (Last_Bit (CC)); --- 3268,3273 ---- *************** package body Sem_Ch13 is *** 2547,2552 **** --- 3327,3350 ---- Error_Msg_N ("component clause is for non-existent field", CC); + -- Ada 2012 (AI05-0026): Any name that denotes a + -- discriminant of an object of an unchecked union type + -- shall not occur within a record_representation_clause. + + -- The general restriction of using record rep clauses on + -- Unchecked_Union types has now been lifted. Since it is + -- possible to introduce a record rep clause which mentions + -- the discriminant of an Unchecked_Union in non-Ada 2012 + -- code, this check is applied to all versions of the + -- language. + + elsif Ekind (Comp) = E_Discriminant + and then Is_Unchecked_Union (Rectype) + then + Error_Msg_N + ("cannot reference discriminant of Unchecked_Union", + Component_Name (CC)); + elsif Present (Component_Clause (Comp)) then -- Diagnose duplicate rep clause, or check consistency *************** package body Sem_Ch13 is *** 2596,2607 **** Fbit := Fbit + UI_From_Int (SSU) * Posit; Lbit := Lbit + UI_From_Int (SSU) * Posit; - if Fbit <= Max_Bit_So_Far then - Overlap_Check_Required := True; - else - Max_Bit_So_Far := Lbit; - end if; - if Has_Size_Clause (Rectype) and then Esize (Rectype) <= Lbit then --- 3394,3399 ---- *************** package body Sem_Ch13 is *** 2615,2629 **** Set_Normalized_First_Bit (Comp, Fbit mod SSU); Set_Normalized_Position (Comp, Fbit / SSU); ! Set_Normalized_Position_Max ! (Fent, Normalized_Position (Fent)); ! ! if Is_Tagged_Type (Rectype) ! and then Fbit < System_Address_Size then Error_Msg_NE ! ("component overlaps tag field of&", ! Component_Name (CC), Rectype); end if; -- This information is also set in the corresponding --- 3407,3419 ---- Set_Normalized_First_Bit (Comp, Fbit mod SSU); Set_Normalized_Position (Comp, Fbit / SSU); ! if Warn_On_Overridden_Size ! and then Has_Size_Clause (Etype (Comp)) ! and then RM_Size (Etype (Comp)) /= Esize (Comp) then Error_Msg_NE ! ("?component size overrides size clause for&", ! Component_Name (CC), Etype (Comp)); end if; -- This information is also set in the corresponding *************** package body Sem_Ch13 is *** 2642,2654 **** Esize (Comp), Biased); ! Set_Has_Biased_Representation (Comp, Biased); ! ! if Biased and Warn_On_Biased_Representation then ! Error_Msg_F ! ("?component clause forces biased " ! & "representation", CC); ! end if; if Present (Ocomp) then Set_Component_Clause (Ocomp, CC); --- 3432,3439 ---- Esize (Comp), Biased); ! Set_Biased ! (Comp, First_Node (CC), "component clause", Biased); if Present (Ocomp) then Set_Component_Clause (Ocomp, CC); *************** package body Sem_Ch13 is *** 2660,2665 **** --- 3445,3454 ---- Set_Normalized_Position_Max (Ocomp, Normalized_Position (Ocomp)); + -- Note: we don't use Set_Biased here, because we + -- already gave a warning above if needed, and we + -- would get a duplicate for the same name here. + Set_Has_Biased_Representation (Ocomp, Has_Biased_Representation (Comp)); end if; *************** package body Sem_Ch13 is *** 2668,2694 **** Error_Msg_N ("component size is negative", CC); end if; end if; - - -- If OK component size, check parent type overlap if - -- this component might overlap a parent field. - - if Present (Tagged_Parent) - and then Fbit <= Parent_Last_Bit - then - Pcomp := First_Entity (Tagged_Parent); - while Present (Pcomp) loop - if (Ekind (Pcomp) = E_Discriminant - or else - Ekind (Pcomp) = E_Component) - and then not Is_Tag (Pcomp) - and then Chars (Pcomp) /= Name_uParent - then - Check_Component_Overlap (Comp, Pcomp); - end if; - - Next_Entity (Pcomp); - end loop; - end if; end if; end if; end if; --- 3457,3462 ---- *************** package body Sem_Ch13 is *** 2697,3061 **** Next (CC); end loop; ! -- Now that we have processed all the component clauses, check for ! -- overlap. We have to leave this till last, since the components can ! -- appear in any arbitrary order in the representation clause. ! -- We do not need this check if all specified ranges were monotonic, ! -- as recorded by Overlap_Check_Required being False at this stage. ! -- This first section checks if there are any overlapping entries at ! -- all. It does this by sorting all entries and then seeing if there are ! -- any overlaps. If there are none, then that is decisive, but if there ! -- are overlaps, they may still be OK (they may result from fields in ! -- different variants). ! if Overlap_Check_Required then ! Overlap_Check1 : declare ! OC_Fbit : array (0 .. Ccount) of Uint; ! -- First-bit values for component clauses, the value is the offset ! -- of the first bit of the field from start of record. The zero ! -- entry is for use in sorting. ! OC_Lbit : array (0 .. Ccount) of Uint; ! -- Last-bit values for component clauses, the value is the offset ! -- of the last bit of the field from start of record. The zero ! -- entry is for use in sorting. ! OC_Count : Natural := 0; ! -- Count of entries in OC_Fbit and OC_Lbit ! function OC_Lt (Op1, Op2 : Natural) return Boolean; ! -- Compare routine for Sort ! procedure OC_Move (From : Natural; To : Natural); ! -- Move routine for Sort ! package Sorting is new GNAT.Heap_Sort_G (OC_Move, OC_Lt); ! ----------- ! -- OC_Lt -- ! ----------- ! function OC_Lt (Op1, Op2 : Natural) return Boolean is ! begin ! return OC_Fbit (Op1) < OC_Fbit (Op2); ! end OC_Lt; ! ------------- ! -- OC_Move -- ! ------------- ! procedure OC_Move (From : Natural; To : Natural) is ! begin ! OC_Fbit (To) := OC_Fbit (From); ! OC_Lbit (To) := OC_Lbit (From); ! end OC_Move; ! -- Start of processing for Overlap_Check begin ! CC := First (Component_Clauses (N)); ! while Present (CC) loop ! if Nkind (CC) /= N_Pragma then ! Posit := Static_Integer (Position (CC)); ! Fbit := Static_Integer (First_Bit (CC)); ! Lbit := Static_Integer (Last_Bit (CC)); ! if Posit /= No_Uint ! and then Fbit /= No_Uint ! and then Lbit /= No_Uint ! then ! OC_Count := OC_Count + 1; ! Posit := Posit * SSU; ! OC_Fbit (OC_Count) := Fbit + Posit; ! OC_Lbit (OC_Count) := Lbit + Posit; end if; - end if; ! Next (CC); ! end loop; ! Sorting.Sort (OC_Count); ! Overlap_Check_Required := False; ! for J in 1 .. OC_Count - 1 loop ! if OC_Lbit (J) >= OC_Fbit (J + 1) then ! Overlap_Check_Required := True; ! exit; end if; - end loop; - end Overlap_Check1; - end if; ! -- If Overlap_Check_Required is still True, then we have to do the full ! -- scale overlap check, since we have at least two fields that do ! -- overlap, and we need to know if that is OK since they are in ! -- different variant, or whether we have a definite problem. ! if Overlap_Check_Required then ! Overlap_Check2 : declare ! C1_Ent, C2_Ent : Entity_Id; ! -- Entities of components being checked for overlap ! Clist : Node_Id; ! -- Component_List node whose Component_Items are being checked ! Citem : Node_Id; ! -- Component declaration for component being checked ! begin ! C1_Ent := First_Entity (Base_Type (Rectype)); ! -- Loop through all components in record. For each component check ! -- for overlap with any of the preceding elements on the component ! -- list containing the component and also, if the component is in ! -- a variant, check against components outside the case structure. ! -- This latter test is repeated recursively up the variant tree. ! Main_Component_Loop : while Present (C1_Ent) loop ! if Ekind (C1_Ent) /= E_Component ! and then Ekind (C1_Ent) /= E_Discriminant ! then ! goto Continue_Main_Component_Loop; end if; ! -- Skip overlap check if entity has no declaration node. This ! -- happens with discriminants in constrained derived types. ! -- Probably we are missing some checks as a result, but that ! -- does not seem terribly serious ??? ! if No (Declaration_Node (C1_Ent)) then ! goto Continue_Main_Component_Loop; end if; ! Clist := Parent (List_Containing (Declaration_Node (C1_Ent))); ! -- Loop through component lists that need checking. Check the ! -- current component list and all lists in variants above us. ! Component_List_Loop : loop ! -- If derived type definition, go to full declaration ! -- If at outer level, check discriminants if there are any. ! if Nkind (Clist) = N_Derived_Type_Definition then ! Clist := Parent (Clist); ! end if; ! -- Outer level of record definition, check discriminants ! if Nkind_In (Clist, N_Full_Type_Declaration, ! N_Private_Type_Declaration) ! then ! if Has_Discriminants (Defining_Identifier (Clist)) then ! C2_Ent := ! First_Discriminant (Defining_Identifier (Clist)); ! while Present (C2_Ent) loop ! exit when C1_Ent = C2_Ent; ! Check_Component_Overlap (C1_Ent, C2_Ent); ! Next_Discriminant (C2_Ent); ! end loop; ! end if; ! -- Record extension case ! elsif Nkind (Clist) = N_Derived_Type_Definition then ! Clist := Empty; ! -- Otherwise check one component list ! else ! Citem := First (Component_Items (Clist)); ! while Present (Citem) loop ! if Nkind (Citem) = N_Component_Declaration then ! C2_Ent := Defining_Identifier (Citem); ! exit when C1_Ent = C2_Ent; ! Check_Component_Overlap (C1_Ent, C2_Ent); ! end if; ! Next (Citem); ! end loop; ! end if; ! -- Check for variants above us (the parent of the Clist can ! -- be a variant, in which case its parent is a variant part, ! -- and the parent of the variant part is a component list ! -- whose components must all be checked against the current ! -- component for overlap). ! if Nkind (Parent (Clist)) = N_Variant then ! Clist := Parent (Parent (Parent (Clist))); ! -- Check for possible discriminant part in record, this is ! -- treated essentially as another level in the recursion. ! -- For this case the parent of the component list is the ! -- record definition, and its parent is the full type ! -- declaration containing the discriminant specifications. ! elsif Nkind (Parent (Clist)) = N_Record_Definition then ! Clist := Parent (Parent ((Clist))); ! -- If neither of these two cases, we are at the top of ! -- the tree. else ! exit Component_List_Loop; end if; ! end loop Component_List_Loop; ! <> ! Next_Entity (C1_Ent); ! end loop Main_Component_Loop; ! end Overlap_Check2; end if; ! -- For records that have component clauses for all components, and whose ! -- size is less than or equal to 32, we need to know the size in the ! -- front end to activate possible packed array processing where the ! -- component type is a record. ! -- At this stage Hbit + 1 represents the first unused bit from all the ! -- component clauses processed, so if the component clauses are ! -- complete, then this is the length of the record. ! -- 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 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 ! -- Nothing to do if at least one component has no component clause ! Comp := First_Component_Or_Discriminant (Rectype); ! while Present (Comp) loop ! exit when No (Component_Clause (Comp)); ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- If we fall out of loop, all components have component clauses ! -- and so we can set the size to the maximum value. ! if No (Comp) then ! Set_RM_Size (Rectype, Hbit + 1); end if; end if; ! -- Check missing components if Complete_Representation pragma appeared ! if Present (CR_Pragma) then ! Comp := First_Component_Or_Discriminant (Rectype); ! while Present (Comp) loop ! if No (Component_Clause (Comp)) then ! Error_Msg_NE ! ("missing component clause for &", CR_Pragma, Comp); ! end if; ! Next_Component_Or_Discriminant (Comp); end loop; ! -- If no Complete_Representation pragma, warn if missing components - elsif Warn_On_Unrepped_Components then declare ! Num_Repped_Components : Nat := 0; ! Num_Unrepped_Components : Nat := 0; begin ! -- First count number of repped and unrepped components - Comp := First_Component_Or_Discriminant (Rectype); - while Present (Comp) loop - if Present (Component_Clause (Comp)) then - Num_Repped_Components := Num_Repped_Components + 1; else ! Num_Unrepped_Components := Num_Unrepped_Components + 1; end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- We are only interested in the case where there is at least one ! -- unrepped component, and at least half the components have rep ! -- clauses. We figure that if less than half have them, then the ! -- partial rep clause is really intentional. If the component ! -- type has no underlying type set at this point (as for a generic ! -- formal type), we don't know enough to give a warning on the ! -- component. ! if Num_Unrepped_Components > 0 ! and then Num_Unrepped_Components < Num_Repped_Components then ! Comp := First_Component_Or_Discriminant (Rectype); ! while Present (Comp) loop ! if No (Component_Clause (Comp)) ! and then Comes_From_Source (Comp) ! and then Present (Underlying_Type (Etype (Comp))) ! and then (Is_Scalar_Type (Underlying_Type (Etype (Comp))) ! or else Size_Known_At_Compile_Time ! (Underlying_Type (Etype (Comp)))) ! and then not Has_Warnings_Off (Rectype) ! then ! Error_Msg_Sloc := Sloc (Comp); ! Error_Msg_NE ! ("?no component clause given for & declared #", ! N, Comp); ! end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; end if; ! end; ! end if; ! end Analyze_Record_Representation_Clause; ! ----------------------------- ! -- Check_Component_Overlap -- ! ----------------------------- ! procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id) is ! begin ! if Present (Component_Clause (C1_Ent)) ! and then Present (Component_Clause (C2_Ent)) ! then ! -- Exclude odd case where we have two tag fields in the same record, ! -- both at location zero. This seems a bit strange, but it seems to ! -- happen in some circumstances ??? ! if Chars (C1_Ent) = Name_uTag ! and then Chars (C2_Ent) = Name_uTag then ! return; end if; ! -- Here we check if the two fields overlap declare ! S1 : constant Uint := Component_Bit_Offset (C1_Ent); ! S2 : constant Uint := Component_Bit_Offset (C2_Ent); ! E1 : constant Uint := S1 + Esize (C1_Ent); ! E2 : constant Uint := S2 + Esize (C2_Ent); begin ! if E2 <= S1 or else E1 <= S2 then ! null; else ! Error_Msg_Node_2 := ! Component_Name (Component_Clause (C2_Ent)); ! Error_Msg_Sloc := Sloc (Error_Msg_Node_2); ! Error_Msg_Node_1 := ! Component_Name (Component_Clause (C1_Ent)); ! Error_Msg_N ! ("component& overlaps & #", ! Component_Name (Component_Clause (C1_Ent))); end if; end; ! end if; ! end Check_Component_Overlap; ----------------------------------- -- Check_Constant_Address_Clause -- --- 3465,4930 ---- Next (CC); end loop; ! -- Check missing components if Complete_Representation pragma appeared ! if Present (CR_Pragma) then ! Comp := First_Component_Or_Discriminant (Rectype); ! while Present (Comp) loop ! if No (Component_Clause (Comp)) then ! Error_Msg_NE ! ("missing component clause for &", CR_Pragma, Comp); ! end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- If no Complete_Representation pragma, warn if missing components ! elsif Warn_On_Unrepped_Components then ! declare ! Num_Repped_Components : Nat := 0; ! Num_Unrepped_Components : Nat := 0; ! begin ! -- First count number of repped and unrepped components ! Comp := First_Component_Or_Discriminant (Rectype); ! while Present (Comp) loop ! if Present (Component_Clause (Comp)) then ! Num_Repped_Components := Num_Repped_Components + 1; ! else ! Num_Unrepped_Components := Num_Unrepped_Components + 1; ! end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! -- We are only interested in the case where there is at least one ! -- unrepped component, and at least half the components have rep ! -- clauses. We figure that if less than half have them, then the ! -- partial rep clause is really intentional. If the component ! -- type has no underlying type set at this point (as for a generic ! -- formal type), we don't know enough to give a warning on the ! -- component. ! if Num_Unrepped_Components > 0 ! and then Num_Unrepped_Components < Num_Repped_Components ! then ! Comp := First_Component_Or_Discriminant (Rectype); ! while Present (Comp) loop ! if No (Component_Clause (Comp)) ! and then Comes_From_Source (Comp) ! and then Present (Underlying_Type (Etype (Comp))) ! and then (Is_Scalar_Type (Underlying_Type (Etype (Comp))) ! or else Size_Known_At_Compile_Time ! (Underlying_Type (Etype (Comp)))) ! and then not Has_Warnings_Off (Rectype) ! then ! Error_Msg_Sloc := Sloc (Comp); ! Error_Msg_NE ! ("?no component clause given for & declared #", ! N, Comp); ! end if; ! Next_Component_Or_Discriminant (Comp); ! end loop; ! end if; ! end; ! end if; ! end Analyze_Record_Representation_Clause; ! ------------------------------- ! -- Build_Invariant_Procedure -- ! ------------------------------- ! -- The procedure that is constructed here has the form ! -- procedure typInvariant (Ixxx : typ) is ! -- begin ! -- pragma Check (Invariant, exp, "failed invariant from xxx"); ! -- pragma Check (Invariant, exp, "failed invariant from xxx"); ! -- ... ! -- pragma Check (Invariant, exp, "failed inherited invariant from xxx"); ! -- ... ! -- end typInvariant; ! procedure Build_Invariant_Procedure (Typ : Entity_Id; N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (Typ); ! Stmts : List_Id; ! Spec : Node_Id; ! SId : Entity_Id; ! PDecl : Node_Id; ! PBody : Node_Id; ! ! Visible_Decls : constant List_Id := Visible_Declarations (N); ! Private_Decls : constant List_Id := Private_Declarations (N); ! ! procedure Add_Invariants (T : Entity_Id; Inherit : Boolean); ! -- Appends statements to Stmts for any invariants in the rep item chain ! -- of the given type. If Inherit is False, then we only process entries ! -- on the chain for the type Typ. If Inherit is True, then we ignore any ! -- Invariant aspects, but we process all Invariant'Class aspects, adding ! -- "inherited" to the exception message and generating an informational ! -- message about the inheritance of an invariant. ! ! Object_Name : constant Name_Id := New_Internal_Name ('I'); ! -- Name for argument of invariant procedure ! ! Object_Entity : constant Node_Id := ! Make_Defining_Identifier (Loc, Object_Name); ! -- The procedure declaration entity for the argument ! ! -------------------- ! -- Add_Invariants -- ! -------------------- ! ! procedure Add_Invariants (T : Entity_Id; Inherit : Boolean) is ! Ritem : Node_Id; ! Arg1 : Node_Id; ! Arg2 : Node_Id; ! Arg3 : Node_Id; ! Exp : Node_Id; ! Loc : Source_Ptr; ! Assoc : List_Id; ! Str : String_Id; ! ! procedure Replace_Type_Reference (N : Node_Id); ! -- Replace a single occurrence N of the subtype name with a reference ! -- to the formal of the predicate function. N can be an identifier ! -- referencing the subtype, or a selected component, representing an ! -- appropriately qualified occurrence of the subtype name. ! ! procedure Replace_Type_References is ! new Replace_Type_References_Generic (Replace_Type_Reference); ! -- Traverse an expression replacing all occurrences of the subtype ! -- name with appropriate references to the object that is the formal ! -- parameter of the predicate function. Note that we must ensure ! -- that the type and entity information is properly set in the ! -- replacement node, since we will do a Preanalyze call of this ! -- expression without proper visibility of the procedure argument. + ---------------------------- + -- Replace_Type_Reference -- + ---------------------------- + + procedure Replace_Type_Reference (N : Node_Id) is begin ! -- Invariant'Class, replace with T'Class (obj) ! if Class_Present (Ritem) then ! Rewrite (N, ! Make_Type_Conversion (Loc, ! Subtype_Mark => ! Make_Attribute_Reference (Loc, ! Prefix => New_Occurrence_Of (T, Loc), ! Attribute_Name => Name_Class), ! Expression => Make_Identifier (Loc, Object_Name))); ! ! Set_Entity (Expression (N), Object_Entity); ! Set_Etype (Expression (N), Typ); ! ! -- Invariant, replace with obj ! ! else ! Rewrite (N, Make_Identifier (Loc, Object_Name)); ! Set_Entity (N, Object_Entity); ! Set_Etype (N, Typ); ! end if; ! end Replace_Type_Reference; ! ! -- Start of processing for Add_Invariants ! ! begin ! Ritem := First_Rep_Item (T); ! while Present (Ritem) loop ! if Nkind (Ritem) = N_Pragma ! and then Pragma_Name (Ritem) = Name_Invariant ! then ! Arg1 := First (Pragma_Argument_Associations (Ritem)); ! Arg2 := Next (Arg1); ! Arg3 := Next (Arg2); ! ! Arg1 := Get_Pragma_Arg (Arg1); ! Arg2 := Get_Pragma_Arg (Arg2); ! ! -- For Inherit case, ignore Invariant, process only Class case ! ! if Inherit then ! if not Class_Present (Ritem) then ! goto Continue; end if; ! -- For Inherit false, process only item for right type ! else ! if Entity (Arg1) /= Typ then ! goto Continue; ! end if; ! end if; ! if No (Stmts) then ! Stmts := Empty_List; end if; ! Exp := New_Copy_Tree (Arg2); ! Loc := Sloc (Exp); ! -- We need to replace any occurrences of the name of the type ! -- with references to the object, converted to type'Class in ! -- the case of Invariant'Class aspects. ! Replace_Type_References (Exp, Chars (T)); ! -- Now we need to preanalyze the expression to properly capture ! -- the visibility in the visible part. The expression will not ! -- be analyzed for real until the body is analyzed, but that is ! -- at the end of the private part and has the wrong visibility. ! Set_Parent (Exp, N); ! Preanalyze_Spec_Expression (Exp, Standard_Boolean); ! -- Build first two arguments for Check pragma ! Assoc := New_List ( ! Make_Pragma_Argument_Association (Loc, ! Expression => Make_Identifier (Loc, Name_Invariant)), ! Make_Pragma_Argument_Association (Loc, Expression => Exp)); ! ! -- Add message if present in Invariant pragma ! ! if Present (Arg3) then ! Str := Strval (Get_Pragma_Arg (Arg3)); ! ! -- If inherited case, and message starts "failed invariant", ! -- change it to be "failed inherited invariant". ! ! if Inherit then ! String_To_Name_Buffer (Str); ! ! if Name_Buffer (1 .. 16) = "failed invariant" then ! Insert_Str_In_Name_Buffer ("inherited ", 8); ! Str := String_From_Name_Buffer; ! end if; ! end if; ! ! Append_To (Assoc, ! Make_Pragma_Argument_Association (Loc, ! Expression => Make_String_Literal (Loc, Str))); end if; ! -- Add Check pragma to list of statements ! Append_To (Stmts, ! Make_Pragma (Loc, ! Pragma_Identifier => ! Make_Identifier (Loc, Name_Check), ! Pragma_Argument_Associations => Assoc)); ! ! -- If Inherited case and option enabled, output info msg. Note ! -- that we know this is a case of Invariant'Class. ! ! if Inherit and Opt.List_Inherited_Aspects then ! Error_Msg_Sloc := Sloc (Ritem); ! Error_Msg_N ! ("?info: & inherits `Invariant''Class` aspect from #", ! Typ); end if; + end if; ! <> ! Next_Rep_Item (Ritem); ! end loop; ! end Add_Invariants; ! -- Start of processing for Build_Invariant_Procedure ! begin ! Stmts := No_List; ! PDecl := Empty; ! PBody := Empty; ! Set_Etype (Object_Entity, Typ); ! -- Add invariants for the current type ! Add_Invariants (Typ, Inherit => False); ! -- Add invariants for parent types ! declare ! Current_Typ : Entity_Id; ! Parent_Typ : Entity_Id; ! begin ! Current_Typ := Typ; ! loop ! Parent_Typ := Etype (Current_Typ); ! if Is_Private_Type (Parent_Typ) ! and then Present (Full_View (Base_Type (Parent_Typ))) ! then ! Parent_Typ := Full_View (Base_Type (Parent_Typ)); ! end if; ! exit when Parent_Typ = Current_Typ; ! Current_Typ := Parent_Typ; ! Add_Invariants (Current_Typ, Inherit => True); ! end loop; ! end; ! -- Build the procedure if we generated at least one Check pragma ! if Stmts /= No_List then ! -- Build procedure declaration ! SId := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Typ), "Invariant")); ! Set_Has_Invariants (SId); ! Set_Invariant_Procedure (Typ, SId); ! Spec := ! Make_Procedure_Specification (Loc, ! Defining_Unit_Name => SId, ! Parameter_Specifications => New_List ( ! Make_Parameter_Specification (Loc, ! Defining_Identifier => Object_Entity, ! Parameter_Type => New_Occurrence_Of (Typ, Loc)))); ! PDecl := Make_Subprogram_Declaration (Loc, Specification => Spec); ! -- Build procedure body ! ! SId := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Typ), "Invariant")); ! ! Spec := ! Make_Procedure_Specification (Loc, ! Defining_Unit_Name => SId, ! Parameter_Specifications => New_List ( ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, Object_Name), ! Parameter_Type => New_Occurrence_Of (Typ, Loc)))); ! ! PBody := ! Make_Subprogram_Body (Loc, ! Specification => Spec, ! Declarations => Empty_List, ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => Stmts)); ! ! -- Insert procedure declaration and spec at the appropriate points. ! -- Skip this if there are no private declarations (that's an error ! -- that will be diagnosed elsewhere, and there is no point in having ! -- an invariant procedure set if the full declaration is missing). ! ! if Present (Private_Decls) then ! ! -- The spec goes at the end of visible declarations, but they have ! -- already been analyzed, so we need to explicitly do the analyze. ! ! Append_To (Visible_Decls, PDecl); ! Analyze (PDecl); ! ! -- The body goes at the end of the private declarations, which we ! -- have not analyzed yet, so we do not need to perform an explicit ! -- analyze call. We skip this if there are no private declarations ! -- (this is an error that will be caught elsewhere); ! ! Append_To (Private_Decls, PBody); ! end if; ! end if; ! end Build_Invariant_Procedure; ! ! ------------------------------ ! -- Build_Predicate_Function -- ! ------------------------------ ! ! -- The procedure that is constructed here has the form ! ! -- function typPredicate (Ixxx : typ) return Boolean is ! -- begin ! -- return ! -- exp1 and then exp2 and then ... ! -- and then typ1Predicate (typ1 (Ixxx)) ! -- and then typ2Predicate (typ2 (Ixxx)) ! -- and then ...; ! -- end typPredicate; ! ! -- Here exp1, and exp2 are expressions from Predicate pragmas. Note that ! -- this is the point at which these expressions get analyzed, providing the ! -- required delay, and typ1, typ2, are entities from which predicates are ! -- inherited. Note that we do NOT generate Check pragmas, that's because we ! -- use this function even if checks are off, e.g. for membership tests. ! ! procedure Build_Predicate_Function (Typ : Entity_Id; N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (Typ); ! Spec : Node_Id; ! SId : Entity_Id; ! FDecl : Node_Id; ! FBody : Node_Id; ! ! Expr : Node_Id; ! -- This is the expression for the return statement in the function. It ! -- is build by connecting the component predicates with AND THEN. ! ! procedure Add_Call (T : Entity_Id); ! -- Includes a call to the predicate function for type T in Expr if T ! -- has predicates and Predicate_Function (T) is non-empty. ! ! procedure Add_Predicates; ! -- Appends expressions for any Predicate pragmas in the rep item chain ! -- Typ to Expr. Note that we look only at items for this exact entity. ! -- Inheritance of predicates for the parent type is done by calling the ! -- Predicate_Function of the parent type, using Add_Call above. ! ! Object_Name : constant Name_Id := New_Internal_Name ('I'); ! -- Name for argument of Predicate procedure ! ! -------------- ! -- Add_Call -- ! -------------- ! ! procedure Add_Call (T : Entity_Id) is ! Exp : Node_Id; ! ! begin ! if Present (T) and then Present (Predicate_Function (T)) then ! Set_Has_Predicates (Typ); ! ! -- Build the call to the predicate function of T ! ! Exp := ! Make_Predicate_Call ! (T, Convert_To (T, Make_Identifier (Loc, Object_Name))); ! ! -- Add call to evolving expression, using AND THEN if needed ! ! if No (Expr) then ! Expr := Exp; ! else ! Expr := ! Make_And_Then (Loc, ! Left_Opnd => Relocate_Node (Expr), ! Right_Opnd => Exp); ! end if; ! ! -- Output info message on inheritance if required. Note we do not ! -- give this information for generic actual types, since it is ! -- unwelcome noise in that case in instantiations. We also ! -- generally suppress the message in instantiations, and also ! -- if it involves internal names. ! ! if Opt.List_Inherited_Aspects ! and then not Is_Generic_Actual_Type (Typ) ! and then Instantiation_Depth (Sloc (Typ)) = 0 ! and then not Is_Internal_Name (Chars (T)) ! and then not Is_Internal_Name (Chars (Typ)) ! then ! Error_Msg_Sloc := Sloc (Predicate_Function (T)); ! Error_Msg_Node_2 := T; ! Error_Msg_N ("?info: & inherits predicate from & #", Typ); ! end if; ! end if; ! end Add_Call; ! ! -------------------- ! -- Add_Predicates -- ! -------------------- ! ! procedure Add_Predicates is ! Ritem : Node_Id; ! Arg1 : Node_Id; ! Arg2 : Node_Id; ! ! procedure Replace_Type_Reference (N : Node_Id); ! -- Replace a single occurrence N of the subtype name with a reference ! -- to the formal of the predicate function. N can be an identifier ! -- referencing the subtype, or a selected component, representing an ! -- appropriately qualified occurrence of the subtype name. ! ! procedure Replace_Type_References is ! new Replace_Type_References_Generic (Replace_Type_Reference); ! -- Traverse an expression changing every occurrence of an identifier ! -- whose name matches the name of the subtype with a reference to ! -- the formal parameter of the predicate function. ! ! ---------------------------- ! -- Replace_Type_Reference -- ! ---------------------------- ! ! procedure Replace_Type_Reference (N : Node_Id) is ! begin ! Rewrite (N, Make_Identifier (Loc, Object_Name)); ! end Replace_Type_Reference; ! ! -- Start of processing for Add_Predicates ! ! begin ! Ritem := First_Rep_Item (Typ); ! while Present (Ritem) loop ! if Nkind (Ritem) = N_Pragma ! and then Pragma_Name (Ritem) = Name_Predicate ! then ! Arg1 := First (Pragma_Argument_Associations (Ritem)); ! Arg2 := Next (Arg1); ! ! Arg1 := Get_Pragma_Arg (Arg1); ! Arg2 := Get_Pragma_Arg (Arg2); ! ! -- See if this predicate pragma is for the current type ! ! if Entity (Arg1) = Typ then ! ! -- We have a match, this entry is for our subtype ! ! -- First We need to replace any occurrences of the name of ! -- the type with references to the object. ! ! Replace_Type_References (Arg2, Chars (Typ)); ! ! -- OK, replacement complete, now we can add the expression ! ! if No (Expr) then ! Expr := Relocate_Node (Arg2); ! ! -- There already was a predicate, so add to it else ! Expr := ! Make_And_Then (Loc, ! Left_Opnd => Relocate_Node (Expr), ! Right_Opnd => Relocate_Node (Arg2)); end if; ! end if; ! end if; ! Next_Rep_Item (Ritem); ! end loop; ! end Add_Predicates; ! -- Start of processing for Build_Predicate_Function ! ! begin ! -- Initialize for construction of statement list ! ! Expr := Empty; ! ! -- Return if already built or if type does not have predicates ! ! if not Has_Predicates (Typ) ! or else Present (Predicate_Function (Typ)) ! then ! return; end if; ! -- Add Predicates for the current type ! Add_Predicates; ! -- Add predicates for ancestor if present ! declare ! Atyp : constant Entity_Id := Nearest_Ancestor (Typ); ! begin ! if Present (Atyp) then ! Add_Call (Atyp); ! end if; ! end; ! -- If we have predicates, build the function ! if Present (Expr) then ! -- Build function declaration ! pragma Assert (Has_Predicates (Typ)); ! SId := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Typ), "Predicate")); ! Set_Has_Predicates (SId); ! Set_Predicate_Function (Typ, SId); ! ! Spec := ! Make_Function_Specification (Loc, ! Defining_Unit_Name => SId, ! Parameter_Specifications => New_List ( ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, Object_Name), ! Parameter_Type => New_Occurrence_Of (Typ, Loc))), ! Result_Definition => ! New_Occurrence_Of (Standard_Boolean, Loc)); ! ! FDecl := Make_Subprogram_Declaration (Loc, Specification => Spec); ! ! -- Build function body ! ! SId := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Typ), "Predicate")); ! ! Spec := ! Make_Function_Specification (Loc, ! Defining_Unit_Name => SId, ! Parameter_Specifications => New_List ( ! Make_Parameter_Specification (Loc, ! Defining_Identifier => ! Make_Defining_Identifier (Loc, Object_Name), ! Parameter_Type => ! New_Occurrence_Of (Typ, Loc))), ! Result_Definition => ! New_Occurrence_Of (Standard_Boolean, Loc)); ! ! FBody := ! Make_Subprogram_Body (Loc, ! Specification => Spec, ! Declarations => Empty_List, ! Handled_Statement_Sequence => ! Make_Handled_Sequence_Of_Statements (Loc, ! Statements => New_List ( ! Make_Simple_Return_Statement (Loc, ! Expression => Expr)))); ! ! -- Insert declaration before freeze node and body after ! ! Insert_Before_And_Analyze (N, FDecl); ! Insert_After_And_Analyze (N, FBody); ! ! -- Deal with static predicate case ! ! if Ekind_In (Typ, E_Enumeration_Subtype, ! E_Modular_Integer_Subtype, ! E_Signed_Integer_Subtype) ! and then Is_Static_Subtype (Typ) ! then ! Build_Static_Predicate (Typ, Expr, Object_Name); end if; end if; + end Build_Predicate_Function; ! ---------------------------- ! -- Build_Static_Predicate -- ! ---------------------------- ! procedure Build_Static_Predicate ! (Typ : Entity_Id; ! Expr : Node_Id; ! Nam : Name_Id) ! is ! Loc : constant Source_Ptr := Sloc (Expr); ! Non_Static : exception; ! -- Raised if something non-static is found ! ! Btyp : constant Entity_Id := Base_Type (Typ); ! ! BLo : constant Uint := Expr_Value (Type_Low_Bound (Btyp)); ! BHi : constant Uint := Expr_Value (Type_High_Bound (Btyp)); ! -- Low bound and high bound value of base type of Typ ! ! TLo : constant Uint := Expr_Value (Type_Low_Bound (Typ)); ! THi : constant Uint := Expr_Value (Type_High_Bound (Typ)); ! -- Low bound and high bound values of static subtype Typ ! ! type REnt is record ! Lo, Hi : Uint; ! end record; ! -- One entry in a Rlist value, a single REnt (range entry) value ! -- denotes one range from Lo to Hi. To represent a single value ! -- range Lo = Hi = value. ! ! type RList is array (Nat range <>) of REnt; ! -- A list of ranges. The ranges are sorted in increasing order, ! -- and are disjoint (there is a gap of at least one value between ! -- each range in the table). A value is in the set of ranges in ! -- Rlist if it lies within one of these ranges ! ! False_Range : constant RList := ! RList'(1 .. 0 => REnt'(No_Uint, No_Uint)); ! -- An empty set of ranges represents a range list that can never be ! -- satisfied, since there are no ranges in which the value could lie, ! -- so it does not lie in any of them. False_Range is a canonical value ! -- for this empty set, but general processing should test for an Rlist ! -- with length zero (see Is_False predicate), since other null ranges ! -- may appear which must be treated as False. ! ! True_Range : constant RList := RList'(1 => REnt'(BLo, BHi)); ! -- Range representing True, value must be in the base range ! ! function "and" (Left, Right : RList) return RList; ! -- And's together two range lists, returning a range list. This is ! -- a set intersection operation. ! ! function "or" (Left, Right : RList) return RList; ! -- Or's together two range lists, returning a range list. This is a ! -- set union operation. ! ! function "not" (Right : RList) return RList; ! -- Returns complement of a given range list, i.e. a range list ! -- representing all the values in TLo .. THi that are not in the ! -- input operand Right. ! ! function Build_Val (V : Uint) return Node_Id; ! -- Return an analyzed N_Identifier node referencing this value, suitable ! -- for use as an entry in the Static_Predicate list. This node is typed ! -- with the base type. ! ! function Build_Range (Lo, Hi : Uint) return Node_Id; ! -- Return an analyzed N_Range node referencing this range, suitable ! -- for use as an entry in the Static_Predicate list. This node is typed ! -- with the base type. ! ! function Get_RList (Exp : Node_Id) return RList; ! -- This is a recursive routine that converts the given expression into ! -- a list of ranges, suitable for use in building the static predicate. ! ! function Is_False (R : RList) return Boolean; ! pragma Inline (Is_False); ! -- Returns True if the given range list is empty, and thus represents ! -- a False list of ranges that can never be satisfied. ! ! function Is_True (R : RList) return Boolean; ! -- Returns True if R trivially represents the True predicate by having ! -- a single range from BLo to BHi. ! ! function Is_Type_Ref (N : Node_Id) return Boolean; ! pragma Inline (Is_Type_Ref); ! -- Returns if True if N is a reference to the type for the predicate in ! -- the expression (i.e. if it is an identifier whose Chars field matches ! -- the Nam given in the call). ! ! function Lo_Val (N : Node_Id) return Uint; ! -- Given static expression or static range from a Static_Predicate list, ! -- gets expression value or low bound of range. ! ! function Hi_Val (N : Node_Id) return Uint; ! -- Given static expression or static range from a Static_Predicate list, ! -- gets expression value of high bound of range. ! ! function Membership_Entry (N : Node_Id) return RList; ! -- Given a single membership entry (range, value, or subtype), returns ! -- the corresponding range list. Raises Static_Error if not static. ! ! function Membership_Entries (N : Node_Id) return RList; ! -- Given an element on an alternatives list of a membership operation, ! -- returns the range list corresponding to this entry and all following ! -- entries (i.e. returns the "or" of this list of values). ! ! function Stat_Pred (Typ : Entity_Id) return RList; ! -- Given a type, if it has a static predicate, then return the predicate ! -- as a range list, otherwise raise Non_Static. ! ! ----------- ! -- "and" -- ! ----------- ! ! function "and" (Left, Right : RList) return RList is ! FEnt : REnt; ! -- First range of result ! ! SLeft : Nat := Left'First; ! -- Start of rest of left entries ! ! SRight : Nat := Right'First; ! -- Start of rest of right entries ! ! begin ! -- If either range is True, return the other ! ! if Is_True (Left) then ! return Right; ! elsif Is_True (Right) then ! return Left; ! end if; ! ! -- If either range is False, return False ! ! if Is_False (Left) or else Is_False (Right) then ! return False_Range; ! end if; ! ! -- Loop to remove entries at start that are disjoint, and thus ! -- just get discarded from the result entirely. ! ! loop ! -- If no operands left in either operand, result is false ! ! if SLeft > Left'Last or else SRight > Right'Last then ! return False_Range; ! ! -- Discard first left operand entry if disjoint with right ! ! elsif Left (SLeft).Hi < Right (SRight).Lo then ! SLeft := SLeft + 1; ! ! -- Discard first right operand entry if disjoint with left ! ! elsif Right (SRight).Hi < Left (SLeft).Lo then ! SRight := SRight + 1; ! ! -- Otherwise we have an overlapping entry ! ! else ! exit; ! end if; end loop; ! -- Now we have two non-null operands, and first entries overlap. ! -- The first entry in the result will be the overlapping part of ! -- these two entries. ! ! FEnt := REnt'(Lo => UI_Max (Left (SLeft).Lo, Right (SRight).Lo), ! Hi => UI_Min (Left (SLeft).Hi, Right (SRight).Hi)); ! ! -- Now we can remove the entry that ended at a lower value, since ! -- its contribution is entirely contained in Fent. ! ! if Left (SLeft).Hi <= Right (SRight).Hi then ! SLeft := SLeft + 1; ! else ! SRight := SRight + 1; ! end if; ! ! -- Compute result by concatenating this first entry with the "and" ! -- of the remaining parts of the left and right operands. Note that ! -- if either of these is empty, "and" will yield empty, so that we ! -- will end up with just Fent, which is what we want in that case. ! ! return ! FEnt & (Left (SLeft .. Left'Last) and Right (SRight .. Right'Last)); ! end "and"; ! ! ----------- ! -- "not" -- ! ----------- ! ! function "not" (Right : RList) return RList is ! begin ! -- Return True if False range ! ! if Is_False (Right) then ! return True_Range; ! end if; ! ! -- Return False if True range ! ! if Is_True (Right) then ! return False_Range; ! end if; ! ! -- Here if not trivial case declare ! Result : RList (1 .. Right'Length + 1); ! -- May need one more entry for gap at beginning and end ! ! Count : Nat := 0; ! -- Number of entries stored in Result begin ! -- Gap at start ! ! if Right (Right'First).Lo > TLo then ! Count := Count + 1; ! Result (Count) := REnt'(TLo, Right (Right'First).Lo - 1); ! end if; ! ! -- Gaps between ranges ! ! for J in Right'First .. Right'Last - 1 loop ! Count := Count + 1; ! Result (Count) := ! REnt'(Right (J).Hi + 1, Right (J + 1).Lo - 1); ! end loop; ! ! -- Gap at end ! ! if Right (Right'Last).Hi < THi then ! Count := Count + 1; ! Result (Count) := REnt'(Right (Right'Last).Hi + 1, THi); ! end if; ! ! return Result (1 .. Count); ! end; ! end "not"; ! ! ---------- ! -- "or" -- ! ---------- ! ! function "or" (Left, Right : RList) return RList is ! FEnt : REnt; ! -- First range of result ! ! SLeft : Nat := Left'First; ! -- Start of rest of left entries ! ! SRight : Nat := Right'First; ! -- Start of rest of right entries ! ! begin ! -- If either range is True, return True ! ! if Is_True (Left) or else Is_True (Right) then ! return True_Range; ! end if; ! ! -- If either range is False (empty), return the other ! ! if Is_False (Left) then ! return Right; ! elsif Is_False (Right) then ! return Left; ! end if; ! ! -- Initialize result first entry from left or right operand ! -- depending on which starts with the lower range. ! ! if Left (SLeft).Lo < Right (SRight).Lo then ! FEnt := Left (SLeft); ! SLeft := SLeft + 1; ! else ! FEnt := Right (SRight); ! SRight := SRight + 1; ! end if; ! ! -- This loop eats ranges from left and right operands that ! -- are contiguous with the first range we are gathering. ! ! loop ! -- Eat first entry in left operand if contiguous or ! -- overlapped by gathered first operand of result. ! ! if SLeft <= Left'Last ! and then Left (SLeft).Lo <= FEnt.Hi + 1 ! then ! FEnt.Hi := UI_Max (FEnt.Hi, Left (SLeft).Hi); ! SLeft := SLeft + 1; ! ! -- Eat first entry in right operand if contiguous or ! -- overlapped by gathered right operand of result. ! ! elsif SRight <= Right'Last ! and then Right (SRight).Lo <= FEnt.Hi + 1 ! then ! FEnt.Hi := UI_Max (FEnt.Hi, Right (SRight).Hi); ! SRight := SRight + 1; ! ! -- All done if no more entries to eat! ! ! else ! exit; ! end if; ! end loop; ! ! -- Obtain result as the first entry we just computed, concatenated ! -- to the "or" of the remaining results (if one operand is empty, ! -- this will just concatenate with the other ! ! return ! FEnt & (Left (SLeft .. Left'Last) or Right (SRight .. Right'Last)); ! end "or"; ! ! ----------------- ! -- Build_Range -- ! ----------------- ! ! function Build_Range (Lo, Hi : Uint) return Node_Id is ! Result : Node_Id; ! begin ! if Lo = Hi then ! return Build_Val (Hi); ! else ! Result := ! Make_Range (Loc, ! Low_Bound => Build_Val (Lo), ! High_Bound => Build_Val (Hi)); ! Set_Etype (Result, Btyp); ! Set_Analyzed (Result); ! return Result; ! end if; ! end Build_Range; ! ! --------------- ! -- Build_Val -- ! --------------- ! ! function Build_Val (V : Uint) return Node_Id is ! Result : Node_Id; ! ! begin ! if Is_Enumeration_Type (Typ) then ! Result := Get_Enum_Lit_From_Pos (Typ, V, Loc); ! else ! Result := Make_Integer_Literal (Loc, V); ! end if; ! ! Set_Etype (Result, Btyp); ! Set_Is_Static_Expression (Result); ! Set_Analyzed (Result); ! return Result; ! end Build_Val; ! ! --------------- ! -- Get_RList -- ! --------------- ! ! function Get_RList (Exp : Node_Id) return RList is ! Op : Node_Kind; ! Val : Uint; ! ! begin ! -- Static expression can only be true or false ! ! if Is_OK_Static_Expression (Exp) then ! ! -- For False ! ! if Expr_Value (Exp) = 0 then ! return False_Range; ! else ! return True_Range; ! end if; ! end if; ! ! -- Otherwise test node type ! ! Op := Nkind (Exp); ! ! case Op is ! ! -- And ! ! when N_Op_And | N_And_Then => ! return Get_RList (Left_Opnd (Exp)) ! and ! Get_RList (Right_Opnd (Exp)); ! ! -- Or ! ! when N_Op_Or | N_Or_Else => ! return Get_RList (Left_Opnd (Exp)) ! or ! Get_RList (Right_Opnd (Exp)); ! ! -- Not ! ! when N_Op_Not => ! return not Get_RList (Right_Opnd (Exp)); ! ! -- Comparisons of type with static value ! ! when N_Op_Compare => ! -- Type is left operand ! ! if Is_Type_Ref (Left_Opnd (Exp)) ! and then Is_OK_Static_Expression (Right_Opnd (Exp)) ! then ! Val := Expr_Value (Right_Opnd (Exp)); ! ! -- Typ is right operand ! ! elsif Is_Type_Ref (Right_Opnd (Exp)) ! and then Is_OK_Static_Expression (Left_Opnd (Exp)) ! then ! Val := Expr_Value (Left_Opnd (Exp)); ! ! -- Invert sense of comparison ! ! case Op is ! when N_Op_Gt => Op := N_Op_Lt; ! when N_Op_Lt => Op := N_Op_Gt; ! when N_Op_Ge => Op := N_Op_Le; ! when N_Op_Le => Op := N_Op_Ge; ! when others => null; ! end case; ! ! -- Other cases are non-static else ! raise Non_Static; end if; ! -- Construct range according to comparison operation ! case Op is ! when N_Op_Eq => ! return RList'(1 => REnt'(Val, Val)); ! when N_Op_Ge => ! return RList'(1 => REnt'(Val, BHi)); ! ! when N_Op_Gt => ! return RList'(1 => REnt'(Val + 1, BHi)); ! ! when N_Op_Le => ! return RList'(1 => REnt'(BLo, Val)); ! ! when N_Op_Lt => ! return RList'(1 => REnt'(BLo, Val - 1)); ! ! when N_Op_Ne => ! return RList'(REnt'(BLo, Val - 1), ! REnt'(Val + 1, BHi)); ! ! when others => ! raise Program_Error; ! end case; ! ! -- Membership (IN) ! ! when N_In => ! if not Is_Type_Ref (Left_Opnd (Exp)) then ! raise Non_Static; ! end if; ! ! if Present (Right_Opnd (Exp)) then ! return Membership_Entry (Right_Opnd (Exp)); ! else ! return Membership_Entries (First (Alternatives (Exp))); ! end if; ! ! -- Negative membership (NOT IN) ! ! when N_Not_In => ! if not Is_Type_Ref (Left_Opnd (Exp)) then ! raise Non_Static; ! end if; ! ! if Present (Right_Opnd (Exp)) then ! return not Membership_Entry (Right_Opnd (Exp)); ! else ! return not Membership_Entries (First (Alternatives (Exp))); ! end if; ! ! -- Function call, may be call to static predicate ! ! when N_Function_Call => ! if Is_Entity_Name (Name (Exp)) then ! declare ! Ent : constant Entity_Id := Entity (Name (Exp)); ! begin ! if Has_Predicates (Ent) then ! return Stat_Pred (Etype (First_Formal (Ent))); ! end if; ! end; ! end if; ! ! -- Other function call cases are non-static ! ! raise Non_Static; ! ! -- Qualified expression, dig out the expression ! ! when N_Qualified_Expression => ! return Get_RList (Expression (Exp)); ! ! -- Xor operator ! ! when N_Op_Xor => ! return (Get_RList (Left_Opnd (Exp)) ! and not Get_RList (Right_Opnd (Exp))) ! or (Get_RList (Right_Opnd (Exp)) ! and not Get_RList (Left_Opnd (Exp))); ! ! -- Any other node type is non-static ! ! when others => ! raise Non_Static; ! end case; ! end Get_RList; ! ! ------------ ! -- Hi_Val -- ! ------------ ! ! function Hi_Val (N : Node_Id) return Uint is ! begin ! if Is_Static_Expression (N) then ! return Expr_Value (N); ! else ! pragma Assert (Nkind (N) = N_Range); ! return Expr_Value (High_Bound (N)); ! end if; ! end Hi_Val; ! ! -------------- ! -- Is_False -- ! -------------- ! ! function Is_False (R : RList) return Boolean is ! begin ! return R'Length = 0; ! end Is_False; ! ! ------------- ! -- Is_True -- ! ------------- ! ! function Is_True (R : RList) return Boolean is ! begin ! return R'Length = 1 ! and then R (R'First).Lo = BLo ! and then R (R'First).Hi = BHi; ! end Is_True; ! ! ----------------- ! -- Is_Type_Ref -- ! ----------------- ! ! function Is_Type_Ref (N : Node_Id) return Boolean is ! begin ! return Nkind (N) = N_Identifier and then Chars (N) = Nam; ! end Is_Type_Ref; ! ! ------------ ! -- Lo_Val -- ! ------------ ! ! function Lo_Val (N : Node_Id) return Uint is ! begin ! if Is_Static_Expression (N) then ! return Expr_Value (N); ! else ! pragma Assert (Nkind (N) = N_Range); ! return Expr_Value (Low_Bound (N)); ! end if; ! end Lo_Val; ! ! ------------------------ ! -- Membership_Entries -- ! ------------------------ ! ! function Membership_Entries (N : Node_Id) return RList is ! begin ! if No (Next (N)) then ! return Membership_Entry (N); ! else ! return Membership_Entry (N) or Membership_Entries (Next (N)); ! end if; ! end Membership_Entries; ! ! ---------------------- ! -- Membership_Entry -- ! ---------------------- ! ! function Membership_Entry (N : Node_Id) return RList is ! Val : Uint; ! SLo : Uint; ! SHi : Uint; ! ! begin ! -- Range case ! ! if Nkind (N) = N_Range then ! if not Is_Static_Expression (Low_Bound (N)) ! or else ! not Is_Static_Expression (High_Bound (N)) then ! raise Non_Static; ! else ! SLo := Expr_Value (Low_Bound (N)); ! SHi := Expr_Value (High_Bound (N)); ! return RList'(1 => REnt'(SLo, SHi)); ! end if; ! -- Static expression case ! ! elsif Is_Static_Expression (N) then ! Val := Expr_Value (N); ! return RList'(1 => REnt'(Val, Val)); ! ! -- Identifier (other than static expression) case ! ! else pragma Assert (Nkind (N) = N_Identifier); ! ! -- Type case ! ! if Is_Type (Entity (N)) then ! ! -- If type has predicates, process them ! ! if Has_Predicates (Entity (N)) then ! return Stat_Pred (Entity (N)); ! ! -- For static subtype without predicates, get range ! ! elsif Is_Static_Subtype (Entity (N)) then ! SLo := Expr_Value (Type_Low_Bound (Entity (N))); ! SHi := Expr_Value (Type_High_Bound (Entity (N))); ! return RList'(1 => REnt'(SLo, SHi)); ! ! -- Any other type makes us non-static ! ! else ! raise Non_Static; ! end if; ! ! -- Any other kind of identifier in predicate (e.g. a non-static ! -- expression value) means this is not a static predicate. ! ! else ! raise Non_Static; end if; ! end if; ! end Membership_Entry; ! --------------- ! -- Stat_Pred -- ! --------------- ! function Stat_Pred (Typ : Entity_Id) return RList is ! begin ! -- Not static if type does not have static predicates ! if not Has_Predicates (Typ) ! or else No (Static_Predicate (Typ)) then ! raise Non_Static; end if; ! -- Otherwise we convert the predicate list to a range list declare ! Result : RList (1 .. List_Length (Static_Predicate (Typ))); ! P : Node_Id; begin ! P := First (Static_Predicate (Typ)); ! for J in Result'Range loop ! Result (J) := REnt'(Lo_Val (P), Hi_Val (P)); ! Next (P); ! end loop; ! ! return Result; ! end; ! end Stat_Pred; ! ! -- Start of processing for Build_Static_Predicate ! ! begin ! -- Now analyze the expression to see if it is a static predicate ! ! declare ! Ranges : constant RList := Get_RList (Expr); ! -- Range list from expression if it is static ! ! Plist : List_Id; ! ! begin ! -- Convert range list into a form for the static predicate. In the ! -- Ranges array, we just have raw ranges, these must be converted ! -- to properly typed and analyzed static expressions or range nodes. ! ! -- Note: here we limit ranges to the ranges of the subtype, so that ! -- a predicate is always false for values outside the subtype. That ! -- seems fine, such values are invalid anyway, and considering them ! -- to fail the predicate seems allowed and friendly, and furthermore ! -- simplifies processing for case statements and loops. ! ! Plist := New_List; ! ! for J in Ranges'Range loop ! declare ! Lo : Uint := Ranges (J).Lo; ! Hi : Uint := Ranges (J).Hi; ! ! begin ! -- Ignore completely out of range entry ! ! if Hi < TLo or else Lo > THi then ! null; ! ! -- Otherwise process entry ! ! else ! -- Adjust out of range value to subtype range ! ! if Lo < TLo then ! Lo := TLo; ! end if; ! ! if Hi > THi then ! Hi := THi; ! end if; ! ! -- Convert range into required form ! ! if Lo = Hi then ! Append_To (Plist, Build_Val (Lo)); ! else ! Append_To (Plist, Build_Range (Lo, Hi)); ! end if; ! end if; ! end; ! end loop; ! ! -- Processing was successful and all entries were static, so now we ! -- can store the result as the predicate list. ! ! Set_Static_Predicate (Typ, Plist); ! ! -- The processing for static predicates put the expression into ! -- canonical form as a series of ranges. It also eliminated ! -- duplicates and collapsed and combined ranges. We might as well ! -- replace the alternatives list of the right operand of the ! -- membership test with the static predicate list, which will ! -- usually be more efficient. ! ! declare ! New_Alts : constant List_Id := New_List; ! Old_Node : Node_Id; ! New_Node : Node_Id; ! ! begin ! Old_Node := First (Plist); ! while Present (Old_Node) loop ! New_Node := New_Copy (Old_Node); ! ! if Nkind (New_Node) = N_Range then ! Set_Low_Bound (New_Node, New_Copy (Low_Bound (Old_Node))); ! Set_High_Bound (New_Node, New_Copy (High_Bound (Old_Node))); ! end if; ! ! Append_To (New_Alts, New_Node); ! Next (Old_Node); ! end loop; ! ! -- If empty list, replace by False ! ! if Is_Empty_List (New_Alts) then ! Rewrite (Expr, New_Occurrence_Of (Standard_False, Loc)); ! ! -- Else replace by set membership test ! else ! Rewrite (Expr, ! Make_In (Loc, ! Left_Opnd => Make_Identifier (Loc, Nam), ! Right_Opnd => Empty, ! Alternatives => New_Alts)); ! ! -- Resolve new expression in function context ! ! Install_Formals (Predicate_Function (Typ)); ! Push_Scope (Predicate_Function (Typ)); ! Analyze_And_Resolve (Expr, Standard_Boolean); ! Pop_Scope; end if; end; ! end; ! ! -- If non-static, return doing nothing ! ! exception ! when Non_Static => ! return; ! end Build_Static_Predicate; ----------------------------------- -- Check_Constant_Address_Clause -- *************** package body Sem_Ch13 is *** 3203,3213 **** -- Otherwise look at the identifier and see if it is OK ! if Ekind (Ent) = E_Named_Integer ! or else ! Ekind (Ent) = E_Named_Real ! or else ! Is_Type (Ent) then return; --- 5072,5079 ---- -- Otherwise look at the identifier and see if it is OK ! if Ekind_In (Ent, E_Named_Integer, E_Named_Real) ! or else Is_Type (Ent) then return; *************** package body Sem_Ch13 is *** 3403,3411 **** -- Start of processing for Check_Constant_Address_Clause begin ! Check_Expr_Constants (Expr); end Check_Constant_Address_Clause; ---------------- -- Check_Size -- ---------------- --- 5269,6020 ---- -- Start of processing for Check_Constant_Address_Clause begin ! -- If rep_clauses are to be ignored, no need for legality checks. In ! -- particular, no need to pester user about rep clauses that violate ! -- the rule on constant addresses, given that these clauses will be ! -- removed by Freeze before they reach the back end. ! ! if not Ignore_Rep_Clauses then ! Check_Expr_Constants (Expr); ! end if; end Check_Constant_Address_Clause; + ---------------------------------------- + -- Check_Record_Representation_Clause -- + ---------------------------------------- + + procedure Check_Record_Representation_Clause (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + Ident : constant Node_Id := Identifier (N); + Rectype : Entity_Id; + Fent : Entity_Id; + CC : Node_Id; + Fbit : Uint; + Lbit : Uint; + Hbit : Uint := Uint_0; + Comp : Entity_Id; + Pcomp : Entity_Id; + + Max_Bit_So_Far : Uint; + -- Records the maximum bit position so far. If all field positions + -- are monotonically increasing, then we can skip the circuit for + -- checking for overlap, since no overlap is possible. + + Tagged_Parent : Entity_Id := Empty; + -- This is set in the case of a derived tagged type for which we have + -- Is_Fully_Repped_Tagged_Type True (indicating that all components are + -- positioned by record representation clauses). In this case we must + -- check for overlap between components of this tagged type, and the + -- components of its parent. Tagged_Parent will point to this parent + -- type. For all other cases Tagged_Parent is left set to Empty. + + Parent_Last_Bit : Uint; + -- Relevant only if Tagged_Parent is set, Parent_Last_Bit indicates the + -- last bit position for any field in the parent type. We only need to + -- check overlap for fields starting below this point. + + Overlap_Check_Required : Boolean; + -- Used to keep track of whether or not an overlap check is required + + Overlap_Detected : Boolean := False; + -- Set True if an overlap is detected + + Ccount : Natural := 0; + -- Number of component clauses in record rep clause + + procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id); + -- Given two entities for record components or discriminants, checks + -- if they have overlapping component clauses and issues errors if so. + + procedure Find_Component; + -- Finds component entity corresponding to current component clause (in + -- CC), and sets Comp to the entity, and Fbit/Lbit to the zero origin + -- start/stop bits for the field. If there is no matching component or + -- if the matching component does not have a component clause, then + -- that's an error and Comp is set to Empty, but no error message is + -- issued, since the message was already given. Comp is also set to + -- Empty if the current "component clause" is in fact a pragma. + + ----------------------------- + -- Check_Component_Overlap -- + ----------------------------- + + procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id) is + CC1 : constant Node_Id := Component_Clause (C1_Ent); + CC2 : constant Node_Id := Component_Clause (C2_Ent); + + begin + if Present (CC1) and then Present (CC2) then + + -- Exclude odd case where we have two tag fields in the same + -- record, both at location zero. This seems a bit strange, but + -- it seems to happen in some circumstances, perhaps on an error. + + if Chars (C1_Ent) = Name_uTag + and then + Chars (C2_Ent) = Name_uTag + then + return; + end if; + + -- Here we check if the two fields overlap + + declare + S1 : constant Uint := Component_Bit_Offset (C1_Ent); + S2 : constant Uint := Component_Bit_Offset (C2_Ent); + E1 : constant Uint := S1 + Esize (C1_Ent); + E2 : constant Uint := S2 + Esize (C2_Ent); + + begin + if E2 <= S1 or else E1 <= S2 then + null; + else + Error_Msg_Node_2 := Component_Name (CC2); + Error_Msg_Sloc := Sloc (Error_Msg_Node_2); + Error_Msg_Node_1 := Component_Name (CC1); + Error_Msg_N + ("component& overlaps & #", Component_Name (CC1)); + Overlap_Detected := True; + end if; + end; + end if; + end Check_Component_Overlap; + + -------------------- + -- Find_Component -- + -------------------- + + procedure Find_Component is + + procedure Search_Component (R : Entity_Id); + -- Search components of R for a match. If found, Comp is set. + + ---------------------- + -- Search_Component -- + ---------------------- + + procedure Search_Component (R : Entity_Id) is + begin + Comp := First_Component_Or_Discriminant (R); + while Present (Comp) loop + + -- Ignore error of attribute name for component name (we + -- already gave an error message for this, so no need to + -- complain here) + + if Nkind (Component_Name (CC)) = N_Attribute_Reference then + null; + else + exit when Chars (Comp) = Chars (Component_Name (CC)); + end if; + + Next_Component_Or_Discriminant (Comp); + end loop; + end Search_Component; + + -- Start of processing for Find_Component + + begin + -- Return with Comp set to Empty if we have a pragma + + if Nkind (CC) = N_Pragma then + Comp := Empty; + return; + end if; + + -- Search current record for matching component + + Search_Component (Rectype); + + -- If not found, maybe component of base type that is absent from + -- statically constrained first subtype. + + if No (Comp) then + Search_Component (Base_Type (Rectype)); + end if; + + -- If no component, or the component does not reference the component + -- clause in question, then there was some previous error for which + -- we already gave a message, so just return with Comp Empty. + + if No (Comp) + or else Component_Clause (Comp) /= CC + then + Comp := Empty; + + -- Normal case where we have a component clause + + else + Fbit := Component_Bit_Offset (Comp); + Lbit := Fbit + Esize (Comp) - 1; + end if; + end Find_Component; + + -- Start of processing for Check_Record_Representation_Clause + + begin + Find_Type (Ident); + Rectype := Entity (Ident); + + if Rectype = Any_Type then + return; + else + Rectype := Underlying_Type (Rectype); + end if; + + -- See if we have a fully repped derived tagged type + + declare + PS : constant Entity_Id := Parent_Subtype (Rectype); + + begin + if Present (PS) and then Is_Fully_Repped_Tagged_Type (PS) then + Tagged_Parent := PS; + + -- Find maximum bit of any component of the parent type + + Parent_Last_Bit := UI_From_Int (System_Address_Size - 1); + Pcomp := First_Entity (Tagged_Parent); + while Present (Pcomp) loop + if Ekind_In (Pcomp, E_Discriminant, E_Component) then + if Component_Bit_Offset (Pcomp) /= No_Uint + and then Known_Static_Esize (Pcomp) + then + Parent_Last_Bit := + UI_Max + (Parent_Last_Bit, + Component_Bit_Offset (Pcomp) + Esize (Pcomp) - 1); + end if; + + Next_Entity (Pcomp); + end if; + end loop; + end if; + end; + + -- All done if no component clauses + + CC := First (Component_Clauses (N)); + + if No (CC) then + return; + end if; + + -- If a tag is present, then create a component clause that places it + -- at the start of the record (otherwise gigi may place it after other + -- fields that have rep clauses). + + Fent := First_Entity (Rectype); + + if Nkind (Fent) = N_Defining_Identifier + and then Chars (Fent) = Name_uTag + then + Set_Component_Bit_Offset (Fent, Uint_0); + Set_Normalized_Position (Fent, Uint_0); + Set_Normalized_First_Bit (Fent, Uint_0); + Set_Normalized_Position_Max (Fent, Uint_0); + Init_Esize (Fent, System_Address_Size); + + Set_Component_Clause (Fent, + Make_Component_Clause (Loc, + Component_Name => Make_Identifier (Loc, Name_uTag), + + Position => Make_Integer_Literal (Loc, Uint_0), + First_Bit => Make_Integer_Literal (Loc, Uint_0), + Last_Bit => + Make_Integer_Literal (Loc, + UI_From_Int (System_Address_Size)))); + + Ccount := Ccount + 1; + end if; + + Max_Bit_So_Far := Uint_Minus_1; + Overlap_Check_Required := False; + + -- Process the component clauses + + while Present (CC) loop + Find_Component; + + if Present (Comp) then + Ccount := Ccount + 1; + + -- We need a full overlap check if record positions non-monotonic + + if Fbit <= Max_Bit_So_Far then + Overlap_Check_Required := True; + end if; + + Max_Bit_So_Far := Lbit; + + -- Check bit position out of range of specified size + + if Has_Size_Clause (Rectype) + and then Esize (Rectype) <= Lbit + then + Error_Msg_N + ("bit number out of range of specified size", + Last_Bit (CC)); + + -- Check for overlap with tag field + + else + if Is_Tagged_Type (Rectype) + and then Fbit < System_Address_Size + then + Error_Msg_NE + ("component overlaps tag field of&", + Component_Name (CC), Rectype); + Overlap_Detected := True; + end if; + + if Hbit < Lbit then + Hbit := Lbit; + end if; + end if; + + -- Check parent overlap if component might overlap parent field + + if Present (Tagged_Parent) + and then Fbit <= Parent_Last_Bit + then + Pcomp := First_Component_Or_Discriminant (Tagged_Parent); + while Present (Pcomp) loop + if not Is_Tag (Pcomp) + and then Chars (Pcomp) /= Name_uParent + then + Check_Component_Overlap (Comp, Pcomp); + end if; + + Next_Component_Or_Discriminant (Pcomp); + end loop; + end if; + end if; + + Next (CC); + end loop; + + -- Now that we have processed all the component clauses, check for + -- overlap. We have to leave this till last, since the components can + -- appear in any arbitrary order in the representation clause. + + -- We do not need this check if all specified ranges were monotonic, + -- as recorded by Overlap_Check_Required being False at this stage. + + -- This first section checks if there are any overlapping entries at + -- all. It does this by sorting all entries and then seeing if there are + -- any overlaps. If there are none, then that is decisive, but if there + -- are overlaps, they may still be OK (they may result from fields in + -- different variants). + + if Overlap_Check_Required then + Overlap_Check1 : declare + + OC_Fbit : array (0 .. Ccount) of Uint; + -- First-bit values for component clauses, the value is the offset + -- of the first bit of the field from start of record. The zero + -- entry is for use in sorting. + + OC_Lbit : array (0 .. Ccount) of Uint; + -- Last-bit values for component clauses, the value is the offset + -- of the last bit of the field from start of record. The zero + -- entry is for use in sorting. + + OC_Count : Natural := 0; + -- Count of entries in OC_Fbit and OC_Lbit + + function OC_Lt (Op1, Op2 : Natural) return Boolean; + -- Compare routine for Sort + + procedure OC_Move (From : Natural; To : Natural); + -- Move routine for Sort + + package Sorting is new GNAT.Heap_Sort_G (OC_Move, OC_Lt); + + ----------- + -- OC_Lt -- + ----------- + + function OC_Lt (Op1, Op2 : Natural) return Boolean is + begin + return OC_Fbit (Op1) < OC_Fbit (Op2); + end OC_Lt; + + ------------- + -- OC_Move -- + ------------- + + procedure OC_Move (From : Natural; To : Natural) is + begin + OC_Fbit (To) := OC_Fbit (From); + OC_Lbit (To) := OC_Lbit (From); + end OC_Move; + + -- Start of processing for Overlap_Check + + begin + CC := First (Component_Clauses (N)); + while Present (CC) loop + + -- Exclude component clause already marked in error + + if not Error_Posted (CC) then + Find_Component; + + if Present (Comp) then + OC_Count := OC_Count + 1; + OC_Fbit (OC_Count) := Fbit; + OC_Lbit (OC_Count) := Lbit; + end if; + end if; + + Next (CC); + end loop; + + Sorting.Sort (OC_Count); + + Overlap_Check_Required := False; + for J in 1 .. OC_Count - 1 loop + if OC_Lbit (J) >= OC_Fbit (J + 1) then + Overlap_Check_Required := True; + exit; + end if; + end loop; + end Overlap_Check1; + end if; + + -- If Overlap_Check_Required is still True, then we have to do the full + -- scale overlap check, since we have at least two fields that do + -- overlap, and we need to know if that is OK since they are in + -- different variant, or whether we have a definite problem. + + if Overlap_Check_Required then + Overlap_Check2 : declare + C1_Ent, C2_Ent : Entity_Id; + -- Entities of components being checked for overlap + + Clist : Node_Id; + -- Component_List node whose Component_Items are being checked + + Citem : Node_Id; + -- Component declaration for component being checked + + begin + C1_Ent := First_Entity (Base_Type (Rectype)); + + -- Loop through all components in record. For each component check + -- for overlap with any of the preceding elements on the component + -- list containing the component and also, if the component is in + -- a variant, check against components outside the case structure. + -- This latter test is repeated recursively up the variant tree. + + Main_Component_Loop : while Present (C1_Ent) loop + if not Ekind_In (C1_Ent, E_Component, E_Discriminant) then + goto Continue_Main_Component_Loop; + end if; + + -- Skip overlap check if entity has no declaration node. This + -- happens with discriminants in constrained derived types. + -- Possibly we are missing some checks as a result, but that + -- does not seem terribly serious. + + if No (Declaration_Node (C1_Ent)) then + goto Continue_Main_Component_Loop; + end if; + + Clist := Parent (List_Containing (Declaration_Node (C1_Ent))); + + -- Loop through component lists that need checking. Check the + -- current component list and all lists in variants above us. + + Component_List_Loop : loop + + -- If derived type definition, go to full declaration + -- If at outer level, check discriminants if there are any. + + if Nkind (Clist) = N_Derived_Type_Definition then + Clist := Parent (Clist); + end if; + + -- Outer level of record definition, check discriminants + + if Nkind_In (Clist, N_Full_Type_Declaration, + N_Private_Type_Declaration) + then + if Has_Discriminants (Defining_Identifier (Clist)) then + C2_Ent := + First_Discriminant (Defining_Identifier (Clist)); + while Present (C2_Ent) loop + exit when C1_Ent = C2_Ent; + Check_Component_Overlap (C1_Ent, C2_Ent); + Next_Discriminant (C2_Ent); + end loop; + end if; + + -- Record extension case + + elsif Nkind (Clist) = N_Derived_Type_Definition then + Clist := Empty; + + -- Otherwise check one component list + + else + Citem := First (Component_Items (Clist)); + while Present (Citem) loop + if Nkind (Citem) = N_Component_Declaration then + C2_Ent := Defining_Identifier (Citem); + exit when C1_Ent = C2_Ent; + Check_Component_Overlap (C1_Ent, C2_Ent); + end if; + + Next (Citem); + end loop; + end if; + + -- Check for variants above us (the parent of the Clist can + -- be a variant, in which case its parent is a variant part, + -- and the parent of the variant part is a component list + -- whose components must all be checked against the current + -- component for overlap). + + if Nkind (Parent (Clist)) = N_Variant then + Clist := Parent (Parent (Parent (Clist))); + + -- Check for possible discriminant part in record, this + -- is treated essentially as another level in the + -- recursion. For this case the parent of the component + -- list is the record definition, and its parent is the + -- full type declaration containing the discriminant + -- specifications. + + elsif Nkind (Parent (Clist)) = N_Record_Definition then + Clist := Parent (Parent ((Clist))); + + -- If neither of these two cases, we are at the top of + -- the tree. + + else + exit Component_List_Loop; + end if; + end loop Component_List_Loop; + + <> + Next_Entity (C1_Ent); + + end loop Main_Component_Loop; + end Overlap_Check2; + end if; + + -- The following circuit deals with warning on record holes (gaps). We + -- skip this check if overlap was detected, since it makes sense for the + -- programmer to fix this illegality before worrying about warnings. + + if not Overlap_Detected and Warn_On_Record_Holes then + Record_Hole_Check : declare + Decl : constant Node_Id := Declaration_Node (Base_Type (Rectype)); + -- Full declaration of record type + + procedure Check_Component_List + (CL : Node_Id; + Sbit : Uint; + DS : List_Id); + -- Check component list CL for holes. The starting bit should be + -- Sbit. which is zero for the main record component list and set + -- appropriately for recursive calls for variants. DS is set to + -- a list of discriminant specifications to be included in the + -- consideration of components. It is No_List if none to consider. + + -------------------------- + -- Check_Component_List -- + -------------------------- + + procedure Check_Component_List + (CL : Node_Id; + Sbit : Uint; + DS : List_Id) + is + Compl : Integer; + + begin + Compl := Integer (List_Length (Component_Items (CL))); + + if DS /= No_List then + Compl := Compl + Integer (List_Length (DS)); + end if; + + declare + Comps : array (Natural range 0 .. Compl) of Entity_Id; + -- Gather components (zero entry is for sort routine) + + Ncomps : Natural := 0; + -- Number of entries stored in Comps (starting at Comps (1)) + + Citem : Node_Id; + -- One component item or discriminant specification + + Nbit : Uint; + -- Starting bit for next component + + CEnt : Entity_Id; + -- Component entity + + Variant : Node_Id; + -- One variant + + function Lt (Op1, Op2 : Natural) return Boolean; + -- Compare routine for Sort + + procedure Move (From : Natural; To : Natural); + -- Move routine for Sort + + package Sorting is new GNAT.Heap_Sort_G (Move, Lt); + + -------- + -- Lt -- + -------- + + function Lt (Op1, Op2 : Natural) return Boolean is + begin + return Component_Bit_Offset (Comps (Op1)) + < + Component_Bit_Offset (Comps (Op2)); + end Lt; + + ---------- + -- Move -- + ---------- + + procedure Move (From : Natural; To : Natural) is + begin + Comps (To) := Comps (From); + end Move; + + begin + -- Gather discriminants into Comp + + if DS /= No_List then + Citem := First (DS); + while Present (Citem) loop + if Nkind (Citem) = N_Discriminant_Specification then + declare + Ent : constant Entity_Id := + Defining_Identifier (Citem); + begin + if Ekind (Ent) = E_Discriminant then + Ncomps := Ncomps + 1; + Comps (Ncomps) := Ent; + end if; + end; + end if; + + Next (Citem); + end loop; + end if; + + -- Gather component entities into Comp + + Citem := First (Component_Items (CL)); + while Present (Citem) loop + if Nkind (Citem) = N_Component_Declaration then + Ncomps := Ncomps + 1; + Comps (Ncomps) := Defining_Identifier (Citem); + end if; + + Next (Citem); + end loop; + + -- Now sort the component entities based on the first bit. + -- Note we already know there are no overlapping components. + + Sorting.Sort (Ncomps); + + -- Loop through entries checking for holes + + Nbit := Sbit; + for J in 1 .. Ncomps loop + CEnt := Comps (J); + Error_Msg_Uint_1 := Component_Bit_Offset (CEnt) - Nbit; + + if Error_Msg_Uint_1 > 0 then + Error_Msg_NE + ("?^-bit gap before component&", + Component_Name (Component_Clause (CEnt)), CEnt); + end if; + + Nbit := Component_Bit_Offset (CEnt) + Esize (CEnt); + end loop; + + -- Process variant parts recursively if present + + if Present (Variant_Part (CL)) then + Variant := First (Variants (Variant_Part (CL))); + while Present (Variant) loop + Check_Component_List + (Component_List (Variant), Nbit, No_List); + Next (Variant); + end loop; + end if; + end; + end Check_Component_List; + + -- Start of processing for Record_Hole_Check + + begin + declare + Sbit : Uint; + + begin + if Is_Tagged_Type (Rectype) then + Sbit := UI_From_Int (System_Address_Size); + else + Sbit := Uint_0; + end if; + + if Nkind (Decl) = N_Full_Type_Declaration + and then Nkind (Type_Definition (Decl)) = N_Record_Definition + then + Check_Component_List + (Component_List (Type_Definition (Decl)), + Sbit, + Discriminant_Specifications (Decl)); + end if; + end; + end Record_Hole_Check; + end if; + + -- For records that have component clauses for all components, and whose + -- size is less than or equal to 32, we need to know the size in the + -- front end to activate possible packed array processing where the + -- component type is a record. + + -- At this stage Hbit + 1 represents the first unused bit from all the + -- component clauses processed, so if the component clauses are + -- complete, then this is the length of the record. + + -- 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 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 + + -- Nothing to do if at least one component has no component clause + + Comp := First_Component_Or_Discriminant (Rectype); + while Present (Comp) loop + exit when No (Component_Clause (Comp)); + Next_Component_Or_Discriminant (Comp); + end loop; + + -- If we fall out of loop, all components have component clauses + -- and so we can set the size to the maximum value. + + if No (Comp) then + Set_RM_Size (Rectype, Hbit + 1); + end if; + end if; + end Check_Record_Representation_Clause; + ---------------- -- Check_Size -- ---------------- *************** package body Sem_Ch13 is *** 3566,3571 **** --- 6175,6182 ---- procedure Initialize is begin + Address_Clause_Checks.Init; + Independence_Checks.Init; Unchecked_Conversions.Init; end Initialize; *************** package body Sem_Ch13 is *** 3879,3887 **** Out_Present => Out_P, Parameter_Type => T_Ref)); ! Spec := Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Subp_Id, ! Parameter_Specifications => Formals); end if; return Spec; --- 6490,6499 ---- Out_Present => Out_P, Parameter_Type => T_Ref)); ! Spec := ! Make_Procedure_Specification (Loc, ! Defining_Unit_Name => Subp_Id, ! Parameter_Specifications => Formals); end if; return Spec; *************** package body Sem_Ch13 is *** 3917,3924 **** else Subp_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Sname, 'V')); Subp_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Subp_Id, --- 6529,6535 ---- else Subp_Id := ! Make_Defining_Identifier (Loc, New_External_Name (Sname, 'V')); Subp_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Subp_Id, *************** package body Sem_Ch13 is *** 3955,3962 **** elsif Is_Type (T) and then Is_Generic_Type (Root_Type (T)) then ! Error_Msg_N ! ("representation item not allowed for generic type", N); return True; end if; --- 6566,6572 ---- elsif Is_Type (T) and then Is_Generic_Type (Root_Type (T)) then ! Error_Msg_N ("representation item not allowed for generic type", N); return True; end if; *************** package body Sem_Ch13 is *** 4081,4086 **** --- 6691,6803 ---- return False; end Rep_Item_Too_Late; + ------------------------------------- + -- Replace_Type_References_Generic -- + ------------------------------------- + + procedure Replace_Type_References_Generic (N : Node_Id; TName : Name_Id) is + + function Replace_Node (N : Node_Id) return Traverse_Result; + -- Processes a single node in the traversal procedure below, checking + -- if node N should be replaced, and if so, doing the replacement. + + procedure Replace_Type_Refs is new Traverse_Proc (Replace_Node); + -- This instantiation provides the body of Replace_Type_References + + ------------------ + -- Replace_Node -- + ------------------ + + function Replace_Node (N : Node_Id) return Traverse_Result is + S : Entity_Id; + P : Node_Id; + + begin + -- Case of identifier + + if Nkind (N) = N_Identifier then + + -- If not the type name, all done with this node + + if Chars (N) /= TName then + return Skip; + + -- Otherwise do the replacement and we are done with this node + + else + Replace_Type_Reference (N); + return Skip; + end if; + + -- Case of selected component (which is what a qualification + -- looks like in the unanalyzed tree, which is what we have. + + elsif Nkind (N) = N_Selected_Component then + + -- If selector name is not our type, keeping going (we might + -- still have an occurrence of the type in the prefix). + + if Nkind (Selector_Name (N)) /= N_Identifier + or else Chars (Selector_Name (N)) /= TName + then + return OK; + + -- Selector name is our type, check qualification + + else + -- Loop through scopes and prefixes, doing comparison + + S := Current_Scope; + P := Prefix (N); + loop + -- Continue if no more scopes or scope with no name + + if No (S) or else Nkind (S) not in N_Has_Chars then + return OK; + end if; + + -- Do replace if prefix is an identifier matching the + -- scope that we are currently looking at. + + if Nkind (P) = N_Identifier + and then Chars (P) = Chars (S) + then + Replace_Type_Reference (N); + return Skip; + end if; + + -- Go check scope above us if prefix is itself of the + -- form of a selected component, whose selector matches + -- the scope we are currently looking at. + + if Nkind (P) = N_Selected_Component + and then Nkind (Selector_Name (P)) = N_Identifier + and then Chars (Selector_Name (P)) = Chars (S) + then + S := Scope (S); + P := Prefix (P); + + -- For anything else, we don't have a match, so keep on + -- going, there are still some weird cases where we may + -- still have a replacement within the prefix. + + else + return OK; + end if; + end loop; + end if; + + -- Continue for any other node kind + + else + return OK; + end if; + end Replace_Node; + + begin + Replace_Type_Refs (N); + end Replace_Type_References_Generic; + ------------------------- -- Same_Representation -- ------------------------- *************** package body Sem_Ch13 is *** 4256,4262 **** -- cases were already dealt with. elsif Is_Enumeration_Type (T1) then - Enumeration_Case : declare L1, L2 : Entity_Id; --- 6973,6978 ---- *************** package body Sem_Ch13 is *** 4284,4289 **** --- 7000,7026 ---- end if; end Same_Representation; + ---------------- + -- Set_Biased -- + ---------------- + + procedure Set_Biased + (E : Entity_Id; + N : Node_Id; + Msg : String; + Biased : Boolean := True) + is + begin + if Biased then + Set_Has_Biased_Representation (E); + + if Warn_On_Biased_Representation then + Error_Msg_NE + ("?" & Msg & " forces biased representation for&", N, E); + end if; + end if; + end Set_Biased; + -------------------- -- Set_Enum_Esize -- -------------------- *************** package body Sem_Ch13 is *** 4441,4446 **** --- 7178,7469 ---- end loop; end Validate_Address_Clauses; + --------------------------- + -- Validate_Independence -- + --------------------------- + + procedure Validate_Independence is + SU : constant Uint := UI_From_Int (System_Storage_Unit); + N : Node_Id; + E : Entity_Id; + IC : Boolean; + Comp : Entity_Id; + Addr : Node_Id; + P : Node_Id; + + procedure Check_Array_Type (Atyp : Entity_Id); + -- Checks if the array type Atyp has independent components, and + -- if not, outputs an appropriate set of error messages. + + procedure No_Independence; + -- Output message that independence cannot be guaranteed + + function OK_Component (C : Entity_Id) return Boolean; + -- Checks one component to see if it is independently accessible, and + -- if so yields True, otherwise yields False if independent access + -- cannot be guaranteed. This is a conservative routine, it only + -- returns True if it knows for sure, it returns False if it knows + -- there is a problem, or it cannot be sure there is no problem. + + procedure Reason_Bad_Component (C : Entity_Id); + -- Outputs continuation message if a reason can be determined for + -- the component C being bad. + + ---------------------- + -- Check_Array_Type -- + ---------------------- + + procedure Check_Array_Type (Atyp : Entity_Id) is + Ctyp : constant Entity_Id := Component_Type (Atyp); + + begin + -- OK if no alignment clause, no pack, and no component size + + if not Has_Component_Size_Clause (Atyp) + and then not Has_Alignment_Clause (Atyp) + and then not Is_Packed (Atyp) + then + return; + end if; + + -- Check actual component size + + if not Known_Component_Size (Atyp) + or else not (Addressable (Component_Size (Atyp)) + and then Component_Size (Atyp) < 64) + or else Component_Size (Atyp) mod Esize (Ctyp) /= 0 + then + No_Independence; + + -- Bad component size, check reason + + if Has_Component_Size_Clause (Atyp) then + P := + Get_Attribute_Definition_Clause + (Atyp, Attribute_Component_Size); + + if Present (P) then + Error_Msg_Sloc := Sloc (P); + Error_Msg_N ("\because of Component_Size clause#", N); + return; + end if; + end if; + + if Is_Packed (Atyp) then + P := Get_Rep_Pragma (Atyp, Name_Pack); + + if Present (P) then + Error_Msg_Sloc := Sloc (P); + Error_Msg_N ("\because of pragma Pack#", N); + return; + end if; + end if; + + -- No reason found, just return + + return; + end if; + + -- Array type is OK independence-wise + + return; + end Check_Array_Type; + + --------------------- + -- No_Independence -- + --------------------- + + procedure No_Independence is + begin + if Pragma_Name (N) = Name_Independent then + Error_Msg_NE + ("independence cannot be guaranteed for&", N, E); + else + Error_Msg_NE + ("independent components cannot be guaranteed for&", N, E); + end if; + end No_Independence; + + ------------------ + -- OK_Component -- + ------------------ + + function OK_Component (C : Entity_Id) return Boolean is + Rec : constant Entity_Id := Scope (C); + Ctyp : constant Entity_Id := Etype (C); + + begin + -- OK if no component clause, no Pack, and no alignment clause + + if No (Component_Clause (C)) + and then not Is_Packed (Rec) + and then not Has_Alignment_Clause (Rec) + then + return True; + end if; + + -- Here we look at the actual component layout. A component is + -- addressable if its size is a multiple of the Esize of the + -- component type, and its starting position in the record has + -- appropriate alignment, and the record itself has appropriate + -- alignment to guarantee the component alignment. + + -- Make sure sizes are static, always assume the worst for any + -- cases where we cannot check static values. + + if not (Known_Static_Esize (C) + and then Known_Static_Esize (Ctyp)) + then + return False; + end if; + + -- Size of component must be addressable or greater than 64 bits + -- and a multiple of bytes. + + if not Addressable (Esize (C)) + and then Esize (C) < Uint_64 + then + return False; + end if; + + -- Check size is proper multiple + + if Esize (C) mod Esize (Ctyp) /= 0 then + return False; + end if; + + -- Check alignment of component is OK + + if not Known_Component_Bit_Offset (C) + or else Component_Bit_Offset (C) < Uint_0 + or else Component_Bit_Offset (C) mod Esize (Ctyp) /= 0 + then + return False; + end if; + + -- Check alignment of record type is OK + + if not Known_Alignment (Rec) + or else (Alignment (Rec) * SU) mod Esize (Ctyp) /= 0 + then + return False; + end if; + + -- All tests passed, component is addressable + + return True; + end OK_Component; + + -------------------------- + -- Reason_Bad_Component -- + -------------------------- + + procedure Reason_Bad_Component (C : Entity_Id) is + Rec : constant Entity_Id := Scope (C); + Ctyp : constant Entity_Id := Etype (C); + + begin + -- If component clause present assume that's the problem + + if Present (Component_Clause (C)) then + Error_Msg_Sloc := Sloc (Component_Clause (C)); + Error_Msg_N ("\because of Component_Clause#", N); + return; + end if; + + -- If pragma Pack clause present, assume that's the problem + + if Is_Packed (Rec) then + P := Get_Rep_Pragma (Rec, Name_Pack); + + if Present (P) then + Error_Msg_Sloc := Sloc (P); + Error_Msg_N ("\because of pragma Pack#", N); + return; + end if; + end if; + + -- See if record has bad alignment clause + + if Has_Alignment_Clause (Rec) + and then Known_Alignment (Rec) + and then (Alignment (Rec) * SU) mod Esize (Ctyp) /= 0 + then + P := Get_Attribute_Definition_Clause (Rec, Attribute_Alignment); + + if Present (P) then + Error_Msg_Sloc := Sloc (P); + Error_Msg_N ("\because of Alignment clause#", N); + end if; + end if; + + -- Couldn't find a reason, so return without a message + + return; + end Reason_Bad_Component; + + -- Start of processing for Validate_Independence + + begin + for J in Independence_Checks.First .. Independence_Checks.Last loop + N := Independence_Checks.Table (J).N; + E := Independence_Checks.Table (J).E; + IC := Pragma_Name (N) = Name_Independent_Components; + + -- Deal with component case + + if Ekind (E) = E_Discriminant or else Ekind (E) = E_Component then + if not OK_Component (E) then + No_Independence; + Reason_Bad_Component (E); + goto Continue; + end if; + end if; + + -- Deal with record with Independent_Components + + if IC and then Is_Record_Type (E) then + Comp := First_Component_Or_Discriminant (E); + while Present (Comp) loop + if not OK_Component (Comp) then + No_Independence; + Reason_Bad_Component (Comp); + goto Continue; + end if; + + Next_Component_Or_Discriminant (Comp); + end loop; + end if; + + -- Deal with address clause case + + if Is_Object (E) then + Addr := Address_Clause (E); + + if Present (Addr) then + No_Independence; + Error_Msg_Sloc := Sloc (Addr); + Error_Msg_N ("\because of Address clause#", N); + goto Continue; + end if; + end if; + + -- Deal with independent components for array type + + if IC and then Is_Array_Type (E) then + Check_Array_Type (E); + end if; + + -- Deal with independent components for array object + + if IC and then Is_Object (E) and then Is_Array_Type (Etype (E)) then + Check_Array_Type (Etype (E)); + end if; + + <> null; + end loop; + end Validate_Independence; + ----------------------------------- -- Validate_Unchecked_Conversion -- ----------------------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch13.ads gcc-4.6.0/gcc/ada/sem_ch13.ads *** gcc-4.5.2/gcc/ada/sem_ch13.ads Wed Jul 29 10:34:29 2009 --- gcc-4.6.0/gcc/ada/sem_ch13.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Table; with Types; use Types; with Uintp; use Uintp; *************** package Sem_Ch13 is *** 35,46 **** procedure Analyze_Record_Representation_Clause (N : Node_Id); procedure Analyze_Code_Statement (N : Node_Id); procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id); -- Called from Freeze where R is a record entity for which reverse bit -- order is specified and there is at least one component clause. Adjusts ! -- component positions according to Ada 2005 AI-133. Note that this is only ! -- called in Ada 2005 mode. The Ada 95 handling for bit order is entirely ! -- contained in Freeze. procedure Initialize; -- Initialize internal tables for new compilation --- 36,77 ---- procedure Analyze_Record_Representation_Clause (N : Node_Id); procedure Analyze_Code_Statement (N : Node_Id); + procedure Analyze_Aspect_Specifications + (N : Node_Id; + E : Entity_Id; + L : List_Id); + -- This procedure is called to analyze aspect specifications for node N. E + -- is the corresponding entity declared by the declaration node N, and L is + -- the list of aspect specifications for this node. If L is No_List, the + -- call is ignored. Note that we can't use a simpler interface of just + -- passing the node N, since the analysis of the node may cause it to be + -- rewritten to a node not permitting aspect specifications. + procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id); -- Called from Freeze where R is a record entity for which reverse bit -- order is specified and there is at least one component clause. Adjusts ! -- component positions according to either Ada 95 or Ada 2005 (AI-133). ! ! procedure Build_Invariant_Procedure (Typ : Entity_Id; N : Node_Id); ! -- Typ is a private type with invariants (indicated by Has_Invariants being ! -- set for Typ, indicating the presence of pragma Invariant entries on the ! -- rep chain, note that Invariant aspects have already been converted to ! -- pragma Invariant), then this procedure builds the spec and body for the ! -- corresponding Invariant procedure, inserting them at appropriate points ! -- in the package specification N. Invariant_Procedure is set for Typ. Note ! -- that this procedure is called at the end of processing the declarations ! -- in the visible part (i.e. the right point for visibility analysis of ! -- the invariant expression). ! ! procedure Check_Record_Representation_Clause (N : Node_Id); ! -- This procedure completes the analysis of a record representation clause ! -- N. It is called at freeze time after adjustment of component clause bit ! -- positions for possible non-standard bit order. In the case of Ada 2005 ! -- (machine scalar) mode, this adjustment can make substantial changes, so ! -- some checks, in particular for component overlaps cannot be done at the ! -- time the record representation clause is first seen, but must be delayed ! -- till freeze time, and in particular is called after calling the above ! -- procedure for adjusting record bit positions for reverse bit order. procedure Initialize; -- Initialize internal tables for new compilation *************** package Sem_Ch13 is *** 139,144 **** --- 170,180 ---- -- the case of a private or incomplete type. The protocol is to first -- check for Rep_Item_Too_Early using the initial entity, then take the -- underlying type, then call Rep_Item_Too_Late on the result. + -- + -- Note: Calls to Rep_Item_Too_Late are ignored for the case of attribute + -- definition clauses which have From_Aspect_Specification set. This is + -- because such clauses are linked on to the Rep_Item chain in procedure + -- Sem_Ch13.Analyze_Aspect_Specifications. See that procedure for details. function Same_Representation (Typ1, Typ2 : Entity_Id) return Boolean; -- Given two types, where the two types are related by possible derivation, *************** package Sem_Ch13 is *** 159,168 **** -- back end as required. procedure Validate_Unchecked_Conversions; ! -- This routine is called after calling the backend to validate ! -- unchecked conversions for size and alignment appropriateness. ! -- The reason it is called that late is to take advantage of any ! -- back-annotation of size and alignment performed by the backend. procedure Validate_Address_Clauses; -- This is called after the back end has been called (and thus after the --- 195,204 ---- -- back end as required. procedure Validate_Unchecked_Conversions; ! -- This routine is called after calling the backend to validate unchecked ! -- conversions for size and alignment appropriateness. The reason it is ! -- called that late is to take advantage of any back-annotation of size ! -- and alignment performed by the backend. procedure Validate_Address_Clauses; -- This is called after the back end has been called (and thus after the *************** package Sem_Ch13 is *** 170,173 **** --- 206,239 ---- -- table of saved address clauses checking for suspicious alignments and -- if necessary issuing warnings. + procedure Validate_Independence; + -- This is called after the back end has been called (and thus after the + -- layout of components has been back annotated). It goes through the + -- table of saved pragma Independent[_Component] entries, checking that + -- independence can be achieved, and if necessary issuing error messages. + + ------------------------------------- + -- Table for Validate_Independence -- + ------------------------------------- + + -- If a legal pragma Independent or Independent_Components is given for + -- an entity, then an entry is made in this table, to be checked by a + -- call to Validate_Independence after back annotation of layout is done. + + type Independence_Check_Record is record + N : Node_Id; + -- The pragma Independent or Independent_Components + + E : Entity_Id; + -- The entity to which it applies + end record; + + package Independence_Checks is new Table.Table ( + Table_Component_Type => Independence_Check_Record, + Table_Index_Type => Int, + Table_Low_Bound => 1, + Table_Initial => 20, + Table_Increment => 200, + Table_Name => "Independence_Checks"); + end Sem_Ch13; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch3.adb gcc-4.6.0/gcc/ada/sem_ch3.adb *** gcc-4.5.2/gcc/ada/sem_ch3.adb Thu Dec 3 15:10:58 2009 --- gcc-4.6.0/gcc/ada/sem_ch3.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Checks; use Checks; with Debug; use Debug; *************** with Sem_Dist; use Sem_Dist; *** 61,66 **** --- 62,68 ---- with Sem_Elim; use Sem_Elim; with Sem_Eval; use Sem_Eval; with Sem_Mech; use Sem_Mech; + with Sem_Prag; use Sem_Prag; with Sem_Res; use Sem_Res; with Sem_Smem; use Sem_Smem; with Sem_Type; use Sem_Type; *************** with Sem_Util; use Sem_Util; *** 68,73 **** --- 70,76 ---- with Sem_Warn; use Sem_Warn; with Stand; use Stand; with Sinfo; use Sinfo; + with Sinput; use Sinput; with Snames; use Snames; with Targparm; use Targparm; with Tbuild; use Tbuild; *************** package body Sem_Ch3 is *** 281,289 **** (N : Node_Id; T : Entity_Id; Prev : Entity_Id := Empty); ! -- If T is the full declaration of an incomplete or private type, check the ! -- conformance of the discriminants, otherwise process them. Prev is the ! -- entity of the partial declaration, if any. procedure Check_Real_Bound (Bound : Node_Id); -- Check given bound for being of real type and static. If not, post an --- 284,294 ---- (N : Node_Id; T : Entity_Id; Prev : Entity_Id := Empty); ! -- If N is the full declaration of the completion T of an incomplete or ! -- private type, check its discriminants (which are already known to be ! -- conformant with those of the partial view, see Find_Type_Name), ! -- otherwise process them. Prev is the entity of the partial declaration, ! -- if any. procedure Check_Real_Bound (Bound : Node_Id); -- Check given bound for being of real type and static. If not, post an *************** package body Sem_Ch3 is *** 441,447 **** Related_Id : Entity_Id; Suffix : Character; Suffix_Index : Nat); ! -- Process an index constraint in a constrained array declaration. The -- constraint can be a subtype name, or a range with or without an explicit -- subtype mark. The index is the corresponding index of the unconstrained -- array. The Related_Id and Suffix parameters are used to build the --- 446,452 ---- Related_Id : Entity_Id; Suffix : Character; Suffix_Index : Nat); ! -- Process an index constraint S in a constrained array declaration. The -- constraint can be a subtype name, or a range with or without an explicit -- subtype mark. The index is the corresponding index of the unconstrained -- array. The Related_Id and Suffix parameters are used to build the *************** package body Sem_Ch3 is *** 481,488 **** -- operations of progenitors of Tagged_Type, and replace the subsidiary -- subtypes with Tagged_Type, to build the specs of the inherited interface -- primitives. The derived primitives are aliased to those of the ! -- interface. This routine takes care also of transferring to the full-view ! -- subprograms associated with the partial-view of Tagged_Type that cover -- interface primitives. procedure Derived_Standard_Character --- 486,493 ---- -- operations of progenitors of Tagged_Type, and replace the subsidiary -- subtypes with Tagged_Type, to build the specs of the inherited interface -- primitives. The derived primitives are aliased to those of the ! -- interface. This routine takes care also of transferring to the full view ! -- subprograms associated with the partial view of Tagged_Type that cover -- interface primitives. procedure Derived_Standard_Character *************** package body Sem_Ch3 is *** 573,586 **** -- 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 the interface Iface is implemented by Typ. It 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; --- 578,583 ---- *************** package body Sem_Ch3 is *** 787,793 **** (E_Anonymous_Access_Type, Related_Nod, Scope_Id => Anon_Scope); if All_Present (N) ! and then Ada_Version >= Ada_05 then Error_Msg_N ("ALL is not permitted for anonymous access types", N); end if; --- 784,790 ---- (E_Anonymous_Access_Type, Related_Nod, Scope_Id => Anon_Scope); if All_Present (N) ! and then Ada_Version >= Ada_2005 then Error_Msg_N ("ALL is not permitted for anonymous access types", N); end if; *************** package body Sem_Ch3 is *** 836,852 **** 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 -- the null value is allowed. In Ada 95 the null value is never allowed. ! if Ada_Version >= Ada_05 then Set_Can_Never_Be_Null (Anon_Type, Null_Exclusion_Present (N)); else Set_Can_Never_Be_Null (Anon_Type, True); --- 833,843 ---- Layout_Type (Anon_Type); end if; -- Ada 2005 (AI-231): Ada 2005 semantics for anonymous access differs -- from Ada 95 semantics. In Ada 2005, anonymous access must specify if -- the null value is allowed. In Ada 95 the null value is never allowed. ! if Ada_Version >= Ada_2005 then Set_Can_Never_Be_Null (Anon_Type, Null_Exclusion_Present (N)); else Set_Can_Never_Be_Null (Anon_Type, True); *************** package body Sem_Ch3 is *** 897,902 **** --- 888,894 ---- elsif Has_Task (Desig_Type) and then Comes_From_Source (Related_Nod) + and then not Restriction_Active (No_Task_Hierarchy) then if not Has_Master_Entity (Current_Scope) then Decl := *************** package body Sem_Ch3 is *** 1037,1044 **** begin -- Associate the Itype node with the inner full-type declaration or ! -- subprogram spec. This is required to handle nested anonymous ! -- declarations. For example: -- procedure P -- (X : access procedure --- 1029,1036 ---- begin -- Associate the Itype node with the inner full-type declaration or ! -- subprogram spec or entry body. This is required to handle nested ! -- anonymous declarations. For example: -- procedure P -- (X : access procedure *************** package body Sem_Ch3 is *** 1050,1056 **** N_Private_Type_Declaration, N_Private_Extension_Declaration, N_Procedure_Specification, ! N_Function_Specification) or else Nkind_In (D_Ityp, N_Object_Declaration, N_Object_Renaming_Declaration, --- 1042,1050 ---- N_Private_Type_Declaration, N_Private_Extension_Declaration, N_Procedure_Specification, ! N_Function_Specification, ! N_Entry_Body) ! or else Nkind_In (D_Ityp, N_Object_Declaration, N_Object_Renaming_Declaration, *************** package body Sem_Ch3 is *** 1122,1130 **** else if From_With_Type (Typ) then ! Error_Msg_NE ! ("illegal use of incomplete type&", ! Result_Definition (T_Def), Typ); elsif Ekind (Current_Scope) = E_Package and then In_Private_Part (Current_Scope) --- 1116,1133 ---- else if From_With_Type (Typ) then ! ! -- AI05-151: Incomplete types are allowed in all basic ! -- declarations, including access to subprograms. ! ! if Ada_Version >= Ada_2012 then ! null; ! ! else ! Error_Msg_NE ! ("illegal use of incomplete type&", ! Result_Definition (T_Def), Typ); ! end if; elsif Ekind (Current_Scope) = E_Package and then In_Private_Part (Current_Scope) *************** package body Sem_Ch3 is *** 1358,1370 **** pragma Assert (Is_Tagged_Type (Iface) and then Is_Interface (Iface)); Def := Make_Component_Definition (Loc, Aliased_Present => True, Subtype_Indication => New_Occurrence_Of (RTE (RE_Interface_Tag), Loc)); ! Tag := Make_Defining_Identifier (Loc, New_Internal_Name ('V')); Decl := Make_Component_Declaration (Loc, --- 1361,1379 ---- pragma Assert (Is_Tagged_Type (Iface) and then Is_Interface (Iface)); + -- This is a reasonable place to propagate predicates + + if Has_Predicates (Iface) then + Set_Has_Predicates (Typ); + end if; + Def := Make_Component_Definition (Loc, Aliased_Present => True, Subtype_Indication => New_Occurrence_Of (RTE (RE_Interface_Tag), Loc)); ! Tag := Make_Temporary (Loc, 'V'); Decl := Make_Component_Declaration (Loc, *************** package body Sem_Ch3 is *** 1406,1413 **** Subtype_Indication => New_Occurrence_Of (RTE (RE_Storage_Offset), Loc)); ! Offset := ! Make_Defining_Identifier (Loc, New_Internal_Name ('V')); Decl := Make_Component_Declaration (Loc, --- 1415,1421 ---- Subtype_Indication => New_Occurrence_Of (RTE (RE_Storage_Offset), Loc)); ! Offset := Make_Temporary (Loc, 'V'); Decl := Make_Component_Declaration (Loc, *************** package body Sem_Ch3 is *** 1515,1603 **** ------------------------------------- procedure Add_Internal_Interface_Entities (Tagged_Type : Entity_Id) is ! Elmt : Elmt_Id; ! Iface : Entity_Id; ! Iface_Elmt : Elmt_Id; ! Iface_Prim : Entity_Id; ! Ifaces_List : Elist_Id; ! New_Subp : Entity_Id := Empty; ! Prim : Entity_Id; begin ! pragma Assert (Ada_Version >= Ada_05 and then Is_Record_Type (Tagged_Type) and then Is_Tagged_Type (Tagged_Type) and then Has_Interfaces (Tagged_Type) and then not Is_Interface (Tagged_Type)); Collect_Interfaces (Tagged_Type, Ifaces_List); Iface_Elmt := First_Elmt (Ifaces_List); while Present (Iface_Elmt) loop Iface := Node (Iface_Elmt); ! -- Exclude from this processing interfaces that are parents of ! -- Tagged_Type because their primitives are located in the primary ! -- dispatch table (and hence no auxiliary internal entities are ! -- required to handle secondary dispatch tables in such case). ! if not Is_Ancestor (Iface, Tagged_Type) then ! Elmt := First_Elmt (Primitive_Operations (Iface)); ! while Present (Elmt) loop ! Iface_Prim := Node (Elmt); ! if not Is_Predefined_Dispatching_Operation (Iface_Prim) then ! Prim := ! Find_Primitive_Covering_Interface ! (Tagged_Type => Tagged_Type, ! Iface_Prim => Iface_Prim); ! pragma Assert (Present (Prim)); Derive_Subprogram (New_Subp => New_Subp, Parent_Subp => Iface_Prim, Derived_Type => Tagged_Type, Parent_Type => Iface); ! -- Ada 2005 (AI-251): Decorate internal entity Iface_Subp ! -- associated with interface types. These entities are ! -- only registered in the list of primitives of its ! -- corresponding tagged type because they are only used ! -- to fill the contents of the secondary dispatch tables. ! -- Therefore they are removed from the homonym chains. ! Set_Is_Hidden (New_Subp); ! Set_Is_Internal (New_Subp); ! Set_Alias (New_Subp, Prim); ! Set_Is_Abstract_Subprogram (New_Subp, ! Is_Abstract_Subprogram (Prim)); ! Set_Interface_Alias (New_Subp, Iface_Prim); ! -- Internal entities associated with interface types are ! -- only registered in the list of primitives of the tagged ! -- type. They are only used to fill the contents of the ! -- secondary dispatch tables. Therefore they are not needed ! -- in the homonym chains. ! Remove_Homonym (New_Subp); ! -- Hidden entities associated with interfaces must have set ! -- the Has_Delay_Freeze attribute to ensure that, in case of ! -- locally defined tagged types (or compiling with static ! -- dispatch tables generation disabled) the corresponding ! -- entry of the secondary dispatch table is filled when ! -- such an entity is frozen. ! Set_Has_Delayed_Freeze (New_Subp); ! end if; ! Next_Elmt (Elmt); ! end loop; ! end if; Next_Elmt (Iface_Elmt); end loop; end Add_Internal_Interface_Entities; ----------------------------------- --- 1523,1644 ---- ------------------------------------- procedure Add_Internal_Interface_Entities (Tagged_Type : Entity_Id) is ! Elmt : Elmt_Id; ! Iface : Entity_Id; ! Iface_Elmt : Elmt_Id; ! Iface_Prim : Entity_Id; ! Ifaces_List : Elist_Id; ! New_Subp : Entity_Id := Empty; ! Prim : Entity_Id; ! Restore_Scope : Boolean := False; begin ! pragma Assert (Ada_Version >= Ada_2005 and then Is_Record_Type (Tagged_Type) and then Is_Tagged_Type (Tagged_Type) and then Has_Interfaces (Tagged_Type) and then not Is_Interface (Tagged_Type)); + -- Ensure that the internal entities are added to the scope of the type + + if Scope (Tagged_Type) /= Current_Scope then + Push_Scope (Scope (Tagged_Type)); + Restore_Scope := True; + end if; + Collect_Interfaces (Tagged_Type, Ifaces_List); Iface_Elmt := First_Elmt (Ifaces_List); while Present (Iface_Elmt) loop Iface := Node (Iface_Elmt); ! -- Originally we excluded here from this processing interfaces that ! -- are parents of Tagged_Type because their primitives are located ! -- in the primary dispatch table (and hence no auxiliary internal ! -- entities are required to handle secondary dispatch tables in such ! -- case). However, these auxiliary entities are also required to ! -- handle derivations of interfaces in formals of generics (see ! -- Derive_Subprograms). ! Elmt := First_Elmt (Primitive_Operations (Iface)); ! while Present (Elmt) loop ! Iface_Prim := Node (Elmt); ! if not Is_Predefined_Dispatching_Operation (Iface_Prim) then ! Prim := ! Find_Primitive_Covering_Interface ! (Tagged_Type => Tagged_Type, ! Iface_Prim => Iface_Prim); ! pragma Assert (Present (Prim)); + -- Ada 2012 (AI05-0197): If the name of the covering primitive + -- differs from the name of the interface primitive then it is + -- a private primitive inherited from a parent type. In such + -- case, given that Tagged_Type covers the interface, the + -- inherited private primitive becomes visible. For such + -- purpose we add a new entity that renames the inherited + -- private primitive. + + if Chars (Prim) /= Chars (Iface_Prim) then + pragma Assert (Has_Suffix (Prim, 'P')); Derive_Subprogram (New_Subp => New_Subp, Parent_Subp => Iface_Prim, Derived_Type => Tagged_Type, Parent_Type => Iface); + Set_Alias (New_Subp, Prim); + Set_Is_Abstract_Subprogram + (New_Subp, Is_Abstract_Subprogram (Prim)); + end if; ! Derive_Subprogram ! (New_Subp => New_Subp, ! Parent_Subp => Iface_Prim, ! Derived_Type => Tagged_Type, ! Parent_Type => Iface); ! -- Ada 2005 (AI-251): Decorate internal entity Iface_Subp ! -- associated with interface types. These entities are ! -- only registered in the list of primitives of its ! -- corresponding tagged type because they are only used ! -- to fill the contents of the secondary dispatch tables. ! -- Therefore they are removed from the homonym chains. ! Set_Is_Hidden (New_Subp); ! Set_Is_Internal (New_Subp); ! Set_Alias (New_Subp, Prim); ! Set_Is_Abstract_Subprogram ! (New_Subp, Is_Abstract_Subprogram (Prim)); ! Set_Interface_Alias (New_Subp, Iface_Prim); ! -- Internal entities associated with interface types are ! -- only registered in the list of primitives of the tagged ! -- type. They are only used to fill the contents of the ! -- secondary dispatch tables. Therefore they are not needed ! -- in the homonym chains. ! Remove_Homonym (New_Subp); ! -- Hidden entities associated with interfaces must have set ! -- the Has_Delay_Freeze attribute to ensure that, in case of ! -- locally defined tagged types (or compiling with static ! -- dispatch tables generation disabled) the corresponding ! -- entry of the secondary dispatch table is filled when ! -- such an entity is frozen. ! Set_Has_Delayed_Freeze (New_Subp); ! end if; ! ! Next_Elmt (Elmt); ! end loop; Next_Elmt (Iface_Elmt); end loop; + + if Restore_Scope then + Pop_Scope; + end if; end Add_Internal_Interface_Entities; ----------------------------------- *************** package body Sem_Ch3 is *** 1775,1781 **** Preanalyze_Spec_Expression (E, T); Check_Initialization (T, E); ! if Ada_Version >= Ada_05 and then Ekind (T) = E_Anonymous_Access_Type and then Etype (E) /= Any_Type then --- 1816,1822 ---- Preanalyze_Spec_Expression (E, T); Check_Initialization (T, E); ! if Ada_Version >= Ada_2005 and then Ekind (T) = E_Anonymous_Access_Type and then Etype (E) /= Any_Type then *************** package body Sem_Ch3 is *** 1866,1872 **** -- Ada 2005 (AI-231): Propagate the null-excluding attribute and carry -- out some static checks. ! if Ada_Version >= Ada_05 and then Can_Never_Be_Null (T) then Null_Exclusion_Static_Checks (N); --- 1907,1913 ---- -- Ada 2005 (AI-231): Propagate the null-excluding attribute and carry -- out some static checks. ! if Ada_Version >= Ada_2005 and then Can_Never_Be_Null (T) then Null_Exclusion_Static_Checks (N); *************** package body Sem_Ch3 is *** 1913,1920 **** if Is_Interface (Root_Type (Current_Scope)) then Error_Msg_N ("\limitedness is not inherited from limited interface", N); ! Error_Msg_N ! ("\add LIMITED to type indication", N); end if; Explain_Limited_Type (T, N); --- 1954,1960 ---- if Is_Interface (Root_Type (Current_Scope)) then Error_Msg_N ("\limitedness is not inherited from limited interface", N); ! Error_Msg_N ("\add LIMITED to type indication", N); end if; Explain_Limited_Type (T, N); *************** package body Sem_Ch3 is *** 1934,1939 **** --- 1974,1980 ---- end if; Set_Original_Record_Component (Id, Id); + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Component_Declaration; -------------------------- *************** package body Sem_Ch3 is *** 2057,2064 **** --- 2098,2431 ---- D := Next_Node; end loop; + + -- One more thing to do, we need to scan the declarations to check + -- for any precondition/postcondition pragmas (Pre/Post aspects have + -- by this stage been converted into corresponding pragmas). It is + -- at this point that we analyze the expressions in such pragmas, + -- to implement the delayed visibility requirement. + + declare + Decl : Node_Id; + Spec : Node_Id; + Sent : Entity_Id; + Prag : Node_Id; + + begin + Decl := First (L); + 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; end Analyze_Declarations; + ----------------------------------- + -- Analyze_Full_Type_Declaration -- + ----------------------------------- + + procedure Analyze_Full_Type_Declaration (N : Node_Id) is + Def : constant Node_Id := Type_Definition (N); + Def_Id : constant Entity_Id := Defining_Identifier (N); + T : Entity_Id; + Prev : Entity_Id; + + Is_Remote : constant Boolean := + (Is_Remote_Types (Current_Scope) + or else Is_Remote_Call_Interface (Current_Scope)) + and then not (In_Private_Part (Current_Scope) + or else In_Package_Body (Current_Scope)); + + procedure Check_Ops_From_Incomplete_Type; + -- If there is a tagged incomplete partial view of the type, transfer + -- its operations to the full view, and indicate that the type of the + -- controlling parameter (s) is this full view. + + ------------------------------------ + -- Check_Ops_From_Incomplete_Type -- + ------------------------------------ + + procedure Check_Ops_From_Incomplete_Type is + Elmt : Elmt_Id; + Formal : Entity_Id; + Op : Entity_Id; + + begin + if Prev /= T + and then Ekind (Prev) = E_Incomplete_Type + and then Is_Tagged_Type (Prev) + and then Is_Tagged_Type (T) + then + Elmt := First_Elmt (Primitive_Operations (Prev)); + while Present (Elmt) loop + Op := Node (Elmt); + Prepend_Elmt (Op, Primitive_Operations (T)); + + Formal := First_Formal (Op); + while Present (Formal) loop + if Etype (Formal) = Prev then + Set_Etype (Formal, T); + end if; + + Next_Formal (Formal); + end loop; + + if Etype (Op) = Prev then + Set_Etype (Op, T); + end if; + + Next_Elmt (Elmt); + end loop; + end if; + end Check_Ops_From_Incomplete_Type; + + -- Start of processing for Analyze_Full_Type_Declaration + + begin + Prev := Find_Type_Name (N); + + -- The full view, if present, now points to the current type + + -- Ada 2005 (AI-50217): If the type was previously decorated when + -- imported through a LIMITED WITH clause, it appears as incomplete + -- but has no full view. + + if Ekind (Prev) = E_Incomplete_Type + and then Present (Full_View (Prev)) + then + T := Full_View (Prev); + else + T := Prev; + end if; + + Set_Is_Pure (T, Is_Pure (Current_Scope)); + + -- We set the flag Is_First_Subtype here. It is needed to set the + -- corresponding flag for the Implicit class-wide-type created + -- during tagged types processing. + + Set_Is_First_Subtype (T, True); + + -- Only composite types other than array types are allowed to have + -- discriminants. + + case Nkind (Def) is + + -- For derived types, the rule will be checked once we've figured + -- out the parent type. + + when N_Derived_Type_Definition => + null; + + -- For record types, discriminants are allowed + + when N_Record_Definition => + null; + + when others => + if Present (Discriminant_Specifications (N)) then + Error_Msg_N + ("elementary or array type cannot have discriminants", + Defining_Identifier + (First (Discriminant_Specifications (N)))); + end if; + end case; + + -- Elaborate the type definition according to kind, and generate + -- subsidiary (implicit) subtypes where needed. We skip this if it was + -- already done (this happens during the reanalysis that follows a call + -- to the high level optimizer). + + if not Analyzed (T) then + Set_Analyzed (T); + + case Nkind (Def) is + + when N_Access_To_Subprogram_Definition => + Access_Subprogram_Declaration (T, Def); + + -- If this is a remote access to subprogram, we must create the + -- equivalent fat pointer type, and related subprograms. + + if Is_Remote then + Process_Remote_AST_Declaration (N); + end if; + + -- Validate categorization rule against access type declaration + -- usually a violation in Pure unit, Shared_Passive unit. + + Validate_Access_Type_Declaration (T, N); + + when N_Access_To_Object_Definition => + Access_Type_Declaration (T, Def); + + -- Validate categorization rule against access type declaration + -- usually a violation in Pure unit, Shared_Passive unit. + + Validate_Access_Type_Declaration (T, N); + + -- If we are in a Remote_Call_Interface package and define a + -- RACW, then calling stubs and specific stream attributes + -- must be added. + + if Is_Remote + and then Is_Remote_Access_To_Class_Wide_Type (Def_Id) + then + Add_RACW_Features (Def_Id); + end if; + + -- Set no strict aliasing flag if config pragma seen + + if Opt.No_Strict_Aliasing then + Set_No_Strict_Aliasing (Base_Type (Def_Id)); + end if; + + when N_Array_Type_Definition => + Array_Type_Declaration (T, Def); + + when N_Derived_Type_Definition => + Derived_Type_Declaration (T, N, T /= Def_Id); + + when N_Enumeration_Type_Definition => + Enumeration_Type_Declaration (T, Def); + + when N_Floating_Point_Definition => + Floating_Point_Type_Declaration (T, Def); + + when N_Decimal_Fixed_Point_Definition => + Decimal_Fixed_Point_Type_Declaration (T, Def); + + when N_Ordinary_Fixed_Point_Definition => + Ordinary_Fixed_Point_Type_Declaration (T, Def); + + when N_Signed_Integer_Type_Definition => + Signed_Integer_Type_Declaration (T, Def); + + when N_Modular_Type_Definition => + Modular_Type_Declaration (T, Def); + + when N_Record_Definition => + Record_Type_Declaration (T, N, Prev); + + -- If declaration has a parse error, nothing to elaborate. + + when N_Error => + null; + + when others => + raise Program_Error; + + end case; + end if; + + if Etype (T) = Any_Type then + return; + end if; + + -- Some common processing for all types + + Set_Depends_On_Private (T, Has_Private_Component (T)); + Check_Ops_From_Incomplete_Type; + + -- Both the declared entity, and its anonymous base type if one + -- was created, need freeze nodes allocated. + + declare + B : constant Entity_Id := Base_Type (T); + + begin + -- In the case where the base type differs from the first subtype, we + -- pre-allocate a freeze node, and set the proper link to the first + -- subtype. Freeze_Entity will use this preallocated freeze node when + -- it freezes the entity. + + -- This does not apply if the base type is a generic type, whose + -- declaration is independent of the current derived definition. + + if B /= T and then not Is_Generic_Type (B) then + Ensure_Freeze_Node (B); + Set_First_Subtype_Link (Freeze_Node (B), T); + end if; + + -- A type that is imported through a limited_with clause cannot + -- generate any code, and thus need not be frozen. However, an access + -- type with an imported designated type needs a finalization list, + -- which may be referenced in some other package that has non-limited + -- visibility on the designated type. Thus we must create the + -- finalization list at the point the access type is frozen, to + -- prevent unsatisfied references at link time. + + if not From_With_Type (T) or else Is_Access_Type (T) then + Set_Has_Delayed_Freeze (T); + end if; + end; + + -- Case where T is the full declaration of some private type which has + -- been swapped in Defining_Identifier (N). + + if T /= Def_Id and then Is_Private_Type (Def_Id) then + Process_Full_View (N, T, Def_Id); + + -- Record the reference. The form of this is a little strange, since + -- the full declaration has been swapped in. So the first parameter + -- here represents the entity to which a reference is made which is + -- the "real" entity, i.e. the one swapped in, and the second + -- parameter provides the reference location. + + -- Also, we want to kill Has_Pragma_Unreferenced temporarily here + -- since we don't want a complaint about the full type being an + -- unwanted reference to the private type + + declare + B : constant Boolean := Has_Pragma_Unreferenced (T); + begin + Set_Has_Pragma_Unreferenced (T, False); + Generate_Reference (T, T, 'c'); + Set_Has_Pragma_Unreferenced (T, B); + end; + + Set_Completion_Referenced (Def_Id); + + -- For completion of incomplete type, process incomplete dependents + -- and always mark the full type as referenced (it is the incomplete + -- type that we get for any real reference). + + elsif Ekind (Prev) = E_Incomplete_Type then + Process_Incomplete_Dependents (N, T, Prev); + Generate_Reference (Prev, Def_Id, 'c'); + Set_Completion_Referenced (Def_Id); + + -- If not private type or incomplete type completion, this is a real + -- definition of a new entity, so record it. + + else + Generate_Definition (Def_Id); + end if; + + if Chars (Scope (Def_Id)) = Name_System + and then Chars (Def_Id) = Name_Address + and then Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (N))) + then + Set_Is_Descendent_Of_Address (Def_Id); + Set_Is_Descendent_Of_Address (Base_Type (Def_Id)); + Set_Is_Descendent_Of_Address (Prev); + end if; + + Set_Optimize_Alignment_Flags (Def_Id); + Check_Eliminated (Def_Id); + + Analyze_Aspect_Specifications (N, Def_Id, Aspect_Specifications (N)); + end Analyze_Full_Type_Declaration; + ---------------------------------- -- Analyze_Incomplete_Type_Decl -- ---------------------------------- *************** package body Sem_Ch3 is *** 2090,2096 **** if Tagged_Present (N) then Set_Is_Tagged_Type (T); Make_Class_Wide_Type (T); ! Set_Primitive_Operations (T, New_Elmt_List); end if; Push_Scope (T); --- 2457,2463 ---- if Tagged_Present (N) then Set_Is_Tagged_Type (T); Make_Class_Wide_Type (T); ! Set_Direct_Primitive_Operations (T, New_Elmt_List); end if; Push_Scope (T); *************** package body Sem_Ch3 is *** 2141,2159 **** or else Synchronized_Present (Def) or else Task_Present (Def)); - Set_Is_Protected_Interface (T, Protected_Present (Def)); - Set_Is_Task_Interface (T, Task_Present (Def)); - - -- Type is a synchronized interface if it includes the keyword task, - -- protected, or synchronized. - - Set_Is_Synchronized_Interface - (T, Synchronized_Present (Def) - or else Protected_Present (Def) - or else Task_Present (Def)); - Set_Interfaces (T, New_Elmt_List); ! Set_Primitive_Operations (T, New_Elmt_List); -- Complete the decoration of the class-wide entity if it was already -- built (i.e. during the creation of the limited view) --- 2508,2515 ---- or else Synchronized_Present (Def) or else Task_Present (Def)); Set_Interfaces (T, New_Elmt_List); ! Set_Direct_Primitive_Operations (T, New_Elmt_List); -- Complete the decoration of the class-wide entity if it was already -- built (i.e. during the creation of the limited view) *************** package body Sem_Ch3 is *** 2161,2169 **** if Present (CW) then Set_Is_Interface (CW); Set_Is_Limited_Interface (CW, Is_Limited_Interface (T)); - Set_Is_Protected_Interface (CW, Is_Protected_Interface (T)); - 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 --- 2517,2522 ---- *************** package body Sem_Ch3 is *** 2470,2476 **** T := Find_Type_Of_Object (Object_Definition (N), N); Set_Etype (Id, T); Set_Ekind (Id, E_Variable); ! return; end if; -- In the normal case, enter identifier at the start to catch premature --- 2823,2829 ---- T := Find_Type_Of_Object (Object_Definition (N), N); Set_Etype (Id, T); Set_Ekind (Id, E_Variable); ! goto Leave; end if; -- In the normal case, enter identifier at the start to catch premature *************** package body Sem_Ch3 is *** 2496,2509 **** if Error_Posted (Id) then Set_Etype (Id, T); Set_Ekind (Id, E_Variable); ! return; end if; end if; -- Ada 2005 (AI-231): Propagate the null-excluding attribute and carry -- out some static checks ! if Ada_Version >= Ada_05 and then Can_Never_Be_Null (T) then -- In case of aggregates we must also take care of the correct --- 2849,2862 ---- if Error_Posted (Id) then Set_Etype (Id, T); Set_Ekind (Id, E_Variable); ! goto Leave; end if; end if; -- Ada 2005 (AI-231): Propagate the null-excluding attribute and carry -- out some static checks ! if Ada_Version >= Ada_2005 and then Can_Never_Be_Null (T) then -- In case of aggregates we must also take care of the correct *************** package body Sem_Ch3 is *** 2603,2609 **** -- to make handlers not at the library level illegal. if Has_Interrupt_Handler (T) ! and then Ada_Version < Ada_05 then Error_Msg_N ("interrupt object can only be declared at library level", Id); --- 2956,2962 ---- -- to make handlers not at the library level illegal. if Has_Interrupt_Handler (T) ! and then Ada_Version < Ada_2005 then Error_Msg_N ("interrupt object can only be declared at library level", Id); *************** package body Sem_Ch3 is *** 2738,2749 **** -- Has_Stream just for efficiency reasons. There is no point in -- spending time on a Has_Stream check if the restriction is not set. ! if Restrictions.Set (No_Streams) then if Has_Stream (T) then Check_Restriction (No_Streams, N); end if; end if; -- Case of unconstrained type if Is_Indefinite_Subtype (T) then --- 3091,3123 ---- -- Has_Stream just for efficiency reasons. There is no point in -- spending time on a Has_Stream check if the restriction is not set. ! if Restriction_Check_Required (No_Streams) then if Has_Stream (T) then Check_Restriction (No_Streams, N); end if; end if; + -- Deal with predicate check before we start to do major rewriting. + -- it is OK to initialize and then check the initialized value, since + -- the object goes out of scope if we get a predicate failure. Note + -- that we do this in the analyzer and not the expander because the + -- analyzer does some substantial rewriting in some cases. + + -- We need a predicate check if the type has predicates, and if either + -- there is an initializing expression, or for default initialization + -- when we have at least one case of an explicit default initial value. + + if not Suppress_Assignment_Checks (N) + and then Present (Predicate_Function (T)) + and then + (Present (E) + or else + Is_Partially_Initialized_Type (T, Include_Implicit => False)) + then + Insert_After (N, + Make_Predicate_Check (T, New_Occurrence_Of (Id, Loc))); + end if; + -- Case of unconstrained type if Is_Indefinite_Subtype (T) then *************** package body Sem_Ch3 is *** 2919,2931 **** -- 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 ! Check_Restriction (No_Wide_Characters, Object_Definition (N)); ! end if; -- Indicate this is not set in source. Certainly true for constants, -- and true for variables so far (will be reset for a variable if and --- 3293,3299 ---- -- Check No_Wide_Characters restriction ! Check_Wide_Character_Restriction (T, Object_Definition (N)); -- Indicate this is not set in source. Certainly true for constants, -- and true for variables so far (will be reset for a variable if and *************** package body Sem_Ch3 is *** 2990,2996 **** and then Is_Record_Type (T) and then not Is_Constrained (T) and then Has_Discriminants (T) ! and then (Ada_Version < Ada_05 or else Is_Indefinite_Subtype (T)) then Set_Actual_Subtype (Id, Build_Default_Subtype (T, N)); end if; --- 3358,3364 ---- and then Is_Record_Type (T) and then not Is_Constrained (T) and then Has_Discriminants (T) ! and then (Ada_Version < Ada_2005 or else Is_Indefinite_Subtype (T)) then Set_Actual_Subtype (Id, Build_Default_Subtype (T, N)); end if; *************** package body Sem_Ch3 is *** 3114,3120 **** -- A rather specialized test. If we see two tasks being declared -- of the same type in the same object declaration, and the task -- has an entry with an address clause, we know that program error ! -- will be raised at run-time since we can't have two tasks with -- entries at the same address. if Is_Task_Type (Etype (Id)) and then More_Ids (N) then --- 3482,3488 ---- -- A rather specialized test. If we see two tasks being declared -- of the same type in the same object declaration, and the task -- has an entry with an address clause, we know that program error ! -- will be raised at run time since we can't have two tasks with -- entries at the same address. if Is_Task_Type (Etype (Id)) and then More_Ids (N) then *************** package body Sem_Ch3 is *** 3223,3228 **** --- 3591,3599 ---- then Check_Restriction (No_Local_Timing_Events, N); end if; + + <> + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Object_Declaration; --------------------------- *************** package body Sem_Ch3 is *** 3268,3274 **** end if; Generate_Definition (T); ! Enter_Name (T); Parent_Type := Find_Type_Of_Subtype_Indic (Indic); Parent_Base := Base_Type (Parent_Type); --- 3639,3666 ---- end if; Generate_Definition (T); ! ! -- For other than Ada 2012, just enter the name in the current scope ! ! if Ada_Version < Ada_2012 then ! Enter_Name (T); ! ! -- Ada 2012 (AI05-0162): Enter the name in the current scope handling ! -- case of private type that completes an incomplete type. ! ! else ! declare ! Prev : Entity_Id; ! ! begin ! Prev := Find_Type_Name (N); ! ! pragma Assert (Prev = T ! or else (Ekind (Prev) = E_Incomplete_Type ! and then Present (Full_View (Prev)) ! and then Full_View (Prev) = T)); ! end; ! end if; Parent_Type := Find_Type_Of_Subtype_Indic (Indic); Parent_Base := Base_Type (Parent_Type); *************** package body Sem_Ch3 is *** 3278,3295 **** then Set_Ekind (T, Ekind (Parent_Type)); Set_Etype (T, Any_Type); ! return; elsif not Is_Tagged_Type (Parent_Type) then Error_Msg_N ("parent of type extension must be a tagged type ", Indic); ! return; ! elsif Ekind (Parent_Type) = E_Void ! or else Ekind (Parent_Type) = E_Incomplete_Type ! then Error_Msg_N ("premature derivation of incomplete type", Indic); ! return; elsif Is_Concurrent_Type (Parent_Type) then Error_Msg_N --- 3670,3685 ---- then Set_Ekind (T, Ekind (Parent_Type)); Set_Etype (T, Any_Type); ! goto Leave; elsif not Is_Tagged_Type (Parent_Type) then Error_Msg_N ("parent of type extension must be a tagged type ", Indic); ! goto Leave; ! elsif Ekind_In (Parent_Type, E_Void, E_Incomplete_Type) then Error_Msg_N ("premature derivation of incomplete type", Indic); ! goto Leave; elsif Is_Concurrent_Type (Parent_Type) then Error_Msg_N *************** package body Sem_Ch3 is *** 3300,3306 **** Set_Ekind (T, E_Limited_Private_Type); Set_Private_Dependents (T, New_Elmt_List); Set_Error_Posted (T); ! return; end if; -- Perhaps the parent type should be changed to the class-wide type's --- 3690,3696 ---- Set_Ekind (T, E_Limited_Private_Type); Set_Private_Dependents (T, New_Elmt_List); Set_Error_Posted (T); ! goto Leave; end if; -- Perhaps the parent type should be changed to the class-wide type's *************** package body Sem_Ch3 is *** 3309,3315 **** if Is_Class_Wide_Type (Parent_Type) then Error_Msg_N ("parent of type extension must not be a class-wide type", Indic); ! return; end if; if (not Is_Package_Or_Generic_Package (Current_Scope) --- 3699,3705 ---- if Is_Class_Wide_Type (Parent_Type) then Error_Msg_N ("parent of type extension must not be a class-wide type", Indic); ! goto Leave; end if; if (not Is_Package_Or_Generic_Package (Current_Scope) *************** package body Sem_Ch3 is *** 3341,3350 **** Build_Derived_Record_Type (N, Parent_Type, T); -- Ada 2005 (AI-443): Synchronized private extension or a rewritten -- synchronized formal derived type. ! if Ada_Version >= Ada_05 and then Synchronized_Present (N) then Set_Is_Limited_Record (T); --- 3731,3749 ---- Build_Derived_Record_Type (N, Parent_Type, T); + -- Propagate inherited invariant information. The new type has + -- invariants, if the parent type has inheritable invariants, + -- and these invariants can in turn be inherited. + + if Has_Inheritable_Invariants (Parent_Type) then + Set_Has_Inheritable_Invariants (T); + Set_Has_Invariants (T); + end if; + -- Ada 2005 (AI-443): Synchronized private extension or a rewritten -- synchronized formal derived type. ! if Ada_Version >= Ada_2005 and then Synchronized_Present (N) then Set_Is_Limited_Record (T); *************** package body Sem_Ch3 is *** 3432,3437 **** --- 3831,3839 ---- N, Parent_Type); end if; end if; + + <> + Analyze_Aspect_Specifications (N, T, Aspect_Specifications (N)); end Analyze_Private_Extension_Declaration; --------------------------------- *************** package body Sem_Ch3 is *** 3488,3495 **** --- 3890,3912 ---- Set_Treat_As_Volatile (Id, Treat_As_Volatile (T)); Set_Is_Atomic (Id, Is_Atomic (T)); Set_Is_Ada_2005_Only (Id, Is_Ada_2005_Only (T)); + Set_Is_Ada_2012_Only (Id, Is_Ada_2012_Only (T)); Set_Convention (Id, Convention (T)); + -- If ancestor has predicates then so does the subtype, and in addition + -- we must delay the freeze to properly arrange predicate inheritance. + + -- The Ancestor_Type test is a big kludge, there seem to be cases in + -- which T = ID, so the above tests and assignments do nothing??? + + if Has_Predicates (T) + or else (Present (Ancestor_Subtype (T)) + and then Has_Predicates (Ancestor_Subtype (T))) + then + Set_Has_Predicates (Id); + Set_Has_Delayed_Freeze (Id); + end if; + -- In the case where there is no constraint given in the subtype -- indication, Process_Subtype just returns the Subtype_Mark, so its -- semantic attributes must be established here. *************** package body Sem_Ch3 is *** 3597,3604 **** if Is_Tagged_Type (T) then Set_Is_Tagged_Type (Id); Set_Is_Abstract_Type (Id, Is_Abstract_Type (T)); ! Set_Primitive_Operations ! (Id, Primitive_Operations (T)); Set_Class_Wide_Type (Id, Class_Wide_Type (T)); if Is_Interface (T) then --- 4014,4021 ---- if Is_Tagged_Type (T) then Set_Is_Tagged_Type (Id); Set_Is_Abstract_Type (Id, Is_Abstract_Type (T)); ! Set_Direct_Primitive_Operations ! (Id, Direct_Primitive_Operations (T)); Set_Class_Wide_Type (Id, Class_Wide_Type (T)); if Is_Interface (T) then *************** package body Sem_Ch3 is *** 3621,3630 **** (Id, Known_To_Have_Preelab_Init (T)); if Is_Tagged_Type (T) then ! Set_Is_Tagged_Type (Id); ! Set_Is_Abstract_Type (Id, Is_Abstract_Type (T)); ! Set_Primitive_Operations (Id, Primitive_Operations (T)); ! Set_Class_Wide_Type (Id, Class_Wide_Type (T)); end if; -- In general the attributes of the subtype of a private type --- 4038,4048 ---- (Id, Known_To_Have_Preelab_Init (T)); if Is_Tagged_Type (T) then ! Set_Is_Tagged_Type (Id); ! Set_Is_Abstract_Type (Id, Is_Abstract_Type (T)); ! Set_Class_Wide_Type (Id, Class_Wide_Type (T)); ! Set_Direct_Primitive_Operations (Id, ! Direct_Primitive_Operations (T)); end if; -- In general the attributes of the subtype of a private type *************** package body Sem_Ch3 is *** 3695,3701 **** end if; when E_Incomplete_Type => ! if Ada_Version >= Ada_05 then Set_Ekind (Id, E_Incomplete_Subtype); -- Ada 2005 (AI-412): Decorate an incomplete subtype --- 4113,4119 ---- end if; when E_Incomplete_Type => ! if Ada_Version >= Ada_2005 then Set_Ekind (Id, E_Incomplete_Subtype); -- Ada 2005 (AI-412): Decorate an incomplete subtype *************** package body Sem_Ch3 is *** 3729,3735 **** end if; if Etype (Id) = Any_Type then ! return; end if; -- Some common processing on all types --- 4147,4153 ---- end if; if Etype (Id) = Any_Type then ! goto Leave; end if; -- Some common processing on all types *************** package body Sem_Ch3 is *** 3750,3759 **** if Present (Generic_Parent_Type (N)) and then (Nkind ! (Parent (Generic_Parent_Type (N))) /= N_Formal_Type_Declaration or else Nkind (Formal_Type_Definition (Parent (Generic_Parent_Type (N)))) ! /= N_Formal_Private_Type_Definition) then if Is_Tagged_Type (Id) then --- 4168,4177 ---- if Present (Generic_Parent_Type (N)) and then (Nkind ! (Parent (Generic_Parent_Type (N))) /= N_Formal_Type_Declaration or else Nkind (Formal_Type_Definition (Parent (Generic_Parent_Type (N)))) ! /= N_Formal_Private_Type_Definition) then if Is_Tagged_Type (Id) then *************** package body Sem_Ch3 is *** 3841,3848 **** --- 4259,4283 ---- end if; end if; + -- Make sure that generic actual types are properly frozen. The subtype + -- is marked as a generic actual type when the enclosing instance is + -- analyzed, so here we identify the subtype from the tree structure. + + if Expander_Active + and then Is_Generic_Actual_Type (Id) + and then In_Instance + and then not Comes_From_Source (N) + and then Nkind (Subtype_Indication (N)) /= N_Subtype_Indication + and then Is_Frozen (T) + then + Freeze_Before (N, Id); + end if; + Set_Optimize_Alignment_Flags (Id); Check_Eliminated (Id); + + <> + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Subtype_Declaration; -------------------------------- *************** package body Sem_Ch3 is *** 3866,4174 **** end if; end Analyze_Subtype_Indication; - ------------------------------ - -- Analyze_Type_Declaration -- - ------------------------------ - - procedure Analyze_Type_Declaration (N : Node_Id) is - Def : constant Node_Id := Type_Definition (N); - Def_Id : constant Entity_Id := Defining_Identifier (N); - T : Entity_Id; - Prev : Entity_Id; - - Is_Remote : constant Boolean := - (Is_Remote_Types (Current_Scope) - or else Is_Remote_Call_Interface (Current_Scope)) - and then not (In_Private_Part (Current_Scope) - or else In_Package_Body (Current_Scope)); - - procedure Check_Ops_From_Incomplete_Type; - -- If there is a tagged incomplete partial view of the type, transfer - -- its operations to the full view, and indicate that the type of the - -- controlling parameter (s) is this full view. - - ------------------------------------ - -- Check_Ops_From_Incomplete_Type -- - ------------------------------------ - - procedure Check_Ops_From_Incomplete_Type is - Elmt : Elmt_Id; - Formal : Entity_Id; - Op : Entity_Id; - - begin - if Prev /= T - and then Ekind (Prev) = E_Incomplete_Type - and then Is_Tagged_Type (Prev) - and then Is_Tagged_Type (T) - then - Elmt := First_Elmt (Primitive_Operations (Prev)); - while Present (Elmt) loop - Op := Node (Elmt); - Prepend_Elmt (Op, Primitive_Operations (T)); - - Formal := First_Formal (Op); - while Present (Formal) loop - if Etype (Formal) = Prev then - Set_Etype (Formal, T); - end if; - - Next_Formal (Formal); - end loop; - - if Etype (Op) = Prev then - Set_Etype (Op, T); - end if; - - Next_Elmt (Elmt); - end loop; - end if; - end Check_Ops_From_Incomplete_Type; - - -- Start of processing for Analyze_Type_Declaration - - begin - Prev := Find_Type_Name (N); - - -- The full view, if present, now points to the current type - - -- Ada 2005 (AI-50217): If the type was previously decorated when - -- imported through a LIMITED WITH clause, it appears as incomplete - -- but has no full view. - -- If the incomplete view is tagged, a class_wide type has been - -- created already. Use it for the full view as well, to prevent - -- multiple incompatible class-wide types that may be created for - -- self-referential anonymous access components. - - if Ekind (Prev) = E_Incomplete_Type - and then Present (Full_View (Prev)) - then - T := Full_View (Prev); - - if Is_Tagged_Type (Prev) - and then Present (Class_Wide_Type (Prev)) - then - Set_Ekind (T, Ekind (Prev)); -- will be reset later - Set_Class_Wide_Type (T, Class_Wide_Type (Prev)); - Set_Etype (Class_Wide_Type (T), T); - end if; - - else - T := Prev; - end if; - - Set_Is_Pure (T, Is_Pure (Current_Scope)); - - -- We set the flag Is_First_Subtype here. It is needed to set the - -- corresponding flag for the Implicit class-wide-type created - -- during tagged types processing. - - Set_Is_First_Subtype (T, True); - - -- Only composite types other than array types are allowed to have - -- discriminants. - - case Nkind (Def) is - - -- For derived types, the rule will be checked once we've figured - -- out the parent type. - - when N_Derived_Type_Definition => - null; - - -- For record types, discriminants are allowed - - when N_Record_Definition => - null; - - when others => - if Present (Discriminant_Specifications (N)) then - Error_Msg_N - ("elementary or array type cannot have discriminants", - Defining_Identifier - (First (Discriminant_Specifications (N)))); - end if; - end case; - - -- Elaborate the type definition according to kind, and generate - -- subsidiary (implicit) subtypes where needed. We skip this if it was - -- already done (this happens during the reanalysis that follows a call - -- to the high level optimizer). - - if not Analyzed (T) then - Set_Analyzed (T); - - case Nkind (Def) is - - when N_Access_To_Subprogram_Definition => - Access_Subprogram_Declaration (T, Def); - - -- If this is a remote access to subprogram, we must create the - -- equivalent fat pointer type, and related subprograms. - - if Is_Remote then - Process_Remote_AST_Declaration (N); - end if; - - -- Validate categorization rule against access type declaration - -- usually a violation in Pure unit, Shared_Passive unit. - - Validate_Access_Type_Declaration (T, N); - - when N_Access_To_Object_Definition => - Access_Type_Declaration (T, Def); - - -- Validate categorization rule against access type declaration - -- usually a violation in Pure unit, Shared_Passive unit. - - Validate_Access_Type_Declaration (T, N); - - -- If we are in a Remote_Call_Interface package and define a - -- RACW, then calling stubs and specific stream attributes - -- must be added. - - if Is_Remote - and then Is_Remote_Access_To_Class_Wide_Type (Def_Id) - then - Add_RACW_Features (Def_Id); - end if; - - -- Set no strict aliasing flag if config pragma seen - - if Opt.No_Strict_Aliasing then - Set_No_Strict_Aliasing (Base_Type (Def_Id)); - end if; - - when N_Array_Type_Definition => - Array_Type_Declaration (T, Def); - - when N_Derived_Type_Definition => - Derived_Type_Declaration (T, N, T /= Def_Id); - - when N_Enumeration_Type_Definition => - Enumeration_Type_Declaration (T, Def); - - when N_Floating_Point_Definition => - Floating_Point_Type_Declaration (T, Def); - - when N_Decimal_Fixed_Point_Definition => - Decimal_Fixed_Point_Type_Declaration (T, Def); - - when N_Ordinary_Fixed_Point_Definition => - Ordinary_Fixed_Point_Type_Declaration (T, Def); - - when N_Signed_Integer_Type_Definition => - Signed_Integer_Type_Declaration (T, Def); - - when N_Modular_Type_Definition => - Modular_Type_Declaration (T, Def); - - when N_Record_Definition => - Record_Type_Declaration (T, N, Prev); - - when others => - raise Program_Error; - - end case; - end if; - - if Etype (T) = Any_Type then - return; - end if; - - -- Some common processing for all types - - Set_Depends_On_Private (T, Has_Private_Component (T)); - Check_Ops_From_Incomplete_Type; - - -- Both the declared entity, and its anonymous base type if one - -- was created, need freeze nodes allocated. - - declare - B : constant Entity_Id := Base_Type (T); - - begin - -- In the case where the base type differs from the first subtype, we - -- pre-allocate a freeze node, and set the proper link to the first - -- subtype. Freeze_Entity will use this preallocated freeze node when - -- it freezes the entity. - - -- This does not apply if the base type is a generic type, whose - -- declaration is independent of the current derived definition. - - if B /= T and then not Is_Generic_Type (B) then - Ensure_Freeze_Node (B); - Set_First_Subtype_Link (Freeze_Node (B), T); - end if; - - -- A type that is imported through a limited_with clause cannot - -- generate any code, and thus need not be frozen. However, an access - -- type with an imported designated type needs a finalization list, - -- which may be referenced in some other package that has non-limited - -- visibility on the designated type. Thus we must create the - -- finalization list at the point the access type is frozen, to - -- prevent unsatisfied references at link time. - - if not From_With_Type (T) or else Is_Access_Type (T) then - Set_Has_Delayed_Freeze (T); - end if; - end; - - -- Case where T is the full declaration of some private type which has - -- been swapped in Defining_Identifier (N). - - if T /= Def_Id and then Is_Private_Type (Def_Id) then - Process_Full_View (N, T, Def_Id); - - -- Record the reference. The form of this is a little strange, since - -- the full declaration has been swapped in. So the first parameter - -- here represents the entity to which a reference is made which is - -- the "real" entity, i.e. the one swapped in, and the second - -- parameter provides the reference location. - - -- Also, we want to kill Has_Pragma_Unreferenced temporarily here - -- since we don't want a complaint about the full type being an - -- unwanted reference to the private type - - declare - B : constant Boolean := Has_Pragma_Unreferenced (T); - begin - Set_Has_Pragma_Unreferenced (T, False); - Generate_Reference (T, T, 'c'); - Set_Has_Pragma_Unreferenced (T, B); - end; - - Set_Completion_Referenced (Def_Id); - - -- For completion of incomplete type, process incomplete dependents - -- and always mark the full type as referenced (it is the incomplete - -- type that we get for any real reference). - - elsif Ekind (Prev) = E_Incomplete_Type then - Process_Incomplete_Dependents (N, T, Prev); - Generate_Reference (Prev, Def_Id, 'c'); - Set_Completion_Referenced (Def_Id); - - -- If not private type or incomplete type completion, this is a real - -- definition of a new entity, so record it. - - else - Generate_Definition (Def_Id); - end if; - - if Chars (Scope (Def_Id)) = Name_System - and then Chars (Def_Id) = Name_Address - and then Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (N))) - then - Set_Is_Descendent_Of_Address (Def_Id); - Set_Is_Descendent_Of_Address (Base_Type (Def_Id)); - Set_Is_Descendent_Of_Address (Prev); - end if; - - Set_Optimize_Alignment_Flags (Def_Id); - Check_Eliminated (Def_Id); - end Analyze_Type_Declaration; - -------------------------- -- Analyze_Variant_Part -- -------------------------- --- 4301,4306 ---- *************** package body Sem_Ch3 is *** 4223,4235 **** Discr_Name : Node_Id; Discr_Type : Entity_Id; - Case_Table : Choice_Table_Type (1 .. Number_Of_Choices (N)); - Last_Choice : Nat; Dont_Care : Boolean; Others_Present : Boolean := False; - pragma Warnings (Off, Case_Table); - pragma Warnings (Off, Last_Choice); pragma Warnings (Off, Dont_Care); pragma Warnings (Off, Others_Present); -- We don't care about the assigned values of any of these --- 4355,4363 ---- *************** package body Sem_Ch3 is *** 4263,4270 **** -- Call the instantiated Analyze_Choices which does the rest of the work ! Analyze_Choices ! (N, Discr_Type, Case_Table, Last_Choice, Dont_Care, Others_Present); end Analyze_Variant_Part; ---------------------------- --- 4391,4397 ---- -- Call the instantiated Analyze_Choices which does the rest of the work ! Analyze_Choices (N, Discr_Type, Dont_Care, Others_Present); end Analyze_Variant_Part; ---------------------------- *************** package body Sem_Ch3 is *** 4325,4333 **** Decl : Entity_Id; begin ! New_E := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); Set_Is_Internal (New_E); Decl := --- 4452,4458 ---- Decl : Entity_Id; begin ! New_E := Make_Temporary (Loc, 'T'); Set_Is_Internal (New_E); Decl := *************** package body Sem_Ch3 is *** 4357,4362 **** --- 4482,4496 ---- end if; Make_Index (Index, P, Related_Id, Nb_Index); + + -- Check error of subtype with predicate for index type + + Bad_Predicated_Subtype_Use + ("subtype& has predicate, not allowed as index subtype", + Index, Etype (Index)); + + -- Move to next index + Next_Index (Index); Nb_Index := Nb_Index + 1; end loop; *************** package body Sem_Ch3 is *** 4480,4486 **** -- Ada 2005 (AI-231): Propagate the null-excluding attribute to the -- array type to ensure that objects of this type are initialized. ! if Ada_Version >= Ada_05 and then Can_Never_Be_Null (Element_Type) then Set_Can_Never_Be_Null (T); --- 4614,4620 ---- -- Ada 2005 (AI-231): Propagate the null-excluding attribute to the -- array type to ensure that objects of this type are initialized. ! if Ada_Version >= Ada_2005 and then Can_Never_Be_Null (Element_Type) then Set_Can_Never_Be_Null (T); *************** package body Sem_Ch3 is *** 4529,4539 **** Error_Msg_N ("missing index definition in array type declaration", T); declare ! Indices : constant List_Id := New_List (New_Occurrence_Of (Any_Id, Sloc (T))); begin ! Set_Discrete_Subtype_Definitions (Def, Indices); ! Set_First_Index (T, First (Indices)); return; end; end if; --- 4663,4673 ---- Error_Msg_N ("missing index definition in array type declaration", T); declare ! Indexes : constant List_Id := New_List (New_Occurrence_Of (Any_Id, Sloc (T))); begin ! Set_Discrete_Subtype_Definitions (Def, Indexes); ! Set_First_Index (T, First (Indexes)); return; end; end if; *************** package body Sem_Ch3 is *** 4549,4555 **** end if; -- In the case of an unconstrained array the parser has already verified ! -- that all the indices are unconstrained but we still need to make sure -- that the element type is constrained. if Is_Indefinite_Subtype (Element_Type) then --- 4683,4689 ---- end if; -- In the case of an unconstrained array the parser has already verified ! -- that all the indexes are unconstrained but we still need to make sure -- that the element type is constrained. if Is_Indefinite_Subtype (Element_Type) then *************** package body Sem_Ch3 is *** 4576,4585 **** Curr_Scope : constant Scope_Stack_Entry := Scope_Stack.Table (Scope_Stack.Last); ! Anon : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); ! Acc : Node_Id; Comp : Node_Id; Decl : Node_Id; --- 4710,4716 ---- Curr_Scope : constant Scope_Stack_Entry := Scope_Stack.Table (Scope_Stack.Last); ! Anon : constant Entity_Id := Make_Temporary (Loc, 'S'); Acc : Node_Id; Comp : Node_Id; Decl : Node_Id; *************** package body Sem_Ch3 is *** 4921,4929 **** is Loc : constant Source_Ptr := Sloc (N); ! Corr_Record : constant Entity_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('C')); ! Corr_Decl : Node_Id; Corr_Decl_Needed : Boolean; -- If the derived type has fewer discriminants than its parent, the --- 5052,5058 ---- is Loc : constant Source_Ptr := Sloc (N); ! Corr_Record : constant Entity_Id := Make_Temporary (Loc, 'C'); Corr_Decl : Node_Id; Corr_Decl_Needed : Boolean; -- If the derived type has fewer discriminants than its parent, the *************** package body Sem_Ch3 is *** 4957,4989 **** end loop; end if; ! if Present (Old_Disc) then -- The new type has fewer discriminants, so we need to create a new -- corresponding record, which is derived from the corresponding -- record of the parent, and has a stored constraint that captures ! -- the values of the discriminant constraints. ! -- The type declaration for the derived corresponding record has ! -- the same discriminant part and constraints as the current ! -- declaration. Copy the unanalyzed tree to build declaration. Corr_Decl_Needed := True; New_N := Copy_Separate_Tree (N); Corr_Decl := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Corr_Record, Discriminant_Specifications => Discriminant_Specifications (New_N), ! Type_Definition => Make_Derived_Type_Definition (Loc, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Corresponding_Record_Type (Parent_Type), Loc), ! Constraint => Constraint (Subtype_Indication (Type_Definition (New_N)))))); end if; --- 5086,5120 ---- end loop; end if; ! if Present (Old_Disc) and then Expander_Active then -- The new type has fewer discriminants, so we need to create a new -- corresponding record, which is derived from the corresponding -- record of the parent, and has a stored constraint that captures ! -- the values of the discriminant constraints. The corresponding ! -- record is needed only if expander is active and code generation is ! -- enabled. ! -- The type declaration for the derived corresponding record has the ! -- same discriminant part and constraints as the current declaration. ! -- Copy the unanalyzed tree to build declaration. Corr_Decl_Needed := True; New_N := Copy_Separate_Tree (N); Corr_Decl := Make_Full_Type_Declaration (Loc, ! Defining_Identifier => Corr_Record, Discriminant_Specifications => Discriminant_Specifications (New_N), ! Type_Definition => Make_Derived_Type_Definition (Loc, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Corresponding_Record_Type (Parent_Type), Loc), ! Constraint => Constraint (Subtype_Indication (Type_Definition (New_N)))))); end if; *************** package body Sem_Ch3 is *** 5020,5026 **** Loc : constant Source_Ptr := Sloc (N); Anon : constant Entity_Id := Make_Defining_Identifier (Loc, ! New_External_Name (Chars (Derived_Type), 'T')); Decl : Node_Id; begin --- 5151,5157 ---- Loc : constant Source_Ptr := Sloc (N); Anon : constant Entity_Id := Make_Defining_Identifier (Loc, ! Chars => New_External_Name (Chars (Derived_Type), 'T')); Decl : Node_Id; begin *************** package body Sem_Ch3 is *** 5319,5325 **** Implicit_Base := Make_Defining_Identifier (Sloc (Derived_Type), ! New_External_Name (Chars (Derived_Type), 'B')); -- Indicate the proper nature of the derived type. This must be done -- before analysis of the literals, to recognize cases when a literal --- 5450,5456 ---- Implicit_Base := Make_Defining_Identifier (Sloc (Derived_Type), ! Chars => New_External_Name (Chars (Derived_Type), 'B')); -- Indicate the proper nature of the derived type. This must be done -- before analysis of the literals, to recognize cases when a literal *************** package body Sem_Ch3 is *** 5350,5358 **** --- 5481,5494 ---- Set_RM_Size (Implicit_Base, RM_Size (Parent_Type)); Set_First_Rep_Item (Implicit_Base, First_Rep_Item (Parent_Type)); + -- Copy other flags from parent type + Set_Has_Non_Standard_Rep (Implicit_Base, Has_Non_Standard_Rep (Parent_Type)); + Set_Has_Pragma_Ordered + (Implicit_Base, Has_Pragma_Ordered + (Parent_Type)); Set_Has_Delayed_Freeze (Implicit_Base); -- Process the subtype indication including a validation check on the *************** package body Sem_Ch3 is *** 5527,5534 **** end if; -- If we did not have a range constraint, then set the range from the ! -- parent type. Otherwise, the call to Process_Subtype has set the ! -- bounds. if No_Constraint or else not Has_Range_Constraint (Indic) --- 5663,5669 ---- end if; -- If we did not have a range constraint, then set the range from the ! -- parent type. Otherwise, the Process_Subtype call has set the bounds. if No_Constraint or else not Has_Range_Constraint (Indic) *************** package body Sem_Ch3 is *** 5569,5575 **** -- already have been set if there was a constraint present. Set_Digits_Value (Implicit_Base, Digits_Value (Parent_Base)); ! Set_Vax_Float (Implicit_Base, Vax_Float (Parent_Base)); if No_Constraint then Set_Digits_Value (Derived_Type, Digits_Value (Parent_Type)); --- 5704,5710 ---- -- already have been set if there was a constraint present. Set_Digits_Value (Implicit_Base, Digits_Value (Parent_Base)); ! Set_Float_Rep (Implicit_Base, Float_Rep (Parent_Base)); if No_Constraint then Set_Digits_Value (Derived_Type, Digits_Value (Parent_Type)); *************** package body Sem_Ch3 is *** 5726,5734 **** and then Expander_Active then declare ! Full_Der : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); New_Ext : constant Node_Id := Copy_Separate_Tree (Record_Extension_Part (Type_Definition (N))); --- 5861,5867 ---- and then Expander_Active then declare ! Full_Der : constant Entity_Id := Make_Temporary (Loc, 'T'); New_Ext : constant Node_Id := Copy_Separate_Tree (Record_Extension_Part (Type_Definition (N))); *************** package body Sem_Ch3 is *** 5816,5821 **** --- 5949,5955 ---- Full_Der := New_Copy (Derived_Type); Set_Comes_From_Source (Full_Decl, False); Set_Comes_From_Source (Full_Der, False); + Set_Parent (Full_Der, Full_Decl); Insert_After (N, Full_Decl); *************** package body Sem_Ch3 is *** 5889,5897 **** Set_Defining_Identifier (Full_Decl, Full_Der); Build_Derived_Record_Type (Full_Decl, Parent_Type, Full_Der, Derive_Subps); - Set_Analyzed (Full_Decl); end if; if Swapped then Uninstall_Declarations (Par_Scope); --- 6023,6038 ---- Set_Defining_Identifier (Full_Decl, Full_Der); Build_Derived_Record_Type (Full_Decl, Parent_Type, Full_Der, Derive_Subps); end if; + -- The full declaration has been introduced into the tree and + -- processed in the step above. It should not be analyzed again + -- (when encountered later in the current list of declarations) + -- to prevent spurious name conflicts. The full entity remains + -- invisible. + + Set_Analyzed (Full_Decl); + if Swapped then Uninstall_Declarations (Par_Scope); *************** package body Sem_Ch3 is *** 5961,5968 **** if not Is_Private_Type (Full_View (Parent_Type)) and then (In_Open_Scopes (Scope (Parent_Type))) then ! Full_Der := Make_Defining_Identifier (Sloc (Derived_Type), ! Chars (Derived_Type)); Set_Is_Itype (Full_Der); Set_Has_Private_Declaration (Full_Der); Set_Has_Private_Declaration (Derived_Type); --- 6102,6110 ---- if not Is_Private_Type (Full_View (Parent_Type)) and then (In_Open_Scopes (Scope (Parent_Type))) then ! Full_Der := ! Make_Defining_Identifier ! (Sloc (Derived_Type), Chars (Derived_Type)); Set_Is_Itype (Full_Der); Set_Has_Private_Declaration (Full_Der); Set_Has_Private_Declaration (Derived_Type); *************** package body Sem_Ch3 is *** 6034,6041 **** and then not Is_Completion then Full_Der := ! Make_Defining_Identifier (Sloc (Derived_Type), ! Chars => Chars (Derived_Type)); Set_Is_Itype (Full_Der); Set_Has_Private_Declaration (Full_Der); Set_Has_Private_Declaration (Derived_Type); --- 6176,6183 ---- and then not Is_Completion then Full_Der := ! Make_Defining_Identifier ! (Sloc (Derived_Type), Chars (Derived_Type)); Set_Is_Itype (Full_Der); Set_Has_Private_Declaration (Full_Der); Set_Has_Private_Declaration (Derived_Type); *************** package body Sem_Ch3 is *** 6108,6115 **** -- will be installed when the enclosing child body is compiled. Full_Der := ! Make_Defining_Identifier (Sloc (Derived_Type), ! Chars => Chars (Derived_Type)); Set_Is_Itype (Full_Der); Build_Itype_Reference (Full_Der, N); --- 6250,6257 ---- -- will be installed when the enclosing child body is compiled. Full_Der := ! Make_Defining_Identifier ! (Sloc (Derived_Type), Chars (Derived_Type)); Set_Is_Itype (Full_Der); Build_Itype_Reference (Full_Der, N); *************** package body Sem_Ch3 is *** 6663,6669 **** -- Create internal access types for components with anonymous -- access types. ! if Ada_Version >= Ada_05 then Check_Anonymous_Access_Components (N, Derived_Type, Derived_Type, Component_List (Record_Extension_Part (Type_Def))); --- 6805,6811 ---- -- Create internal access types for components with anonymous -- access types. ! if Ada_Version >= Ada_2005 then Check_Anonymous_Access_Components (N, Derived_Type, Derived_Type, Component_List (Record_Extension_Part (Type_Def))); *************** package body Sem_Ch3 is *** 6778,6783 **** --- 6920,6934 ---- Mark_Rewrite_Insertion (New_Decl); Insert_Before (N, New_Decl); + -- In the extension case, make sure ancestor is frozen appropriately + -- (see also non-discriminated case below). + + if Present (Record_Extension_Part (Type_Def)) + or else Is_Interface (Parent_Base) + then + Freeze_Before (New_Decl, Parent_Type); + end if; + -- Note that this call passes False for the Derive_Subps parameter -- because subprogram derivation is deferred until after creating -- the subtype (see below). *************** package body Sem_Ch3 is *** 6868,6876 **** -- The declaration of a specific descendant of an interface type -- freezes the interface type (RM 13.14). ! if not Private_Extension ! or else Is_Interface (Parent_Base) ! then Freeze_Before (N, Parent_Type); end if; --- 7019,7025 ---- -- The declaration of a specific descendant of an interface type -- freezes the interface type (RM 13.14). ! if not Private_Extension or else Is_Interface (Parent_Base) then Freeze_Before (N, Parent_Type); end if; *************** package body Sem_Ch3 is *** 6881,6887 **** -- cannot be declared in a generic body if it's derived directly -- or indirectly from a formal type of that generic. ! if Ada_Version >= Ada_05 then if Present (Enclosing_Generic_Body (Derived_Type)) then declare Ancestor_Type : Entity_Id; --- 7030,7036 ---- -- cannot be declared in a generic body if it's derived directly -- or indirectly from a formal type of that generic. ! if Ada_Version >= Ada_2005 then if Present (Enclosing_Generic_Body (Derived_Type)) then declare Ancestor_Type : Entity_Id; *************** package body Sem_Ch3 is *** 6954,6962 **** -- Ada 2005 (AI-251) ! if Ada_Version = Ada_05 ! and then Is_Tagged ! then -- "The declaration of a specific descendant of an interface type -- freezes the interface type" (RM 13.14). --- 7103,7110 ---- -- Ada 2005 (AI-251) ! if Ada_Version >= Ada_2005 and then Is_Tagged then ! -- "The declaration of a specific descendant of an interface type -- freezes the interface type" (RM 13.14). *************** package body Sem_Ch3 is *** 7043,7049 **** Check_Or_Process_Discriminants (N, Derived_Type); ! -- For non-tagged types the constraint on the Parent_Type must be -- present and is used to rename the discriminants. if not Is_Tagged and then not Has_Discriminants (Parent_Type) then --- 7191,7197 ---- Check_Or_Process_Discriminants (N, Derived_Type); ! -- For untagged types, the constraint on the Parent_Type must be -- present and is used to rename the discriminants. if not Is_Tagged and then not Has_Discriminants (Parent_Type) then *************** package body Sem_Ch3 is *** 7290,7296 **** -- Set fields for tagged types if Is_Tagged then ! Set_Primitive_Operations (Derived_Type, New_Elmt_List); -- All tagged types defined in Ada.Finalization are controlled --- 7438,7444 ---- -- Set fields for tagged types if Is_Tagged then ! Set_Direct_Primitive_Operations (Derived_Type, New_Elmt_List); -- All tagged types defined in Ada.Finalization are controlled *************** package body Sem_Ch3 is *** 7319,7325 **** (Derived_Type, Expand_To_Stored_Constraint (Parent_Base, Discs)); end if; ! if Ada_Version >= Ada_05 then declare Ifaces_List : Elist_Id; --- 7467,7473 ---- (Derived_Type, Expand_To_Stored_Constraint (Parent_Base, Discs)); end if; ! if Ada_Version >= Ada_2005 then declare Ifaces_List : Elist_Id; *************** package body Sem_Ch3 is *** 7356,7361 **** --- 7504,7530 ---- Exclude_Parents => True); Set_Interfaces (Derived_Type, Ifaces_List); + + -- If the derived type is the anonymous type created for + -- a declaration whose parent has a constraint, propagate + -- the interface list to the source type. This must be done + -- prior to the completion of the analysis of the source type + -- because the components in the extension may contain current + -- instances whose legality depends on some ancestor. + + if Is_Itype (Derived_Type) then + declare + Def : constant Node_Id := + Associated_Node_For_Itype (Derived_Type); + begin + if Present (Def) + and then Nkind (Def) = N_Full_Type_Declaration + then + Set_Interfaces + (Defining_Identifier (Def), Ifaces_List); + end if; + end; + end if; end; end if; *************** package body Sem_Ch3 is *** 7527,7535 **** begin D := First_Entity (Derived_Type); while Present (D) loop ! if Ekind (D) = E_Discriminant ! or else Ekind (D) = E_Component ! then if Is_Itype (Etype (D)) and then Ekind (Etype (D)) = E_Anonymous_Access_Type then --- 7696,7702 ---- begin D := First_Entity (Derived_Type); while Present (D) loop ! if Ekind_In (D, E_Discriminant, E_Component) then if Is_Itype (Etype (D)) and then Ekind (Etype (D)) = E_Anonymous_Access_Type then *************** package body Sem_Ch3 is *** 7570,7575 **** --- 7737,7757 ---- Set_Is_Controlled (Derived_Type, Is_Controlled (Parent_Type)); Set_Is_Tagged_Type (Derived_Type, Is_Tagged_Type (Parent_Type)); + -- Propagate invariant information. The new type has invariants if + -- they are inherited from the parent type, and these invariants can + -- be further inherited, so both flags are set. + + if Has_Inheritable_Invariants (Parent_Type) then + Set_Has_Inheritable_Invariants (Derived_Type); + Set_Has_Invariants (Derived_Type); + end if; + + -- We similarly inherit predicates + + if Has_Predicates (Parent_Type) then + Set_Has_Predicates (Derived_Type); + end if; + -- The derived type inherits the representation clauses of the parent. -- However, for a private type that is completed by a derivation, there -- may be operation attributes that have been specified already (stream *************** package body Sem_Ch3 is *** 7697,7709 **** begin -- A discriminal has the same name as the discriminant ! D_Minal := ! Make_Defining_Identifier (Sloc (Discrim), ! Chars => Chars (Discrim)); Set_Ekind (D_Minal, E_In_Parameter); Set_Mechanism (D_Minal, Default_Mechanism); Set_Etype (D_Minal, Etype (Discrim)); Set_Discriminal (Discrim, D_Minal); Set_Discriminal_Link (D_Minal, Discrim); --- 7879,7890 ---- begin -- A discriminal has the same name as the discriminant ! D_Minal := Make_Defining_Identifier (Sloc (Discrim), Chars (Discrim)); Set_Ekind (D_Minal, E_In_Parameter); Set_Mechanism (D_Minal, Default_Mechanism); Set_Etype (D_Minal, Etype (Discrim)); + Set_Scope (D_Minal, Current_Scope); Set_Discriminal (Discrim, D_Minal); Set_Discriminal_Link (D_Minal, Discrim); *************** package body Sem_Ch3 is *** 7720,7725 **** --- 7901,7907 ---- Set_Ekind (CR_Disc, E_In_Parameter); Set_Mechanism (CR_Disc, Default_Mechanism); Set_Etype (CR_Disc, Etype (Discrim)); + Set_Scope (CR_Disc, Current_Scope); Set_Discriminal_Link (CR_Disc, Discrim); Set_CR_Discriminant (Discrim, CR_Disc); end if; *************** package body Sem_Ch3 is *** 8148,8160 **** -- concurrent record type (which has the list of primitive -- operations). ! if Ada_Version >= Ada_05 and then Is_Concurrent_Type (T) then Set_Corresponding_Record_Type (Def_Id, Corresponding_Record_Type (T)); else ! Set_Primitive_Operations (Def_Id, Primitive_Operations (T)); end if; Set_Is_Abstract_Type (Def_Id, Is_Abstract_Type (T)); --- 8330,8343 ---- -- concurrent record type (which has the list of primitive -- operations). ! if Ada_Version >= Ada_2005 and then Is_Concurrent_Type (T) then Set_Corresponding_Record_Type (Def_Id, Corresponding_Record_Type (T)); else ! Set_Direct_Primitive_Operations (Def_Id, ! Direct_Primitive_Operations (T)); end if; Set_Is_Abstract_Type (Def_Id, Is_Abstract_Type (T)); *************** package body Sem_Ch3 is *** 8361,8366 **** --- 8544,8697 ---- Subp : Entity_Id; Type_Def : Node_Id; + procedure Check_Pragma_Implemented (Subp : Entity_Id); + -- Ada 2012 (AI05-0030): Subprogram Subp overrides an interface routine + -- which has pragma Implemented already set. Check whether Subp's entity + -- kind conforms to the implementation kind of the overridden routine. + + procedure Check_Pragma_Implemented + (Subp : Entity_Id; + Iface_Subp : Entity_Id); + -- Ada 2012 (AI05-0030): Subprogram Subp overrides interface routine + -- Iface_Subp and both entities have pragma Implemented already set on + -- them. Check whether the two implementation kinds are conforming. + + procedure Inherit_Pragma_Implemented + (Subp : Entity_Id; + Iface_Subp : Entity_Id); + -- Ada 2012 (AI05-0030): Interface primitive Subp overrides interface + -- subprogram Iface_Subp which has been marked by pragma Implemented. + -- Propagate the implementation kind of Iface_Subp to Subp. + + ------------------------------ + -- Check_Pragma_Implemented -- + ------------------------------ + + procedure Check_Pragma_Implemented (Subp : Entity_Id) is + Iface_Alias : constant Entity_Id := Interface_Alias (Subp); + Impl_Kind : constant Name_Id := Implementation_Kind (Iface_Alias); + Contr_Typ : Entity_Id; + + begin + -- Subp must have an alias since it is a hidden entity used to link + -- an interface subprogram to its overriding counterpart. + + pragma Assert (Present (Alias (Subp))); + + -- Extract the type of the controlling formal + + Contr_Typ := Etype (First_Formal (Alias (Subp))); + + if Is_Concurrent_Record_Type (Contr_Typ) then + Contr_Typ := Corresponding_Concurrent_Type (Contr_Typ); + end if; + + -- An interface subprogram whose implementation kind is By_Entry must + -- be implemented by an entry. + + if Impl_Kind = Name_By_Entry + and then Ekind (Wrapped_Entity (Alias (Subp))) /= E_Entry + then + Error_Msg_Node_2 := Iface_Alias; + Error_Msg_NE + ("type & must implement abstract subprogram & with an entry", + Alias (Subp), Contr_Typ); + + elsif Impl_Kind = Name_By_Protected_Procedure then + + -- An interface subprogram whose implementation kind is By_ + -- Protected_Procedure cannot be implemented by a primitive + -- procedure of a task type. + + if Ekind (Contr_Typ) /= E_Protected_Type then + Error_Msg_Node_2 := Contr_Typ; + Error_Msg_NE + ("interface subprogram & cannot be implemented by a " & + "primitive procedure of task type &", Alias (Subp), + Iface_Alias); + + -- An interface subprogram whose implementation kind is By_ + -- Protected_Procedure must be implemented by a procedure. + + elsif Is_Primitive_Wrapper (Alias (Subp)) + and then Ekind (Wrapped_Entity (Alias (Subp))) /= E_Procedure + then + Error_Msg_Node_2 := Iface_Alias; + Error_Msg_NE + ("type & must implement abstract subprogram & with a " & + "procedure", Alias (Subp), Contr_Typ); + end if; + end if; + end Check_Pragma_Implemented; + + ------------------------------ + -- Check_Pragma_Implemented -- + ------------------------------ + + procedure Check_Pragma_Implemented + (Subp : Entity_Id; + Iface_Subp : Entity_Id) + is + Iface_Kind : constant Name_Id := Implementation_Kind (Iface_Subp); + Subp_Kind : constant Name_Id := Implementation_Kind (Subp); + + begin + -- Ada 2012 (AI05-0030): The implementation kinds of an overridden + -- and overriding subprogram are different. In general this is an + -- error except when the implementation kind of the overridden + -- subprograms is By_Any. + + if Iface_Kind /= Subp_Kind + and then Iface_Kind /= Name_By_Any + then + if Iface_Kind = Name_By_Entry then + Error_Msg_N + ("incompatible implementation kind, overridden subprogram " & + "is marked By_Entry", Subp); + else + Error_Msg_N + ("incompatible implementation kind, overridden subprogram " & + "is marked By_Protected_Procedure", Subp); + end if; + end if; + end Check_Pragma_Implemented; + + -------------------------------- + -- Inherit_Pragma_Implemented -- + -------------------------------- + + procedure Inherit_Pragma_Implemented + (Subp : Entity_Id; + Iface_Subp : Entity_Id) + is + Iface_Kind : constant Name_Id := Implementation_Kind (Iface_Subp); + Loc : constant Source_Ptr := Sloc (Subp); + Impl_Prag : Node_Id; + + begin + -- Since the implementation kind is stored as a representation item + -- rather than a flag, create a pragma node. + + Impl_Prag := + Make_Pragma (Loc, + Chars => Name_Implemented, + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => + New_Reference_To (Subp, Loc)), + + Make_Pragma_Argument_Association (Loc, + Expression => Make_Identifier (Loc, Iface_Kind)))); + + -- The pragma doesn't need to be analyzed because it is internally + -- build. It is safe to directly register it as a rep item since we + -- are only interested in the characters of the implementation kind. + + Record_Rep_Item (Subp, Impl_Prag); + end Inherit_Pragma_Implemented; + + -- Start of processing for Check_Abstract_Overriding + begin Op_List := Primitive_Operations (T); *************** package body Sem_Ch3 is *** 8394,8400 **** if Is_Null_Extension (T) and then Has_Controlling_Result (Subp) ! and then Ada_Version >= Ada_05 and then Present (Alias_Subp) and then not Comes_From_Source (Subp) and then not Is_Abstract_Subprogram (Alias_Subp) --- 8725,8731 ---- if Is_Null_Extension (T) and then Has_Controlling_Result (Subp) ! and then Ada_Version >= Ada_2005 and then Present (Alias_Subp) and then not Comes_From_Source (Subp) and then not Is_Abstract_Subprogram (Alias_Subp) *************** package body Sem_Ch3 is *** 8450,8456 **** if Nkind (Type_Def) = N_Derived_Type_Definition and then Present (Record_Extension_Part (Type_Def)) and then ! (Ada_Version < Ada_05 or else not Is_Null_Extension (T) or else Ekind (Subp) = E_Procedure or else not Has_Controlling_Result (Subp) --- 8781,8787 ---- if Nkind (Type_Def) = N_Derived_Type_Definition and then Present (Record_Extension_Part (Type_Def)) and then ! (Ada_Version < Ada_2005 or else not Is_Null_Extension (T) or else Ekind (Subp) = E_Procedure or else not Has_Controlling_Result (Subp) *************** package body Sem_Ch3 is *** 8566,8603 **** -- them all, and not just the first one). Error_Msg_Node_2 := Subp; ! Error_Msg_N ! ("nonabstract type& has abstract subprogram&!", T); end if; end if; ! -- Ada 2005 (AI05-0030): Inspect hidden subprograms which provide ! -- the mapping between interface and implementing type primitives. ! -- If the interface alias is marked as Implemented_By_Entry, the ! -- alias must be an entry wrapper. ! if Ada_Version >= Ada_05 and then Is_Hidden (Subp) and then Present (Interface_Alias (Subp)) ! and then Implemented_By_Entry (Interface_Alias (Subp)) ! and then Present (Alias_Subp) ! and then ! (not Is_Primitive_Wrapper (Alias_Subp) ! or else Ekind (Wrapped_Entity (Alias_Subp)) /= E_Entry) then ! declare ! Error_Ent : Entity_Id := T; ! begin ! if Is_Concurrent_Record_Type (Error_Ent) then ! Error_Ent := Corresponding_Concurrent_Type (Error_Ent); ! end if; ! Error_Msg_Node_2 := Interface_Alias (Subp); ! Error_Msg_NE ! ("type & must implement abstract subprogram & with an entry", ! Error_Ent, Error_Ent); ! end; end if; Next_Elmt (Elmt); --- 8897,8947 ---- -- them all, and not just the first one). Error_Msg_Node_2 := Subp; ! Error_Msg_N ("nonabstract type& has abstract subprogram&!", T); end if; end if; ! -- Ada 2012 (AI05-0030): Perform some checks related to pragma ! -- Implemented ! -- Subp is an expander-generated procedure which maps an interface ! -- alias to a protected wrapper. The interface alias is flagged by ! -- pragma Implemented. Ensure that Subp is a procedure when the ! -- implementation kind is By_Protected_Procedure or an entry when ! -- By_Entry. ! ! if Ada_Version >= Ada_2012 and then Is_Hidden (Subp) and then Present (Interface_Alias (Subp)) ! and then Has_Rep_Pragma (Interface_Alias (Subp), Name_Implemented) then ! Check_Pragma_Implemented (Subp); ! end if; ! -- Subp is an interface primitive which overrides another interface ! -- primitive marked with pragma Implemented. ! if Ada_Version >= Ada_2012 ! and then Present (Overridden_Operation (Subp)) ! and then Has_Rep_Pragma ! (Overridden_Operation (Subp), Name_Implemented) ! then ! -- If the overriding routine is also marked by Implemented, check ! -- that the two implementation kinds are conforming. ! ! if Has_Rep_Pragma (Subp, Name_Implemented) then ! Check_Pragma_Implemented ! (Subp => Subp, ! Iface_Subp => Overridden_Operation (Subp)); ! ! -- Otherwise the overriding routine inherits the implementation ! -- kind from the overridden subprogram. ! ! else ! Inherit_Pragma_Implemented ! (Subp => Subp, ! Iface_Subp => Overridden_Operation (Subp)); ! end if; end if; Next_Elmt (Elmt); *************** package body Sem_Ch3 is *** 8616,8631 **** -- A discriminant_specification for an access discriminant shall appear -- only in the declaration for a task or protected type, or for a type -- with the reserved word 'limited' in its definition or in one of its ! -- ancestors. (RM 3.7(10)) ! if Nkind (Discriminant_Type (D)) = N_Access_Definition ! and then not Is_Concurrent_Type (Current_Scope) ! and then not Is_Concurrent_Record_Type (Current_Scope) ! and then not Is_Limited_Record (Current_Scope) ! and then Ekind (Current_Scope) /= E_Limited_Private_Type ! then ! Error_Msg_N ! ("access discriminants allowed only for limited types", Loc); end if; end Check_Access_Discriminant_Requires_Limited; --- 8960,8982 ---- -- A discriminant_specification for an access discriminant shall appear -- only in the declaration for a task or protected type, or for a type -- with the reserved word 'limited' in its definition or in one of its ! -- ancestors (RM 3.7(10)). ! -- AI-0063: The proper condition is that type must be immutably limited, ! -- or else be a partial view. ! ! if Nkind (Discriminant_Type (D)) = N_Access_Definition then ! if Is_Immutably_Limited_Type (Current_Scope) ! or else ! (Nkind (Parent (Current_Scope)) = N_Private_Type_Declaration ! and then Limited_Present (Parent (Current_Scope))) ! then ! null; ! ! else ! Error_Msg_N ! ("access discriminants allowed only for limited types", Loc); ! end if; end if; end Check_Access_Discriminant_Requires_Limited; *************** package body Sem_Ch3 is *** 8653,8659 **** and then Has_Discriminants (Etype (C)) and then not Is_Constrained (Etype (C)) and then not In_Instance_Body ! and then Ada_Version < Ada_05 then Error_Msg_N ("aliased component must be constrained (RM 3.6(11))", --- 9004,9010 ---- and then Has_Discriminants (Etype (C)) and then not Is_Constrained (Etype (C)) and then not In_Instance_Body ! and then Ada_Version < Ada_2005 then Error_Msg_N ("aliased component must be constrained (RM 3.6(11))", *************** package body Sem_Ch3 is *** 8668,8674 **** and then Has_Discriminants (Component_Type (T)) and then not Is_Constrained (Component_Type (T)) and then not In_Instance_Body ! and then Ada_Version < Ada_05 then Error_Msg_N ("aliased component type must be constrained (RM 3.6(11))", --- 9019,9025 ---- and then Has_Discriminants (Component_Type (T)) and then not Is_Constrained (Component_Type (T)) and then not In_Instance_Body ! and then Ada_Version < Ada_2005 then Error_Msg_N ("aliased component type must be constrained (RM 3.6(11))", *************** package body Sem_Ch3 is *** 8720,8728 **** begin if not Comes_From_Source (E) then ! if Ekind (E) = E_Task_Type ! or else Ekind (E) = E_Protected_Type ! then -- It may be an anonymous protected type created for a -- single variable. Post error on variable, if present. --- 9071,9077 ---- begin if not Comes_From_Source (E) then ! if Ekind_In (E, E_Task_Type, E_Protected_Type) then -- It may be an anonymous protected type created for a -- single variable. Post error on variable, if present. *************** package body Sem_Ch3 is *** 8770,8777 **** Error_Msg_NE ("missing full declaration for }", Parent (E), E); else ! Error_Msg_NE ! ("missing body for &", Parent (E), E); end if; -- Package body has no completion for a declaration that appears --- 9119,9125 ---- Error_Msg_NE ("missing full declaration for }", Parent (E), E); else ! Error_Msg_NE ("missing body for &", Parent (E), E); end if; -- Package body has no completion for a declaration that appears *************** package body Sem_Ch3 is *** 8782,8789 **** Error_Msg_Sloc := Sloc (E); if Is_Type (E) then ! Error_Msg_NE ! ("missing full declaration for }!", Body_Id, E); elsif Is_Overloadable (E) and then Current_Entity_In_Scope (E) /= E --- 9130,9136 ---- Error_Msg_Sloc := Sloc (E); if Is_Type (E) then ! Error_Msg_NE ("missing full declaration for }!", Body_Id, E); elsif Is_Overloadable (E) and then Current_Entity_In_Scope (E) /= E *************** package body Sem_Ch3 is *** 9021,9027 **** Error_Msg_N ("?cannot initialize entities of limited type!", Exp); ! elsif Ada_Version < Ada_05 then Error_Msg_N ("cannot initialize entities of limited type", Exp); Explain_Limited_Type (T, Exp); --- 9368,9374 ---- Error_Msg_N ("?cannot initialize entities of limited type!", Exp); ! elsif Ada_Version < Ada_2005 then Error_Msg_N ("cannot initialize entities of limited type", Exp); Explain_Limited_Type (T, Exp); *************** package body Sem_Ch3 is *** 9308,9314 **** -- If an incomplete or private type declaration was already given for the -- type, the discriminants may have already been processed if they were -- present on the incomplete declaration. In this case a full conformance ! -- check is performed otherwise just process them. procedure Check_Or_Process_Discriminants (N : Node_Id; --- 9655,9663 ---- -- If an incomplete or private type declaration was already given for the -- type, the discriminants may have already been processed if they were -- present on the incomplete declaration. In this case a full conformance ! -- check has been performed in Find_Type_Name, and we then recheck here ! -- some properties that can't be checked on the partial view alone. ! -- Otherwise we call Process_Discriminants. procedure Check_Or_Process_Discriminants (N : Node_Id; *************** package body Sem_Ch3 is *** 9318,9341 **** begin if Has_Discriminants (T) then ! -- Make the discriminants visible to component declarations declare ! D : Entity_Id; ! Prev : Entity_Id; begin ! D := First_Discriminant (T); while Present (D) loop ! Prev := Current_Entity (D); Set_Current_Entity (D); Set_Is_Immediately_Visible (D); ! Set_Homonym (D, Prev); -- Ada 2005 (AI-230): Access discriminant allowed in -- non-limited record types. ! if Ada_Version < Ada_05 then -- This restriction gets applied to the full type here. It -- has already been applied earlier to the partial view. --- 9667,9727 ---- begin if Has_Discriminants (T) then ! -- Discriminants are already set on T if they were already present ! -- on the partial view. Make them visible to component declarations. declare ! D : Entity_Id; ! -- Discriminant on T (full view) referencing expr on partial view ! ! Prev_D : Entity_Id; ! -- Entity of corresponding discriminant on partial view ! ! New_D : Node_Id; ! -- Discriminant specification for full view, expression is the ! -- syntactic copy on full view (which has been checked for ! -- conformance with partial view), only used here to post error ! -- message. begin ! D := First_Discriminant (T); ! New_D := First (Discriminant_Specifications (N)); while Present (D) loop ! Prev_D := Current_Entity (D); Set_Current_Entity (D); Set_Is_Immediately_Visible (D); ! Set_Homonym (D, Prev_D); ! ! -- Handle the case where there is an untagged partial view and ! -- the full view is tagged: must disallow discriminants with ! -- defaults, unless compiling for Ada 2012, which allows a ! -- limited tagged type to have defaulted discriminants (see ! -- AI05-0214). However, suppress the error here if it was ! -- already reported on the default expression of the partial ! -- view. ! ! if Is_Tagged_Type (T) ! and then Present (Expression (Parent (D))) ! and then (not Is_Limited_Type (Current_Scope) ! or else Ada_Version < Ada_2012) ! and then not Error_Posted (Expression (Parent (D))) ! then ! if Ada_Version >= Ada_2012 then ! Error_Msg_N ! ("discriminants of nonlimited tagged type cannot have" ! & " defaults", ! Expression (New_D)); ! else ! Error_Msg_N ! ("discriminants of tagged type cannot have defaults", ! Expression (New_D)); ! end if; ! end if; -- Ada 2005 (AI-230): Access discriminant allowed in -- non-limited record types. ! if Ada_Version < Ada_2005 then -- This restriction gets applied to the full type here. It -- has already been applied earlier to the partial view. *************** package body Sem_Ch3 is *** 9344,9349 **** --- 9730,9736 ---- end if; Next_Discriminant (D); + Next (New_D); end loop; end; *************** package body Sem_Ch3 is *** 9562,9569 **** if Is_Tagged_Type (Full_Base) then Set_Is_Tagged_Type (Full); ! Set_Primitive_Operations (Full, Primitive_Operations (Full_Base)); ! Set_Class_Wide_Type (Full, Class_Wide_Type (Full_Base)); -- If this is a subtype of a protected or task type, constrain its -- corresponding record, unless this is a subtype without constraints, --- 9949,9964 ---- if Is_Tagged_Type (Full_Base) then Set_Is_Tagged_Type (Full); ! Set_Direct_Primitive_Operations (Full, ! Direct_Primitive_Operations (Full_Base)); ! ! -- Inherit class_wide type of full_base in case the partial view was ! -- not tagged. Otherwise it has already been created when the private ! -- subtype was analyzed. ! ! if No (Class_Wide_Type (Full)) then ! Set_Class_Wide_Type (Full, Class_Wide_Type (Full_Base)); ! end if; -- If this is a subtype of a protected or task type, constrain its -- corresponding record, unless this is a subtype without constraints, *************** package body Sem_Ch3 is *** 9585,9590 **** --- 9980,10027 ---- Corresponding_Record_Type (Full_Base)); end if; end if; + + -- Link rep item chain, and also setting of Has_Predicates from private + -- subtype to full subtype, since we will need these on the full subtype + -- to create the predicate function. Note that the full subtype may + -- already have rep items, inherited from the full view of the base + -- type, so we must be sure not to overwrite these entries. + + declare + Item : Node_Id; + Next_Item : Node_Id; + + begin + Item := First_Rep_Item (Full); + + -- If no existing rep items on full type, we can just link directly + -- to the list of items on the private type. + + if No (Item) then + Set_First_Rep_Item (Full, First_Rep_Item (Priv)); + + -- Else search to end of items currently linked to the full subtype + + else + loop + Next_Item := Next_Rep_Item (Item); + exit when No (Next_Item); + Item := Next_Item; + end loop; + + -- And link the private type items at the end of the chain + + Set_Next_Rep_Item (Item, First_Rep_Item (Priv)); + end if; + end; + + -- Make sure Has_Predicates is set on full type if it is set on the + -- private type. Note that it may already be set on the full type and + -- if so, we don't want to unset it. + + if Has_Predicates (Priv) then + Set_Has_Predicates (Full); + end if; end Complete_Private_Subtype; ---------------------------- *************** package body Sem_Ch3 is *** 9633,9646 **** then declare Loc : constant Source_Ptr := Sloc (N); ! Def_Id : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('S')); ! Decl : constant Node_Id := Make_Subtype_Declaration (Loc, ! Defining_Identifier => ! Def_Id, ! Subtype_Indication => Relocate_Node (Curr_Obj_Def)); begin --- 10070,10080 ---- then declare Loc : constant Source_Ptr := Sloc (N); ! Def_Id : constant Entity_Id := Make_Temporary (Loc, 'S'); ! Decl : constant Node_Id := Make_Subtype_Declaration (Loc, ! Defining_Identifier => Def_Id, ! Subtype_Indication => Relocate_Node (Curr_Obj_Def)); begin *************** package body Sem_Ch3 is *** 9802,9814 **** and then not In_Private_Part (Current_Scope) then Error_Msg_Sloc := Sloc (Prev); ! Error_Msg_N ("full constant for declaration#" ! & " must be in private part", N); elsif Ekind (Current_Scope) = E_Package ! and then List_Containing (Parent (Prev)) ! /= Visible_Declarations ! (Specification (Unit_Declaration_Node (Current_Scope))) then Error_Msg_N ("deferred constant must be declared in visible part", --- 10236,10250 ---- and then not In_Private_Part (Current_Scope) then Error_Msg_Sloc := Sloc (Prev); ! Error_Msg_N ! ("full constant for declaration#" ! & " must be in private part", N); elsif Ekind (Current_Scope) = E_Package ! and then ! List_Containing (Parent (Prev)) /= ! Visible_Declarations ! (Specification (Unit_Declaration_Node (Current_Scope))) then Error_Msg_N ("deferred constant must be declared in visible part", *************** package body Sem_Ch3 is *** 9885,9891 **** end if; if (Ekind (T) = E_General_Access_Type ! or else Ada_Version >= Ada_05) and then Has_Private_Declaration (Desig_Type) and then In_Open_Scopes (Scope (Desig_Type)) and then Has_Discriminants (Desig_Type) --- 10321,10327 ---- end if; if (Ekind (T) = E_General_Access_Type ! or else Ada_Version >= Ada_2005) and then Has_Private_Declaration (Desig_Type) and then In_Open_Scopes (Scope (Desig_Type)) and then Has_Discriminants (Desig_Type) *************** package body Sem_Ch3 is *** 9989,10005 **** -- generic body, the rule is checked assuming that the actual type has -- defaulted discriminants. ! if Ada_Version >= Ada_05 or else Warn_On_Ada_2005_Compatibility then if Ekind (Base_Type (T)) = E_General_Access_Type and then Has_Defaulted_Discriminants (Desig_Type) then ! if Ada_Version < Ada_05 then Error_Msg_N ("access subtype of general access type would not " & "be allowed in Ada 2005?", S); else Error_Msg_N ! ("access subype of general access type not allowed", S); end if; Error_Msg_N ("\discriminants have defaults", S); --- 10425,10441 ---- -- generic body, the rule is checked assuming that the actual type has -- defaulted discriminants. ! if Ada_Version >= Ada_2005 or else Warn_On_Ada_2005_Compatibility then if Ekind (Base_Type (T)) = E_General_Access_Type and then Has_Defaulted_Discriminants (Desig_Type) then ! if Ada_Version < Ada_2005 then Error_Msg_N ("access subtype of general access type would not " & "be allowed in Ada 2005?", S); else Error_Msg_N ! ("access subtype of general access type not allowed", S); end if; Error_Msg_N ("\discriminants have defaults", S); *************** package body Sem_Ch3 is *** 10009,10015 **** and then Has_Discriminants (Desig_Type) and then In_Package_Body (Current_Scope) then ! if Ada_Version < Ada_05 then Error_Msg_N ("access subtype would not be allowed in generic body " & "in Ada 2005?", S); --- 10445,10451 ---- and then Has_Discriminants (Desig_Type) and then In_Package_Body (Current_Scope) then ! if Ada_Version < Ada_2005 then Error_Msg_N ("access subtype would not be allowed in generic body " & "in Ada 2005?", S); *************** package body Sem_Ch3 is *** 10055,10062 **** -- is such an array type... (RM 3.6.1) if Is_Constrained (T) then ! Error_Msg_N ! ("array type is already constrained", Subtype_Mark (SI)); Constraint_OK := False; else --- 10491,10497 ---- -- is such an array type... (RM 3.6.1) if Is_Constrained (T) then ! Error_Msg_N ("array type is already constrained", Subtype_Mark (SI)); Constraint_OK := False; else *************** package body Sem_Ch3 is *** 10150,10156 **** function Build_Constrained_Array_Type (Old_Type : Entity_Id) return Entity_Id; ! -- If Old_Type is an array type, one of whose indices is constrained -- by a discriminant, build an Itype whose constraint replaces the -- discriminant with its value in the constraint. --- 10585,10591 ---- function Build_Constrained_Array_Type (Old_Type : Entity_Id) return Entity_Id; ! -- If Old_Type is an array type, one of whose indexes is constrained -- by a discriminant, build an Itype whose constraint replaces the -- discriminant with its value in the constraint. *************** package body Sem_Ch3 is *** 10446,10452 **** Next_Elmt (E); end loop; ! -- The corresponding_Discriminant mechanism is incomplete, because -- the correspondence between new and old discriminants is not one -- to one: one new discriminant can constrain several old ones. In -- that case, scan sequentially the stored_constraint, the list of --- 10881,10887 ---- Next_Elmt (E); end loop; ! -- The Corresponding_Discriminant mechanism is incomplete, because -- the correspondence between new and old discriminants is not one -- to one: one new discriminant can constrain several old ones. In -- that case, scan sequentially the stored_constraint, the list of *************** package body Sem_Ch3 is *** 10783,10789 **** -- Ada 2005 (AI-412): Constrained incomplete subtypes are illegal. -- Avoid generating an error for access-to-incomplete subtypes. ! if Ada_Version >= Ada_05 and then Ekind (T) = E_Incomplete_Type and then Nkind (Parent (S)) = N_Subtype_Declaration and then not Is_Itype (Def_Id) --- 11218,11224 ---- -- Ada 2005 (AI-412): Constrained incomplete subtypes are illegal. -- Avoid generating an error for access-to-incomplete subtypes. ! if Ada_Version >= Ada_2005 and then Ekind (T) = E_Incomplete_Type and then Nkind (Parent (S)) = N_Subtype_Declaration and then not Is_Itype (Def_Id) *************** package body Sem_Ch3 is *** 10804,10811 **** Error_Msg_N ("(Ada 2005) incomplete subtype may not be constrained", C); else ! Error_Msg_N ! ("invalid constraint: type has no discriminant", C); end if; Fixup_Bad_Constraint; --- 11239,11245 ---- Error_Msg_N ("(Ada 2005) incomplete subtype may not be constrained", C); else ! Error_Msg_N ("invalid constraint: type has no discriminant", C); end if; Fixup_Bad_Constraint; *************** package body Sem_Ch3 is *** 11018,11023 **** --- 11452,11464 ---- elsif Base_Type (Entity (S)) /= Base_Type (T) then Wrong_Type (S, Base_Type (T)); + + -- Check error of subtype with predicate in index constraint + + else + Bad_Predicated_Subtype_Use + ("subtype& has predicate, not allowed in index constraint", + S, Entity (S)); end if; return; *************** package body Sem_Ch3 is *** 11043,11048 **** --- 11484,11490 ---- else Set_Ekind (Def_Id, E_Enumeration_Subtype); Set_Is_Character_Type (Def_Id, Is_Character_Type (T)); + Set_First_Literal (Def_Id, First_Literal (T)); end if; Set_Size_Info (Def_Id, (T)); *************** package body Sem_Ch3 is *** 11198,11203 **** --- 11640,11651 ---- Rng : Node_Id; begin + -- Defend against previous errors + + if No (Scalar_Range (Derived_Type)) then + return; + end if; + Lo := Build_Scalar_Bound (Type_Low_Bound (Derived_Type), Parent_Type, Implicit_Base); *************** package body Sem_Ch3 is *** 11283,11288 **** --- 11731,11737 ---- Set_Is_Public (Full, Is_Public (Priv)); Set_Is_Pure (Full, Is_Pure (Priv)); Set_Is_Tagged_Type (Full, Is_Tagged_Type (Priv)); + Set_Has_Pragma_Unmodified (Full, Has_Pragma_Unmodified (Priv)); Set_Has_Pragma_Unreferenced (Full, Has_Pragma_Unreferenced (Priv)); Set_Has_Pragma_Unreferenced_Objects (Full, Has_Pragma_Unreferenced_Objects *************** package body Sem_Ch3 is *** 11291,11299 **** Conditional_Delay (Full, Priv); if Is_Tagged_Type (Full) then ! Set_Primitive_Operations (Full, Primitive_Operations (Priv)); ! if Priv = Base_Type (Priv) then Set_Class_Wide_Type (Full, Class_Wide_Type (Priv)); end if; end if; --- 11740,11749 ---- Conditional_Delay (Full, Priv); if Is_Tagged_Type (Full) then ! Set_Direct_Primitive_Operations (Full, ! Direct_Primitive_Operations (Priv)); ! if Is_Base_Type (Priv) then Set_Class_Wide_Type (Full, Class_Wide_Type (Priv)); end if; end if; *************** package body Sem_Ch3 is *** 11318,11327 **** Access_Types_To_Process (Freeze_Node (Priv))); end if; ! -- Swap the two entities. Now Privat is the full type entity and ! -- Full is the private one. They will be swapped back at the end ! -- of the private part. This swapping ensures that the entity that ! -- is visible in the private part is the full declaration. Exchange_Entities (Priv, Full); Append_Entity (Full, Scope (Full)); --- 11768,11777 ---- Access_Types_To_Process (Freeze_Node (Priv))); end if; ! -- Swap the two entities. Now Private is the full type entity and Full ! -- is the private one. They will be swapped back at the end of the ! -- private part. This swapping ensures that the entity that is visible ! -- in the private part is the full declaration. Exchange_Entities (Priv, Full); Append_Entity (Full, Scope (Full)); *************** package body Sem_Ch3 is *** 11909,11915 **** Typ : Entity_Id; begin ! pragma Assert (Ada_Version >= Ada_05 and then Is_Record_Type (Tagged_Type) and then Is_Tagged_Type (Tagged_Type) and then Has_Interfaces (Tagged_Type)); --- 12359,12365 ---- Typ : Entity_Id; begin ! pragma Assert (Ada_Version >= Ada_2005 and then Is_Record_Type (Tagged_Type) and then Is_Tagged_Type (Tagged_Type) and then Has_Interfaces (Tagged_Type)); *************** package body Sem_Ch3 is *** 11927,11933 **** -- non-abstract tagged types that can reference abstract primitives -- through its Alias attribute are the internal entities that have -- attribute Interface_Alias, and these entities are generated later ! -- by Freeze_Record_Type). if In_Private_Part (Current_Scope) and then Is_Abstract_Type (Parent_Type) --- 12377,12383 ---- -- non-abstract tagged types that can reference abstract primitives -- through its Alias attribute are the internal entities that have -- attribute Interface_Alias, and these entities are generated later ! -- by Add_Internal_Interface_Entities). if In_Private_Part (Current_Scope) and then Is_Abstract_Type (Parent_Type) *************** package body Sem_Ch3 is *** 11993,11998 **** --- 12443,12464 ---- Derive_Subprogram (New_Subp, Iface_Subp, Tagged_Type, Iface); + -- Ada 2012 (AI05-0197): If the covering primitive's name + -- differs from the name of the interface primitive then it + -- is a private primitive inherited from a parent type. In + -- such case, given that Tagged_Type covers the interface, + -- the inherited private primitive becomes visible. For such + -- purpose we add a new entity that renames the inherited + -- private primitive. + + elsif Chars (E) /= Chars (Iface_Subp) then + pragma Assert (Has_Suffix (E, 'P')); + Derive_Subprogram + (New_Subp, Iface_Subp, Tagged_Type, Iface); + Set_Alias (New_Subp, E); + Set_Is_Abstract_Subprogram (New_Subp, + Is_Abstract_Subprogram (E)); + -- Propagate to the full view interface entities associated -- with the partial view *************** package body Sem_Ch3 is *** 12205,12219 **** Set_Etype (New_Id, Base_Type (Derived_Type)); end if; - -- Ada 2005 (AI-251): Handle derivations of abstract interface - -- primitives. - - 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); - else Set_Etype (New_Id, Etype (Id)); end if; --- 12671,12676 ---- *************** package body Sem_Ch3 is *** 12233,12242 **** end if; end Set_Derived_Name; - -- Local variables - - Parent_Overrides_Interface_Primitive : Boolean := False; - -- Start of processing for Derive_Subprogram begin --- 12690,12695 ---- *************** package body Sem_Ch3 is *** 12244,12266 **** New_Entity (Nkind (Parent_Subp), Sloc (Derived_Type)); Set_Ekind (New_Subp, Ekind (Parent_Subp)); - -- Check whether the parent overrides an interface primitive - - if Is_Overriding_Operation (Parent_Subp) then - declare - E : Entity_Id := Parent_Subp; - begin - while Present (Overridden_Operation (E)) loop - E := Ultimate_Alias (Overridden_Operation (E)); - end loop; - - Parent_Overrides_Interface_Primitive := - Is_Dispatching_Operation (E) - and then Present (Find_Dispatching_Type (E)) - and then Is_Interface (Find_Dispatching_Type (E)); - end; - end if; - -- Check whether the inherited subprogram is a private operation that -- should be inherited but not yet made visible. Such subprograms can -- become visible at a later point (e.g., the private part of a public --- 12697,12702 ---- *************** package body Sem_Ch3 is *** 12329,12335 **** -- overrides an interface primitive because interface primitives -- must be visible in the partial view of the parent (RM 7.3 (7.3/2)) ! elsif Parent_Overrides_Interface_Primitive then Set_Derived_Name; -- Otherwise, the type is inheriting a private operation, so enter --- 12765,12774 ---- -- overrides an interface primitive because interface primitives -- must be visible in the partial view of the parent (RM 7.3 (7.3/2)) ! elsif Ada_Version >= Ada_2005 ! and then Is_Dispatching_Operation (Parent_Subp) ! and then Covers_Some_Interface (Parent_Subp) ! then Set_Derived_Name; -- Otherwise, the type is inheriting a private operation, so enter *************** package body Sem_Ch3 is *** 12443,12448 **** --- 12882,12890 ---- if Ekind (Parent_Subp) = E_Procedure then Set_Is_Valued_Procedure (New_Subp, Is_Valued_Procedure (Parent_Subp)); + else + Set_Has_Controlling_Result + (New_Subp, Has_Controlling_Result (Parent_Subp)); end if; -- No_Return must be inherited properly. If this is overridden in the *************** package body Sem_Ch3 is *** 12466,12472 **** -- Ada 2005 (AI-228): Calculate the "require overriding" and "abstract" -- properties of the subprogram, as defined in RM-3.9.3(4/2-6/2). ! elsif Ada_Version >= Ada_05 and then (Is_Abstract_Subprogram (Alias (New_Subp)) or else (Is_Tagged_Type (Derived_Type) and then Etype (New_Subp) = Derived_Type --- 12908,12914 ---- -- Ada 2005 (AI-228): Calculate the "require overriding" and "abstract" -- properties of the subprogram, as defined in RM-3.9.3(4/2-6/2). ! elsif Ada_Version >= Ada_2005 and then (Is_Abstract_Subprogram (Alias (New_Subp)) or else (Is_Tagged_Type (Derived_Type) and then Etype (New_Subp) = Derived_Type *************** package body Sem_Ch3 is *** 12488,12494 **** Set_Requires_Overriding (New_Subp); end if; ! elsif Ada_Version < Ada_05 and then (Is_Abstract_Subprogram (Alias (New_Subp)) or else (Is_Tagged_Type (Derived_Type) and then Etype (New_Subp) = Derived_Type --- 12930,12936 ---- Set_Requires_Overriding (New_Subp); end if; ! elsif Ada_Version < Ada_2005 and then (Is_Abstract_Subprogram (Alias (New_Subp)) or else (Is_Tagged_Type (Derived_Type) and then Etype (New_Subp) = Derived_Type *************** package body Sem_Ch3 is *** 12496,12501 **** --- 12938,12952 ---- then Set_Is_Abstract_Subprogram (New_Subp); + -- AI05-0097 : an inherited operation that dispatches on result is + -- abstract if the derived type is abstract, even if the parent type + -- is concrete and the derived type is a null extension. + + elsif Has_Controlling_Result (Alias (New_Subp)) + and then Is_Abstract_Type (Etype (New_Subp)) + then + 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 *************** package body Sem_Ch3 is *** 12567,12575 **** Collect_Primitive_Operations (Parent_Type); function Check_Derived_Type return Boolean; ! -- Check that all primitive inherited from Parent_Type are found in -- the list of primitives of Derived_Type exactly in the same order. function Check_Derived_Type return Boolean is E : Entity_Id; Elmt : Elmt_Id; --- 13018,13035 ---- Collect_Primitive_Operations (Parent_Type); function Check_Derived_Type return Boolean; ! -- Check that all the entities derived from Parent_Type are found in -- the list of primitives of Derived_Type exactly in the same order. + procedure Derive_Interface_Subprogram + (New_Subp : in out Entity_Id; + Subp : Entity_Id; + Actual_Subp : Entity_Id); + -- Derive New_Subp from the ultimate alias of the parent subprogram Subp + -- (which is an interface primitive). If Generic_Actual is present then + -- Actual_Subp is the actual subprogram corresponding with the generic + -- subprogram Subp. + function Check_Derived_Type return Boolean is E : Entity_Id; Elmt : Elmt_Id; *************** package body Sem_Ch3 is *** 12645,12650 **** --- 13105,13149 ---- return True; end Check_Derived_Type; + --------------------------------- + -- Derive_Interface_Subprogram -- + --------------------------------- + + procedure Derive_Interface_Subprogram + (New_Subp : in out Entity_Id; + Subp : Entity_Id; + Actual_Subp : Entity_Id) + is + Iface_Subp : constant Entity_Id := Ultimate_Alias (Subp); + Iface_Type : constant Entity_Id := Find_Dispatching_Type (Iface_Subp); + + begin + pragma Assert (Is_Interface (Iface_Type)); + + Derive_Subprogram + (New_Subp => New_Subp, + Parent_Subp => Iface_Subp, + Derived_Type => Derived_Type, + Parent_Type => Iface_Type, + Actual_Subp => Actual_Subp); + + -- Given that this new interface entity corresponds with a primitive + -- of the parent that was not overridden we must leave it associated + -- with its parent primitive to ensure that it will share the same + -- dispatch table slot when overridden. + + if No (Actual_Subp) then + Set_Alias (New_Subp, Subp); + + -- For instantiations this is not needed since the previous call to + -- Derive_Subprogram leaves the entity well decorated. + + else + pragma Assert (Alias (New_Subp) = Actual_Subp); + null; + end if; + end Derive_Interface_Subprogram; + -- Local variables Alias_Subp : Entity_Id; *************** package body Sem_Ch3 is *** 12706,12711 **** --- 13205,13216 ---- -- corresponding operations of the actual. else + pragma Assert (No (Node (Act_Elmt)) + or else (Primitive_Names_Match (Subp, Node (Act_Elmt)) + and then + Type_Conformant (Subp, Node (Act_Elmt), + Skip_Controlling_Formals => True))); + Derive_Subprogram (New_Subp, Subp, Derived_Type, Parent_Base, Node (Act_Elmt)); *************** package body Sem_Ch3 is *** 12790,12802 **** Subp := Node (Elmt); Alias_Subp := Ultimate_Alias (Subp); ! -- At this early stage Derived_Type has no entities with attribute ! -- Interface_Alias. In addition, such primitives are always ! -- located at the end of the list of primitives of Parent_Type. ! -- Therefore, if found we can safely stop processing pending ! -- entities. ! exit when Present (Interface_Alias (Subp)); -- If the generic actual is present find the corresponding -- operation in the generic actual. If the parent type is a --- 13295,13307 ---- Subp := Node (Elmt); Alias_Subp := Ultimate_Alias (Subp); ! -- Do not derive internal entities of the parent that link ! -- interface primitives with their covering primitive. These ! -- entities will be added to this type when frozen. ! if Present (Interface_Alias (Subp)) then ! goto Continue; ! end if; -- If the generic actual is present find the corresponding -- operation in the generic actual. If the parent type is a *************** package body Sem_Ch3 is *** 12810,12836 **** if Need_Search or else (Present (Generic_Actual) ! and then Present (Act_Subp) ! and then not Primitive_Names_Match (Subp, Act_Subp)) then pragma Assert (not Is_Ancestor (Parent_Base, Generic_Actual)); - pragma Assert (Is_Interface (Parent_Base)); ! -- Remember that we need searching for all the pending ! -- primitives Need_Search := True; -- Handle entities associated with interface primitives ! if Present (Alias (Subp)) ! and then Is_Interface (Find_Dispatching_Type (Alias (Subp))) and then not Is_Predefined_Dispatching_Operation (Subp) then Act_Subp := Find_Primitive_Covering_Interface (Tagged_Type => Generic_Actual, ! Iface_Prim => Subp); -- Handle predefined primitives plus the rest of user-defined -- primitives --- 13315,13402 ---- if Need_Search or else (Present (Generic_Actual) ! and then Present (Act_Subp) ! and then not ! (Primitive_Names_Match (Subp, Act_Subp) ! and then ! Type_Conformant (Subp, Act_Subp, ! Skip_Controlling_Formals => True))) then pragma Assert (not Is_Ancestor (Parent_Base, Generic_Actual)); ! -- Remember that we need searching for all pending primitives Need_Search := True; -- Handle entities associated with interface primitives ! if Present (Alias_Subp) ! and then Is_Interface (Find_Dispatching_Type (Alias_Subp)) and then not Is_Predefined_Dispatching_Operation (Subp) then + -- Search for the primitive in the homonym chain + Act_Subp := Find_Primitive_Covering_Interface (Tagged_Type => Generic_Actual, ! Iface_Prim => Alias_Subp); ! ! -- Previous search may not locate primitives covering ! -- interfaces defined in generics units or instantiations. ! -- (it fails if the covering primitive has formals whose ! -- type is also defined in generics or instantiations). ! -- In such case we search in the list of primitives of the ! -- generic actual for the internal entity that links the ! -- interface primitive and the covering primitive. ! ! if No (Act_Subp) ! and then Is_Generic_Type (Parent_Type) ! then ! -- This code has been designed to handle only generic ! -- formals that implement interfaces that are defined ! -- in a generic unit or instantiation. If this code is ! -- needed for other cases we must review it because ! -- (given that it relies on Original_Location to locate ! -- the primitive of Generic_Actual that covers the ! -- interface) it could leave linked through attribute ! -- Alias entities of unrelated instantiations). ! ! pragma Assert ! (Is_Generic_Unit ! (Scope (Find_Dispatching_Type (Alias_Subp))) ! or else ! Instantiation_Depth ! (Sloc (Find_Dispatching_Type (Alias_Subp))) > 0); ! ! declare ! Iface_Prim_Loc : constant Source_Ptr := ! Original_Location (Sloc (Alias_Subp)); ! Elmt : Elmt_Id; ! Prim : Entity_Id; ! begin ! Elmt := ! First_Elmt (Primitive_Operations (Generic_Actual)); ! ! Search : while Present (Elmt) loop ! Prim := Node (Elmt); ! ! if Present (Interface_Alias (Prim)) ! and then Original_Location ! (Sloc (Interface_Alias (Prim))) ! = Iface_Prim_Loc ! then ! Act_Subp := Alias (Prim); ! exit Search; ! end if; ! ! Next_Elmt (Elmt); ! end loop Search; ! end; ! end if; ! ! pragma Assert (Present (Act_Subp) ! or else Is_Abstract_Type (Generic_Actual) ! or else Serious_Errors_Detected > 0); -- Handle predefined primitives plus the rest of user-defined -- primitives *************** package body Sem_Ch3 is *** 12841,12852 **** Act_Subp := Node (Act_Elmt); exit when Primitive_Names_Match (Subp, Act_Subp) ! and then Type_Conformant (Subp, Act_Subp, ! Skip_Controlling_Formals => True) and then No (Interface_Alias (Act_Subp)); Next_Elmt (Act_Elmt); end loop; end if; end if; --- 13407,13423 ---- Act_Subp := Node (Act_Elmt); exit when Primitive_Names_Match (Subp, Act_Subp) ! and then Type_Conformant ! (Subp, Act_Subp, ! Skip_Controlling_Formals => True) and then No (Interface_Alias (Act_Subp)); Next_Elmt (Act_Elmt); end loop; + + if No (Act_Elmt) then + Act_Subp := Empty; + end if; end if; end if; *************** package body Sem_Ch3 is *** 12862,12887 **** then null; ! -- Case 2: Inherit entities associated with interfaces that ! -- were not covered by the parent type. We exclude here null ! -- interface primitives because they do not need special ! -- management. elsif Present (Alias (Subp)) and then Is_Interface (Find_Dispatching_Type (Alias_Subp)) and then not (Nkind (Parent (Alias_Subp)) = N_Procedure_Specification ! and then Null_Present (Parent (Alias_Subp))) then ! Derive_Subprogram ! (New_Subp => New_Subp, ! Parent_Subp => Alias_Subp, ! Derived_Type => Derived_Type, ! Parent_Type => Find_Dispatching_Type (Alias_Subp), ! Actual_Subp => Act_Subp); ! if No (Generic_Actual) then ! Set_Alias (New_Subp, Subp); end if; -- Case 3: Common derivation --- 13433,13524 ---- then null; ! -- Case 2: Inherit entities associated with interfaces that were ! -- not covered by the parent type. We exclude here null interface ! -- primitives because they do not need special management. ! ! -- We also exclude interface operations that are renamings. If the ! -- subprogram is an explicit renaming of an interface primitive, ! -- it is a regular primitive operation, and the presence of its ! -- alias is not relevant: it has to be derived like any other ! -- primitive. elsif Present (Alias (Subp)) + and then Nkind (Unit_Declaration_Node (Subp)) /= + N_Subprogram_Renaming_Declaration and then Is_Interface (Find_Dispatching_Type (Alias_Subp)) and then not (Nkind (Parent (Alias_Subp)) = N_Procedure_Specification ! and then Null_Present (Parent (Alias_Subp))) then ! -- If this is an abstract private type then we transfer the ! -- derivation of the interface primitive from the partial view ! -- to the full view. This is safe because all the interfaces ! -- must be visible in the partial view. Done to avoid adding ! -- a new interface derivation to the private part of the ! -- enclosing package; otherwise this new derivation would be ! -- decorated as hidden when the analysis of the enclosing ! -- package completes. ! if Is_Abstract_Type (Derived_Type) ! and then In_Private_Part (Current_Scope) ! and then Has_Private_Declaration (Derived_Type) ! then ! declare ! Partial_View : Entity_Id; ! Elmt : Elmt_Id; ! Ent : Entity_Id; ! ! begin ! Partial_View := First_Entity (Current_Scope); ! loop ! exit when No (Partial_View) ! or else (Has_Private_Declaration (Partial_View) ! and then ! Full_View (Partial_View) = Derived_Type); ! ! Next_Entity (Partial_View); ! end loop; ! ! -- If the partial view was not found then the source code ! -- has errors and the derivation is not needed. ! ! if Present (Partial_View) then ! Elmt := ! First_Elmt (Primitive_Operations (Partial_View)); ! while Present (Elmt) loop ! Ent := Node (Elmt); ! ! if Present (Alias (Ent)) ! and then Ultimate_Alias (Ent) = Alias (Subp) ! then ! Append_Elmt ! (Ent, Primitive_Operations (Derived_Type)); ! exit; ! end if; ! ! Next_Elmt (Elmt); ! end loop; ! ! -- If the interface primitive was not found in the ! -- partial view then this interface primitive was ! -- overridden. We add a derivation to activate in ! -- Derive_Progenitor_Subprograms the machinery to ! -- search for it. ! ! if No (Elmt) then ! Derive_Interface_Subprogram ! (New_Subp => New_Subp, ! Subp => Subp, ! Actual_Subp => Act_Subp); ! end if; ! end if; ! end; ! else ! Derive_Interface_Subprogram ! (New_Subp => New_Subp, ! Subp => Subp, ! Actual_Subp => Act_Subp); end if; -- Case 3: Common derivation *************** package body Sem_Ch3 is *** 12905,12910 **** --- 13542,13548 ---- Act_Subp := Node (Act_Elmt); end if; + <> Next_Elmt (Elmt); end loop; *************** package body Sem_Ch3 is *** 12921,12927 **** end if; -- Final check: Direct descendants must have their primitives in the ! -- same order. We exclude from this test non-tagged types and instances -- of formal derived types. We skip this test if we have already -- reported serious errors in the sources. --- 13559,13565 ---- end if; -- Final check: Direct descendants must have their primitives in the ! -- same order. We exclude from this test untagged types and instances -- of formal derived types. We skip this test if we have already -- reported serious errors in the sources. *************** package body Sem_Ch3 is *** 13203,13210 **** Set_Etype (T, Any_Type); Set_Scalar_Range (T, Scalar_Range (Any_Type)); ! if Is_Tagged_Type (T) then ! Set_Primitive_Operations (T, New_Elmt_List); end if; return; --- 13841,13850 ---- Set_Etype (T, Any_Type); Set_Scalar_Range (T, Scalar_Range (Any_Type)); ! if Is_Tagged_Type (T) ! and then Is_Record_Type (T) ! then ! Set_Direct_Primitive_Operations (T, New_Elmt_List); end if; return; *************** package body Sem_Ch3 is *** 13287,13294 **** New_Copy (Subtype_Indication (Parent (Partial_View)))); ! New_Iface := Make_Identifier (Sloc (N), ! Chars (Parent_Type)); Append (New_Iface, Interface_List (Def)); -- Analyze the transformed code --- 13927,13934 ---- New_Copy (Subtype_Indication (Parent (Partial_View)))); ! New_Iface := ! Make_Identifier (Sloc (N), Chars (Parent_Type)); Append (New_Iface, Interface_List (Def)); -- Analyze the transformed code *************** package body Sem_Ch3 is *** 13334,13342 **** -- Check for early use of incomplete or private type ! if Ekind (Parent_Type) = E_Void ! or else Ekind (Parent_Type) = E_Incomplete_Type ! then Error_Msg_N ("premature derivation of incomplete type", Indic); return; --- 13974,13980 ---- -- Check for early use of incomplete or private type ! if Ekind_In (Parent_Type, E_Void, E_Incomplete_Type) then Error_Msg_N ("premature derivation of incomplete type", Indic); return; *************** package body Sem_Ch3 is *** 13421,13428 **** if not Is_Generic_Actual_Type (Parent_Type) or else In_Visible_Part (Scope (Parent_Type)) then ! Error_Msg_N ! ("type derived from tagged type must have extension", Indic); end if; end if; --- 14059,14076 ---- if not Is_Generic_Actual_Type (Parent_Type) or else In_Visible_Part (Scope (Parent_Type)) then ! if Is_Class_Wide_Type (Parent_Type) then ! Error_Msg_N ! ("parent type must not be a class-wide type", Indic); ! ! -- Use specific type to prevent cascaded errors. ! ! Parent_Type := Etype (Parent_Type); ! ! else ! Error_Msg_N ! ("type derived from tagged type must have extension", Indic); ! end if; end if; end if; *************** package body Sem_Ch3 is *** 13430,13436 **** -- extension. There is no point in checking the ancestor type or -- the progenitors since the construct is wrong to begin with. ! if Ada_Version >= Ada_05 and then Is_Generic_Type (T) and then Present (Original_Node (N)) then --- 14078,14084 ---- -- extension. There is no point in checking the ancestor type or -- the progenitors since the construct is wrong to begin with. ! if Ada_Version >= Ada_2005 and then Is_Generic_Type (T) and then Present (Original_Node (N)) then *************** package body Sem_Ch3 is *** 13480,13487 **** (not Is_Interface (Parent_Type) or else not Is_Limited_Interface (Parent_Type)) then ! Error_Msg_NE ("parent type& of limited type must be limited", ! N, Parent_Type); end if; end if; end Derived_Type_Declaration; --- 14128,14150 ---- (not Is_Interface (Parent_Type) or else not Is_Limited_Interface (Parent_Type)) then ! -- AI05-0096: a derivation in the private part of an instance is ! -- legal if the generic formal is untagged limited, and the actual ! -- is non-limited. ! ! if Is_Generic_Actual_Type (Parent_Type) ! and then In_Private_Part (Current_Scope) ! and then ! not Is_Tagged_Type ! (Generic_Parent_Type (Parent (Parent_Type))) ! then ! null; ! ! else ! Error_Msg_NE ! ("parent type& of limited type must be limited", ! N, Parent_Type); ! end if; end if; end if; end Derived_Type_Declaration; *************** package body Sem_Ch3 is *** 13547,13554 **** --- 14210,14229 ---- Generate_Definition (L); Set_Convention (L, Convention_Intrinsic); + -- Case of character literal + if Nkind (L) = N_Defining_Character_Literal then Set_Is_Character_Type (T, True); + + -- Check violation of No_Wide_Characters + + if Restriction_Check_Required (No_Wide_Characters) then + Get_Name_String (Chars (L)); + + if Name_Len >= 3 and then Name_Buffer (1 .. 2) = "QW" then + Check_Restriction (No_Wide_Characters, L); + end if; + end if; end if; Ev := Ev + 1; *************** package body Sem_Ch3 is *** 13718,13728 **** procedure Tag_Mismatch is begin if Sloc (Prev) < Sloc (Id) then ! Error_Msg_NE ! ("full declaration of } must be a tagged type ", Id, Prev); else ! Error_Msg_NE ! ("full declaration of } must be a tagged type ", Prev, Id); end if; end Tag_Mismatch; --- 14393,14417 ---- procedure Tag_Mismatch is begin if Sloc (Prev) < Sloc (Id) then ! if Ada_Version >= Ada_2012 ! and then Nkind (N) = N_Private_Type_Declaration ! then ! Error_Msg_NE ! ("declaration of private } must be a tagged type ", Id, Prev); ! else ! Error_Msg_NE ! ("full declaration of } must be a tagged type ", Id, Prev); ! end if; else ! if Ada_Version >= Ada_2012 ! and then Nkind (N) = N_Private_Type_Declaration ! then ! Error_Msg_NE ! ("declaration of private } must be a tagged type ", Prev, Id); ! else ! Error_Msg_NE ! ("full declaration of } must be a tagged type ", Prev, Id); ! end if; end if; end Tag_Mismatch; *************** package body Sem_Ch3 is *** 13733,13753 **** Prev := Current_Entity_In_Scope (Id); ! if Present (Prev) then ! -- Previous declaration exists. Error if not incomplete/private case ! -- except if previous declaration is implicit, etc. Enter_Name will ! -- emit error if appropriate. Prev_Par := Parent (Prev); if not Is_Incomplete_Or_Private_Type (Prev) then Enter_Name (Id); New_Id := Id; elsif not Nkind_In (N, N_Full_Type_Declaration, N_Task_Type_Declaration, N_Protected_Type_Declaration) then -- Completion must be a full type declarations (RM 7.3(4)) --- 14422,14456 ---- Prev := Current_Entity_In_Scope (Id); ! -- New type declaration ! if No (Prev) then ! Enter_Name (Id); ! return Id; + -- Previous declaration exists + + else Prev_Par := Parent (Prev); + -- Error if not incomplete/private case except if previous + -- declaration is implicit, etc. Enter_Name will emit error if + -- appropriate. + if not Is_Incomplete_Or_Private_Type (Prev) then Enter_Name (Id); New_Id := Id; + -- Check invalid completion of private or incomplete type + elsif not Nkind_In (N, N_Full_Type_Declaration, N_Task_Type_Declaration, N_Protected_Type_Declaration) + and then + (Ada_Version < Ada_2012 + or else not Is_Incomplete_Type (Prev) + or else not Nkind_In (N, N_Private_Type_Declaration, + N_Private_Extension_Declaration)) then -- Completion must be a full type declarations (RM 7.3(4)) *************** package body Sem_Ch3 is *** 13769,13775 **** -- Case of full declaration of incomplete type ! elsif Ekind (Prev) = E_Incomplete_Type then -- Indicate that the incomplete declaration has a matching full -- declaration. The defining occurrence of the incomplete --- 14472,14482 ---- -- Case of full declaration of incomplete type ! elsif Ekind (Prev) = E_Incomplete_Type ! and then (Ada_Version < Ada_2012 ! or else No (Full_View (Prev)) ! or else not Is_Private_Type (Full_View (Prev))) ! then -- Indicate that the incomplete declaration has a matching full -- declaration. The defining occurrence of the incomplete *************** package body Sem_Ch3 is *** 13786,13794 **** --- 14493,14526 ---- Set_Is_Internal (Id); New_Id := Prev; + -- If the incomplete view is tagged, a class_wide type has been + -- created already. Use it for the private type as well, in order + -- to prevent multiple incompatible class-wide types that may be + -- created for self-referential anonymous access components. + + if Is_Tagged_Type (Prev) + and then Present (Class_Wide_Type (Prev)) + then + Set_Ekind (Id, Ekind (Prev)); -- will be reset later + Set_Class_Wide_Type (Id, Class_Wide_Type (Prev)); + Set_Etype (Class_Wide_Type (Id), Id); + end if; + -- Case of full declaration of private type else + -- If the private type was a completion of an incomplete type then + -- update Prev to reference the private type + + if Ada_Version >= Ada_2012 + and then Ekind (Prev) = E_Incomplete_Type + and then Present (Full_View (Prev)) + and then Is_Private_Type (Full_View (Prev)) + then + Prev := Full_View (Prev); + Prev_Par := Parent (Prev); + end if; + if Nkind (Parent (Prev)) /= N_Private_Extension_Declaration then if Etype (Prev) /= Prev then *************** package body Sem_Ch3 is *** 13906,13919 **** if Is_Type (Prev) and then (Is_Tagged_Type (Prev) ! or else Present (Class_Wide_Type (Prev))) then -- The full declaration is either a tagged type (including -- a synchronized type that implements interfaces) or a -- type extension, otherwise this is an error. ! if Nkind_In (N, N_Task_Type_Declaration, ! N_Protected_Type_Declaration) then if No (Interface_List (N)) and then not Error_Posted (N) --- 14638,14667 ---- if Is_Type (Prev) and then (Is_Tagged_Type (Prev) ! or else Present (Class_Wide_Type (Prev))) then + -- Ada 2012 (AI05-0162): A private type may be the completion of + -- an incomplete type + + if Ada_Version >= Ada_2012 + and then Is_Incomplete_Type (Prev) + and then Nkind_In (N, N_Private_Type_Declaration, + N_Private_Extension_Declaration) + then + -- No need to check private extensions since they are tagged + + if Nkind (N) = N_Private_Type_Declaration + and then not Tagged_Present (N) + then + Tag_Mismatch; + end if; + -- The full declaration is either a tagged type (including -- a synchronized type that implements interfaces) or a -- type extension, otherwise this is an error. ! elsif Nkind_In (N, N_Task_Type_Declaration, ! N_Protected_Type_Declaration) then if No (Interface_List (N)) and then not Error_Posted (N) *************** package body Sem_Ch3 is *** 13929,13947 **** if not Tagged_Present (Type_Definition (N)) then Tag_Mismatch; Set_Is_Tagged_Type (Id); - Set_Primitive_Operations (Id, New_Elmt_List); end if; elsif Nkind (Type_Definition (N)) = N_Derived_Type_Definition then if No (Record_Extension_Part (Type_Definition (N))) then ! Error_Msg_NE ( ! "full declaration of } must be a record extension", ! Prev, Id); -- Set some attributes to produce a usable full view Set_Is_Tagged_Type (Id); - Set_Primitive_Operations (Id, New_Elmt_List); end if; else --- 14677,14693 ---- if not Tagged_Present (Type_Definition (N)) then Tag_Mismatch; Set_Is_Tagged_Type (Id); end if; elsif Nkind (Type_Definition (N)) = N_Derived_Type_Definition then if No (Record_Extension_Part (Type_Definition (N))) then ! Error_Msg_NE ! ("full declaration of } must be a record extension", ! Prev, Id); -- Set some attributes to produce a usable full view Set_Is_Tagged_Type (Id); end if; else *************** package body Sem_Ch3 is *** 13950,13961 **** end if; return New_Id; - - else - -- New type declaration - - Enter_Name (Id); - return Id; end if; end Find_Type_Name; --- 14696,14701 ---- *************** package body Sem_Ch3 is *** 14027,14033 **** then null; else ! Insert_Actions (Obj_Def, Freeze_Entity (T, Sloc (P))); end if; -- Ada 2005 AI-406: the object definition in an object declaration --- 14767,14773 ---- then null; else ! Insert_Actions (Obj_Def, Freeze_Entity (T, P)); end if; -- Ada 2005 AI-406: the object definition in an object declaration *************** package body Sem_Ch3 is *** 14081,14093 **** -- Check No_Wide_Characters restriction ! if Typ = Standard_Wide_Character ! or else Typ = Standard_Wide_Wide_Character ! or else Typ = Standard_Wide_String ! or else Typ = Standard_Wide_Wide_String ! then ! Check_Restriction (No_Wide_Characters, S); ! end if; return Typ; end Find_Type_Of_Subtype_Indic; --- 14821,14827 ---- -- Check No_Wide_Characters restriction ! Check_Wide_Character_Restriction (Typ, S); return Typ; end Find_Type_Of_Subtype_Indic; *************** package body Sem_Ch3 is *** 14221,14227 **** Set_RM_Size (Implicit_Base, RM_Size (Base_Typ)); Set_First_Rep_Item (Implicit_Base, First_Rep_Item (Base_Typ)); Set_Digits_Value (Implicit_Base, Digits_Value (Base_Typ)); ! Set_Vax_Float (Implicit_Base, Vax_Float (Base_Typ)); Set_Ekind (T, E_Floating_Point_Subtype); Set_Etype (T, Implicit_Base); --- 14955,14961 ---- Set_RM_Size (Implicit_Base, RM_Size (Base_Typ)); Set_First_Rep_Item (Implicit_Base, First_Rep_Item (Base_Typ)); Set_Digits_Value (Implicit_Base, Digits_Value (Base_Typ)); ! Set_Float_Rep (Implicit_Base, Float_Rep (Base_Typ)); Set_Ekind (T, E_Floating_Point_Subtype); Set_Etype (T, Implicit_Base); *************** package body Sem_Ch3 is *** 14757,14764 **** then null; ! elsif Ekind (Derived_Base) = E_Private_Type ! or else Ekind (Derived_Base) = E_Limited_Private_Type then null; --- 15491,15498 ---- then null; ! elsif Ekind_In (Derived_Base, E_Private_Type, ! E_Limited_Private_Type) then null; *************** package body Sem_Ch3 is *** 14833,14851 **** end if; end Is_Null_Extension; - -------------------- - -- Is_Progenitor -- - -------------------- - - function Is_Progenitor - (Iface : Entity_Id; - Typ : Entity_Id) return Boolean - is - begin - return Implements_Interface (Typ, Iface, - Exclude_Parents => True); - end Is_Progenitor; - ------------------------------ -- Is_Valid_Constraint_Kind -- ------------------------------ --- 15567,15572 ---- *************** package body Sem_Ch3 is *** 14926,14934 **** -- Start of processing for Is_Visible_Component begin ! if Ekind (C) = E_Component ! or else Ekind (C) = E_Discriminant ! then Original_Comp := Original_Record_Component (C); end if; --- 15647,15653 ---- -- Start of processing for Is_Visible_Component begin ! if Ekind_In (C, E_Component, E_Discriminant) then Original_Comp := Original_Record_Component (C); end if; *************** package body Sem_Ch3 is *** 15081,15092 **** -- Customize the class-wide type: It has no prim. op., it cannot be -- abstract and its Etype points back to the specific root type. ! Set_Ekind (CW_Type, E_Class_Wide_Type); ! Set_Is_Tagged_Type (CW_Type, True); ! Set_Primitive_Operations (CW_Type, New_Elmt_List); ! Set_Is_Abstract_Type (CW_Type, False); ! Set_Is_Constrained (CW_Type, False); ! Set_Is_First_Subtype (CW_Type, Is_First_Subtype (T)); if Ekind (T) = E_Class_Wide_Subtype then Set_Etype (CW_Type, Etype (Base_Type (T))); --- 15800,15811 ---- -- Customize the class-wide type: It has no prim. op., it cannot be -- abstract and its Etype points back to the specific root type. ! Set_Ekind (CW_Type, E_Class_Wide_Type); ! Set_Is_Tagged_Type (CW_Type, True); ! Set_Direct_Primitive_Operations (CW_Type, New_Elmt_List); ! Set_Is_Abstract_Type (CW_Type, False); ! Set_Is_Constrained (CW_Type, False); ! Set_Is_First_Subtype (CW_Type, Is_First_Subtype (T)); if Ekind (T) = E_Class_Wide_Subtype then Set_Etype (CW_Type, Etype (Base_Type (T))); *************** package body Sem_Ch3 is *** 15458,15467 **** Set_Scalar_Range (T, Make_Range (Sloc (Mod_Expr), ! Low_Bound => ! Make_Integer_Literal (Sloc (Mod_Expr), 0), ! High_Bound => ! Make_Integer_Literal (Sloc (Mod_Expr), M_Val - 1))); -- Properly analyze the literals for the range. We do this manually -- because we can't go calling Resolve, since we are resolving these --- 16177,16184 ---- Set_Scalar_Range (T, Make_Range (Sloc (Mod_Expr), ! Low_Bound => Make_Integer_Literal (Sloc (Mod_Expr), 0), ! High_Bound => Make_Integer_Literal (Sloc (Mod_Expr), M_Val - 1))); -- Properly analyze the literals for the range. We do this manually -- because we can't go calling Resolve, since we are resolving these *************** package body Sem_Ch3 is *** 15574,15580 **** is begin return Is_CPP_Constructor_Call (Exp) ! or else (Ada_Version >= Ada_05 and then not Debug_Flag_Dot_L and then OK_For_Limited_Init_In_05 (Typ, Exp)); end OK_For_Limited_Init; --- 16291,16297 ---- is begin return Is_CPP_Constructor_Call (Exp) ! or else (Ada_Version >= Ada_2005 and then not Debug_Flag_Dot_L and then OK_For_Limited_Init_In_05 (Typ, Exp)); end OK_For_Limited_Init; *************** package body Sem_Ch3 is *** 15600,15607 **** -- 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 -- notation, in which case the original node is an indexed component. case Nkind (Original_Node (Exp)) is when N_Aggregate | N_Extension_Aggregate | N_Function_Call | N_Op => --- 16317,16326 ---- -- 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 given in prefixed -- notation, in which case the original node is an indexed component. + -- If the function is parameterless, the original node was an explicit + -- dereference. case Nkind (Original_Node (Exp)) is when N_Aggregate | N_Extension_Aggregate | N_Function_Call | N_Op => *************** package body Sem_Ch3 is *** 15620,15632 **** -- A return statement for a build-in-place function returning a -- synchronized type also introduces an unchecked conversion. ! when N_Type_Conversion | N_Unchecked_Type_Conversion => return not Comes_From_Source (Exp) and then OK_For_Limited_Init_In_05 (Typ, Expression (Original_Node (Exp))); ! when N_Indexed_Component | N_Selected_Component => return Nkind (Exp) = N_Function_Call; -- A use of 'Input is a function call, hence allowed. Normally the --- 16339,16354 ---- -- A return statement for a build-in-place function returning a -- synchronized type also introduces an unchecked conversion. ! when N_Type_Conversion | ! N_Unchecked_Type_Conversion => return not Comes_From_Source (Exp) and then OK_For_Limited_Init_In_05 (Typ, Expression (Original_Node (Exp))); ! when N_Indexed_Component | ! N_Selected_Component | ! N_Explicit_Dereference => return Nkind (Exp) = N_Function_Call; -- A use of 'Input is a function call, hence allowed. Normally the *************** package body Sem_Ch3 is *** 15875,15881 **** -- Ada 2005 (AI-230): Access discriminant allowed in non-limited -- record types ! if Ada_Version < Ada_05 then Check_Access_Discriminant_Requires_Limited (Discr, Discriminant_Type (Discr)); end if; --- 16597,16603 ---- -- Ada 2005 (AI-230): Access discriminant allowed in non-limited -- record types ! if Ada_Version < Ada_2005 then Check_Access_Discriminant_Requires_Limited (Discr, Discriminant_Type (Discr)); end if; *************** package body Sem_Ch3 is *** 15908,15923 **** ("discriminant defaults not allowed for formal type", Expression (Discr)); ! -- Tagged types cannot have defaulted discriminants, but a ! -- non-tagged private type with defaulted discriminants ! -- can have a tagged completion. elsif Is_Tagged_Type (Current_Scope) and then Comes_From_Source (N) then ! Error_Msg_N ! ("discriminants of tagged type cannot have defaults", ! Expression (Discr)); else Default_Present := True; --- 16630,16662 ---- ("discriminant defaults not allowed for formal type", Expression (Discr)); ! -- Flag an error for a tagged type with defaulted discriminants, ! -- excluding limited tagged types when compiling for Ada 2012 ! -- (see AI05-0214). elsif Is_Tagged_Type (Current_Scope) + and then (not Is_Limited_Type (Current_Scope) + or else Ada_Version < Ada_2012) and then Comes_From_Source (N) then ! -- Note: see similar test in Check_Or_Process_Discriminants, to ! -- handle the (illegal) case of the completion of an untagged ! -- view with discriminants with defaults by a tagged full view. ! -- We skip the check if Discr does not come from source, to ! -- account for the case of an untagged derived type providing ! -- defaults for a renamed discriminant from a private untagged ! -- ancestor with a tagged full view (ACATS B460006). ! ! if Ada_Version >= Ada_2012 then ! Error_Msg_N ! ("discriminants of nonlimited tagged type cannot have" ! & " defaults", ! Expression (Discr)); ! else ! Error_Msg_N ! ("discriminants of tagged type cannot have defaults", ! Expression (Discr)); ! end if; else Default_Present := True; *************** package body Sem_Ch3 is *** 15937,15943 **** -- Ada 2005 (AI-231): Create an Itype that is a duplicate of -- Discr_Type but with the null-exclusion attribute ! if Ada_Version >= Ada_05 then -- Ada 2005 (AI-231): Static checks --- 16676,16682 ---- -- Ada 2005 (AI-231): Create an Itype that is a duplicate of -- Discr_Type but with the null-exclusion attribute ! if Ada_Version >= Ada_2005 then -- Ada 2005 (AI-231): Static checks *************** package body Sem_Ch3 is *** 16130,16136 **** if Ekind (Typ) = E_Record_Type_With_Private then ! -- Handle the following erronous case: -- type Private_Type is tagged private; -- private -- type Private_Type is new Type_Implementing_Iface; --- 16869,16875 ---- if Ekind (Typ) = E_Record_Type_With_Private then ! -- Handle the following erroneous case: -- type Private_Type is tagged private; -- private -- type Private_Type is new Type_Implementing_Iface; *************** package body Sem_Ch3 is *** 16225,16231 **** -- consistent. We omit this check for synchronized types because -- they are performed on the corresponding record type when frozen. ! if Ada_Version >= Ada_05 and then Is_Tagged_Type (Priv_T) and then Is_Tagged_Type (Full_T) and then not Is_Concurrent_Type (Full_T) --- 16964,16970 ---- -- consistent. We omit this check for synchronized types because -- they are performed on the corresponding record type when frozen. ! if Ada_Version >= Ada_2005 and then Is_Tagged_Type (Priv_T) and then Is_Tagged_Type (Full_T) and then not Is_Concurrent_Type (Full_T) *************** package body Sem_Ch3 is *** 16246,16260 **** Iface := Find_Hidden_Interface (Priv_T_Ifaces, Full_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ("interface & not implemented by full type " & ! "(RM-2005 7.3 (7.3/2))", Priv_T, Iface); end if; Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ("interface & not implemented by partial view " & ! "(RM-2005 7.3 (7.3/2))", Full_T, Iface); end if; end; end if; --- 16985,17001 ---- Iface := Find_Hidden_Interface (Priv_T_Ifaces, Full_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ! ("interface & not implemented by full type " & ! "(RM-2005 7.3 (7.3/2))", Priv_T, Iface); end if; Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ! ("interface & not implemented by partial view " & ! "(RM-2005 7.3 (7.3/2))", Full_T, Iface); end if; end; end if; *************** package body Sem_Ch3 is *** 16423,16429 **** -- Ada 2005 (AI-443): A synchronized private extension must be -- completed by a task or protected type. ! if Ada_Version >= Ada_05 and then Nkind (Parent (Priv_T)) = N_Private_Extension_Declaration and then Synchronized_Present (Parent (Priv_T)) and then not Is_Concurrent_Type (Full_T) --- 17164,17170 ---- -- Ada 2005 (AI-443): A synchronized private extension must be -- completed by a task or protected type. ! if Ada_Version >= Ada_2005 and then Nkind (Parent (Priv_T)) = N_Private_Extension_Declaration and then Synchronized_Present (Parent (Priv_T)) and then not Is_Concurrent_Type (Full_T) *************** package body Sem_Ch3 is *** 16463,16471 **** while Present (Priv_Elmt) loop Priv := Node (Priv_Elmt); ! if Ekind (Priv) = E_Private_Subtype ! or else Ekind (Priv) = E_Limited_Private_Subtype ! or else Ekind (Priv) = E_Record_Subtype_With_Private then Full := Make_Defining_Identifier (Sloc (Priv), Chars (Priv)); Set_Is_Itype (Full); --- 17204,17212 ---- while Present (Priv_Elmt) loop Priv := Node (Priv_Elmt); ! if Ekind_In (Priv, E_Private_Subtype, ! E_Limited_Private_Subtype, ! E_Record_Subtype_With_Private) then Full := Make_Defining_Identifier (Sloc (Priv), Chars (Priv)); Set_Is_Itype (Full); *************** package body Sem_Ch3 is *** 16613,16622 **** Prim := Next_Entity (Full_T); while Present (Prim) and then Prim /= Priv_T loop ! if Ekind (Prim) = E_Procedure ! or else ! Ekind (Prim) = E_Function ! then Disp_Typ := Find_Dispatching_Type (Prim); if Disp_Typ = Full_T --- 17354,17360 ---- Prim := Next_Entity (Full_T); while Present (Prim) and then Prim /= Priv_T loop ! if Ekind_In (Prim, E_Procedure, E_Function) then Disp_Typ := Find_Dispatching_Type (Prim); if Disp_Typ = Full_T *************** package body Sem_Ch3 is *** 16646,16658 **** end loop; end if; ! -- For the tagged case, the two views can share the same ! -- Primitive Operation list and the same class wide type. ! -- Update attributes of the class-wide type which depend on ! -- the full declaration. if Is_Tagged_Type (Priv_T) then ! Set_Primitive_Operations (Priv_T, Full_List); Set_Class_Wide_Type (Base_Type (Full_T), Class_Wide_Type (Priv_T)); --- 17384,17395 ---- end loop; end if; ! -- For the tagged case, the two views can share the same primitive ! -- operations list and the same class-wide type. Update attributes ! -- of the class-wide type which depend on the full declaration. if Is_Tagged_Type (Priv_T) then ! Set_Direct_Primitive_Operations (Priv_T, Full_List); Set_Class_Wide_Type (Base_Type (Full_T), Class_Wide_Type (Priv_T)); *************** package body Sem_Ch3 is *** 16670,16677 **** -- but it means we don't have to struggle to meet the requirements in -- the RM for having Preelaborable Initialization. Otherwise we -- require that the type meets the RM rules. But we can't check that ! -- yet, because of the rule about overriding Ininitialize, so we ! -- simply set a flag that will be checked at freeze time. if not In_Predefined_Unit (Full_T) then Set_Must_Have_Preelab_Init (Full_T); --- 17407,17414 ---- -- but it means we don't have to struggle to meet the requirements in -- the RM for having Preelaborable Initialization. Otherwise we -- require that the type meets the RM rules. But we can't check that ! -- yet, because of the rule about overriding Initialize, so we simply ! -- set a flag that will be checked at freeze time. if not In_Predefined_Unit (Full_T) then Set_Must_Have_Preelab_Init (Full_T); *************** package body Sem_Ch3 is *** 16689,16706 **** --- 17426,17466 ---- -- If the private view has user specified stream attributes, then so has -- the full view. + -- Why the test, how could these flags be already set in Full_T ??? + if Has_Specified_Stream_Read (Priv_T) then Set_Has_Specified_Stream_Read (Full_T); end if; + if Has_Specified_Stream_Write (Priv_T) then Set_Has_Specified_Stream_Write (Full_T); end if; + if Has_Specified_Stream_Input (Priv_T) then Set_Has_Specified_Stream_Input (Full_T); end if; + if Has_Specified_Stream_Output (Priv_T) then Set_Has_Specified_Stream_Output (Full_T); end if; + + -- Propagate invariants to full type + + if Has_Invariants (Priv_T) then + Set_Has_Invariants (Full_T); + Set_Invariant_Procedure (Full_T, Invariant_Procedure (Priv_T)); + end if; + + if Has_Inheritable_Invariants (Priv_T) then + Set_Has_Inheritable_Invariants (Full_T); + end if; + + -- Propagate predicates to full type + + if Has_Predicates (Priv_T) then + Set_Predicate_Function (Priv_T, Predicate_Function (Full_T)); + Set_Has_Predicates (Priv_T); + end if; end Process_Full_View; ----------------------------------- *************** package body Sem_Ch3 is *** 16829,16838 **** Check_List : List_Id := Empty_List; R_Check_Off : Boolean := False) is ! Lo, Hi : Node_Id; ! R_Checks : Check_Result; ! Type_Decl : Node_Id; ! Def_Id : Entity_Id; begin Analyze_And_Resolve (R, Base_Type (T)); --- 17589,17598 ---- Check_List : List_Id := Empty_List; R_Check_Off : Boolean := False) is ! Lo, Hi : Node_Id; ! R_Checks : Check_Result; ! Insert_Node : Node_Id; ! Def_Id : Entity_Id; begin Analyze_And_Resolve (R, Base_Type (T)); *************** package body Sem_Ch3 is *** 16940,16971 **** if not R_Check_Off then R_Checks := Get_Range_Checks (R, T); ! -- Look up tree to find an appropriate insertion point. ! -- This seems really junk code, and very brittle, couldn't ! -- we just use an insert actions call of some kind ??? ! Type_Decl := Parent (R); ! while Present (Type_Decl) and then not ! (Nkind_In (Type_Decl, N_Full_Type_Declaration, ! N_Subtype_Declaration, ! N_Loop_Statement, ! N_Task_Type_Declaration) ! or else ! Nkind_In (Type_Decl, N_Single_Task_Declaration, ! N_Protected_Type_Declaration, ! N_Single_Protected_Declaration)) ! loop ! Type_Decl := Parent (Type_Decl); end loop; -- Why would Type_Decl not be present??? Without this test, -- short regression tests fail. ! if Present (Type_Decl) then ! -- Case of loop statement (more comments ???) ! if Nkind (Type_Decl) = N_Loop_Statement then declare Indic : Node_Id; --- 17700,17742 ---- if not R_Check_Off then R_Checks := Get_Range_Checks (R, T); ! -- Look up tree to find an appropriate insertion point. We ! -- can't just use insert_actions because later processing ! -- depends on the insertion node. Prior to Ada2012 the ! -- insertion point could only be a declaration or a loop, but ! -- quantified expressions can appear within any context in an ! -- expression, and the insertion point can be any statement, ! -- pragma, or declaration. ! Insert_Node := Parent (R); ! while Present (Insert_Node) loop ! exit when ! Nkind (Insert_Node) in N_Declaration ! and then ! not Nkind_In ! (Insert_Node, N_Component_Declaration, ! N_Loop_Parameter_Specification, ! N_Function_Specification, ! N_Procedure_Specification); ! ! exit when Nkind (Insert_Node) in N_Later_Decl_Item ! or else Nkind (Insert_Node) in ! N_Statement_Other_Than_Procedure_Call ! or else Nkind_In (Insert_Node, N_Procedure_Call_Statement, ! N_Pragma); ! ! Insert_Node := Parent (Insert_Node); end loop; -- Why would Type_Decl not be present??? Without this test, -- short regression tests fail. ! if Present (Insert_Node) then ! -- Case of loop statement. Verify that the range is part ! -- of the subtype indication of the iteration scheme. ! if Nkind (Insert_Node) = N_Loop_Statement then declare Indic : Node_Id; *************** package body Sem_Ch3 is *** 16982,16999 **** Insert_Range_Checks (R_Checks, ! Type_Decl, Def_Id, ! Sloc (Type_Decl), R, Do_Before => True); end if; end; ! -- All other cases (more comments ???) ! else ! Def_Id := Defining_Identifier (Type_Decl); if (Ekind (Def_Id) = E_Record_Type and then Depends_On_Discriminant (R)) --- 17753,17772 ---- Insert_Range_Checks (R_Checks, ! Insert_Node, Def_Id, ! Sloc (Insert_Node), R, Do_Before => True); end if; end; ! -- Insertion before a declaration. If the declaration ! -- includes discriminants, the list of applicable checks ! -- is given by the caller. ! elsif Nkind (Insert_Node) in N_Declaration then ! Def_Id := Defining_Identifier (Insert_Node); if (Ekind (Def_Id) = E_Record_Type and then Depends_On_Discriminant (R)) *************** package body Sem_Ch3 is *** 17002,17019 **** and then Has_Discriminants (Def_Id)) then Append_Range_Checks ! (R_Checks, Check_List, Def_Id, Sloc (Type_Decl), R); else Insert_Range_Checks ! (R_Checks, Type_Decl, Def_Id, Sloc (Type_Decl), R); end if; end if; end if; end if; end if; elsif Expander_Active then Get_Index_Bounds (R, Lo, Hi); Force_Evaluation (Lo); --- 17775,17803 ---- and then Has_Discriminants (Def_Id)) then Append_Range_Checks ! (R_Checks, ! Check_List, Def_Id, Sloc (Insert_Node), R); else Insert_Range_Checks ! (R_Checks, ! Insert_Node, Def_Id, Sloc (Insert_Node), R); end if; + + -- Insertion before a statement. Range appears in the + -- context of a quantified expression. Insertion will + -- take place when expression is expanded. + + else + null; end if; end if; end if; end if; + -- Case of other than an explicit N_Range node + elsif Expander_Active then Get_Index_Bounds (R, Lo, Hi); Force_Evaluation (Lo); *************** package body Sem_Ch3 is *** 17097,17103 **** if Ekind (Root_Type (Entity (T))) = E_Incomplete_Type and then ! not (Ada_Version >= Ada_05 and then (Nkind (Parent (T)) = N_Subtype_Declaration or else --- 17881,17887 ---- if Ekind (Root_Type (Entity (T))) = E_Incomplete_Type and then ! not (Ada_Version >= Ada_2005 and then (Nkind (Parent (T)) = N_Subtype_Declaration or else *************** package body Sem_Ch3 is *** 17121,17127 **** -- Ada 2005 (AI-231): Static check ! if Ada_Version >= Ada_05 and then Present (P) and then Null_Exclusion_Present (P) and then Nkind (P) /= N_Access_To_Object_Definition --- 17905,17911 ---- -- Ada 2005 (AI-231): Static check ! if Ada_Version >= Ada_2005 and then Present (P) and then Null_Exclusion_Present (P) and then Nkind (P) /= N_Access_To_Object_Definition *************** package body Sem_Ch3 is *** 17149,17155 **** N_Subtype_Declaration); -- Create an Itype that is a duplicate of Entity (S) but with the ! -- null-exclusion attribute if May_Have_Null_Exclusion and then Is_Access_Type (Entity (S)) --- 17933,17939 ---- N_Subtype_Declaration); -- Create an Itype that is a duplicate of Entity (S) but with the ! -- null-exclusion attribute. if May_Have_Null_Exclusion and then Is_Access_Type (Entity (S)) *************** package body Sem_Ch3 is *** 17480,17498 **** and then Ekind (Current_Entity (Typ)) = E_Incomplete_Type and then Full_View (Current_Entity (Typ)) = Typ then return; else 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 ! -- that subsequent anonymous access types can use it. ! -- The entity is unchained from the homonym list and from ! -- immediate visibility. After analysis, the entity in the ! -- incomplete declaration becomes immediately visible in the ! -- record declaration that follows. H := Current_Entity (Typ); --- 18264,18290 ---- and then Ekind (Current_Entity (Typ)) = E_Incomplete_Type and then Full_View (Current_Entity (Typ)) = Typ then + if Is_Tagged + and then Comes_From_Source (Current_Entity (Typ)) + and then not Is_Tagged_Type (Current_Entity (Typ)) + then + Make_Class_Wide_Type (Typ); + Error_Msg_N + ("incomplete view of tagged type should be declared tagged?", + Parent (Current_Entity (Typ))); + end if; return; else 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 that subsequent ! -- anonymous access types can use it. The entity is unchained from ! -- the homonym list and from immediate visibility. After analysis, ! -- the entity in the incomplete declaration becomes immediately ! -- visible in the record declaration that follows. H := Current_Entity (Typ); *************** package body Sem_Ch3 is *** 17513,17520 **** Set_Full_View (Inc_T, Typ); if Is_Tagged then ! -- Create a common class-wide type for both views, and set ! -- the Etype of the class-wide type to the full view. Make_Class_Wide_Type (Inc_T); Set_Class_Wide_Type (Typ, Class_Wide_Type (Inc_T)); --- 18305,18313 ---- Set_Full_View (Inc_T, Typ); if Is_Tagged then ! ! -- Create a common class-wide type for both views, and set the ! -- Etype of the class-wide type to the full view. Make_Class_Wide_Type (Inc_T); Set_Class_Wide_Type (Typ, Class_Wide_Type (Inc_T)); *************** package body Sem_Ch3 is *** 17676,17684 **** (Access_Definition (Comp_Def)); Build_Incomplete_Type_Declaration; ! Anon_Access := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); -- Create a declaration for the anonymous access type: either -- an access_to_object or an access_to_subprogram. --- 18469,18475 ---- (Access_Definition (Comp_Def)); Build_Incomplete_Type_Declaration; ! Anon_Access := Make_Temporary (Loc, 'S'); -- Create a declaration for the anonymous access type: either -- an access_to_object or an access_to_subprogram. *************** package body Sem_Ch3 is *** 17814,17820 **** -- Normal case ! if Ada_Version < Ada_05 or else not Interface_Present (Def) then -- The flag Is_Tagged_Type might have already been set by --- 18605,18611 ---- -- Normal case ! if Ada_Version < Ada_2005 or else not Interface_Present (Def) then -- The flag Is_Tagged_Type might have already been set by *************** package body Sem_Ch3 is *** 17853,17859 **** Check_Anonymous_Access_Components (N, T, Prev, Component_List (Def)); ! if Ada_Version >= Ada_05 and then Present (Interface_List (Def)) then Check_Interfaces (N, Def); --- 18644,18650 ---- Check_Anonymous_Access_Components (N, T, Prev, Component_List (Def)); ! if Ada_Version >= Ada_2005 and then Present (Interface_List (Def)) then Check_Interfaces (N, Def); *************** package body Sem_Ch3 is *** 17923,17936 **** end if; Make_Class_Wide_Type (T); ! Set_Primitive_Operations (T, New_Elmt_List); end if; ! -- We must suppress range checks when processing the components ! -- of a record in the presence of discriminants, since we don't ! -- want spurious checks to be generated during their analysis, but ! -- must reset the Suppress_Range_Checks flags after having processed ! -- the record definition. -- Note: this is the only use of Kill_Range_Checks, and is a bit odd, -- couldn't we just use the normal range check suppression method here. --- 18714,18726 ---- end if; Make_Class_Wide_Type (T); ! Set_Direct_Primitive_Operations (T, New_Elmt_List); end if; ! -- We must suppress range checks when processing record components in ! -- the presence of discriminants, since we don't want spurious checks to ! -- be generated during their analysis, but Suppress_Range_Checks flags ! -- must be reset the after processing the record definition. -- Note: this is the only use of Kill_Range_Checks, and is a bit odd, -- couldn't we just use the normal range check suppression method here. *************** package body Sem_Ch3 is *** 18181,18186 **** --- 18971,18982 ---- Kind : constant Entity_Kind := Ekind (Def_Id); begin + -- Defend against previous error + + if Nkind (R) = N_Error then + return; + end if; + Set_Scalar_Range (Def_Id, R); -- We need to link the range into the tree before resolving it so diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch3.ads gcc-4.6.0/gcc/ada/sem_ch3.ads *** gcc-4.5.2/gcc/ada/sem_ch3.ads Thu Jul 30 09:23:06 2009 --- gcc-4.6.0/gcc/ada/sem_ch3.ads Thu Oct 21 10:19:58 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Types; use Types; *** 28,33 **** --- 28,34 ---- package Sem_Ch3 is procedure Analyze_Component_Declaration (N : Node_Id); + procedure Analyze_Full_Type_Declaration (N : Node_Id); procedure Analyze_Incomplete_Type_Decl (N : Node_Id); procedure Analyze_Itype_Reference (N : Node_Id); procedure Analyze_Number_Declaration (N : Node_Id); *************** package Sem_Ch3 is *** 35,41 **** procedure Analyze_Others_Choice (N : Node_Id); procedure Analyze_Private_Extension_Declaration (N : Node_Id); procedure Analyze_Subtype_Indication (N : Node_Id); - procedure Analyze_Type_Declaration (N : Node_Id); procedure Analyze_Variant_Part (N : Node_Id); procedure Analyze_Subtype_Declaration --- 36,41 ---- *************** package Sem_Ch3 is *** 84,96 **** procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id); -- Process an access type declaration ! procedure Build_Itype_Reference ! (Ityp : Entity_Id; ! Nod : Node_Id); -- Create a reference to an internal type, for use by Gigi. The back-end ! -- elaborates itypes on demand, i.e. when their first use is seen. This ! -- can lead to scope anomalies if the first use is within a scope that is ! -- nested within the scope that contains the point of definition of the -- 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. --- 84,94 ---- procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id); -- Process an access type declaration ! procedure Build_Itype_Reference (Ityp : Entity_Id; Nod : Node_Id); -- Create a reference to an internal type, for use by Gigi. The back-end ! -- elaborates itypes on demand, i.e. when their first use is seen. This can ! -- lead to scope anomalies if the first use is within a scope that is ! -- nested within the scope that contains the point of definition of the -- 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. *************** package Sem_Ch3 is *** 159,165 **** function Find_Type_Name (N : Node_Id) return Entity_Id; -- Enter the identifier in a type definition, or find the entity already -- declared, in the case of the full declaration of an incomplete or ! -- private type. function Get_Discriminant_Value (Discriminant : Entity_Id; --- 157,166 ---- function Find_Type_Name (N : Node_Id) return Entity_Id; -- Enter the identifier in a type definition, or find the entity already -- declared, in the case of the full declaration of an incomplete or ! -- private type. If the previous declaration is tagged then the class-wide ! -- entity is propagated to the identifier to prevent multiple incompatible ! -- class-wide types that may be created for self-referential anonymous ! -- access components. function Get_Discriminant_Value (Discriminant : Entity_Id; *************** package Sem_Ch3 is *** 229,234 **** --- 230,237 ---- -- 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. + -- This mechanism is also used for aspect specifications that have an + -- expression parameter that needs similar preanalysis. 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 *************** package Sem_Ch3 is *** 274,279 **** --- 277,286 ---- -- Process the discriminants contained in an N_Full_Type_Declaration or -- N_Incomplete_Type_Decl node N. If the declaration is a completion, -- Prev is entity on the partial view, on which references are posted. + -- However, note that Process_Discriminants is called for a completion only + -- if partial view had no discriminants (else we just check conformance + -- between the two views and do not call Process_Discriminants again for + -- the completion). function Replace_Anonymous_Access_To_Protected_Subprogram (N : Node_Id) return Entity_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch4.adb gcc-4.6.0/gcc/ada/sem_ch4.adb *** gcc-4.5.2/gcc/ada/sem_ch4.adb Mon Nov 30 09:46:15 2009 --- gcc-4.6.0/gcc/ada/sem_ch4.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Restrict; use Restrict; *** 43,59 **** with Rident; use Rident; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Cat; use Sem_Cat; with Sem_Ch3; use Sem_Ch3; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; - with Sem_SCIL; use Sem_SCIL; with Sem_Disp; use Sem_Disp; with Sem_Dist; use Sem_Dist; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; - with Sem_Util; use Sem_Util; with Sem_Type; use Sem_Type; with Stand; use Stand; with Sinfo; use Sinfo; with Snames; use Snames; --- 43,61 ---- with Rident; use Rident; with Sem; use Sem; with Sem_Aux; use Sem_Aux; + with Sem_Case; use Sem_Case; with Sem_Cat; use Sem_Cat; with Sem_Ch3; use Sem_Ch3; + with Sem_Ch5; use Sem_Ch5; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; with Sem_Disp; use Sem_Disp; with Sem_Dist; use Sem_Dist; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; + with Sem_Util; use Sem_Util; + with Sem_Warn; use Sem_Warn; with Stand; use Stand; with Sinfo; use Sinfo; with Snames; use Snames; *************** package body Sem_Ch4 is *** 98,104 **** -- the operand of the operator node. procedure Ambiguous_Operands (N : Node_Id); ! -- for equality, membership, and comparison operators with overloaded -- arguments, list possible interpretations. procedure Analyze_One_Call --- 100,106 ---- -- the operand of the operator node. procedure Ambiguous_Operands (N : Node_Id); ! -- For equality, membership, and comparison operators with overloaded -- arguments, list possible interpretations. procedure Analyze_One_Call *************** package body Sem_Ch4 is *** 268,274 **** -- the call may be overloaded with both interpretations. 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); --- 270,279 ---- -- the call may be overloaded with both interpretations. function Try_Object_Operation (N : Node_Id) return Boolean; ! -- Ada 2005 (AI-252): Support the object.operation notation. If node N ! -- is a call in this notation, it is transformed into a normal subprogram ! -- call where the prefix is a parameter, and True is returned. If node ! -- N is not of this form, it is unchanged, and False is returned. procedure wpo (T : Entity_Id); pragma Warnings (Off, wpo); *************** package body Sem_Ch4 is *** 305,312 **** end if; if Opnd = Left_Opnd (N) then ! Error_Msg_N ! ("\left operand has the following interpretations", N); else Error_Msg_N ("\right operand has the following interpretations", N); --- 310,316 ---- end if; if Opnd = Left_Opnd (N) then ! Error_Msg_N ("\left operand has the following interpretations", N); else Error_Msg_N ("\right operand has the following interpretations", N); *************** package body Sem_Ch4 is *** 361,375 **** E : Node_Id := Expression (N); Acc_Type : Entity_Id; Type_Id : Entity_Id; begin -- In accordance with H.4(7), the No_Allocators restriction only applies ! -- to user-written allocators. if Comes_From_Source (N) then Check_Restriction (No_Allocators, N); end if; if Nkind (E) = N_Qualified_Expression then Acc_Type := Create_Itype (E_Allocator_Type, N); Set_Etype (Acc_Type, Acc_Type); --- 365,424 ---- E : Node_Id := Expression (N); Acc_Type : Entity_Id; Type_Id : Entity_Id; + P : Node_Id; + C : Node_Id; begin + -- Deal with allocator restrictions + -- In accordance with H.4(7), the No_Allocators restriction only applies ! -- to user-written allocators. The same consideration applies to the ! -- No_Allocators_Before_Elaboration restriction. if Comes_From_Source (N) then Check_Restriction (No_Allocators, N); + + -- Processing for No_Allocators_After_Elaboration, loop to look at + -- enclosing context, checking task case and main subprogram case. + + C := N; + P := Parent (C); + while Present (P) loop + + -- In both cases we need a handled sequence of statements, where + -- the occurrence of the allocator is within the statements. + + if Nkind (P) = N_Handled_Sequence_Of_Statements + and then Is_List_Member (C) + and then List_Containing (C) = Statements (P) + then + -- Check for allocator within task body, this is a definite + -- violation of No_Allocators_After_Elaboration we can detect. + + if Nkind (Original_Node (Parent (P))) = N_Task_Body then + Check_Restriction (No_Allocators_After_Elaboration, N); + exit; + end if; + + -- The other case is appearance in a subprogram body. This may + -- be a violation if this is a library level subprogram, and it + -- turns out to be used as the main program, but only the + -- binder knows that, so just record the occurrence. + + if Nkind (Original_Node (Parent (P))) = N_Subprogram_Body + and then Nkind (Parent (Parent (P))) = N_Compilation_Unit + then + Set_Has_Allocator (Current_Sem_Unit); + end if; + end if; + + C := P; + P := Parent (C); + end loop; end if; + -- Analyze the allocator + if Nkind (E) = N_Qualified_Expression then Acc_Type := Create_Itype (E_Allocator_Type, N); Set_Etype (Acc_Type, Acc_Type); *************** package body Sem_Ch4 is *** 463,469 **** -- partial view, it cannot receive a discriminant constraint, -- and the allocated object is unconstrained. ! elsif Ada_Version >= Ada_05 and then Has_Constrained_Partial_View (Base_Typ) then Error_Msg_N --- 512,518 ---- -- partial view, it cannot receive a discriminant constraint, -- and the allocated object is unconstrained. ! elsif Ada_Version >= Ada_2005 and then Has_Constrained_Partial_View (Base_Typ) then Error_Msg_N *************** package body Sem_Ch4 is *** 472,479 **** end if; if Expander_Active then ! Def_Id := ! Make_Defining_Identifier (Loc, New_Internal_Name ('S')); Insert_Action (E, Make_Subtype_Declaration (Loc, --- 521,527 ---- end if; if Expander_Active then ! Def_Id := Make_Temporary (Loc, 'S'); Insert_Action (E, Make_Subtype_Declaration (Loc, *************** package body Sem_Ch4 is *** 505,519 **** -- be a null object, and we can insert an unconditional raise -- before the allocator. if Can_Never_Be_Null (Type_Id) then declare Not_Null_Check : constant Node_Id := Make_Raise_Constraint_Error (Sloc (E), Reason => CE_Null_Not_Allowed); begin ! if Expander_Active then Insert_Action (N, Not_Null_Check); Analyze (Not_Null_Check); else Error_Msg_N ("null value not allowed here?", E); end if; --- 553,577 ---- -- be a null object, and we can insert an unconditional raise -- before the allocator. + -- Ada 2012 (AI-104): A not null indication here is altogether + -- illegal. + if Can_Never_Be_Null (Type_Id) then declare Not_Null_Check : constant Node_Id := Make_Raise_Constraint_Error (Sloc (E), Reason => CE_Null_Not_Allowed); + begin ! if Ada_Version >= Ada_2012 then ! Error_Msg_N ! ("an uninitialized allocator cannot have" ! & " a null exclusion", N); ! ! elsif Expander_Active then Insert_Action (N, Not_Null_Check); Analyze (Not_Null_Check); + else Error_Msg_N ("null value not allowed here?", E); end if; *************** package body Sem_Ch4 is *** 540,546 **** Error_Msg_N ("initialization required in class-wide allocation", N); else ! if Ada_Version < Ada_05 and then Is_Limited_Type (Type_Id) then Error_Msg_N ("unconstrained allocation not allowed", N); --- 598,604 ---- Error_Msg_N ("initialization required in class-wide allocation", N); else ! if Ada_Version < Ada_2005 and then Is_Limited_Type (Type_Id) then Error_Msg_N ("unconstrained allocation not allowed", N); *************** package body Sem_Ch4 is *** 591,596 **** --- 649,673 ---- Check_Restriction (No_Tasking, N); Check_Restriction (Max_Tasks, N); Check_Restriction (No_Task_Allocators, N); + + -- Check that an allocator with task parts isn't for a nested access + -- type when restriction No_Task_Hierarchy applies. + + if not Is_Library_Level_Entity (Acc_Type) then + Check_Restriction (No_Task_Hierarchy, N); + end if; + end if; + + -- Check that an allocator of a nested access type doesn't create a + -- protected object when restriction No_Local_Protected_Objects applies. + -- We don't have an equivalent to Has_Task for protected types, so only + -- cases where the designated type itself is a protected type are + -- currently checked. ??? + + if Is_Protected_Type (Designated_Type (Acc_Type)) + and then not Is_Library_Level_Entity (Acc_Type) + then + Check_Restriction (No_Local_Protected_Objects, N); end if; -- If the No_Streams restriction is set, check that the type of the *************** package body Sem_Ch4 is *** 599,605 **** -- Has_Stream just for efficiency reasons. There is no point in -- spending time on a Has_Stream check if the restriction is not set. ! if Restrictions.Set (No_Streams) then if Has_Stream (Designated_Type (Acc_Type)) then Check_Restriction (No_Streams, N); end if; --- 676,682 ---- -- Has_Stream just for efficiency reasons. There is no point in -- spending time on a Has_Stream check if the restriction is not set. ! if Restriction_Check_Required (No_Streams) then if Has_Stream (Designated_Type (Acc_Type)) then Check_Restriction (No_Streams, N); end if; *************** package body Sem_Ch4 is *** 818,827 **** elsif Nkind (Nam) = N_Selected_Component then Nam_Ent := Entity (Selector_Name (Nam)); ! if Ekind (Nam_Ent) /= E_Entry ! and then Ekind (Nam_Ent) /= E_Entry_Family ! and then Ekind (Nam_Ent) /= E_Function ! and then Ekind (Nam_Ent) /= E_Procedure then Error_Msg_N ("name in call is not a callable entity", Nam); Set_Etype (N, Any_Type); --- 895,904 ---- elsif Nkind (Nam) = N_Selected_Component then Nam_Ent := Entity (Selector_Name (Nam)); ! if not Ekind_In (Nam_Ent, E_Entry, ! E_Entry_Family, ! E_Function, ! E_Procedure) then Error_Msg_N ("name in call is not a callable entity", Nam); Set_Etype (N, Any_Type); *************** package body Sem_Ch4 is *** 870,877 **** -- If this is an indirect call, the return type of the access_to -- subprogram may be an incomplete type. At the point of the call, ! -- use the full type if available, and at the same time update ! -- the return type of the access_to_subprogram. if Success and then Nkind (Nam) = N_Explicit_Dereference --- 947,954 ---- -- If this is an indirect call, the return type of the access_to -- subprogram may be an incomplete type. At the point of the call, ! -- use the full type if available, and at the same time update the ! -- return type of the access_to_subprogram. if Success and then Nkind (Nam) = N_Explicit_Dereference *************** package body Sem_Ch4 is *** 899,910 **** -- Name may be call that returns an access to subprogram, or more -- generally an overloaded expression one of whose interpretations ! -- yields an access to subprogram. If the name is an entity, we ! -- do not dereference, because the node is a call that returns ! -- the access type: note difference between f(x), where the call ! -- may return an access subprogram type, and f(x)(y), where the ! -- type returned by the call to f is implicitly dereferenced to ! -- analyze the outer call. if Is_Access_Type (Nam_Ent) then Nam_Ent := Designated_Type (Nam_Ent); --- 976,987 ---- -- Name may be call that returns an access to subprogram, or more -- generally an overloaded expression one of whose interpretations ! -- yields an access to subprogram. If the name is an entity, we do ! -- not dereference, because the node is a call that returns the ! -- access type: note difference between f(x), where the call may ! -- return an access subprogram type, and f(x)(y), where the type ! -- returned by the call to f is implicitly dereferenced to analyze ! -- the outer call. if Is_Access_Type (Nam_Ent) then Nam_Ent := Designated_Type (Nam_Ent); *************** package body Sem_Ch4 is *** 923,929 **** end if; end if; ! Analyze_One_Call (N, Nam_Ent, False, Success); -- If the interpretation succeeds, mark the proper type of the -- prefix (any valid candidate will do). If not, remove the --- 1000,1020 ---- end if; end if; ! -- If the call has been rewritten from a prefixed call, the first ! -- parameter has been analyzed, but may need a subsequent ! -- dereference, so skip its analysis now. ! ! if N /= Original_Node (N) ! and then Nkind (Original_Node (N)) = Nkind (N) ! and then Nkind (Name (N)) /= Nkind (Name (Original_Node (N))) ! and then Present (Parameter_Associations (N)) ! and then Present (Etype (First (Parameter_Associations (N)))) ! then ! Analyze_One_Call ! (N, Nam_Ent, False, Success, Skip_First => True); ! else ! Analyze_One_Call (N, Nam_Ent, False, Success); ! end if; -- If the interpretation succeeds, mark the proper type of the -- prefix (any valid candidate will do). If not, remove the *************** package body Sem_Ch4 is *** 1035,1040 **** --- 1126,1262 ---- end if; end Analyze_Call; + ----------------------------- + -- Analyze_Case_Expression -- + ----------------------------- + + procedure Analyze_Case_Expression (N : Node_Id) is + Expr : constant Node_Id := Expression (N); + FirstX : constant Node_Id := Expression (First (Alternatives (N))); + Alt : Node_Id; + Exp_Type : Entity_Id; + Exp_Btype : Entity_Id; + + Dont_Care : Boolean; + Others_Present : Boolean; + + procedure Non_Static_Choice_Error (Choice : Node_Id); + -- Error routine invoked by the generic instantiation below when + -- the case expression has a non static choice. + + package Case_Choices_Processing is new + Generic_Choices_Processing + (Get_Alternatives => Alternatives, + Get_Choices => Discrete_Choices, + Process_Empty_Choice => No_OP, + Process_Non_Static_Choice => Non_Static_Choice_Error, + Process_Associated_Node => No_OP); + use Case_Choices_Processing; + + ----------------------------- + -- Non_Static_Choice_Error -- + ----------------------------- + + procedure Non_Static_Choice_Error (Choice : Node_Id) is + begin + Flag_Non_Static_Expr + ("choice given in case expression is not static!", Choice); + end Non_Static_Choice_Error; + + -- Start of processing for Analyze_Case_Expression + + begin + if Comes_From_Source (N) then + Check_Compiler_Unit (N); + end if; + + Analyze_And_Resolve (Expr, Any_Discrete); + Check_Unset_Reference (Expr); + Exp_Type := Etype (Expr); + Exp_Btype := Base_Type (Exp_Type); + + Alt := First (Alternatives (N)); + while Present (Alt) loop + Analyze (Expression (Alt)); + Next (Alt); + end loop; + + if not Is_Overloaded (FirstX) then + Set_Etype (N, Etype (FirstX)); + + else + declare + I : Interp_Index; + It : Interp; + + begin + Set_Etype (N, Any_Type); + + Get_First_Interp (FirstX, I, It); + while Present (It.Nam) loop + + -- For each interpretation of the first expression, we only + -- add the interpretation if every other expression in the + -- case expression alternatives has a compatible type. + + Alt := Next (First (Alternatives (N))); + while Present (Alt) loop + exit when not Has_Compatible_Type (Expression (Alt), It.Typ); + Next (Alt); + end loop; + + if No (Alt) then + Add_One_Interp (N, It.Typ, It.Typ); + end if; + + Get_Next_Interp (I, It); + end loop; + end; + end if; + + Exp_Btype := Base_Type (Exp_Type); + + -- The expression must be of a discrete type which must be determinable + -- independently of the context in which the expression occurs, but + -- using the fact that the expression must be of a discrete type. + -- Moreover, the type this expression must not be a character literal + -- (which is always ambiguous). + + -- If error already reported by Resolve, nothing more to do + + if Exp_Btype = Any_Discrete + or else Exp_Btype = Any_Type + then + return; + + elsif Exp_Btype = Any_Character then + Error_Msg_N + ("character literal as case expression is ambiguous", Expr); + return; + end if; + + -- If the case expression is a formal object of mode in out, then + -- treat it as having a nonstatic subtype by forcing use of the base + -- type (which has to get passed to Check_Case_Choices below). Also + -- use base type when the case expression is parenthesized. + + if Paren_Count (Expr) > 0 + or else (Is_Entity_Name (Expr) + and then Ekind (Entity (Expr)) = E_Generic_In_Out_Parameter) + then + Exp_Type := Exp_Btype; + end if; + + -- Call instantiated Analyze_Choices which does the rest of the work + + Analyze_Choices (N, Exp_Type, Dont_Care, Others_Present); + + if Exp_Type = Universal_Integer and then not Others_Present then + Error_Msg_N + ("case on universal integer requires OTHERS choice", Expr); + end if; + end Analyze_Case_Expression; + --------------------------- -- Analyze_Comparison_Op -- --------------------------- *************** package body Sem_Ch4 is *** 1160,1166 **** if Present (Op_Id) then if Ekind (Op_Id) = E_Operator then - LT := Base_Type (Etype (L)); RT := Base_Type (Etype (R)); --- 1382,1387 ---- *************** package body Sem_Ch4 is *** 1237,1245 **** procedure Analyze_Conditional_Expression (N : Node_Id) is Condition : constant Node_Id := First (Expressions (N)); Then_Expr : constant Node_Id := Next (Condition); ! Else_Expr : constant Node_Id := Next (Then_Expr); begin if Comes_From_Source (N) then Check_Compiler_Unit (N); end if; --- 1458,1474 ---- procedure Analyze_Conditional_Expression (N : Node_Id) is Condition : constant Node_Id := First (Expressions (N)); Then_Expr : constant Node_Id := Next (Condition); ! Else_Expr : Node_Id; begin + -- Defend against error of missing expressions from previous error + + if No (Then_Expr) then + return; + end if; + + Else_Expr := Next (Then_Expr); + if Comes_From_Source (N) then Check_Compiler_Unit (N); end if; *************** package body Sem_Ch4 is *** 1251,1258 **** --- 1480,1492 ---- Analyze_Expression (Else_Expr); end if; + -- If then expression not overloaded, then that decides the type + if not Is_Overloaded (Then_Expr) then Set_Etype (N, Etype (Then_Expr)); + + -- Case where then expression is overloaded + else declare I : Interp_Index; *************** package body Sem_Ch4 is *** 1262,1267 **** --- 1496,1507 ---- Set_Etype (N, Any_Type); Get_First_Interp (Then_Expr, I, It); while Present (It.Nam) loop + + -- For each possible interpretation of the Then Expression, + -- add it only if the else expression has a compatible type. + + -- Is this right if Else_Expr is empty? + if Has_Compatible_Type (Else_Expr, It.Typ) then Add_One_Interp (N, It.Typ, It.Typ); end if; *************** package body Sem_Ch4 is *** 1577,1582 **** --- 1817,1841 ---- Check_Parameterless_Call (N); end Analyze_Expression; + ------------------------------------- + -- Analyze_Expression_With_Actions -- + ------------------------------------- + + procedure Analyze_Expression_With_Actions (N : Node_Id) is + A : Node_Id; + + begin + A := First (Actions (N)); + loop + Analyze (A); + Next (A); + exit when No (A); + end loop; + + Analyze_Expression (Expression (N)); + Set_Etype (N, Etype (Expression (N))); + end Analyze_Expression_With_Actions; + ------------------------------------ -- Analyze_Indexed_Component_Form -- ------------------------------------ *************** package body Sem_Ch4 is *** 1896,1904 **** P_T := Base_Type (Etype (P)); ! if Is_Entity_Name (P) ! or else Nkind (P) = N_Operator_Symbol ! then U_N := Entity (P); if Is_Type (U_N) then --- 2155,2161 ---- P_T := Base_Type (Etype (P)); ! if Is_Entity_Name (P) and then Present (Entity (P)) then U_N := Entity (P); if Is_Type (U_N) then *************** package body Sem_Ch4 is *** 1930,1936 **** elsif Ekind (Etype (P)) = E_Subprogram_Type or else (Is_Access_Type (Etype (P)) and then ! Ekind (Designated_Type (Etype (P))) = E_Subprogram_Type) then -- Call to access_to-subprogram with possible implicit dereference --- 2187,2194 ---- elsif Ekind (Etype (P)) = E_Subprogram_Type or else (Is_Access_Type (Etype (P)) and then ! Ekind (Designated_Type (Etype (P))) = ! E_Subprogram_Type) then -- Call to access_to-subprogram with possible implicit dereference *************** package body Sem_Ch4 is *** 1955,1961 **** if Ekind (P_T) = E_Subprogram_Type or else (Is_Access_Type (P_T) and then ! Ekind (Designated_Type (P_T)) = E_Subprogram_Type) then Process_Function_Call; --- 2213,2219 ---- if Ekind (P_T) = E_Subprogram_Type or else (Is_Access_Type (P_T) and then ! Ekind (Designated_Type (P_T)) = E_Subprogram_Type) then Process_Function_Call; *************** package body Sem_Ch4 is *** 2018,2025 **** --------------------------- procedure Analyze_Membership_Op (N : Node_Id) is ! L : constant Node_Id := Left_Opnd (N); ! R : constant Node_Id := Right_Opnd (N); Index : Interp_Index; It : Interp; --- 2276,2284 ---- --------------------------- procedure Analyze_Membership_Op (N : Node_Id) is ! Loc : constant Source_Ptr := Sloc (N); ! L : constant Node_Id := Left_Opnd (N); ! R : constant Node_Id := Right_Opnd (N); Index : Interp_Index; It : Interp; *************** package body Sem_Ch4 is *** 2158,2164 **** Analyze_Expression (L); if No (R) ! and then Extensions_Allowed then Analyze_Set_Membership; return; --- 2417,2423 ---- Analyze_Expression (L); if No (R) ! and then Ada_Version >= Ada_2012 then Analyze_Set_Membership; return; *************** package body Sem_Ch4 is *** 2181,2194 **** end loop; end if; ! -- If not a range, it can only be a subtype mark, or else there ! -- is a more basic error, to be diagnosed in Find_Type. else ! Find_Type (R); ! ! if Is_Entity_Name (R) then Check_Fully_Declared (Entity (R), R); end if; end if; --- 2440,2477 ---- end loop; end if; ! -- If not a range, it can be a subtype mark, or else it is a degenerate ! -- membership test with a singleton value, i.e. a test for equality. else ! Analyze (R); ! if Is_Entity_Name (R) ! and then Is_Type (Entity (R)) ! then ! Find_Type (R); Check_Fully_Declared (Entity (R), R); + + elsif Ada_Version >= Ada_2012 then + if Nkind (N) = N_In then + Rewrite (N, + Make_Op_Eq (Loc, + Left_Opnd => L, + Right_Opnd => R)); + else + Rewrite (N, + Make_Op_Ne (Loc, + Left_Opnd => L, + Right_Opnd => R)); + end if; + + Analyze (N); + return; + + else + -- In previous version of the language this is an error that will + -- be diagnosed below. + + Find_Type (R); end if; end if; *************** package body Sem_Ch4 is *** 2318,2326 **** -- being called is noted on the selector. if not Is_Type (Nam) then ! if Is_Entity_Name (Name (N)) ! or else Nkind (Name (N)) = N_Operator_Symbol ! then Set_Entity (Name (N), Nam); elsif Nkind (Name (N)) = N_Selected_Component then --- 2601,2607 ---- -- being called is noted on the selector. if not Is_Type (Nam) then ! if Is_Entity_Name (Name (N)) then Set_Entity (Name (N), Nam); elsif Nkind (Name (N)) = N_Selected_Component then *************** package body Sem_Ch4 is *** 2617,2622 **** --- 2898,2908 ---- if All_Errors_Mode then Error_Msg_Sloc := Sloc (Nam); + if Etype (Formal) = Any_Type then + Error_Msg_N + ("there is no legal actual parameter", Actual); + end if; + if Is_Overloadable (Nam) and then Present (Alias (Nam)) and then not Comes_From_Source (Nam) *************** package body Sem_Ch4 is *** 2917,2922 **** --- 3203,3256 ---- Set_Etype (N, T); end Analyze_Qualified_Expression; + ----------------------------------- + -- Analyze_Quantified_Expression -- + ----------------------------------- + + procedure Analyze_Quantified_Expression (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + Ent : constant Entity_Id := + New_Internal_Entity + (E_Loop, Current_Scope, Sloc (N), 'L'); + + Iterator : Node_Id; + + begin + Set_Etype (Ent, Standard_Void_Type); + Set_Parent (Ent, N); + + if Present (Loop_Parameter_Specification (N)) then + Iterator := + Make_Iteration_Scheme (Loc, + Loop_Parameter_Specification => + Loop_Parameter_Specification (N)); + else + Iterator := + Make_Iteration_Scheme (Loc, + Iterator_Specification => + Iterator_Specification (N)); + end if; + + Push_Scope (Ent); + Set_Parent (Iterator, N); + Analyze_Iteration_Scheme (Iterator); + + -- The loop specification may have been converted into an + -- iterator specification during its analysis. Update the + -- quantified node accordingly. + + if Present (Iterator_Specification (Iterator)) then + Set_Iterator_Specification + (N, Iterator_Specification (Iterator)); + Set_Loop_Parameter_Specification (N, Empty); + end if; + + Analyze (Condition (N)); + End_Scope; + + Set_Etype (N, Standard_Boolean); + end Analyze_Quantified_Expression; + ------------------- -- Analyze_Range -- ------------------- *************** package body Sem_Ch4 is *** 3058,3069 **** -- 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); --- 3392,3405 ---- -- 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, except in CodePeer mode where we do not really ! -- care and don't want to bother the user. T := Etype (P); if Is_Entity_Name (P) and then Is_Object_Reference (P) + and then not CodePeer_Mode then E := Entity (P); T := Etype (P); *************** package body Sem_Ch4 is *** 3092,3099 **** -- Analyze_Selected_Component -- -------------------------------- ! -- Prefix is a record type or a task or protected type. In the ! -- later case, the selector must denote a visible entry. procedure Analyze_Selected_Component (N : Node_Id) is Name : constant Node_Id := Prefix (N); --- 3428,3435 ---- -- Analyze_Selected_Component -- -------------------------------- ! -- Prefix is a record type or a task or protected type. In the latter case, ! -- the selector must denote a visible entry. procedure Analyze_Selected_Component (N : Node_Id) is Name : constant Node_Id := Prefix (N); *************** package body Sem_Ch4 is *** 3111,3116 **** --- 3447,3463 ---- -- a class-wide type, we use its root type, whose components are -- present in the class-wide type. + Is_Single_Concurrent_Object : Boolean; + -- Set True if the prefix is a single task or a single protected object + + procedure Find_Component_In_Instance (Rec : Entity_Id); + -- In an instance, a component of a private extension may not be visible + -- while it was visible in the generic. Search candidate scope for a + -- component with the proper identifier. This is only done if all other + -- searches have failed. When the match is found (it always will be), + -- the Etype of both N and Sel are set from this component, and the + -- entity of Sel is set to reference this component. + function Has_Mode_Conformant_Spec (Comp : Entity_Id) return Boolean; -- It is known that the parent of N denotes a subprogram call. Comp -- is an overloadable component of the concurrent type of the prefix. *************** package body Sem_Ch4 is *** 3118,3123 **** --- 3465,3495 ---- -- conformant. If the parent node is not analyzed yet it may be an -- indexed component rather than a function call. + -------------------------------- + -- Find_Component_In_Instance -- + -------------------------------- + + procedure Find_Component_In_Instance (Rec : Entity_Id) is + Comp : Entity_Id; + + begin + Comp := First_Component (Rec); + while Present (Comp) loop + if Chars (Comp) = Chars (Sel) then + Set_Entity_With_Style_Check (Sel, Comp); + Set_Etype (Sel, Etype (Comp)); + Set_Etype (N, Etype (Comp)); + return; + end if; + + Next_Component (Comp); + end loop; + + -- This must succeed because code was legal in the generic + + raise Program_Error; + end Find_Component_In_Instance; + ------------------------------ -- Has_Mode_Conformant_Spec -- ------------------------------ *************** package body Sem_Ch4 is *** 3182,3192 **** if Is_Access_Type (Prefix_Type) then ! -- 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(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) --- 3554,3564 ---- if Is_Access_Type (Prefix_Type) then ! -- 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(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) *************** package body Sem_Ch4 is *** 3281,3286 **** --- 3653,3667 ---- Type_To_Use := Root_Type (Prefix_Type); end if; + -- If the prefix is a single concurrent object, use its name in error + -- messages, rather than that of its anonymous type. + + Is_Single_Concurrent_Object := + Is_Concurrent_Type (Prefix_Type) + and then Is_Internal_Name (Chars (Prefix_Type)) + and then not Is_Derived_Type (Prefix_Type) + and then Is_Entity_Name (Name); + Comp := First_Entity (Type_To_Use); -- If the selector has an original discriminant, the node appears in *************** package body Sem_Ch4 is *** 3367,3374 **** -- this case gigi generates all the checks and can find the -- necessary bounds information. ! -- We also do not need an actual subtype for the case of ! -- a first, last, length, or range attribute applied to a -- non-packed array, since gigi can again get the bounds in -- these cases (gigi cannot handle the packed case, since it -- has the bounds of the packed array type, not the original --- 3748,3755 ---- -- this case gigi generates all the checks and can find the -- necessary bounds information. ! -- We also do not need an actual subtype for the case of a ! -- first, last, length, or range attribute applied to a -- non-packed array, since gigi can again get the bounds in -- these cases (gigi cannot handle the packed case, since it -- has the bounds of the packed array type, not the original *************** package body Sem_Ch4 is *** 3461,3467 **** -- Ada 2005 (AI05-0030): In the case of dispatching requeue, the -- selected component should resolve to a name. ! if Ada_Version >= Ada_05 and then Is_Tagged_Type (Prefix_Type) and then not Is_Concurrent_Type (Prefix_Type) then --- 3842,3848 ---- -- Ada 2005 (AI05-0030): In the case of dispatching requeue, the -- selected component should resolve to a name. ! if Ada_Version >= Ada_2005 and then Is_Tagged_Type (Prefix_Type) and then not Is_Concurrent_Type (Prefix_Type) then *************** package body Sem_Ch4 is *** 3512,3527 **** -- Before declaring an error, check whether this is tagged -- private type and a call to a primitive operation. ! elsif Ada_Version >= Ada_05 and then Is_Tagged_Type (Prefix_Type) and then Try_Object_Operation (N) then return; else ! Error_Msg_NE ! ("invisible selector for }", ! N, First_Subtype (Prefix_Type)); Set_Entity (Sel, Any_Id); Set_Etype (N, Any_Type); end if; --- 3893,3907 ---- -- Before declaring an error, check whether this is tagged -- private type and a call to a primitive operation. ! elsif Ada_Version >= Ada_2005 and then Is_Tagged_Type (Prefix_Type) and then Try_Object_Operation (N) then return; else ! Error_Msg_Node_2 := First_Subtype (Prefix_Type); ! Error_Msg_NE ("invisible selector& for }", N, Sel); Set_Entity (Sel, Any_Id); Set_Etype (N, Any_Type); end if; *************** package body Sem_Ch4 is *** 3566,3575 **** Has_Candidate := True; end if; ! elsif Ekind (Comp) = E_Discriminant ! or else Ekind (Comp) = E_Entry_Family or else (In_Scope ! and then Is_Entity_Name (Name)) then Set_Entity_With_Style_Check (Sel, Comp); Generate_Reference (Comp, Sel); --- 3946,3958 ---- Has_Candidate := True; end if; ! -- Note: a selected component may not denote a component of a ! -- protected type (4.1.3(7)). ! ! elsif Ekind_In (Comp, E_Discriminant, E_Entry_Family) or else (In_Scope ! and then not Is_Protected_Type (Prefix_Type) ! and then Is_Entity_Name (Name)) then Set_Entity_With_Style_Check (Sel, Comp); Generate_Reference (Comp, Sel); *************** package body Sem_Ch4 is *** 3606,3612 **** -- visible entities are plausible interpretations, check whether -- there is some other primitive operation with that name. ! if Ada_Version >= Ada_05 and then Is_Tagged_Type (Prefix_Type) then if (Etype (N) = Any_Type --- 3989,3995 ---- -- visible entities are plausible interpretations, check whether -- there is some other primitive operation with that name. ! if Ada_Version >= Ada_2005 and then Is_Tagged_Type (Prefix_Type) then if (Etype (N) = Any_Type *************** package body Sem_Ch4 is *** 3633,3638 **** --- 4016,4043 ---- end if; end if; + if Etype (N) = Any_Type and then Is_Protected_Type (Prefix_Type) then + -- Case of a prefix of a protected type: selector might denote + -- an invisible private component. + + Comp := First_Private_Entity (Base_Type (Prefix_Type)); + while Present (Comp) and then Chars (Comp) /= Chars (Sel) loop + Next_Entity (Comp); + end loop; + + if Present (Comp) then + if Is_Single_Concurrent_Object then + Error_Msg_Node_2 := Entity (Name); + Error_Msg_NE ("invisible selector& for &", N, Sel); + + else + Error_Msg_Node_2 := First_Subtype (Prefix_Type); + Error_Msg_NE ("invisible selector& for }", N, Sel); + end if; + return; + end if; + end if; + Set_Is_Overloaded (N, Is_Overloaded (Sel)); else *************** package body Sem_Ch4 is *** 3645,3659 **** if Etype (N) = Any_Type then ! -- If the prefix is a single concurrent object, use its name in the ! -- error message, rather than that of its anonymous type. ! ! if Is_Concurrent_Type (Prefix_Type) ! and then Is_Internal_Name (Chars (Prefix_Type)) ! and then not Is_Derived_Type (Prefix_Type) ! and then Is_Entity_Name (Name) ! then ! Error_Msg_Node_2 := Entity (Name); Error_Msg_NE ("no selector& for&", N, Sel); --- 4050,4056 ---- if Etype (N) = Any_Type then ! if Is_Single_Concurrent_Object then Error_Msg_Node_2 := Entity (Name); Error_Msg_NE ("no selector& for&", N, Sel); *************** package body Sem_Ch4 is *** 3672,3714 **** Analyze_Selected_Component (N); return; elsif Ekind (Prefix_Type) = E_Record_Subtype_With_Private and then Is_Generic_Actual_Type (Prefix_Type) and then Present (Full_View (Prefix_Type)) then - -- Similarly, if this the actual for a formal derived type, the - -- component inherited from the generic parent may not be visible - -- in the actual, but the selected component is legal. ! declare ! Comp : Entity_Id; ! begin ! Comp := ! First_Component (Generic_Parent_Type (Parent (Prefix_Type))); ! while Present (Comp) loop ! if Chars (Comp) = Chars (Sel) then ! Set_Entity_With_Style_Check (Sel, Comp); ! Set_Etype (Sel, Etype (Comp)); ! Set_Etype (N, Etype (Comp)); ! return; ! end if; ! Next_Component (Comp); ! end loop; ! pragma Assert (Etype (N) /= Any_Type); ! end; else if Ekind (Prefix_Type) = E_Record_Subtype then ! -- Check whether this is a component of the base type ! -- which is absent from a statically constrained subtype. ! -- This will raise constraint error at run-time, but is ! -- not a compile-time error. When the selector is illegal ! -- for base type as well fall through and generate a ! -- compilation error anyway. Comp := First_Component (Base_Type (Prefix_Type)); while Present (Comp) loop --- 4069,4108 ---- Analyze_Selected_Component (N); return; + -- Similarly, if this is the actual for a formal derived type, the + -- component inherited from the generic parent may not be visible + -- in the actual, but the selected component is legal. + elsif Ekind (Prefix_Type) = E_Record_Subtype_With_Private and then Is_Generic_Actual_Type (Prefix_Type) and then Present (Full_View (Prefix_Type)) then ! Find_Component_In_Instance ! (Generic_Parent_Type (Parent (Prefix_Type))); ! return; ! -- Finally, the formal and the actual may be private extensions, ! -- but the generic is declared in a child unit of the parent, and ! -- an additional step is needed to retrieve the proper scope. ! elsif In_Instance ! and then Present (Parent_Subtype (Etype (Base_Type (Prefix_Type)))) ! then ! Find_Component_In_Instance ! (Parent_Subtype (Etype (Base_Type (Prefix_Type)))); ! return; ! -- Component not found, specialize error message when appropriate else if Ekind (Prefix_Type) = E_Record_Subtype then ! -- Check whether this is a component of the base type which ! -- is absent from a statically constrained subtype. This will ! -- raise constraint error at run time, but is not a compile- ! -- time error. When the selector is illegal for base type as ! -- well fall through and generate a compilation error anyway. Comp := First_Component (Base_Type (Prefix_Type)); while Present (Comp) loop *************** package body Sem_Ch4 is *** 3890,3904 **** T : Entity_Id; begin - -- Check if the expression is a function call for which we need to - -- adjust a SCIL dispatching node. - - if Generate_SCIL - and then Nkind (Expr) = N_Function_Call - then - Adjust_SCIL_Node (N, Expr); - end if; - -- If Conversion_OK is set, then the Etype is already set, and the -- only processing required is to analyze the expression. This is -- used to construct certain "illegal" conversions which are not --- 4284,4289 ---- *************** package body Sem_Ch4 is *** 4431,4437 **** pragma Warnings (Off, Boolean); begin ! if Ada_Version >= Ada_05 then Actual := First_Actual (N); while Present (Actual) loop --- 4816,4822 ---- pragma Warnings (Off, Boolean); begin ! if Ada_Version >= Ada_2005 then Actual := First_Actual (N); while Present (Actual) loop *************** package body Sem_Ch4 is *** 4488,4496 **** if Nkind (N) = N_Function_Call then Get_First_Interp (Nam, X, It); while Present (It.Nam) loop ! if Ekind (It.Nam) = E_Function ! or else Ekind (It.Nam) = E_Operator ! then return; else Get_Next_Interp (X, It); --- 4873,4879 ---- if Nkind (N) = N_Function_Call then Get_First_Interp (Nam, X, It); while Present (It.Nam) loop ! if Ekind_In (It.Nam, E_Function, E_Operator) then return; else Get_Next_Interp (X, It); *************** package body Sem_Ch4 is *** 4920,4926 **** null; else ! -- Save candidate type for subsquent error message, if any if not Is_Limited_Type (T1) then Candidate_Type := T1; --- 5303,5309 ---- null; else ! -- Save candidate type for subsequent error message, if any if not Is_Limited_Type (T1) then Candidate_Type := T1; *************** package body Sem_Ch4 is *** 4932,4938 **** -- Ada 2005 (AI-230): Keep restriction imposed by Ada 83 and 95: -- Do not allow anonymous access types in equality operators. ! if Ada_Version < Ada_05 and then Ekind (T1) = E_Anonymous_Access_Type then return; --- 5315,5321 ---- -- Ada 2005 (AI-230): Keep restriction imposed by Ada 83 and 95: -- Do not allow anonymous access types in equality operators. ! if Ada_Version < Ada_2005 and then Ekind (T1) = E_Anonymous_Access_Type then return; *************** package body Sem_Ch4 is *** 5288,5294 **** or else Is_Array_Type (Etype (L)) or else Is_Array_Type (Etype (R))) then - if Nkind (N) = N_Op_Concat then if Etype (L) /= Any_Composite and then Is_Array_Type (Etype (L)) --- 5671,5676 ---- *************** package body Sem_Ch4 is *** 5302,5311 **** end if; end if; ! Error_Msg_NE ("operator for} is not directly visible!", N, First_Subtype (Candidate_Type)); ! Error_Msg_N ("use clause would make operation legal!", N); return; -- If either operand is a junk operand (e.g. package name), then --- 5684,5694 ---- end if; end if; ! Error_Msg_NE -- CODEFIX ("operator for} is not directly visible!", N, First_Subtype (Candidate_Type)); ! Error_Msg_N -- CODEFIX ! ("use clause would make operation legal!", N); return; -- If either operand is a junk operand (e.g. package name), then *************** package body Sem_Ch4 is *** 5611,5617 **** -- unit, it is one of the operations declared abstract in some -- variants of System, and it must be removed as well. ! elsif Ada_Version >= Ada_05 or else Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (It.Nam))) then --- 5994,6000 ---- -- unit, it is one of the operations declared abstract in some -- variants of System, and it must be removed as well. ! elsif Ada_Version >= Ada_2005 or else Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (It.Nam))) then *************** package body Sem_Ch4 is *** 5771,5777 **** -- predefined operators when addresses are involved since this -- case is handled separately. ! elsif Ada_Version >= Ada_05 and then not Address_Kludge then while Present (It.Nam) loop --- 6154,6160 ---- -- predefined operators when addresses are involved since this -- case is handled separately. ! elsif Ada_Version >= Ada_2005 and then not Address_Kludge then while Present (It.Nam) loop *************** package body Sem_Ch4 is *** 5874,5887 **** and then Is_Type (Entity (Actual)) and then No (Next (Actual)) then ! Rewrite (N, ! Make_Slice (Loc, ! Prefix => Make_Function_Call (Loc, ! Name => Relocate_Node (Name (N))), ! Discrete_Range => ! New_Occurrence_Of (Entity (Actual), Sloc (Actual)))); - Analyze (N); return True; elsif not Has_Compatible_Type (Actual, Etype (Index)) then --- 6257,6281 ---- and then Is_Type (Entity (Actual)) and then No (Next (Actual)) then ! -- A single actual that is a type name indicates a slice if the ! -- type is discrete, and an error otherwise. ! ! if Is_Discrete_Type (Entity (Actual)) then ! Rewrite (N, ! Make_Slice (Loc, ! Prefix => ! Make_Function_Call (Loc, ! Name => Relocate_Node (Name (N))), ! Discrete_Range => ! New_Occurrence_Of (Entity (Actual), Sloc (Actual)))); ! ! Analyze (N); ! ! else ! Error_Msg_N ("invalid use of type in expression", Actual); ! Set_Etype (N, Any_Type); ! end if; return True; elsif not Has_Compatible_Type (Actual, Etype (Index)) then *************** package body Sem_Ch4 is *** 5921,5929 **** N_Function_Call); Loc : constant Source_Ptr := Sloc (N); Obj : constant Node_Id := Prefix (N); ! Subprog : constant Node_Id := ! Make_Identifier (Sloc (Selector_Name (N)), ! Chars => Chars (Selector_Name (N))); -- Identifier on which possible interpretations will be collected Report_Error : Boolean := False; --- 6315,6324 ---- N_Function_Call); Loc : constant Source_Ptr := Sloc (N); Obj : constant Node_Id := Prefix (N); ! ! Subprog : constant Node_Id := ! Make_Identifier (Sloc (Selector_Name (N)), ! Chars => Chars (Selector_Name (N))); -- Identifier on which possible interpretations will be collected Report_Error : Boolean := False; *************** package body Sem_Ch4 is *** 6025,6032 **** if Present (Arr_Type) then ! -- Verify that the actuals (excluding the object) ! -- match the types of the indices. declare Actual : Node_Id; --- 6420,6427 ---- if Present (Arr_Type) then ! -- Verify that the actuals (excluding the object) match the types ! -- of the indexes. declare Actual : Node_Id; *************** package body Sem_Ch4 is *** 6180,6187 **** --- 6575,6594 ---- if Is_Overloaded (Subprog) then Save_Interps (Subprog, Node_To_Replace); + else Analyze (Node_To_Replace); + + -- If the operation has been rewritten into a call, which may get + -- subsequently an explicit dereference, preserve the type on the + -- original node (selected component or indexed component) for + -- subsequent legality tests, e.g. Is_Variable. which examines + -- the original node. + + if Nkind (Node_To_Replace) = N_Function_Call then + Set_Etype + (Original_Node (Node_To_Replace), Etype (Node_To_Replace)); + end if; end if; end Complete_Object_Operation; *************** package body Sem_Ch4 is *** 6293,6299 **** and then N = Prefix (Parent_Node) then Node_To_Replace := Parent_Node; - Actuals := Expressions (Parent_Node); Actual := First (Actuals); --- 6700,6705 ---- *************** package body Sem_Ch4 is *** 6649,6677 **** if Is_Derived_Type (T) then return Primitive_Operations (T); ! elsif Ekind (Scope (T)) = E_Procedure ! or else Ekind (Scope (T)) = E_Function ! then -- Scan the list of generic formals to find subprograms -- that may have a first controlling formal of the type. ! declare ! Decl : Node_Id; ! ! begin ! Decl := ! First (Generic_Formal_Declarations ! (Unit_Declaration_Node (Scope (T)))); ! while Present (Decl) loop ! if Nkind (Decl) in N_Formal_Subprogram_Declaration then ! Subp := Defining_Entity (Decl); ! Check_Candidate; ! end if; ! Next (Decl); ! end loop; ! end; return Candidates; else --- 7055,7085 ---- if Is_Derived_Type (T) then return Primitive_Operations (T); ! elsif Ekind_In (Scope (T), E_Procedure, E_Function) then ! -- Scan the list of generic formals to find subprograms -- that may have a first controlling formal of the type. ! if Nkind (Unit_Declaration_Node (Scope (T))) ! = N_Generic_Subprogram_Declaration ! then ! declare ! Decl : Node_Id; ! begin ! Decl := ! First (Generic_Formal_Declarations ! (Unit_Declaration_Node (Scope (T)))); ! while Present (Decl) loop ! if Nkind (Decl) in N_Formal_Subprogram_Declaration then ! Subp := Defining_Entity (Decl); ! Check_Candidate; ! end if; + Next (Decl); + end loop; + end; + end if; return Candidates; else *************** package body Sem_Ch4 is *** 6681,6687 **** -- declaration or body (either the one that declares T, or a -- child unit). ! Subp := First_Entity (Scope (T)); while Present (Subp) loop if Is_Overloadable (Subp) then Check_Candidate; --- 7089,7103 ---- -- declaration or body (either the one that declares T, or a -- child unit). ! -- For a subtype representing a generic actual type, go to the ! -- base type. ! ! if Is_Generic_Actual_Type (T) then ! Subp := First_Entity (Scope (Base_Type (T))); ! else ! Subp := First_Entity (Scope (T)); ! end if; ! while Present (Subp) loop if Is_Overloadable (Subp) then Check_Candidate; *************** package body Sem_Ch4 is *** 6754,6766 **** -- corresponding record (base) type. if Is_Concurrent_Type (Obj_Type) then ! if not Present (Corresponding_Record_Type (Obj_Type)) then ! return False; end if; - Corr_Type := Base_Type (Corresponding_Record_Type (Obj_Type)); - Elmt := First_Elmt (Primitive_Operations (Corr_Type)); - elsif not Is_Generic_Type (Obj_Type) then Corr_Type := Obj_Type; Elmt := First_Elmt (Primitive_Operations (Obj_Type)); --- 7170,7183 ---- -- corresponding record (base) type. if Is_Concurrent_Type (Obj_Type) then ! if Present (Corresponding_Record_Type (Obj_Type)) then ! Corr_Type := Base_Type (Corresponding_Record_Type (Obj_Type)); ! Elmt := First_Elmt (Primitive_Operations (Corr_Type)); ! else ! Corr_Type := Obj_Type; ! Elmt := First_Elmt (Collect_Generic_Type_Ops (Obj_Type)); end if; elsif not Is_Generic_Type (Obj_Type) then Corr_Type := Obj_Type; Elmt := First_Elmt (Primitive_Operations (Obj_Type)); *************** package body Sem_Ch4 is *** 6777,6783 **** and then Present (First_Formal (Prim_Op)) and then Valid_First_Argument_Of (Prim_Op) and then ! (Nkind (Call_Node) = N_Function_Call) = (Ekind (Prim_Op) = E_Function) then -- Ada 2005 (AI-251): If this primitive operation corresponds --- 7194,7200 ---- and then Present (First_Formal (Prim_Op)) and then Valid_First_Argument_Of (Prim_Op) and then ! (Nkind (Call_Node) = N_Function_Call) = (Ekind (Prim_Op) = E_Function) then -- Ada 2005 (AI-251): If this primitive operation corresponds diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch4.ads gcc-4.6.0/gcc/ada/sem_ch4.ads *** gcc-4.5.2/gcc/ada/sem_ch4.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/sem_ch4.ads Thu Oct 21 10:14:06 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch4 is *** 30,45 **** --- 30,48 ---- procedure Analyze_Allocator (N : Node_Id); procedure Analyze_Arithmetic_Op (N : Node_Id); procedure Analyze_Call (N : Node_Id); + procedure Analyze_Case_Expression (N : Node_Id); procedure Analyze_Comparison_Op (N : Node_Id); procedure Analyze_Concatenation (N : Node_Id); procedure Analyze_Conditional_Expression (N : Node_Id); procedure Analyze_Equality_Op (N : Node_Id); procedure Analyze_Explicit_Dereference (N : Node_Id); + procedure Analyze_Expression_With_Actions (N : Node_Id); procedure Analyze_Logical_Op (N : Node_Id); procedure Analyze_Membership_Op (N : Node_Id); procedure Analyze_Negation (N : Node_Id); procedure Analyze_Null (N : Node_Id); procedure Analyze_Qualified_Expression (N : Node_Id); + procedure Analyze_Quantified_Expression (N : Node_Id); procedure Analyze_Range (N : Node_Id); procedure Analyze_Reference (N : Node_Id); procedure Analyze_Selected_Component (N : Node_Id); *************** package Sem_Ch4 is *** 58,63 **** -- c) A conversion -- d) A slice -- The resolution of the construct requires some semantic information ! -- on the prefix and the indices. end Sem_Ch4; --- 61,66 ---- -- c) A conversion -- d) A slice -- The resolution of the construct requires some semantic information ! -- on the prefix and the indexes. end Sem_Ch4; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch5.adb gcc-4.6.0/gcc/ada/sem_ch5.adb *** gcc-4.5.2/gcc/ada/sem_ch5.adb Wed Jul 29 08:43:58 2009 --- gcc-4.6.0/gcc/ada/sem_ch5.adb Tue Oct 26 13:05:30 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Disp; use Sem_Disp; *** 46,52 **** with Sem_Elab; use Sem_Elab; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; - with Sem_SCIL; use Sem_SCIL; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; --- 46,51 ---- *************** package body Sem_Ch5 is *** 71,82 **** -- messages. This variable is recursively saved on entry to processing the -- construct, and restored on exit. - ----------------------- - -- Local Subprograms -- - ----------------------- - - procedure Analyze_Iteration_Scheme (N : Node_Id); - ------------------------ -- Analyze_Assignment -- ------------------------ --- 70,75 ---- *************** package body Sem_Ch5 is *** 367,373 **** S : Entity_Id; begin ! if Ada_Version >= Ada_05 then -- Handle chains of renamings --- 360,366 ---- S : Entity_Id; begin ! if Ada_Version >= Ada_2005 then -- Handle chains of renamings *************** package body Sem_Ch5 is *** 448,461 **** end if; 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 --- 441,454 ---- end if; return; ! -- Enforce RM 3.9.3 (8): the target of an assignment operation cannot be ! -- abstract. This is only checked when the assignment Comes_From_Source, ! -- because in some cases the expander generates such assignments (such ! -- in the _assign operation for an abstract type). ! elsif Is_Abstract_Type (T1) and then Comes_From_Source (N) then Error_Msg_N ! ("target of assignment operation must not be abstract", Lhs); end if; -- Resolution may have updated the subtype, in case the left-hand *************** package body Sem_Ch5 is *** 593,599 **** -- as well to anonymous access-to-subprogram types that are component -- subtypes or formal parameters. ! if Ada_Version >= Ada_05 and then Is_Access_Type (T1) then if Is_Local_Anonymous_Access (T1) --- 586,592 ---- -- as well to anonymous access-to-subprogram types that are component -- subtypes or formal parameters. ! if Ada_Version >= Ada_2005 and then Is_Access_Type (T1) then if Is_Local_Anonymous_Access (T1) *************** package body Sem_Ch5 is *** 606,612 **** -- Ada 2005 (AI-231): Assignment to not null variable ! if Ada_Version >= Ada_05 and then Can_Never_Be_Null (T1) and then not Assignment_OK (Lhs) then --- 599,605 ---- -- Ada 2005 (AI-231): Assignment to not null variable ! if Ada_Version >= Ada_2005 and then Can_Never_Be_Null (T1) and then not Assignment_OK (Lhs) then *************** package body Sem_Ch5 is *** 650,656 **** or else Nkind (N) /= N_Block_Statement) then -- Assignment verifies that the length of the Lsh and Rhs are equal, ! -- but of course the indices do not have to match. If the right-hand -- side is a type conversion to an unconstrained type, a length check -- is performed on the expression itself during expansion. In rare -- cases, the redundant length check is computed on an index type --- 643,649 ---- or else Nkind (N) /= N_Block_Statement) then -- Assignment verifies that the length of the Lsh and Rhs are equal, ! -- but of course the indexes do not have to match. If the right-hand -- side is a type conversion to an unconstrained type, a length check -- is performed on the expression itself during expansion. In rare -- cases, the redundant length check is computed on an index type *************** package body Sem_Ch5 is *** 669,674 **** --- 662,668 ---- -- checks have been applied. Note_Possible_Modification (Lhs, Sure => True); + Check_Order_Dependence; -- ??? a real accessibility check is needed when ??? *************** package body Sem_Ch5 is *** 693,702 **** and then Nkind (Original_Node (Rhs)) not in N_Op then if Nkind (Lhs) in N_Has_Entity then ! Error_Msg_NE ("?useless assignment of & to itself!", N, Entity (Lhs)); else ! Error_Msg_N ("?useless assignment of object to itself!", N); end if; end if; --- 687,696 ---- and then Nkind (Original_Node (Rhs)) not in N_Op then if Nkind (Lhs) in N_Has_Entity then ! Error_Msg_NE -- CODEFIX ("?useless assignment of & to itself!", N, Entity (Lhs)); else ! Error_Msg_N -- CODEFIX ("?useless assignment of object to itself!", N); end if; end if; *************** package body Sem_Ch5 is *** 948,954 **** -- the case statement has a non static choice. procedure Process_Statements (Alternative : Node_Id); ! -- Analyzes all the statements associated to a case alternative. -- Needed by the generic instantiation below. package Case_Choices_Processing is new --- 942,948 ---- -- the case statement has a non static choice. procedure Process_Statements (Alternative : Node_Id); ! -- Analyzes all the statements associated with a case alternative. -- Needed by the generic instantiation below. package Case_Choices_Processing is new *************** package body Sem_Ch5 is *** 998,1008 **** if Is_Entity_Name (Exp) then Ent := Entity (Exp); ! if Ekind (Ent) = E_Variable ! or else ! Ekind (Ent) = E_In_Out_Parameter ! or else ! Ekind (Ent) = E_Out_Parameter then if List_Length (Choices) = 1 and then Nkind (First (Choices)) in N_Subexpr --- 992,1000 ---- if Is_Entity_Name (Exp) then Ent := Entity (Exp); ! if Ekind_In (Ent, E_Variable, ! E_In_Out_Parameter, ! E_Out_Parameter) then if List_Length (Choices) = 1 and then Nkind (First (Choices)) in N_Subexpr *************** package body Sem_Ch5 is *** 1027,1038 **** Analyze_Statements (Statements (Alternative)); end Process_Statements; - -- Table to record choices. Put after subprograms since we make - -- a call to Number_Of_Choices to get the right number of entries. - - Case_Table : Choice_Table_Type (1 .. Number_Of_Choices (N)); - pragma Warnings (Off, Case_Table); - -- Start of processing for Analyze_Case_Statement begin --- 1019,1024 ---- *************** package body Sem_Ch5 is *** 1105,1112 **** -- Call instantiated Analyze_Choices which does the rest of the work ! Analyze_Choices ! (N, Exp_Type, Case_Table, Last_Choice, Dont_Care, Others_Present); if Exp_Type = Universal_Integer and then not Others_Present then Error_Msg_N ("case on universal integer requires OTHERS choice", Exp); --- 1091,1097 ---- -- Call instantiated Analyze_Choices which does the rest of the work ! Analyze_Choices (N, Exp_Type, Dont_Care, Others_Present); if Exp_Type = Universal_Integer and then not Others_Present then Error_Msg_N ("case on universal integer requires OTHERS choice", Exp); *************** package body Sem_Ch5 is *** 1198,1204 **** else Error_Msg_N ("cannot exit from program unit or accept statement", N); ! exit; end if; end loop; --- 1183,1189 ---- else Error_Msg_N ("cannot exit from program unit or accept statement", N); ! return; end if; end loop; *************** package body Sem_Ch5 is *** 1209,1214 **** --- 1194,1204 ---- Check_Unset_Reference (Cond); end if; + -- Chain exit statement to associated loop entity + + Set_Next_Exit_Statement (N, First_Exit_Statement (Scope_Id)); + Set_First_Exit_Statement (Scope_Id, N); + -- Since the exit may take us out of a loop, any previous assignment -- statement is not useless, so clear last assignment indications. It -- is OK to keep other current values, since if the exit statement *************** package body Sem_Ch5 is *** 1472,1479 **** R_Copy : constant Node_Id := New_Copy_Tree (R); Lo : constant Node_Id := Low_Bound (R); Hi : constant Node_Id := High_Bound (R); ! New_Lo_Bound : Node_Id := Empty; ! New_Hi_Bound : Node_Id := Empty; Typ : Entity_Id; Save_Analysis : Boolean; --- 1462,1469 ---- R_Copy : constant Node_Id := New_Copy_Tree (R); Lo : constant Node_Id := Low_Bound (R); Hi : constant Node_Id := High_Bound (R); ! New_Lo_Bound : Node_Id; ! New_Hi_Bound : Node_Id; Typ : Entity_Id; Save_Analysis : Boolean; *************** package body Sem_Ch5 is *** 1517,1525 **** Analyze_And_Resolve (Original_Bound, Typ); ! Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); -- Normally, the best approach is simply to generate a constant -- declaration that captures the bound. However, there is a nasty --- 1507,1513 ---- Analyze_And_Resolve (Original_Bound, Typ); ! Id := Make_Temporary (Loc, 'S', Original_Bound); -- Normally, the best approach is simply to generate a constant -- declaration that captures the bound. However, there is a nasty *************** package body Sem_Ch5 is *** 1550,1587 **** Object_Definition => New_Occurrence_Of (Typ, Loc), Expression => Relocate_Node (Original_Bound)); ! Insert_Before (Parent (N), Decl); ! Analyze (Decl); Rewrite (Original_Bound, New_Occurrence_Of (Id, Loc)); return Expression (Decl); end if; ! -- Here we make a declaration with a separate assignment statement Decl := Make_Object_Declaration (Loc, Defining_Identifier => Id, Object_Definition => New_Occurrence_Of (Typ, Loc)); - Insert_Before (Parent (N), Decl); - Analyze (Decl); - Assign := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Id, Loc), Expression => Relocate_Node (Original_Bound)); ! -- If the relocated node is a function call then check if some ! -- SCIL node references it and needs readjustment. ! ! if Generate_SCIL ! and then Nkind (Original_Bound) = N_Function_Call ! then ! Adjust_SCIL_Node (Original_Bound, Expression (Assign)); ! end if; ! ! Insert_Before (Parent (N), Assign); ! Analyze (Assign); Rewrite (Original_Bound, New_Occurrence_Of (Id, Loc)); --- 1538,1566 ---- Object_Definition => New_Occurrence_Of (Typ, Loc), Expression => Relocate_Node (Original_Bound)); ! -- Insert declaration at proper place. If loop comes from an ! -- enclosing quantified expression, the insertion point is ! -- arbitrarily far up in the tree. ! ! Insert_Action (Parent (N), Decl); Rewrite (Original_Bound, New_Occurrence_Of (Id, Loc)); return Expression (Decl); end if; ! -- Here we make a declaration with a separate assignment ! -- statement, and insert before loop header. Decl := Make_Object_Declaration (Loc, Defining_Identifier => Id, Object_Definition => New_Occurrence_Of (Typ, Loc)); Assign := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Id, Loc), Expression => Relocate_Node (Original_Bound)); ! Insert_Actions (Parent (N), New_List (Decl, Assign)); Rewrite (Original_Bound, New_Occurrence_Of (Id, Loc)); *************** package body Sem_Ch5 is *** 1718,1730 **** then declare Loc : constant Source_Ptr := Sloc (N); ! Arr : constant Entity_Id := ! Etype (Entity (Prefix (DS))); Indx : constant Entity_Id := Base_Type (Etype (First_Index (Arr))); ! Subt : constant Entity_Id := ! Make_Defining_Identifier ! (Loc, New_Internal_Name ('S')); Decl : Node_Id; begin --- 1697,1706 ---- then declare Loc : constant Source_Ptr := Sloc (N); ! Arr : constant Entity_Id := Etype (Entity (Prefix (DS))); Indx : constant Entity_Id := Base_Type (Etype (First_Index (Arr))); ! Subt : constant Entity_Id := Make_Temporary (Loc, 'S'); Decl : Node_Id; begin *************** package body Sem_Ch5 is *** 1752,1961 **** -- Start of processing for Analyze_Iteration_Scheme begin -- For an infinite loop, there is no iteration scheme if No (N) then return; ! else ! declare ! Cond : constant Node_Id := Condition (N); ! begin ! -- For WHILE loop, verify that the condition is a Boolean ! -- expression and resolve and check it. ! if Present (Cond) then ! Analyze_And_Resolve (Cond, Any_Boolean); ! Check_Unset_Reference (Cond); ! Set_Current_Value_Condition (N); ! return; ! -- Else we have a FOR loop ! else ! declare ! LP : constant Node_Id := Loop_Parameter_Specification (N); ! Id : constant Entity_Id := Defining_Identifier (LP); ! DS : constant Node_Id := Discrete_Subtype_Definition (LP); ! begin ! Enter_Name (Id); ! -- We always consider the loop variable to be referenced, ! -- since the loop may be used just for counting purposes. ! Generate_Reference (Id, N, ' '); ! -- Check for case of loop variable hiding a local ! -- variable (used later on to give a nice warning ! -- if the hidden variable is never assigned). ! declare ! H : constant Entity_Id := Homonym (Id); ! begin ! if Present (H) ! and then Enclosing_Dynamic_Scope (H) = ! Enclosing_Dynamic_Scope (Id) ! and then Ekind (H) = E_Variable ! and then Is_Discrete_Type (Etype (H)) ! then ! Set_Hiding_Loop_Variable (H, Id); ! end if; ! end; ! -- Now analyze the subtype definition. If it is ! -- a range, create temporaries for bounds. ! if Nkind (DS) = N_Range ! and then Expander_Active then ! Process_Bounds (DS); ! else ! Analyze (DS); end if; ! if DS = Error then ! return; ! end if; ! -- The subtype indication may denote the completion ! -- of an incomplete type declaration. ! if Is_Entity_Name (DS) ! and then Present (Entity (DS)) ! and then Is_Type (Entity (DS)) ! and then Ekind (Entity (DS)) = E_Incomplete_Type then Set_Entity (DS, Get_Full_View (Entity (DS))); Set_Etype (DS, Entity (DS)); end if; ! if not Is_Discrete_Type (Etype (DS)) then ! Wrong_Type (DS, Any_Discrete); ! Set_Etype (DS, Any_Type); end if; ! Check_Controlled_Array_Attribute (DS); ! Make_Index (DS, LP); ! Set_Ekind (Id, E_Loop_Parameter); ! Set_Etype (Id, Etype (DS)); ! -- Treat a range as an implicit reference to the type, to ! -- inhibit spurious warnings. ! Generate_Reference (Base_Type (Etype (DS)), N, ' '); ! Set_Is_Known_Valid (Id, True); ! -- The loop is not a declarative part, so the only entity ! -- declared "within" must be frozen explicitly. ! declare ! Flist : constant List_Id := Freeze_Entity (Id, Sloc (N)); ! begin ! if Is_Non_Empty_List (Flist) then ! Insert_Actions (N, Flist); ! end if; ! end; ! -- Check for null or possibly null range and issue warning. ! -- We suppress such messages in generic templates and ! -- instances, because in practice they tend to be dubious ! -- in these cases. ! if Nkind (DS) = N_Range ! and then Comes_From_Source (N) ! then ! declare ! L : constant Node_Id := Low_Bound (DS); ! H : constant Node_Id := High_Bound (DS); ! begin ! -- If range of loop is null, issue warning ! if Compile_Time_Compare ! (L, H, Assume_Valid => True) = GT then ! -- Suppress the warning if inside a generic ! -- template or instance, since in practice ! -- they tend to be dubious in these cases since ! -- they can result from intended parametrization. ! if not Inside_A_Generic ! and then not In_Instance then ! -- Specialize msg if invalid values could make ! -- the loop non-null after all. ! ! if Compile_Time_Compare ! (L, H, Assume_Valid => False) = GT ! then ! Error_Msg_N ! ("?loop range is null, " ! & "loop will not execute", ! DS); ! -- Since we know the range of the loop is ! -- null, set the appropriate flag to remove ! -- the loop entirely during expansion. ! Set_Is_Null_Loop (Parent (N)); -- Here is where the loop could execute because -- of invalid values, so issue appropriate -- message and in this case we do not set the -- Is_Null_Loop flag since the loop may execute. ! else ! Error_Msg_N ! ("?loop range may be null, " ! & "loop may not execute", ! DS); ! Error_Msg_N ! ("?can only execute if invalid values " ! & "are present", ! DS); ! end if; end if; ! -- In either case, suppress warnings in the body of ! -- the loop, since it is likely that these warnings ! -- will be inappropriate if the loop never actually ! -- executes, which is unlikely. ! Set_Suppress_Loop_Warnings (Parent (N)); -- The other case for a warning is a reverse loop ! -- where the upper bound is the integer literal ! -- zero or one, and the lower bound can be positive. -- For example, we have -- for J in reverse N .. 1 loop ! -- In practice, this is very likely to be a case ! -- of reversing the bounds incorrectly in the range. ! elsif Reverse_Present (LP) ! and then Nkind (Original_Node (H)) = ! N_Integer_Literal ! and then (Intval (Original_Node (H)) = Uint_0 ! or else Intval (Original_Node (H)) = Uint_1) ! then ! Error_Msg_N ("?loop range may be null", DS); ! Error_Msg_N ("\?bounds may be wrong way round", DS); ! end if; ! end; ! end if; ! end; ! end if; ! end; ! end if; end Analyze_Iteration_Scheme; ------------------- -- Analyze_Label -- ------------------- --- 1728,2059 ---- -- Start of processing for Analyze_Iteration_Scheme begin + -- If this is a rewritten quantified expression, the iteration + -- scheme has been analyzed already. Do no repeat analysis because + -- the loop variable is already declared. + + if Analyzed (N) then + return; + end if; + -- For an infinite loop, there is no iteration scheme if No (N) then return; + end if; ! -- Iteration scheme is present ! declare ! Cond : constant Node_Id := Condition (N); ! begin ! -- For WHILE loop, verify that the condition is a Boolean ! -- expression and resolve and check it. ! if Present (Cond) then ! Analyze_And_Resolve (Cond, Any_Boolean); ! Check_Unset_Reference (Cond); ! Set_Current_Value_Condition (N); ! return; ! elsif Present (Iterator_Specification (N)) then ! Analyze_Iterator_Specification (Iterator_Specification (N)); ! -- Else we have a FOR loop ! else ! declare ! LP : constant Node_Id := Loop_Parameter_Specification (N); ! Id : constant Entity_Id := Defining_Identifier (LP); ! DS : constant Node_Id := Discrete_Subtype_Definition (LP); ! begin ! Enter_Name (Id); ! -- We always consider the loop variable to be referenced, ! -- since the loop may be used just for counting purposes. ! Generate_Reference (Id, N, ' '); ! -- Check for the case of loop variable hiding a local variable ! -- (used later on to give a nice warning if the hidden variable ! -- is never assigned). ! declare ! H : constant Entity_Id := Homonym (Id); ! begin ! if Present (H) ! and then Enclosing_Dynamic_Scope (H) = ! Enclosing_Dynamic_Scope (Id) ! and then Ekind (H) = E_Variable ! and then Is_Discrete_Type (Etype (H)) then ! Set_Hiding_Loop_Variable (H, Id); end if; + end; ! -- Now analyze the subtype definition. If it is a range, create ! -- temporaries for bounds. ! if Nkind (DS) = N_Range ! and then Expander_Active ! then ! Process_Bounds (DS); ! -- Not a range or expander not active (is that right???) ! ! else ! Analyze (DS); ! ! if Nkind (DS) = N_Function_Call ! or else ! (Is_Entity_Name (DS) ! and then not Is_Type (Entity (DS))) then + -- This is an iterator specification. Rewrite as such + -- and analyze. + + declare + I_Spec : constant Node_Id := + Make_Iterator_Specification (Sloc (LP), + Defining_Identifier => + Relocate_Node (Id), + Name => + Relocate_Node (DS), + Subtype_Indication => + Empty, + Reverse_Present => + Reverse_Present (LP)); + begin + Set_Iterator_Specification (N, I_Spec); + Set_Loop_Parameter_Specification (N, Empty); + Analyze_Iterator_Specification (I_Spec); + return; + end; + end if; + end if; + + if DS = Error then + return; + end if; + + -- Some additional checks if we are iterating through a type + + if Is_Entity_Name (DS) + and then Present (Entity (DS)) + and then Is_Type (Entity (DS)) + then + -- The subtype indication may denote the completion of an + -- incomplete type declaration. + + if Ekind (Entity (DS)) = E_Incomplete_Type then Set_Entity (DS, Get_Full_View (Entity (DS))); Set_Etype (DS, Entity (DS)); end if; ! -- Attempt to iterate through non-static predicate ! ! if Is_Discrete_Type (Entity (DS)) ! and then Present (Predicate_Function (Entity (DS))) ! and then No (Static_Predicate (Entity (DS))) ! then ! Bad_Predicated_Subtype_Use ! ("cannot use subtype& with non-static " ! & "predicate for loop iteration", DS, Entity (DS)); end if; + end if; ! -- Error if not discrete type ! if not Is_Discrete_Type (Etype (DS)) then ! Wrong_Type (DS, Any_Discrete); ! Set_Etype (DS, Any_Type); ! end if; ! Check_Controlled_Array_Attribute (DS); ! Make_Index (DS, LP); ! Set_Ekind (Id, E_Loop_Parameter); ! Set_Etype (Id, Etype (DS)); ! -- Treat a range as an implicit reference to the type, to ! -- inhibit spurious warnings. ! Generate_Reference (Base_Type (Etype (DS)), N, ' '); ! Set_Is_Known_Valid (Id, True); ! -- The loop is not a declarative part, so the only entity ! -- declared "within" must be frozen explicitly. ! declare ! Flist : constant List_Id := Freeze_Entity (Id, N); ! begin ! if Is_Non_Empty_List (Flist) then ! Insert_Actions (N, Flist); ! end if; ! end; ! -- Check for null or possibly null range and issue warning. We ! -- suppress such messages in generic templates and instances, ! -- because in practice they tend to be dubious in these cases. ! if Nkind (DS) = N_Range and then Comes_From_Source (N) then ! declare ! L : constant Node_Id := Low_Bound (DS); ! H : constant Node_Id := High_Bound (DS); ! ! begin ! -- If range of loop is null, issue warning ! ! if Compile_Time_Compare ! (L, H, Assume_Valid => True) = GT ! then ! -- Suppress the warning if inside a generic template ! -- or instance, since in practice they tend to be ! -- dubious in these cases since they can result from ! -- intended parametrization. ! ! if not Inside_A_Generic ! and then not In_Instance then ! -- Specialize msg if invalid values could make ! -- the loop non-null after all. ! if Compile_Time_Compare ! (L, H, Assume_Valid => False) = GT then ! Error_Msg_N ! ("?loop range is null, loop will not execute", ! DS); ! -- Since we know the range of the loop is ! -- null, set the appropriate flag to remove ! -- the loop entirely during expansion. ! Set_Is_Null_Loop (Parent (N)); -- Here is where the loop could execute because -- of invalid values, so issue appropriate -- message and in this case we do not set the -- Is_Null_Loop flag since the loop may execute. ! else ! Error_Msg_N ! ("?loop range may be null, " ! & "loop may not execute", ! DS); ! Error_Msg_N ! ("?can only execute if invalid values " ! & "are present", ! DS); end if; + end if; ! -- In either case, suppress warnings in the body of ! -- the loop, since it is likely that these warnings ! -- will be inappropriate if the loop never actually ! -- executes, which is likely. ! Set_Suppress_Loop_Warnings (Parent (N)); -- The other case for a warning is a reverse loop ! -- where the upper bound is the integer literal zero ! -- or one, and the lower bound can be positive. -- For example, we have -- for J in reverse N .. 1 loop ! -- In practice, this is very likely to be a case of ! -- reversing the bounds incorrectly in the range. ! elsif Reverse_Present (LP) ! and then Nkind (Original_Node (H)) = ! N_Integer_Literal ! and then (Intval (Original_Node (H)) = Uint_0 ! or else Intval (Original_Node (H)) = Uint_1) ! then ! Error_Msg_N ("?loop range may be null", DS); ! Error_Msg_N ("\?bounds may be wrong way round", DS); ! end if; ! end; ! end if; ! end; ! end if; ! end; end Analyze_Iteration_Scheme; + ------------------------------------- + -- Analyze_Iterator_Specification -- + ------------------------------------- + + procedure Analyze_Iterator_Specification (N : Node_Id) is + Def_Id : constant Node_Id := Defining_Identifier (N); + Subt : constant Node_Id := Subtype_Indication (N); + Container : constant Node_Id := Name (N); + + Ent : Entity_Id; + Typ : Entity_Id; + + begin + Enter_Name (Def_Id); + Set_Ekind (Def_Id, E_Variable); + + if Present (Subt) then + Analyze (Subt); + end if; + + Analyze_And_Resolve (Container); + Typ := Etype (Container); + + if Is_Array_Type (Typ) then + if Of_Present (N) then + Set_Etype (Def_Id, Component_Type (Typ)); + else + Error_Msg_N + ("to iterate over the elements of an array, use OF", N); + Set_Etype (Def_Id, Etype (First_Index (Typ))); + end if; + + -- Iteration over a container + + else + Set_Ekind (Def_Id, E_Loop_Parameter); + + if Of_Present (N) then + + -- Find the Element_Type in the package instance that defines the + -- container type. + + Ent := First_Entity (Scope (Typ)); + while Present (Ent) loop + if Chars (Ent) = Name_Element_Type then + Set_Etype (Def_Id, Ent); + exit; + end if; + + Next_Entity (Ent); + end loop; + + else + -- Find the Cursor type in similar fashion + + Ent := First_Entity (Scope (Typ)); + while Present (Ent) loop + if Chars (Ent) = Name_Cursor then + Set_Etype (Def_Id, Ent); + exit; + end if; + + Next_Entity (Ent); + end loop; + end if; + end if; + end Analyze_Iterator_Specification; + ------------------- -- Analyze_Label -- ------------------- *************** package body Sem_Ch5 is *** 2060,2067 **** End_Scope; Kill_Current_Values; ! -- Check for infinite loop. We skip this check for generated code, since ! -- it justs waste time and makes debugging the routine called harder. if Comes_From_Source (N) then Check_Infinite_Loop_Warning (N); --- 2158,2169 ---- End_Scope; Kill_Current_Values; ! -- Check for infinite loop. Skip check for generated code, since it ! -- justs waste time and makes debugging the routine called harder. ! ! -- Note that we have to wait till the body of the loop is fully analyzed ! -- before making this call, since Check_Infinite_Loop_Warning relies on ! -- being able to use semantic visibility information to find references. if Comes_From_Source (N) then Check_Infinite_Loop_Warning (N); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch5.ads gcc-4.6.0/gcc/ada/sem_ch5.ads *** gcc-4.5.2/gcc/ada/sem_ch5.ads Tue Apr 8 06:50:04 2008 --- gcc-4.6.0/gcc/ada/sem_ch5.ads Fri Oct 22 09:36:41 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch5 is *** 34,39 **** --- 34,41 ---- procedure Analyze_Goto_Statement (N : Node_Id); procedure Analyze_If_Statement (N : Node_Id); procedure Analyze_Implicit_Label_Declaration (N : Node_Id); + procedure Analyze_Iterator_Specification (N : Node_Id); + procedure Analyze_Iteration_Scheme (N : Node_Id); procedure Analyze_Label (N : Node_Id); procedure Analyze_Loop_Statement (N : Node_Id); procedure Analyze_Null_Statement (N : Node_Id); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch6.adb gcc-4.6.0/gcc/ada/sem_ch6.adb *** gcc-4.5.2/gcc/ada/sem_ch6.adb Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/sem_ch6.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Checks; use Checks; with Debug; use Debug; *************** with Sem_Ch5; use Sem_Ch5; *** 59,64 **** --- 60,66 ---- with Sem_Ch8; use Sem_Ch8; with Sem_Ch10; use Sem_Ch10; with Sem_Ch12; use Sem_Ch12; + with Sem_Ch13; use Sem_Ch13; with Sem_Disp; use Sem_Disp; with Sem_Dist; use Sem_Dist; with Sem_Elim; use Sem_Elim; *************** package body Sem_Ch6 is *** 98,104 **** ----------------------- procedure Analyze_Return_Statement (N : Node_Id); ! -- Common processing for simple_ and extended_return_statements procedure Analyze_Function_Return (N : Node_Id); -- Subsidiary to Analyze_Return_Statement. Called when the return statement --- 100,106 ---- ----------------------- procedure Analyze_Return_Statement (N : Node_Id); ! -- Common processing for simple and extended return statements procedure Analyze_Function_Return (N : Node_Id); -- Subsidiary to Analyze_Return_Statement. Called when the return statement *************** package body Sem_Ch6 is *** 106,116 **** procedure Analyze_Return_Type (N : Node_Id); -- Subsidiary to Process_Formals: analyze subtype mark in function ! -- specification, in a context where the formals are visible and hide -- outer homographs. procedure Analyze_Subprogram_Body_Helper (N : Node_Id); ! -- Does all the real work of Analyze_Subprogram_Body procedure Analyze_Generic_Subprogram_Body (N : Node_Id; Gen_Id : Entity_Id); -- Analyze a generic subprogram body. N is the body to be analyzed, and --- 108,119 ---- procedure Analyze_Return_Type (N : Node_Id); -- Subsidiary to Process_Formals: analyze subtype mark in function ! -- specification in a context where the formals are visible and hide -- outer homographs. procedure Analyze_Subprogram_Body_Helper (N : Node_Id); ! -- Does all the real work of Analyze_Subprogram_Body. This is split out so ! -- that we can use RETURN but not skip the debug output at the end. procedure Analyze_Generic_Subprogram_Body (N : Node_Id; Gen_Id : Entity_Id); -- Analyze a generic subprogram body. N is the body to be analyzed, and *************** package body Sem_Ch6 is *** 165,176 **** -- True otherwise. Proc is the entity for the procedure case and is used -- in posting the warning message. procedure Enter_Overloaded_Entity (S : Entity_Id); -- This procedure makes S, a new overloaded entity, into the first visible -- entity with that name. procedure Install_Entity (E : Entity_Id); ! -- Make single entity visible. Used for generic formals as well function Is_Non_Overriding_Operation (Prev_E : Entity_Id; --- 168,186 ---- -- True otherwise. Proc is the entity for the procedure case and is used -- in posting the warning message. + procedure Check_Untagged_Equality (Eq_Op : Entity_Id); + -- In Ada 2012, a primitive equality operator on an untagged record type + -- must appear before the type is frozen, and have the same visibility as + -- that of the type. This procedure checks that this rule is met, and + -- otherwise emits an error on the subprogram declaration and a warning + -- on the earlier freeze point if it is easy to locate. + procedure Enter_Overloaded_Entity (S : Entity_Id); -- This procedure makes S, a new overloaded entity, into the first visible -- entity with that name. procedure Install_Entity (E : Entity_Id); ! -- Make single entity visible (used for generic formals as well) function Is_Non_Overriding_Operation (Prev_E : Entity_Id; *************** package body Sem_Ch6 is *** 197,203 **** -- 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 --- 207,214 ---- -- 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). Note that invariants and predicates may also ! -- provide postconditions, and are also handled in this procedure. procedure Set_Formal_Validity (Formal_Id : Entity_Id); -- Formal_Id is an formal parameter entity. This procedure deals with *************** package body Sem_Ch6 is *** 363,369 **** elsif Warn_On_Redundant_Constructs and then not Is_Dispatching_Operation (Designator) ! and then not Is_Overriding_Operation (Designator) and then (not Is_Operator_Symbol_Name (Chars (Designator)) or else Scop /= Scope (Etype (First_Formal (Designator)))) then --- 374,380 ---- elsif Warn_On_Redundant_Constructs and then not Is_Dispatching_Operation (Designator) ! and then not Present (Overridden_Operation (Designator)) and then (not Is_Operator_Symbol_Name (Chars (Designator)) or else Scop /= Scope (Etype (First_Formal (Designator)))) then *************** package body Sem_Ch6 is *** 373,378 **** --- 384,390 ---- Generate_Reference_To_Formals (Designator); Check_Eliminated (Designator); + Analyze_Aspect_Specifications (N, Designator, Aspect_Specifications (N)); end Analyze_Abstract_Subprogram_Declaration; ---------------------------------------- *************** package body Sem_Ch6 is *** 468,481 **** then -- Error in Ada 2005 ! if Ada_Version >= Ada_05 and then not Debug_Flag_Dot_L and then not GNAT_Mode then Error_Msg_N ("(Ada 2005) cannot copy object of a limited type " & "(RM-2005 6.5(5.5/2))", Expr); ! if Is_Inherently_Limited_Type (R_Type) then Error_Msg_N ("\return by reference not permitted in Ada 2005", Expr); end if; --- 480,494 ---- then -- Error in Ada 2005 ! if Ada_Version >= Ada_2005 and then not Debug_Flag_Dot_L and then not GNAT_Mode then Error_Msg_N ("(Ada 2005) cannot copy object of a limited type " & "(RM-2005 6.5(5.5/2))", Expr); ! ! if Is_Immutably_Limited_Type (R_Type) then Error_Msg_N ("\return by reference not permitted in Ada 2005", Expr); end if; *************** package body Sem_Ch6 is *** 486,500 **** -- In GNAT mode, this is just a warning, to allow it to be -- evilly turned off. Otherwise it is a real error. elsif Warn_On_Ada_2005_Compatibility or GNAT_Mode then ! if Is_Inherently_Limited_Type (R_Type) then Error_Msg_N ! ("return by reference not permitted in Ada 2005 " & ! "(RM-2005 6.5(5.5/2))?", Expr); else Error_Msg_N ! ("cannot copy object of a limited type in Ada 2005 " & ! "(RM-2005 6.5(5.5/2))?", Expr); end if; -- Ada 95 mode, compatibility warnings disabled --- 499,521 ---- -- In GNAT mode, this is just a warning, to allow it to be -- evilly turned off. Otherwise it is a real error. + -- In a generic context, simplify the warning because it makes + -- no sense to discuss pass-by-reference or copy. + elsif Warn_On_Ada_2005_Compatibility or GNAT_Mode then ! if Inside_A_Generic then Error_Msg_N ! ("return of limited object not permitted in Ada2005 " ! & "(RM-2005 6.5(5.5/2))?", Expr); ! ! elsif Is_Immutably_Limited_Type (R_Type) then ! Error_Msg_N ! ("return by reference not permitted in Ada 2005 " ! & "(RM-2005 6.5(5.5/2))?", Expr); else Error_Msg_N ! ("cannot copy object of a limited type in Ada 2005 " ! & "(RM-2005 6.5(5.5/2))?", Expr); end if; -- Ada 95 mode, compatibility warnings disabled *************** package body Sem_Ch6 is *** 503,511 **** return; -- skip continuation messages below end if; ! Error_Msg_N ! ("\consider switching to return of access type", Expr); ! Explain_Limited_Type (R_Type, Expr); end if; end Check_Limited_Return; --- 524,534 ---- return; -- skip continuation messages below end if; ! if not Inside_A_Generic then ! Error_Msg_N ! ("\consider switching to return of access type", Expr); ! Explain_Limited_Type (R_Type, Expr); ! end if; end if; end Check_Limited_Return; *************** package body Sem_Ch6 is *** 514,523 **** ------------------------------------- procedure Check_Return_Subtype_Indication (Obj_Decl : Node_Id) is ! Return_Obj : constant Node_Id := Defining_Identifier (Obj_Decl); ! R_Stm_Type : constant Entity_Id := Etype (Return_Obj); ! -- Subtype given in the extended return statement; ! -- this must match R_Type. Subtype_Ind : constant Node_Id := Object_Definition (Original_Node (Obj_Decl)); --- 537,546 ---- ------------------------------------- procedure Check_Return_Subtype_Indication (Obj_Decl : Node_Id) is ! Return_Obj : constant Node_Id := Defining_Identifier (Obj_Decl); ! ! R_Stm_Type : constant Entity_Id := Etype (Return_Obj); ! -- Subtype given in the extended return statement (must match R_Type) Subtype_Ind : constant Node_Id := Object_Definition (Original_Node (Obj_Decl)); *************** package body Sem_Ch6 is *** 542,548 **** -- True if type of the return object is an anonymous access type begin ! -- First, avoid cascade errors: if Error_Posted (Obj_Decl) or else Error_Posted (Subtype_Ind) then return; --- 565,571 ---- -- True if type of the return object is an anonymous access type begin ! -- First, avoid cascaded errors if Error_Posted (Obj_Decl) or else Error_Posted (Subtype_Ind) then return; *************** package body Sem_Ch6 is *** 612,618 **** Subtype_Ind); end if; ! if Is_Constrained (R_Type) then if not Subtypes_Statically_Match (R_Stm_Type, R_Type) then Error_Msg_N ("subtype must statically match function result subtype", --- 635,645 ---- Subtype_Ind); end if; ! -- AI05-103: for elementary types, subtypes must statically match ! ! if Is_Constrained (R_Type) ! or else Is_Access_Type (R_Type) ! then if not Subtypes_Statically_Match (R_Stm_Type, R_Type) then Error_Msg_N ("subtype must statically match function result subtype", *************** package body Sem_Ch6 is *** 710,716 **** -- type, apply an implicit conversion of the expression to that type -- to force appropriate static and run-time accessibility checks. ! if Ada_Version >= Ada_05 and then Ekind (R_Type) = E_Anonymous_Access_Type then Rewrite (Expr, Convert_To (R_Type, Relocate_Node (Expr))); --- 737,743 ---- -- type, apply an implicit conversion of the expression to that type -- to force appropriate static and run-time accessibility checks. ! if Ada_Version >= Ada_2005 and then Ekind (R_Type) = E_Anonymous_Access_Type then Rewrite (Expr, Convert_To (R_Type, Relocate_Node (Expr))); *************** package body Sem_Ch6 is *** 721,727 **** -- 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)) > --- 748,754 ---- -- expression's type is not declared at a deeper level than the -- function (RM05-6.5(5.6/2)). ! if Ada_Version >= Ada_2005 and then Is_Class_Wide_Type (R_Type) then if Type_Access_Level (Etype (Expr)) > *************** package body Sem_Ch6 is *** 746,766 **** -- involving dereferences of access parameters. For now we just -- check the static cases. ! if (Ada_Version < Ada_05 or else Debug_Flag_Dot_L) ! and then Is_Inherently_Limited_Type (Etype (Scope_Id)) and then Object_Access_Level (Expr) > Subprogram_Access_Level (Scope_Id) then - Rewrite (N, - Make_Raise_Program_Error (Loc, - Reason => PE_Accessibility_Check_Failed)); - Analyze (N); ! Error_Msg_N ! ("cannot return a local value by reference?", N); ! Error_Msg_NE ! ("\& will be raised at run time?", ! N, Standard_Program_Error); end if; if Known_Null (Expr) --- 773,802 ---- -- involving dereferences of access parameters. For now we just -- check the static cases. ! if (Ada_Version < Ada_2005 or else Debug_Flag_Dot_L) ! and then Is_Immutably_Limited_Type (Etype (Scope_Id)) and then Object_Access_Level (Expr) > Subprogram_Access_Level (Scope_Id) then ! -- Suppress the message in a generic, where the rewriting ! -- is irrelevant. ! ! if Inside_A_Generic then ! null; ! ! else ! Rewrite (N, ! Make_Raise_Program_Error (Loc, ! Reason => PE_Accessibility_Check_Failed)); ! Analyze (N); ! ! Error_Msg_N ! ("cannot return a local value by reference?", N); ! Error_Msg_NE ! ("\& will be raised at run time?", ! N, Standard_Program_Error); ! end if; end if; if Known_Null (Expr) *************** package body Sem_Ch6 is *** 773,778 **** --- 809,818 ---- & "null-excluding return?", Reason => CE_Null_Not_Allowed); end if; + + -- Apply checks suggested by AI05-0144 (dangerous order dependence) + + Check_Order_Dependence; end if; end Analyze_Function_Return; *************** package body Sem_Ch6 is *** 978,983 **** --- 1018,1024 ---- if Style_Check then Style.Check_Identifier (Body_Id, Gen_Id); end if; + End_Generic; end Analyze_Generic_Subprogram_Body; *************** package body Sem_Ch6 is *** 1024,1029 **** --- 1065,1095 ---- Analyze (Explicit_Actual_Parameter (N)); end Analyze_Parameter_Association; + -------------------------------------- + -- Analyze_Parameterized_Expression -- + -------------------------------------- + + procedure Analyze_Parameterized_Expression (N : Node_Id) is + Loc : constant Source_Ptr := Sloc (N); + LocX : constant Source_Ptr := Sloc (Expression (N)); + + begin + -- This is one of the occasions on which we write things during semantic + -- analysis. Transform the parameterized expression into an equivalent + -- subprogram body, and then analyze that. + + Rewrite (N, + Make_Subprogram_Body (Loc, + Specification => Specification (N), + Declarations => Empty_List, + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (LocX, + Statements => New_List ( + Make_Simple_Return_Statement (LocX, + Expression => Expression (N)))))); + Analyze (N); + end Analyze_Parameterized_Expression; + ---------------------------- -- Analyze_Procedure_Call -- ---------------------------- *************** package body Sem_Ch6 is *** 1037,1042 **** --- 1103,1109 ---- procedure Analyze_Call_And_Resolve; -- Do Analyze and Resolve calls for procedure call + -- At end, check illegal order dependence. ------------------------------ -- Analyze_Call_And_Resolve -- *************** package body Sem_Ch6 is *** 1047,1052 **** --- 1114,1124 ---- if Nkind (N) = N_Procedure_Call_Statement then Analyze_Call (N); Resolve (N, Standard_Void_Type); + + -- Apply checks suggested by AI05-0144 + + Check_Order_Dependence; + else Analyze (N); end if; *************** package body Sem_Ch6 is *** 1074,1082 **** return; end if; ! -- If error analyzing prefix, then set Any_Type as result and return ! if Etype (P) = Any_Type then Set_Etype (N, Any_Type); return; end if; --- 1146,1158 ---- return; end if; ! -- If there is an error analyzing the name (which may have been ! -- rewritten if the original call was in prefix notation) then error ! -- has been emitted already, mark node and return. ! if Error_Posted (N) ! or else Etype (Name (N)) = Any_Type ! then Set_Etype (N, Any_Type); return; end if; *************** package body Sem_Ch6 is *** 1359,1366 **** and then Ekind (Root_Type (Typ)) = E_Incomplete_Type) then ! Error_Msg_NE ! ("invalid use of incomplete type&", Designator, Typ); end if; end if; --- 1435,1461 ---- and then Ekind (Root_Type (Typ)) = E_Incomplete_Type) then ! -- AI05-0151: Tagged incomplete types are allowed in all formal ! -- parts. Untagged incomplete types are not allowed in bodies. ! ! if Ada_Version >= Ada_2012 then ! if Is_Tagged_Type (Typ) then ! null; ! ! elsif Nkind_In (Parent (Parent (N)), ! N_Accept_Statement, ! N_Entry_Body, ! N_Subprogram_Body) ! then ! Error_Msg_NE ! ("invalid use of untagged incomplete type&", ! Designator, Typ); ! end if; ! ! else ! Error_Msg_NE ! ("invalid use of incomplete type&", Designator, Typ); ! end if; end if; end if; *************** package body Sem_Ch6 is *** 1424,1430 **** Prev_Id : constant Entity_Id := Current_Entity_In_Scope (Body_Id); Conformant : Boolean; HSS : Node_Id; - Missing_Ret : Boolean; P_Ent : Entity_Id; Prot_Typ : Entity_Id := Empty; Spec_Id : Entity_Id; --- 1519,1524 ---- *************** package body Sem_Ch6 is *** 1466,1471 **** --- 1560,1569 ---- -- If pragma does not appear after the body, check whether there is -- an inline pragma before any local declarations. + procedure Check_Missing_Return; + -- Checks for a function with a no return statements, and also performs + -- the warning checks implemented by Check_Returns. + function Disambiguate_Spec return Entity_Id; -- When a primitive is declared between the private view and the full -- view of a concurrent type which implements an interface, a special *************** package body Sem_Ch6 is *** 1618,1626 **** if Present (Prag) then if Present (Spec_Id) then ! if List_Containing (N) = ! List_Containing (Unit_Declaration_Node (Spec_Id)) ! then Analyze (Prag); end if; --- 1716,1722 ---- if Present (Prag) then if Present (Spec_Id) then ! if In_Same_List (N, Unit_Declaration_Node (Spec_Id)) then Analyze (Prag); end if; *************** package body Sem_Ch6 is *** 1629,1638 **** declare Subp : constant Entity_Id := ! Make_Defining_Identifier (Loc, Chars (Body_Id)); Decl : constant Node_Id := ! Make_Subprogram_Declaration (Loc, ! Specification => New_Copy_Tree (Specification (N))); begin Set_Defining_Unit_Name (Specification (Decl), Subp); --- 1725,1736 ---- declare Subp : constant Entity_Id := ! Make_Defining_Identifier (Loc, Chars (Body_Id)); Decl : constant Node_Id := ! Make_Subprogram_Declaration (Loc, ! Specification => ! New_Copy_Tree (Specification (N))); ! begin Set_Defining_Unit_Name (Specification (Decl), Subp); *************** package body Sem_Ch6 is *** 1658,1663 **** --- 1756,1801 ---- end if; end Check_Inline_Pragma; + -------------------------- + -- Check_Missing_Return -- + -------------------------- + + procedure Check_Missing_Return is + Id : Entity_Id; + Missing_Ret : Boolean; + + begin + if Nkind (Body_Spec) = N_Function_Specification then + if Present (Spec_Id) then + Id := Spec_Id; + else + Id := Body_Id; + end if; + + if Return_Present (Id) then + Check_Returns (HSS, 'F', Missing_Ret); + + if Missing_Ret then + Set_Has_Missing_Return (Id); + end if; + + elsif (Is_Generic_Subprogram (Id) + or else not Is_Machine_Code_Subprogram (Id)) + and then not Body_Deleted + then + Error_Msg_N ("missing RETURN statement in function body", N); + end if; + + -- If procedure with No_Return, check returns + + elsif Nkind (Body_Spec) = N_Procedure_Specification + and then Present (Spec_Id) + and then No_Return (Spec_Id) + then + Check_Returns (HSS, 'P', Missing_Ret, Spec_Id); + end if; + end Check_Missing_Return; + ----------------------- -- Disambiguate_Spec -- ----------------------- *************** package body Sem_Ch6 is *** 1822,1834 **** 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 Error_Msg_NE ("subprogram& overrides inherited operation", Body_Spec, Spec_Id); --- 1960,1972 ---- then null; ! elsif not Present (Overridden_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 Present (Overridden_Operation (Spec_Id)) then Error_Msg_NE ("subprogram& overrides inherited operation", Body_Spec, Spec_Id); *************** package body Sem_Ch6 is *** 1846,1858 **** elsif not Is_Primitive (Spec_Id) and then Ekind (Scope (Spec_Id)) /= E_Protected_Type then ! Error_Msg_N ("overriding indicator only allowed " & ! "if subprogram is primitive", ! Body_Spec); end if; elsif Style_Check -- ??? incorrect use of Style_Check! ! and then Is_Overriding_Operation (Spec_Id) then pragma Assert (Unit_Declaration_Node (Body_Id) = N); Style.Missing_Overriding (N, Body_Id); --- 1984,1997 ---- elsif not Is_Primitive (Spec_Id) and then Ekind (Scope (Spec_Id)) /= E_Protected_Type then ! Error_Msg_N ! ("overriding indicator only allowed " & ! "if subprogram is primitive", ! Body_Spec); end if; elsif Style_Check -- ??? incorrect use of Style_Check! ! and then Present (Overridden_Operation (Spec_Id)) then pragma Assert (Unit_Declaration_Node (Body_Id) = N); Style.Missing_Overriding (N, Body_Id); *************** package body Sem_Ch6 is *** 1881,1886 **** --- 2020,2031 ---- Set_Is_Child_Unit (Body_Id, Is_Child_Unit (Spec_Id)); Analyze_Generic_Subprogram_Body (N, Spec_Id); + + if Nkind (N) = N_Subprogram_Body then + HSS := Handled_Statement_Sequence (N); + Check_Missing_Return; + end if; + return; else *************** package body Sem_Ch6 is *** 2022,2035 **** -- why, to be investigated further??? Set_Has_Delayed_Freeze (Spec_Id); ! Insert_Actions (N, Freeze_Entity (Spec_Id, Loc)); end if; end if; ! -- Mark presence of postcondition proc in current scope if Chars (Body_Id) = Name_uPostconditions then Set_Has_Postconditions (Current_Scope); end if; -- Place subprogram on scope stack, and make formals visible. If there --- 2167,2183 ---- -- why, to be investigated further??? Set_Has_Delayed_Freeze (Spec_Id); ! Freeze_Before (N, Spec_Id); end if; end if; ! -- Mark presence of postcondition procedure in current scope and mark ! -- the procedure itself as needing debug info. The latter is important ! -- when analyzing decision coverage (for example, for MC/DC coverage). if Chars (Body_Id) = Name_uPostconditions then Set_Has_Postconditions (Current_Scope); + Set_Debug_Info_Needed (Body_Id); end if; -- Place subprogram on scope stack, and make formals visible. If there *************** package body Sem_Ch6 is *** 2079,2084 **** --- 2227,2241 ---- then Conformant := True; + -- Conversely, the spec may have been generated for specless body + -- with an inline pragma. + + elsif Comes_From_Source (N) + and then not Comes_From_Source (Spec_Id) + and then Has_Pragma_Inline (Spec_Id) + then + Conformant := True; + else Check_Conformance (Body_Id, Spec_Id, *************** package body Sem_Ch6 is *** 2169,2178 **** --- 2326,2348 ---- -- Case of subprogram body with no previous spec else + -- Check for style warning required + if Style_Check + + -- Only apply check for source level subprograms for which checks + -- have not been suppressed. + and then Comes_From_Source (Body_Id) and then not Suppress_Style_Checks (Body_Id) + + -- No warnings within an instance + and then not In_Instance + + -- No warnings for parameterized expressions + + and then Nkind (Original_Node (N)) /= N_Parameterized_Expression then Style.Body_With_No_Spec (N); end if; *************** package body Sem_Ch6 is *** 2194,2200 **** -- is the limited view of a class-wide type and the non-limited view is -- available, update the return type accordingly. ! if Ada_Version >= Ada_05 and then Comes_From_Source (N) then declare --- 2364,2370 ---- -- is the limited view of a class-wide type and the non-limited view is -- available, update the return type accordingly. ! if Ada_Version >= Ada_2005 and then Comes_From_Source (N) then declare *************** package body Sem_Ch6 is *** 2407,2447 **** end if; end if; ! -- If function, check return statements ! ! if Nkind (Body_Spec) = N_Function_Specification then ! declare ! Id : Entity_Id; ! ! begin ! if Present (Spec_Id) then ! Id := Spec_Id; ! else ! Id := Body_Id; ! end if; ! ! if Return_Present (Id) then ! Check_Returns (HSS, 'F', Missing_Ret); ! ! if Missing_Ret then ! Set_Has_Missing_Return (Id); ! end if; ! ! elsif not Is_Machine_Code_Subprogram (Id) ! and then not Body_Deleted ! then ! Error_Msg_N ("missing RETURN statement in function body", N); ! end if; ! end; ! ! -- If procedure with No_Return, check returns ! ! elsif Nkind (Body_Spec) = N_Procedure_Specification ! and then Present (Spec_Id) ! and then No_Return (Spec_Id) ! then ! Check_Returns (HSS, 'P', Missing_Ret, Spec_Id); ! end if; -- Now we are going to check for variables that are never modified in -- the body of the procedure. But first we deal with a special case --- 2577,2583 ---- end if; end if; ! Check_Missing_Return; -- Now we are going to check for variables that are never modified in -- the body of the procedure. But first we deal with a special case *************** package body Sem_Ch6 is *** 2576,2593 **** procedure Analyze_Subprogram_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Designator : Entity_Id; Form : Node_Id; - Scop : constant Entity_Id := Current_Scope; Null_Body : Node_Id := Empty; -- Start of processing for Analyze_Subprogram_Declaration begin -- For a null procedure, capture the profile before analysis, for ! -- expansion at the freeze point and at each point of call. ! -- The body will only be used if the procedure has preconditions. ! -- In that case the body is analyzed at the freeze point. if Nkind (Specification (N)) = N_Procedure_Specification and then Null_Present (Specification (N)) --- 2712,2729 ---- procedure Analyze_Subprogram_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); + Scop : constant Entity_Id := Current_Scope; Designator : Entity_Id; Form : Node_Id; Null_Body : Node_Id := Empty; -- Start of processing for Analyze_Subprogram_Declaration begin -- For a null procedure, capture the profile before analysis, for ! -- expansion at the freeze point and at each point of call. The body ! -- will only be used if the procedure has preconditions. In that case ! -- the body is analyzed at the freeze point. if Nkind (Specification (N)) = N_Procedure_Specification and then Null_Present (Specification (N)) *************** package body Sem_Ch6 is *** 2614,2629 **** Set_Defining_Identifier (Form, Make_Defining_Identifier (Loc, Chars (Defining_Identifier (Form)))); Next (Form); end loop; if Is_Protected_Type (Current_Scope) then ! Error_Msg_N ! ("protected operation cannot be a null procedure", N); end if; end if; ! Designator := Analyze_Subprogram_Specification (Specification (N)); Generate_Definition (Designator); if Debug_Flag_C then --- 2750,2785 ---- Set_Defining_Identifier (Form, Make_Defining_Identifier (Loc, Chars (Defining_Identifier (Form)))); + + -- Resolve the types of the formals now, because the freeze point + -- may appear in a different context, e.g. an instantiation. + + if Nkind (Parameter_Type (Form)) /= N_Access_Definition then + Find_Type (Parameter_Type (Form)); + + elsif + No (Access_To_Subprogram_Definition (Parameter_Type (Form))) + then + Find_Type (Subtype_Mark (Parameter_Type (Form))); + + else + + -- the case of a null procedure with a formal that is an + -- access_to_subprogram type, and that is used as an actual + -- in an instantiation is left to the enthusiastic reader. + + null; + end if; + Next (Form); end loop; if Is_Protected_Type (Current_Scope) then ! Error_Msg_N ("protected operation cannot be a null procedure", N); end if; end if; ! Designator := Analyze_Subprogram_Specification (Specification (N)); Generate_Definition (Designator); if Debug_Flag_C then *************** package body Sem_Ch6 is *** 2681,2687 **** -- Ada 2005 (AI-251): Abstract interface primitives must be abstract -- or null. ! if Ada_Version >= Ada_05 and then Comes_From_Source (N) and then Is_Dispatching_Operation (Designator) then --- 2837,2843 ---- -- Ada 2005 (AI-251): Abstract interface primitives must be abstract -- or null. ! if Ada_Version >= Ada_2005 and then Comes_From_Source (N) and then Is_Dispatching_Operation (Designator) then *************** package body Sem_Ch6 is *** 2752,2758 **** if Nkind (Parent (N)) = N_Compilation_Unit then Set_Body_Required (Parent (N), True); ! if Ada_Version >= Ada_05 and then Nkind (Specification (N)) = N_Procedure_Specification and then Null_Present (Specification (N)) then --- 2908,2914 ---- if Nkind (Parent (N)) = N_Compilation_Unit then Set_Body_Required (Parent (N), True); ! if Ada_Version >= Ada_2005 and then Nkind (Specification (N)) = N_Procedure_Specification and then Null_Present (Specification (N)) then *************** package body Sem_Ch6 is *** 2772,2777 **** --- 2928,2936 ---- Write_Location (Sloc (N)); Write_Eol; end if; + + List_Inherited_Pre_Post_Aspects (Designator); + Analyze_Aspect_Specifications (N, Designator, Aspect_Specifications (N)); end Analyze_Subprogram_Declaration; -------------------------------------- *************** package body Sem_Ch6 is *** 2794,2800 **** if Nkind (N) = N_Function_Specification then Set_Ekind (Designator, E_Function); Set_Mechanism (Designator, Default_Mechanism); - else Set_Ekind (Designator, E_Procedure); Set_Etype (Designator, Standard_Void_Type); --- 2953,2958 ---- *************** package body Sem_Ch6 is *** 2815,2821 **** -- Same processing for an access parameter whose designated type is -- derived from a synchronized interface. ! if Ada_Version >= Ada_05 then declare Formal : Entity_Id; Formal_Typ : Entity_Id; --- 2973,2979 ---- -- Same processing for an access parameter whose designated type is -- derived from a synchronized interface. ! if Ada_Version >= Ada_2005 then declare Formal : Entity_Id; Formal_Typ : Entity_Id; *************** package body Sem_Ch6 is *** 2865,2877 **** elsif Nkind (N) = N_Function_Specification then Push_Scope (Designator); - Analyze_Return_Type (N); - End_Scope; end if; if Nkind (N) = N_Function_Specification then if Nkind (Designator) = N_Defining_Operator_Symbol then Valid_Operator_Definition (Designator); end if; --- 3023,3038 ---- elsif Nkind (N) = N_Function_Specification then Push_Scope (Designator); Analyze_Return_Type (N); End_Scope; end if; + -- Function case + if Nkind (N) = N_Function_Specification then + + -- Deal with operator symbol case + if Nkind (Designator) = N_Defining_Operator_Symbol then Valid_Operator_Definition (Designator); end if; *************** package body Sem_Ch6 is *** 2881,2899 **** -- Ada 2005 (AI-251): If the return type is abstract, verify that -- the subprogram is abstract also. This does not apply to renaming -- declarations, where abstractness is inherited. -- In case of primitives associated with abstract interface types -- the check is applied later (see Analyze_Subprogram_Declaration). ! if Is_Abstract_Type (Etype (Designator)) ! and then not Is_Interface (Etype (Designator)) ! and then Nkind (Parent (N)) /= N_Subprogram_Renaming_Declaration ! and then Nkind (Parent (N)) /= ! N_Abstract_Subprogram_Declaration ! and then ! (Nkind (Parent (N))) /= N_Formal_Abstract_Subprogram_Declaration then ! Error_Msg_N ! ("function that returns abstract type must be abstract", N); end if; end if; --- 3042,3073 ---- -- Ada 2005 (AI-251): If the return type is abstract, verify that -- the subprogram is abstract also. This does not apply to renaming -- declarations, where abstractness is inherited. + -- In case of primitives associated with abstract interface types -- the check is applied later (see Analyze_Subprogram_Declaration). ! if not Nkind_In (Parent (N), N_Subprogram_Renaming_Declaration, ! N_Abstract_Subprogram_Declaration, ! N_Formal_Abstract_Subprogram_Declaration) then ! if Is_Abstract_Type (Etype (Designator)) ! and then not Is_Interface (Etype (Designator)) ! then ! Error_Msg_N ! ("function that returns abstract type must be abstract", N); ! ! -- Ada 2012 (AI-0073): Extend this test to subprograms with an ! -- access result whose designated type is abstract. ! ! elsif Nkind (Result_Definition (N)) = N_Access_Definition ! and then ! not Is_Class_Wide_Type (Designated_Type (Etype (Designator))) ! and then Is_Abstract_Type (Designated_Type (Etype (Designator))) ! and then Ada_Version >= Ada_2012 ! then ! Error_Msg_N ("function whose access result designates " ! & "abstract type must be abstract", N); ! end if; end if; end if; *************** package body Sem_Ch6 is *** 3087,3092 **** --- 3261,3275 ---- and then Has_Excluded_Statement (Statements (S)) then return True; + + elsif Nkind (S) = N_Extended_Return_Statement then + if Has_Excluded_Statement + (Statements (Handled_Statement_Sequence (S))) + or else Present + (Exception_Handlers (Handled_Statement_Sequence (S))) + then + return True; + end if; end if; Next (S); *************** package body Sem_Ch6 is *** 3109,3114 **** --- 3292,3298 ---- or else Is_Child_Unit (S) then return False; + elsif Ekind (S) = E_Package and then Has_Forward_Instantiation (S) then *************** package body Sem_Ch6 is *** 3153,3164 **** --- 3337,3369 ---- return Abandon; end if; + -- A return statement within an extended return is a noop + -- after inlining. + + elsif No (Expression (N)) + and then Nkind (Parent (Parent (N))) = + N_Extended_Return_Statement + then + return OK; + else -- Expression has wrong form return Abandon; end if; + -- We can only inline a build-in-place function if + -- it has a single extended return. + + elsif Nkind (N) = N_Extended_Return_Statement then + if No (Return_Statement) then + Return_Statement := N; + return OK; + + else + return Abandon; + end if; + else return OK; end if; *************** package body Sem_Ch6 is *** 3169,3179 **** -- Start of processing for Has_Single_Return begin ! return Check_All_Returns (N) = OK ! and then Present (Declarations (N)) ! and then Present (First (Declarations (N))) ! and then Chars (Expression (Return_Statement)) = ! Chars (Defining_Identifier (First (Declarations (N)))); end Has_Single_Return; -------------------- --- 3374,3391 ---- -- Start of processing for Has_Single_Return begin ! if Check_All_Returns (N) /= OK then ! return False; ! ! elsif Nkind (Return_Statement) = N_Extended_Return_Statement then ! return True; ! ! else ! return Present (Declarations (N)) ! and then Present (First (Declarations (N))) ! and then Chars (Expression (Return_Statement)) = ! Chars (Defining_Identifier (First (Declarations (N)))); ! end if; end Has_Single_Return; -------------------- *************** package body Sem_Ch6 is *** 3390,3399 **** procedure Cannot_Inline (Msg : String; N : Node_Id; Subp : Entity_Id) is begin ! -- Do not emit warning if this is a predefined unit which is not ! -- the main unit. With validity checks enabled, some predefined ! -- subprograms may contain nested subprograms and become ineligible ! -- for inlining. if Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Subp))) and then not In_Extended_Main_Source_Unit (Subp) --- 3602,3610 ---- procedure Cannot_Inline (Msg : String; N : Node_Id; Subp : Entity_Id) is begin ! -- Do not emit warning if this is a predefined unit which is not the ! -- main unit. With validity checks enabled, some predefined subprograms ! -- may contain nested subprograms and become ineligible for inlining. if Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Subp))) and then not In_Extended_Main_Source_Unit (Subp) *************** package body Sem_Ch6 is *** 3462,3482 **** when Mode_Conformant => if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then ! Error_Msg_N -- CODEFIX??? ("not mode conformant with operation inherited#!", Enode); else ! Error_Msg_N -- CODEFIX??? ("not mode conformant with declaration#!", Enode); end if; when Subtype_Conformant => if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then ! Error_Msg_N -- CODEFIX??? ("not subtype conformant with operation inherited#!", Enode); else ! Error_Msg_N -- CODEFIX??? ("not subtype conformant with declaration#!", Enode); end if; --- 3673,3693 ---- when Mode_Conformant => if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then ! Error_Msg_N ("not mode conformant with operation inherited#!", Enode); else ! Error_Msg_N ("not mode conformant with declaration#!", Enode); end if; when Subtype_Conformant => if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then ! Error_Msg_N ("not subtype conformant with operation inherited#!", Enode); else ! Error_Msg_N ("not subtype conformant with declaration#!", Enode); end if; *************** package body Sem_Ch6 is *** 3545,3551 **** -- Ada 2005 (AI-231): In case of anonymous access types check the -- null-exclusion and access-to-constant attributes match. ! if Ada_Version >= Ada_05 and then Ekind (Etype (Old_Type)) = E_Anonymous_Access_Type and then (Can_Never_Be_Null (Old_Type) --- 3756,3762 ---- -- Ada 2005 (AI-231): In case of anonymous access types check the -- null-exclusion and access-to-constant attributes match. ! if Ada_Version >= Ada_2005 and then Ekind (Etype (Old_Type)) = E_Anonymous_Access_Type and then (Can_Never_Be_Null (Old_Type) *************** package body Sem_Ch6 is *** 3585,3591 **** Error_Msg_Name_1 := Chars (New_Id); Error_Msg_Name_2 := Name_Ada + Convention_Id'Pos (Convention (New_Id)); - Conformance_Error ("\prior declaration for% has convention %!"); else --- 3796,3801 ---- *************** package body Sem_Ch6 is *** 3645,3650 **** --- 3855,3883 ---- Set_Error_Posted (New_Formal); return; end if; + + -- Null exclusion must match + + if Null_Exclusion_Present (Parent (Old_Formal)) + /= + Null_Exclusion_Present (Parent (New_Formal)) + then + -- Only give error if both come from source. This should be + -- investigated some time, since it should not be needed ??? + + if Comes_From_Source (Old_Formal) + and then + Comes_From_Source (New_Formal) + then + Conformance_Error + ("\null exclusion for & does not match", New_Formal); + + -- Mark error posted on the new formal to avoid duplicated + -- complaint about types not matching. + + Set_Error_Posted (New_Formal); + end if; + end if; end if; -- Ada 2005 (AI-423): Possible access [sub]type and itype match. This *************** package body Sem_Ch6 is *** 3667,3673 **** New_Formal_Base := Get_Instance_Of (New_Formal_Base); end if; ! Access_Types_Match := Ada_Version >= Ada_05 -- Ensure that this rule is only applied when New_Id is a -- renaming of Old_Id. --- 3900,3906 ---- New_Formal_Base := Get_Instance_Of (New_Formal_Base); end if; ! Access_Types_Match := Ada_Version >= Ada_2005 -- Ensure that this rule is only applied when New_Id is a -- renaming of Old_Id. *************** package body Sem_Ch6 is *** 3777,3783 **** -- the null-exclusion and access-to-constant attributes must -- match. ! if Ada_Version >= Ada_05 and then Ekind (Etype (Old_Formal)) = E_Anonymous_Access_Type and then Ekind (Etype (New_Formal)) = E_Anonymous_Access_Type and then --- 4010,4016 ---- -- the null-exclusion and access-to-constant attributes must -- match. ! if Ada_Version >= Ada_2005 and then Ekind (Etype (Old_Formal)) = E_Anonymous_Access_Type and then Ekind (Etype (New_Formal)) = E_Anonymous_Access_Type and then *************** package body Sem_Ch6 is *** 3786,3791 **** --- 4019,4029 ---- or else Is_Access_Constant (Etype (Old_Formal)) /= Is_Access_Constant (Etype (New_Formal))) + + -- Do not complain if error already posted on New_Formal. This + -- avoids some redundant error messages. + + and then not Error_Posted (New_Formal) then -- It is allowed to omit the null-exclusion in case of stream -- attribute subprograms. We recognize stream subprograms *************** package body Sem_Ch6 is *** 3956,3981 **** Error_Msg_Name_2 := Get_Convention_Name (Convention (Op)); Error_Msg_Sloc := Sloc (Op); ! if Comes_From_Source (Op) then ! if not Is_Overriding_Operation (Op) then Error_Msg_N ("\\primitive % defined #", Typ); else ! Error_Msg_N ("\\overriding operation % with " & ! "convention % defined #", Typ); end if; else pragma Assert (Present (Alias (Op))); Error_Msg_Sloc := Sloc (Alias (Op)); ! Error_Msg_N ("\\inherited operation % with " & ! "convention % defined #", Typ); end if; Error_Msg_Name_1 := Chars (Op); Error_Msg_Name_2 := Get_Convention_Name (Convention (Iface_Prim)); Error_Msg_Sloc := Sloc (Iface_Prim); ! Error_Msg_N ("\\overridden operation % with " & ! "convention % defined #", Typ); -- Avoid cascading errors --- 4194,4222 ---- Error_Msg_Name_2 := Get_Convention_Name (Convention (Op)); Error_Msg_Sloc := Sloc (Op); ! if Comes_From_Source (Op) or else No (Alias (Op)) then ! if not Present (Overridden_Operation (Op)) then Error_Msg_N ("\\primitive % defined #", Typ); else ! Error_Msg_N ! ("\\overriding operation % with " & ! "convention % defined #", Typ); end if; else pragma Assert (Present (Alias (Op))); Error_Msg_Sloc := Sloc (Alias (Op)); ! Error_Msg_N ! ("\\inherited operation % with " & ! "convention % defined #", Typ); end if; Error_Msg_Name_1 := Chars (Op); Error_Msg_Name_2 := Get_Convention_Name (Convention (Iface_Prim)); Error_Msg_Sloc := Sloc (Iface_Prim); ! Error_Msg_N ! ("\\overridden operation % with " & ! "convention % defined #", Typ); -- Avoid cascading errors *************** package body Sem_Ch6 is *** 4060,4088 **** -- Start of processing for Check_Delayed_Subprogram begin ! -- Never need to freeze abstract subprogram ! ! if Ekind (Designator) /= E_Subprogram_Type ! and then Is_Abstract_Subprogram (Designator) ! then ! null; ! else ! -- Need delayed freeze if return type itself needs a delayed ! -- freeze and is not yet frozen. ! Possible_Freeze (Etype (Designator)); ! Possible_Freeze (Base_Type (Etype (Designator))); -- needed ??? ! -- Need delayed freeze if any of the formal types themselves need ! -- a delayed freeze and are not yet frozen. ! F := First_Formal (Designator); ! while Present (F) loop ! Possible_Freeze (Etype (F)); ! Possible_Freeze (Base_Type (Etype (F))); -- needed ??? ! Next_Formal (F); ! end loop; ! end if; -- Mark functions that return by reference. Note that it cannot be -- done for delayed_freeze subprograms because the underlying --- 4301,4321 ---- -- Start of processing for Check_Delayed_Subprogram begin ! -- All subprograms, including abstract subprograms, may need a freeze ! -- node if some formal type or the return type needs one. ! Possible_Freeze (Etype (Designator)); ! Possible_Freeze (Base_Type (Etype (Designator))); -- needed ??? ! -- Need delayed freeze if any of the formal types themselves need ! -- a delayed freeze and are not yet frozen. ! F := First_Formal (Designator); ! while Present (F) loop ! Possible_Freeze (Etype (F)); ! Possible_Freeze (Base_Type (Etype (F))); -- needed ??? ! Next_Formal (F); ! end loop; -- Mark functions that return by reference. Note that it cannot be -- done for delayed_freeze subprograms because the underlying *************** package body Sem_Ch6 is *** 4096,4102 **** Utyp : constant Entity_Id := Underlying_Type (Typ); begin ! if Is_Inherently_Limited_Type (Typ) then Set_Returns_By_Ref (Designator); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then --- 4329,4335 ---- Utyp : constant Entity_Id := Underlying_Type (Typ); begin ! if Is_Immutably_Limited_Type (Typ) then Set_Returns_By_Ref (Designator); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then *************** package body Sem_Ch6 is *** 4393,4399 **** then Error_Msg_Node_2 := Alias (Overridden_Subp); Error_Msg_Sloc := Sloc (Error_Msg_Node_2); ! Error_Msg_NE ("& does not match corresponding formal of&#", Form1, Form1); exit; end if; --- 4626,4633 ---- then Error_Msg_Node_2 := Alias (Overridden_Subp); Error_Msg_Sloc := Sloc (Error_Msg_Node_2); ! Error_Msg_NE ! ("& does not match corresponding formal of&#", Form1, Form1); exit; end if; *************** package body Sem_Ch6 is *** 4404,4411 **** end; end if; if Present (Overridden_Subp) ! and then not Is_Hidden (Overridden_Subp) then if Must_Not_Override (Spec) then Error_Msg_Sloc := Sloc (Overridden_Subp); --- 4638,4663 ---- end; end if; + -- If there is an overridden subprogram, then check that there is no + -- "not overriding" indicator, and mark the subprogram as overriding. + -- This is not done if the overridden subprogram is marked as hidden, + -- which can occur for the case of inherited controlled operations + -- (see Derive_Subprogram), unless the inherited subprogram's parent + -- subprogram is not itself hidden. (Note: This condition could probably + -- be simplified, leaving out the testing for the specific controlled + -- cases, but it seems safer and clearer this way, and echoes similar + -- special-case tests of this kind in other places.) + if Present (Overridden_Subp) ! and then (not Is_Hidden (Overridden_Subp) ! or else ! ((Chars (Overridden_Subp) = Name_Initialize ! or else ! Chars (Overridden_Subp) = Name_Adjust ! or else ! Chars (Overridden_Subp) = Name_Finalize) ! and then Present (Alias (Overridden_Subp)) ! and then not Is_Hidden (Alias (Overridden_Subp)))) then if Must_Not_Override (Spec) then Error_Msg_Sloc := Sloc (Overridden_Subp); *************** package body Sem_Ch6 is *** 4419,4425 **** end if; elsif Is_Subprogram (Subp) then ! Set_Is_Overriding_Operation (Subp); end if; -- If primitive flag is set or this is a protected operation, then --- 4671,4695 ---- end if; elsif Is_Subprogram (Subp) then ! if No (Overridden_Operation (Subp)) then ! ! -- For entities generated by Derive_Subprograms the overridden ! -- operation is the inherited primitive (which is available ! -- through the attribute alias) ! ! if (Is_Dispatching_Operation (Subp) ! or else Is_Dispatching_Operation (Overridden_Subp)) ! and then not Comes_From_Source (Overridden_Subp) ! and then Find_Dispatching_Type (Overridden_Subp) = ! Find_Dispatching_Type (Subp) ! and then Present (Alias (Overridden_Subp)) ! and then Comes_From_Source (Alias (Overridden_Subp)) ! then ! Set_Overridden_Operation (Subp, Alias (Overridden_Subp)); ! else ! Set_Overridden_Operation (Subp, Overridden_Subp); ! end if; ! end if; end if; -- If primitive flag is set or this is a protected operation, then *************** package body Sem_Ch6 is *** 4437,4443 **** -- If Subp is an operator, it may override a predefined operation, if -- it is defined in the same scope as the type to which it applies. ! -- In that case overridden_subp is empty because of our implicit -- representation for predefined operators. We have to check whether the -- signature of Subp matches that of a predefined operator. Note that -- first argument provides the name of the operator, and the second --- 4707,4713 ---- -- If Subp is an operator, it may override a predefined operation, if -- it is defined in the same scope as the type to which it applies. ! -- In that case Overridden_Subp is empty because of our implicit -- representation for predefined operators. We have to check whether the -- signature of Subp matches that of a predefined operator. Note that -- first argument provides the name of the operator, and the second *************** package body Sem_Ch6 is *** 4449,4455 **** elsif Nkind (Subp) = N_Defining_Operator_Symbol then declare Typ : constant Entity_Id := ! Base_Type (Etype (First_Formal (Subp))); Can_Override : constant Boolean := Operator_Matches_Spec (Subp, Subp) --- 4719,4725 ---- elsif Nkind (Subp) = N_Defining_Operator_Symbol then declare Typ : constant Entity_Id := ! Base_Type (Etype (First_Formal (Subp))); Can_Override : constant Boolean := Operator_Matches_Spec (Subp, Subp) *************** package body Sem_Ch6 is *** 4471,4485 **** elsif Can_Override then Error_Msg_NE ! ("subprogram & overrides predefined operator ", ! Spec, Subp); end if; elsif Must_Override (Spec) then ! if Is_Overriding_Operation (Subp) then ! Set_Is_Overriding_Operation (Subp); ! ! elsif not Can_Override then Error_Msg_NE ("subprogram & is not overriding", Spec, Subp); end if; --- 4741,4753 ---- elsif Can_Override then Error_Msg_NE ! ("subprogram& overrides predefined operator ", Spec, Subp); end if; elsif Must_Override (Spec) then ! if No (Overridden_Operation (Subp)) ! and then not Can_Override ! then Error_Msg_NE ("subprogram & is not overriding", Spec, Subp); end if; *************** package body Sem_Ch6 is *** 4490,4497 **** not Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Subp))) then - Set_Is_Overriding_Operation (Subp); - -- If style checks are enabled, indicate that the indicator is -- missing. However, at the point of declaration, the type of -- which this is a primitive operation may be private, in which --- 4758,4763 ---- *************** package body Sem_Ch6 is *** 5227,5233 **** -- In Ada2005, access constant indicators must match for -- subtype conformance. ! if Ada_Version >= Ada_05 and then Ctype >= Subtype_Conformant and then Is_Access_Constant (Type_1) /= Is_Access_Constant (Type_2) --- 5493,5499 ---- -- In Ada2005, access constant indicators must match for -- subtype conformance. ! if Ada_Version >= Ada_2005 and then Ctype >= Subtype_Conformant and then Is_Access_Constant (Type_1) /= Is_Access_Constant (Type_2) *************** package body Sem_Ch6 is *** 5236,5242 **** end if; Desig_1 := Find_Designated_Type (Type_1); - Desig_2 := Find_Designated_Type (Type_2); -- If the context is an instance association for a formal --- 5502,5507 ---- *************** package body Sem_Ch6 is *** 5257,5263 **** -- of an incomplete Class_Wide_Type are illegal. if Is_Class_Wide_Type (Desig_1) ! and then Is_Class_Wide_Type (Desig_2) then return Conforming_Types --- 5522,5529 ---- -- of an incomplete Class_Wide_Type are illegal. if Is_Class_Wide_Type (Desig_1) ! and then ! Is_Class_Wide_Type (Desig_2) then return Conforming_Types *************** package body Sem_Ch6 is *** 5265,5271 **** Etype (Base_Type (Desig_2)), Ctype); elsif Are_Anonymous_Access_To_Subprogram_Types then ! if Ada_Version < Ada_05 then return Ctype = Type_Conformant or else Subtypes_Statically_Match (Desig_1, Desig_2); --- 5531,5537 ---- Etype (Base_Type (Desig_2)), Ctype); elsif Are_Anonymous_Access_To_Subprogram_Types then ! if Ada_Version < Ada_2005 then return Ctype = Type_Conformant or else Subtypes_Statically_Match (Desig_1, Desig_2); *************** package body Sem_Ch6 is *** 5329,5334 **** --- 5595,5608 ---- -- and also returned as the result. These formals are always of mode IN. -- The new formal has the type Typ, is declared in Scope, and its name -- is given by a concatenation of the name of Assoc_Entity and Suffix. + -- The following suffixes are currently used. They should not be changed + -- without coordinating with CodePeer, which makes use of these to + -- provide better messages. + + -- O denotes the Constrained bit. + -- L denotes the accessibility level. + -- BIP_xxx denotes an extra formal for a build-in-place function. See + -- the full list in exp_ch6.BIP_Formal_Kind. ---------------------- -- Add_Extra_Formal -- *************** package body Sem_Ch6 is *** 5450,5461 **** Formal_Type := Underlying_Type (Formal_Type); end if; if Has_Discriminants (Formal_Type) and then not Is_Constrained (Formal_Type) and then not Is_Indefinite_Subtype (Formal_Type) then Set_Extra_Constrained ! (Formal, Add_Extra_Formal (Formal, Standard_Boolean, E, "F")); end if; end if; --- 5724,5749 ---- Formal_Type := Underlying_Type (Formal_Type); end if; + -- Suppress the extra formal if formal's subtype is constrained or + -- indefinite, or we're compiling for Ada 2012 and the underlying + -- type is tagged and limited. In Ada 2012, a limited tagged type + -- can have defaulted discriminants, but 'Constrained is required + -- to return True, so the formal is never needed (see AI05-0214). + -- Note that this ensures consistency of calling sequences for + -- dispatching operations when some types in a class have defaults + -- on discriminants and others do not (and requiring the extra + -- formal would introduce distributed overhead). + if Has_Discriminants (Formal_Type) and then not Is_Constrained (Formal_Type) and then not Is_Indefinite_Subtype (Formal_Type) + and then (Ada_Version < Ada_2012 + or else + not (Is_Tagged_Type (Underlying_Type (Formal_Type)) + and then Is_Limited_Type (Formal_Type))) then Set_Extra_Constrained ! (Formal, Add_Extra_Formal (Formal, Standard_Boolean, E, "O")); end if; end if; *************** package body Sem_Ch6 is *** 5488,5494 **** or else Present (Extra_Accessibility (P_Formal))) then Set_Extra_Accessibility ! (Formal, Add_Extra_Formal (Formal, Standard_Natural, E, "F")); end if; -- This label is required when skipping extra formal generation for --- 5776,5782 ---- or else Present (Extra_Accessibility (P_Formal))) then Set_Extra_Accessibility ! (Formal, Add_Extra_Formal (Formal, Standard_Natural, E, "L")); end if; -- This label is required when skipping extra formal generation for *************** package body Sem_Ch6 is *** 5508,5514 **** -- Ada 2005 (AI-318-02): In the case of build-in-place functions, add -- appropriate extra formals. See type Exp_Ch6.BIP_Formal_Kind. ! if Ada_Version >= Ada_05 and then Is_Build_In_Place_Function (E) then declare Result_Subt : constant Entity_Id := Etype (E); --- 5796,5802 ---- -- Ada 2005 (AI-318-02): In the case of build-in-place functions, add -- appropriate extra formals. See type Exp_Ch6.BIP_Formal_Kind. ! if Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function (E) then declare Result_Subt : constant Entity_Id := Etype (E); *************** package body Sem_Ch6 is *** 5517,5531 **** begin -- In the case of functions with unconstrained result subtypes, ! -- add a 3-state formal indicating whether the return object is ! -- allocated by the caller (0), or should be allocated by the ! -- callee on the secondary stack (1) or in the global heap (2). ! -- For the moment we just use Natural for the type of this formal. ! -- Note that this formal isn't usually needed in the case where ! -- the result subtype is constrained, but it is needed when the ! -- function has a tagged result, because generally such functions ! -- can be called in a dispatching context and such calls must be ! -- handled like calls to a class-wide function. if not Is_Constrained (Underlying_Type (Result_Subt)) or else Is_Tagged_Type (Underlying_Type (Result_Subt)) --- 5805,5820 ---- begin -- In the case of functions with unconstrained result subtypes, ! -- add a 4-state formal indicating whether the return object is ! -- allocated by the caller (1), or should be allocated by the ! -- callee on the secondary stack (2), in the global heap (3), or ! -- in a user-defined storage pool (4). For the moment we just use ! -- Natural for the type of this formal. Note that this formal ! -- isn't usually needed in the case where the result subtype is ! -- constrained, but it is needed when the function has a tagged ! -- result, because generally such functions can be called in a ! -- dispatching context and such calls must be handled like calls ! -- to a class-wide function. if not Is_Constrained (Underlying_Type (Result_Subt)) or else Is_Tagged_Type (Underlying_Type (Result_Subt)) *************** package body Sem_Ch6 is *** 5536,5554 **** E, BIP_Formal_Suffix (BIP_Alloc_Form)); end if; ! -- In the case of functions whose result type has controlled ! -- parts, we have an extra formal of type ! -- System.Finalization_Implementation.Finalizable_Ptr_Ptr. That ! -- is, we are passing a pointer to a finalization list (which is ! -- itself a pointer). This extra formal is then passed along to ! -- Move_Final_List in case of successful completion of a return ! -- statement. We cannot pass an 'in out' parameter, because we ! -- need to update the finalization list during an abort-deferred ! -- region, rather than using copy-back after the function ! -- returns. This is true even if we are able to get away with ! -- having 'in out' parameters, which are normally illegal for ! -- functions. This formal is also needed when the function has ! -- a tagged result. if Needs_BIP_Final_List (E) then Discard := --- 5825,5842 ---- E, BIP_Formal_Suffix (BIP_Alloc_Form)); end if; ! -- For functions whose result type has controlled parts, we have ! -- an extra formal of type System.Finalization_Implementation. ! -- Finalizable_Ptr_Ptr. That is, we are passing a pointer to a ! -- finalization list (which is itself a pointer). This extra ! -- formal is then passed along to Move_Final_List in case of ! -- successful completion of a return statement. We cannot pass an ! -- 'in out' parameter, because we need to update the finalization ! -- list during an abort-deferred region, rather than using ! -- copy-back after the function returns. This is true even if we ! -- are able to get away with having 'in out' parameters, which are ! -- normally illegal for functions. This formal is also needed when ! -- the function has a tagged result. if Needs_BIP_Final_List (E) then Discard := *************** package body Sem_Ch6 is *** 5667,5687 **** E := Homonym (E); exit when No (E); ! -- Warn unless genuine overloading if (not Is_Overloadable (E) or else Subtype_Conformant (E, S)) and then (Is_Immediately_Visible (E) or else Is_Potentially_Use_Visible (S)) then ! Error_Msg_Sloc := Sloc (E); ! Error_Msg_N ("declaration of & hides one#?", S); end if; end loop; end if; end Enter_Overloaded_Entity; ----------------------------- -- Find_Corresponding_Spec -- ----------------------------- --- 5955,6062 ---- E := Homonym (E); exit when No (E); ! -- Warn unless genuine overloading. Do not emit warning on ! -- hiding predefined operators in Standard (these are either an ! -- (artifact of our implicit declarations, or simple noise) but ! -- keep warning on a operator defined on a local subtype, because ! -- of the real danger that different operators may be applied in ! -- various parts of the program. if (not Is_Overloadable (E) or else Subtype_Conformant (E, S)) and then (Is_Immediately_Visible (E) or else Is_Potentially_Use_Visible (S)) then ! if Scope (E) /= Standard_Standard then ! Error_Msg_Sloc := Sloc (E); ! Error_Msg_N ("declaration of & hides one#?", S); ! ! elsif Nkind (S) = N_Defining_Operator_Symbol ! and then ! Scope ( ! Base_Type (Etype (First_Formal (S)))) /= Scope (S) ! then ! Error_Msg_N ! ("declaration of & hides predefined operator?", S); ! end if; end if; end loop; end if; end Enter_Overloaded_Entity; ----------------------------- + -- Check_Untagged_Equality -- + ----------------------------- + + procedure Check_Untagged_Equality (Eq_Op : Entity_Id) is + Typ : constant Entity_Id := Etype (First_Formal (Eq_Op)); + Decl : constant Node_Id := Unit_Declaration_Node (Eq_Op); + Obj_Decl : Node_Id; + + begin + if Nkind (Decl) = N_Subprogram_Declaration + and then Is_Record_Type (Typ) + and then not Is_Tagged_Type (Typ) + then + -- If the type is not declared in a package, or if we are in the + -- body of the package or in some other scope, the new operation is + -- not primitive, and therefore legal, though suspicious. If the + -- type is a generic actual (sub)type, the operation is not primitive + -- either because the base type is declared elsewhere. + + if Is_Frozen (Typ) then + if Ekind (Scope (Typ)) /= E_Package + or else Scope (Typ) /= Current_Scope + then + null; + + elsif Is_Generic_Actual_Type (Typ) then + null; + + elsif In_Package_Body (Scope (Typ)) then + Error_Msg_NE + ("equality operator must be declared " + & "before type& is frozen", Eq_Op, Typ); + Error_Msg_N + ("\move declaration to package spec", Eq_Op); + + else + Error_Msg_NE + ("equality operator must be declared " + & "before type& is frozen", Eq_Op, Typ); + + Obj_Decl := Next (Parent (Typ)); + while Present (Obj_Decl) + and then Obj_Decl /= Decl + loop + if Nkind (Obj_Decl) = N_Object_Declaration + and then Etype (Defining_Identifier (Obj_Decl)) = Typ + then + Error_Msg_NE ("type& is frozen by declaration?", + Obj_Decl, Typ); + Error_Msg_N + ("\an equality operator cannot be declared after this " + & "point ('R'M 4.5.2 (9.8)) (Ada 2012))?", Obj_Decl); + exit; + end if; + + Next (Obj_Decl); + end loop; + end if; + + elsif not In_Same_List (Parent (Typ), Decl) + and then not Is_Limited_Type (Typ) + then + + -- This makes it illegal to have a primitive equality declared in + -- the private part if the type is visible. + + Error_Msg_N ("equality operator appears too late", Eq_Op); + end if; + end if; + end Check_Untagged_Equality; + + ----------------------------- -- Find_Corresponding_Spec -- ----------------------------- *************** package body Sem_Ch6 is *** 5750,5760 **** -- that was created for an operation inherited by a null -- extension, it may be overridden by a body without a previous -- spec (one more reason why these should be shunned). In that ! -- case remove the generated body, because the current one is ! -- the explicit overriding. elsif Ekind (E) = E_Function ! and then Ada_Version >= Ada_05 and then not Comes_From_Source (E) and then Has_Controlling_Result (E) and then Is_Null_Extension (Etype (E)) --- 6125,6135 ---- -- that was created for an operation inherited by a null -- extension, it may be overridden by a body without a previous -- spec (one more reason why these should be shunned). In that ! -- case remove the generated body if present, because the ! -- current one is the explicit overriding. elsif Ekind (E) = E_Function ! and then Ada_Version >= Ada_2005 and then not Comes_From_Source (E) and then Has_Controlling_Result (E) and then Is_Null_Extension (Etype (E)) *************** package body Sem_Ch6 is *** 5762,5776 **** then Set_Has_Completion (E, False); ! if Expander_Active then Remove (Unit_Declaration_Node ! (Corresponding_Body (Unit_Declaration_Node (E)))); return E; ! -- If expansion is disabled, the wrapper function has not ! -- been generated, and this is the standard case of a late ! -- body overriding an inherited operation. else return Empty; --- 6137,6156 ---- then Set_Has_Completion (E, False); ! if Expander_Active ! and then Nkind (Parent (E)) = N_Function_Specification ! then Remove (Unit_Declaration_Node ! (Corresponding_Body (Unit_Declaration_Node (E)))); ! return E; ! -- If expansion is disabled, or if the wrapper function has ! -- not been generated yet, this a late body overriding an ! -- inherited operation, or it is an overriding by some other ! -- declaration before the controlling result is frozen. In ! -- either case this is a declaration of a new entity. else return Empty; *************** package body Sem_Ch6 is *** 6001,6008 **** when N_Aggregate => return FCL (Expressions (E1), Expressions (E2)) ! and then FCL (Component_Associations (E1), ! Component_Associations (E2)); when N_Allocator => if Nkind (Expression (E1)) = N_Qualified_Expression --- 6381,6389 ---- when N_Aggregate => return FCL (Expressions (E1), Expressions (E2)) ! and then ! FCL (Component_Associations (E1), ! Component_Associations (E2)); when N_Allocator => if Nkind (Expression (E1)) = N_Qualified_Expression *************** package body Sem_Ch6 is *** 6072,6077 **** --- 6453,6490 ---- and then FCE (Right_Opnd (E1), Right_Opnd (E2)); + when N_Case_Expression => + declare + Alt1 : Node_Id; + Alt2 : Node_Id; + + begin + if not FCE (Expression (E1), Expression (E2)) then + return False; + + else + Alt1 := First (Alternatives (E1)); + Alt2 := First (Alternatives (E2)); + loop + if Present (Alt1) /= Present (Alt2) then + return False; + elsif No (Alt1) then + return True; + end if; + + if not FCE (Expression (Alt1), Expression (Alt2)) + or else not FCL (Discrete_Choices (Alt1), + Discrete_Choices (Alt2)) + then + return False; + end if; + + Next (Alt1); + Next (Alt2); + end loop; + end if; + end; + when N_Character_Literal => return Char_Literal_Value (E1) = Char_Literal_Value (E2); *************** package body Sem_Ch6 is *** 6079,6085 **** when N_Component_Association => return FCL (Choices (E1), Choices (E2)) ! and then FCE (Expression (E1), Expression (E2)); when N_Conditional_Expression => return --- 6492,6499 ---- when N_Component_Association => return FCL (Choices (E1), Choices (E2)) ! and then ! FCE (Expression (E1), Expression (E2)); when N_Conditional_Expression => return *************** package body Sem_Ch6 is *** 6100,6112 **** when N_Function_Call => return FCE (Name (E1), Name (E2)) ! and then FCL (Parameter_Associations (E1), ! Parameter_Associations (E2)); when N_Indexed_Component => return FCE (Prefix (E1), Prefix (E2)) ! and then FCL (Expressions (E1), Expressions (E2)); when N_Integer_Literal => return (Intval (E1) = Intval (E2)); --- 6514,6528 ---- when N_Function_Call => return FCE (Name (E1), Name (E2)) ! and then ! FCL (Parameter_Associations (E1), ! Parameter_Associations (E2)); when N_Indexed_Component => return FCE (Prefix (E1), Prefix (E2)) ! and then ! FCL (Expressions (E1), Expressions (E2)); when N_Integer_Literal => return (Intval (E1) = Intval (E2)); *************** package body Sem_Ch6 is *** 6130,6141 **** when N_Qualified_Expression => return FCE (Subtype_Mark (E1), Subtype_Mark (E2)) ! and then FCE (Expression (E1), Expression (E2)); when N_Range => return FCE (Low_Bound (E1), Low_Bound (E2)) ! and then FCE (High_Bound (E1), High_Bound (E2)); when N_Real_Literal => return (Realval (E1) = Realval (E2)); --- 6546,6559 ---- when N_Qualified_Expression => return FCE (Subtype_Mark (E1), Subtype_Mark (E2)) ! and then ! FCE (Expression (E1), Expression (E2)); when N_Range => return FCE (Low_Bound (E1), Low_Bound (E2)) ! and then ! FCE (High_Bound (E1), High_Bound (E2)); when N_Real_Literal => return (Realval (E1) = Realval (E2)); *************** package body Sem_Ch6 is *** 6143,6154 **** when N_Selected_Component => return FCE (Prefix (E1), Prefix (E2)) ! and then FCE (Selector_Name (E1), Selector_Name (E2)); when N_Slice => return FCE (Prefix (E1), Prefix (E2)) ! and then FCE (Discrete_Range (E1), Discrete_Range (E2)); when N_String_Literal => declare --- 6561,6574 ---- when N_Selected_Component => return FCE (Prefix (E1), Prefix (E2)) ! and then ! FCE (Selector_Name (E1), Selector_Name (E2)); when N_Slice => return FCE (Prefix (E1), Prefix (E2)) ! and then ! FCE (Discrete_Range (E1), Discrete_Range (E2)); when N_String_Literal => declare *************** package body Sem_Ch6 is *** 6177,6193 **** when N_Type_Conversion => return FCE (Subtype_Mark (E1), Subtype_Mark (E2)) ! and then FCE (Expression (E1), Expression (E2)); when N_Unary_Op => return Entity (E1) = Entity (E2) ! and then FCE (Right_Opnd (E1), Right_Opnd (E2)); when N_Unchecked_Type_Conversion => return FCE (Subtype_Mark (E1), Subtype_Mark (E2)) ! and then FCE (Expression (E1), Expression (E2)); -- All other node types cannot appear in this context. Strictly -- we should raise a fatal internal error. Instead we just ignore --- 6597,6616 ---- when N_Type_Conversion => return FCE (Subtype_Mark (E1), Subtype_Mark (E2)) ! and then ! FCE (Expression (E1), Expression (E2)); when N_Unary_Op => return Entity (E1) = Entity (E2) ! and then ! FCE (Right_Opnd (E1), Right_Opnd (E2)); when N_Unchecked_Type_Conversion => return FCE (Subtype_Mark (E1), Subtype_Mark (E2)) ! and then ! FCE (Expression (E1), Expression (E2)); -- All other node types cannot appear in this context. Strictly -- we should raise a fatal internal error. Instead we just ignore *************** package body Sem_Ch6 is *** 6343,6350 **** or else Etype (Prim) = Etype (Iface_Prim) or else not Has_Controlling_Result (Prim) then ! return Type_Conformant (Prim, Iface_Prim, ! Skip_Controlling_Formals => True); -- Case of a function returning an interface, or an access to one. -- Check that the return types correspond. --- 6766,6773 ---- or else Etype (Prim) = Etype (Iface_Prim) or else not Has_Controlling_Result (Prim) then ! return Type_Conformant ! (Iface_Prim, Prim, Skip_Controlling_Formals => True); -- Case of a function returning an interface, or an access to one. -- Check that the return types correspond. *************** package body Sem_Ch6 is *** 6481,6487 **** -- instance of) a generic type. Formal := First_Formal (Prev_E); - while Present (Formal) loop F_Typ := Base_Type (Etype (Formal)); --- 6904,6909 ---- *************** package body Sem_Ch6 is *** 6575,6580 **** --- 6997,7039 ---- end if; end Is_Non_Overriding_Operation; + ------------------------------------- + -- List_Inherited_Pre_Post_Aspects -- + ------------------------------------- + + procedure List_Inherited_Pre_Post_Aspects (E : Entity_Id) is + begin + if Opt.List_Inherited_Aspects + and then (Is_Subprogram (E) or else Is_Generic_Subprogram (E)) + then + declare + Inherited : constant Subprogram_List := + Inherited_Subprograms (E); + P : Node_Id; + + begin + for J in Inherited'Range loop + P := Spec_PPC_List (Inherited (J)); + while Present (P) loop + Error_Msg_Sloc := Sloc (P); + + if Class_Present (P) and then not Split_PPC (P) then + if Pragma_Name (P) = Name_Precondition then + Error_Msg_N + ("?info: & inherits `Pre''Class` aspect from #", E); + else + Error_Msg_N + ("?info: & inherits `Post''Class` aspect from #", E); + end if; + end if; + + P := Next_Pragma (P); + end loop; + end loop; + end; + end if; + end List_Inherited_Pre_Post_Aspects; + ------------------------------ -- Make_Inequality_Operator -- ------------------------------ *************** package body Sem_Ch6 is *** 6792,6811 **** and then (not Is_Overriding or else not Is_Abstract_Subprogram (E)) then ! Error_Msg_N ("abstract subprograms must be visible " ! & "(RM 3.9.3(10))!", S); elsif Ekind (S) = E_Function - and then Is_Tagged_Type (T) - and then T = Base_Type (Etype (S)) and then not Is_Overriding then ! Error_Msg_N ! ("private function with tagged result must" ! & " override visible-part function", S); ! Error_Msg_N ! ("\move subprogram to the visible part" ! & " (RM 3.9.3(10))", S); end if; end if; end Check_Private_Overriding; --- 7251,7289 ---- and then (not Is_Overriding or else not Is_Abstract_Subprogram (E)) then ! Error_Msg_N ! ("abstract subprograms must be visible " ! & "(RM 3.9.3(10))!", S); elsif Ekind (S) = E_Function and then not Is_Overriding then ! if Is_Tagged_Type (T) ! and then T = Base_Type (Etype (S)) ! then ! Error_Msg_N ! ("private function with tagged result must" ! & " override visible-part function", S); ! Error_Msg_N ! ("\move subprogram to the visible part" ! & " (RM 3.9.3(10))", S); ! ! -- AI05-0073: extend this test to the case of a function ! -- with a controlling access result. ! ! elsif Ekind (Etype (S)) = E_Anonymous_Access_Type ! and then Is_Tagged_Type (Designated_Type (Etype (S))) ! and then ! not Is_Class_Wide_Type (Designated_Type (Etype (S))) ! and then Ada_Version >= Ada_2012 ! then ! Error_Msg_N ! ("private function with controlling access result " ! & "must override visible-part function", S); ! Error_Msg_N ! ("\move subprogram to the visible part" ! & " (RM 3.9.3(10))", S); ! end if; end if; end if; end Check_Private_Overriding; *************** package body Sem_Ch6 is *** 7099,7111 **** In_Scope := True; -- The enclosing scope is not a synchronized type and the subprogram ! -- has no formals elsif No (First_Formal (Def_Id)) then return; -- The subprogram has formals and hence it may be a primitive of a ! -- concurrent type else Typ := Etype (First_Formal (Def_Id)); --- 7577,7589 ---- In_Scope := True; -- The enclosing scope is not a synchronized type and the subprogram ! -- has no formals. elsif No (First_Formal (Def_Id)) then return; -- The subprogram has formals and hence it may be a primitive of a ! -- concurrent type. else Typ := Etype (First_Formal (Def_Id)); *************** package body Sem_Ch6 is *** 7154,7160 **** Subp : Entity_Id := Empty; begin ! -- Traverse the homonym chain, looking at a potentially -- overridden subprogram that belongs to an implemented -- interface. --- 7632,7638 ---- Subp : Entity_Id := Empty; begin ! -- Traverse the homonym chain, looking for a potentially -- overridden subprogram that belongs to an implemented -- interface. *************** package body Sem_Ch6 is *** 7172,7178 **** null; -- Entries and procedures can override abstract or null ! -- interface procedures elsif (Ekind (Def_Id) = E_Procedure or else Ekind (Def_Id) = E_Entry) --- 7650,7656 ---- null; -- Entries and procedures can override abstract or null ! -- interface procedures. elsif (Ekind (Def_Id) = E_Procedure or else Ekind (Def_Id) = E_Entry) *************** package body Sem_Ch6 is *** 7233,7255 **** Hom := Homonym (Hom); end loop; ! -- After examining all candidates for overriding, we are ! -- left with the best match which is a mode incompatible ! -- interface routine. Do not emit an error if the Expander ! -- is active since this error will be detected later on ! -- after all concurrent types are expanded and all wrappers ! -- are built. This check is meant for spec-only ! -- compilations. ! if Present (Candidate) ! and then not Expander_Active ! then Iface_Typ := Find_Parameter_Type (Parent (First_Formal (Candidate))); ! -- Def_Id is primitive of a protected type, declared ! -- inside the type, and the candidate is primitive of a ! -- limited or synchronized interface. if In_Scope and then Is_Protected_Type (Typ) --- 7711,7730 ---- Hom := Homonym (Hom); end loop; ! -- After examining all candidates for overriding, we are left with ! -- the best match which is a mode incompatible interface routine. ! -- Do not emit an error if the Expander is active since this error ! -- will be detected later on after all concurrent types are ! -- expanded and all wrappers are built. This check is meant for ! -- spec-only compilations. ! if Present (Candidate) and then not Expander_Active then Iface_Typ := Find_Parameter_Type (Parent (First_Formal (Candidate))); ! -- Def_Id is primitive of a protected type, declared inside the ! -- type, and the candidate is primitive of a limited or ! -- synchronized interface. if In_Scope and then Is_Protected_Type (Typ) *************** package body Sem_Ch6 is *** 7259,7273 **** or else Is_Synchronized_Interface (Iface_Typ) or else Is_Task_Interface (Iface_Typ)) then - -- Must reword this message, comma before to in -gnatj - -- mode ??? - Error_Msg_NE ("first formal of & must be of mode `OUT`, `IN OUT`" & " or access-to-variable", Typ, Candidate); Error_Msg_N ! ("\to be overridden by protected procedure or entry " ! & "(RM 9.4(11.9/2))", Typ); end if; end if; --- 7734,7745 ---- or else Is_Synchronized_Interface (Iface_Typ) or else Is_Task_Interface (Iface_Typ)) then Error_Msg_NE ("first formal of & must be of mode `OUT`, `IN OUT`" & " or access-to-variable", Typ, Candidate); Error_Msg_N ! ("\in order to be overridden by protected procedure or " ! & "entry (RM 9.4(11.9/2))", Typ); end if; end if; *************** package body Sem_Ch6 is *** 7334,7339 **** --- 7806,7858 ---- E := Current_Entity_In_Scope (S); + -- Ada 2005 (AI-251): Derivation of abstract interface primitives. + -- They are directly added to the list of primitive operations of + -- Derived_Type, unless this is a rederivation in the private part + -- of an operation that was already derived in the visible part of + -- the current package. + + if Ada_Version >= Ada_2005 + and then Present (Derived_Type) + and then Present (Alias (S)) + and then Is_Dispatching_Operation (Alias (S)) + and then Present (Find_Dispatching_Type (Alias (S))) + and then Is_Interface (Find_Dispatching_Type (Alias (S))) + then + -- For private types, when the full-view is processed we propagate to + -- the full view the non-overridden entities whose attribute "alias" + -- references an interface primitive. These entities were added by + -- Derive_Subprograms to ensure that interface primitives are + -- covered. + + -- Inside_Freeze_Actions is non zero when S corresponds with an + -- internal entity that links an interface primitive with its + -- covering primitive through attribute Interface_Alias (see + -- Add_Internal_Interface_Entities). + + if Inside_Freezing_Actions = 0 + and then Is_Package_Or_Generic_Package (Current_Scope) + and then In_Private_Part (Current_Scope) + and then Nkind (Parent (E)) = N_Private_Extension_Declaration + and then Nkind (Parent (S)) = N_Full_Type_Declaration + and then Full_View (Defining_Identifier (Parent (E))) + = Defining_Identifier (Parent (S)) + and then Alias (E) = Alias (S) + then + Check_Operation_From_Private_View (S, E); + Set_Is_Dispatching_Operation (S); + + -- Common case + + else + Enter_Overloaded_Entity (S); + Check_Dispatching_Operation (S, Empty); + Check_For_Primitive_Subprogram (Is_Primitive_Subp); + end if; + + return; + end if; + -- If there is no homonym then this is definitely not overriding if No (E) then *************** package body Sem_Ch6 is *** 7346,7351 **** --- 7865,7884 ---- if Comes_From_Source (S) then Check_Synchronized_Overriding (S, Overridden_Subp); + + -- (Ada 2012: AI05-0125-1): If S is a dispatching operation then + -- it may have overridden some hidden inherited primitive. Update + -- Overridden_Subp to avoid spurious errors when checking the + -- overriding indicator. + + if Ada_Version >= Ada_2012 + and then No (Overridden_Subp) + and then Is_Dispatching_Operation (S) + and then Present (Overridden_Operation (S)) + then + Overridden_Subp := Overridden_Operation (S); + end if; + Check_Overriding_Indicator (S, Overridden_Subp, Is_Primitive => Is_Primitive_Subp); end if; *************** package body Sem_Ch6 is *** 7380,7388 **** -- dispatch table anyway, because it can be dispatched to even if it -- cannot be called directly. ! elsif Present (Alias (S)) ! and then not Comes_From_Source (S) ! then Set_Scope (S, Current_Scope); if Is_Dispatching_Operation (Alias (S)) then --- 7913,7919 ---- -- dispatch table anyway, because it can be dispatched to even if it -- cannot be called directly. ! elsif Present (Alias (S)) and then not Comes_From_Source (S) then Set_Scope (S, Current_Scope); if Is_Dispatching_Operation (Alias (S)) then *************** package body Sem_Ch6 is *** 7409,7427 **** -- E exists and is overloadable else - -- Ada 2005 (AI-251): Derivation of abstract interface primitives - -- need no check against the homonym chain. They are directly added - -- to the list of primitive operations of Derived_Type. - - if Ada_Version >= Ada_05 - and then Present (Derived_Type) - and then Is_Dispatching_Operation (Alias (S)) - and then Present (Find_Dispatching_Type (Alias (S))) - and then Is_Interface (Find_Dispatching_Type (Alias (S))) - then - goto Add_New_Entity; - end if; - Check_Synchronized_Overriding (S, Overridden_Subp); -- Loop through E and its homonyms to determine if any of them is --- 7940,7945 ---- *************** package body Sem_Ch6 is *** 7478,7499 **** Check_Operation_From_Private_View (S, E); end if; ! -- In any case the implicit operation remains hidden by ! -- the existing declaration, which is overriding. ! Set_Is_Overriding_Operation (E); if Comes_From_Source (E) then Check_Overriding_Indicator (E, S, Is_Primitive => False); - - -- Indicate that E overrides the operation from which - -- S is inherited. - - if Present (Alias (S)) then - Set_Overridden_Operation (E, Alias (S)); - else - Set_Overridden_Operation (E, S); - end if; end if; return; --- 7996,8013 ---- Check_Operation_From_Private_View (S, E); end if; ! -- In any case the implicit operation remains hidden by the ! -- existing declaration, which is overriding. Indicate that ! -- E overrides the operation from which S is inherited. ! if Present (Alias (S)) then ! Set_Overridden_Operation (E, Alias (S)); ! else ! Set_Overridden_Operation (E, S); ! end if; if Comes_From_Source (E) then Check_Overriding_Indicator (E, S, Is_Primitive => False); end if; return; *************** package body Sem_Ch6 is *** 7641,7661 **** if No (Next_Entity (Prev)) then Set_Last_Entity (Current_Scope, Prev); end if; - end if; end if; Enter_Overloaded_Entity (S); ! Set_Is_Overriding_Operation (S); Check_Overriding_Indicator (S, E, Is_Primitive => True); -- If S is a user-defined subprogram or a null procedure ! -- expanded to override an inherited null procedure, then ! -- indicate that E overrides the operation from which S ! -- is inherited. It seems odd that Overridden_Operation ! -- isn't set in all cases where Is_Overriding_Operation ! -- is true, but doing so causes infinite loops in the ! -- compiler for implicit overriding subprograms. ??? if Comes_From_Source (S) or else --- 8155,8187 ---- if No (Next_Entity (Prev)) then Set_Last_Entity (Current_Scope, Prev); end if; end if; end if; Enter_Overloaded_Entity (S); ! ! -- For entities generated by Derive_Subprograms the ! -- overridden operation is the inherited primitive ! -- (which is available through the attribute alias). ! ! if not (Comes_From_Source (E)) ! and then Is_Dispatching_Operation (E) ! and then Find_Dispatching_Type (E) = ! Find_Dispatching_Type (S) ! and then Present (Alias (E)) ! and then Comes_From_Source (Alias (E)) ! then ! Set_Overridden_Operation (S, Alias (E)); ! else ! Set_Overridden_Operation (S, E); ! end if; ! Check_Overriding_Indicator (S, E, Is_Primitive => True); -- If S is a user-defined subprogram or a null procedure ! -- expanded to override an inherited null procedure, or a ! -- predefined dispatching primitive then indicate that E ! -- overrides the operation from which S is inherited. if Comes_From_Source (S) or else *************** package body Sem_Ch6 is *** 7664,7682 **** Nkind (Parent (S)) = N_Procedure_Specification and then Null_Present (Parent (S))) then if Present (Alias (E)) then Set_Overridden_Operation (S, Alias (E)); - else - Set_Overridden_Operation (S, E); end if; end if; if Is_Dispatching_Operation (E) then -- An overriding dispatching subprogram inherits the ! -- convention of the overridden subprogram (by ! -- AI-117). Set_Convention (S, Convention (E)); Check_Dispatching_Operation (S, E); --- 8190,8209 ---- Nkind (Parent (S)) = N_Procedure_Specification and then Null_Present (Parent (S))) + or else + (Present (Alias (E)) + and then + Is_Predefined_Dispatching_Operation (Alias (E))) then if Present (Alias (E)) then Set_Overridden_Operation (S, Alias (E)); end if; end if; if Is_Dispatching_Operation (E) then -- An overriding dispatching subprogram inherits the ! -- convention of the overridden subprogram (AI-117). Set_Convention (S, Convention (E)); Check_Dispatching_Operation (S, E); *************** package body Sem_Ch6 is *** 7779,7786 **** E := Homonym (E); end loop; - <> - -- On exit, we know that S is a new entity Enter_Overloaded_Entity (S); --- 8306,8311 ---- *************** package body Sem_Ch6 is *** 7812,7817 **** --- 8337,8346 ---- and then not Is_Dispatching_Operation (S) then Make_Inequality_Operator (S); + + if Ada_Version >= Ada_2012 then + Check_Untagged_Equality (S); + end if; end if; end New_Overloaded_Entity; *************** package body Sem_Ch6 is *** 7936,7953 **** elsif not Nkind_In (Parent (T), N_Access_Function_Definition, N_Access_Procedure_Definition) then - Error_Msg_NE - ("invalid use of incomplete type&", - Param_Spec, Formal_Type); ! -- Further checks on the legality of incomplete types ! -- in formal parts must be delayed until the freeze point ! -- of the enclosing subprogram or access to subprogram. end if; elsif Ekind (Formal_Type) = E_Void then ! Error_Msg_NE ("premature use of&", ! Parameter_Type (Param_Spec), Formal_Type); end if; -- Ada 2005 (AI-231): Create and decorate an internal subtype --- 8465,8503 ---- elsif not Nkind_In (Parent (T), N_Access_Function_Definition, N_Access_Procedure_Definition) then ! -- AI05-0151: Tagged incomplete types are allowed in all ! -- formal parts. Untagged incomplete types are not allowed ! -- in bodies. ! ! if Ada_Version >= Ada_2012 then ! if Is_Tagged_Type (Formal_Type) then ! null; ! ! elsif Nkind_In (Parent (Parent (T)), N_Accept_Statement, ! N_Entry_Body, ! N_Subprogram_Body) ! then ! Error_Msg_NE ! ("invalid use of untagged incomplete type&", ! Ptype, Formal_Type); ! end if; ! ! else ! Error_Msg_NE ! ("invalid use of incomplete type&", ! Param_Spec, Formal_Type); ! ! -- Further checks on the legality of incomplete types ! -- in formal parts are delayed until the freeze point ! -- of the enclosing subprogram or access to subprogram. ! end if; end if; elsif Ekind (Formal_Type) = E_Void then ! Error_Msg_NE ! ("premature use of&", ! Parameter_Type (Param_Spec), Formal_Type); end if; -- Ada 2005 (AI-231): Create and decorate an internal subtype *************** package body Sem_Ch6 is *** 7955,7961 **** -- formal in the enclosing scope. Finally, replace the parameter -- type of the formal with the internal subtype. ! if Ada_Version >= Ada_05 and then Null_Exclusion_Present (Param_Spec) then if not Is_Access_Type (Formal_Type) then --- 8505,8511 ---- -- formal in the enclosing scope. Finally, replace the parameter -- type of the formal with the internal subtype. ! if Ada_Version >= Ada_2005 and then Null_Exclusion_Present (Param_Spec) then if not Is_Access_Type (Formal_Type) then *************** package body Sem_Ch6 is *** 7968,7975 **** then Error_Msg_NE ("`NOT NULL` not allowed (& already excludes null)", ! Param_Spec, ! Formal_Type); end if; Formal_Type := --- 8518,8524 ---- then Error_Msg_NE ("`NOT NULL` not allowed (& already excludes null)", ! Param_Spec, Formal_Type); end if; Formal_Type := *************** package body Sem_Ch6 is *** 8072,8078 **** -- Ada 2005 (AI-231): Static checks ! if Ada_Version >= Ada_05 and then Is_Access_Type (Etype (Formal)) and then Can_Never_Be_Null (Etype (Formal)) then --- 8621,8627 ---- -- Ada 2005 (AI-231): Static checks ! if Ada_Version >= Ada_2005 and then Is_Access_Type (Etype (Formal)) and then Can_Never_Be_Null (Etype (Formal)) then *************** package body Sem_Ch6 is *** 8094,8100 **** -- Now set the kind (mode) of each formal Param_Spec := First (T); - while Present (Param_Spec) loop Formal := Defining_Identifier (Param_Spec); Set_Formal_Mode (Formal); --- 8643,8648 ---- *************** package body Sem_Ch6 is *** 8150,8210 **** 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. -- For a postcondition pragma within a generic, preserve the pragma -- for later expansion. - Set_Analyzed (CP, False); - if Nam = Name_Postcondition and then not Expander_Active then return CP; end if; ! -- 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 ! -- Nothing to do if we are not generating code ! if Operating_Mode /= Generate_Code then ! return; end if; -- Grab preconditions from spec --- 8698,8872 ---- is Loc : constant Source_Ptr := Sloc (N); Prag : Node_Id; Parms : List_Id; ! Designator : Entity_Id; ! -- Subprogram designator, set from Spec_Id if present, else Body_Id ! ! Precond : Node_Id := Empty; ! -- Set non-Empty if we prepend precondition to the declarations. This ! -- is used to hook up inherited preconditions (adding the condition ! -- expression with OR ELSE, and adding the message). ! ! Inherited_Precond : Node_Id; ! -- Precondition inherited from parent subprogram ! ! Inherited : constant Subprogram_List := ! Inherited_Subprograms (Spec_Id); ! -- List of subprograms inherited by this subprogram ! ! Plist : List_Id := No_List; ! -- List of generated postconditions ! ! function Grab_PPC (Pspec : Entity_Id := Empty) 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. If Pspec is non- ! -- empty, this is the case of inheriting a PPC, where we must change ! -- references to parameters of the inherited subprogram to point to the ! -- corresponding parameters of the current subprogram. ! ! function Invariants_Or_Predicates_Present return Boolean; ! -- Determines if any invariants or predicates are present for any OUT ! -- or IN OUT parameters of the subprogram, or (for a function) if the ! -- return value has an invariant. -------------- -- Grab_PPC -- -------------- ! function Grab_PPC (Pspec : Entity_Id := Empty) return Node_Id is ! Nam : constant Name_Id := Pragma_Name (Prag); ! Map : Elist_Id; ! CP : Node_Id; begin + -- Prepare map if this is the case where we have to map entities of + -- arguments in the overridden subprogram to corresponding entities + -- of the current subprogram. + + if No (Pspec) then + Map := No_Elist; + + else + declare + PF : Entity_Id; + CF : Entity_Id; + + begin + Map := New_Elmt_List; + PF := First_Formal (Pspec); + CF := First_Formal (Designator); + while Present (PF) loop + Append_Elmt (PF, Map); + Append_Elmt (CF, Map); + Next_Formal (PF); + Next_Formal (CF); + end loop; + end; + end if; + + -- Now we can copy the tree, doing any required substitutions + + CP := New_Copy_Tree (Prag, Map => Map, New_Scope => Current_Scope); + -- 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); + + -- We also make sure Comes_From_Source is False for the copy + + Set_Comes_From_Source (CP, False); + -- For a postcondition pragma within a generic, preserve the pragma -- for later expansion. if Nam = Name_Postcondition and then not Expander_Active then return CP; end if; ! -- Change copy of pragma into corresponding pragma Check Prepend_To (Pragma_Argument_Associations (CP), Make_Pragma_Argument_Association (Sloc (Prag), ! Expression => Make_Identifier (Loc, Nam))); ! Set_Pragma_Identifier (CP, Make_Identifier (Sloc (Prag), Name_Check)); ! ! -- If this is inherited case and the current message starts with ! -- "failed p", we change it to "failed inherited p...". ! ! if Present (Pspec) then ! declare ! Msg : constant Node_Id := ! Last (Pragma_Argument_Associations (CP)); ! ! begin ! if Chars (Msg) = Name_Message then ! String_To_Name_Buffer (Strval (Expression (Msg))); ! ! if Name_Buffer (1 .. 8) = "failed p" then ! Insert_Str_In_Name_Buffer ("inherited ", 8); ! Set_Strval ! (Expression (Last (Pragma_Argument_Associations (CP))), ! String_From_Name_Buffer); ! end if; ! end if; ! end; ! end if; ! ! -- Return the check pragma return CP; end Grab_PPC; + -------------------------------------- + -- Invariants_Or_Predicates_Present -- + -------------------------------------- + + function Invariants_Or_Predicates_Present return Boolean is + Formal : Entity_Id; + + begin + -- Check function return result + + if Ekind (Designator) /= E_Procedure + and then Has_Invariants (Etype (Designator)) + then + return True; + end if; + + -- Check parameters + + Formal := First_Formal (Designator); + while Present (Formal) loop + if Ekind (Formal) /= E_In_Parameter + and then + (Has_Invariants (Etype (Formal)) + or else Present (Predicate_Function (Etype (Formal)))) + then + return True; + end if; + + Next_Formal (Formal); + end loop; + + return False; + end Invariants_Or_Predicates_Present; + -- Start of processing for Process_PPCs begin ! -- Capture designator from spec if present, else from body ! if Present (Spec_Id) then ! Designator := Spec_Id; ! else ! Designator := Body_Id; end if; -- Grab preconditions from spec *************** package body Sem_Ch6 is *** 8217,8235 **** Prag := Spec_PPC_List (Spec_Id); while Present (Prag) loop ! if Pragma_Name (Prag) = Name_Precondition ! and then Pragma_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 --- 8879,8999 ---- Prag := Spec_PPC_List (Spec_Id); while Present (Prag) loop ! if Pragma_Name (Prag) = Name_Precondition then ! -- For Pre (or Precondition pragma), we simply prepend the ! -- pragma to the list of declarations right away so that it ! -- will be executed at the start of the procedure. 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. There can be more then one precondition when we ! -- use pragma Precondition ! ! if not Class_Present (Prag) then ! Prepend (Grab_PPC, Declarations (N)); ! ! -- For Pre'Class there can only be one pragma, and we save ! -- it in Precond for now. We will add inherited Pre'Class ! -- stuff before inserting this pragma in the declarations. ! else ! Precond := Grab_PPC; ! end if; end if; Prag := Next_Pragma (Prag); end loop; + + -- Now deal with inherited preconditions + + for J in Inherited'Range loop + Prag := Spec_PPC_List (Inherited (J)); + + while Present (Prag) loop + if Pragma_Name (Prag) = Name_Precondition + and then Class_Present (Prag) + then + Inherited_Precond := Grab_PPC (Inherited (J)); + + -- No precondition so far, so establish this as the first + + if No (Precond) then + Precond := Inherited_Precond; + + -- Here we already have a precondition, add inherited one + + else + -- Add new precondition to old one using OR ELSE + + declare + New_Expr : constant Node_Id := + Get_Pragma_Arg + (Next + (First + (Pragma_Argument_Associations + (Inherited_Precond)))); + Old_Expr : constant Node_Id := + Get_Pragma_Arg + (Next + (First + (Pragma_Argument_Associations + (Precond)))); + + begin + if Paren_Count (Old_Expr) = 0 then + Set_Paren_Count (Old_Expr, 1); + end if; + + if Paren_Count (New_Expr) = 0 then + Set_Paren_Count (New_Expr, 1); + end if; + + Rewrite (Old_Expr, + Make_Or_Else (Sloc (Old_Expr), + Left_Opnd => Relocate_Node (Old_Expr), + Right_Opnd => New_Expr)); + end; + + -- Add new message in the form: + + -- failed precondition from bla + -- also failed inherited precondition from bla + -- ... + + -- Skip this if exception locations are suppressed + + if not Exception_Locations_Suppressed then + declare + New_Msg : constant Node_Id := + Get_Pragma_Arg + (Last + (Pragma_Argument_Associations + (Inherited_Precond))); + Old_Msg : constant Node_Id := + Get_Pragma_Arg + (Last + (Pragma_Argument_Associations + (Precond))); + begin + Start_String (Strval (Old_Msg)); + Store_String_Chars (ASCII.LF & " also "); + Store_String_Chars (Strval (New_Msg)); + Set_Strval (Old_Msg, End_String); + end; + end if; + end if; + end if; + + Prag := Next_Pragma (Prag); + end loop; + end loop; + + -- If we have built a precondition for Pre'Class (including any + -- Pre'Class aspects inherited from parent subprograms), then we + -- insert this composite precondition at this stage. + + if Present (Precond) then + Prepend (Precond, Declarations (N)); + end if; end if; -- Build postconditions procedure if needed and prepend the following *************** package body Sem_Ch6 is *** 8240,8245 **** --- 9004,9012 ---- -- pragma Check (Postcondition, condition [,message]); -- pragma Check (Postcondition, condition [,message]); -- ... + -- Invariant_Procedure (_Result) ... + -- Invariant_Procedure (Arg1) + -- ... -- end; -- First we deal with the postconditions in the body *************** package body Sem_Ch6 is *** 8263,8275 **** Analyze (Prag); ! -- If expansion is disabled, as in a generic unit, ! -- save pragma for later expansion. if not Expander_Active then ! Prepend (Grab_PPC (Name_Postcondition), Declarations (N)); else ! Append (Grab_PPC (Name_Postcondition), Plist); end if; end if; --- 9030,9042 ---- Analyze (Prag); ! -- If expansion is disabled, as in a generic unit, save ! -- pragma for later expansion. if not Expander_Active then ! Prepend (Grab_PPC, Declarations (N)); else ! Append (Grab_PPC, Plist); end if; end if; *************** package body Sem_Ch6 is *** 8291,8343 **** -- 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 Pragma_Enabled (Prag) ! then ! if Plist = No_List then ! Plist := Empty_List; ! end if; ! if not Expander_Active then ! Prepend (Grab_PPC (Name_Postcondition), Declarations (N)); else ! Append (Grab_PPC (Name_Postcondition), Plist); end if; end if; ! Prag := Next_Pragma (Prag); ! end loop; end if; ! -- If we had any postconditions and expansion is enabled, build ! -- the _Postconditions procedure. ! if Present (Plist) and then Expander_Active 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; declare Post_Proc : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => Name_uPostconditions); -- The entity for the _Postconditions procedure begin Prepend_To (Declarations (N), Make_Subprogram_Body (Loc, --- 9058,9217 ---- -- Now deal with any postconditions from the spec if Present (Spec_Id) then + Spec_Postconditions : declare + procedure Process_Post_Conditions + (Spec : Node_Id; + Class : Boolean); + -- This processes the Spec_PPC_List from Spec, processing any + -- postconditions from the list. If Class is True, then only + -- postconditions marked with Class_Present are considered. + -- The caller has checked that Spec_PPC_List is non-Empty. ! ----------------------------- ! -- Process_Post_Conditions -- ! ----------------------------- ! procedure Process_Post_Conditions ! (Spec : Node_Id; ! Class : Boolean) ! is ! Pspec : Node_Id; ! begin ! if Class then ! Pspec := Spec; else ! Pspec := Empty; end if; + + -- Loop through PPC pragmas from spec + + Prag := Spec_PPC_List (Spec); + loop + if Pragma_Name (Prag) = Name_Postcondition + and then (not Class or else Class_Present (Prag)) + then + if Plist = No_List then + Plist := Empty_List; + end if; + + if not Expander_Active then + Prepend + (Grab_PPC (Pspec), Declarations (N)); + else + Append (Grab_PPC (Pspec), Plist); + end if; + end if; + + Prag := Next_Pragma (Prag); + exit when No (Prag); + end loop; + end Process_Post_Conditions; + + -- Start of processing for Spec_Postconditions + + begin + if Present (Spec_PPC_List (Spec_Id)) then + Process_Post_Conditions (Spec_Id, Class => False); end if; ! -- Process inherited postconditions ! ! for J in Inherited'Range loop ! if Present (Spec_PPC_List (Inherited (J))) then ! Process_Post_Conditions (Inherited (J), Class => True); ! end if; ! end loop; ! end Spec_Postconditions; end if; ! -- If we had any postconditions and expansion is enabled, or if the ! -- procedure has invariants, then build the _Postconditions procedure. ! if (Present (Plist) or else Invariants_Or_Predicates_Present) and then Expander_Active then ! if No (Plist) then ! Plist := Empty_List; ! end if; ! ! -- Special processing for function case ! ! if Ekind (Designator) /= E_Procedure then ! declare ! Rent : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => Name_uResult); ! Ftyp : constant Entity_Id := Etype (Designator); ! ! begin ! Set_Etype (Rent, Ftyp); ! ! -- Add argument for return ! ! Parms := ! New_List ( ! Make_Parameter_Specification (Loc, ! Parameter_Type => New_Occurrence_Of (Ftyp, Loc), ! Defining_Identifier => Rent)); ! ! -- Add invariant call if returning type with invariants ! ! if Has_Invariants (Etype (Rent)) ! and then Present (Invariant_Procedure (Etype (Rent))) ! then ! Append_To (Plist, ! Make_Invariant_Call (New_Occurrence_Of (Rent, Loc))); ! end if; ! end; ! ! -- Procedure rather than a function else Parms := No_List; end if; + -- Add invariant calls and predicate calls for parameters. Note that + -- this is done for functions as well, since in Ada 2012 they can + -- have IN OUT args. + + declare + Formal : Entity_Id; + Ftype : Entity_Id; + + begin + Formal := First_Formal (Designator); + while Present (Formal) loop + if Ekind (Formal) /= E_In_Parameter then + Ftype := Etype (Formal); + + if Has_Invariants (Ftype) + and then Present (Invariant_Procedure (Ftype)) + then + Append_To (Plist, + Make_Invariant_Call + (New_Occurrence_Of (Formal, Loc))); + end if; + + if Present (Predicate_Function (Ftype)) then + Append_To (Plist, + Make_Predicate_Check + (Ftype, New_Occurrence_Of (Formal, Loc))); + end if; + end if; + + Next_Formal (Formal); + end loop; + end; + + -- Build and insert postcondition procedure + declare Post_Proc : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => Name_uPostconditions); -- The entity for the _Postconditions procedure + begin Prepend_To (Declarations (N), Make_Subprogram_Body (Loc, *************** package body Sem_Ch6 is *** 8355,8374 **** -- If this is a procedure, set the Postcondition_Proc attribute on -- the proper defining entity for the subprogram. ! if Etype (Subp) = Standard_Void_Type then ! if Present (Spec_Id) then ! Set_Postcondition_Proc (Spec_Id, Post_Proc); ! else ! Set_Postcondition_Proc (Body_Id, Post_Proc); ! end if; end if; end; ! if Present (Spec_Id) then ! Set_Has_Postconditions (Spec_Id); ! else ! Set_Has_Postconditions (Body_Id); ! end if; end if; end Process_PPCs; --- 9229,9240 ---- -- If this is a procedure, set the Postcondition_Proc attribute on -- the proper defining entity for the subprogram. ! if Ekind (Designator) = E_Procedure then ! Set_Postcondition_Proc (Designator, Post_Proc); end if; end; ! Set_Has_Postconditions (Designator); end if; end Process_PPCs; *************** package body Sem_Ch6 is *** 8409,8415 **** ------------------------- procedure Set_Actual_Subtypes (N : Node_Id; Subp : Entity_Id) is - Loc : constant Source_Ptr := Sloc (N); Decl : Node_Id; Formal : Entity_Id; T : Entity_Id; --- 9275,9280 ---- *************** package body Sem_Ch6 is *** 8523,8529 **** if Present (First_Stmt) then Insert_List_Before_And_Analyze (First_Stmt, ! Freeze_Entity (Defining_Identifier (Decl), Loc)); end if; if Nkind (N) = N_Accept_Statement --- 9388,9394 ---- if Present (First_Stmt) then Insert_List_Before_And_Analyze (First_Stmt, ! Freeze_Entity (Defining_Identifier (Decl), N)); end if; if Nkind (N) = N_Accept_Statement *************** package body Sem_Ch6 is *** 8556,8563 **** if Ekind (Scope (Formal_Id)) = E_Function or else Ekind (Scope (Formal_Id)) = E_Generic_Function then ! Error_Msg_N ("functions can only have IN parameters", Spec); ! Set_Ekind (Formal_Id, E_In_Parameter); elsif In_Present (Spec) then Set_Ekind (Formal_Id, E_In_Out_Parameter); --- 9421,9441 ---- if Ekind (Scope (Formal_Id)) = E_Function or else Ekind (Scope (Formal_Id)) = E_Generic_Function then ! -- [IN] OUT parameters allowed for functions in Ada 2012 ! ! if Ada_Version >= Ada_2012 then ! if In_Present (Spec) then ! Set_Ekind (Formal_Id, E_In_Out_Parameter); ! else ! Set_Ekind (Formal_Id, E_Out_Parameter); ! end if; ! ! -- But not in earlier versions of Ada ! ! else ! Error_Msg_N ("functions can only have IN parameters", Spec); ! Set_Ekind (Formal_Id, E_In_Parameter); ! end if; elsif In_Present (Spec) then Set_Ekind (Formal_Id, E_In_Out_Parameter); *************** package body Sem_Ch6 is *** 8582,8588 **** -- Ada 2005 (AI-231): In Ada95, access parameters are always non- -- null; In Ada 2005, only if then null_exclusion is explicit. ! if Ada_Version < Ada_05 or else Can_Never_Be_Null (Etype (Formal_Id)) then Set_Is_Known_Non_Null (Formal_Id); --- 9460,9466 ---- -- Ada 2005 (AI-231): In Ada95, access parameters are always non- -- null; In Ada 2005, only if then null_exclusion is explicit. ! if Ada_Version < Ada_2005 or else Can_Never_Be_Null (Etype (Formal_Id)) then Set_Is_Known_Non_Null (Formal_Id); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch6.ads gcc-4.6.0/gcc/ada/sem_ch6.ads *** gcc-4.5.2/gcc/ada/sem_ch6.ads Mon Apr 20 08:35:16 2009 --- gcc-4.6.0/gcc/ada/sem_ch6.ads Tue Oct 26 12:45:45 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch6 is *** 28,42 **** type Conformance_Type is (Type_Conformant, Mode_Conformant, Subtype_Conformant, Fully_Conformant); -- Conformance type used in conformance checks between specs and bodies, -- and for overriding. The literals match the RM definitions of the ! -- corresponding terms. procedure Analyze_Abstract_Subprogram_Declaration (N : Node_Id); procedure Analyze_Extended_Return_Statement (N : Node_Id); procedure Analyze_Function_Call (N : Node_Id); procedure Analyze_Operator_Symbol (N : Node_Id); procedure Analyze_Parameter_Association (N : Node_Id); procedure Analyze_Procedure_Call (N : Node_Id); procedure Analyze_Simple_Return_Statement (N : Node_Id); procedure Analyze_Subprogram_Declaration (N : Node_Id); --- 28,45 ---- type Conformance_Type is (Type_Conformant, Mode_Conformant, Subtype_Conformant, Fully_Conformant); + pragma Ordered (Conformance_Type); -- Conformance type used in conformance checks between specs and bodies, -- and for overriding. The literals match the RM definitions of the ! -- corresponding terms. This is an ordered type, since each conformance ! -- type is stronger than the ones preceding it. procedure Analyze_Abstract_Subprogram_Declaration (N : Node_Id); procedure Analyze_Extended_Return_Statement (N : Node_Id); procedure Analyze_Function_Call (N : Node_Id); procedure Analyze_Operator_Symbol (N : Node_Id); procedure Analyze_Parameter_Association (N : Node_Id); + procedure Analyze_Parameterized_Expression (N : Node_Id); procedure Analyze_Procedure_Call (N : Node_Id); procedure Analyze_Simple_Return_Statement (N : Node_Id); procedure Analyze_Subprogram_Declaration (N : Node_Id); *************** package Sem_Ch6 is *** 183,191 **** (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id; Prim : Entity_Id) return Boolean; ! -- Returns true if both primitives have a matching name and they are also ! -- type conformant. Special management is done for functions returning ! -- interfaces. function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean; -- Determine whether two callable entities (subprograms, entries, --- 186,199 ---- (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id; Prim : Entity_Id) return Boolean; ! -- Returns true if both primitives have a matching name (including support ! -- for names of inherited private primitives --which have suffix 'P'), they ! -- are type conformant, and Prim is defined in the scope of Tagged_Type. ! -- Special management is done for functions returning interfaces. ! ! procedure List_Inherited_Pre_Post_Aspects (E : Entity_Id); ! -- E is the entity for a subprogram or generic subprogram spec. This call ! -- lists all inherited Pre/Post aspects if List_Inherited_Pre_Post is True. function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean; -- Determine whether two callable entities (subprograms, entries, diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch7.adb gcc-4.6.0/gcc/ada/sem_ch7.adb *** gcc-4.5.2/gcc/ada/sem_ch7.adb Thu Jul 30 09:23:06 2009 --- gcc-4.6.0/gcc/ada/sem_ch7.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,33 **** --- 28,34 ---- -- handling of private and full declarations, and the construction of dispatch -- tables for tagged types. + with Aspects; use Aspects; with Atree; use Atree; with Debug; use Debug; with Einfo; use Einfo; *************** with Sem_Ch6; use Sem_Ch6; *** 51,58 **** 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; --- 52,60 ---- with Sem_Ch8; use Sem_Ch8; with Sem_Ch10; use Sem_Ch10; with Sem_Ch12; use Sem_Ch12; + with Sem_Ch13; use Sem_Ch13; with Sem_Disp; use Sem_Disp; ! with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Snames; use Snames; *************** package body Sem_Ch7 is *** 252,268 **** end if; if Is_Package_Or_Generic_Package (Spec_Id) ! and then ! (Scope (Spec_Id) = Standard_Standard ! or else Is_Child_Unit (Spec_Id)) and then not Unit_Requires_Body (Spec_Id) then if Ada_Version = Ada_83 then Error_Msg_N ("optional package body (not allowed in Ada 95)?", N); else ! Error_Msg_N ! ("spec of this package does not allow a body", N); end if; end if; end if; --- 254,268 ---- end if; if Is_Package_Or_Generic_Package (Spec_Id) ! and then (Scope (Spec_Id) = Standard_Standard ! or else Is_Child_Unit (Spec_Id)) and then not Unit_Requires_Body (Spec_Id) then if Ada_Version = Ada_83 then Error_Msg_N ("optional package body (not allowed in Ada 95)?", N); else ! Error_Msg_N ("spec of this package does not allow a body", N); end if; end if; end if; *************** package body Sem_Ch7 is *** 474,482 **** -- is conservative and definitely correct. -- We only do this at the outer (library) level non-generic packages. ! -- The reason is simply to cut down on the number of external symbols ! -- generated, so this is simply an optimization of the efficiency ! -- of the compilation process. It has no other effect. if (Scope (Spec_Id) = Standard_Standard or else Is_Child_Unit (Spec_Id)) and then not Is_Generic_Unit (Spec_Id) --- 474,483 ---- -- is conservative and definitely correct. -- We only do this at the outer (library) level non-generic packages. ! -- The reason is simply to cut down on the number of global symbols ! -- generated, which has a double effect: (1) to make the compilation ! -- process more efficient and (2) to give the code generator more ! -- freedom to optimize within each unit, especially subprograms. if (Scope (Spec_Id) = Standard_Standard or else Is_Child_Unit (Spec_Id)) and then not Is_Generic_Unit (Spec_Id) *************** package body Sem_Ch7 is *** 486,504 **** function Has_Referencer (L : List_Id; ! Outer : Boolean) ! return Boolean; -- Traverse the given list of declarations in reverse order. ! -- Return True as soon as a referencer is reached. Return False if ! -- none is found. The Outer parameter is True for the outer level ! -- call, and False for inner level calls for nested packages. If ! -- Outer is True, then any entities up to the point of hitting a ! -- referencer get their Is_Public flag cleared, so that the ! -- entities will be treated as static entities in the C sense, and ! -- need not have fully qualified names. For inner levels, we need ! -- all names to be fully qualified to deal with the same name ! -- appearing in parallel packages (right now this is tied to their ! -- being external). -------------------- -- Has_Referencer -- --- 487,506 ---- function Has_Referencer (L : List_Id; ! Outer : Boolean) return Boolean; -- Traverse the given list of declarations in reverse order. ! -- Return True if a referencer is present. Return False if none is ! -- found. The Outer parameter is True for the outer level call and ! -- False for inner level calls for nested packages. If Outer is ! -- True, then any entities up to the point of hitting a referencer ! -- get their Is_Public flag cleared, so that the entities will be ! -- treated as static entities in the C sense, and need not have ! -- fully qualified names. Furthermore, if the referencer is an ! -- inlined subprogram that doesn't reference other subprograms, ! -- we keep clearing the Is_Public flag on subprograms. For inner ! -- levels, we need all names to be fully qualified to deal with ! -- the same name appearing in parallel packages (right now this ! -- is tied to their being external). -------------------- -- Has_Referencer -- *************** package body Sem_Ch7 is *** 506,519 **** function Has_Referencer (L : List_Id; ! Outer : Boolean) ! return Boolean is D : Node_Id; E : Entity_Id; K : Node_Kind; S : Entity_Id; begin if No (L) then return False; --- 508,576 ---- function Has_Referencer (L : List_Id; ! Outer : Boolean) return Boolean is + Has_Referencer_Except_For_Subprograms : Boolean := False; + D : Node_Id; E : Entity_Id; K : Node_Kind; S : Entity_Id; + function Check_Subprogram_Ref (N : Node_Id) + return Traverse_Result; + -- Look for references to subprograms + + -------------------------- + -- Check_Subprogram_Ref -- + -------------------------- + + function Check_Subprogram_Ref (N : Node_Id) + return Traverse_Result + is + V : Node_Id; + + begin + -- Check name of procedure or function calls + + if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) + and then Is_Entity_Name (Name (N)) + then + return Abandon; + end if; + + -- Check prefix of attribute references + + if Nkind (N) = N_Attribute_Reference + and then Is_Entity_Name (Prefix (N)) + and then Present (Entity (Prefix (N))) + and then Ekind (Entity (Prefix (N))) in Subprogram_Kind + then + return Abandon; + end if; + + -- Check value of constants + + if Nkind (N) = N_Identifier + and then Present (Entity (N)) + and then Ekind (Entity (N)) = E_Constant + then + V := Constant_Value (Entity (N)); + if Present (V) + and then not Compile_Time_Known_Value_Or_Aggr (V) + then + return Abandon; + end if; + end if; + + return OK; + end Check_Subprogram_Ref; + + function Check_Subprogram_Refs is + new Traverse_Func (Check_Subprogram_Ref); + + -- Start of processing for Has_Referencer + begin if No (L) then return False; *************** package body Sem_Ch7 is *** 526,531 **** --- 583,590 ---- if K in N_Body_Stub then return True; + -- Processing for subprogram bodies + elsif K = N_Subprogram_Body then if Acts_As_Spec (D) then E := Defining_Entity (D); *************** package body Sem_Ch7 is *** 542,548 **** -- of accessing global entities. if Has_Pragma_Inline (E) then ! return True; else Set_Is_Public (E, False); end if; --- 601,613 ---- -- of accessing global entities. if Has_Pragma_Inline (E) then ! if Outer ! and then Check_Subprogram_Refs (D) = OK ! then ! Has_Referencer_Except_For_Subprograms := True; ! else ! return True; ! end if; else Set_Is_Public (E, False); end if; *************** package body Sem_Ch7 is *** 550,567 **** else E := Corresponding_Spec (D); ! if Present (E) ! and then (Is_Generic_Unit (E) ! or else Has_Pragma_Inline (E) ! or else Is_Inlined (E)) ! then ! return True; end if; end if; -- Processing for package bodies elsif K = N_Package_Body and then Present (Corresponding_Spec (D)) then E := Corresponding_Spec (D); --- 615,644 ---- else E := Corresponding_Spec (D); ! if Present (E) then ! ! -- A generic subprogram body acts as a referencer ! ! if Is_Generic_Unit (E) then ! return True; ! end if; ! ! if Has_Pragma_Inline (E) or else Is_Inlined (E) then ! if Outer ! and then Check_Subprogram_Refs (D) = OK ! then ! Has_Referencer_Except_For_Subprograms := True; ! else ! return True; ! end if; ! end if; end if; end if; -- Processing for package bodies elsif K = N_Package_Body + and then not Has_Referencer_Except_For_Subprograms and then Present (Corresponding_Spec (D)) then E := Corresponding_Spec (D); *************** package body Sem_Ch7 is *** 591,597 **** -- Processing for package specs, recurse into declarations. -- Again we skip this for the case of generic instances. ! elsif K = N_Package_Declaration then S := Specification (D); if not Is_Generic_Unit (Defining_Entity (S)) then --- 668,676 ---- -- Processing for package specs, recurse into declarations. -- Again we skip this for the case of generic instances. ! elsif K = N_Package_Declaration ! and then not Has_Referencer_Except_For_Subprograms ! then S := Specification (D); if not Is_Generic_Unit (Defining_Entity (S)) then *************** package body Sem_Ch7 is *** 618,623 **** --- 697,704 ---- E := Defining_Entity (D); if Outer + and then (not Has_Referencer_Except_For_Subprograms + or else K = N_Subprogram_Declaration) and then not Is_Imported (E) and then not Is_Exported (E) and then No (Interface_Name (E)) *************** package body Sem_Ch7 is *** 629,635 **** Prev (D); end loop; ! return False; end Has_Referencer; -- Start of processing for Make_Non_Public_Where_Possible --- 710,716 ---- Prev (D); end loop; ! return Has_Referencer_Except_For_Subprograms; end Has_Referencer; -- Start of processing for Make_Non_Public_Where_Possible *************** package body Sem_Ch7 is *** 687,693 **** -- package Pkg is ... if From_With_Type (Id) then ! return; end if; if Debug_Flag_C then --- 768,774 ---- -- package Pkg is ... if From_With_Type (Id) then ! goto Leave; end if; if Debug_Flag_C then *************** package body Sem_Ch7 is *** 761,766 **** --- 842,850 ---- Write_Location (Sloc (N)); Write_Eol; end if; + + <> + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Package_Declaration; ----------------------------------- *************** package body Sem_Ch7 is *** 786,797 **** -- 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, and on --- 870,875 ---- *************** package body Sem_Ch7 is *** 820,852 **** -- 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 -- --------------------- --- 898,903 ---- *************** package body Sem_Ch7 is *** 1075,1093 **** begin if Present (Vis_Decls) then Analyze_Declarations (Vis_Decls); - Analyze_PPCs (Vis_Decls); end if; ! -- Verify that incomplete types have received full declarations E := First_Entity (Id); while Present (E) loop if Ekind (E) = E_Incomplete_Type and then No (Full_View (E)) then Error_Msg_N ("no declaration in visible part for incomplete}", E); end if; Next_Entity (E); end loop; --- 1126,1153 ---- begin if Present (Vis_Decls) then Analyze_Declarations (Vis_Decls); end if; ! -- Verify that incomplete types have received full declarations and ! -- also build invariant procedures for any types with invariants. E := First_Entity (Id); while Present (E) loop + + -- Check on incomplete types + if Ekind (E) = E_Incomplete_Type and then No (Full_View (E)) then Error_Msg_N ("no declaration in visible part for incomplete}", E); end if; + -- Build invariant procedures + + if Is_Type (E) and then Has_Invariants (E) then + Build_Invariant_Procedure (E, N); + end if; + Next_Entity (E); end loop; *************** package body Sem_Ch7 is *** 1109,1115 **** declare Orig_Spec : constant Node_Id := Specification (Orig_Decl); Save_Priv : constant List_Id := Private_Declarations (Orig_Spec); - begin Set_Private_Declarations (Orig_Spec, Empty_List); Save_Global_References (Orig_Decl); --- 1169,1174 ---- *************** package body Sem_Ch7 is *** 1210,1216 **** end if; Analyze_Declarations (Priv_Decls); - Analyze_PPCs (Priv_Decls); -- Check the private declarations for incomplete deferred constants --- 1269,1274 ---- *************** package body Sem_Ch7 is *** 1345,1350 **** --- 1403,1409 ---- New_Private_Type (N, Id, N); Set_Depends_On_Private (Id); + Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); end Analyze_Private_Type_Declaration; ---------------------------------- *************** package body Sem_Ch7 is *** 1451,1457 **** (Nkind (Parent (E)) = N_Private_Extension_Declaration and then Is_Generic_Type (E))) and then In_Open_Scopes (Scope (Etype (E))) ! and then E = Base_Type (E) then if Is_Tagged_Type (E) then Op_List := Primitive_Operations (E); --- 1510,1516 ---- (Nkind (Parent (E)) = N_Private_Extension_Declaration and then Is_Generic_Type (E))) and then In_Open_Scopes (Scope (Etype (E))) ! and then Is_Base_Type (E) then if Is_Tagged_Type (E) then Op_List := Primitive_Operations (E); *************** package body Sem_Ch7 is *** 1478,1485 **** --- 1537,1551 ---- Op_Elmt_2 := Next_Elmt (Op_Elmt); while Present (Op_Elmt_2) loop + + -- Skip entities with attribute Interface_Alias since + -- they are not overriding primitives (these entities + -- link an interface primitive with their covering + -- primitive) + if Chars (Node (Op_Elmt_2)) = Chars (Parent_Subp) and then Type_Conformant (Prim_Op, Node (Op_Elmt_2)) + and then No (Interface_Alias (Node (Op_Elmt_2))) then -- The private inherited operation has been -- overridden by an explicit subprogram: replace *************** package body Sem_Ch7 is *** 1488,1494 **** New_Op := Node (Op_Elmt_2); 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. --- 1554,1559 ---- *************** package body Sem_Ch7 is *** 1869,1875 **** procedure New_Private_Type (N : Node_Id; Id : Entity_Id; Def : Node_Id) is begin ! Enter_Name (Id); if Limited_Present (Def) then Set_Ekind (Id, E_Limited_Private_Type); --- 1934,1958 ---- procedure New_Private_Type (N : Node_Id; Id : Entity_Id; Def : Node_Id) is begin ! -- For other than Ada 2012, enter the name in the current scope ! ! if Ada_Version < Ada_2012 then ! Enter_Name (Id); ! ! -- Ada 2012 (AI05-0162): Enter the name in the current scope handling ! -- private type that completes an incomplete type. ! ! else ! declare ! Prev : Entity_Id; ! begin ! Prev := Find_Type_Name (N); ! pragma Assert (Prev = Id ! or else (Ekind (Prev) = E_Incomplete_Type ! and then Present (Full_View (Prev)) ! and then Full_View (Prev) = Id)); ! end; ! end if; if Limited_Present (Def) then Set_Ekind (Id, E_Limited_Private_Type); *************** package body Sem_Ch7 is *** 1906,1916 **** Set_Private_Dependents (Id, New_Elmt_List); if Tagged_Present (Def) then ! Set_Ekind (Id, E_Record_Type_With_Private); ! Set_Primitive_Operations (Id, New_Elmt_List); ! Set_Is_Abstract_Type (Id, Abstract_Present (Def)); ! Set_Is_Limited_Record (Id, Limited_Present (Def)); ! Set_Has_Delayed_Freeze (Id, True); -- Create a class-wide type with the same attributes --- 1989,1999 ---- Set_Private_Dependents (Id, New_Elmt_List); if Tagged_Present (Def) then ! Set_Ekind (Id, E_Record_Type_With_Private); ! Set_Direct_Primitive_Operations (Id, New_Elmt_List); ! Set_Is_Abstract_Type (Id, Abstract_Present (Def)); ! Set_Is_Limited_Record (Id, Limited_Present (Def)); ! Set_Has_Delayed_Freeze (Id, True); -- Create a class-wide type with the same attributes *************** package body Sem_Ch7 is *** 1944,1950 **** ------------------------------ procedure Preserve_Full_Attributes (Priv, Full : Entity_Id) is ! Priv_Is_Base_Type : constant Boolean := Priv = Base_Type (Priv); begin Set_Size_Info (Priv, (Full)); --- 2027,2033 ---- ------------------------------ procedure Preserve_Full_Attributes (Priv, Full : Entity_Id) is ! Priv_Is_Base_Type : constant Boolean := Is_Base_Type (Priv); begin Set_Size_Info (Priv, (Full)); *************** package body Sem_Ch7 is *** 1954,1959 **** --- 2037,2044 ---- Set_Is_Volatile (Priv, Is_Volatile (Full)); Set_Treat_As_Volatile (Priv, Treat_As_Volatile (Full)); Set_Is_Ada_2005_Only (Priv, Is_Ada_2005_Only (Full)); + Set_Is_Ada_2012_Only (Priv, Is_Ada_2012_Only (Full)); + Set_Has_Pragma_Unmodified (Priv, Has_Pragma_Unmodified (Full)); Set_Has_Pragma_Unreferenced (Priv, Has_Pragma_Unreferenced (Full)); Set_Has_Pragma_Unreferenced_Objects (Priv, Has_Pragma_Unreferenced_Objects *************** package body Sem_Ch7 is *** 2032,2037 **** --- 2117,2127 ---- end if; Set_Has_Discriminants (Priv, Has_Discriminants (Full)); + + if Has_Discriminants (Full) then + Set_Discriminant_Constraint (Priv, + Discriminant_Constraint (Full)); + end if; end if; end Preserve_Full_Attributes; *************** package body Sem_Ch7 is *** 2068,2074 **** -- but the formals are private and remain so. if Ekind (Id) = E_Function ! and then Is_Operator_Symbol_Name (Chars (Id)) and then not Is_Hidden (Id) and then not Error_Posted (Id) then --- 2158,2164 ---- -- but the formals are private and remain so. if Ekind (Id) = E_Function ! and then Is_Operator_Symbol_Name (Chars (Id)) and then not Is_Hidden (Id) and then not Error_Posted (Id) then diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch8.adb gcc-4.6.0/gcc/ada/sem_ch8.adb *** gcc-4.5.2/gcc/ada/sem_ch8.adb Tue Jan 26 14:02:25 2010 --- gcc-4.6.0/gcc/ada/sem_ch8.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sinfo.CN; use Sinfo.CN; *** 64,69 **** --- 64,70 ---- with Snames; use Snames; with Style; use Style; with Table; + with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; *************** package body Sem_Ch8 is *** 398,412 **** -- must be added to the list of actuals in any subsequent call. function Applicable_Use (Pack_Name : Node_Id) return Boolean; ! -- Common code to Use_One_Package and Set_Use, to determine whether ! -- use clause must be processed. Pack_Name is an entity name that ! -- references the package in question. procedure Attribute_Renaming (N : Node_Id); -- Analyze renaming of attribute as subprogram. The renaming declaration N -- is rewritten as a subprogram body that returns the attribute reference -- applied to the formals of the function. procedure Check_Frozen_Renaming (N : Node_Id; Subp : Entity_Id); -- A renaming_as_body may occur after the entity of the original decla- -- ration has been frozen. In that case, the body of the new entity must --- 399,418 ---- -- must be added to the list of actuals in any subsequent call. function Applicable_Use (Pack_Name : Node_Id) return Boolean; ! -- Common code to Use_One_Package and Set_Use, to determine whether use ! -- clause must be processed. Pack_Name is an entity name that references ! -- the package in question. procedure Attribute_Renaming (N : Node_Id); -- Analyze renaming of attribute as subprogram. The renaming declaration N -- is rewritten as a subprogram body that returns the attribute reference -- applied to the formals of the function. + procedure Set_Entity_Or_Discriminal (N : Node_Id; E : Entity_Id); + -- Set Entity, with style check if need be. For a discriminant reference, + -- replace by the corresponding discriminal, i.e. the parameter of the + -- initialization procedure that corresponds to the discriminant. + procedure Check_Frozen_Renaming (N : Node_Id; Subp : Entity_Id); -- A renaming_as_body may occur after the entity of the original decla- -- ration has been frozen. In that case, the body of the new entity must *************** package body Sem_Ch8 is *** 449,456 **** -- private with on E. procedure Find_Expanded_Name (N : Node_Id); ! -- Selected component is known to be expanded name. Verify legality of ! -- selector given the scope denoted by prefix. function Find_Renamed_Entity (N : Node_Id; --- 455,463 ---- -- private with on E. procedure Find_Expanded_Name (N : Node_Id); ! -- The input is a selected component is known to be expanded name. Verify ! -- legality of selector given the scope denoted by prefix, and change node ! -- N into a expanded name with a properly set Entity field. function Find_Renamed_Entity (N : Node_Id; *************** package body Sem_Ch8 is *** 506,515 **** procedure Write_Info; -- Write debugging information on entities declared in current scope - procedure Write_Scopes; - pragma Warnings (Off, Write_Scopes); - -- Debugging information: dump all entities on scope stack - -------------------------------- -- Analyze_Exception_Renaming -- -------------------------------- --- 513,518 ---- *************** package body Sem_Ch8 is *** 893,899 **** Error_Msg_NE ("\?function & will be called only once", Nam, Entity (Name (Nam))); ! Error_Msg_N ("\?suggest using an initialized constant object instead", Nam); end if; --- 896,902 ---- Error_Msg_NE ("\?function & will be called only once", Nam, Entity (Name (Nam))); ! Error_Msg_N -- CODEFIX ("\?suggest using an initialized constant object instead", Nam); end if; *************** package body Sem_Ch8 is *** 910,918 **** then declare Loc : constant Source_Ptr := Sloc (N); ! Subt : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('T')); begin Remove_Side_Effects (Nam); Insert_Action (N, --- 913,919 ---- then declare Loc : constant Source_Ptr := Sloc (N); ! Subt : constant Entity_Id := Make_Temporary (Loc, 'T'); begin Remove_Side_Effects (Nam); Insert_Action (N, *************** package body Sem_Ch8 is *** 953,965 **** -- Ada 2005 (AI-327) ! if Ada_Version >= Ada_05 and then Nkind (Nam) = N_Attribute_Reference and then Attribute_Name (Nam) = Name_Priority then null; ! elsif Ada_Version >= Ada_05 and then Nkind (Nam) in N_Has_Entity then declare --- 954,966 ---- -- Ada 2005 (AI-327) ! if Ada_Version >= Ada_2005 and then Nkind (Nam) = N_Attribute_Reference and then Attribute_Name (Nam) = Name_Priority then null; ! elsif Ada_Version >= Ada_2005 and then Nkind (Nam) in N_Has_Entity then declare *************** package body Sem_Ch8 is *** 1102,1108 **** -- Ada 2005 (AI-327) ! elsif Ada_Version >= Ada_05 and then Nkind (Nam) = N_Attribute_Reference and then Attribute_Name (Nam) = Name_Priority then --- 1103,1109 ---- -- Ada 2005 (AI-327) ! elsif Ada_Version >= Ada_2005 and then Nkind (Nam) = N_Attribute_Reference and then Attribute_Name (Nam) = Name_Priority then *************** package body Sem_Ch8 is *** 1315,1321 **** begin if not Is_Overloaded (P) then if Ekind (Etype (Nam)) /= E_Subprogram_Type ! or else not Type_Conformant (Etype (Nam), New_S) then Error_Msg_N ("designated type does not match specification", P); else Resolve (P); --- 1316,1323 ---- begin if not Is_Overloaded (P) then if Ekind (Etype (Nam)) /= E_Subprogram_Type ! or else not Type_Conformant (Etype (Nam), New_S) ! then Error_Msg_N ("designated type does not match specification", P); else Resolve (P); *************** package body Sem_Ch8 is *** 1330,1337 **** while Present (It.Nam) loop if Ekind (It.Nam) = E_Subprogram_Type ! and then Type_Conformant (It.Nam, New_S) then ! if Typ /= Any_Id then Error_Msg_N ("ambiguous renaming", P); return; --- 1332,1339 ---- while Present (It.Nam) loop if Ekind (It.Nam) = E_Subprogram_Type ! and then Type_Conformant (It.Nam, New_S) ! then if Typ /= Any_Id then Error_Msg_N ("ambiguous renaming", P); return; *************** package body Sem_Ch8 is *** 1966,1972 **** -- Ada 2005: check overriding indicator ! if Is_Overriding_Operation (Rename_Spec) then if Must_Not_Override (Specification (N)) then Error_Msg_NE ("subprogram& overrides inherited operation", --- 1968,1974 ---- -- Ada 2005: check overriding indicator ! if Present (Overridden_Operation (Rename_Spec)) then if Must_Not_Override (Specification (N)) then Error_Msg_NE ("subprogram& overrides inherited operation", *************** package body Sem_Ch8 is *** 2077,2084 **** Analyze_Renamed_Character (N, New_S, Present (Rename_Spec)); return; ! elsif (not Is_Entity_Name (Nam) ! and then Nkind (Nam) /= N_Operator_Symbol) or else not Is_Overloadable (Entity (Nam)) then Error_Msg_N ("expect valid subprogram name in renaming", N); --- 2079,2085 ---- Analyze_Renamed_Character (N, New_S, Present (Rename_Spec)); return; ! elsif not Is_Entity_Name (Nam) or else not Is_Overloadable (Entity (Nam)) then Error_Msg_N ("expect valid subprogram name in renaming", N); *************** package body Sem_Ch8 is *** 2099,2104 **** --- 2100,2120 ---- if No (Old_S) then Old_S := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual); + -- The visible operation may be an inherited abstract operation that + -- was overridden in the private part, in which case a call will + -- dispatch to the overriding operation. Use the overriding one in + -- the renaming declaration, to prevent spurious errors below. + + if Is_Overloadable (Old_S) + and then Is_Abstract_Subprogram (Old_S) + and then No (DTC_Entity (Old_S)) + and then Present (Alias (Old_S)) + and then not Is_Abstract_Subprogram (Alias (Old_S)) + and then Present (Overridden_Operation (Alias (Old_S))) + then + Old_S := Alias (Old_S); + end if; + -- When the renamed subprogram is overloaded and used as an actual -- of a generic, its entity is set to the first available homonym. -- We must first disambiguate the name, then set the proper entity. *************** package body Sem_Ch8 is *** 2127,2133 **** -- when performing a null exclusion check between a renaming and a -- renamed subprogram that has been found to be illegal. ! if Ada_Version >= Ada_05 and then Entity (Nam) /= Any_Id then Check_Null_Exclusion --- 2143,2149 ---- -- when performing a null exclusion check between a renaming and a -- renamed subprogram that has been found to be illegal. ! if Ada_Version >= Ada_2005 and then Entity (Nam) /= Any_Id then Check_Null_Exclusion *************** package body Sem_Ch8 is *** 2149,2157 **** -- Guard against previous errors, and omit renamings of predefined -- operators. ! elsif Ekind (Old_S) /= E_Function ! and then Ekind (Old_S) /= E_Procedure ! then null; elsif Requires_Overriding (Old_S) --- 2165,2171 ---- -- Guard against previous errors, and omit renamings of predefined -- operators. ! elsif not Ekind_In (Old_S, E_Function, E_Procedure) then null; elsif Requires_Overriding (Old_S) *************** package body Sem_Ch8 is *** 2435,2441 **** -- is dispatching. Test is skipped if some previous error was detected -- that set Old_S to Any_Id. ! if Ada_Version >= Ada_05 and then Old_S /= Any_Id and then not Is_Dispatching_Operation (Old_S) and then Is_Dispatching_Operation (New_S) --- 2449,2455 ---- -- is dispatching. Test is skipped if some previous error was detected -- that set Old_S to Any_Id. ! if Ada_Version >= Ada_2005 and then Old_S /= Any_Id and then not Is_Dispatching_Operation (Old_S) and then Is_Dispatching_Operation (New_S) *************** package body Sem_Ch8 is *** 2465,2482 **** end if; -- A useful warning, suggested by Ada Bug Finder (Ada-Europe 2005) if Comes_From_Source (N) and then Present (Old_S) ! and then Nkind (Old_S) = N_Defining_Operator_Symbol and then Nkind (New_S) = N_Defining_Operator_Symbol and then Chars (Old_S) /= Chars (New_S) then Error_Msg_NE ! ("?& is being renamed as a different operator", ! New_S, Old_S); end if; -- Another warning or some utility: if the new subprogram as the same -- name as the old one, the old one is not hidden by an outer homograph, -- the new one is not a public symbol, and the old one is otherwise --- 2479,2504 ---- end if; -- A useful warning, suggested by Ada Bug Finder (Ada-Europe 2005) + -- is to warn if an operator is being renamed as a different operator. + -- If the operator is predefined, examine the kind of the entity, not + -- the abbreviated declaration in Standard. if Comes_From_Source (N) and then Present (Old_S) ! and then ! (Nkind (Old_S) = N_Defining_Operator_Symbol ! or else Ekind (Old_S) = E_Operator) and then Nkind (New_S) = N_Defining_Operator_Symbol and then Chars (Old_S) /= Chars (New_S) then Error_Msg_NE ! ("?& is being renamed as a different operator", N, Old_S); end if; + -- Check for renaming of obsolescent subprogram + + Check_Obsolescent_2005_Entity (Entity (Nam), Nam); + -- Another warning or some utility: if the new subprogram as the same -- name as the old one, the old one is not hidden by an outer homograph, -- the new one is not a public symbol, and the old one is otherwise *************** package body Sem_Ch8 is *** 2584,2591 **** ("a generic package is not allowed in a use clause", Pack_Name); else ! Error_Msg_N -- CODEFIX??? ! ("& is not a usable package", Pack_Name); end if; else --- 2606,2612 ---- ("a generic package is not allowed in a use clause", Pack_Name); else ! Error_Msg_N ("& is not a usable package", Pack_Name); end if; else *************** package body Sem_Ch8 is *** 2706,2712 **** if Warn_On_Redundant_Constructs and then Pack = Current_Scope then ! Error_Msg_NE ("& is already use-visible within itself?", Pack_Name, Pack); end if; --- 2727,2733 ---- if Warn_On_Redundant_Constructs and then Pack = Current_Scope then ! Error_Msg_NE -- CODEFIX ("& is already use-visible within itself?", Pack_Name, Pack); end if; *************** package body Sem_Ch8 is *** 2838,2856 **** if Aname = Name_AST_Entry then declare ! Ent : Entity_Id; Decl : Node_Id; begin - Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); - Decl := Make_Object_Declaration (Loc, Defining_Identifier => Ent, ! Object_Definition => New_Occurrence_Of (RTE (RE_AST_Handler), Loc), ! Expression => Nam, ! Constant_Present => True); Set_Assignment_OK (Decl, True); Insert_Action (N, Decl); --- 2859,2875 ---- if Aname = Name_AST_Entry then declare ! Ent : constant Entity_Id := Make_Temporary (Loc, 'R', Nam); Decl : Node_Id; begin Decl := Make_Object_Declaration (Loc, Defining_Identifier => Ent, ! Object_Definition => New_Occurrence_Of (RTE (RE_AST_Handler), Loc), ! Expression => Nam, ! Constant_Present => True); Set_Assignment_OK (Decl, True); Insert_Action (N, Decl); *************** package body Sem_Ch8 is *** 2918,2924 **** -- type is still not frozen). We exclude from this processing generic -- formal subprograms found in instantiations and AST_Entry renamings. ! if not Present (Corresponding_Formal_Spec (N)) and then Etype (Nam) /= RTE (RE_AST_Handler) then declare --- 2937,2947 ---- -- type is still not frozen). We exclude from this processing generic -- formal subprograms found in instantiations and AST_Entry renamings. ! -- We must exclude VM targets because entity AST_Handler is defined in ! -- package System.Aux_Dec which is not available in those platforms. ! ! if VM_Target = No_VM ! and then not Present (Corresponding_Formal_Spec (N)) and then Etype (Nam) /= RTE (RE_AST_Handler) then declare *************** package body Sem_Ch8 is *** 3042,3047 **** --- 3065,3120 ---- end if; end Check_Frozen_Renaming; + ------------------------------- + -- Set_Entity_Or_Discriminal -- + ------------------------------- + + procedure Set_Entity_Or_Discriminal (N : Node_Id; E : Entity_Id) is + P : Node_Id; + + begin + -- If the entity is not a discriminant, or else expansion is disabled, + -- simply set the entity. + + if not In_Spec_Expression + or else Ekind (E) /= E_Discriminant + or else Inside_A_Generic + then + Set_Entity_With_Style_Check (N, E); + + -- The replacement of a discriminant by the corresponding discriminal + -- is not done for a task discriminant that appears in a default + -- expression of an entry parameter. See Exp_Ch2.Expand_Discriminant + -- for details on their handling. + + elsif Is_Concurrent_Type (Scope (E)) then + + P := Parent (N); + while Present (P) + and then not Nkind_In (P, N_Parameter_Specification, + N_Component_Declaration) + loop + P := Parent (P); + end loop; + + if Present (P) + and then Nkind (P) = N_Parameter_Specification + then + null; + + else + Set_Entity (N, Discriminal (E)); + end if; + + -- Otherwise, this is a discriminant in a context in which + -- it is a reference to the corresponding parameter of the + -- init proc for the enclosing type. + + else + Set_Entity (N, Discriminal (E)); + end if; + end Set_Entity_Or_Discriminal; + ----------------------------------- -- Check_In_Previous_With_Clause -- ----------------------------------- *************** package body Sem_Ch8 is *** 3076,3083 **** end loop; if Is_Child_Unit (Entity (Original_Node (Par))) then ! Error_Msg_NE ! ("& is not directly visible", Par, Entity (Par)); else return; end if; --- 3149,3155 ---- end loop; if Is_Child_Unit (Entity (Original_Node (Par))) then ! Error_Msg_NE ("& is not directly visible", Par, Entity (Par)); else return; end if; *************** package body Sem_Ch8 is *** 3292,3315 **** Id : Entity_Id; Elmt : Elmt_Id; ! function Is_Primitive_Operator (Op : Entity_Id; F : Entity_Id) return Boolean; -- Check whether Op is a primitive operator of a use-visible type ! --------------------------- ! -- Is_Primitive_Operator -- ! --------------------------- ! function Is_Primitive_Operator (Op : Entity_Id; F : Entity_Id) return Boolean is T : constant Entity_Id := Etype (F); begin ! return In_Use (T) and then Scope (T) = Scope (Op); ! end Is_Primitive_Operator; -- Start of processing for End_Use_Package --- 3364,3388 ---- Id : Entity_Id; Elmt : Elmt_Id; ! function Is_Primitive_Operator_In_Use (Op : Entity_Id; F : Entity_Id) return Boolean; -- Check whether Op is a primitive operator of a use-visible type ! ---------------------------------- ! -- Is_Primitive_Operator_In_Use -- ! ---------------------------------- ! function Is_Primitive_Operator_In_Use (Op : Entity_Id; F : Entity_Id) return Boolean is T : constant Entity_Id := Etype (F); begin ! return (In_Use (T) ! or else Present (Current_Use_Clause (Base_Type (T)))) and then Scope (T) = Scope (Op); ! end Is_Primitive_Operator_In_Use; -- Start of processing for End_Use_Package *************** package body Sem_Ch8 is *** 3340,3350 **** if Nkind (Id) = N_Defining_Operator_Symbol and then ! (Is_Primitive_Operator (Id, First_Formal (Id)) or else (Present (Next_Formal (First_Formal (Id))) and then ! Is_Primitive_Operator (Id, Next_Formal (First_Formal (Id))))) then null; --- 3413,3424 ---- if Nkind (Id) = N_Defining_Operator_Symbol and then ! (Is_Primitive_Operator_In_Use ! (Id, First_Formal (Id)) or else (Present (Next_Formal (First_Formal (Id))) and then ! Is_Primitive_Operator_In_Use (Id, Next_Formal (First_Formal (Id))))) then null; *************** package body Sem_Ch8 is *** 3426,3458 **** ------------------ procedure End_Use_Type (N : Node_Id) is Id : Entity_Id; Op_List : Elist_Id; ! Elmt : Elmt_Id; T : Entity_Id; begin Id := First (Subtype_Marks (N)); while Present (Id) loop ! -- A call to rtsfind may occur while analyzing a use_type clause, -- in which case the type marks are not resolved yet, and there is -- nothing to remove. ! if not Is_Entity_Name (Id) ! or else No (Entity (Id)) ! then goto Continue; end if; T := Entity (Id); ! if T = Any_Type ! or else From_With_Type (T) ! then null; ! -- Note that the use_Type clause may mention a subtype of the type -- whose primitive operations have been made visible. Here as -- elsewhere, it is the base type that matters for visibility. --- 3500,3546 ---- ------------------ procedure End_Use_Type (N : Node_Id) is + Elmt : Elmt_Id; Id : Entity_Id; Op_List : Elist_Id; ! Op : Entity_Id; T : Entity_Id; + function May_Be_Used_Primitive_Of (T : Entity_Id) return Boolean; + -- An operator may be primitive in several types, if they are declared + -- in the same scope as the operator. To determine the use-visibility of + -- the operator in such cases we must examine all types in the profile. + + ------------------------------ + -- May_Be_Used_Primitive_Of -- + ------------------------------ + + function May_Be_Used_Primitive_Of (T : Entity_Id) return Boolean is + begin + return Scope (Op) = Scope (T) + and then (In_Use (T) or else Is_Potentially_Use_Visible (T)); + end May_Be_Used_Primitive_Of; + + -- Start of processing for End_Use_Type + begin Id := First (Subtype_Marks (N)); while Present (Id) loop ! -- A call to Rtsfind may occur while analyzing a use_type clause, -- in which case the type marks are not resolved yet, and there is -- nothing to remove. ! if not Is_Entity_Name (Id) or else No (Entity (Id)) then goto Continue; end if; T := Entity (Id); ! if T = Any_Type or else From_With_Type (T) then null; ! -- Note that the use_type clause may mention a subtype of the type -- whose primitive operations have been made visible. Here as -- elsewhere, it is the base type that matters for visibility. *************** package body Sem_Ch8 is *** 3468,3475 **** Elmt := First_Elmt (Op_List); while Present (Elmt) loop ! if Nkind (Node (Elmt)) = N_Defining_Operator_Symbol then ! Set_Is_Potentially_Use_Visible (Node (Elmt), False); end if; Next_Elmt (Elmt); --- 3556,3585 ---- Elmt := First_Elmt (Op_List); while Present (Elmt) loop ! Op := Node (Elmt); ! ! if Nkind (Op) = N_Defining_Operator_Symbol then ! declare ! T_First : constant Entity_Id := ! Base_Type (Etype (First_Formal (Op))); ! T_Res : constant Entity_Id := Base_Type (Etype (Op)); ! T_Next : Entity_Id; ! ! begin ! if Present (Next_Formal (First_Formal (Op))) then ! T_Next := ! Base_Type (Etype (Next_Formal (First_Formal (Op)))); ! else ! T_Next := T_First; ! end if; ! ! if not May_Be_Used_Primitive_Of (T_First) ! and then not May_Be_Used_Primitive_Of (T_Next) ! and then not May_Be_Used_Primitive_Of (T_Res) ! then ! Set_Is_Potentially_Use_Visible (Op, False); ! end if; ! end; end if; Next_Elmt (Elmt); *************** package body Sem_Ch8 is *** 3805,3813 **** Nkind (Parent (Parent (N))) = N_Use_Package_Clause then Error_Msg_Qual_Level := 99; ! Error_Msg_NE ("\\missing `WITH &;`", N, Ent); Error_Msg_Qual_Level := 0; end if; end if; -- Set entity and its containing package as referenced. We --- 3915,3934 ---- Nkind (Parent (Parent (N))) = N_Use_Package_Clause then Error_Msg_Qual_Level := 99; ! Error_Msg_NE -- CODEFIX ! ("\\missing `WITH &;`", N, Ent); Error_Msg_Qual_Level := 0; end if; + + if Ekind (Ent) = E_Discriminant + and then Present (Corresponding_Discriminant (Ent)) + and then Scope (Corresponding_Discriminant (Ent)) = + Etype (Scope (Ent)) + then + Error_Msg_N + ("inherited discriminant not allowed here" & + " (RM 3.8 (12), 3.8.1 (6))!", N); + end if; end if; -- Set entity and its containing package as referenced. We *************** package body Sem_Ch8 is *** 3873,3879 **** if Chars (Lit) /= Chars (N) and then Is_Bad_Spelling_Of (Chars (N), Chars (Lit)) then Error_Msg_Node_2 := Lit; ! Error_Msg_N ("& is undefined, assume misspelling of &", N); Rewrite (N, New_Occurrence_Of (Lit, Sloc (N))); return; --- 3994,4000 ---- if Chars (Lit) /= Chars (N) and then Is_Bad_Spelling_Of (Chars (N), Chars (Lit)) then Error_Msg_Node_2 := Lit; ! Error_Msg_N -- CODEFIX ("& is undefined, assume misspelling of &", N); Rewrite (N, New_Occurrence_Of (Lit, Sloc (N))); return; *************** package body Sem_Ch8 is *** 3937,3943 **** -- this is a very common error for beginners to make). if Chars (N) = Name_Put or else Chars (N) = Name_Put_Line then ! Error_Msg_N ("\\possible missing `WITH Ada.Text_'I'O; " & "USE Ada.Text_'I'O`!", N); --- 4058,4064 ---- -- this is a very common error for beginners to make). if Chars (N) = Name_Put or else Chars (N) = Name_Put_Line then ! Error_Msg_N -- CODEFIX ("\\possible missing `WITH Ada.Text_'I'O; " & "USE Ada.Text_'I'O`!", N); *************** package body Sem_Ch8 is *** 3950,3956 **** and then Is_Known_Unit (Parent (N)) then Error_Msg_Node_2 := Selector_Name (Parent (N)); ! Error_Msg_N ("\\missing `WITH &.&;`", Prefix (Parent (N))); end if; -- Now check for possible misspellings --- 4071,4078 ---- and then Is_Known_Unit (Parent (N)) then Error_Msg_Node_2 := Selector_Name (Parent (N)); ! Error_Msg_N -- CODEFIX ! ("\\missing `WITH &.&;`", Prefix (Parent (N))); end if; -- Now check for possible misspellings *************** package body Sem_Ch8 is *** 4314,4319 **** --- 4436,4445 ---- <> begin + -- Check violation of No_Wide_Characters restriction + + Check_Wide_Character_Restriction (E, N); + -- 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 *************** package body Sem_Ch8 is *** 4336,4343 **** return; end if; ! Set_Entity (N, E); ! -- Why no Style_Check here??? if Is_Type (E) then Set_Etype (N, E); --- 4462,4479 ---- return; end if; ! -- Set the entity. Note that the reason we call Set_Entity for the ! -- overloadable case, as opposed to Set_Entity_With_Style_Check is ! -- that in the overloaded case, the initial call can set the wrong ! -- homonym. The call that sets the right homonym is in Sem_Res and ! -- that call does use Set_Entity_With_Style_Check, so we don't miss ! -- a style check. ! ! if Is_Overloadable (E) then ! Set_Entity (N, E); ! else ! Set_Entity_With_Style_Check (N, E); ! end if; if Is_Type (E) then Set_Etype (N, E); *************** package body Sem_Ch8 is *** 4447,4504 **** Check_Nested_Access (E); end if; ! -- Set Entity, with style check if need be. For a discriminant ! -- reference, replace by the corresponding discriminal, i.e. the ! -- parameter of the initialization procedure that corresponds to ! -- the discriminant. If this replacement is being performed, there ! -- is no style check to perform. ! ! -- This replacement must not be done if we are currently ! -- processing a generic spec or body, because the discriminal ! -- has not been not generated in this case. ! ! -- 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 ! Set_Entity_With_Style_Check (N, E); ! ! -- The replacement is not done either for a task discriminant that ! -- appears in a default expression of an entry parameter. See ! -- Expand_Discriminant in exp_ch2 for details on their handling. ! ! elsif Is_Concurrent_Type (Scope (E)) then ! declare ! P : Node_Id; ! ! begin ! P := Parent (N); ! while Present (P) ! and then not Nkind_In (P, N_Parameter_Specification, ! N_Component_Declaration) ! loop ! P := Parent (P); ! end loop; ! ! if Present (P) ! and then Nkind (P) = N_Parameter_Specification ! then ! null; ! else ! Set_Entity (N, Discriminal (E)); ! end if; ! end; ! ! -- Otherwise, this is a discriminant in a context in which ! -- it is a reference to the corresponding parameter of the ! -- init proc for the enclosing type. ! ! else ! Set_Entity (N, Discriminal (E)); ! end if; end if; end; end Find_Direct_Name; --- 4583,4589 ---- Check_Nested_Access (E); end if; ! Set_Entity_Or_Discriminal (N, E); end if; end; end Find_Direct_Name; *************** package body Sem_Ch8 is *** 4688,4694 **** else Error_Msg_Qual_Level := 99; ! Error_Msg_NE ("missing `WITH &;`", Selector, Candidate); Error_Msg_Qual_Level := 0; end if; --- 4773,4780 ---- else Error_Msg_Qual_Level := 99; ! Error_Msg_NE -- CODEFIX ! ("missing `WITH &;`", Selector, Candidate); Error_Msg_Qual_Level := 0; end if; *************** package body Sem_Ch8 is *** 4719,4727 **** exit when S = Standard_Standard; ! if Ekind (S) = E_Function ! or else Ekind (S) = E_Package ! or else Ekind (S) = E_Procedure then P := Generic_Parent (Specification (Unit_Declaration_Node (S))); --- 4805,4813 ---- exit when S = Standard_Standard; ! if Ekind_In (S, E_Function, ! E_Package, ! E_Procedure) then P := Generic_Parent (Specification (Unit_Declaration_Node (S))); *************** package body Sem_Ch8 is *** 4745,4751 **** if Is_Known_Unit (N) then if not Error_Posted (N) then Error_Msg_Node_2 := Selector; ! Error_Msg_N ("missing `WITH &.&;`", Prefix (N)); end if; -- If this is a selection from a dummy package, then suppress --- 4831,4838 ---- if Is_Known_Unit (N) then if not Error_Posted (N) then Error_Msg_Node_2 := Selector; ! Error_Msg_N -- CODEFIX ! ("missing `WITH &.&;`", Prefix (N)); end if; -- If this is a selection from a dummy package, then suppress *************** package body Sem_Ch8 is *** 4785,4795 **** ("\use fully qualified name starting with" & " Standard to make& visible", N, H); Error_Msg_Qual_Level := 0; ! exit; end if; Next_Entity (Id); end loop; end; else --- 4872,4888 ---- ("\use fully qualified name starting with" & " Standard to make& visible", N, H); Error_Msg_Qual_Level := 0; ! goto Done; end if; Next_Entity (Id); end loop; + + -- If not found, standard error message. + + Error_Msg_NE ("& not declared in&", N, Selector); + + <> null; end; else *************** package body Sem_Ch8 is *** 4820,4826 **** (Generic_Parent (Parent (Entity (Prefix (N))))) then Error_Msg_Node_2 := Selector; ! Error_Msg_N ("\missing `WITH &.&;`", Prefix (N)); end if; end if; end if; --- 4913,4920 ---- (Generic_Parent (Parent (Entity (Prefix (N))))) then Error_Msg_Node_2 := Selector; ! Error_Msg_N -- CODEFIX ! ("\missing `WITH &.&;`", Prefix (N)); end if; end if; end if; *************** package body Sem_Ch8 is *** 4885,4891 **** if Has_Homonym (Id) then Set_Entity (N, Id); else ! Set_Entity_With_Style_Check (N, Id); Generate_Reference (Id, N); end if; --- 4979,4985 ---- if Has_Homonym (Id) then Set_Entity (N, Id); else ! Set_Entity_Or_Discriminal (N, Id); Generate_Reference (Id, N); end if; *************** package body Sem_Ch8 is *** 4895,4900 **** --- 4989,4998 ---- Set_Etype (N, Get_Full_View (Etype (Id))); end if; + -- Check for violation of No_Wide_Characters + + Check_Wide_Character_Restriction (Id, N); + -- If the Ekind of the entity is Void, it means that all homonyms are -- hidden from all visibility (RM 8.3(5,14-20)). *************** package body Sem_Ch8 is *** 5112,5122 **** function Report_Overload return Entity_Id is begin if Is_Actual then ! Error_Msg_NE ("ambiguous actual subprogram&, " & "possible interpretations:", N, Nam); else ! Error_Msg_N ("ambiguous subprogram, " & "possible interpretations:", N); end if; --- 5210,5220 ---- function Report_Overload return Entity_Id is begin if Is_Actual then ! Error_Msg_NE -- CODEFIX ("ambiguous actual subprogram&, " & "possible interpretations:", N, Nam); else ! Error_Msg_N -- CODEFIX ("ambiguous subprogram, " & "possible interpretations:", N); end if; *************** package body Sem_Ch8 is *** 5273,5281 **** and then (not Is_Entity_Name (P) or else Chars (Entity (P)) /= Name_uInit) then ! C_Etype := ! Build_Actual_Subtype_Of_Component ( ! Etype (Selector), N); else C_Etype := Empty; end if; --- 5371,5399 ---- and then (not Is_Entity_Name (P) or else Chars (Entity (P)) /= Name_uInit) then ! -- Do not build the subtype when referencing components of ! -- dispatch table wrappers. Required to avoid generating ! -- elaboration code with HI runtimes. ! ! if RTU_Loaded (Ada_Tags) ! and then RTE_Available (RE_Dispatch_Table_Wrapper) ! and then Scope (Selector) = RTE (RE_Dispatch_Table_Wrapper) ! then ! C_Etype := Empty; ! ! elsif RTU_Loaded (Ada_Tags) ! and then RTE_Available (RE_No_Dispatch_Table_Wrapper) ! and then Scope (Selector) ! = RTE (RE_No_Dispatch_Table_Wrapper) ! then ! C_Etype := Empty; ! ! else ! C_Etype := ! Build_Actual_Subtype_Of_Component ( ! Etype (Selector), N); ! end if; ! else C_Etype := Empty; end if; *************** package body Sem_Ch8 is *** 5364,5369 **** --- 5482,5489 ---- Analyze_Selected_Component (N); + -- Reference to type name in predicate/invariant expression + elsif Is_Appropriate_For_Entry_Prefix (P_Type) and then not In_Open_Scopes (P_Name) and then (not Is_Concurrent_Type (Etype (P_Name)) *************** package body Sem_Ch8 is *** 5375,5384 **** Analyze_Selected_Component (N); elsif (In_Open_Scopes (P_Name) ! and then Ekind (P_Name) /= E_Void ! and then not Is_Overloadable (P_Name)) or else (Is_Concurrent_Type (Etype (P_Name)) ! and then In_Open_Scopes (Etype (P_Name))) then -- Prefix denotes an enclosing loop, block, or task, i.e. an -- enclosing construct that is not a subprogram or accept. --- 5495,5504 ---- Analyze_Selected_Component (N); elsif (In_Open_Scopes (P_Name) ! and then Ekind (P_Name) /= E_Void ! and then not Is_Overloadable (P_Name)) or else (Is_Concurrent_Type (Etype (P_Name)) ! and then In_Open_Scopes (Etype (P_Name))) then -- Prefix denotes an enclosing loop, block, or task, i.e. an -- enclosing construct that is not a subprogram or accept. *************** package body Sem_Ch8 is *** 5393,5400 **** -- The subprogram may be a renaming (of an enclosing scope) as -- in the case of the name of the generic within an instantiation. ! if (Ekind (P_Name) = E_Procedure ! or else Ekind (P_Name) = E_Function) and then Present (Alias (P_Name)) and then Is_Generic_Instance (Alias (P_Name)) then --- 5513,5519 ---- -- The subprogram may be a renaming (of an enclosing scope) as -- in the case of the name of the generic within an instantiation. ! if Ekind_In (P_Name, E_Procedure, E_Function) and then Present (Alias (P_Name)) and then Is_Generic_Instance (Alias (P_Name)) then *************** package body Sem_Ch8 is *** 5582,5588 **** -- It is legal to denote the class type of an incomplete -- type. The full type will have to be tagged, of course. -- In Ada 2005 this usage is declared obsolescent, so we ! -- warn accordingly. -- ??? This test is temporarily disabled (always False) -- because it causes an unwanted warning on GNAT sources --- 5701,5719 ---- -- It is legal to denote the class type of an incomplete -- type. The full type will have to be tagged, of course. -- In Ada 2005 this usage is declared obsolescent, so we ! -- warn accordingly. This usage is only legal if the type ! -- is completed in the current scope, and not for a limited ! -- view of a type. ! ! if not Is_Tagged_Type (T) ! and then Ada_Version >= Ada_2005 ! then ! if From_With_Type (T) then ! Error_Msg_N ! ("prefix of Class attribute must be tagged", N); ! Set_Etype (N, Any_Type); ! Set_Entity (N, Any_Type); ! return; -- ??? This test is temporarily disabled (always False) -- because it causes an unwanted warning on GNAT sources *************** package body Sem_Ch8 is *** 5590,5607 **** -- Feature). Once this issue is cleared in the sources, it -- can be enabled. ! if not Is_Tagged_Type (T) ! and then Ada_Version >= Ada_05 ! and then Warn_On_Obsolescent_Feature ! and then False ! then ! Error_Msg_N ! ("applying 'Class to an untagged incomplete type" ! & " is an obsolescent feature (RM J.11)", N); end if; Set_Is_Tagged_Type (T); ! Set_Primitive_Operations (T, New_Elmt_List); Make_Class_Wide_Type (T); Set_Entity (N, Class_Wide_Type (T)); Set_Etype (N, Class_Wide_Type (T)); --- 5721,5737 ---- -- Feature). Once this issue is cleared in the sources, it -- can be enabled. ! elsif Warn_On_Obsolescent_Feature ! and then False ! then ! Error_Msg_N ! ("applying 'Class to an untagged incomplete type" ! & " is an obsolescent feature (RM J.11)", N); ! end if; end if; Set_Is_Tagged_Type (T); ! Set_Direct_Primitive_Operations (T, New_Elmt_List); Make_Class_Wide_Type (T); Set_Entity (N, Class_Wide_Type (T)); Set_Etype (N, Class_Wide_Type (T)); *************** package body Sem_Ch8 is *** 5681,5699 **** ("prefix of Base attribute must be scalar type", Prefix (N)); ! elsif Sloc (Typ) = Standard_Location and then Base_Type (Typ) = Typ - and then Warn_On_Redundant_Constructs then ! Error_Msg_NE ("?redundant attribute, & is its own base type", N, Typ); end if; T := Base_Type (Typ); -- Rewrite attribute reference with type itself (see similar ! -- processing in Analyze_Attribute, case Base). Preserve ! -- prefix if present, for other legality checks. if Nkind (Prefix (N)) = N_Expanded_Name then Rewrite (N, --- 5811,5828 ---- ("prefix of Base attribute must be scalar type", Prefix (N)); ! elsif Warn_On_Redundant_Constructs and then Base_Type (Typ) = Typ then ! Error_Msg_NE -- CODEFIX ("?redundant attribute, & is its own base type", N, Typ); end if; T := Base_Type (Typ); -- Rewrite attribute reference with type itself (see similar ! -- processing in Analyze_Attribute, case Base). Preserve prefix ! -- if present, for other legality checks. if Nkind (Prefix (N)) = N_Expanded_Name then Rewrite (N, *************** package body Sem_Ch8 is *** 5783,5789 **** -- nor anywhere else in the declaration because entries -- cannot have access parameters. ! if Ada_Version >= Ada_05 and then Nkind (Parent (N)) = N_Access_Definition then Set_Entity (N, T_Name); --- 5912,5918 ---- -- nor anywhere else in the declaration because entries -- cannot have access parameters. ! if Ada_Version >= Ada_2005 and then Nkind (Parent (N)) = N_Access_Definition then Set_Entity (N, T_Name); *************** package body Sem_Ch8 is *** 5809,5815 **** -- In Ada 2005, a protected name can be used in an access -- definition within its own body. ! if Ada_Version >= Ada_05 and then Nkind (Parent (N)) = N_Access_Definition then Set_Entity (N, T_Name); --- 5938,5944 ---- -- In Ada 2005, a protected name can be used in an access -- definition within its own body. ! if Ada_Version >= Ada_2005 and then Nkind (Parent (N)) = N_Access_Definition then Set_Entity (N, T_Name); *************** package body Sem_Ch8 is *** 5875,5883 **** while Present (Id) and then Id /= Priv_Id loop ! if Is_Standard_Character_Type (Id) ! and then Id = Base_Type (Id) ! then -- We replace the node with the literal itself, resolve as a -- character, and set the type correctly. --- 6004,6011 ---- while Present (Id) and then Id /= Priv_Id loop ! if Is_Standard_Character_Type (Id) and then Is_Base_Type (Id) then ! -- We replace the node with the literal itself, resolve as a -- character, and set the type correctly. *************** package body Sem_Ch8 is *** 5968,5979 **** Change_Selected_Component_To_Expanded_Name (N); end if; ! Add_One_Interp (N, Predef_Op, T); ! -- For operators with unary and binary interpretations, add both ! if Present (Homonym (Predef_Op)) then ! Add_One_Interp (N, Homonym (Predef_Op), T); end if; -- The node is a reference to a predefined operator, and --- 6096,6140 ---- Change_Selected_Component_To_Expanded_Name (N); end if; ! -- If the context is an unanalyzed function call, determine whether ! -- a binary or unary interpretation is required. ! if Nkind (Parent (N)) = N_Indexed_Component then ! declare ! Is_Binary_Call : constant Boolean := ! Present ! (Next (First (Expressions (Parent (N))))); ! Is_Binary_Op : constant Boolean := ! First_Entity ! (Predef_Op) /= Last_Entity (Predef_Op); ! Predef_Op2 : constant Entity_Id := Homonym (Predef_Op); ! begin ! if Is_Binary_Call then ! if Is_Binary_Op then ! Add_One_Interp (N, Predef_Op, T); ! else ! Add_One_Interp (N, Predef_Op2, T); ! end if; ! ! else ! if not Is_Binary_Op then ! Add_One_Interp (N, Predef_Op, T); ! else ! Add_One_Interp (N, Predef_Op2, T); ! end if; ! end if; ! end; ! ! else ! Add_One_Interp (N, Predef_Op, T); ! ! -- For operators with unary and binary interpretations, if ! -- context is not a call, add both ! ! if Present (Homonym (Predef_Op)) then ! Add_One_Interp (N, Homonym (Predef_Op), T); ! end if; end if; -- The node is a reference to a predefined operator, and *************** package body Sem_Ch8 is *** 6005,6013 **** when Name_Op_And | Name_Op_Not | Name_Op_Or | Name_Op_Xor => while Id /= Priv_Id loop ! if Valid_Boolean_Arg (Id) ! and then Id = Base_Type (Id) ! then Add_Implicit_Operator (Id); return True; end if; --- 6166,6172 ---- when Name_Op_And | Name_Op_Not | Name_Op_Or | Name_Op_Xor => while Id /= Priv_Id loop ! if Valid_Boolean_Arg (Id) and then Is_Base_Type (Id) then Add_Implicit_Operator (Id); return True; end if; *************** package body Sem_Ch8 is *** 6021,6027 **** while Id /= Priv_Id loop if Is_Type (Id) and then not Is_Limited_Type (Id) ! and then Id = Base_Type (Id) then Add_Implicit_Operator (Standard_Boolean, Id); return True; --- 6180,6186 ---- while Id /= Priv_Id loop if Is_Type (Id) and then not Is_Limited_Type (Id) ! and then Is_Base_Type (Id) then Add_Implicit_Operator (Standard_Boolean, Id); return True; *************** package body Sem_Ch8 is *** 6035,6043 **** when Name_Op_Lt | Name_Op_Le | Name_Op_Gt | Name_Op_Ge => while Id /= Priv_Id loop if (Is_Scalar_Type (Id) ! or else (Is_Array_Type (Id) ! and then Is_Scalar_Type (Component_Type (Id)))) ! and then Id = Base_Type (Id) then Add_Implicit_Operator (Standard_Boolean, Id); return True; --- 6194,6202 ---- when Name_Op_Lt | Name_Op_Le | Name_Op_Gt | Name_Op_Ge => while Id /= Priv_Id loop if (Is_Scalar_Type (Id) ! or else (Is_Array_Type (Id) ! and then Is_Scalar_Type (Component_Type (Id)))) ! and then Is_Base_Type (Id) then Add_Implicit_Operator (Standard_Boolean, Id); return True; *************** package body Sem_Ch8 is *** 6057,6065 **** Name_Op_Divide | Name_Op_Expon => while Id /= Priv_Id loop ! if Is_Numeric_Type (Id) ! and then Id = Base_Type (Id) ! then Add_Implicit_Operator (Id); return True; end if; --- 6216,6222 ---- Name_Op_Divide | Name_Op_Expon => while Id /= Priv_Id loop ! if Is_Numeric_Type (Id) and then Is_Base_Type (Id) then Add_Implicit_Operator (Id); return True; end if; *************** package body Sem_Ch8 is *** 6071,6078 **** when Name_Op_Concat => while Id /= Priv_Id loop ! if Is_Array_Type (Id) and then Number_Dimensions (Id) = 1 ! and then Id = Base_Type (Id) then Add_Implicit_Operator (Id); return True; --- 6228,6236 ---- when Name_Op_Concat => while Id /= Priv_Id loop ! if Is_Array_Type (Id) ! and then Number_Dimensions (Id) = 1 ! and then Is_Base_Type (Id) then Add_Implicit_Operator (Id); return True; *************** package body Sem_Ch8 is *** 6170,6178 **** Next_Formal (Old_F); end loop; ! if Ekind (Old_S) = E_Function ! or else Ekind (Old_S) = E_Enumeration_Literal ! then Set_Etype (New_S, Etype (Old_S)); end if; end if; --- 6328,6334 ---- Next_Formal (Old_F); end loop; ! if Ekind_In (Old_S, E_Function, E_Enumeration_Literal) then Set_Etype (New_S, Etype (Old_S)); end if; end if; *************** package body Sem_Ch8 is *** 6488,6494 **** if Present (Redundant) then Error_Msg_Sloc := Sloc (Prev_Use); ! Error_Msg_NE ("& is already use-visible through previous use clause #?", Redundant, Pack_Name); end if; --- 6644,6650 ---- if Present (Redundant) then Error_Msg_Sloc := Sloc (Prev_Use); ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous use clause #?", Redundant, Pack_Name); end if; *************** package body Sem_Ch8 is *** 6500,6517 **** procedure Pop_Scope is SST : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last); begin if Debug_Flag_E then Write_Info; end if; 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: "); Write_Name (Chars (Current_Scope)); Write_Str (", Depth="); Write_Int (Int (Scope_Stack.Last)); --- 6656,6691 ---- procedure Pop_Scope is SST : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last); + S : constant Entity_Id := SST.Entity; begin if Debug_Flag_E then Write_Info; end if; + -- Set Default_Storage_Pool field of the library unit if necessary + + if Ekind_In (S, E_Package, E_Generic_Package) + and then + Nkind (Parent (Unit_Declaration_Node (S))) = N_Compilation_Unit + then + declare + Aux : constant Node_Id := + Aux_Decls_Node (Parent (Unit_Declaration_Node (S))); + begin + if No (Default_Storage_Pool (Aux)) then + Set_Default_Storage_Pool (Aux, Default_Pool); + end if; + end; + end if; + Scope_Suppress := SST.Save_Scope_Suppress; Local_Suppress_Stack_Top := SST.Save_Local_Suppress_Stack_Top; Check_Policy_List := SST.Save_Check_Policy_List; + Default_Pool := SST.Save_Default_Storage_Pool; if Debug_Flag_W then ! Write_Str ("<-- exiting scope: "); Write_Name (Chars (Current_Scope)); Write_Str (", Depth="); Write_Int (Int (Scope_Stack.Last)); *************** package body Sem_Ch8 is *** 6529,6535 **** or else SST.Actions_To_Be_Wrapped_After /= No_List then ! return; end if; -- Free last subprogram name if allocated, and pop scope --- 6703,6709 ---- or else SST.Actions_To_Be_Wrapped_After /= No_List then ! raise Program_Error; end if; -- Free last subprogram name if allocated, and pop scope *************** package body Sem_Ch8 is *** 6543,6549 **** --------------- procedure Push_Scope (S : Entity_Id) is ! E : Entity_Id; begin if Ekind (S) = E_Void then --- 6717,6723 ---- --------------- procedure Push_Scope (S : Entity_Id) is ! E : constant Entity_Id := Scope (S); begin if Ekind (S) = E_Void then *************** package body Sem_Ch8 is *** 6581,6586 **** --- 6755,6761 ---- SST.Save_Scope_Suppress := Scope_Suppress; SST.Save_Local_Suppress_Stack_Top := Local_Suppress_Stack_Top; SST.Save_Check_Policy_List := Check_Policy_List; + SST.Save_Default_Storage_Pool := Default_Pool; if Scope_Stack.Last > Scope_Stack.First then SST.Component_Alignment_Default := Scope_Stack.Table *************** package body Sem_Ch8 is *** 6617,6624 **** and then Scope (S) /= Standard_Standard and then not Is_Child_Unit (S) then - E := Scope (S); - if Nkind (E) not in N_Entity then return; end if; --- 6792,6797 ---- *************** package body Sem_Ch8 is *** 6640,6645 **** --- 6813,6834 ---- Set_Categorization_From_Scope (E => S, Scop => E); end if; end if; + + if Is_Child_Unit (S) + and then Present (E) + and then Ekind_In (E, E_Package, E_Generic_Package) + and then + Nkind (Parent (Unit_Declaration_Node (E))) = N_Compilation_Unit + then + declare + Aux : constant Node_Id := + Aux_Decls_Node (Parent (Unit_Declaration_Node (E))); + begin + if Present (Default_Storage_Pool (Aux)) then + Default_Pool := Default_Storage_Pool (Aux); + end if; + end; + end if; end Push_Scope; --------------------- *************** package body Sem_Ch8 is *** 7162,7172 **** -- we compare the scope depth of its scope with that of the -- current instance. However, a generic actual of a subprogram -- instance is declared in the wrapper package but will not be ! -- hidden by a use-visible entity. Similarly, a generic actual ! -- will not be hidden by an entity declared in another generic ! -- actual, which can only have been use-visible in the generic. ! -- Is this condition complete, and can the following complex ! -- test be simplified ??? -- If Id is called Standard, the predefined package with the -- same name is in the homonym chain. It has to be ignored --- 7351,7361 ---- -- we compare the scope depth of its scope with that of the -- current instance. However, a generic actual of a subprogram -- instance is declared in the wrapper package but will not be ! -- hidden by a use-visible entity. similarly, an entity that is ! -- declared in an enclosing instance will not be hidden by an ! -- an entity declared in a generic actual, which can only have ! -- been use-visible in the generic and will not have hidden the ! -- entity in the generic parent. -- If Id is called Standard, the predefined package with the -- same name is in the homonym chain. It has to be ignored *************** package body Sem_Ch8 is *** 7181,7188 **** and then (Scope (Prev) /= Standard_Standard or else Sloc (Prev) > Standard_Location) then ! if Ekind (Prev) = E_Package ! and then Present (Associated_Formal_Package (Prev)) and then Present (Associated_Formal_Package (P)) then null; --- 7370,7377 ---- and then (Scope (Prev) /= Standard_Standard or else Sloc (Prev) > Standard_Location) then ! if In_Open_Scopes (Scope (Prev)) ! and then Is_Generic_Instance (Scope (Prev)) and then Present (Associated_Formal_Package (P)) then null; *************** package body Sem_Ch8 is *** 7223,7230 **** and then Scope (Id) /= Scope (Prev) and then Used_As_Generic_Actual (Scope (Prev)) and then Used_As_Generic_Actual (Scope (Id)) ! and then List_Containing (Current_Use_Clause (Scope (Prev))) /= ! List_Containing (Current_Use_Clause (Scope (Id))) then Set_Is_Potentially_Use_Visible (Prev, False); Append_Elmt (Prev, Hidden_By_Use_Clause (N)); --- 7412,7419 ---- and then Scope (Id) /= Scope (Prev) and then Used_As_Generic_Actual (Scope (Prev)) and then Used_As_Generic_Actual (Scope (Id)) ! and then not In_Same_List (Current_Use_Clause (Scope (Prev)), ! Current_Use_Clause (Scope (Id))) then Set_Is_Potentially_Use_Visible (Prev, False); Append_Elmt (Prev, Hidden_By_Use_Clause (N)); *************** package body Sem_Ch8 is *** 7466,7479 **** if Unit1 = Unit2 then Error_Msg_Sloc := Sloc (Current_Use_Clause (T)); ! Error_Msg_NE ("& is already use-visible through previous " & "use_type_clause #?", Clause1, T); return; elsif Nkind (Unit1) = N_Subunit then Error_Msg_Sloc := Sloc (Current_Use_Clause (T)); ! Error_Msg_NE ("& is already use-visible through previous " & "use_type_clause #?", Clause1, T); return; --- 7655,7668 ---- if Unit1 = Unit2 then Error_Msg_Sloc := Sloc (Current_Use_Clause (T)); ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous " & "use_type_clause #?", Clause1, T); return; elsif Nkind (Unit1) = N_Subunit then Error_Msg_Sloc := Sloc (Current_Use_Clause (T)); ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous " & "use_type_clause #?", Clause1, T); return; *************** package body Sem_Ch8 is *** 7483,7489 **** and then Nkind (Unit1) /= N_Subunit then Error_Msg_Sloc := Sloc (Clause1); ! Error_Msg_NE ("& is already use-visible through previous " & "use_type_clause #?", Current_Use_Clause (T), T); return; --- 7672,7678 ---- and then Nkind (Unit1) /= N_Subunit then Error_Msg_Sloc := Sloc (Clause1); ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous " & "use_type_clause #?", Current_Use_Clause (T), T); return; *************** package body Sem_Ch8 is *** 7516,7524 **** begin S1 := Scope (Ent1); S2 := Scope (Ent2); ! while S1 /= Standard_Standard ! and then ! S2 /= Standard_Standard loop S1 := Scope (S1); S2 := Scope (S2); --- 7705,7714 ---- begin S1 := Scope (Ent1); S2 := Scope (Ent2); ! while Present (S1) ! and then Present (S2) ! and then S1 /= Standard_Standard ! and then S2 /= Standard_Standard loop S1 := Scope (S1); S2 := Scope (S2); *************** package body Sem_Ch8 is *** 7534,7540 **** end; end if; ! Error_Msg_NE ("& is already use-visible through previous " & "use_type_clause #?", Err_No, Id); --- 7724,7730 ---- end; end if; ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous " & "use_type_clause #?", Err_No, Id); *************** package body Sem_Ch8 is *** 7543,7549 **** -- level. In this case we don't have location information. else ! Error_Msg_NE ("& is already use-visible through previous " & "use type clause?", Id, T); end if; --- 7733,7739 ---- -- level. In this case we don't have location information. else ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous " & "use type clause?", Id, T); end if; *************** package body Sem_Ch8 is *** 7553,7559 **** -- where we do not have the location information available. else ! Error_Msg_NE ("& is already use-visible through previous " & "use type clause?", Id, T); end if; --- 7743,7749 ---- -- where we do not have the location information available. else ! Error_Msg_NE -- CODEFIX ("& is already use-visible through previous " & "use type clause?", Id, T); end if; *************** package body Sem_Ch8 is *** 7562,7568 **** elsif In_Use (Scope (T)) then Error_Msg_Sloc := Sloc (Current_Use_Clause (Scope (T))); ! Error_Msg_NE ("& is already use-visible through package use clause #?", Id, T); --- 7752,7758 ---- elsif In_Use (Scope (T)) then Error_Msg_Sloc := Sloc (Current_Use_Clause (Scope (T))); ! Error_Msg_NE -- CODEFIX ("& is already use-visible through package use clause #?", Id, T); *************** package body Sem_Ch8 is *** 7570,7576 **** else Error_Msg_Node_2 := Scope (T); ! Error_Msg_NE ("& is already use-visible inside package &?", Id, T); end if; end if; --- 7760,7766 ---- else Error_Msg_Node_2 := Scope (T); ! Error_Msg_NE -- CODEFIX ("& is already use-visible inside package &?", Id, T); end if; end if; *************** package body Sem_Ch8 is *** 7619,7629 **** Write_Eol; end Write_Info; ! ----------------- ! -- Write_Scopes -- ! ----------------- ! procedure Write_Scopes is S : Entity_Id; begin for J in reverse 1 .. Scope_Stack.Last loop --- 7809,7819 ---- Write_Eol; end Write_Info; ! -------- ! -- ws -- ! -------- ! procedure ws is S : Entity_Id; begin for J in reverse 1 .. Scope_Stack.Last loop *************** package body Sem_Ch8 is *** 7633,7638 **** Write_Name (Chars (S)); Write_Eol; end loop; ! end Write_Scopes; end Sem_Ch8; --- 7823,7828 ---- Write_Name (Chars (S)); Write_Eol; end loop; ! end ws; end Sem_Ch8; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch8.ads gcc-4.6.0/gcc/ada/sem_ch8.ads *** gcc-4.5.2/gcc/ada/sem_ch8.ads Tue May 20 13:00:35 2008 --- gcc-4.6.0/gcc/ada/sem_ch8.ads Tue Aug 10 14:34:24 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch8 is *** 131,157 **** function Present_System_Aux (N : Node_Id := Empty) return Boolean; -- Return True if the auxiliary system file has been successfully loaded. -- Otherwise attempt to load it, using the name supplied by a previous ! -- Extend_System pragma, and report on the success of the load. ! -- If N is present, it is a selected component whose prefix is System, ! -- or else a with-clause on system. N is absent when the function is ! -- called to find the visibility of implicit operators. procedure Restore_Scope_Stack (Handle_Use : Boolean := True); procedure Save_Scope_Stack (Handle_Use : Boolean := True); ! -- These two procedures are called from Semantics, when a unit U1 is ! -- to be compiled in the course of the compilation of another unit U2. ! -- This happens whenever Rtsfind is called. U1, the unit retrieved by ! -- Rtsfind, must be compiled in its own context, and the current scope ! -- stack containing U2 and local scopes must be made unreachable. On ! -- 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 ! -- visibility handling is done fully in Inline_Instance_Body, and use ! -- clauses are handled there. procedure Set_Use (L : List_Id); -- Find use clauses that are declarative items in a package declaration -- and set the potentially use-visible flags of imported entities before -- analyzing the corresponding package body. end Sem_Ch8; --- 131,160 ---- function Present_System_Aux (N : Node_Id := Empty) return Boolean; -- Return True if the auxiliary system file has been successfully loaded. -- Otherwise attempt to load it, using the name supplied by a previous ! -- Extend_System pragma, and report on the success of the load. If N is ! -- present, it is a selected component whose prefix is System, or else a ! -- with-clause on system. N is absent when the function is called to find ! -- the visibility of implicit operators. procedure Restore_Scope_Stack (Handle_Use : Boolean := True); procedure Save_Scope_Stack (Handle_Use : Boolean := True); ! -- These two procedures are called from Semantics, when a unit U1 is to ! -- be compiled in the course of the compilation of another unit U2. This ! -- happens whenever Rtsfind is called. U1, the unit retrieved by Rtsfind, ! -- must be compiled in its own context, and the current scope stack ! -- containing U2 and local scopes must be made unreachable. On return, the ! -- contents of the scope stack must be made accessible again. The flag ! -- Handle_Use indicates whether local use clauses must be removed or ! -- installed. In the case of inlining of instance bodies, the visibility ! -- handling is done fully in Inline_Instance_Body, and use clauses are ! -- handled there. procedure Set_Use (L : List_Id); -- Find use clauses that are declarative items in a package declaration -- and set the potentially use-visible flags of imported entities before -- analyzing the corresponding package body. + procedure ws; + -- Debugging routine for use in gdb: dump all entities on scope stack + end Sem_Ch8; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch9.adb gcc-4.6.0/gcc/ada/sem_ch9.adb *** gcc-4.5.2/gcc/ada/sem_ch9.adb Mon Jul 13 12:45:02 2009 --- gcc-4.6.0/gcc/ada/sem_ch9.adb Fri Oct 22 14:35:39 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Checks; use Checks; with Einfo; use Einfo; *************** with Errout; use Errout; *** 30,36 **** with Exp_Ch9; use Exp_Ch9; with Elists; use Elists; with Freeze; use Freeze; - with Itypes; use Itypes; with Lib.Xref; use Lib.Xref; with Namet; use Namet; with Nlists; use Nlists; --- 31,36 ---- *************** with Sem_Ch3; use Sem_Ch3; *** 45,50 **** --- 45,51 ---- with Sem_Ch5; use Sem_Ch5; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; + with Sem_Ch13; use Sem_Ch13; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; *************** package body Sem_Ch9 is *** 105,118 **** Analyze (T_Name); if Is_Task_Type (Etype (T_Name)) ! or else (Ada_Version >= Ada_05 and then Ekind (Etype (T_Name)) = E_Class_Wide_Type and then Is_Interface (Etype (T_Name)) and then Is_Task_Interface (Etype (T_Name))) then Resolve (T_Name); else ! if Ada_Version >= Ada_05 then Error_Msg_N ("expect task name or task interface class-wide " & "object for ABORT", T_Name); else --- 106,119 ---- Analyze (T_Name); if Is_Task_Type (Etype (T_Name)) ! or else (Ada_Version >= Ada_2005 and then Ekind (Etype (T_Name)) = E_Class_Wide_Type and then Is_Interface (Etype (T_Name)) and then Is_Task_Interface (Etype (T_Name))) then Resolve (T_Name); else ! if Ada_Version >= Ada_2005 then Error_Msg_N ("expect task name or task interface class-wide " & "object for ABORT", T_Name); else *************** package body Sem_Ch9 is *** 167,239 **** Kind : Entity_Kind; Task_Nam : Entity_Id; - ----------------------- - -- Actual_Index_Type -- - ----------------------- - - function Actual_Index_Type (E : Entity_Id) return Entity_Id; - -- If the bounds of an entry family depend on task discriminants, create - -- a new index type where a discriminant is replaced by the local - -- variable that renames it in the task body. - - ----------------------- - -- Actual_Index_Type -- - ----------------------- - - function Actual_Index_Type (E : Entity_Id) return Entity_Id is - Typ : constant Entity_Id := Entry_Index_Type (E); - Lo : constant Node_Id := Type_Low_Bound (Typ); - Hi : constant Node_Id := Type_High_Bound (Typ); - New_T : Entity_Id; - - function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id; - -- If bound is discriminant reference, replace with corresponding - -- local variable of the same name. - - ----------------------------- - -- Actual_Discriminant_Ref -- - ----------------------------- - - function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id is - Typ : constant Entity_Id := Etype (Bound); - Ref : Node_Id; - begin - if not Is_Entity_Name (Bound) - or else Ekind (Entity (Bound)) /= E_Discriminant - then - return Bound; - else - Ref := Make_Identifier (Sloc (N), Chars (Entity (Bound))); - Analyze (Ref); - Resolve (Ref, Typ); - return Ref; - end if; - end Actual_Discriminant_Ref; - - -- Start of processing for Actual_Index_Type - - begin - if not Has_Discriminants (Task_Nam) - or else (not Is_Entity_Name (Lo) - and then not Is_Entity_Name (Hi)) - then - return Entry_Index_Type (E); - else - New_T := Create_Itype (Ekind (Typ), N); - Set_Etype (New_T, Base_Type (Typ)); - Set_Size_Info (New_T, Typ); - Set_RM_Size (New_T, RM_Size (Typ)); - Set_Scalar_Range (New_T, - Make_Range (Sloc (N), - Low_Bound => Actual_Discriminant_Ref (Lo), - High_Bound => Actual_Discriminant_Ref (Hi))); - - return New_T; - end if; - end Actual_Index_Type; - - -- Start of processing for Analyze_Accept_Statement - begin Tasking_Used := True; --- 168,173 ---- *************** package body Sem_Ch9 is *** 260,270 **** return; end if; ! -- In order to process the parameters, we create a defining ! -- identifier that can be used as the name of the scope. The ! -- name of the accept statement itself is not a defining identifier, ! -- and we cannot use its name directly because the task may have ! -- any number of accept statements for the same entry. if Present (Index) then Accept_Id := New_Internal_Entity --- 194,204 ---- return; end if; ! -- In order to process the parameters, we create a defining identifier ! -- that can be used as the name of the scope. The name of the accept ! -- statement itself is not a defining identifier, and we cannot use ! -- its name directly because the task may have any number of accept ! -- statements for the same entry. if Present (Index) then Accept_Id := New_Internal_Entity *************** package body Sem_Ch9 is *** 343,349 **** if Entry_Nam = Scope_Stack.Table (J).Entity then Error_Msg_N ("duplicate accept statement for same entry", N); end if; - end loop; declare --- 277,282 ---- *************** package body Sem_Ch9 is *** 370,376 **** Error_Msg_N ("missing entry index in accept for entry family", N); else Analyze_And_Resolve (Index, Entry_Index_Type (E)); ! Apply_Range_Check (Index, Actual_Index_Type (E)); end if; elsif Present (Index) then --- 303,309 ---- Error_Msg_N ("missing entry index in accept for entry family", N); else Analyze_And_Resolve (Index, Entry_Index_Type (E)); ! Apply_Range_Check (Index, Entry_Index_Type (E)); end if; elsif Present (Index) then *************** package body Sem_Ch9 is *** 470,476 **** Check_Restriction (Max_Asynchronous_Select_Nesting, N); Check_Restriction (No_Select_Statements, N); ! if Ada_Version >= Ada_05 then Trigger := Triggering_Statement (Triggering_Alternative (N)); Analyze (Trigger); --- 403,409 ---- Check_Restriction (Max_Asynchronous_Select_Nesting, N); Check_Restriction (No_Select_Statements, N); ! if Ada_Version >= Ada_2005 then Trigger := Triggering_Statement (Triggering_Alternative (N)); Analyze (Trigger); *************** package body Sem_Ch9 is *** 516,522 **** -- Ada 2005 (AI-345): The trigger may be a dispatching call ! if Ada_Version >= Ada_05 then Analyze (Trigger); Check_Triggering_Statement (Trigger, N, Is_Disp_Select); end if; --- 449,455 ---- -- Ada 2005 (AI-345): The trigger may be a dispatching call ! if Ada_Version >= Ada_2005 then Analyze (Trigger); Check_Triggering_Statement (Trigger, N, Is_Disp_Select); end if; *************** package body Sem_Ch9 is *** 946,964 **** --- 879,912 ---- Generate_Definition (Def_Id); Tasking_Used := True; + -- Case of no discrete subtype definition + if No (D_Sdef) then Set_Ekind (Def_Id, E_Entry); + + -- Processing for discrete subtype definition present + else Enter_Name (Def_Id); Set_Ekind (Def_Id, E_Entry_Family); Analyze (D_Sdef); Make_Index (D_Sdef, N, Def_Id); + + -- Check subtype with predicate in entry family + + Bad_Predicated_Subtype_Use + ("subtype& has predicate, not allowed in entry family", + D_Sdef, Etype (D_Sdef)); end if; + -- Decorate Def_Id + Set_Etype (Def_Id, Standard_Void_Type); Set_Convention (Def_Id, Convention_Entry); Set_Accept_Address (Def_Id, New_Elmt_List); + -- Process formals + if Present (Formals) then Set_Scope (Def_Id, Current_Scope); Push_Scope (Def_Id); *************** package body Sem_Ch9 is *** 972,977 **** --- 920,926 ---- end if; Generate_Reference_To_Formals (Def_Id); + Analyze_Aspect_Specifications (N, Def_Id, Aspect_Specifications (N)); end Analyze_Entry_Declaration; --------------------------------------- *************** package body Sem_Ch9 is *** 991,999 **** procedure Analyze_Entry_Index_Specification (N : Node_Id) is Iden : constant Node_Id := Defining_Identifier (N); Def : constant Node_Id := Discrete_Subtype_Definition (N); ! Loop_Id : constant Entity_Id := ! Make_Defining_Identifier (Sloc (N), ! Chars => New_Internal_Name ('L')); begin Tasking_Used := True; --- 940,946 ---- procedure Analyze_Entry_Index_Specification (N : Node_Id) is Iden : constant Node_Id := Defining_Identifier (N); Def : constant Node_Id := Discrete_Subtype_Definition (N); ! Loop_Id : constant Entity_Id := Make_Temporary (Sloc (N), 'L'); begin Tasking_Used := True; *************** package body Sem_Ch9 is *** 1174,1182 **** E := First_Entity (Current_Scope); while Present (E) loop ! if Ekind (E) = E_Function ! or else Ekind (E) = E_Procedure ! then Set_Convention (E, Convention_Protected); elsif Is_Task_Type (Etype (E)) --- 1121,1127 ---- E := First_Entity (Current_Scope); while Present (E) loop ! if Ekind_In (E, E_Function, E_Procedure) then Set_Convention (E, Convention_Protected); elsif Is_Task_Type (Etype (E)) *************** package body Sem_Ch9 is *** 1194,1204 **** Process_End_Label (N, 'e', Current_Scope); end Analyze_Protected_Definition; ! ---------------------------- ! -- Analyze_Protected_Type -- ! ---------------------------- ! procedure Analyze_Protected_Type (N : Node_Id) is Def_Id : constant Entity_Id := Defining_Identifier (N); E : Entity_Id; T : Entity_Id; --- 1139,1149 ---- Process_End_Label (N, 'e', Current_Scope); end Analyze_Protected_Definition; ! ---------------------------------------- ! -- Analyze_Protected_Type_Declaration -- ! ---------------------------------------- ! procedure Analyze_Protected_Type_Declaration (N : Node_Id) is Def_Id : constant Entity_Id := Defining_Identifier (N); E : Entity_Id; T : Entity_Id; *************** package body Sem_Ch9 is *** 1206,1212 **** begin if No_Run_Time_Mode then Error_Msg_CRT ("protected type", N); ! return; end if; Tasking_Used := True; --- 1151,1157 ---- begin if No_Run_Time_Mode then Error_Msg_CRT ("protected type", N); ! goto Leave; end if; Tasking_Used := True; *************** package body Sem_Ch9 is *** 1230,1236 **** Set_Stored_Constraint (T, No_Elist); Push_Scope (T); ! if Ada_Version >= Ada_05 then Check_Interfaces (N, T); end if; --- 1175,1181 ---- Set_Stored_Constraint (T, No_Elist); Push_Scope (T); ! if Ada_Version >= Ada_2005 then Check_Interfaces (N, T); end if; *************** package body Sem_Ch9 is *** 1248,1264 **** Set_Is_Constrained (T, not Has_Discriminants (T)); ! -- Perform minimal expansion of protected type while inside a generic. ! -- The corresponding record is needed for various semantic checks. ! if Ada_Version >= Ada_05 ! and then Inside_A_Generic then ! Insert_After_And_Analyze (N, ! Build_Corresponding_Record (N, T, Sloc (T))); ! end if; ! Analyze (Protected_Definition (N)); -- Protected types with entries are controlled (because of the -- Protection component if nothing else), same for any protected type --- 1193,1220 ---- Set_Is_Constrained (T, not Has_Discriminants (T)); ! Analyze (Protected_Definition (N)); ! -- In the case where the protected type is declared at a nested level ! -- and the No_Local_Protected_Objects restriction applies, issue a ! -- warning that objects of the type will violate the restriction. ! ! if Restriction_Check_Required (No_Local_Protected_Objects) ! and then not Is_Library_Level_Entity (T) ! and then Comes_From_Source (T) then ! Error_Msg_Sloc := Restrictions_Loc (No_Local_Protected_Objects); ! if Error_Msg_Sloc = No_Location then ! Error_Msg_N ! ("objects of this type will violate " & ! "`No_Local_Protected_Objects`?", N); ! else ! Error_Msg_N ! ("objects of this type will violate " & ! "`No_Local_Protected_Objects`?#", N); ! end if; ! end if; -- Protected types with entries are controlled (because of the -- Protection component if nothing else), same for any protected type *************** package body Sem_Ch9 is *** 1315,1321 **** Process_Full_View (N, T, Def_Id); end if; end if; ! end Analyze_Protected_Type; --------------------- -- Analyze_Requeue -- --- 1271,1280 ---- Process_Full_View (N, T, Def_Id); end if; end if; ! ! <> ! Analyze_Aspect_Specifications (N, Def_Id, Aspect_Specifications (N)); ! end Analyze_Protected_Type_Declaration; --------------------- -- Analyze_Requeue -- *************** package body Sem_Ch9 is *** 1343,1351 **** Enclosing := Scope_Stack.Table (J).Entity; exit when Is_Entry (Enclosing); ! if Ekind (Enclosing) /= E_Block ! and then Ekind (Enclosing) /= E_Loop ! then Error_Msg_N ("requeue must appear within accept or entry body", N); return; end if; --- 1302,1308 ---- Enclosing := Scope_Stack.Table (J).Entity; exit when Is_Entry (Enclosing); ! if not Ekind_In (Enclosing, E_Block, E_Loop) then Error_Msg_N ("requeue must appear within accept or entry body", N); return; end if; *************** package body Sem_Ch9 is *** 1486,1503 **** Entry_Id := Entity (Entry_Name); end if; ! -- Ada 2005 (AI05-0030): Potential dispatching requeue statement. The -- target type must be a concurrent interface class-wide type and the ! -- entry name must be a procedure, flagged by pragma Implemented_By_ ! -- Entry. Is_Disp_Req := ! Ada_Version >= Ada_05 and then Present (Target_Obj) and then Is_Class_Wide_Type (Etype (Target_Obj)) and then Is_Concurrent_Interface (Etype (Target_Obj)) and then Ekind (Entry_Id) = E_Procedure ! and then Implemented_By_Entry (Entry_Id); -- Resolve entry, and check that it is subtype conformant with the -- enclosing construct if this construct has formals (RM 9.5.4(5)). --- 1443,1459 ---- Entry_Id := Entity (Entry_Name); end if; ! -- Ada 2012 (AI05-0030): Potential dispatching requeue statement. The -- target type must be a concurrent interface class-wide type and the ! -- target must be a procedure, flagged by pragma Implemented. Is_Disp_Req := ! Ada_Version >= Ada_2012 and then Present (Target_Obj) and then Is_Class_Wide_Type (Etype (Target_Obj)) and then Is_Concurrent_Interface (Etype (Target_Obj)) and then Ekind (Entry_Id) = E_Procedure ! and then Has_Rep_Pragma (Entry_Id, Name_Implemented); -- Resolve entry, and check that it is subtype conformant with the -- enclosing construct if this construct has formals (RM 9.5.4(5)). *************** package body Sem_Ch9 is *** 1525,1535 **** return; end if; ! -- Ada 2005 (AI05-0030): Perform type conformance after skipping -- the first parameter of Entry_Id since it is the interface -- controlling formal. ! if Is_Disp_Req then declare Enclosing_Formal : Entity_Id; Target_Formal : Entity_Id; --- 1481,1493 ---- return; end if; ! -- Ada 2012 (AI05-0030): Perform type conformance after skipping -- the first parameter of Entry_Id since it is the interface -- controlling formal. ! if Ada_Version >= Ada_2012 ! and then Is_Disp_Req ! then declare Enclosing_Formal : Entity_Id; Target_Formal : Entity_Id; *************** package body Sem_Ch9 is *** 1576,1585 **** -- perform an unconditional goto so that any further -- references will not occur anyway. ! if Ekind (Ent) = E_Out_Parameter ! or else ! Ekind (Ent) = E_In_Out_Parameter ! then Set_Never_Set_In_Source (Ent, False); Set_Is_True_Constant (Ent, False); end if; --- 1534,1540 ---- -- perform an unconditional goto so that any further -- references will not occur anyway. ! if Ekind_In (Ent, E_Out_Parameter, E_In_Out_Parameter) then Set_Never_Set_In_Source (Ent, False); Set_Is_True_Constant (Ent, False); end if; *************** package body Sem_Ch9 is *** 1716,1726 **** end if; end Analyze_Selective_Accept; ! ------------------------------ ! -- Analyze_Single_Protected -- ! ------------------------------ ! procedure Analyze_Single_Protected (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Id : constant Node_Id := Defining_Identifier (N); T : Entity_Id; --- 1671,1681 ---- end if; end Analyze_Selective_Accept; ! ------------------------------------------ ! -- Analyze_Single_Protected_Declaration -- ! ------------------------------------------ ! procedure Analyze_Single_Protected_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Id : constant Node_Id := Defining_Identifier (N); T : Entity_Id; *************** package body Sem_Ch9 is *** 1750,1755 **** --- 1705,1711 ---- Defining_Identifier => O_Name, Object_Definition => Make_Identifier (Loc, Chars (T))); + Move_Aspects (N, O_Decl); Rewrite (N, T_Decl); Insert_After (N, O_Decl); Mark_Rewrite_Insertion (O_Decl); *************** package body Sem_Ch9 is *** 1769,1782 **** -- procedure directly. Otherwise the node would be expanded twice, with -- disastrous result. ! Analyze_Protected_Type (N); ! end Analyze_Single_Protected; ! ------------------------- ! -- Analyze_Single_Task -- ! ------------------------- ! procedure Analyze_Single_Task (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Id : constant Node_Id := Defining_Identifier (N); T : Entity_Id; --- 1725,1739 ---- -- procedure directly. Otherwise the node would be expanded twice, with -- disastrous result. ! Analyze_Protected_Type_Declaration (N); ! Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); ! end Analyze_Single_Protected_Declaration; ! ------------------------------------- ! -- Analyze_Single_Task_Declaration -- ! ------------------------------------- ! procedure Analyze_Single_Task_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Id : constant Node_Id := Defining_Identifier (N); T : Entity_Id; *************** package body Sem_Ch9 is *** 1807,1819 **** -- entity is the new object declaration. The single_task_declaration -- is not used further in semantics or code generation, but is scanned -- when generating debug information, and therefore needs the updated ! -- Sloc information for the entity (see Sprint). O_Decl := Make_Object_Declaration (Loc, Defining_Identifier => O_Name, Object_Definition => Make_Identifier (Loc, Chars (T))); Rewrite (N, T_Decl); Insert_After (N, O_Decl); Mark_Rewrite_Insertion (O_Decl); --- 1764,1778 ---- -- entity is the new object declaration. The single_task_declaration -- is not used further in semantics or code generation, but is scanned -- when generating debug information, and therefore needs the updated ! -- Sloc information for the entity (see Sprint). Aspect specifications ! -- are moved from the single task node to the object declaration node. O_Decl := Make_Object_Declaration (Loc, Defining_Identifier => O_Name, Object_Definition => Make_Identifier (Loc, Chars (T))); + Move_Aspects (N, O_Decl); Rewrite (N, T_Decl); Insert_After (N, O_Decl); Mark_Rewrite_Insertion (O_Decl); *************** package body Sem_Ch9 is *** 1833,1840 **** -- procedure directly. Otherwise the node would be expanded twice, with -- disastrous result. ! Analyze_Task_Type (N); ! end Analyze_Single_Task; ----------------------- -- Analyze_Task_Body -- --- 1792,1800 ---- -- procedure directly. Otherwise the node would be expanded twice, with -- disastrous result. ! Analyze_Task_Type_Declaration (N); ! Analyze_Aspect_Specifications (N, Id, Aspect_Specifications (N)); ! end Analyze_Single_Task_Declaration; ----------------------- -- Analyze_Task_Body -- *************** package body Sem_Ch9 is *** 2000,2010 **** Process_End_Label (N, 'e', Current_Scope); end Analyze_Task_Definition; ! ----------------------- ! -- Analyze_Task_Type -- ! ----------------------- ! procedure Analyze_Task_Type (N : Node_Id) is Def_Id : constant Entity_Id := Defining_Identifier (N); T : Entity_Id; --- 1960,1970 ---- Process_End_Label (N, 'e', Current_Scope); end Analyze_Task_Definition; ! ----------------------------------- ! -- Analyze_Task_Type_Declaration -- ! ----------------------------------- ! procedure Analyze_Task_Type_Declaration (N : Node_Id) is Def_Id : constant Entity_Id := Defining_Identifier (N); T : Entity_Id; *************** package body Sem_Ch9 is *** 2031,2037 **** Set_Stored_Constraint (T, No_Elist); Push_Scope (T); ! if Ada_Version >= Ada_05 then Check_Interfaces (N, T); end if; --- 1991,1997 ---- Set_Stored_Constraint (T, No_Elist); Push_Scope (T); ! if Ada_Version >= Ada_2005 then Check_Interfaces (N, T); end if; *************** package body Sem_Ch9 is *** 2053,2073 **** Set_Is_Constrained (T, not Has_Discriminants (T)); - -- Perform minimal expansion of the task type while inside a generic - -- context. The corresponding record is needed for various semantic - -- checks. - - if Inside_A_Generic then - Insert_After_And_Analyze (N, - Build_Corresponding_Record (N, T, Sloc (T))); - end if; - if Present (Task_Definition (N)) then Analyze_Task_Definition (Task_Definition (N)); end if; ! if not Is_Library_Level_Entity (T) then ! Check_Restriction (No_Task_Hierarchy, N); end if; End_Scope; --- 2013,2039 ---- Set_Is_Constrained (T, not Has_Discriminants (T)); if Present (Task_Definition (N)) then Analyze_Task_Definition (Task_Definition (N)); end if; ! -- In the case where the task type is declared at a nested level and the ! -- No_Task_Hierarchy restriction applies, issue a warning that objects ! -- of the type will violate the restriction. ! ! if Restriction_Check_Required (No_Task_Hierarchy) ! and then not Is_Library_Level_Entity (T) ! and then Comes_From_Source (T) ! then ! Error_Msg_Sloc := Restrictions_Loc (No_Task_Hierarchy); ! ! if Error_Msg_Sloc = No_Location then ! Error_Msg_N ! ("objects of this type will violate `No_Task_Hierarchy`?", N); ! else ! Error_Msg_N ! ("objects of this type will violate `No_Task_Hierarchy`?#", N); ! end if; end if; End_Scope; *************** package body Sem_Ch9 is *** 2097,2103 **** Process_Full_View (N, T, Def_Id); end if; end if; ! end Analyze_Task_Type; ----------------------------------- -- Analyze_Terminate_Alternative -- --- 2063,2071 ---- Process_Full_View (N, T, Def_Id); end if; end if; ! ! Analyze_Aspect_Specifications (N, Def_Id, Aspect_Specifications (N)); ! end Analyze_Task_Type_Declaration; ----------------------------------- -- Analyze_Terminate_Alternative -- *************** package body Sem_Ch9 is *** 2131,2137 **** -- Ada 2005 (AI-345): The trigger may be a dispatching call ! if Ada_Version >= Ada_05 then Analyze (Trigger); Check_Triggering_Statement (Trigger, N, Is_Disp_Select); end if; --- 2099,2105 ---- -- Ada 2005 (AI-345): The trigger may be a dispatching call ! if Ada_Version >= Ada_2005 then Analyze (Trigger); Check_Triggering_Statement (Trigger, N, Is_Disp_Select); end if; *************** package body Sem_Ch9 is *** 2173,2179 **** and then Nkind (Trigger) not in N_Delay_Statement and then Nkind (Trigger) /= N_Entry_Call_Statement then ! if Ada_Version < Ada_05 then Error_Msg_N ("triggering statement must be delay or entry call", Trigger); --- 2141,2147 ---- and then Nkind (Trigger) not in N_Delay_Statement and then Nkind (Trigger) /= N_Entry_Call_Statement then ! if Ada_Version < Ada_2005 then Error_Msg_N ("triggering statement must be delay or entry call", Trigger); *************** package body Sem_Ch9 is *** 2253,2270 **** -- Entry family with non-static bounds else ! -- If restriction is set, then this is an error ! ! if Restrictions.Set (R) then ! Error_Msg_N ! ("static subtype required by Restriction pragma", ! DSD); ! ! -- Otherwise we record an unknown count restriction ! else ! Check_Restriction (R, D); ! end if; end if; end; end if; --- 2221,2230 ---- -- Entry family with non-static bounds else ! -- Record an unknown count restriction, and if the ! -- restriction is active, post a message or warning. ! Check_Restriction (R, D); end if; end; end if; *************** package body Sem_Ch9 is *** 2433,2447 **** Iface := Find_Hidden_Interface (Priv_T_Ifaces, Full_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ("interface & not implemented by full type " & ! "(RM-2005 7.3 (7.3/2))", Priv_T, Iface); end if; Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ("interface & not implemented by partial " & ! "view (RM-2005 7.3 (7.3/2))", T, Iface); end if; end if; end if; --- 2393,2409 ---- Iface := Find_Hidden_Interface (Priv_T_Ifaces, Full_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ! ("interface & not implemented by full type " & ! "(RM-2005 7.3 (7.3/2))", Priv_T, Iface); end if; Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); if Present (Iface) then ! Error_Msg_NE ! ("interface & not implemented by partial " & ! "view (RM-2005 7.3 (7.3/2))", T, Iface); end if; end if; end if; *************** package body Sem_Ch9 is *** 2465,2471 **** -- It is not possible to have a dispatching trigger if we are not in -- Ada 2005 mode. ! if Ada_Version >= Ada_05 and then Nkind (Trigger) = N_Procedure_Call_Statement and then Present (Parameter_Associations (Trigger)) then --- 2427,2433 ---- -- It is not possible to have a dispatching trigger if we are not in -- Ada 2005 mode. ! if Ada_Version >= Ada_2005 and then Nkind (Trigger) = N_Procedure_Call_Statement and then Present (Parameter_Associations (Trigger)) then diff -Nrcpad gcc-4.5.2/gcc/ada/sem_ch9.ads gcc-4.6.0/gcc/ada/sem_ch9.ads *** gcc-4.5.2/gcc/ada/sem_ch9.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/sem_ch9.ads Mon Oct 11 10:34:53 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Ch9 is *** 41,54 **** procedure Analyze_Entry_Index_Specification (N : Node_Id); procedure Analyze_Protected_Body (N : Node_Id); procedure Analyze_Protected_Definition (N : Node_Id); ! procedure Analyze_Protected_Type (N : Node_Id); procedure Analyze_Requeue (N : Node_Id); procedure Analyze_Selective_Accept (N : Node_Id); ! procedure Analyze_Single_Protected (N : Node_Id); ! procedure Analyze_Single_Task (N : Node_Id); procedure Analyze_Task_Body (N : Node_Id); procedure Analyze_Task_Definition (N : Node_Id); ! procedure Analyze_Task_Type (N : Node_Id); procedure Analyze_Terminate_Alternative (N : Node_Id); procedure Analyze_Timed_Entry_Call (N : Node_Id); procedure Analyze_Triggering_Alternative (N : Node_Id); --- 41,54 ---- procedure Analyze_Entry_Index_Specification (N : Node_Id); procedure Analyze_Protected_Body (N : Node_Id); procedure Analyze_Protected_Definition (N : Node_Id); ! procedure Analyze_Protected_Type_Declaration (N : Node_Id); procedure Analyze_Requeue (N : Node_Id); procedure Analyze_Selective_Accept (N : Node_Id); ! procedure Analyze_Single_Protected_Declaration (N : Node_Id); ! procedure Analyze_Single_Task_Declaration (N : Node_Id); procedure Analyze_Task_Body (N : Node_Id); procedure Analyze_Task_Definition (N : Node_Id); ! procedure Analyze_Task_Type_Declaration (N : Node_Id); procedure Analyze_Terminate_Alternative (N : Node_Id); procedure Analyze_Timed_Entry_Call (N : Node_Id); procedure Analyze_Triggering_Alternative (N : Node_Id); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_disp.adb gcc-4.6.0/gcc/ada/sem_disp.adb *** gcc-4.5.2/gcc/ada/sem_disp.adb Mon Nov 30 13:29:41 2009 --- gcc-4.6.0/gcc/ada/sem_disp.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem_Disp is *** 72,77 **** --- 72,89 ---- -- (returning the designated tagged type in the case of an access -- parameter); otherwise returns empty. + function Find_Hidden_Overridden_Primitive (S : Entity_Id) return Entity_Id; + -- [Ada 2012:AI-0125] Find an inherited hidden primitive of the dispatching + -- type of S that has the same name of S, a type-conformant profile, an + -- original corresponding operation O that is a primitive of a visible + -- ancestor of the dispatching type of S and O is visible at the point of + -- of declaration of S. If the entity is found the Alias of S is set to the + -- original corresponding operation S and its Overridden_Operation is set + -- to the found entity; otherwise return Empty. + -- + -- This routine does not search for non-hidden primitives since they are + -- covered by the normal Ada 2005 rules. + ------------------------------- -- Add_Dispatching_Operation -- ------------------------------- *************** package body Sem_Disp is *** 91,96 **** --- 103,183 ---- Append_Unique_Elmt (New_Op, List); end Add_Dispatching_Operation; + --------------------------- + -- Covers_Some_Interface -- + --------------------------- + + function Covers_Some_Interface (Prim : Entity_Id) return Boolean is + Tagged_Type : constant Entity_Id := Find_Dispatching_Type (Prim); + Elmt : Elmt_Id; + E : Entity_Id; + + begin + pragma Assert (Is_Dispatching_Operation (Prim)); + + -- Although this is a dispatching primitive we must check if its + -- dispatching type is available because it may be the primitive + -- of a private type not defined as tagged in its partial view. + + if Present (Tagged_Type) and then Has_Interfaces (Tagged_Type) then + + -- If the tagged type is frozen then the internal entities associated + -- with interfaces are available in the list of primitives of the + -- tagged type and can be used to speed up this search. + + if Is_Frozen (Tagged_Type) then + Elmt := First_Elmt (Primitive_Operations (Tagged_Type)); + while Present (Elmt) loop + E := Node (Elmt); + + if Present (Interface_Alias (E)) + and then Alias (E) = Prim + then + return True; + end if; + + Next_Elmt (Elmt); + end loop; + + -- Otherwise we must collect all the interface primitives and check + -- if the Prim will override some interface primitive. + + else + declare + Ifaces_List : Elist_Id; + Iface_Elmt : Elmt_Id; + Iface : Entity_Id; + Iface_Prim : Entity_Id; + + begin + Collect_Interfaces (Tagged_Type, Ifaces_List); + Iface_Elmt := First_Elmt (Ifaces_List); + while Present (Iface_Elmt) loop + Iface := Node (Iface_Elmt); + + Elmt := First_Elmt (Primitive_Operations (Iface)); + while Present (Elmt) loop + Iface_Prim := Node (Elmt); + + if Chars (E) = Chars (Prim) + and then Is_Interface_Conformant + (Tagged_Type, Iface_Prim, Prim) + then + return True; + end if; + + Next_Elmt (Elmt); + end loop; + + Next_Elmt (Iface_Elmt); + end loop; + end; + end if; + end if; + + return False; + end Covers_Some_Interface; + ------------------------------- -- Check_Controlling_Formals -- ------------------------------- *************** package body Sem_Disp is *** 153,159 **** -- In Ada 2005, access parameters can have defaults if Ekind (Etype (Formal)) = E_Anonymous_Access_Type ! and then Ada_Version < Ada_05 then Error_Msg_N ("default not allowed for controlling access parameter", --- 240,246 ---- -- In Ada 2005, access parameters can have defaults if Ekind (Etype (Formal)) = E_Anonymous_Access_Type ! and then Ada_Version < Ada_2005 then Error_Msg_N ("default not allowed for controlling access parameter", *************** package body Sem_Disp is *** 175,184 **** Next_Formal (Formal); end loop; ! if Ekind (Subp) = E_Function ! or else ! Ekind (Subp) = E_Generic_Function ! then Ctrl_Type := Check_Controlling_Type (Etype (Subp), Subp); if Present (Ctrl_Type) then --- 262,268 ---- Next_Formal (Formal); end loop; ! if Ekind_In (Subp, E_Function, E_Generic_Function) then Ctrl_Type := Check_Controlling_Type (Etype (Subp), Subp); if Present (Ctrl_Type) then *************** package body Sem_Disp is *** 643,650 **** end if; if Present (Func) and then Is_Abstract_Subprogram (Func) then ! Error_Msg_N ( ! "call to abstract function must be dispatching", N); end if; end if; --- 727,734 ---- end if; if Present (Func) and then Is_Abstract_Subprogram (Func) then ! Error_Msg_N ! ("call to abstract function must be dispatching", N); end if; end if; *************** package body Sem_Disp is *** 669,697 **** procedure Check_Dispatching_Operation (Subp, Old_Subp : Entity_Id) is Tagged_Type : Entity_Id; ! Has_Dispatching_Parent : Boolean := False; ! Body_Is_Last_Primitive : Boolean := False; begin ! if Ekind (Subp) /= E_Procedure and then Ekind (Subp) /= E_Function then return; end if; Set_Is_Dispatching_Operation (Subp, False); Tagged_Type := Find_Dispatching_Type (Subp); ! -- Ada 2005 (AI-345) ! if Ada_Version = Ada_05 and then Present (Tagged_Type) and then Is_Concurrent_Type (Tagged_Type) then - -- Protect the frontend against previously detected errors - - if No (Corresponding_Record_Type (Tagged_Type)) then - return; - end if; - Tagged_Type := Corresponding_Record_Type (Tagged_Type); end if; --- 753,779 ---- procedure Check_Dispatching_Operation (Subp, Old_Subp : Entity_Id) is Tagged_Type : Entity_Id; ! Has_Dispatching_Parent : Boolean := False; ! Body_Is_Last_Primitive : Boolean := False; ! Ovr_Subp : Entity_Id := Empty; begin ! if not Ekind_In (Subp, E_Procedure, E_Function) then return; end if; Set_Is_Dispatching_Operation (Subp, False); Tagged_Type := Find_Dispatching_Type (Subp); ! -- Ada 2005 (AI-345): Use the corresponding record (if available). ! -- Required because primitives of concurrent types are be attached ! -- to the corresponding record (not to the concurrent type). ! if Ada_Version >= Ada_2005 and then Present (Tagged_Type) and then Is_Concurrent_Type (Tagged_Type) + and then Present (Corresponding_Record_Type (Tagged_Type)) then Tagged_Type := Corresponding_Record_Type (Tagged_Type); end if; *************** package body Sem_Disp is *** 749,755 **** and then not In_Instance then Error_Msg_N ("?declaration of& is too late!", Subp); ! Error_Msg_NE ("\spec should appear immediately after declaration of &!", Subp, Typ); exit; --- 831,837 ---- and then not In_Instance then Error_Msg_N ("?declaration of& is too late!", Subp); ! Error_Msg_NE -- CODEFIX?? ("\spec should appear immediately after declaration of &!", Subp, Typ); exit; *************** package body Sem_Disp is *** 790,796 **** and then not Comes_From_Source (Subp) and then not Has_Dispatching_Parent then ! -- Complete decoration if internally built subprograms that override -- a dispatching primitive. These entities correspond with the -- following cases: --- 872,878 ---- and then not Comes_From_Source (Subp) and then not Has_Dispatching_Parent then ! -- Complete decoration of internally built subprograms that override -- a dispatching primitive. These entities correspond with the -- following cases: *************** package body Sem_Disp is *** 800,819 **** -- type by Make_Controlling_Function_Wrappers. However, attribute -- Is_Dispatching_Operation must be set to true. ! -- 2. Subprograms associated with stream attributes (built by -- New_Stream_Subprogram) if Present (Old_Subp) ! and then Is_Overriding_Operation (Subp) and then Is_Dispatching_Operation (Old_Subp) then pragma Assert ((Ekind (Subp) = E_Function and then Is_Dispatching_Operation (Old_Subp) and then Is_Null_Extension (Base_Type (Etype (Subp)))) or else Get_TSS_Name (Subp) = TSS_Stream_Read or else Get_TSS_Name (Subp) = TSS_Stream_Write); Set_Is_Dispatching_Operation (Subp); end if; --- 882,912 ---- -- type by Make_Controlling_Function_Wrappers. However, attribute -- Is_Dispatching_Operation must be set to true. ! -- 2. Ada 2005 (AI-251): Wrapper procedures of null interface ! -- primitives. ! ! -- 3. Subprograms associated with stream attributes (built by -- New_Stream_Subprogram) if Present (Old_Subp) ! and then Present (Overridden_Operation (Subp)) and then Is_Dispatching_Operation (Old_Subp) then pragma Assert ((Ekind (Subp) = E_Function and then Is_Dispatching_Operation (Old_Subp) and then Is_Null_Extension (Base_Type (Etype (Subp)))) + or else + (Ekind (Subp) = E_Procedure + and then Is_Dispatching_Operation (Old_Subp) + and then Present (Alias (Old_Subp)) + and then Is_Null_Interface_Primitive + (Ultimate_Alias (Old_Subp))) or else Get_TSS_Name (Subp) = TSS_Stream_Read or else Get_TSS_Name (Subp) = TSS_Stream_Write); + Check_Controlling_Formals (Tagged_Type, Subp); + Override_Dispatching_Operation (Tagged_Type, Old_Subp, Subp); Set_Is_Dispatching_Operation (Subp); end if; *************** package body Sem_Disp is *** 942,948 **** end if; -- Indicate that this is an overriding operation, ! -- and replace the overriden entry in the list of -- primitive operations, which is used for xref -- generation subsequently. --- 1035,1041 ---- end if; -- Indicate that this is an overriding operation, ! -- and replace the overridden entry in the list of -- primitive operations, which is used for xref -- generation subsequently. *************** package body Sem_Disp is *** 964,972 **** -- If the type is not frozen yet and we are not in the overriding -- case it looks suspiciously like an attempt to define a primitive -- operation, which requires the declaration to be in a package spec ! -- (3.2.3(6)). ! elsif not Is_Frozen (Tagged_Type) then Error_Msg_N ("?not dispatching (must be defined in a package spec)", Subp); return; --- 1057,1071 ---- -- If the type is not frozen yet and we are not in the overriding -- case it looks suspiciously like an attempt to define a primitive -- operation, which requires the declaration to be in a package spec ! -- (3.2.3(6)). Only report cases where the type and subprogram are ! -- in the same declaration list (by checking the enclosing parent ! -- declarations), to avoid spurious warnings on subprograms in ! -- instance bodies when the type is declared in the instance spec but ! -- hasn't been frozen by the instance body. ! elsif not Is_Frozen (Tagged_Type) ! and then In_Same_List (Parent (Tagged_Type), Parent (Parent (Subp))) ! then Error_Msg_N ("?not dispatching (must be defined in a package spec)", Subp); return; *************** package body Sem_Disp is *** 992,1005 **** Check_Controlling_Formals (Tagged_Type, Subp); -- Now it should be a correct primitive operation, put it in the list ! if Present (Old_Subp) then -- If the type has interfaces we complete this check after we set -- attribute Is_Dispatching_Operation. ! Check_Subtype_Conformant (Subp, Old_Subp); if (Chars (Subp) = Name_Initialize or else Chars (Subp) = Name_Adjust --- 1091,1115 ---- Check_Controlling_Formals (Tagged_Type, Subp); + Ovr_Subp := Old_Subp; + + -- [Ada 2012:AI-0125]: Search for inherited hidden primitive that may be + -- overridden by Subp + + if No (Ovr_Subp) + and then Ada_Version >= Ada_2012 + then + Ovr_Subp := Find_Hidden_Overridden_Primitive (Subp); + end if; + -- Now it should be a correct primitive operation, put it in the list ! if Present (Ovr_Subp) then -- If the type has interfaces we complete this check after we set -- attribute Is_Dispatching_Operation. ! Check_Subtype_Conformant (Subp, Ovr_Subp); if (Chars (Subp) = Name_Initialize or else Chars (Subp) = Name_Adjust *************** package body Sem_Disp is *** 1007,1013 **** and then Is_Controlled (Tagged_Type) and then not Is_Visibly_Controlled (Tagged_Type) then ! Set_Is_Overriding_Operation (Subp, False); -- If the subprogram specification carries an overriding -- indicator, no need for the warning: it is either redundant, --- 1117,1123 ---- and then Is_Controlled (Tagged_Type) and then not Is_Visibly_Controlled (Tagged_Type) then ! Set_Overridden_Operation (Subp, Empty); -- If the subprogram specification carries an overriding -- indicator, no need for the warning: it is either redundant, *************** package body Sem_Disp is *** 1028,1035 **** end if; else ! Override_Dispatching_Operation (Tagged_Type, Old_Subp, Subp); ! Set_Is_Overriding_Operation (Subp); -- Ada 2005 (AI-251): In case of late overriding of a primitive -- that covers abstract interface subprograms we must register it --- 1138,1144 ---- end if; else ! Override_Dispatching_Operation (Tagged_Type, Ovr_Subp, Subp); -- Ada 2005 (AI-251): In case of late overriding of a primitive -- that covers abstract interface subprograms we must register it *************** package body Sem_Disp is *** 1071,1076 **** --- 1180,1197 ---- end if; end if; + -- If the tagged type is a concurrent type then we must be compiling + -- with no code generation (we are either compiling a generic unit or + -- compiling under -gnatc mode) because we have previously tested that + -- no serious errors has been reported. In this case we do not add the + -- primitive to the list of primitives of Tagged_Type but we leave the + -- primitive decorated as a dispatching operation to be able to analyze + -- and report errors associated with the Object.Operation notation. + + elsif Is_Concurrent_Type (Tagged_Type) then + pragma Assert (not Expander_Active); + null; + -- If no old subprogram, then we add this as a dispatching operation, -- but we avoid doing this if an error was posted, to prevent annoying -- cascaded errors. *************** package body Sem_Disp is *** 1085,1091 **** -- subtype conformance against all the interfaces covered by this -- primitive. ! if Present (Old_Subp) and then Has_Interfaces (Tagged_Type) then declare --- 1206,1212 ---- -- subtype conformance against all the interfaces covered by this -- primitive. ! if Present (Ovr_Subp) and then Has_Interfaces (Tagged_Type) then declare *************** package body Sem_Disp is *** 1499,1505 **** -- For subprograms internally generated by derivations of tagged types -- use the alias subprogram as a reference to locate the dispatching ! -- type of Subp elsif not Comes_From_Source (Subp) and then Present (Alias (Subp)) --- 1620,1626 ---- -- For subprograms internally generated by derivations of tagged types -- use the alias subprogram as a reference to locate the dispatching ! -- type of Subp. elsif not Comes_From_Source (Subp) and then Present (Alias (Subp)) *************** package body Sem_Disp is *** 1551,1556 **** --- 1672,1758 ---- return Empty; end Find_Dispatching_Type; + -------------------------------------- + -- Find_Hidden_Overridden_Primitive -- + -------------------------------------- + + function Find_Hidden_Overridden_Primitive (S : Entity_Id) return Entity_Id + is + Tag_Typ : constant Entity_Id := Find_Dispatching_Type (S); + Elmt : Elmt_Id; + Orig_Prim : Entity_Id; + Prim : Entity_Id; + Vis_List : Elist_Id; + + begin + -- This Ada 2012 rule is valid only for type extensions or private + -- extensions. + + if No (Tag_Typ) + or else not Is_Record_Type (Tag_Typ) + or else Etype (Tag_Typ) = Tag_Typ + then + return Empty; + end if; + + -- Collect the list of visible ancestor of the tagged type + + Vis_List := Visible_Ancestors (Tag_Typ); + + Elmt := First_Elmt (Primitive_Operations (Tag_Typ)); + while Present (Elmt) loop + Prim := Node (Elmt); + + -- Find an inherited hidden dispatching primitive with the name of S + -- and a type-conformant profile. + + if Present (Alias (Prim)) + and then Is_Hidden (Alias (Prim)) + and then Find_Dispatching_Type (Alias (Prim)) /= Tag_Typ + and then Primitive_Names_Match (S, Prim) + and then Type_Conformant (S, Prim) + then + declare + Vis_Ancestor : Elmt_Id; + Elmt : Elmt_Id; + + begin + -- The original corresponding operation of Prim must be an + -- operation of a visible ancestor of the dispatching type + -- S, and the original corresponding operation of S2 must + -- be visible. + + Orig_Prim := Original_Corresponding_Operation (Prim); + + if Orig_Prim /= Prim + and then Is_Immediately_Visible (Orig_Prim) + then + Vis_Ancestor := First_Elmt (Vis_List); + while Present (Vis_Ancestor) loop + Elmt := + First_Elmt (Primitive_Operations (Node (Vis_Ancestor))); + while Present (Elmt) loop + if Node (Elmt) = Orig_Prim then + Set_Overridden_Operation (S, Prim); + Set_Alias (Prim, Orig_Prim); + return Prim; + end if; + + Next_Elmt (Elmt); + end loop; + + Next_Elmt (Vis_Ancestor); + end loop; + end if; + end; + end if; + + Next_Elmt (Elmt); + end loop; + + return Empty; + end Find_Hidden_Overridden_Primitive; + --------------------------------------- -- Find_Primitive_Covering_Interface -- --------------------------------------- *************** package body Sem_Disp is *** 1559,1572 **** (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id) return Entity_Id is ! E : Entity_Id; begin pragma Assert (Is_Interface (Find_Dispatching_Type (Iface_Prim)) or else (Present (Alias (Iface_Prim)) ! and then ! Is_Interface ! (Find_Dispatching_Type (Ultimate_Alias (Iface_Prim))))); E := Current_Entity (Iface_Prim); while Present (E) loop --- 1761,1779 ---- (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id) return Entity_Id is ! E : Entity_Id; ! El : Elmt_Id; begin pragma Assert (Is_Interface (Find_Dispatching_Type (Iface_Prim)) or else (Present (Alias (Iface_Prim)) ! and then ! Is_Interface ! (Find_Dispatching_Type (Ultimate_Alias (Iface_Prim))))); ! ! -- Search in the homonym chain. Done to speed up locating visible ! -- entities and required to catch primitives associated with the partial ! -- view of private types when processing the corresponding full view. E := Current_Entity (Iface_Prim); while Present (E) loop *************** package body Sem_Disp is *** 1580,1589 **** --- 1787,1948 ---- E := Homonym (E); end loop; + -- Search in the list of primitives of the type. Required to locate the + -- covering primitive if the covering primitive is not visible (for + -- example, non-visible inherited primitive of private type). + + El := First_Elmt (Primitive_Operations (Tagged_Type)); + while Present (El) loop + E := Node (El); + + -- Keep separate the management of internal entities that link + -- primitives with interface primitives from tagged type primitives. + + if No (Interface_Alias (E)) then + if Present (Alias (E)) then + + -- This interface primitive has not been covered yet + + if Alias (E) = Iface_Prim then + return E; + + -- The covering primitive was inherited + + elsif Overridden_Operation (Ultimate_Alias (E)) + = Iface_Prim + then + return E; + end if; + end if; + + -- Check if E covers the interface primitive (includes case in + -- which E is an inherited private primitive). + + if Is_Interface_Conformant (Tagged_Type, Iface_Prim, E) then + return E; + end if; + + -- Use the internal entity that links the interface primitive with + -- the covering primitive to locate the entity. + + elsif Interface_Alias (E) = Iface_Prim then + return Alias (E); + end if; + + Next_Elmt (El); + end loop; + + -- Not found + return Empty; end Find_Primitive_Covering_Interface; --------------------------- + -- Inherited_Subprograms -- + --------------------------- + + function Inherited_Subprograms (S : Entity_Id) return Subprogram_List is + Result : Subprogram_List (1 .. 6000); + -- 6000 here is intended to be infinity. We could use an expandable + -- table, but it would be awfully heavy, and there is no way that we + -- could reasonably exceed this value. + + N : Int := 0; + -- Number of entries in Result + + Parent_Op : Entity_Id; + -- Traverses the Overridden_Operation chain + + procedure Store_IS (E : Entity_Id); + -- Stores E in Result if not already stored + + -------------- + -- Store_IS -- + -------------- + + procedure Store_IS (E : Entity_Id) is + begin + for J in 1 .. N loop + if E = Result (J) then + return; + end if; + end loop; + + N := N + 1; + Result (N) := E; + end Store_IS; + + -- Start of processing for Inherited_Subprograms + + begin + if Present (S) and then Is_Dispatching_Operation (S) then + + -- Deal with direct inheritance + + Parent_Op := S; + loop + Parent_Op := Overridden_Operation (Parent_Op); + exit when No (Parent_Op); + + if Is_Subprogram (Parent_Op) + or else Is_Generic_Subprogram (Parent_Op) + then + Store_IS (Parent_Op); + end if; + end loop; + + -- Now deal with interfaces + + declare + Tag_Typ : Entity_Id; + Prim : Entity_Id; + Elmt : Elmt_Id; + + begin + Tag_Typ := Find_Dispatching_Type (S); + + if Is_Concurrent_Type (Tag_Typ) then + Tag_Typ := Corresponding_Record_Type (Tag_Typ); + end if; + + -- Search primitive operations of dispatching type + + if Present (Tag_Typ) + and then Present (Primitive_Operations (Tag_Typ)) + then + Elmt := First_Elmt (Primitive_Operations (Tag_Typ)); + while Present (Elmt) loop + Prim := Node (Elmt); + + -- The following test eliminates some odd cases in which + -- Ekind (Prim) is Void, to be investigated further ??? + + if not (Is_Subprogram (Prim) + or else + Is_Generic_Subprogram (Prim)) + then + null; + + -- For [generic] subprogram, look at interface alias + + elsif Present (Interface_Alias (Prim)) + and then Alias (Prim) = S + then + -- We have found a primitive covered by S + + Store_IS (Interface_Alias (Prim)); + end if; + + Next_Elmt (Elmt); + end loop; + end if; + end; + end if; + + return Result (1 .. N); + end Inherited_Subprograms; + + --------------------------- -- Is_Dynamically_Tagged -- --------------------------- *************** package body Sem_Disp is *** 1596,1601 **** --- 1955,1973 ---- end if; end Is_Dynamically_Tagged; + --------------------------------- + -- Is_Null_Interface_Primitive -- + --------------------------------- + + function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean is + begin + return Comes_From_Source (E) + and then Is_Dispatching_Operation (E) + and then Ekind (E) = E_Procedure + and then Null_Present (Parent (E)) + and then Is_Interface (Find_Dispatching_Type (E)); + end Is_Null_Interface_Primitive; + -------------------------- -- Is_Tag_Indeterminate -- -------------------------- *************** package body Sem_Disp is *** 1659,1665 **** -- is also tag-indeterminate. elsif Nkind (Orig_Node) = N_Explicit_Dereference ! and then Ada_Version >= Ada_05 then return Is_Tag_Indeterminate (Prefix (Orig_Node)); --- 2031,2037 ---- -- is also tag-indeterminate. elsif Nkind (Orig_Node) = N_Explicit_Dereference ! and then Ada_Version >= Ada_2005 then return Is_Tag_Indeterminate (Prefix (Orig_Node)); *************** package body Sem_Disp is *** 1703,1711 **** return; end if; ! Replace_Elmt (Elmt, New_Op); ! if Ada_Version >= Ada_05 and then Has_Interfaces (Tagged_Type) then -- Ada 2005 (AI-251): Update the attribute alias of all the aliased --- 2075,2104 ---- return; end if; ! -- The location of entities that come from source in the list of ! -- primitives of the tagged type must follow their order of occurrence ! -- in the sources to fulfill the C++ ABI. If the overridden entity is a ! -- primitive of an interface that is not an ancestor of this tagged ! -- type (that is, it is an entity added to the list of primitives by ! -- Derive_Interface_Progenitors), then we must append the new entity ! -- at the end of the list of primitives. ! if Present (Alias (Prev_Op)) ! and then Is_Interface (Find_Dispatching_Type (Alias (Prev_Op))) ! and then not Is_Ancestor (Find_Dispatching_Type (Alias (Prev_Op)), ! Tagged_Type) ! then ! Remove_Elmt (Primitive_Operations (Tagged_Type), Elmt); ! Append_Elmt (New_Op, Primitive_Operations (Tagged_Type)); ! ! -- The new primitive replaces the overridden entity. Required to ensure ! -- that overriding primitive is assigned the same dispatch table slot. ! ! else ! Replace_Elmt (Elmt, New_Op); ! end if; ! ! if Ada_Version >= Ada_2005 and then Has_Interfaces (Tagged_Type) then -- Ada 2005 (AI-251): Update the attribute alias of all the aliased *************** package body Sem_Disp is *** 1760,1770 **** -- Make the overriding operation into an alias of the implicit one. -- In this fashion a call from outside ends up calling the new body ! -- even if non-dispatching, and a call from inside calls the ! -- overriding operation because it hides the implicit one. To ! -- indicate that the body of Prev_Op is never called, set its ! -- dispatch table entity to Empty. If the overridden operation ! -- has a dispatching result, so does the overriding one. Set_Alias (Prev_Op, New_Op); Set_DTC_Entity (Prev_Op, Empty); --- 2153,2163 ---- -- Make the overriding operation into an alias of the implicit one. -- In this fashion a call from outside ends up calling the new body ! -- even if non-dispatching, and a call from inside calls the over- ! -- riding operation because it hides the implicit one. To indicate ! -- that the body of Prev_Op is never called, set its dispatch table ! -- entity to Empty. If the overridden operation has a dispatching ! -- result, so does the overriding one. Set_Alias (Prev_Op, New_Op); Set_DTC_Entity (Prev_Op, Empty); *************** package body Sem_Disp is *** 1819,1825 **** end if; Arg := First_Actual (Call_Node); - while Present (Arg) loop if Is_Tag_Indeterminate (Arg) then Propagate_Tag (Control, Arg); --- 2212,2217 ---- *************** package body Sem_Disp is *** 1833,1839 **** -- and would have to undo any expansion to an indirect call. if Tagged_Type_Expansion 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 --- 2225,2259 ---- -- and would have to undo any expansion to an indirect call. if Tagged_Type_Expansion then ! declare ! Call_Typ : constant Entity_Id := Etype (Call_Node); ! ! begin ! Expand_Dispatching_Call (Call_Node); ! ! -- If the controlling argument is an interface type and the type ! -- of Call_Node differs then we must add an implicit conversion to ! -- force displacement of the pointer to the object to reference ! -- the secondary dispatch table of the interface. ! ! if Is_Interface (Etype (Control)) ! and then Etype (Control) /= Call_Typ ! then ! -- Cannot use Convert_To because the previous call to ! -- Expand_Dispatching_Call leaves decorated the Call_Node ! -- with the type of Control. ! ! Rewrite (Call_Node, ! Make_Type_Conversion (Sloc (Call_Node), ! Subtype_Mark => ! New_Occurrence_Of (Etype (Control), Sloc (Call_Node)), ! Expression => Relocate_Node (Call_Node))); ! Set_Etype (Call_Node, Etype (Control)); ! Set_Analyzed (Call_Node); ! ! Expand_Interface_Conversion (Call_Node, Is_Static => False); ! end if; ! end; -- 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 diff -Nrcpad gcc-4.5.2/gcc/ada/sem_disp.ads gcc-4.6.0/gcc/ada/sem_disp.ads *** gcc-4.5.2/gcc/ada/sem_disp.ads Mon May 26 13:43:18 2008 --- gcc-4.6.0/gcc/ada/sem_disp.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Disp is *** 46,52 **** -- if it has a parameter of this type and is defined at a proper place for -- primitive operations (new primitives are only defined in package spec, -- overridden operation can be defined in any scope). If Old_Subp is not ! -- Empty we are in the overriding case. procedure Check_Operation_From_Incomplete_Type (Subp : Entity_Id; --- 46,57 ---- -- if it has a parameter of this type and is defined at a proper place for -- primitive operations (new primitives are only defined in package spec, -- overridden operation can be defined in any scope). If Old_Subp is not ! -- Empty we are in the overriding case. If the tagged type associated with ! -- Subp is a concurrent type (case that occurs when the type is declared in ! -- a generic because the analysis of generics disables generation of the ! -- corresponding record) then this routine does does not add "Subp" to the ! -- list of primitive operations but leaves Subp decorated as dispatching ! -- operation to enable checks associated with the Object.Operation notation procedure Check_Operation_From_Incomplete_Type (Subp : Entity_Id; *************** package Sem_Disp is *** 61,87 **** -- of "OldSubp" is adjusted to point to the inherited procedure of the -- full view because it is always this one which has to be called. function Find_Controlling_Arg (N : Node_Id) return Node_Id; -- Returns the actual controlling argument if N is dynamically tagged, -- and Empty if it is not dynamically tagged. function Find_Dispatching_Type (Subp : Entity_Id) return Entity_Id; ! -- Check whether a subprogram is dispatching, and find the tagged ! -- type of the controlling argument or arguments. function Find_Primitive_Covering_Interface (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id) return Entity_Id; ! -- Search in the homonym chain for the primitive of Tagged_Type that ! -- covers Iface_Prim. The homonym chain traversal is required to catch ! -- primitives associated with the partial view of private types when ! -- processing the corresponding full view. function Is_Dynamically_Tagged (N : Node_Id) return Boolean; -- Used to determine whether a call is dispatching, i.e. if is an -- an expression of a class_Wide type, or a call to a function with -- controlling result where at least one operand is dynamically tagged. function Is_Tag_Indeterminate (N : Node_Id) return Boolean; -- An expression is tag-indeterminate if it is a call that dispatches -- on result, and all controlling operands are also indeterminate. --- 66,118 ---- -- of "OldSubp" is adjusted to point to the inherited procedure of the -- full view because it is always this one which has to be called. + function Covers_Some_Interface (Prim : Entity_Id) return Boolean; + -- Returns true if Prim covers some interface primitive of its associated + -- tagged type. The tagged type of Prim must be frozen when this function + -- is invoked. + function Find_Controlling_Arg (N : Node_Id) return Node_Id; -- Returns the actual controlling argument if N is dynamically tagged, -- and Empty if it is not dynamically tagged. function Find_Dispatching_Type (Subp : Entity_Id) return Entity_Id; ! -- Check whether a subprogram is dispatching, and find the tagged type of ! -- the controlling argument or arguments. Returns Empty if Subp is not a ! -- dispatching operation. function Find_Primitive_Covering_Interface (Tagged_Type : Entity_Id; Iface_Prim : Entity_Id) return Entity_Id; ! -- Search in the homonym chain for the primitive of Tagged_Type that covers ! -- Iface_Prim. The homonym chain traversal is required to catch primitives ! -- associated with the partial view of private types when processing the ! -- corresponding full view. If the entity is not found then search for it ! -- in the list of primitives of Tagged_Type. This latter search is needed ! -- when the interface primitive is covered by a private subprogram. If the ! -- primitive has not been covered yet then return the entity that will be ! -- overridden when the primitive is covered (that is, return the entity ! -- whose alias attribute references the interface primitive). If none of ! -- these entities is found then return Empty. ! ! type Subprogram_List is array (Nat range <>) of Entity_Id; ! -- Type returned by Inherited_Subprograms function ! ! function Inherited_Subprograms (S : Entity_Id) return Subprogram_List; ! -- Given the spec of a subprogram, this function gathers any inherited ! -- subprograms from direct inheritance or via interfaces. The list is ! -- a list of entity id's of the specs of inherited subprograms. Returns ! -- a null array if passed an Empty spec id. Note that the returned array ! -- only includes subprograms and generic subprograms (and excludes any ! -- other inherited entities, in particular enumeration literals). function Is_Dynamically_Tagged (N : Node_Id) return Boolean; -- Used to determine whether a call is dispatching, i.e. if is an -- an expression of a class_Wide type, or a call to a function with -- controlling result where at least one operand is dynamically tagged. + function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean; + -- Returns True if E is a null procedure that is an interface primitive + function Is_Tag_Indeterminate (N : Node_Id) return Boolean; -- An expression is tag-indeterminate if it is a call that dispatches -- on result, and all controlling operands are also indeterminate. diff -Nrcpad gcc-4.5.2/gcc/ada/sem_dist.adb gcc-4.6.0/gcc/ada/sem_dist.adb *** gcc-4.5.2/gcc/ada/sem_dist.adb Mon Jul 20 13:48:01 2009 --- gcc-4.6.0/gcc/ada/sem_dist.adb Tue Oct 26 13:20:47 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem_Dist is *** 451,459 **** -- True iff this RAS has an access formal parameter (see -- Exp_Dist.Add_RAS_Dereference_TSS for details). ! Subpkg : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! New_Internal_Name ('S')); Subpkg_Decl : Node_Id; Subpkg_Body : Node_Id; Vis_Decls : constant List_Id := New_List; --- 451,457 ---- -- True iff this RAS has an access formal parameter (see -- Exp_Dist.Add_RAS_Dereference_TSS for details). ! Subpkg : constant Entity_Id := Make_Temporary (Loc, 'S'); Subpkg_Decl : Node_Id; Subpkg_Body : Node_Id; Vis_Decls : constant List_Id := New_List; *************** package body Sem_Dist is *** 464,479 **** New_External_Name (Chars (User_Type), 'R')); Full_Obj_Type : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars (Obj_Type)); RACW_Type : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (User_Type), 'P')); Fat_Type : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars (User_Type)); Fat_Type_Decl : Node_Id; --- 462,475 ---- New_External_Name (Chars (User_Type), 'R')); Full_Obj_Type : constant Entity_Id := ! Make_Defining_Identifier (Loc, Chars (Obj_Type)); RACW_Type : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (User_Type), 'P')); Fat_Type : constant Entity_Id := ! Make_Defining_Identifier (Loc, Chars (User_Type)); Fat_Type_Decl : Node_Id; *************** package body Sem_Dist is *** 781,787 **** Make_Aggregate (Loc, Component_Associations => New_List ( Make_Component_Association (Loc, ! Choices => New_List (Make_Identifier (Loc, Name_Ras)), Expression => Make_Null (Loc))))); Analyze_And_Resolve (N, Target_Type); return True; --- 777,783 ---- Make_Aggregate (Loc, Component_Associations => New_List ( Make_Component_Association (Loc, ! Choices => New_List (Make_Identifier (Loc, Name_Ras)), Expression => Make_Null (Loc))))); Analyze_And_Resolve (N, Target_Type); return True; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_elab.adb gcc-4.6.0/gcc/ada/sem_elab.adb *** gcc-4.5.2/gcc/ada/sem_elab.adb Wed Jul 22 10:31:30 2009 --- gcc-4.6.0/gcc/ada/sem_elab.adb Thu Oct 7 10:35:03 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2010, 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- -- *************** package body Sem_Elab is *** 599,607 **** -- No checks needed for pure or preelaborated compilation units ! if Is_Pure (E_Scope) ! or else Is_Preelaborated (E_Scope) ! then return; end if; --- 599,605 ---- -- No checks needed for pure or preelaborated compilation units ! if Is_Pure (E_Scope) or else Is_Preelaborated (E_Scope) then return; end if; *************** package body Sem_Elab is *** 941,946 **** --- 939,954 ---- Make_Attribute_Reference (Loc, Attribute_Name => Name_Elaborated, Prefix => New_Occurrence_Of (Spec_Entity (E_Scope), Loc))); + + -- Prevent duplicate elaboration checks on the same call, + -- which can happen if the body enclosing the call appears + -- itself in a call whose elaboration check is delayed. + + if Nkind_In (N, N_Function_Call, + N_Procedure_Call_Statement) + then + Set_No_Elaboration_Check (N); + end if; end if; -- Case of static elaboration model *************** package body Sem_Elab is *** 1678,1684 **** -- Here is where we give the warning ! -- All OK if warnings suppressed on the entity if not Has_Warnings_Off (Ent) then Error_Msg_Sloc := Sloc (Ent); --- 1686,1692 ---- -- Here is where we give the warning ! -- All OK if warnings suppressed on the entity if not Has_Warnings_Off (Ent) then Error_Msg_Sloc := Sloc (Ent); *************** package body Sem_Elab is *** 1891,1896 **** --- 1899,1909 ---- elsif In_Task_Activation then return; + + -- Nothing to do if call is within a generic unit + + elsif Inside_A_Generic then + return; end if; -- Delay this call if we are still delaying calls *************** package body Sem_Elab is *** 2285,2291 **** ("task will be activated before elaboration of its body?", Decl); Error_Msg_N ! ("\Program_Error will be raised at run-time?", Decl); elsif Present (Corresponding_Body (Unit_Declaration_Node (Proc))) --- 2298,2304 ---- ("task will be activated before elaboration of its body?", Decl); Error_Msg_N ! ("\Program_Error will be raised at run time?", Decl); elsif Present (Corresponding_Body (Unit_Declaration_Node (Proc))) *************** package body Sem_Elab is *** 2427,2433 **** and then not Elaboration_Checks_Suppressed (Task_Scope) then Error_Msg_Node_2 := Task_Scope; ! Error_Msg_NE ("activation of an instance of task type&" & " requires pragma Elaborate_All on &?", N, Ent); end if; --- 2440,2447 ---- and then not Elaboration_Checks_Suppressed (Task_Scope) then Error_Msg_Node_2 := Task_Scope; ! Error_Msg_NE ! ("activation of an instance of task type&" & " requires pragma Elaborate_All on &?", N, Ent); end if; *************** package body Sem_Elab is *** 2846,2853 **** Typ : constant Entity_Id := Etype (N); Chk : constant Boolean := Do_Range_Check (N); ! R : constant Node_Id := ! Make_Raise_Program_Error (Loc, Reason => PE_Access_Before_Elaboration); Reloc_N : Node_Id; --- 2860,2867 ---- Typ : constant Entity_Id := Etype (N); Chk : constant Boolean := Do_Range_Check (N); ! R : constant Node_Id := ! Make_Raise_Program_Error (Loc, Reason => PE_Access_Before_Elaboration); Reloc_N : Node_Id; *************** package body Sem_Elab is *** 3008,3017 **** -- Check for case of body entity -- Why is the check for E_Void needed??? ! if Ekind (E) = E_Void ! or else Ekind (E) = E_Subprogram_Body ! or else Ekind (E) = E_Package_Body ! then Decl := E; loop --- 3022,3028 ---- -- Check for case of body entity -- Why is the check for E_Void needed??? ! if Ekind_In (E, E_Void, E_Subprogram_Body, E_Package_Body) then Decl := E; loop *************** package body Sem_Elab is *** 3042,3058 **** 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 := --- 3053,3069 ---- 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 := diff -Nrcpad gcc-4.5.2/gcc/ada/sem_elim.adb gcc-4.6.0/gcc/ada/sem_elim.adb *** gcc-4.5.2/gcc/ada/sem_elim.adb Wed Apr 29 10:19:14 2009 --- gcc-4.6.0/gcc/ada/sem_elim.adb Tue Oct 26 11:02:31 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2010, 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- -- *************** with Errout; use Errout; *** 29,35 **** --- 29,37 ---- with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; + with Opt; use Opt; with Sem; use Sem; + with Sem_Aux; use Sem_Aux; with Sem_Prag; use Sem_Prag; with Sem_Util; use Sem_Util; with Sinput; use Sinput; *************** package body Sem_Elim is *** 234,239 **** --- 236,242 ---- Elmt : Access_Elim_Data; Scop : Entity_Id; Form : Entity_Id; + Up : Nat; begin if No_Elimination then *************** package body Sem_Elim is *** 264,270 **** -- If an overriding dispatching primitive is eliminated then -- its parent must have been eliminated. ! if Is_Overriding_Operation (E) and then not Is_Eliminated (Overridden_Operation (E)) then Error_Msg_Name_1 := Chars (E); --- 267,273 ---- -- If an overriding dispatching primitive is eliminated then -- its parent must have been eliminated. ! if Present (Overridden_Operation (E)) and then not Is_Eliminated (Overridden_Operation (E)) then Error_Msg_Name_1 := Chars (E); *************** package body Sem_Elim is *** 286,306 **** goto Continue; end if; ! -- Find enclosing unit Scop := Cunit_Entity (Current_Sem_Unit); -- Now see if compilation unit matches ! for J in reverse Elmt.Unit_Name'Range loop if Elmt.Unit_Name (J) /= Chars (Scop) then goto Continue; end if; Scop := Scope (Scop); - while Ekind (Scop) = E_Block loop - Scop := Scope (Scop); - end loop; if Scop /= Standard_Standard and then J = 1 then goto Continue; --- 289,337 ---- goto Continue; end if; ! -- Find enclosing unit, and verify that its name and those of its ! -- parents match. Scop := Cunit_Entity (Current_Sem_Unit); -- Now see if compilation unit matches ! Up := Elmt.Unit_Name'Last; ! ! -- If we are within a subunit, the name in the pragma has been ! -- parsed as a child unit, but the current compilation unit is in ! -- fact the parent in which the subunit is embedded. We must skip ! -- the first name which is that of the subunit to match the pragma ! -- specification. Body may be that of a package or subprogram. ! ! declare ! Par : Node_Id; ! ! begin ! Par := Parent (E); ! while Present (Par) loop ! if Nkind (Par) = N_Subunit then ! if Chars (Defining_Entity (Proper_Body (Par))) = ! Elmt.Unit_Name (Up) ! then ! Up := Up - 1; ! exit; ! ! else ! goto Continue; ! end if; ! end if; ! ! Par := Parent (Par); ! end loop; ! end; ! ! for J in reverse Elmt.Unit_Name'First .. Up loop if Elmt.Unit_Name (J) /= Chars (Scop) then goto Continue; end if; Scop := Scope (Scop); if Scop /= Standard_Standard and then J = 1 then goto Continue; *************** package body Sem_Elim is *** 311,318 **** goto Continue; end if; ! -- Check for case of given entity is a library level subprogram ! -- and we have the single parameter Eliminate case, a match! if Is_Compilation_Unit (E) and then Is_Subprogram (E) --- 342,400 ---- goto Continue; end if; ! if Present (Elmt.Entity_Node) ! and then Elmt.Entity_Scope /= null ! then ! -- Check that names of enclosing scopes match. Skip blocks and ! -- wrapper package of subprogram instances, which do not appear ! -- in the pragma. ! ! Scop := Scope (E); ! ! for J in reverse Elmt.Entity_Scope'Range loop ! while Ekind (Scop) = E_Block ! or else ! (Ekind (Scop) = E_Package ! and then Is_Wrapper_Package (Scop)) ! loop ! Scop := Scope (Scop); ! end loop; ! ! if Elmt.Entity_Scope (J) /= Chars (Scop) then ! if Ekind (Scop) /= E_Protected_Type ! or else Comes_From_Source (Scop) ! then ! goto Continue; ! ! -- For simple protected declarations, retrieve the source ! -- name of the object, which appeared in the Eliminate ! -- pragma. ! ! else ! declare ! Decl : constant Node_Id := ! Original_Node (Parent (Scop)); ! ! begin ! if Elmt.Entity_Scope (J) /= ! Chars (Defining_Identifier (Decl)) ! then ! if J > 0 then ! null; ! end if; ! goto Continue; ! end if; ! end; ! end if; ! ! end if; ! ! Scop := Scope (Scop); ! end loop; ! end if; ! ! -- If given entity is a library level subprogram and pragma had a ! -- single parameter, a match! if Is_Compilation_Unit (E) and then Is_Subprogram (E) *************** package body Sem_Elim is *** 332,340 **** -- Check for case of subprogram ! elsif Ekind (E) = E_Function ! or else Ekind (E) = E_Procedure ! then -- If Source_Location present, then see if it matches if Elmt.Source_Location /= No_Name then --- 414,421 ---- -- Check for case of subprogram ! elsif Ekind_In (E, E_Function, E_Procedure) then ! -- If Source_Location present, then see if it matches if Elmt.Source_Location /= No_Name then *************** package body Sem_Elim is *** 642,648 **** Enclosing_Subp := Enclosing_Subprogram (Enclosing_Subp); end loop; ! Eliminate_Error_Msg (N, Ultimate_Subp); end if; end Check_For_Eliminated_Subprogram; --- 723,742 ---- Enclosing_Subp := Enclosing_Subprogram (Enclosing_Subp); end loop; ! -- Emit error, unless we are within an instance body and the expander ! -- is disabled, indicating an instance within an enclosing generic. ! -- In an instance, the ultimate alias is an internal entity, so place ! -- the message on the original subprogram. ! ! if In_Instance_Body and then not Expander_Active then ! null; ! ! elsif Comes_From_Source (Ultimate_Subp) then ! Eliminate_Error_Msg (N, Ultimate_Subp); ! ! else ! Eliminate_Error_Msg (N, S); ! end if; end if; end Check_For_Eliminated_Subprogram; *************** package body Sem_Elim is *** 673,679 **** -- Otherwise should not fall through, entry should be in table else ! raise Program_Error; end if; end Eliminate_Error_Msg; --- 767,775 ---- -- Otherwise should not fall through, entry should be in table else ! Error_Msg_NE ! ("subprogram& is called but its alias is eliminated", N, E); ! -- raise Program_Error; end if; end Eliminate_Error_Msg; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_eval.adb gcc-4.6.0/gcc/ada/sem_eval.adb *** gcc-4.5.2/gcc/ada/sem_eval.adb Tue Jan 26 10:30:04 2010 --- gcc-4.6.0/gcc/ada/sem_eval.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Elists; use Elists; *** 31,36 **** --- 31,37 ---- with Errout; use Errout; with Eval_Fat; use Eval_Fat; with Exp_Util; use Exp_Util; + with Freeze; use Freeze; with Lib; use Lib; with Namet; use Namet; with Nmake; use Nmake; *************** package body Sem_Eval is *** 126,131 **** --- 127,136 ---- -- This is the actual cache, with entries consisting of node/value pairs, -- and the impossible value Node_High_Bound used for unset entries. + type Range_Membership is (In_Range, Out_Of_Range, Unknown); + -- Range membership may either be statically known to be in range or out + -- of range, or not statically known. Used for Test_In_Range below. + ----------------------- -- Local Subprograms -- ----------------------- *************** package body Sem_Eval is *** 176,181 **** --- 181,195 ---- -- used for producing the result of the static evaluation of the -- logical operators + function Find_Universal_Operator_Type (N : Node_Id) return Entity_Id; + -- Check whether an arithmetic operation with universal operands which + -- is a rewritten function call with an explicit scope indication is + -- ambiguous: P."+" (1, 2) will be ambiguous if there is more than one + -- visible numeric type declared in P and the context does not impose a + -- type on the result (e.g. in the expression of a type conversion). + -- If ambiguous, emit an error and return Empty, else return the result + -- type of the operator. + procedure Test_Expression_Is_Foldable (N : Node_Id; Op1 : Node_Id; *************** package body Sem_Eval is *** 197,203 **** -- -- If Stat is set True on return, then Is_Static_Expression is also set -- true in node N. There are some cases where this is over-enthusiastic, ! -- e.g. in the two operand case below, for string comaprison, the result -- is not static even though the two operands are static. In such cases, -- the caller must reset the Is_Static_Expression flag in N. --- 211,217 ---- -- -- If Stat is set True on return, then Is_Static_Expression is also set -- true in node N. There are some cases where this is over-enthusiastic, ! -- e.g. in the two operand case below, for string comparison, the result -- is not static even though the two operands are static. In such cases, -- the caller must reset the Is_Static_Expression flag in N. *************** package body Sem_Eval is *** 210,215 **** --- 224,241 ---- -- Same processing, except applies to an expression N with two operands -- Op1 and Op2. + function Test_In_Range + (N : Node_Id; + Typ : Entity_Id; + Assume_Valid : Boolean; + Fixed_Int : Boolean; + Int_Real : Boolean) return Range_Membership; + -- Common processing for Is_In_Range and Is_Out_Of_Range: + -- Returns In_Range or Out_Of_Range if it can be guaranteed at compile time + -- that expression N is known to be in or out of range of the subtype Typ. + -- If not compile time known, Unknown is returned. + -- See documentation of Is_In_Range for complete description of parameters. + procedure To_Bits (U : Uint; B : out Bits); -- Converts a Uint value to a bit string of length B'Length *************** package body Sem_Eval is *** 616,624 **** --- 642,658 ---- -- types, since we may have two NaN values and they should never -- compare equal. + -- If the entity is a discriminant, the two expressions may be bounds + -- of components of objects of the same discriminated type. The + -- values of the discriminants are not static, and therefore the + -- result is unknown. + + -- It would be better to comment individual branches of this test ??? + if Nkind_In (Lf, N_Identifier, N_Expanded_Name) and then Nkind_In (Rf, N_Identifier, N_Expanded_Name) and then Entity (Lf) = Entity (Rf) + and then Ekind (Entity (Lf)) /= E_Discriminant and then Present (Entity (Lf)) and then not Is_Floating_Point_Type (Etype (L)) and then not Is_Volatile_Reference (L) *************** package body Sem_Eval is *** 1430,1435 **** --- 1464,1470 ---- Right : constant Node_Id := Right_Opnd (N); Ltype : constant Entity_Id := Etype (Left); Rtype : constant Entity_Id := Etype (Right); + Otype : Entity_Id := Empty; Stat : Boolean; Fold : Boolean; *************** package body Sem_Eval is *** 1442,1447 **** --- 1477,1489 ---- return; end if; + if Is_Universal_Numeric_Type (Etype (Left)) + and then + Is_Universal_Numeric_Type (Etype (Right)) + then + Otype := Find_Universal_Operator_Type (N); + end if; + -- Fold for cases where both operands are of integer type if Is_Integer_Type (Ltype) and then Is_Integer_Type (Rtype) then *************** package body Sem_Eval is *** 1548,1556 **** Fold_Uint (N, Result, Stat); end; ! -- Cases where at least one operand is a real. We handle the cases ! -- of both reals, or mixed/real integer cases (the latter happen ! -- only for divide and multiply, and the result is always real). elsif Is_Real_Type (Ltype) or else Is_Real_Type (Rtype) then declare --- 1590,1598 ---- Fold_Uint (N, Result, Stat); end; ! -- Cases where at least one operand is a real. We handle the cases of ! -- both reals, or mixed/real integer cases (the latter happen only for ! -- divide and multiply, and the result is always real). elsif Is_Real_Type (Ltype) or else Is_Real_Type (Rtype) then declare *************** package body Sem_Eval is *** 1593,1598 **** --- 1635,1648 ---- Fold_Ureal (N, Result, Stat); end; end if; + + -- If the operator was resolved to a specific type, make sure that type + -- is frozen even if the expression is folded into a literal (which has + -- a universal type). + + if Present (Otype) then + Freeze_Before (N, Otype); + end if; end Eval_Arithmetic_Op; ---------------------------- *************** package body Sem_Eval is *** 1632,1641 **** and then Present (Alias (Entity (Name (N)))) and then Is_Enumeration_Type (Base_Type (Typ)) then ! Lit := Alias (Entity (Name (N))); ! while Present (Alias (Lit)) loop ! Lit := Alias (Lit); ! end loop; if Ekind (Lit) = E_Enumeration_Literal then if Base_Type (Etype (Lit)) /= Base_Type (Typ) then --- 1682,1688 ---- and then Present (Alias (Entity (Name (N)))) and then Is_Enumeration_Type (Base_Type (Typ)) then ! Lit := Ultimate_Alias (Entity (Name (N))); if Ekind (Lit) = E_Enumeration_Literal then if Base_Type (Etype (Lit)) /= Base_Type (Typ) then *************** package body Sem_Eval is *** 1650,1655 **** --- 1697,1723 ---- end if; end Eval_Call; + -------------------------- + -- Eval_Case_Expression -- + -------------------------- + + -- Right now we do not attempt folding of any case expressions, and the + -- language does not require it, so the only required processing is to + -- do the check for all expressions appearing in the case expression. + + procedure Eval_Case_Expression (N : Node_Id) is + Alt : Node_Id; + + begin + Check_Non_Static_Context (Expression (N)); + + Alt := First (Alternatives (N)); + while Present (Alt) loop + Check_Non_Static_Context (Expression (Alt)); + Next (Alt); + end loop; + end Eval_Case_Expression; + ------------------------ -- Eval_Concatenation -- ------------------------ *************** package body Sem_Eval is *** 1767,1784 **** -- Eval_Conditional_Expression -- --------------------------------- ! -- This GNAT internal construct can never be statically folded, so the ! -- only required processing is to do the check for non-static context ! -- for the two expression operands. procedure Eval_Conditional_Expression (N : Node_Id) is ! Condition : constant Node_Id := First (Expressions (N)); ! Then_Expr : constant Node_Id := Next (Condition); ! Else_Expr : constant Node_Id := Next (Then_Expr); begin ! Check_Non_Static_Context (Then_Expr); ! Check_Non_Static_Context (Else_Expr); end Eval_Conditional_Expression; ---------------------- --- 1835,1913 ---- -- Eval_Conditional_Expression -- --------------------------------- ! -- We can fold to a static expression if the condition and both constituent ! -- expressions are static. Otherwise, the only required processing is to do ! -- the check for non-static context for the then and else expressions. procedure Eval_Conditional_Expression (N : Node_Id) is ! Condition : constant Node_Id := First (Expressions (N)); ! Then_Expr : constant Node_Id := Next (Condition); ! Else_Expr : constant Node_Id := Next (Then_Expr); ! Result : Node_Id; ! Non_Result : Node_Id; ! ! Rstat : constant Boolean := ! Is_Static_Expression (Condition) ! and then ! Is_Static_Expression (Then_Expr) ! and then ! Is_Static_Expression (Else_Expr); begin ! -- If any operand is Any_Type, just propagate to result and do not try ! -- to fold, this prevents cascaded errors. ! ! if Etype (Condition) = Any_Type or else ! Etype (Then_Expr) = Any_Type or else ! Etype (Else_Expr) = Any_Type ! then ! Set_Etype (N, Any_Type); ! Set_Is_Static_Expression (N, False); ! return; ! ! -- Static case where we can fold. Note that we don't try to fold cases ! -- where the condition is known at compile time, but the result is ! -- non-static. This avoids possible cases of infinite recursion where ! -- the expander puts in a redundant test and we remove it. Instead we ! -- deal with these cases in the expander. ! ! elsif Rstat then ! ! -- Select result operand ! ! if Is_True (Expr_Value (Condition)) then ! Result := Then_Expr; ! Non_Result := Else_Expr; ! else ! Result := Else_Expr; ! Non_Result := Then_Expr; ! end if; ! ! -- Note that it does not matter if the non-result operand raises a ! -- Constraint_Error, but if the result raises constraint error then ! -- we replace the node with a raise constraint error. This will ! -- properly propagate Raises_Constraint_Error since this flag is ! -- set in Result. ! ! if Raises_Constraint_Error (Result) then ! Rewrite_In_Raise_CE (N, Result); ! Check_Non_Static_Context (Non_Result); ! ! -- Otherwise the result operand replaces the original node ! ! else ! Rewrite (N, Relocate_Node (Result)); ! end if; ! ! -- Case of condition not known at compile time ! ! else ! Check_Non_Static_Context (Condition); ! Check_Non_Static_Context (Then_Expr); ! Check_Non_Static_Context (Else_Expr); ! end if; ! ! Set_Is_Static_Expression (N, Rstat); end Eval_Conditional_Expression; ---------------------- *************** package body Sem_Eval is *** 2069,2075 **** Right_Int : constant Uint := Expr_Value (Right); begin ! if Is_Modular_Integer_Type (Etype (N)) then declare Left_Bits : Bits (0 .. UI_To_Int (Esize (Etype (N))) - 1); Right_Bits : Bits (0 .. UI_To_Int (Esize (Etype (N))) - 1); --- 2198,2208 ---- Right_Int : constant Uint := Expr_Value (Right); begin ! -- VMS includes bitwise operations on signed types ! ! if Is_Modular_Integer_Type (Etype (N)) ! or else Is_VMS_Operator (Entity (N)) ! then declare Left_Bits : Bits (0 .. UI_To_Int (Esize (Etype (N))) - 1); Right_Bits : Bits (0 .. UI_To_Int (Esize (Etype (N))) - 1); *************** package body Sem_Eval is *** 2144,2156 **** -- Ignore if error in either operand, except to make sure that Any_Type -- is properly propagated to avoid junk cascaded errors. ! if Etype (Left) = Any_Type ! or else Etype (Right) = Any_Type ! then Set_Etype (N, Any_Type); return; end if; -- Case of right operand is a subtype name if Is_Entity_Name (Right) then --- 2277,2296 ---- -- Ignore if error in either operand, except to make sure that Any_Type -- is properly propagated to avoid junk cascaded errors. ! if Etype (Left) = Any_Type or else Etype (Right) = Any_Type then Set_Etype (N, Any_Type); return; end if; + -- Ignore if types involved have predicates + + if Present (Predicate_Function (Etype (Left))) + or else + Present (Predicate_Function (Etype (Right))) + then + return; + end if; + -- Case of right operand is a subtype name if Is_Entity_Name (Right) then *************** package body Sem_Eval is *** 2219,2225 **** declare Typlen : constant Uint := String_Type_Len (Etype (Right)); Strlen : constant Uint := ! UI_From_Int (String_Length (Strval (Get_String_Val (Left)))); begin Result := (Typlen = Strlen); end; --- 2359,2366 ---- declare Typlen : constant Uint := String_Type_Len (Etype (Right)); Strlen : constant Uint := ! UI_From_Int ! (String_Length (Strval (Get_String_Val (Left)))); begin Result := (Typlen = Strlen); end; *************** package body Sem_Eval is *** 2252,2257 **** --- 2393,2399 ---- end if; Fold_Uint (N, Test (Result), True); + Warn_On_Known_Condition (N); end Eval_Membership_Op; *************** package body Sem_Eval is *** 2311,2318 **** Result : Uint; begin ! -- Exponentiation of an integer raises the exception ! -- Constraint_Error for a negative exponent (RM 4.5.6) if Right_Int < 0 then Apply_Compile_Time_Constraint_Error --- 2453,2460 ---- Result : Uint; begin ! -- Exponentiation of an integer raises Constraint_Error for a ! -- negative exponent (RM 4.5.6). if Right_Int < 0 then Apply_Compile_Time_Constraint_Error *************** package body Sem_Eval is *** 2427,2435 **** begin -- Can only fold if target is string or scalar and subtype is static. ! -- Also, do not fold if our parent is an allocator (this is because ! -- the qualified expression is really part of the syntactic structure ! -- of an allocator, and we do not want to end up with something that -- corresponds to "new 1" where the 1 is the result of folding a -- qualified expression). --- 2569,2577 ---- begin -- Can only fold if target is string or scalar and subtype is static. ! -- Also, do not fold if our parent is an allocator (this is because the ! -- qualified expression is really part of the syntactic structure of an ! -- allocator, and we do not want to end up with something that -- corresponds to "new 1" where the 1 is the result of folding a -- qualified expression). *************** package body Sem_Eval is *** 2529,2542 **** -- Eval_Relational_Op -- ------------------------ ! -- Relational operations are static functions, so the result is static ! -- if both operands are static (RM 4.9(7), 4.9(20)), except that for ! -- strings, the result is never static, even if the operands are. procedure Eval_Relational_Op (N : Node_Id) is Left : constant Node_Id := Left_Opnd (N); Right : constant Node_Id := Right_Opnd (N); Typ : constant Entity_Id := Etype (Left); Result : Boolean; Stat : Boolean; Fold : Boolean; --- 2671,2685 ---- -- Eval_Relational_Op -- ------------------------ ! -- Relational operations are static functions, so the result is static if ! -- both operands are static (RM 4.9(7), 4.9(20)), except that for strings, ! -- the result is never static, even if the operands are. procedure Eval_Relational_Op (N : Node_Id) is Left : constant Node_Id := Left_Opnd (N); Right : constant Node_Id := Right_Opnd (N); Typ : constant Entity_Id := Etype (Left); + Otype : Entity_Id := Empty; Result : Boolean; Stat : Boolean; Fold : Boolean; *************** package body Sem_Eval is *** 2615,2621 **** -- 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 --- 2758,2764 ---- -- 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 *************** package body Sem_Eval is *** 2645,2661 **** 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; --- 2788,2824 ---- 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)); + -- If the bound is a constant created to remove side + -- effects, recover original expression to see if it has + -- one of the recognizable forms. + + elsif Nkind (Expr) = N_Identifier + and then not Comes_From_Source (Entity (Expr)) + and then Ekind (Entity (Expr)) = E_Constant + and then + Nkind (Parent (Entity (Expr))) = N_Object_Declaration + then + Exp := Expression (Parent (Entity (Expr))); + Decompose_Expr (Exp, Ent, Kind, Cons); + + -- If original expression includes an entity, create a + -- reference to it for use below. + + if Present (Ent) then + Exp := New_Occurrence_Of (Ent, Sloc (Ent)); + end if; + else ! Exp := Expr; Cons := Uint_0; end if; *************** package body Sem_Eval is *** 2664,2671 **** --- 2827,2836 ---- 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; *************** package body Sem_Eval is *** 2746,2751 **** --- 2911,2927 ---- Set_Is_Static_Expression (N, False); end if; + -- For operators on universal numeric types called as functions with + -- an explicit scope, determine appropriate specific numeric type, and + -- diagnose possible ambiguity. + + if Is_Universal_Numeric_Type (Etype (Left)) + and then + Is_Universal_Numeric_Type (Etype (Right)) + then + Otype := Find_Universal_Operator_Type (N); + end if; + -- For static real type expressions, we cannot use Compile_Time_Compare -- since it worries about run-time results which are not exact. *************** package body Sem_Eval is *** 2845,2850 **** --- 3021,3033 ---- Fold_Uint (N, Test (Result), Stat); end if; + -- For the case of a folded relational operator on a specific numeric + -- type, freeze operand type now. + + if Present (Otype) then + Freeze_Before (N, Otype); + end if; + Warn_On_Known_Condition (N); end Eval_Relational_Op; *************** package body Sem_Eval is *** 2852,2860 **** -- Eval_Shift -- ---------------- ! -- Shift operations are intrinsic operations that can never be static, ! -- so the only processing required is to perform the required check for ! -- a non static context for the two operands. -- Actually we could do some compile time evaluation here some time ??? --- 3035,3043 ---- -- Eval_Shift -- ---------------- ! -- Shift operations are intrinsic operations that can never be static, so ! -- the only processing required is to perform the required check for a non ! -- static context for the two operands. -- Actually we could do some compile time evaluation here some time ??? *************** package body Sem_Eval is *** 2868,2891 **** -- Eval_Short_Circuit -- ------------------------ ! -- A short circuit operation is potentially static if both operands ! -- are potentially static (RM 4.9 (13)) procedure Eval_Short_Circuit (N : Node_Id) is Kind : constant Node_Kind := Nkind (N); Left : constant Node_Id := Left_Opnd (N); Right : constant Node_Id := Right_Opnd (N); Left_Int : Uint; ! Rstat : constant Boolean := ! Is_Static_Expression (Left) ! and then Is_Static_Expression (Right); begin -- Short circuit operations are never static in Ada 83 ! if Ada_Version = Ada_83 ! and then Comes_From_Source (N) ! then Check_Non_Static_Context (Left); Check_Non_Static_Context (Right); return; --- 3051,3074 ---- -- Eval_Short_Circuit -- ------------------------ ! -- A short circuit operation is potentially static if both operands are ! -- potentially static (RM 4.9 (13)). procedure Eval_Short_Circuit (N : Node_Id) is Kind : constant Node_Kind := Nkind (N); Left : constant Node_Id := Left_Opnd (N); Right : constant Node_Id := Right_Opnd (N); Left_Int : Uint; ! ! Rstat : constant Boolean := ! Is_Static_Expression (Left) ! and then ! Is_Static_Expression (Right); begin -- Short circuit operations are never static in Ada 83 ! if Ada_Version = Ada_83 and then Comes_From_Source (N) then Check_Non_Static_Context (Left); Check_Non_Static_Context (Right); return; *************** package body Sem_Eval is *** 2896,2903 **** -- are a special case, they can still be foldable, even if the right -- operand raises constraint error. ! -- If either operand is Any_Type, just propagate to result and ! -- do not try to fold, this prevents cascaded errors. if Etype (Left) = Any_Type or else Etype (Right) = Any_Type then Set_Etype (N, Any_Type); --- 3079,3086 ---- -- are a special case, they can still be foldable, even if the right -- operand raises constraint error. ! -- If either operand is Any_Type, just propagate to result and do not ! -- try to fold, this prevents cascaded errors. if Etype (Left) = Any_Type or else Etype (Right) = Any_Type then Set_Etype (N, Any_Type); *************** package body Sem_Eval is *** 2942,2948 **** if (Kind = N_And_Then and then Is_False (Left_Int)) or else ! (Kind = N_Or_Else and then Is_True (Left_Int)) then Fold_Uint (N, Left_Int, Rstat); return; --- 3125,3131 ---- if (Kind = N_And_Then and then Is_False (Left_Int)) or else ! (Kind = N_Or_Else and then Is_True (Left_Int)) then Fold_Uint (N, Left_Int, Rstat); return; *************** package body Sem_Eval is *** 2970,2977 **** -- Eval_Slice -- ---------------- ! -- Slices can never be static, so the only processing required is to ! -- check for non-static context if an explicit range is given. procedure Eval_Slice (N : Node_Id) is Drange : constant Node_Id := Discrete_Range (N); --- 3153,3160 ---- -- Eval_Slice -- ---------------- ! -- Slices can never be static, so the only processing required is to check ! -- for non-static context if an explicit range is given. procedure Eval_Slice (N : Node_Id) is Drange : constant Node_Id := Discrete_Range (N); *************** package body Sem_Eval is *** 2981,2987 **** Check_Non_Static_Context (High_Bound (Drange)); end if; ! -- A slice of the form A (subtype), when the subtype is the index of -- the type of A, is redundant, the slice can be replaced with A, and -- this is worth a warning. --- 3164,3170 ---- Check_Non_Static_Context (High_Bound (Drange)); end if; ! -- A slice of the form A (subtype), when the subtype is the index of -- the type of A, is redundant, the slice can be replaced with A, and -- this is worth a warning. *************** package body Sem_Eval is *** 3002,3008 **** Error_Msg_N ("redundant slice denotes whole array?", N); end if; ! -- The following might be a useful optimization ???? -- Rewrite (N, New_Occurrence_Of (E, Sloc (N))); end if; --- 3185,3191 ---- Error_Msg_N ("redundant slice denotes whole array?", N); end if; ! -- The following might be a useful optimization???? -- Rewrite (N, New_Occurrence_Of (E, Sloc (N))); end if; *************** package body Sem_Eval is *** 3024,3030 **** begin -- Nothing to do if error type (handles cases like default expressions ! -- or generics where we have not yet fully resolved the type) if Bas = Any_Type or else Bas = Any_String then return; --- 3207,3213 ---- begin -- Nothing to do if error type (handles cases like default expressions ! -- or generics where we have not yet fully resolved the type). if Bas = Any_Type or else Bas = Any_String then return; *************** package body Sem_Eval is *** 3042,3048 **** end if; -- Here if Etype of string literal is normal Etype (not yet possible, ! -- but may be possible in future!) elsif not Is_OK_Static_Expression (Type_Low_Bound (Etype (First_Index (Typ)))) --- 3225,3231 ---- end if; -- Here if Etype of string literal is normal Etype (not yet possible, ! -- but may be possible in future). elsif not Is_OK_Static_Expression (Type_Low_Bound (Etype (First_Index (Typ)))) *************** package body Sem_Eval is *** 3058,3069 **** return; end if; ! -- Test for illegal Ada 95 cases. A string literal is illegal in ! -- Ada 95 if its bounds are outside the index base type and this ! -- index type is static. This can happen in only two ways. Either ! -- the string literal is too long, or it is null, and the lower ! -- bound is type'First. In either case it is the upper bound that ! -- is out of range of the index type. if Ada_Version >= Ada_95 then if Root_Type (Bas) = Standard_String --- 3241,3252 ---- return; end if; ! -- Test for illegal Ada 95 cases. A string literal is illegal in Ada 95 ! -- if its bounds are outside the index base type and this index type is ! -- static. This can happen in only two ways. Either the string literal ! -- is too long, or it is null, and the lower bound is type'First. In ! -- either case it is the upper bound that is out of range of the index ! -- type. if Ada_Version >= Ada_95 then if Root_Type (Bas) = Standard_String *************** package body Sem_Eval is *** 3109,3115 **** -- A type conversion is potentially static if its subtype mark is for a -- static scalar subtype, and its operand expression is potentially static ! -- (RM 4.9 (10)) procedure Eval_Type_Conversion (N : Node_Id) is Operand : constant Node_Id := Expression (N); --- 3292,3298 ---- -- A type conversion is potentially static if its subtype mark is for a -- static scalar subtype, and its operand expression is potentially static ! -- (RM 4.9(10)). procedure Eval_Type_Conversion (N : Node_Id) is Operand : constant Node_Id := Expression (N); *************** package body Sem_Eval is *** 3120,3128 **** Fold : Boolean; function To_Be_Treated_As_Integer (T : Entity_Id) return Boolean; ! -- Returns true if type T is an integer type, or if it is a ! -- fixed-point type to be treated as an integer (i.e. the flag ! -- Conversion_OK is set on the conversion node). function To_Be_Treated_As_Real (T : Entity_Id) return Boolean; -- Returns true if type T is a floating-point type, or if it is a --- 3303,3311 ---- Fold : Boolean; function To_Be_Treated_As_Integer (T : Entity_Id) return Boolean; ! -- Returns true if type T is an integer type, or if it is a fixed-point ! -- type to be treated as an integer (i.e. the flag Conversion_OK is set ! -- on the conversion node). function To_Be_Treated_As_Real (T : Entity_Id) return Boolean; -- Returns true if type T is a floating-point type, or if it is a *************** package body Sem_Eval is *** 3256,3265 **** ------------------- -- Predefined unary operators are static functions (RM 4.9(20)) and thus ! -- are potentially static if the operand is potentially static (RM 4.9(7)) procedure Eval_Unary_Op (N : Node_Id) is Right : constant Node_Id := Right_Opnd (N); Stat : Boolean; Fold : Boolean; --- 3439,3449 ---- ------------------- -- Predefined unary operators are static functions (RM 4.9(20)) and thus ! -- are potentially static if the operand is potentially static (RM 4.9(7)). procedure Eval_Unary_Op (N : Node_Id) is Right : constant Node_Id := Right_Opnd (N); + Otype : Entity_Id := Empty; Stat : Boolean; Fold : Boolean; *************** package body Sem_Eval is *** 3272,3277 **** --- 3456,3468 ---- return; end if; + if Etype (Right) = Universal_Integer + or else + Etype (Right) = Universal_Real + then + Otype := Find_Universal_Operator_Type (N); + end if; + -- Fold for integer case if Is_Integer_Type (Etype (N)) then *************** package body Sem_Eval is *** 3327,3332 **** --- 3518,3531 ---- Fold_Ureal (N, Result, Stat); end; end if; + + -- If the operator was resolved to a specific type, make sure that type + -- is frozen even if the expression is folded into a literal (which has + -- a universal type). + + if Present (Otype) then + Freeze_Before (N, Otype); + end if; end Eval_Unary_Op; ------------------------------- *************** package body Sem_Eval is *** 3353,3360 **** if Is_Entity_Name (N) then Ent := Entity (N); ! -- An enumeration literal that was either in the source or ! -- created as a result of static evaluation. if Ekind (Ent) = E_Enumeration_Literal then return Enumeration_Rep (Ent); --- 3552,3559 ---- if Is_Entity_Name (N) then Ent := Entity (N); ! -- An enumeration literal that was either in the source or created ! -- as a result of static evaluation. if Ekind (Ent) = E_Enumeration_Literal then return Enumeration_Rep (Ent); *************** package body Sem_Eval is *** 3366,3373 **** return Expr_Rep_Value (Constant_Value (Ent)); end if; ! -- An integer literal that was either in the source or created ! -- as a result of static evaluation. elsif Kind = N_Integer_Literal then return Intval (N); --- 3565,3572 ---- return Expr_Rep_Value (Constant_Value (Ent)); end if; ! -- An integer literal that was either in the source or created as a ! -- result of static evaluation. elsif Kind = N_Integer_Literal then return Intval (N); *************** package body Sem_Eval is *** 3394,3404 **** pragma Assert (Kind = N_Character_Literal); Ent := Entity (N); ! -- Since Character literals of type Standard.Character don't ! -- have any defining character literals built for them, they ! -- do not have their Entity set, so just use their Char ! -- code. Otherwise for user-defined character literals use ! -- their Pos value as usual which is the same as the Rep value. if No (Ent) then return Char_Literal_Value (N); --- 3593,3603 ---- pragma Assert (Kind = N_Character_Literal); Ent := Entity (N); ! -- Since Character literals of type Standard.Character don't have any ! -- defining character literals built for them, they do not have their ! -- Entity set, so just use their Char code. Otherwise for user- ! -- defined character literals use their Pos value as usual which is ! -- the same as the Rep value. if No (Ent) then return Char_Literal_Value (N); *************** package body Sem_Eval is *** 3432,3439 **** if Is_Entity_Name (N) then Ent := Entity (N); ! -- An enumeration literal that was either in the source or ! -- created as a result of static evaluation. if Ekind (Ent) = E_Enumeration_Literal then Val := Enumeration_Pos (Ent); --- 3631,3638 ---- if Is_Entity_Name (N) then Ent := Entity (N); ! -- An enumeration literal that was either in the source or created as ! -- a result of static evaluation. if Ekind (Ent) = E_Enumeration_Literal then Val := Enumeration_Pos (Ent); *************** package body Sem_Eval is *** 3445,3452 **** Val := Expr_Value (Constant_Value (Ent)); end if; ! -- An integer literal that was either in the source or created ! -- as a result of static evaluation. elsif Kind = N_Integer_Literal then Val := Intval (N); --- 3644,3651 ---- Val := Expr_Value (Constant_Value (Ent)); end if; ! -- An integer literal that was either in the source or created as a ! -- result of static evaluation. elsif Kind = N_Integer_Literal then Val := Intval (N); *************** package body Sem_Eval is *** 3558,3565 **** return Ureal_0; end if; ! -- 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; end Expr_Value_R; --- 3757,3764 ---- return Ureal_0; end if; ! -- 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; end Expr_Value_R; *************** package body Sem_Eval is *** 3578,3583 **** --- 3777,3920 ---- end if; end Expr_Value_S; + ---------------------------------- + -- Find_Universal_Operator_Type -- + ---------------------------------- + + function Find_Universal_Operator_Type (N : Node_Id) return Entity_Id is + PN : constant Node_Id := Parent (N); + Call : constant Node_Id := Original_Node (N); + Is_Int : constant Boolean := Is_Integer_Type (Etype (N)); + + Is_Fix : constant Boolean := + Nkind (N) in N_Binary_Op + and then Nkind (Right_Opnd (N)) /= Nkind (Left_Opnd (N)); + -- A mixed-mode operation in this context indicates the presence of + -- fixed-point type in the designated package. + + Is_Relational : constant Boolean := Etype (N) = Standard_Boolean; + -- Case where N is a relational (or membership) operator (else it is an + -- arithmetic one). + + In_Membership : constant Boolean := + Nkind (PN) in N_Membership_Test + and then + Nkind (Right_Opnd (PN)) = N_Range + and then + Is_Universal_Numeric_Type (Etype (Left_Opnd (PN))) + and then + Is_Universal_Numeric_Type + (Etype (Low_Bound (Right_Opnd (PN)))) + and then + Is_Universal_Numeric_Type + (Etype (High_Bound (Right_Opnd (PN)))); + -- Case where N is part of a membership test with a universal range + + E : Entity_Id; + Pack : Entity_Id; + Typ1 : Entity_Id := Empty; + Priv_E : Entity_Id; + + function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean; + -- Check whether one operand is a mixed-mode operation that requires the + -- presence of a fixed-point type. Given that all operands are universal + -- and have been constant-folded, retrieve the original function call. + + --------------------------- + -- Is_Mixed_Mode_Operand -- + --------------------------- + + function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean is + Onod : constant Node_Id := Original_Node (Op); + begin + return Nkind (Onod) = N_Function_Call + and then Present (Next_Actual (First_Actual (Onod))) + and then Etype (First_Actual (Onod)) /= + Etype (Next_Actual (First_Actual (Onod))); + end Is_Mixed_Mode_Operand; + + -- Start of processing for Find_Universal_Operator_Type + + begin + if Nkind (Call) /= N_Function_Call + or else Nkind (Name (Call)) /= N_Expanded_Name + then + return Empty; + + -- There are several cases where the context does not imply the type of + -- the operands: + -- - the universal expression appears in a type conversion; + -- - the expression is a relational operator applied to universal + -- operands; + -- - the expression is a membership test with a universal operand + -- and a range with universal bounds. + + elsif Nkind (Parent (N)) = N_Type_Conversion + or else Is_Relational + or else In_Membership + then + Pack := Entity (Prefix (Name (Call))); + + -- If the prefix is a package declared elsewhere, iterate over its + -- visible entities, otherwise iterate over all declarations in the + -- designated scope. + + if Ekind (Pack) = E_Package + and then not In_Open_Scopes (Pack) + then + Priv_E := First_Private_Entity (Pack); + else + Priv_E := Empty; + end if; + + Typ1 := Empty; + E := First_Entity (Pack); + while Present (E) and then E /= Priv_E loop + if Is_Numeric_Type (E) + and then Nkind (Parent (E)) /= N_Subtype_Declaration + and then Comes_From_Source (E) + and then Is_Integer_Type (E) = Is_Int + and then + (Nkind (N) in N_Unary_Op + or else Is_Relational + or else Is_Fixed_Point_Type (E) = Is_Fix) + then + if No (Typ1) then + Typ1 := E; + + -- Before emitting an error, check for the presence of a + -- mixed-mode operation that specifies a fixed point type. + + elsif Is_Relational + and then + (Is_Mixed_Mode_Operand (Left_Opnd (N)) + or else Is_Mixed_Mode_Operand (Right_Opnd (N))) + and then Is_Fixed_Point_Type (E) /= Is_Fixed_Point_Type (Typ1) + + then + if Is_Fixed_Point_Type (E) then + Typ1 := E; + end if; + + else + -- More than one type of the proper class declared in P + + Error_Msg_N ("ambiguous operation", N); + Error_Msg_Sloc := Sloc (Typ1); + Error_Msg_N ("\possible interpretation (inherited)#", N); + Error_Msg_Sloc := Sloc (E); + Error_Msg_N ("\possible interpretation (inherited)#", N); + return Empty; + end if; + end if; + + Next_Entity (E); + end loop; + end if; + + return Typ1; + end Find_Universal_Operator_Type; + -------------------------- -- Flag_Non_Static_Expr -- -------------------------- *************** package body Sem_Eval is *** 3623,3630 **** Ent : Entity_Id; begin ! -- If we are folding a named number, retain the entity in the ! -- literal, for ASIS use. if Is_Entity_Name (N) and then Ekind (Entity (N)) = E_Named_Integer --- 3960,3967 ---- Ent : Entity_Id; begin ! -- If we are folding a named number, retain the entity in the literal, ! -- for ASIS use. if Is_Entity_Name (N) and then Ekind (Entity (N)) = E_Named_Integer *************** package body Sem_Eval is *** 3677,3684 **** Ent : Entity_Id; begin ! -- If we are folding a named number, retain the entity in the ! -- literal, for ASIS use. if Is_Entity_Name (N) and then Ekind (Entity (N)) = E_Named_Real --- 4014,4021 ---- Ent : Entity_Id; begin ! -- If we are folding a named number, retain the entity in the literal, ! -- for ASIS use. if Is_Entity_Name (N) and then Ekind (Entity (N)) = E_Named_Real *************** package body Sem_Eval is *** 3872,3949 **** Fixed_Int : Boolean := False; Int_Real : Boolean := False) return Boolean is - Val : Uint; - Valr : Ureal; - - pragma Warnings (Off, Assume_Valid); - -- For now Assume_Valid is unreferenced since the current implementation - -- always returns False if N is not a compile time known value, but we - -- keep the parameter to allow for future enhancements in which we try - -- to get the information in the variable case as well. - begin ! -- Universal types have no range limits, so always in range ! ! if Typ = Universal_Integer or else Typ = Universal_Real then ! return True; ! ! -- Never in range if not scalar type. Don't know if this can ! -- actually happen, but our spec allows it, so we must check! ! ! elsif not Is_Scalar_Type (Typ) then ! return False; ! ! -- Never in range unless we have a compile time known value ! ! elsif not Compile_Time_Known_Value (N) then ! return False; ! ! -- General processing with a known compile time value ! ! else ! declare ! Lo : Node_Id; ! Hi : Node_Id; ! LB_Known : Boolean; ! UB_Known : Boolean; ! ! begin ! Lo := Type_Low_Bound (Typ); ! Hi := Type_High_Bound (Typ); ! ! LB_Known := Compile_Time_Known_Value (Lo); ! UB_Known := Compile_Time_Known_Value (Hi); ! ! -- Fixed point types should be considered as such only in ! -- flag Fixed_Int is set to False. ! ! if Is_Floating_Point_Type (Typ) ! or else (Is_Fixed_Point_Type (Typ) and then not Fixed_Int) ! or else Int_Real ! then ! Valr := Expr_Value_R (N); ! ! if LB_Known and then Valr >= Expr_Value_R (Lo) ! and then UB_Known and then Valr <= Expr_Value_R (Hi) ! then ! return True; ! else ! return False; ! end if; ! ! else ! Val := Expr_Value (N); ! ! if LB_Known and then Val >= Expr_Value (Lo) ! and then UB_Known and then Val <= Expr_Value (Hi) ! then ! return True; ! else ! return False; ! end if; ! end if; ! end; ! end if; end Is_In_Range; ------------------- --- 4209,4217 ---- Fixed_Int : Boolean := False; Int_Real : Boolean := False) return Boolean is begin ! return Test_In_Range (N, Typ, Assume_Valid, Fixed_Int, Int_Real) ! = In_Range; end Is_In_Range; ------------------- *************** package body Sem_Eval is *** 3998,4005 **** -- Is_OK_Static_Subtype -- -------------------------- ! -- Determines if Typ is a static subtype as defined in (RM 4.9(26)) ! -- where neither bound raises constraint error when evaluated. function Is_OK_Static_Subtype (Typ : Entity_Id) return Boolean is Base_T : constant Entity_Id := Base_Type (Typ); --- 4266,4273 ---- -- Is_OK_Static_Subtype -- -------------------------- ! -- Determines if Typ is a static subtype as defined in (RM 4.9(26)) where ! -- neither bound raises constraint error when evaluated. function Is_OK_Static_Subtype (Typ : Entity_Id) return Boolean is Base_T : constant Entity_Id := Base_Type (Typ); *************** package body Sem_Eval is *** 4041,4048 **** return True; else ! -- Scalar_Range (Typ) might be an N_Subtype_Indication, so ! -- use Get_Type_Low,High_Bound. return Is_OK_Static_Subtype (Anc_Subt) and then Is_OK_Static_Expression (Type_Low_Bound (Typ)) --- 4309,4316 ---- return True; else ! -- Scalar_Range (Typ) might be an N_Subtype_Indication, so use ! -- Get_Type_{Low,High}_Bound. return Is_OK_Static_Subtype (Anc_Subt) and then Is_OK_Static_Expression (Type_Low_Bound (Typ)) *************** package body Sem_Eval is *** 4067,4156 **** Fixed_Int : Boolean := False; Int_Real : Boolean := False) return Boolean is - Val : Uint; - Valr : Ureal; - - pragma Warnings (Off, Assume_Valid); - -- For now Assume_Valid is unreferenced since the current implementation - -- always returns False if N is not a compile time known value, but we - -- keep the parameter to allow for future enhancements in which we try - -- to get the information in the variable case as well. - begin ! -- Universal types have no range limits, so always in range ! ! if Typ = Universal_Integer or else Typ = Universal_Real then ! return False; ! ! -- Never out of range if not scalar type. Don't know if this can ! -- actually happen, but our spec allows it, so we must check! ! ! elsif not Is_Scalar_Type (Typ) then ! return False; ! ! -- Never out of range if this is a generic type, since the bounds ! -- of generic types are junk. Note that if we only checked for ! -- static expressions (instead of compile time known values) below, ! -- we would not need this check, because values of a generic type ! -- can never be static, but they can be known at compile time. ! ! elsif Is_Generic_Type (Typ) then ! return False; ! ! -- Never out of range unless we have a compile time known value ! ! elsif not Compile_Time_Known_Value (N) then ! return False; ! ! else ! declare ! Lo : Node_Id; ! Hi : Node_Id; ! LB_Known : Boolean; ! UB_Known : Boolean; ! ! begin ! Lo := Type_Low_Bound (Typ); ! Hi := Type_High_Bound (Typ); ! ! LB_Known := Compile_Time_Known_Value (Lo); ! UB_Known := Compile_Time_Known_Value (Hi); ! ! -- Real types (note that fixed-point types are not treated ! -- as being of a real type if the flag Fixed_Int is set, ! -- since in that case they are regarded as integer types). ! ! if Is_Floating_Point_Type (Typ) ! or else (Is_Fixed_Point_Type (Typ) and then not Fixed_Int) ! or else Int_Real ! then ! Valr := Expr_Value_R (N); ! ! if LB_Known and then Valr < Expr_Value_R (Lo) then ! return True; ! ! elsif UB_Known and then Expr_Value_R (Hi) < Valr then ! return True; ! ! else ! return False; ! end if; ! ! else ! Val := Expr_Value (N); ! ! if LB_Known and then Val < Expr_Value (Lo) then ! return True; ! ! elsif UB_Known and then Expr_Value (Hi) < Val then ! return True; ! ! else ! return False; ! end if; ! end if; ! end; ! end if; end Is_Out_Of_Range; --------------------- --- 4335,4343 ---- Fixed_Int : Boolean := False; Int_Real : Boolean := False) return Boolean is begin ! return Test_In_Range (N, Typ, Assume_Valid, Fixed_Int, Int_Real) ! = Out_Of_Range; end Is_Out_Of_Range; --------------------- *************** package body Sem_Eval is *** 4275,4284 **** begin -- If we have the static expression case, then this is an illegality -- in Ada 95 mode, except that in an instance, we never generate an ! -- error (if the error is legitimate, it was already diagnosed in ! -- the template). The expression to compute the length of a packed ! -- array is attached to the array type itself, and deserves a separate ! -- message. if Is_Static_Expression (N) and then not In_Instance --- 4462,4470 ---- begin -- If we have the static expression case, then this is an illegality -- in Ada 95 mode, except that in an instance, we never generate an ! -- error (if the error is legitimate, it was already diagnosed in the ! -- template). The expression to compute the length of a packed array is ! -- attached to the array type itself, and deserves a separate message. if Is_Static_Expression (N) and then not In_Instance *************** package body Sem_Eval is *** 4300,4307 **** (N, "value not in range of}", CE_Range_Check_Failed); end if; ! -- Here we generate a warning for the Ada 83 case, or when we are ! -- in an instance, or when we have a non-static expression case. else Apply_Compile_Time_Constraint_Error --- 4486,4493 ---- (N, "value not in range of}", CE_Range_Check_Failed); end if; ! -- Here we generate a warning for the Ada 83 case, or when we are in an ! -- instance, or when we have a non-static expression case. else Apply_Compile_Time_Constraint_Error *************** package body Sem_Eval is *** 4317,4338 **** Typ : constant Entity_Id := Etype (N); begin ! -- If we want to raise CE in the condition of a raise_CE node ! -- we may as well get rid of the condition if Present (Parent (N)) and then Nkind (Parent (N)) = N_Raise_Constraint_Error then Set_Condition (Parent (N), Empty); ! -- If the expression raising CE is a N_Raise_CE node, we can use ! -- that one. We just preserve the type of the context elsif Nkind (Exp) = N_Raise_Constraint_Error then Rewrite (N, Exp); Set_Etype (N, Typ); ! -- We have to build an explicit raise_ce node else Rewrite (N, --- 4503,4524 ---- Typ : constant Entity_Id := Etype (N); begin ! -- If we want to raise CE in the condition of a N_Raise_CE node ! -- we may as well get rid of the condition. if Present (Parent (N)) and then Nkind (Parent (N)) = N_Raise_Constraint_Error then Set_Condition (Parent (N), Empty); ! -- If the expression raising CE is a N_Raise_CE node, we can use that ! -- one. We just preserve the type of the context. elsif Nkind (Exp) = N_Raise_Constraint_Error then Rewrite (N, Exp); Set_Etype (N, Typ); ! -- Else build an explcit N_Raise_CE else Rewrite (N, *************** package body Sem_Eval is *** 4371,4376 **** --- 4557,4564 ---- T2 : Entity_Id) return Boolean is begin + -- Scalar types + if Is_Scalar_Type (T1) then -- Definitely compatible if we match *************** package body Sem_Eval is *** 4393,4401 **** then return True; ! -- Base types must match, but we don't check that (should ! -- we???) but we do at least check that both types are ! -- real, or both types are not real. elsif Is_Real_Type (T1) /= Is_Real_Type (T2) then return False; --- 4581,4589 ---- then return True; ! -- Base types must match, but we don't check that (should we???) but ! -- we do at least check that both types are real, or both types are ! -- not real. elsif Is_Real_Type (T1) /= Is_Real_Type (T2) then return False; *************** package body Sem_Eval is *** 4429,4438 **** end; end if; elsif Is_Access_Type (T1) then ! return not Is_Constrained (T2) ! or else Subtypes_Statically_Match ! (Designated_Type (T1), Designated_Type (T2)); else return (Is_Composite_Type (T1) and then not Is_Constrained (T2)) --- 4617,4632 ---- end; end if; + -- Access types + elsif Is_Access_Type (T1) then ! return (not Is_Constrained (T2) ! or else (Subtypes_Statically_Match ! (Designated_Type (T1), Designated_Type (T2)))) ! and then not (Can_Never_Be_Null (T2) ! and then not Can_Never_Be_Null (T1)); ! ! -- All other cases else return (Is_Composite_Type (T1) and then not Is_Constrained (T2)) *************** package body Sem_Eval is *** 4470,4484 **** -- subtype, i.e. both types must be constrained or unconstrained. -- 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 unconstrained base type. In this ! -- situation, Integer and Integer'Base do not statically match, ! -- even though they have the same bounds. ! -- We only apply this test to types in Standard and types that ! -- appear in user programs. That way, we do not have to be ! -- too careful about setting Is_Constrained right for itypes. if Is_Numeric_Type (T1) and then (Is_Constrained (T1) /= Is_Constrained (T2)) --- 4664,4678 ---- -- subtype, i.e. both types must be constrained or unconstrained. -- 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 unconstrained base type. In this situation, ! -- Integer and Integer'Base do not statically match, even though ! -- they have the same bounds. ! -- We only apply this test to types in Standard and types that appear ! -- in user programs. That way, we do not have to be too careful about ! -- setting Is_Constrained right for Itypes. if Is_Numeric_Type (T1) and then (Is_Constrained (T1) /= Is_Constrained (T2)) *************** package body Sem_Eval is *** 4489,4497 **** then return False; ! -- A generic scalar type does not statically match its base ! -- type (AI-311). In this case we make sure that the formals, ! -- which are first subtypes of their bases, are constrained. elsif Is_Generic_Type (T1) and then Is_Generic_Type (T2) --- 4683,4691 ---- then return False; ! -- A generic scalar type does not statically match its base type ! -- (AI-311). In this case we make sure that the formals, which are ! -- first subtypes of their bases, are constrained. elsif Is_Generic_Type (T1) and then Is_Generic_Type (T2) *************** package body Sem_Eval is *** 4500,4511 **** return False; end if; ! -- If there was an error in either range, then just assume ! -- the types statically match to avoid further junk errors ! if Error_Posted (Scalar_Range (T1)) ! or else ! Error_Posted (Scalar_Range (T2)) then return True; end if; --- 4694,4705 ---- return False; end if; ! -- If there was an error in either range, then just assume the types ! -- statically match to avoid further junk errors. ! if No (Scalar_Range (T1)) or else No (Scalar_Range (T2)) ! or else Error_Posted (Scalar_Range (T1)) ! or else Error_Posted (Scalar_Range (T2)) then return True; end if; *************** package body Sem_Eval is *** 4532,4539 **** then return False; ! -- If either type has constraint error bounds, then say ! -- that they match to avoid junk cascaded errors here. elsif not Is_OK_Static_Subtype (T1) or else not Is_OK_Static_Subtype (T2) --- 4726,4733 ---- then return False; ! -- If either type has constraint error bounds, then say that ! -- they match to avoid junk cascaded errors here. elsif not Is_OK_Static_Subtype (T1) or else not Is_OK_Static_Subtype (T2) *************** package body Sem_Eval is *** 4643,4653 **** return True; ! -- A definite type does not match an indefinite or classwide type -- However, a generic type with unknown discriminants may be -- instantiated with a type with no discriminants, and conformance ! -- checking on an inherited operation may compare the actual with ! -- the subtype that renames it in the instance. elsif Has_Unknown_Discriminants (T1) /= Has_Unknown_Discriminants (T2) --- 4837,4847 ---- return True; ! -- A definite type does not match an indefinite or classwide type. -- However, a generic type with unknown discriminants may be -- instantiated with a type with no discriminants, and conformance ! -- checking on an inherited operation may compare the actual with the ! -- subtype that renames it in the instance. elsif Has_Unknown_Discriminants (T1) /= Has_Unknown_Discriminants (T2) *************** package body Sem_Eval is *** 4659,4674 **** elsif Is_Array_Type (T1) then ! -- If either subtype is unconstrained then both must be, ! -- and if both are unconstrained then no further checking ! -- is needed. if not Is_Constrained (T1) or else not Is_Constrained (T2) then return not (Is_Constrained (T1) or else Is_Constrained (T2)); end if; ! -- Both subtypes are constrained, so check that the index ! -- subtypes statically match. declare Index1 : Node_Id := First_Index (T1); --- 4853,4867 ---- elsif Is_Array_Type (T1) then ! -- If either subtype is unconstrained then both must be, and if both ! -- are unconstrained then no further checking is needed. if not Is_Constrained (T1) or else not Is_Constrained (T2) then return not (Is_Constrained (T1) or else Is_Constrained (T2)); end if; ! -- Both subtypes are constrained, so check that the index subtypes ! -- statically match. declare Index1 : Node_Id := First_Index (T1); *************** package body Sem_Eval is *** 4693,4700 **** if Can_Never_Be_Null (T1) /= Can_Never_Be_Null (T2) then return False; ! elsif Ekind (T1) = E_Access_Subprogram_Type ! or else Ekind (T1) = E_Anonymous_Access_Subprogram_Type then return Subtype_Conformant --- 4886,4893 ---- if Can_Never_Be_Null (T1) /= Can_Never_Be_Null (T2) then return False; ! elsif Ekind_In (T1, E_Access_Subprogram_Type, ! E_Anonymous_Access_Subprogram_Type) then return Subtype_Conformant *************** package body Sem_Eval is *** 4819,4826 **** Set_Etype (N, Any_Type); return; ! -- If left operand raises constraint error, then replace node N with ! -- the raise constraint error node, and we are obviously not foldable. -- Is_Static_Expression is set from the two operands in the normal way, -- and we check the right operand if it is in a non-static context. --- 5012,5019 ---- Set_Etype (N, Any_Type); return; ! -- If left operand raises constraint error, then replace node N with the ! -- Raise_Constraint_Error node, and we are obviously not foldable. -- Is_Static_Expression is set from the two operands in the normal way, -- and we check the right operand if it is in a non-static context. *************** package body Sem_Eval is *** 4833,4841 **** Set_Is_Static_Expression (N, Rstat); return; ! -- Similar processing for the case of the right operand. Note that ! -- we don't use this routine for the short-circuit case, so we do ! -- not have to worry about that special case here. elsif Raises_Constraint_Error (Op2) then if not Rstat then --- 5026,5034 ---- Set_Is_Static_Expression (N, Rstat); return; ! -- Similar processing for the case of the right operand. Note that we ! -- don't use this routine for the short-circuit case, so we do not have ! -- to worry about that special case here. elsif Raises_Constraint_Error (Op2) then if not Rstat then *************** package body Sem_Eval is *** 4855,4861 **** return; -- If result is not static, then check non-static contexts on operands ! -- since one of them may be static and the other one may not be static elsif not Rstat then Check_Non_Static_Context (Op1); --- 5048,5054 ---- return; -- If result is not static, then check non-static contexts on operands ! -- since one of them may be static and the other one may not be static. elsif not Rstat then Check_Non_Static_Context (Op1); *************** package body Sem_Eval is *** 4864,4871 **** and then Compile_Time_Known_Value (Op2); return; ! -- Else result is static and foldable. Both operands are static, ! -- and neither raises constraint error, so we can definitely fold. else Set_Is_Static_Expression (N); --- 5057,5064 ---- and then Compile_Time_Known_Value (Op2); return; ! -- Else result is static and foldable. Both operands are static, and ! -- neither raises constraint error, so we can definitely fold. else Set_Is_Static_Expression (N); *************** package body Sem_Eval is *** 4875,4880 **** --- 5068,5192 ---- end if; end Test_Expression_Is_Foldable; + ------------------- + -- Test_In_Range -- + ------------------- + + function Test_In_Range + (N : Node_Id; + Typ : Entity_Id; + Assume_Valid : Boolean; + Fixed_Int : Boolean; + Int_Real : Boolean) return Range_Membership + is + Val : Uint; + Valr : Ureal; + + pragma Warnings (Off, Assume_Valid); + -- For now Assume_Valid is unreferenced since the current implementation + -- always returns Unknown if N is not a compile time known value, but we + -- keep the parameter to allow for future enhancements in which we try + -- to get the information in the variable case as well. + + begin + -- Universal types have no range limits, so always in range + + if Typ = Universal_Integer or else Typ = Universal_Real then + return In_Range; + + -- Never known if not scalar type. Don't know if this can actually + -- happen, but our spec allows it, so we must check! + + elsif not Is_Scalar_Type (Typ) then + return Unknown; + + -- Never known if this is a generic type, since the bounds of generic + -- types are junk. Note that if we only checked for static expressions + -- (instead of compile time known values) below, we would not need this + -- check, because values of a generic type can never be static, but they + -- can be known at compile time. + + elsif Is_Generic_Type (Typ) then + return Unknown; + + -- Never known unless we have a compile time known value + + elsif not Compile_Time_Known_Value (N) then + return Unknown; + + -- General processing with a known compile time value + + else + declare + Lo : Node_Id; + Hi : Node_Id; + + LB_Known : Boolean; + HB_Known : Boolean; + + begin + Lo := Type_Low_Bound (Typ); + Hi := Type_High_Bound (Typ); + + LB_Known := Compile_Time_Known_Value (Lo); + HB_Known := Compile_Time_Known_Value (Hi); + + -- Fixed point types should be considered as such only if flag + -- Fixed_Int is set to False. + + if Is_Floating_Point_Type (Typ) + or else (Is_Fixed_Point_Type (Typ) and then not Fixed_Int) + or else Int_Real + then + Valr := Expr_Value_R (N); + + if LB_Known and HB_Known then + if Valr >= Expr_Value_R (Lo) + and then + Valr <= Expr_Value_R (Hi) + then + return In_Range; + else + return Out_Of_Range; + end if; + + elsif (LB_Known and then Valr < Expr_Value_R (Lo)) + or else + (HB_Known and then Valr > Expr_Value_R (Hi)) + then + return Out_Of_Range; + + else + return Unknown; + end if; + + else + Val := Expr_Value (N); + + if LB_Known and HB_Known then + if Val >= Expr_Value (Lo) + and then + Val <= Expr_Value (Hi) + then + return In_Range; + else + return Out_Of_Range; + end if; + + elsif (LB_Known and then Val < Expr_Value (Lo)) + or else + (HB_Known and then Val > Expr_Value (Hi)) + then + return Out_Of_Range; + + else + return Unknown; + end if; + end if; + end; + end if; + end Test_In_Range; + -------------- -- To_Bits -- -------------- *************** package body Sem_Eval is *** 4896,4903 **** E : Entity_Id; procedure Why_Not_Static_List (L : List_Id); ! -- A version that can be called on a list of expressions. Finds ! -- all non-static violations in any element of the list. ------------------------- -- Why_Not_Static_List -- --- 5208,5215 ---- E : Entity_Id; procedure Why_Not_Static_List (L : List_Id); ! -- A version that can be called on a list of expressions. Finds all ! -- non-static violations in any element of the list. ------------------------- -- Why_Not_Static_List -- *************** package body Sem_Eval is *** 4919,4926 **** -- Start of processing for Why_Not_Static begin ! -- If in ACATS mode (debug flag 2), then suppress all these ! -- messages, this avoids massive updates to the ACATS base line. if Debug_Flag_2 then return; --- 5231,5238 ---- -- Start of processing for Why_Not_Static begin ! -- If in ACATS mode (debug flag 2), then suppress all these messages, ! -- this avoids massive updates to the ACATS base line. if Debug_Flag_2 then return; *************** package body Sem_Eval is *** 5044,5051 **** return; ! -- Special case generic types, since again this is a common ! -- source of confusion. elsif Is_Generic_Actual_Type (E) or else --- 5356,5363 ---- return; ! -- Special case generic types, since again this is a common source ! -- of confusion. elsif Is_Generic_Actual_Type (E) or else *************** package body Sem_Eval is *** 5120,5127 **** when N_Type_Conversion => Why_Not_Static (Expression (N)); ! if not Is_Scalar_Type (Etype (Prefix (N))) ! or else not Is_Static_Subtype (Etype (Prefix (N))) then Error_Msg_N ("static conversion requires static scalar subtype result " & --- 5432,5439 ---- when N_Type_Conversion => Why_Not_Static (Expression (N)); ! if not Is_Scalar_Type (Entity (Subtype_Mark (N))) ! or else not Is_Static_Subtype (Entity (Subtype_Mark (N))) then Error_Msg_N ("static conversion requires static scalar subtype result " & diff -Nrcpad gcc-4.5.2/gcc/ada/sem_eval.ads gcc-4.6.0/gcc/ada/sem_eval.ads *** gcc-4.5.2/gcc/ada/sem_eval.ads Mon Apr 20 13:28:50 2009 --- gcc-4.6.0/gcc/ada/sem_eval.ads Fri Jun 18 09:41:49 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Eval is *** 282,287 **** --- 282,288 ---- procedure Eval_Allocator (N : Node_Id); procedure Eval_Arithmetic_Op (N : Node_Id); procedure Eval_Call (N : Node_Id); + procedure Eval_Case_Expression (N : Node_Id); procedure Eval_Character_Literal (N : Node_Id); procedure Eval_Concatenation (N : Node_Id); procedure Eval_Conditional_Expression (N : Node_Id); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_intr.adb gcc-4.6.0/gcc/ada/sem_intr.adb *** gcc-4.5.2/gcc/ada/sem_intr.adb Mon Jul 20 13:06:01 2009 --- gcc-4.6.0/gcc/ada/sem_intr.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Errout; use Errout; *** 31,36 **** --- 31,37 ---- with Fname; use Fname; with Lib; use Lib; with Namet; use Namet; + with Sem_Aux; use Sem_Aux; with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; *************** package body Sem_Intr is *** 53,60 **** -- returns type String. procedure Check_Intrinsic_Operator (E : Entity_Id; N : Node_Id); ! -- Check that operator is one of the binary arithmetic operators, and ! -- that the types involved have the same size. procedure Check_Shift (E : Entity_Id; N : Node_Id); -- Check intrinsic shift subprogram, the two arguments are the same --- 54,61 ---- -- returns type String. procedure Check_Intrinsic_Operator (E : Entity_Id; N : Node_Id); ! -- Check that operator is one of the binary arithmetic operators, and that ! -- the types involved both have underlying integer types. procedure Check_Shift (E : Entity_Id; N : Node_Id); -- Check intrinsic shift subprogram, the two arguments are the same *************** package body Sem_Intr is *** 73,81 **** procedure Check_Exception_Function (E : Entity_Id; N : Node_Id) is begin ! if Ekind (E) /= E_Function ! and then Ekind (E) /= E_Generic_Function ! then Errint ("intrinsic exception subprogram must be a function", E, N); --- 74,80 ---- procedure Check_Exception_Function (E : Entity_Id; N : Node_Id) is begin ! if not Ekind_In (E, E_Function, E_Generic_Function) then Errint ("intrinsic exception subprogram must be a function", E, N); *************** package body Sem_Intr is *** 98,107 **** procedure Check_Intrinsic_Call (N : Node_Id) is Nam : constant Entity_Id := Entity (Name (N)); - Cnam : constant Name_Id := Chars (Nam); Arg1 : constant Node_Id := First_Actual (N); begin -- For Import_xxx calls, argument must be static string. A string -- literal is legal even in Ada83 mode, where such literals are -- not static. --- 97,128 ---- procedure Check_Intrinsic_Call (N : Node_Id) is Nam : constant Entity_Id := Entity (Name (N)); Arg1 : constant Node_Id := First_Actual (N); + Typ : Entity_Id; + Rtyp : Entity_Id; + Cnam : Name_Id; + Unam : Node_Id; begin + -- Set argument type if argument present + + if Present (Arg1) then + Typ := Etype (Arg1); + Rtyp := Underlying_Type (Root_Type (Typ)); + end if; + + -- Set intrinsic name (getting original name in the generic case) + + Unam := Ultimate_Alias (Nam); + + if Present (Parent (Unam)) + and then Present (Generic_Parent (Parent (Unam))) + then + Cnam := Chars (Generic_Parent (Parent (Unam))); + else + Cnam := Chars (Nam); + end if; + -- For Import_xxx calls, argument must be static string. A string -- literal is legal even in Ada83 mode, where such literals are -- not static. *************** package body Sem_Intr is *** 138,149 **** -- Check for the case of freeing a non-null object which will raise -- Constraint_Error. Issue warning here, do the expansion in Exp_Intr. ! elsif Cnam = Name_Free and then Can_Never_Be_Null (Etype (Arg1)) then Error_Msg_N ("freeing `NOT NULL` object will raise Constraint_Error?", N); -- For now, no other special checks are required else --- 159,181 ---- -- Check for the case of freeing a non-null object which will raise -- Constraint_Error. Issue warning here, do the expansion in Exp_Intr. ! elsif Cnam = Name_Unchecked_Deallocation and then Can_Never_Be_Null (Etype (Arg1)) then Error_Msg_N ("freeing `NOT NULL` object will raise Constraint_Error?", N); + -- For unchecked deallocation, error to deallocate from empty pool. + -- Note: this test used to be in Exp_Intr as a warning, but AI 157 + -- issues a binding interpretation that this should be an error, and + -- consequently it needs to be done in the semantic analysis so that + -- the error is issued even in semantics only mode. + + elsif Cnam = Name_Unchecked_Deallocation + and then No_Pool_Assigned (Rtyp) + then + Error_Msg_N ("deallocation from empty storage pool!", N); + -- For now, no other special checks are required else *************** package body Sem_Intr is *** 190,198 **** then T2 := T1; ! else ! -- Previous error in declaration return; end if; --- 222,230 ---- then T2 := T1; ! -- Previous error in declaration + else return; end if; *************** package body Sem_Intr is *** 200,210 **** T2 := Etype (Next_Formal (First_Formal (E))); end if; ! if Root_Type (T1) /= Root_Type (T2) ! or else Root_Type (T1) /= Root_Type (Ret) then Errint ! ("types of intrinsic operator must have the same size", E, N); end if; -- Comparison operators --- 232,255 ---- T2 := Etype (Next_Formal (First_Formal (E))); end if; ! -- Same types, predefined operator will apply ! ! if Root_Type (T1) = Root_Type (T2) ! or else Root_Type (T1) = Root_Type (Ret) then + null; + + -- Expansion will introduce conversions if sizes are not equal + + elsif Is_Integer_Type (Underlying_Type (T1)) + and then Is_Integer_Type (Underlying_Type (T2)) + and then Is_Integer_Type (Underlying_Type (Ret)) + then + null; + + else Errint ! ("types of intrinsic operator operands do not match", E, N); end if; -- Comparison operators *************** package body Sem_Intr is *** 223,234 **** then T1 := Etype (First_Formal (E)); ! if No (Next_Formal (First_Formal (E))) then ! ! -- Previous error in declaration return; - else T2 := Etype (Next_Formal (First_Formal (E))); end if; --- 268,277 ---- then T1 := Etype (First_Formal (E)); ! -- Return if previous error in declaration, otherwise get T2 type + if No (Next_Formal (First_Formal (E))) then return; else T2 := Etype (Next_Formal (First_Formal (E))); end if; *************** package body Sem_Intr is *** 274,280 **** return; end if; ! if not Is_Numeric_Type (T1) then Errint ("intrinsic operator can only apply to numeric types", E, N); end if; end Check_Intrinsic_Operator; --- 317,323 ---- return; end if; ! if not Is_Numeric_Type (Underlying_Type (T1)) then Errint ("intrinsic operator can only apply to numeric types", E, N); end if; end Check_Intrinsic_Operator; *************** package body Sem_Intr is *** 374,382 **** Ptyp2 : Node_Id; begin ! if Ekind (E) /= E_Function ! and then Ekind (E) /= E_Generic_Function ! then Errint ("intrinsic shift subprogram must be a function", E, N); return; end if; --- 417,423 ---- Ptyp2 : Node_Id; begin ! if not Ekind_In (E, E_Function, E_Generic_Function) then Errint ("intrinsic shift subprogram must be a function", E, N); return; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_mech.adb gcc-4.6.0/gcc/ada/sem_mech.adb *** gcc-4.5.2/gcc/ada/sem_mech.adb Thu Apr 9 10:27:10 2009 --- gcc-4.6.0/gcc/ada/sem_mech.adb Fri Jun 18 12:14:52 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** package body Sem_Mech is *** 92,99 **** return; elsif Chars (Mech_Name) = Name_Copy then ! Error_Msg_N ! ("bad mechanism name, Value assumed", Mech_Name); Set_Mechanism (Ent, By_Copy); else --- 92,98 ---- return; elsif Chars (Mech_Name) = Name_Copy then ! Error_Msg_N ("bad mechanism name, Value assumed", Mech_Name); Set_Mechanism (Ent, By_Copy); else diff -Nrcpad gcc-4.5.2/gcc/ada/sem_prag.adb gcc-4.6.0/gcc/ada/sem_prag.adb *** gcc-4.5.2/gcc/ada/sem_prag.adb Wed Jan 27 13:29:52 2010 --- gcc-4.6.0/gcc/ada/sem_prag.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Debug; use Debug; *** 37,42 **** --- 37,43 ---- with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; + with Exp_Ch7; use Exp_Ch7; with Exp_Dist; use Exp_Dist; with Lib; use Lib; with Lib.Writ; use Lib.Writ; *************** with Nlists; use Nlists; *** 46,51 **** --- 47,53 ---- with Nmake; use Nmake; with Opt; use Opt; with Output; use Output; + with Par_SCO; use Par_SCO; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; *************** with Sem_Ch6; use Sem_Ch6; *** 56,61 **** --- 58,64 ---- with Sem_Ch8; use Sem_Ch8; with Sem_Ch12; use Sem_Ch12; with Sem_Ch13; use Sem_Ch13; + with Sem_Disp; use Sem_Disp; with Sem_Dist; use Sem_Dist; with Sem_Elim; use Sem_Elim; with Sem_Eval; use Sem_Eval; *************** package body Sem_Prag is *** 88,97 **** -- Common Handling of Import-Export Pragmas -- ---------------------------------------------- ! -- In the following section, a number of Import_xxx and Export_xxx ! -- pragmas are defined by GNAT. These are compatible with the DEC ! -- pragmas of the same name, and all have the following common ! -- form and processing: -- pragma Export_xxx -- [Internal =>] LOCAL_NAME --- 91,99 ---- -- Common Handling of Import-Export Pragmas -- ---------------------------------------------- ! -- In the following section, a number of Import_xxx and Export_xxx pragmas ! -- are defined by GNAT. These are compatible with the DEC pragmas of the ! -- same name, and all have the following common form and processing: -- pragma Export_xxx -- [Internal =>] LOCAL_NAME *************** package body Sem_Prag is *** 176,189 **** -- 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 --- 178,183 ---- *************** package body Sem_Prag is *** 246,254 **** ------------------------------ 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 --- 240,246 ---- ------------------------------ procedure Analyze_PPC_In_Decl_Part (N : Node_Id; S : Entity_Id) is ! Arg1 : constant Node_Id := First (Pragma_Argument_Associations (N)); begin -- Install formals and push subprogram spec onto scope stack so that we *************** package body Sem_Prag is *** 263,275 **** 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. --- 255,260 ---- *************** package body Sem_Prag is *** 285,290 **** --- 270,282 ---- Pname : constant Name_Id := Pragma_Name (N); Prag_Id : Pragma_Id; + Sense : constant Boolean := not Aspect_Cancel (N); + -- Sense is True if we have the normal case of a pragma that is active + -- and turns the corresponding aspect on. It is false only for the case + -- of a pragma coming from an aspect which is explicitly turned off by + -- using aspect => False. If Sense is False, the effect of the pragma + -- is to turn the corresponding aspect off. + Pragma_Exit : exception; -- This exception is used to exit pragma processing completely. It is -- used when an error is detected, and no further processing is *************** package body Sem_Prag is *** 308,314 **** procedure Ada_2005_Pragma; -- Called for pragmas defined in Ada 2005, that are not in Ada 95. In -- Ada 95 mode, these are implementation defined pragmas, so should be ! -- caught by the No_Implementation_Pragmas restriction procedure Check_Ada_83_Warning; -- Issues a warning message for the current pragma if operating in Ada --- 300,311 ---- procedure Ada_2005_Pragma; -- Called for pragmas defined in Ada 2005, that are not in Ada 95. In -- Ada 95 mode, these are implementation defined pragmas, so should be ! -- caught by the No_Implementation_Pragmas restriction. ! ! procedure Ada_2012_Pragma; ! -- Called for pragmas defined in Ada 2012, that are not in Ada 95 or 05. ! -- In Ada 95 or 05 mode, these are implementation defined pragmas, so ! -- should be caught by the No_Implementation_Pragmas restriction. procedure Check_Ada_83_Warning; -- Issues a warning message for the current pragma if operating in Ada *************** package body Sem_Prag is *** 376,385 **** -- Any_Integer is OK). If not, given error and raise Pragma_Exit. If -- Typ is left Empty, then any static expression is allowed. - procedure Check_Arg_Is_String_Literal (Arg : Node_Id); - -- Check the specified argument Arg to make sure that it is a string - -- literal. If not give error and raise Pragma_Exit - procedure Check_Arg_Is_Task_Dispatching_Policy (Arg : Node_Id); -- Check the specified argument Arg to make sure that it is a valid task -- dispatching policy name. If not give error and raise Pragma_Exit. --- 373,378 ---- *************** package body Sem_Prag is *** 395,403 **** procedure Check_At_Most_N_Arguments (N : Nat); -- Check there are no more than N arguments present ! procedure Check_Component (Comp : Node_Id); ! -- Examine Unchecked_Union component for correct use of per-object -- constrained subtypes, and for restrictions on finalizable components. procedure Check_Duplicated_Export_Name (Nam : Node_Id); -- Nam is an N_String_Literal node containing the external name set by --- 388,407 ---- procedure Check_At_Most_N_Arguments (N : Nat); -- Check there are no more than N arguments present ! procedure Check_Component ! (Comp : Node_Id; ! UU_Typ : Entity_Id; ! In_Variant_Part : Boolean := False); ! -- Examine an Unchecked_Union component for correct use of per-object -- constrained subtypes, and for restrictions on finalizable components. + -- UU_Typ is the related Unchecked_Union type. Flag In_Variant_Part + -- should be set when Comp comes from a record variant. + + procedure Check_Duplicate_Pragma (E : Entity_Id); + -- Check if a pragma of the same name as the current pragma is already + -- chained as a rep pragma to the given entity. If so give a message + -- about the duplicate, and then raise Pragma_Exit so does not return. + -- Also checks for delayed aspect specification node in the chain. procedure Check_Duplicated_Export_Name (Nam : Node_Id); -- Nam is an N_String_Literal node containing the external name set by *************** package body Sem_Prag is *** 406,417 **** -- case, and if found, issues an appropriate error message. procedure Check_First_Subtype (Arg : Node_Id); ! -- Checks that Arg, whose expression is an entity name referencing a ! -- subtype, does not reference a type that is not a first subtype. procedure Check_In_Main_Program; -- Common checks for pragmas that appear within a main program ! -- (Priority, Main_Storage, Time_Slice, Relative_Deadline). procedure Check_Interrupt_Or_Attach_Handler; -- Common processing for first argument of pragma Interrupt_Handler or --- 410,421 ---- -- case, and if found, issues an appropriate error message. procedure Check_First_Subtype (Arg : Node_Id); ! -- Checks that Arg, whose expression is an entity name, references a ! -- first subtype. procedure Check_In_Main_Program; -- Common checks for pragmas that appear within a main program ! -- (Priority, Main_Storage, Time_Slice, Relative_Deadline, CPU). procedure Check_Interrupt_Or_Attach_Handler; -- Common processing for first argument of pragma Interrupt_Handler or *************** package body Sem_Prag is *** 486,494 **** -- and to library level instantiations), and they are simply ignored, -- which is implemented by rewriting them as null statements. ! procedure Check_Variant (Variant : Node_Id); ! -- Check Unchecked_Union variant for lack of nested variants and ! -- presence of at least one component. procedure Error_Pragma (Msg : String); pragma No_Return (Error_Pragma); --- 490,499 ---- -- and to library level instantiations), and they are simply ignored, -- which is implemented by rewriting them as null statements. ! procedure Check_Variant (Variant : Node_Id; UU_Typ : Entity_Id); ! -- Check an Unchecked_Union variant for lack of nested variants and ! -- presence of at least one component. UU_Typ is the related Unchecked_ ! -- Union type. procedure Error_Pragma (Msg : String); pragma No_Return (Error_Pragma); *************** package body Sem_Prag is *** 548,553 **** --- 553,565 ---- -- procedure identified by Name, returns it if it exists, otherwise -- errors out and uses Arg as the pragma argument for the message. + procedure Fix_Error (Msg : in out String); + -- This is called prior to issuing an error message. Msg is a string + -- which typically contains the substring pragma. If the current pragma + -- comes from an aspect, each such "pragma" substring is replaced with + -- the characters "aspect", and if Error_Msg_Name_1 is Name_Precondition + -- (resp Name_Postcondition) it is changed to Name_Pre (resp Name_Post). + procedure Gather_Associations (Names : Name_List; Args : out Args_List); *************** package body Sem_Prag is *** 729,734 **** --- 741,757 ---- end if; end Ada_2005_Pragma; + --------------------- + -- Ada_2012_Pragma -- + --------------------- + + procedure Ada_2012_Pragma is + begin + if Ada_Version <= Ada_2005 then + Check_Restriction (No_Implementation_Pragmas, N); + end if; + end Ada_2012_Pragma; + -------------------------- -- Check_Ada_83_Warning -- -------------------------- *************** package body Sem_Prag is *** 792,801 **** else Error_Msg_Name_1 := Pname; ! Flag_Non_Static_Expr ! ("argument for pragma% must be a identifier or " & ! "static string expression!", Argx); ! raise Pragma_Exit; end if; end if; end Check_Arg_Is_External_Name; --- 815,830 ---- else Error_Msg_Name_1 := Pname; ! ! declare ! Msg : String := ! "argument for pragma% must be a identifier or " ! & "static string expression!"; ! begin ! Fix_Error (Msg); ! Flag_Non_Static_Expr (Msg, Argx); ! raise Pragma_Exit; ! end; end if; end if; end Check_Arg_Is_External_Name; *************** package body Sem_Prag is *** 839,845 **** begin Check_Arg_Is_Local_Name (Arg); ! if not Is_Library_Level_Entity (Entity (Expression (Arg))) and then Comes_From_Source (N) then Error_Pragma_Arg --- 868,874 ---- begin Check_Arg_Is_Local_Name (Arg); ! if not Is_Library_Level_Entity (Entity (Get_Pragma_Arg (Arg))) and then Comes_From_Source (N) then Error_Pragma_Arg *************** package body Sem_Prag is *** 872,882 **** Error_Pragma_Arg ("argument for pragma% must be local name", Argx); end if; ! if Is_Entity_Name (Argx) ! and then Scope (Entity (Argx)) /= Current_Scope ! then ! Error_Pragma_Arg ! ("pragma% argument must be in same declarative part", Arg); end if; end Check_Arg_Is_Local_Name; --- 901,967 ---- Error_Pragma_Arg ("argument for pragma% must be local name", Argx); end if; ! -- No further check required if not an entity name ! ! if not Is_Entity_Name (Argx) then ! null; ! ! else ! declare ! OK : Boolean; ! Ent : constant Entity_Id := Entity (Argx); ! Scop : constant Entity_Id := Scope (Ent); ! begin ! -- Case of a pragma applied to a compilation unit: pragma must ! -- occur immediately after the program unit in the compilation. ! ! if Is_Compilation_Unit (Ent) then ! declare ! Decl : constant Node_Id := Unit_Declaration_Node (Ent); ! begin ! -- Case of pragma placed immediately after spec ! ! if Parent (N) = Aux_Decls_Node (Parent (Decl)) then ! OK := True; ! ! -- Case of pragma placed immediately after body ! ! elsif Nkind (Decl) = N_Subprogram_Declaration ! and then Present (Corresponding_Body (Decl)) ! then ! OK := Parent (N) = ! Aux_Decls_Node ! (Parent (Unit_Declaration_Node ! (Corresponding_Body (Decl)))); ! ! -- All other cases are illegal ! ! else ! OK := False; ! end if; ! end; ! ! -- Special restricted placement rule from 10.2.1(11.8/2) ! ! elsif Is_Generic_Formal (Ent) ! and then Prag_Id = Pragma_Preelaborable_Initialization ! then ! OK := List_Containing (N) = ! Generic_Formal_Declarations ! (Unit_Declaration_Node (Scop)); ! ! -- Default case, just check that the pragma occurs in the scope ! -- of the entity denoted by the name. ! ! else ! OK := Current_Scope = Scop; ! end if; ! ! if not OK then ! Error_Pragma_Arg ! ("pragma% argument must be in same declarative part", Arg); ! end if; ! end; end if; end Check_Arg_Is_Local_Name; *************** package body Sem_Prag is *** 891,898 **** Check_Arg_Is_Identifier (Argx); if not Is_Locking_Policy_Name (Chars (Argx)) then ! Error_Pragma_Arg ! ("& is not a valid locking policy name", Argx); end if; end Check_Arg_Is_Locking_Policy; --- 976,982 ---- Check_Arg_Is_Identifier (Argx); if not Is_Locking_Policy_Name (Chars (Argx)) then ! Error_Pragma_Arg ("& is not a valid locking policy name", Argx); end if; end Check_Arg_Is_Locking_Policy; *************** package body Sem_Prag is *** 947,953 **** Error_Pragma_Arg ("invalid argument for pragma%", Argx); end if; end Check_Arg_Is_One_Of; - --------------------------------- -- Check_Arg_Is_Queuing_Policy -- --------------------------------- --- 1031,1036 ---- *************** package body Sem_Prag is *** 959,966 **** Check_Arg_Is_Identifier (Argx); if not Is_Queuing_Policy_Name (Chars (Argx)) then ! Error_Pragma_Arg ! ("& is not a valid queuing policy name", Argx); end if; end Check_Arg_Is_Queuing_Policy; --- 1042,1048 ---- Check_Arg_Is_Identifier (Argx); if not Is_Queuing_Policy_Name (Chars (Argx)) then ! Error_Pragma_Arg ("& is not a valid queuing policy name", Argx); end if; end Check_Arg_Is_Queuing_Policy; *************** package body Sem_Prag is *** 1008,1031 **** else Error_Msg_Name_1 := Pname; - Flag_Non_Static_Expr - ("argument for pragma% must be a static expression!", Argx); - raise Pragma_Exit; - end if; - end Check_Arg_Is_Static_Expression; ! --------------------------------- ! -- Check_Arg_Is_String_Literal -- ! --------------------------------- ! procedure Check_Arg_Is_String_Literal (Arg : Node_Id) is ! Argx : constant Node_Id := Get_Pragma_Arg (Arg); ! begin ! if Nkind (Argx) /= N_String_Literal then ! Error_Pragma_Arg ! ("argument for pragma% must be string literal", Argx); end if; ! end Check_Arg_Is_String_Literal; ------------------------------------------ -- Check_Arg_Is_Task_Dispatching_Policy -- --- 1090,1107 ---- else Error_Msg_Name_1 := Pname; ! declare ! Msg : String := ! "argument for pragma% must be a static expression!"; ! begin ! Fix_Error (Msg); ! Flag_Non_Static_Expr (Msg, Argx); ! end; ! raise Pragma_Exit; end if; ! end Check_Arg_Is_Static_Expression; ------------------------------------------ -- Check_Arg_Is_Task_Dispatching_Policy -- *************** package body Sem_Prag is *** 1110,1151 **** -- Check_Component -- --------------------- ! procedure Check_Component (Comp : Node_Id) is ! begin ! if Nkind (Comp) = N_Component_Declaration then ! declare ! Sindic : constant Node_Id := ! Subtype_Indication (Component_Definition (Comp)); ! Typ : constant Entity_Id := ! Etype (Defining_Identifier (Comp)); ! begin ! if Nkind (Sindic) = N_Subtype_Indication then ! -- Ada 2005 (AI-216): If a component subtype is subject to ! -- a per-object constraint, then the component type shall ! -- be an Unchecked_Union. ! if Has_Per_Object_Constraint (Defining_Identifier (Comp)) ! and then ! not Is_Unchecked_Union (Etype (Subtype_Mark (Sindic))) ! then ! Error_Msg_N ("component subtype subject to per-object" & ! " constraint must be an Unchecked_Union", Comp); ! end if; ! end if; ! if Is_Controlled (Typ) then ! Error_Msg_N ! ("component of unchecked union cannot be controlled", Comp); ! elsif Has_Task (Typ) then ! Error_Msg_N ! ("component of unchecked union cannot have tasks", Comp); end if; ! end; end if; end Check_Component; ---------------------------------- -- Check_Duplicated_Export_Name -- ---------------------------------- --- 1186,1305 ---- -- Check_Component -- --------------------- ! procedure Check_Component ! (Comp : Node_Id; ! UU_Typ : Entity_Id; ! In_Variant_Part : Boolean := False) ! is ! Comp_Id : constant Entity_Id := Defining_Identifier (Comp); ! Sindic : constant Node_Id := ! Subtype_Indication (Component_Definition (Comp)); ! Typ : constant Entity_Id := Etype (Comp_Id); ! function Inside_Generic_Body (Id : Entity_Id) return Boolean; ! -- Determine whether entity Id appears inside a generic body. ! -- Shouldn't this be in a more general place ??? ! ------------------------- ! -- Inside_Generic_Body -- ! ------------------------- ! function Inside_Generic_Body (Id : Entity_Id) return Boolean is ! S : Entity_Id; ! begin ! S := Id; ! while Present (S) and then S /= Standard_Standard loop ! if Ekind (S) = E_Generic_Package ! and then In_Package_Body (S) ! then ! return True; end if; ! ! S := Scope (S); ! end loop; ! ! return False; ! end Inside_Generic_Body; ! ! -- Start of processing for Check_Component ! ! begin ! -- Ada 2005 (AI-216): If a component subtype is subject to a per- ! -- object constraint, then the component type shall be an Unchecked_ ! -- Union. ! ! if Nkind (Sindic) = N_Subtype_Indication ! and then Has_Per_Object_Constraint (Comp_Id) ! and then not Is_Unchecked_Union (Etype (Subtype_Mark (Sindic))) ! then ! Error_Msg_N ! ("component subtype subject to per-object constraint " & ! "must be an Unchecked_Union", Comp); ! ! -- Ada 2012 (AI05-0026): For an unchecked union type declared within ! -- the body of a generic unit, or within the body of any of its ! -- descendant library units, no part of the type of a component ! -- declared in a variant_part of the unchecked union type shall be of ! -- a formal private type or formal private extension declared within ! -- the formal part of the generic unit. ! ! elsif Ada_Version >= Ada_2012 ! and then Inside_Generic_Body (UU_Typ) ! and then In_Variant_Part ! and then Is_Private_Type (Typ) ! and then Is_Generic_Type (Typ) ! then ! Error_Msg_N ! ("component of Unchecked_Union cannot be of generic type", Comp); ! ! elsif Needs_Finalization (Typ) then ! Error_Msg_N ! ("component of Unchecked_Union cannot be controlled", Comp); ! ! elsif Has_Task (Typ) then ! Error_Msg_N ! ("component of Unchecked_Union cannot have tasks", Comp); end if; end Check_Component; + ---------------------------- + -- Check_Duplicate_Pragma -- + ---------------------------- + + procedure Check_Duplicate_Pragma (E : Entity_Id) is + P : Node_Id; + + begin + -- Nothing to do if this pragma comes from an aspect specification, + -- since we could not be duplicating a pragma, and we dealt with the + -- case of duplicated aspects in Analyze_Aspect_Specifications. + + if From_Aspect_Specification (N) then + return; + end if; + + -- Otherwise current pragma may duplicate previous pragma or a + -- previously given aspect specification for the same pragma. + + P := Get_Rep_Item_For_Entity (E, Pragma_Name (N)); + + if Present (P) then + Error_Msg_Name_1 := Pragma_Name (N); + Error_Msg_Sloc := Sloc (P); + + if Nkind (P) = N_Aspect_Specification + or else From_Aspect_Specification (P) + then + Error_Msg_NE ("aspect% for & previously given#", N, E); + else + Error_Msg_NE ("pragma% for & duplicates pragma#", N, E); + end if; + + raise Pragma_Exit; + end if; + end Check_Duplicate_Pragma; + ---------------------------------- -- Check_Duplicated_Export_Name -- ---------------------------------- *************** package body Sem_Prag is *** 1154,1167 **** String_Val : constant String_Id := Strval (Nam); begin - -- We allow duplicated export names in CIL, as they are always - -- enclosed in a namespace that differentiates them, and overloaded - -- entities are supported by the VM. - - if VM_Target = CLI_Target then - return; - end if; - -- We are only interested in the export case, and in the case of -- generics, it is the instance, not the template, that is the -- problem (the template will generate a warning in any case). --- 1308,1313 ---- *************** package body Sem_Prag is *** 1193,1202 **** procedure Check_First_Subtype (Arg : Node_Id) is Argx : constant Node_Id := Get_Pragma_Arg (Arg); begin ! if not Is_First_Subtype (Entity (Argx)) then Error_Pragma_Arg ("pragma% cannot apply to subtype", Argx); end if; end Check_First_Subtype; --- 1339,1361 ---- procedure Check_First_Subtype (Arg : Node_Id) is Argx : constant Node_Id := Get_Pragma_Arg (Arg); + Ent : constant Entity_Id := Entity (Argx); + begin ! if Is_First_Subtype (Ent) then ! null; ! ! elsif Is_Type (Ent) then Error_Pragma_Arg ("pragma% cannot apply to subtype", Argx); + + elsif Is_Object (Ent) then + Error_Pragma_Arg + ("pragma% cannot apply to object, requires a type", Argx); + + else + Error_Pragma_Arg + ("pragma% cannot apply to&, requires a type", Argx); end if; end Check_First_Subtype; *************** package body Sem_Prag is *** 1229,1235 **** --------------------------------------- procedure Check_Interrupt_Or_Attach_Handler is ! Arg1_X : constant Node_Id := Expression (Arg1); Handler_Proc, Proc_Scope : Entity_Id; begin --- 1388,1394 ---- --------------------------------------- procedure Check_Interrupt_Or_Attach_Handler is ! Arg1_X : constant Node_Id := Get_Pragma_Arg (Arg1); Handler_Proc, Proc_Scope : Entity_Id; begin *************** package body Sem_Prag is *** 1265,1270 **** --- 1424,1445 ---- Error_Pragma_Arg ("argument for pragma% must be library level entity", Arg1); end if; + + -- AI05-0033: A pragma cannot appear within a generic body, because + -- instance can be in a nested scope. The check that protected type + -- is itself a library-level declaration is done elsewhere. + + -- Note: we omit this check in Codepeer mode to properly handle code + -- prior to AI-0033 (pragmas don't matter to codepeer in any case). + + if Inside_A_Generic then + if Ekind (Scope (Current_Scope)) = E_Generic_Package + and then In_Package_Body (Scope (Current_Scope)) + and then not CodePeer_Mode + then + Error_Pragma ("pragma% cannot be used inside a generic"); + end if; + end if; end Check_Interrupt_Or_Attach_Handler; ------------------------------------------- *************** package body Sem_Prag is *** 1314,1320 **** procedure Check_No_Identifier (Arg : Node_Id) is begin ! if Chars (Arg) /= No_Name then Error_Pragma_Arg_Ident ("pragma% does not permit identifier& here", Arg); end if; --- 1489,1497 ---- procedure Check_No_Identifier (Arg : Node_Id) is begin ! if Nkind (Arg) = N_Pragma_Argument_Association ! and then Chars (Arg) /= No_Name ! then Error_Pragma_Arg_Ident ("pragma% does not permit identifier& here", Arg); end if; *************** package body Sem_Prag is *** 1342,1348 **** procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id) is begin ! if Present (Arg) and then Chars (Arg) /= No_Name then if Chars (Arg) /= Id then Error_Msg_Name_1 := Pname; Error_Msg_Name_2 := Id; --- 1519,1528 ---- procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id) is begin ! if Present (Arg) ! and then Nkind (Arg) = N_Pragma_Argument_Association ! and then Chars (Arg) /= No_Name ! then if Chars (Arg) /= Id then Error_Msg_Name_1 := Pname; Error_Msg_Name_2 := Id; *************** package body Sem_Prag is *** 1378,1405 **** --------------- procedure Chain_PPC (PO : Node_Id) is ! S : Node_Id; begin ! if not Nkind_In (PO, N_Subprogram_Declaration, ! N_Generic_Subprogram_Declaration) then Pragma_Misplaced; end if; ! -- Here if we have subprogram or generic subprogram declaration ! 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 not Is_Package_Or_Generic_Package (Scope (S)) 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)); --- 1558,1655 ---- --------------- procedure Chain_PPC (PO : Node_Id) is ! S : Entity_Id; ! P : Node_Id; begin ! if Nkind (PO) = N_Abstract_Subprogram_Declaration then ! if not From_Aspect_Specification (N) then ! Error_Pragma ! ("pragma% cannot be applied to abstract subprogram"); ! ! elsif Class_Present (N) then ! null; ! ! else ! Error_Pragma ! ("aspect % requires ''Class for abstract subprogram"); ! end if; ! ! elsif not Nkind_In (PO, N_Subprogram_Declaration, ! N_Generic_Subprogram_Declaration, ! N_Entry_Declaration) then Pragma_Misplaced; end if; ! -- Here if we have [generic] subprogram or entry declaration ! if Nkind (PO) = N_Entry_Declaration then ! S := Defining_Entity (PO); ! else ! S := Defining_Unit_Name (Specification (PO)); ! end if; ! -- Make sure we do not have the case of a precondition pragma when ! -- the Pre'Class aspect is present. ! -- We do this by looking at pragmas already chained to the entity ! -- since the aspect derived pragma will be put on this list first. ! ! if Pragma_Name (N) = Name_Precondition then ! if not From_Aspect_Specification (N) then ! P := Spec_PPC_List (S); ! while Present (P) loop ! if Pragma_Name (P) = Name_Precondition ! and then From_Aspect_Specification (P) ! and then Class_Present (P) ! then ! Error_Msg_Sloc := Sloc (P); ! Error_Pragma ! ("pragma% not allowed, `Pre''Class` aspect given#"); ! end if; ! ! P := Next_Pragma (P); ! end loop; ! end if; end if; + -- Similarly check for Pre with inherited Pre'Class. Note that + -- we cover the aspect case as well here. + + if Pragma_Name (N) = Name_Precondition + and then not Class_Present (N) + then + declare + Inherited : constant Subprogram_List := + Inherited_Subprograms (S); + P : Node_Id; + + begin + for J in Inherited'Range loop + P := Spec_PPC_List (Inherited (J)); + while Present (P) loop + if Pragma_Name (P) = Name_Precondition + and then Class_Present (P) + then + Error_Msg_Sloc := Sloc (P); + Error_Pragma + ("pragma% not allowed, `Pre''Class` " + & "aspect inherited from#"); + end if; + + P := Next_Pragma (P); + end loop; + end loop; + end; + end if; + + -- Note: we do not analyze the pragma at this point. Instead we + -- delay this analysis until the end of the declarative part in + -- which the pragma appears. This implements the required delay + -- in this analysis, allowing forward references. The analysis + -- happens at the end of Analyze_Declarations. + -- Chain spec PPC pragma to list for subprogram Set_Next_Pragma (N, Spec_PPC_List (S)); *************** package body Sem_Prag is *** 1418,1426 **** Pragma_Misplaced; end if; ! -- Record whether pragma is enabled ! Set_Pragma_Enabled (N, Check_Enabled (Pname)); -- If we are within an inlined body, the legality of the pragma -- has been checked already. --- 1668,1688 ---- Pragma_Misplaced; end if; ! -- Preanalyze message argument if present. Visibility in this ! -- argument is established at the point of pragma occurrence. ! if Arg_Count = 2 then ! Check_Optional_Identifier (Arg2, Name_Message); ! Preanalyze_Spec_Expression ! (Get_Pragma_Arg (Arg2), Standard_String); ! end if; ! ! -- Record if pragma is enabled ! ! if Check_Enabled (Pname) then ! Set_Pragma_Enabled (N); ! Set_SCO_Pragma_Enabled (Loc); ! end if; -- If we are within an inlined body, the legality of the pragma -- has been checked already. *************** package body Sem_Prag is *** 1475,1483 **** if Operating_Mode /= Generate_Code or else Inside_A_Generic then ! ! -- Analyze expression in pragma, for correctness ! -- and for ASIS use. Preanalyze_Spec_Expression (Get_Pragma_Arg (Arg1), Standard_Boolean); --- 1737,1743 ---- if Operating_Mode /= Generate_Code or else Inside_A_Generic then ! -- Analyze pragma expression for correctness and for ASIS use Preanalyze_Spec_Expression (Get_Pragma_Arg (Arg1), Standard_Boolean); *************** package body Sem_Prag is *** 1615,1621 **** Unit_Node := Unit (Parent (Parent_Node)); Unit_Kind := Nkind (Unit_Node); ! Analyze (Expression (Arg1)); if Unit_Kind = N_Generic_Subprogram_Declaration or else Unit_Kind = N_Subprogram_Declaration --- 1875,1881 ---- Unit_Node := Unit (Parent (Parent_Node)); Unit_Kind := Nkind (Unit_Node); ! Analyze (Get_Pragma_Arg (Arg1)); if Unit_Kind = N_Generic_Subprogram_Declaration or else Unit_Kind = N_Subprogram_Declaration *************** package body Sem_Prag is *** 1630,1636 **** end if; if Chars (Unit_Name) /= ! Chars (Entity (Expression (Arg1))) then Error_Pragma_Arg ("pragma% argument is not current unit name", Arg1); --- 1890,1896 ---- end if; if Chars (Unit_Name) /= ! Chars (Entity (Get_Pragma_Arg (Arg1))) then Error_Pragma_Arg ("pragma% argument is not current unit name", Arg1); *************** package body Sem_Prag is *** 1688,1696 **** Pragma_Misplaced; elsif Arg_Count > 0 then ! Analyze (Expression (Arg1)); ! if Entity (Expression (Arg1)) /= Current_Scope then Error_Pragma_Arg ("name in pragma% must be enclosing unit", Arg1); end if; --- 1948,1956 ---- Pragma_Misplaced; elsif Arg_Count > 0 then ! Analyze (Get_Pragma_Arg (Arg1)); ! if Entity (Get_Pragma_Arg (Arg1)) /= Current_Scope then Error_Pragma_Arg ("name in pragma% must be enclosing unit", Arg1); end if; *************** package body Sem_Prag is *** 1719,1725 **** -- Check_Variant -- ------------------- ! procedure Check_Variant (Variant : Node_Id) is Clist : constant Node_Id := Component_List (Variant); Comp : Node_Id; --- 1979,1985 ---- -- Check_Variant -- ------------------- ! procedure Check_Variant (Variant : Node_Id; UU_Typ : Entity_Id) is Clist : constant Node_Id := Component_List (Variant); Comp : Node_Id; *************** package body Sem_Prag is *** 1733,1739 **** Comp := First (Component_Items (Clist)); while Present (Comp) loop ! Check_Component (Comp); Next (Comp); end loop; end Check_Variant; --- 1993,1999 ---- Comp := First (Component_Items (Clist)); while Present (Comp) loop ! Check_Component (Comp, UU_Typ, In_Variant_Part => True); Next (Comp); end loop; end Check_Variant; *************** package body Sem_Prag is *** 1743,1751 **** ------------------ procedure Error_Pragma (Msg : String) is begin Error_Msg_Name_1 := Pname; ! Error_Msg_N (Msg, N); raise Pragma_Exit; end Error_Pragma; --- 2003,2013 ---- ------------------ procedure Error_Pragma (Msg : String) is + MsgF : String := Msg; begin Error_Msg_Name_1 := Pname; ! Fix_Error (MsgF); ! Error_Msg_N (MsgF, N); raise Pragma_Exit; end Error_Pragma; *************** package body Sem_Prag is *** 1754,1769 **** ---------------------- procedure Error_Pragma_Arg (Msg : String; Arg : Node_Id) is begin Error_Msg_Name_1 := Pname; ! Error_Msg_N (Msg, Get_Pragma_Arg (Arg)); raise Pragma_Exit; end Error_Pragma_Arg; procedure Error_Pragma_Arg (Msg1, Msg2 : String; Arg : Node_Id) is begin Error_Msg_Name_1 := Pname; ! Error_Msg_N (Msg1, Get_Pragma_Arg (Arg)); Error_Pragma_Arg (Msg2, Arg); end Error_Pragma_Arg; --- 2016,2035 ---- ---------------------- procedure Error_Pragma_Arg (Msg : String; Arg : Node_Id) is + MsgF : String := Msg; begin Error_Msg_Name_1 := Pname; ! Fix_Error (MsgF); ! Error_Msg_N (MsgF, Get_Pragma_Arg (Arg)); raise Pragma_Exit; end Error_Pragma_Arg; procedure Error_Pragma_Arg (Msg1, Msg2 : String; Arg : Node_Id) is + MsgF : String := Msg1; begin Error_Msg_Name_1 := Pname; ! Fix_Error (MsgF); ! Error_Msg_N (MsgF, Get_Pragma_Arg (Arg)); Error_Pragma_Arg (Msg2, Arg); end Error_Pragma_Arg; *************** package body Sem_Prag is *** 1772,1780 **** ---------------------------- procedure Error_Pragma_Arg_Ident (Msg : String; Arg : Node_Id) is begin Error_Msg_Name_1 := Pname; ! Error_Msg_N (Msg, Arg); raise Pragma_Exit; end Error_Pragma_Arg_Ident; --- 2038,2048 ---- ---------------------------- procedure Error_Pragma_Arg_Ident (Msg : String; Arg : Node_Id) is + MsgF : String := Msg; begin Error_Msg_Name_1 := Pname; ! Fix_Error (MsgF); ! Error_Msg_N (MsgF, Arg); raise Pragma_Exit; end Error_Pragma_Arg_Ident; *************** package body Sem_Prag is *** 1783,1792 **** ---------------------- 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; --- 2051,2062 ---- ---------------------- procedure Error_Pragma_Ref (Msg : String; Ref : Entity_Id) is + MsgF : String := Msg; begin Error_Msg_Name_1 := Pname; + Fix_Error (MsgF); Error_Msg_Sloc := Sloc (Ref); ! Error_Msg_NE (MsgF, N, Ref); raise Pragma_Exit; end Error_Pragma_Ref; *************** package body Sem_Prag is *** 1867,1873 **** Proc := Entity (Name); if Ekind (Proc) /= E_Procedure ! or else Present (First_Formal (Proc)) then Error_Pragma_Arg ("argument of pragma% must be parameterless procedure", Arg); end if; --- 2137,2144 ---- Proc := Entity (Name); if Ekind (Proc) /= E_Procedure ! or else Present (First_Formal (Proc)) ! then Error_Pragma_Arg ("argument of pragma% must be parameterless procedure", Arg); end if; *************** package body Sem_Prag is *** 1912,1917 **** --- 2183,2209 ---- return Proc; end Find_Unique_Parameterless_Procedure; + --------------- + -- Fix_Error -- + --------------- + + procedure Fix_Error (Msg : in out String) is + begin + if From_Aspect_Specification (N) then + for J in Msg'First .. Msg'Last - 5 loop + if Msg (J .. J + 5) = "pragma" then + Msg (J .. J + 5) := "aspect"; + end if; + end loop; + + if Error_Msg_Name_1 = Name_Precondition then + Error_Msg_Name_1 := Name_Pre; + elsif Error_Msg_Name_1 = Name_Postcondition then + Error_Msg_Name_1 := Name_Post; + end if; + end if; + end Fix_Error; + ------------------------- -- Gather_Associations -- ------------------------- *************** package body Sem_Prag is *** 1940,1946 **** Arg := First (Pragma_Argument_Associations (N)); for Index in Args'Range loop exit when No (Arg) or else Chars (Arg) /= No_Name; ! Args (Index) := Expression (Arg); Next (Arg); end loop; --- 2232,2238 ---- Arg := First (Pragma_Argument_Associations (N)); for Index in Args'Range loop exit when No (Arg) or else Chars (Arg) /= No_Name; ! Args (Index) := Get_Pragma_Arg (Arg); Next (Arg); end loop; *************** package body Sem_Prag is *** 1967,1973 **** Error_Pragma_Arg ("duplicate argument association for pragma%", Arg); else ! Args (Index) := Expression (Arg); exit; end if; end if; --- 2259,2265 ---- Error_Pragma_Arg ("duplicate argument association for pragma%", Arg); else ! Args (Index) := Get_Pragma_Arg (Arg); exit; end if; end if; *************** package body Sem_Prag is *** 2148,2156 **** procedure Set_Atomic (E : Entity_Id) is begin ! Set_Is_Atomic (E); ! if not Has_Alignment_Clause (E) then Set_Alignment (E, Uint_0); end if; end Set_Atomic; --- 2440,2448 ---- procedure Set_Atomic (E : Entity_Id) is begin ! Set_Is_Atomic (E, Sense); ! if Sense and then not Has_Alignment_Clause (E) then Set_Alignment (E, Uint_0); end if; end Set_Atomic; *************** package body Sem_Prag is *** 2162,2168 **** Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Etype (E_Id) = Any_Type then return; --- 2454,2460 ---- Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Etype (E_Id) = Any_Type then return; *************** package body Sem_Prag is *** 2172,2177 **** --- 2464,2475 ---- D := Declaration_Node (E); K := Nkind (D); + -- Check duplicate before we chain ourselves! + + Check_Duplicate_Pragma (E); + + -- Now check appropriateness of the entity + if Is_Type (E) then if Rep_Item_Too_Early (E, N) or else *************** package body Sem_Prag is *** 2191,2201 **** -- 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)); ! Set_Treat_As_Volatile (E); ! Set_Treat_As_Volatile (Underlying_Type (E)); elsif K = N_Object_Declaration or else (K = N_Component_Declaration --- 2489,2499 ---- -- 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), Sense); ! Set_Is_Volatile (Underlying_Type (E), Sense); ! Set_Treat_As_Volatile (E, Sense); ! Set_Treat_As_Volatile (Underlying_Type (E), Sense); elsif K = N_Object_Declaration or else (K = N_Component_Declaration *************** package body Sem_Prag is *** 2206,2212 **** end if; 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 --- 2504,2510 ---- end if; if Prag_Id /= Pragma_Volatile then ! Set_Is_Atomic (E, Sense); -- If the object declaration has an explicit initialization, a -- temporary may have to be created to hold the expression, to *************** package body Sem_Prag is *** 2214,2219 **** --- 2512,2518 ---- if Nkind (Parent (E)) = N_Object_Declaration and then Present (Expression (Parent (E))) + and then Sense then Set_Has_Delayed_Freeze (E); end if; *************** package body Sem_Prag is *** 2234,2240 **** Get_Source_File_Index (Sloc (E)) = Get_Source_File_Index (Sloc (Underlying_Type (Etype (E)))) then ! Set_Is_Atomic (Underlying_Type (Etype (E))); end if; end if; --- 2533,2539 ---- Get_Source_File_Index (Sloc (E)) = Get_Source_File_Index (Sloc (Underlying_Type (Etype (E)))) then ! Set_Is_Atomic (Underlying_Type (Etype (E)), Sense); end if; end if; *************** package body Sem_Prag is *** 2334,2340 **** -- need to force visibility for client (error will be -- output in any case, and this is the situation in which -- we do not want a client to get a warning, since the ! -- warning is in the body or the spec private part. else if Cont = False then --- 2633,2639 ---- -- need to force visibility for client (error will be -- output in any case, and this is the situation in which -- we do not want a client to get a warning, since the ! -- warning is in the body or the spec private part). else if Cont = False then *************** package body Sem_Prag is *** 2366,2377 **** --- 2665,2840 ---- Cname : Name_Id; Comp_Unit : Unit_Number_Type; + procedure Diagnose_Multiple_Pragmas (S : Entity_Id); + -- Called if we have more than one Export/Import/Convention pragma. + -- This is generally illegal, but we have a special case of allowing + -- Import and Interface to coexist if they specify the convention in + -- a consistent manner. We are allowed to do this, since Interface is + -- an implementation defined pragma, and we choose to do it since we + -- know Rational allows this combination. S is the entity id of the + -- subprogram in question. This procedure also sets the special flag + -- Import_Interface_Present in both pragmas in the case where we do + -- have matching Import and Interface pragmas. + procedure Set_Convention_From_Pragma (E : Entity_Id); -- Set convention in entity E, and also flag that the entity has a -- convention pragma. If entity is for a private or incomplete type, -- also set convention and flag on underlying type. This procedure -- also deals with the special case of C_Pass_By_Copy convention. + ------------------------------- + -- Diagnose_Multiple_Pragmas -- + ------------------------------- + + procedure Diagnose_Multiple_Pragmas (S : Entity_Id) is + Pdec : constant Node_Id := Declaration_Node (S); + Decl : Node_Id; + Err : Boolean; + + function Same_Convention (Decl : Node_Id) return Boolean; + -- Decl is a pragma node. This function returns True if this + -- pragma has a first argument that is an identifier with a + -- Chars field corresponding to the Convention_Id C. + + function Same_Name (Decl : Node_Id) return Boolean; + -- Decl is a pragma node. This function returns True if this + -- pragma has a second argument that is an identifier with a + -- Chars field that matches the Chars of the current subprogram. + + --------------------- + -- Same_Convention -- + --------------------- + + function Same_Convention (Decl : Node_Id) return Boolean is + Arg1 : constant Node_Id := + First (Pragma_Argument_Associations (Decl)); + + begin + if Present (Arg1) then + declare + Arg : constant Node_Id := Get_Pragma_Arg (Arg1); + begin + if Nkind (Arg) = N_Identifier + and then Is_Convention_Name (Chars (Arg)) + and then Get_Convention_Id (Chars (Arg)) = C + then + return True; + end if; + end; + end if; + + return False; + end Same_Convention; + + --------------- + -- Same_Name -- + --------------- + + function Same_Name (Decl : Node_Id) return Boolean is + Arg1 : constant Node_Id := + First (Pragma_Argument_Associations (Decl)); + Arg2 : Node_Id; + + begin + if No (Arg1) then + return False; + end if; + + Arg2 := Next (Arg1); + + if No (Arg2) then + return False; + end if; + + declare + Arg : constant Node_Id := Get_Pragma_Arg (Arg2); + begin + if Nkind (Arg) = N_Identifier + and then Chars (Arg) = Chars (S) + then + return True; + end if; + end; + + return False; + end Same_Name; + + -- Start of processing for Diagnose_Multiple_Pragmas + + begin + Err := True; + + -- Definitely give message if we have Convention/Export here + + if Prag_Id = Pragma_Convention or else Prag_Id = Pragma_Export then + null; + + -- If we have an Import or Export, scan back from pragma to + -- find any previous pragma applying to the same procedure. + -- The scan will be terminated by the start of the list, or + -- hitting the subprogram declaration. This won't allow one + -- pragma to appear in the public part and one in the private + -- part, but that seems very unlikely in practice. + + else + Decl := Prev (N); + while Present (Decl) and then Decl /= Pdec loop + + -- Look for pragma with same name as us + + if Nkind (Decl) = N_Pragma + and then Same_Name (Decl) + then + -- Give error if same as our pragma or Export/Convention + + if Pragma_Name (Decl) = Name_Export + or else + Pragma_Name (Decl) = Name_Convention + or else + Pragma_Name (Decl) = Pragma_Name (N) + then + exit; + + -- Case of Import/Interface or the other way round + + elsif Pragma_Name (Decl) = Name_Interface + or else + Pragma_Name (Decl) = Name_Import + then + -- Here we know that we have Import and Interface. It + -- doesn't matter which way round they are. See if + -- they specify the same convention. If so, all OK, + -- and set special flags to stop other messages + + if Same_Convention (Decl) then + Set_Import_Interface_Present (N); + Set_Import_Interface_Present (Decl); + Err := False; + + -- If different conventions, special message + + else + Error_Msg_Sloc := Sloc (Decl); + Error_Pragma_Arg + ("convention differs from that given#", Arg1); + return; + end if; + end if; + end if; + + Next (Decl); + end loop; + end if; + + -- Give message if needed if we fall through those tests + + if Err then + Error_Pragma_Arg + ("at most one Convention/Export/Import pragma is allowed", + Arg2); + end if; + end Diagnose_Multiple_Pragmas; + -------------------------------- -- Set_Convention_From_Pragma -- -------------------------------- *************** package body Sem_Prag is *** 2453,2469 **** Check_At_Least_N_Arguments (2); Check_Optional_Identifier (Arg1, Name_Convention); Check_Arg_Is_Identifier (Arg1); ! Cname := Chars (Expression (Arg1)); -- C_Pass_By_Copy is treated as a synonym for convention C (this is -- tested again below to set the critical flag). if Cname = Name_C_Pass_By_Copy then C := Convention_C; -- Otherwise we must have something in the standard convention list elsif Is_Convention_Name (Cname) then ! C := Get_Convention_Id (Chars (Expression (Arg1))); -- In DEC VMS, it seems that there is an undocumented feature that -- any unrecognized convention is treated as the default, which for --- 2916,2933 ---- Check_At_Least_N_Arguments (2); Check_Optional_Identifier (Arg1, Name_Convention); Check_Arg_Is_Identifier (Arg1); ! Cname := Chars (Get_Pragma_Arg (Arg1)); -- C_Pass_By_Copy is treated as a synonym for convention C (this is -- tested again below to set the critical flag). + if Cname = Name_C_Pass_By_Copy then C := Convention_C; -- Otherwise we must have something in the standard convention list elsif Is_Convention_Name (Cname) then ! C := Get_Convention_Id (Chars (Get_Pragma_Arg (Arg1))); -- In DEC VMS, it seems that there is an undocumented feature that -- any unrecognized convention is treated as the default, which for *************** package body Sem_Prag is *** 2475,2481 **** if Warn_On_Export_Import and not OpenVMS_On_Target then Error_Msg_N ("?unrecognized convention name, C assumed", ! Expression (Arg1)); end if; C := Convention_C; --- 2939,2945 ---- if Warn_On_Export_Import and not OpenVMS_On_Target then Error_Msg_N ("?unrecognized convention name, C assumed", ! Get_Pragma_Arg (Arg1)); end if; C := Convention_C; *************** package body Sem_Prag is *** 2484,2490 **** Check_Optional_Identifier (Arg2, Name_Entity); Check_Arg_Is_Local_Name (Arg2); ! Id := Expression (Arg2); Analyze (Id); if not Is_Entity_Name (Id) then --- 2948,2954 ---- Check_Optional_Identifier (Arg2, Name_Entity); Check_Arg_Is_Local_Name (Arg2); ! Id := Get_Pragma_Arg (Arg2); Analyze (Id); if not Is_Entity_Name (Id) then *************** package body Sem_Prag is *** 2537,2546 **** -- Check that we are not applying this to a named constant ! if Ekind (E) = E_Named_Integer ! or else ! Ekind (E) = E_Named_Real ! then Error_Msg_Name_1 := Pname; Error_Msg_N ("cannot apply pragma% to named constant!", --- 3001,3007 ---- -- Check that we are not applying this to a named constant ! if Ekind_In (E, E_Named_Integer, E_Named_Real) then Error_Msg_Name_1 := Pname; Error_Msg_N ("cannot apply pragma% to named constant!", *************** package body Sem_Prag is *** 2568,2575 **** end if; if Has_Convention_Pragma (E) then ! Error_Pragma_Arg ! ("at most one Convention/Export/Import pragma is allowed", Arg2); elsif Convention (E) = Convention_Protected or else Ekind (Scope (E)) = E_Protected_Type --- 3029,3035 ---- end if; if Has_Convention_Pragma (E) then ! Diagnose_Multiple_Pragmas (E); elsif Convention (E) = Convention_Protected or else Ekind (Scope (E)) = E_Protected_Type *************** package body Sem_Prag is *** 2597,2603 **** and then Ekind (E) /= E_Variable and then not (Is_Access_Type (E) ! and then Ekind (Designated_Type (E)) = E_Subprogram_Type) then Error_Pragma_Arg ("second argument of pragma% must be subprogram (type)", --- 3057,3063 ---- and then Ekind (E) /= E_Variable and then not (Is_Access_Type (E) ! and then Ekind (Designated_Type (E)) = E_Subprogram_Type) then Error_Pragma_Arg ("second argument of pragma% must be subprogram (type)", *************** package body Sem_Prag is *** 2610,2616 **** Set_Convention_From_Pragma (E); if Is_Type (E) then - Check_First_Subtype (Arg2); Set_Convention_From_Pragma (Base_Type (E)); --- 3070,3075 ---- *************** package body Sem_Prag is *** 2666,2671 **** --- 3125,3134 ---- Generate_Reference (E1, Id, 'b'); end if; end if; + + -- For aspect case, do NOT apply to homonyms + + exit when From_Aspect_Specification (N); end loop; end if; end Process_Convention; *************** package body Sem_Prag is *** 2778,2786 **** Process_Extended_Import_Export_Internal_Arg (Arg_Internal); Def_Id := Entity (Arg_Internal); ! if Ekind (Def_Id) /= E_Constant ! and then Ekind (Def_Id) /= E_Variable ! then Error_Pragma_Arg ("pragma% must designate an object", Arg_Internal); end if; --- 3241,3247 ---- Process_Extended_Import_Export_Internal_Arg (Arg_Internal); Def_Id := Entity (Arg_Internal); ! if not Ekind_In (Def_Id, E_Constant, E_Variable) then Error_Pragma_Arg ("pragma% must designate an object", Arg_Internal); end if; *************** package body Sem_Prag is *** 3132,3138 **** Prag_Id = Pragma_Import_Valued_Procedure then if not Is_Imported (Ent) then ! Error_Pragma -- CODEFIX??? ("pragma Import or Interface must precede pragma%"); end if; --- 3593,3599 ---- Prag_Id = Pragma_Import_Valued_Procedure then if not Is_Imported (Ent) then ! Error_Pragma ("pragma Import or Interface must precede pragma%"); end if; *************** package body Sem_Prag is *** 3269,3275 **** Set_Mechanism_Value (Formal, Expression (Massoc)); ! -- Set entity on identifier for ASIS Set_Entity (Choice, Formal); --- 3730,3736 ---- Set_Mechanism_Value (Formal, Expression (Massoc)); ! -- Set entity on identifier (needed by ASIS) Set_Entity (Choice, Formal); *************** package body Sem_Prag is *** 3358,3364 **** Arg := Arg1; while Present (Arg) loop ! Exp := Expression (Arg); Analyze (Exp); if not Is_Entity_Name (Exp) --- 3819,3825 ---- Arg := Arg1; while Present (Arg) loop ! Exp := Get_Pragma_Arg (Arg); Analyze (Exp); if not Is_Entity_Name (Exp) *************** package body Sem_Prag is *** 3388,3399 **** begin Process_Convention (C, Def_Id); Kill_Size_Check_Code (Def_Id); ! Note_Possible_Modification (Expression (Arg2), Sure => False); - if Ekind (Def_Id) = E_Variable - or else - Ekind (Def_Id) = E_Constant - then -- We do not permit Import to apply to a renaming declaration if Present (Renamed_Object (Def_Id)) then --- 3849,3858 ---- begin Process_Convention (C, Def_Id); Kill_Size_Check_Code (Def_Id); ! Note_Possible_Modification (Get_Pragma_Arg (Arg2), Sure => False); ! ! if Ekind_In (Def_Id, E_Variable, E_Constant) then -- We do not permit Import to apply to a renaming declaration if Present (Renamed_Object (Def_Id)) then *************** package body Sem_Prag is *** 3446,3460 **** elsif Is_Subprogram (Def_Id) or else Is_Generic_Subprogram (Def_Id) then ! -- If the name is overloaded, pragma applies to all of the ! -- denoted entities in the same declarative part. Hom_Id := Def_Id; while Present (Hom_Id) loop Def_Id := Get_Base_Subprogram (Hom_Id); ! -- Ignore inherited subprograms because the pragma will ! -- apply to the parent operation, which is the one called. if Is_Overloadable (Def_Id) and then Present (Alias (Def_Id)) --- 3905,3919 ---- elsif Is_Subprogram (Def_Id) or else Is_Generic_Subprogram (Def_Id) then ! -- If the name is overloaded, pragma applies to all of the denoted ! -- entities in the same declarative part. Hom_Id := Def_Id; while Present (Hom_Id) loop Def_Id := Get_Base_Subprogram (Hom_Id); ! -- Ignore inherited subprograms because the pragma will apply ! -- to the parent operation, which is the one called. if Is_Overloadable (Def_Id) and then Present (Alias (Def_Id)) *************** package body Sem_Prag is *** 3469,3474 **** --- 3928,3941 ---- then null; + -- The pragma does not apply to primitives of interfaces + + elsif Is_Dispatching_Operation (Def_Id) + and then Present (Find_Dispatching_Type (Def_Id)) + and then Is_Interface (Find_Dispatching_Type (Def_Id)) + then + null; + -- Verify that the homonym is in the same declarative part (not -- just the same scope). *************** package body Sem_Prag is *** 3517,3523 **** -- is present, then this is handled by the back end. if No (Arg3) then ! Check_Intrinsic_Subprogram (Def_Id, Expression (Arg2)); end if; end if; --- 3984,3991 ---- -- is present, then this is handled by the back end. if No (Arg3) then ! Check_Intrinsic_Subprogram ! (Def_Id, Get_Pragma_Arg (Arg2)); end if; end if; *************** package body Sem_Prag is *** 3587,3596 **** and then C = Convention_CPP then -- Types treated as CPP classes are treated as limited, but we ! -- don't require them to be declared this way. A warning is ! -- issued to encourage the user to declare them as limited. ! -- This is not an error, for compatibility reasons, because ! -- these types have been supported this way for some time. if not Is_Limited_Type (Def_Id) then Error_Msg_N --- 4055,4064 ---- and then C = Convention_CPP then -- Types treated as CPP classes are treated as limited, but we ! -- don't require them to be declared this way. A warning is issued ! -- to encourage the user to declare them as limited. This is not ! -- an error, for compatibility reasons, because these types have ! -- been supported this way for some time. if not Is_Limited_Type (Def_Id) then Error_Msg_N *************** package body Sem_Prag is *** 3821,3829 **** -- entity (if declared in the same unit) is inlined. if Is_Subprogram (Subp) then ! while Present (Alias (Inner_Subp)) loop ! Inner_Subp := Alias (Inner_Subp); ! end loop; if In_Same_Source_Unit (Subp, Inner_Subp) then Set_Inline_Flags (Inner_Subp); --- 4289,4300 ---- -- entity (if declared in the same unit) is inlined. if Is_Subprogram (Subp) then ! ! if not Sense then ! return; ! end if; ! ! Inner_Subp := Ultimate_Alias (Inner_Subp); if In_Same_Source_Unit (Subp, Inner_Subp) then Set_Inline_Flags (Inner_Subp); *************** package body Sem_Prag is *** 3883,3898 **** procedure Set_Inline_Flags (Subp : Entity_Id) is begin if Active then ! Set_Is_Inlined (Subp, True); end if; if not Has_Pragma_Inline (Subp) then ! Set_Has_Pragma_Inline (Subp); Effective := True; end if; if Prag_Id = Pragma_Inline_Always then ! Set_Has_Pragma_Inline_Always (Subp); end if; end Set_Inline_Flags; --- 4354,4369 ---- procedure Set_Inline_Flags (Subp : Entity_Id) is begin if Active then ! Set_Is_Inlined (Subp, Sense); end if; if not Has_Pragma_Inline (Subp) then ! Set_Has_Pragma_Inline (Subp, Sense); Effective := True; end if; if Prag_Id = Pragma_Inline_Always then ! Set_Has_Pragma_Inline_Always (Subp, Sense); end if; end Set_Inline_Flags; *************** package body Sem_Prag is *** 3908,3914 **** Assoc := Arg1; while Present (Assoc) loop ! Subp_Id := Expression (Assoc); Analyze (Subp_Id); Applies := False; --- 4379,4385 ---- Assoc := Arg1; while Present (Assoc) loop ! Subp_Id := Get_Pragma_Arg (Assoc); Analyze (Subp_Id); Applies := False; *************** package body Sem_Prag is *** 3925,3936 **** else Make_Inline (Subp); ! while Present (Homonym (Subp)) ! and then Scope (Homonym (Subp)) = Current_Scope ! loop ! Make_Inline (Homonym (Subp)); ! Subp := Homonym (Subp); ! end loop; end if; end if; --- 4396,4409 ---- else Make_Inline (Subp); ! if not From_Aspect_Specification (N) then ! while Present (Homonym (Subp)) ! and then Scope (Homonym (Subp)) = Current_Scope ! loop ! Make_Inline (Homonym (Subp)); ! Subp := Homonym (Subp); ! end loop; ! end if; end if; end if; *************** package body Sem_Prag is *** 4140,4146 **** Set_Encoded_Interface_Name (Get_Base_Subprogram (Subprogram_Def), Link_Nam); ! Check_Duplicated_Export_Name (Link_Nam); end Process_Interface_Name; ----------------------------------------- --- 4613,4626 ---- Set_Encoded_Interface_Name (Get_Base_Subprogram (Subprogram_Def), Link_Nam); ! ! -- We allow duplicated export names in CIL, as they are always ! -- enclosed in a namespace that differentiates them, and overloaded ! -- entities are supported by the VM. ! ! if Convention (Subprogram_Def) /= Convention_CIL then ! Check_Duplicated_Export_Name (Link_Nam); ! end if; end Process_Interface_Name; ----------------------------------------- *************** package body Sem_Prag is *** 4148,4154 **** ----------------------------------------- procedure Process_Interrupt_Or_Attach_Handler is ! Arg1_X : constant Node_Id := Expression (Arg1); Handler_Proc : constant Entity_Id := Entity (Arg1_X); Proc_Scope : constant Entity_Id := Scope (Handler_Proc); --- 4628,4634 ---- ----------------------------------------- procedure Process_Interrupt_Or_Attach_Handler is ! Arg1_X : constant Node_Id := Get_Pragma_Arg (Arg1); Handler_Proc : constant Entity_Id := Entity (Arg1_X); Proc_Scope : constant Entity_Id := Scope (Handler_Proc); *************** package body Sem_Prag is *** 4213,4218 **** --- 4693,4704 ---- -- Start of processing for Process_Restrictions_Or_Restriction_Warnings begin + -- Ignore all Restrictions pragma in CodePeer mode + + if CodePeer_Mode then + return; + end if; + Check_Ada_83_Warning; Check_At_Least_N_Arguments (1); Check_Valid_Configuration_Pragma; *************** package body Sem_Prag is *** 4220,4226 **** Arg := Arg1; while Present (Arg) loop Id := Chars (Arg); ! Expr := Expression (Arg); -- Case of no restriction identifier present --- 4706,4712 ---- Arg := Arg1; while Present (Arg) loop Id := Chars (Arg); ! Expr := Get_Pragma_Arg (Arg); -- Case of no restriction identifier present *************** package body Sem_Prag is *** 4290,4295 **** --- 4776,4794 ---- Restriction_Warnings (R_Id) := False; end if; + -- Check for obsolescent restrictions in Ada 2005 mode + + if not Warn + and then Ada_Version >= Ada_2005 + and then (R_Id = No_Asynchronous_Control + or else + R_Id = No_Unchecked_Deallocation + or else + R_Id = No_Unchecked_Conversion) + then + Check_Restriction (No_Obsolescent_Features, N); + end if; + -- A very special case that must be processed here: pragma -- Restrictions (No_Exceptions) turns off all run-time -- checking. This is a bit dubious in terms of the formal *************** package body Sem_Prag is *** 4418,4423 **** --- 4917,4929 ---- -- Start of processing for Process_Suppress_Unsuppress begin + -- Ignore pragma Suppress/Unsuppress in codepeer mode on user code: + -- we want to generate checks for analysis purposes, as set by -gnatC + + if CodePeer_Mode and then Comes_From_Source (N) then + return; + end if; + -- Suppress/Unsuppress can appear as a configuration pragma, or in a -- declarative part or a package spec (RM 11.5(5)). *************** package body Sem_Prag is *** 4430,4436 **** Check_No_Identifier (Arg1); Check_Arg_Is_Identifier (Arg1); ! C := Get_Check_Id (Chars (Expression (Arg1))); if C = No_Check_Id then Error_Pragma_Arg --- 4936,4942 ---- Check_No_Identifier (Arg1); Check_Arg_Is_Identifier (Arg1); ! C := Get_Check_Id (Chars (Get_Pragma_Arg (Arg1))); if C = No_Check_Id then Error_Pragma_Arg *************** package body Sem_Prag is *** 4481,4488 **** -- a specified entity (given as the second argument of the pragma) else Check_Optional_Identifier (Arg2, Name_On); ! E_Id := Expression (Arg2); Analyze (E_Id); if not Is_Entity_Name (E_Id) then --- 4987,5000 ---- -- a specified entity (given as the second argument of the pragma) else + -- This is obsolescent in Ada 2005 mode + + if Ada_Version >= Ada_2005 then + Check_Restriction (No_Obsolescent_Features, Arg2); + end if; + Check_Optional_Identifier (Arg2, Name_On); ! E_Id := Get_Pragma_Arg (Arg2); Analyze (E_Id); if not Is_Entity_Name (E_Id) then *************** package body Sem_Prag is *** 4524,4531 **** Suppress_Unsuppress_Echeck (Alias (E), C); end if; ! -- Move to next homonym E := Homonym (E); exit when No (E); --- 5036,5044 ---- Suppress_Unsuppress_Echeck (Alias (E), C); end if; ! -- Move to next homonym if not aspect spec case + exit when From_Aspect_Specification (N); E := Homonym (E); exit when No (E); *************** package body Sem_Prag is *** 4548,4554 **** Error_Pragma_Arg ("cannot export entity& that was previously imported", Arg); ! elsif Present (Address_Clause (E)) then Error_Pragma_Arg ("cannot export entity& that has an address clause", Arg); end if; --- 5061,5067 ---- Error_Pragma_Arg ("cannot export entity& that was previously imported", Arg); ! elsif Present (Address_Clause (E)) and then not CodePeer_Mode then Error_Pragma_Arg ("cannot export entity& that has an address clause", Arg); end if; *************** package body Sem_Prag is *** 4594,4601 **** end if; if Warn_On_Export_Import and then Is_Type (E) then ! Error_Msg_NE ! ("exporting a type has no effect?", Arg, E); end if; if Warn_On_Export_Import and Inside_A_Generic then --- 5107,5113 ---- end if; if Warn_On_Export_Import and then Is_Type (E) then ! Error_Msg_NE ("exporting a type has no effect?", Arg, E); end if; if Warn_On_Export_Import and Inside_A_Generic then *************** package body Sem_Prag is *** 4695,4702 **** --- 5207,5225 ---- -- Error message if already imported or exported if Is_Exported (E) or else Is_Imported (E) then + + -- Error if being set Exported twice + if Is_Exported (E) then Error_Msg_NE ("entity& was previously exported", N, E); + + -- OK if Import/Interface case + + elsif Import_Interface_Present (N) then + goto OK; + + -- Error if being set Imported twice + else Error_Msg_NE ("entity& was previously imported", N, E); end if; *************** package body Sem_Prag is *** 4725,4730 **** --- 5248,5255 ---- Set_Is_Statically_Allocated (E); end if; end if; + + <> null; end Set_Imported; ------------------------- *************** package body Sem_Prag is *** 4736,4743 **** -- form created by the parser. procedure Set_Mechanism_Value (Ent : Entity_Id; Mech_Name : Node_Id) is ! Class : Node_Id; ! Param : Node_Id; Mech_Name_Id : Name_Id; procedure Bad_Class; --- 5261,5268 ---- -- form created by the parser. procedure Set_Mechanism_Value (Ent : Entity_Id; Mech_Name : Node_Id) is ! Class : Node_Id; ! Param : Node_Id; Mech_Name_Id : Name_Id; procedure Bad_Class; *************** package body Sem_Prag is *** 4786,4792 **** elsif Chars (Mech_Name) = Name_Descriptor then Check_VMS (Mech_Name); ! Set_Mechanism (Ent, By_Descriptor); return; elsif Chars (Mech_Name) = Name_Short_Descriptor then --- 5311,5325 ---- elsif Chars (Mech_Name) = Name_Descriptor then Check_VMS (Mech_Name); ! ! -- Descriptor => Short_Descriptor if pragma was given ! ! if Short_Descriptors then ! Set_Mechanism (Ent, By_Short_Descriptor); ! else ! Set_Mechanism (Ent, By_Descriptor); ! end if; ! return; elsif Chars (Mech_Name) = Name_Short_Descriptor then *************** package body Sem_Prag is *** 4809,4815 **** -- Note: this form is parsed as an indexed component elsif Nkind (Mech_Name) = N_Indexed_Component then - Class := First (Expressions (Mech_Name)); if Nkind (Prefix (Mech_Name)) /= N_Identifier --- 5342,5347 ---- *************** package body Sem_Prag is *** 4820,4825 **** --- 5352,5365 ---- Bad_Mechanism; else Mech_Name_Id := Chars (Prefix (Mech_Name)); + + -- Change Descriptor => Short_Descriptor if pragma was given + + if Mech_Name_Id = Name_Descriptor + and then Short_Descriptors + then + Mech_Name_Id := Name_Short_Descriptor; + end if; end if; -- MECHANISM_NAME ::= descriptor (Class => CLASS_NAME) | *************** package body Sem_Prag is *** 4829,4835 **** -- Note: this form is parsed as a function call elsif Nkind (Mech_Name) = N_Function_Call then - Param := First (Parameter_Associations (Mech_Name)); if Nkind (Name (Mech_Name)) /= N_Identifier --- 5369,5374 ---- *************** package body Sem_Prag is *** 4857,4928 **** Bad_Class; elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_UBS then Set_Mechanism (Ent, By_Descriptor_UBS); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_UBSB then Set_Mechanism (Ent, By_Descriptor_UBSB); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_UBA then Set_Mechanism (Ent, By_Descriptor_UBA); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_S then Set_Mechanism (Ent, By_Descriptor_S); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_SB then Set_Mechanism (Ent, By_Descriptor_SB); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_A then Set_Mechanism (Ent, By_Descriptor_A); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_NCA then Set_Mechanism (Ent, By_Descriptor_NCA); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_UBS then Set_Mechanism (Ent, By_Short_Descriptor_UBS); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_UBSB then Set_Mechanism (Ent, By_Short_Descriptor_UBSB); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_UBA then Set_Mechanism (Ent, By_Short_Descriptor_UBA); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_S then Set_Mechanism (Ent, By_Short_Descriptor_S); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_SB then Set_Mechanism (Ent, By_Short_Descriptor_SB); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_A then Set_Mechanism (Ent, By_Short_Descriptor_A); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_NCA then Set_Mechanism (Ent, By_Short_Descriptor_NCA); --- 5396,5467 ---- Bad_Class; elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_UBS then Set_Mechanism (Ent, By_Descriptor_UBS); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_UBSB then Set_Mechanism (Ent, By_Descriptor_UBSB); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_UBA then Set_Mechanism (Ent, By_Descriptor_UBA); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_S then Set_Mechanism (Ent, By_Descriptor_S); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_SB then Set_Mechanism (Ent, By_Descriptor_SB); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_A then Set_Mechanism (Ent, By_Descriptor_A); elsif Mech_Name_Id = Name_Descriptor ! and then Chars (Class) = Name_NCA then Set_Mechanism (Ent, By_Descriptor_NCA); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_UBS then Set_Mechanism (Ent, By_Short_Descriptor_UBS); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_UBSB then Set_Mechanism (Ent, By_Short_Descriptor_UBSB); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_UBA then Set_Mechanism (Ent, By_Short_Descriptor_UBA); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_S then Set_Mechanism (Ent, By_Short_Descriptor_S); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_SB then Set_Mechanism (Ent, By_Short_Descriptor_SB); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_A then Set_Mechanism (Ent, By_Short_Descriptor_A); elsif Mech_Name_Id = Name_Short_Descriptor ! and then Chars (Class) = Name_NCA then Set_Mechanism (Ent, By_Short_Descriptor_NCA); *************** package body Sem_Prag is *** 4946,4952 **** --- 5485,5504 ---- -- Set required restrictions (see System.Rident for detailed list) + -- Set the No_Dependence rules + -- No_Dependence => Ada.Asynchronous_Task_Control + -- No_Dependence => Ada.Calendar + -- No_Dependence => Ada.Execution_Time.Group_Budget + -- No_Dependence => Ada.Execution_Time.Timers + -- No_Dependence => Ada.Task_Attributes + -- No_Dependence => System.Multiprocessors.Dispatching_Domains + procedure Set_Ravenscar_Profile (N : Node_Id) is + Prefix_Entity : Entity_Id; + Selector_Entity : Entity_Id; + Prefix_Node : Node_Id; + Node : Node_Id; + begin -- pragma Task_Dispatching_Policy (FIFO_Within_Priorities) *************** package body Sem_Prag is *** 4995,5000 **** --- 5547,5652 ---- Set_Profile_Restrictions (Ravenscar, N, Warn => Treat_Restrictions_As_Warnings); + + -- Set the No_Dependence restrictions + + -- The following No_Dependence restrictions: + -- No_Dependence => Ada.Asynchronous_Task_Control + -- No_Dependence => Ada.Calendar + -- No_Dependence => Ada.Task_Attributes + -- are already set by previous call to Set_Profile_Restrictions. + + -- Set the following restrictions which were added to Ada 2005: + -- No_Dependence => Ada.Execution_Time.Group_Budget + -- No_Dependence => Ada.Execution_Time.Timers + + if Ada_Version >= Ada_2005 then + Name_Buffer (1 .. 3) := "ada"; + Name_Len := 3; + + Prefix_Entity := Make_Identifier (Loc, Name_Find); + + Name_Buffer (1 .. 14) := "execution_time"; + Name_Len := 14; + + Selector_Entity := Make_Identifier (Loc, Name_Find); + + Prefix_Node := + Make_Selected_Component + (Sloc => Loc, + Prefix => Prefix_Entity, + Selector_Name => Selector_Entity); + + Name_Buffer (1 .. 13) := "group_budgets"; + Name_Len := 13; + + Selector_Entity := Make_Identifier (Loc, Name_Find); + + Node := + Make_Selected_Component + (Sloc => Loc, + Prefix => Prefix_Node, + Selector_Name => Selector_Entity); + + Set_Restriction_No_Dependence + (Unit => Node, + Warn => Treat_Restrictions_As_Warnings, + Profile => Ravenscar); + + Name_Buffer (1 .. 6) := "timers"; + Name_Len := 6; + + Selector_Entity := Make_Identifier (Loc, Name_Find); + + Node := + Make_Selected_Component + (Sloc => Loc, + Prefix => Prefix_Node, + Selector_Name => Selector_Entity); + + Set_Restriction_No_Dependence + (Unit => Node, + Warn => Treat_Restrictions_As_Warnings, + Profile => Ravenscar); + end if; + + -- Set the following restrictions which was added to Ada 2012 (see + -- AI-0171): + -- No_Dependence => System.Multiprocessors.Dispatching_Domains + + if Ada_Version >= Ada_2012 then + Name_Buffer (1 .. 6) := "system"; + Name_Len := 6; + + Prefix_Entity := Make_Identifier (Loc, Name_Find); + + Name_Buffer (1 .. 15) := "multiprocessors"; + Name_Len := 15; + + Selector_Entity := Make_Identifier (Loc, Name_Find); + + Prefix_Node := + Make_Selected_Component + (Sloc => Loc, + Prefix => Prefix_Entity, + Selector_Name => Selector_Entity); + + Name_Buffer (1 .. 19) := "dispatching_domains"; + Name_Len := 19; + + Selector_Entity := Make_Identifier (Loc, Name_Find); + + Node := + Make_Selected_Component + (Sloc => Loc, + Prefix => Prefix_Node, + Selector_Name => Selector_Entity); + + Set_Restriction_No_Dependence + (Unit => Node, + Warn => Treat_Restrictions_As_Warnings, + Profile => Ravenscar); + end if; end Set_Ravenscar_Profile; -- Start of processing for Analyze_Pragma *************** package body Sem_Prag is *** 5105,5114 **** -- said this was a configuration pragma, but we did not check and -- are hesitant to add the check now. ! -- However, we really cannot tolerate mixing Ada 2005 with Ada 83 ! -- or Ada 95, so we must check if we are in Ada 2005 mode. ! if Ada_Version >= Ada_05 then Check_Valid_Configuration_Pragma; end if; --- 5757,5767 ---- -- said this was a configuration pragma, but we did not check and -- are hesitant to add the check now. ! -- However, we really cannot tolerate mixing Ada 2005 or Ada 2012 ! -- with Ada 83 or Ada 95, so we must check if we are in Ada 2005 ! -- or Ada 2012 mode. ! if Ada_Version >= Ada_2005 then Check_Valid_Configuration_Pragma; end if; *************** package body Sem_Prag is *** 5139,5145 **** -- However, we really cannot tolerate mixing Ada 2005 with Ada 83 -- or Ada 95, so we must check if we are in Ada 2005 mode. ! if Ada_Version >= Ada_05 then Check_Valid_Configuration_Pragma; end if; --- 5792,5798 ---- -- However, we really cannot tolerate mixing Ada 2005 with Ada 83 -- or Ada 95, so we must check if we are in Ada 2005 mode. ! if Ada_Version >= Ada_2005 then Check_Valid_Configuration_Pragma; end if; *************** package body Sem_Prag is *** 5158,5164 **** -- pragma Ada_2005; -- pragma Ada_2005 (LOCAL_NAME): ! -- Note: these pragma also have some specific processing in Par.Prag -- because we want to set the Ada 2005 version mode during parsing. when Pragma_Ada_05 | Pragma_Ada_2005 => declare --- 5811,5817 ---- -- pragma Ada_2005; -- pragma Ada_2005 (LOCAL_NAME): ! -- Note: these pragmas also have some specific processing in Par.Prag -- because we want to set the Ada 2005 version mode during parsing. when Pragma_Ada_05 | Pragma_Ada_2005 => declare *************** package body Sem_Prag is *** 5169,5175 **** if Arg_Count = 1 then Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Etype (E_Id) = Any_Type then return; --- 5822,5828 ---- if Arg_Count = 1 then Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Etype (E_Id) = Any_Type then return; *************** package body Sem_Prag is *** 5188,5197 **** Check_Valid_Configuration_Pragma; ! -- Now set Ada 2005 mode ! Ada_Version := Ada_05; ! Ada_Version_Explicit := Ada_05; end if; end; --- 5841,5908 ---- Check_Valid_Configuration_Pragma; ! -- Now set appropriate Ada mode ! if Sense then ! Ada_Version := Ada_2005; ! else ! Ada_Version := Ada_Version_Default; ! end if; ! ! Ada_Version_Explicit := Ada_2005; ! end if; ! end; ! ! --------------------- ! -- Ada_12/Ada_2012 -- ! --------------------- ! ! -- pragma Ada_12; ! -- pragma Ada_12 (LOCAL_NAME); ! ! -- pragma Ada_2012; ! -- pragma Ada_2012 (LOCAL_NAME): ! ! -- Note: these pragmas also have some specific processing in Par.Prag ! -- because we want to set the Ada 2012 version mode during parsing. ! ! when Pragma_Ada_12 | Pragma_Ada_2012 => declare ! E_Id : Node_Id; ! ! begin ! GNAT_Pragma; ! ! if Arg_Count = 1 then ! Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); ! ! if Etype (E_Id) = Any_Type then ! return; ! end if; ! ! Set_Is_Ada_2012_Only (Entity (E_Id)); ! ! else ! Check_Arg_Count (0); ! ! -- For Ada_2012 we unconditionally enforce the documented ! -- configuration pragma placement, since we do not want to ! -- tolerate mixed modes in a unit involving Ada 2012. That ! -- would cause real difficulties for those cases where there ! -- are incompatibilities between Ada 95 and Ada 2012. We could ! -- allow mixing of Ada 2005 and Ada 2012 but it's not worth it. ! ! Check_Valid_Configuration_Pragma; ! ! -- Now set appropriate Ada mode ! ! if Sense then ! Ada_Version := Ada_2012; ! else ! Ada_Version := Ada_Version_Default; ! end if; ! ! Ada_Version_Explicit := Ada_2012; end if; end; *************** package body Sem_Prag is *** 5246,5251 **** --- 5957,5964 ---- GNAT_Pragma; Check_At_Least_N_Arguments (1); Check_Arg_Is_Identifier (Arg1); + Check_No_Identifiers; + Store_Note (N); declare Arg : Node_Id; *************** package body Sem_Prag is *** 5259,5265 **** else Arg := Next (Arg2); while Present (Arg) loop ! Exp := Expression (Arg); Analyze (Exp); if Is_Entity_Name (Exp) then --- 5972,5978 ---- else Arg := Next (Arg2); while Present (Arg) loop ! Exp := Get_Pragma_Arg (Arg); Analyze (Exp); if Is_Entity_Name (Exp) then *************** package body Sem_Prag is *** 5319,5327 **** Expr := Get_Pragma_Arg (Arg1); Newa := New_List ( Make_Pragma_Argument_Association (Loc, ! Expression => ! Make_Identifier (Loc, ! Chars => Name_Assertion)), Make_Pragma_Argument_Association (Sloc (Expr), Expression => Expr)); --- 6032,6038 ---- Expr := Get_Pragma_Arg (Arg1); Newa := New_List ( Make_Pragma_Argument_Association (Loc, ! Expression => Make_Identifier (Loc, Name_Assertion)), Make_Pragma_Argument_Association (Sloc (Expr), Expression => Expr)); *************** package body Sem_Prag is *** 5370,5383 **** 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); --- 6081,6091 ---- Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, ! Expression => Make_Identifier (Loc, Name_Assertion)), Make_Pragma_Argument_Association (Loc, Expression => ! Make_Identifier (Sloc (Policy), Chars (Policy)))))); Set_Analyzed (N); Set_Next_Pragma (N, Opt.Check_Policy_List); *************** package body Sem_Prag is *** 5397,5403 **** Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); ! if Chars (Expression (Arg1)) = Name_On then Assume_No_Invalid_Values := True; else Assume_No_Invalid_Values := False; --- 6105,6111 ---- Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); ! if Chars (Get_Pragma_Arg (Arg1)) = Name_On then Assume_No_Invalid_Values := True; else Assume_No_Invalid_Values := False; *************** package body Sem_Prag is *** 5418,5424 **** Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_Local_Name (Arg1); ! Ent := Entity (Expression (Arg1)); -- Note: the implementation of the AST_Entry pragma could handle -- the entry family case fine, but for now we are consistent with --- 6126,6132 ---- Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_Local_Name (Arg1); ! Ent := Entity (Get_Pragma_Arg (Arg1)); -- Note: the implementation of the AST_Entry pragma could handle -- the entry family case fine, but for now we are consistent with *************** package body Sem_Prag is *** 5521,5528 **** end if; C_Ent := Cunit_Entity (Current_Sem_Unit); ! Analyze (Expression (Arg1)); ! Nm := Entity (Expression (Arg1)); if not Is_Remote_Call_Interface (C_Ent) and then not Is_Remote_Types (C_Ent) --- 6229,6236 ---- end if; C_Ent := Cunit_Entity (Current_Sem_Unit); ! Analyze (Get_Pragma_Arg (Arg1)); ! Nm := Entity (Get_Pragma_Arg (Arg1)); if not Is_Remote_Call_Interface (C_Ent) and then not Is_Remote_Types (C_Ent) *************** package body Sem_Prag is *** 5634,5640 **** Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Etype (E_Id) = Any_Type then return; --- 6342,6348 ---- Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Etype (E_Id) = Any_Type then return; *************** package body Sem_Prag is *** 5642,5647 **** --- 6350,6357 ---- E := Entity (E_Id); + Check_Duplicate_Pragma (E); + if Rep_Item_Too_Early (E, N) or else Rep_Item_Too_Late (E, N) *************** package body Sem_Prag is *** 5665,5682 **** E := Base_Type (E); end if; ! Set_Has_Volatile_Components (E); if Prag_Id = Pragma_Atomic_Components then ! Set_Has_Atomic_Components (E); ! ! if Is_Packed (E) then ! Set_Is_Packed (E, False); ! ! Error_Pragma_Arg ! ("?Pack canceled, cannot pack atomic components", ! Arg1); ! end if; end if; else --- 6375,6384 ---- E := Base_Type (E); end if; ! Set_Has_Volatile_Components (E, Sense); if Prag_Id = Pragma_Atomic_Components then ! Set_Has_Atomic_Components (E, Sense); end if; else *************** package body Sem_Prag is *** 5700,5723 **** else Check_Interrupt_Or_Attach_Handler; ! -- The expression that designates the attribute may ! -- depend on a discriminant, and is therefore a per- ! -- object expression, to be expanded in the init proc. ! -- If expansion is enabled, perform semantic checks ! -- on a copy only. if Expander_Active then declare Temp : constant Node_Id := ! New_Copy_Tree (Expression (Arg2)); begin Set_Parent (Temp, N); Preanalyze_And_Resolve (Temp, RTE (RE_Interrupt_ID)); end; else ! Analyze (Expression (Arg2)); ! Resolve (Expression (Arg2), RTE (RE_Interrupt_ID)); end if; Process_Interrupt_Or_Attach_Handler; --- 6402,6424 ---- else Check_Interrupt_Or_Attach_Handler; ! -- The expression that designates the attribute may depend on a ! -- discriminant, and is therefore a per- object expression, to ! -- be expanded in the init proc. If expansion is enabled, then ! -- perform semantic checks on a copy only. if Expander_Active then declare Temp : constant Node_Id := ! New_Copy_Tree (Get_Pragma_Arg (Arg2)); begin Set_Parent (Temp, N); Preanalyze_And_Resolve (Temp, RTE (RE_Interrupt_ID)); end; else ! Analyze (Get_Pragma_Arg (Arg2)); ! Resolve (Get_Pragma_Arg (Arg2), RTE (RE_Interrupt_ID)); end if; Process_Interrupt_Or_Attach_Handler; *************** package body Sem_Prag is *** 5739,5745 **** Check_Arg_Count (1); Check_Optional_Identifier (Arg1, "max_size"); ! Arg := Expression (Arg1); Check_Arg_Is_Static_Expression (Arg, Any_Integer); Val := Expr_Value (Arg); --- 6440,6446 ---- Check_Arg_Count (1); Check_Optional_Identifier (Arg1, "max_size"); ! Arg := Get_Pragma_Arg (Arg1); Check_Arg_Is_Static_Expression (Arg, Any_Integer); Val := Expr_Value (Arg); *************** package body Sem_Prag is *** 5788,5795 **** end if; Check_Arg_Is_Identifier (Arg1); Check_On := Check_Enabled (Chars (Get_Pragma_Arg (Arg1))); ! Set_Pragma_Enabled (N, Check_On); -- If expansion is active and the check is not enabled then we -- rewrite the Check as: --- 6489,6505 ---- end if; Check_Arg_Is_Identifier (Arg1); + + -- Indicate if pragma is enabled. The Original_Node reference here + -- is to deal with pragma Assert rewritten as a Check pragma. + Check_On := Check_Enabled (Chars (Get_Pragma_Arg (Arg1))); ! ! if Check_On then ! Set_Pragma_Enabled (N); ! Set_Pragma_Enabled (Original_Node (N)); ! Set_SCO_Pragma_Enabled (Loc); ! end if; -- If expansion is active and the check is not enabled then we -- rewrite the Check as: *************** package body Sem_Prag is *** 5810,5816 **** -- 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); --- 6520,6526 ---- -- compile time, and we do not want to delete this warning when we -- delete the if statement. ! Expr := Get_Pragma_Arg (Arg2); if Expander_Active and then not Check_On then Eloc := Sloc (Expr); *************** package body Sem_Prag is *** 5847,5853 **** Check_Arg_Is_Identifier (Arg1); declare ! Nam : constant Name_Id := Chars (Expression (Arg1)); begin for J in Check_Names.First .. Check_Names.Last loop --- 6557,6563 ---- Check_Arg_Is_Identifier (Arg1); declare ! Nam : constant Name_Id := Chars (Get_Pragma_Arg (Arg1)); begin for J in Check_Names.First .. Check_Names.Last loop *************** package body Sem_Prag is *** 5985,5991 **** Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Etype (E_Id) = Any_Type then return; --- 6695,6701 ---- Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Etype (E_Id) = Any_Type then return; *************** package body Sem_Prag is *** 6133,6139 **** Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! Arg := Expression (Arg1); if not Is_Entity_Name (Arg) or else not Is_Access_Type (Entity (Arg)) --- 6843,6849 ---- Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! Arg := Get_Pragma_Arg (Arg1); if not Is_Entity_Name (Arg) or else not Is_Access_Type (Entity (Arg)) *************** package body Sem_Prag is *** 6182,6189 **** Check_Optional_Identifier (Arg2, Name_Convention); Check_Arg_Is_Identifier (Arg1); Check_Arg_Is_Identifier (Arg2); ! Idnam := Chars (Expression (Arg1)); ! Cname := Chars (Expression (Arg2)); if Is_Convention_Name (Cname) then Record_Convention_Identifier --- 6892,6899 ---- Check_Optional_Identifier (Arg2, Name_Convention); Check_Arg_Is_Identifier (Arg1); Check_Arg_Is_Identifier (Arg2); ! Idnam := Chars (Get_Pragma_Arg (Arg1)); ! Cname := Chars (Get_Pragma_Arg (Arg2)); if Is_Convention_Name (Cname) then Record_Convention_Identifier *************** package body Sem_Prag is *** 6216,6222 **** Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Arg := Expression (Arg1); Analyze (Arg); if Etype (Arg) = Any_Type then --- 6926,6932 ---- Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Arg := Get_Pragma_Arg (Arg1); Analyze (Arg); if Etype (Arg) = Any_Type then *************** package body Sem_Prag is *** 6333,6339 **** Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Id := Expression (Arg1); Find_Program_Unit_Name (Id); -- If we did not find the name, we are done --- 7043,7049 ---- Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Id := Get_Pragma_Arg (Arg1); Find_Program_Unit_Name (Id); -- If we did not find the name, we are done *************** package body Sem_Prag is *** 6344,6349 **** --- 7054,7067 ---- Def_Id := Entity (Id); + -- Check if already defined as constructor + + if Is_Constructor (Def_Id) then + Error_Msg_N + ("?duplicate argument for pragma 'C'P'P_Constructor", Arg1); + return; + end if; + if Ekind (Def_Id) = E_Function and then (Is_CPP_Class (Etype (Def_Id)) or else (Is_Class_Wide_Type (Etype (Def_Id)) *************** package body Sem_Prag is *** 6426,6431 **** --- 7144,7235 ---- end if; end CPP_Vtable; + --------- + -- CPU -- + --------- + + -- pragma CPU (EXPRESSION); + + when Pragma_CPU => CPU : declare + P : constant Node_Id := Parent (N); + Arg : Node_Id; + + begin + Ada_2012_Pragma; + Check_No_Identifiers; + Check_Arg_Count (1); + + -- Subprogram case + + if Nkind (P) = N_Subprogram_Body then + Check_In_Main_Program; + + Arg := Get_Pragma_Arg (Arg1); + Analyze_And_Resolve (Arg, Any_Integer); + + -- Must be static + + if not Is_Static_Expression (Arg) then + Flag_Non_Static_Expr + ("main subprogram affinity is not static!", Arg); + raise Pragma_Exit; + + -- If constraint error, then we already signalled an error + + elsif Raises_Constraint_Error (Arg) then + null; + + -- Otherwise check in range + + else + declare + CPU_Id : constant Entity_Id := RTE (RE_CPU_Range); + -- This is the entity System.Multiprocessors.CPU_Range; + + Val : constant Uint := Expr_Value (Arg); + + begin + if Val < Expr_Value (Type_Low_Bound (CPU_Id)) + or else + Val > Expr_Value (Type_High_Bound (CPU_Id)) + then + Error_Pragma_Arg + ("main subprogram CPU is out of range", Arg1); + end if; + end; + end if; + + Set_Main_CPU + (Current_Sem_Unit, UI_To_Int (Expr_Value (Arg))); + + -- Task case + + elsif Nkind (P) = N_Task_Definition then + Arg := Get_Pragma_Arg (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_CPU_Range)); + + -- Anything else is incorrect + + else + Pragma_Misplaced; + end if; + + if Has_Pragma_CPU (P) then + Error_Pragma ("duplicate pragma% not allowed"); + else + Set_Has_Pragma_CPU (P, True); + + if Nkind (P) = N_Task_Definition then + Record_Rep_Item (Defining_Identifier (Parent (P)), N); + end if; + end if; + end CPU; + ----------- -- Debug -- ----------- *************** package body Sem_Prag is *** 6447,6453 **** Cond := Make_And_Then (Loc, Left_Opnd => Relocate_Node (Cond), ! Right_Opnd => Expression (Arg1)); end if; -- Rewrite into a conditional with an appropriate condition. We --- 7251,7257 ---- Cond := Make_And_Then (Loc, Left_Opnd => Relocate_Node (Cond), ! Right_Opnd => Get_Pragma_Arg (Arg1)); end if; -- Rewrite into a conditional with an appropriate condition. We *************** package body Sem_Prag is *** 6476,6482 **** GNAT_Pragma; Check_Arg_Count (1); Check_Arg_Is_One_Of (Arg1, Name_Check, Name_Ignore); ! Debug_Pragmas_Enabled := Chars (Expression (Arg1)) = Name_Check; --------------------- -- Detect_Blocking -- --- 7280,7287 ---- GNAT_Pragma; Check_Arg_Count (1); Check_Arg_Is_One_Of (Arg1, Name_Check, Name_Ignore); ! Debug_Pragmas_Enabled := ! Chars (Get_Pragma_Arg (Arg1)) = Name_Check; --------------------- -- Detect_Blocking -- *************** package body Sem_Prag is *** 6490,6495 **** --- 7295,7351 ---- Check_Valid_Configuration_Pragma; Detect_Blocking := True; + -------------------------- + -- Default_Storage_Pool -- + -------------------------- + + -- pragma Default_Storage_Pool (storage_pool_NAME | null); + + when Pragma_Default_Storage_Pool => + Ada_2012_Pragma; + Check_Arg_Count (1); + + -- Default_Storage_Pool can appear as a configuration pragma, or + -- in a declarative part or a package spec. + + if not Is_Configuration_Pragma then + Check_Is_In_Decl_Part_Or_Package_Spec; + end if; + + -- Case of Default_Storage_Pool (null); + + if Nkind (Expression (Arg1)) = N_Null then + Analyze (Expression (Arg1)); + + -- This is an odd case, this is not really an expression, so + -- we don't have a type for it. So just set the type to Empty. + + Set_Etype (Expression (Arg1), Empty); + + -- Case of Default_Storage_Pool (storage_pool_NAME); + + else + -- If it's a configuration pragma, then the only allowed + -- argument is "null". + + if Is_Configuration_Pragma then + Error_Pragma_Arg ("NULL expected", Arg1); + end if; + + -- The expected type for a non-"null" argument is + -- Root_Storage_Pool'Class. + + Analyze_And_Resolve + (Get_Pragma_Arg (Arg1), + Typ => Class_Wide_Type (RTE (RE_Root_Storage_Pool))); + end if; + + -- Finally, record the pool name (or null). Freeze.Freeze_Entity + -- for an access type will use this information to set the + -- appropriate attributes of the access type. + + Default_Pool := Expression (Arg1); + --------------- -- Dimension -- --------------- *************** package body Sem_Prag is *** 6539,6545 **** -- defined in the current declarative part, and recursively -- to any nested scope. ! Set_Discard_Names (Current_Scope); return; else --- 7395,7401 ---- -- defined in the current declarative part, and recursively -- to any nested scope. ! Set_Discard_Names (Current_Scope, Sense); return; else *************** package body Sem_Prag is *** 6547,6553 **** Check_Optional_Identifier (Arg1, Name_On); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Etype (E_Id) = Any_Type then return; --- 7403,7409 ---- Check_Optional_Identifier (Arg1, Name_On); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Etype (E_Id) = Any_Type then return; *************** package body Sem_Prag is *** 6560,6566 **** (Is_Enumeration_Type (E) or else Is_Tagged_Type (E))) or else Ekind (E) = E_Exception then ! Set_Discard_Names (E); else Error_Pragma_Arg ("inappropriate entity for pragma%", Arg1); --- 7416,7422 ---- (Is_Enumeration_Type (E) or else Is_Tagged_Type (E))) or else Ekind (E) = E_Exception then ! Set_Discard_Names (E, Sense); else Error_Pragma_Arg ("inappropriate entity for pragma%", Arg1); *************** package body Sem_Prag is *** 6625,6634 **** Citem := First (List_Containing (N)); Inner : while Citem /= N loop if Nkind (Citem) = N_With_Clause ! and then Same_Name (Name (Citem), Expression (Arg)) then Set_Elaborate_Present (Citem, True); ! Set_Unit_Name (Expression (Arg), Name (Citem)); -- With the pragma present, elaboration calls on -- subprograms from the named unit need no further --- 7481,7490 ---- Citem := First (List_Containing (N)); Inner : while Citem /= N loop if Nkind (Citem) = N_With_Clause ! and then Same_Name (Name (Citem), Get_Pragma_Arg (Arg)) then Set_Elaborate_Present (Citem, True); ! Set_Unit_Name (Get_Pragma_Arg (Arg), Name (Citem)); -- With the pragma present, elaboration calls on -- subprograms from the named unit need no further *************** package body Sem_Prag is *** 6707,6716 **** Citem := First (List_Containing (N)); Innr : while Citem /= N loop if Nkind (Citem) = N_With_Clause ! and then Same_Name (Name (Citem), Expression (Arg)) then Set_Elaborate_All_Present (Citem, True); ! Set_Unit_Name (Expression (Arg), Name (Citem)); -- Suppress warnings and elaboration checks on the named -- unit if the pragma is in the current compilation, as --- 7563,7572 ---- Citem := First (List_Containing (N)); Innr : while Citem /= N loop if Nkind (Citem) = N_With_Clause ! and then Same_Name (Name (Citem), Get_Pragma_Arg (Arg)) then Set_Elaborate_All_Present (Citem, True); ! Set_Unit_Name (Get_Pragma_Arg (Arg), Name (Citem)); -- Suppress warnings and elaboration checks on the named -- unit if the pragma is in the current compilation, as *************** package body Sem_Prag is *** 6909,6915 **** Process_Convention (C, Def_Id); if Ekind (Def_Id) /= E_Constant then ! Note_Possible_Modification (Expression (Arg2), Sure => False); end if; Process_Interface_Name (Def_Id, Arg3, Arg4); --- 7765,7772 ---- Process_Convention (C, Def_Id); if Ekind (Def_Id) /= E_Constant then ! Note_Possible_Modification ! (Get_Pragma_Arg (Arg2), Sure => False); end if; Process_Interface_Name (Def_Id, Arg3, Arg4); *************** package body Sem_Prag is *** 7247,7259 **** Check_Optional_Identifier (Arg1, Name_Name); Check_Arg_Is_Identifier (Arg1); ! Get_Name_String (Chars (Expression (Arg1))); if Name_Len > 4 and then Name_Buffer (1 .. 4) = "aux_" then if Present (System_Extend_Pragma_Arg) then ! if Chars (Expression (Arg1)) = Chars (Expression (System_Extend_Pragma_Arg)) then null; --- 8104,8116 ---- Check_Optional_Identifier (Arg1, Name_Name); Check_Arg_Is_Identifier (Arg1); ! Get_Name_String (Chars (Get_Pragma_Arg (Arg1))); if Name_Len > 4 and then Name_Buffer (1 .. 4) = "aux_" then if Present (System_Extend_Pragma_Arg) then ! if Chars (Get_Pragma_Arg (Arg1)) = Chars (Expression (System_Extend_Pragma_Arg)) then null; *************** package body Sem_Prag is *** 7286,7295 **** Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); ! if Chars (Expression (Arg1)) = Name_On then Extensions_Allowed := True; else Extensions_Allowed := False; end if; -------------- --- 8143,8155 ---- Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); ! if Chars (Get_Pragma_Arg (Arg1)) = Name_On then Extensions_Allowed := True; + Ada_Version := Ada_Version_Type'Last; + else Extensions_Allowed := False; + Ada_Version := Ada_Version_Explicit; end if; -------------- *************** package body Sem_Prag is *** 7318,7324 **** Check_At_Least_N_Arguments (2); Check_At_Most_N_Arguments (4); Process_Convention (C, Def_Id); ! Note_Possible_Modification (Expression (Arg2), Sure => False); Process_Interface_Name (Def_Id, Arg3, Arg4); Set_Exported (Def_Id, Arg2); end External; --- 8178,8185 ---- Check_At_Least_N_Arguments (2); Check_At_Most_N_Arguments (4); Process_Convention (C, Def_Id); ! Note_Possible_Modification ! (Get_Pragma_Arg (Arg2), Sure => False); Process_Interface_Name (Def_Id, Arg3, Arg4); Set_Exported (Def_Id, Arg2); end External; *************** package body Sem_Prag is *** 7386,7404 **** Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! Named_Entity := Entity (Expression (Arg1)); -- If it's an access-to-subprogram type (in particular, not a -- subtype), set the flag on that type. if Is_Access_Subprogram_Type (Named_Entity) then ! Set_Can_Use_Internal_Rep (Named_Entity, False); -- Otherwise it's an error (name denotes the wrong sort of entity) else Error_Pragma_Arg ! ("access-to-subprogram type expected", Expression (Arg1)); end if; end Favor_Top_Level; --- 8247,8268 ---- Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! Named_Entity := Entity (Get_Pragma_Arg (Arg1)); -- If it's an access-to-subprogram type (in particular, not a -- subtype), set the flag on that type. if Is_Access_Subprogram_Type (Named_Entity) then ! if Sense then ! Set_Can_Use_Internal_Rep (Named_Entity, False); ! end if; -- Otherwise it's an error (name denotes the wrong sort of entity) else Error_Pragma_Arg ! ("access-to-subprogram type expected", ! Get_Pragma_Arg (Arg1)); end if; end Favor_Top_Level; *************** package body Sem_Prag is *** 7422,7428 **** when Pragma_Finalize_Storage_Only => Finalize_Storage : declare Assoc : constant Node_Id := Arg1; ! Type_Id : constant Node_Id := Expression (Assoc); Typ : Entity_Id; begin --- 8286,8292 ---- when Pragma_Finalize_Storage_Only => Finalize_Storage : declare Assoc : constant Node_Id := Arg1; ! Type_Id : constant Node_Id := Get_Pragma_Arg (Assoc); Typ : Entity_Id; begin *************** package body Sem_Prag is *** 7484,7490 **** Check_Arg_Is_One_Of (Arg1, Name_VAX_Float, Name_IEEE_Float); if not OpenVMS_On_Target then ! if Chars (Expression (Arg1)) = Name_VAX_Float then Error_Pragma ("?pragma% ignored (applies only to Open'V'M'S)"); end if; --- 8348,8354 ---- Check_Arg_Is_One_Of (Arg1, Name_VAX_Float, Name_IEEE_Float); if not OpenVMS_On_Target then ! if Chars (Get_Pragma_Arg (Arg1)) = Name_VAX_Float then Error_Pragma ("?pragma% ignored (applies only to Open'V'M'S)"); end if; *************** package body Sem_Prag is *** 7495,7501 **** -- One argument case if Arg_Count = 1 then ! if Chars (Expression (Arg1)) = Name_VAX_Float then if Opt.Float_Format = 'I' then Error_Pragma ("'I'E'E'E format previously specified"); end if; --- 8359,8365 ---- -- One argument case if Arg_Count = 1 then ! if Chars (Get_Pragma_Arg (Arg1)) = Name_VAX_Float then if Opt.Float_Format = 'I' then Error_Pragma ("'I'E'E'E format previously specified"); end if; *************** package body Sem_Prag is *** 7530,7536 **** -- Two arguments, VAX_Float case ! if Chars (Expression (Arg1)) = Name_VAX_Float then case Digs is when 6 => Set_F_Float (Ent); when 9 => Set_D_Float (Ent); --- 8394,8400 ---- -- Two arguments, VAX_Float case ! if Chars (Get_Pragma_Arg (Arg1)) = Name_VAX_Float then case Digs is when 6 => Set_F_Float (Ent); when 9 => Set_D_Float (Ent); *************** package body Sem_Prag is *** 7575,7580 **** --- 8439,8445 ---- Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_Static_Expression (Arg1, Standard_String); + Store_Note (N); -- For pragma Ident, preserve DEC compatibility by requiring the -- pragma to appear in a declarative part or package spec. *************** package body Sem_Prag is *** 7583,7589 **** Check_Is_In_Decl_Part_Or_Package_Spec; end if; ! Str := Expr_Value_S (Expression (Arg1)); declare CS : Node_Id; --- 8448,8454 ---- Check_Is_In_Decl_Part_Or_Package_Spec; end if; ! Str := Expr_Value_S (Get_Pragma_Arg (Arg1)); declare CS : Node_Id; *************** package body Sem_Prag is *** 7623,7634 **** else -- In VMS, the effect of IDENT is achieved by passing ! -- IDENTIFICATION=name as a --for-linker switch. if OpenVMS_On_Target then Start_String; Store_String_Chars ! ("--for-linker=IDENTIFICATION="); String_To_Name_Buffer (Strval (Str)); Store_String_Chars (Name_Buffer (1 .. Name_Len)); --- 8488,8499 ---- else -- In VMS, the effect of IDENT is achieved by passing ! -- --identification=name as a --for-linker switch. if OpenVMS_On_Target then Start_String; Store_String_Chars ! ("--for-linker=--identification="); String_To_Name_Buffer (Strval (Str)); Store_String_Chars (Name_Buffer (1 .. Name_Len)); *************** package body Sem_Prag is *** 7638,7644 **** -- associated with a with'd package. Replace_Linker_Option_String ! (End_String, "--for-linker=IDENTIFICATION="); end if; Set_Ident_String (Current_Sem_Unit, Str); --- 8503,8509 ---- -- associated with a with'd package. Replace_Linker_Option_String ! (End_String, "--for-linker=--identification="); end if; Set_Ident_String (Current_Sem_Unit, Str); *************** package body Sem_Prag is *** 7663,7711 **** end; end Ident; ! -------------------------- ! -- Implemented_By_Entry -- ! -------------------------- ! -- pragma Implemented_By_Entry (DIRECT_NAME); ! when Pragma_Implemented_By_Entry => Implemented_By_Entry : declare ! Ent : Entity_Id; begin ! Ada_2005_Pragma; ! Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_Identifier (Arg1); Check_Arg_Is_Local_Name (Arg1); ! Ent := Entity (Expression (Arg1)); ! -- Pragma Implemented_By_Entry must be applied only to protected ! -- synchronized or task interface primitives. ! if (Ekind (Ent) /= E_Function ! and then Ekind (Ent) /= E_Procedure) ! or else not Present (First_Formal (Ent)) ! or else not Is_Concurrent_Interface (Etype (First_Formal (Ent))) then ! Error_Pragma_Arg ! ("pragma % must be applied to a concurrent interface " & ! "primitive", Arg1); ! else ! if Einfo.Implemented_By_Entry (Ent) ! and then Warn_On_Redundant_Constructs then ! Error_Pragma ("?duplicate pragma%!"); else ! Set_Implemented_By_Entry (Ent); end if; end if; - end Implemented_By_Entry; ! ----------------------- -- Implicit_Packing -- ! ----------------------- -- pragma Implicit_Packing; --- 8528,8632 ---- end; end Ident; ! ----------------- ! -- Implemented -- ! ----------------- ! -- pragma Implemented (procedure_LOCAL_NAME, implementation_kind); ! -- implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any ! when Pragma_Implemented => Implemented : declare ! Proc_Id : Entity_Id; ! Typ : Entity_Id; begin ! Ada_2012_Pragma; ! Check_Arg_Count (2); Check_No_Identifiers; Check_Arg_Is_Identifier (Arg1); Check_Arg_Is_Local_Name (Arg1); ! Check_Arg_Is_One_Of ! (Arg2, Name_By_Any, Name_By_Entry, Name_By_Protected_Procedure); ! -- Extract the name of the local procedure ! Proc_Id := Entity (Get_Pragma_Arg (Arg1)); ! ! -- Ada 2012 (AI05-0030): The procedure_LOCAL_NAME must denote a ! -- primitive procedure of a synchronized tagged type. ! ! if Ekind (Proc_Id) = E_Procedure ! and then Is_Primitive (Proc_Id) ! and then Present (First_Formal (Proc_Id)) then ! Typ := Etype (First_Formal (Proc_Id)); ! if Is_Tagged_Type (Typ) ! and then ! ! -- Check for a protected, a synchronized or a task interface ! ! ((Is_Interface (Typ) ! and then Is_Synchronized_Interface (Typ)) ! ! -- Check for a protected type or a task type that implements ! -- an interface. ! ! or else ! (Is_Concurrent_Record_Type (Typ) ! and then Present (Interfaces (Typ))) ! ! -- Check for a private record extension with keyword ! -- "synchronized". ! ! or else ! (Ekind_In (Typ, E_Record_Type_With_Private, ! E_Record_Subtype_With_Private) ! and then Synchronized_Present (Parent (Typ)))) then ! null; else ! Error_Pragma_Arg ! ("controlling formal must be of synchronized " & ! "tagged type", Arg1); ! return; end if; + + -- Procedures declared inside a protected type must be accepted + + elsif Ekind (Proc_Id) = E_Procedure + and then Is_Protected_Type (Scope (Proc_Id)) + then + null; + + -- The first argument is not a primitive procedure + + else + Error_Pragma_Arg + ("pragma % must be applied to a primitive procedure", Arg1); + return; end if; ! -- Ada 2012 (AI05-0030): Cannot apply the implementation_kind ! -- By_Protected_Procedure to the primitive procedure of a task ! -- interface. ! ! if Chars (Arg2) = Name_By_Protected_Procedure ! and then Is_Interface (Typ) ! and then Is_Task_Interface (Typ) ! then ! Error_Pragma_Arg ! ("implementation kind By_Protected_Procedure cannot be " & ! "applied to a task interface primitive", Arg2); ! return; ! end if; ! ! Record_Rep_Item (Proc_Id, N); ! end Implemented; ! ! ---------------------- -- Implicit_Packing -- ! ---------------------- -- pragma Implicit_Packing; *************** package body Sem_Prag is *** 8009,8014 **** --- 8930,9054 ---- Arg_First_Optional_Parameter => First_Optional_Parameter); end Import_Valued_Procedure; + ----------------- + -- Independent -- + ----------------- + + -- pragma Independent (LOCAL_NAME); + + when Pragma_Independent => Independent : declare + E_Id : Node_Id; + E : Entity_Id; + D : Node_Id; + K : Node_Kind; + + begin + Check_Ada_83_Warning; + Ada_2012_Pragma; + Check_No_Identifiers; + Check_Arg_Count (1); + Check_Arg_Is_Local_Name (Arg1); + E_Id := Get_Pragma_Arg (Arg1); + + if Etype (E_Id) = Any_Type then + return; + end if; + + E := Entity (E_Id); + D := Declaration_Node (E); + K := Nkind (D); + + -- Check duplicate before we chain ourselves! + + Check_Duplicate_Pragma (E); + + -- Check appropriate entity + + if Is_Type (E) then + if Rep_Item_Too_Early (E, N) + or else + Rep_Item_Too_Late (E, N) + then + return; + else + Check_First_Subtype (Arg1); + end if; + + elsif K = N_Object_Declaration + or else (K = N_Component_Declaration + and then Original_Record_Component (E) = E) + then + if Rep_Item_Too_Late (E, N) then + return; + end if; + + else + Error_Pragma_Arg + ("inappropriate entity for pragma%", Arg1); + end if; + + Independence_Checks.Append ((N, E)); + end Independent; + + ---------------------------- + -- Independent_Components -- + ---------------------------- + + -- pragma Atomic_Components (array_LOCAL_NAME); + + -- This processing is shared by Volatile_Components + + when Pragma_Independent_Components => Independent_Components : declare + E_Id : Node_Id; + E : Entity_Id; + D : Node_Id; + K : Node_Kind; + + begin + Check_Ada_83_Warning; + Ada_2012_Pragma; + Check_No_Identifiers; + Check_Arg_Count (1); + Check_Arg_Is_Local_Name (Arg1); + E_Id := Get_Pragma_Arg (Arg1); + + if Etype (E_Id) = Any_Type then + return; + end if; + + E := Entity (E_Id); + + -- Check duplicate before we chain ourselves! + + Check_Duplicate_Pragma (E); + + -- Check appropriate entity + + if Rep_Item_Too_Early (E, N) + or else + Rep_Item_Too_Late (E, N) + then + return; + end if; + + D := Declaration_Node (E); + K := Nkind (D); + + if (K = N_Full_Type_Declaration + and then (Is_Array_Type (E) or else Is_Record_Type (E))) + or else + ((Ekind (E) = E_Constant or else Ekind (E) = E_Variable) + and then Nkind (D) = N_Object_Declaration + and then Nkind (Object_Definition (D)) = + N_Constrained_Array_Definition) + then + Independence_Checks.Append ((N, E)); + + else + Error_Pragma_Arg ("inappropriate entity for pragma%", Arg1); + end if; + end Independent_Components; + ------------------------ -- Initialize_Scalars -- ------------------------ *************** package body Sem_Prag is *** 8051,8057 **** when Pragma_Inline_Always => GNAT_Pragma; ! Process_Inline (True); -------------------- -- Inline_Generic -- --- 9091,9103 ---- when Pragma_Inline_Always => GNAT_Pragma; ! ! -- Pragma always active unless in CodePeer mode, since this causes ! -- walk order issues. ! ! if not CodePeer_Mode then ! Process_Inline (True); ! end if; -------------------- -- Inline_Generic -- *************** package body Sem_Prag is *** 8077,8083 **** if Arg_Count > 0 then Arg := Arg1; loop ! Exp := Expression (Arg); Analyze (Exp); if not Is_Entity_Name (Exp) --- 9123,9129 ---- if Arg_Count > 0 then Arg := Arg1; loop ! Exp := Get_Pragma_Arg (Arg); Analyze (Exp); if not Is_Entity_Name (Exp) *************** package body Sem_Prag is *** 8113,8118 **** --- 9159,9172 ---- Check_At_Most_N_Arguments (4); Process_Import_Or_Interface; + -- In Ada 2005, the permission to use Interface (a reserved word) + -- as a pragma name is considered an obsolescent feature. + + if Ada_Version >= Ada_2005 then + Check_Restriction + (No_Obsolescent_Features, Pragma_Identifier (N)); + end if; + -------------------- -- Interface_Name -- -------------------- *************** package body Sem_Prag is *** 8134,8140 **** ((Name_Entity, Name_External_Name, Name_Link_Name)); Check_At_Least_N_Arguments (2); Check_At_Most_N_Arguments (3); ! Id := Expression (Arg1); Analyze (Id); if not Is_Entity_Name (Id) then --- 9188,9194 ---- ((Name_Entity, Name_External_Name, Name_Link_Name)); Check_At_Least_N_Arguments (2); Check_At_Most_N_Arguments (3); ! Id := Get_Pragma_Arg (Arg1); Analyze (Id); if not Is_Entity_Name (Id) then *************** package body Sem_Prag is *** 8204,8209 **** --- 9258,9264 ---- Found := True; end if; + exit when From_Aspect_Specification (N); Hom_Id := Homonym (Hom_Id); exit when No (Hom_Id) *************** package body Sem_Prag is *** 8250,8256 **** Check_Ada_83_Warning; if Arg_Count /= 0 then ! Arg := Expression (Arg1); Check_Arg_Count (1); Check_No_Identifiers; --- 9305,9311 ---- Check_Ada_83_Warning; if Arg_Count /= 0 then ! Arg := Get_Pragma_Arg (Arg1); Check_Arg_Count (1); Check_No_Identifiers; *************** package body Sem_Prag is *** 8265,8275 **** Pragma_Misplaced; return; ! elsif Has_Priority_Pragma (P) then Error_Pragma ("duplicate pragma% not allowed"); else ! Set_Has_Priority_Pragma (P, True); Record_Rep_Item (Defining_Identifier (Parent (P)), N); end if; end Interrupt_Priority; --- 9320,9330 ---- Pragma_Misplaced; return; ! elsif Has_Pragma_Priority (P) then Error_Pragma ("duplicate pragma% not allowed"); else ! Set_Has_Pragma_Priority (P, True); Record_Rep_Item (Defining_Identifier (Parent (P)), N); end if; end Interrupt_Priority; *************** package body Sem_Prag is *** 8403,8408 **** --- 9458,9524 ---- end loop; end Interrupt_State; + --------------- + -- Invariant -- + --------------- + + -- pragma Invariant + -- ([Entity =>] type_LOCAL_NAME, + -- [Check =>] EXPRESSION + -- [,[Message =>] String_Expression]); + + when Pragma_Invariant => Invariant : declare + Type_Id : Node_Id; + Typ : Entity_Id; + + Discard : Boolean; + pragma Unreferenced (Discard); + + begin + GNAT_Pragma; + Check_At_Least_N_Arguments (2); + Check_At_Most_N_Arguments (3); + Check_Optional_Identifier (Arg1, Name_Entity); + Check_Optional_Identifier (Arg2, Name_Check); + + if Arg_Count = 3 then + Check_Optional_Identifier (Arg3, Name_Message); + Check_Arg_Is_Static_Expression (Arg3, Standard_String); + end if; + + Check_Arg_Is_Local_Name (Arg1); + + Type_Id := Get_Pragma_Arg (Arg1); + Find_Type (Type_Id); + Typ := Entity (Type_Id); + + if Typ = Any_Type then + return; + + elsif not Ekind_In (Typ, E_Private_Type, + E_Record_Type_With_Private, + E_Limited_Private_Type) + then + Error_Pragma_Arg + ("pragma% only allowed for private type", Arg1); + end if; + + -- Note that the type has at least one invariant, and also that + -- it has inheritable invariants if we have Invariant'Class. + + Set_Has_Invariants (Typ); + + if Class_Present (N) then + Set_Has_Inheritable_Invariants (Typ); + end if; + + -- The remaining processing is simply to link the pragma on to + -- the rep item chain, for processing when the type is frozen. + -- This is accomplished by a call to Rep_Item_Too_Late. + + Discard := Rep_Item_Too_Late (Typ, N, FOnly => True); + end Invariant; + ---------------------- -- Java_Constructor -- ---------------------- *************** package body Sem_Prag is *** 8413,8422 **** when Pragma_CIL_Constructor | Pragma_Java_Constructor => Java_Constructor : declare ! Id : Entity_Id; ! Def_Id : Entity_Id; ! Hom_Id : Entity_Id; ! Convention : Convention_Id; begin GNAT_Pragma; --- 9529,9539 ---- when Pragma_CIL_Constructor | Pragma_Java_Constructor => Java_Constructor : declare ! Convention : Convention_Id; ! Def_Id : Entity_Id; ! Hom_Id : Entity_Id; ! Id : Entity_Id; ! This_Formal : Entity_Id; begin GNAT_Pragma; *************** package body Sem_Prag is *** 8424,8430 **** Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Id := Expression (Arg1); Find_Program_Unit_Name (Id); -- If we did not find the name, we are done --- 9541,9547 ---- Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Id := Get_Pragma_Arg (Arg1); Find_Program_Unit_Name (Id); -- If we did not find the name, we are done *************** package body Sem_Prag is *** 8433,8438 **** --- 9550,9571 ---- return; end if; + -- Check wrong use of pragma in wrong VM target + + if VM_Target = No_VM then + return; + + elsif VM_Target = CLI_Target + and then Prag_Id = Pragma_Java_Constructor + then + Error_Pragma ("must use pragma 'C'I'L_'Constructor"); + + elsif VM_Target = JVM_Target + and then Prag_Id = Pragma_CIL_Constructor + then + Error_Pragma ("must use pragma 'Java_'Constructor"); + end if; + case Prag_Id is when Pragma_CIL_Constructor => Convention := Convention_CIL; when Pragma_Java_Constructor => Convention := Convention_Java; *************** package body Sem_Prag is *** 8446,8488 **** loop Def_Id := Get_Base_Subprogram (Hom_Id); ! -- The constructor is required to be a function returning an ! -- access type whose designated type has convention Java/CIL. ! ! if Ekind (Def_Id) = E_Function ! and then ! (Is_Value_Type (Etype (Def_Id)) ! or else ! (Ekind (Etype (Def_Id)) = E_Access_Subprogram_Type ! and then ! Atree.Convention (Etype (Def_Id)) = Convention) ! or else ! (Ekind (Etype (Def_Id)) in Access_Kind ! and then ! (Atree.Convention ! (Designated_Type (Etype (Def_Id))) = Convention ! or else ! Atree.Convention ! (Root_Type (Designated_Type (Etype (Def_Id)))) = ! Convention))) ! then ! Set_Is_Constructor (Def_Id); ! Set_Convention (Def_Id, Convention); ! Set_Is_Imported (Def_Id); ! else ! if Convention = Convention_Java then Error_Pragma_Arg ("pragma% requires function returning a " & ! "'Java access type", Arg1); else - pragma Assert (Convention = Convention_CIL); Error_Pragma_Arg ("pragma% requires function returning a " & ! "'C'I'L access type", Arg1); end if; end if; Hom_Id := Homonym (Hom_Id); exit when No (Hom_Id) or else Scope (Hom_Id) /= Current_Scope; --- 9579,9790 ---- loop Def_Id := Get_Base_Subprogram (Hom_Id); ! -- The constructor is required to be a function ! if Ekind (Def_Id) /= E_Function then ! if VM_Target = JVM_Target then Error_Pragma_Arg ("pragma% requires function returning a " & ! "'Java access type", Def_Id); else Error_Pragma_Arg ("pragma% requires function returning a " & ! "'C'I'L access type", Def_Id); end if; end if; + -- Check arguments: For tagged type the first formal must be + -- named "this" and its type must be a named access type + -- designating a class-wide tagged type that has convention + -- CIL/Java. The first formal must also have a null default + -- value. For example: + + -- type Typ is tagged ... + -- type Ref is access all Typ; + -- pragma Convention (CIL, Typ); + + -- function New_Typ (This : Ref) return Ref; + -- function New_Typ (This : Ref; I : Integer) return Ref; + -- pragma Cil_Constructor (New_Typ); + + -- Reason: The first formal must NOT be a primitive of the + -- tagged type. + + -- This rule also applies to constructors of delegates used + -- to interface with standard target libraries. For example: + + -- type Delegate is access procedure ... + -- pragma Import (CIL, Delegate, ...); + + -- function new_Delegate + -- (This : Delegate := null; ... ) return Delegate; + + -- For value-types this rule does not apply. + + if not Is_Value_Type (Etype (Def_Id)) then + if No (First_Formal (Def_Id)) then + Error_Msg_Name_1 := Pname; + Error_Msg_N ("% function must have parameters", Def_Id); + return; + end if; + + -- In the JRE library we have several occurrences in which + -- the "this" parameter is not the first formal. + + This_Formal := First_Formal (Def_Id); + + -- In the JRE library we have several occurrences in which + -- the "this" parameter is not the first formal. Search for + -- it. + + if VM_Target = JVM_Target then + while Present (This_Formal) + and then Get_Name_String (Chars (This_Formal)) /= "this" + loop + Next_Formal (This_Formal); + end loop; + + if No (This_Formal) then + This_Formal := First_Formal (Def_Id); + end if; + end if; + + -- Warning: The first parameter should be named "this". + -- We temporarily allow it because we have the following + -- case in the Java runtime (file s-osinte.ads) ??? + + -- function new_Thread + -- (Self_Id : System.Address) return Thread_Id; + -- pragma Java_Constructor (new_Thread); + + if VM_Target = JVM_Target + and then Get_Name_String (Chars (First_Formal (Def_Id))) + = "self_id" + and then Etype (First_Formal (Def_Id)) = RTE (RE_Address) + then + null; + + elsif Get_Name_String (Chars (This_Formal)) /= "this" then + Error_Msg_Name_1 := Pname; + Error_Msg_N + ("first formal of % function must be named `this`", + Parent (This_Formal)); + + elsif not Is_Access_Type (Etype (This_Formal)) then + Error_Msg_Name_1 := Pname; + Error_Msg_N + ("first formal of % function must be an access type", + Parameter_Type (Parent (This_Formal))); + + -- For delegates the type of the first formal must be a + -- named access-to-subprogram type (see previous example) + + elsif Ekind (Etype (Def_Id)) = E_Access_Subprogram_Type + and then Ekind (Etype (This_Formal)) + /= E_Access_Subprogram_Type + then + Error_Msg_Name_1 := Pname; + Error_Msg_N + ("first formal of % function must be a named access" & + " to subprogram type", + Parameter_Type (Parent (This_Formal))); + + -- Warning: We should reject anonymous access types because + -- the constructor must not be handled as a primitive of the + -- tagged type. We temporarily allow it because this profile + -- is currently generated by cil2ada??? + + elsif Ekind (Etype (Def_Id)) /= E_Access_Subprogram_Type + and then not Ekind_In (Etype (This_Formal), + E_Access_Type, + E_General_Access_Type, + E_Anonymous_Access_Type) + then + Error_Msg_Name_1 := Pname; + Error_Msg_N + ("first formal of % function must be a named access" & + " type", + Parameter_Type (Parent (This_Formal))); + + elsif Atree.Convention + (Designated_Type (Etype (This_Formal))) /= Convention + then + Error_Msg_Name_1 := Pname; + + if Convention = Convention_Java then + Error_Msg_N + ("pragma% requires convention 'Cil in designated" & + " type", + Parameter_Type (Parent (This_Formal))); + else + Error_Msg_N + ("pragma% requires convention 'Java in designated" & + " type", + Parameter_Type (Parent (This_Formal))); + end if; + + elsif No (Expression (Parent (This_Formal))) + or else Nkind (Expression (Parent (This_Formal))) /= N_Null + then + Error_Msg_Name_1 := Pname; + Error_Msg_N + ("pragma% requires first formal with default `null`", + Parameter_Type (Parent (This_Formal))); + end if; + end if; + + -- Check result type: the constructor must be a function + -- returning: + -- * a value type (only allowed in the CIL compiler) + -- * an access-to-subprogram type with convention Java/CIL + -- * an access-type designating a type that has convention + -- Java/CIL. + + if Is_Value_Type (Etype (Def_Id)) then + null; + + -- Access-to-subprogram type with convention Java/CIL + + elsif Ekind (Etype (Def_Id)) = E_Access_Subprogram_Type then + if Atree.Convention (Etype (Def_Id)) /= Convention then + if Convention = Convention_Java then + Error_Pragma_Arg + ("pragma% requires function returning a " & + "'Java access type", Arg1); + else + pragma Assert (Convention = Convention_CIL); + Error_Pragma_Arg + ("pragma% requires function returning a " & + "'C'I'L access type", Arg1); + end if; + end if; + + elsif Ekind (Etype (Def_Id)) in Access_Kind then + if not Ekind_In (Etype (Def_Id), E_Access_Type, + E_General_Access_Type) + or else + Atree.Convention + (Designated_Type (Etype (Def_Id))) /= Convention + then + Error_Msg_Name_1 := Pname; + + if Convention = Convention_Java then + Error_Pragma_Arg + ("pragma% requires function returning a named" & + "'Java access type", Arg1); + else + Error_Pragma_Arg + ("pragma% requires function returning a named" & + "'C'I'L access type", Arg1); + end if; + end if; + end if; + + Set_Is_Constructor (Def_Id); + Set_Convention (Def_Id, Convention); + Set_Is_Imported (Def_Id); + + exit when From_Aspect_Specification (N); Hom_Id := Homonym (Hom_Id); exit when No (Hom_Id) or else Scope (Hom_Id) /= Current_Scope; *************** package body Sem_Prag is *** 8505,8511 **** Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Arg := Expression (Arg1); Analyze (Arg); if Etype (Arg) = Any_Type then --- 9807,9813 ---- Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Arg := Get_Pragma_Arg (Arg1); Analyze (Arg); if Etype (Arg) = Any_Type then *************** package body Sem_Prag is *** 8557,8563 **** Check_Optional_Identifier (Arg1, Name_On); Check_Arg_Is_Local_Name (Arg1); ! Arg := Expression (Arg1); Analyze (Arg); if Etype (Arg) = Any_Type then --- 9859,9865 ---- Check_Optional_Identifier (Arg1, Name_On); Check_Arg_Is_Local_Name (Arg1); ! Arg := Get_Pragma_Arg (Arg1); Analyze (Arg); if Etype (Arg) = Any_Type then *************** package body Sem_Prag is *** 8642,8648 **** Arg_Store : declare C : constant Char_Code := Get_Char_Code (' '); S : constant String_Id := ! Strval (Expr_Value_S (Expression (Arg))); L : constant Nat := String_Length (S); F : Nat := 1; --- 9944,9950 ---- Arg_Store : declare C : constant Char_Code := Get_Char_Code (' '); S : constant String_Id := ! Strval (Expr_Value_S (Get_Pragma_Arg (Arg))); L : constant Nat := String_Length (S); F : Nat := 1; *************** package body Sem_Prag is *** 8715,8724 **** -- by the call to Rep_Item_Too_Late (when no error is detected -- and False is returned). ! if Rep_Item_Too_Late (Entity (Expression (Arg1)), N) then return; else ! Set_Has_Gigi_Rep_Item (Entity (Expression (Arg1))); end if; ------------------------ --- 10017,10026 ---- -- by the call to Rep_Item_Too_Late (when no error is detected -- and False is returned). ! if Rep_Item_Too_Late (Entity (Get_Pragma_Arg (Arg1)), N) then return; else ! Set_Has_Gigi_Rep_Item (Entity (Get_Pragma_Arg (Arg1))); end if; ------------------------ *************** package body Sem_Prag is *** 8746,8752 **** Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_Local_Name (Arg1); ! Arg1_X := Expression (Arg1); Analyze (Arg1_X); Proc := Find_Unique_Parameterless_Procedure (Arg1_X, Arg1); --- 10048,10054 ---- Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_Local_Name (Arg1); ! Arg1_X := Get_Pragma_Arg (Arg1); Analyze (Arg1_X); Proc := Find_Unique_Parameterless_Procedure (Arg1_X, Arg1); *************** package body Sem_Prag is *** 8782,8794 **** 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; --- 10084,10097 ---- 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 (Get_Pragma_Arg (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 (Get_Pragma_Arg (Arg)))); Arg := Next (Arg); end loop; *************** package body Sem_Prag is *** 8818,8824 **** -- This pragma applies only to objects ! if not Is_Object (Entity (Expression (Arg1))) then Error_Pragma_Arg ("pragma% applies only to objects", Arg1); end if; --- 10121,10127 ---- -- This pragma applies only to objects ! if not Is_Object (Entity (Get_Pragma_Arg (Arg1))) then Error_Pragma_Arg ("pragma% applies only to objects", Arg1); end if; *************** package body Sem_Prag is *** 8827,8836 **** -- by the call to Rep_Item_Too_Late (when no error is detected -- and False is returned). ! if Rep_Item_Too_Late (Entity (Expression (Arg1)), N) then return; else ! Set_Has_Gigi_Rep_Item (Entity (Expression (Arg1))); end if; ---------- --- 10130,10139 ---- -- by the call to Rep_Item_Too_Late (when no error is detected -- and False is returned). ! if Rep_Item_Too_Late (Entity (Get_Pragma_Arg (Arg1)), N) then return; else ! Set_Has_Gigi_Rep_Item (Entity (Get_Pragma_Arg (Arg1))); end if; ---------- *************** package body Sem_Prag is *** 8861,8867 **** Check_No_Identifiers; Check_Arg_Is_Locking_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Expression (Arg1))); LP := Fold_Upper (Name_Buffer (1)); if Locking_Policy /= ' ' --- 10164,10170 ---- Check_No_Identifiers; Check_Arg_Is_Locking_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Get_Pragma_Arg (Arg1))); LP := Fold_Upper (Name_Buffer (1)); if Locking_Policy /= ' ' *************** package body Sem_Prag is *** 8901,8907 **** -- D_Float case ! if Chars (Expression (Arg1)) = Name_D_Float then if Opt.Float_Format_Long = 'G' then Error_Pragma ("G_Float previously specified"); end if; --- 10204,10210 ---- -- D_Float case ! if Chars (Get_Pragma_Arg (Arg1)) = Name_D_Float then if Opt.Float_Format_Long = 'G' then Error_Pragma ("G_Float previously specified"); end if; *************** package body Sem_Prag is *** 8947,8953 **** Check_Optional_Identifier (Arg2, Name_Attribute_Name); Check_Arg_Is_Local_Name (Arg1); Check_Arg_Is_Static_Expression (Arg2, Standard_String); ! Def_Id := Entity (Expression (Arg1)); if Is_Access_Type (Def_Id) then Def_Id := Designated_Type (Def_Id); --- 10250,10256 ---- Check_Optional_Identifier (Arg2, Name_Attribute_Name); Check_Arg_Is_Local_Name (Arg1); Check_Arg_Is_Static_Expression (Arg2, Standard_String); ! Def_Id := Entity (Get_Pragma_Arg (Arg1)); if Is_Access_Type (Def_Id) then Def_Id := Designated_Type (Def_Id); *************** package body Sem_Prag is *** 8967,8973 **** if Rep_Item_Too_Late (Def_Id, N) then return; else ! Set_Has_Gigi_Rep_Item (Entity (Expression (Arg1))); end if; end Machine_Attribute; --- 10270,10276 ---- if Rep_Item_Too_Late (Def_Id, N) then return; else ! Set_Has_Gigi_Rep_Item (Entity (Get_Pragma_Arg (Arg1))); end if; end Machine_Attribute; *************** package body Sem_Prag is *** 9116,9122 **** Arg := Arg1; while Present (Arg) loop Check_Arg_Is_Local_Name (Arg); ! Id := Expression (Arg); Analyze (Id); if not Is_Entity_Name (Id) then --- 10419,10425 ---- Arg := Arg1; while Present (Arg) loop Check_Arg_Is_Local_Name (Arg); ! Id := Get_Pragma_Arg (Arg); Analyze (Id); if not Is_Entity_Name (Id) then *************** package body Sem_Prag is *** 9134,9142 **** while Present (E) and then Scope (E) = Current_Scope loop ! if Ekind (E) = E_Procedure ! or else Ekind (E) = E_Generic_Procedure ! then Set_No_Return (E); -- Set flag on any alias as well --- 10437,10443 ---- while Present (E) and then Scope (E) = Current_Scope loop ! if Ekind_In (E, E_Procedure, E_Generic_Procedure) then Set_No_Return (E); -- Set flag on any alias as well *************** package body Sem_Prag is *** 9148,9153 **** --- 10449,10455 ---- Found := True; end if; + exit when From_Aspect_Specification (N); E := Homonym (E); end loop; *************** package body Sem_Prag is *** 9209,9215 **** else Check_Optional_Identifier (Arg2, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Entity (Expression (Arg1)); if E_Id = Any_Type then return; --- 10511,10517 ---- else Check_Optional_Identifier (Arg2, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Entity (Get_Pragma_Arg (Arg1)); if E_Id = Any_Type then return; *************** package body Sem_Prag is *** 9320,9326 **** -- Deal with static string argument Check_Arg_Is_Static_Expression (Arg1, Standard_String); ! S := Strval (Expression (Arg1)); for J in 1 .. String_Length (S) loop if not In_Character_Range (Get_String_Char (S, J)) then --- 10622,10628 ---- -- Deal with static string argument Check_Arg_Is_Static_Expression (Arg1, Standard_String); ! S := Strval (Get_Pragma_Arg (Arg1)); for J in 1 .. String_Length (S) loop if not In_Character_Range (Get_String_Char (S, J)) then *************** package body Sem_Prag is *** 9331,9337 **** end loop; Obsolescent_Warnings.Append ! ((Ent => Ent, Msg => Strval (Expression (Arg1)))); -- Check for Ada_05 parameter --- 10633,10639 ---- end loop; Obsolescent_Warnings.Append ! ((Ent => Ent, Msg => Strval (Get_Pragma_Arg (Arg1)))); -- Check for Ada_05 parameter *************** package body Sem_Prag is *** 9350,9356 **** ("only allowed argument for pragma% is %", Argx); end if; ! if Ada_Version_Explicit < Ada_05 or else not Warn_On_Ada_2005_Compatibility then Active := False; --- 10652,10658 ---- ("only allowed argument for pragma% is %", Argx); end if; ! if Ada_Version_Explicit < Ada_2005 or else not Warn_On_Ada_2005_Compatibility then Active := False; *************** package body Sem_Prag is *** 9479,9485 **** -- pragma Optimize_Alignment (Time | Space | Off); ! when Pragma_Optimize_Alignment => GNAT_Pragma; Check_No_Identifiers; Check_Arg_Count (1); --- 10781,10787 ---- -- pragma Optimize_Alignment (Time | Space | Off); ! when Pragma_Optimize_Alignment => Optimize_Alignment : begin GNAT_Pragma; Check_No_Identifiers; Check_Arg_Count (1); *************** package body Sem_Prag is *** 9505,9510 **** --- 10807,10848 ---- -- switch will get reset anyway at the start of each unit. Optimize_Alignment_Local := True; + end Optimize_Alignment; + + ------------- + -- Ordered -- + ------------- + + -- pragma Ordered (first_enumeration_subtype_LOCAL_NAME); + + when Pragma_Ordered => Ordered : declare + Assoc : constant Node_Id := Arg1; + Type_Id : Node_Id; + Typ : Entity_Id; + + begin + GNAT_Pragma; + Check_No_Identifiers; + Check_Arg_Count (1); + Check_Arg_Is_Local_Name (Arg1); + + Type_Id := Get_Pragma_Arg (Assoc); + Find_Type (Type_Id); + Typ := Entity (Type_Id); + + if Typ = Any_Type then + return; + else + Typ := Underlying_Type (Typ); + end if; + + if not Is_Enumeration_Type (Typ) then + Error_Pragma ("pragma% must specify enumeration type"); + end if; + + Check_First_Subtype (Arg1); + Set_Has_Pragma_Ordered (Base_Type (Typ)); + end Ordered; ---------- -- Pack -- *************** package body Sem_Prag is *** 9516,9528 **** Assoc : constant Node_Id := Arg1; Type_Id : Node_Id; Typ : Entity_Id; begin Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! Type_Id := Expression (Assoc); Find_Type (Type_Id); Typ := Entity (Type_Id); --- 10854,10868 ---- Assoc : constant Node_Id := Arg1; Type_Id : Node_Id; Typ : Entity_Id; + Ctyp : Entity_Id; + Ignore : Boolean := False; begin Check_No_Identifiers; Check_Arg_Count (1); Check_Arg_Is_Local_Name (Arg1); ! Type_Id := Get_Pragma_Arg (Assoc); Find_Type (Type_Id); Typ := Entity (Type_Id); *************** package body Sem_Prag is *** 9539,9606 **** end if; Check_First_Subtype (Arg1); ! ! if Has_Pragma_Pack (Typ) then ! Error_Pragma ("duplicate pragma%, only one allowed"); -- Array type ! elsif Is_Array_Type (Typ) then ! ! -- Pack not allowed for aliased or atomic components ! if Has_Aliased_Components (Base_Type (Typ)) then ! Error_Pragma ! ("pragma% ignored, cannot pack aliased components?"); ! elsif Has_Atomic_Components (Typ) ! or else Is_Atomic (Component_Type (Typ)) then ! Error_Pragma ! ("?pragma% ignored, cannot pack atomic components"); end if; ! -- If we had an explicit component size given, then we do not ! -- let Pack override this given size. We also give a warning ! -- that Pack is being ignored unless we can tell for sure that ! -- the Pack would not have had any effect anyway. ! if Has_Component_Size_Clause (Typ) then ! if Known_Static_RM_Size (Component_Type (Typ)) ! and then ! RM_Size (Component_Type (Typ)) = Component_Size (Typ) ! then null; - else - Error_Pragma - ("?pragma% ignored, explicit component size given"); - end if; ! -- If no prior array component size given, Pack is effective ! else ! if not Rep_Item_Too_Late (Typ, N) then ! -- In the context of static code analysis, we do not need ! -- complex front-end expansions related to pragma Pack, ! -- so disable handling of pragma Pack in this case. ! if CodePeer_Mode then ! null; ! -- For normal non-VM target, do the packing ! elsif VM_Target = No_VM then ! Set_Is_Packed (Base_Type (Typ)); ! Set_Has_Pragma_Pack (Base_Type (Typ)); ! Set_Has_Non_Standard_Rep (Base_Type (Typ)); ! -- If we ignore the pack, then warn about this, except ! -- that we suppress the warning in GNAT mode. ! elsif not GNAT_Mode then ! Error_Pragma ! ("?pragma% ignored in this configuration"); end if; end if; end if; --- 10879,10966 ---- end if; Check_First_Subtype (Arg1); ! Check_Duplicate_Pragma (Typ); -- Array type ! if Is_Array_Type (Typ) then ! Ctyp := Component_Type (Typ); ! -- Ignore pack that does nothing ! if Known_Static_Esize (Ctyp) ! and then Known_Static_RM_Size (Ctyp) ! and then Esize (Ctyp) = RM_Size (Ctyp) ! and then Addressable (Esize (Ctyp)) then ! Ignore := True; end if; ! -- Process OK pragma Pack. Note that if there is a separate ! -- component clause present, the Pack will be cancelled. This ! -- processing is in Freeze. ! if not Rep_Item_Too_Late (Typ, N) then ! ! -- In the context of static code analysis, we do not need ! -- complex front-end expansions related to pragma Pack, ! -- so disable handling of pragma Pack in this case. ! ! if CodePeer_Mode then null; ! -- Don't attempt any packing for VM targets. We possibly ! -- could deal with some cases of array bit-packing, but we ! -- don't bother, since this is not a typical kind of ! -- representation in the VM context anyway (and would not ! -- for example work nicely with the debugger). ! elsif VM_Target /= No_VM then ! if not GNAT_Mode then ! Error_Pragma ! ("?pragma% ignored in this configuration"); ! end if; ! -- Normal case where we do the pack action ! else ! if not Ignore then ! Set_Is_Packed (Base_Type (Typ), Sense); ! Set_Has_Non_Standard_Rep (Base_Type (Typ), Sense); ! end if; ! Set_Has_Pragma_Pack (Base_Type (Typ), Sense); ! -- Complete reset action for Aspect_Cancel case ! if Sense = False then ! -- Cancel size unless explicitly set ! ! if not Has_Size_Clause (Typ) ! and then not Has_Object_Size_Clause (Typ) ! then ! Set_Esize (Typ, Uint_0); ! Set_RM_Size (Typ, Uint_0); ! Set_Alignment (Typ, Uint_0); ! Set_Packed_Array_Type (Typ, Empty); ! end if; ! ! -- Reset component size unless explicitly set ! ! if not Has_Component_Size_Clause (Typ) then ! if Known_Static_Esize (Ctyp) ! and then Known_Static_RM_Size (Ctyp) ! and then Esize (Ctyp) = RM_Size (Ctyp) ! and then Addressable (Esize (Ctyp)) ! then ! Set_Component_Size ! (Base_Type (Typ), Esize (Ctyp)); ! else ! Set_Component_Size ! (Base_Type (Typ), Uint_0); ! end if; ! end if; end if; end if; end if; *************** package body Sem_Prag is *** 9609,9621 **** else pragma Assert (Is_Record_Type (Typ)); if not Rep_Item_Too_Late (Typ, N) then - if VM_Target = No_VM then - Set_Is_Packed (Base_Type (Typ)); - Set_Has_Pragma_Pack (Base_Type (Typ)); - Set_Has_Non_Standard_Rep (Base_Type (Typ)); ! elsif not GNAT_Mode then ! Error_Pragma ("?pragma% ignored in this configuration"); end if; end if; end if; --- 10969,11004 ---- else pragma Assert (Is_Record_Type (Typ)); if not Rep_Item_Too_Late (Typ, N) then ! -- Ignore pack request with warning in VM mode (skip warning ! -- if we are compiling GNAT run time library). ! ! if VM_Target /= No_VM then ! if not GNAT_Mode then ! Error_Pragma ! ("?pragma% ignored in this configuration"); ! end if; ! ! -- Normal case of pack request active ! ! else ! Set_Is_Packed (Base_Type (Typ), Sense); ! Set_Has_Pragma_Pack (Base_Type (Typ), Sense); ! Set_Has_Non_Standard_Rep (Base_Type (Typ), Sense); ! ! -- Complete reset action for Aspect_Cancel case ! ! if Sense = False then ! ! -- Cancel size if not explicitly given ! ! if not Has_Size_Clause (Typ) ! and then not Has_Object_Size_Clause (Typ) ! then ! Set_Esize (Typ, Uint_0); ! Set_Alignment (Typ, Uint_0); ! end if; ! end if; end if; end if; end if; *************** package body Sem_Prag is *** 9640,9646 **** -- pragma Passive [(PASSIVE_FORM)]; ! -- PASSIVE_FORM ::= Semaphore | No when Pragma_Passive => GNAT_Pragma; --- 11023,11029 ---- -- pragma Passive [(PASSIVE_FORM)]; ! -- PASSIVE_FORM ::= Semaphore | No when Pragma_Passive => GNAT_Pragma; *************** package body Sem_Prag is *** 9670,9682 **** Check_Arg_Is_Identifier (Arg1); Check_Arg_Is_Local_Name (Arg1); Check_First_Subtype (Arg1); ! Ent := Entity (Expression (Arg1)); ! if not Is_Private_Type (Ent) ! and then not Is_Protected_Type (Ent) then Error_Pragma_Arg ! ("pragma % can only be applied to private or protected type", Arg1); end if; --- 11053,11069 ---- Check_Arg_Is_Identifier (Arg1); Check_Arg_Is_Local_Name (Arg1); Check_First_Subtype (Arg1); ! Ent := Entity (Get_Pragma_Arg (Arg1)); ! if not (Is_Private_Type (Ent) ! or else ! Is_Protected_Type (Ent) ! or else ! (Is_Generic_Type (Ent) and then Is_Derived_Type (Ent))) then Error_Pragma_Arg ! ("pragma % can only be applied to private, formal derived or " ! & "protected type", Arg1); end if; *************** package body Sem_Prag is *** 9711,9716 **** --- 11098,11105 ---- -- Persistent_BSS -- -------------------- + -- pragma Persistent_BSS [(object_NAME)]; + when Pragma_Persistent_BSS => Persistent_BSS : declare Decl : Node_Id; Ent : Entity_Id; *************** package body Sem_Prag is *** 9725,9739 **** if Arg_Count = 1 then Check_Arg_Is_Library_Level_Local_Name (Arg1); ! if not Is_Entity_Name (Expression (Arg1)) ! or else ! (Ekind (Entity (Expression (Arg1))) /= E_Variable ! and then Ekind (Entity (Expression (Arg1))) /= E_Constant) then Error_Pragma_Arg ("pragma% only applies to objects", Arg1); end if; ! Ent := Entity (Expression (Arg1)); Decl := Parent (Ent); if Rep_Item_Too_Late (Ent, N) then --- 11114,11128 ---- if Arg_Count = 1 then Check_Arg_Is_Library_Level_Local_Name (Arg1); ! if not Is_Entity_Name (Get_Pragma_Arg (Arg1)) ! or else not ! Ekind_In (Entity (Get_Pragma_Arg (Arg1)), E_Variable, ! E_Constant) then Error_Pragma_Arg ("pragma% only applies to objects", Arg1); end if; ! Ent := Entity (Get_Pragma_Arg (Arg1)); Decl := Parent (Ent); if Rep_Item_Too_Late (Ent, N) then *************** package body Sem_Prag is *** 9751,9761 **** Arg1); end if; ! Prag := ! Make_Linker_Section_Pragma ! (Ent, Sloc (N), ".persistent.bss"); ! Insert_After (N, Prag); ! Analyze (Prag); -- Case of use as configuration pragma with no arguments --- 11140,11154 ---- Arg1); end if; ! Check_Duplicate_Pragma (Ent); ! ! if Sense then ! Prag := ! Make_Linker_Section_Pragma ! (Ent, Sloc (N), ".persistent.bss"); ! Insert_After (N, Prag); ! Analyze (Prag); ! end if; -- Case of use as configuration pragma with no arguments *************** package body Sem_Prag is *** 9776,9782 **** Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); ! Polling_Required := (Chars (Expression (Arg1)) = Name_On); ------------------- -- Postcondition -- --- 11169,11175 ---- Check_Arg_Count (1); Check_No_Identifiers; Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); ! Polling_Required := (Chars (Get_Pragma_Arg (Arg1)) = Name_On); ------------------- -- Postcondition -- *************** package body Sem_Prag is *** 9816,9822 **** 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 more to do. If in body, then we convert the --- 11209,11214 ---- *************** package body Sem_Prag is *** 9826,9844 **** -- analyze the condition itself in the proper context. 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; - 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)))))); --- 11218,11229 ---- -- analyze the condition itself in the proper context. if In_Body then Rewrite (N, Make_Pragma (Loc, Chars => Name_Check, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, ! Expression => Make_Identifier (Loc, Name_Precondition)), Make_Pragma_Argument_Association (Sloc (Arg1), Expression => Relocate_Node (Get_Pragma_Arg (Arg1)))))); *************** package body Sem_Prag is *** 9853,9858 **** --- 11238,11283 ---- end if; end Precondition; + --------------- + -- Predicate -- + --------------- + + -- pragma Predicate + -- ([Entity =>] type_LOCAL_NAME, + -- [Check =>] EXPRESSION); + + when Pragma_Predicate => Predicate : declare + Type_Id : Node_Id; + Typ : Entity_Id; + + Discard : Boolean; + pragma Unreferenced (Discard); + + begin + GNAT_Pragma; + Check_Arg_Count (2); + Check_Optional_Identifier (Arg1, Name_Entity); + Check_Optional_Identifier (Arg2, Name_Check); + + Check_Arg_Is_Local_Name (Arg1); + + Type_Id := Get_Pragma_Arg (Arg1); + Find_Type (Type_Id); + Typ := Entity (Type_Id); + + if Typ = Any_Type then + return; + end if; + + -- The remaining processing is simply to link the pragma on to + -- the rep item chain, for processing when the type is frozen. + -- This is accomplished by a call to Rep_Item_Too_Late. We also + -- mark the type as having predicates. + + Set_Has_Predicates (Typ); + Discard := Rep_Item_Too_Late (Typ, N, FOnly => True); + end Predicate; + ------------------ -- Preelaborate -- ------------------ *************** package body Sem_Prag is *** 9875,9880 **** --- 11300,11306 ---- end if; Ent := Find_Lib_Unit_Name; + Check_Duplicate_Pragma (Ent); -- This filters out pragmas inside generic parent then -- show up inside instantiation *************** package body Sem_Prag is *** 9884,9891 **** and then Present (Generic_Parent (Pa))) then if not Debug_Flag_U then ! Set_Is_Preelaborated (Ent); ! Set_Suppress_Elaboration_Warnings (Ent); end if; end if; end Preelaborate; --- 11310,11317 ---- and then Present (Generic_Parent (Pa))) then if not Debug_Flag_U then ! Set_Is_Preelaborated (Ent, Sense); ! Set_Suppress_Elaboration_Warnings (Ent, Sense); end if; end if; end Preelaborate; *************** package body Sem_Prag is *** 9918,9927 **** -- This is one of the few cases where we need to test the value of -- Ada_Version_Explicit rather than Ada_Version (which is always ! -- set to Ada_05 in a predefined unit), we need to know the -- explicit version set to know if this pragma is active. ! if Ada_Version_Explicit >= Ada_05 then Ent := Find_Lib_Unit_Name; Set_Is_Preelaborated (Ent); Set_Suppress_Elaboration_Warnings (Ent); --- 11344,11353 ---- -- This is one of the few cases where we need to test the value of -- Ada_Version_Explicit rather than Ada_Version (which is always ! -- set to Ada_2012 in a predefined unit), we need to know the -- explicit version set to know if this pragma is active. ! if Ada_Version_Explicit >= Ada_2005 then Ent := Find_Lib_Unit_Name; Set_Is_Preelaborated (Ent); Set_Suppress_Elaboration_Warnings (Ent); *************** package body Sem_Prag is *** 9947,9953 **** if Nkind (P) = N_Subprogram_Body then Check_In_Main_Program; ! Arg := Expression (Arg1); Analyze_And_Resolve (Arg, Standard_Integer); -- Must be static --- 11373,11379 ---- if Nkind (P) = N_Subprogram_Body then Check_In_Main_Program; ! Arg := Get_Pragma_Arg (Arg1); Analyze_And_Resolve (Arg, Standard_Integer); -- Must be static *************** package body Sem_Prag is *** 9997,10003 **** -- Task or Protected, must be of type Integer elsif Nkind_In (P, N_Protected_Definition, N_Task_Definition) then ! Arg := Expression (Arg1); -- The expression must be analyzed in the special manner -- described in "Handling of Default and Per-Object --- 11423,11429 ---- -- Task or Protected, must be of type Integer elsif Nkind_In (P, N_Protected_Definition, N_Task_Definition) then ! Arg := Get_Pragma_Arg (Arg1); -- The expression must be analyzed in the special manner -- described in "Handling of Default and Per-Object *************** package body Sem_Prag is *** 10015,10024 **** Pragma_Misplaced; end if; ! if Has_Priority_Pragma (P) then Error_Pragma ("duplicate pragma% not allowed"); else ! Set_Has_Priority_Pragma (P, True); if Nkind_In (P, N_Protected_Definition, N_Task_Definition) then Record_Rep_Item (Defining_Identifier (Parent (P)), N); --- 11441,11450 ---- Pragma_Misplaced; end if; ! if Has_Pragma_Priority (P) then Error_Pragma ("duplicate pragma% not allowed"); else ! Set_Has_Pragma_Priority (P, True); if Nkind_In (P, N_Protected_Definition, N_Task_Definition) then Record_Rep_Item (Defining_Identifier (Parent (P)), N); *************** package body Sem_Prag is *** 10053,10066 **** Check_No_Identifiers; Check_Arg_Is_Task_Dispatching_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Expression (Arg1))); DP := Fold_Upper (Name_Buffer (1)); ! Lower_Bound := Expression (Arg2); Check_Arg_Is_Static_Expression (Lower_Bound, Standard_Integer); Lower_Val := Expr_Value (Lower_Bound); ! Upper_Bound := Expression (Arg3); Check_Arg_Is_Static_Expression (Upper_Bound, Standard_Integer); Upper_Val := Expr_Value (Upper_Bound); --- 11479,11492 ---- Check_No_Identifiers; Check_Arg_Is_Task_Dispatching_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Get_Pragma_Arg (Arg1))); DP := Fold_Upper (Name_Buffer (1)); ! Lower_Bound := Get_Pragma_Arg (Arg2); Check_Arg_Is_Static_Expression (Lower_Bound, Standard_Integer); Lower_Val := Expr_Value (Lower_Bound); ! Upper_Bound := Get_Pragma_Arg (Arg3); Check_Arg_Is_Static_Expression (Upper_Bound, Standard_Integer); Upper_Val := Expr_Value (Upper_Bound); *************** package body Sem_Prag is *** 10294,10302 **** Def_Id := Entity (Internal); ! if Ekind (Def_Id) /= E_Constant ! and then Ekind (Def_Id) /= E_Variable ! then Error_Pragma_Arg ("pragma% must designate an object", Internal); end if; --- 11720,11726 ---- Def_Id := Entity (Internal); ! if not Ekind_In (Def_Id, E_Constant, E_Variable) then Error_Pragma_Arg ("pragma% must designate an object", Internal); end if; *************** package body Sem_Prag is *** 10420,10429 **** -- This is one of the few cases where we need to test the value of -- Ada_Version_Explicit rather than Ada_Version (which is always ! -- set to Ada_05 in a predefined unit), we need to know the -- explicit version set to know if this pragma is active. ! if Ada_Version_Explicit >= Ada_05 then Ent := Find_Lib_Unit_Name; Set_Is_Preelaborated (Ent, False); Set_Is_Pure (Ent); --- 11844,11853 ---- -- This is one of the few cases where we need to test the value of -- Ada_Version_Explicit rather than Ada_Version (which is always ! -- set to Ada_2012 in a predefined unit), we need to know the -- explicit version set to know if this pragma is active. ! if Ada_Version_Explicit >= Ada_2005 then Ent := Find_Lib_Unit_Name; Set_Is_Preelaborated (Ent, False); Set_Is_Pure (Ent); *************** package body Sem_Prag is *** 10448,10454 **** Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Error_Posted (E_Id) then return; --- 11872,11878 ---- Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Error_Posted (E_Id) then return; *************** package body Sem_Prag is *** 10462,10491 **** loop Def_Id := Get_Base_Subprogram (E); ! if Ekind (Def_Id) /= E_Function ! and then Ekind (Def_Id) /= E_Generic_Function ! and then Ekind (Def_Id) /= E_Operator then Error_Pragma_Arg ("pragma% requires a function name", Arg1); end if; ! Set_Is_Pure (Def_Id); if not Has_Pragma_Pure_Function (Def_Id) then ! Set_Has_Pragma_Pure_Function (Def_Id); ! Effective := True; end if; E := Homonym (E); exit when No (E) or else Scope (E) /= Current_Scope; end loop; ! if not Effective and then Warn_On_Redundant_Constructs then ! Error_Msg_NE ("pragma Pure_Function on& is redundant?", ! N, Entity (E_Id)); end if; end if; end Pure_Function; --- 11886,11917 ---- loop Def_Id := Get_Base_Subprogram (E); ! if not Ekind_In (Def_Id, E_Function, ! E_Generic_Function, ! E_Operator) then Error_Pragma_Arg ("pragma% requires a function name", Arg1); end if; ! Set_Is_Pure (Def_Id, Sense); if not Has_Pragma_Pure_Function (Def_Id) then ! Set_Has_Pragma_Pure_Function (Def_Id, Sense); ! Effective := Sense; end if; + exit when From_Aspect_Specification (N); E := Homonym (E); exit when No (E) or else Scope (E) /= Current_Scope; end loop; ! if Sense and then not Effective and then Warn_On_Redundant_Constructs then ! Error_Msg_NE ! ("pragma Pure_Function on& is redundant?", ! N, Entity (E_Id)); end if; end if; end Pure_Function; *************** package body Sem_Prag is *** 10505,10511 **** Check_No_Identifiers; Check_Arg_Is_Queuing_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Expression (Arg1))); QP := Fold_Upper (Name_Buffer (1)); if Queuing_Policy /= ' ' --- 11931,11937 ---- Check_No_Identifiers; Check_Arg_Is_Queuing_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Get_Pragma_Arg (Arg1))); QP := Fold_Upper (Name_Buffer (1)); if Queuing_Policy /= ' ' *************** package body Sem_Prag is *** 10541,10547 **** 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. --- 11967,11973 ---- Check_No_Identifiers; Check_Arg_Count (1); ! Arg := Get_Pragma_Arg (Arg1); -- The expression must be analyzed in the special manner described -- in "Handling of Default and Per-Object Expressions" in sem.ads. *************** package body Sem_Prag is *** 10658,10667 **** Set_Ravenscar_Profile (N); if Warn_On_Obsolescent_Feature then ! Error_Msg_N ! ("pragma Ravenscar is an obsolescent feature?", N); ! Error_Msg_N ! ("|use pragma Profile (Ravenscar) instead", N); end if; ------------------------- --- 12084,12091 ---- Set_Ravenscar_Profile (N); if Warn_On_Obsolescent_Feature then ! Error_Msg_N ("pragma Ravenscar is an obsolescent feature?", N); ! Error_Msg_N ("|use pragma Profile (Ravenscar) instead", N); end if; ------------------------- *************** package body Sem_Prag is *** 10680,10687 **** if Warn_On_Obsolescent_Feature then Error_Msg_N ("pragma Restricted_Run_Time is an obsolescent feature?", N); ! Error_Msg_N ! ("|use pragma Profile (Restricted) instead", N); end if; ------------------ --- 12104,12110 ---- if Warn_On_Obsolescent_Feature then Error_Msg_N ("pragma Restricted_Run_Time is an obsolescent feature?", N); ! Error_Msg_N ("|use pragma Profile (Restricted) instead", N); end if; ------------------ *************** package body Sem_Prag is *** 10792,10797 **** --- 12215,12232 ---- Set_Is_Shared_Passive (Cunit_Ent); end Shared_Passive; + ----------------------- + -- Short_Descriptors -- + ----------------------- + + -- pragma Short_Descriptors; + + when Pragma_Short_Descriptors => + GNAT_Pragma; + Check_Arg_Count (0); + Check_Valid_Configuration_Pragma; + Short_Descriptors := True; + ---------------------- -- Source_File_Name -- ---------------------- *************** package body Sem_Prag is *** 10921,10927 **** -- The expression must be analyzed in the special manner described -- in "Handling of Default Expressions" in sem.ads. ! Arg := Expression (Arg1); Preanalyze_Spec_Expression (Arg, Any_Integer); if not Is_Static_Expression (Arg) then --- 12356,12362 ---- -- The expression must be analyzed in the special manner described -- in "Handling of Default Expressions" in sem.ads. ! Arg := Get_Pragma_Arg (Arg1); Preanalyze_Spec_Expression (Arg, Any_Integer); if not Is_Static_Expression (Arg) then *************** package body Sem_Prag is *** 10957,10963 **** Check_Arg_Count (1); Check_Arg_Is_Integer_Literal (Arg1); ! if Intval (Expression (Arg1)) /= UI_From_Int (Ttypes.System_Storage_Unit) then Error_Msg_Uint_1 := UI_From_Int (Ttypes.System_Storage_Unit); --- 12392,12398 ---- Check_Arg_Count (1); Check_Arg_Is_Integer_Literal (Arg1); ! if Intval (Get_Pragma_Arg (Arg1)) /= UI_From_Int (Ttypes.System_Storage_Unit) then Error_Msg_Uint_1 := UI_From_Int (Ttypes.System_Storage_Unit); *************** package body Sem_Prag is *** 10991,10997 **** begin Check_Arg_Is_Local_Name (Arg); ! Ent := Entity (Expression (Arg)); if Has_Homonym (Ent) then Error_Pragma_Arg --- 12426,12432 ---- begin Check_Arg_Is_Local_Name (Arg); ! Ent := Entity (Get_Pragma_Arg (Arg)); if Has_Homonym (Ent) then Error_Pragma_Arg *************** package body Sem_Prag is *** 11023,11031 **** declare Typ : constant Entity_Id := ! Underlying_Type (Entity (Expression (Arg1))); ! Read : constant Entity_Id := Entity (Expression (Arg2)); ! Write : constant Entity_Id := Entity (Expression (Arg3)); begin Check_First_Subtype (Arg1); --- 12458,12466 ---- declare Typ : constant Entity_Id := ! Underlying_Type (Entity (Get_Pragma_Arg (Arg1))); ! Read : constant Entity_Id := Entity (Get_Pragma_Arg (Arg2)); ! Write : constant Entity_Id := Entity (Get_Pragma_Arg (Arg3)); begin Check_First_Subtype (Arg1); *************** package body Sem_Prag is *** 11088,11094 **** -- we don't need to issue error messages here. when Pragma_Style_Checks => Style_Checks : declare ! A : constant Node_Id := Expression (Arg1); S : String_Id; C : Char_Code; --- 12523,12529 ---- -- we don't need to issue error messages here. when Pragma_Style_Checks => Style_Checks : declare ! A : constant Node_Id := Get_Pragma_Arg (Arg1); S : String_Id; C : Char_Code; *************** package body Sem_Prag is *** 11106,11112 **** E : Entity_Id; begin ! E_Id := Expression (Arg2); Analyze (E_Id); if not Is_Entity_Name (E_Id) then --- 12541,12547 ---- E : Entity_Id; begin ! E_Id := Get_Pragma_Arg (Arg2); Analyze (E_Id); if not Is_Entity_Name (E_Id) then *************** package body Sem_Prag is *** 11122,11128 **** else loop Set_Suppress_Style_Checks (E, ! (Chars (Expression (Arg1)) = Name_Off)); exit when No (Homonym (E)); E := Homonym (E); end loop; --- 12557,12563 ---- else loop Set_Suppress_Style_Checks (E, ! (Chars (Get_Pragma_Arg (Arg1)) = Name_Off)); exit when No (Homonym (E)); E := Homonym (E); end loop; *************** package body Sem_Prag is *** 11164,11170 **** elsif Nkind (A) = N_Identifier then if Chars (A) = Name_All_Checks then ! Set_Default_Style_Check_Options; elsif Chars (A) = Name_On then Style_Check := True; --- 12599,12609 ---- elsif Nkind (A) = N_Identifier then if Chars (A) = Name_All_Checks then ! if GNAT_Mode then ! Set_GNAT_Style_Check_Options; ! else ! Set_Default_Style_Check_Options; ! end if; elsif Chars (A) = Name_On then Style_Check := True; *************** package body Sem_Prag is *** 11186,11192 **** GNAT_Pragma; Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Subtitle); ! Check_Arg_Is_String_Literal (Arg1); -------------- -- Suppress -- --- 12625,12632 ---- GNAT_Pragma; Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Subtitle); ! Check_Arg_Is_Static_Expression (Arg1, Standard_String); ! Store_Note (N); -------------- -- Suppress -- *************** package body Sem_Prag is *** 11203,11225 **** -- pragma Suppress_All; ! -- The only check made here is that the pragma appears in the proper ! -- place, i.e. following a compilation unit. If indeed it appears in ! -- this context, then the parser has already inserted an equivalent ! -- pragma Suppress (All_Checks) to get the required effect. when Pragma_Suppress_All => GNAT_Pragma; Check_Arg_Count (0); - if Nkind (Parent (N)) /= N_Compilation_Unit_Aux - or else not Is_List_Member (N) - or else List_Containing (N) /= Pragmas_After (Parent (N)) - then - Error_Pragma - ("misplaced pragma%, must follow compilation unit"); - end if; - ------------------------- -- Suppress_Debug_Info -- ------------------------- --- 12643,12658 ---- -- pragma Suppress_All; ! -- The only check made here is that the pragma has no arguments. ! -- There are no placement rules, and the processing required (setting ! -- the Has_Pragma_Suppress_All flag in the compilation unit node was ! -- taken care of by the parser). Process_Compilation_Unit_Pragmas ! -- then creates and inserts a pragma Suppress (All_Checks). when Pragma_Suppress_All => GNAT_Pragma; Check_Arg_Count (0); ------------------------- -- Suppress_Debug_Info -- ------------------------- *************** package body Sem_Prag is *** 11231,11237 **** Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Set_Debug_Info_Off (Entity (Get_Pragma_Arg (Arg1))); ---------------------------------- -- Suppress_Exception_Locations -- --- 12664,12670 ---- Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! Set_Debug_Info_Off (Entity (Get_Pragma_Arg (Arg1)), Sense); ---------------------------------- -- Suppress_Exception_Locations -- *************** package body Sem_Prag is *** 11261,11267 **** Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Expression (Arg1); if Etype (E_Id) = Any_Type then return; --- 12694,12700 ---- Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Get_Pragma_Arg (Arg1); if Etype (E_Id) = Any_Type then return; *************** package body Sem_Prag is *** 11318,11324 **** Check_No_Identifiers; Check_Arg_Is_Task_Dispatching_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Expression (Arg1))); DP := Fold_Upper (Name_Buffer (1)); if Task_Dispatching_Policy /= ' ' --- 12751,12757 ---- Check_No_Identifiers; Check_Arg_Is_Task_Dispatching_Policy (Arg1); Check_Valid_Configuration_Pragma; ! Get_Name_String (Chars (Get_Pragma_Arg (Arg1))); DP := Fold_Upper (Name_Buffer (1)); if Task_Dispatching_Policy /= ' ' *************** package body Sem_Prag is *** 11359,11367 **** Check_No_Identifiers; Check_Arg_Count (1); ! Analyze_And_Resolve (Expression (Arg1), RTE (RE_Task_Info_Type)); ! if Etype (Expression (Arg1)) = Any_Type then return; end if; --- 12792,12801 ---- Check_No_Identifiers; Check_Arg_Count (1); ! Analyze_And_Resolve ! (Get_Pragma_Arg (Arg1), RTE (RE_Task_Info_Type)); ! if Etype (Get_Pragma_Arg (Arg1)) = Any_Type then return; end if; *************** package body Sem_Prag is *** 11386,11392 **** Check_No_Identifiers; Check_Arg_Count (1); ! Arg := Expression (Arg1); -- The expression is used in the call to Create_Task, and must be -- expanded there, not in the context of the current spec. It must --- 12820,12826 ---- Check_No_Identifiers; Check_Arg_Count (1); ! Arg := Get_Pragma_Arg (Arg1); -- The expression is used in the call to Create_Task, and must be -- expanded there, not in the context of the current spec. It must *************** package body Sem_Prag is *** 11474,11480 **** Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Library_Level_Local_Name (Arg1); ! Id := Expression (Arg1); Analyze (Id); if not Is_Entity_Name (Id) --- 12908,12914 ---- Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Library_Level_Local_Name (Arg1); ! Id := Get_Pragma_Arg (Arg1); Analyze (Id); if not Is_Entity_Name (Id) *************** package body Sem_Prag is *** 11530,11536 **** if Get_Source_Unit (Loc) = Main_Unit then Opt.Time_Slice_Set := True; ! Val := Expr_Value_R (Expression (Arg1)); if Val <= Ureal_0 then Opt.Time_Slice_Value := 0; --- 12964,12970 ---- if Get_Source_Unit (Loc) = Main_Unit then Opt.Time_Slice_Set := True; ! Val := Expr_Value_R (Get_Pragma_Arg (Arg1)); if Val <= Ureal_0 then Opt.Time_Slice_Value := 0; *************** package body Sem_Prag is *** 11564,11573 **** begin GNAT_Pragma; Gather_Associations (Names, Args); for J in 1 .. 2 loop if Present (Args (J)) then ! Check_Arg_Is_String_Literal (Args (J)); end if; end loop; end Title; --- 12998,13008 ---- begin GNAT_Pragma; Gather_Associations (Names, Args); + Store_Note (N); for J in 1 .. 2 loop if Present (Args (J)) then ! Check_Arg_Is_Static_Expression (Args (J), Standard_String); end if; end loop; end Title; *************** package body Sem_Prag is *** 11580,11586 **** when Pragma_Unchecked_Union => Unchecked_Union : declare Assoc : constant Node_Id := Arg1; ! Type_Id : constant Node_Id := Expression (Assoc); Typ : Entity_Id; Discr : Entity_Id; Tdef : Node_Id; --- 13015,13021 ---- when Pragma_Unchecked_Union => Unchecked_Union : declare Assoc : constant Node_Id := Arg1; ! Type_Id : constant Node_Id := Get_Pragma_Arg (Assoc); Typ : Entity_Id; Discr : Entity_Id; Tdef : Node_Id; *************** package body Sem_Prag is *** 11644,11649 **** --- 13079,13085 ---- ("Unchecked_Union discriminant must have default value", Discr); end if; + Next_Discriminant (Discr); end loop; *************** package body Sem_Prag is *** 11652,11658 **** Comp := First (Component_Items (Clist)); while Present (Comp) loop ! Check_Component (Comp); Next (Comp); end loop; --- 13088,13094 ---- Comp := First (Component_Items (Clist)); while Present (Comp) loop ! Check_Component (Comp, Typ); Next (Comp); end loop; *************** package body Sem_Prag is *** 11667,11682 **** Variant := First (Variants (Vpart)); while Present (Variant) loop ! Check_Variant (Variant); Next (Variant); end loop; end if; ! Set_Is_Unchecked_Union (Typ, True); ! Set_Convention (Typ, Convention_C); ! Set_Has_Unchecked_Union (Base_Type (Typ), True); ! Set_Is_Unchecked_Union (Base_Type (Typ), True); end Unchecked_Union; ------------------------ --- 13103,13121 ---- Variant := First (Variants (Vpart)); while Present (Variant) loop ! Check_Variant (Variant, Typ); Next (Variant); end loop; end if; ! Set_Is_Unchecked_Union (Typ, Sense); ! if Sense then ! Set_Convention (Typ, Convention_C); ! end if; ! ! Set_Has_Unchecked_Union (Base_Type (Typ), Sense); ! Set_Is_Unchecked_Union (Base_Type (Typ), Sense); end Unchecked_Union; ------------------------ *************** package body Sem_Prag is *** 11727,11733 **** Check_Arg_Count (1); Check_Optional_Identifier (Arg2, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Entity (Expression (Arg1)); if E_Id = Any_Type then return; --- 13166,13172 ---- Check_Arg_Count (1); Check_Optional_Identifier (Arg2, Name_Entity); Check_Arg_Is_Local_Name (Arg1); ! E_Id := Entity (Get_Pragma_Arg (Arg1)); if E_Id = Any_Type then return; *************** package body Sem_Prag is *** 11735,11741 **** Error_Pragma_Arg ("pragma% requires type", Arg1); end if; ! Set_Universal_Aliasing (Implementation_Base_Type (E_Id)); end Universal_Alias; -------------------- --- 13174,13180 ---- Error_Pragma_Arg ("pragma% requires type", Arg1); end if; ! Set_Universal_Aliasing (Implementation_Base_Type (E_Id), Sense); end Universal_Alias; -------------------- *************** package body Sem_Prag is *** 11803,11809 **** ("pragma% can only be applied to a variable", Arg_Expr); else ! Set_Has_Pragma_Unmodified (Arg_Ent); end if; end if; --- 13242,13248 ---- ("pragma% can only be applied to a variable", Arg_Expr); else ! Set_Has_Pragma_Unmodified (Arg_Ent, Sense); end if; end if; *************** package body Sem_Prag is *** 11845,11857 **** Citem := First (List_Containing (N)); while Citem /= N loop if Nkind (Citem) = N_With_Clause ! and then Same_Name (Name (Citem), Expression (Arg_Node)) then Set_Has_Pragma_Unreferenced (Cunit_Entity (Get_Source_Unit (Library_Unit (Citem)))); ! Set_Unit_Name (Expression (Arg_Node), Name (Citem)); exit; end if; --- 13284,13298 ---- Citem := First (List_Containing (N)); while Citem /= N loop if Nkind (Citem) = N_With_Clause ! and then ! Same_Name (Name (Citem), Get_Pragma_Arg (Arg_Node)) then Set_Has_Pragma_Unreferenced (Cunit_Entity (Get_Source_Unit (Library_Unit (Citem)))); ! Set_Unit_Name ! (Get_Pragma_Arg (Arg_Node), Name (Citem)); exit; end if; *************** package body Sem_Prag is *** 11896,11902 **** Generate_Reference (Arg_Ent, N); end if; ! Set_Has_Pragma_Unreferenced (Arg_Ent); end if; Next (Arg_Node); --- 13337,13343 ---- Generate_Reference (Arg_Ent, N); end if; ! Set_Has_Pragma_Unreferenced (Arg_Ent, Sense); end if; Next (Arg_Node); *************** package body Sem_Prag is *** 11931,11937 **** ("argument for pragma% must be type or subtype", Arg_Node); end if; ! Set_Has_Pragma_Unreferenced_Objects (Entity (Arg_Expr)); Next (Arg_Node); end loop; end Unreferenced_Objects; --- 13372,13378 ---- ("argument for pragma% must be type or subtype", Arg_Node); end if; ! Set_Has_Pragma_Unreferenced_Objects (Entity (Arg_Expr), Sense); Next (Arg_Node); end loop; end Unreferenced_Objects; *************** package body Sem_Prag is *** 11979,11985 **** -- pragma Validity_Checks (On | Off | ALL_CHECKS | STRING_LITERAL); when Pragma_Validity_Checks => Validity_Checks : declare ! A : constant Node_Id := Expression (Arg1); S : String_Id; C : Char_Code; --- 13420,13426 ---- -- pragma Validity_Checks (On | Off | ALL_CHECKS | STRING_LITERAL); when Pragma_Validity_Checks => Validity_Checks : declare ! A : constant Node_Id := Get_Pragma_Arg (Arg1); S : String_Id; C : Char_Code; *************** package body Sem_Prag is *** 12089,12095 **** elsif not Is_Static_String_Expression (Arg1) then Error_Pragma_Arg ("argument of pragma% must be On/Off or " & ! "static string expression", Arg2); -- One argument string expression case --- 13530,13536 ---- elsif not Is_Static_String_Expression (Arg1) then Error_Pragma_Arg ("argument of pragma% must be On/Off or " & ! "static string expression", Arg1); -- One argument string expression case *************** package body Sem_Prag is *** 12155,12161 **** Err : Boolean; begin ! E_Id := Expression (Arg2); Analyze (E_Id); -- In the expansion of an inlined body, a reference to --- 13596,13602 ---- Err : Boolean; begin ! E_Id := Get_Pragma_Arg (Arg2); Analyze (E_Id); -- In the expansion of an inlined body, a reference to *************** package body Sem_Prag is *** 12179,12187 **** else loop Set_Warnings_Off ! (E, (Chars (Expression (Arg1)) = Name_Off)); ! if Chars (Expression (Arg1)) = Name_Off and then Warn_On_Warnings_Off then Warnings_Off_Pragmas.Append ((N, E)); --- 13620,13629 ---- else loop Set_Warnings_Off ! (E, (Chars (Get_Pragma_Arg (Arg1)) = ! Name_Off)); ! if Chars (Get_Pragma_Arg (Arg1)) = Name_Off and then Warn_On_Warnings_Off then Warnings_Off_Pragmas.Append ((N, E)); *************** package body Sem_Prag is *** 12215,12221 **** else String_To_Name_Buffer ! (Strval (Expr_Value_S (Expression (Arg2)))); -- Note on configuration pragma case: If this is a -- configuration pragma, then for an OFF pragma, we --- 13657,13663 ---- else String_To_Name_Buffer ! (Strval (Expr_Value_S (Get_Pragma_Arg (Arg2)))); -- Note on configuration pragma case: If this is a -- configuration pragma, then for an OFF pragma, we *************** package body Sem_Prag is *** 12262,12268 **** Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Library_Level_Local_Name (Arg1); ! Ent := Entity (Expression (Arg1)); if Rep_Item_Too_Early (Ent, N) then return; --- 13704,13710 ---- Check_Arg_Count (1); Check_Optional_Identifier (Arg1, Name_Entity); Check_Arg_Is_Library_Level_Local_Name (Arg1); ! Ent := Entity (Get_Pragma_Arg (Arg1)); if Rep_Item_Too_Early (Ent, N) then return; *************** package body Sem_Prag is *** 12309,12314 **** --- 13751,13761 ---- raise Program_Error; end case; + -- AI05-0144: detect dangerous order dependence. Disabled for now, + -- until AI is formally approved. + + -- Check_Order_Dependence; + exception when Pragma_Exit => null; end Analyze_Pragma; *************** package body Sem_Prag is *** 12321,12347 **** 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; --- 13768,13806 ---- PP : Node_Id; begin + -- Loop through entries in check policy list + PP := Opt.Check_Policy_List; loop + -- If there are no specific entries that matched, then we let the + -- setting of assertions govern. Note that this provides the needed + -- compatibility with the RM for the cases of assertion, invariant, + -- precondition, predicate, and postcondition. + if No (PP) then return Assertions_Enabled; ! -- Here we have an entry see if it matches else ! declare ! PPA : constant List_Id := Pragma_Argument_Associations (PP); ! ! begin ! if Nam = Chars (Get_Pragma_Arg (First (PPA))) then ! case (Chars (Get_Pragma_Arg (Last (PPA)))) 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; end if; end loop; end Check_Enabled; *************** package body Sem_Prag is *** 12381,12399 **** 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 -- ---------------- --- 13840,13845 ---- *************** package body Sem_Prag is *** 12471,12478 **** -- whether a given pragma is significant. -- -1 indicates that references in any argument position are significant ! -- 0 indicates that appearence in any argument is not significant ! -- +n indicates that appearence as argument n is significant, but all -- other arguments are not significant -- 99 special processing required (e.g. for pragma Check) --- 13917,13924 ---- -- whether a given pragma is significant. -- -1 indicates that references in any argument position are significant ! -- 0 indicates that appearance in any argument is not significant ! -- +n indicates that appearance as argument n is significant, but all -- other arguments are not significant -- 99 special processing required (e.g. for pragma Check) *************** package body Sem_Prag is *** 12483,12488 **** --- 13929,13936 ---- Pragma_Ada_95 => -1, Pragma_Ada_05 => -1, Pragma_Ada_2005 => -1, + Pragma_Ada_12 => -1, + Pragma_Ada_2012 => -1, Pragma_All_Calls_Remote => -1, Pragma_Annotate => -1, Pragma_Assert => -1, *************** package body Sem_Prag is *** 12500,12505 **** --- 13948,13954 ---- Pragma_CPP_Constructor => 0, Pragma_CPP_Virtual => 0, Pragma_CPP_Vtable => 0, + Pragma_CPU => -1, Pragma_C_Pass_By_Copy => 0, Pragma_Comment => 0, Pragma_Common_Object => -1, *************** package body Sem_Prag is *** 12515,12520 **** --- 13964,13970 ---- Pragma_Debug => -1, Pragma_Debug_Policy => 0, Pragma_Detect_Blocking => -1, + Pragma_Default_Storage_Pool => -1, Pragma_Dimension => -1, Pragma_Discard_Names => 0, Pragma_Elaborate => -1, *************** package body Sem_Prag is *** 12538,12544 **** Pragma_Finalize_Storage_Only => 0, Pragma_Float_Representation => 0, Pragma_Ident => -1, ! Pragma_Implemented_By_Entry => -1, Pragma_Implicit_Packing => 0, Pragma_Import => +2, Pragma_Import_Exception => 0, --- 13988,13994 ---- Pragma_Finalize_Storage_Only => 0, Pragma_Float_Representation => 0, Pragma_Ident => -1, ! Pragma_Implemented => -1, Pragma_Implicit_Packing => 0, Pragma_Import => +2, Pragma_Import_Exception => 0, *************** package body Sem_Prag is *** 12546,12551 **** --- 13996,14003 ---- Pragma_Import_Object => 0, Pragma_Import_Procedure => 0, Pragma_Import_Valued_Procedure => 0, + Pragma_Independent => 0, + Pragma_Independent_Components => 0, Pragma_Initialize_Scalars => -1, Pragma_Inline => 0, Pragma_Inline_Always => 0, *************** package body Sem_Prag is *** 12556,12561 **** --- 14008,14014 ---- Pragma_Interrupt_Handler => -1, Pragma_Interrupt_Priority => -1, Pragma_Interrupt_State => -1, + Pragma_Invariant => -1, Pragma_Java_Constructor => -1, Pragma_Java_Interface => -1, Pragma_Keep_Names => 0, *************** package body Sem_Prag is *** 12581,12586 **** --- 14034,14040 ---- Pragma_Obsolescent => 0, Pragma_Optimize => -1, Pragma_Optimize_Alignment => -1, + Pragma_Ordered => 0, Pragma_Pack => 0, Pragma_Page => -1, Pragma_Passive => -1, *************** package body Sem_Prag is *** 12589,12594 **** --- 14043,14049 ---- Pragma_Persistent_BSS => 0, Pragma_Postcondition => -1, Pragma_Precondition => -1, + Pragma_Predicate => -1, Pragma_Preelaborate => -1, Pragma_Preelaborate_05 => -1, Pragma_Priority => -1, *************** package body Sem_Prag is *** 12613,12618 **** --- 14068,14074 ---- Pragma_Share_Generic => -1, Pragma_Shared => -1, Pragma_Shared_Passive => -1, + Pragma_Short_Descriptors => 0, Pragma_Source_File_Name => -1, Pragma_Source_File_Name_Project => -1, Pragma_Source_Reference => -1, *************** package body Sem_Prag is *** 12780,12814 **** procedure Process_Compilation_Unit_Pragmas (N : Node_Id) is begin -- A special check for pragma Suppress_All, a very strange DEC pragma, ! -- strange because it comes at the end of the unit. If we have a pragma ! -- Suppress_All in the Pragmas_After of the current unit, then we insert ! -- a pragma Suppress (All_Checks) at the start of the context clause to ! -- ensure the correct processing. ! declare ! PA : constant List_Id := Pragmas_After (Aux_Decls_Node (N)); ! P : Node_Id; ! begin ! if Present (PA) then ! P := First (PA); ! while Present (P) loop ! if Pragma_Name (P) = Name_Suppress_All then ! Prepend_To (Context_Items (N), ! Make_Pragma (Sloc (P), ! Chars => Name_Suppress, ! Pragma_Argument_Associations => New_List ( ! Make_Pragma_Argument_Association (Sloc (P), ! Expression => ! Make_Identifier (Sloc (P), ! Chars => Name_All_Checks))))); ! exit; ! end if; - Next (P); - end loop; - end if; - end; end Process_Compilation_Unit_Pragmas; -------- --- 14236,14259 ---- procedure Process_Compilation_Unit_Pragmas (N : Node_Id) is begin -- A special check for pragma Suppress_All, a very strange DEC pragma, ! -- strange because it comes at the end of the unit. Rational has the ! -- same name for a pragma, but treats it as a program unit pragma, In ! -- GNAT we just decide to allow it anywhere at all. If it appeared then ! -- the flag Has_Pragma_Suppress_All was set on the compilation unit ! -- node, and we insert a pragma Suppress (All_Checks) at the start of ! -- the context clause to ensure the correct processing. ! if Has_Pragma_Suppress_All (N) then ! Prepend_To (Context_Items (N), ! Make_Pragma (Sloc (N), ! Chars => Name_Suppress, ! Pragma_Argument_Associations => New_List ( ! Make_Pragma_Argument_Association (Sloc (N), ! Expression => Make_Identifier (Sloc (N), Name_All_Checks))))); ! end if; ! -- Nothing else to do at the current time! end Process_Compilation_Unit_Pragmas; -------- diff -Nrcpad gcc-4.5.2/gcc/ada/sem_prag.ads gcc-4.6.0/gcc/ada/sem_prag.ads *** gcc-4.5.2/gcc/ada/sem_prag.ads Mon Apr 14 21:07:59 2008 --- gcc-4.6.0/gcc/ada/sem_prag.ads Tue Oct 12 10:32:58 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Prag is *** 99,106 **** procedure Process_Compilation_Unit_Pragmas (N : Node_Id); -- Called at the start of processing compilation unit N to deal with any -- special issues regarding pragmas. In particular, we have to deal with ! -- Suppress_All at this stage, since it appears after the unit instead of ! -- before. procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id); -- This routine is used to set an encoded interface name. The node S is an --- 99,106 ---- procedure Process_Compilation_Unit_Pragmas (N : Node_Id); -- Called at the start of processing compilation unit N to deal with any -- special issues regarding pragmas. In particular, we have to deal with ! -- Suppress_All at this stage, since it can appear after the unit instead ! -- of before (actually we allow it to appear anywhere). procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id); -- This routine is used to set an encoded interface name. The node S is an diff -Nrcpad gcc-4.5.2/gcc/ada/sem_res.adb gcc-4.6.0/gcc/ada/sem_res.adb *** gcc-4.5.2/gcc/ada/sem_res.adb Fri Oct 30 12:02:11 2009 --- gcc-4.6.0/gcc/ada/sem_res.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Util; use Sem_Util; *** 68,73 **** --- 68,74 ---- with Sem_Type; use Sem_Type; with Sem_Warn; use Sem_Warn; with Sinfo; use Sinfo; + with Sinfo.CN; use Sinfo.CN; with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; *************** package body Sem_Res is *** 91,96 **** --- 92,106 ---- -- Note that Resolve_Attribute is separated off in Sem_Attr + function Bad_Unordered_Enumeration_Reference + (N : Node_Id; + T : Entity_Id) return Boolean; + -- Node N contains a potentially dubious reference to type T, either an + -- explicit comparison, or an explicit range. This function returns True + -- if the type T is an enumeration type for which No pragma Order has been + -- given, and the reference N is not in the same extended source unit as + -- the declaration of T. + procedure Check_Discriminant_Use (N : Node_Id); -- Enforce the restrictions on the use of discriminants when constraining -- a component of a discriminated type (record or concurrent type). *************** package body Sem_Res is *** 130,139 **** -- declaration, and not an (anonymous) allocator type. function Is_Predefined_Op (Nam : Entity_Id) return Boolean; ! -- Utility to check whether the name in the call is a predefined ! -- operator, in which case the call is made into an operator node. ! -- An instance of an intrinsic conversion operation may be given ! -- an operator name, but is not treated like an operator. procedure Replace_Actual_Discriminants (N : Node_Id; Default : Node_Id); -- If a default expression in entry call N depends on the discriminants --- 140,153 ---- -- declaration, and not an (anonymous) allocator type. function Is_Predefined_Op (Nam : Entity_Id) return Boolean; ! -- Utility to check whether the entity for an operator is a predefined ! -- operator, in which case the expression is left as an operator in the ! -- tree (else it is rewritten into a call). An instance of an intrinsic ! -- conversion operation may be given an operator name, but is not treated ! -- like an operator. Note that an operator that is an imported back-end ! -- builtin has convention Intrinsic, but is expected to be rewritten into ! -- a call, so such an operator is not treated as predefined by this ! -- predicate. procedure Replace_Actual_Discriminants (N : Node_Id; Default : Node_Id); -- If a default expression in entry call N depends on the discriminants *************** package body Sem_Res is *** 160,171 **** procedure Resolve_Allocator (N : Node_Id; Typ : Entity_Id); procedure Resolve_Arithmetic_Op (N : Node_Id; Typ : Entity_Id); procedure Resolve_Call (N : Node_Id; Typ : Entity_Id); procedure Resolve_Character_Literal (N : Node_Id; Typ : Entity_Id); procedure Resolve_Comparison_Op (N : Node_Id; Typ : Entity_Id); procedure Resolve_Conditional_Expression (N : Node_Id; Typ : Entity_Id); procedure Resolve_Equality_Op (N : Node_Id; Typ : Entity_Id); procedure Resolve_Explicit_Dereference (N : Node_Id; Typ : Entity_Id); ! procedure Resolve_Entity_Name (N : Node_Id; Typ : Entity_Id); procedure Resolve_Indexed_Component (N : Node_Id; Typ : Entity_Id); procedure Resolve_Integer_Literal (N : Node_Id; Typ : Entity_Id); procedure Resolve_Logical_Op (N : Node_Id; Typ : Entity_Id); --- 174,187 ---- procedure Resolve_Allocator (N : Node_Id; Typ : Entity_Id); procedure Resolve_Arithmetic_Op (N : Node_Id; Typ : Entity_Id); procedure Resolve_Call (N : Node_Id; Typ : Entity_Id); + procedure Resolve_Case_Expression (N : Node_Id; Typ : Entity_Id); procedure Resolve_Character_Literal (N : Node_Id; Typ : Entity_Id); procedure Resolve_Comparison_Op (N : Node_Id; Typ : Entity_Id); procedure Resolve_Conditional_Expression (N : Node_Id; Typ : Entity_Id); + procedure Resolve_Entity_Name (N : Node_Id; Typ : Entity_Id); procedure Resolve_Equality_Op (N : Node_Id; Typ : Entity_Id); procedure Resolve_Explicit_Dereference (N : Node_Id; Typ : Entity_Id); ! procedure Resolve_Expression_With_Actions (N : Node_Id; Typ : Entity_Id); procedure Resolve_Indexed_Component (N : Node_Id; Typ : Entity_Id); procedure Resolve_Integer_Literal (N : Node_Id; Typ : Entity_Id); procedure Resolve_Logical_Op (N : Node_Id; Typ : Entity_Id); *************** package body Sem_Res is *** 176,181 **** --- 192,198 ---- procedure Resolve_Op_Expon (N : Node_Id; Typ : Entity_Id); procedure Resolve_Op_Not (N : Node_Id; Typ : Entity_Id); procedure Resolve_Qualified_Expression (N : Node_Id; Typ : Entity_Id); + procedure Resolve_Quantified_Expression (N : Node_Id; Typ : Entity_Id); procedure Resolve_Range (N : Node_Id; Typ : Entity_Id); procedure Resolve_Real_Literal (N : Node_Id; Typ : Entity_Id); procedure Resolve_Reference (N : Node_Id; Typ : Entity_Id); *************** package body Sem_Res is *** 211,219 **** procedure Resolve_Intrinsic_Operator (N : Node_Id; Typ : Entity_Id); -- A call to a user-defined intrinsic operator is rewritten as a call -- to the corresponding predefined operator, with suitable conversions. procedure Resolve_Intrinsic_Unary_Operator (N : Node_Id; Typ : Entity_Id); ! -- Ditto, for unary operators (only arithmetic ones) procedure Rewrite_Operator_As_Call (N : Node_Id; Nam : Entity_Id); -- If an operator node resolves to a call to a user-defined operator, --- 228,240 ---- procedure Resolve_Intrinsic_Operator (N : Node_Id; Typ : Entity_Id); -- A call to a user-defined intrinsic operator is rewritten as a call -- to the corresponding predefined operator, with suitable conversions. + -- Note that this applies only for intrinsic operators that denote + -- predefined operators, not operators that are intrinsic imports of + -- back-end builtins. procedure Resolve_Intrinsic_Unary_Operator (N : Node_Id; Typ : Entity_Id); ! -- Ditto, for unary operators (arithmetic ones and "not" on signed ! -- integer types for VMS). procedure Rewrite_Operator_As_Call (N : Node_Id; Nam : Entity_Id); -- If an operator node resolves to a call to a user-defined operator, *************** package body Sem_Res is *** 276,291 **** -- First the ones in Standard ! Error_Msg_N ! ("\\possible interpretation: Character!", C); ! Error_Msg_N ! ("\\possible interpretation: Wide_Character!", C); -- Include Wide_Wide_Character in Ada 2005 mode ! if Ada_Version >= Ada_05 then ! Error_Msg_N ! ("\\possible interpretation: Wide_Wide_Character!", C); end if; -- Now any other types that match --- 297,309 ---- -- First the ones in Standard ! Error_Msg_N ("\\possible interpretation: Character!", C); ! Error_Msg_N ("\\possible interpretation: Wide_Character!", C); -- Include Wide_Wide_Character in Ada 2005 mode ! if Ada_Version >= Ada_2005 then ! Error_Msg_N ("\\possible interpretation: Wide_Wide_Character!", C); end if; -- Now any other types that match *************** package body Sem_Res is *** 393,398 **** --- 411,432 ---- end if; end Analyze_And_Resolve; + ---------------------------------------- + -- Bad_Unordered_Enumeration_Reference -- + ---------------------------------------- + + function Bad_Unordered_Enumeration_Reference + (N : Node_Id; + T : Entity_Id) return Boolean + is + begin + return Is_Enumeration_Type (T) + and then Comes_From_Source (N) + and then Warn_On_Unordered_Enumeration_Type + and then not Has_Pragma_Ordered (T) + and then not In_Same_Extended_Unit (N, T); + end Bad_Unordered_Enumeration_Reference; + ---------------------------- -- Check_Discriminant_Use -- ---------------------------- *************** package body Sem_Res is *** 632,640 **** procedure Check_For_Visible_Operator (N : Node_Id; T : Entity_Id) is begin if Is_Invisible_Operator (N, T) then ! Error_Msg_NE ("operator for} is not directly visible!", N, First_Subtype (T)); ! Error_Msg_N ("use clause would make operation legal!", N); end if; end Check_For_Visible_Operator; --- 666,675 ---- procedure Check_For_Visible_Operator (N : Node_Id; T : Entity_Id) is begin if Is_Invisible_Operator (N, T) then ! Error_Msg_NE -- CODEFIX ("operator for} is not directly visible!", N, First_Subtype (T)); ! Error_Msg_N -- CODEFIX ! ("use clause would make operation legal!", N); end if; end Check_For_Visible_Operator; *************** package body Sem_Res is *** 674,680 **** -- are handled by Analyze_Access_Attribute, Analyze_Assignment, -- Analyze_Object_Renaming, and Freeze_Entity. ! elsif Ada_Version >= Ada_05 and then Is_Entity_Name (Pref) and then Is_Access_Type (Etype (Pref)) and then Ekind (Directly_Designated_Type (Etype (Pref))) = --- 709,715 ---- -- are handled by Analyze_Access_Attribute, Analyze_Assignment, -- Analyze_Object_Renaming, and Freeze_Entity. ! elsif Ada_Version >= Ada_2005 and then Is_Entity_Name (Pref) and then Is_Access_Type (Etype (Pref)) and then Ekind (Directly_Designated_Type (Etype (Pref))) = *************** package body Sem_Res is *** 784,791 **** if Nkind_In (P, N_Or_Else, N_And_Then, ! N_If_Statement, ! N_Case_Statement) then return False; --- 819,828 ---- if Nkind_In (P, N_Or_Else, N_And_Then, ! N_Case_Expression, ! N_Case_Statement, ! N_Conditional_Expression, ! N_If_Statement) then return False; *************** package body Sem_Res is *** 898,907 **** Expr := Original_Node (Expression (Parent (Comp))); -- Return True if the expression is a call to a function ! -- (including an attribute function such as Image) with ! -- a result that requires a transient scope. if (Nkind (Expr) = N_Function_Call or else (Nkind (Expr) = N_Attribute_Reference and then Present (Expressions (Expr)))) and then Requires_Transient_Scope (Etype (Expr)) --- 935,946 ---- Expr := Original_Node (Expression (Parent (Comp))); -- Return True if the expression is a call to a function ! -- (including an attribute function such as Image, or a ! -- user-defined operator) with a result that requires a ! -- transient scope. if (Nkind (Expr) = N_Function_Call + or else Nkind (Expr) in N_Op or else (Nkind (Expr) = N_Attribute_Reference and then Present (Expressions (Expr)))) and then Requires_Transient_Scope (Etype (Expr)) *************** package body Sem_Res is *** 975,980 **** --- 1014,1030 ---- It : Interp; begin + -- If the context is an attribute reference that can apply to + -- functions, this is never a parameterless call (RM 4.1.4(6)). + + if Nkind (Parent (N)) = N_Attribute_Reference + and then (Attribute_Name (Parent (N)) = Name_Address + or else Attribute_Name (Parent (N)) = Name_Code_Address + or else Attribute_Name (Parent (N)) = Name_Access) + then + return False; + end if; + if not Is_Overloaded (N) then return Ekind (Etype (N)) = E_Subprogram_Type *************** package body Sem_Res is *** 1031,1040 **** -- 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)) and then (Ekind (Entity (N)) /= E_Enumeration_Literal ! or else Is_Overloaded (N))) -- Rewrite as call if it is an explicit dereference of an expression of -- a subprogram access type, and the subprogram type is not that of a --- 1081,1096 ---- -- overloaded case) a function call. If we know for sure that the entity -- is an enumeration literal, we do not rewrite it. + -- If the entity is the name of an operator, it cannot be a call because + -- operators cannot have default parameters. In this case, this must be + -- a string whose contents coincide with an operator name. Set the kind + -- of the node appropriately. + if (Is_Entity_Name (N) + and then Nkind (N) /= N_Operator_Symbol and then Is_Overloadable (Entity (N)) and then (Ekind (Entity (N)) /= E_Enumeration_Literal ! or else Is_Overloaded (N))) -- Rewrite as call if it is an explicit dereference of an expression of -- a subprogram access type, and the subprogram type is not that of a *************** package body Sem_Res is *** 1050,1060 **** or else (Nkind (N) = N_Selected_Component and then (Ekind (Entity (Selector_Name (N))) = E_Function ! or else ! ((Ekind (Entity (Selector_Name (N))) = E_Entry ! or else ! Ekind (Entity (Selector_Name (N))) = E_Procedure) ! and then Is_Overloaded (Selector_Name (N))))) -- If one of the above three conditions is met, rewrite as call. -- Apply the rewriting only once. --- 1106,1115 ---- or else (Nkind (N) = N_Selected_Component and then (Ekind (Entity (Selector_Name (N))) = E_Function ! or else ! (Ekind_In (Entity (Selector_Name (N)), E_Entry, ! E_Procedure) ! and then Is_Overloaded (Selector_Name (N))))) -- If one of the above three conditions is met, rewrite as call. -- Apply the rewriting only once. *************** package body Sem_Res is *** 1081,1086 **** --- 1136,1146 ---- elsif Nkind (N) = N_Parameter_Association then Check_Parameterless_Call (Explicit_Actual_Parameter (N)); + + elsif Nkind (N) = N_Operator_Symbol then + Change_Operator_Symbol_To_String_Literal (N); + Set_Is_Overloaded (N, False); + Set_Etype (N, Any_String); end if; end Check_Parameterless_Call; *************** package body Sem_Res is *** 1102,1112 **** function Is_Predefined_Op (Nam : Entity_Id) return Boolean is begin ! return Is_Intrinsic_Subprogram (Nam) ! and then not Is_Generic_Instance (Nam) and then Chars (Nam) in Any_Operator_Name ! and then (No (Alias (Nam)) ! or else Is_Predefined_Op (Alias (Nam))); end Is_Predefined_Op; ----------------------------- --- 1162,1182 ---- function Is_Predefined_Op (Nam : Entity_Id) return Boolean is begin ! -- Predefined operators are intrinsic subprograms ! ! if not Is_Intrinsic_Subprogram (Nam) then ! return False; ! end if; ! ! -- A call to a back-end builtin is never a predefined operator ! ! if Is_Imported (Nam) and then Present (Interface_Name (Nam)) then ! return False; ! end if; ! ! return not Is_Generic_Instance (Nam) and then Chars (Nam) in Any_Operator_Name ! and then (No (Alias (Nam)) or else Is_Predefined_Op (Alias (Nam))); end Is_Predefined_Op; ----------------------------- *************** package body Sem_Res is *** 1132,1144 **** type Kind_Test is access function (E : Entity_Id) return Boolean; function Operand_Type_In_Scope (S : Entity_Id) return Boolean; ! -- If the operand is not universal, and the operator is given by a ! -- expanded name, verify that the operand has an interpretation with ! -- a type defined in the given scope of the operator. function Type_In_P (Test : Kind_Test) return Entity_Id; ! -- Find a type of the given class in the package Pack that contains ! -- the operator. --------------------------- -- Operand_Type_In_Scope -- --- 1202,1214 ---- type Kind_Test is access function (E : Entity_Id) return Boolean; function Operand_Type_In_Scope (S : Entity_Id) return Boolean; ! -- If the operand is not universal, and the operator is given by an ! -- expanded name, verify that the operand has an interpretation with a ! -- type defined in the given scope of the operator. function Type_In_P (Test : Kind_Test) return Entity_Id; ! -- Find a type of the given class in package Pack that contains the ! -- operator. --------------------------- -- Operand_Type_In_Scope -- *************** package body Sem_Res is *** 1213,1224 **** -- Start of processing for Type_In_P begin ! -- If the context type is declared in the prefix package, this ! -- is the desired base type. ! if Scope (Base_Type (Typ)) = Pack ! and then Test (Typ) ! then return Base_Type (Typ); else --- 1283,1292 ---- -- Start of processing for Type_In_P begin ! -- If the context type is declared in the prefix package, this is the ! -- desired base type. ! if Scope (Base_Type (Typ)) = Pack and then Test (Typ) then return Base_Type (Typ); else *************** package body Sem_Res is *** 1274,1289 **** -- you courtesy of b33302a. The type itself must be frozen, so we must -- find the type of the proper class in the given scope. ! -- A final wrinkle is the multiplication operator for fixed point ! -- types, which is defined in Standard only, and not in the scope of ! -- the fixed_point type itself. if Nkind (Name (N)) = N_Expanded_Name then Pack := Entity (Prefix (Name (N))); ! -- If the entity being called is defined in the given package, ! -- it is a renaming of a predefined operator, and known to be ! -- legal. if Scope (Entity (Name (N))) = Pack and then Pack /= Standard_Standard --- 1342,1356 ---- -- you courtesy of b33302a. The type itself must be frozen, so we must -- find the type of the proper class in the given scope. ! -- A final wrinkle is the multiplication operator for fixed point types, ! -- which is defined in Standard only, and not in the scope of the ! -- fixed point type itself. if Nkind (Name (N)) = N_Expanded_Name then Pack := Entity (Prefix (Name (N))); ! -- If the entity being called is defined in the given package, it is ! -- a renaming of a predefined operator, and known to be legal. if Scope (Entity (Name (N))) = Pack and then Pack /= Standard_Standard *************** package body Sem_Res is *** 1297,1304 **** elsif In_Instance then null; ! elsif (Op_Name = Name_Op_Multiply ! or else Op_Name = Name_Op_Divide) and then Is_Fixed_Point_Type (Etype (Left_Opnd (Op_Node))) and then Is_Fixed_Point_Type (Etype (Right_Opnd (Op_Node))) then --- 1364,1370 ---- elsif In_Instance then null; ! elsif (Op_Name = Name_Op_Multiply or else Op_Name = Name_Op_Divide) and then Is_Fixed_Point_Type (Etype (Left_Opnd (Op_Node))) and then Is_Fixed_Point_Type (Etype (Right_Opnd (Op_Node))) then *************** package body Sem_Res is *** 1306,1315 **** Error := True; end if; ! -- Ada 2005, AI-420: Predefined equality on Universal_Access ! -- is available. ! elsif Ada_Version >= Ada_05 and then (Op_Name = Name_Op_Eq or else Op_Name = Name_Op_Ne) and then Ekind (Etype (Act1)) = E_Anonymous_Access_Type then --- 1372,1381 ---- Error := True; end if; ! -- Ada 2005 AI-420: Predefined equality on Universal_Access is ! -- available. ! elsif Ada_Version >= Ada_2005 and then (Op_Name = Name_Op_Eq or else Op_Name = Name_Op_Ne) and then Ekind (Etype (Act1)) = E_Anonymous_Access_Type then *************** package body Sem_Res is *** 1338,1344 **** if Pack /= Standard_Standard then if Opnd_Type = Universal_Integer then ! Orig_Type := Type_In_P (Is_Integer_Type'Access); elsif Opnd_Type = Universal_Real then Orig_Type := Type_In_P (Is_Real_Type'Access); --- 1404,1410 ---- if Pack /= Standard_Standard then if Opnd_Type = Universal_Integer then ! Orig_Type := Type_In_P (Is_Integer_Type'Access); elsif Opnd_Type = Universal_Real then Orig_Type := Type_In_P (Is_Real_Type'Access); *************** package body Sem_Res is *** 1347,1353 **** Orig_Type := Type_In_P (Is_String_Type'Access); elsif Opnd_Type = Any_Access then ! Orig_Type := Type_In_P (Is_Definite_Access_Type'Access); elsif Opnd_Type = Any_Composite then Orig_Type := Type_In_P (Is_Composite_Type'Access); --- 1413,1419 ---- Orig_Type := Type_In_P (Is_String_Type'Access); elsif Opnd_Type = Any_Access then ! Orig_Type := Type_In_P (Is_Definite_Access_Type'Access); elsif Opnd_Type = Any_Composite then Orig_Type := Type_In_P (Is_Composite_Type'Access); *************** package body Sem_Res is *** 1407,1412 **** --- 1473,1513 ---- ("& not declared in&", N, Selector_Name (Name (N))); Set_Etype (N, Any_Type); return; + + -- Detect a mismatch between the context type and the result type + -- in the named package, which is otherwise not detected if the + -- operands are universal. Check is only needed if source entity is + -- an operator, not a function that renames an operator. + + elsif Nkind (Parent (N)) /= N_Type_Conversion + and then Ekind (Entity (Name (N))) = E_Operator + and then Is_Numeric_Type (Typ) + and then not Is_Universal_Numeric_Type (Typ) + and then Scope (Base_Type (Typ)) /= Pack + and then not In_Instance + then + if Is_Fixed_Point_Type (Typ) + and then (Op_Name = Name_Op_Multiply + or else + Op_Name = Name_Op_Divide) + then + -- Already checked above + + null; + + -- Operator may be defined in an extension of System + + elsif Present (System_Aux_Id) + and then Scope (Opnd_Type) = System_Aux_Id + then + null; + + else + -- Could we use Wrong_Type here??? (this would require setting + -- Etype (N) to the actual type found where Typ was expected). + + Error_Msg_NE ("expect }", N, Typ); + end if; end if; end if; *************** package body Sem_Res is *** 1468,1481 **** else Resolve (N, Typ); end if; - - -- For predefined operators on literals, the operation freezes - -- their type. - - if Present (Orig_Type) then - Set_Etype (Act1, Orig_Type); - Freeze_Expression (Act1); - end if; end Make_Call_Into_Operator; ------------------- --- 1569,1574 ---- *************** package body Sem_Res is *** 1669,1674 **** --- 1762,1771 ---- -- Try and fix up a literal so that it matches its expected type. New -- literals are manufactured if necessary to avoid cascaded errors. + procedure Report_Ambiguous_Argument; + -- Additional diagnostics when an ambiguous call has an ambiguous + -- argument (typically a controlling actual). + procedure Resolution_Failed; -- Called when attempt at resolving current expression fails *************** package body Sem_Res is *** 1733,1738 **** --- 1830,1868 ---- end if; end Patch_Up_Value; + ------------------------------- + -- Report_Ambiguous_Argument -- + ------------------------------- + + procedure Report_Ambiguous_Argument is + Arg : constant Node_Id := First (Parameter_Associations (N)); + I : Interp_Index; + It : Interp; + + begin + if Nkind (Arg) = N_Function_Call + and then Is_Entity_Name (Name (Arg)) + and then Is_Overloaded (Name (Arg)) + then + Error_Msg_NE ("ambiguous call to&", Arg, Name (Arg)); + + -- Could use comments on what is going on here ??? + + Get_First_Interp (Name (Arg), I, It); + while Present (It.Nam) loop + Error_Msg_Sloc := Sloc (It.Nam); + + if Nkind (Parent (It.Nam)) = N_Full_Type_Declaration then + Error_Msg_N ("interpretation (inherited) #!", Arg); + else + Error_Msg_N ("interpretation #!", Arg); + end if; + + Get_Next_Interp (I, It); + end loop; + end if; + end Report_Ambiguous_Argument; + ----------------------- -- Resolution_Failed -- ----------------------- *************** package body Sem_Res is *** 1805,1810 **** --- 1935,1941 ---- -- Check that Typ is a remote access-to-subprogram type if Is_Remote_Access_To_Subprogram_Type (Typ) then + -- Prefix (N) must statically denote a remote subprogram -- declared in a package specification. *************** package body Sem_Res is *** 1917,1923 **** -- type against which we are resolving is the same as the -- type of the interpretation. ! if Ada_Version >= Ada_05 and then It.Typ = Typ and then Typ /= Universal_Integer and then Typ /= Universal_Real --- 2048,2054 ---- -- type against which we are resolving is the same as the -- type of the interpretation. ! if Ada_Version >= Ada_2005 and then It.Typ = Typ and then Typ /= Universal_Integer and then Typ /= Universal_Real *************** package body Sem_Res is *** 2037,2042 **** --- 2168,2180 ---- Error_Msg_N -- CODEFIX ("\\possible interpretation#!", N); end if; + + if Nkind_In + (N, N_Procedure_Call_Statement, N_Function_Call) + and then Present (Parameter_Associations (N)) + then + Report_Ambiguous_Argument; + end if; end if; Error_Msg_Sloc := Sloc (It.Nam); *************** package body Sem_Res is *** 2077,2083 **** -- If this is an indirect call, use the subprogram_type -- in the message, to have a meaningful location. ! -- Indicate as well if this is an inherited operation, -- created by a type declaration. elsif Nkind (N) = N_Function_Call --- 2215,2221 ---- -- If this is an indirect call, use the subprogram_type -- in the message, to have a meaningful location. ! -- Also indicate if this is an inherited operation, -- created by a type declaration. elsif Nkind (N) = N_Function_Call *************** package body Sem_Res is *** 2134,2139 **** --- 2272,2280 ---- Set_Entity (N, Seen); Generate_Reference (Seen, N); + elsif Nkind (N) = N_Case_Expression then + Set_Etype (N, Expr_Type); + elsif Nkind (N) = N_Character_Literal then Set_Etype (N, Expr_Type); *************** package body Sem_Res is *** 2158,2168 **** null; -- For procedure or function calls, set the type of the name, ! -- and also the entity pointer for the prefix 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 Set_Etype (Name (N), Expr_Type); Set_Entity (Name (N), Seen); --- 2299,2308 ---- null; -- For procedure or function calls, set the type of the name, ! -- and also the entity pointer for the prefix. elsif Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) ! and then Is_Entity_Name (Name (N)) then Set_Etype (Name (N), Expr_Type); Set_Entity (Name (N), Seen); *************** package body Sem_Res is *** 2194,2202 **** end if; -- At this stage Found indicates whether or not an acceptable ! -- interpretation exists. If not, then we have an error, except ! -- that if the context is Any_Type as a result of some other error, ! -- then we suppress the error report. if not Found then if Typ /= Any_Type then --- 2334,2342 ---- end if; -- At this stage Found indicates whether or not an acceptable ! -- interpretation exists. If not, then we have an error, except that if ! -- the context is Any_Type as a result of some other error, then we ! -- suppress the error report. if not Found then if Typ /= Any_Type then *************** package body Sem_Res is *** 2489,2494 **** --- 2629,2637 ---- when N_Attribute_Reference => Resolve_Attribute (N, Ctx_Type); + when N_Case_Expression + => Resolve_Case_Expression (N, Ctx_Type); + when N_Character_Literal => Resolve_Character_Literal (N, Ctx_Type); *************** package body Sem_Res is *** 2498,2509 **** when N_Expanded_Name => Resolve_Entity_Name (N, Ctx_Type); - when N_Extension_Aggregate - => Resolve_Extension_Aggregate (N, Ctx_Type); - when N_Explicit_Dereference => Resolve_Explicit_Dereference (N, Ctx_Type); when N_Function_Call => Resolve_Call (N, Ctx_Type); --- 2641,2655 ---- when N_Expanded_Name => Resolve_Entity_Name (N, Ctx_Type); when N_Explicit_Dereference => Resolve_Explicit_Dereference (N, Ctx_Type); + when N_Expression_With_Actions + => Resolve_Expression_With_Actions (N, Ctx_Type); + + when N_Extension_Aggregate + => Resolve_Extension_Aggregate (N, Ctx_Type); + when N_Function_Call => Resolve_Call (N, Ctx_Type); *************** package body Sem_Res is *** 2555,2560 **** --- 2701,2709 ---- when N_Qualified_Expression => Resolve_Qualified_Expression (N, Ctx_Type); + when N_Quantified_Expression + => Resolve_Quantified_Expression (N, Ctx_Type); + when N_Raise_xxx_Error => Set_Etype (N, Ctx_Type); *************** package body Sem_Res is *** 2584,2590 **** when N_Unchecked_Type_Conversion => Resolve_Unchecked_Type_Conversion (N, Ctx_Type); - end case; -- If the subexpression was replaced by a non-subexpression, then --- 2733,2738 ---- *************** package body Sem_Res is *** 2598,2603 **** --- 2746,2763 ---- return; end if; + -- AI05-144-2: Check dangerous order dependence within an expression + -- that is not a subexpression. Exclude RHS of an assignment, because + -- both sides may have side-effects and the check must be performed + -- over the statement. + + if Nkind (Parent (N)) not in N_Subexpr + and then Nkind (Parent (N)) /= N_Assignment_Statement + and then Nkind (Parent (N)) /= N_Procedure_Call_Statement + then + Check_Order_Dependence; + end if; + -- The expression is definitely NOT overloaded at this point, so -- we reset the Is_Overloaded flag to avoid any confusion when -- reanalyzing the node. *************** package body Sem_Res is *** 2978,2985 **** -- If the default expression raises constraint error, then just -- silently replace it with an N_Raise_Constraint_Error node, -- since we already gave the warning on the subprogram spec. ! if Raises_Constraint_Error (Actval) then Rewrite (Actval, Make_Raise_Constraint_Error (Loc, Reason => CE_Range_Check_Failed)); --- 3138,3149 ---- -- If the default expression raises constraint error, then just -- silently replace it with an N_Raise_Constraint_Error node, -- since we already gave the warning on the subprogram spec. + -- If node is already a Raise_Constraint_Error leave as is, to + -- prevent loops in the warnings removal machinery. ! if Raises_Constraint_Error (Actval) ! and then Nkind (Actval) /= N_Raise_Constraint_Error ! then Rewrite (Actval, Make_Raise_Constraint_Error (Loc, Reason => CE_Range_Check_Failed)); *************** package body Sem_Res is *** 3172,3216 **** if Ekind (F) = E_In_Out_Parameter and then Is_Array_Type (Etype (F)) then ! if Has_Aliased_Components (Etype (Expression (A))) ! /= Has_Aliased_Components (Etype (F)) ! then ! ! -- 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)). ! -- 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 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" --- 3336,3390 ---- if Ekind (F) = E_In_Out_Parameter and then Is_Array_Type (Etype (F)) then ! -- 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)). ! -- The extra rule in 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 ??? + if Has_Aliased_Components (Etype (Expression (A))) /= + Has_Aliased_Components (Etype (F)) + then Error_Msg_N ("both component types in a view conversion must be" & " aliased, or neither", A); + -- Comment here??? what set of cases??? + elsif not Same_Ancestor (Etype (F), Etype (Expression (A))) then + -- Check view conv between unrelated by ref array types + if 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); ! ! -- In Ada 2005 mode, check view conversion component ! -- type cannot be private, tagged, or volatile. Note ! -- that we only apply this to source conversions. The ! -- generated code can contain conversions which are ! -- not subject to this test, and we cannot extract the ! -- component type in such cases since it is not present. ! ! elsif Comes_From_Source (A) ! and then Ada_Version >= Ada_2005 ! then declare Comp_Type : constant Entity_Id := Component_Type (Etype (Expression (A))); begin ! if (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" *************** package body Sem_Res is *** 3223,3230 **** end if; end if; if (Conversion_OK (A) ! or else Valid_Conversion (A, Etype (A), Expression (A))) and then not Is_Ref_To_Bit_Packed_Array (Expression (A)) then Resolve (Expression (A)); --- 3397,3406 ---- end if; end if; + -- Resolve expression if conversion is all OK + if (Conversion_OK (A) ! or else Valid_Conversion (A, Etype (A), Expression (A))) and then not Is_Ref_To_Bit_Packed_Array (Expression (A)) then Resolve (Expression (A)); *************** package body Sem_Res is *** 3379,3384 **** --- 3555,3565 ---- A_Typ := Etype (A); F_Typ := Etype (F); + -- Save actual for subsequent check on order dependence, and + -- indicate whether actual is modifiable. For AI05-0144-2. + + Save_Actual (A, Ekind (F) /= E_In_Parameter); + -- For mode IN, if actual is an entity, and the type of the formal -- has warnings suppressed, then we reset Never_Set_In_Source for -- the calling entity. The reason for this is to catch cases like *************** package body Sem_Res is *** 3490,3498 **** -- might not be done in the In Out case since Gigi does not do -- any analysis. More thought required about this ??? ! if Ekind (F) = E_In_Parameter ! or else Ekind (F) = E_In_Out_Parameter ! then if Is_Scalar_Type (Etype (A)) then Apply_Scalar_Range_Check (A, F_Typ); --- 3671,3690 ---- -- might not be done in the In Out case since Gigi does not do -- any analysis. More thought required about this ??? ! if Ekind_In (F, E_In_Parameter, E_In_Out_Parameter) then ! ! -- Apply predicate checks, unless this is a call to the ! -- predicate check function itself, which would cause an ! -- infinite recursion. ! ! if not (Ekind (Nam) = E_Function ! and then Has_Predicates (Nam)) ! then ! Apply_Predicate_Check (A, F_Typ); ! end if; ! ! -- Apply required constraint checks ! if Is_Scalar_Type (Etype (A)) then Apply_Scalar_Range_Check (A, F_Typ); *************** package body Sem_Res is *** 3523,3546 **** Apply_Range_Check (A, F_Typ); end if; ! -- Ada 2005 (AI-231) ! if Ada_Version >= Ada_05 ! and then Is_Access_Type (F_Typ) and then Can_Never_Be_Null (F_Typ) and then Known_Null (A) then ! Apply_Compile_Time_Constraint_Error ! (N => A, ! Msg => "(Ada 2005) null not allowed in " ! & "null-excluding formal?", ! Reason => CE_Null_Not_Allowed); end if; end if; ! if Ekind (F) = E_Out_Parameter ! or else Ekind (F) = E_In_Out_Parameter ! then if Nkind (A) = N_Type_Conversion then if Is_Scalar_Type (A_Typ) then Apply_Scalar_Range_Check --- 3715,3746 ---- Apply_Range_Check (A, F_Typ); end if; ! -- Ada 2005 (AI-231): Note that the controlling parameter case ! -- already existed in Ada 95, which is partially checked ! -- elsewhere (see Checks), and we don't want the warning ! -- message to differ. ! if Is_Access_Type (F_Typ) and then Can_Never_Be_Null (F_Typ) and then Known_Null (A) then ! if Is_Controlling_Formal (F) then ! Apply_Compile_Time_Constraint_Error ! (N => A, ! Msg => "null value not allowed here?", ! Reason => CE_Access_Check_Failed); ! ! elsif Ada_Version >= Ada_2005 then ! Apply_Compile_Time_Constraint_Error ! (N => A, ! Msg => "(Ada 2005) null not allowed in " ! & "null-excluding formal?", ! Reason => CE_Null_Not_Allowed); ! end if; end if; end if; ! if Ekind_In (F, E_Out_Parameter, E_In_Out_Parameter) then if Nkind (A) = N_Type_Conversion then if Is_Scalar_Type (A_Typ) then Apply_Scalar_Range_Check *************** package body Sem_Res is *** 3672,3679 **** Eval_Actual (A); ! -- If it is a named association, treat the selector_name as ! -- a proper identifier, and mark the corresponding entity. if Nkind (Parent (A)) = N_Parameter_Association then Set_Entity (Selector_Name (Parent (A)), F); --- 3872,3879 ---- Eval_Actual (A); ! -- If it is a named association, treat the selector_name as a ! -- proper identifier, and mark the corresponding entity. if Nkind (Parent (A)) = N_Parameter_Association then Set_Entity (Selector_Name (Parent (A)), F); *************** package body Sem_Res is *** 4110,4116 **** -- the case of an initialized allocator with a class-wide argument (see -- Expand_Allocator_Expression). ! if Ada_Version >= Ada_05 and then Is_Class_Wide_Type (Designated_Type (Typ)) then declare --- 4310,4316 ---- -- the case of an initialized allocator with a class-wide argument (see -- Expand_Allocator_Expression). ! if Ada_Version >= Ada_2005 and then Is_Class_Wide_Type (Designated_Type (Typ)) then declare *************** package body Sem_Res is *** 4151,4165 **** -- Check for allocation from an empty storage pool if No_Pool_Assigned (Typ) then ! declare ! Loc : constant Source_Ptr := Sloc (N); ! begin ! Error_Msg_N ("?allocation from empty storage pool!", N); ! Error_Msg_N ("\?Storage_Error will be raised at run time!", N); ! Insert_Action (N, ! Make_Raise_Storage_Error (Loc, ! Reason => SE_Empty_Storage_Pool)); ! end; -- If the context is an unchecked conversion, as may happen within -- an inlined subprogram, the allocator is being resolved with its --- 4351,4357 ---- -- Check for allocation from an empty storage pool if No_Pool_Assigned (Typ) then ! Error_Msg_N ("allocation from empty storage pool!", N); -- If the context is an unchecked conversion, as may happen within -- an inlined subprogram, the allocator is being resolved with its *************** package body Sem_Res is *** 4173,4178 **** --- 4365,4374 ---- (Typ, Associated_Storage_Pool (Etype (Parent (N)))); end if; + if Ekind (Etype (N)) = E_Anonymous_Access_Type then + Check_Restriction (No_Anonymous_Allocators, N); + end if; + -- An erroneous allocator may be rewritten as a raise Program_Error -- statement. *************** package body Sem_Res is *** 4568,4574 **** -- If the context is Universal_Fixed and the operands are also -- 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 T := Unique_Fixed_Point_Type (N); --- 4764,4770 ---- -- If the context is Universal_Fixed and the operands are also -- 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 T := Unique_Fixed_Point_Type (N); *************** package body Sem_Res is *** 4659,4665 **** -- 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 --- 4855,4861 ---- -- violated if either operand can be negative for mod, or for rem -- if both operands can be negative. ! if Restriction_Check_Required (No_Implicit_Conditionals) and then Nkind_In (N, N_Op_Rem, N_Op_Mod) then declare *************** package body Sem_Res is *** 4689,4695 **** -- expander does, so we match its logic here). -- The second case is mod where either operand can be negative. ! -- In this case, the back end has to generate additonal tests. if (Nkind (N) = N_Op_Rem and then (LNeg and RNeg)) or else --- 4885,4891 ---- -- expander does, so we match its logic here). -- The second case is mod where either operand can be negative. ! -- In this case, the back end has to generate additional tests. if (Nkind (N) = N_Op_Rem and then (LNeg and RNeg)) or else *************** package body Sem_Res is *** 4719,4724 **** --- 4915,4942 ---- Scop : Entity_Id; Rtype : Entity_Id; + function Same_Or_Aliased_Subprograms + (S : Entity_Id; + E : Entity_Id) return Boolean; + -- Returns True if the subprogram entity S is the same as E or else + -- S is an alias of E. + + --------------------------------- + -- Same_Or_Aliased_Subprograms -- + --------------------------------- + + function Same_Or_Aliased_Subprograms + (S : Entity_Id; + E : Entity_Id) return Boolean + is + Subp_Alias : constant Entity_Id := Alias (S); + begin + return S = E + or else (Present (Subp_Alias) and then Subp_Alias = E); + end Same_Or_Aliased_Subprograms; + + -- Start of processing for Resolve_Call + begin -- The context imposes a unique interpretation with type Typ on a -- procedure or function call. Find the entity of the subprogram that *************** package body Sem_Res is *** 4884,4890 **** and then Nkind (N) /= N_Entry_Call_Statement and then Entry_Call_Statement (Parent (N)) = N then ! if Ada_Version < Ada_05 then Error_Msg_N ("entry call required in select statement", N); -- Ada 2005 (AI-345): If a procedure_call_statement is used --- 5102,5108 ---- and then Nkind (N) /= N_Entry_Call_Statement and then Entry_Call_Statement (Parent (N)) = N then ! if Ada_Version < Ada_2005 then Error_Msg_N ("entry call required in select statement", N); -- Ada 2005 (AI-345): If a procedure_call_statement is used *************** package body Sem_Res is *** 4990,4996 **** -- An Ada 2005 prefixed call to a primitive operation -- whose first parameter is the prefix. This prefix was -- prepended to the parameter list, which is actually a ! -- list of indices. Remove the prefix in order to build -- the proper indexed component. Index_Node := --- 5208,5214 ---- -- An Ada 2005 prefixed call to a primitive operation -- whose first parameter is the prefix. This prefix was -- prepended to the parameter list, which is actually a ! -- list of indexes. Remove the prefix in order to build -- the proper indexed component. Index_Node := *************** package body Sem_Res is *** 5004,5013 **** --- 5222,5236 ---- Expressions => Parameter_Associations (N)); end if; + -- Preserve the parenthesis count of the node + + Set_Paren_Count (Index_Node, Paren_Count (N)); + -- Since we are correcting a node classification error made -- by the parser, we call Replace rather than Rewrite. Replace (N, Index_Node); + Set_Etype (Prefix (N), Ret_Type); Set_Etype (N, Typ); Resolve_Indexed_Component (N, Typ); *************** package body Sem_Res is *** 5051,5063 **** -- Issue warning for possible infinite recursion in the absence -- of the No_Recursion restriction. ! if Nam = Scop and then not Restriction_Active (No_Recursion) and then Check_Infinite_Recursion (N) then -- Here we detected and flagged an infinite recursion, so we do ! -- not need to test the case below for further warnings. Also if ! -- we now have a raise SE node, we are all done. if Nkind (N) = N_Raise_Storage_Error then return; --- 5274,5286 ---- -- Issue warning for possible infinite recursion in the absence -- of the No_Recursion restriction. ! if Same_Or_Aliased_Subprograms (Nam, Scop) and then not Restriction_Active (No_Recursion) and then Check_Infinite_Recursion (N) then -- Here we detected and flagged an infinite recursion, so we do ! -- not need to test the case below for further warnings. Also we ! -- are all done if we now have a raise SE node. if Nkind (N) = N_Raise_Storage_Error then return; *************** package body Sem_Res is *** 5068,5074 **** else Scope_Loop : while Scop /= Standard_Standard loop ! if Nam = Scop then -- Although in general case, recursion is not statically -- checkable, the case of calling an immediately containing --- 5291,5297 ---- else Scope_Loop : while Scop /= Standard_Standard loop ! if Same_Or_Aliased_Subprograms (Nam, Scop) then -- Although in general case, recursion is not statically -- checkable, the case of calling an immediately containing *************** package body Sem_Res is *** 5123,5129 **** K : constant Node_Kind := Nkind (Parent (N)); begin if (K = N_Loop_Statement ! and then Present (Iteration_Scheme (Parent (N)))) or else K = N_If_Statement or else K = N_Elsif_Part or else K = N_Case_Statement_Alternative --- 5346,5352 ---- K : constant Node_Kind := Nkind (Parent (N)); begin if (K = N_Loop_Statement ! and then Present (Iteration_Scheme (Parent (N)))) or else K = N_If_Statement or else K = N_Elsif_Part or else K = N_Case_Statement_Alternative *************** package body Sem_Res is *** 5149,5154 **** --- 5372,5381 ---- end if; end if; + -- Check obsolescent reference to Ada.Characters.Handling subprogram + + Check_Obsolescent_2005_Entity (Nam, Subp); + -- If subprogram name is a predefined operator, it was given in -- functional notation. Replace call node with operator node, so -- that actuals can be resolved appropriately. *************** package body Sem_Res is *** 5316,5324 **** F := First_Formal (Nam); A := First_Actual (N); while Present (F) and then Present (A) loop ! if (Ekind (F) = E_Out_Parameter ! or else ! Ekind (F) = E_In_Out_Parameter) and then Warn_On_Modified_As_Out_Parameter (F) and then Is_Entity_Name (A) and then Present (Entity (A)) --- 5543,5549 ---- F := First_Formal (Nam); A := First_Actual (N); while Present (F) and then Present (A) loop ! if Ekind_In (F, E_Out_Parameter, E_In_Out_Parameter) and then Warn_On_Modified_As_Out_Parameter (F) and then Is_Entity_Name (A) and then Present (Entity (A)) *************** package body Sem_Res is *** 5357,5366 **** then Generate_Reference (Nam, Subp, 'R'); ! -- Normal case, not a dispatching call else ! Generate_Reference (Nam, Subp); end if; if Is_Intrinsic_Subprogram (Nam) then --- 5582,5591 ---- then Generate_Reference (Nam, Subp, 'R'); ! -- Normal case, not a dispatching call. Generate a call reference. else ! Generate_Reference (Nam, Subp, 's'); end if; if Is_Intrinsic_Subprogram (Nam) then *************** package body Sem_Res is *** 5380,5388 **** Check_Potentially_Blocking_Operation (N); end if; ! -- Issue an error for a call to an eliminated subprogram ! Check_For_Eliminated_Subprogram (Subp, Nam); -- All done, evaluate call and deal with elaboration issues --- 5605,5625 ---- Check_Potentially_Blocking_Operation (N); end if; ! -- A call to Ada.Real_Time.Timing_Events.Set_Handler violates ! -- restriction No_Relative_Delay (AI-0211). ! if Is_RTE (Nam, RE_Set_Handler) then ! Check_Restriction (No_Relative_Delay, N); ! end if; ! ! -- Issue an error for a call to an eliminated subprogram. We skip this ! -- in a spec expression, e.g. a call in a default parameter value, since ! -- we are not really doing a call at this time. That's important because ! -- the spec expression may itself belong to an eliminated subprogram. ! ! if not In_Spec_Expression then ! Check_For_Eliminated_Subprogram (Subp, Nam); ! end if; -- All done, evaluate call and deal with elaboration issues *************** package body Sem_Res is *** 5391,5396 **** --- 5628,5651 ---- Warn_On_Overlapping_Actuals (Nam, N); end Resolve_Call; + ----------------------------- + -- Resolve_Case_Expression -- + ----------------------------- + + procedure Resolve_Case_Expression (N : Node_Id; Typ : Entity_Id) is + Alt : Node_Id; + + begin + Alt := First (Alternatives (N)); + while Present (Alt) loop + Resolve (Expression (Alt), Typ); + Next (Alt); + end loop; + + Set_Etype (N, Typ); + Eval_Case_Expression (N); + end Resolve_Case_Expression; + ------------------------------- -- Resolve_Character_Literal -- ------------------------------- *************** package body Sem_Res is *** 5506,5535 **** Set_Etype (N, Base_Type (Typ)); Generate_Reference (T, N, ' '); ! if T /= Any_Type then ! if T = Any_String or else ! T = Any_Composite or else ! T = Any_Character ! then ! if T = Any_Character then ! Ambiguous_Character (L); ! else ! Error_Msg_N ("ambiguous operands for comparison", N); ! end if; ! Set_Etype (N, Any_Type); ! return; else ! Resolve (L, T); ! Resolve (R, T); ! Check_Unset_Reference (L); ! Check_Unset_Reference (R); ! Generate_Operator_Reference (N, T); ! Check_Low_Bound_Tested (N); ! Eval_Relational_Op (N); end if; end if; end Resolve_Comparison_Op; ------------------------------------ --- 5761,5809 ---- Set_Etype (N, Base_Type (Typ)); Generate_Reference (T, N, ' '); ! -- Skip remaining processing if already set to Any_Type ! if T = Any_Type then ! return; ! end if; ! ! -- Deal with other error cases + if T = Any_String or else + T = Any_Composite or else + T = Any_Character + then + if T = Any_Character then + Ambiguous_Character (L); else ! Error_Msg_N ("ambiguous operands for comparison", N); end if; + + Set_Etype (N, Any_Type); + return; end if; + + -- Resolve the operands if types OK + + Resolve (L, T); + Resolve (R, T); + Check_Unset_Reference (L); + Check_Unset_Reference (R); + Generate_Operator_Reference (N, T); + Check_Low_Bound_Tested (N); + + -- Check comparison on unordered enumeration + + if Comes_From_Source (N) + and then Bad_Unordered_Enumeration_Reference (N, Etype (L)) + then + Error_Msg_N ("comparison on unordered enumeration type?", N); + end if; + + -- Evaluate the relation (note we do this after the above check + -- since this Eval call may change N to True/False. + + Eval_Relational_Op (N); end Resolve_Comparison_Op; ------------------------------------ *************** package body Sem_Res is *** 5689,5704 **** Set_Etype (N, Typ); Eval_Named_Real (N); ! -- Allow use of subtype only if it is a concurrent type where we are ! -- currently inside the body. This will eventually be expanded into a ! -- call to Self (for tasks) or _object (for protected objects). Any ! -- other use of a subtype is invalid. elsif Is_Type (E) then if Is_Concurrent_Type (E) and then In_Open_Scopes (E) then null; else Error_Msg_N ("invalid use of subtype mark in expression or call", N); --- 5963,5992 ---- Set_Etype (N, Typ); Eval_Named_Real (N); ! -- For enumeration literals, we need to make sure that a proper style ! -- check is done, since such literals are overloaded, and thus we did ! -- not do a style check during the first phase of analysis. ! ! elsif Ekind (E) = E_Enumeration_Literal then ! Set_Entity_With_Style_Check (N, E); ! Eval_Entity_Name (N); ! ! -- Case of subtype name appearing as an operand in expression elsif Is_Type (E) then + + -- Allow use of subtype if it is a concurrent type where we are + -- currently inside the body. This will eventually be expanded into a + -- call to Self (for tasks) or _object (for protected objects). Any + -- other use of a subtype is invalid. + if Is_Concurrent_Type (E) and then In_Open_Scopes (E) then null; + + -- Any other use is an error + else Error_Msg_N ("invalid use of subtype mark in expression or call", N); *************** package body Sem_Res is *** 5743,5749 **** and then not In_Spec_Expression and then not Is_Imported (E) then - if No_Initialization (Parent (E)) or else (Present (Full_View (E)) and then No_Initialization (Parent (Full_View (E)))) --- 6031,6036 ---- *************** package body Sem_Res is *** 5794,5800 **** -- to the discriminant of the same name in the target task. If the -- entry name is the target of a requeue statement and the entry is -- in the current protected object, the bound to be used is the ! -- discriminal of the object (see apply_range_checks for details of -- the transformation). ----------------------------- --- 6081,6087 ---- -- to the discriminant of the same name in the target task. If the -- entry name is the target of a requeue statement and the entry is -- in the current protected object, the bound to be used is the ! -- discriminal of the object (see Apply_Range_Checks for details of -- the transformation). ----------------------------- *************** package body Sem_Res is *** 5817,5823 **** and then In_Open_Scopes (Tsk) and then Nkind (Parent (Entry_Name)) = N_Requeue_Statement then ! return New_Occurrence_Of (Discriminal (Entity (Bound)), Loc); else Ref := --- 6104,6117 ---- and then In_Open_Scopes (Tsk) and then Nkind (Parent (Entry_Name)) = N_Requeue_Statement then ! -- Note: here Bound denotes a discriminant of the corresponding ! -- record type tskV, whose discriminal is a formal of the ! -- init-proc tskVIP. What we want is the body discriminal, ! -- which is associated to the discriminant of the original ! -- concurrent type tsk. ! ! return New_Occurrence_Of ! (Find_Body_Discriminal (Entity (Bound)), Loc); else Ref := *************** package body Sem_Res is *** 6084,6089 **** --- 6378,6414 ---- end; end if; + if Ekind_In (Nam, E_Entry, E_Entry_Family) + and then Present (PPC_Wrapper (Nam)) + and then Current_Scope /= PPC_Wrapper (Nam) + then + -- Rewrite as call to the precondition wrapper, adding the task + -- object to the list of actuals. If the call is to a member of + -- an entry family, include the index as well. + + declare + New_Call : Node_Id; + New_Actuals : List_Id; + begin + New_Actuals := New_List (Obj); + + if Nkind (Entry_Name) = N_Indexed_Component then + Append_To (New_Actuals, + New_Copy_Tree (First (Expressions (Entry_Name)))); + end if; + + Append_List (Parameter_Associations (N), New_Actuals); + New_Call := + Make_Procedure_Call_Statement (Loc, + Name => + New_Occurrence_Of (PPC_Wrapper (Nam), Loc), + Parameter_Associations => New_Actuals); + Rewrite (N, New_Call); + Analyze_And_Resolve (N); + return; + end; + end if; + -- The operation name may have been overloaded. Order the actuals -- according to the formals of the resolved entity, and set the -- return type to that of the operation. *************** package body Sem_Res is *** 6095,6105 **** end if; Resolve_Actuals (N, Nam); - Generate_Reference (Nam, Entry_Name); ! if Ekind (Nam) = E_Entry ! or else Ekind (Nam) = E_Entry_Family ! then Check_Potentially_Blocking_Operation (N); end if; --- 6420,6431 ---- end if; Resolve_Actuals (N, Nam); ! -- Create a call reference to the entry ! ! Generate_Reference (Nam, Entry_Name, 's'); ! ! if Ekind_In (Nam, E_Entry, E_Entry_Family) then Check_Potentially_Blocking_Operation (N); end if; *************** package body Sem_Res is *** 6183,6194 **** --- 6509,6549 ---- R : constant Node_Id := Right_Opnd (N); T : Entity_Id := Find_Unique_Type (L, R); + procedure Check_Conditional_Expression (Cond : Node_Id); + -- The resolution rule for conditional expressions requires that each + -- such must have a unique type. This means that if several dependent + -- expressions are of a non-null anonymous access type, and the context + -- does not impose an expected type (as can be the case in an equality + -- operation) the expression must be rejected. + function Find_Unique_Access_Type return Entity_Id; -- In the case of allocators, make a last-ditch attempt to find a single -- access type with the right designated type. This is semantically -- dubious, and of no interest to any real code, but c48008a makes it -- all worthwhile. + ---------------------------------- + -- Check_Conditional_Expression -- + ---------------------------------- + + procedure Check_Conditional_Expression (Cond : Node_Id) is + Then_Expr : Node_Id; + Else_Expr : Node_Id; + + begin + if Nkind (Cond) = N_Conditional_Expression then + Then_Expr := Next (First (Expressions (Cond))); + Else_Expr := Next (Then_Expr); + + if Nkind (Then_Expr) /= N_Null + and then Nkind (Else_Expr) /= N_Null + then + Error_Msg_N + ("cannot determine type of conditional expression", Cond); + end if; + end if; + end Check_Conditional_Expression; + ----------------------------- -- Find_Unique_Access_Type -- ----------------------------- *************** package body Sem_Res is *** 6253,6260 **** return; elsif T = Any_Access ! or else Ekind (T) = E_Allocator_Type ! or else Ekind (T) = E_Access_Attribute_Type then T := Find_Unique_Access_Type; --- 6608,6614 ---- return; elsif T = Any_Access ! or else Ekind_In (T, E_Allocator_Type, E_Access_Attribute_Type) then T := Find_Unique_Access_Type; *************** package body Sem_Res is *** 6263,6268 **** --- 6617,6635 ---- Set_Etype (N, Any_Type); return; end if; + + -- Conditional expressions must have a single type, and if the + -- context does not impose one the dependent expressions cannot + -- be anonymous access types. + + elsif Ada_Version >= Ada_2012 + and then Ekind_In (Etype (L), E_Anonymous_Access_Type, + E_Anonymous_Access_Subprogram_Type) + and then Ekind_In (Etype (R), E_Anonymous_Access_Type, + E_Anonymous_Access_Subprogram_Type) + then + Check_Conditional_Expression (L); + Check_Conditional_Expression (R); end if; Resolve (L, T); *************** package body Sem_Res is *** 6282,6288 **** and then Entity (R) = Standard_True and then Comes_From_Source (R) then ! Error_Msg_N ("?comparison with True is redundant!", R); end if; Check_Unset_Reference (L); --- 6649,6656 ---- and then Entity (R) = Standard_True and then Comes_From_Source (R) then ! Error_Msg_N -- CODEFIX ! ("?comparison with True is redundant!", R); end if; Check_Unset_Reference (L); *************** package body Sem_Res is *** 6321,6328 **** if Expander_Active and then ! (Ekind (T) = E_Anonymous_Access_Type ! or else Ekind (T) = E_Anonymous_Access_Subprogram_Type or else Is_Private_Type (T)) then if Etype (L) /= T then --- 6689,6696 ---- if Expander_Active and then ! (Ekind_In (T, E_Anonymous_Access_Type, ! E_Anonymous_Access_Subprogram_Type) or else Is_Private_Type (T)) then if Etype (L) /= T then *************** package body Sem_Res is *** 6434,6439 **** --- 6802,6816 ---- end Resolve_Explicit_Dereference; + ------------------------------------- + -- Resolve_Expression_With_Actions -- + ------------------------------------- + + procedure Resolve_Expression_With_Actions (N : Node_Id; Typ : Entity_Id) is + begin + Set_Etype (N, Typ); + end Resolve_Expression_With_Actions; + ------------------------------- -- Resolve_Indexed_Component -- ------------------------------- *************** package body Sem_Res is *** 6556,6561 **** --- 6933,6956 ---- Warn_On_Suspicious_Index (Name, First (Expressions (N))); Eval_Indexed_Component (N); end if; + + -- If the array type is atomic, and is packed, and we are in a left side + -- context, then this is worth a warning, since we have a situation + -- where the access to the component may cause extra read/writes of + -- the atomic array object, which could be considered unexpected. + + if Nkind (N) = N_Indexed_Component + and then (Is_Atomic (Array_Type) + or else (Is_Entity_Name (Prefix (N)) + and then Is_Atomic (Entity (Prefix (N))))) + and then Is_Bit_Packed_Array (Array_Type) + and then Is_LHS (N) + then + Error_Msg_N ("?assignment to component of packed atomic array", + Prefix (N)); + Error_Msg_N ("?\may cause unexpected accesses to atomic object", + Prefix (N)); + end if; end Resolve_Indexed_Component; ----------------------------- *************** package body Sem_Res is *** 6573,6584 **** -------------------------------- procedure Resolve_Intrinsic_Operator (N : Node_Id; Typ : Entity_Id) is ! Btyp : constant Entity_Id := Base_Type (Underlying_Type (Typ)); ! Op : Entity_Id; ! Arg1 : Node_Id; ! Arg2 : Node_Id; begin Op := Entity (N); while Scope (Op) /= Standard_Standard loop Op := Homonym (Op); --- 6968,6987 ---- -------------------------------- procedure Resolve_Intrinsic_Operator (N : Node_Id; Typ : Entity_Id) is ! Btyp : constant Entity_Id := Base_Type (Underlying_Type (Typ)); ! Op : Entity_Id; ! Orig_Op : constant Entity_Id := Entity (N); ! Arg1 : Node_Id; ! Arg2 : Node_Id; begin + -- We must preserve the original entity in a generic setting, so that + -- the legality of the operation can be verified in an instance. + + if not Expander_Active then + return; + end if; + Op := Entity (N); while Scope (Op) /= Standard_Standard loop Op := Homonym (Op); *************** package body Sem_Res is *** 6601,6608 **** Arg2 := Unchecked_Convert_To (Btyp, Right_Opnd (N)); end if; ! Save_Interps (Left_Opnd (N), Expression (Arg1)); ! Save_Interps (Right_Opnd (N), Expression (Arg2)); Set_Left_Opnd (N, Arg1); Set_Right_Opnd (N, Arg2); --- 7004,7016 ---- Arg2 := Unchecked_Convert_To (Btyp, Right_Opnd (N)); end if; ! if Nkind (Arg1) = N_Type_Conversion then ! Save_Interps (Left_Opnd (N), Expression (Arg1)); ! end if; ! ! if Nkind (Arg2) = N_Type_Conversion then ! Save_Interps (Right_Opnd (N), Expression (Arg2)); ! end if; Set_Left_Opnd (N, Arg1); Set_Right_Opnd (N, Arg2); *************** package body Sem_Res is *** 6615,6633 **** or else Typ /= Etype (Right_Opnd (N)) then -- Add explicit conversion where needed, and save interpretations in ! -- case operands are overloaded. Arg1 := Convert_To (Typ, Left_Opnd (N)); Arg2 := Convert_To (Typ, Right_Opnd (N)); if Nkind (Arg1) = N_Type_Conversion then Save_Interps (Left_Opnd (N), Expression (Arg1)); else Save_Interps (Left_Opnd (N), Arg1); end if; if Nkind (Arg2) = N_Type_Conversion then Save_Interps (Right_Opnd (N), Expression (Arg2)); else Save_Interps (Right_Opnd (N), Arg2); end if; --- 7023,7053 ---- or else Typ /= Etype (Right_Opnd (N)) then -- Add explicit conversion where needed, and save interpretations in ! -- case operands are overloaded. If the context is a VMS operation, ! -- assert that the conversion is legal (the operands have the proper ! -- types to select the VMS intrinsic). Note that in rare cases the ! -- VMS operators may be visible, but the default System is being used ! -- and Address is a private type. Arg1 := Convert_To (Typ, Left_Opnd (N)); Arg2 := Convert_To (Typ, Right_Opnd (N)); if Nkind (Arg1) = N_Type_Conversion then Save_Interps (Left_Opnd (N), Expression (Arg1)); + + if Is_VMS_Operator (Orig_Op) then + Set_Conversion_OK (Arg1); + end if; else Save_Interps (Left_Opnd (N), Arg1); end if; if Nkind (Arg2) = N_Type_Conversion then Save_Interps (Right_Opnd (N), Expression (Arg2)); + + if Is_VMS_Operator (Orig_Op) then + Set_Conversion_OK (Arg2); + end if; else Save_Interps (Right_Opnd (N), Arg2); end if; *************** package body Sem_Res is *** 6699,6711 **** B_Typ := Base_Type (Typ); end if; -- The following test is required because the operands of the operation -- may be literals, in which case the resulting type appears to be -- compatible with a signed integer type, when in fact it is compatible -- only with modular types. If the context itself is universal, the -- operation is illegal. ! if not Valid_Boolean_Arg (Typ) then Error_Msg_N ("invalid context for logical operation", N); Set_Etype (N, Any_Type); return; --- 7119,7136 ---- B_Typ := Base_Type (Typ); end if; + -- OK if this is a VMS-specific intrinsic operation + + if Is_VMS_Operator (Entity (N)) then + null; + -- The following test is required because the operands of the operation -- may be literals, in which case the resulting type appears to be -- compatible with a signed integer type, when in fact it is compatible -- only with modular types. If the context itself is universal, the -- operation is illegal. ! elsif not Valid_Boolean_Arg (Typ) then Error_Msg_N ("invalid context for logical operation", N); Set_Etype (N, Any_Type); return; *************** package body Sem_Res is *** 6808,6816 **** -- end Test; -- In this case we have nothing else to do. The membership test will be ! -- done at run-time. ! elsif Ada_Version >= Ada_05 and then Is_Class_Wide_Type (Etype (L)) and then Is_Interface (Etype (L)) and then Is_Class_Wide_Type (Etype (R)) --- 7233,7241 ---- -- end Test; -- In this case we have nothing else to do. The membership test will be ! -- done at run time. ! elsif Ada_Version >= Ada_2005 and then Is_Class_Wide_Type (Etype (L)) and then Is_Interface (Etype (L)) and then Is_Class_Wide_Type (Etype (R)) *************** package body Sem_Res is *** 6822,6827 **** --- 7247,7264 ---- T := Intersect_Types (L, R); end if; + -- If mixed-mode operations are present and operands are all literal, + -- the only interpretation involves Duration, which is probably not + -- the intention of the programmer. + + if T = Any_Fixed then + T := Unique_Fixed_Point_Type (N); + + if T = Any_Type then + return; + end if; + end if; + Resolve (L, T); Check_Unset_Reference (L); *************** package body Sem_Res is *** 6854,6860 **** -- Ada 2005 (AI-231): Remove restriction ! if Ada_Version < Ada_05 and then not Debug_Flag_J and then Ekind (Typ) = E_Anonymous_Access_Type and then Comes_From_Source (N) --- 7291,7297 ---- -- Ada 2005 (AI-231): Remove restriction ! if Ada_Version < Ada_2005 and then not Debug_Flag_J and then Ekind (Typ) = E_Anonymous_Access_Type and then Comes_From_Source (N) *************** package body Sem_Res is *** 6879,6885 **** -- Ada 2005 (AI-231): Generate the null-excluding check in case of -- assignment to a null-excluding object ! if Ada_Version >= Ada_05 and then Can_Never_Be_Null (Typ) and then Nkind (Parent (N)) = N_Assignment_Statement then --- 7316,7322 ---- -- Ada 2005 (AI-231): Generate the null-excluding check in case of -- assignment to a null-excluding object ! if Ada_Version >= Ada_2005 and then Can_Never_Be_Null (Typ) and then Nkind (Parent (N)) = N_Assignment_Statement then *************** package body Sem_Res is *** 7249,7257 **** B_Typ := Base_Type (Typ); end if; -- Straightforward case of incorrect arguments ! if not Valid_Boolean_Arg (Typ) then Error_Msg_N ("invalid operand type for operator&", N); Set_Etype (N, Any_Type); return; --- 7686,7697 ---- B_Typ := Base_Type (Typ); end if; + if Is_VMS_Operator (Entity (N)) then + null; + -- Straightforward case of incorrect arguments ! elsif not Valid_Boolean_Arg (Typ) then Error_Msg_N ("invalid operand type for operator&", N); Set_Etype (N, Any_Type); return; *************** package body Sem_Res is *** 7349,7357 **** Wrong_Type (Expr, Target_Typ); end if; ! -- If the target type is unconstrained, then we reset the type of ! -- the result from the type of the expression. For other cases, the ! -- actual subtype of the expression is the target type. if Is_Composite_Type (Target_Typ) and then not Is_Constrained (Target_Typ) --- 7789,7797 ---- Wrong_Type (Expr, Target_Typ); end if; ! -- If the target type is unconstrained, then we reset the type of the ! -- result from the type of the expression. For other cases, the actual ! -- subtype of the expression is the target type. if Is_Composite_Type (Target_Typ) and then not Is_Constrained (Target_Typ) *************** package body Sem_Res is *** 7362,7367 **** --- 7802,7823 ---- Eval_Qualified_Expression (N); end Resolve_Qualified_Expression; + ----------------------------------- + -- Resolve_Quantified_Expression -- + ----------------------------------- + + procedure Resolve_Quantified_Expression (N : Node_Id; Typ : Entity_Id) is + begin + -- The loop structure is already resolved during its analysis, only the + -- resolution of the condition needs to be done. Expansion is disabled + -- so that checks and other generated code are inserted in the tree + -- after expression has been rewritten as a loop. + + Expander_Mode_Save_And_Set (False); + Resolve (Condition (N), Typ); + Expander_Mode_Restore; + end Resolve_Quantified_Expression; + ------------------- -- Resolve_Range -- ------------------- *************** package body Sem_Res is *** 7370,7380 **** --- 7826,7883 ---- L : constant Node_Id := Low_Bound (N); H : constant Node_Id := High_Bound (N); + function First_Last_Ref return Boolean; + -- Returns True if N is of the form X'First .. X'Last where X is the + -- same entity for both attributes. + + -------------------- + -- First_Last_Ref -- + -------------------- + + function First_Last_Ref return Boolean is + Lorig : constant Node_Id := Original_Node (L); + Horig : constant Node_Id := Original_Node (H); + + begin + if Nkind (Lorig) = N_Attribute_Reference + and then Nkind (Horig) = N_Attribute_Reference + and then Attribute_Name (Lorig) = Name_First + and then Attribute_Name (Horig) = Name_Last + then + declare + PL : constant Node_Id := Prefix (Lorig); + PH : constant Node_Id := Prefix (Horig); + begin + if Is_Entity_Name (PL) + and then Is_Entity_Name (PH) + and then Entity (PL) = Entity (PH) + then + return True; + end if; + end; + end if; + + return False; + end First_Last_Ref; + + -- Start of processing for Resolve_Range + begin Set_Etype (N, Typ); Resolve (L, Typ); Resolve (H, Typ); + -- Check for inappropriate range on unordered enumeration type + + if Bad_Unordered_Enumeration_Reference (N, Typ) + + -- Exclude X'First .. X'Last if X is the same entity for both + + and then not First_Last_Ref + then + Error_Msg ("subrange of unordered enumeration type?", Sloc (N)); + end if; + Check_Unset_Reference (L); Check_Unset_Reference (H); *************** package body Sem_Res is *** 7628,7634 **** Comp := Next_Entity (Comp); end loop; - end if; Get_Next_Interp (I, It); --- 8131,8136 ---- *************** package body Sem_Res is *** 7666,7674 **** end if; if Has_Discriminants (T) ! and then (Ekind (Entity (S)) = E_Component ! or else ! Ekind (Entity (S)) = E_Discriminant) and then Present (Original_Record_Component (Entity (S))) and then Ekind (Original_Record_Component (Entity (S))) = E_Component and then Present (Discriminant_Checking_Func --- 8168,8174 ---- end if; if Has_Discriminants (T) ! and then Ekind_In (Entity (S), E_Component, E_Discriminant) and then Present (Original_Record_Component (Entity (S))) and then Ekind (Original_Record_Component (Entity (S))) = E_Component and then Present (Discriminant_Checking_Func *************** package body Sem_Res is *** 7697,7702 **** --- 8197,8219 ---- -- Note: No Eval processing is required, because the prefix is of a -- record type, or protected type, and neither can possibly be static. + -- If the array type is atomic, and is packed, and we are in a left side + -- context, then this is worth a warning, since we have a situation + -- where the access to the component may cause extra read/writes of + -- the atomic array object, which could be considered unexpected. + + if Nkind (N) = N_Selected_Component + and then (Is_Atomic (T) + or else (Is_Entity_Name (Prefix (N)) + and then Is_Atomic (Entity (Prefix (N))))) + and then Is_Packed (T) + and then Is_LHS (N) + then + Error_Msg_N ("?assignment to component of packed atomic record", + Prefix (N)); + Error_Msg_N ("?\may cause unexpected accesses to atomic object", + Prefix (N)); + end if; end Resolve_Selected_Component; ------------------- *************** package body Sem_Res is *** 7772,7786 **** then null; else ! -- Issue warning. Note that we don't want to make this ! -- an unconditional warning, because if the assert is ! -- within deleted code we do not want the warning. But ! -- we do not want the deletion of the IF/AND-THEN to ! -- take this message with it. We achieve this by making ! -- sure that the expanded code points to the Sloc of ! -- the expression, not the original pragma. ! Error_Msg_N ("?assertion would fail at run-time", Orig); end if; end; --- 8289,8303 ---- then null; else ! -- Issue warning. We do not want the deletion of the ! -- IF/AND-THEN to take this message with it. We achieve ! -- this by making sure that the expanded code points to ! -- the Sloc of the expression, not the original pragma. ! Error_Msg_N ! ("?assertion would fail at run time!", ! Expression ! (First (Pragma_Argument_Associations (Orig)))); end if; end; *************** package body Sem_Res is *** 7803,7809 **** then null; else ! Error_Msg_N ("?check would fail at run-time", Orig); end if; end; end if; --- 8320,8329 ---- then null; else ! Error_Msg_N ! ("?check would fail at run time!", ! Expression ! (Last (Pragma_Argument_Associations (Orig)))); end if; end; end if; *************** package body Sem_Res is *** 7905,7910 **** --- 8425,8431 ---- end if; elsif Is_Entity_Name (Name) + or else Nkind (Name) = N_Explicit_Dereference or else (Nkind (Name) = N_Function_Call and then not Is_Constrained (Etype (Name))) then *************** package body Sem_Res is *** 7949,7977 **** Index := First_Index (Array_Type); Resolve (Drange, Base_Type (Etype (Index))); ! if Nkind (Drange) = N_Range -- Do not apply the range check to nodes associated with the -- frontend expansion of the dispatch table. We first check ! -- if Ada.Tags is already loaded to void the addition of an -- undesired dependence on such run-time unit. ! and then ! (not Tagged_Type_Expansion ! or else not ! (RTU_Loaded (Ada_Tags) ! and then Nkind (Prefix (N)) = N_Selected_Component ! and then Present (Entity (Selector_Name (Prefix (N)))) ! and then Entity (Selector_Name (Prefix (N))) = ! RTE_Record_Component (RE_Prims_Ptr))) ! then ! Apply_Range_Check (Drange, Etype (Index)); end if; end if; Set_Slice_Subtype (N); ! if Nkind (Drange) = N_Range then Warn_On_Suspicious_Index (Name, Low_Bound (Drange)); Warn_On_Suspicious_Index (Name, High_Bound (Drange)); end if; --- 8470,8512 ---- Index := First_Index (Array_Type); Resolve (Drange, Base_Type (Etype (Index))); ! if Nkind (Drange) = N_Range then ! ! -- Ensure that side effects in the bounds are properly handled ! ! Remove_Side_Effects (Low_Bound (Drange), Variable_Ref => True); ! Remove_Side_Effects (High_Bound (Drange), Variable_Ref => True); -- Do not apply the range check to nodes associated with the -- frontend expansion of the dispatch table. We first check ! -- if Ada.Tags is already loaded to avoid the addition of an -- undesired dependence on such run-time unit. ! if not Tagged_Type_Expansion ! or else not ! (RTU_Loaded (Ada_Tags) ! and then Nkind (Prefix (N)) = N_Selected_Component ! and then Present (Entity (Selector_Name (Prefix (N)))) ! and then Entity (Selector_Name (Prefix (N))) = ! RTE_Record_Component (RE_Prims_Ptr)) ! then ! Apply_Range_Check (Drange, Etype (Index)); ! end if; end if; end if; Set_Slice_Subtype (N); ! -- Check bad use of type with predicates ! ! if Has_Predicates (Etype (Drange)) then ! Bad_Predicated_Subtype_Use ! ("subtype& has predicate, not allowed in slice", ! Drange, Etype (Drange)); ! ! -- Otherwise here is where we check suspicious indexes ! ! elsif Nkind (Drange) = N_Range then Warn_On_Suspicious_Index (Name, Low_Bound (Drange)); Warn_On_Suspicious_Index (Name, High_Bound (Drange)); end if; *************** package body Sem_Res is *** 8262,8267 **** --- 8797,8806 ---- Orig_N : Node_Id; Orig_T : Node_Id; + Test_Redundant : Boolean := Warn_On_Redundant_Constructs; + -- Set to False to suppress cases where we want to suppress the test + -- for redundancy to avoid possible false positives on this warning. + begin if not Conv_OK and then not Valid_Conversion (N, Target_Typ, Operand) *************** package body Sem_Res is *** 8269,8275 **** return; end if; ! if Etype (Operand) = Any_Fixed then -- Mixed-mode operation involving a literal. Context must be a fixed -- type which is applied to the literal subsequently. --- 8808,8827 ---- return; end if; ! -- If the Operand Etype is Universal_Fixed, then the conversion is ! -- never redundant. We need this check because by the time we have ! -- finished the rather complex transformation, the conversion looks ! -- redundant when it is not. ! ! if Operand_Typ = Universal_Fixed then ! Test_Redundant := False; ! ! -- If the operand is marked as Any_Fixed, then special processing is ! -- required. This is also a case where we suppress the test for a ! -- redundant conversion, since most certainly it is not redundant. ! ! elsif Operand_Typ = Any_Fixed then ! Test_Redundant := False; -- Mixed-mode operation involving a literal. Context must be a fixed -- type which is applied to the literal subsequently. *************** package body Sem_Res is *** 8375,8383 **** Orig_N := Original_Node (N); ! if Warn_On_Redundant_Constructs ! and then Comes_From_Source (Orig_N) and then Nkind (Orig_N) = N_Type_Conversion and then not In_Instance then Orig_N := Original_Node (Expression (Orig_N)); --- 8927,8939 ---- Orig_N := Original_Node (N); ! -- Here we test for a redundant conversion if the warning mode is ! -- active (and was not locally reset), and we have a type conversion ! -- from source not appearing in a generic instance. ! ! if Test_Redundant and then Nkind (Orig_N) = N_Type_Conversion + and then Comes_From_Source (Orig_N) and then not In_Instance then Orig_N := Original_Node (Expression (Orig_N)); *************** package body Sem_Res is *** 8393,8404 **** Orig_T := Etype (Parent (N)); end if; ! if Is_Entity_Name (Orig_N) ! and then ! (Etype (Entity (Orig_N)) = Orig_T ! or else ! (Ekind (Entity (Orig_N)) = E_Loop_Parameter ! and then Covers (Orig_T, Etype (Entity (Orig_N))))) then -- One more check, do not give warning if the analyzed conversion -- has an expression with non-static bounds, and the bounds of the --- 8949,8969 ---- Orig_T := Etype (Parent (N)); end if; ! -- If we have an entity name, then give the warning if the entity ! -- is the right type, or if it is a loop parameter covered by the ! -- original type (that's needed because loop parameters have an ! -- odd subtype coming from the bounds). ! ! if (Is_Entity_Name (Orig_N) ! and then ! (Etype (Entity (Orig_N)) = Orig_T ! or else ! (Ekind (Entity (Orig_N)) = E_Loop_Parameter ! and then Covers (Orig_T, Etype (Entity (Orig_N)))))) ! ! -- If not an entity, then type of expression must match ! ! or else Etype (Orig_N) = Orig_T then -- One more check, do not give warning if the analyzed conversion -- has an expression with non-static bounds, and the bounds of the *************** package body Sem_Res is *** 8411,8423 **** then null; ! -- Here we give the redundant conversion warning else ! Error_Msg_Node_2 := Orig_T; ! Error_Msg_NE -- CODEFIX ! ("?redundant conversion, & is of type &!", ! N, Entity (Orig_N)); end if; end if; end if; --- 8976,9018 ---- then null; ! -- Finally, if this type conversion occurs in a context that ! -- requires a prefix, and the expression is a qualified expression ! -- then the type conversion is not redundant, because a qualified ! -- expression is not a prefix, whereas a type conversion is. For ! -- example, "X := T'(Funx(...)).Y;" is illegal because a selected ! -- component requires a prefix, but a type conversion makes it ! -- legal: "X := T(T'(Funx(...))).Y;" ! ! -- In Ada 2012, a qualified expression is a name, so this idiom is ! -- no longer needed, but we still suppress the warning because it ! -- seems unfriendly for warnings to pop up when you switch to the ! -- newer language version. ! ! elsif Nkind (Orig_N) = N_Qualified_Expression ! and then Nkind_In (Parent (N), N_Attribute_Reference, ! N_Indexed_Component, ! N_Selected_Component, ! N_Slice, ! N_Explicit_Dereference) ! then ! null; ! ! -- Here we give the redundant conversion warning. If it is an ! -- entity, give the name of the entity in the message. If not, ! -- just mention the expression. else ! if Is_Entity_Name (Orig_N) then ! Error_Msg_Node_2 := Orig_T; ! Error_Msg_NE -- CODEFIX ! ("?redundant conversion, & is of type &!", ! N, Entity (Orig_N)); ! else ! Error_Msg_NE ! ("?redundant conversion, expression is of type&!", ! N, Orig_T); ! end if; end if; end if; end if; *************** package body Sem_Res is *** 8426,8432 **** -- No need to perform any interface conversion if the type of the -- expression coincides with the target type. ! if Ada_Version >= Ada_05 and then Expander_Active and then Operand_Typ /= Target_Typ then --- 9021,9027 ---- -- No need to perform any interface conversion if the type of the -- expression coincides with the target type. ! if Ada_Version >= Ada_2005 and then Expander_Active and then Operand_Typ /= Target_Typ then *************** package body Sem_Res is *** 8436,8446 **** begin if Is_Access_Type (Opnd) then ! Opnd := Directly_Designated_Type (Opnd); end if; if Is_Access_Type (Target_Typ) then ! Target := Directly_Designated_Type (Target); end if; if Opnd = Target then --- 9031,9041 ---- begin if Is_Access_Type (Opnd) then ! Opnd := Designated_Type (Opnd); end if; if Is_Access_Type (Target_Typ) then ! Target := Designated_Type (Target); end if; if Opnd = Target then *************** package body Sem_Res is *** 8454,8460 **** if From_With_Type (Opnd) then Error_Msg_Qual_Level := 99; ! Error_Msg_NE ("missing WITH clause on package &", N, Cunit_Entity (Get_Source_Unit (Base_Type (Opnd)))); Error_Msg_N ("type conversions require visibility of the full view", --- 9049,9056 ---- if From_With_Type (Opnd) then Error_Msg_Qual_Level := 99; ! Error_Msg_NE -- CODEFIX ! ("missing WITH clause on package &", N, Cunit_Entity (Get_Source_Unit (Base_Type (Opnd)))); Error_Msg_N ("type conversions require visibility of the full view", *************** package body Sem_Res is *** 8466,8472 **** and then Present (Non_Limited_View (Etype (Target)))) then Error_Msg_Qual_Level := 99; ! Error_Msg_NE ("missing WITH clause on package &", N, Cunit_Entity (Get_Source_Unit (Base_Type (Target)))); Error_Msg_N ("type conversions require visibility of the full view", --- 9062,9069 ---- and then Present (Non_Limited_View (Etype (Target)))) then Error_Msg_Qual_Level := 99; ! Error_Msg_NE -- CODEFIX ! ("missing WITH clause on package &", N, Cunit_Entity (Get_Source_Unit (Base_Type (Target)))); Error_Msg_N ("type conversions require visibility of the full view", *************** package body Sem_Res is *** 8482,8490 **** -- Handle subtypes ! if Ekind (Opnd) = E_Protected_Subtype ! or else Ekind (Opnd) = E_Task_Subtype ! then Opnd := Etype (Opnd); end if; --- 9079,9085 ---- -- Handle subtypes ! if Ekind_In (Opnd, E_Protected_Subtype, E_Task_Subtype) then Opnd := Etype (Opnd); end if; *************** package body Sem_Res is *** 8497,8503 **** -- The static analysis is not enough to know if the -- interface is implemented or not. Hence we must pass -- the work to the expander to generate code to evaluate ! -- the conversion at run-time. Expand_Interface_Conversion (N, Is_Static => False); --- 9092,9098 ---- -- The static analysis is not enough to know if the -- interface is implemented or not. Hence we must pass -- the work to the expander to generate code to evaluate ! -- the conversion at run time. Expand_Interface_Conversion (N, Is_Static => False); *************** package body Sem_Res is *** 8560,8566 **** Determine_Range (Right_Opnd (N), OK, Lo, Hi); if OK and then Hi >= Lo and then Lo >= 0 then ! Error_Msg_N ("?abs applied to known non-negative value has no effect", N); end if; end if; --- 9155,9161 ---- Determine_Range (Right_Opnd (N), OK, Lo, Hi); if OK and then Hi >= Lo and then Lo >= 0 then ! Error_Msg_N -- CODEFIX ("?abs applied to known non-negative value has no effect", N); end if; end if; *************** package body Sem_Res is *** 8736,8742 **** Resolve (Operand, Opnd_Type); Eval_Unchecked_Conversion (N); - end Resolve_Unchecked_Type_Conversion; ------------------------------ --- 9331,9336 ---- *************** package body Sem_Res is *** 8784,8792 **** -- Exclude user-defined intrinsic operations of the same name, which are -- treated separately and rewritten as calls. ! if Ekind (Op) /= E_Function ! or else Chars (N) /= Nam ! then Op_Node := New_Node (Operator_Kind (Nam, Is_Binary), Sloc (N)); Set_Chars (Op_Node, Nam); Set_Etype (Op_Node, Etype (N)); --- 9378,9384 ---- -- Exclude user-defined intrinsic operations of the same name, which are -- treated separately and rewritten as calls. ! if Ekind (Op) /= E_Function or else Chars (N) /= Nam then Op_Node := New_Node (Operator_Kind (Nam, Is_Binary), Sloc (N)); Set_Chars (Op_Node, Nam); Set_Etype (Op_Node, Etype (N)); *************** package body Sem_Res is *** 8805,8813 **** Rewrite (N, Op_Node); ! -- If the context type is private, add the appropriate conversions ! -- so that the operator is applied to the full view. This is done ! -- in the routines that resolve intrinsic operators, if Is_Intrinsic_Subprogram (Op) and then Is_Private_Type (Typ) --- 9397,9405 ---- Rewrite (N, Op_Node); ! -- If the context type is private, add the appropriate conversions so ! -- that the operator is applied to the full view. This is done in the ! -- routines that resolve intrinsic operators. if Is_Intrinsic_Subprogram (Op) and then Is_Private_Type (Typ) *************** package body Sem_Res is *** 8825,8836 **** end case; end if; ! elsif Ekind (Op) = E_Function ! and then Is_Intrinsic_Subprogram (Op) ! then ! -- Operator renames a user-defined operator of the same name. Use ! -- the original operator in the node, which is the one that Gigi ! -- knows about. Set_Entity (N, Op); Set_Is_Overloaded (N, False); --- 9417,9426 ---- end case; end if; ! elsif Ekind (Op) = E_Function and then Is_Intrinsic_Subprogram (Op) then ! ! -- Operator renames a user-defined operator of the same name. Use the ! -- original operator in the node, which is the one Gigi knows about. Set_Entity (N, Op); Set_Is_Overloaded (N, False); *************** package body Sem_Res is *** 8841,8852 **** -- Set_Slice_Subtype -- ----------------------- ! -- Build an implicit subtype declaration to represent the type delivered ! -- by the slice. This is an abbreviated version of an array subtype. We ! -- define an index subtype for the slice, using either the subtype name ! -- or the discrete range of the slice. To be consistent with index usage ! -- elsewhere, we create a list header to hold the single index. This list ! -- is not otherwise attached to the syntax tree. procedure Set_Slice_Subtype (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); --- 9431,9442 ---- -- Set_Slice_Subtype -- ----------------------- ! -- Build an implicit subtype declaration to represent the type delivered by ! -- the slice. This is an abbreviated version of an array subtype. We define ! -- an index subtype for the slice, using either the subtype name or the ! -- discrete range of the slice. To be consistent with index usage elsewhere ! -- we create a list header to hold the single index. This list is not ! -- otherwise attached to the syntax tree. procedure Set_Slice_Subtype (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); *************** package body Sem_Res is *** 8877,8883 **** Index_Subtype := Create_Itype (Subtype_Kind (Ekind (Index_Type)), N); ! Set_Scalar_Range (Index_Subtype, Drange); Set_Etype (Index_Subtype, Index_Type); Set_Size_Info (Index_Subtype, Index_Type); Set_RM_Size (Index_Subtype, RM_Size (Index_Type)); --- 9467,9483 ---- Index_Subtype := Create_Itype (Subtype_Kind (Ekind (Index_Type)), N); ! -- Take a new copy of Drange (where bounds have been rewritten to ! -- reference side-effect-free names). Using a separate tree ensures ! -- that further expansion (e.g. while rewriting a slice assignment ! -- into a FOR loop) does not attempt to remove side effects on the ! -- bounds again (which would cause the bounds in the index subtype ! -- definition to refer to temporaries before they are defined) (the ! -- reason is that some names are considered side effect free here ! -- for the subtype, but not in the context of a loop iteration ! -- scheme). ! ! Set_Scalar_Range (Index_Subtype, New_Copy_Tree (Drange)); Set_Etype (Index_Subtype, Index_Type); Set_Size_Info (Index_Subtype, Index_Type); Set_RM_Size (Index_Subtype, RM_Size (Index_Type)); *************** package body Sem_Res is *** 8900,8917 **** Set_Etype (N, Slice_Subtype); ! -- In the packed case, this must be immediately frozen ! ! -- Couldn't we always freeze here??? and if we did, then the above ! -- call to Check_Compile_Time_Size could be eliminated, which would ! -- be nice, because then that routine could be made private to Freeze. ! ! -- 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; end Set_Slice_Subtype; -------------------------------- --- 9500,9521 ---- Set_Etype (N, Slice_Subtype); ! -- For packed slice subtypes, freeze immediately (except in the ! -- case of being in a "spec expression" where we never freeze ! -- when we first see the expression). if Is_Packed (Slice_Subtype) and not In_Spec_Expression then Freeze_Itype (Slice_Subtype, N); + -- For all other cases insert an itype reference in the slice's actions + -- so that the itype is frozen at the proper place in the tree (i.e. at + -- the point where actions for the slice are analyzed). Note that this + -- is different from freezing the itype immediately, which might be + -- premature (e.g. if the slice is within a transient scope). + + else + Ensure_Defined (Typ => Slice_Subtype, N => N); + end if; end Set_Slice_Subtype; -------------------------------- *************** package body Sem_Res is *** 8938,8947 **** if Is_OK_Static_Expression (Low_Bound) then ! -- The low bound is set from the low bound of the corresponding ! -- index type. Note that we do not store the high bound in the ! -- string literal subtype, but it can be deduced if necessary ! -- from the length and the low bound. Set_String_Literal_Low_Bound (Subtype_Id, Low_Bound); --- 9542,9551 ---- if Is_OK_Static_Expression (Low_Bound) then ! -- The low bound is set from the low bound of the corresponding index ! -- type. Note that we do not store the high bound in the string literal ! -- subtype, but it can be deduced if necessary from the length and the ! -- low bound. Set_String_Literal_Low_Bound (Subtype_Id, Low_Bound); *************** package body Sem_Res is *** 8981,8989 **** -- be used when generating attributes of the string, for example -- in the context of a slice assignment. ! Set_Etype (Index_Subtype, Base_Type (Index_Type)); ! Set_Size_Info (Index_Subtype, Index_Type); ! Set_RM_Size (Index_Subtype, RM_Size (Index_Type)); Array_Subtype := Create_Itype (E_Array_Subtype, N); --- 9585,9593 ---- -- be used when generating attributes of the string, for example -- in the context of a slice assignment. ! Set_Etype (Index_Subtype, Base_Type (Index_Type)); ! Set_Size_Info (Index_Subtype, Index_Type); ! Set_RM_Size (Index_Subtype, RM_Size (Index_Type)); Array_Subtype := Create_Itype (E_Array_Subtype, N); *************** package body Sem_Res is *** 9034,9040 **** -- ityp (x) ! -- with the Float_Truncate flag set, which is more efficient then Rewrite (Operand, --- 9638,9644 ---- -- ityp (x) ! -- with the Float_Truncate flag set, which is more efficient. then Rewrite (Operand, *************** package body Sem_Res is *** 9162,9169 **** -- Specifically test for validity of tagged conversions function Valid_Array_Conversion return Boolean; ! -- Check index and component conformance, and accessibility levels ! -- if the component types are anonymous access types (Ada 2005) ---------------------- -- Conversion_Check -- --- 9766,9773 ---- -- Specifically test for validity of tagged conversions function Valid_Array_Conversion return Boolean; ! -- Check index and component conformance, and accessibility levels if ! -- the component types are anonymous access types (Ada 2005). ---------------------- -- Conversion_Check -- *************** package body Sem_Res is *** 9253,9261 **** -- out-of-scope references. elsif ! (Ekind (Target_Comp_Base) = E_Anonymous_Access_Type ! or else ! Ekind (Target_Comp_Base) = E_Anonymous_Access_Subprogram_Type) and then Ekind (Opnd_Comp_Base) = Ekind (Target_Comp_Base) and then Subtypes_Statically_Match (Target_Comp_Type, Opnd_Comp_Type) --- 9857,9864 ---- -- out-of-scope references. elsif ! Ekind_In (Target_Comp_Base, E_Anonymous_Access_Type, ! E_Anonymous_Access_Subprogram_Type) and then Ekind (Opnd_Comp_Base) = Ekind (Target_Comp_Base) and then Subtypes_Statically_Match (Target_Comp_Type, Opnd_Comp_Type) *************** package body Sem_Res is *** 9384,9389 **** --- 9987,9993 ---- It : Interp; It1 : Interp; N1 : Entity_Id; + T1 : Entity_Id; begin -- Remove procedure calls, which syntactically cannot appear in *************** package body Sem_Res is *** 9397,9406 **** -- is no context type and the removal of the spurious operations -- must be done explicitly here. ! -- The node may be labelled overloaded, but still contain only ! -- one interpretation because others were discarded in previous ! -- filters. If this is the case, retain the single interpretation ! -- if legal. Get_First_Interp (Operand, I, It); Opnd_Type := It.Typ; --- 10001,10009 ---- -- is no context type and the removal of the spurious operations -- must be done explicitly here. ! -- The node may be labelled overloaded, but still contain only one ! -- interpretation because others were discarded earlier. If this ! -- is the case, retain the single interpretation if legal. Get_First_Interp (Operand, I, It); Opnd_Type := It.Typ; *************** package body Sem_Res is *** 9440,9455 **** if Present (It.Typ) then N1 := It1.Nam; It1 := Disambiguate (Operand, I1, I, Any_Type); if It1 = No_Interp then Error_Msg_N ("ambiguous operand in conversion", Operand); ! Error_Msg_Sloc := Sloc (It.Nam); Error_Msg_N -- CODEFIX ("\\possible interpretation#!", Operand); ! Error_Msg_Sloc := Sloc (N1); Error_Msg_N -- CODEFIX ("\\possible interpretation#!", Operand); --- 10043,10072 ---- if Present (It.Typ) then N1 := It1.Nam; + T1 := It1.Typ; It1 := Disambiguate (Operand, I1, I, Any_Type); if It1 = No_Interp then Error_Msg_N ("ambiguous operand in conversion", Operand); ! -- If the interpretation involves a standard operator, use ! -- the location of the type, which may be user-defined. ! ! if Sloc (It.Nam) = Standard_Location then ! Error_Msg_Sloc := Sloc (It.Typ); ! else ! Error_Msg_Sloc := Sloc (It.Nam); ! end if; ! Error_Msg_N -- CODEFIX ("\\possible interpretation#!", Operand); ! if Sloc (N1) = Standard_Location then ! Error_Msg_Sloc := Sloc (T1); ! else ! Error_Msg_Sloc := Sloc (N1); ! end if; ! Error_Msg_N -- CODEFIX ("\\possible interpretation#!", Operand); *************** package body Sem_Res is *** 9484,9490 **** -- this situation can arise in source code. elsif In_Instance or else In_Inlined_Body then ! return True; -- Otherwise we need the conversion check --- 10101,10107 ---- -- this situation can arise in source code. elsif In_Instance or else In_Inlined_Body then ! return True; -- Otherwise we need the conversion check *************** package body Sem_Res is *** 9501,9508 **** or else Opnd_Type = Any_Composite or else Opnd_Type = Any_String then ! Error_Msg_N ! ("illegal operand for array conversion", Operand); return False; else return Valid_Array_Conversion; --- 10118,10124 ---- or else Opnd_Type = Any_Composite or else Opnd_Type = Any_String then ! Error_Msg_N ("illegal operand for array conversion", Operand); return False; else return Valid_Array_Conversion; *************** package body Sem_Res is *** 9511,9519 **** -- Ada 2005 (AI-251): Anonymous access types where target references an -- interface type. ! elsif (Ekind (Target_Type) = E_General_Access_Type ! or else ! Ekind (Target_Type) = E_Anonymous_Access_Type) and then Is_Interface (Directly_Designated_Type (Target_Type)) then -- Check the static accessibility rule of 4.6(17). Note that the --- 10127,10134 ---- -- Ada 2005 (AI-251): Anonymous access types where target references an -- interface type. ! elsif Ekind_In (Target_Type, E_General_Access_Type, ! E_Anonymous_Access_Type) and then Is_Interface (Directly_Designated_Type (Target_Type)) then -- Check the static accessibility rule of 4.6(17). Note that the *************** package body Sem_Res is *** 9582,9589 **** if Is_Entity_Name (Operand) and then not Is_Local_Anonymous_Access (Opnd_Type) ! and then (Ekind (Entity (Operand)) = E_In_Parameter ! or else Ekind (Entity (Operand)) = E_Constant) and then Present (Discriminal_Link (Entity (Operand))) then Error_Msg_N --- 10197,10204 ---- if Is_Entity_Name (Operand) and then not Is_Local_Anonymous_Access (Opnd_Type) ! and then ! Ekind_In (Entity (Operand), E_In_Parameter, E_Constant) and then Present (Discriminal_Link (Entity (Operand))) then Error_Msg_N *************** package body Sem_Res is *** 9598,9612 **** -- General and anonymous access types ! elsif (Ekind (Target_Type) = E_General_Access_Type ! or else Ekind (Target_Type) = E_Anonymous_Access_Type) and then Conversion_Check (Is_Access_Type (Opnd_Type) ! and then Ekind (Opnd_Type) /= ! E_Access_Subprogram_Type ! and then Ekind (Opnd_Type) /= ! E_Access_Protected_Subprogram_Type, "must be an access-to-object type") then if Is_Access_Constant (Opnd_Type) --- 10213,10226 ---- -- General and anonymous access types ! elsif Ekind_In (Target_Type, E_General_Access_Type, ! E_Anonymous_Access_Type) and then Conversion_Check (Is_Access_Type (Opnd_Type) ! and then not ! Ekind_In (Opnd_Type, E_Access_Subprogram_Type, ! E_Access_Protected_Subprogram_Type), "must be an access-to-object type") then if Is_Access_Constant (Opnd_Type) *************** package body Sem_Res is *** 9656,9662 **** elsif Ekind (Opnd_Type) = E_Anonymous_Access_Type and then not Is_Local_Anonymous_Access (Opnd_Type) then - -- When the operand is a selected access discriminant the check -- needs to be made against the level of the object denoted by -- the prefix of the selected name (Object_Access_Level handles --- 10270,10275 ---- *************** package body Sem_Res is *** 9693,9700 **** -- access type. if Is_Entity_Name (Operand) ! and then (Ekind (Entity (Operand)) = E_In_Parameter ! or else Ekind (Entity (Operand)) = E_Constant) and then Present (Discriminal_Link (Entity (Operand))) then Error_Msg_N --- 10306,10313 ---- -- access type. if Is_Entity_Name (Operand) ! and then ! Ekind_In (Entity (Operand), E_In_Parameter, E_Constant) and then Present (Discriminal_Link (Entity (Operand))) then Error_Msg_N *************** package body Sem_Res is *** 9797,9807 **** end Check_Limited; -- Access to subprogram types. If the operand is an access parameter, ! -- the type has a deeper accessibility that any master, and cannot ! -- be assigned. We must make an exception if the conversion is part ! -- of an assignment and the target is the return object of an extended ! -- return statement, because in that case the accessibility check ! -- takes place after the return. elsif Is_Access_Subprogram_Type (Target_Type) and then No (Corresponding_Remote_Type (Opnd_Type)) --- 10410,10420 ---- end Check_Limited; -- Access to subprogram types. If the operand is an access parameter, ! -- the type has a deeper accessibility that any master, and cannot be ! -- assigned. We must make an exception if the conversion is part of an ! -- assignment and the target is the return object of an extended return ! -- statement, because in that case the accessibility check takes place ! -- after the return. elsif Is_Access_Subprogram_Type (Target_Type) and then No (Corresponding_Remote_Type (Opnd_Type)) *************** package body Sem_Res is *** 9889,9895 **** -- If both are tagged types, check legality of view conversions elsif Is_Tagged_Type (Target_Type) ! and then Is_Tagged_Type (Opnd_Type) then return Valid_Tagged_Conversion (Target_Type, Opnd_Type); --- 10502,10509 ---- -- If both are tagged types, check legality of view conversions elsif Is_Tagged_Type (Target_Type) ! and then ! Is_Tagged_Type (Opnd_Type) then return Valid_Tagged_Conversion (Target_Type, Opnd_Type); *************** package body Sem_Res is *** 9898,9905 **** elsif Root_Type (Target_Type) = Root_Type (Opnd_Type) then return True; ! -- In an instance or an inlined body, there may be inconsistent ! -- views of the same type, or of types derived from a common root. elsif (In_Instance or In_Inlined_Body) and then --- 10512,10519 ---- elsif Root_Type (Target_Type) = Root_Type (Opnd_Type) then return True; ! -- In an instance or an inlined body, there may be inconsistent views of ! -- the same type, or of types derived from a common root. elsif (In_Instance or In_Inlined_Body) and then *************** package body Sem_Res is *** 9914,9920 **** and then Is_Access_Type (Opnd_Type) then Error_Msg_N ("target type must be general access type!", N); ! Error_Msg_NE ("add ALL to }!", N, Target_Type); return False; else --- 10528,10535 ---- and then Is_Access_Type (Opnd_Type) then Error_Msg_N ("target type must be general access type!", N); ! Error_Msg_NE -- CODEFIX ! ("add ALL to }!", N, Target_Type); return False; else diff -Nrcpad gcc-4.5.2/gcc/ada/sem_scil.adb gcc-4.6.0/gcc/ada/sem_scil.adb *** gcc-4.5.2/gcc/ada/sem_scil.adb Mon Nov 30 14:24:04 2009 --- gcc-4.6.0/gcc/ada/sem_scil.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2009-2010, 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,671 **** -- -- ------------------------------------------------------------------------------ ! with Einfo; use Einfo; ! with Namet; use Namet; ! with Nlists; use Nlists; ! with Opt; use Opt; ! with Rtsfind; use Rtsfind; ! with Sem; use Sem; ! with Sem_Aux; use Sem_Aux; ! with Sem_Util; use Sem_Util; ! with Sinfo; use Sinfo; ! with Snames; use Snames; ! with Stand; use Stand; package body Sem_SCIL is - ---------------------- - -- Adjust_SCIL_Node -- - ---------------------- - - procedure Adjust_SCIL_Node (Old_Node : Node_Id; New_Node : Node_Id) is - SCIL_Node : Node_Id; - - begin - pragma Assert (Generate_SCIL); - - -- Check cases in which no action is required. Currently the only SCIL - -- nodes that may require adjustment are those of dispatching calls - -- internally generated by the frontend. - - if Comes_From_Source (Old_Node) - or else not - Nkind_In (New_Node, N_Function_Call, N_Procedure_Call_Statement) - then - return; - - -- Conditional expression associated with equality operator. Old_Node - -- may be part of the expansion of the predefined equality operator of - -- a tagged type and hence we need to check if it has a SCIL dispatching - -- node that needs adjustment. - - elsif Nkind (Old_Node) = N_Conditional_Expression - and then (Nkind (Original_Node (Old_Node)) = N_Op_Eq - or else - (Nkind (Original_Node (Old_Node)) = N_Function_Call - and then Chars (Name (Original_Node (Old_Node))) = - Name_Op_Eq)) - then - null; - - -- Type conversions may involve dispatching calls to functions whose - -- associated SCIL dispatching node needs adjustment. - - elsif Nkind_In (Old_Node, N_Type_Conversion, - N_Unchecked_Type_Conversion) - then - null; - - -- Relocated subprogram call - - elsif Nkind (Old_Node) = Nkind (New_Node) - and then Original_Node (Old_Node) = Original_Node (New_Node) - then - null; - - else - return; - end if; - - -- Search for the SCIL node and update it (if found) - - SCIL_Node := Find_SCIL_Node (Old_Node); - - if Present (SCIL_Node) then - Set_SCIL_Related_Node (SCIL_Node, New_Node); - end if; - end Adjust_SCIL_Node; - --------------------- -- Check_SCIL_Node -- --------------------- function Check_SCIL_Node (N : Node_Id) return Traverse_Result is ! Ctrl_Tag : Node_Id; ! Ctrl_Typ : Entity_Id; begin ! if Nkind (N) = N_SCIL_Membership_Test then ! ! -- Check contents of the boolean expression associated with the ! -- membership test. ! ! pragma Assert (Nkind (SCIL_Related_Node (N)) = N_Identifier ! and then Etype (SCIL_Related_Node (N)) = Standard_Boolean); ! ! -- Check the entity identifier of the associated tagged type (that ! -- is, in testing for membership in T'Class, the entity id of the ! -- specific type T). ! ! -- Note: When the SCIL node is generated the private and full-view ! -- of the tagged types may have been swapped and hence the node ! -- referenced by attribute SCIL_Entity may be the private view. ! -- Therefore, in order to uniformily locate the full-view we use ! -- attribute Underlying_Type. ! ! pragma Assert (Is_Tagged_Type (Underlying_Type (SCIL_Entity (N)))); ! ! -- Interface types are unsupported ! ! pragma Assert (not Is_Interface (Underlying_Type (SCIL_Entity (N)))); ! ! -- Check the decoration of the expression that denotes the tag value ! -- being tested ! ! Ctrl_Tag := SCIL_Tag_Value (N); ! ! case Nkind (Ctrl_Tag) is ! ! -- For class-wide membership tests the SCIL tag value is the tag ! -- of the tested object (i.e. Obj.Tag). ! ! when N_Selected_Component => ! pragma Assert (Etype (Ctrl_Tag) = RTE (RE_Tag)); ! null; ! ! when others => ! pragma Assert (False); ! null; ! ! end case; ! ! return Skip; ! ! elsif Nkind (N) = N_SCIL_Dispatching_Call then ! Ctrl_Tag := SCIL_Controlling_Tag (N); ! ! -- SCIL_Related_Node of SCIL dispatching call nodes MUST reference ! -- subprogram calls. ! ! if not Nkind_In (SCIL_Related_Node (N), N_Function_Call, ! N_Procedure_Call_Statement) ! then ! pragma Assert (False); ! raise Program_Error; ! ! -- In simple cases the controlling tag is the tag of the controlling ! -- argument (i.e. Obj.Tag). ! ! elsif Nkind (Ctrl_Tag) = N_Selected_Component then ! Ctrl_Typ := Etype (Ctrl_Tag); ! ! -- Interface types are unsupported ! ! if Is_Interface (Ctrl_Typ) ! or else (RTE_Available (RE_Interface_Tag) ! and then Ctrl_Typ = RTE (RE_Interface_Tag)) ! then ! null; ! ! else ! pragma Assert (Ctrl_Typ = RTE (RE_Tag)); ! null; ! end if; ! ! -- When the controlling tag of a dispatching call is an identifier ! -- the SCIL_Controlling_Tag attribute references the corresponding ! -- object or parameter declaration. Interface types are still ! -- unsupported. ! ! elsif Nkind_In (Ctrl_Tag, N_Object_Declaration, ! N_Parameter_Specification) ! then ! Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag)); ! ! -- Interface types are unsupported. ! ! if Is_Interface (Ctrl_Typ) ! or else (RTE_Available (RE_Interface_Tag) ! and then Ctrl_Typ = RTE (RE_Interface_Tag)) ! or else (Is_Access_Type (Ctrl_Typ) ! and then ! Is_Interface ! (Available_View ! (Base_Type (Designated_Type (Ctrl_Typ))))) ! then ! null; ! ! else ! pragma Assert ! (Ctrl_Typ = RTE (RE_Tag) ! or else ! (Is_Access_Type (Ctrl_Typ) ! and then Available_View ! (Base_Type (Designated_Type (Ctrl_Typ))) = ! RTE (RE_Tag))); ! null; ! end if; ! ! -- Interface types are unsupported ! ! elsif Is_Interface (Etype (Ctrl_Tag)) then ! null; ! ! else ! pragma Assert (False); ! raise Program_Error; ! end if; ! ! return Skip; ! ! -- Node is not N_SCIL_Dispatching_Call ! else return OK; end if; - end Check_SCIL_Node; - - -------------------- - -- Find_SCIL_Node -- - -------------------- ! function Find_SCIL_Node (Node : Node_Id) return Node_Id is ! Found_Node : Node_Id; ! -- This variable stores the last node found by the nested subprogram ! -- Find_SCIL_Node. ! ! function Find_SCIL_Node (L : List_Id) return Boolean; ! -- Searches in list L for a SCIL node associated with a dispatching call ! -- whose SCIL_Related_Node is Node. If found returns true and stores the ! -- SCIL node in Found_Node; otherwise returns False and sets Found_Node ! -- to Empty. ! ! -------------------- ! -- Find_SCIL_Node -- ! -------------------- ! ! function Find_SCIL_Node (L : List_Id) return Boolean is ! N : Node_Id; ! ! begin ! N := First (L); ! while Present (N) loop ! if Nkind (N) in N_SCIL_Node ! and then SCIL_Related_Node (N) = Node ! then ! Found_Node := N; ! return True; ! end if; ! ! Next (N); ! end loop; ! ! Found_Node := Empty; ! return False; ! end Find_SCIL_Node; ! ! -- Local variables ! ! P : Node_Id; ! ! -- Start of processing for Find_SCIL_Node ! begin ! pragma Assert (Generate_SCIL); ! -- Search for the SCIL node in list associated with a transient scope ! if Scope_Is_Transient then ! declare ! SE : Scope_Stack_Entry ! renames Scope_Stack.Table (Scope_Stack.Last); ! begin ! if SE.Is_Transient ! and then Present (SE.Actions_To_Be_Wrapped_Before) ! and then Find_SCIL_Node (SE.Actions_To_Be_Wrapped_Before) then ! return Found_Node; ! end if; ! end; ! end if; ! -- Otherwise climb up the tree searching for the SCIL node analyzing ! -- all the lists in which Insert_Actions may have inserted it ! P := Node; ! while Present (P) loop ! case Nkind (P) is ! -- Actions associated with AND THEN or OR ELSE ! when N_Short_Circuit => ! if Present (Actions (P)) ! and then Find_SCIL_Node (Actions (P)) then ! return Found_Node; ! end if; ! ! -- Actions of conditional expressions ! when N_Conditional_Expression => ! if (Present (Then_Actions (P)) ! and then Find_SCIL_Node (Actions (P))) ! or else ! (Present (Else_Actions (P)) ! and then Find_SCIL_Node (Else_Actions (P))) ! then ! return Found_Node; end if; ! -- Actions in handled sequence of statements ! when ! N_Handled_Sequence_Of_Statements => ! if Find_SCIL_Node (Statements (P)) then ! return Found_Node; ! end if; ! -- Conditions of while expression or elsif. ! when N_Iteration_Scheme | ! N_Elsif_Part ! => ! if Present (Condition_Actions (P)) ! and then Find_SCIL_Node (Condition_Actions (P)) then - return Found_Node; - end if; - - -- Statements, declarations, pragmas, representation clauses - - when - -- Statements - - N_Procedure_Call_Statement | - N_Statement_Other_Than_Procedure_Call | - - -- Pragmas - - N_Pragma | - - -- Representation_Clause - - N_At_Clause | - N_Attribute_Definition_Clause | - N_Enumeration_Representation_Clause | - N_Record_Representation_Clause | - - -- Declarations - - N_Abstract_Subprogram_Declaration | - N_Entry_Body | - N_Exception_Declaration | - N_Exception_Renaming_Declaration | - N_Formal_Abstract_Subprogram_Declaration | - N_Formal_Concrete_Subprogram_Declaration | - N_Formal_Object_Declaration | - N_Formal_Type_Declaration | - N_Full_Type_Declaration | - N_Function_Instantiation | - N_Generic_Function_Renaming_Declaration | - N_Generic_Package_Declaration | - N_Generic_Package_Renaming_Declaration | - N_Generic_Procedure_Renaming_Declaration | - N_Generic_Subprogram_Declaration | - N_Implicit_Label_Declaration | - N_Incomplete_Type_Declaration | - N_Number_Declaration | - N_Object_Declaration | - N_Object_Renaming_Declaration | - N_Package_Body | - N_Package_Body_Stub | - N_Package_Declaration | - N_Package_Instantiation | - N_Package_Renaming_Declaration | - N_Private_Extension_Declaration | - N_Private_Type_Declaration | - N_Procedure_Instantiation | - N_Protected_Body | - N_Protected_Body_Stub | - N_Protected_Type_Declaration | - N_Single_Task_Declaration | - N_Subprogram_Body | - N_Subprogram_Body_Stub | - N_Subprogram_Declaration | - N_Subprogram_Renaming_Declaration | - N_Subtype_Declaration | - N_Task_Body | - N_Task_Body_Stub | - N_Task_Type_Declaration | - - -- Freeze entity behaves like a declaration or statement - - N_Freeze_Entity - => - -- Do not search here if the item is not a list member - - if not Is_List_Member (P) then - null; - - -- Do not search if parent of P is an N_Component_Association - -- node (i.e. we are in the context of an N_Aggregate or - -- N_Extension_Aggregate node). In this case the node should - -- have been added before the entire aggregate. - - elsif Nkind (Parent (P)) = N_Component_Association then null; ! -- Do not search if the parent of P is either an N_Variant ! -- node or an N_Record_Definition node. In this case the node ! -- should have been added before the entire record. ! ! elsif Nkind (Parent (P)) = N_Variant ! or else Nkind (Parent (P)) = N_Record_Definition ! then null; - - -- Otherwise search it in the list containing this node - - elsif Find_SCIL_Node (List_Containing (P)) then - return Found_Node; end if; ! -- A special case, N_Raise_xxx_Error can act either as a statement ! -- or a subexpression. We diferentiate them by looking at the ! -- Etype. It is set to Standard_Void_Type in the statement case. ! ! when ! N_Raise_xxx_Error => ! if Etype (P) = Standard_Void_Type then ! if Is_List_Member (P) ! and then Find_SCIL_Node (List_Containing (P)) ! then ! return Found_Node; ! end if; ! -- In the subexpression case, keep climbing ! else ! null; ! end if; ! -- If a component association appears within a loop created for ! -- an array aggregate, check if the SCIL node was added to the ! -- the list of nodes attached to the association. ! when ! N_Component_Association => ! if Nkind (Parent (P)) = N_Aggregate ! and then Present (Loop_Actions (P)) ! and then Find_SCIL_Node (Loop_Actions (P)) ! then ! return Found_Node; ! end if; ! -- Another special case, an attribute denoting a procedure call ! when ! N_Attribute_Reference => ! if Is_Procedure_Attribute_Name (Attribute_Name (P)) ! and then Find_SCIL_Node (List_Containing (P)) ! then ! return Found_Node; ! -- In the subexpression case, keep climbing ! else ! null; ! end if; ! -- SCIL nodes do not have subtrees and hence they can never be ! -- found climbing tree ! when ! N_SCIL_Dispatch_Table_Object_Init | ! N_SCIL_Dispatch_Table_Tag_Init | ! N_SCIL_Dispatching_Call | ! N_SCIL_Membership_Test | ! N_SCIL_Tag_Init ! => ! pragma Assert (False); ! raise Program_Error; ! -- For all other node types, keep climbing tree ! when ! N_Abortable_Part | ! N_Accept_Alternative | ! N_Access_Definition | ! N_Access_Function_Definition | ! N_Access_Procedure_Definition | ! N_Access_To_Object_Definition | ! N_Aggregate | ! N_Allocator | ! N_Case_Statement_Alternative | ! N_Character_Literal | ! N_Compilation_Unit | ! N_Compilation_Unit_Aux | ! N_Component_Clause | ! N_Component_Declaration | ! N_Component_Definition | ! N_Component_List | ! N_Constrained_Array_Definition | ! N_Decimal_Fixed_Point_Definition | ! N_Defining_Character_Literal | ! N_Defining_Identifier | ! N_Defining_Operator_Symbol | ! N_Defining_Program_Unit_Name | ! N_Delay_Alternative | ! N_Delta_Constraint | ! N_Derived_Type_Definition | ! N_Designator | ! N_Digits_Constraint | ! N_Discriminant_Association | ! N_Discriminant_Specification | ! N_Empty | ! N_Entry_Body_Formal_Part | ! N_Entry_Call_Alternative | ! N_Entry_Declaration | ! N_Entry_Index_Specification | ! N_Enumeration_Type_Definition | ! N_Error | ! N_Exception_Handler | ! N_Expanded_Name | ! N_Explicit_Dereference | ! N_Extension_Aggregate | ! N_Floating_Point_Definition | ! N_Formal_Decimal_Fixed_Point_Definition | ! N_Formal_Derived_Type_Definition | ! N_Formal_Discrete_Type_Definition | ! N_Formal_Floating_Point_Definition | ! N_Formal_Modular_Type_Definition | ! N_Formal_Ordinary_Fixed_Point_Definition | ! N_Formal_Package_Declaration | ! N_Formal_Private_Type_Definition | ! N_Formal_Signed_Integer_Type_Definition | ! N_Function_Call | ! N_Function_Specification | ! N_Generic_Association | ! N_Identifier | ! N_In | ! N_Index_Or_Discriminant_Constraint | ! N_Indexed_Component | ! N_Integer_Literal | ! N_Itype_Reference | ! N_Label | ! N_Loop_Parameter_Specification | ! N_Mod_Clause | ! N_Modular_Type_Definition | ! N_Not_In | ! N_Null | ! N_Op_Abs | ! N_Op_Add | ! N_Op_And | ! N_Op_Concat | ! N_Op_Divide | ! N_Op_Eq | ! N_Op_Expon | ! N_Op_Ge | ! N_Op_Gt | ! N_Op_Le | ! N_Op_Lt | ! N_Op_Minus | ! N_Op_Mod | ! N_Op_Multiply | ! N_Op_Ne | ! N_Op_Not | ! N_Op_Or | ! N_Op_Plus | ! N_Op_Rem | ! N_Op_Rotate_Left | ! N_Op_Rotate_Right | ! N_Op_Shift_Left | ! N_Op_Shift_Right | ! N_Op_Shift_Right_Arithmetic | ! N_Op_Subtract | ! N_Op_Xor | ! N_Operator_Symbol | ! N_Ordinary_Fixed_Point_Definition | ! N_Others_Choice | ! N_Package_Specification | ! N_Parameter_Association | ! N_Parameter_Specification | ! N_Pop_Constraint_Error_Label | ! N_Pop_Program_Error_Label | ! N_Pop_Storage_Error_Label | ! N_Pragma_Argument_Association | ! N_Procedure_Specification | ! N_Protected_Definition | ! N_Push_Constraint_Error_Label | ! N_Push_Program_Error_Label | ! N_Push_Storage_Error_Label | ! N_Qualified_Expression | ! N_Range | ! N_Range_Constraint | ! N_Real_Literal | ! N_Real_Range_Specification | ! N_Record_Definition | ! N_Reference | ! N_Selected_Component | ! N_Signed_Integer_Type_Definition | ! N_Single_Protected_Declaration | ! N_Slice | ! N_String_Literal | ! N_Subprogram_Info | ! N_Subtype_Indication | ! N_Subunit | ! N_Task_Definition | ! N_Terminate_Alternative | ! N_Triggering_Alternative | ! N_Type_Conversion | ! N_Unchecked_Expression | ! N_Unchecked_Type_Conversion | ! N_Unconstrained_Array_Definition | ! N_Unused_At_End | ! N_Unused_At_Start | ! N_Use_Package_Clause | ! N_Use_Type_Clause | ! N_Variant | ! N_Variant_Part | ! N_Validate_Unchecked_Conversion | ! N_With_Clause ! => ! null; ! end case; ! -- If we fall through above tests, keep climbing tree ! if Nkind (Parent (P)) = N_Subunit then ! -- This is the proper body corresponding to a stub. Insertion done ! -- at the point of the stub, which is in the declarative part of ! -- the parent unit. ! P := Corresponding_Stub (Parent (P)); ! else ! P := Parent (P); ! end if; ! end loop; ! -- SCIL node not found ! return Empty; ! end Find_SCIL_Node; ------------------------- -- First_Non_SCIL_Node -- --- 23,192 ---- -- -- ------------------------------------------------------------------------------ ! with Einfo; use Einfo; ! with Nlists; use Nlists; ! with Rtsfind; use Rtsfind; ! with Sem_Aux; use Sem_Aux; ! with Sinfo; use Sinfo; ! with Stand; use Stand; ! with SCIL_LL; use SCIL_LL; package body Sem_SCIL is --------------------- -- Check_SCIL_Node -- --------------------- function Check_SCIL_Node (N : Node_Id) return Traverse_Result is ! SCIL_Node : constant Node_Id := Get_SCIL_Node (N); ! Ctrl_Tag : Node_Id; ! Ctrl_Typ : Entity_Id; begin ! -- For nodes that do not have SCIL node continue traversing the tree ! if No (SCIL_Node) then return OK; end if; ! case Nkind (SCIL_Node) is ! when N_SCIL_Dispatch_Table_Tag_Init => ! pragma Assert (Nkind (N) = N_Object_Declaration); ! null; ! when N_SCIL_Dispatching_Call => ! Ctrl_Tag := SCIL_Controlling_Tag (SCIL_Node); ! -- Parent of SCIL dispatching call nodes MUST be a subprogram call ! if not Nkind_In (N, N_Function_Call, ! N_Procedure_Call_Statement) then ! pragma Assert (False); ! raise Program_Error; ! -- In simple cases the controlling tag is the tag of the ! -- controlling argument (i.e. Obj.Tag). ! elsif Nkind (Ctrl_Tag) = N_Selected_Component then ! Ctrl_Typ := Etype (Ctrl_Tag); ! -- Interface types are unsupported ! if Is_Interface (Ctrl_Typ) ! or else (RTE_Available (RE_Interface_Tag) ! and then Ctrl_Typ = RTE (RE_Interface_Tag)) then ! null; ! else ! pragma Assert (Ctrl_Typ = RTE (RE_Tag)); ! null; end if; ! -- When the controlling tag of a dispatching call is an identifier ! -- the SCIL_Controlling_Tag attribute references the corresponding ! -- object or parameter declaration. Interface types are still ! -- unsupported. ! elsif Nkind_In (Ctrl_Tag, N_Object_Declaration, ! N_Parameter_Specification) ! then ! Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag)); ! -- Interface types are unsupported. ! if Is_Interface (Ctrl_Typ) ! or else (RTE_Available (RE_Interface_Tag) ! and then Ctrl_Typ = RTE (RE_Interface_Tag)) ! or else (Is_Access_Type (Ctrl_Typ) ! and then ! Is_Interface ! (Available_View ! (Base_Type (Designated_Type (Ctrl_Typ))))) then null; ! else ! pragma Assert ! (Ctrl_Typ = RTE (RE_Tag) ! or else ! (Is_Access_Type (Ctrl_Typ) ! and then Available_View ! (Base_Type (Designated_Type (Ctrl_Typ))) ! = RTE (RE_Tag))); null; end if; ! -- Interface types are unsupported ! elsif Is_Interface (Etype (Ctrl_Tag)) then ! null; ! else ! pragma Assert (False); ! raise Program_Error; ! end if; ! return Skip; ! when N_SCIL_Membership_Test => ! -- Check contents of the boolean expression associated with the ! -- membership test. ! pragma Assert (Nkind_In (N, N_Identifier, ! N_And_Then, ! N_Or_Else, ! N_Expression_With_Actions) ! and then Etype (N) = Standard_Boolean); ! -- Check the entity identifier of the associated tagged type (that ! -- is, in testing for membership in T'Class, the entity id of the ! -- specific type T). ! -- Note: When the SCIL node is generated the private and full-view ! -- of the tagged types may have been swapped and hence the node ! -- referenced by attribute SCIL_Entity may be the private view. ! -- Therefore, in order to uniformly locate the full-view we use ! -- attribute Underlying_Type. ! pragma Assert ! (Is_Tagged_Type (Underlying_Type (SCIL_Entity (SCIL_Node)))); ! -- Interface types are unsupported ! pragma Assert ! (not Is_Interface (Underlying_Type (SCIL_Entity (SCIL_Node)))); ! -- Check the decoration of the expression that denotes the tag ! -- value being tested ! Ctrl_Tag := SCIL_Tag_Value (SCIL_Node); ! case Nkind (Ctrl_Tag) is ! -- For class-wide membership tests the SCIL tag value is the ! -- tag of the tested object (i.e. Obj.Tag). ! when N_Selected_Component => ! pragma Assert (Etype (Ctrl_Tag) = RTE (RE_Tag)); ! null; ! when others => ! pragma Assert (False); ! null; ! end case; ! return Skip; ! when others => ! pragma Assert (False); ! raise Program_Error; ! end case; ! return Skip; ! end Check_SCIL_Node; ------------------------- -- First_Non_SCIL_Node -- diff -Nrcpad gcc-4.5.2/gcc/ada/sem_scil.ads gcc-4.6.0/gcc/ada/sem_scil.ads *** gcc-4.5.2/gcc/ada/sem_scil.ads Wed Jul 29 08:43:58 2009 --- gcc-4.6.0/gcc/ada/sem_scil.ads Wed Jun 23 06:11:20 2010 *************** *** 4,12 **** -- -- -- S E M _ S C I L -- -- -- ! -- B o d y -- -- -- ! -- Copyright (C) 2009, 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- -- --- 4,12 ---- -- -- -- S E M _ S C I L -- -- -- ! -- S p e c -- -- -- ! -- Copyright (C) 2009-2010, 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- -- *************** package Sem_SCIL is *** 33,42 **** -- Here would be a good place to document what SCIL is all about ??? - procedure Adjust_SCIL_Node (Old_Node : Node_Id; New_Node : Node_Id); - -- Searches for a SCIL dispatching node associated with Old_Node. If found - -- then update its SCIL_Related_Node field to reference New_Node. - function Check_SCIL_Node (N : Node_Id) return Traverse_Result; -- Process a single node during the tree traversal. Done to verify that -- SCIL nodes decoration fulfill the requirements of the SCIL backend. --- 33,38 ---- *************** package Sem_SCIL is *** 44,53 **** procedure Check_SCIL_Nodes is new Traverse_Proc (Check_SCIL_Node); -- The traversal procedure itself - function Find_SCIL_Node (Node : Node_Id) return Node_Id; - -- Searches for a SCIL dispatching node associated with Node. If not found - -- then return Empty. - function First_Non_SCIL_Node (L : List_Id) return Node_Id; -- Returns the first non-SCIL node of list L --- 40,45 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/sem_type.adb gcc-4.6.0/gcc/ada/sem_type.adb *** gcc-4.5.2/gcc/ada/sem_type.adb Thu Oct 29 14:42:50 2009 --- gcc-4.6.0/gcc/ada/sem_type.adb Mon Oct 18 09:37:14 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sem_Type is *** 230,236 **** -- Find out whether the new entry references interpretations that -- are abstract or disabled by abstract operators. ! if Ada_Version >= Ada_05 then if Nkind (N) in N_Binary_Op then Abstr_Op := Binary_Op_Interp_Has_Abstract_Op (N, Name); elsif Nkind (N) = N_Function_Call then --- 230,236 ---- -- Find out whether the new entry references interpretations that -- are abstract or disabled by abstract operators. ! if Ada_Version >= Ada_2005 then if Nkind (N) in N_Binary_Op then Abstr_Op := Binary_Op_Interp_Has_Abstract_Op (N, Name); elsif Nkind (N) = N_Function_Call then *************** package body Sem_Type is *** 362,368 **** -- performed, given that the operator was visible in the generic. if Ekind (E) = E_Operator then - if Present (Opnd_Type) then Vis_Type := Opnd_Type; else --- 362,367 ---- *************** package body Sem_Type is *** 481,490 **** then Add_Entry (Entity (N), Etype (N)); ! elsif (Nkind (N) = N_Function_Call ! or else Nkind (N) = N_Procedure_Call_Statement) ! and then (Nkind (Name (N)) = N_Operator_Symbol ! or else Is_Entity_Name (Name (N))) then Add_Entry (Entity (Name (N)), Etype (N)); --- 480,487 ---- then Add_Entry (Entity (N), Etype (N)); ! elsif Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) ! and then Is_Entity_Name (Name (N)) then Add_Entry (Entity (Name (N)), Etype (N)); *************** package body Sem_Type is *** 758,763 **** --- 755,768 ---- end if; end if; + -- First check for Standard_Void_Type, which is special. Subsequent + -- processing in this routine assumes T1 and T2 are bona fide types; + -- Standard_Void_Type is a special entity that has some, but not all, + -- properties of types. + + if (T1 = Standard_Void_Type) /= (T2 = Standard_Void_Type) then + return False; + -- Simplest case: same types are compatible, and types that have the -- same base type and are not generic actuals are compatible. Generic -- actuals belong to their class but are not compatible with other *************** package body Sem_Type is *** 773,779 **** -- the same actual, so that different subprograms end up with the same -- signature in the instance. ! if T1 = T2 then return True; elsif BT1 = BT2 --- 778,784 ---- -- the same actual, so that different subprograms end up with the same -- signature in the instance. ! elsif T1 = T2 then return True; elsif BT1 = BT2 *************** package body Sem_Type is *** 803,810 **** then return True; ! -- The context may be class wide, and a class-wide type is ! -- compatible with any member of the class. elsif Is_Class_Wide_Type (T1) and then Is_Ancestor (Root_Type (T1), T2) --- 808,815 ---- then return True; ! -- The context may be class wide, and a class-wide type is compatible ! -- with any member of the class. elsif Is_Class_Wide_Type (T1) and then Is_Ancestor (Root_Type (T1), T2) *************** package body Sem_Type is *** 820,826 **** -- Ada 2005 (AI-345): A class-wide abstract interface type covers a -- task_type or protected_type that implements the interface. ! elsif Ada_Version >= Ada_05 and then Is_Class_Wide_Type (T1) and then Is_Interface (Etype (T1)) and then Is_Concurrent_Type (T2) --- 825,831 ---- -- Ada 2005 (AI-345): A class-wide abstract interface type covers a -- task_type or protected_type that implements the interface. ! elsif Ada_Version >= Ada_2005 and then Is_Class_Wide_Type (T1) and then Is_Interface (Etype (T1)) and then Is_Concurrent_Type (T2) *************** package body Sem_Type is *** 833,839 **** -- Ada 2005 (AI-251): A class-wide abstract interface type T1 covers an -- object T2 implementing T1 ! elsif Ada_Version >= Ada_05 and then Is_Class_Wide_Type (T1) and then Is_Interface (Etype (T1)) and then Is_Tagged_Type (T2) --- 838,844 ---- -- Ada 2005 (AI-251): A class-wide abstract interface type T1 covers an -- object T2 implementing T1 ! elsif Ada_Version >= Ada_2005 and then Is_Class_Wide_Type (T1) and then Is_Interface (Etype (T1)) and then Is_Tagged_Type (T2) *************** package body Sem_Type is *** 878,887 **** return False; end; ! -- In a dispatching call the actual may be class-wide elsif Is_Class_Wide_Type (T2) ! and then Base_Type (Root_Type (T2)) = Base_Type (T1) then return True; --- 883,895 ---- return False; end; ! -- In a dispatching call the actual may be class-wide, the formal ! -- may be its specific type, or that of a descendent of it. elsif Is_Class_Wide_Type (T2) ! and then ! (Class_Wide_Type (T1) = T2 ! or else Base_Type (Root_Type (T2)) = Base_Type (T1)) then return True; *************** package body Sem_Type is *** 901,907 **** -- An aggregate is compatible with an array or record type elsif T2 = Any_Composite ! and then Ekind (T1) in E_Array_Type .. E_Record_Subtype then return True; --- 909,915 ---- -- An aggregate is compatible with an array or record type elsif T2 = Any_Composite ! and then Is_Aggregate_Type (T1) then return True; *************** package body Sem_Type is *** 997,1005 **** -- imposed by context. elsif Ekind (T2) = E_Access_Attribute_Type ! and then (Ekind (BT1) = E_General_Access_Type ! or else ! Ekind (BT1) = E_Access_Type) and then Covers (Designated_Type (T1), Designated_Type (T2)) then -- If the target type is a RACW type while the source is an access --- 1005,1011 ---- -- imposed by context. elsif Ekind (T2) = E_Access_Attribute_Type ! and then Ekind_In (BT1, E_General_Access_Type, E_Access_Type) and then Covers (Designated_Type (T1), Designated_Type (T2)) then -- If the target type is a RACW type while the source is an access *************** package body Sem_Type is *** 1153,1159 **** -- package Instance is new G (Formal => Actual, -- Formal_Obj => Actual_Obj); ! elsif Ada_Version >= Ada_05 and then Ekind (T1) = E_Anonymous_Access_Type and then Ekind (T2) = E_Anonymous_Access_Type and then Is_Generic_Type (Directly_Designated_Type (T1)) --- 1159,1165 ---- -- package Instance is new G (Formal => Actual, -- Formal_Obj => Actual_Obj); ! elsif Ada_Version >= Ada_2005 and then Ekind (T1) = E_Anonymous_Access_Type and then Ekind (T2) = E_Anonymous_Access_Type and then Is_Generic_Type (Directly_Designated_Type (T1)) *************** package body Sem_Type is *** 1299,1305 **** begin if Nkind (N) not in N_Op ! or else Ada_Version < Ada_05 or else not Is_Overloaded (N) or else No (Universal_Interpretation (N)) then --- 1305,1311 ---- begin if Nkind (N) not in N_Op ! or else Ada_Version < Ada_2005 or else not Is_Overloaded (N) or else No (Universal_Interpretation (N)) then *************** package body Sem_Type is *** 1535,1549 **** It2 := It; Nam2 := It.Nam; ! if Ada_Version < Ada_05 then ! -- Check whether one of the entities is an Ada 2005 entity and we are ! -- operating in an earlier mode, in which case we discard the Ada ! -- 2005 entity, so that we get proper Ada 95 overload resolution. ! if Is_Ada_2005_Only (Nam1) then return It2; ! elsif Is_Ada_2005_Only (Nam2) then return It1; end if; end if; --- 1541,1566 ---- It2 := It; Nam2 := It.Nam; ! -- Check whether one of the entities is an Ada 2005/2012 and we are ! -- operating in an earlier mode, in which case we discard the Ada ! -- 2005/2012 entity, so that we get proper Ada 95 overload resolution. ! if Ada_Version < Ada_2005 then ! if Is_Ada_2005_Only (Nam1) or else Is_Ada_2012_Only (Nam1) then ! return It2; ! elsif Is_Ada_2005_Only (Nam2) or else Is_Ada_2012_Only (Nam1) then ! return It1; ! end if; ! end if; ! -- Check whether one of the entities is an Ada 2012 entity and we are ! -- operating in Ada 2005 mode, in which case we discard the Ada 2012 ! -- entity, so that we get proper Ada 2005 overload resolution. ! ! if Ada_Version = Ada_2005 then ! if Is_Ada_2012_Only (Nam1) then return It2; ! elsif Is_Ada_2012_Only (Nam2) then return It1; end if; end if; *************** package body Sem_Type is *** 1625,1633 **** Arg1 := Left_Opnd (N); Arg2 := Right_Opnd (N); ! elsif Is_Entity_Name (N) ! or else Nkind (N) = N_Operator_Symbol ! then Arg1 := First_Entity (Entity (N)); Arg2 := Next_Entity (Arg1); --- 1642,1648 ---- Arg1 := Left_Opnd (N); Arg2 := Right_Opnd (N); ! elsif Is_Entity_Name (N) then Arg1 := First_Entity (Entity (N)); Arg2 := Next_Entity (Arg1); *************** package body Sem_Type is *** 1677,1685 **** elsif Nkind (Parent (N)) = N_Object_Renaming_Declaration and then Present (Access_Definition (Parent (N))) then ! if Ekind (It1.Typ) = E_Anonymous_Access_Type ! or else ! Ekind (It1.Typ) = E_Anonymous_Access_Subprogram_Type then if Ekind (It2.Typ) = Ekind (It1.Typ) then --- 1692,1699 ---- elsif Nkind (Parent (N)) = N_Object_Renaming_Declaration and then Present (Access_Definition (Parent (N))) then ! if Ekind_In (It1.Typ, E_Anonymous_Access_Type, ! E_Anonymous_Access_Subprogram_Type) then if Ekind (It2.Typ) = Ekind (It1.Typ) then *************** package body Sem_Type is *** 1691,1699 **** return It1; end if; ! elsif Ekind (It2.Typ) = E_Anonymous_Access_Type ! or else ! Ekind (It2.Typ) = E_Anonymous_Access_Subprogram_Type then return It2; --- 1705,1712 ---- return It1; end if; ! elsif Ekind_In (It2.Typ, E_Anonymous_Access_Type, ! E_Anonymous_Access_Subprogram_Type) then return It2; *************** package body Sem_Type is *** 1866,1876 **** elsif (Chars (Nam1) = Name_Op_Eq or else Chars (Nam1) = Name_Op_Ne) ! and then Ada_Version >= Ada_05 and then Etype (User_Subp) = Standard_Boolean then declare Opnd : Node_Id; begin if Nkind (N) = N_Function_Call then Opnd := First_Actual (N); --- 1879,1890 ---- elsif (Chars (Nam1) = Name_Op_Eq or else Chars (Nam1) = Name_Op_Ne) ! and then Ada_Version >= Ada_2005 and then Etype (User_Subp) = Standard_Boolean then declare Opnd : Node_Id; + begin if Nkind (N) = N_Function_Call then Opnd := First_Actual (N); *************** package body Sem_Type is *** 1880,1887 **** if Ekind (Etype (Opnd)) = E_Anonymous_Access_Type and then ! List_Containing (Parent (Designated_Type (Etype (Opnd)))) ! = List_Containing (Unit_Declaration_Node (User_Subp)) then if It2.Nam = Predef_Subp then return It1; --- 1894,1901 ---- if Ekind (Etype (Opnd)) = E_Anonymous_Access_Type and then ! In_Same_List (Parent (Designated_Type (Etype (Opnd))), ! Unit_Declaration_Node (User_Subp)) then if It2.Nam = Predef_Subp then return It1; *************** package body Sem_Type is *** 2011,2017 **** -- P is convertible to "access Integer" by 4.6 (24.11-24.15), but there -- is no rule in 4.6 that allows "access Integer" to be converted to P. ! elsif Ada_Version >= Ada_05 and then (Ekind (Etype (L)) = E_Anonymous_Access_Type or else --- 2025,2031 ---- -- P is convertible to "access Integer" by 4.6 (24.11-24.15), but there -- is no rule in 4.6 that allows "access Integer" to be converted to P. ! elsif Ada_Version >= Ada_2005 and then (Ekind (Etype (L)) = E_Anonymous_Access_Type or else *************** package body Sem_Type is *** 2021,2027 **** then return Etype (L); ! elsif Ada_Version >= Ada_05 and then (Ekind (Etype (R)) = E_Anonymous_Access_Type or else Ekind (Etype (R)) = E_Anonymous_Access_Subprogram_Type) --- 2035,2041 ---- then return Etype (L); ! elsif Ada_Version >= Ada_2005 and then (Ekind (Etype (R)) = E_Anonymous_Access_Type or else Ekind (Etype (R)) = E_Anonymous_Access_Subprogram_Type) *************** package body Sem_Type is *** 2559,2567 **** BT1 := Base_Type (T1); BT2 := Base_Type (T2); ! -- Handle underlying view of records with unknown discriminants ! -- using the original entity that motivated the construction of ! -- this underlying record view (see Build_Derived_Private_Type). if Is_Underlying_Record_View (BT1) then BT1 := Underlying_Record_View (BT1); --- 2573,2581 ---- BT1 := Base_Type (T1); BT2 := Base_Type (T2); ! -- Handle underlying view of records with unknown discriminants using ! -- the original entity that motivated the construction of this ! -- underlying record view (see Build_Derived_Private_Type). if Is_Underlying_Record_View (BT1) then BT1 := Underlying_Record_View (BT1); *************** package body Sem_Type is *** 2574,2585 **** --- 2588,2607 ---- if BT1 = BT2 then return True; + -- The predicate must look past privacy + elsif Is_Private_Type (T1) and then Present (Full_View (T1)) and then BT2 = Base_Type (Full_View (T1)) then return True; + elsif Is_Private_Type (T2) + and then Present (Full_View (T2)) + and then BT1 = Base_Type (Full_View (T2)) + then + return True; + else Par := Etype (BT2); *************** package body Sem_Type is *** 2603,2609 **** return True; elsif Etype (Par) /= Par then ! Par := Etype (Par); else return False; end if; --- 2625,2646 ---- return True; elsif Etype (Par) /= Par then ! ! -- If this is a private type and its parent is an interface ! -- then use the parent of the full view (which is a type that ! -- implements such interface) ! ! if Is_Private_Type (Par) ! and then Is_Interface (Etype (Par)) ! and then Present (Full_View (Par)) ! then ! Par := Etype (Full_View (Par)); ! else ! Par := Etype (Par); ! end if; ! ! -- For all other cases return False, not an Ancestor ! else return False; end if; *************** package body Sem_Type is *** 2650,2655 **** --- 2687,2704 ---- end if; end Is_Invisible_Operator; + -------------------- + -- Is_Progenitor -- + -------------------- + + function Is_Progenitor + (Iface : Entity_Id; + Typ : Entity_Id) return Boolean + is + begin + return Implements_Interface (Typ, Iface, Exclude_Parents => True); + end Is_Progenitor; + ------------------- -- Is_Subtype_Of -- ------------------- *************** package body Sem_Type is *** 3029,3040 **** return T1; elsif T2 = Any_Composite ! and then Ekind (T1) in E_Array_Type .. E_Record_Subtype then return T1; elsif T1 = Any_Composite ! and then Ekind (T2) in E_Array_Type .. E_Record_Subtype then return T2; --- 3078,3089 ---- return T1; elsif T2 = Any_Composite ! and then Is_Aggregate_Type (T1) then return T1; elsif T1 = Any_Composite ! and then Is_Aggregate_Type (T2) then return T2; *************** package body Sem_Type is *** 3191,3197 **** Write_Str (" Index: "); Write_Int (Int (Interp_Map.Table (Map_Ptr).Index)); Write_Str (" Next: "); ! Write_Int (Int (Interp_Map.Table (Map_Ptr).Next)); Write_Eol; end Write_Interp_Ref; --- 3240,3246 ---- Write_Str (" Index: "); Write_Int (Int (Interp_Map.Table (Map_Ptr).Index)); Write_Str (" Next: "); ! Write_Int (Interp_Map.Table (Map_Ptr).Next); Write_Eol; end Write_Interp_Ref; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_type.ads gcc-4.6.0/gcc/ada/sem_type.ads *** gcc-4.5.2/gcc/ada/sem_type.ads Wed Jul 22 10:31:30 2009 --- gcc-4.6.0/gcc/ada/sem_type.ads Thu Sep 9 10:07:52 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Type is *** 221,226 **** --- 221,234 ---- -- T1 is a tagged type (not class-wide). Verify that it is one of the -- ancestors of type T2 (which may or not be class-wide). + function Is_Progenitor + (Iface : Entity_Id; + Typ : Entity_Id) return Boolean; + -- Determine whether the interface Iface is implemented by Typ. It 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_Subtype_Of (T1 : Entity_Id; T2 : Entity_Id) return Boolean; -- Checks whether T1 is any subtype of T2 directly or indirectly. Applies -- only to scalar subtypes??? diff -Nrcpad gcc-4.5.2/gcc/ada/sem_util.adb gcc-4.6.0/gcc/ada/sem_util.adb *** gcc-4.5.2/gcc/ada/sem_util.adb Mon Nov 30 16:08:37 2009 --- gcc-4.6.0/gcc/ada/sem_util.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Nlists; use Nlists; *** 41,48 **** with Output; use Output; with Opt; use Opt; with Rtsfind; use Rtsfind; - with Scans; use Scans; - with Scn; use Scn; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Attr; use Sem_Attr; --- 41,46 ---- *************** with Sem_Ch8; use Sem_Ch8; *** 50,68 **** with Sem_Disp; use Sem_Disp; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; - with Sem_SCIL; use Sem_SCIL; with Sem_Type; use Sem_Type; with Sinfo; use Sinfo; with Sinput; use Sinput; with Stand; use Stand; with Style; with Stringt; use Stringt; with Targparm; use Targparm; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uname; use Uname; with GNAT.HTable; use GNAT.HTable; package body Sem_Util is ---------------------------------------- --- 48,67 ---- with Sem_Disp; use Sem_Disp; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sinfo; use Sinfo; with Sinput; use Sinput; with Stand; use Stand; with Style; with Stringt; use Stringt; + with Table; with Targparm; use Targparm; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uname; use Uname; with GNAT.HTable; use GNAT.HTable; + package body Sem_Util is ---------------------------------------- *************** package body Sem_Util is *** 74,80 **** -- safely used by New_Copy_Tree, since there is no case of a recursive -- call from the processing inside New_Copy_Tree. ! NCT_Hash_Threshhold : constant := 20; -- If there are more than this number of pairs of entries in the -- map, then Hash_Tables_Used will be set, and the hash tables will -- be initialized and used for the searches. --- 73,79 ---- -- safely used by New_Copy_Tree, since there is no case of a recursive -- call from the processing inside New_Copy_Tree. ! NCT_Hash_Threshold : constant := 20; -- If there are more than this number of pairs of entries in the -- map, then Hash_Tables_Used will be set, and the hash tables will -- be initialized and used for the searches. *************** package body Sem_Util is *** 83,89 **** -- Set to True if hash tables are in use NCT_Table_Entries : Nat; ! -- Count entries in table to see if threshhold is reached NCT_Hash_Table_Setup : Boolean := False; -- Set to True if hash table contains data. We set this True if we --- 82,88 ---- -- Set to True if hash tables are in use NCT_Table_Entries : Nat; ! -- Count entries in table to see if threshold is reached NCT_Hash_Table_Setup : Boolean := False; -- Set to True if hash table contains data. We set this True if we *************** package body Sem_Util is *** 94,99 **** --- 93,122 ---- subtype NCT_Header_Num is Int range 0 .. 511; -- Defines range of headers in hash tables (512 headers) + ---------------------------------- + -- Order Dependence (AI05-0144) -- + ---------------------------------- + + -- Each actual in a call is entered into the table below. A flag indicates + -- whether the corresponding formal is OUT or IN OUT. Each top-level call + -- (procedure call, condition, assignment) examines all the actuals for a + -- possible order dependence. The table is reset after each such check. + -- The actuals to be checked in a call to Check_Order_Dependence are at + -- positions 1 .. Last. + + type Actual_Name is record + Act : Node_Id; + Is_Writable : Boolean; + end record; + + package Actuals_In_Call is new Table.Table ( + Table_Component_Type => Actual_Name, + Table_Index_Type => Int, + Table_Low_Bound => 0, + Table_Initial => 10, + Table_Increment => 100, + Table_Name => "Actuals"); + ----------------------- -- Local Subprograms -- ----------------------- *************** package body Sem_Util is *** 220,225 **** --- 243,270 ---- Analyze (N); end Add_Global_Declaration; + ----------------- + -- Addressable -- + ----------------- + + -- For now, just 8/16/32/64. but analyze later if AAMP is special??? + + function Addressable (V : Uint) return Boolean is + begin + return V = Uint_8 or else + V = Uint_16 or else + V = Uint_32 or else + V = Uint_64; + end Addressable; + + function Addressable (V : Int) return Boolean is + begin + return V = 8 or else + V = 16 or else + V = 32 or else + V = 64; + end Addressable; + ----------------------- -- Alignment_In_Bits -- ----------------------- *************** package body Sem_Util is *** 284,289 **** --- 329,358 ---- end if; end Apply_Compile_Time_Constraint_Error; + -------------------------------- + -- Bad_Predicated_Subtype_Use -- + -------------------------------- + + procedure Bad_Predicated_Subtype_Use + (Msg : String; + N : Node_Id; + Typ : Entity_Id) + is + begin + if Has_Predicates (Typ) then + if Is_Generic_Actual_Type (Typ) then + Error_Msg_FE (Msg & '?', N, Typ); + Error_Msg_F ("\Program_Error will be raised at run time?", N); + Insert_Action (N, + Make_Raise_Program_Error (Sloc (N), + Reason => PE_Bad_Predicated_Generic_Type)); + + else + Error_Msg_FE (Msg, N, Typ); + end if; + end if; + end Bad_Predicated_Subtype_Use; + -------------------------- -- Build_Actual_Subtype -- -------------------------- *************** package body Sem_Util is *** 398,406 **** end loop; end if; ! Subt := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); Set_Is_Internal (Subt); Decl := --- 467,473 ---- end loop; end if; ! Subt := Make_Temporary (Loc, 'S', Related_Node => N); Set_Is_Internal (Subt); Decl := *************** package body Sem_Util is *** 543,550 **** and then Is_Constrained (Root_Type (T))) and then not Has_Unknown_Discriminants (T) then ! -- If the type of the dereference is already constrained, it ! -- is an actual subtype. if Is_Array_Type (Etype (N)) and then Is_Constrained (Etype (N)) --- 610,617 ---- and then Is_Constrained (Root_Type (T))) and then not Has_Unknown_Discriminants (T) then ! -- If the type of the dereference is already constrained, it is an ! -- actual subtype. if Is_Array_Type (Etype (N)) and then Is_Constrained (Etype (N)) *************** package body Sem_Util is *** 624,632 **** return Empty; end if; ! Subt := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); Set_Is_Internal (Subt); Decl := --- 691,697 ---- return Empty; end if; ! Subt := Make_Temporary (Loc, 'S'); Set_Is_Internal (Subt); Decl := *************** package body Sem_Util is *** 666,675 **** end if; declare ! Act : constant Entity_Id := ! Make_Defining_Identifier (Loc, ! Chars => New_Internal_Name ('S')); ! Constraints : constant List_Id := New_List; Decl : Node_Id; --- 731,737 ---- end if; declare ! Act : constant Entity_Id := Make_Temporary (Loc, 'S'); Constraints : constant List_Id := New_List; Decl : Node_Id; *************** package body Sem_Util is *** 1151,1162 **** --- 1213,1284 ---- end if; end Check_Nested_Access; + ---------------------------- + -- Check_Order_Dependence -- + ---------------------------- + + procedure Check_Order_Dependence is + Act1 : Node_Id; + Act2 : Node_Id; + + begin + if Ada_Version < Ada_2012 then + return; + end if; + + -- Ada 2012 AI04-0144-2: Dangerous order dependence. Actuals in nested + -- calls within a construct have been collected. If one of them is + -- writable and overlaps with another one, evaluation of the enclosing + -- construct is nondeterministic. This is illegal in Ada 2012, but is + -- treated as a warning for now. + + for J in 1 .. Actuals_In_Call.Last loop + if Actuals_In_Call.Table (J).Is_Writable then + Act1 := Actuals_In_Call.Table (J).Act; + + if Nkind (Act1) = N_Attribute_Reference then + Act1 := Prefix (Act1); + end if; + + for K in 1 .. Actuals_In_Call.Last loop + if K /= J then + Act2 := Actuals_In_Call.Table (K).Act; + + if Nkind (Act2) = N_Attribute_Reference then + Act2 := Prefix (Act2); + end if; + + if Actuals_In_Call.Table (K).Is_Writable + and then K < J + then + -- Already checked + + null; + + elsif Denotes_Same_Object (Act1, Act2) + and then Parent (Act1) /= Parent (Act2) + then + Error_Msg_N + ("result may differ if evaluated " + & "after other actual in expression?", Act1); + end if; + end if; + end loop; + end if; + end loop; + + -- Remove checked actuals from table + + Actuals_In_Call.Set_Last (0); + end Check_Order_Dependence; + ------------------------------------------ -- Check_Potentially_Blocking_Operation -- ------------------------------------------ procedure Check_Potentially_Blocking_Operation (N : Node_Id) is S : Entity_Id; + begin -- N is one of the potentially blocking operations listed in 9.5.1(8). -- When pragma Detect_Blocking is active, the run time will raise *************** package body Sem_Util is *** 1173,1179 **** if Is_Protected_Type (S) then Error_Msg_N ("potentially blocking operation in protected operation?", N); - return; end if; --- 1295,1300 ---- *************** package body Sem_Util is *** 1499,1520 **** function Search_Tag (Iface : Entity_Id) return Entity_Id is ADT : Elmt_Id; - begin ! ADT := Next_Elmt (Next_Elmt (First_Elmt (Access_Disp_Table (T)))); while Present (ADT) ! and then Ekind (Node (ADT)) = E_Constant and then Related_Type (Node (ADT)) /= Iface loop ! -- Skip the secondary dispatch tables of Iface Next_Elmt (ADT); ! Next_Elmt (ADT); ! Next_Elmt (ADT); ! Next_Elmt (ADT); end loop; ! pragma Assert (Ekind (Node (ADT)) = E_Constant); return Node (ADT); end Search_Tag; --- 1620,1667 ---- function Search_Tag (Iface : Entity_Id) return Entity_Id is ADT : Elmt_Id; begin ! if not Is_CPP_Class (T) then ! ADT := Next_Elmt (Next_Elmt (First_Elmt (Access_Disp_Table (T)))); ! else ! ADT := Next_Elmt (First_Elmt (Access_Disp_Table (T))); ! end if; ! while Present (ADT) ! and then Is_Tag (Node (ADT)) and then Related_Type (Node (ADT)) /= Iface loop ! -- Skip secondary dispatch table referencing thunks to user ! -- defined primitives covered by this interface. + pragma Assert (Has_Suffix (Node (ADT), 'P')); Next_Elmt (ADT); ! ! -- Skip secondary dispatch tables of Ada types ! ! if not Is_CPP_Class (T) then ! ! -- Skip secondary dispatch table referencing thunks to ! -- predefined primitives. ! ! pragma Assert (Has_Suffix (Node (ADT), 'Y')); ! Next_Elmt (ADT); ! ! -- Skip secondary dispatch table referencing user-defined ! -- primitives covered by this interface. ! ! pragma Assert (Has_Suffix (Node (ADT), 'D')); ! Next_Elmt (ADT); ! ! -- Skip secondary dispatch table referencing predefined ! -- primitives. ! ! pragma Assert (Has_Suffix (Node (ADT), 'Z')); ! Next_Elmt (ADT); ! end if; end loop; ! pragma Assert (Is_Tag (Node (ADT))); return Node (ADT); end Search_Tag; *************** package body Sem_Util is *** 1566,1571 **** --- 1713,1756 ---- end loop; end Collect_Interfaces_Info; + --------------------- + -- Collect_Parents -- + --------------------- + + procedure Collect_Parents + (T : Entity_Id; + List : out Elist_Id; + Use_Full_View : Boolean := True) + is + Current_Typ : Entity_Id := T; + Parent_Typ : Entity_Id; + + begin + List := New_Elmt_List; + + -- No action if the if the type has no parents + + if T = Etype (T) then + return; + end if; + + loop + Parent_Typ := Etype (Current_Typ); + + if Is_Private_Type (Parent_Typ) + and then Present (Full_View (Parent_Typ)) + and then Use_Full_View + then + Parent_Typ := Full_View (Base_Type (Parent_Typ)); + end if; + + Append_Elmt (Parent_Typ, List); + + exit when Parent_Typ = Current_Typ; + Current_Typ := Parent_Typ; + end loop; + end Collect_Parents; + ---------------------------------- -- Collect_Primitive_Operations -- ---------------------------------- *************** package body Sem_Util is *** 1580,1585 **** --- 1765,1791 ---- Formal_Derived : Boolean := False; Id : Entity_Id; + function Match (E : Entity_Id) return Boolean; + -- True if E's base type is B_Type, or E is of an anonymous access type + -- and the base type of its designated type is B_Type. + + ----------- + -- Match -- + ----------- + + function Match (E : Entity_Id) return Boolean is + Etyp : Entity_Id := Etype (E); + + begin + if Ekind (Etyp) = E_Anonymous_Access_Type then + Etyp := Designated_Type (Etyp); + end if; + + return Base_Type (Etyp) = B_Type; + end Match; + + -- Start of processing for Collect_Primitive_Operations + begin -- For tagged types, the primitive operations are collected as they -- are declared, and held in an explicit list which is simply returned. *************** package body Sem_Util is *** 1648,1666 **** then Is_Prim := False; ! if Base_Type (Etype (Id)) = B_Type then Is_Prim := True; else Formal := First_Formal (Id); while Present (Formal) loop ! if Base_Type (Etype (Formal)) = B_Type then ! Is_Prim := True; ! exit; ! ! elsif Ekind (Etype (Formal)) = E_Anonymous_Access_Type ! and then Base_Type ! (Designated_Type (Etype (Formal))) = B_Type ! then Is_Prim := True; exit; end if; --- 1854,1866 ---- then Is_Prim := False; ! if Match (Id) then Is_Prim := True; + else Formal := First_Formal (Id); while Present (Formal) loop ! if Match (Formal) then Is_Prim := True; exit; end if; *************** package body Sem_Util is *** 1677,1694 **** and then (not Formal_Derived or else Present (Alias (Id))) then ! Append_Elmt (Id, Op_List); end if; end if; Next_Entity (Id); ! -- For a type declared in System, some of its operations ! -- may appear in the target-specific extension to System. if No (Id) ! and then Chars (B_Scope) = Name_System ! and then Scope (B_Scope) = Standard_Standard and then Present_System_Aux then B_Scope := System_Aux_Id; --- 1877,1916 ---- and then (not Formal_Derived or else Present (Alias (Id))) then ! -- In the special case of an equality operator aliased to ! -- an overriding dispatching equality belonging to the same ! -- type, we don't include it in the list of primitives. ! -- This avoids inheriting multiple equality operators when ! -- deriving from untagged private types whose full type is ! -- tagged, which can otherwise cause ambiguities. Note that ! -- this should only happen for this kind of untagged parent ! -- type, since normally dispatching operations are inherited ! -- using the type's Primitive_Operations list. ! ! if Chars (Id) = Name_Op_Eq ! and then Is_Dispatching_Operation (Id) ! and then Present (Alias (Id)) ! and then Present (Overridden_Operation (Alias (Id))) ! and then Base_Type (Etype (First_Entity (Id))) = ! Base_Type (Etype (First_Entity (Alias (Id)))) ! then ! null; ! ! -- Include the subprogram in the list of primitives ! ! else ! Append_Elmt (Id, Op_List); ! end if; end if; end if; Next_Entity (Id); ! -- For a type declared in System, some of its operations may ! -- appear in the target-specific extension to System. if No (Id) ! and then B_Scope = RTU_Entity (System) and then Present_System_Aux then B_Scope := System_Aux_Id; *************** package body Sem_Util is *** 2080,2088 **** -- so we can continue semantic analysis elsif Nam = Error then ! Err := ! Make_Defining_Identifier (Sloc (N), ! Chars => New_Internal_Name ('T')); Set_Defining_Unit_Name (N, Err); return Err; --- 2302,2308 ---- -- so we can continue semantic analysis elsif Nam = Error then ! Err := Make_Temporary (Sloc (N), 'T'); Set_Defining_Unit_Name (N, Err); return Err; *************** package body Sem_Util is *** 2142,2190 **** ------------------------- function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean is begin -- If we have entity names, then must be same entity ! if Is_Entity_Name (A1) then ! if Is_Entity_Name (A2) then ! return Entity (A1) = Entity (A2); else return False; end if; -- No match if not same node kind ! elsif Nkind (A1) /= Nkind (A2) then return False; -- For selected components, must have same prefix and selector ! elsif Nkind (A1) = N_Selected_Component then ! return Denotes_Same_Object (Prefix (A1), Prefix (A2)) and then ! Entity (Selector_Name (A1)) = Entity (Selector_Name (A2)); -- For explicit dereferences, prefixes must be same ! elsif Nkind (A1) = N_Explicit_Dereference then ! return Denotes_Same_Object (Prefix (A1), Prefix (A2)); -- For indexed components, prefixes and all subscripts must be the same ! elsif Nkind (A1) = N_Indexed_Component then ! if Denotes_Same_Object (Prefix (A1), Prefix (A2)) then declare Indx1 : Node_Id; Indx2 : Node_Id; begin ! Indx1 := First (Expressions (A1)); ! Indx2 := First (Expressions (A2)); while Present (Indx1) loop ! -- Shouldn't we be checking that values are the same??? ! if not Denotes_Same_Object (Indx1, Indx2) then return False; end if; --- 2362,2471 ---- ------------------------- function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean is + Obj1 : Node_Id := A1; + Obj2 : Node_Id := A2; + + procedure Check_Renaming (Obj : in out Node_Id); + -- If an object is a renaming, examine renamed object. If it is a + -- dereference of a variable, or an indexed expression with non-constant + -- indexes, no overlap check can be reported. + + -------------------- + -- Check_Renaming -- + -------------------- + + procedure Check_Renaming (Obj : in out Node_Id) is + begin + if Is_Entity_Name (Obj) + and then Present (Renamed_Entity (Entity (Obj))) + then + Obj := Renamed_Entity (Entity (Obj)); + if Nkind (Obj) = N_Explicit_Dereference + and then Is_Variable (Prefix (Obj)) + then + Obj := Empty; + + elsif Nkind (Obj) = N_Indexed_Component then + declare + Indx : Node_Id; + + begin + Indx := First (Expressions (Obj)); + while Present (Indx) loop + if not Is_OK_Static_Expression (Indx) then + Obj := Empty; + exit; + end if; + + Next_Index (Indx); + end loop; + end; + end if; + end if; + end Check_Renaming; + + -- Start of processing for Denotes_Same_Object + begin + Check_Renaming (Obj1); + Check_Renaming (Obj2); + + if No (Obj1) + or else No (Obj2) + then + return False; + end if; + -- If we have entity names, then must be same entity ! if Is_Entity_Name (Obj1) then ! if Is_Entity_Name (Obj2) then ! return Entity (Obj1) = Entity (Obj2); else return False; end if; -- No match if not same node kind ! elsif Nkind (Obj1) /= Nkind (Obj2) then return False; -- For selected components, must have same prefix and selector ! elsif Nkind (Obj1) = N_Selected_Component then ! return Denotes_Same_Object (Prefix (Obj1), Prefix (Obj2)) and then ! Entity (Selector_Name (Obj1)) = Entity (Selector_Name (Obj2)); -- For explicit dereferences, prefixes must be same ! elsif Nkind (Obj1) = N_Explicit_Dereference then ! return Denotes_Same_Object (Prefix (Obj1), Prefix (Obj2)); -- For indexed components, prefixes and all subscripts must be the same ! elsif Nkind (Obj1) = N_Indexed_Component then ! if Denotes_Same_Object (Prefix (Obj1), Prefix (Obj2)) then declare Indx1 : Node_Id; Indx2 : Node_Id; begin ! Indx1 := First (Expressions (Obj1)); ! Indx2 := First (Expressions (Obj2)); while Present (Indx1) loop ! -- Indexes must denote the same static value or same object ! if Is_OK_Static_Expression (Indx1) then ! if not Is_OK_Static_Expression (Indx2) then ! return False; ! ! elsif Expr_Value (Indx1) /= Expr_Value (Indx2) then ! return False; ! end if; ! ! elsif not Denotes_Same_Object (Indx1, Indx2) then return False; end if; *************** package body Sem_Util is *** 2200,2229 **** -- For slices, prefixes must match and bounds must match ! elsif Nkind (A1) = N_Slice ! and then Denotes_Same_Object (Prefix (A1), Prefix (A2)) then declare Lo1, Lo2, Hi1, Hi2 : Node_Id; begin ! Get_Index_Bounds (Etype (A1), Lo1, Hi1); ! Get_Index_Bounds (Etype (A2), Lo2, Hi2); -- Check whether bounds are statically identical. There is no -- attempt to detect partial overlap of slices. - -- What about an array and a slice of an array??? - return Denotes_Same_Object (Lo1, Lo2) and then Denotes_Same_Object (Hi1, Hi2); end; ! -- Literals will appear as indices. Isn't this where we should check -- Known_At_Compile_Time at least if we are generating warnings ??? ! elsif Nkind (A1) = N_Integer_Literal then ! return Intval (A1) = Intval (A2); else return False; --- 2481,2508 ---- -- For slices, prefixes must match and bounds must match ! elsif Nkind (Obj1) = N_Slice ! and then Denotes_Same_Object (Prefix (Obj1), Prefix (Obj2)) then declare Lo1, Lo2, Hi1, Hi2 : Node_Id; begin ! Get_Index_Bounds (Etype (Obj1), Lo1, Hi1); ! Get_Index_Bounds (Etype (Obj2), Lo2, Hi2); -- Check whether bounds are statically identical. There is no -- attempt to detect partial overlap of slices. return Denotes_Same_Object (Lo1, Lo2) and then Denotes_Same_Object (Hi1, Hi2); end; ! -- Literals will appear as indexes. Isn't this where we should check -- Known_At_Compile_Time at least if we are generating warnings ??? ! elsif Nkind (Obj1) = N_Integer_Literal then ! return Intval (Obj1) = Intval (Obj2); else return False; *************** package body Sem_Util is *** 2238,2244 **** begin if Is_Entity_Name (A1) then ! if Nkind_In (A2, N_Selected_Component, N_Indexed_Component) then return Denotes_Same_Object (A1, Prefix (A2)) or else Denotes_Same_Prefix (A1, Prefix (A2)); else --- 2517,2525 ---- begin if Is_Entity_Name (A1) then ! if Nkind_In (A2, N_Selected_Component, N_Indexed_Component) ! and then not Is_Access_Type (Etype (A1)) ! then return Denotes_Same_Object (A1, Prefix (A2)) or else Denotes_Same_Prefix (A1, Prefix (A2)); else *************** package body Sem_Util is *** 2412,2417 **** --- 2693,2720 ---- end if; end Designate_Same_Unit; + -------------------------- + -- Enclosing_CPP_Parent -- + -------------------------- + + function Enclosing_CPP_Parent (Typ : Entity_Id) return Entity_Id is + Parent_Typ : Entity_Id := Typ; + + begin + while not Is_CPP_Class (Parent_Typ) + and then Etype (Parent_Typ) /= Parent_Typ + loop + Parent_Typ := Etype (Parent_Typ); + + if Is_Private_Type (Parent_Typ) then + Parent_Typ := Full_View (Base_Type (Parent_Typ)); + end if; + end loop; + + pragma Assert (Is_CPP_Class (Parent_Typ)); + return Parent_Typ; + end Enclosing_CPP_Parent; + ---------------------------- -- Enclosing_Generic_Body -- ---------------------------- *************** package body Sem_Util is *** 2558,2564 **** elsif Ekind (Dynamic_Scope) = E_Task_Type then return Get_Task_Body_Procedure (Dynamic_Scope); ! elsif Convention (Dynamic_Scope) = Convention_Protected then return Protected_Body_Subprogram (Dynamic_Scope); else --- 2861,2878 ---- elsif Ekind (Dynamic_Scope) = E_Task_Type then return Get_Task_Body_Procedure (Dynamic_Scope); ! elsif Ekind (Dynamic_Scope) = E_Limited_Private_Type ! and then Present (Full_View (Dynamic_Scope)) ! and then Ekind (Full_View (Dynamic_Scope)) = E_Task_Type ! then ! return Get_Task_Body_Procedure (Full_View (Dynamic_Scope)); ! ! -- No body is generated if the protected operation is eliminated ! ! elsif Convention (Dynamic_Scope) = Convention_Protected ! and then not Is_Eliminated (Dynamic_Scope) ! and then Present (Protected_Body_Subprogram (Dynamic_Scope)) ! then return Protected_Body_Subprogram (Dynamic_Scope); else *************** package body Sem_Util is *** 2731,2739 **** 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 --- 3045,3053 ---- 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 *************** package body Sem_Util is *** 2741,2751 **** Set_Scope (Def_Id, Current_Scope); return; ! -- In the body or private part of an instance, a type extension ! -- may introduce a component with the same name as that of an ! -- actual. The legality rule is not enforced, but the semantics ! -- of the full type with two components of the same name are not ! -- clear at this point ??? elsif In_Instance_Not_Visible then null; --- 3055,3064 ---- Set_Scope (Def_Id, Current_Scope); return; ! -- In the body or private part of an instance, a type extension may ! -- introduce a component with the same name as that of an actual. The ! -- legality rule is not enforced, but the semantics of the full type ! -- with two components of same name are not clear at this point??? elsif In_Instance_Not_Visible then null; *************** package body Sem_Util is *** 2759,2767 **** then null; ! -- Conversely, with front-end inlining we may compile the parent ! -- body first, and a child unit subsequently. The context is now ! -- the parent spec, and body entities are not visible. elsif Is_Child_Unit (Def_Id) and then Is_Package_Body_Entity (E) --- 3072,3080 ---- then null; ! -- Conversely, with front-end inlining we may compile the parent body ! -- first, and a child unit subsequently. The context is now the ! -- parent spec, and body entities are not visible. elsif Is_Child_Unit (Def_Id) and then Is_Package_Body_Entity (E) *************** package body Sem_Util is *** 2775,2782 **** Error_Msg_Sloc := Sloc (E); -- If the previous declaration is an incomplete type declaration ! -- this may be an attempt to complete it with a private type. ! -- The following avoids confusing cascaded errors. if Nkind (Parent (E)) = N_Incomplete_Type_Declaration and then Nkind (Parent (Def_Id)) = N_Private_Type_Declaration --- 3088,3095 ---- Error_Msg_Sloc := Sloc (E); -- If the previous declaration is an incomplete type declaration ! -- this may be an attempt to complete it with a private type. The ! -- following avoids confusing cascaded errors. if Nkind (Parent (E)) = N_Incomplete_Type_Declaration and then Nkind (Parent (Def_Id)) = N_Private_Type_Declaration *************** package body Sem_Util is *** 2799,2807 **** Error_Msg_N ("& conflicts with declaration#", E); return; ! -- If the name of the unit appears in its own context clause, ! -- a dummy package with the name has already been created, and ! -- the error emitted. Try to continue quietly. elsif Error_Posted (E) and then Sloc (E) = No_Location --- 3112,3120 ---- Error_Msg_N ("& conflicts with declaration#", E); return; ! -- If the name of the unit appears in its own context clause, a ! -- dummy package with the name has already been created, and the ! -- error emitted. Try to continue quietly. elsif Error_Posted (E) and then Sloc (E) = No_Location *************** package body Sem_Util is *** 2817,2825 **** -- Avoid cascaded messages with duplicate components in -- derived types. ! if Ekind (E) = E_Component ! or else Ekind (E) = E_Discriminant ! then return; end if; end if; --- 3130,3136 ---- -- Avoid cascaded messages with duplicate components in -- derived types. ! if Ekind_In (E, E_Component, E_Discriminant) then return; end if; end if; *************** package body Sem_Util is *** 2832,2840 **** Error_Msg_N ("\generic units cannot be overloaded", Def_Id); end if; ! -- If entity is in standard, then we are in trouble, because ! -- it means that we have a library package with a duplicated ! -- name. That's hard to recover from, so abort! if S = Standard_Standard then raise Unrecoverable_Error; --- 3143,3151 ---- Error_Msg_N ("\generic units cannot be overloaded", Def_Id); end if; ! -- If entity is in standard, then we are in trouble, because it ! -- means that we have a library package with a duplicated name. ! -- That's hard to recover from, so abort! if S = Standard_Standard then raise Unrecoverable_Error; *************** package body Sem_Util is *** 2848,2866 **** end if; end if; ! -- If we fall through, declaration is OK , or OK enough to continue ! -- If Def_Id is a discriminant or a record component we are in the ! -- midst of inheriting components in a derived record definition. ! -- Preserve their Ekind and Etype. ! if Ekind (Def_Id) = E_Discriminant ! or else Ekind (Def_Id) = E_Component ! then null; ! -- If a type is already set, leave it alone (happens whey a type ! -- declaration is reanalyzed following a call to the optimizer) elsif Present (Etype (Def_Id)) then null; --- 3159,3175 ---- end if; end if; ! -- If we fall through, declaration is OK, at least OK enough to continue ! -- If Def_Id is a discriminant or a record component we are in the midst ! -- of inheriting components in a derived record definition. Preserve ! -- their Ekind and Etype. ! if Ekind_In (Def_Id, E_Discriminant, E_Component) then null; ! -- If a type is already set, leave it alone (happens when a type ! -- declaration is reanalyzed following a call to the optimizer). elsif Present (Etype (Def_Id)) then null; *************** package body Sem_Util is *** 2876,2883 **** -- Inherited discriminants and components in derived record types are -- immediately visible. Itypes are not. ! if Ekind (Def_Id) = E_Discriminant ! or else Ekind (Def_Id) = E_Component or else (No (Corresponding_Remote_Type (Def_Id)) and then not Is_Itype (Def_Id)) then --- 3185,3191 ---- -- Inherited discriminants and components in derived record types are -- immediately visible. Itypes are not. ! if Ekind_In (Def_Id, E_Discriminant, E_Component) or else (No (Corresponding_Remote_Type (Def_Id)) and then not Is_Itype (Def_Id)) then *************** package body Sem_Util is *** 2918,2925 **** and then In_Extended_Main_Source_Unit (Def_Id) ! -- Finally, the hidden entity must be either immediately visible ! -- or use visible (from a used package) and then (Is_Immediately_Visible (C) --- 3226,3233 ---- and then In_Extended_Main_Source_Unit (Def_Id) ! -- Finally, the hidden entity must be either immediately visible or ! -- use visible (i.e. from a used package). and then (Is_Immediately_Visible (C) *************** package body Sem_Util is *** 3048,3053 **** --- 3356,3393 ---- Call := Empty; end Find_Actual; + --------------------------- + -- Find_Body_Discriminal -- + --------------------------- + + function Find_Body_Discriminal + (Spec_Discriminant : Entity_Id) return Entity_Id + is + pragma Assert (Is_Concurrent_Record_Type (Scope (Spec_Discriminant))); + + Tsk : constant Entity_Id := + Corresponding_Concurrent_Type (Scope (Spec_Discriminant)); + Disc : Entity_Id; + + begin + -- Find discriminant of original concurrent type, and use its current + -- discriminal, which is the renaming within the task/protected body. + + Disc := First_Discriminant (Tsk); + while Present (Disc) loop + if Chars (Disc) = Chars (Spec_Discriminant) then + return Discriminal (Disc); + end if; + + Next_Discriminant (Disc); + end loop; + + -- That loop should always succeed in finding a matching entry and + -- returning. Fatal error if not. + + raise Program_Error; + end Find_Body_Discriminal; + ------------------------------------- -- Find_Corresponding_Discriminant -- ------------------------------------- *************** package body Sem_Util is *** 3301,3371 **** end if; end First_Actual; - ------------------------- - -- Full_Qualified_Name -- - ------------------------- - - function Full_Qualified_Name (E : Entity_Id) return String_Id is - Res : String_Id; - pragma Warnings (Off, Res); - - function Internal_Full_Qualified_Name (E : Entity_Id) return String_Id; - -- Compute recursively the qualified name without NUL at the end - - ---------------------------------- - -- Internal_Full_Qualified_Name -- - ---------------------------------- - - function Internal_Full_Qualified_Name (E : Entity_Id) return String_Id is - Ent : Entity_Id := E; - Parent_Name : String_Id := No_String; - - begin - -- Deals properly with child units - - if Nkind (Ent) = N_Defining_Program_Unit_Name then - Ent := Defining_Identifier (Ent); - end if; - - -- Compute qualification recursively (only "Standard" has no scope) - - if Present (Scope (Scope (Ent))) then - Parent_Name := Internal_Full_Qualified_Name (Scope (Ent)); - end if; - - -- Every entity should have a name except some expanded blocks - -- don't bother about those. - - if Chars (Ent) = No_Name then - return Parent_Name; - end if; - - -- Add a period between Name and qualification - - if Parent_Name /= No_String then - Start_String (Parent_Name); - Store_String_Char (Get_Char_Code ('.')); - - else - Start_String; - end if; - - -- Generates the entity name in upper case - - Get_Decoded_Name_String (Chars (Ent)); - Set_All_Upper_Case; - Store_String_Chars (Name_Buffer (1 .. Name_Len)); - return End_String; - end Internal_Full_Qualified_Name; - - -- Start of processing for Full_Qualified_Name - - begin - Res := Internal_Full_Qualified_Name (E); - Store_String_Char (Get_Char_Code (ASCII.NUL)); - return End_String; - end Full_Qualified_Name; - ----------------------- -- Gather_Components -- ----------------------- --- 3641,3646 ---- *************** package body Sem_Util is *** 4452,4466 **** (T : Entity_Id; Use_Full_View : Boolean := True) return Boolean is ! Typ : Entity_Id; begin -- Handle concurrent types ! if Is_Concurrent_Type (T) then ! Typ := Corresponding_Record_Type (T); ! else ! Typ := T; end if; if not Present (Typ) --- 4727,4739 ---- (T : Entity_Id; Use_Full_View : Boolean := True) return Boolean is ! Typ : Entity_Id := Base_Type (T); begin -- Handle concurrent types ! if Is_Concurrent_Type (Typ) then ! Typ := Corresponding_Record_Type (Typ); end if; if not Present (Typ) *************** package body Sem_Util is *** 4848,4885 **** -- We are interested only in components and discriminants ! if Ekind (Ent) = E_Component ! or else ! Ekind (Ent) = E_Discriminant ! 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 entities. For these cases, ! -- we just test the type of the entity. ! if Present (Declaration_Node (Ent)) then ! Exp := Expression (Declaration_Node (Ent)); ! else ! Exp := Empty; ! end if; ! -- A component has PI if it has no default expression and the ! -- component type has PI. ! if No (Exp) then ! if not Has_Preelaborable_Initialization (Etype (Ent)) then ! Has_PE := False; ! exit; end if; ! -- Require the default expression to be preelaborable ! elsif not Is_Preelaborable_Expression (Exp) then Has_PE := False; exit; end if; end if; Next_Entity (Ent); end loop; end Check_Components; --- 5121,5170 ---- -- We are interested only in components and discriminants ! Exp := Empty; ! case Ekind (Ent) is ! when E_Component => ! -- 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 entities. For such cases, ! -- we just test the type of the entity. ! if Present (Declaration_Node (Ent)) then ! Exp := Expression (Declaration_Node (Ent)); end if; ! when E_Discriminant => ! -- Note: for a renamed discriminant, the Declaration_Node ! -- may point to the one from the ancestor, and have a ! -- different expression, so use the proper attribute to ! -- retrieve the expression from the derived constraint. ! ! Exp := Discriminant_Default_Value (Ent); ! ! when others => ! goto Check_Next_Entity; ! end case; ! ! -- A component has PI if it has no default expression and the ! -- component type has PI. ! ! if No (Exp) then ! if not Has_Preelaborable_Initialization (Etype (Ent)) then Has_PE := False; exit; end if; + + -- Require the default expression to be preelaborable + + elsif not Is_Preelaborable_Expression (Exp) then + Has_PE := False; + exit; end if; + <> Next_Entity (Ent); end loop; end Check_Components; *************** package body Sem_Util is *** 5093,5098 **** --- 5378,5393 ---- end if; end Has_Stream; + ---------------- + -- Has_Suffix -- + ---------------- + + function Has_Suffix (E : Entity_Id; Suffix : Character) return Boolean is + begin + Get_Name_String (Chars (E)); + return Name_Buffer (Name_Len) = Suffix; + end Has_Suffix; + -------------------------- -- Has_Tagged_Component -- -------------------------- *************** package body Sem_Util is *** 5129,5134 **** --- 5424,5441 ---- end if; end Has_Tagged_Component; + ------------------------- + -- Implementation_Kind -- + ------------------------- + + function Implementation_Kind (Subp : Entity_Id) return Name_Id is + Impl_Prag : constant Node_Id := Get_Rep_Pragma (Subp, Name_Implemented); + begin + pragma Assert (Present (Impl_Prag)); + return + Chars (Expression (Last (Pragma_Argument_Associations (Impl_Prag)))); + end Implementation_Kind; + -------------------------- -- Implements_Interface -- -------------------------- *************** package body Sem_Util is *** 5406,5421 **** begin Save_Interps (N, New_Prefix); ! -- Check if the node relocation requires readjustment of some SCIL ! -- dispatching node. ! ! if Generate_SCIL ! and then Nkind (N) = N_Function_Call ! then ! Adjust_SCIL_Node (N, New_Prefix); ! end if; ! ! Rewrite (N, Make_Explicit_Dereference (Sloc (N), Prefix => New_Prefix)); Set_Etype (N, Designated_Type (Etype (New_Prefix))); --- 5713,5721 ---- begin Save_Interps (N, New_Prefix); ! Rewrite (N, ! Make_Explicit_Dereference (Sloc (Parent (N)), ! Prefix => New_Prefix)); Set_Etype (N, Designated_Type (Etype (New_Prefix))); *************** package body Sem_Util is *** 5446,5451 **** --- 5746,5752 ---- if Is_Entity_Name (New_Prefix) then Ent := Entity (New_Prefix); + Pref := New_Prefix; -- For a retrieval of a subcomponent of some composite object, -- retrieve the ultimate entity if there is one. *************** package body Sem_Util is *** 5467,5474 **** end if; end if; if Present (Ent) then ! Generate_Reference (Ent, New_Prefix); end if; end if; end Insert_Explicit_Dereference; --- 5768,5777 ---- end if; end if; + -- Place the reference on the entity node + if Present (Ent) then ! Generate_Reference (Ent, Pref); end if; end if; end Insert_Explicit_Dereference; *************** package body Sem_Util is *** 5494,5501 **** and then Comes_From_Source (Decl) ! -- The constant is not completed. A full object declaration ! -- or a pragma Import complete a deferred constant. and then not Has_Completion (Defining_Identifier (Decl)) then --- 5797,5804 ---- and then Comes_From_Source (Decl) ! -- The constant is not completed. A full object declaration or a ! -- pragma Import complete a deferred constant. and then not Has_Completion (Defining_Identifier (Decl)) then *************** package body Sem_Util is *** 5508,5525 **** end loop; end Inspect_Deferred_Constant_Completion; - ------------------- - -- Is_AAMP_Float -- - ------------------- - - function Is_AAMP_Float (E : Entity_Id) return Boolean is - pragma Assert (Is_Type (E)); - begin - return AAMP_On_Target - and then Is_Floating_Point_Type (E) - and then E = Base_Type (E); - end Is_AAMP_Float; - ----------------------------- -- Is_Actual_Out_Parameter -- ----------------------------- --- 5811,5816 ---- *************** package body Sem_Util is *** 5529,5536 **** Call : Node_Id; begin Find_Actual (N, Formal, Call); ! return Present (Formal) ! and then Ekind (Formal) = E_Out_Parameter; end Is_Actual_Out_Parameter; ------------------------- --- 5820,5826 ---- Call : Node_Id; begin Find_Actual (N, Formal, Call); ! return Present (Formal) and then Ekind (Formal) = E_Out_Parameter; end Is_Actual_Out_Parameter; ------------------------- *************** package body Sem_Util is *** 5700,5706 **** -- Start of processing for Is_Atomic_Object begin ! if Is_Atomic (Etype (N)) or else (Is_Entity_Name (N) and then Is_Atomic (Entity (N))) then return True; --- 5990,6001 ---- -- Start of processing for Is_Atomic_Object begin ! -- Predicate is not relevant to subprograms ! ! if Is_Entity_Name (N) and then Is_Overloadable (Entity (N)) then ! return False; ! ! elsif Is_Atomic (Etype (N)) or else (Is_Entity_Name (N) and then Is_Atomic (Entity (N))) then return True; *************** package body Sem_Util is *** 5797,5808 **** and then Is_Imported (Entity (Name (N))); end Is_CPP_Constructor_Call; ---------------------------------------------- -- Is_Dependent_Component_Of_Mutable_Object -- ---------------------------------------------- function Is_Dependent_Component_Of_Mutable_Object ! (Object : Node_Id) return Boolean is P : Node_Id; Prefix_Type : Entity_Id; --- 6092,6151 ---- and then Is_Imported (Entity (Name (N))); end Is_CPP_Constructor_Call; + ----------------- + -- Is_Delegate -- + ----------------- + + function Is_Delegate (T : Entity_Id) return Boolean is + Desig_Type : Entity_Id; + + begin + if VM_Target /= CLI_Target then + return False; + end if; + + -- Access-to-subprograms are delegates in CIL + + if Ekind (T) = E_Access_Subprogram_Type then + return True; + end if; + + if Ekind (T) not in Access_Kind then + + -- A delegate is a managed pointer. If no designated type is defined + -- it means that it's not a delegate. + + return False; + end if; + + Desig_Type := Etype (Directly_Designated_Type (T)); + + if not Is_Tagged_Type (Desig_Type) then + return False; + end if; + + -- Test if the type is inherited from [mscorlib]System.Delegate + + while Etype (Desig_Type) /= Desig_Type loop + if Chars (Scope (Desig_Type)) /= No_Name + and then Is_Imported (Scope (Desig_Type)) + and then Get_Name_String (Chars (Scope (Desig_Type))) = "delegate" + then + return True; + end if; + + Desig_Type := Etype (Desig_Type); + end loop; + + return False; + end Is_Delegate; + ---------------------------------------------- -- Is_Dependent_Component_Of_Mutable_Object -- ---------------------------------------------- function Is_Dependent_Component_Of_Mutable_Object ! (Object : Node_Id) return Boolean is P : Node_Id; Prefix_Type : Entity_Id; *************** package body Sem_Util is *** 5842,5851 **** P_Aliased := True; end if; ! -- A discriminant check on a selected component may be ! -- expanded into a dereference when removing side-effects. ! -- Recover the original node and its type, which may be ! -- unconstrained. elsif Nkind (P) = N_Explicit_Dereference and then not (Comes_From_Source (P)) --- 6185,6193 ---- P_Aliased := True; end if; ! -- A discriminant check on a selected component may be expanded ! -- into a dereference when removing side-effects. Recover the ! -- original node and its type, which may be unconstrained. elsif Nkind (P) = N_Explicit_Dereference and then not (Comes_From_Source (P)) *************** package body Sem_Util is *** 5854,5860 **** Prefix_Type := Etype (P); else ! -- Check for prefix being an aliased component ??? null; end if; --- 6196,6203 ---- Prefix_Type := Etype (P); else ! -- Check for prefix being an aliased component??? ! null; end if; *************** package body Sem_Util is *** 5870,5883 **** -- (despite the fact that 3.10.2(26/2) and 8.5.1(5/2) are -- semantic rules -- these rules are acknowledged to need fixing). ! if Ada_Version < Ada_05 then if Is_Access_Type (Prefix_Type) or else Nkind (P) = N_Explicit_Dereference then return False; end if; ! elsif Ada_Version >= Ada_05 then if Is_Access_Type (Prefix_Type) then -- If the access type is pool-specific, and there is no --- 6213,6226 ---- -- (despite the fact that 3.10.2(26/2) and 8.5.1(5/2) are -- semantic rules -- these rules are acknowledged to need fixing). ! if Ada_Version < Ada_2005 then if Is_Access_Type (Prefix_Type) or else Nkind (P) = N_Explicit_Dereference then return False; end if; ! elsif Ada_Version >= Ada_2005 then if Is_Access_Type (Prefix_Type) then -- If the access type is pool-specific, and there is no *************** package body Sem_Util is *** 5903,5910 **** Comp := Original_Record_Component (Entity (Selector_Name (Object))); ! -- As per AI-0017, the renaming is illegal in a generic body, ! -- even if the subtype is indefinite. -- Ada 2005 (AI-363): In Ada 2005 an aliased object can be mutable --- 6246,6253 ---- Comp := Original_Record_Component (Entity (Selector_Name (Object))); ! -- As per AI-0017, the renaming is illegal in a generic body, even ! -- if the subtype is indefinite. -- Ada 2005 (AI-363): In Ada 2005 an aliased object can be mutable *************** package body Sem_Util is *** 5917,5923 **** and then (Is_Declared_Within_Variant (Comp) or else Has_Discriminant_Dependent_Constraint (Comp)) ! and then (not P_Aliased or else Ada_Version >= Ada_05) then return True; --- 6260,6266 ---- and then (Is_Declared_Within_Variant (Comp) or else Has_Discriminant_Dependent_Constraint (Comp)) ! and then (not P_Aliased or else Ada_Version >= Ada_2005) then return True; *************** package body Sem_Util is *** 6353,6359 **** -- the corresponding procedure has been created, and which therefore do -- not have an assigned scope. ! if Ekind (E) in Formal_Kind then return False; end if; --- 6696,6702 ---- -- the corresponding procedure has been created, and which therefore do -- not have an assigned scope. ! if Is_Formal (E) then return False; end if; *************** package body Sem_Util is *** 6376,6385 **** Ent : constant Entity_Id := Entity (Expr); Sub : constant Entity_Id := Enclosing_Subprogram (Ent); begin ! if Ekind (Ent) /= E_Variable ! and then ! Ekind (Ent) /= E_In_Out_Parameter ! then return False; else return Present (Sub) and then Sub = Current_Subprogram; --- 6719,6725 ---- Ent : constant Entity_Id := Entity (Expr); Sub : constant Entity_Id := Enclosing_Subprogram (Ent); begin ! if not Ekind_In (Ent, E_Variable, E_In_Out_Parameter) then return False; else return Present (Sub) and then Sub = Current_Subprogram; *************** package body Sem_Util is *** 6532,6550 **** -- Is_Partially_Initialized_Type -- ----------------------------------- ! function Is_Partially_Initialized_Type (Typ : Entity_Id) return Boolean is begin if Is_Scalar_Type (Typ) then return False; elsif Is_Access_Type (Typ) then ! return True; elsif Is_Array_Type (Typ) then -- If component type is partially initialized, so is array type ! if Is_Partially_Initialized_Type (Component_Type (Typ)) then return True; -- Otherwise we are only partially initialized if we are fully --- 6872,6895 ---- -- Is_Partially_Initialized_Type -- ----------------------------------- ! function Is_Partially_Initialized_Type ! (Typ : Entity_Id; ! Include_Implicit : Boolean := True) return Boolean ! is begin if Is_Scalar_Type (Typ) then return False; elsif Is_Access_Type (Typ) then ! return Include_Implicit; elsif Is_Array_Type (Typ) then -- If component type is partially initialized, so is array type ! if Is_Partially_Initialized_Type ! (Component_Type (Typ), Include_Implicit) ! then return True; -- Otherwise we are only partially initialized if we are fully *************** package body Sem_Util is *** 6557,6565 **** elsif Is_Record_Type (Typ) then ! -- A discriminated type is always partially initialized ! if Has_Discriminants (Typ) then return True; -- A tagged type is always partially initialized --- 6902,6911 ---- elsif Is_Record_Type (Typ) then ! -- A discriminated type is always partially initialized if in ! -- all mode ! if Has_Discriminants (Typ) and then Include_Implicit then return True; -- A tagged type is always partially initialized *************** package body Sem_Util is *** 6597,6603 **** -- If a component is of a type which is itself partially -- initialized, then the enclosing record type is also. ! elsif Is_Partially_Initialized_Type (Etype (Ent)) then return True; end if; end if; --- 6943,6951 ---- -- If a component is of a type which is itself partially -- initialized, then the enclosing record type is also. ! elsif Is_Partially_Initialized_Type ! (Etype (Ent), Include_Implicit) ! then return True; end if; end if; *************** package body Sem_Util is *** 6636,6642 **** if No (U) then return True; else ! return Is_Partially_Initialized_Type (U); end if; end; --- 6984,6990 ---- if No (U) then return True; else ! return Is_Partially_Initialized_Type (U, Include_Implicit); end if; end; *************** package body Sem_Util is *** 6749,6755 **** -- because they denote entities that are not necessarily visible. -- Neither of them can apply to a protected type. ! return Ada_Version >= Ada_05 and then Is_Entity_Name (N) and then Present (Entity (N)) and then Is_Protected_Type (Entity (N)) --- 7097,7103 ---- -- because they denote entities that are not necessarily visible. -- Neither of them can apply to a protected type. ! return Ada_Version >= Ada_2005 and then Is_Entity_Name (N) and then Present (Entity (N)) and then Is_Protected_Type (Entity (N)) *************** package body Sem_Util is *** 7033,7038 **** --- 7381,7395 ---- return (U /= 0); end Is_True; + ------------------------------- + -- Is_Universal_Numeric_Type -- + ------------------------------- + + function Is_Universal_Numeric_Type (T : Entity_Id) return Boolean is + begin + return T = Universal_Integer or else T = Universal_Real; + end Is_Universal_Numeric_Type; + ------------------- -- Is_Value_Type -- ------------------- *************** package body Sem_Util is *** 7045,7097 **** and then Get_Name_String (Chars (T)) = "valuetype"; end Is_Value_Type; ! ----------------- ! -- Is_Delegate -- ! ----------------- ! ! function Is_Delegate (T : Entity_Id) return Boolean is ! Desig_Type : Entity_Id; begin ! if VM_Target /= CLI_Target then ! return False; ! end if; ! ! -- Access-to-subprograms are delegates in CIL ! ! if Ekind (T) = E_Access_Subprogram_Type then ! return True; ! end if; ! ! if Ekind (T) not in Access_Kind then ! ! -- A delegate is a managed pointer. If no designated type is defined ! -- it means that it's not a delegate. ! ! return False; ! end if; ! ! Desig_Type := Etype (Directly_Designated_Type (T)); ! ! if not Is_Tagged_Type (Desig_Type) then ! return False; ! end if; ! ! -- Test if the type is inherited from [mscorlib]System.Delegate ! ! while Etype (Desig_Type) /= Desig_Type loop ! if Chars (Scope (Desig_Type)) /= No_Name ! and then Is_Imported (Scope (Desig_Type)) ! and then Get_Name_String (Chars (Scope (Desig_Type))) = "delegate" ! then ! return True; ! end if; ! ! Desig_Type := Etype (Desig_Type); ! end loop; ! return False; ! end Is_Delegate; ----------------- -- Is_Variable -- --- 7402,7426 ---- and then Get_Name_String (Chars (T)) = "valuetype"; end Is_Value_Type; ! --------------------- ! -- Is_VMS_Operator -- ! --------------------- + function Is_VMS_Operator (Op : Entity_Id) return Boolean is begin ! -- The VMS operators are declared in a child of System that is loaded ! -- through pragma Extend_System. In some rare cases a program is run ! -- with this extension but without indicating that the target is VMS. ! return Ekind (Op) = E_Function ! and then Is_Intrinsic_Subprogram (Op) ! and then ! ((Present_System_Aux ! and then Scope (Op) = System_Aux_Id) ! or else ! (True_VMS_Target ! and then Scope (Scope (Op)) = RTU_Entity (System))); ! end Is_VMS_Operator; ----------------- -- Is_Variable -- *************** package body Sem_Util is *** 7107,7120 **** -- expansion. function In_Protected_Function (E : Entity_Id) return Boolean; ! -- Within a protected function, the private components of the ! -- enclosing protected type are constants. A function nested within ! -- a (protected) procedure is not itself protected. function Is_Variable_Prefix (P : Node_Id) return Boolean; ! -- Prefixes can involve implicit dereferences, in which case we ! -- must test for the case of a reference of a constant access ! -- type, which can never be a variable. --------------------------- -- In_Protected_Function -- --- 7436,7449 ---- -- expansion. function In_Protected_Function (E : Entity_Id) return Boolean; ! -- Within a protected function, the private components of the enclosing ! -- protected type are constants. A function nested within a (protected) ! -- procedure is not itself protected. function Is_Variable_Prefix (P : Node_Id) return Boolean; ! -- Prefixes can involve implicit dereferences, in which case we must ! -- test for the case of a reference of a constant access type, which can ! -- can never be a variable. --------------------------- -- In_Protected_Function -- *************** package body Sem_Util is *** 7130,7138 **** else S := Current_Scope; while Present (S) and then S /= Prot loop ! if Ekind (S) = E_Function ! and then Scope (S) = Prot ! then return True; end if; --- 7459,7465 ---- else S := Current_Scope; while Present (S) and then S /= Prot loop ! if Ekind (S) = E_Function and then Scope (S) = Prot then return True; end if; *************** package body Sem_Util is *** 7177,7192 **** if Nkind (N) in N_Subexpr and then Assignment_OK (N) then return True; ! -- Normally we go to the original node, but there is one exception ! -- where we use the rewritten node, namely when it is an explicit ! -- dereference. The generated code may rewrite a prefix which is an ! -- access type with an explicit dereference. The dereference is a ! -- variable, even though the original node may not be (since it could ! -- be a constant of the access type). ! -- In Ada 2005 we have a further case to consider: the prefix may be ! -- a function call given in prefix notation. The original node appears ! -- to be a selected component, but we need to examine the call. elsif Nkind (N) = N_Explicit_Dereference and then Nkind (Orig_Node) /= N_Explicit_Dereference --- 7504,7519 ---- if Nkind (N) in N_Subexpr and then Assignment_OK (N) then return True; ! -- Normally we go to the original node, but there is one exception where ! -- we use the rewritten node, namely when it is an explicit dereference. ! -- The generated code may rewrite a prefix which is an access type with ! -- an explicit dereference. The dereference is a variable, even though ! -- the original node may not be (since it could be a constant of the ! -- access type). ! -- In Ada 2005 we have a further case to consider: the prefix may be a ! -- function call given in prefix notation. The original node appears to ! -- be a selected component, but we need to examine the call. elsif Nkind (N) = N_Explicit_Dereference and then Nkind (Orig_Node) /= N_Explicit_Dereference *************** package body Sem_Util is *** 7679,7695 **** when N_Explicit_Dereference => return False; ! -- Function call arguments are never lvalues ! ! when N_Function_Call => ! return False; ! ! -- Positional parameter for procedure, entry, or accept call ! when N_Procedure_Call_Statement | N_Entry_Call_Statement | N_Accept_Statement => declare Proc : Entity_Id; Form : Entity_Id; --- 8006,8029 ---- when N_Explicit_Dereference => return False; ! -- Positional parameter for subprogram, entry, or accept call. ! -- In older versions of Ada function call arguments are never ! -- lvalues. In Ada 2012 functions can have in-out parameters. ! when N_Function_Call | ! N_Procedure_Call_Statement | N_Entry_Call_Statement | N_Accept_Statement => + if Nkind (P) = N_Function_Call + and then Ada_Version < Ada_2012 + then + return False; + end if; + + -- The following mechanism is clumsy and fragile. A single + -- flag set in Resolve_Actuals would be preferable ??? + declare Proc : Entity_Id; Form : Entity_Id; *************** package body Sem_Util is *** 7805,7810 **** --- 8139,8155 ---- if Nkind (N) = N_Allocator then if Is_Dynamic then Set_Is_Dynamic_Coextension (N); + + -- If the allocator expression is potentially dynamic, it may + -- be expanded out of order and require dynamic allocation + -- anyway, so we treat the coextension itself as dynamic. + -- Potential optimization ??? + + elsif Nkind (Expression (N)) = N_Qualified_Expression + and then Nkind (Expression (Expression (N))) = N_Op_Concat + then + Set_Is_Dynamic_Coextension (N); + else Set_Is_Static_Coextension (N); end if; *************** package body Sem_Util is *** 7844,7850 **** Formal : Entity_Id; begin ! if Ada_Version >= Ada_05 and then Present (First_Formal (E)) then Formal := Next_Formal (First_Formal (E)); --- 8189,8195 ---- Formal : Entity_Id; begin ! if Ada_Version >= Ada_2005 and then Present (First_Formal (E)) then Formal := Next_Formal (First_Formal (E)); *************** package body Sem_Util is *** 7903,7909 **** -- Itype references within the copied tree. -- The following hash tables are used if the Map supplied has more ! -- than hash threshhold entries to speed up access to the map. If -- there are fewer entries, then the map is searched sequentially -- (because setting up a hash table for only a few entries takes -- more time than it saves. --- 8248,8254 ---- -- Itype references within the copied tree. -- The following hash tables are used if the Map supplied has more ! -- than hash threshold entries to speed up access to the map. If -- there are fewer entries, then the map is searched sequentially -- (because setting up a hash table for only a few entries takes -- more time than it saves. *************** package body Sem_Util is *** 8639,8645 **** else NCT_Table_Entries := NCT_Table_Entries + 1; ! if NCT_Table_Entries > NCT_Hash_Threshhold then Build_NCT_Hash_Tables; end if; end if; --- 8984,8990 ---- else NCT_Table_Entries := NCT_Table_Entries + 1; ! if NCT_Table_Entries > NCT_Hash_Threshold then Build_NCT_Hash_Tables; end if; end if; *************** package body Sem_Util is *** 8647,8655 **** -- If a record subtype is simply copied, the entity list will be -- shared. Thus cloned_Subtype must be set to indicate the sharing. ! if Ekind (Old_Itype) = E_Record_Subtype ! or else Ekind (Old_Itype) = E_Class_Wide_Subtype ! then Set_Cloned_Subtype (New_Itype, Old_Itype); end if; --- 8992,8998 ---- -- If a record subtype is simply copied, the entity list will be -- shared. Thus cloned_Subtype must be set to indicate the sharing. ! if Ekind_In (Old_Itype, E_Record_Subtype, E_Class_Wide_Subtype) then Set_Cloned_Subtype (New_Itype, Old_Itype); end if; *************** package body Sem_Util is *** 8775,8781 **** Next_Elmt (Elmt); end loop; ! if NCT_Table_Entries > NCT_Hash_Threshhold then Build_NCT_Hash_Tables; else NCT_Hash_Tables_Used := False; --- 9118,9124 ---- Next_Elmt (Elmt); end loop; ! if NCT_Table_Entries > NCT_Hash_Threshold then Build_NCT_Hash_Tables; else NCT_Hash_Tables_Used := False; *************** package body Sem_Util is *** 8852,8859 **** Sloc_Value : Source_Ptr; Id_Char : Character) return Entity_Id is ! N : constant Entity_Id := ! Make_Defining_Identifier (Sloc_Value, New_Internal_Name (Id_Char)); begin Set_Ekind (N, Kind); --- 9195,9201 ---- Sloc_Value : Source_Ptr; Id_Char : Character) return Entity_Id is ! N : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char); begin Set_Ekind (N, Kind); *************** package body Sem_Util is *** 9273,9279 **** if Comes_From_Source (Exp) or else Modification_Comes_From_Source then ! if Has_Pragma_Unmodified (Ent) then Error_Msg_NE ("?pragma Unmodified given for &!", N, Ent); end if; --- 9615,9624 ---- if Comes_From_Source (Exp) or else Modification_Comes_From_Source then ! -- Give warning if pragma unmodified given and we are ! -- sure this is a modification. ! ! if Has_Pragma_Unmodified (Ent) and then Sure then Error_Msg_NE ("?pragma Unmodified given for &!", N, Ent); end if; *************** package body Sem_Util is *** 9303,9308 **** --- 9648,9676 ---- if Modification_Comes_From_Source then Generate_Reference (Ent, Exp, 'm'); + + -- If the target of the assignment is the bound variable + -- in an iterator, indicate that the corresponding array + -- or container is also modified. + + if Ada_Version >= Ada_2012 + and then + Nkind (Parent (Ent)) = N_Iterator_Specification + then + declare + Domain : constant Node_Id := Name (Parent (Ent)); + + begin + -- TBD : in the full version of the construct, the + -- domain of iteration can be given by an expression. + + if Is_Entity_Name (Domain) then + Generate_Reference (Entity (Domain), Exp, 'm'); + Set_Is_True_Constant (Entity (Domain), False); + Set_Never_Set_In_Source (Entity (Domain), False); + end if; + end; + end if; end if; Check_Nested_Access (Ent); *************** package body Sem_Util is *** 9468,9482 **** then return Object_Access_Level (Expression (Obj)); - -- Function results are objects, so we get either the access level of - -- the function or, in the case of an indirect call, the level of the - -- access-to-subprogram type. - elsif Nkind (Obj) = N_Function_Call then ! if Is_Entity_Name (Name (Obj)) then ! return Subprogram_Access_Level (Entity (Name (Obj))); else ! return Type_Access_Level (Etype (Prefix (Name (Obj)))); end if; -- For convenience we handle qualified expressions, even though --- 9836,9947 ---- then return Object_Access_Level (Expression (Obj)); elsif Nkind (Obj) = N_Function_Call then ! ! -- Function results are objects, so we get either the access level of ! -- the function or, in the case of an indirect call, the level of the ! -- access-to-subprogram type. (This code is used for Ada 95, but it ! -- looks wrong, because it seems that we should be checking the level ! -- of the call itself, even for Ada 95. However, using the Ada 2005 ! -- version of the code causes regressions in several tests that are ! -- compiled with -gnat95. ???) ! ! if Ada_Version < Ada_2005 then ! if Is_Entity_Name (Name (Obj)) then ! return Subprogram_Access_Level (Entity (Name (Obj))); ! else ! return Type_Access_Level (Etype (Prefix (Name (Obj)))); ! end if; ! ! -- For Ada 2005, the level of the result object of a function call is ! -- defined to be the level of the call's innermost enclosing master. ! -- We determine that by querying the depth of the innermost enclosing ! -- dynamic scope. ! else ! Return_Master_Scope_Depth_Of_Call : declare ! ! function Innermost_Master_Scope_Depth ! (N : Node_Id) return Uint; ! -- Returns the scope depth of the given node's innermost ! -- enclosing dynamic scope (effectively the accessibility ! -- level of the innermost enclosing master). ! ! ---------------------------------- ! -- Innermost_Master_Scope_Depth -- ! ---------------------------------- ! ! function Innermost_Master_Scope_Depth ! (N : Node_Id) return Uint ! is ! Node_Par : Node_Id := Parent (N); ! ! begin ! -- Locate the nearest enclosing node (by traversing Parents) ! -- that Defining_Entity can be applied to, and return the ! -- depth of that entity's nearest enclosing dynamic scope. ! ! while Present (Node_Par) loop ! case Nkind (Node_Par) is ! when N_Component_Declaration | ! N_Entry_Declaration | ! N_Formal_Object_Declaration | ! N_Formal_Type_Declaration | ! N_Full_Type_Declaration | ! N_Incomplete_Type_Declaration | ! N_Loop_Parameter_Specification | ! N_Object_Declaration | ! N_Protected_Type_Declaration | ! N_Private_Extension_Declaration | ! N_Private_Type_Declaration | ! N_Subtype_Declaration | ! N_Function_Specification | ! N_Procedure_Specification | ! N_Task_Type_Declaration | ! N_Body_Stub | ! N_Generic_Instantiation | ! N_Proper_Body | ! N_Implicit_Label_Declaration | ! N_Package_Declaration | ! N_Single_Task_Declaration | ! N_Subprogram_Declaration | ! N_Generic_Declaration | ! N_Renaming_Declaration | ! N_Block_Statement | ! N_Formal_Subprogram_Declaration | ! N_Abstract_Subprogram_Declaration | ! N_Entry_Body | ! N_Exception_Declaration | ! N_Formal_Package_Declaration | ! N_Number_Declaration | ! N_Package_Specification | ! N_Parameter_Specification | ! N_Single_Protected_Declaration | ! N_Subunit => ! ! return Scope_Depth ! (Nearest_Dynamic_Scope ! (Defining_Entity (Node_Par))); ! ! when others => ! null; ! end case; ! ! Node_Par := Parent (Node_Par); ! end loop; ! ! pragma Assert (False); ! ! -- Should never reach the following return ! ! return Scope_Depth (Current_Scope) + 1; ! end Innermost_Master_Scope_Depth; ! ! -- Start of processing for Return_Master_Scope_Depth_Of_Call ! ! begin ! return Innermost_Master_Scope_Depth (Obj); ! end Return_Master_Scope_Depth_Of_Call; end if; -- For convenience we handle qualified expressions, even though *************** package body Sem_Util is *** 9495,9500 **** --- 9960,9995 ---- end if; end Object_Access_Level; + -------------------------------------- + -- Original_Corresponding_Operation -- + -------------------------------------- + + function Original_Corresponding_Operation (S : Entity_Id) return Entity_Id + is + Typ : constant Entity_Id := Find_Dispatching_Type (S); + + begin + -- If S is an inherited primitive S2 the original corresponding + -- operation of S is the original corresponding operation of S2 + + if Present (Alias (S)) + and then Find_Dispatching_Type (Alias (S)) /= Typ + then + return Original_Corresponding_Operation (Alias (S)); + + -- If S overrides an inherited subprogram S2 the original corresponding + -- operation of S is the original corresponding operation of S2 + + elsif Present (Overridden_Operation (S)) then + return Original_Corresponding_Operation (Overridden_Operation (S)); + + -- otherwise it is S itself + + else + return S; + end if; + end Original_Corresponding_Operation; + ----------------------- -- Private_Component -- ----------------------- *************** package body Sem_Util is *** 9799,9843 **** Set_Sloc (Endl, Loc); end Process_End_Label; - ------------------ - -- Real_Convert -- - ------------------ - - -- We do the conversion to get the value of the real string by using - -- the scanner, see Sinput for details on use of the internal source - -- buffer for scanning internal strings. - - function Real_Convert (S : String) return Node_Id is - Save_Src : constant Source_Buffer_Ptr := Source; - Negative : Boolean; - - begin - Source := Internal_Source_Ptr; - Scan_Ptr := 1; - - for J in S'Range loop - Source (Source_Ptr (J)) := S (J); - end loop; - - Source (S'Length + 1) := EOF; - - if Source (Scan_Ptr) = '-' then - Negative := True; - Scan_Ptr := Scan_Ptr + 1; - else - Negative := False; - end if; - - Scan; - - if Negative then - Set_Realval (Token_Node, UR_Negate (Realval (Token_Node))); - end if; - - Source := Save_Src; - return Token_Node; - end Real_Convert; - ------------------------------------ -- References_Generic_Formal_Type -- ------------------------------------ --- 10294,10299 ---- *************** package body Sem_Util is *** 10140,10151 **** while R_Scope /= Standard_Standard loop exit when R_Scope = E_Scope; ! if Ekind (R_Scope) /= E_Package ! and then ! Ekind (R_Scope) /= E_Block ! and then ! Ekind (R_Scope) /= E_Loop ! then return False; else R_Scope := Scope (R_Scope); --- 10596,10602 ---- while R_Scope /= Standard_Standard loop exit when R_Scope = E_Scope; ! if not Ekind_In (R_Scope, E_Package, E_Block, E_Loop) then return False; else R_Scope := Scope (R_Scope); *************** package body Sem_Util is *** 10237,10256 **** begin -- First case, both are entities with same entity ! if K1 in N_Has_Entity ! and then K2 in N_Has_Entity ! and then Present (Entity (N1)) ! and then Present (Entity (N2)) ! and then (Ekind (Entity (N1)) = E_Variable ! or else ! Ekind (Entity (N1)) = E_Constant) ! and then Entity (N1) = Entity (N2) ! then ! return True; -- Second case, selected component with same selector, same record ! elsif K1 = N_Selected_Component and then K2 = N_Selected_Component and then Chars (Selector_Name (N1)) = Chars (Selector_Name (N2)) then --- 10688,10711 ---- begin -- First case, both are entities with same entity ! if K1 in N_Has_Entity and then K2 in N_Has_Entity then ! declare ! EN1 : constant Entity_Id := Entity (N1); ! EN2 : constant Entity_Id := Entity (N2); ! begin ! if Present (EN1) and then Present (EN2) ! and then (Ekind_In (EN1, E_Variable, E_Constant) ! or else Is_Formal (EN1)) ! and then EN1 = EN2 ! then ! return True; ! end if; ! end; ! end if; -- Second case, selected component with same selector, same record ! if K1 = N_Selected_Component and then K2 = N_Selected_Component and then Chars (Selector_Name (N1)) = Chars (Selector_Name (N2)) then *************** package body Sem_Util is *** 10341,10346 **** --- 10796,10830 ---- end if; end Same_Value; + ----------------- + -- Save_Actual -- + ----------------- + + procedure Save_Actual (N : Node_Id; Writable : Boolean := False) is + begin + if Ada_Version < Ada_2012 then + return; + + elsif Is_Entity_Name (N) + or else + Nkind_In (N, N_Indexed_Component, N_Selected_Component, N_Slice) + or else + (Nkind (N) = N_Attribute_Reference + and then Attribute_Name (N) = Name_Access) + + then + -- We are only interested in IN OUT parameters of inner calls + + if not Writable + or else Nkind (Parent (N)) = N_Function_Call + or else Nkind (Parent (N)) in N_Op + then + Actuals_In_Call.Increment_Last; + Actuals_In_Call.Table (Actuals_In_Call.Last) := (N, Writable); + end if; + end if; + end Save_Actual; + ------------------------ -- Scope_Is_Transient -- ------------------------ *************** package body Sem_Util is *** 10489,10494 **** --- 10973,10981 ---- end loop; end; + -- For a class wide subtype, we also need debug information + -- for the equivalent type. + if Ekind (T) = E_Class_Wide_Subtype then Set_Debug_Info_Needed_If_Not_Set (Equivalent_Type (T)); end if; *************** package body Sem_Util is *** 10964,10985 **** return Scope_Depth (Enclosing_Dynamic_Scope (Btyp)); end Type_Access_Level; - -------------------- - -- Ultimate_Alias -- - -------------------- - -- To do: add occurrences calling this new subprogram - - function Ultimate_Alias (Prim : Entity_Id) return Entity_Id is - E : Entity_Id := Prim; - - begin - while Present (Alias (E)) loop - E := Alias (E); - end loop; - - return E; - end Ultimate_Alias; - -------------------------- -- Unit_Declaration_Node -- -------------------------- --- 11451,11456 ---- *************** package body Sem_Util is *** 11080,11085 **** --- 11551,11597 ---- end if; end Unqualify; + ----------------------- + -- Visible_Ancestors -- + ----------------------- + + function Visible_Ancestors (Typ : Entity_Id) return Elist_Id is + List_1 : Elist_Id; + List_2 : Elist_Id; + Elmt : Elmt_Id; + + begin + pragma Assert (Is_Record_Type (Typ) + and then Is_Tagged_Type (Typ)); + + -- Collect all the parents and progenitors of Typ. If the full-view of + -- private parents and progenitors is available then it is used to + -- generate the list of visible ancestors; otherwise their partial + -- view is added to the resulting list. + + Collect_Parents + (T => Typ, + List => List_1, + Use_Full_View => True); + + Collect_Interfaces + (T => Typ, + Ifaces_List => List_2, + Exclude_Parents => True, + Use_Full_View => True); + + -- Join the two lists. Avoid duplications because an interface may + -- simultaneously be parent and progenitor of a type. + + Elmt := First_Elmt (List_2); + while Present (Elmt) loop + Append_Unique_Elmt (Node (Elmt), List_1); + Next_Elmt (Elmt); + end loop; + + return List_1; + end Visible_Ancestors; + ---------------------- -- Within_Init_Proc -- ---------------------- *************** package body Sem_Util is *** 11218,11225 **** and then Covers (Designated_Type (Expec_Type), Designated_Type (Found_Type)) then ! Error_Msg_N ("result must be general access type!", Expr); ! Error_Msg_NE ("add ALL to }!", Expr, Expec_Type); -- Another special check, if the expected type is an integer type, -- but the expression is of type System.Address, and the parent is --- 11730,11739 ---- and then Covers (Designated_Type (Expec_Type), Designated_Type (Found_Type)) then ! Error_Msg_N -- CODEFIX ! ("result must be general access type!", Expr); ! Error_Msg_NE -- CODEFIX ! ("add ALL to }!", Expr, Expec_Type); -- Another special check, if the expected type is an integer type, -- but the expression is of type System.Address, and the parent is *************** package body Sem_Util is *** 11266,11272 **** if From_With_Type (Found_Type) then Error_Msg_NE ("\\found incomplete}!", Expr, Found_Type); Error_Msg_Qual_Level := 99; ! Error_Msg_NE ("\\missing `WITH &;", Expr, Scope (Found_Type)); Error_Msg_Qual_Level := 0; else Error_Msg_NE ("found}!", Expr, Found_Type); --- 11780,11787 ---- if From_With_Type (Found_Type) then Error_Msg_NE ("\\found incomplete}!", Expr, Found_Type); Error_Msg_Qual_Level := 99; ! Error_Msg_NE -- CODEFIX ! ("\\missing `WITH &;", Expr, Scope (Found_Type)); Error_Msg_Qual_Level := 0; else Error_Msg_NE ("found}!", Expr, Found_Type); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_util.ads gcc-4.6.0/gcc/ada/sem_util.ads *** gcc-4.5.2/gcc/ada/sem_util.ads Mon Nov 30 16:31:31 2009 --- gcc-4.6.0/gcc/ada/sem_util.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sem_Util is *** 51,56 **** --- 51,62 ---- -- for the current unit. The declarations are added in the current scope, -- so the caller should push a new scope as required before the call. + function Addressable (V : Uint) return Boolean; + function Addressable (V : Int) return Boolean; + pragma Inline (Addressable); + -- Returns True if the value of V is the word size of an addressable + -- factor of the word size (typically 8, 16, 32 or 64). + function Alignment_In_Bits (E : Entity_Id) return Uint; -- If the alignment of the type or object E is currently known to the -- compiler, then this function returns the alignment value in bits. *************** package Sem_Util is *** 84,92 **** -- node that is built is normally Etype (N), but if the Typ parameter -- is present, this is used instead. Warn is normally False. If it is -- True then the message is treated as a warning even though it does ! -- not end with a ? (this is used when the caller wants to parametrize -- whether an error or warning is given. function Build_Actual_Subtype (T : Entity_Id; N : Node_Or_Entity_Id) return Node_Id; --- 90,113 ---- -- node that is built is normally Etype (N), but if the Typ parameter -- is present, this is used instead. Warn is normally False. If it is -- True then the message is treated as a warning even though it does ! -- not end with a ? (this is used when the caller wants to parameterize -- whether an error or warning is given. + procedure Bad_Predicated_Subtype_Use + (Msg : String; + N : Node_Id; + Typ : Entity_Id); + -- This is called when Typ, a predicated subtype, is used in a context + -- which does not allow the use of a predicated subtype. Msg is passed + -- to Error_Msg_FE to output an appropriate message using N as the + -- location, and Typ as the entity. The caller must set up any insertions + -- other than the & for the type itself. Note that if Typ is a generic + -- actual type, then the message will be output as a warning, and a + -- raise Program_Error is inserted using Insert_Action with node N as + -- the insertion point. Node N also supplies the source location for + -- construction of the raise node. If Typ is NOT a type with predicates + -- this call has no effect. + function Build_Actual_Subtype (T : Entity_Id; N : Node_Or_Entity_Id) return Node_Id; *************** package Sem_Util is *** 132,146 **** -- Check wrong use of dynamically tagged expression procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id); ! -- Verify that the full declaration of type T has been seen. If not, ! -- place error message on node N. Used in object declarations, type ! -- conversions, qualified expressions. procedure Check_Nested_Access (Ent : Entity_Id); -- Check whether Ent denotes an entity declared in an uplevel scope, which -- is accessed inside a nested procedure, and set Has_Up_Level_Access flag -- accordingly. This is currently only enabled for VM_Target /= No_VM. procedure Check_Potentially_Blocking_Operation (N : Node_Id); -- N is one of the statement forms that is a potentially blocking -- operation. If it appears within a protected action, emit warning. --- 153,172 ---- -- Check wrong use of dynamically tagged expression procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id); ! -- Verify that the full declaration of type T has been seen. If not, place ! -- error message on node N. Used in object declarations, type conversions ! -- and qualified expressions. procedure Check_Nested_Access (Ent : Entity_Id); -- Check whether Ent denotes an entity declared in an uplevel scope, which -- is accessed inside a nested procedure, and set Has_Up_Level_Access flag -- accordingly. This is currently only enabled for VM_Target /= No_VM. + procedure Check_Order_Dependence; + -- Examine the actuals in a top-level call to determine whether aliasing + -- between two actuals, one of which is writable, can make the call + -- order-dependent. + procedure Check_Potentially_Blocking_Operation (N : Node_Id); -- N is one of the statement forms that is a potentially blocking -- operation. If it appears within a protected action, emit warning. *************** package Sem_Util is *** 153,162 **** -- 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 ! -- with OpenVMS ports. The argument is the construct in question ! -- and is used to post the error message. procedure Collect_Interfaces (T : Entity_Id; --- 179,188 ---- -- 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 with OpenVMS ports. ! -- The argument is the construct in question and is used to post the error ! -- message. procedure Collect_Interfaces (T : Entity_Id; *************** package Sem_Util is *** 186,196 **** -- of elements, and elements at the same position on these tables provide -- information on the same interface type. function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id; ! -- Called upon type derivation and extension. We scan the declarative ! -- part in which the type appears, and collect subprograms that have ! -- one subsidiary subtype of the type. These subprograms can only ! -- appear after the type itself. function Compile_Time_Constraint_Error (N : Node_Id; --- 212,229 ---- -- of elements, and elements at the same position on these tables provide -- information on the same interface type. + procedure Collect_Parents + (T : Entity_Id; + List : out Elist_Id; + Use_Full_View : Boolean := True); + -- Collect all the parents of Typ. Use_Full_View is used to collect them + -- using the full-view of private parents (if available). + function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id; ! -- Called upon type derivation and extension. We scan the declarative part ! -- in which the type appears, and collect subprograms that have one ! -- subsidiary subtype of the type. These subprograms can only appear after ! -- the type itself. function Compile_Time_Constraint_Error (N : Node_Id; *************** package Sem_Util is *** 202,213 **** -- generates a warning (or error) message in the same manner, but it does -- not replace any nodes. For convenience, the function always returns its -- first argument. The message is a warning if the message ends with ?, or ! -- we are operating in Ada 83 mode, or if the Warn parameter is set to ! -- True. procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id); ! -- 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 --- 235,245 ---- -- generates a warning (or error) message in the same manner, but it does -- not replace any nodes. For convenience, the function always returns its -- first argument. The message is a warning if the message ends with ?, or ! -- we are operating in Ada 83 mode, or the Warn parameter is set to True. procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id); ! -- 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 *************** package Sem_Util is *** 216,221 **** --- 248,254 ---- -- for stubbed subprograms. function Current_Entity (N : Node_Id) return Entity_Id; + pragma Inline (Current_Entity); -- 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. *************** package Sem_Util is *** 235,255 **** -- from a library package which is not within any subprogram. function Defining_Entity (N : Node_Id) return Entity_Id; ! -- Given a declaration N, returns the associated defining entity. If ! -- the declaration has a specification, the entity is obtained from ! -- the specification. If the declaration has a defining unit name, ! -- then the defining entity is obtained from the defining unit name ! -- ignoring any child unit prefixes. function Denotes_Discriminant (N : Node_Id; Check_Concurrent : Boolean := False) return Boolean; ! -- Returns True if node N is an Entity_Name node for a discriminant. ! -- If the flag Check_Concurrent is true, function also returns true ! -- when N denotes the discriminal of the discriminant of a concurrent ! -- type. This is necessary to disable some optimizations on private ! -- components of protected types, and constraint checks on entry ! -- families constrained by discriminants. function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean; function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean; --- 268,287 ---- -- from a library package which is not within any subprogram. function Defining_Entity (N : Node_Id) return Entity_Id; ! -- Given a declaration N, returns the associated defining entity. If the ! -- declaration has a specification, the entity is obtained from the ! -- specification. If the declaration has a defining unit name, then the ! -- defining entity is obtained from the defining unit name ignoring any ! -- child unit prefixes. function Denotes_Discriminant (N : Node_Id; Check_Concurrent : Boolean := False) return Boolean; ! -- Returns True if node N is an Entity_Name node for a discriminant. If the ! -- flag Check_Concurrent is true, function also returns true when N denotes ! -- the discriminal of the discriminant of a concurrent type. This is needed ! -- to disable some optimizations on private components of protected types, ! -- and constraint checks on entry families constrained by discriminants. function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean; function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean; *************** package Sem_Util is *** 271,319 **** function Designate_Same_Unit (Name1 : Node_Id; Name2 : Node_Id) return Boolean; ! -- Return true if Name1 and Name2 designate the same unit name; ! -- each of these names is supposed to be a selected component name, ! -- an expanded name, a defining program unit name or an identifier function Enclosing_Generic_Body (N : Node_Id) return Node_Id; ! -- Returns the Node_Id associated with the innermost enclosing ! -- generic body, if any. If none, then returns Empty. function Enclosing_Generic_Unit (N : Node_Id) return Node_Id; ! -- Returns the Node_Id associated with the innermost enclosing ! -- generic unit, if any. If none, then returns Empty. function Enclosing_Lib_Unit_Entity return Entity_Id; -- Returns the entity of enclosing N_Compilation_Unit Node which is the ! -- root of the current scope (which must not be Standard_Standard, and ! -- the caller is responsible for ensuring this condition). function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id; ! -- Returns the enclosing N_Compilation_Unit Node that is the root ! -- of a subtree containing N. function Enclosing_Subprogram (E : Entity_Id) return Entity_Id; -- Utility function to return the Ada entity of the subprogram enclosing -- the entity E, if any. Returns Empty if no enclosing subprogram. procedure Ensure_Freeze_Node (E : Entity_Id); ! -- Make sure a freeze node is allocated for entity E. If necessary, ! -- build and initialize a new freeze node and set Has_Delayed_Freeze ! -- true for entity E. procedure Enter_Name (Def_Id : Entity_Id); -- Insert new name in symbol table of current scope with check for ! -- duplications (error message is issued if a conflict is found) ! -- Note: Enter_Name is not used for overloadable entities, instead ! -- these are entered using Sem_Ch6.Enter_Overloadable_Entity. procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id); ! -- This procedure is called after issuing a message complaining ! -- about an inappropriate use of limited type T. If useful, it ! -- adds additional continuation lines to the message explaining ! -- why type T is limited. Messages are placed at node N. procedure Find_Actual (N : Node_Id; --- 303,353 ---- function Designate_Same_Unit (Name1 : Node_Id; Name2 : Node_Id) return Boolean; ! -- Return true if Name1 and Name2 designate the same unit name; each of ! -- these names is supposed to be a selected component name, an expanded ! -- name, a defining program unit name or an identifier. ! ! function Enclosing_CPP_Parent (Typ : Entity_Id) return Entity_Id; ! -- Returns the closest ancestor of Typ that is a CPP type. function Enclosing_Generic_Body (N : Node_Id) return Node_Id; ! -- Returns the Node_Id associated with the innermost enclosing generic ! -- body, if any. If none, then returns Empty. function Enclosing_Generic_Unit (N : Node_Id) return Node_Id; ! -- Returns the Node_Id associated with the innermost enclosing generic ! -- unit, if any. If none, then returns Empty. function Enclosing_Lib_Unit_Entity return Entity_Id; -- Returns the entity of enclosing N_Compilation_Unit Node which is the ! -- root of the current scope (which must not be Standard_Standard, and the ! -- caller is responsible for ensuring this condition). function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id; ! -- Returns the enclosing N_Compilation_Unit Node that is the root of a ! -- subtree containing N. function Enclosing_Subprogram (E : Entity_Id) return Entity_Id; -- Utility function to return the Ada entity of the subprogram enclosing -- the entity E, if any. Returns Empty if no enclosing subprogram. procedure Ensure_Freeze_Node (E : Entity_Id); ! -- Make sure a freeze node is allocated for entity E. If necessary, build ! -- and initialize a new freeze node and set Has_Delayed_Freeze True for E. procedure Enter_Name (Def_Id : Entity_Id); -- Insert new name in symbol table of current scope with check for ! -- duplications (error message is issued if a conflict is found). ! -- Note: Enter_Name is not used for overloadable entities, instead these ! -- are entered using Sem_Ch6.Enter_Overloadable_Entity. procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id); ! -- This procedure is called after issuing a message complaining about an ! -- inappropriate use of limited type T. If useful, it adds additional ! -- continuation lines to the message explaining why type T is limited. ! -- Messages are placed at node N. procedure Find_Actual (N : Node_Id; *************** package Sem_Util is *** 329,339 **** function Find_Corresponding_Discriminant (Id : Node_Id; Typ : Entity_Id) return Entity_Id; ! -- Because discriminants may have different names in a generic unit ! -- and in an instance, they are resolved positionally when possible. ! -- A reference to a discriminant carries the discriminant that it ! -- denotes when analyzed. Subsequent uses of this id on a different ! -- type denote the discriminant at the same position in this new type. procedure Find_Overlaid_Entity (N : Node_Id; --- 363,373 ---- function Find_Corresponding_Discriminant (Id : Node_Id; Typ : Entity_Id) return Entity_Id; ! -- Because discriminants may have different names in a generic unit and in ! -- an instance, they are resolved positionally when possible. A reference ! -- to a discriminant carries the discriminant that it denotes when it is ! -- analyzed. Subsequent uses of this id on a different type denotes the ! -- discriminant at the same position in this new type. procedure Find_Overlaid_Entity (N : Node_Id; *************** package Sem_Util is *** 355,360 **** --- 389,400 ---- -- Determine the alternative chosen, so that the code of non-selected -- alternatives, and the warnings that may apply to them, are removed. + function Find_Body_Discriminal + (Spec_Discriminant : Entity_Id) return Entity_Id; + -- Given a discriminant of the record type that implements a task or + -- protected type, return the discriminal of the corresponding discriminant + -- of the actual concurrent type. + function First_Actual (Node : Node_Id) return Node_Id; -- Node is an N_Function_Call or N_Procedure_Call_Statement node. The -- result returned is the first actual parameter in declaration order *************** package Sem_Util is *** 364,377 **** -- iterating through the actuals in declaration order is to use this -- function to find the first actual, and then use Next_Actual to obtain -- the next actual in declaration order. Note that the value returned ! -- is always the expression (not the N_Parameter_Association nodes -- even if named association is used). - function Full_Qualified_Name (E : Entity_Id) return String_Id; - -- Generates the string literal corresponding to the E's full qualified - -- name in upper case. An ASCII.NUL is appended as the last character. - -- The names in the string are generated by Namet.Get_Decoded_Name_String. - procedure Gather_Components (Typ : Entity_Id; Comp_List : Node_Id; --- 404,412 ---- -- iterating through the actuals in declaration order is to use this -- function to find the first actual, and then use Next_Actual to obtain -- the next actual in declaration order. Note that the value returned ! -- is always the expression (not the N_Parameter_Association nodes, -- even if named association is used). procedure Gather_Components (Typ : Entity_Id; Comp_List : Node_Id; *************** package Sem_Util is *** 409,423 **** function Get_Actual_Subtype (N : Node_Id) return Entity_Id; -- Given a node for an expression, obtain the actual subtype of the -- expression. In the case of a parameter where the formal is an ! -- unconstrained array or discriminated type, this will be the ! -- previously constructed subtype of the actual. Note that this is ! -- not quite the "Actual Subtype" of the RM, since it is always ! -- a constrained type, i.e. it is the subtype of the value of the ! -- actual. The actual subtype is also returned in other cases where ! -- it has already been constructed for an object. Otherwise the ! -- expression type is returned unchanged, except for the case of an ! -- unconstrained array type, where an actual subtype is created, using ! -- Insert_Actions if necessary to insert any associated actions. function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id; -- This is like Get_Actual_Subtype, except that it never constructs an --- 444,458 ---- function Get_Actual_Subtype (N : Node_Id) return Entity_Id; -- Given a node for an expression, obtain the actual subtype of the -- expression. In the case of a parameter where the formal is an ! -- unconstrained array or discriminated type, this will be the previously ! -- constructed subtype of the actual. Note that this is not quite the ! -- "Actual Subtype" of the RM, since it is always a constrained type, i.e. ! -- it is the subtype of the value of the actual. The actual subtype is also ! -- returned in other cases where it has already been constructed for an ! -- object. Otherwise the expression type is returned unchanged, except for ! -- the case of an unconstrained array type, where an actual subtype is ! -- created, using Insert_Actions if necessary to insert any associated ! -- actions. function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id; -- This is like Get_Actual_Subtype, except that it never constructs an *************** package Sem_Util is *** 427,467 **** function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id; -- This is used to construct the string literal node representing a ! -- default external name, i.e. one that is constructed from the name ! -- of an entity, or (in the case of extended DEC import/export pragmas, ! -- an identifier provided as the external name. Letters in the name are -- according to the setting of Opt.External_Name_Default_Casing. function Get_Generic_Entity (N : Node_Id) return Entity_Id; ! -- Returns the true generic entity in an instantiation. If the name in ! -- the instantiation is a renaming, the function returns the renamed ! -- generic. procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id); ! -- This procedure assigns to L and H respectively the values of the ! -- low and high bounds of node N, which must be a range, subtype ! -- indication, or the name of a scalar subtype. The result in L, H ! -- may be set to Error if there was an earlier error in the range. function Get_Enum_Lit_From_Pos (T : Entity_Id; Pos : Uint; ! Loc : Source_Ptr) return Entity_Id; ! -- This function obtains the E_Enumeration_Literal entity for 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. procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id); -- Retrieve the fully expanded name of the library unit declared by -- Decl_Node into the name buffer. function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id; -- An entity value is associated with each name in the name table. The ! -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, ! -- which is the innermost visible entity with the given name. See the ! -- body of Sem_Ch8 for further details on handling of entity visibility. function Get_Pragma_Id (N : Node_Id) return Pragma_Id; pragma Inline (Get_Pragma_Id); --- 462,502 ---- function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id; -- This is used to construct the string literal node representing a ! -- default external name, i.e. one that is constructed from the name of an ! -- entity, or (in the case of extended DEC import/export pragmas, an ! -- identifier provided as the external name. Letters in the name are -- according to the setting of Opt.External_Name_Default_Casing. function Get_Generic_Entity (N : Node_Id) return Entity_Id; ! -- Returns the true generic entity in an instantiation. If the name in the ! -- instantiation is a renaming, the function returns the renamed generic. procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id); ! -- This procedure assigns to L and H respectively the values of the low and ! -- high bounds of node N, which must be a range, subtype indication, or the ! -- name of a scalar subtype. The result in L, H may be set to Error if ! -- there was an earlier error in the range. function Get_Enum_Lit_From_Pos (T : Entity_Id; Pos : Uint; ! Loc : Source_Ptr) return Node_Id; ! -- This function obtains the E_Enumeration_Literal entity for the specified ! -- value from the enumeration type or subtype T and returns an identifier ! -- node referencing this value. 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. procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id); -- Retrieve the fully expanded name of the library unit declared by -- Decl_Node into the name buffer. function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id; + pragma Inline (Get_Name_Entity_Id); -- An entity value is associated with each name in the name table. The ! -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, which ! -- is the innermost visible entity with the given name. See the body of ! -- Sem_Ch8 for further details on handling of entity visibility. function Get_Pragma_Id (N : Node_Id) return Pragma_Id; pragma Inline (Get_Pragma_Id); *************** package Sem_Util is *** 479,500 **** -- with any other kind of entity. function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id; ! -- Nod is either a procedure call statement, or a function call, or ! -- an accept statement node. This procedure finds the Entity_Id of the ! -- related subprogram or entry and returns it, or if no subprogram can ! -- be found, returns Empty. function Get_Subprogram_Body (E : Entity_Id) return Node_Id; ! -- Given the entity for a subprogram (E_Function or E_Procedure), ! -- return the corresponding N_Subprogram_Body node. If the corresponding ! -- body of the declaration is missing (as for an imported subprogram) ! -- return Empty. function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id; pragma Inline (Get_Task_Body_Procedure); -- Given an entity for a task type or subtype, retrieves the ! -- Task_Body_Procedure field from the corresponding task type ! -- 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 --- 514,533 ---- -- with any other kind of entity. function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id; ! -- Nod is either a procedure call statement, or a function call, or an ! -- accept statement node. This procedure finds the Entity_Id of the related ! -- subprogram or entry and returns it, or if no subprogram can be found, ! -- returns Empty. function Get_Subprogram_Body (E : Entity_Id) return Node_Id; ! -- Given the entity for a subprogram (E_Function or E_Procedure), return ! -- the corresponding N_Subprogram_Body node. If the corresponding body ! -- is missing (as for an imported subprogram), return Empty. function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id; pragma Inline (Get_Task_Body_Procedure); -- Given an entity for a task type or subtype, retrieves the ! -- Task_Body_Procedure field from the corresponding task type 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 *************** package Sem_Util is *** 524,541 **** -- -- Note: Known_Incompatible does not mean that at run time the alignment -- of Expr is known to be wrong for Obj, just that it can be determined ! -- that alignments have been explicitly or implicitly specified which ! -- are incompatible (whereas Unknown means that even this is not known). ! -- The appropriate reaction of a caller to Known_Incompatible is to treat ! -- it as Unknown, but issue a warning that there may be an alignment error. function Has_Declarations (N : Node_Id) return Boolean; -- Determines if the node can have declarations function Has_Discriminant_Dependent_Constraint (Comp : Entity_Id) return Boolean; ! -- Returns True if and only if Comp has a constrained subtype ! -- that depends on a discriminant. function Has_Infinities (E : Entity_Id) return Boolean; -- Determines if the range of the floating-point type E includes --- 557,574 ---- -- -- Note: Known_Incompatible does not mean that at run time the alignment -- of Expr is known to be wrong for Obj, just that it can be determined ! -- that alignments have been explicitly or implicitly specified which are ! -- incompatible (whereas Unknown means that even this is not known). The ! -- appropriate reaction of a caller to Known_Incompatible is to treat it as ! -- Unknown, but issue a warning that there may be an alignment error. function Has_Declarations (N : Node_Id) return Boolean; -- Determines if the node can have declarations function Has_Discriminant_Dependent_Constraint (Comp : Entity_Id) return Boolean; ! -- Returns True if and only if Comp has a constrained subtype that depends ! -- on a discriminant. function Has_Infinities (E : Entity_Id) return Boolean; -- Determines if the range of the floating-point type E includes *************** package Sem_Util is *** 565,589 **** -- yet received a full declaration. function Has_Stream (T : Entity_Id) return Boolean; ! -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or ! -- in the case of a composite type, has a component for which this ! -- predicate is True, and if so returns True. Otherwise a result of ! -- False means that there is no Stream type in sight. For a private ! -- type, the test is applied to the underlying type (or returns False ! -- if there is no underlying type). function Has_Tagged_Component (Typ : Entity_Id) return Boolean; -- 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 Implements_Interface (Typ_Ent : Entity_Id; Iface_Ent : Entity_Id; Exclude_Parents : Boolean := False) return Boolean; ! -- Returns true if the Typ implements interface Iface function In_Instance return Boolean; -- Returns True if the current scope is within a generic instance --- 598,630 ---- -- yet received a full declaration. function Has_Stream (T : Entity_Id) return Boolean; ! -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or in the ! -- case of a composite type, has a component for which this predicate is ! -- True, and if so returns True. Otherwise a result of False means that ! -- there is no Stream type in sight. For a private type, the test is ! -- applied to the underlying type (or returns False if there is no ! -- underlying type). ! ! function Has_Suffix (E : Entity_Id; Suffix : Character) return Boolean; ! -- Returns true if the last character of E is Suffix. Used in Assertions. function Has_Tagged_Component (Typ : Entity_Id) return Boolean; -- 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 Implementation_Kind (Subp : Entity_Id) return Name_Id; + -- Subp is a subprogram marked with pragma Implemented. Return the specific + -- implementation requirement which the pragma imposes. The return value is + -- either Name_By_Any, Name_By_Entry or Name_By_Protected_Procedure. + function Implements_Interface (Typ_Ent : Entity_Id; Iface_Ent : Entity_Id; Exclude_Parents : Boolean := False) return Boolean; ! -- Returns true if the Typ_Ent implements interface Iface_Ent function In_Instance return Boolean; -- Returns True if the current scope is within a generic instance *************** package Sem_Util is *** 607,617 **** -- Returns True if node N belongs to a parameter specification function In_Subprogram_Or_Concurrent_Unit return Boolean; ! -- Determines if the current scope is within a subprogram compilation ! -- unit (inside a subprogram declaration, subprogram body, or generic ! -- subprogram declaration) or within a task or protected body. The test ! -- is for appearing anywhere within such a construct (that is it does not ! -- need to be directly within). function In_Visible_Part (Scope_Id : Entity_Id) return Boolean; -- Determine whether a declaration occurs within the visible part of a --- 648,658 ---- -- Returns True if node N belongs to a parameter specification function In_Subprogram_Or_Concurrent_Unit return Boolean; ! -- Determines if the current scope is within a subprogram compilation unit ! -- (inside a subprogram declaration, subprogram body, or generic ! -- subprogram declaration) or within a task or protected body. The test is ! -- for appearing anywhere within such a construct (that is it does not need ! -- to be directly within). function In_Visible_Part (Scope_Id : Entity_Id) return Boolean; -- Determine whether a declaration occurs within the visible part of a *************** package Sem_Util is *** 628,641 **** -- whether they have been completed by a full constant declaration or an -- Import pragma. Emit the error message if that is not the case. - function Is_AAMP_Float (E : Entity_Id) return Boolean; - -- Defined for all type entities. Returns True only for the base type of - -- float types with AAMP format. The particular format is determined by the - -- Digits_Value value which is 6 for the 32-bit floating point type, or 9 - -- for the 48-bit type. This is not an attribute function (like VAX_Float) - -- in order to not use up an extra flag and to prevent the dependency of - -- Einfo on Targparm which would be required for a synthesized attribute. - function Is_Actual_Out_Parameter (N : Node_Id) return Boolean; -- Determines if N is an actual parameter of out mode in a subprogram call --- 669,674 ---- *************** package Sem_Util is *** 643,650 **** -- Determines if N is an actual parameter in a subprogram call function Is_Aliased_View (Obj : Node_Id) return Boolean; ! -- Determine if Obj is an aliased view, i.e. the name of an ! -- object to which 'Access or 'Unchecked_Access can apply. function Is_Ancestor_Package (E1 : Entity_Id; --- 676,683 ---- -- Determines if N is an actual parameter in a subprogram call function Is_Aliased_View (Obj : Node_Id) return Boolean; ! -- Determine if Obj is an aliased view, i.e. the name of an object to which ! -- 'Access or 'Unchecked_Access can apply. function Is_Ancestor_Package (E1 : Entity_Id; *************** package Sem_Util is *** 652,659 **** -- Determine whether package E1 is an ancestor of E2 function Is_Atomic_Object (N : Node_Id) return Boolean; ! -- Determines if the given node denotes an atomic object in the sense ! -- of the legality checks described in RM C.6(12). function Is_Coextension_Root (N : Node_Id) return Boolean; -- Determine whether node N is an allocator which acts as a coextension --- 685,692 ---- -- Determine whether package E1 is an ancestor of E2 function Is_Atomic_Object (N : Node_Id) return Boolean; ! -- Determines if the given node denotes an atomic object in the sense of ! -- the legality checks described in RM C.6(12). function Is_Coextension_Root (N : Node_Id) return Boolean; -- Determine whether node N is an allocator which acts as a coextension *************** package Sem_Util is *** 690,698 **** -- it is of protected, synchronized or task kind. function Is_False (U : Uint) return Boolean; ! -- The argument is a Uint value which is the Boolean'Pos value of a ! -- Boolean operand (i.e. is either 0 for False, or 1 for True). This ! -- function simply tests if it is False (i.e. zero) function Is_Fixed_Model_Number (U : Ureal; T : Entity_Id) return Boolean; -- Returns True iff the number U is a model number of the fixed- --- 723,732 ---- -- it is of protected, synchronized or task kind. function Is_False (U : Uint) return Boolean; ! pragma Inline (Is_False); ! -- The argument is a Uint value which is the Boolean'Pos value of a Boolean ! -- operand (i.e. is either 0 for False, or 1 for True). This function tests ! -- if it is False (i.e. zero). function Is_Fixed_Model_Number (U : Ureal; T : Entity_Id) return Boolean; -- Returns True iff the number U is a model number of the fixed- *************** package Sem_Util is *** 712,718 **** -- by a derived type declarations. function Is_LHS (N : Node_Id) return Boolean; ! -- Returns True iff N is used as Name in an assignment statement. function Is_Library_Level_Entity (E : Entity_Id) return Boolean; -- A library-level declaration is one that is accessible from Standard, --- 746,752 ---- -- by a derived type declarations. function Is_LHS (N : Node_Id) return Boolean; ! -- Returns True iff N is used as Name in an assignment statement function Is_Library_Level_Entity (E : Entity_Id) return Boolean; -- A library-level declaration is one that is accessible from Standard, *************** package Sem_Util is *** 728,745 **** -- variable and constant objects return True (compare Is_Variable). function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean; ! -- Used to test if AV is an acceptable formal for an OUT or IN OUT ! -- formal. Note that the Is_Variable function is not quite the right ! -- test because this is a case in which conversions whose expression ! -- is a variable (in the Is_Variable sense) with a non-tagged type ! -- target are considered view conversions and hence variables. ! function Is_Partially_Initialized_Type (Typ : Entity_Id) return Boolean; -- Typ is a type entity. This function returns true if this type is partly -- initialized, meaning that an object of the type is at least partly -- initialized (in particular in the record case, that at least one -- component has an initialization expression). Note that initialization -- resulting from the use of pragma Normalized_Scalars does not count. function Is_Potentially_Persistent_Type (T : Entity_Id) return Boolean; -- Determines if type T is a potentially persistent type. A potentially --- 762,788 ---- -- variable and constant objects return True (compare Is_Variable). function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean; ! -- Used to test if AV is an acceptable formal for an OUT or IN OUT formal. ! -- Note that the Is_Variable function is not quite the right test because ! -- this is a case in which conversions whose expression is a variable (in ! -- the Is_Variable sense) with a non-tagged type target are considered view ! -- conversions and hence variables. ! function Is_Partially_Initialized_Type ! (Typ : Entity_Id; ! Include_Implicit : Boolean := True) return Boolean; -- Typ is a type entity. This function returns true if this type is partly -- initialized, meaning that an object of the type is at least partly -- initialized (in particular in the record case, that at least one -- component has an initialization expression). Note that initialization -- resulting from the use of pragma Normalized_Scalars does not count. + -- Include_Implicit controls whether implicit initialization of access + -- values to null, and of discriminant values, is counted as making the + -- type be partially initialized. For the default setting of True, these + -- implicit cases do count, and discriminated types or types containing + -- access values not explicitly initialized will return True. Otherwise + -- if Include_Implicit is False, these cases do not count as making the + -- type be partially initialized. function Is_Potentially_Persistent_Type (T : Entity_Id) return Boolean; -- Determines if type T is a potentially persistent type. A potentially *************** package Sem_Util is *** 776,781 **** --- 819,825 ---- -- normally such nodes represent a direct name. function Is_Statement (N : Node_Id) return Boolean; + pragma Inline (Is_Statement); -- Check if the node N is a statement node. Note that this includes -- the case of procedure call statements (unlike the direct use of -- the N_Statement_Other_Than_Procedure_Call subtype from Sinfo). *************** package Sem_Util is *** 785,798 **** -- Returns True if E is a synchronized tagged type (AARM 3.9.4 (6/2)) function Is_Transfer (N : Node_Id) return Boolean; ! -- Returns True if the node N is a statement which is known to cause ! -- an unconditional transfer of control at runtime, i.e. the following -- statement definitely will not be executed. function Is_True (U : Uint) return Boolean; ! -- The argument is a Uint value which is the Boolean'Pos value of a ! -- Boolean operand (i.e. is either 0 for False, or 1 for True). This ! -- function simply tests if it is True (i.e. non-zero) function Is_Value_Type (T : Entity_Id) return Boolean; -- Returns true if type T represents a value type. This is only relevant to --- 829,847 ---- -- Returns True if E is a synchronized tagged type (AARM 3.9.4 (6/2)) function Is_Transfer (N : Node_Id) return Boolean; ! -- Returns True if the node N is a statement which is known to cause an ! -- unconditional transfer of control at runtime, i.e. the following -- statement definitely will not be executed. function Is_True (U : Uint) return Boolean; ! pragma Inline (Is_True); ! -- The argument is a Uint value which is the Boolean'Pos value of a Boolean ! -- operand (i.e. is either 0 for False, or 1 for True). This function tests ! -- if it is True (i.e. non-zero). ! ! function Is_Universal_Numeric_Type (T : Entity_Id) return Boolean; ! pragma Inline (Is_Universal_Numeric_Type); ! -- True if T is Universal_Integer or Universal_Real function Is_Value_Type (T : Entity_Id) return Boolean; -- Returns true if type T represents a value type. This is only relevant to *************** package Sem_Util is *** 800,805 **** --- 849,858 ---- -- object that is accessed directly, as opposed to the other CIL objects -- that are accessed through managed pointers. + function Is_VMS_Operator (Op : Entity_Id) return Boolean; + -- Determine whether an operator is one of the intrinsics defined + -- in the DEC system extension. + function Is_Delegate (T : Entity_Id) return Boolean; -- Returns true if type T represents a delegate. A Delegate is the CIL -- object used to represent access-to-subprogram types. This is only *************** package Sem_Util is *** 990,996 **** procedure Next_Actual (Actual_Id : in out Node_Id); pragma Inline (Next_Actual); ! -- Next_Actual (N) is equivalent to N := Next_Actual (N) function Next_Actual (Actual_Id : Node_Id) return Node_Id; -- Find next actual parameter in declaration order. As described for --- 1043,1050 ---- procedure Next_Actual (Actual_Id : in out Node_Id); pragma Inline (Next_Actual); ! -- Next_Actual (N) is equivalent to N := Next_Actual (N). Note that we ! -- inline this procedural form, but not the functional form that follows. function Next_Actual (Actual_Id : Node_Id) return Node_Id; -- Find next actual parameter in declaration order. As described for *************** package Sem_Util is *** 1022,1027 **** --- 1076,1087 ---- -- (e.g. target of assignment, or out parameter), and to False if the -- modification is only potential (e.g. address of entity taken). + function Original_Corresponding_Operation (S : Entity_Id) return Entity_Id; + -- [Ada 2012: AI05-0125-1]: If S is an inherited dispatching primitive S2, + -- or overrides an inherited dispatching primitive S2, the original + -- corresponding operation of S is the original corresponding operation of + -- S2. Otherwise, it is S itself. + function Object_Access_Level (Obj : Node_Id) return Uint; -- Return the accessibility level of the view of the object Obj. -- For convenience, qualified expressions applied to object names *************** package Sem_Util is *** 1053,1062 **** -- parameter Ent gives the entity to which the End_Label refers, -- and to which cross-references are to be generated. - function Real_Convert (S : String) return Node_Id; - -- S is a possibly signed syntactically valid real literal. The result - -- returned is an N_Real_Literal node representing the literal value. - function References_Generic_Formal_Type (N : Node_Id) return Boolean; -- Returns True if the expression Expr contains any references to a -- generic type. This can only happen within a generic template. --- 1113,1118 ---- *************** package Sem_Util is *** 1148,1153 **** --- 1204,1214 ---- -- are only partially ordered, so Scope_Within_Or_Same (A,B) and -- Scope_Within_Or_Same (B,A) can both be False for a given pair A,B. + procedure Save_Actual (N : Node_Id; Writable : Boolean := False); + -- Enter an actual in a call in a table global, for subsequent check of + -- possible order dependence in the presence of IN OUT parameters for + -- functions in Ada 2012 (or access parameters in older language versions). + function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean; -- Like Scope_Within_Or_Same, except that this function returns -- False in the case where Scope1 and Scope2 are the same scope. *************** package Sem_Util is *** 1158,1163 **** --- 1219,1225 ---- -- foreign convention, then we set Can_Use_Internal_Rep to False on E. procedure Set_Current_Entity (E : Entity_Id); + pragma Inline (Set_Current_Entity); -- Establish the entity E as the currently visible definition of its -- associated name (i.e. the Node_Id associated with its name) *************** package Sem_Util is *** 1175,1180 **** --- 1237,1243 ---- -- can check identifier spelling style. procedure Set_Name_Entity_Id (Id : Name_Id; Val : Entity_Id); + pragma Inline (Set_Name_Entity_Id); -- Sets the Entity_Id value associated with the given name, which is the -- Id of the innermost visible entity with the given name. See the body -- of package Sem_Ch8 for further details on the handling of visibility. *************** package Sem_Util is *** 1205,1210 **** --- 1268,1274 ---- -- Set the flag Is_Transient of the current scope procedure Set_Size_Info (T1, T2 : Entity_Id); + pragma Inline (Set_Size_Info); -- Copies the Esize field and Has_Biased_Representation flag from sub(type) -- entity T2 to (sub)type entity T1. Also copies the Is_Unsigned_Type flag -- in the fixed-point and discrete cases, and also copies the alignment *************** package Sem_Util is *** 1237,1246 **** function Type_Access_Level (Typ : Entity_Id) return Uint; -- Return the accessibility level of Typ - function Ultimate_Alias (Prim : Entity_Id) return Entity_Id; - -- Return the last entity in the chain of aliased entities of Prim. - -- If Prim has no alias return Prim. - function Unit_Declaration_Node (Unit_Id : Entity_Id) return Node_Id; -- Unit_Id is the simple name of a program unit, this function returns the -- corresponding xxx_Declaration node for the entity. Also applies to the --- 1301,1306 ---- *************** package Sem_Util is *** 1249,1279 **** -- may be a child unit with any number of ancestors. function Universal_Interpretation (Opnd : Node_Id) return Entity_Id; ! -- Yields universal_Integer or Universal_Real if this is a candidate function Unqualify (Expr : Node_Id) return Node_Id; ! -- Removes any qualifications from Expr. For example, for T1'(T2'(X)), ! -- this returns X. If Expr is not a qualified expression, returns Expr. function Within_Init_Proc return Boolean; -- Determines if Current_Scope is within an init proc procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id); ! -- Output error message for incorrectly typed expression. Expr is the ! -- node for the incorrectly typed construct (Etype (Expr) is the type ! -- found), and Expected_Type is the entity for the expected type. Note ! -- that Expr does not have to be a subexpression, anything with an ! -- Etype field may be used. ! ! private ! pragma Inline (Current_Entity); ! pragma Inline (Get_Name_Entity_Id); ! pragma Inline (Is_False); ! pragma Inline (Is_Statement); ! pragma Inline (Is_True); ! pragma Inline (Set_Current_Entity); ! pragma Inline (Set_Name_Entity_Id); ! pragma Inline (Set_Size_Info); ! pragma Inline (Unqualify); end Sem_Util; --- 1309,1336 ---- -- may be a child unit with any number of ancestors. function Universal_Interpretation (Opnd : Node_Id) return Entity_Id; ! -- Yields Universal_Integer or Universal_Real if this is a candidate function Unqualify (Expr : Node_Id) return Node_Id; ! pragma Inline (Unqualify); ! -- Removes any qualifications from Expr. For example, for T1'(T2'(X)), this ! -- returns X. If Expr is not a qualified expression, returns Expr. ! ! function Visible_Ancestors (Typ : Entity_Id) return Elist_Id; ! -- [Ada 2012:AI-0125-1]: Collect all the visible parents and progenitors ! -- of a type extension or private extension declaration. If the full-view ! -- of private parents and progenitors is available then it is used to ! -- generate the list of visible ancestors; otherwise their partial ! -- view is added to the resulting list. function Within_Init_Proc return Boolean; -- Determines if Current_Scope is within an init proc procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id); ! -- Output error message for incorrectly typed expression. Expr is the node ! -- for the incorrectly typed construct (Etype (Expr) is the type found), ! -- and Expected_Type is the entity for the expected type. Note that Expr ! -- does not have to be a subexpression, anything with an Etype field may ! -- be used. end Sem_Util; diff -Nrcpad gcc-4.5.2/gcc/ada/sem_vfpt.adb gcc-4.6.0/gcc/ada/sem_vfpt.adb *** gcc-4.5.2/gcc/ada/sem_vfpt.adb Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/sem_vfpt.adb Fri Oct 22 10:19:58 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1997-2010, 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- -- *************** with Einfo; use Einfo; *** 28,34 **** with Opt; use Opt; with Stand; use Stand; with Targparm; use Targparm; - with Ttypef; use Ttypef; package body Sem_VFpt is --- 28,33 ---- *************** package body Sem_VFpt is *** 37,47 **** ----------------- procedure Set_D_Float (E : Entity_Id) is begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXDF_Digits); ! Set_Vax_Float (Base_Type (E), True); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); --- 36,48 ---- ----------------- procedure Set_D_Float (E : Entity_Id) is + VAXDF_Digits : constant := 9; + begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXDF_Digits); ! Set_Float_Rep (Base_Type (E), VAX_Native); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); *************** package body Sem_VFpt is *** 55,65 **** ----------------- procedure Set_F_Float (E : Entity_Id) is begin Init_Size (Base_Type (E), 32); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXFF_Digits); ! Set_Vax_Float (Base_Type (E), True); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 32); --- 56,68 ---- ----------------- procedure Set_F_Float (E : Entity_Id) is + VAXFF_Digits : constant := 6; + begin Init_Size (Base_Type (E), 32); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXFF_Digits); ! Set_Float_Rep (Base_Type (E), VAX_Native); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 32); *************** package body Sem_VFpt is *** 73,83 **** ----------------- procedure Set_G_Float (E : Entity_Id) is begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXGF_Digits); ! Set_Vax_Float (Base_Type (E), True); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); --- 76,88 ---- ----------------- procedure Set_G_Float (E : Entity_Id) is + VAXGF_Digits : constant := 15; + begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXGF_Digits); ! Set_Float_Rep (Base_Type (E), VAX_Native); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); *************** package body Sem_VFpt is *** 91,101 **** ------------------- procedure Set_IEEE_Long (E : Entity_Id) is begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), IEEEL_Digits); ! Set_Vax_Float (Base_Type (E), False); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); --- 96,108 ---- ------------------- procedure Set_IEEE_Long (E : Entity_Id) is + IEEEL_Digits : constant := 15; + begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), IEEEL_Digits); ! Set_Float_Rep (Base_Type (E), IEEE_Binary); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); *************** package body Sem_VFpt is *** 109,119 **** -------------------- procedure Set_IEEE_Short (E : Entity_Id) is begin Init_Size (Base_Type (E), 32); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), IEEES_Digits); ! Set_Vax_Float (Base_Type (E), False); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 32); --- 116,128 ---- -------------------- procedure Set_IEEE_Short (E : Entity_Id) is + IEEES_Digits : constant := 6; + begin Init_Size (Base_Type (E), 32); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), IEEES_Digits); ! Set_Float_Rep (Base_Type (E), IEEE_Binary); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 32); diff -Nrcpad gcc-4.5.2/gcc/ada/sem_warn.adb gcc-4.6.0/gcc/ada/sem_warn.adb *** gcc-4.5.2/gcc/ada/sem_warn.adb Mon Nov 30 16:08:37 2009 --- gcc-4.6.0/gcc/ada/sem_warn.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1999-2010, 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- -- *************** package body Sem_Warn is *** 234,243 **** -- within the body of the loop. procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id) is ! Iter : constant Node_Id := Iteration_Scheme (Loop_Statement); Ref : Node_Id := Empty; ! -- Reference in iteration scheme to variable that might not be modified -- in loop, indicating a possible infinite loop. Var : Entity_Id := Empty; --- 234,244 ---- -- within the body of the loop. procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id) is ! Expression : Node_Id := Empty; ! -- Set to WHILE or EXIT WHEN condition to be tested Ref : Node_Id := Empty; ! -- Reference in Expression to variable that might not be modified -- in loop, indicating a possible infinite loop. Var : Entity_Id := Empty; *************** package body Sem_Warn is *** 267,275 **** function Test_Ref (N : Node_Id) return Traverse_Result; -- Test for reference to variable in question. Returns Abandon if ! -- matching reference found. ! function Find_Ref is new Traverse_Func (Test_Ref); -- Function to traverse body of procedure. Returns Abandon if matching -- reference found. --- 268,276 ---- function Test_Ref (N : Node_Id) return Traverse_Result; -- Test for reference to variable in question. Returns Abandon if ! -- matching reference found. Used in instantiation of No_Ref_Found. ! function No_Ref_Found is new Traverse_Func (Test_Ref); -- Function to traverse body of procedure. Returns Abandon if matching -- reference found. *************** package body Sem_Warn is *** 465,473 **** function Test_Ref (N : Node_Id) return Traverse_Result is begin ! -- Waste of time to look at iteration scheme ! if N = Iter then return Skip; -- Direct reference to variable in question --- 466,474 ---- function Test_Ref (N : Node_Id) return Traverse_Result is begin ! -- Waste of time to look at the expression we are testing ! if N = Expression then return Skip; -- Direct reference to variable in question *************** package body Sem_Warn is *** 537,542 **** --- 538,566 ---- then return Abandon; end if; + + -- If any of the arguments are of type access to subprogram, then + -- we may have funny side effects, so no warning in this case. + + declare + Actual : Node_Id; + begin + Actual := First_Actual (N); + while Present (Actual) loop + if Is_Access_Subprogram_Type (Etype (Actual)) then + return Abandon; + else + Next_Actual (Actual); + end if; + end loop; + end; + + -- Declaration of the variable in question + + elsif Nkind (N) = N_Object_Declaration + and then Defining_Identifier (N) = Var + then + return Abandon; end if; -- All OK, continue scan *************** package body Sem_Warn is *** 547,566 **** -- Start of processing for Check_Infinite_Loop_Warning begin ! -- We need a while iteration with no condition actions. Condition ! -- actions just make things too complicated to get the warning right. ! if No (Iter) ! or else No (Condition (Iter)) ! or else Present (Condition_Actions (Iter)) ! or else Debug_Flag_Dot_W ! then return; end if; -- Initial conditions met, see if condition is of right form ! Find_Var (Condition (Iter)); -- Nothing to do if local variable from source not found. If it's a -- renaming, it is probably renaming something too complicated to deal --- 571,666 ---- -- Start of processing for Check_Infinite_Loop_Warning begin ! -- Skip processing if debug flag gnatd.w is set ! if Debug_Flag_Dot_W then ! return; ! end if; ! ! -- Deal with Iteration scheme present ! ! declare ! Iter : constant Node_Id := Iteration_Scheme (Loop_Statement); ! ! begin ! if Present (Iter) then ! ! -- While iteration ! ! if Present (Condition (Iter)) then ! ! -- Skip processing for while iteration with conditions actions, ! -- since they make it too complicated to get the warning right. ! ! if Present (Condition_Actions (Iter)) then ! return; ! end if; ! ! -- Capture WHILE condition ! ! Expression := Condition (Iter); ! ! -- For iteration, do not process, since loop will always terminate ! ! elsif Present (Loop_Parameter_Specification (Iter)) then ! return; ! end if; ! end if; ! end; ! ! -- Check chain of EXIT statements, we only process loops that have a ! -- single exit condition (either a single EXIT WHEN statement, or a ! -- WHILE loop not containing any EXIT WHEN statements). ! ! declare ! Ident : constant Node_Id := Identifier (Loop_Statement); ! Exit_Stmt : Node_Id; ! ! begin ! -- If we don't have a proper chain set, ignore call entirely. This ! -- happens because of previous errors. ! ! if No (Entity (Ident)) ! or else Ekind (Entity (Ident)) /= E_Loop ! then ! return; ! end if; ! ! -- Otherwise prepare to scan list of EXIT statements ! ! Exit_Stmt := First_Exit_Statement (Entity (Ident)); ! while Present (Exit_Stmt) loop ! ! -- Check for EXIT WHEN ! ! if Present (Condition (Exit_Stmt)) then ! ! -- Quit processing if EXIT WHEN in WHILE loop, or more than ! -- one EXIT WHEN statement present in the loop. ! ! if Present (Expression) then ! return; ! ! -- Otherwise capture condition from EXIT WHEN statement ! ! else ! Expression := Condition (Exit_Stmt); ! end if; ! end if; ! ! Exit_Stmt := Next_Exit_Statement (Exit_Stmt); ! end loop; ! end; ! ! -- Return if no condition to test ! ! if No (Expression) then return; end if; -- Initial conditions met, see if condition is of right form ! Find_Var (Expression); -- Nothing to do if local variable from source not found. If it's a -- renaming, it is probably renaming something too complicated to deal *************** package body Sem_Warn is *** 608,614 **** -- We have a variable reference of the right form, now we scan the loop -- body to see if it looks like it might not be modified ! if Find_Ref (Loop_Statement) = OK then Error_Msg_NE ("?variable& is not modified in loop body!", Ref, Var); Error_Msg_N --- 708,714 ---- -- We have a variable reference of the right form, now we scan the loop -- body to see if it looks like it might not be modified ! if No_Ref_Found (Loop_Statement) = OK then Error_Msg_NE ("?variable& is not modified in loop body!", Ref, Var); Error_Msg_N *************** package body Sem_Warn is *** 758,766 **** procedure Output_Reference_Error (M : String) is begin ! -- Never issue messages for internal names ! if Is_Internal_Name (Chars (E1)) then return; end if; --- 858,868 ---- procedure Output_Reference_Error (M : String) is begin ! -- Never issue messages for internal names, nor for renamings ! if Is_Internal_Name (Chars (E1)) ! or else Nkind (Parent (E1)) = N_Object_Renaming_Declaration ! then return; end if; *************** package body Sem_Warn is *** 927,935 **** -- we exclude protected types, too complicated to worry about. if Ekind (E1) = E_Variable ! or else ! ((Ekind (E1) = E_Out_Parameter ! or else Ekind (E1) = E_In_Out_Parameter) and then not Is_Protected_Type (Current_Scope)) then -- Case of an unassigned variable --- 1029,1036 ---- -- we exclude protected types, too complicated to worry about. if Ekind (E1) = E_Variable ! or else ! (Ekind_In (E1, E_Out_Parameter, E_In_Out_Parameter) and then not Is_Protected_Type (Current_Scope)) then -- Case of an unassigned variable *************** package body Sem_Warn is *** 1245,1251 **** while Present (Comp) loop if Ekind (Comp) = E_Component and then Nkind (Parent (Comp)) = ! N_Component_Declaration and then No (Expression (Parent (Comp))) then Error_Msg_Node_2 := Comp; --- 1346,1352 ---- while Present (Comp) loop if Ekind (Comp) = E_Component and then Nkind (Parent (Comp)) = ! N_Component_Declaration and then No (Expression (Parent (Comp))) then Error_Msg_Node_2 := Comp; *************** package body Sem_Warn is *** 1323,1330 **** or else Referenced_As_Out_Parameter_Check_Spec (E1)) ! -- Labels, and enumeration literals, and exceptions. The ! -- warnings are also placed on local packages that cannot be -- referenced from elsewhere, including those declared within a -- package body. --- 1424,1430 ---- or else Referenced_As_Out_Parameter_Check_Spec (E1)) ! -- All other entities, including local packages that cannot be -- referenced from elsewhere, including those declared within a -- package body. *************** package body Sem_Warn is *** 1364,1375 **** -- a separate spec. and then not (Is_Formal (E1) ! and then ! Ekind (Scope (E1)) = E_Subprogram_Body ! and then ! Present (Spec_Entity (E1)) ! and then ! Referenced (Spec_Entity (E1))) -- Consider private type referenced if full view is referenced. -- If there is not full view, this is a generic type on which --- 1464,1472 ---- -- a separate spec. and then not (Is_Formal (E1) ! and then Ekind (Scope (E1)) = E_Subprogram_Body ! and then Present (Spec_Entity (E1)) ! and then Referenced (Spec_Entity (E1))) -- Consider private type referenced if full view is referenced. -- If there is not full view, this is a generic type on which *************** package body Sem_Warn is *** 1377,1384 **** and then not (Is_Private_Type (E1) ! and then ! Present (Full_View (E1)) and then Referenced (Full_View (E1))) -- Don't worry about full view, only about private type --- 1474,1480 ---- and then not (Is_Private_Type (E1) ! and then Present (Full_View (E1)) and then Referenced (Full_View (E1))) -- Don't worry about full view, only about private type *************** package body Sem_Warn is *** 1408,1423 **** -- be non-referenced, since they start up tasks! and then ((Ekind (E1) /= E_Variable ! and then Ekind (E1) /= E_Constant ! and then Ekind (E1) /= E_Component) ! or else not Is_Task_Type (E1T)) -- For subunits, only place warnings on the main unit itself, -- since parent units are not completely compiled. and then (Nkind (Unit (Cunit (Main_Unit))) /= N_Subunit ! or else ! Get_Source_Unit (E1) = Main_Unit) -- No warning on a return object, because these are often -- created with a single expression and an implicit return. --- 1504,1518 ---- -- be non-referenced, since they start up tasks! and then ((Ekind (E1) /= E_Variable ! and then Ekind (E1) /= E_Constant ! and then Ekind (E1) /= E_Component) ! or else not Is_Task_Type (E1T)) -- For subunits, only place warnings on the main unit itself, -- since parent units are not completely compiled. and then (Nkind (Unit (Cunit (Main_Unit))) /= N_Subunit ! or else Get_Source_Unit (E1) = Main_Unit) -- No warning on a return object, because these are often -- created with a single expression and an implicit return. *************** package body Sem_Warn is *** 1432,1440 **** -- since they refer to problems in internal units). if GNAT_Mode ! or else not ! Is_Internal_File_Name ! (Unit_File_Name (Get_Source_Unit (E1))) then -- We do not immediately flag the error. This is because we -- have not expanded generic bodies yet, and they may have --- 1527,1534 ---- -- since they refer to problems in internal units). if GNAT_Mode ! or else not Is_Internal_File_Name ! (Unit_File_Name (Get_Source_Unit (E1))) then -- We do not immediately flag the error. This is because we -- have not expanded generic bodies yet, and they may have *************** package body Sem_Warn is *** 1475,1481 **** if not Warnings_Off_E1 then Unreferenced_Entities.Append (E1); ! -- Force warning on entity Set_Referenced (E1, False); end if; --- 1569,1575 ---- if not Warnings_Off_E1 then Unreferenced_Entities.Append (E1); ! -- Force warning on entity Set_Referenced (E1, False); end if; *************** package body Sem_Warn is *** 1961,1967 **** -- or a pragma, and a warning is worthwhile as well. function Check_System_Aux return Boolean; ! -- Before giving a warning on a with_clause for System, check wheter -- a system extension is present. function Find_Package_Renaming --- 2055,2061 ---- -- or a pragma, and a warning is worthwhile as well. function Check_System_Aux return Boolean; ! -- Before giving a warning on a with_clause for System, check whether -- a system extension is present. function Find_Package_Renaming *************** package body Sem_Warn is *** 2004,2010 **** while Present (Nam) loop if Entity (Nam) = Pack then Error_Msg_Qual_Level := 1; ! Error_Msg_NE ("?no entities of package& are referenced!", Nam, Pack); Error_Msg_Qual_Level := 0; --- 2098,2104 ---- while Present (Nam) loop if Entity (Nam) = Pack then Error_Msg_Qual_Level := 1; ! Error_Msg_NE -- CODEFIX ("?no entities of package& are referenced!", Nam, Pack); Error_Msg_Qual_Level := 0; *************** package body Sem_Warn is *** 2201,2207 **** -- else or a pragma elaborate with a body library task). elsif Has_Visible_Entities (Entity (Name (Item))) then ! Error_Msg_N ("?unit& is not referenced!", Name (Item)); end if; end if; --- 2295,2301 ---- -- else or a pragma elaborate with a body library task). elsif Has_Visible_Entities (Entity (Name (Item))) then ! Error_Msg_N -- CODEFIX ("?unit& is not referenced!", Name (Item)); end if; end if; *************** package body Sem_Warn is *** 2278,2284 **** if not Has_Unreferenced (Entity (Name (Item))) then ! Error_Msg_N ("?no entities of & are referenced!", Name (Item)); end if; --- 2372,2378 ---- if not Has_Unreferenced (Entity (Name (Item))) then ! Error_Msg_N -- CODEFIX ("?no entities of & are referenced!", Name (Item)); end if; *************** package body Sem_Warn is *** 2294,2300 **** and then not Has_Warnings_Off (Lunit) and then not Has_Unreferenced (Pack) then ! Error_Msg_NE ("?no entities of & are referenced!", Unit_Declaration_Node (Pack), Pack); --- 2388,2394 ---- and then not Has_Warnings_Off (Lunit) and then not Has_Unreferenced (Pack) then ! Error_Msg_NE -- CODEFIX ("?no entities of & are referenced!", Unit_Declaration_Node (Pack), Pack); *************** package body Sem_Warn is *** 2334,2345 **** end if; if Unreferenced_In_Spec (Item) then ! Error_Msg_N ("?unit& is not referenced in spec!", Name (Item)); elsif No_Entities_Ref_In_Spec (Item) then ! Error_Msg_N ("?no entities of & are referenced in spec!", Name (Item)); --- 2428,2439 ---- end if; if Unreferenced_In_Spec (Item) then ! Error_Msg_N -- CODEFIX ("?unit& is not referenced in spec!", Name (Item)); elsif No_Entities_Ref_In_Spec (Item) then ! Error_Msg_N -- CODEFIX ("?no entities of & are referenced in spec!", Name (Item)); *************** package body Sem_Warn is *** 2688,2695 **** -- default mode. elsif Check_Unreferenced then ! Error_Msg_N ("?formal parameter& is read but " ! & "never assigned!", E1); end if; end if; --- 2782,2790 ---- -- default mode. elsif Check_Unreferenced then ! Error_Msg_N ! ("?formal parameter& is read but " ! & "never assigned!", E1); end if; end if; *************** package body Sem_Warn is *** 2783,2791 **** -- Reference to obsolescent component ! elsif Ekind (E) = E_Component ! or else Ekind (E) = E_Discriminant ! then Error_Msg_NE ("?reference to obsolescent component& declared#", N, E); --- 2878,2884 ---- -- Reference to obsolescent component ! elsif Ekind_In (E, E_Component, E_Discriminant) then Error_Msg_NE ("?reference to obsolescent component& declared#", N, E); *************** package body Sem_Warn is *** 2975,2981 **** --- 3068,3076 ---- Elab_Warnings := True; Implementation_Unit_Warnings := True; Ineffective_Inline_Warnings := True; + List_Inherited_Aspects := True; Warn_On_Ada_2005_Compatibility := True; + Warn_On_Ada_2012_Compatibility := True; Warn_On_All_Unread_Out_Parameters := True; Warn_On_Assertion_Failure := True; Warn_On_Assumed_Low_Bound := True; *************** package body Sem_Warn is *** 2992,3002 **** --- 3087,3100 ---- Warn_On_Object_Renames_Function := True; Warn_On_Obsolescent_Feature := True; Warn_On_Overlap := True; + Warn_On_Overridden_Size := True; Warn_On_Parameter_Order := True; Warn_On_Questionable_Missing_Parens := True; + Warn_On_Record_Holes := True; Warn_On_Redundant_Constructs := True; Warn_On_Reverse_Bit_Order := True; Warn_On_Unchecked_Conversion := True; + Warn_On_Unordered_Enumeration_Type := True; Warn_On_Unrecognized_Pragma := True; Warn_On_Unrepped_Components := True; Warn_On_Warnings_Off := True; *************** package body Sem_Warn is *** 3004,3015 **** --- 3102,3125 ---- when 'g' => Set_GNAT_Mode_Warnings; + when 'h' => + Warn_On_Record_Holes := True; + + when 'H' => + Warn_On_Record_Holes := False; + when 'i' => Warn_On_Overlap := True; when 'I' => Warn_On_Overlap := False; + when 'l' => + List_Inherited_Aspects := True; + + when 'L' => + List_Inherited_Aspects := False; + when 'm' => Warn_On_Suspicious_Modulus_Value := True; *************** package body Sem_Warn is *** 3034,3039 **** --- 3144,3161 ---- when 'R' => Warn_On_Object_Renames_Function := False; + when 's' => + Warn_On_Overridden_Size := True; + + when 'S' => + Warn_On_Overridden_Size := False; + + when 'u' => + Warn_On_Unordered_Enumeration_Type := True; + + when 'U' => + Warn_On_Unordered_Enumeration_Type := False; + when 'v' => Warn_On_Reverse_Bit_Order := True; *************** package body Sem_Warn is *** 3074,3080 **** --- 3196,3204 ---- Elab_Warnings := False; Implementation_Unit_Warnings := False; Ineffective_Inline_Warnings := True; + List_Inherited_Aspects := False; Warn_On_Ada_2005_Compatibility := True; + Warn_On_Ada_2012_Compatibility := True; Warn_On_All_Unread_Out_Parameters := False; Warn_On_Assertion_Failure := True; Warn_On_Assumed_Low_Bound := True; *************** package body Sem_Warn is *** 3095,3100 **** --- 3219,3225 ---- Warn_On_Reverse_Bit_Order := False; Warn_On_Object_Renames_Function := True; Warn_On_Unchecked_Conversion := True; + Warn_On_Unordered_Enumeration_Type := False; Warn_On_Unrecognized_Pragma := True; Warn_On_Unrepped_Components := False; Warn_On_Warnings_Off := False; *************** package body Sem_Warn is *** 3114,3120 **** --- 3239,3247 ---- Constant_Condition_Warnings := True; Implementation_Unit_Warnings := True; Ineffective_Inline_Warnings := True; + List_Inherited_Aspects := True; Warn_On_Ada_2005_Compatibility := True; + Warn_On_Ada_2012_Compatibility := True; Warn_On_Assertion_Failure := True; Warn_On_Assumed_Low_Bound := True; Warn_On_Bad_Fixed_Value := True; *************** package body Sem_Warn is *** 3143,3149 **** --- 3270,3278 ---- Elab_Warnings := False; Implementation_Unit_Warnings := False; Ineffective_Inline_Warnings := False; + List_Inherited_Aspects := False; Warn_On_Ada_2005_Compatibility := False; + Warn_On_Ada_2012_Compatibility := False; Warn_On_All_Unread_Out_Parameters := False; Warn_On_Assertion_Failure := False; Warn_On_Assumed_Low_Bound := False; *************** package body Sem_Warn is *** 3160,3170 **** --- 3289,3302 ---- Warn_On_Object_Renames_Function := False; Warn_On_Obsolescent_Feature := False; Warn_On_Overlap := False; + Warn_On_Overridden_Size := False; Warn_On_Parameter_Order := False; + Warn_On_Record_Holes := False; Warn_On_Questionable_Missing_Parens := False; Warn_On_Redundant_Constructs := False; Warn_On_Reverse_Bit_Order := False; Warn_On_Unchecked_Conversion := False; + Warn_On_Unordered_Enumeration_Type := False; Warn_On_Unrecognized_Pragma := False; Warn_On_Unrepped_Components := False; Warn_On_Warnings_Off := False; *************** package body Sem_Warn is *** 3306,3314 **** --- 3438,3448 ---- when 'y' => Warn_On_Ada_2005_Compatibility := True; + Warn_On_Ada_2012_Compatibility := True; when 'Y' => Warn_On_Ada_2005_Compatibility := False; + Warn_On_Ada_2012_Compatibility := False; when 'z' => Warn_On_Unchecked_Conversion := True; *************** package body Sem_Warn is *** 3423,3450 **** and then Is_Known_Branch then declare - Start : Source_Ptr; - Dummy : Source_Ptr; - Typ : Character; Atrue : Boolean; begin - Sloc_Range (Orig, Start, Dummy); Atrue := Test_Result; ! if Present (Parent (C)) ! and then Nkind (Parent (C)) = N_Op_Not ! then Atrue := not Atrue; end if; ! if Atrue then ! Typ := 't'; ! else ! Typ := 'f'; ! end if; ! ! Set_SCO_Condition (Start, Typ); end; end if; --- 3557,3572 ---- and then Is_Known_Branch then declare Atrue : Boolean; begin Atrue := Test_Result; ! if Present (Parent (C)) and then Nkind (Parent (C)) = N_Op_Not then Atrue := not Atrue; end if; ! Set_SCO_Condition (Orig, Atrue); end; end if; *************** package body Sem_Warn is *** 3586,3592 **** Form1 := First_Formal (Subp); Act1 := First_Actual (N); while Present (Form1) and then Present (Act1) loop ! if Ekind (Form1) = E_In_Out_Parameter then Form2 := First_Formal (Subp); Act2 := First_Actual (N); while Present (Form2) and then Present (Act2) loop --- 3708,3714 ---- Form1 := First_Formal (Subp); Act1 := First_Actual (N); while Present (Form1) and then Present (Act1) loop ! if Ekind (Form1) /= E_In_Parameter then Form2 := First_Formal (Subp); Act2 := First_Actual (N); while Present (Form2) and then Present (Act2) loop *************** package body Sem_Warn is *** 3617,3627 **** elsif Nkind (Act2) = N_Function_Call then null; ! -- If either type is elementary the aliasing is harmless. ! elsif Is_Elementary_Type (Underlying_Type (Etype (Form1))) ! or else ! Is_Elementary_Type (Underlying_Type (Etype (Form2))) then null; --- 3739,3749 ---- elsif Nkind (Act2) = N_Function_Call then null; ! -- If type is not by-copy we can assume that the aliasing is ! -- intended. ! elsif ! Is_By_Reference_Type (Underlying_Type (Etype (Form1))) then null; *************** package body Sem_Warn is *** 3640,3650 **** Next_Actual (Act); end loop; -- If the call was written in prefix notation, and -- thus its prefix before rewriting was a selected -- component, count only visible actuals in the call. ! if Is_Entity_Name (First_Actual (N)) and then Nkind (Original_Node (N)) = Nkind (N) and then Nkind (Name (Original_Node (N))) = N_Selected_Component --- 3762,3782 ---- Next_Actual (Act); end loop; + if Is_Elementary_Type (Etype (Act1)) + and then Ekind (Form2) = E_In_Parameter + then + null; -- no real aliasing. + + elsif Is_Elementary_Type (Etype (Act2)) + and then Ekind (Form2) = E_In_Parameter + then + null; -- ditto + -- If the call was written in prefix notation, and -- thus its prefix before rewriting was a selected -- component, count only visible actuals in the call. ! elsif Is_Entity_Name (First_Actual (N)) and then Nkind (Original_Node (N)) = Nkind (N) and then Nkind (Name (Original_Node (N))) = N_Selected_Component *************** package body Sem_Warn is *** 3665,3673 **** end if; else Error_Msg_FE ! ("writable actual overlaps with actual for&?", ! Act1, Form); end if; end; end if; --- 3797,3806 ---- end if; else + Error_Msg_Node_2 := Form; Error_Msg_FE ! ("writable actual for & overlaps with" ! & " actual for&?", Act1, Form1); end if; end; end if; *************** package body Sem_Warn is *** 3776,3782 **** procedure Warn1 is begin Error_Msg_Uint_1 := Low_Bound; ! Error_Msg_FE ("?index for& may assume lower bound of^", X, Ent); end Warn1; -- Start of processing for Test_Suspicious_Index --- 3909,3916 ---- procedure Warn1 is begin Error_Msg_Uint_1 := Low_Bound; ! Error_Msg_FE -- CODEFIX ! ("?index for& may assume lower bound of^", X, Ent); end Warn1; -- Start of processing for Test_Suspicious_Index *************** package body Sem_Warn is *** 3800,3810 **** if Nkind (Original_Node (X)) = N_Integer_Literal then if Intval (X) = Low_Bound then ! Error_Msg_FE -- CODEFIX ("\suggested replacement: `&''First`", X, Ent); else Error_Msg_Uint_1 := Intval (X) - Low_Bound; ! Error_Msg_FE -- CODEFIX ("\suggested replacement: `&''First + ^`", X, Ent); end if; --- 3934,3944 ---- if Nkind (Original_Node (X)) = N_Integer_Literal then if Intval (X) = Low_Bound then ! Error_Msg_FE -- CODEFIX ("\suggested replacement: `&''First`", X, Ent); else Error_Msg_Uint_1 := Intval (X) - Low_Bound; ! Error_Msg_FE -- CODEFIX ("\suggested replacement: `&''First + ^`", X, Ent); end if; *************** package body Sem_Warn is *** 3910,3916 **** -- Replacement subscript is now in string buffer ! Error_Msg_FE -- CODEFIX ("\suggested replacement: `&~`", Original_Node (X), Ent); end if; --- 4044,4050 ---- -- Replacement subscript is now in string buffer ! Error_Msg_FE -- CODEFIX ("\suggested replacement: `&~`", Original_Node (X), Ent); end if; *************** package body Sem_Warn is *** 4082,4091 **** if Present (Renamed_Object (E)) and then Comes_From_Source (Renamed_Object (E)) then ! Error_Msg_N ("?renamed variable & is not referenced!", E); else ! Error_Msg_N ("?variable & is not referenced!", E); end if; end if; --- 4216,4225 ---- if Present (Renamed_Object (E)) and then Comes_From_Source (Renamed_Object (E)) then ! Error_Msg_N -- CODEFIX ("?renamed variable & is not referenced!", E); else ! Error_Msg_N -- CODEFIX ("?variable & is not referenced!", E); end if; end if; *************** package body Sem_Warn is *** 4095,4104 **** if Present (Renamed_Object (E)) and then Comes_From_Source (Renamed_Object (E)) then ! Error_Msg_N ("?renamed constant & is not referenced!", E); else ! Error_Msg_N ("?constant & is not referenced!", E); end if; when E_In_Parameter | --- 4229,4239 ---- if Present (Renamed_Object (E)) and then Comes_From_Source (Renamed_Object (E)) then ! Error_Msg_N -- CODEFIX ("?renamed constant & is not referenced!", E); else ! Error_Msg_N -- CODEFIX ! ("?constant & is not referenced!", E); end if; when E_In_Parameter | *************** package body Sem_Warn is *** 4123,4129 **** end if; if not Is_Trivial_Subprogram (Scope (E)) then ! Error_Msg_NE ("?formal parameter & is not referenced!", E, Spec_E); end if; --- 4258,4264 ---- end if; if not Is_Trivial_Subprogram (Scope (E)) then ! Error_Msg_NE -- CODEFIX ("?formal parameter & is not referenced!", E, Spec_E); end if; *************** package body Sem_Warn is *** 4138,4165 **** when E_Named_Integer | E_Named_Real => ! Error_Msg_N ("?named number & is not referenced!", E); when Formal_Object_Kind => ! Error_Msg_N ("?formal object & is not referenced!", E); when E_Enumeration_Literal => ! Error_Msg_N ("?literal & is not referenced!", E); when E_Function => ! Error_Msg_N ("?function & is not referenced!", E); when E_Procedure => ! Error_Msg_N ("?procedure & is not referenced!", E); when E_Package => ! Error_Msg_N ("?package & is not referenced!", E); when E_Exception => ! Error_Msg_N ("?exception & is not referenced!", E); when E_Label => ! Error_Msg_N ("?label & is not referenced!", E); when E_Generic_Procedure => Error_Msg_N -- CODEFIX --- 4273,4308 ---- when E_Named_Integer | E_Named_Real => ! Error_Msg_N -- CODEFIX ! ("?named number & is not referenced!", E); when Formal_Object_Kind => ! Error_Msg_N -- CODEFIX ! ("?formal object & is not referenced!", E); when E_Enumeration_Literal => ! Error_Msg_N -- CODEFIX ! ("?literal & is not referenced!", E); when E_Function => ! Error_Msg_N -- CODEFIX ! ("?function & is not referenced!", E); when E_Procedure => ! Error_Msg_N -- CODEFIX ! ("?procedure & is not referenced!", E); when E_Package => ! Error_Msg_N -- CODEFIX ! ("?package & is not referenced!", E); when E_Exception => ! Error_Msg_N -- CODEFIX ! ("?exception & is not referenced!", E); when E_Label => ! Error_Msg_N -- CODEFIX ! ("?label & is not referenced!", E); when E_Generic_Procedure => Error_Msg_N -- CODEFIX *************** package body Sem_Warn is *** 4170,4179 **** ("?generic function & is never instantiated!", E); when Type_Kind => ! Error_Msg_N ("?type & is not referenced!", E); when others => ! Error_Msg_N ("?& is not referenced!", E); end case; -- Kill warnings on the entity on which the message has been posted --- 4313,4324 ---- ("?generic function & is never instantiated!", E); when Type_Kind => ! Error_Msg_N -- CODEFIX ! ("?type & is not referenced!", E); when others => ! Error_Msg_N -- CODEFIX ! ("?& is not referenced!", E); end case; -- Kill warnings on the entity on which the message has been posted *************** package body Sem_Warn is *** 4270,4276 **** ("?& modified by call, but value never referenced", Last_Assignment (Ent), Ent); else ! Error_Msg_NE ("?useless assignment to&, value never referenced!", Last_Assignment (Ent), Ent); end if; --- 4415,4421 ---- ("?& modified by call, but value never referenced", Last_Assignment (Ent), Ent); else ! Error_Msg_NE -- CODEFIX ("?useless assignment to&, value never referenced!", Last_Assignment (Ent), Ent); end if; *************** package body Sem_Warn is *** 4286,4292 **** ("?& modified by call, but value overwritten #!", Last_Assignment (Ent), Ent); else ! Error_Msg_NE ("?useless assignment to&, value overwritten #!", Last_Assignment (Ent), Ent); end if; --- 4431,4437 ---- ("?& modified by call, but value overwritten #!", Last_Assignment (Ent), Ent); else ! Error_Msg_NE -- CODEFIX ("?useless assignment to&, value overwritten #!", Last_Assignment (Ent), Ent); end if; *************** package body Sem_Warn is *** 4321,4327 **** -- variable in question, or if the entity in question -- is an OUT or IN OUT parameter, which which case -- the caller can reference it after the exception ! -- hanlder completes else if Is_Formal (Ent) then --- 4466,4472 ---- -- variable in question, or if the entity in question -- is an OUT or IN OUT parameter, which which case -- the caller can reference it after the exception ! -- handler completes. else if Is_Formal (Ent) then diff -Nrcpad gcc-4.5.2/gcc/ada/sem_warn.ads gcc-4.6.0/gcc/ada/sem_warn.ads *** gcc-4.5.2/gcc/ada/sem_warn.ads Tue Oct 27 14:14:44 2009 --- gcc-4.6.0/gcc/ada/sem_warn.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1999-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1999-2010, 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- -- *************** with Types; use Types; *** 33,38 **** --- 33,58 ---- package Sem_Warn is + ------------------- + -- Warning Flags -- + ------------------- + + -- These flags are activated or deactivated by -gnatw switches and control + -- whether warnings of a given class will be generated or not. + + -- Note: most of these flags are still in opt, but the plan is to move them + -- here as time goes by. + + Warn_On_Record_Holes : Boolean := False; + -- Warn when explicit record component clauses leave uncovered holes (gaps) + -- in a record layout. Off by default, set by -gnatw.h (but not -gnatwa). + + Warn_On_Overridden_Size : Boolean := False; + -- Warn when explicit record component clause or array component_size + -- clause specifies a size that overrides a size for the type which was + -- set with an explicit size clause. Off by default, set by -gnatw.s (but + -- not -gnatwa). + ------------------------ -- Warnings Off Table -- ------------------------ *************** package Sem_Warn is *** 170,176 **** procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id); -- N is the node for a loop statement. This procedure checks if a warning ! -- should be given for a possible infinite loop, and if so issues it. procedure Check_Low_Bound_Tested (Expr : Node_Id); -- Expr is the node for a comparison operation. This procedure checks if --- 190,197 ---- procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id); -- N is the node for a loop statement. This procedure checks if a warning ! -- for a possible infinite loop should be given for a suspicious WHILE or ! -- EXIT WHEN condition. procedure Check_Low_Bound_Tested (Expr : Node_Id); -- Expr is the node for a comparison operation. This procedure checks if diff -Nrcpad gcc-4.5.2/gcc/ada/sfn_scan.adb gcc-4.6.0/gcc/ada/sfn_scan.adb *** gcc-4.5.2/gcc/ada/sfn_scan.adb Thu Jun 11 15:48:14 2009 --- gcc-4.6.0/gcc/ada/sfn_scan.adb Tue Jun 22 17:04:37 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2000-2010, 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- -- *************** package body SFN_Scan is *** 37,47 **** -- Allow easy access to control character definitions 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 ! -- 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. type String_Ptr is access String; --- 37,46 ---- -- Allow easy access to control character definitions EOF : constant Character := ASCII.SUB; ! -- The character SUB (16#1A#) is used in DOS-derived systems, such as ! -- Windows 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. type String_Ptr is access String; *************** package body SFN_Scan is *** 637,643 **** loop if At_EOF or else S (P) = LF or else S (P) = CR then ! Error -- CODEFIX ("missing string quote"); elsif S (P) = HT then --- 636,642 ---- loop if At_EOF or else S (P) = LF or else S (P) = CR then ! Error -- CODEFIX ("missing string quote"); elsif S (P) = HT then diff -Nrcpad gcc-4.5.2/gcc/ada/sinfo.adb gcc-4.6.0/gcc/ada/sinfo.adb *** gcc-4.5.2/gcc/ada/sinfo.adb Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/sinfo.adb Fri Oct 22 14:51:40 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sinfo is *** 146,152 **** --- 146,154 ---- begin pragma Assert (False or else NT (N).Nkind = N_And_Then + or else NT (N).Nkind = N_Case_Expression_Alternative or else NT (N).Nkind = N_Compilation_Unit_Aux + or else NT (N).Nkind = N_Expression_With_Actions or else NT (N).Nkind = N_Freeze_Entity or else NT (N).Nkind = N_Or_Else); return List1 (N); *************** package body Sinfo is *** 221,227 **** begin pragma Assert (False or else NT (N).Nkind = N_Access_Definition ! or else NT (N).Nkind = N_Access_To_Object_Definition); return Flag15 (N); end All_Present; --- 223,231 ---- begin pragma Assert (False or else NT (N).Nkind = N_Access_Definition ! or else NT (N).Nkind = N_Access_To_Object_Definition ! or else NT (N).Nkind = N_Quantified_Expression ! or else NT (N).Nkind = N_Use_Type_Clause); return Flag15 (N); end All_Present; *************** package body Sinfo is *** 229,234 **** --- 233,239 ---- (N : Node_Id) return List_Id is begin pragma Assert (False + or else NT (N).Nkind = N_Case_Expression or else NT (N).Nkind = N_Case_Statement or else NT (N).Nkind = N_In or else NT (N).Nkind = N_Not_In); *************** package body Sinfo is *** 251,256 **** --- 256,277 ---- return Node3 (N); end Array_Aggregate; + function Aspect_Cancel + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + return Flag11 (N); + end Aspect_Cancel; + + function Aspect_Rep_Item + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification); + return Node2 (N); + end Aspect_Rep_Item; + function Assignment_OK (N : Node_Id) return Boolean is begin *************** package body Sinfo is *** 388,393 **** --- 409,423 ---- return List1 (N); end Choices; + function Class_Present + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification + or else NT (N).Nkind = N_Pragma); + return Flag6 (N); + end Class_Present; + function Coextensions (N : Node_Id) return Elist_Id is begin *************** package body Sinfo is *** 483,488 **** --- 513,519 ---- or else NT (N).Nkind = N_Exit_Statement or else NT (N).Nkind = N_If_Statement or else NT (N).Nkind = N_Iteration_Scheme + or else NT (N).Nkind = N_Quantified_Expression or else NT (N).Nkind = N_Raise_Constraint_Error or else NT (N).Nkind = N_Raise_Program_Error or else NT (N).Nkind = N_Raise_Storage_Error *************** package body Sinfo is *** 678,683 **** --- 709,722 ---- return Node5 (N); end Default_Expression; + function Default_Storage_Pool + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Compilation_Unit_Aux); + return Node3 (N); + end Default_Storage_Pool; + function Default_Name (N : Node_Id) return Node_Id is begin *************** package body Sinfo is *** 705,710 **** --- 744,750 ---- or else NT (N).Nkind = N_Full_Type_Declaration or else NT (N).Nkind = N_Implicit_Label_Declaration or else NT (N).Nkind = N_Incomplete_Type_Declaration + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Loop_Parameter_Specification or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration *************** package body Sinfo is *** 791,796 **** --- 831,837 ---- (N : Node_Id) return List_Id is begin pragma Assert (False + or else NT (N).Nkind = N_Case_Expression_Alternative or else NT (N).Nkind = N_Case_Statement_Alternative or else NT (N).Nkind = N_Variant); return List4 (N); *************** package body Sinfo is *** 1026,1033 **** begin pragma Assert (False or else NT (N).Nkind in N_Has_Entity ! or else NT (N).Nkind = N_Freeze_Entity ! or else NT (N).Nkind = N_Attribute_Definition_Clause); return Node4 (N); end Entity; --- 1067,1075 ---- begin pragma Assert (False or else NT (N).Nkind in N_Has_Entity ! or else NT (N).Nkind = N_Aspect_Specification ! or else NT (N).Nkind = N_Attribute_Definition_Clause ! or else NT (N).Nkind = N_Freeze_Entity); return Node4 (N); end Entity; *************** package body Sinfo is *** 1166,1174 **** --- 1208,1219 ---- begin pragma Assert (False or else NT (N).Nkind = N_Allocator + or else NT (N).Nkind = N_Aspect_Specification or else NT (N).Nkind = N_Assignment_Statement or else NT (N).Nkind = N_At_Clause or else NT (N).Nkind = N_Attribute_Definition_Clause + or else NT (N).Nkind = N_Case_Expression + or else NT (N).Nkind = N_Case_Expression_Alternative or else NT (N).Nkind = N_Case_Statement or else NT (N).Nkind = N_Code_Statement or else NT (N).Nkind = N_Component_Association *************** package body Sinfo is *** 1178,1189 **** --- 1223,1236 ---- or else NT (N).Nkind = N_Discriminant_Association or else NT (N).Nkind = N_Discriminant_Specification or else NT (N).Nkind = N_Exception_Declaration + or else NT (N).Nkind = N_Expression_With_Actions or else NT (N).Nkind = N_Free_Statement or else NT (N).Nkind = N_Mod_Clause or else NT (N).Nkind = N_Modular_Type_Definition or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration or else NT (N).Nkind = N_Parameter_Specification + or else NT (N).Nkind = N_Parameterized_Expression or else NT (N).Nkind = N_Pragma_Argument_Association or else NT (N).Nkind = N_Qualified_Expression or else NT (N).Nkind = N_Raise_Statement *************** package body Sinfo is *** 1280,1285 **** --- 1327,1341 ---- return Flag5 (N); end Forwards_OK; + function From_Aspect_Specification + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Attribute_Definition_Clause + or else NT (N).Nkind = N_Pragma); + return Flag13 (N); + end From_Aspect_Specification; + function From_At_End (N : Node_Id) return Boolean is begin *************** package body Sinfo is *** 1378,1384 **** begin return Flag10 (N); end Has_Dynamic_Length_Check; - function Has_Dynamic_Range_Check (N : Node_Id) return Boolean is begin --- 1434,1439 ---- *************** package body Sinfo is *** 1409,1415 **** return Flag17 (N); end Has_No_Elaboration_Code; ! function Has_Priority_Pragma (N : Node_Id) return Boolean is begin pragma Assert (False --- 1464,1479 ---- return Flag17 (N); end Has_No_Elaboration_Code; ! function Has_Pragma_CPU ! (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 Flag14 (N); ! end Has_Pragma_CPU; ! ! function Has_Pragma_Priority (N : Node_Id) return Boolean is begin pragma Assert (False *************** package body Sinfo is *** 1417,1423 **** or else NT (N).Nkind = N_Subprogram_Body or else NT (N).Nkind = N_Task_Definition); return Flag6 (N); ! end Has_Priority_Pragma; function Has_Private_View (N : Node_Id) return Boolean is --- 1481,1495 ---- or else NT (N).Nkind = N_Subprogram_Body or else NT (N).Nkind = N_Task_Definition); return Flag6 (N); ! end Has_Pragma_Priority; ! ! function Has_Pragma_Suppress_All ! (N : Node_Id) return Boolean is ! begin ! pragma Assert (False ! or else NT (N).Nkind = N_Compilation_Unit); ! return Flag14 (N); ! end Has_Pragma_Suppress_All; function Has_Private_View (N : Node_Id) return Boolean is *************** package body Sinfo is *** 1512,1517 **** --- 1584,1590 ---- (N : Node_Id) return Node_Id is begin pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification or else NT (N).Nkind = N_At_Clause or else NT (N).Nkind = N_Block_Statement or else NT (N).Nkind = N_Designator *************** package body Sinfo is *** 1555,1560 **** --- 1628,1641 ---- return Flag16 (N); end Interface_Present; + function Import_Interface_Present + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + return Flag16 (N); + end Import_Interface_Present; + function In_Present (N : Node_Id) return Boolean is begin *************** package body Sinfo is *** 1572,1577 **** --- 1653,1666 ---- return Flag11 (N); end Includes_Infinities; + function Inherited_Discriminant + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Component_Association); + return Flag13 (N); + end Inherited_Discriminant; + function Instance_Spec (N : Node_Id) return Node_Id is begin *************** package body Sinfo is *** 1631,1636 **** --- 1720,1734 ---- return Flag16 (N); end Is_Controlling_Actual; + function Is_Delayed_Aspect + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Attribute_Definition_Clause + or else NT (N).Nkind = N_Pragma); + return Flag14 (N); + end Is_Delayed_Aspect; + function Is_Dynamic_Coextension (N : Node_Id) return Boolean is begin *************** package body Sinfo is *** 1769,1774 **** --- 1867,1881 ---- return Node2 (N); end Iteration_Scheme; + function Iterator_Specification + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Iteration_Scheme + or else NT (N).Nkind = N_Quantified_Expression); + return Node2 (N); + end Iterator_Specification; + function Itype (N : Node_Id) return Node_Id is begin *************** package body Sinfo is *** 1893,1899 **** (N : Node_Id) return Node_Id is begin pragma Assert (False ! or else NT (N).Nkind = N_Iteration_Scheme); return Node4 (N); end Loop_Parameter_Specification; --- 2000,2007 ---- (N : Node_Id) return Node_Id is begin pragma Assert (False ! or else NT (N).Nkind = N_Iteration_Scheme ! or else NT (N).Nkind = N_Quantified_Expression); return Node4 (N); end Loop_Parameter_Specification; *************** package body Sinfo is *** 1988,1993 **** --- 2096,2102 ---- or else NT (N).Nkind = N_Generic_Package_Renaming_Declaration or else NT (N).Nkind = N_Generic_Procedure_Renaming_Declaration or else NT (N).Nkind = N_Goto_Statement + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Object_Renaming_Declaration or else NT (N).Nkind = N_Package_Instantiation or else NT (N).Nkind = N_Package_Renaming_Declaration *************** package body Sinfo is *** 2021,2026 **** --- 2130,2143 ---- return Node2 (N); end Next_Entity; + function Next_Exit_Statement + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Exit_Statement); + return Node3 (N); + end Next_Exit_Statement; + function Next_Implicit_With (N : Node_Id) return Node_Id is begin *************** package body Sinfo is *** 2049,2054 **** --- 2166,2172 ---- (N : Node_Id) return Node_Id is begin pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification or else NT (N).Nkind = N_Attribute_Definition_Clause or else NT (N).Nkind = N_Enumeration_Representation_Clause or else NT (N).Nkind = N_Pragma *************** package body Sinfo is *** 2163,2168 **** --- 2281,2294 ---- return Node4 (N); end Object_Definition; + function Of_Present + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Iterator_Specification); + return Flag16 (N); + end Of_Present; + function Original_Discriminant (N : Node_Id) return Node_Id is begin *************** package body Sinfo is *** 2523,2528 **** --- 2649,2655 ---- (N : Node_Id) return Boolean is begin pragma Assert (False + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Loop_Parameter_Specification); return Flag15 (N); end Reverse_Present; *************** package body Sinfo is *** 2561,2586 **** (N : Node_Id) return Node_Id is begin pragma Assert (False - or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init or else NT (N).Nkind = N_SCIL_Dispatching_Call ! or else NT (N).Nkind = N_SCIL_Membership_Test ! or else NT (N).Nkind = N_SCIL_Tag_Init); return Node4 (N); end SCIL_Entity; - function SCIL_Related_Node - (N : Node_Id) return Node_Id is - begin - pragma Assert (False - or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init - or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init - or else NT (N).Nkind = N_SCIL_Dispatching_Call - or else NT (N).Nkind = N_SCIL_Membership_Test - or else NT (N).Nkind = N_SCIL_Tag_Init); - return Node1 (N); - end SCIL_Related_Node; - function SCIL_Tag_Value (N : Node_Id) return Node_Id is begin --- 2688,2699 ---- (N : Node_Id) return Node_Id is begin pragma Assert (False or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init or else NT (N).Nkind = N_SCIL_Dispatching_Call ! or else NT (N).Nkind = N_SCIL_Membership_Test); return Node4 (N); end SCIL_Entity; function SCIL_Tag_Value (N : Node_Id) return Node_Id is begin *************** package body Sinfo is *** 2664,2669 **** --- 2777,2783 ---- or else NT (N).Nkind = N_Generic_Package_Declaration or else NT (N).Nkind = N_Generic_Subprogram_Declaration or else NT (N).Nkind = N_Package_Declaration + or else NT (N).Nkind = N_Parameterized_Expression or else NT (N).Nkind = N_Subprogram_Body or else NT (N).Nkind = N_Subprogram_Body_Stub or else NT (N).Nkind = N_Subprogram_Declaration *************** package body Sinfo is *** 2671,2676 **** --- 2785,2799 ---- return Node1 (N); end Specification; + function Split_PPC + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification + or else NT (N).Nkind = N_Pragma); + return Flag17 (N); + end Split_PPC; + function Statements (N : Node_Id) return List_Id is begin *************** package body Sinfo is *** 2722,2732 **** --- 2845,2865 ---- or else NT (N).Nkind = N_Access_To_Object_Definition or else NT (N).Nkind = N_Component_Definition or else NT (N).Nkind = N_Derived_Type_Definition + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Private_Extension_Declaration or else NT (N).Nkind = N_Subtype_Declaration); return Node5 (N); end Subtype_Indication; + function Suppress_Assignment_Checks + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Assignment_Statement + or else NT (N).Nkind = N_Object_Declaration); + return Flag18 (N); + end Suppress_Assignment_Checks; + function Suppress_Loop_Warnings (N : Node_Id) return Boolean is begin *************** package body Sinfo is *** 2931,2936 **** --- 3064,3077 ---- return Flag13 (N); end Was_Originally_Stub; + function Withed_Body + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_With_Clause); + return Node1 (N); + end Withed_Body; + function Zero_Cost_Handling (N : Node_Id) return Boolean is begin *************** package body Sinfo is *** 3033,3039 **** --- 3174,3182 ---- begin pragma Assert (False or else NT (N).Nkind = N_And_Then + or else NT (N).Nkind = N_Case_Expression_Alternative or else NT (N).Nkind = N_Compilation_Unit_Aux + or else NT (N).Nkind = N_Expression_With_Actions or else NT (N).Nkind = N_Freeze_Entity or else NT (N).Nkind = N_Or_Else); Set_List1_With_Parent (N, Val); *************** package body Sinfo is *** 3108,3114 **** begin pragma Assert (False or else NT (N).Nkind = N_Access_Definition ! or else NT (N).Nkind = N_Access_To_Object_Definition); Set_Flag15 (N, Val); end Set_All_Present; --- 3251,3259 ---- begin pragma Assert (False or else NT (N).Nkind = N_Access_Definition ! or else NT (N).Nkind = N_Access_To_Object_Definition ! or else NT (N).Nkind = N_Quantified_Expression ! or else NT (N).Nkind = N_Use_Type_Clause); Set_Flag15 (N, Val); end Set_All_Present; *************** package body Sinfo is *** 3116,3121 **** --- 3261,3267 ---- (N : Node_Id; Val : List_Id) is begin pragma Assert (False + or else NT (N).Nkind = N_Case_Expression or else NT (N).Nkind = N_Case_Statement or else NT (N).Nkind = N_In or else NT (N).Nkind = N_Not_In); *************** package body Sinfo is *** 3138,3143 **** --- 3284,3305 ---- Set_Node3_With_Parent (N, Val); end Set_Array_Aggregate; + procedure Set_Aspect_Cancel + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + Set_Flag11 (N, Val); + end Set_Aspect_Cancel; + + procedure Set_Aspect_Rep_Item + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification); + Set_Node2 (N, Val); + end Set_Aspect_Rep_Item; + procedure Set_Assignment_OK (N : Node_Id; Val : Boolean := True) is begin *************** package body Sinfo is *** 3275,3280 **** --- 3437,3451 ---- Set_List1_With_Parent (N, Val); end Set_Choices; + procedure Set_Class_Present + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification + or else NT (N).Nkind = N_Pragma); + Set_Flag6 (N, Val); + end Set_Class_Present; + procedure Set_Coextensions (N : Node_Id; Val : Elist_Id) is begin *************** package body Sinfo is *** 3370,3375 **** --- 3541,3547 ---- or else NT (N).Nkind = N_Exit_Statement or else NT (N).Nkind = N_If_Statement or else NT (N).Nkind = N_Iteration_Scheme + or else NT (N).Nkind = N_Quantified_Expression or else NT (N).Nkind = N_Raise_Constraint_Error or else NT (N).Nkind = N_Raise_Program_Error or else NT (N).Nkind = N_Raise_Storage_Error *************** package body Sinfo is *** 3565,3570 **** --- 3737,3750 ---- Set_Node5 (N, Val); -- semantic field, no parent set end Set_Default_Expression; + procedure Set_Default_Storage_Pool + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Compilation_Unit_Aux); + Set_Node3 (N, Val); -- semantic field, no parent set + end Set_Default_Storage_Pool; + procedure Set_Default_Name (N : Node_Id; Val : Node_Id) is begin *************** package body Sinfo is *** 3592,3597 **** --- 3772,3778 ---- or else NT (N).Nkind = N_Full_Type_Declaration or else NT (N).Nkind = N_Implicit_Label_Declaration or else NT (N).Nkind = N_Incomplete_Type_Declaration + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Loop_Parameter_Specification or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration *************** package body Sinfo is *** 3678,3683 **** --- 3859,3865 ---- (N : Node_Id; Val : List_Id) is begin pragma Assert (False + or else NT (N).Nkind = N_Case_Expression_Alternative or else NT (N).Nkind = N_Case_Statement_Alternative or else NT (N).Nkind = N_Variant); Set_List4_With_Parent (N, Val); *************** package body Sinfo is *** 3913,3920 **** begin pragma Assert (False or else NT (N).Nkind in N_Has_Entity ! or else NT (N).Nkind = N_Freeze_Entity ! or else NT (N).Nkind = N_Attribute_Definition_Clause); Set_Node4 (N, Val); -- semantic field, no parent set end Set_Entity; --- 4095,4103 ---- begin pragma Assert (False or else NT (N).Nkind in N_Has_Entity ! or else NT (N).Nkind = N_Aspect_Specification ! or else NT (N).Nkind = N_Attribute_Definition_Clause ! or else NT (N).Nkind = N_Freeze_Entity); Set_Node4 (N, Val); -- semantic field, no parent set end Set_Entity; *************** package body Sinfo is *** 4044,4052 **** --- 4227,4238 ---- begin pragma Assert (False or else NT (N).Nkind = N_Allocator + or else NT (N).Nkind = N_Aspect_Specification or else NT (N).Nkind = N_Assignment_Statement or else NT (N).Nkind = N_At_Clause or else NT (N).Nkind = N_Attribute_Definition_Clause + or else NT (N).Nkind = N_Case_Expression + or else NT (N).Nkind = N_Case_Expression_Alternative or else NT (N).Nkind = N_Case_Statement or else NT (N).Nkind = N_Code_Statement or else NT (N).Nkind = N_Component_Association *************** package body Sinfo is *** 4056,4067 **** --- 4242,4255 ---- or else NT (N).Nkind = N_Discriminant_Association or else NT (N).Nkind = N_Discriminant_Specification or else NT (N).Nkind = N_Exception_Declaration + or else NT (N).Nkind = N_Expression_With_Actions or else NT (N).Nkind = N_Free_Statement or else NT (N).Nkind = N_Mod_Clause or else NT (N).Nkind = N_Modular_Type_Definition or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration or else NT (N).Nkind = N_Parameter_Specification + or else NT (N).Nkind = N_Parameterized_Expression or else NT (N).Nkind = N_Pragma_Argument_Association or else NT (N).Nkind = N_Qualified_Expression or else NT (N).Nkind = N_Raise_Statement *************** package body Sinfo is *** 4158,4163 **** --- 4346,4360 ---- Set_Flag5 (N, Val); end Set_Forwards_OK; + procedure Set_From_Aspect_Specification + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Attribute_Definition_Clause + or else NT (N).Nkind = N_Pragma); + Set_Flag13 (N, Val); + end Set_From_Aspect_Specification; + procedure Set_From_At_End (N : Node_Id; Val : Boolean := True) is begin *************** package body Sinfo is *** 4287,4293 **** Set_Flag17 (N, Val); end Set_Has_No_Elaboration_Code; ! procedure Set_Has_Priority_Pragma (N : Node_Id; Val : Boolean := True) is begin pragma Assert (False --- 4484,4499 ---- Set_Flag17 (N, Val); end Set_Has_No_Elaboration_Code; ! procedure Set_Has_Pragma_CPU ! (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_Flag14 (N, Val); ! end Set_Has_Pragma_CPU; ! ! procedure Set_Has_Pragma_Priority (N : Node_Id; Val : Boolean := True) is begin pragma Assert (False *************** package body Sinfo is *** 4295,4301 **** or else NT (N).Nkind = N_Subprogram_Body or else NT (N).Nkind = N_Task_Definition); Set_Flag6 (N, Val); ! end Set_Has_Priority_Pragma; procedure Set_Has_Private_View (N : Node_Id; Val : Boolean := True) is --- 4501,4515 ---- or else NT (N).Nkind = N_Subprogram_Body or else NT (N).Nkind = N_Task_Definition); Set_Flag6 (N, Val); ! end Set_Has_Pragma_Priority; ! ! procedure Set_Has_Pragma_Suppress_All ! (N : Node_Id; Val : Boolean := True) is ! begin ! pragma Assert (False ! or else NT (N).Nkind = N_Compilation_Unit); ! Set_Flag14 (N, Val); ! end Set_Has_Pragma_Suppress_All; procedure Set_Has_Private_View (N : Node_Id; Val : Boolean := True) is *************** package body Sinfo is *** 4390,4395 **** --- 4604,4610 ---- (N : Node_Id; Val : Node_Id) is begin pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification or else NT (N).Nkind = N_At_Clause or else NT (N).Nkind = N_Block_Statement or else NT (N).Nkind = N_Designator *************** package body Sinfo is *** 4433,4438 **** --- 4648,4661 ---- Set_Flag16 (N, Val); end Set_Interface_Present; + procedure Set_Import_Interface_Present + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Pragma); + Set_Flag16 (N, Val); + end Set_Import_Interface_Present; + procedure Set_In_Present (N : Node_Id; Val : Boolean := True) is begin *************** package body Sinfo is *** 4450,4455 **** --- 4673,4686 ---- Set_Flag11 (N, Val); end Set_Includes_Infinities; + procedure Set_Inherited_Discriminant + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Component_Association); + Set_Flag13 (N, Val); + end Set_Inherited_Discriminant; + procedure Set_Instance_Spec (N : Node_Id; Val : Node_Id) is begin *************** package body Sinfo is *** 4509,4514 **** --- 4740,4754 ---- Set_Flag16 (N, Val); end Set_Is_Controlling_Actual; + procedure Set_Is_Delayed_Aspect + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Attribute_Definition_Clause + or else NT (N).Nkind = N_Pragma); + Set_Flag14 (N, Val); + end Set_Is_Delayed_Aspect; + procedure Set_Is_Dynamic_Coextension (N : Node_Id; Val : Boolean := True) is begin *************** package body Sinfo is *** 4647,4652 **** --- 4887,4901 ---- Set_Node2_With_Parent (N, Val); end Set_Iteration_Scheme; + procedure Set_Iterator_Specification + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Iteration_Scheme + or else NT (N).Nkind = N_Quantified_Expression); + Set_Node2_With_Parent (N, Val); + end Set_Iterator_Specification; + procedure Set_Itype (N : Node_Id; Val : Entity_Id) is begin *************** package body Sinfo is *** 4771,4777 **** (N : Node_Id; Val : Node_Id) is begin pragma Assert (False ! or else NT (N).Nkind = N_Iteration_Scheme); Set_Node4_With_Parent (N, Val); end Set_Loop_Parameter_Specification; --- 5020,5027 ---- (N : Node_Id; Val : Node_Id) is begin pragma Assert (False ! or else NT (N).Nkind = N_Iteration_Scheme ! or else NT (N).Nkind = N_Quantified_Expression); Set_Node4_With_Parent (N, Val); end Set_Loop_Parameter_Specification; *************** package body Sinfo is *** 4866,4871 **** --- 5116,5122 ---- or else NT (N).Nkind = N_Generic_Package_Renaming_Declaration or else NT (N).Nkind = N_Generic_Procedure_Renaming_Declaration or else NT (N).Nkind = N_Goto_Statement + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Object_Renaming_Declaration or else NT (N).Nkind = N_Package_Instantiation or else NT (N).Nkind = N_Package_Renaming_Declaration *************** package body Sinfo is *** 4899,4904 **** --- 5150,5163 ---- Set_Node2 (N, Val); -- semantic field, no parent set end Set_Next_Entity; + procedure Set_Next_Exit_Statement + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Exit_Statement); + Set_Node3 (N, Val); -- semantic field, no parent set + end Set_Next_Exit_Statement; + procedure Set_Next_Implicit_With (N : Node_Id; Val : Node_Id) is begin *************** package body Sinfo is *** 4927,4932 **** --- 5186,5192 ---- (N : Node_Id; Val : Node_Id) is begin pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification or else NT (N).Nkind = N_Attribute_Definition_Clause or else NT (N).Nkind = N_Enumeration_Representation_Clause or else NT (N).Nkind = N_Pragma *************** package body Sinfo is *** 5041,5046 **** --- 5301,5314 ---- Set_Node4_With_Parent (N, Val); end Set_Object_Definition; + procedure Set_Of_Present + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Iterator_Specification); + Set_Flag16 (N, Val); + end Set_Of_Present; + procedure Set_Original_Discriminant (N : Node_Id; Val : Node_Id) is begin *************** package body Sinfo is *** 5401,5406 **** --- 5669,5675 ---- (N : Node_Id; Val : Boolean := True) is begin pragma Assert (False + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Loop_Parameter_Specification); Set_Flag15 (N, Val); end Set_Reverse_Present; *************** package body Sinfo is *** 5439,5464 **** (N : Node_Id; Val : Node_Id) is begin pragma Assert (False - or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init or else NT (N).Nkind = N_SCIL_Dispatching_Call ! or else NT (N).Nkind = N_SCIL_Membership_Test ! or else NT (N).Nkind = N_SCIL_Tag_Init); Set_Node4 (N, Val); -- semantic field, no parent set end Set_SCIL_Entity; - procedure Set_SCIL_Related_Node - (N : Node_Id; Val : Node_Id) is - begin - pragma Assert (False - or else NT (N).Nkind = N_SCIL_Dispatch_Table_Object_Init - or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init - or else NT (N).Nkind = N_SCIL_Dispatching_Call - or else NT (N).Nkind = N_SCIL_Membership_Test - or else NT (N).Nkind = N_SCIL_Tag_Init); - Set_Node1 (N, Val); -- semantic field, no parent set - end Set_SCIL_Related_Node; - procedure Set_SCIL_Tag_Value (N : Node_Id; Val : Node_Id) is begin --- 5708,5719 ---- (N : Node_Id; Val : Node_Id) is begin pragma Assert (False or else NT (N).Nkind = N_SCIL_Dispatch_Table_Tag_Init or else NT (N).Nkind = N_SCIL_Dispatching_Call ! or else NT (N).Nkind = N_SCIL_Membership_Test); Set_Node4 (N, Val); -- semantic field, no parent set end Set_SCIL_Entity; procedure Set_SCIL_Tag_Value (N : Node_Id; Val : Node_Id) is begin *************** package body Sinfo is *** 5542,5547 **** --- 5797,5803 ---- or else NT (N).Nkind = N_Generic_Package_Declaration or else NT (N).Nkind = N_Generic_Subprogram_Declaration or else NT (N).Nkind = N_Package_Declaration + or else NT (N).Nkind = N_Parameterized_Expression or else NT (N).Nkind = N_Subprogram_Body or else NT (N).Nkind = N_Subprogram_Body_Stub or else NT (N).Nkind = N_Subprogram_Declaration *************** package body Sinfo is *** 5549,5554 **** --- 5805,5819 ---- Set_Node1_With_Parent (N, Val); end Set_Specification; + procedure Set_Split_PPC + (N : Node_Id; Val : Boolean) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Aspect_Specification + or else NT (N).Nkind = N_Pragma); + Set_Flag17 (N, Val); + end Set_Split_PPC; + procedure Set_Statements (N : Node_Id; Val : List_Id) is begin *************** package body Sinfo is *** 5600,5605 **** --- 5865,5871 ---- or else NT (N).Nkind = N_Access_To_Object_Definition or else NT (N).Nkind = N_Component_Definition or else NT (N).Nkind = N_Derived_Type_Definition + or else NT (N).Nkind = N_Iterator_Specification or else NT (N).Nkind = N_Private_Extension_Declaration or else NT (N).Nkind = N_Subtype_Declaration); Set_Node5_With_Parent (N, Val); *************** package body Sinfo is *** 5629,5634 **** --- 5895,5909 ---- Set_List2_With_Parent (N, Val); end Set_Subtype_Marks; + procedure Set_Suppress_Assignment_Checks + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Assignment_Statement + or else NT (N).Nkind = N_Object_Declaration); + Set_Flag18 (N, Val); + end Set_Suppress_Assignment_Checks; + procedure Set_Suppress_Loop_Warnings (N : Node_Id; Val : Boolean := True) is begin *************** package body Sinfo is *** 5809,5814 **** --- 6084,6097 ---- Set_Flag13 (N, Val); end Set_Was_Originally_Stub; + procedure Set_Withed_Body + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_With_Clause); + Set_Node1 (N, Val); + end Set_Withed_Body; + procedure Set_Zero_Cost_Handling (N : Node_Id; Val : Boolean := True) is begin *************** package body Sinfo is *** 5856,5861 **** --- 6139,6157 ---- end if; end End_Location; + -------------------- + -- 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; + ---------------------- -- Set_End_Location -- ---------------------- *************** package body Sinfo is *** 5982,5988 **** T = V8; end Nkind_In; - function Nkind_In (T : Node_Kind; V1 : Node_Kind; --- 6278,6283 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/sinfo.ads gcc-4.6.0/gcc/ada/sinfo.ads *** gcc-4.5.2/gcc/ada/sinfo.ads Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/sinfo.ads Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sinfo is *** 59,73 **** -- If changes are made to this file, a number of related steps must be -- carried out to ensure consistency. First, if a field access function is ! -- added, it appears in seven places: ! -- The documentation associated with the node ! -- The spec of the access function in sinfo.ads ! -- The body of the access function in sinfo.adb ! -- The pragma Inline at the end of sinfo.ads for the access function ! -- The spec of the set procedure in sinfo.ads ! -- The body of the set procedure in sinfo.adb ! -- The pragma Inline at the end of sinfo.ads for the set procedure -- The field chosen must be consistent in all places, and, for a node that -- is a subexpression, must not overlap any of the standard expression --- 59,77 ---- -- If changes are made to this file, a number of related steps must be -- carried out to ensure consistency. First, if a field access function is ! -- added, it appears in these places: ! -- In sinfo.ads: ! -- The documentation associated with the field (if semantic) ! -- The documentation associated with the node ! -- The spec of the access function ! -- The spec of the set procedure ! -- The entries in Is_Syntactic_Field ! -- The pragma Inline for the access function ! -- The pragma Inline for the set procedure ! -- In sinfo.adb: ! -- The body of the access function ! -- The body of the set procedure -- The field chosen must be consistent in all places, and, for a node that -- is a subexpression, must not overlap any of the standard expression *************** package Sinfo is *** 96,105 **** -- Finally, four utility programs must be run: ! -- Run CSinfo to check that you have made the changes consistently. It ! -- checks most of the rules given above, with clear error messages. This ! -- utility reads sinfo.ads and sinfo.adb and generates a report to ! -- standard output. -- Run XSinfo to create sinfo.h, the corresponding C header. This -- utility reads sinfo.ads and generates sinfo.h. Note that it does --- 100,109 ---- -- Finally, four utility programs must be run: ! -- (Optional.) Run CSinfo to check that you have made the changes ! -- consistently. It checks most of the rules given above. This utility ! -- reads sinfo.ads and sinfo.adb and generates a report to standard ! -- output. This step is optional because XSinfo runs CSinfo. -- Run XSinfo to create sinfo.h, the corresponding C header. This -- utility reads sinfo.ads and generates sinfo.h. Note that it does *************** package Sinfo is *** 116,123 **** -- spec of the Nmake package which contains functions for constructing -- nodes. ! -- All of the above steps except CSinfo are done automatically by the ! -- build scripts when you do a full bootstrap. -- Note: sometime we could write a utility that actually generated the body -- of sinfo from the spec instead of simply checking it, since, as noted --- 120,127 ---- -- spec of the Nmake package which contains functions for constructing -- nodes. ! -- The above steps are done automatically by the build scripts when you do ! -- a full bootstrap. -- Note: sometime we could write a utility that actually generated the body -- of sinfo from the spec instead of simply checking it, since, as noted *************** package Sinfo is *** 455,467 **** -- The following flag fields appear in all nodes ! -- Analyzed (Flag1) -- This flag is used to indicate that a node (and all its children have -- been analyzed. It is used to avoid reanalysis of a node that has -- already been analyzed, both for efficiency and functional correctness -- reasons. ! -- Comes_From_Source (Flag2) -- This flag is set if the node comes directly from an explicit construct -- in the source. It is normally on for any nodes built by the scanner or -- parser from the source program, with the exception that in a few cases --- 459,471 ---- -- The following flag fields appear in all nodes ! -- Analyzed -- This flag is used to indicate that a node (and all its children have -- been analyzed. It is used to avoid reanalysis of a node that has -- already been analyzed, both for efficiency and functional correctness -- reasons. ! -- Comes_From_Source -- This flag is set if the node comes directly from an explicit construct -- in the source. It is normally on for any nodes built by the scanner or -- parser from the source program, with the exception that in a few cases *************** package Sinfo is *** 475,481 **** -- from the source program (e.g. the allocator built for build-in-place -- case), and the Comes_From_Source flag is deliberately set. ! -- Error_Posted (Flag3) -- This flag is used to avoid multiple error messages being posted on or -- referring to the same node. This flag is set if an error message -- refers to a node or is posted on its source location, and has the --- 479,485 ---- -- from the source program (e.g. the allocator built for build-in-place -- case), and the Comes_From_Source flag is deliberately set. ! -- Error_Posted -- This flag is used to avoid multiple error messages being posted on or -- referring to the same node. This flag is set if an error message -- refers to a node or is posted on its source location, and has the *************** package Sinfo is *** 587,592 **** --- 591,608 ---- -- is used for translation of the at end handler into a normal exception -- handler. + -- Aspect_Cancel (Flag11-Sem) + -- Processing of aspect specifications typically generates pragmas and + -- attribute definition clauses that are inserted into the tree after + -- the declaration node to get the desired aspect effect. In the case + -- of Boolean aspects that use "=> False" to cancel the effect of an + -- aspect (i.e. turn if off), the generated pragma has the Aspect_Cancel + -- flag set to indicate that the pragma operates in the opposite sense. + + -- Aspect_Rep_Item (Node2-Sem) + -- Present in N_Aspect_Specification nodes. Points to the corresponding + -- pragma/attribute definition node used to process the aspect. + -- 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 *************** package Sinfo is *** 793,798 **** --- 809,820 ---- -- for the default expression). Default_Expression is used for -- conformance checking. + -- Default_Storage_Pool (Node3-Sem) + -- This field is present in N_Compilation_Unit_Aux nodes. It is set to a + -- copy of Opt.Default_Pool at the end of the compilation unit. See + -- package Opt for details. This is used for inheriting the + -- Default_Storage_Pool in child units. + -- Discr_Check_Funcs_Built (Flag11-Sem) -- This flag is present in N_Full_Type_Declaration nodes. It is set when -- discriminant checking functions are constructed. The purpose is to *************** package Sinfo is *** 1056,1061 **** --- 1078,1089 ---- -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are -- set, it means that the front end can assure no overlap of operands. + -- From_Aspect_Specification (Flag13-Sem) + -- Processing of aspect specifications typically results in insertion in + -- the tree of corresponding pragma or attribute definition clause nodes. + -- These generated nodes have the From_Aspect_Specification flag set to + -- indicate that they came from aspect specifications originally. + -- From_At_End (Flag4-Sem) -- This flag is set on an N_Raise_Statement node if it corresponds to -- the reraise statement generated as the last statement of an AT END *************** package Sinfo is *** 1115,1121 **** -- generate elaboration code, and non-preelaborated packages which do -- not generate elaboration code. ! -- Has_Priority_Pragma (Flag6-Sem) -- A flag present in N_Subprogram_Body, N_Task_Definition and -- N_Protected_Definition nodes to flag the presence of either a Priority -- or Interrupt_Priority pragma in the declaration sequence (public or --- 1143,1163 ---- -- generate elaboration code, and non-preelaborated packages which do -- not generate elaboration code. ! -- Has_Pragma_CPU (Flag14-Sem) ! -- A flag present in N_Subprogram_Body and N_Task_Definition nodes to ! -- flag the presence of a CPU pragma in the declaration sequence (public ! -- or private in the task case). ! ! -- Has_Pragma_Suppress_All (Flag14-Sem) ! -- This flag is set in an N_Compilation_Unit node if the Suppress_All ! -- pragma appears anywhere in the unit. This accommodates the rather ! -- strange placement rules of other compilers (DEC permits it at the ! -- end of a unit, and Rational allows it as a program unit pragma). We ! -- allow it anywhere at all, and consider it equivalent to a pragma ! -- Suppress (All_Checks) appearing at the start of the configuration ! -- pragmas for the unit. ! ! -- Has_Pragma_Priority (Flag6-Sem) -- A flag present in N_Subprogram_Body, N_Task_Definition and -- N_Protected_Definition nodes to flag the presence of either a Priority -- or Interrupt_Priority pragma in the declaration sequence (public or *************** package Sinfo is *** 1172,1177 **** --- 1214,1224 ---- -- 'Address or 'Tag attribute. ???There are other implicit with clauses -- as well. + -- Import_Interface_Present (Flag16-Sem) + -- This flag is set in an Interface or Import pragma if a matching + -- pragma of the other kind is also present. This is used to avoid + -- generating some unwanted error messages. + -- 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 *************** package Sinfo is *** 1180,1185 **** --- 1227,1238 ---- -- range is given by the programmer, even if that range is identical to -- the range for Float. + -- Inherited_Discriminant (Flag13-Sem) + -- This flag is present in N_Component_Association nodes. It indicates + -- that a given component association in an extension aggregate is the + -- value obtained from a constraint on an ancestor. Used to prevent + -- double expansion when the aggregate has expansion delayed. + -- Instance_Spec (Node5-Sem) -- This field is present in generic instantiation nodes, and also in -- formal package declaration nodes (formal package declarations are *************** package Sinfo is *** 1205,1210 **** --- 1258,1268 ---- -- operand is of the component type of the result. Used in resolving -- concatenation nodes in instances. + -- Is_Delayed_Aspect (Flag14-Sem) + -- Present in N_Pragma and N_Attribute_Definition_Clause nodes which + -- come from aspect specifications, where the evaluation of the aspect + -- must be delayed to the freeze point. + -- Is_Controlling_Actual (Flag16-Sem) -- This flag is set on in an expression that is a controlling argument in -- a dispatching call. It is off in all other cases. See Sem_Disp for *************** package Sinfo is *** 1395,1400 **** --- 1453,1464 ---- -- scope are chained, and this field is used as the forward pointer for -- this list. See Einfo for further details. + -- Next_Exit_Statement (Node3-Sem) + -- Present in N_Exit_Statement nodes. The exit statements for a loop are + -- chained (in reverse order of appearance) from the First_Exit_Statement + -- field of the E_Loop entity for the loop. Next_Exit_Statement points to + -- the next entry on this chain (Empty = end of list). + -- Next_Implicit_With (Node3-Sem) -- Present in N_With_Clause. Part of a chain of with_clauses generated -- in rtsfind to indicate implicit dependencies on predefined units. Used *************** package Sinfo is *** 1402,1408 **** -- A postorder traversal of the tree whose nodes are units and whose -- links are with_clauses defines the order in which Inspector must -- examine a compiled unit and its full context. This ordering ensures ! -- that any subprogram call is examined after the subprogram declartion -- has been seen. -- Next_Named_Actual (Node4-Sem) --- 1466,1472 ---- -- A postorder traversal of the tree whose nodes are units and whose -- links are with_clauses defines the order in which Inspector must -- examine a compiled unit and its full context. This ordering ensures ! -- that any subprogram call is examined after the subprogram declaration -- has been seen. -- Next_Named_Actual (Node4-Sem) *************** package Sinfo is *** 1425,1433 **** -- 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 ! -- First_Rep_Item field in Einfo for full details. -- Next_Use_Clause (Node3-Sem) -- While use clauses are active during semantic processing, they are --- 1489,1498 ---- -- details). -- Next_Rep_Item (Node5-Sem) ! -- Present in pragma nodes, attribute definition nodes, enumeration rep ! -- clauses, record rep clauses, aspect specification nodes. Used to link ! -- representation items that apply to an entity. See full description of ! -- First_Rep_Item field in Einfo for further details. -- Next_Use_Clause (Node3-Sem) -- While use clauses are active during semantic processing, they are *************** package Sinfo is *** 1609,1618 **** -- Present in SCIL nodes. Used to reference the tagged type associated -- with the SCIL node. - -- SCIL_Related_Node (Node1-Sem) - -- Present in SCIL nodes. Used to reference a tree node that requires - -- special processing in the CodePeer backend. - -- SCIL_Controlling_Tag (Node5-Sem) -- Present in N_SCIL_Dispatching_Call nodes. Used to reference the -- controlling tag of a dispatching call. --- 1674,1679 ---- *************** package Sinfo is *** 1643,1648 **** --- 1704,1717 ---- -- source type entity for the unchecked conversion instantiation -- which gigi must do size validation for. + -- Split_PPC (Flag17) + -- When a Pre or Postaspect specification is processed, it is broken + -- into AND THEN sections. The left most section has Split_PPC set to + -- False, indicating that it is the original specification (e.g. for + -- posting errors). For other sections, Split_PPC is set to True. + -- This flag is set in both the N_Aspect_Specification node itself, + -- and in the pragma which is generated from this node. + -- Static_Processing_OK (Flag4-Sem) -- Present in N_Aggregate nodes. When the Compile_Time_Known_Aggregate -- flag is set, the full value of the aggregate can be determined at *************** package Sinfo is *** 1664,1669 **** --- 1733,1745 ---- -- value of a type whose size is not known at compile time on the -- secondary stack. + -- Suppress_Assignment_Checks (Flag18-Sem) + -- Used in generated N_Assignment_Statement nodes to suppress predicate + -- and range checks in cases where the generated code knows that the + -- value being assigned is in range and satisfies any predicate. Also + -- can be set in N_Object_Declaration nodes, to similarly suppress any + -- checks on the initializing value. + -- Suppress_Loop_Warnings (Flag17-Sem) -- Used in N_Loop_Statement node to indicate that warnings within the -- body of the loop should be suppressed. This is set when the range *************** package Sinfo is *** 1723,1728 **** --- 1799,1810 ---- -- Original_Node here because of the case of nested instantiations where -- the substituted node can be copied. + -- Withed_Body (Node1-Sem) + -- Present in N_With_Clause nodes. Set if the unit in whose context + -- the with_clause appears instantiates a generic contained in the + -- library unit of the with_clause and as a result loads its body. + -- Used for a more precise unit traversal for CodePeer. + -- Zero_Cost_Handling (Flag5-Sem) -- This flag is set in all handled sequence of statement and exception -- handler nodes if exceptions are to be handled using the zero-cost *************** package Sinfo is *** 1866,1872 **** -- Note: the value of an integer literal node created by the front end -- is never outside the range of values of the base type. However, it ! -- can be the case that the value is outside the range of the -- particular subtype. This happens in the case of integer overflows -- with checks suppressed. --- 1948,1954 ---- -- Note: the value of an integer literal node created by the front end -- is never outside the range of values of the base type. However, it ! -- can be the case that the created value is outside the range of the -- particular subtype. This happens in the case of integer overflows -- with checks suppressed. *************** package Sinfo is *** 1974,1986 **** -- which are explicitly documented. -- 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) -- Pragma_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 --- 2056,2074 ---- -- which are explicitly documented. -- N_Pragma ! -- Sloc points to PRAGMA -- Next_Pragma (Node1-Sem) -- Pragma_Argument_Associations (List2) (set to No_List if none) ! -- Debug_Statement (Node3) (set to Empty if not Debug) -- Pragma_Identifier (Node4) -- Next_Rep_Item (Node5-Sem) -- Pragma_Enabled (Flag5-Sem) + -- From_Aspect_Specification (Flag13-Sem) + -- Is_Delayed_Aspect (Flag14-Sem) + -- Import_Interface_Present (Flag16-Sem) + -- Aspect_Cancel (Flag11-Sem) + -- Split_PPC (Flag17) set if corresponding aspect had Split_PPC set + -- Class_Present (Flag6) set if from Aspect with 'Class -- 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 *************** package Sinfo is *** 1990,1996 **** -- Note: a utility function Pragma_Name may be applied to pragma nodes -- to conveniently obtain the Chars field of the Pragma_Identifier. ! -------------------------------------- -- 2.8 Pragma Argument Association -- -------------------------------------- --- 2078,2089 ---- -- Note: a utility function Pragma_Name may be applied to pragma nodes -- to conveniently obtain the Chars field of the Pragma_Identifier. ! -- Note: if From_Aspect_Specification is set, then Sloc points to the ! -- aspect name, as does the Pragma_Identifier. In this case if the ! -- pragma has a local name argument (such as pragma Inline), it is ! -- resolved to point to the specific entity affected by the pragma. ! ! -------------------------------------- -- 2.8 Pragma Argument Association -- -------------------------------------- *************** package Sinfo is *** 2068,2074 **** -- FULL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- is TYPE_DEFINITION; -- | TASK_TYPE_DECLARATION -- | PROTECTED_TYPE_DECLARATION --- 2161,2169 ---- -- FULL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- is TYPE_DEFINITION ! -- [ASPECT_SPECIFICATIONS]; ! -- | TASK_TYPE_DECLARATION -- | PROTECTED_TYPE_DECLARATION *************** package Sinfo is *** 2175,2185 **** -- OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ACCESS_DEFINITION [:= EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ARRAY_TYPE_DEFINITION [:= EXPRESSION]; -- | SINGLE_TASK_DECLARATION -- | SINGLE_PROTECTED_DECLARATION --- 2270,2283 ---- -- OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ACCESS_DEFINITION [:= EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] ! -- ARRAY_TYPE_DEFINITION [:= EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | SINGLE_TASK_DECLARATION -- | SINGLE_PROTECTED_DECLARATION *************** package Sinfo is *** 2240,2245 **** --- 2338,2344 ---- -- Exception_Junk (Flag8-Sem) -- Is_Subprogram_Descriptor (Flag16-Sem) -- Has_Init_Expression (Flag14) + -- Suppress_Assignment_Checks (Flag18-Sem) ------------------------------------- -- 3.3.1 Defining Identifier List -- *************** package Sinfo is *** 2790,2795 **** --- 2889,2895 ---- -- COMPONENT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION -- [:= DEFAULT_EXPRESSION] + -- [ASPECT_SPECIFICATIONS]; -- Note: although the syntax does not permit a component definition to -- be an anonymous array (and the parser will diagnose such an attempt *************** package Sinfo is *** 3328,3333 **** --- 3428,3434 ---- -- Loop_Actions (List2-Sem) -- Expression (Node3) -- Box_Present (Flag15) + -- Inherited_Discriminant (Flag13) -- Note: this structure is used for both record component associations -- and array component associations, since the two cases aren't always *************** package Sinfo is *** 3415,3428 **** -------------------------------------------------- -- EXPRESSION ::= ! -- RELATION {and RELATION} | RELATION {and then RELATION} ! -- | RELATION {or RELATION} | RELATION {or else RELATION} ! -- | RELATION {xor RELATION} ! -- RELATION ::= -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] ! -- | SIMPLE_EXPRESSION [not] in RANGE ! -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK -- SIMPLE_EXPRESSION ::= -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM} --- 3516,3539 ---- -------------------------------------------------- -- EXPRESSION ::= ! -- RELATION {LOGICAL_OPERATOR RELATION} ! -- CHOICE_EXPRESSION ::= ! -- CHOICE_RELATION {LOGICAL_OPERATOR CHOICE_RELATION} ! ! -- CHOICE_RELATION ::= -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] ! ! -- RELATION ::= ! -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST ! ! -- MEMBERSHIP_CHOICE_LIST ::= ! -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE} ! ! -- MEMBERSHIP_CHOICE ::= ! -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK ! ! -- LOGICAL_OPERATOR ::= and | and then | or | or else | xor -- SIMPLE_EXPRESSION ::= -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM} *************** package Sinfo is *** 3437,3442 **** --- 3548,3561 ---- -- constituent components of an expression (e.g. identifier is -- an example of an expression). + -- Note: the above syntax is that Ada 2012 syntax which restricts + -- choice relations to simple expressions to avoid ambiguities in + -- some contexts with set membership notation. It has been decided + -- that in retrospect, the Ada 95 change allowing general expressions + -- in this context was a mistake, so we have reverted to the above + -- syntax in Ada 95 and Ada 2005 modes (the restriction to simple + -- expressions was there in Ada 83 from the start). + ------------------ -- 4.4 Primary -- ------------------ *************** package Sinfo is *** 3522,3529 **** --------------------------- -- RELATION ::= ! -- SIMPLE_EXPRESSION [not] in RANGE ! -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK -- Note: although the grammar above allows only a range or a subtype -- mark, the parser in fact will accept any simple expression in place --- 3641,3653 ---- --------------------------- -- RELATION ::= ! -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST ! ! -- MEMBERSHIP_CHOICE_LIST ::= ! -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE} ! ! -- MEMBERSHIP_CHOICE ::= ! -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK -- Note: although the grammar above allows only a range or a subtype -- mark, the parser in fact will accept any simple expression in place *************** package Sinfo is *** 3531,3549 **** -- to deal with, and diagnose a simple expression other than a name for -- the right operand. This simplifies error recovery in the parser. ! -- If extensions are enabled, the grammar is as follows: ! ! -- RELATION ::= ! -- SIMPLE_EXPRESSION [not] in SET_ALTERNATIVE {| SET_ALTERNATIVE} ! ! -- SET_ALTERNATIVE ::= RANGE | SUBTYPE_MARK ! -- The Alternatives field below is present only if there is more than ! -- one Set_Alternative present, in which case Right_Opnd is set to ! -- Empty, and Alternatives contains the list of alternatives. In the ! -- tree passed to the back end, Alternatives is always No_List, and ! -- Right_Opnd is set (i.e. the expansion circuitry expands out the ! -- complex set membership case using simple membership operations). -- N_In -- Sloc points to IN --- 3655,3669 ---- -- to deal with, and diagnose a simple expression other than a name for -- the right operand. This simplifies error recovery in the parser. ! -- The Alternatives field below is present only if there is more ! -- than one Membership_Choice present (which is legitimate only in ! -- Ada 2012 mode) in which case Right_Opnd is Empty, and Alternatives ! -- contains the list of choices. In the tree passed to the back end, ! -- Alternatives is always No_List, and Right_Opnd is set (i.e. the ! -- expansion circuitry expands out the complex set membership case ! -- using simple membership operations). ! -- Should we rename Alternatives here to Membership_Choices ??? -- N_In -- Sloc points to IN *************** package Sinfo is *** 3724,3729 **** --- 3844,3869 ---- -- point operands if the Treat_Fixed_As_Integer flag is set and will -- thus treat these nodes in identical manner, ignoring small values. + --------------------------------- + -- 4.5.9 Quantified Expression -- + --------------------------------- + + -- QUANTIFIED_EXPRESSION ::= + -- for QUANTIFIER LOOP_PARAMETER_SPECIFICATION => PREDICATE + -- | for QUANTIFIER ITERATOR_SPECIFICATION => PREDICATE + -- + -- QUANTIFIER ::= all | some + + -- At most one of (Iterator_Specification, Loop_Parameter_Specification) + -- is present at a time, in which case the other one is empty. + + -- N_Quantified_Expression + -- Sloc points to FOR + -- Iterator_Specification (Node2) + -- Loop_Parameter_Specification (Node4) + -- Condition (Node1) + -- All_Present (Flag15) + -------------------------- -- 4.6 Type Conversion -- -------------------------- *************** package Sinfo is *** 3890,3895 **** --- 4030,4039 ---- -- Identifier (Node1) direct name of statement identifier -- Exception_Junk (Flag8-Sem) + -- Note: Before Ada 2012, a label is always followed by a statement, + -- and this is true in the tree even in Ada 2012 mode (the parser + -- inserts a null statement marked with Comes_From_Source False). + ------------------------------- -- 5.1 Statement Identifier -- ------------------------------- *************** package Sinfo is *** 3916,3921 **** --- 4060,4066 ---- -- Backwards_OK (Flag6-Sem) -- No_Ctrl_Actions (Flag7-Sem) -- Componentwise_Assignment (Flag14-Sem) + -- Suppress_Assignment_Checks (Flag18-Sem) -- Note: if a range check is required, then the Do_Range_Check flag -- is set in the Expression (right hand side), with the check being *************** package Sinfo is *** 3985,3990 **** --- 4130,4140 ---- -- Alternatives (List4) -- End_Span (Uint5) (set to No_Uint if expander generated) + -- Note: Before Ada 2012, a pragma in a statement sequence is always + -- followed by a statement, and this is true in the tree even in Ada + -- 2012 mode (the parser inserts a null statement marked with the flag + -- Comes_From_Source False). + ------------------------------------- -- 5.4 Case Statement Alternative -- ------------------------------------- *************** package Sinfo is *** 4034,4045 **** -- Is_Null_Loop (Flag16) -- Suppress_Loop_Warnings (Flag17) -------------------------- -- 5.5 Iteration Scheme -- -------------------------- -- ITERATION_SCHEME ::= ! -- while CONDITION | for LOOP_PARAMETER_SPECIFICATION -- Gigi restriction: This expander ensures that the type of the -- Condition field is always Standard.Boolean, even if the type --- 4184,4208 ---- -- Is_Null_Loop (Flag16) -- Suppress_Loop_Warnings (Flag17) + -- Note: the parser fills in the Identifier field if there is an + -- explicit loop identifier. Otherwise the parser leaves this field + -- set to Empty, and then the semantic processing for a loop statement + -- creates an identifier, setting the Has_Created_Identifier flag to + -- True. So after semantic analysis, the Identifier is always set, + -- referencing an identifier whose entity has an Ekind of E_Loop. + -------------------------- -- 5.5 Iteration Scheme -- -------------------------- -- ITERATION_SCHEME ::= ! -- while CONDITION ! -- | for LOOP_PARAMETER_SPECIFICATION ! -- | for ITERATOR_SPECIFICATION ! ! -- At most one of (Iterator_Specification, Loop_Parameter_Specification) ! -- is present at a time, in which case the other one is empty. Both are ! -- empty in the case of a WHILE loop. -- Gigi restriction: This expander ensures that the type of the -- Condition field is always Standard.Boolean, even if the type *************** package Sinfo is *** 4049,4054 **** --- 4212,4218 ---- -- Sloc points to WHILE or FOR -- Condition (Node1) (set to Empty if FOR case) -- Condition_Actions (List3-Sem) + -- Iterator_Specification (Node2) (set to Empty if WHILE case) -- Loop_Parameter_Specification (Node4) (set to Empty if WHILE case) --------------------------------------- *************** package Sinfo is *** 4064,4069 **** --- 4228,4251 ---- -- Reverse_Present (Flag15) -- Discrete_Subtype_Definition (Node4) + ---------------------------------- + -- 5.5.1 Iterator specification -- + ---------------------------------- + + -- ITERATOR_SPECIFICATION ::= + -- DEFINING_IDENTIFIER in [reverse] NAME + -- | DEFINING_IDENTIFIER [: SUBTYPE_INDICATION] of [reverse] NAME + + -- N_Iterator_Specification + -- Sloc points to defining identifier + -- Defining_Identifier (Node1) + -- Name (Node2) + -- Reverse_Present (Flag15) + -- Of_Present (Flag16) + -- Subtype_Indication (Node5) + + -- Note: The Of_Present flag distinguishes the two forms + -------------------------- -- 5.6 Block Statement -- -------------------------- *************** package Sinfo is *** 4122,4128 **** -- N_Exit_Statement -- Sloc points to EXIT -- Name (Node2) (set to Empty if no loop name present) ! -- Condition (Node1) (set to Empty if no when part present) ------------------------- -- 5.9 Goto Statement -- --- 4304,4311 ---- -- N_Exit_Statement -- Sloc points to EXIT -- Name (Node2) (set to Empty if no loop name present) ! -- Condition (Node1) (set to Empty if no WHEN part present) ! -- Next_Exit_Statement (Node3-Sem): Next exit on chain ------------------------- -- 5.9 Goto Statement -- *************** package Sinfo is *** 4139,4145 **** -- 6.1 Subprogram Declaration -- --------------------------------- ! -- SUBPROGRAM_DECLARATION ::= SUBPROGRAM_SPECIFICATION; -- N_Subprogram_Declaration -- Sloc points to FUNCTION or PROCEDURE --- 4322,4330 ---- -- 6.1 Subprogram Declaration -- --------------------------------- ! -- SUBPROGRAM_DECLARATION ::= ! -- SUBPROGRAM_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- N_Subprogram_Declaration -- Sloc points to FUNCTION or PROCEDURE *************** package Sinfo is *** 4153,4159 **** ------------------------------------------ -- ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- SUBPROGRAM_SPECIFICATION is abstract; -- N_Abstract_Subprogram_Declaration -- Sloc points to ABSTRACT --- 4338,4345 ---- ------------------------------------------ -- ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- SUBPROGRAM_SPECIFICATION is abstract ! -- [ASPECT_SPECIFICATIONS]; -- N_Abstract_Subprogram_Declaration -- Sloc points to ABSTRACT *************** package Sinfo is *** 4382,4393 **** -- Acts_As_Spec (Flag4-Sem) -- Bad_Is_Detected (Flag15) used only by parser -- Do_Storage_Check (Flag17-Sem) ! -- Has_Priority_Pragma (Flag6-Sem) -- Is_Protected_Subprogram_Body (Flag7-Sem) -- 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 -- --- 4568,4595 ---- -- Acts_As_Spec (Flag4-Sem) -- Bad_Is_Detected (Flag15) used only by parser -- Do_Storage_Check (Flag17-Sem) ! -- Has_Pragma_Priority (Flag6-Sem) -- Is_Protected_Subprogram_Body (Flag7-Sem) -- Is_Entry_Barrier_Function (Flag8-Sem) -- Is_Task_Master (Flag5-Sem) -- Was_Originally_Stub (Flag13-Sem) -- Has_Relative_Deadline_Pragma (Flag9-Sem) + -- Has_Pragma_CPU (Flag14-Sem) + + ------------------------------ + -- Parameterized Expression -- + ------------------------------ + + -- This is an Ada 2012 extension, we put it here for now, to be labeled + -- and put in its proper section when we know exactly where that is! + + -- PARAMETERIZED_EXPRESSION ::= + -- FUNCTION SPECIFICATION IS (EXPRESSION); + + -- N_Parameterized_Expression + -- Sloc points to FUNCTION + -- Specification (Node1) + -- Expression (Node3) ----------------------------------- -- 6.4 Procedure Call Statement -- *************** package Sinfo is *** 4533,4541 **** --- 4735,4746 ---- -- By_Ref (Flag5-Sem) -- Note: Return_Statement_Entity points to an E_Return_Statement. + -- Note that Return_Object_Declarations is a list containing the -- N_Object_Declaration -- see comment on this field above. + -- The declared object will have Is_Return_Object = True. + -- There is no such syntactic category as return_object_declaration -- in the RM. Return_Object_Declarations represents this portion of -- the syntax for EXTENDED_RETURN_STATEMENT: *************** package Sinfo is *** 4552,4558 **** -- 7.1 Package Declaration -- ------------------------------ ! -- PACKAGE_DECLARATION ::= PACKAGE_SPECIFICATION; -- Note: the activation chain entity for a package spec is used for -- all tasks declared in the package spec, or in the package body. --- 4757,4765 ---- -- 7.1 Package Declaration -- ------------------------------ ! -- PACKAGE_DECLARATION ::= ! -- PACKAGE_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- Note: the activation chain entity for a package spec is used for -- all tasks declared in the package spec, or in the package body. *************** package Sinfo is *** 4677,4691 **** -- 8.4 Use Type Clause -- -------------------------- ! -- USE_TYPE_CLAUSE ::= use type SUBTYPE_MARK {, SUBTYPE_MARK}; -- Note: use type clause is not permitted in Ada 83 mode -- N_Use_Type_Clause -- Sloc points to USE -- Subtype_Marks (List2) -- Next_Use_Clause (Node3-Sem) -- Hidden_By_Use_Clause (Elist4-Sem) ------------------------------- -- 8.5 Renaming Declaration -- --- 4884,4901 ---- -- 8.4 Use Type Clause -- -------------------------- ! -- USE_TYPE_CLAUSE ::= use [ALL] type SUBTYPE_MARK {, SUBTYPE_MARK}; -- Note: use type clause is not permitted in Ada 83 mode + -- Note: the ALL keyword can appear only in Ada 2012 mode + -- N_Use_Type_Clause -- Sloc points to USE -- Subtype_Marks (List2) -- Next_Use_Clause (Node3-Sem) -- Hidden_By_Use_Clause (Elist4-Sem) + -- All_Present (Flag15) ------------------------------- -- 8.5 Renaming Declaration -- *************** package Sinfo is *** 4798,4804 **** -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- N_Task_Type_Declaration -- Sloc points to TASK --- 5008,5015 ---- -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION] ! -- [ASPECT_SPECIFICATIONS]; -- N_Task_Type_Declaration -- Sloc points to TASK *************** package Sinfo is *** 4815,4821 **** -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- N_Single_Task_Declaration -- Sloc points to TASK --- 5026,5033 ---- -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER ! -- [is [new INTERFACE_LIST with] TASK_DEFINITION] ! -- [ASPECT_SPECIFICATIONS]; -- N_Single_Task_Declaration -- Sloc points to TASK *************** package Sinfo is *** 4841,4851 **** -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private part) -- End_Label (Node4) ! -- Has_Priority_Pragma (Flag6-Sem) -- 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 -- --- 5053,5064 ---- -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private part) -- End_Label (Node4) ! -- Has_Pragma_Priority (Flag6-Sem) -- Has_Storage_Size_Pragma (Flag5-Sem) -- Has_Task_Info_Pragma (Flag7-Sem) -- Has_Task_Name_Pragma (Flag8-Sem) -- Has_Relative_Deadline_Pragma (Flag9-Sem) + -- Has_Pragma_CPU (Flag14-Sem) -------------------- -- 9.1 Task Item -- *************** package Sinfo is *** 4882,4888 **** -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- Note: protected type declarations are not permitted in Ada 83 mode --- 5095,5102 ---- -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] ! -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION ! -- {ASPECT_SPECIFICATIONS]; -- Note: protected type declarations are not permitted in Ada 83 mode *************** package Sinfo is *** 4901,4907 **** -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER ! -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- Note: single protected declarations are not allowed in Ada 83 mode --- 5115,5122 ---- -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER ! -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION ! -- [ASPECT_SPECIFICATIONS]; -- Note: single protected declarations are not allowed in Ada 83 mode *************** package Sinfo is *** 4926,4932 **** -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private part) -- End_Label (Node4) ! -- Has_Priority_Pragma (Flag6-Sem) ------------------------------------------ -- 9.4 Protected Operation Declaration -- --- 5141,5147 ---- -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private part) -- End_Label (Node4) ! -- Has_Pragma_Priority (Flag6-Sem) ------------------------------------------ -- 9.4 Protected Operation Declaration -- *************** package Sinfo is *** 5425,5432 **** -- the library item. -- To deal with all these problems, we create an auxiliary node for ! -- a compilation unit, referenced from the N_Compilation_Unit node ! -- that contains these three items. -- N_Compilation_Unit -- Sloc points to first token of defining unit name --- 5640,5647 ---- -- the library item. -- To deal with all these problems, we create an auxiliary node for ! -- a compilation unit, referenced from the N_Compilation_Unit node, ! -- that contains these items. -- N_Compilation_Unit -- Sloc points to first token of defining unit name *************** package Sinfo is *** 5440,5445 **** --- 5655,5661 ---- -- Acts_As_Spec (Flag4-Sem) flag for subprogram body with no spec -- Context_Pending (Flag16-Sem) -- First_Inlined_Subprogram (Node3-Sem) + -- Has_Pragma_Suppress_All (Flag14-Sem) -- N_Compilation_Unit_Aux -- Sloc is a copy of the Sloc from the N_Compilation_Unit node *************** package Sinfo is *** 5447,5452 **** --- 5663,5669 ---- -- Actions (List1) (set to No_List if no actions) -- Pragmas_After (List5) pragmas after unit (set to No_List if none) -- Config_Pragmas (List4) config pragmas (set to Empty_List if none) + -- Default_Storage_Pool (Node3-Sem) -------------------------- -- 10.1.1 Library Item -- *************** package Sinfo is *** 5530,5535 **** --- 5747,5753 ---- -- N_With_Clause -- Sloc points to first token of library unit name + -- Withed_Body (Node1-Sem) -- Name (Node2) -- Next_Implicit_With (Node3-Sem) -- Library_Unit (Node4-Sem) *************** package Sinfo is *** 5543,5549 **** -- Elaborate_Desirable (Flag11-Sem) -- Private_Present (Flag15) set if with_clause has private keyword -- Implicit_With (Flag16-Sem) ! -- Limited_Present (Flag17) set if LIMITED is present -- Limited_View_Installed (Flag18-Sem) -- Unreferenced_In_Spec (Flag7-Sem) -- No_Entities_Ref_In_Spec (Flag8-Sem) --- 5761,5767 ---- -- Elaborate_Desirable (Flag11-Sem) -- Private_Present (Flag15) set if with_clause has private keyword -- Implicit_With (Flag16-Sem) ! -- Limited_Present (Flag17) set if LIMITED is present -- Limited_View_Installed (Flag18-Sem) -- Unreferenced_In_Spec (Flag7-Sem) -- No_Entities_Ref_In_Spec (Flag8-Sem) *************** package Sinfo is *** 5641,5647 **** -- 11.1 Exception Declaration -- --------------------------------- ! -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception; -- For consistency with object declarations etc., the parser converts -- the case of multiple identifiers being declared to a series of --- 5859,5866 ---- -- 11.1 Exception Declaration -- --------------------------------- ! -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception ! -- [ASPECT_SPECIFICATIONS]; -- For consistency with object declarations etc., the parser converts -- the case of multiple identifiers being declared to a series of *************** package Sinfo is *** 5810,5816 **** --------------------------------------- -- GENERIC_PACKAGE_DECLARATION ::= ! -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION; -- Note: when we do generics right, the Activation_Chain_Entity entry -- for this node can be removed (since the expander won't see generic --- 6029,6036 ---- --------------------------------------- -- GENERIC_PACKAGE_DECLARATION ::= ! -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION ! -- [ASPECT_SPECIFICATIONS]; -- Note: when we do generics right, the Activation_Chain_Entity entry -- for this node can be removed (since the expander won't see generic *************** package Sinfo is *** 5849,5861 **** -- GENERIC_INSTANTIATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is ! -- new generic_package_NAME [GENERIC_ACTUAL_PART]; -- | [[not] overriding] -- procedure DEFINING_PROGRAM_UNIT_NAME is ! -- new generic_procedure_NAME [GENERIC_ACTUAL_PART]; -- | [[not] overriding] -- function DEFINING_DESIGNATOR is ! -- new generic_function_NAME [GENERIC_ACTUAL_PART]; -- N_Package_Instantiation -- Sloc points to PACKAGE --- 6069,6084 ---- -- GENERIC_INSTANTIATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is ! -- new generic_package_NAME [GENERIC_ACTUAL_PART] ! -- [ASPECT_SPECIFICATIONS]; -- | [[not] overriding] -- procedure DEFINING_PROGRAM_UNIT_NAME is ! -- new generic_procedure_NAME [GENERIC_ACTUAL_PART] ! -- [ASPECT_SPECIFICATIONS]; -- | [[not] overriding] -- function DEFINING_DESIGNATOR is ! -- new generic_function_NAME [GENERIC_ACTUAL_PART] ! -- [ASPECT_SPECIFICATIONS]; -- N_Package_Instantiation -- Sloc points to PACKAGE *************** package Sinfo is *** 5939,5947 **** -- FORMAL_OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : ! -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : ! -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION]; -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with --- 6162,6172 ---- -- FORMAL_OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : ! -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : ! -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION] ! -- [ASPECT_SPECIFICATIONS]; -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with *************** package Sinfo is *** 5969,5975 **** -- FORMAL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] ! -- is FORMAL_TYPE_DEFINITION; -- N_Formal_Type_Declaration -- Sloc points to TYPE --- 6194,6201 ---- -- FORMAL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] ! -- is FORMAL_TYPE_DEFINITION ! -- [ASPECT_SPECIFICATIONS]; -- N_Formal_Type_Declaration -- Sloc points to TYPE *************** package Sinfo is *** 6116,6122 **** -------------------------------------------------- -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT]; -- N_Formal_Concrete_Subprogram_Declaration -- Sloc points to WITH --- 6342,6349 ---- -------------------------------------------------- -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT] ! -- [ASPECT_SPECIFICATIONS]; -- N_Formal_Concrete_Subprogram_Declaration -- Sloc points to WITH *************** package Sinfo is *** 6132,6138 **** -------------------------------------------------- -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT]; -- N_Formal_Abstract_Subprogram_Declaration -- Sloc points to WITH --- 6359,6366 ---- -------------------------------------------------- -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::= ! -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT] ! -- [ASPECT_SPECIFICATIONS]; -- N_Formal_Abstract_Subprogram_Declaration -- Sloc points to WITH *************** package Sinfo is *** 6166,6172 **** -- FORMAL_PACKAGE_DECLARATION ::= -- with package DEFINING_IDENTIFIER ! -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART; -- Note: formal package declarations not allowed in Ada 83 mode --- 6394,6401 ---- -- FORMAL_PACKAGE_DECLARATION ::= -- with package DEFINING_IDENTIFIER ! -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART ! -- [ASPECT_SPECIFICATIONS]; -- Note: formal package declarations not allowed in Ada 83 mode *************** package Sinfo is *** 6266,6273 **** --- 6495,6556 ---- -- Next_Rep_Item (Node5-Sem) -- From_At_Mod (Flag4-Sem) -- Check_Address_Alignment (Flag11-Sem) + -- From_Aspect_Specification (Flag13-Sem) + -- Is_Delayed_Aspect (Flag14-Sem) -- Address_Warning_Posted (Flag18-Sem) + -- Note: if From_Aspect_Specification is set, then Sloc points to the + -- aspect name, and Entity is resolved already to reference the entity + -- to which the aspect applies. + + ----------------------------------- + -- 13.3.1 Aspect Specifications -- + ----------------------------------- + + -- We modify the RM grammar here, the RM grammar is: + + -- ASPECT_SPECIFICATION ::= + -- with ASPECT_MARK [=> ASPECT_DEFINITION] {. + -- ASPECT_MARK [=> ASPECT_DEFINITION] } + + -- ASPECT_MARK ::= aspect_IDENTIFIER['Class] + + -- ASPECT_DEFINITION ::= NAME | EXPRESSION + + -- That's inconvenient, since there is no non-terminal name for a single + -- entry in the list of aspects. So we use this grammar instead: + + -- ASPECT_SPECIFICATIONS ::= + -- with ASPECT_SPECIFICATION {, ASPECT_SPECIFICATION} + + -- ASPECT_SPECIFICATION => + -- ASPECT_MARK [=> ASPECT_DEFINITION] + + -- ASPECT_MARK ::= aspect_IDENTIFIER['Class] + + -- ASPECT_DEFINITION ::= NAME | EXPRESSION + + -- See separate package Aspects for details on the incorporation of + -- these nodes into the tree, and how aspect specifications for a given + -- declaration node are associated with that node. + + -- N_Aspect_Specification + -- Sloc points to aspect identifier + -- Identifier (Node1) aspect identifier + -- Aspect_Rep_Item (Node2-Sem) + -- Expression (Node3) Aspect_Definition (set to Empty if none) + -- Entity (Node4-Sem) entity to which the aspect applies + -- Class_Present (Flag6) Set if 'Class present + -- Next_Rep_Item (Node5-Sem) + -- Split_PPC (Flag17) Set if split pre/post attribute + + -- Note: Aspect_Specification is an Ada 2012 feature + + -- Note: When a Pre or Post aspect specification is processed, it is + -- broken into AND THEN sections. The left most section has Split_PPC + -- set to False, indicating that it is the original specification (e.g. + -- for posting errors). For the other sections, Split_PPC is set True. + --------------------------------------------- -- 13.4 Enumeration representation clause -- --------------------------------------------- *************** package Sinfo is *** 6509,6518 **** -- reconstructed tree printed by Sprint, and the node descriptions here -- show this syntax. ! -- Note: Conditional_Expression is in this section for historical reasons. ! -- We will move it to its appropriate place when it is officially approved ! -- as an extension (and then we will know what the exact grammar and place ! -- in the Reference Manual is!) ---------------------------- -- Conditional Expression -- --- 6792,6837 ---- -- reconstructed tree printed by Sprint, and the node descriptions here -- show this syntax. ! -- Note: Case_Expression and Conditional_Expression is in this section for ! -- now, since they are extensions. We will move them to their appropriate ! -- places when they are officially approved as extensions (and then we will ! -- know what the exact grammar and place in the Reference Manual is!) ! ! --------------------- ! -- Case Expression -- ! --------------------- ! ! -- CASE_EXPRESSION ::= ! -- case EXPRESSION is ! -- CASE_EXPRESSION_ALTERNATIVE ! -- {CASE_EXPRESSION_ALTERNATIVE} ! ! -- Note that the Alternatives cannot include pragmas (this contrasts ! -- with the situation of case statements where pragmas are allowed). ! ! -- N_Case_Expression ! -- Sloc points to CASE ! -- Expression (Node3) ! -- Alternatives (List4) ! ! --------------------------------- ! -- Case Expression Alternative -- ! --------------------------------- ! ! -- CASE_STATEMENT_ALTERNATIVE ::= ! -- when DISCRETE_CHOICE_LIST => ! -- EXPRESSION ! ! -- N_Case_Expression_Alternative ! -- Sloc points to WHEN ! -- Actions (List1) ! -- Discrete_Choices (List4) ! -- Expression (Node3) ! ! -- Note: The Actions field temporarily holds any actions associated with ! -- evaluation of the Expression. During expansion of the case expression ! -- these actions are wrapped into an N_Expressions_With_Actions node ! -- replacing the original expression. ---------------------------- -- Conditional Expression -- *************** package Sinfo is *** 6540,6546 **** -- And we add the additional constructs ! -- PRIMARY ::= ( CONDITIONAL_EXPRESION ) -- PRAGMA_ARGUMENT_ASSOCIATION ::= CONDITIONAL_EXPRESSION -- Note: if we have (IF x1 THEN x2 ELSIF x3 THEN x4 ELSE x5) then it --- 6859,6865 ---- -- And we add the additional constructs ! -- PRIMARY ::= ( CONDITIONAL_EXPRESSION ) -- PRAGMA_ARGUMENT_ASSOCIATION ::= CONDITIONAL_EXPRESSION -- Note: if we have (IF x1 THEN x2 ELSIF x3 THEN x4 ELSE x5) then it *************** package Sinfo is *** 6583,6588 **** --- 6902,6947 ---- -- Has_Private_View (Flag11-Sem) set in generic units. -- plus fields for expression + ----------------------------- + -- Expression with Actions -- + ----------------------------- + + -- This node is created by the analyzer/expander to handle some + -- expansion cases, notably short circuit forms where there are + -- actions associated with the right hand operand. + + -- The N_Expression_With_Actions node represents an expression with + -- an associated set of actions (which are executable statements and + -- declarations, as might occur in a handled statement sequence). + + -- The required semantics is that the set of actions is executed in + -- the order in which it appears just before the expression is + -- evaluated (and these actions must only be executed if the value + -- of the expression is evaluated). The node is considered to be + -- a subexpression, whose value is the value of the Expression after + -- executing all the actions. + + -- Note: if the actions contain declarations, then these declarations + -- maybe referenced with in the expression. It is thus appropriate for + -- the back end to create a scope that encompasses the construct (any + -- declarations within the actions will definitely not be referenced + -- once elaboration of the construct is completed). + + -- Sprint syntax: do + -- action; + -- action; + -- ... + -- action; + -- in expression end + + -- N_Expression_With_Actions + -- Actions (List1) + -- Expression (Node3) + -- plus fields for expression + + -- Note: the actions list is always non-null, since we would + -- never have created this node if there weren't some actions. + -------------------- -- Free Statement -- -------------------- *************** package Sinfo is *** 6883,6916 **** -- Meanwhile these nodes should be considered in experimental form, and -- should be ignored by all code generating back ends. ??? - -- N_SCIL_Dispatch_Table_Object_Init - -- Sloc references a declaration node containing a dispatch table - -- SCIL_Related_Node (Node1-Sem) - -- SCIL_Entity (Node4-Sem) - -- N_SCIL_Dispatch_Table_Tag_Init -- Sloc references a node for a tag initialization - -- SCIL_Related_Node (Node1-Sem) -- SCIL_Entity (Node4-Sem) -- N_SCIL_Dispatching_Call -- Sloc references the node of a dispatching call - -- SCIL_Related_Node (Node1-Sem) -- SCIL_Target_Prim (Node2-Sem) -- SCIL_Entity (Node4-Sem) -- SCIL_Controlling_Tag (Node5-Sem) -- N_SCIL_Membership_Test -- Sloc references the node of a membership test - -- SCIL_Related_Node (Node1-Sem) -- SCIL_Tag_Value (Node5-Sem) -- SCIL_Entity (Node4-Sem) - -- N_SCIL_Tag_Init - -- Sloc references the node of a tag component initialization - -- SCIL_Related_Node (Node1-Sem) - -- SCIL_Entity (Node4-Sem) - --------------------- -- Subprogram_Info -- --------------------- --- 7242,7262 ---- *************** package Sinfo is *** 7045,7054 **** -------------------------- -- The following is the definition of the Node_Kind type. As previously ! -- discussed, this is separated off to allow rearrangement of the order ! -- 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. type Node_Kind is ( N_Unused_At_Start, --- 7391,7400 ---- -------------------------- -- The following is the definition of the Node_Kind type. As previously ! -- discussed, this is separated off to allow rearrangement of the order 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. type Node_Kind is ( N_Unused_At_Start, *************** package Sinfo is *** 7167,7178 **** --- 7513,7526 ---- N_Conditional_Expression, N_Explicit_Dereference, + N_Expression_With_Actions, N_Function_Call, N_Indexed_Component, N_Integer_Literal, N_Null, N_Procedure_Call_Statement, N_Qualified_Expression, + N_Quantified_Expression, -- N_Raise_xxx_Error, N_Subexpr, N_Has_Etype *************** package Sinfo is *** 7184,7189 **** --- 7532,7538 ---- N_Aggregate, N_Allocator, + N_Case_Expression, N_Extension_Aggregate, N_Range, N_Real_Literal, *************** package Sinfo is *** 7208,7215 **** --- 7557,7566 ---- N_Formal_Type_Declaration, N_Full_Type_Declaration, N_Incomplete_Type_Declaration, + N_Iterator_Specification, N_Loop_Parameter_Specification, N_Object_Declaration, + N_Parameterized_Expression, N_Protected_Type_Declaration, N_Private_Extension_Declaration, N_Private_Type_Declaration, *************** package Sinfo is *** 7350,7360 **** -- SCIL nodes - N_SCIL_Dispatch_Table_Object_Init, N_SCIL_Dispatch_Table_Tag_Init, N_SCIL_Dispatching_Call, N_SCIL_Membership_Test, - N_SCIL_Tag_Init, -- Other nodes (not part of any subtype class) --- 7701,7709 ---- *************** package Sinfo is *** 7362,7367 **** --- 7711,7718 ---- N_Abstract_Subprogram_Declaration, N_Access_Definition, N_Access_To_Object_Definition, + N_Aspect_Specification, + N_Case_Expression_Alternative, N_Case_Statement_Alternative, N_Compilation_Unit, N_Compilation_Unit_Aux, *************** package Sinfo is *** 7487,7493 **** N_Expanded_Name .. N_Attribute_Reference; -- Nodes that have Entity fields ! -- Warning: DOES NOT INCLUDE N_Freeze_Entity! subtype N_Has_Etype is Node_Kind range N_Error .. --- 7838,7845 ---- N_Expanded_Name .. N_Attribute_Reference; -- Nodes that have Entity fields ! -- Warning: DOES NOT INCLUDE N_Freeze_Entity, N_Aspect_Specification, ! -- or N_Attribute_Definition_Clause. subtype N_Has_Etype is Node_Kind range N_Error .. *************** package Sinfo is *** 7567,7574 **** N_Or_Else; subtype N_SCIL_Node is Node_Kind range ! N_SCIL_Dispatch_Table_Object_Init .. ! N_SCIL_Tag_Init; subtype N_Statement_Other_Than_Procedure_Call is Node_Kind range N_Abort_Statement .. --- 7919,7926 ---- N_Or_Else; subtype N_SCIL_Node is Node_Kind range ! N_SCIL_Dispatch_Table_Tag_Init .. ! N_SCIL_Membership_Test; subtype N_Statement_Other_Than_Procedure_Call is Node_Kind range N_Abort_Statement .. *************** package Sinfo is *** 7679,7684 **** --- 8031,8042 ---- function Array_Aggregate (N : Node_Id) return Node_Id; -- Node3 + function Aspect_Cancel + (N : Node_Id) return Boolean; -- Flag11 + + function Aspect_Rep_Item + (N : Node_Id) return Node_Id; -- Node2 + function Assignment_OK (N : Node_Id) return Boolean; -- Flag15 *************** package Sinfo is *** 7727,7732 **** --- 8085,8093 ---- function Choices (N : Node_Id) return List_Id; -- List1 + function Class_Present + (N : Node_Id) return Boolean; -- Flag6 + function Coextensions (N : Node_Id) return Elist_Id; -- Elist4 *************** package Sinfo is *** 7820,7825 **** --- 8181,8189 ---- function Default_Expression (N : Node_Id) return Node_Id; -- Node5 + function Default_Storage_Pool + (N : Node_Id) return Node_Id; -- Node3 + function Default_Name (N : Node_Id) return Node_Id; -- Node2 *************** package Sinfo is *** 8000,8005 **** --- 8364,8372 ---- function Forwards_OK (N : Node_Id) return Boolean; -- Flag5 + function From_Aspect_Specification + (N : Node_Id) return Boolean; -- Flag13 + function From_At_End (N : Node_Id) return Boolean; -- Flag4 *************** package Sinfo is *** 8045,8053 **** function Has_No_Elaboration_Code (N : Node_Id) return Boolean; -- Flag17 ! function Has_Priority_Pragma (N : Node_Id) return Boolean; -- Flag6 function Has_Private_View (N : Node_Id) return Boolean; -- Flag11 --- 8412,8426 ---- function Has_No_Elaboration_Code (N : Node_Id) return Boolean; -- Flag17 ! function Has_Pragma_CPU ! (N : Node_Id) return Boolean; -- Flag14 ! ! function Has_Pragma_Priority (N : Node_Id) return Boolean; -- Flag6 + function Has_Pragma_Suppress_All + (N : Node_Id) return Boolean; -- Flag14 + function Has_Private_View (N : Node_Id) return Boolean; -- Flag11 *************** package Sinfo is *** 8090,8101 **** --- 8463,8480 ---- function Implicit_With (N : Node_Id) return Boolean; -- Flag16 + function Import_Interface_Present + (N : Node_Id) return Boolean; -- Flag16 + function In_Present (N : Node_Id) return Boolean; -- Flag15 function Includes_Infinities (N : Node_Id) return Boolean; -- Flag11 + function Inherited_Discriminant + (N : Node_Id) return Boolean; -- Flag13 + function Instance_Spec (N : Node_Id) return Node_Id; -- Node5 *************** package Sinfo is *** 8117,8122 **** --- 8496,8504 ---- function Is_Controlling_Actual (N : Node_Id) return Boolean; -- Flag16 + function Is_Delayed_Aspect + (N : Node_Id) return Boolean; -- Flag14 + function Is_Dynamic_Coextension (N : Node_Id) return Boolean; -- Flag18 *************** package Sinfo is *** 8168,8173 **** --- 8550,8558 ---- function Iteration_Scheme (N : Node_Id) return Node_Id; -- Node2 + function Iterator_Specification + (N : Node_Id) return Node_Id; -- Node2 + function Itype (N : Node_Id) return Entity_Id; -- Node1 *************** package Sinfo is *** 8240,8245 **** --- 8625,8633 ---- function Next_Entity (N : Node_Id) return Node_Id; -- Node2 + function Next_Exit_Statement + (N : Node_Id) return Node_Id; -- Node3 + function Next_Implicit_With (N : Node_Id) return Node_Id; -- Node3 *************** package Sinfo is *** 8285,8290 **** --- 8673,8681 ---- function Object_Definition (N : Node_Id) return Node_Id; -- Node4 + function Of_Present + (N : Node_Id) return Boolean; -- Flag16 + function Original_Discriminant (N : Node_Id) return Node_Id; -- Node2 *************** package Sinfo is *** 8411,8419 **** function SCIL_Entity (N : Node_Id) return Node_Id; -- Node4 - function SCIL_Related_Node - (N : Node_Id) return Node_Id; -- Node1 - function SCIL_Tag_Value (N : Node_Id) return Node_Id; -- Node5 --- 8802,8807 ---- *************** package Sinfo is *** 8441,8446 **** --- 8829,8837 ---- function Specification (N : Node_Id) return Node_Id; -- Node1 + function Split_PPC + (N : Node_Id) return Boolean; -- Flag17 + function Statements (N : Node_Id) return List_Id; -- List3 *************** package Sinfo is *** 8462,8467 **** --- 8853,8861 ---- function Subtype_Marks (N : Node_Id) return List_Id; -- List2 + function Suppress_Assignment_Checks + (N : Node_Id) return Boolean; -- Flag18 + function Suppress_Loop_Warnings (N : Node_Id) return Boolean; -- Flag17 *************** package Sinfo is *** 8522,8527 **** --- 8916,8924 ---- function Was_Originally_Stub (N : Node_Id) return Boolean; -- Flag13 + function Withed_Body + (N : Node_Id) return Node_Id; -- Node1 + function Zero_Cost_Handling (N : Node_Id) return Boolean; -- Flag5 *************** package Sinfo is *** 8600,8605 **** --- 8997,9008 ---- procedure Set_Array_Aggregate (N : Node_Id; Val : Node_Id); -- Node3 + procedure Set_Aspect_Cancel + (N : Node_Id; Val : Boolean := True); -- Flag11 + + procedure Set_Aspect_Rep_Item + (N : Node_Id; Val : Node_Id); -- Node2 + procedure Set_Assignment_OK (N : Node_Id; Val : Boolean := True); -- Flag15 *************** package Sinfo is *** 8645,8656 **** procedure Set_Choice_Parameter (N : Node_Id; Val : Node_Id); -- Node2 - procedure Set_Coextensions - (N : Node_Id; Val : Elist_Id); -- Elist4 - procedure Set_Choices (N : Node_Id; Val : List_Id); -- List1 procedure Set_Comes_From_Extended_Return_Statement (N : Node_Id; Val : Boolean := True); -- Flag18 --- 9048,9062 ---- procedure Set_Choice_Parameter (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Choices (N : Node_Id; Val : List_Id); -- List1 + procedure Set_Class_Present + (N : Node_Id; Val : Boolean := True); -- Flag6 + + procedure Set_Coextensions + (N : Node_Id; Val : Elist_Id); -- Elist4 + procedure Set_Comes_From_Extended_Return_Statement (N : Node_Id; Val : Boolean := True); -- Flag18 *************** package Sinfo is *** 8741,8746 **** --- 9147,9155 ---- procedure Set_Default_Expression (N : Node_Id; Val : Node_Id); -- Node5 + procedure Set_Default_Storage_Pool + (N : Node_Id; Val : Node_Id); -- Node3 + procedure Set_Default_Name (N : Node_Id; Val : Node_Id); -- Node2 *************** package Sinfo is *** 8921,8926 **** --- 9330,9338 ---- procedure Set_From_At_Mod (N : Node_Id; Val : Boolean := True); -- Flag4 + procedure Set_From_Aspect_Specification + (N : Node_Id; Val : Boolean := True); -- Flag13 + procedure Set_From_At_End (N : Node_Id; Val : Boolean := True); -- Flag4 *************** package Sinfo is *** 8963,8971 **** procedure Set_Has_No_Elaboration_Code (N : Node_Id; Val : Boolean := True); -- Flag17 ! procedure Set_Has_Priority_Pragma (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Has_Private_View (N : Node_Id; Val : Boolean := True); -- Flag11 --- 9375,9389 ---- procedure Set_Has_No_Elaboration_Code (N : Node_Id; Val : Boolean := True); -- Flag17 ! procedure Set_Has_Pragma_CPU ! (N : Node_Id; Val : Boolean := True); -- Flag14 ! ! procedure Set_Has_Pragma_Priority (N : Node_Id; Val : Boolean := True); -- Flag6 + procedure Set_Has_Pragma_Suppress_All + (N : Node_Id; Val : Boolean := True); -- Flag14 + procedure Set_Has_Private_View (N : Node_Id; Val : Boolean := True); -- Flag11 *************** package Sinfo is *** 9008,9019 **** --- 9426,9443 ---- procedure Set_Implicit_With (N : Node_Id; Val : Boolean := True); -- Flag16 + procedure Set_Import_Interface_Present + (N : Node_Id; Val : Boolean := True); -- Flag16 + procedure Set_In_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Includes_Infinities (N : Node_Id; Val : Boolean := True); -- Flag11 + procedure Set_Inherited_Discriminant + (N : Node_Id; Val : Boolean := True); -- Flag13 + procedure Set_Instance_Spec (N : Node_Id; Val : Node_Id); -- Node5 *************** package Sinfo is *** 9035,9040 **** --- 9459,9467 ---- procedure Set_Is_Controlling_Actual (N : Node_Id; Val : Boolean := True); -- Flag16 + procedure Set_Is_Delayed_Aspect + (N : Node_Id; Val : Boolean := True); -- Flag14 + procedure Set_Is_Dynamic_Coextension (N : Node_Id; Val : Boolean := True); -- Flag18 *************** package Sinfo is *** 9086,9091 **** --- 9513,9521 ---- procedure Set_Iteration_Scheme (N : Node_Id; Val : Node_Id); -- Node2 + procedure Set_Iterator_Specification + (N : Node_Id; Val : Node_Id); -- Node2 + procedure Set_Itype (N : Node_Id; Val : Entity_Id); -- Node1 *************** package Sinfo is *** 9158,9163 **** --- 9588,9596 ---- procedure Set_Next_Entity (N : Node_Id; Val : Node_Id); -- Node2 + procedure Set_Next_Exit_Statement + (N : Node_Id; Val : Node_Id); -- Node3 + procedure Set_Next_Implicit_With (N : Node_Id; Val : Node_Id); -- Node3 *************** package Sinfo is *** 9203,9208 **** --- 9636,9644 ---- procedure Set_Object_Definition (N : Node_Id; Val : Node_Id); -- Node4 + procedure Set_Of_Present + (N : Node_Id; Val : Boolean := True); -- Flag16 + procedure Set_Original_Discriminant (N : Node_Id; Val : Node_Id); -- Node2 *************** package Sinfo is *** 9329,9337 **** procedure Set_SCIL_Entity (N : Node_Id; Val : Node_Id); -- Node4 - procedure Set_SCIL_Related_Node - (N : Node_Id; Val : Node_Id); -- Node1 - procedure Set_SCIL_Tag_Value (N : Node_Id; Val : Node_Id); -- Node5 --- 9765,9770 ---- *************** package Sinfo is *** 9359,9364 **** --- 9792,9800 ---- procedure Set_Specification (N : Node_Id; Val : Node_Id); -- Node1 + procedure Set_Split_PPC + (N : Node_Id; Val : Boolean); -- Flag17 + procedure Set_Statements (N : Node_Id; Val : List_Id); -- List3 *************** package Sinfo is *** 9380,9385 **** --- 9816,9824 ---- procedure Set_Subtype_Marks (N : Node_Id; Val : List_Id); -- List2 + procedure Set_Suppress_Assignment_Checks + (N : Node_Id; Val : Boolean := True); -- Flag18 + procedure Set_Suppress_Loop_Warnings (N : Node_Id; Val : Boolean := True); -- Flag17 *************** package Sinfo is *** 9440,9445 **** --- 9879,9887 ---- procedure Set_Was_Originally_Stub (N : Node_Id; Val : Boolean := True); -- Flag13 + procedure Set_Withed_Body + (N : Node_Id; Val : Node_Id); -- Node1 + procedure Set_Zero_Cost_Handling (N : Node_Id; Val : Boolean := True); -- Flag5 *************** package Sinfo is *** 9454,9473 **** procedure Next_Rep_Item (N : in out Node_Id); procedure Next_Use_Clause (N : in out Node_Id); ! -------------------------------------- ! -- Logical Access to End_Span Field -- ! -------------------------------------- function End_Location (N : Node_Id) return Source_Ptr; ! -- N is an N_If_Statement or N_Case_Statement node, and this ! -- function returns the location of the IF token in the END IF ! -- sequence by translating the value of the End_Span field. procedure Set_End_Location (N : Node_Id; S : Source_Ptr); ! -- N is an N_If_Statement or N_Case_Statement node. This procedure ! -- sets the End_Span field to correspond to the given value S. In ! -- other words, End_Span is set to the difference between S and ! -- Sloc (N), the starting location. -------------------------------- -- Node_Kind Membership Tests -- --- 9896,9920 ---- procedure Next_Rep_Item (N : in out Node_Id); procedure Next_Use_Clause (N : in out Node_Id); ! ------------------------------------------- ! -- Miscellaneous Tree Access Subprograms -- ! ------------------------------------------- function End_Location (N : Node_Id) return Source_Ptr; ! -- N is an N_If_Statement or N_Case_Statement node, and this function ! -- returns the location of the IF token in the END IF sequence by ! -- translating the value of the End_Span field. procedure Set_End_Location (N : Node_Id; S : Source_Ptr); ! -- N is an N_If_Statement or N_Case_Statement node. This procedure sets ! -- the End_Span field to correspond to the given value S. In other words, ! -- End_Span is set to the difference between S and Sloc (N), the starting ! -- location. ! ! function Get_Pragma_Arg (Arg : Node_Id) return Node_Id; ! -- Given an argument to a pragma Arg, this function returns the expression ! -- for the argument. This is Arg itself, or, in the case where Arg is a ! -- pragma argument association node, the expression from this node. -------------------------------- -- Node_Kind Membership Tests -- *************** package Sinfo is *** 10119,10124 **** --- 10566,10578 ---- 4 => True, -- Subtype_Mark (Node4) 5 => False), -- Etype (Node5-Sem) + N_Quantified_Expression => + (1 => True, -- Condition (Node1) + 2 => True, -- Iterator_Specification + 3 => False, -- unused + 4 => True, -- Loop_Parameter_Specification (Node4) + 5 => False), -- Etype (Node5-Sem) + N_Allocator => (1 => False, -- Storage_Pool (Node1-Sem) 2 => False, -- Procedure_To_Call (Node2-Sem) *************** package Sinfo is *** 10161,10166 **** --- 10615,10634 ---- 4 => False, -- unused 5 => False), -- unused + N_Case_Expression => + (1 => False, -- unused + 2 => False, -- unused + 3 => True, -- Expression (Node3) + 4 => True, -- Alternatives (List4) + 5 => False), -- unused + + N_Case_Expression_Alternative => + (1 => False, -- Actions (List1-Sem) + 2 => False, -- unused + 3 => True, -- Statements (List3) + 4 => True, -- Expression (Node4) + 5 => False), -- unused + N_Case_Statement => (1 => False, -- unused 2 => False, -- unused *************** package Sinfo is *** 10184,10190 **** N_Iteration_Scheme => (1 => True, -- Condition (Node1) ! 2 => False, -- unused 3 => False, -- Condition_Actions (List3-Sem) 4 => True, -- Loop_Parameter_Specification (Node4) 5 => False), -- unused --- 10652,10658 ---- N_Iteration_Scheme => (1 => True, -- Condition (Node1) ! 2 => True, -- Iterator_Specification (Node2) 3 => False, -- Condition_Actions (List3-Sem) 4 => True, -- Loop_Parameter_Specification (Node4) 5 => False), -- unused *************** package Sinfo is *** 10196,10201 **** --- 10664,10676 ---- 4 => True, -- Discrete_Subtype_Definition (Node4) 5 => False), -- unused + N_Iterator_Specification => + (1 => True, -- Defining_Identifier (Node1) + 2 => True, -- Name (Node2) + 3 => False, -- Unused + 4 => False, -- Unused + 5 => True), -- Subtype_Indication (Node5) + N_Block_Statement => (1 => True, -- Identifier (Node1) 2 => True, -- Declarations (List2) *************** package Sinfo is *** 10287,10292 **** --- 10762,10774 ---- 4 => True, -- Handled_Statement_Sequence (Node4) 5 => False), -- Corresponding_Spec (Node5-Sem) + N_Parameterized_Expression => + (1 => True, -- Specification (Node1) + 2 => False, -- unused + 3 => True, -- Expression (Node3) + 4 => False, -- unused + 5 => False), -- unused + N_Procedure_Call_Statement => (1 => False, -- Controlling_Argument (Node1-Sem) 2 => True, -- Name (Node2) *************** package Sinfo is *** 10626,10632 **** N_Compilation_Unit_Aux => (1 => True, -- Actions (List1) 2 => True, -- Declarations (List2) ! 3 => False, -- unused 4 => True, -- Config_Pragmas (List4) 5 => True), -- Pragmas_After (List5) --- 11108,11114 ---- N_Compilation_Unit_Aux => (1 => True, -- Actions (List1) 2 => True, -- Declarations (List2) ! 3 => False, -- Default_Storage_Pool (Node3) 4 => True, -- Config_Pragmas (List4) 5 => True), -- Pragmas_After (List5) *************** package Sinfo is *** 10840,10845 **** --- 11322,11334 ---- 4 => False, -- unused 5 => False), -- Next_Rep_Item (Node5-Sem) + N_Aspect_Specification => + (1 => True, -- Identifier (Node1) + 2 => False, -- Aspect_Rep_Item (Node2-Sem) + 3 => True, -- Expression (Node3) + 4 => False, -- Entity (Node4-Sem) + 5 => False), -- Next_Rep_Item (Node5-Sem) + N_Enumeration_Representation_Clause => (1 => True, -- Identifier (Node1) 2 => False, -- unused *************** package Sinfo is *** 10938,10943 **** --- 11427,11439 ---- 4 => False, -- Entity (Node4-Sem) 5 => False), -- Etype (Node5-Sem) + N_Expression_With_Actions => + (1 => True, -- Actions (List1) + 2 => False, -- unused + 3 => True, -- Expression (Node3) + 4 => False, -- unused + 5 => False), -- unused + N_Free_Statement => (1 => False, -- Storage_Pool (Node1-Sem) 2 => False, -- Procedure_To_Call (Node2-Sem) *************** package Sinfo is *** 11064,11108 **** 4 => False, -- unused 5 => False), -- unused - -- End of inserted output from makeisf program - -- Entries for SCIL nodes - N_SCIL_Dispatch_Table_Object_Init => - (1 => False, -- SCIL_Related_Node (Node1-Sem) - 2 => False, -- unused - 3 => False, -- unused - 4 => False, -- SCIL_Entity (Node4-Sem) - 5 => False), -- unused - N_SCIL_Dispatch_Table_Tag_Init => ! (1 => False, -- SCIL_Related_Node (Node1-Sem) 2 => False, -- unused 3 => False, -- unused 4 => False, -- SCIL_Entity (Node4-Sem) 5 => False), -- unused N_SCIL_Dispatching_Call => ! (1 => False, -- SCIL_Related_Node (Node1-Sem) 2 => False, -- SCIL_Target_Prim (Node2-Sem) 3 => False, -- unused 4 => False, -- SCIL_Entity (Node4-Sem) 5 => False), -- SCIL_Controlling_Tag (Node5-Sem) N_SCIL_Membership_Test => ! (1 => False, -- SCIL_Related_Node (Node1-Sem) 2 => False, -- unused 3 => False, -- unused 4 => False, -- SCIL_Entity (Node4-Sem) 5 => False), -- SCIL_Tag_Value (Node5-Sem) - N_SCIL_Tag_Init => - (1 => False, -- SCIL_Related_Node (Node1-Sem) - 2 => False, -- unused - 3 => False, -- unused - 4 => False, -- SCIL_Entity (Node4-Sem) - 5 => False), -- unused - -- Entries for Empty, Error and Unused. Even thought these have a Chars -- field for debugging purposes, they are not really syntactic fields, so -- we mark all fields as unused. --- 11560,11588 ---- 4 => False, -- unused 5 => False), -- unused -- Entries for SCIL nodes N_SCIL_Dispatch_Table_Tag_Init => ! (1 => False, -- unused 2 => False, -- unused 3 => False, -- unused 4 => False, -- SCIL_Entity (Node4-Sem) 5 => False), -- unused N_SCIL_Dispatching_Call => ! (1 => False, -- unused 2 => False, -- SCIL_Target_Prim (Node2-Sem) 3 => False, -- unused 4 => False, -- SCIL_Entity (Node4-Sem) 5 => False), -- SCIL_Controlling_Tag (Node5-Sem) N_SCIL_Membership_Test => ! (1 => False, -- unused 2 => False, -- unused 3 => False, -- unused 4 => False, -- SCIL_Entity (Node4-Sem) 5 => False), -- SCIL_Tag_Value (Node5-Sem) -- Entries for Empty, Error and Unused. Even thought these have a Chars -- field for debugging purposes, they are not really syntactic fields, so -- we mark all fields as unused. *************** package Sinfo is *** 11160,11165 **** --- 11640,11647 ---- pragma Inline (Alternatives); pragma Inline (Ancestor_Part); pragma Inline (Array_Aggregate); + pragma Inline (Aspect_Cancel); + pragma Inline (Aspect_Rep_Item); pragma Inline (Assignment_OK); pragma Inline (Associated_Node); pragma Inline (At_End_Proc); *************** package Sinfo is *** 11176,11181 **** --- 11658,11664 ---- pragma Inline (Check_Address_Alignment); pragma Inline (Choice_Parameter); pragma Inline (Choices); + pragma Inline (Class_Present); pragma Inline (Coextensions); pragma Inline (Comes_From_Extended_Return_Statement); pragma Inline (Compile_Time_Known_Aggregate); *************** package Sinfo is *** 11207,11212 **** --- 11690,11696 ---- pragma Inline (Debug_Statement); pragma Inline (Declarations); pragma Inline (Default_Expression); + pragma Inline (Default_Storage_Pool); pragma Inline (Default_Name); pragma Inline (Defining_Identifier); pragma Inline (Defining_Unit_Name); *************** package Sinfo is *** 11267,11272 **** --- 11751,11757 ---- pragma Inline (Float_Truncate); pragma Inline (Formal_Type_Definition); pragma Inline (Forwards_OK); + pragma Inline (From_Aspect_Specification); pragma Inline (From_At_End); pragma Inline (From_At_Mod); pragma Inline (From_Default); *************** package Sinfo is *** 11283,11289 **** pragma Inline (Has_Local_Raise); pragma Inline (Has_Self_Reference); 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); --- 11768,11776 ---- pragma Inline (Has_Local_Raise); pragma Inline (Has_Self_Reference); pragma Inline (Has_No_Elaboration_Code); ! pragma Inline (Has_Pragma_CPU); ! pragma Inline (Has_Pragma_Priority); ! pragma Inline (Has_Pragma_Suppress_All); pragma Inline (Has_Private_View); pragma Inline (Has_Relative_Deadline_Pragma); pragma Inline (Has_Storage_Size_Pragma); *************** package Sinfo is *** 11298,11311 **** --- 11785,11802 ---- pragma Inline (Interface_List); pragma Inline (Interface_Present); pragma Inline (Includes_Infinities); + pragma Inline (Import_Interface_Present); pragma Inline (In_Present); + pragma Inline (Inherited_Discriminant); pragma Inline (Instance_Spec); pragma Inline (Intval); + pragma Inline (Iterator_Specification); pragma Inline (Is_Accessibility_Actual); pragma Inline (Is_Asynchronous_Call_Block); pragma Inline (Is_Component_Left_Opnd); pragma Inline (Is_Component_Right_Opnd); pragma Inline (Is_Controlling_Actual); + pragma Inline (Is_Delayed_Aspect); pragma Inline (Is_Dynamic_Coextension); pragma Inline (Is_Elsif); pragma Inline (Is_Entry_Barrier_Function); *************** package Sinfo is *** 11347,11352 **** --- 11838,11844 ---- pragma Inline (Name); pragma Inline (Names); pragma Inline (Next_Entity); + pragma Inline (Next_Exit_Statement); pragma Inline (Next_Implicit_With); pragma Inline (Next_Named_Actual); pragma Inline (Next_Pragma); *************** package Sinfo is *** 11362,11367 **** --- 11854,11860 ---- pragma Inline (Null_Exclusion_In_Return_Present); pragma Inline (Null_Record_Present); pragma Inline (Object_Definition); + pragma Inline (Of_Present); pragma Inline (Original_Discriminant); pragma Inline (Original_Entity); pragma Inline (Others_Discrete_Choices); *************** package Sinfo is *** 11404,11410 **** pragma Inline (Rounded_Result); pragma Inline (SCIL_Controlling_Tag); pragma Inline (SCIL_Entity); - pragma Inline (SCIL_Related_Node); pragma Inline (SCIL_Tag_Value); pragma Inline (SCIL_Target_Prim); pragma Inline (Scope); --- 11897,11902 ---- *************** package Sinfo is *** 11414,11419 **** --- 11906,11912 ---- pragma Inline (Shift_Count_OK); pragma Inline (Source_Type); pragma Inline (Specification); + pragma Inline (Split_PPC); pragma Inline (Statements); pragma Inline (Static_Processing_OK); pragma Inline (Storage_Pool); *************** package Sinfo is *** 11421,11426 **** --- 11914,11920 ---- pragma Inline (Subtype_Indication); pragma Inline (Subtype_Mark); pragma Inline (Subtype_Marks); + pragma Inline (Suppress_Assignment_Checks); pragma Inline (Suppress_Loop_Warnings); pragma Inline (Synchronized_Present); pragma Inline (Tagged_Present); *************** package Sinfo is *** 11441,11446 **** --- 11935,11941 ---- pragma Inline (Variants); pragma Inline (Visible_Declarations); pragma Inline (Was_Originally_Stub); + pragma Inline (Withed_Body); pragma Inline (Zero_Cost_Handling); pragma Inline (Set_ABE_Is_Certain); *************** package Sinfo is *** 11464,11469 **** --- 11959,11966 ---- pragma Inline (Set_Alternatives); pragma Inline (Set_Ancestor_Part); pragma Inline (Set_Array_Aggregate); + pragma Inline (Set_Aspect_Cancel); + pragma Inline (Set_Aspect_Rep_Item); pragma Inline (Set_Assignment_OK); pragma Inline (Set_Associated_Node); pragma Inline (Set_At_End_Proc); *************** package Sinfo is *** 11480,11485 **** --- 11977,11983 ---- pragma Inline (Set_Check_Address_Alignment); pragma Inline (Set_Choice_Parameter); pragma Inline (Set_Choices); + pragma Inline (Set_Class_Present); pragma Inline (Set_Coextensions); pragma Inline (Set_Comes_From_Extended_Return_Statement); pragma Inline (Set_Compile_Time_Known_Aggregate); *************** package Sinfo is *** 11511,11516 **** --- 12009,12015 ---- pragma Inline (Set_Debug_Statement); pragma Inline (Set_Declarations); pragma Inline (Set_Default_Expression); + pragma Inline (Set_Default_Storage_Pool); pragma Inline (Set_Default_Name); pragma Inline (Set_Defining_Identifier); pragma Inline (Set_Defining_Unit_Name); *************** package Sinfo is *** 11570,11575 **** --- 12069,12075 ---- pragma Inline (Set_Float_Truncate); pragma Inline (Set_Formal_Type_Definition); pragma Inline (Set_Forwards_OK); + pragma Inline (Set_From_Aspect_Specification); pragma Inline (Set_From_At_End); pragma Inline (Set_From_At_Mod); pragma Inline (Set_From_Default); *************** package Sinfo is *** 11585,11591 **** pragma Inline (Set_Has_Local_Raise); pragma Inline (Set_Has_Dynamic_Range_Check); 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); --- 12085,12093 ---- pragma Inline (Set_Has_Local_Raise); pragma Inline (Set_Has_Dynamic_Range_Check); pragma Inline (Set_Has_No_Elaboration_Code); ! pragma Inline (Set_Has_Pragma_CPU); ! pragma Inline (Set_Has_Pragma_Priority); ! pragma Inline (Set_Has_Pragma_Suppress_All); pragma Inline (Set_Has_Private_View); pragma Inline (Set_Has_Relative_Deadline_Pragma); pragma Inline (Set_Has_Storage_Size_Pragma); *************** package Sinfo is *** 11600,11613 **** --- 12102,12119 ---- pragma Inline (Set_Includes_Infinities); pragma Inline (Set_Interface_List); pragma Inline (Set_Interface_Present); + pragma Inline (Set_Import_Interface_Present); pragma Inline (Set_In_Present); + pragma Inline (Set_Inherited_Discriminant); pragma Inline (Set_Instance_Spec); pragma Inline (Set_Intval); + pragma Inline (Set_Iterator_Specification); pragma Inline (Set_Is_Accessibility_Actual); pragma Inline (Set_Is_Asynchronous_Call_Block); pragma Inline (Set_Is_Component_Left_Opnd); pragma Inline (Set_Is_Component_Right_Opnd); pragma Inline (Set_Is_Controlling_Actual); + pragma Inline (Set_Is_Delayed_Aspect); pragma Inline (Set_Is_Dynamic_Coextension); pragma Inline (Set_Is_Elsif); pragma Inline (Set_Is_Entry_Barrier_Function); *************** package Sinfo is *** 11650,11655 **** --- 12156,12162 ---- pragma Inline (Set_Name); pragma Inline (Set_Names); pragma Inline (Set_Next_Entity); + pragma Inline (Set_Next_Exit_Statement); pragma Inline (Set_Next_Implicit_With); pragma Inline (Set_Next_Named_Actual); pragma Inline (Set_Next_Pragma); *************** package Sinfo is *** 11665,11670 **** --- 12172,12178 ---- pragma Inline (Set_Null_Exclusion_In_Return_Present); pragma Inline (Set_Null_Record_Present); pragma Inline (Set_Object_Definition); + pragma Inline (Set_Of_Present); pragma Inline (Set_Original_Discriminant); pragma Inline (Set_Original_Entity); pragma Inline (Set_Others_Discrete_Choices); *************** package Sinfo is *** 11706,11712 **** pragma Inline (Set_Rounded_Result); pragma Inline (Set_SCIL_Controlling_Tag); pragma Inline (Set_SCIL_Entity); - pragma Inline (Set_SCIL_Related_Node); pragma Inline (Set_SCIL_Tag_Value); pragma Inline (Set_SCIL_Target_Prim); pragma Inline (Set_Scope); --- 12214,12219 ---- *************** package Sinfo is *** 11716,11721 **** --- 12223,12229 ---- pragma Inline (Set_Shift_Count_OK); pragma Inline (Set_Source_Type); pragma Inline (Set_Specification); + pragma Inline (Set_Split_PPC); pragma Inline (Set_Statements); pragma Inline (Set_Static_Processing_OK); pragma Inline (Set_Storage_Pool); *************** package Sinfo is *** 11723,11728 **** --- 12231,12237 ---- pragma Inline (Set_Subtype_Indication); pragma Inline (Set_Subtype_Mark); pragma Inline (Set_Subtype_Marks); + pragma Inline (Set_Suppress_Assignment_Checks); pragma Inline (Set_Suppress_Loop_Warnings); pragma Inline (Set_Synchronized_Present); pragma Inline (Set_Tagged_Present); *************** package Sinfo is *** 11743,11748 **** --- 12252,12258 ---- pragma Inline (Set_Variants); pragma Inline (Set_Visible_Declarations); pragma Inline (Set_Was_Originally_Stub); + pragma Inline (Set_Withed_Body); pragma Inline (Set_Zero_Cost_Handling); N_Simple_Return_Statement : constant Node_Kind := N_Return_Statement; diff -Nrcpad gcc-4.5.2/gcc/ada/sinput-c.adb gcc-4.6.0/gcc/ada/sinput-c.adb *** gcc-4.5.2/gcc/ada/sinput-c.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/sinput-c.adb Tue Jun 22 13:26:32 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with System; use System; *** 28,34 **** --- 28,37 ---- with Ada.Unchecked_Conversion; + pragma Warnings (Off); + -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; + pragma Warnings (On); package body Sinput.C is diff -Nrcpad gcc-4.5.2/gcc/ada/sinput-l.adb gcc-4.6.0/gcc/ada/sinput-l.adb *** gcc-4.5.2/gcc/ada/sinput-l.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/sinput-l.adb Mon Oct 4 13:38:32 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Einfo; use Einfo; *** 30,35 **** --- 30,36 ---- with Errout; use Errout; with Fname; use Fname; with Hostparm; + with Lib; use Lib; with Opt; use Opt; with Osint; use Osint; with Output; use Output; *************** package body Sinput.L is *** 530,541 **** Save_Style_Check := Opt.Style_Check; Opt.Style_Check := False; ! -- Make sure that there will be no check of pragma Restrictions ! -- for obsolescent features while preprocessing the source. - Scn.Set_Obsolescent_Check (False); Preprocess (Modified); - Scn.Set_Obsolescent_Check (True); -- Reset the scanner to its standard behavior, and restore the -- Style_Checks flag. --- 531,539 ---- Save_Style_Check := Opt.Style_Check; Opt.Style_Check := False; ! -- The actual preprocessing step Preprocess (Modified); -- Reset the scanner to its standard behavior, and restore the -- Style_Checks flag. *************** package body Sinput.L is *** 555,563 **** else -- Output the result of the preprocessing, if requested and ! -- the source has been modified by the preprocessing. ! if Generate_Processed_File and then Modified then declare FD : File_Descriptor; NB : Integer; --- 553,570 ---- else -- Output the result of the preprocessing, if requested and ! -- the source has been modified by the preprocessing. Only ! -- do that for the main unit (spec, body and subunits). ! if Generate_Processed_File ! and then Modified ! and then ! ((Compiler_State = Parsing ! and then Parsing_Main_Extended_Source) ! or else ! (Compiler_State = Analyzing ! and then Analysing_Subunit_Of_Main)) ! then declare FD : File_Descriptor; NB : Integer; *************** package body Sinput.L is *** 594,603 **** if not Status then Errout.Error_Msg ! ("could not write processed file """ & Name_Buffer (1 .. Name_Len) & '"', Lo); - return No_Source_File; end if; end; end if; --- 601,609 ---- if not Status then Errout.Error_Msg ! ("?could not write processed file """ & Name_Buffer (1 .. Name_Len) & '"', Lo); end if; end; end if; diff -Nrcpad gcc-4.5.2/gcc/ada/sinput-p.adb gcc-4.6.0/gcc/ada/sinput-p.adb *** gcc-4.5.2/gcc/ada/sinput-p.adb Thu Apr 16 10:58:48 2009 --- gcc-4.6.0/gcc/ada/sinput-p.adb Thu Sep 9 13:50:19 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sinput.P is *** 151,156 **** --- 151,162 ---- function Source_File_Is_Subunit (X : Source_File_Index) return Boolean is begin + -- Nothing to do if X is no source file, so simply return False + + if X = No_Source_File then + return False; + end if; + Prj.Err.Scanner.Initialize_Scanner (X); -- No error for special characters that are used for preprocessing diff -Nrcpad gcc-4.5.2/gcc/ada/sinput-p.ads gcc-4.6.0/gcc/ada/sinput-p.ads *** gcc-4.5.2/gcc/ada/sinput-p.ads Wed Apr 15 12:57:34 2009 --- gcc-4.6.0/gcc/ada/sinput-p.ads Thu Sep 9 13:53:19 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sinput.P is *** 54,60 **** -- the file cannot possibly be a legal subunit. This function does NOT do a -- complete parse of the file, or build a tree. It is used in gnatmake and -- gprbuild to decide if a body without a spec in a project file needs to ! -- be compiled or not. type Saved_Project_Scan_State is limited private; -- Used to save project scan state in following two routines --- 54,60 ---- -- the file cannot possibly be a legal subunit. This function does NOT do a -- complete parse of the file, or build a tree. It is used in gnatmake and -- gprbuild to decide if a body without a spec in a project file needs to ! -- be compiled or not. Returns False if X = No_Source_File. type Saved_Project_Scan_State is limited private; -- Used to save project scan state in following two routines diff -Nrcpad gcc-4.5.2/gcc/ada/sinput.adb gcc-4.6.0/gcc/ada/sinput.adb *** gcc-4.5.2/gcc/ada/sinput.adb Wed Jan 27 11:37:20 2010 --- gcc-4.6.0/gcc/ada/sinput.adb Tue Oct 12 11:00:42 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Sinput is *** 227,234 **** Get_Name_String_And_Append (Reference_Name (Get_Source_File_Index (Ptr))); Add_Char_To_Name_Buffer (':'); ! Add_Nat_To_Name_Buffer ! (Nat (Get_Logical_Line_Number (Ptr))); Ptr := Instantiation_Location (Ptr); exit when Ptr = No_Location; --- 227,233 ---- Get_Name_String_And_Append (Reference_Name (Get_Source_File_Index (Ptr))); Add_Char_To_Name_Buffer (':'); ! Add_Nat_To_Name_Buffer (Nat (Get_Logical_Line_Number (Ptr))); Ptr := Instantiation_Location (Ptr); exit when Ptr = No_Location; *************** package body Sinput is *** 239,244 **** --- 238,250 ---- return; end Build_Location_String; + function Build_Location_String (Loc : Source_Ptr) return String is + begin + Name_Len := 0; + Build_Location_String (Loc); + return Name_Buffer (1 .. Name_Len); + end Build_Location_String; + ----------------------- -- Get_Column_Number -- ----------------------- *************** package body Sinput is *** 299,304 **** --- 305,323 ---- end if; end Get_Logical_Line_Number; + --------------------------------- + -- Get_Logical_Line_Number_Img -- + --------------------------------- + + function Get_Logical_Line_Number_Img + (P : Source_Ptr) return String + is + begin + Name_Len := 0; + Add_Nat_To_Name_Buffer (Nat (Get_Logical_Line_Number (P))); + return Name_Buffer (1 .. Name_Len); + end Get_Logical_Line_Number_Img; + ------------------------------ -- Get_Physical_Line_Number -- ------------------------------ *************** package body Sinput is *** 792,799 **** 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. --- 811,817 ---- 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 have to recreate a proper pointer to the actual array -- from the zero origin pointer stored in the source table. *************** package body Sinput is *** 801,809 **** Tmp1 := To_Source_Buffer_Ptr (S.Source_Text (S.Source_First)'Address); - pragma Warnings (Off); Free_Ptr (Tmp1); - pragma Warnings (On); if S.Lines_Table /= null then Memory.Free (To_Address (S.Lines_Table)); --- 819,825 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/sinput.ads gcc-4.6.0/gcc/ada/sinput.ads *** gcc-4.5.2/gcc/ada/sinput.ads Wed Jan 27 11:37:20 2010 --- gcc-4.6.0/gcc/ada/sinput.ads Tue Oct 12 11:00:42 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Sinput is *** 471,476 **** --- 471,480 ---- -- ASCII.NUL, with Name_Length indicating the length not including the -- terminating Nul. + function Build_Location_String (Loc : Source_Ptr) return String; + -- Functional form returning a string, which does not include a terminating + -- null character. The contents of Name_Buffer is destroyed. + function Get_Column_Number (P : Source_Ptr) return Column_Number; -- The ones-origin column number of the specified Source_Ptr value is -- determined and returned. Tab characters if present are assumed to *************** package Sinput is *** 487,492 **** --- 491,501 ---- -- reference pragmas have been encountered, the value returned is -- the same as the physical line number. + function Get_Logical_Line_Number_Img + (P : Source_Ptr) return String; + -- Same as above function, but returns the line number as a string of + -- decimal digits, with no leading space. Destroys Name_Buffer. + function Get_Physical_Line_Number (P : Source_Ptr) return Physical_Line_Number; -- The line number of the specified source position is obtained by diff -Nrcpad gcc-4.5.2/gcc/ada/snames.adb-tmpl gcc-4.6.0/gcc/ada/snames.adb-tmpl *** gcc-4.5.2/gcc/ada/snames.adb-tmpl Fri Apr 10 14:08:58 2009 --- gcc-4.6.0/gcc/ada/snames.adb-tmpl Mon Oct 11 09:20:53 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Snames is *** 368,374 **** return Get_Name_Table_Byte (N) /= 0 and then (Ada_Version >= Ada_95 or else N not in Ada_95_Reserved_Words) ! and then (Ada_Version >= Ada_05 or else N not in Ada_2005_Reserved_Words); end Is_Keyword_Name; --- 368,374 ---- return Get_Name_Table_Byte (N) /= 0 and then (Ada_Version >= Ada_95 or else N not in Ada_95_Reserved_Words) ! and then (Ada_Version >= Ada_2005 or else N not in Ada_2005_Reserved_Words); end Is_Keyword_Name; diff -Nrcpad gcc-4.5.2/gcc/ada/snames.ads-tmpl gcc-4.6.0/gcc/ada/snames.ads-tmpl *** gcc-4.5.2/gcc/ada/snames.ads-tmpl Wed Jan 27 13:29:52 2010 --- gcc-4.6.0/gcc/ada/snames.ads-tmpl Fri Oct 22 10:00:18 2010 *************** *** 6,12 **** -- -- -- T e m p l a t e -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- T e m p l a t e -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Namet; use Namet; *** 34,40 **** package Snames is -- This package contains definitions of standard names (i.e. entries in the ! -- Names table) that are used throughout the GNAT compiler). It also contains -- the definitions of some enumeration types whose definitions are tied to -- the order of these preset names. --- 34,40 ---- package Snames is -- This package contains definitions of standard names (i.e. entries in the ! -- Names table) that are used throughout the GNAT compiler. It also contains -- the definitions of some enumeration types whose definitions are tied to -- the order of these preset names. *************** package Snames is *** 134,139 **** --- 134,145 ---- Name_Space : constant Name_Id := N + $; Name_Time : constant Name_Id := N + $; + -- Names of aspects for which there are no matching pragmas or attributes + -- so that they need to be included for aspect specification use. + + Name_Post : constant Name_Id := N + $; + Name_Pre : constant Name_Id := N + $; + -- Some special names used by the expander. Note that the lower case u's -- at the start of these names get translated to extra underscores. These -- names are only referenced internally by expander generated code. *************** package Snames is *** 145,150 **** --- 151,157 ---- Name_uChain : constant Name_Id := N + $; Name_uClean : constant Name_Id := N + $; Name_uController : constant Name_Id := N + $; + Name_uCPU : constant Name_Id := N + $; Name_uEntry_Bodies : constant Name_Id := N + $; Name_uExpunge : constant Name_Id := N + $; Name_uFinal_List : constant Name_Id := N + $; *************** package Snames is *** 312,320 **** -- may be found in the appropriate section in unit Sem_Prag in file -- sem-prag.adb, and they are documented in the GNAT reference manual. ! -- The entries marked Ada05 are Ada 2005 pragmas. They are implemented in ! -- Ada 83 and Ada 95 mode as well, where they are technically considered to ! -- be implementation dependent pragmas. -- The entries marked VMS are VMS specific pragmas that are recognized -- only in OpenVMS versions of GNAT. They are ignored in other versions --- 319,331 ---- -- may be found in the appropriate section in unit Sem_Prag in file -- sem-prag.adb, and they are documented in the GNAT reference manual. ! -- The entries marked Ada 05 are Ada 2005 pragmas. They are implemented ! -- in Ada 83 and Ada 95 mode as well, where they are technically considered ! -- to be implementation dependent pragmas. ! ! -- The entries marked Ada 12 are Ada 2012 pragmas. They are implemented ! -- in Ada 83, Ada 95, and Ada 2005 mode as well, where they are technically ! -- considered to be implementation dependent pragmas. -- The entries marked VMS are VMS specific pragmas that are recognized -- only in OpenVMS versions of GNAT. They are ignored in other versions *************** package Snames is *** 334,339 **** --- 345,352 ---- Name_Ada_95 : constant Name_Id := N + $; -- GNAT Name_Ada_05 : constant Name_Id := N + $; -- GNAT Name_Ada_2005 : constant Name_Id := N + $; -- GNAT + Name_Ada_12 : constant Name_Id := N + $; -- GNAT + Name_Ada_2012 : constant Name_Id := N + $; -- GNAT Name_Assertion_Policy : constant Name_Id := N + $; -- Ada 05 Name_Assume_No_Invalid_Values : constant Name_Id := N + $; -- GNAT Name_C_Pass_By_Copy : constant Name_Id := N + $; -- GNAT *************** package Snames is *** 346,351 **** --- 359,365 ---- Name_Convention_Identifier : constant Name_Id := N + $; -- GNAT Name_Debug_Policy : constant Name_Id := N + $; -- GNAT Name_Detect_Blocking : constant Name_Id := N + $; -- Ada 05 + Name_Default_Storage_Pool : constant Name_Id := N + $; -- Ada 12 Name_Discard_Names : constant Name_Id := N + $; Name_Elaboration_Checks : constant Name_Id := N + $; -- GNAT Name_Eliminate : constant Name_Id := N + $; -- GNAT *************** package Snames is *** 384,389 **** --- 398,404 ---- Name_Restriction_Warnings : constant Name_Id := N + $; -- GNAT Name_Reviewable : constant Name_Id := N + $; Name_Short_Circuit_And_Or : constant Name_Id := N + $; -- GNAT + Name_Short_Descriptors : constant Name_Id := N + $; -- GNAT Name_Source_File_Name : constant Name_Id := N + $; -- GNAT Name_Source_File_Name_Project : constant Name_Id := N + $; -- GNAT Name_Style_Checks : constant Name_Id := N + $; -- GNAT *************** package Snames is *** 404,410 **** Name_All_Calls_Remote : constant Name_Id := N + $; Name_Annotate : constant Name_Id := N + $; -- GNAT ! -- Note: AST_Entry is not in this list because its name matches -- VMS -- the name of the corresponding attribute. However, it is -- included in the definition of the type Pragma_Id, and the -- functions Get_Pragma_Id and Is_Pragma_Id correctly recognize --- 419,425 ---- Name_All_Calls_Remote : constant Name_Id := N + $; Name_Annotate : constant Name_Id := N + $; -- GNAT ! -- Note: AST_Entry is not in this list because its name matches -- VMS -- the name of the corresponding attribute. However, it is -- included in the definition of the type Pragma_Id, and the -- functions Get_Pragma_Id and Is_Pragma_Id correctly recognize *************** package Snames is *** 427,432 **** --- 442,448 ---- Name_CPP_Constructor : constant Name_Id := N + $; -- GNAT Name_CPP_Virtual : constant Name_Id := N + $; -- GNAT Name_CPP_Vtable : constant Name_Id := N + $; -- GNAT + Name_CPU : constant Name_Id := N + $; -- Ada 12 Name_Debug : constant Name_Id := N + $; -- GNAT Name_Dimension : constant Name_Id := N + $; -- GNAT Name_Elaborate : constant Name_Id := N + $; -- Ada 83 *************** package Snames is *** 442,461 **** Name_External : constant Name_Id := N + $; -- GNAT Name_Finalize_Storage_Only : constant Name_Id := N + $; -- GNAT Name_Ident : constant Name_Id := N + $; -- VMS ! Name_Implemented_By_Entry : constant Name_Id := N + $; -- Ada 05 Name_Import : constant Name_Id := N + $; Name_Import_Exception : constant Name_Id := N + $; -- VMS Name_Import_Function : constant Name_Id := N + $; -- GNAT Name_Import_Object : constant Name_Id := N + $; -- GNAT Name_Import_Procedure : constant Name_Id := N + $; -- GNAT Name_Import_Valued_Procedure : constant Name_Id := N + $; -- GNAT Name_Inline : constant Name_Id := N + $; Name_Inline_Always : constant Name_Id := N + $; -- GNAT Name_Inline_Generic : constant Name_Id := N + $; -- GNAT Name_Inspection_Point : constant Name_Id := N + $; -- Note: Interface is not in this list because its name -- GNAT ! -- matches an Ada 2005 keyword. However it is included in -- the definition of the type Attribute_Id, and the functions -- Get_Pragma_Id and Is_Pragma_Id correctly recognize and -- process Name_Storage_Size. --- 458,479 ---- Name_External : constant Name_Id := N + $; -- GNAT Name_Finalize_Storage_Only : constant Name_Id := N + $; -- GNAT Name_Ident : constant Name_Id := N + $; -- VMS ! Name_Implemented : constant Name_Id := N + $; -- Ada 12 Name_Import : constant Name_Id := N + $; Name_Import_Exception : constant Name_Id := N + $; -- VMS Name_Import_Function : constant Name_Id := N + $; -- GNAT Name_Import_Object : constant Name_Id := N + $; -- GNAT Name_Import_Procedure : constant Name_Id := N + $; -- GNAT Name_Import_Valued_Procedure : constant Name_Id := N + $; -- GNAT + Name_Independent : constant Name_Id := N + $; -- Ada 12 + Name_Independent_Components : constant Name_Id := N + $; -- Ada 12 Name_Inline : constant Name_Id := N + $; Name_Inline_Always : constant Name_Id := N + $; -- GNAT Name_Inline_Generic : constant Name_Id := N + $; -- GNAT Name_Inspection_Point : constant Name_Id := N + $; -- Note: Interface is not in this list because its name -- GNAT ! -- matches an Ada 05 keyword. However it is included in -- the definition of the type Attribute_Id, and the functions -- Get_Pragma_Id and Is_Pragma_Id correctly recognize and -- process Name_Storage_Size. *************** package Snames is *** 463,468 **** --- 481,487 ---- Name_Interface_Name : constant Name_Id := N + $; -- GNAT Name_Interrupt_Handler : constant Name_Id := N + $; Name_Interrupt_Priority : constant Name_Id := N + $; + Name_Invariant : constant Name_Id := N + $; -- GNAT Name_Java_Constructor : constant Name_Id := N + $; -- GNAT Name_Java_Interface : constant Name_Id := N + $; -- GNAT Name_Keep_Names : constant Name_Id := N + $; -- GNAT *************** package Snames is *** 481,491 **** --- 500,512 ---- Name_No_Return : constant Name_Id := N + $; -- Ada 05 Name_Obsolescent : constant Name_Id := N + $; -- GNAT Name_Optimize : constant Name_Id := N + $; + Name_Ordered : constant Name_Id := N + $; -- GNAT Name_Pack : constant Name_Id := N + $; Name_Page : constant Name_Id := N + $; Name_Passive : constant Name_Id := N + $; -- GNAT Name_Postcondition : constant Name_Id := N + $; -- GNAT Name_Precondition : constant Name_Id := N + $; -- GNAT + Name_Predicate : constant Name_Id := N + $; -- GNAT Name_Preelaborable_Initialization : constant Name_Id := N + $; -- Ada 05 Name_Preelaborate : constant Name_Id := N + $; Name_Preelaborate_05 : constant Name_Id := N + $; -- GNAT *************** package Snames is *** 590,595 **** --- 611,619 ---- Name_Attribute_Name : constant Name_Id := N + $; Name_Body_File_Name : constant Name_Id := N + $; Name_Boolean_Entry_Barriers : constant Name_Id := N + $; + Name_By_Any : constant Name_Id := N + $; + Name_By_Entry : constant Name_Id := N + $; + Name_By_Protected_Procedure : constant Name_Id := N + $; Name_Casing : constant Name_Id := N + $; Name_Code : constant Name_Id := N + $; Name_Component : constant Name_Id := N + $; *************** package Snames is *** 740,745 **** --- 764,770 ---- Name_Machine_Rounds : constant Name_Id := N + $; Name_Machine_Size : constant Name_Id := N + $; -- GNAT Name_Mantissa : constant Name_Id := N + $; -- Ada 83 + Name_Max_Alignment_For_Allocation : constant Name_Id := N + $; -- Ada 12 Name_Max_Size_In_Storage_Elements : constant Name_Id := N + $; Name_Maximum_Alignment : constant Name_Id := N + $; -- GNAT Name_Mechanism_Code : constant Name_Id := N + $; -- GNAT *************** package Snames is *** 760,765 **** --- 785,791 ---- Name_Priority : constant Name_Id := N + $; -- Ada 05 Name_Range : constant Name_Id := N + $; Name_Range_Length : constant Name_Id := N + $; -- GNAT + Name_Ref : constant Name_Id := N + $; -- GNAT Name_Result : constant Name_Id := N + $; -- GNAT Name_Round : constant Name_Id := N + $; Name_Safe_Emax : constant Name_Id := N + $; -- Ada 83 *************** package Snames is *** 780,785 **** --- 806,812 ---- Name_Terminated : constant Name_Id := N + $; Name_To_Address : constant Name_Id := N + $; -- GNAT Name_Type_Class : constant Name_Id := N + $; -- GNAT + Name_Type_Key : constant Name_Id := N + $; -- GNAT Name_UET_Address : constant Name_Id := N + $; -- GNAT Name_Unbiased_Rounding : constant Name_Id := N + $; Name_Unchecked_Access : constant Name_Id := N + $; *************** package Snames is *** 910,915 **** --- 937,946 ---- -- Names corresponding to reserved keywords, excluding those already -- declared in the attribute list (Access, Delta, Digits, Mod, Range). + -- Note: Name_Some is here even though for now we do not treat it as being + -- reserved. We treat it instead as an unreserved keyword. This may change + -- in the future, but in any case it belongs in the following list. + Name_Abort : constant Name_Id := N + $; Name_Abs : constant Name_Id := N + $; Name_Accept : constant Name_Id := N + $; *************** package Snames is *** 958,963 **** --- 989,995 ---- Name_Reverse : constant Name_Id := N + $; Name_Select : constant Name_Id := N + $; Name_Separate : constant Name_Id := N + $; + Name_Some : constant Name_Id := N + $; Name_Subtype : constant Name_Id := N + $; Name_Task : constant Name_Id := N + $; Name_Terminate : constant Name_Id := N + $; *************** package Snames is *** 1056,1061 **** --- 1088,1094 ---- Name_Executable : constant Name_Id := N + $; Name_Executable_Suffix : constant Name_Id := N + $; Name_Extends : constant Name_Id := N + $; + Name_External_As_List : constant Name_Id := N + $; Name_Externally_Built : constant Name_Id := N + $; Name_Finder : constant Name_Id := N + $; Name_Global_Compilation_Switches : constant Name_Id := N + $; *************** package Snames is *** 1065,1070 **** --- 1098,1104 ---- Name_Gnatstub : constant Name_Id := N + $; Name_Gnu : constant Name_Id := N + $; Name_Ide : constant Name_Id := N + $; + Name_Ignore_Source_Sub_Dirs : constant Name_Id := N + $; Name_Implementation : constant Name_Id := N + $; Name_Implementation_Exceptions : constant Name_Id := N + $; Name_Implementation_Suffix : constant Name_Id := N + $; *************** package Snames is *** 1073,1079 **** --- 1107,1115 ---- Name_Include_Path_File : constant Name_Id := N + $; Name_Inherit_Source_Path : constant Name_Id := N + $; Name_Languages : constant Name_Id := N + $; + Name_Leading_Library_Options : constant Name_Id := N + $; Name_Leading_Required_Switches : constant Name_Id := N + $; + Name_Leading_Switches : constant Name_Id := N + $; Name_Library : constant Name_Id := N + $; Name_Library_Ali_Dir : constant Name_Id := N + $; Name_Library_Auto_Init : constant Name_Id := N + $; *************** package Snames is *** 1127,1132 **** --- 1163,1170 ---- Name_Prefix : constant Name_Id := N + $; Name_Project : constant Name_Id := N + $; Name_Project_Dir : constant Name_Id := N + $; + Name_Project_Files : constant Name_Id := N + $; + Name_Project_Path : constant Name_Id := N + $; Name_Response_File_Format : constant Name_Id := N + $; Name_Response_File_Switches : constant Name_Id := N + $; Name_Roots : constant Name_Id := N + $; -- GPR *************** package Snames is *** 1160,1166 **** Name_Unaligned_Valid : constant Name_Id := N + $; ! -- Ada 2005 reserved words First_2005_Reserved_Word : constant Name_Id := N + $; Name_Interface : constant Name_Id := N + $; --- 1198,1212 ---- Name_Unaligned_Valid : constant Name_Id := N + $; ! -- Names used to implement iterators over predefined containers ! ! Name_Cursor : constant Name_Id := N + $; ! Name_Element : constant Name_Id := N + $; ! Name_Element_Type : constant Name_Id := N + $; ! Name_No_Element : constant Name_Id := N + $; ! Name_Previous : constant Name_Id := N + $; ! ! -- Ada 05 reserved words First_2005_Reserved_Word : constant Name_Id := N + $; Name_Interface : constant Name_Id := N + $; *************** package Snames is *** 1250,1255 **** --- 1296,1302 ---- Attribute_Machine_Rounds, Attribute_Machine_Size, Attribute_Mantissa, + Attribute_Max_Alignment_For_Allocation, Attribute_Max_Size_In_Storage_Elements, Attribute_Maximum_Alignment, Attribute_Mechanism_Code, *************** package Snames is *** 1270,1275 **** --- 1317,1323 ---- Attribute_Priority, Attribute_Range, Attribute_Range_Length, + Attribute_Ref, Attribute_Result, Attribute_Round, Attribute_Safe_Emax, *************** package Snames is *** 1290,1295 **** --- 1338,1344 ---- Attribute_Terminated, Attribute_To_Address, Attribute_Type_Class, + Attribute_Type_Key, Attribute_UET_Address, Attribute_Unbiased_Rounding, Attribute_Unchecked_Access, *************** package Snames is *** 1416,1421 **** --- 1465,1472 ---- Pragma_Ada_95, Pragma_Ada_05, Pragma_Ada_2005, + Pragma_Ada_12, + Pragma_Ada_2012, Pragma_Assertion_Policy, Pragma_Assume_No_Invalid_Values, Pragma_C_Pass_By_Copy, *************** package Snames is *** 1428,1433 **** --- 1479,1485 ---- Pragma_Convention_Identifier, Pragma_Debug_Policy, Pragma_Detect_Blocking, + Pragma_Default_Storage_Pool, Pragma_Discard_Names, Pragma_Elaboration_Checks, Pragma_Eliminate, *************** package Snames is *** 1459,1464 **** --- 1511,1517 ---- Pragma_Restriction_Warnings, Pragma_Reviewable, Pragma_Short_Circuit_And_Or, + Pragma_Short_Descriptors, Pragma_Source_File_Name, Pragma_Source_File_Name_Project, Pragma_Style_Checks, *************** package Snames is *** 1494,1499 **** --- 1547,1553 ---- Pragma_CPP_Constructor, Pragma_CPP_Virtual, Pragma_CPP_Vtable, + Pragma_CPU, Pragma_Debug, Pragma_Dimension, Pragma_Elaborate, *************** package Snames is *** 1509,1521 **** Pragma_External, Pragma_Finalize_Storage_Only, Pragma_Ident, ! Pragma_Implemented_By_Entry, Pragma_Import, Pragma_Import_Exception, Pragma_Import_Function, Pragma_Import_Object, Pragma_Import_Procedure, Pragma_Import_Valued_Procedure, Pragma_Inline, Pragma_Inline_Always, Pragma_Inline_Generic, --- 1563,1577 ---- Pragma_External, Pragma_Finalize_Storage_Only, Pragma_Ident, ! Pragma_Implemented, Pragma_Import, Pragma_Import_Exception, Pragma_Import_Function, Pragma_Import_Object, Pragma_Import_Procedure, Pragma_Import_Valued_Procedure, + Pragma_Independent, + Pragma_Independent_Components, Pragma_Inline, Pragma_Inline_Always, Pragma_Inline_Generic, *************** package Snames is *** 1523,1528 **** --- 1579,1585 ---- Pragma_Interface_Name, Pragma_Interrupt_Handler, Pragma_Interrupt_Priority, + Pragma_Invariant, Pragma_Java_Constructor, Pragma_Java_Interface, Pragma_Keep_Names, *************** package Snames is *** 1541,1551 **** --- 1598,1610 ---- Pragma_No_Return, Pragma_Obsolescent, Pragma_Optimize, + Pragma_Ordered, Pragma_Pack, Pragma_Page, Pragma_Passive, Pragma_Postcondition, Pragma_Precondition, + Pragma_Predicate, Pragma_Preelaborable_Initialization, Pragma_Preelaborate, Pragma_Preelaborate_05, *************** package Snames is *** 1690,1698 **** -- call this function with a name that is not the name of a attribute. function Get_Convention_Id (N : Name_Id) return Convention_Id; ! -- Returns Id of language convention corresponding to given name. It is an ! -- to call this function with a name that is not the name of a convention, ! -- 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 corresponding to given --- 1749,1758 ---- -- call this function with a name that is not the name of a attribute. function Get_Convention_Id (N : Name_Id) return Convention_Id; ! -- Returns Id of language convention corresponding to given name. It is ! -- an error to call this function with a name that is not the name of a ! -- convention, or one that has been previously recorded using a call to ! -- Record_Convention_Identifier. function Get_Convention_Name (C : Convention_Id) return Name_Id; -- Returns the name of language convention corresponding to given diff -Nrcpad gcc-4.5.2/gcc/ada/socket.c gcc-4.6.0/gcc/ada/socket.c *** gcc-4.5.2/gcc/ada/socket.c Mon Nov 30 10:38:23 2009 --- gcc-4.6.0/gcc/ada/socket.c Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 2003-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 2003-2010, 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,57 **** /* This file provides a portable binding to the sockets API */ #include "gsocket.h" #ifdef VMS /* * For VMS, gsocket.h can't include sockets-related DEC C header files * when building the runtime (because these files are in a DEC C text library ! * (DECC$RTLDEF.TLB) not accessable to GCC). So, we generate a separate header * file along with s-oscons.ads and include it here. */ # include "s-oscons.h" /* ! * We also need the declaration of struct servent, which s-oscons can't ! * provide, so we copy it manually here. This needs to be kept in synch * with the definition of that structure in the DEC C headers, which * hopefully won't change frequently. */ struct servent { ! char *s_name; /* official service name */ ! char **s_aliases; /* alias list */ ! int s_port; /* port # */ ! char *s_proto; /* protocol to use */ }; #endif --- 32,69 ---- /* This file provides a portable binding to the sockets API */ #include "gsocket.h" + #ifdef VMS /* * For VMS, gsocket.h can't include sockets-related DEC C header files * when building the runtime (because these files are in a DEC C text library ! * (DECC$RTLDEF.TLB) not accessible to GCC). So, we generate a separate header * file along with s-oscons.ads and include it here. */ # include "s-oscons.h" /* ! * We also need the declaration of struct hostent/servent, which s-oscons ! * can't provide, so we copy it manually here. This needs to be kept in synch * with the definition of that structure in the DEC C headers, which * hopefully won't change frequently. */ + typedef char *__netdb_char_ptr __attribute__ (( mode (SI) )); + typedef __netdb_char_ptr *__netdb_char_ptr_ptr __attribute__ (( mode (SI) )); + + struct hostent { + __netdb_char_ptr h_name; + __netdb_char_ptr_ptr h_aliases; + int h_addrtype; + int h_length; + __netdb_char_ptr_ptr h_addr_list; + }; + struct servent { ! __netdb_char_ptr s_name; ! __netdb_char_ptr_ptr s_aliases; ! int s_port; ! __netdb_char_ptr s_proto; }; #endif *************** extern void __gnat_remove_socket_from_se *** 87,101 **** extern void __gnat_reset_socket_set (fd_set *); extern int __gnat_get_h_errno (void); extern int __gnat_socket_ioctl (int, int, int *); extern char * __gnat_servent_s_name (struct servent *); ! extern char ** __gnat_servent_s_aliases (struct servent *); ! extern int __gnat_servent_s_port (struct servent *); extern char * __gnat_servent_s_proto (struct servent *); ! extern void __gnat_servent_set_s_name (struct servent *, char *); ! extern void __gnat_servent_set_s_aliases (struct servent *, char **); ! extern void __gnat_servent_set_s_port (struct servent *, int); ! extern void __gnat_servent_set_s_proto (struct servent *, char *); ! #if defined (__vxworks) || defined (_WIN32) extern int __gnat_inet_pton (int, const char *, void *); #endif --- 99,117 ---- extern void __gnat_reset_socket_set (fd_set *); extern int __gnat_get_h_errno (void); extern int __gnat_socket_ioctl (int, int, int *); + extern char * __gnat_servent_s_name (struct servent *); ! extern char * __gnat_servent_s_alias (struct servent *, int index); ! extern unsigned short __gnat_servent_s_port (struct servent *); extern char * __gnat_servent_s_proto (struct servent *); ! ! extern char * __gnat_hostent_h_name (struct hostent *); ! extern char * __gnat_hostent_h_alias (struct hostent *, int); ! extern int __gnat_hostent_h_addrtype (struct hostent *); ! extern int __gnat_hostent_h_length (struct hostent *); ! extern char * __gnat_hostent_h_addr (struct hostent *, int); ! ! #ifndef HAVE_INET_PTON extern int __gnat_inet_pton (int, const char *, void *); #endif *************** __gnat_close_signalling_fd (int sig) { *** 164,239 **** #endif /* ! * GetXXXbyYYY wrappers ! * These functions are used by the default implementation of g-socthi, ! * and also by the Windows version. * ! * They can be used for any platform that either provides an intrinsically ! * task safe implementation of getXXXbyYYY, or a reentrant variant ! * getXXXbyYYY_r. Otherwise, a task safe wrapper, including proper mutual ! * exclusion if appropriate, must be implemented in the target specific ! * version of g-socthi. */ ! #ifdef HAVE_THREAD_SAFE_GETxxxBYyyy ! int ! __gnat_safe_gethostbyname (const char *name, ! struct hostent *ret, char *buf, size_t buflen, ! int *h_errnop) ! { ! struct hostent *rh; ! rh = gethostbyname (name); ! if (rh == NULL) { ! *h_errnop = h_errno; ! return -1; ! } ! *ret = *rh; ! *h_errnop = 0; ! return 0; ! } ! ! int ! __gnat_safe_gethostbyaddr (const char *addr, int len, int type, ! struct hostent *ret, char *buf, size_t buflen, ! int *h_errnop) ! { ! struct hostent *rh; ! rh = gethostbyaddr (addr, len, type); ! if (rh == NULL) { ! *h_errnop = h_errno; ! return -1; ! } ! *ret = *rh; ! *h_errnop = 0; ! return 0; ! } ! ! int ! __gnat_safe_getservbyname (const char *name, const char *proto, ! struct servent *ret, char *buf, size_t buflen) ! { ! struct servent *rh; ! rh = getservbyname (name, proto); ! if (rh == NULL) ! return -1; ! *ret = *rh; ! return 0; ! } ! ! int ! __gnat_safe_getservbyport (int port, const char *proto, ! struct servent *ret, char *buf, size_t buflen) ! { ! struct servent *rh; ! rh = getservbyport (port, proto); ! if (rh == NULL) ! return -1; ! *ret = *rh; ! return 0; ! } ! #elif HAVE_GETxxxBYyyy_R int ! __gnat_safe_gethostbyname (const char *name, struct hostent *ret, char *buf, size_t buflen, int *h_errnop) { --- 180,207 ---- #endif /* ! * Handling of gethostbyname, gethostbyaddr, getservbyname and getservbyport ! * ========================================================================= * ! * This module exposes __gnat_getXXXbyYYY operations with the same signature ! * as the reentrant variant getXXXbyYYY_r. ! * ! * On platforms where getXXXbyYYY is intrinsically reentrant, the provided user ! * buffer argument is ignored. ! * ! * When getXXXbyYYY is not reentrant but getXXXbyYYY_r exists, the latter is ! * used, and the provided buffer argument must point to a valid, thread-local ! * buffer (usually on the caller's stack). ! * ! * When getXXXbyYYY is not reentrant and no reentrant getXXXbyYYY_r variant ! * is available, the non-reentrant getXXXbyYYY is called, the provided user ! * buffer is ignored, and the caller is expected to take care of mutual ! * exclusion. */ ! #ifdef HAVE_GETxxxBYyyy_R int ! __gnat_gethostbyname (const char *name, struct hostent *ret, char *buf, size_t buflen, int *h_errnop) { *************** __gnat_safe_gethostbyname (const char *n *** 250,256 **** } int ! __gnat_safe_gethostbyaddr (const char *addr, int len, int type, struct hostent *ret, char *buf, size_t buflen, int *h_errnop) { --- 218,224 ---- } int ! __gnat_gethostbyaddr (const char *addr, int len, int type, struct hostent *ret, char *buf, size_t buflen, int *h_errnop) { *************** __gnat_safe_gethostbyaddr (const char *a *** 267,273 **** } int ! __gnat_safe_getservbyname (const char *name, const char *proto, struct servent *ret, char *buf, size_t buflen) { struct servent *rh; --- 235,241 ---- } int ! __gnat_getservbyname (const char *name, const char *proto, struct servent *ret, char *buf, size_t buflen) { struct servent *rh; *************** __gnat_safe_getservbyname (const char *n *** 283,289 **** } int ! __gnat_safe_getservbyport (int port, const char *proto, struct servent *ret, char *buf, size_t buflen) { struct servent *rh; --- 251,257 ---- } int ! __gnat_getservbyport (int port, const char *proto, struct servent *ret, char *buf, size_t buflen) { struct servent *rh; *************** __gnat_safe_getservbyport (int port, con *** 297,302 **** --- 265,394 ---- ri = (rh == NULL) ? -1 : 0; return ri; } + #elif defined (__vxworks) + static char vxw_h_name[MAXHOSTNAMELEN + 1]; + static char *vxw_h_aliases[1] = { NULL }; + static int vxw_h_addr; + static char *vxw_h_addr_list[2] = { (char*) &vxw_h_addr, NULL }; + + int + __gnat_gethostbyname (const char *name, + struct hostent *ret, char *buf, size_t buflen, + int *h_errnop) + { + vxw_h_addr = hostGetByName (name); + if (vxw_h_addr == ERROR) { + *h_errnop = __gnat_get_h_errno (); + return -1; + } + ret->h_name = name; + ret->h_aliases = &vxw_h_aliases; + ret->h_addrtype = AF_INET; + ret->h_length = 4; + ret->h_addr_list = &vxw_h_addr_list; + return 0; + } + + int + __gnat_gethostbyaddr (const char *addr, int len, int type, + struct hostent *ret, char *buf, size_t buflen, + int *h_errnop) + { + if (type != AF_INET) { + *h_errnop = EAFNOSUPPORT; + return -1; + } + + if (addr == NULL || len != 4) { + *h_errnop = EINVAL; + return -1; + } + + if (hostGetByAddr (*(int*)addr, &vxw_h_name) != OK) { + *h_errnop = __gnat_get_h_errno (); + return -1; + } + + vxw_h_addr = addr; + + ret->h_name = &vxw_h_name; + ret->h_aliases = &vxw_h_aliases; + ret->h_addrtype = AF_INET; + ret->h_length = 4; + ret->h_addr_list = &vxw_h_addr_list; + } + + int + __gnat_getservbyname (const char *name, const char *proto, + struct servent *ret, char *buf, size_t buflen) + { + /* Not available under VxWorks */ + return -1; + } + + int + __gnat_getservbyport (int port, const char *proto, + struct servent *ret, char *buf, size_t buflen) + { + /* Not available under VxWorks */ + return -1; + } + #else + int + __gnat_gethostbyname (const char *name, + struct hostent *ret, char *buf, size_t buflen, + int *h_errnop) + { + struct hostent *rh; + rh = gethostbyname (name); + if (rh == NULL) { + *h_errnop = __gnat_get_h_errno (); + return -1; + } + *ret = *rh; + *h_errnop = 0; + return 0; + } + + int + __gnat_gethostbyaddr (const char *addr, int len, int type, + struct hostent *ret, char *buf, size_t buflen, + int *h_errnop) + { + struct hostent *rh; + rh = gethostbyaddr (addr, len, type); + if (rh == NULL) { + *h_errnop = __gnat_get_h_errno (); + return -1; + } + *ret = *rh; + *h_errnop = 0; + return 0; + } + + int + __gnat_getservbyname (const char *name, const char *proto, + struct servent *ret, char *buf, size_t buflen) + { + struct servent *rh; + rh = getservbyname (name, proto); + if (rh == NULL) + return -1; + *ret = *rh; + return 0; + } + + int + __gnat_getservbyport (int port, const char *proto, + struct servent *ret, char *buf, size_t buflen) + { + struct servent *rh; + rh = getservbyport (port, proto); + if (rh == NULL) + return -1; + *ret = *rh; + return 0; + } #endif /* Find the largest socket in the socket set SET. This is needed for *************** int *** 437,442 **** --- 529,540 ---- __gnat_socket_ioctl (int fd, int req, int *arg) { #if defined (_WIN32) return ioctlsocket (fd, req, arg); + #elif defined (__APPLE__) + /* + * On Darwin, req is an unsigned long, and we want to convert without sign + * extension to get the proper bit pattern in the case of a 64 bit kernel. + */ + return ioctl (fd, (unsigned int) req, arg); #else return ioctl (fd, req, arg); #endif *************** __gnat_inet_pton (int af, const char *sr *** 510,515 **** --- 608,637 ---- #endif /* + * Accessor functions for struct hostent. + */ + + char * __gnat_hostent_h_name (struct hostent * h) { + return h->h_name; + } + + char * __gnat_hostent_h_alias (struct hostent * h, int index) { + return h->h_aliases[index]; + } + + int __gnat_hostent_h_addrtype (struct hostent * h) { + return h->h_addrtype; + } + + int __gnat_hostent_h_length (struct hostent * h) { + return h->h_length; + } + + char * __gnat_hostent_h_addr (struct hostent * h, int index) { + return h->h_addr_list[index]; + } + + /* * Accessor functions for struct servent. * * These are needed because servent has different representations on different *************** __gnat_inet_pton (int af, const char *sr *** 539,559 **** * }; */ - /* Getters */ - char * __gnat_servent_s_name (struct servent * s) { return s->s_name; } ! char ** ! __gnat_servent_s_aliases (struct servent * s) { ! return s->s_aliases; } ! int __gnat_servent_s_port (struct servent * s) { return s->s_port; --- 661,679 ---- * }; */ char * __gnat_servent_s_name (struct servent * s) { return s->s_name; } ! char * ! __gnat_servent_s_alias (struct servent * s, int index) { ! return s->s_aliases[index]; } ! unsigned short __gnat_servent_s_port (struct servent * s) { return s->s_port; *************** __gnat_servent_s_proto (struct servent * *** 565,596 **** return s->s_proto; } - /* Setters */ - - void - __gnat_servent_set_s_name (struct servent * s, char * s_name) - { - s->s_name = s_name; - } - - void - __gnat_servent_set_s_aliases (struct servent * s, char ** s_aliases) - { - s->s_aliases = s_aliases; - } - - void - __gnat_servent_set_s_port (struct servent * s, int s_port) - { - s->s_port = s_port; - } - - void - __gnat_servent_set_s_proto (struct servent * s, char * s_proto) - { - s->s_proto = s_proto; - } - #else # warning Sockets are not supported on this platform #endif /* defined(HAVE_SOCKETS) */ --- 685,690 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/sprint.adb gcc-4.6.0/gcc/ada/sprint.adb *** gcc-4.5.2/gcc/ada/sprint.adb Mon Nov 30 11:55:21 2009 --- gcc-4.6.0/gcc/ada/sprint.adb Fri Oct 22 10:09:51 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Casing; use Casing; with Csets; use Csets; *************** package body Sprint is *** 65,71 **** -- Set True if the -gnatdo (dump original tree) flag is set Dump_Generated_Only : Boolean; ! -- Set True if the -gnatG (dump generated tree) debug flag is set -- or for Print_Generated_Code (-gnatG) or Dump_Generated_Code (-gnatD). Dump_Freeze_Null : Boolean; --- 66,72 ---- -- Set True if the -gnatdo (dump original tree) flag is set Dump_Generated_Only : Boolean; ! -- Set True if the -gnatdG (dump generated tree) debug flag is set -- or for Print_Generated_Code (-gnatG) or Dump_Generated_Code (-gnatD). Dump_Freeze_Null : Boolean; *************** package body Sprint is *** 182,187 **** --- 183,194 ---- procedure Sprint_And_List (List : List_Id); -- Print the given list with items separated by vertical "and" + procedure Sprint_Aspect_Specifications (Node : Node_Id); + -- Node is a declaration node that has aspect specifications (Has_Aspects + -- flag set True). It is called after outputting the terminating semicolon + -- for the related node. The effect is to remove the semicolon and print + -- the aspect specifications, followed by a terminating semicolon. + procedure Sprint_Bar_List (List : List_Id); -- Print the given list with items separated by vertical bars *************** package body Sprint is *** 403,409 **** procedure pg (Arg : Union_Id) is begin Dump_Generated_Only := True; ! Dump_Original_Only := False; Current_Source_File := No_Source_File; if Arg in List_Range then --- 410,417 ---- procedure pg (Arg : Union_Id) is begin Dump_Generated_Only := True; ! Dump_Original_Only := False; ! Dump_Freeze_Null := True; Current_Source_File := No_Source_File; if Arg in List_Range then *************** package body Sprint is *** 618,623 **** --- 626,670 ---- end if; end Sprint_And_List; + ---------------------------------- + -- Sprint_Aspect_Specifications -- + ---------------------------------- + + procedure Sprint_Aspect_Specifications (Node : Node_Id) is + AS : constant List_Id := Aspect_Specifications (Node); + A : Node_Id; + + begin + Write_Erase_Char (';'); + Indent := Indent + 2; + Write_Indent; + Write_Str ("with "); + Indent := Indent + 5; + + A := First (AS); + loop + Sprint_Node (Identifier (A)); + + if Class_Present (A) then + Write_Str ("'Class"); + end if; + + if Present (Expression (A)) then + Write_Str (" => "); + Sprint_Node (Expression (A)); + end if; + + Next (A); + + exit when No (A); + Write_Char (','); + Write_Indent; + end loop; + + Indent := Indent - 7; + Write_Char (';'); + end Sprint_Aspect_Specifications; + --------------------- -- Sprint_Bar_List -- --------------------- *************** package body Sprint is *** 800,806 **** -- Select print circuit based on node kind case Nkind (Node) is - when N_Abort_Statement => Write_Indent_Str_Sloc ("abort "); Sprint_Comma_List (Names (Node)); --- 847,852 ---- *************** package body Sprint is *** 998,1009 **** Write_Str_Sloc (" and then "); Sprint_Right_Opnd (Node); ! when N_At_Clause => ! Write_Indent_Str_Sloc ("for "); ! Write_Id (Identifier (Node)); ! Write_Str_With_Col_Check (" use at "); ! Sprint_Node (Expression (Node)); ! Write_Char (';'); when N_Assignment_Statement => Write_Indent; --- 1044,1051 ---- Write_Str_Sloc (" and then "); Sprint_Right_Opnd (Node); ! when N_Aspect_Specification => ! raise Program_Error; when N_Assignment_Statement => Write_Indent; *************** package body Sprint is *** 1025,1030 **** --- 1067,1079 ---- Sprint_Node (Abortable_Part (Node)); Write_Indent_Str ("end select;"); + when N_At_Clause => + Write_Indent_Str_Sloc ("for "); + Write_Id (Identifier (Node)); + Write_Str_With_Col_Check (" use at "); + Sprint_Node (Expression (Node)); + Write_Char (';'); + when N_Attribute_Definition_Clause => Write_Indent_Str_Sloc ("for "); Sprint_Node (Name (Node)); *************** package body Sprint is *** 1083,1088 **** --- 1132,1163 ---- Write_Char (';'); + when N_Case_Expression => + declare + Alt : Node_Id; + + begin + Write_Str_With_Col_Check_Sloc ("(case "); + Sprint_Node (Expression (Node)); + Write_Str_With_Col_Check (" is"); + + Alt := First (Alternatives (Node)); + loop + Sprint_Node (Alt); + Next (Alt); + exit when No (Alt); + Write_Char (','); + end loop; + + Write_Char (')'); + end; + + when N_Case_Expression_Alternative => + Write_Str_With_Col_Check (" when "); + Sprint_Bar_List (Discrete_Choices (Node)); + Write_Str (" => "); + Sprint_Node (Expression (Node)); + when N_Case_Statement => Write_Indent_Str_Sloc ("case "); Sprint_Node (Expression (Node)); *************** package body Sprint is *** 1224,1237 **** declare Condition : constant Node_Id := First (Expressions (Node)); Then_Expr : constant Node_Id := Next (Condition); ! Else_Expr : constant Node_Id := Next (Then_Expr); begin Write_Str_With_Col_Check_Sloc ("(if "); Sprint_Node (Condition); Write_Str_With_Col_Check (" then "); ! Sprint_Node (Then_Expr); ! Write_Str_With_Col_Check (" else "); ! Sprint_Node (Else_Expr); Write_Char (')'); end; --- 1299,1318 ---- declare Condition : constant Node_Id := First (Expressions (Node)); Then_Expr : constant Node_Id := Next (Condition); ! begin Write_Str_With_Col_Check_Sloc ("(if "); Sprint_Node (Condition); Write_Str_With_Col_Check (" then "); ! ! -- Defense against junk here! ! ! if Present (Then_Expr) then ! Sprint_Node (Then_Expr); ! Write_Str_With_Col_Check (" else "); ! Sprint_Node (Next (Then_Expr)); ! end if; ! Write_Char (')'); end; *************** package body Sprint is *** 1299,1305 **** Write_Str_With_Col_Check ("abstract "); end if; ! Write_Str_With_Col_Check_Sloc ("new "); -- Ada 2005 (AI-231) --- 1380,1386 ---- Write_Str_With_Col_Check ("abstract "); end if; ! Write_Str_With_Col_Check ("new "); -- Ada 2005 (AI-231) *************** package body Sprint is *** 1508,1513 **** --- 1589,1607 ---- Write_Char_Sloc ('.'); Write_Str_Sloc ("all"); + when N_Expression_With_Actions => + Indent_Begin; + Write_Indent_Str_Sloc ("do "); + Indent_Begin; + Sprint_Node_List (Actions (Node)); + Indent_End; + Write_Indent; + Write_Str_With_Col_Check_Sloc ("in "); + Sprint_Node (Expression (Node)); + Write_Str_With_Col_Check (" end"); + Indent_End; + Write_Indent; + when N_Extended_Return_Statement => Write_Indent_Str_Sloc ("return "); Sprint_Node_List (Return_Object_Declarations (Node)); *************** package body Sprint is *** 1901,1911 **** Sprint_Node (Condition (Node)); else Write_Str_With_Col_Check_Sloc ("for "); ! Sprint_Node (Loop_Parameter_Specification (Node)); end if; Write_Char (' '); when N_Itype_Reference => Write_Indent_Str_Sloc ("reference "); Write_Id (Itype (Node)); --- 1995,2031 ---- Sprint_Node (Condition (Node)); else Write_Str_With_Col_Check_Sloc ("for "); ! ! if Present (Iterator_Specification (Node)) then ! Sprint_Node (Iterator_Specification (Node)); ! else ! Sprint_Node (Loop_Parameter_Specification (Node)); ! end if; end if; Write_Char (' '); + when N_Iterator_Specification => + Set_Debug_Sloc; + Write_Id (Defining_Identifier (Node)); + + if Present (Subtype_Indication (Node)) then + Write_Str_With_Col_Check (" : "); + Sprint_Node (Subtype_Indication (Node)); + end if; + + if Of_Present (Node) then + Write_Str_With_Col_Check (" of "); + else + Write_Str_With_Col_Check (" in "); + end if; + + if Reverse_Present (Node) then + Write_Str_With_Col_Check ("reverse "); + end if; + + Sprint_Node (Name (Node)); + when N_Itype_Reference => Write_Indent_Str_Sloc ("reference "); Write_Id (Itype (Node)); *************** package body Sprint is *** 2342,2347 **** --- 2462,2478 ---- Write_Str (", "); end if; + when N_Parameterized_Expression => + Write_Indent; + Sprint_Node_Sloc (Specification (Node)); + + Write_Str (" is"); + Indent_Begin; + Write_Indent; + Sprint_Node (Expression (Node)); + Write_Char (';'); + Indent_End; + when N_Pop_Constraint_Error_Label => Write_Indent_Str ("%pop_constraint_error_label"); *************** package body Sprint is *** 2351,2356 **** --- 2482,2529 ---- when N_Pop_Storage_Error_Label => Write_Indent_Str ("%pop_storage_error_label"); + when N_Private_Extension_Declaration => + Write_Indent_Str_Sloc ("type "); + Write_Id (Defining_Identifier (Node)); + + if Present (Discriminant_Specifications (Node)) then + Write_Discr_Specs (Node); + elsif Unknown_Discriminants_Present (Node) then + Write_Str_With_Col_Check ("(<>)"); + end if; + + Write_Str_With_Col_Check (" is new "); + Sprint_Node (Subtype_Indication (Node)); + + if Present (Interface_List (Node)) then + Write_Str_With_Col_Check (" and "); + Sprint_And_List (Interface_List (Node)); + end if; + + Write_Str_With_Col_Check (" with private;"); + + when N_Private_Type_Declaration => + Write_Indent_Str_Sloc ("type "); + Write_Id (Defining_Identifier (Node)); + + if Present (Discriminant_Specifications (Node)) then + Write_Discr_Specs (Node); + elsif Unknown_Discriminants_Present (Node) then + Write_Str_With_Col_Check ("(<>)"); + end if; + + Write_Str (" is "); + + if Tagged_Present (Node) then + Write_Str_With_Col_Check ("tagged "); + end if; + + if Limited_Present (Node) then + Write_Str_With_Col_Check ("limited "); + end if; + + Write_Str_With_Col_Check ("private;"); + when N_Push_Constraint_Error_Label => Write_Indent_Str ("%push_constraint_error_label ("); *************** package body Sprint is *** 2399,2446 **** Sprint_Node (Expression (Node)); - when N_Private_Type_Declaration => - Write_Indent_Str_Sloc ("type "); - Write_Id (Defining_Identifier (Node)); - - if Present (Discriminant_Specifications (Node)) then - Write_Discr_Specs (Node); - elsif Unknown_Discriminants_Present (Node) then - Write_Str_With_Col_Check ("(<>)"); - end if; - - Write_Str (" is "); - - if Tagged_Present (Node) then - Write_Str_With_Col_Check ("tagged "); - end if; - - if Limited_Present (Node) then - Write_Str_With_Col_Check ("limited "); - end if; - - Write_Str_With_Col_Check ("private;"); - - when N_Private_Extension_Declaration => - Write_Indent_Str_Sloc ("type "); - Write_Id (Defining_Identifier (Node)); - - if Present (Discriminant_Specifications (Node)) then - Write_Discr_Specs (Node); - elsif Unknown_Discriminants_Present (Node) then - Write_Str_With_Col_Check ("(<>)"); - end if; - - Write_Str_With_Col_Check (" is new "); - Sprint_Node (Subtype_Indication (Node)); - - if Present (Interface_List (Node)) then - Write_Str_With_Col_Check (" and "); - Sprint_And_List (Interface_List (Node)); - end if; - - Write_Str_With_Col_Check (" with private;"); - when N_Procedure_Call_Statement => Write_Indent; Set_Debug_Sloc; --- 2572,2577 ---- *************** package body Sprint is *** 2521,2526 **** --- 2652,2670 ---- Write_Char (')'); end if; + when N_Quantified_Expression => + Write_Str (" for"); + + if All_Present (Node) then + Write_Str (" all "); + else + Write_Str (" some "); + end if; + + Sprint_Node (Loop_Parameter_Specification (Node)); + Write_Str (" => "); + Sprint_Node (Condition (Node)); + when N_Raise_Constraint_Error => -- This node can be used either as a subexpression or as a *************** package body Sprint is *** 2643,2651 **** -- Doc of this extended syntax belongs in sinfo.ads and/or -- sprint.ads ??? - when N_SCIL_Dispatch_Table_Object_Init => - Write_Indent_Str ("[N_SCIL_Dispatch_Table_Object_Init]"); - when N_SCIL_Dispatch_Table_Tag_Init => Write_Indent_Str ("[N_SCIL_Dispatch_Table_Tag_Init]"); --- 2787,2792 ---- *************** package body Sprint is *** 2655,2663 **** when N_SCIL_Membership_Test => Write_Indent_Str ("[N_SCIL_Membership_Test]"); - when N_SCIL_Tag_Init => - Write_Indent_Str ("[N_SCIL_Dispatch_Table_Tag_Init]"); - when N_Simple_Return_Statement => if Present (Expression (Node)) then Write_Indent_Str_Sloc ("return "); --- 2796,2801 ---- *************** package body Sprint is *** 2745,2751 **** end if; Write_Indent; ! Sprint_Node_Sloc (Specification (Node)); Write_Str (" is"); Sprint_Indented_List (Declarations (Node)); --- 2883,2895 ---- end if; Write_Indent; ! ! if Present (Corresponding_Spec (Node)) then ! Sprint_Node_Sloc (Parent (Corresponding_Spec (Node))); ! else ! Sprint_Node_Sloc (Specification (Node)); ! end if; ! Write_Str (" is"); Sprint_Indented_List (Declarations (Node)); *************** package body Sprint is *** 2873,2879 **** when N_Terminate_Alternative => Sprint_Node_List (Pragmas_Before (Node)); - Write_Indent; if Present (Condition (Node)) then --- 3017,3022 ---- *************** package body Sprint is *** 3031,3039 **** Write_Char (';'); end if; end if; - end case; if Nkind (Node) in N_Subexpr and then Do_Range_Check (Node) then --- 3174,3185 ---- Write_Char (';'); end if; end if; end case; + if Has_Aspects (Node) then + Sprint_Aspect_Specifications (Node); + end if; + if Nkind (Node) in N_Subexpr and then Do_Range_Check (Node) then *************** package body Sprint is *** 3427,3437 **** end if; -- Case of selector of an expanded name where the expanded name ! -- has an associated entity, output this entity. elsif Nkind (Parent (N)) = N_Expanded_Name and then Selector_Name (Parent (N)) = N ! and then Present (Entity (Parent (N))) then Write_Id (Entity (Parent (N))); --- 3573,3585 ---- end if; -- Case of selector of an expanded name where the expanded name ! -- has an associated entity, output this entity. Check that the ! -- entity or associated node is of the right kind, see above. elsif Nkind (Parent (N)) = N_Expanded_Name and then Selector_Name (Parent (N)) = N ! and then Present (Entity_Or_Associated_Node (Parent (N))) ! and then Nkind (Entity (Parent (N))) in N_Entity then Write_Id (Entity (Parent (N))); *************** package body Sprint is *** 3718,3729 **** when Access_Kind => Write_Header (Ekind (Typ) = E_Access_Type); Write_Str ("access "); if Is_Access_Constant (Typ) then Write_Str ("constant "); - elsif Can_Never_Be_Null (Typ) then - Write_Str ("not null "); end if; Write_Id (Directly_Designated_Type (Typ)); --- 3866,3880 ---- when Access_Kind => Write_Header (Ekind (Typ) = E_Access_Type); + + if Can_Never_Be_Null (Typ) then + Write_Str ("not null "); + end if; + Write_Str ("access "); if Is_Access_Constant (Typ) then Write_Str ("constant "); end if; Write_Id (Directly_Designated_Type (Typ)); *************** package body Sprint is *** 4322,4333 **** procedure Write_Ureal_With_Col_Check_Sloc (U : Ureal) is D : constant Uint := Denominator (U); N : constant Uint := Numerator (U); - begin ! Col_Check ! (UI_Decimal_Digits_Hi (D) + UI_Decimal_Digits_Hi (N) + 4); Set_Debug_Sloc; ! UR_Write (U); end Write_Ureal_With_Col_Check_Sloc; end Sprint; --- 4473,4482 ---- procedure Write_Ureal_With_Col_Check_Sloc (U : Ureal) is D : constant Uint := Denominator (U); N : constant Uint := Numerator (U); begin ! Col_Check (UI_Decimal_Digits_Hi (D) + UI_Decimal_Digits_Hi (N) + 4); Set_Debug_Sloc; ! UR_Write (U, Brackets => True); end Write_Ureal_With_Col_Check_Sloc; end Sprint; diff -Nrcpad gcc-4.5.2/gcc/ada/sprint.ads gcc-4.6.0/gcc/ada/sprint.ads *** gcc-4.5.2/gcc/ada/sprint.ads Mon Jul 20 13:06:01 2009 --- gcc-4.6.0/gcc/ada/sprint.ads Fri Sep 10 11:01:37 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,37 **** --- 32,38 ---- -- tree may either blow up on a debugging check, or list incorrect source. with Types; use Types; + package Sprint is ----------------------- *************** package Sprint is *** 53,60 **** -- Convert wi Rounded_Result target@(source) -- Divide wi Treat_Fixed_As_Integer x #/ y -- Divide wi Rounded_Result x @/ y -- Expression with range check {expression} - -- Operator with range check {operator} (e.g. {+}) -- Free statement free expr [storage_pool = xxx] -- Freeze entity with freeze actions freeze entityname [ actions ] -- Implicit call to run time routine $routine-name --- 54,61 ---- -- Convert wi Rounded_Result target@(source) -- Divide wi Treat_Fixed_As_Integer x #/ y -- Divide wi Rounded_Result x @/ y + -- Expression with actions do action; .. action; in expr end -- Expression with range check {expression} -- Free statement free expr [storage_pool = xxx] -- Freeze entity with freeze actions freeze entityname [ actions ] -- Implicit call to run time routine $routine-name *************** package Sprint is *** 69,80 **** -- Multiple concatenation expr && expr && expr ... && expr -- Multiply wi Treat_Fixed_As_Integer x #* y -- Multiply wi Rounded_Result x @* y -- Others choice for cleanup when all others -- Pop exception label %pop_xxx_exception_label -- Push exception label %push_xxx_exception_label (label) -- Raise xxx error [xxx_error [when cond]] -- Raise xxx error with msg [xxx_error [when cond], "msg"] ! -- Rational literal See UR_Write for details -- Rem wi Treat_Fixed_As_Integer x #rem y -- Reference expression'reference -- Shift nodes shift_name!(expr, count) --- 70,82 ---- -- Multiple concatenation expr && expr && expr ... && expr -- Multiply wi Treat_Fixed_As_Integer x #* y -- Multiply wi Rounded_Result x @* y + -- Operator with range check {operator} (e.g. {+}) -- Others choice for cleanup when all others -- Pop exception label %pop_xxx_exception_label -- Push exception label %push_xxx_exception_label (label) -- Raise xxx error [xxx_error [when cond]] -- Raise xxx error with msg [xxx_error [when cond], "msg"] ! -- Rational literal [expression] -- Rem wi Treat_Fixed_As_Integer x #rem y -- Reference expression'reference -- Shift nodes shift_name!(expr, count) diff -Nrcpad gcc-4.5.2/gcc/ada/stand.ads gcc-4.6.0/gcc/ada/stand.ads *** gcc-4.5.2/gcc/ada/stand.ads Fri Apr 17 13:07:12 2009 --- gcc-4.6.0/gcc/ada/stand.ads Fri Oct 22 10:00:18 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Stand is *** 413,421 **** Universal_Real : Entity_Id; -- Entity for universal real type. The bounds of this type correspond to ! -- to the largest supported real type (i.e. Long_Long_Real). It is the -- type used for runtime calculations in type universal real. Note that ! -- this type is always IEEE format, even if Long_Long_Real is Vax_Float -- (and in that case the bounds don't correspond exactly). Universal_Fixed : Entity_Id; --- 413,421 ---- Universal_Real : Entity_Id; -- Entity for universal real type. The bounds of this type correspond to ! -- to the largest supported real type (i.e. Long_Long_Float). It is the -- type used for runtime calculations in type universal real. Note that ! -- this type is always IEEE format, even if Long_Long_Float is Vax_Float -- (and in that case the bounds don't correspond exactly). Universal_Fixed : Entity_Id; diff -Nrcpad gcc-4.5.2/gcc/ada/style.adb gcc-4.6.0/gcc/ada/style.adb *** gcc-4.5.2/gcc/ada/style.adb Thu Apr 9 12:29:20 2009 --- gcc-4.6.0/gcc/ada/style.adb Fri Jun 18 12:14:52 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Style is *** 78,88 **** begin if Style_Check_Array_Attribute_Index then if D = 1 and then Present (E1) then ! Error_Msg_N ("(style) index number not allowed for one dimensional array", E1); elsif D > 1 and then No (E1) then ! Error_Msg_N ("(style) index number required for multi-dimensional array", N); end if; --- 78,88 ---- begin if Style_Check_Array_Attribute_Index then if D = 1 and then Present (E1) then ! Error_Msg_N -- CODEFIX ("(style) index number not allowed for one dimensional array", E1); elsif D > 1 and then No (E1) then ! Error_Msg_N -- CODEFIX ("(style) index number required for multi-dimensional array", N); end if; *************** package body Style is *** 161,167 **** then Error_Msg_Node_1 := Def; Error_Msg_Sloc := Sloc (Def); ! Error_Msg ("(style) bad casing of & declared#", Sref); return; --- 161,167 ---- then Error_Msg_Node_1 := Def; Error_Msg_Sloc := Sloc (Def); ! Error_Msg -- CODEFIX ("(style) bad casing of & declared#", Sref); return; *************** package body Style is *** 222,228 **** String (Tref (Sref .. Sref + Source_Ptr (Nlen) - 1)); Set_Casing (Cas); Error_Msg_Name_1 := Name_Enter; ! Error_Msg_N ("(style) bad casing of %% declared in Standard", Ref); end if; end if; --- 222,228 ---- String (Tref (Sref .. Sref + Source_Ptr (Nlen) - 1)); Set_Casing (Cas); Error_Msg_Name_1 := Name_Enter; ! Error_Msg_N -- CODEFIX ("(style) bad casing of %% declared in Standard", Ref); end if; end if; *************** package body Style is *** 243,252 **** if Style_Check_Missing_Overriding and then Comes_From_Source (N) then if Nkind (N) = N_Subprogram_Body then ! Error_Msg_N ("(style) missing OVERRIDING indicator in body of%", N); else ! Error_Msg_N ("(style) missing OVERRIDING indicator in declaration of%", N); end if; end if; --- 243,252 ---- if Style_Check_Missing_Overriding and then Comes_From_Source (N) then if Nkind (N) = N_Subprogram_Body then ! Error_Msg_N -- CODEFIX ("(style) missing OVERRIDING indicator in body of%", N); else ! Error_Msg_N -- CODEFIX ("(style) missing OVERRIDING indicator in declaration of%", N); end if; end if; *************** package body Style is *** 259,265 **** procedure Subprogram_Not_In_Alpha_Order (Name : Node_Id) is begin if Style_Check_Order_Subprograms then ! Error_Msg_N ("(style) subprogram body& not in alphabetical order", Name); end if; end Subprogram_Not_In_Alpha_Order; --- 259,265 ---- procedure Subprogram_Not_In_Alpha_Order (Name : Node_Id) is begin if Style_Check_Order_Subprograms then ! Error_Msg_N -- CODEFIX ("(style) subprogram body& not in alphabetical order", Name); end if; end Subprogram_Not_In_Alpha_Order; diff -Nrcpad gcc-4.5.2/gcc/ada/style.ads gcc-4.6.0/gcc/ada/style.ads *** gcc-4.5.2/gcc/ada/style.ads Wed Jul 22 10:25:57 2009 --- gcc-4.6.0/gcc/ada/style.ads Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- diff -Nrcpad gcc-4.5.2/gcc/ada/styleg.adb gcc-4.6.0/gcc/ada/styleg.adb *** gcc-4.5.2/gcc/ada/styleg.adb Wed Oct 28 14:22:09 2009 --- gcc-4.6.0/gcc/ada/styleg.adb Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Styleg is *** 201,207 **** end if; end OK_Boolean_Operand; ! -- Start of processig for Check_Boolean_Operator begin if Style_Check_Boolean_And_Or and then Comes_From_Source (Node) --- 201,208 ---- end if; end OK_Boolean_Operand; ! -- Start of processing for Check_Boolean_Operator ! begin if Style_Check_Boolean_And_Or and then Comes_From_Source (Node) *************** package body Styleg is *** 237,245 **** -- Otherwise we have an error elsif Nkind (Orig) = N_Op_And then ! Error_Msg ("(style) `AND THEN` required", Sloc (Orig)); else ! Error_Msg ("(style) `OR ELSE` required", Sloc (Orig)); end if; end; end if; --- 238,248 ---- -- Otherwise we have an error elsif Nkind (Orig) = N_Op_And then ! Error_Msg -- CODEFIX ! ("(style) `AND THEN` required", Sloc (Orig)); else ! Error_Msg -- CODEFIX ! ("(style) `OR ELSE` required", Sloc (Orig)); end if; end; end if; *************** package body Styleg is *** 434,440 **** if Scan_Ptr > Source_First (Current_Source_File) and then Source (Scan_Ptr - 1) > ' ' then ! Error_Msg_S ("(style) space required"); end if; end if; --- 437,444 ---- if Scan_Ptr > Source_First (Current_Source_File) and then Source (Scan_Ptr - 1) > ' ' then ! Error_Msg_S -- CODEFIX ! ("(style) space required"); end if; end if; *************** package body Styleg is *** 447,453 **** 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; --- 451,458 ---- if Source (Scan_Ptr + 2) > ' ' and then not Is_Special_Character (Source (Scan_Ptr + 2)) then ! Error_Msg -- CODEFIX ! ("(style) space required", Scan_Ptr + 2); end if; end if; *************** package body Styleg is *** 505,511 **** if Is_Box_Comment then Error_Space_Required (Scan_Ptr + 2); else ! Error_Msg ("(style) two spaces required", Scan_Ptr + 2); end if; return; --- 510,517 ---- if Is_Box_Comment then Error_Space_Required (Scan_Ptr + 2); else ! Error_Msg -- CODEFIX ! ("(style) two spaces required", Scan_Ptr + 2); end if; return; *************** package body Styleg is *** 558,569 **** -- We expect one blank line, from the EOF, but no more than one if Blank_Lines = 2 then ! Error_Msg ("(style) blank line not allowed at end of file", Blank_Line_Location); elsif Blank_Lines >= 3 then ! Error_Msg ("(style) blank lines not allowed at end of file", Blank_Line_Location); end if; --- 564,575 ---- -- We expect one blank line, from the EOF, but no more than one if Blank_Lines = 2 then ! Error_Msg -- CODEFIX ("(style) blank line not allowed at end of file", Blank_Line_Location); elsif Blank_Lines >= 3 then ! Error_Msg -- CODEFIX ("(style) blank lines not allowed at end of file", Blank_Line_Location); end if; *************** package body Styleg is *** 590,596 **** procedure Check_HT is begin if Style_Check_Horizontal_Tabs then ! Error_Msg_S ("(style) horizontal tab not allowed"); end if; end Check_HT; --- 596,603 ---- procedure Check_HT is begin if Style_Check_Horizontal_Tabs then ! Error_Msg_S -- CODEFIX ! ("(style) horizontal tab not allowed"); end if; end Check_HT; *************** package body Styleg is *** 608,614 **** if Token_Ptr = First_Non_Blank_Location and then Start_Column rem Style_Check_Indentation /= 0 then ! Error_Msg_SC ("(style) bad indentation"); end if; end if; end Check_Indentation; --- 615,622 ---- if Token_Ptr = First_Non_Blank_Location and then Start_Column rem Style_Check_Indentation /= 0 then ! Error_Msg_SC -- CODEFIX ! ("(style) bad indentation"); end if; end if; end Check_Indentation; *************** package body Styleg is *** 682,690 **** if Style_Check_Form_Feeds then if Source (Scan_Ptr) = ASCII.FF then ! Error_Msg_S ("(style) form feed not allowed"); elsif Source (Scan_Ptr) = ASCII.VT then ! Error_Msg_S ("(style) vertical tab not allowed"); end if; end if; --- 690,700 ---- if Style_Check_Form_Feeds then if Source (Scan_Ptr) = ASCII.FF then ! Error_Msg_S -- CODEFIX ! ("(style) form feed not allowed"); elsif Source (Scan_Ptr) = ASCII.VT then ! Error_Msg_S -- CODEFIX ! ("(style) vertical tab not allowed"); end if; end if; *************** package body Styleg is *** 717,723 **** -- Issue message for blanks at end of line if option enabled if Style_Check_Blanks_At_End and then L < Len then ! Error_Msg ("(style) trailing spaces not permitted", S); end if; --- 727,733 ---- -- Issue message for blanks at end of line if option enabled if Style_Check_Blanks_At_End and then L < Len then ! Error_Msg -- CODEFIX ("(style) trailing spaces not permitted", S); end if; *************** package body Styleg is *** 913,919 **** else if Token = Tok_Then then ! Error_Msg ("(style) no statements may follow THEN on same line", S); else Error_Msg --- 923,929 ---- else if Token = Tok_Then then ! Error_Msg -- CODEFIX ("(style) no statements may follow THEN on same line", S); else Error_Msg *************** package body Styleg is *** 977,983 **** procedure Check_Xtra_Parens (Loc : Source_Ptr) is begin if Style_Check_Xtra_Parens then ! Error_Msg ("redundant parentheses?", Loc); end if; end Check_Xtra_Parens; --- 987,994 ---- procedure Check_Xtra_Parens (Loc : Source_Ptr) is begin if Style_Check_Xtra_Parens then ! Error_Msg -- CODEFIX ! ("redundant parentheses?", Loc); end if; end Check_Xtra_Parens; *************** package body Styleg is *** 996,1002 **** procedure Error_Space_Not_Allowed (S : Source_Ptr) is begin ! Error_Msg ("(style) space not allowed", S); end Error_Space_Not_Allowed; -------------------------- --- 1007,1014 ---- procedure Error_Space_Not_Allowed (S : Source_Ptr) is begin ! Error_Msg -- CODEFIX ! ("(style) space not allowed", S); end Error_Space_Not_Allowed; -------------------------- *************** package body Styleg is *** 1005,1011 **** procedure Error_Space_Required (S : Source_Ptr) is begin ! Error_Msg ("(style) space required", S); end Error_Space_Required; -------------------- --- 1017,1024 ---- procedure Error_Space_Required (S : Source_Ptr) is begin ! Error_Msg -- CODEFIX ! ("(style) space required", S); end Error_Space_Required; -------------------- *************** package body Styleg is *** 1037,1043 **** begin if Style_Check_End_Labels then Error_Msg_Node_1 := Name; ! Error_Msg_SP ("(style) `END &` required"); end if; end No_End_Name; --- 1050,1057 ---- begin if Style_Check_End_Labels then Error_Msg_Node_1 := Name; ! Error_Msg_SP -- CODEFIX ! ("(style) `END &` required"); end if; end No_End_Name; *************** package body Styleg is *** 1052,1058 **** begin if Style_Check_End_Labels then Error_Msg_Node_1 := Name; ! Error_Msg_SP ("(style) `EXIT &` required"); end if; end No_Exit_Name; --- 1066,1073 ---- begin if Style_Check_End_Labels then Error_Msg_Node_1 := Name; ! Error_Msg_SP -- CODEFIX ! ("(style) `EXIT &` required"); end if; end No_Exit_Name; *************** package body Styleg is *** 1067,1073 **** procedure Non_Lower_Case_Keyword is begin if Style_Check_Keyword_Casing then ! Error_Msg_SC -- CODEIX ("(style) reserved words must be all lower case"); end if; end Non_Lower_Case_Keyword; --- 1082,1088 ---- procedure Non_Lower_Case_Keyword is begin if Style_Check_Keyword_Casing then ! Error_Msg_SC -- CODEFIX ("(style) reserved words must be all lower case"); end if; end Non_Lower_Case_Keyword; diff -Nrcpad gcc-4.5.2/gcc/ada/styleg.ads gcc-4.6.0/gcc/ada/styleg.ads *** gcc-4.5.2/gcc/ada/styleg.ads Wed Jul 22 10:25:57 2009 --- gcc-4.6.0/gcc/ada/styleg.ads Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- diff -Nrcpad gcc-4.5.2/gcc/ada/stylesw.adb gcc-4.6.0/gcc/ada/stylesw.adb *** gcc-4.5.2/gcc/ada/stylesw.adb Wed Jul 22 13:16:44 2009 --- gcc-4.6.0/gcc/ada/stylesw.adb Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Stylesw is *** 59,64 **** --- 59,69 ---- "u" & -- check no unnecessary blank lines "x"; -- check extra parentheses around conditionals + -- Note: we intend GNAT_Style to also include the following, but we do + -- not yet have the whole tool suite clean with respect to this. + + -- "B" & -- check boolean operators + ------------------------------- -- Reset_Style_Check_Options -- ------------------------------- diff -Nrcpad gcc-4.5.2/gcc/ada/stylesw.ads gcc-4.6.0/gcc/ada/stylesw.ads *** gcc-4.5.2/gcc/ada/stylesw.ads Wed Jul 22 10:25:57 2009 --- gcc-4.6.0/gcc/ada/stylesw.ads Thu Sep 9 10:32:50 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- diff -Nrcpad gcc-4.5.2/gcc/ada/switch-b.adb gcc-4.6.0/gcc/ada/switch-b.adb *** gcc-4.5.2/gcc/ada/switch-b.adb Thu Apr 9 10:38:54 2009 --- gcc-4.6.0/gcc/ada/switch-b.adb Wed Jun 23 06:11:20 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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,31 **** -- -- ------------------------------------------------------------------------------ ! with Debug; use Debug; ! with Osint; use Osint; ! with Opt; use Opt; with System.WCh_Con; use System.WCh_Con; --- 23,32 ---- -- -- ------------------------------------------------------------------------------ ! with Debug; use Debug; ! with Osint; use Osint; ! with Opt; use Opt; ! with Output; use Output; with System.WCh_Con; use System.WCh_Con; *************** package body Switch.B is *** 40,48 **** Ptr : Integer := Switch_Chars'First; C : Character := ' '; function Get_Stack_Size (S : Character) return Int; ! -- Used for -d and -D to scan stack size including handling k/m. ! -- S is set to 'd' or 'D' to indicate the switch being scanned. -------------------- -- Get_Stack_Size -- --- 41,75 ---- Ptr : Integer := Switch_Chars'First; C : Character := ' '; + function Get_Optional_Filename return String_Ptr; + -- If current character is '=', return a newly allocated string that + -- contains the remainder of the current switch (after the '='), else + -- return null. + function Get_Stack_Size (S : Character) return Int; ! -- Used for -d and -D to scan stack size including handling k/m. S is ! -- set to 'd' or 'D' to indicate the switch being scanned. ! ! --------------------------- ! -- Get_Optional_Filename -- ! --------------------------- ! ! function Get_Optional_Filename return String_Ptr is ! Result : String_Ptr; ! ! begin ! if Ptr <= Max and then Switch_Chars (Ptr) = '=' then ! if Ptr = Max then ! Bad_Switch (Switch_Chars); ! else ! Result := new String'(Switch_Chars (Ptr + 1 .. Max)); ! Ptr := Max + 1; ! return Result; ! end if; ! end if; ! ! return null; ! end Get_Optional_Filename; -------------------- -- Get_Stack_Size -- *************** package body Switch.B is *** 61,71 **** pragma Unsuppress (Overflow_Check); begin ! -- Check for additional character 'k' (for kilobytes) or 'm' ! -- (for Megabytes), but only if we have not reached the end ! -- of the switch string. Note that if this appears before the ! -- end of the string we will get an error when we test to make ! -- sure that the string is exhausted (at the end of the case). if Ptr <= Max then if Switch_Chars (Ptr) = 'k' then --- 88,98 ---- pragma Unsuppress (Overflow_Check); begin ! -- Check for additional character 'k' (for kilobytes) or 'm' (for ! -- Megabytes), but only if we have not reached the end of the ! -- switch string. Note that if this appears before the end of the ! -- string we will get an error when we test to make sure that the ! -- string is exhausted (at the end of the case). if Ptr <= Max then if Switch_Chars (Ptr) = 'k' then *************** package body Switch.B is *** 97,104 **** Ptr := Ptr + 1; end if; ! -- A little check, "gnat" at the start of a switch is not allowed ! -- except for the compiler if Switch_Chars'Last >= Ptr + 3 and then Switch_Chars (Ptr .. Ptr + 3) = "gnat" --- 124,131 ---- Ptr := Ptr + 1; end if; ! -- A little check, "gnat" at the start of a switch is not allowed except ! -- for the compiler if Switch_Chars'Last >= Ptr + 3 and then Switch_Chars (Ptr .. Ptr + 3) = "gnat" *************** package body Switch.B is *** 124,130 **** when 'A' => Ptr := Ptr + 1; ! Ada_Bind_File := True; -- Processing for b switch --- 151,158 ---- when 'A' => Ptr := Ptr + 1; ! Output_ALI_List := True; ! ALI_List_Filename := Get_Optional_Filename; -- Processing for b switch *************** package body Switch.B is *** 136,151 **** when 'c' => Ptr := Ptr + 1; - Check_Only := True; -- Processing for C switch when 'C' => Ptr := Ptr + 1; - Ada_Bind_File := False; -- Processing for d switch when 'd' => --- 164,179 ---- when 'c' => Ptr := Ptr + 1; Check_Only := True; -- Processing for C switch when 'C' => Ptr := Ptr + 1; Ada_Bind_File := False; + Write_Line ("warning: gnatbind switch -C is obsolescent"); + -- Processing for d switch when 'd' => *************** package body Switch.B is *** 243,248 **** --- 271,290 ---- Ptr := Ptr + 1; Usage_Requested := True; + -- Processing for H switch + + when 'H' => + if Ptr = Max then + Bad_Switch (Switch_Chars); + end if; + + Ptr := Ptr + 1; + Scan_Nat (Switch_Chars, Max, Ptr, Heap_Size, C); + + if Heap_Size /= 32 and then Heap_Size /= 64 then + Bad_Switch (Switch_Chars); + end if; + -- Processing for i switch when 'i' => *************** package body Switch.B is *** 253,259 **** Ptr := Ptr + 1; C := Switch_Chars (Ptr); ! if C in '1' .. '5' or else C = '8' or else C = 'p' or else C = 'f' --- 295,301 ---- Ptr := Ptr + 1; C := Switch_Chars (Ptr); ! if C in '1' .. '5' or else C = '8' or else C = 'p' or else C = 'f' *************** package body Switch.B is *** 305,311 **** if Output_File_Name_Present then Osint.Fail ("duplicate -o switch"); - else Output_File_Name_Present := True; end if; --- 347,352 ---- *************** package body Switch.B is *** 315,320 **** --- 356,362 ---- when 'O' => Ptr := Ptr + 1; Output_Object_List := True; + Object_List_Filename := Get_Optional_Filename; -- Processing for p switch *************** package body Switch.B is *** 338,344 **** when 'R' => Ptr := Ptr + 1; - Check_Only := True; List_Closure := True; -- Processing for s switch --- 380,385 ---- *************** package body Switch.B is *** 400,406 **** Ptr := Ptr + 1; case Switch_Chars (Ptr) is - when 'e' => Warning_Mode := Treat_As_Error; --- 441,446 ---- *************** package body Switch.B is *** 433,440 **** Wide_Character_Encoding_Method_Specified := True; Upper_Half_Encoding := ! Wide_Character_Encoding_Method in ! WC_Upper_Half_Encoding_Method; Ptr := Ptr + 1; --- 473,479 ---- Wide_Character_Encoding_Method_Specified := True; Upper_Half_Encoding := ! Wide_Character_Encoding_Method in WC_Upper_Half_Encoding_Method; Ptr := Ptr + 1; *************** package body Switch.B is *** 486,492 **** Osint.Fail ("missing path for --RTS"); else ! -- valid --RTS switch Opt.No_Stdinc := True; Opt.RTS_Switch := True; --- 525,531 ---- Osint.Fail ("missing path for --RTS"); else ! -- Valid --RTS switch Opt.No_Stdinc := True; Opt.RTS_Switch := True; *************** package body Switch.B is *** 508,515 **** Lib_Path_Name /= null then -- Set the RTS_*_Path_Name variables, so that the ! -- correct directories will be set when ! -- Osint.Add_Default_Search_Dirs will be called later. RTS_Src_Path_Name := Src_Path_Name; RTS_Lib_Path_Name := Lib_Path_Name; --- 547,554 ---- Lib_Path_Name /= null then -- Set the RTS_*_Path_Name variables, so that the ! -- correct directories will be set when a subsequent ! -- call Osint.Add_Default_Search_Dirs is made. RTS_Src_Path_Name := Src_Path_Name; RTS_Lib_Path_Name := Lib_Path_Name; diff -Nrcpad gcc-4.5.2/gcc/ada/switch-c.adb gcc-4.6.0/gcc/ada/switch-c.adb *** gcc-4.5.2/gcc/ada/switch-c.adb Tue Jan 26 13:49:56 2010 --- gcc-4.6.0/gcc/ada/switch-c.adb Tue Oct 26 13:00:05 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Validsw; use Validsw; *** 32,39 **** with Sem_Warn; use Sem_Warn; with Stylesw; use Stylesw; ! with System.OS_Lib; use System.OS_Lib; ! with System.WCh_Con; use System.WCh_Con; package body Switch.C is --- 32,38 ---- with Sem_Warn; use Sem_Warn; with Stylesw; use Stylesw; ! with System.Strings; with System.WCh_Con; use System.WCh_Con; package body Switch.C is *************** package body Switch.C is *** 41,51 **** RTS_Specified : String_Access := null; -- Used to detect multiple use of --RTS= flag ----------------------------- -- Scan_Front_End_Switches -- ----------------------------- ! procedure Scan_Front_End_Switches (Switch_Chars : String) is First_Switch : Boolean := True; -- False for all but first switch --- 40,64 ---- RTS_Specified : String_Access := null; -- Used to detect multiple use of --RTS= flag + function Switch_Subsequently_Cancelled + (C : String; + Args : Argument_List; + Arg_Rank : Positive) return Boolean; + -- This function is called from Scan_Front_End_Switches. It determines if + -- the switch currently being scanned is followed by a switch of the form + -- "-gnat-" & C, where C is the argument. If so, then True is returned, + -- and Scan_Front_End_Switches will cancel the effect of the switch. If + -- no such switch is found, False is returned. + ----------------------------- -- Scan_Front_End_Switches -- ----------------------------- ! procedure Scan_Front_End_Switches ! (Switch_Chars : String; ! Args : Argument_List; ! Arg_Rank : Positive) ! is First_Switch : Boolean := True; -- False for all but first switch *************** package body Switch.C is *** 232,238 **** when 'C' => Ptr := Ptr + 1; ! CodePeer_Mode := True; -- Processing for d switch --- 245,263 ---- when 'C' => Ptr := Ptr + 1; ! ! if not CodePeer_Mode then ! CodePeer_Mode := True; ! ! -- Suppress compiler warnings by default, since what we are ! -- interested in here is what CodePeer can find out. Note ! -- that if -gnatwxxx is specified after -gnatC on the ! -- command line, we do not want to override this setting in ! -- Adjust_Global_Switches, and assume that the user wants to ! -- get both warnings from GNAT and CodePeer messages. ! ! Warning_Mode := Suppress; ! end if; -- Processing for d switch *************** package body Switch.C is *** 397,402 **** --- 422,433 ---- ("-gnateD" & Switch_Chars (Ptr .. Max)); Ptr := Max + 1; + -- -gnateE (extra exception information) + + when 'E' => + Exception_Extra_Info := True; + Ptr := Ptr + 1; + -- -gnatef (full source path for brief error messages) when 'f' => *************** package body Switch.C is *** 464,469 **** --- 495,505 ---- Ptr := Max + 1; + -- -gnateP (Treat pragma Pure/Preelaborate errs as warnings) + + when 'P' => + Treat_Categorization_Errors_As_Warnings := True; + -- -gnatez (final delimiter of explicit switches) -- All switches that come after -gnatez have been added by *************** package body Switch.C is *** 519,529 **** System_Extend_Unit := Empty; Warning_Mode := Treat_As_Error; ! -- Set Ada 2005 mode explicitly. We don't want to rely on the -- implicit setting here, since for example, we want -- Preelaborate_05 treated as Preelaborate ! Ada_Version := Ada_05; Ada_Version_Explicit := Ada_Version; -- Set default warnings and style checks for -gnatg --- 555,565 ---- System_Extend_Unit := Empty; Warning_Mode := Treat_As_Error; ! -- Set Ada 2012 mode explicitly. We don't want to rely on the -- implicit setting here, since for example, we want -- Preelaborate_05 treated as Preelaborate ! Ada_Version := Ada_2012; Ada_Version_Explicit := Ada_Version; -- Set default warnings and style checks for -gnatg *************** package body Switch.C is *** 662,681 **** when 'p' => Ptr := Ptr + 1; ! -- Set all specific options as well as All_Checks in the ! -- Suppress_Options array, excluding Elaboration_Check, since ! -- this is treated specially because we do not want -gnatp to ! -- disable static elaboration processing. ! for J in Suppress_Options'Range loop ! if J /= Elaboration_Check then ! Suppress_Options (J) := True; ! end if; ! end loop; ! Validity_Checks_On := False; ! Opt.Suppress_Checks := True; ! Opt.Enable_Overflow_Checks := False; -- Processing for P switch --- 698,724 ---- when 'p' => Ptr := Ptr + 1; ! -- Skip processing if cancelled by subsequent -gnat-p ! if Switch_Subsequently_Cancelled ("p", Args, Arg_Rank) then ! Store_Switch := False; ! else ! -- Set all specific options as well as All_Checks in the ! -- Suppress_Options array, excluding Elaboration_Check, ! -- since this is treated specially because we do not want ! -- -gnatp to disable static elaboration processing. ! ! for J in Suppress_Options'Range loop ! if J /= Elaboration_Check then ! Suppress_Options (J) := True; ! end if; ! end loop; ! ! Validity_Checks_On := False; ! Opt.Suppress_Checks := True; ! Opt.Enable_Overflow_Checks := False; ! end if; -- Processing for P switch *************** package body Switch.C is *** 882,888 **** when 'X' => Ptr := Ptr + 1; ! Extensions_Allowed := True; -- Processing for y switch --- 925,933 ---- when 'X' => Ptr := Ptr + 1; ! Extensions_Allowed := True; ! Ada_Version := Ada_Version_Type'Last; ! Ada_Version_Explicit := Ada_Version_Type'Last; -- Processing for y switch *************** package body Switch.C is *** 933,938 **** --- 978,984 ---- -- Processing for z switch when 'z' => + -- -gnatz must be the first and only switch in Switch_Chars, -- and is a two-letter switch. *************** package body Switch.C is *** 1023,1037 **** Bad_Switch ("-gnat0" & Switch_Chars (Ptr .. Max)); else Ptr := Ptr + 1; ! Ada_Version := Ada_05; Ada_Version_Explicit := Ada_Version; end if; ! -- Ignore extra switch character - when '/' | '-' => Ptr := Ptr + 1; -- Anything else is an error (illegal switch character) when others => --- 1069,1140 ---- Bad_Switch ("-gnat0" & Switch_Chars (Ptr .. Max)); else Ptr := Ptr + 1; ! Ada_Version := Ada_2005; Ada_Version_Explicit := Ada_Version; end if; ! -- Processing for 12 switch ! ! when '1' => ! if Ptr = Max then ! Bad_Switch ("-gnat1"); ! end if; Ptr := Ptr + 1; + if Switch_Chars (Ptr) /= '2' then + Bad_Switch ("-gnat1" & Switch_Chars (Ptr .. Max)); + else + Ptr := Ptr + 1; + Ada_Version := Ada_2012; + Ada_Version_Explicit := Ada_Version; + end if; + + -- Processing for 2005 and 2012 switches + + when '2' => + if Ptr > Max - 3 then + Bad_Switch ("-gnat" & Switch_Chars (Ptr .. Max)); + + elsif Switch_Chars (Ptr .. Ptr + 3) = "2005" then + Ada_Version := Ada_2005; + + elsif Switch_Chars (Ptr .. Ptr + 3) = "2012" then + Ada_Version := Ada_2012; + + else + Bad_Switch ("-gnat" & Switch_Chars (Ptr .. Ptr + 3)); + end if; + + Ada_Version_Explicit := Ada_Version; + Ptr := Ptr + 4; + + -- Switch cancellation, currently only -gnat-p is allowed. + -- All we do here is the error checking, since the actual + -- processing for switch cancellation is done by calls to + -- Switch_Subsequently_Cancelled at the appropriate point. + + when '-' => + + -- Simple ignore -gnat-p + + if Switch_Chars = "-gnat-p" then + return; + + -- Any other occurrence of minus is ignored. This is for + -- maximum compatibility with previous version which ignored + -- all occurrences of minus. + + else + Store_Switch := False; + Ptr := Ptr + 1; + end if; + + -- We ignore '/' in switches, this is historical, still needed??? + + when '/' => + Store_Switch := False; + -- Anything else is an error (illegal switch character) when others => *************** package body Switch.C is *** 1048,1051 **** --- 1151,1179 ---- end if; end Scan_Front_End_Switches; + ----------------------------------- + -- Switch_Subsequently_Cancelled -- + ----------------------------------- + + function Switch_Subsequently_Cancelled + (C : String; + Args : Argument_List; + Arg_Rank : Positive) return Boolean + is + use type System.Strings.String_Access; + + begin + -- Loop through arguments following the current one + + for Arg in Arg_Rank + 1 .. Args'Last loop + if Args (Arg).all = "-gnat-" & C then + return True; + end if; + end loop; + + -- No match found, not cancelled + + return False; + end Switch_Subsequently_Cancelled; + end Switch.C; diff -Nrcpad gcc-4.5.2/gcc/ada/switch-c.ads gcc-4.6.0/gcc/ada/switch-c.ads *** gcc-4.5.2/gcc/ada/switch-c.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/switch-c.ads Thu Jun 17 09:06:41 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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,43 **** -- switches that are recognized. In addition, package Debug documents -- the otherwise undocumented debug switches that are also recognized. package Switch.C is ! procedure Scan_Front_End_Switches (Switch_Chars : String); -- Procedures to scan out front end switches stored in the given string. -- The first character is known to be a valid switch character, and there -- are no blanks or other switch terminator characters in the string, so -- the entire string should consist of valid switch characters, except that -- an optional terminating NUL character is allowed. A bad switch causes -- a fatal error exit and control does not return. The call also sets ! -- Usage_Requested to True if a ? switch is encountered. end Switch.C; --- 29,52 ---- -- switches that are recognized. In addition, package Debug documents -- the otherwise undocumented debug switches that are also recognized. + with System.OS_Lib; use System.OS_Lib; + package Switch.C is ! procedure Scan_Front_End_Switches ! (Switch_Chars : String; ! Args : Argument_List; ! Arg_Rank : Positive); -- Procedures to scan out front end switches stored in the given string. -- The first character is known to be a valid switch character, and there -- are no blanks or other switch terminator characters in the string, so -- the entire string should consist of valid switch characters, except that -- an optional terminating NUL character is allowed. A bad switch causes -- a fatal error exit and control does not return. The call also sets ! -- Usage_Requested to True if a switch -gnath is encountered. ! -- ! -- Args is the full list of command line arguments. Arg_Rank is the ! -- position of the switch in Args. It is used for certain switches -gnatx ! -- to check if a subsequent switch -gnat-x cancels the switch -gnatx. end Switch.C; diff -Nrcpad gcc-4.5.2/gcc/ada/switch-m.adb gcc-4.6.0/gcc/ada/switch-m.adb *** gcc-4.5.2/gcc/ada/switch-m.adb Fri Oct 30 13:27:40 2009 --- gcc-4.6.0/gcc/ada/switch-m.adb Tue Oct 12 13:05:11 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2001-2010, 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- -- *************** with Makeutl; use Makeutl; *** 28,36 **** with Osint; use Osint; with Opt; use Opt; with Prj; use Prj; ! with Prj.Ext; use Prj.Ext; with Table; package body Switch.M is package Normalized_Switches is new Table.Table --- 28,38 ---- with Osint; use Osint; with Opt; use Opt; with Prj; use Prj; ! with Prj.Env; use Prj.Env; with Table; + with System.Multiprocessors; use System.Multiprocessors; + package body Switch.M is package Normalized_Switches is new Table.Table *************** package body Switch.M is *** 71,77 **** procedure Add_Switch_Component (S : String); -- Add a new String_Access component in Switches. If a string equal -- to S is already stored in the table Normalized_Switches, use it. ! -- Other wise add a new component to the table. -------------------------- -- Add_Switch_Component -- --- 73,79 ---- procedure Add_Switch_Component (S : String); -- Add a new String_Access component in Switches. If a string equal -- to S is already stored in the table Normalized_Switches, use it. ! -- Otherwise add a new component to the table. -------------------------- -- Add_Switch_Component -- *************** package body Switch.M is *** 215,224 **** -- One-letter switches ! when 'a' | 'A' | 'b' | 'c' | 'D' | 'E' | 'f' | ! 'F' | 'g' | 'h' | 'H' | 'k' | 'l' | 'L' | 'n' | 'N' | ! 'o' | 'O' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 't' | ! 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' => Storing (First_Stored) := C; Add_Switch_Component (Storing (Storing'First .. First_Stored)); --- 217,226 ---- -- One-letter switches ! when 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'E' | 'f' | ! 'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'n' | 'N' | ! 'o' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 'S' | ! 't' | 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' => Storing (First_Stored) := C; Add_Switch_Component (Storing (Storing'First .. First_Stored)); *************** package body Switch.M is *** 226,235 **** -- One-letter switches followed by a positive number ! when 'm' | 'T' => Storing (First_Stored) := C; Last_Stored := First_Stored; loop Ptr := Ptr + 1; exit when Ptr > Max --- 228,241 ---- -- One-letter switches followed by a positive number ! when 'D' | 'G' | 'j' | 'k' | 'm' | 'T' => Storing (First_Stored) := C; Last_Stored := First_Stored; + if Ptr <= Max and then Switch_Chars (Ptr) = '=' then + Ptr := Ptr + 1; + end if; + loop Ptr := Ptr + 1; exit when Ptr > Max *************** package body Switch.M is *** 268,330 **** when 'e' => ! -- Store -gnateD, -gnatep= and -gnateG in the ALI file. ! -- The other -gnate switches do not need to be stored. Storing (First_Stored) := 'e'; Ptr := Ptr + 1; ! if Ptr > Max ! or else (Switch_Chars (Ptr) /= 'D' ! and then Switch_Chars (Ptr) /= 'G' ! and then Switch_Chars (Ptr) /= 'p') ! then Last := 0; return; - end if; ! -- Processing for -gnateD ! if Switch_Chars (Ptr) = 'D' then ! Storing (First_Stored + 1 .. ! First_Stored + Max - Ptr + 1) := ! Switch_Chars (Ptr .. Max); ! Add_Switch_Component ! (Storing (Storing'First .. ! First_Stored + Max - Ptr + 1)); ! -- Processing for -gnatep= ! elsif Switch_Chars (Ptr) = 'p' then ! Ptr := Ptr + 1; ! if Ptr = Max then ! Last := 0; ! return; ! end if; ! if Switch_Chars (Ptr) = '=' then ! Ptr := Ptr + 1; ! end if; ! -- To normalize, always put a '=' after -gnatep. ! -- Because that could lengthen the switch string, ! -- declare a local variable. ! declare ! To_Store : String (1 .. Max - Ptr + 9); ! begin ! To_Store (1 .. 8) := "-gnatep="; ! To_Store (9 .. Max - Ptr + 9) := ! Switch_Chars (Ptr .. Max); ! Add_Switch_Component (To_Store); ! end; ! elsif Switch_Chars (Ptr) = 'G' then ! Add_Switch_Component ("-gnateG"); ! end if; ! return; when 'i' => Storing (First_Stored) := 'i'; --- 274,366 ---- when 'e' => ! -- Some of the gnate... switches are not stored Storing (First_Stored) := 'e'; Ptr := Ptr + 1; ! if Ptr > Max then Last := 0; return; ! else ! case Switch_Chars (Ptr) is ! when 'D' => ! Storing (First_Stored + 1 .. ! First_Stored + Max - Ptr + 1) := ! Switch_Chars (Ptr .. Max); ! Add_Switch_Component ! (Storing (Storing'First .. ! First_Stored + Max - Ptr + 1)); ! Ptr := Max + 1; ! when 'G' => ! Ptr := Ptr + 1; ! Add_Switch_Component ("-gnateG"); ! when 'I' => ! Ptr := Ptr + 1; ! declare ! First : constant Positive := Ptr - 1; ! begin ! if Ptr <= Max and then ! Switch_Chars (Ptr) = '=' ! then ! Ptr := Ptr + 1; ! end if; ! while Ptr <= Max and then ! Switch_Chars (Ptr) in '0' .. '9' ! loop ! Ptr := Ptr + 1; ! end loop; ! Storing (First_Stored + 1 .. ! First_Stored + Ptr - First) := ! Switch_Chars (First .. Ptr - 1); ! Add_Switch_Component ! (Storing (Storing'First .. ! First_Stored + Ptr - First)); ! end; ! when 'p' => ! Ptr := Ptr + 1; ! if Ptr = Max then ! Last := 0; ! return; ! end if; ! if Switch_Chars (Ptr) = '=' then ! Ptr := Ptr + 1; ! end if; ! ! -- To normalize, always put a '=' after ! -- -gnatep. Because that could lengthen the ! -- switch string, declare a local variable. ! ! declare ! To_Store : String (1 .. Max - Ptr + 9); ! begin ! To_Store (1 .. 8) := "-gnatep="; ! To_Store (9 .. Max - Ptr + 9) := ! Switch_Chars (Ptr .. Max); ! Add_Switch_Component (To_Store); ! end; ! ! return; ! ! when 'S' => ! Ptr := Ptr + 1; ! Add_Switch_Component ("-gnateS"); ! ! when others => ! Last := 0; ! return; ! end case; ! end if; when 'i' => Storing (First_Stored) := 'i'; *************** package body Switch.M is *** 355,360 **** --- 391,410 ---- return; end if; + -- -gnatl may be -gnatl= + + when 'l' => + Ptr := Ptr + 1; + + if Ptr > Max or else Switch_Chars (Ptr) /= '=' then + Add_Switch_Component ("-gnatl"); + + else + Add_Switch_Component + ("-gnatl" & Switch_Chars (Ptr .. Max)); + return; + end if; + -- -gnatR may be followed by '0', '1', '2' or '3', -- then by 's' *************** package body Switch.M is *** 390,395 **** --- 440,465 ---- Add_Switch_Component (Storing (Storing'First .. Last_Stored)); + -- -gnatWx, x = 'h'. 'u', 's', 'e', '8' or 'b' + + when 'W' => + Storing (First_Stored) := 'W'; + Ptr := Ptr + 1; + + if Ptr <= Max then + case Switch_Chars (Ptr) is + when 'h' | 'u' | 's' | 'e' | '8' | 'b' => + Storing (First_Stored + 1) := Switch_Chars (Ptr); + Add_Switch_Component + (Storing (Storing'First .. First_Stored + 1)); + Ptr := Ptr + 1; + + when others => + Last := 0; + return; + end case; + end if; + -- Multiple switches when 'V' | 'w' | 'y' => *************** package body Switch.M is *** 584,597 **** (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 ! (Project_Node_Tree, Switch_Chars (Ptr + 2 .. Switch_Chars'Last)); elsif C = 'v' and then Switch_Chars'Length = 3 then --- 654,673 ---- (Switch_Chars'First + Subdirs_Option'Length .. Switch_Chars'Last)); + elsif Switch_Chars = Makeutl.Unchecked_Shared_Lib_Imports then + Opt.Unchecked_Shared_Lib_Imports := True; + + elsif Switch_Chars = Makeutl.Single_Compile_Per_Obj_Dir_Switch then + Opt.One_Compilation_Per_Obj_Dir := True; + elsif Switch_Chars (Ptr) = '-' then Bad_Switch (Switch_Chars); elsif Switch_Chars'Length > 3 and then Switch_Chars (Ptr .. Ptr + 1) = "aP" then ! Add_Directories ! (Project_Node_Tree.Project_Path, Switch_Chars (Ptr + 2 .. Switch_Chars'Last)); elsif C = 'v' and then Switch_Chars'Length = 3 then *************** package body Switch.M is *** 677,690 **** Ptr := Ptr + 1; declare ! Max_Proc : Pos; begin ! Scan_Pos (Switch_Chars, Max, Ptr, Max_Proc, C); if Ptr <= Max then Bad_Switch (Switch_Chars); else Maximum_Processes := Positive (Max_Proc); end if; end; --- 753,775 ---- Ptr := Ptr + 1; declare ! Max_Proc : Nat; ! begin ! Scan_Nat (Switch_Chars, Max, Ptr, Max_Proc, C); if Ptr <= Max then Bad_Switch (Switch_Chars); else + if Max_Proc = 0 then + Max_Proc := Nat (Number_Of_CPUs); + + if Max_Proc = 0 then + Max_Proc := 1; + end if; + end if; + Maximum_Processes := Positive (Max_Proc); end if; end; *************** package body Switch.M is *** 739,745 **** -- Processing for C switch when 'C' => ! Create_Mapping_File := True; -- Processing for D switch --- 824,830 ---- -- Processing for C switch when 'C' => ! Opt.Create_Mapping_File := True; -- Processing for D switch *************** package body Switch.M is *** 839,844 **** --- 924,930 ---- when 'x' => External_Unit_Compilation_Allowed := True; + Use_Include_Path_File := True; -- Processing for z switch diff -Nrcpad gcc-4.5.2/gcc/ada/switch-m.ads gcc-4.6.0/gcc/ada/switch-m.ads *** gcc-4.5.2/gcc/ada/switch-m.ads Mon Nov 30 09:36:20 2009 --- gcc-4.6.0/gcc/ada/switch-m.ads Tue Jun 22 13:26:32 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2001-2010, 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,35 **** --- 29,39 ---- -- switches that are recognized. In addition, package Debug documents -- the otherwise undocumented debug switches that are also recognized. + pragma Warnings (Off); + -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; + pragma Warnings (On); + with Prj.Tree; package Switch.M is diff -Nrcpad gcc-4.5.2/gcc/ada/switch.ads gcc-4.6.0/gcc/ada/switch.ads *** gcc-4.5.2/gcc/ada/switch.ads Sun May 24 09:14:53 2009 --- gcc-4.6.0/gcc/ada/switch.ads Mon Dec 20 07:26:57 2010 *************** package Switch is *** 75,81 **** function Is_Internal_GCC_Switch (Switch_Chars : String) return Boolean; -- Returns True iff Switch_Chars represents an internal GCC switch to be -- followed by a single argument, such as -dumpbase, --param or -auxbase. ! -- Eventhough passed by the "gcc" driver, these need not be stored in ALI -- files and may safely be ignored by non GCC back-ends. function Switch_Last (Switch_Chars : String) return Natural; --- 75,81 ---- function Is_Internal_GCC_Switch (Switch_Chars : String) return Boolean; -- Returns True iff Switch_Chars represents an internal GCC switch to be -- followed by a single argument, such as -dumpbase, --param or -auxbase. ! -- Even though passed by the "gcc" driver, these need not be stored in ALI -- files and may safely be ignored by non GCC back-ends. function Switch_Last (Switch_Chars : String) return Natural; *************** private *** 98,104 **** -- Returns True if an integer is at the current scan location or an equal -- sign. This is used as a guard for calling Scan_Nat. Switch_Chars is the -- string containing the switch, and Ptr points just past the switch ! -- character. Max is the maximum alllowed value of Ptr. procedure Scan_Nat (Switch_Chars : String; --- 98,104 ---- -- Returns True if an integer is at the current scan location or an equal -- sign. This is used as a guard for calling Scan_Nat. Switch_Chars is the -- string containing the switch, and Ptr points just past the switch ! -- character. Max is the maximum allowed value of Ptr. procedure Scan_Nat (Switch_Chars : String; *************** private *** 109,115 **** -- Scan natural integer parameter for switch. On entry, Ptr points just -- past the switch character, on exit it points past the last digit of the -- integer value. Max is the maximum allowed value of Ptr, so the scan is ! -- restricted to Switch_Chars (Ptr .. Max). It is posssible for Ptr to be -- one greater than Max on return if the entire string is digits. Scan_Nat -- will skip an optional equal sign if it is present. Nat_Present must be -- True, or an error will be signalled. --- 109,115 ---- -- Scan natural integer parameter for switch. On entry, Ptr points just -- past the switch character, on exit it points past the last digit of the -- integer value. Max is the maximum allowed value of Ptr, so the scan is ! -- restricted to Switch_Chars (Ptr .. Max). It is possible for Ptr to be -- one greater than Max on return if the entire string is digits. Scan_Nat -- will skip an optional equal sign if it is present. Nat_Present must be -- True, or an error will be signalled. diff -Nrcpad gcc-4.5.2/gcc/ada/symbols-processing-vms-alpha.adb gcc-4.6.0/gcc/ada/symbols-processing-vms-alpha.adb *** gcc-4.5.2/gcc/ada/symbols-processing-vms-alpha.adb Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/symbols-processing-vms-alpha.adb Fri Sep 10 13:29:36 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 2003-2010, 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- -- *************** package body Processing is *** 31,50 **** type Number is mod 2**16; -- 16 bits unsigned number for number of characters GSD : constant Number := 10; -- Code for the Global Symbol Definition section C_SYM : constant Number := 1; -- Code for a Symbol subsection ! V_DEF_Mask : constant Number := 2**1; ! V_NORM_Mask : constant Number := 2**6; B : Byte; Number_Of_Characters : Natural := 0; -- The number of characters of each section -- The following variables are used by procedure Process when reading an -- object file. --- 31,60 ---- type Number is mod 2**16; -- 16 bits unsigned number for number of characters + EMH : constant Number := 8; + -- Code for the Module Header section + GSD : constant Number := 10; -- Code for the Global Symbol Definition section C_SYM : constant Number := 1; -- Code for a Symbol subsection ! V_DEF_Mask : constant Number := 2 ** 1; ! V_NORM_Mask : constant Number := 2 ** 6; ! -- Comments ??? B : Byte; Number_Of_Characters : Natural := 0; -- The number of characters of each section + Native_Format : Boolean; + -- True if records are decoded by the system (like on VMS) + + Has_Pad : Boolean; + -- If true, a pad byte must be skipped before reading the next record + -- The following variables are used by procedure Process when reading an -- object file. *************** package body Processing is *** 114,138 **** Success := True; -- Get the different sections one by one from the object file while not End_Of_File (File) loop Get (Code); Get (Number_Of_Characters); Number_Of_Characters := Number_Of_Characters - 4; -- If this is not a Global Symbol Definition section, skip to the -- next section. if Code /= GSD then - for J in 1 .. Number_Of_Characters loop Read (File, B); end loop; else - -- Skip over the next 4 bytes Get (Dummy); --- 124,205 ---- Success := True; + -- Check the file format in case of cross-tool + + Get (Code); + Get (Number_Of_Characters); + Get (Dummy); + + if Code = Dummy and then Number_Of_Characters = Natural (EMH) then + + -- Looks like a cross tool + + Native_Format := False; + Number_Of_Characters := Natural (Dummy) - 4; + Has_Pad := (Number_Of_Characters mod 2) = 1; + + elsif Code = EMH then + Native_Format := True; + Number_Of_Characters := Number_Of_Characters - 6; + Has_Pad := False; + + else + Put_Line ("file """ & Object_File & """ is not an object file"); + Close (File); + Success := False; + return; + end if; + + -- Skip the EMH section + + for J in 1 .. Number_Of_Characters loop + Read (File, B); + end loop; + -- Get the different sections one by one from the object file while not End_Of_File (File) loop + if not Native_Format then + + -- Skip pad byte if present + + if Has_Pad then + Get (B); + end if; + + -- Skip record length + + Get (Dummy); + end if; + Get (Code); Get (Number_Of_Characters); + + if not Native_Format then + if Natural (Dummy) /= Number_Of_Characters then + + -- Format error + + raise Constraint_Error; + end if; + + Has_Pad := (Number_Of_Characters mod 2) = 1; + end if; + + -- The header is 4 bytes length + Number_Of_Characters := Number_Of_Characters - 4; -- If this is not a Global Symbol Definition section, skip to the -- next section. if Code /= GSD then for J in 1 .. Number_Of_Characters loop Read (File, B); end loop; else -- Skip over the next 4 bytes Get (Dummy); *************** package body Processing is *** 149,158 **** Number_Of_Characters := Number_Of_Characters - 8; Nchars := Nchars - 8; ! -- If this is a symbol and the V_DEF flag is set, get the ! -- symbol. if Code = C_SYM and then ((Flags and V_DEF_Mask) /= 0) then -- First, reach the symbol length for J in 1 .. 25 loop --- 216,225 ---- Number_Of_Characters := Number_Of_Characters - 8; Nchars := Nchars - 8; ! -- If this is a symbol and the V_DEF flag is set, get symbol if Code = C_SYM and then ((Flags and V_DEF_Mask) /= 0) then + -- First, reach the symbol length for J in 1 .. 25 loop *************** package body Processing is *** 169,174 **** --- 236,242 ---- for J in 1 .. Nchars loop Read (File, B); Number_Of_Characters := Number_Of_Characters - 1; + if Length > 0 then LSymb := LSymb + 1; Symbol (LSymb) := B; *************** package body Processing is *** 204,210 **** if (Flags and V_NORM_Mask) = 0 then S_Data.Kind := Data; - else S_Data.Kind := Proc; end if; --- 272,277 ---- *************** package body Processing is *** 225,231 **** end loop; end if; ! -- Exit the GSD section when number of characters reaches 0 exit when Number_Of_Characters = 0; end loop; --- 292,298 ---- end loop; end if; ! -- Exit the GSD section when number of characters reaches zero exit when Number_Of_Characters = 0; end loop; diff -Nrcpad gcc-4.5.2/gcc/ada/sysdep.c gcc-4.6.0/gcc/ada/sysdep.c *** gcc-4.5.2/gcc/ada/sysdep.c Tue Jan 26 09:42:04 2010 --- gcc-4.6.0/gcc/ada/sysdep.c Mon Dec 20 07:26:57 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 1992-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 1992-2010, 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,40 **** #ifdef __vxworks #include "ioLib.h" ! #if ! defined (__VXWORKSMILS__) #include "dosFsLib.h" #endif #if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) --- 34,40 ---- #ifdef __vxworks #include "ioLib.h" ! #if ! defined (VTHREADS) #include "dosFsLib.h" #endif #if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) *************** extern struct tm *localtime_r(const time *** 158,164 **** */ ! #if defined(WINNT) || defined (MSDOS) || defined (__EMX__) static const char *mode_read_text = "rt"; static const char *mode_write_text = "wt"; static const char *mode_append_text = "at"; --- 158,164 ---- */ ! #if defined(WINNT) static const char *mode_read_text = "rt"; static const char *mode_write_text = "wt"; static const char *mode_append_text = "at"; *************** winflush_nt (void) *** 235,241 **** /* Does nothing as there is no problem under NT. */ } ! #else static void winflush_init (void); --- 235,241 ---- /* Does nothing as there is no problem under NT. */ } ! #else /* !RTX */ static void winflush_init (void); *************** __gnat_is_windows_xp (void) *** 301,309 **** return is_win_xp; } ! #endif ! #endif #else --- 301,327 ---- return is_win_xp; } ! #endif /* !RTX */ ! /* Get the bounds of the stack. The stack pointer is supposed to be ! initialized to BASE when a thread is created and the stack can be extended ! to LIMIT before reaching a guard page. ! Note: for the main thread, the system automatically extend the stack, so ! LIMIT is only the current limit. */ ! ! void ! __gnat_get_stack_bounds (void **base, void **limit) ! { ! NT_TIB *tib; ! ! /* We know that the first field of the TEB is the TIB. */ ! tib = (NT_TIB *)NtCurrentTeb (); ! ! *base = tib->StackBase; ! *limit = tib->StackLimit; ! } ! ! #endif /* !__MINGW32__ */ #else *************** __gnat_ttyname (int filedes) *** 345,351 **** } #endif ! #if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \ || (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \ || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \ || (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \ --- 363,369 ---- } #endif ! #if defined (linux) || defined (sun) || defined (sgi) \ || (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \ || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \ || (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \ *************** getc_immediate_common (FILE *stream, *** 403,409 **** int *avail, int waiting) { ! #if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \ || (defined (__osf__) && ! defined (__alpha_vxworks)) \ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \ --- 421,427 ---- int *avail, int waiting) { ! #if defined (linux) || defined (sun) || defined (sgi) \ || (defined (__osf__) && ! defined (__alpha_vxworks)) \ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \ *************** getc_immediate_common (FILE *stream, *** 424,430 **** /* Set RAW mode, with no echo */ termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON & ~ECHO; ! #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__) \ --- 442,448 ---- /* Set RAW mode, with no echo */ termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON & ~ECHO; ! #if defined(linux) || defined (sun) || defined (sgi) \ || defined (__osf__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ *************** getc_immediate_common (FILE *stream, *** 433,450 **** /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for a character forever. This doesn't seem to effect Ctrl-Z or ! Ctrl-C processing except on OS/2 where Ctrl-C won't work right ! unless we do a read loop. Luckily we can delay a bit between ! iterations. If not waiting (i.e. Get_Immediate (Char, Available)), don't wait for anything but timeout immediately. */ - #ifdef __EMX__ - termios_rec.c_cc[VMIN] = 0; - termios_rec.c_cc[VTIME] = waiting; - #else termios_rec.c_cc[VMIN] = waiting; termios_rec.c_cc[VTIME] = 0; #endif - #endif tcsetattr (fd, TCSANOW, &termios_rec); while (! good_one) --- 451,462 ---- /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for a character forever. This doesn't seem to effect Ctrl-Z or ! Ctrl-C processing. ! If not waiting (i.e. Get_Immediate (Char, Available)), don't wait for anything but timeout immediately. */ termios_rec.c_cc[VMIN] = waiting; termios_rec.c_cc[VTIME] = 0; #endif tcsetattr (fd, TCSANOW, &termios_rec); while (! good_one) *************** long __gnat_invalid_tzoff = 259273; *** 720,726 **** /* Definition of __gnat_localtime_r used by a-calend.adb */ ! #if defined (__EMX__) || defined (__MINGW32__) #ifdef CERT --- 732,738 ---- /* Definition of __gnat_localtime_r used by a-calend.adb */ ! #if defined (__MINGW32__) #ifdef CERT *************** extern void (*Unlock_Task) (void); *** 743,749 **** #endif ! /* Reentrant localtime for Windows and OS/2. */ extern void __gnat_localtime_tzoff (const time_t *, long *); --- 755,761 ---- #endif ! /* Reentrant localtime for Windows. */ extern void __gnat_localtime_tzoff (const time_t *, long *); *************** __gnat_localtime_tzoff (const time_t *ti *** 838,848 **** #else ! /* VMS does not need __gnat_locatime_tzoff */ #if defined (VMS) ! /* Other targets except Lynx, VMS and Windows provide a standard locatime_r */ #else --- 850,860 ---- #else ! /* VMS does not need __gnat_localtime_tzoff */ #if defined (VMS) ! /* Other targets except Lynx, VMS and Windows provide a standard localtime_r */ #else *************** __gnat_get_task_options (void) *** 965,971 **** /* Force VX_FP_TASK because it is almost always required */ options |= VX_FP_TASK; ! #if defined (__SPE__) options |= VX_SPE_TASK; #endif --- 977,983 ---- /* Force VX_FP_TASK because it is almost always required */ options |= VX_FP_TASK; ! #if defined (__SPE__) && (! defined (__VXWORKSMILS__)) options |= VX_SPE_TASK; #endif *************** __gnat_is_file_not_found_error (int errn *** 987,993 **** /* In the case of VxWorks, we also have to take into account various * filesystem-specific variants of this error. */ ! #if ! defined (__VXWORKSMILS__) case S_dosFsLib_FILE_NOT_FOUND: #endif #if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) --- 999,1005 ---- /* In the case of VxWorks, we also have to take into account various * filesystem-specific variants of this error. */ ! #if ! defined (VTHREADS) case S_dosFsLib_FILE_NOT_FOUND: #endif #if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) diff -Nrcpad gcc-4.5.2/gcc/ada/system-vms-ia64.ads gcc-4.6.0/gcc/ada/system-vms-ia64.ads *** gcc-4.5.2/gcc/ada/system-vms-ia64.ads Fri Apr 10 15:57:48 2009 --- gcc-4.6.0/gcc/ada/system-vms-ia64.ads Tue Jun 22 17:11:54 2010 *************** *** 7,13 **** -- S p e c -- -- (OpenVMS 64bit Itanium GCC_ZCX DEC Threads Version) -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 7,13 ---- -- S p e c -- -- (OpenVMS 64bit Itanium GCC_ZCX DEC Threads Version) -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** private *** 239,245 **** -- Special VMS Interfaces -- ---------------------------- ! procedure Lib_Stop (I : Integer); pragma Interface (C, Lib_Stop); pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value)); -- Interface to VMS condition handling. Used by RTSfind and pragma --- 239,245 ---- -- Special VMS Interfaces -- ---------------------------- ! procedure Lib_Stop (Cond_Value : Integer); pragma Interface (C, Lib_Stop); pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value)); -- Interface to VMS condition handling. Used by RTSfind and pragma *************** private *** 251,254 **** --- 251,257 ---- -- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug. -- Do not remove! + pragma Ident ("GNAT"); -- Gnat_Static_Version_String + -- Default ident for all VMS images. + end System; diff -Nrcpad gcc-4.5.2/gcc/ada/system-vms-zcx.ads gcc-4.6.0/gcc/ada/system-vms-zcx.ads *** gcc-4.5.2/gcc/ada/system-vms-zcx.ads Fri Apr 10 15:57:48 2009 --- gcc-4.6.0/gcc/ada/system-vms-zcx.ads Thu Jan 1 00:00:00 1970 *************** *** 1,232 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT RUN-TIME COMPONENTS -- - -- -- - -- S Y S T E M -- - -- -- - -- S p e c -- - -- (OpenVMS GCC_ZCX DEC Threads Version) -- - -- -- - -- Copyright (C) 2002-2009, 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 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. -- - -- -- - -- As a special exception under Section 7 of GPL version 3, you are granted -- - -- additional permissions described in the GCC Runtime Library Exception, -- - -- version 3.1, as published by the Free Software Foundation. -- - -- -- - -- You should have received a copy of the GNU General Public License and -- - -- a copy of the GCC Runtime Library Exception along with this program; -- - -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- - -- . -- - -- -- - -- 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 := 2 ** Integer'Size - 1; - - 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.01; - - -- Storage-related Declarations - - type Address is private; - pragma Preelaborable_Initialization (Address); - 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. - - Backend_Divide_Checks : constant Boolean := False; - Backend_Overflow_Checks : constant Boolean := True; - Command_Line_Args : constant Boolean := True; - Configurable_Run_Time : constant Boolean := False; - Denorm : constant Boolean := False; - Duration_32_Bits : constant Boolean := False; - Exit_Status_Supported : constant Boolean := True; - Fractional_Fixed_Ops : constant Boolean := False; - Frontend_Layout : constant Boolean := False; - Machine_Overflows : constant Boolean := False; - Machine_Rounds : constant Boolean := True; - OpenVMS : constant Boolean := True; - Preallocated_Stacks : constant Boolean := False; - Signed_Zeros : constant Boolean := True; - Stack_Check_Default : constant Boolean := True; - Stack_Check_Probes : constant Boolean := True; - Stack_Check_Limits : 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; - Always_Compatible_Rep : 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; - - -------------------------- - -- Underlying Priorities -- - --------------------------- - - -- Important note: this section of the file must come AFTER the - -- definition of the system implementation parameters to ensure - -- that the value of these parameters is available for analysis - -- of the declarations here (using Rtsfind at compile time). - - -- The underlying priorities table provides a generalized mechanism - -- for mapping from Ada priorities to system priorities. In some - -- cases a 1-1 mapping is not the convenient or optimal choice. - - -- For DEC Threads OpenVMS, we use the full range of 31 priorities - -- in the Ada model, but map them by compression onto the more limited - -- range of priorities available in OpenVMS. - - -- To replace the default values of the Underlying_Priorities mapping, - -- copy this source file into your build directory, edit the file to - -- reflect your desired behavior, and recompile with the command: - - -- $ gcc -c -O3 -gnatpgn system.ads - - -- then recompile the run-time parts that depend on this package: - - -- $ gnatmake -a -gnatn -O3 - - -- then force rebuilding your application if you need different options: - - -- $ gnatmake -f - - type Priorities_Mapping is array (Any_Priority) of Integer; - pragma Suppress_Initialization (Priorities_Mapping); - -- Suppress initialization in case gnat.adc specifies Normalize_Scalars - - Underlying_Priorities : constant Priorities_Mapping := - - (Priority'First => 16, - - 1 => 17, - 2 => 18, - 3 => 18, - 4 => 18, - 5 => 18, - 6 => 19, - 7 => 19, - 8 => 19, - 9 => 20, - 10 => 20, - 11 => 21, - 12 => 21, - 13 => 22, - 14 => 23, - - Default_Priority => 24, - - 16 => 25, - 17 => 25, - 18 => 25, - 19 => 26, - 20 => 26, - 21 => 26, - 22 => 27, - 23 => 27, - 24 => 27, - 25 => 28, - 26 => 28, - 27 => 29, - 28 => 29, - 29 => 30, - - Priority'Last => 30, - - Interrupt_Priority => 31); - - ---------------------------- - -- Special VMS Interfaces -- - ---------------------------- - - procedure Lib_Stop (I : Integer); - pragma Interface (C, Lib_Stop); - pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value)); - -- Interface to VMS condition handling. Used by RTSfind and pragma - -- {Import,Export}_Exception. Put here because this is the only - -- VMS specific package that doesn't drag in tasking. - - end System; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/system-vms.ads gcc-4.6.0/gcc/ada/system-vms.ads *** gcc-4.5.2/gcc/ada/system-vms.ads Fri Apr 10 15:57:48 2009 --- gcc-4.6.0/gcc/ada/system-vms.ads Thu Jan 1 00:00:00 1970 *************** *** 1,237 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT RUN-TIME COMPONENTS -- - -- -- - -- S Y S T E M -- - -- -- - -- S p e c -- - -- (OpenVMS DEC Threads Version) -- - -- -- - -- Copyright (C) 1992-2009, 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 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. -- - -- -- - -- As a special exception under Section 7 of GPL version 3, you are granted -- - -- additional permissions described in the GCC Runtime Library Exception, -- - -- version 3.1, as published by the Free Software Foundation. -- - -- -- - -- You should have received a copy of the GNU General Public License and -- - -- a copy of the GCC Runtime Library Exception along with this program; -- - -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- - -- . -- - -- -- - -- 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 := 2 ** Integer'Size - 1; - - 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.01; - - -- Storage-related Declarations - - type Address is private; - pragma Preelaborable_Initialization (Address); - 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. - - Backend_Divide_Checks : constant Boolean := False; - Backend_Overflow_Checks : constant Boolean := True; - Command_Line_Args : constant Boolean := True; - Configurable_Run_Time : constant Boolean := False; - Denorm : constant Boolean := False; - Duration_32_Bits : constant Boolean := False; - Exit_Status_Supported : constant Boolean := True; - Fractional_Fixed_Ops : constant Boolean := False; - Frontend_Layout : constant Boolean := False; - Machine_Overflows : constant Boolean := False; - Machine_Rounds : constant Boolean := True; - OpenVMS : constant Boolean := True; - Preallocated_Stacks : constant Boolean := False; - Signed_Zeros : constant Boolean := True; - Stack_Check_Default : constant Boolean := True; - Stack_Check_Probes : constant Boolean := True; - Stack_Check_Limits : 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; - Always_Compatible_Rep : 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 := False; - - -------------------------- - -- Underlying Priorities -- - --------------------------- - - -- Important note: this section of the file must come AFTER the - -- definition of the system implementation parameters to ensure - -- that the value of these parameters is available for analysis - -- of the declarations here (using Rtsfind at compile time). - - -- The underlying priorities table provides a generalized mechanism - -- for mapping from Ada priorities to system priorities. In some - -- cases a 1-1 mapping is not the convenient or optimal choice. - - -- For DEC Threads OpenVMS, we use the full range of 31 priorities - -- in the Ada model, but map them by compression onto the more limited - -- range of priorities available in OpenVMS. - - -- To replace the default values of the Underlying_Priorities mapping, - -- copy this source file into your build directory, edit the file to - -- reflect your desired behavior, and recompile with the command: - - -- $ gcc -c -O3 -gnatpgn system.ads - - -- then recompile the run-time parts that depend on this package: - - -- $ gnatmake -a -gnatn -O3 - - -- then force rebuilding your application if you need different options: - - -- $ gnatmake -f - - type Priorities_Mapping is array (Any_Priority) of Integer; - pragma Suppress_Initialization (Priorities_Mapping); - -- Suppress initialization in case gnat.adc specifies Normalize_Scalars - - Underlying_Priorities : constant Priorities_Mapping := - - (Priority'First => 16, - - 1 => 17, - 2 => 18, - 3 => 18, - 4 => 18, - 5 => 18, - 6 => 19, - 7 => 19, - 8 => 19, - 9 => 20, - 10 => 20, - 11 => 21, - 12 => 21, - 13 => 22, - 14 => 23, - - Default_Priority => 24, - - 16 => 25, - 17 => 25, - 18 => 25, - 19 => 26, - 20 => 26, - 21 => 26, - 22 => 27, - 23 => 27, - 24 => 27, - 25 => 28, - 26 => 28, - 27 => 29, - 28 => 29, - 29 => 30, - - Priority'Last => 30, - - Interrupt_Priority => 31); - - ---------------------------- - -- Special VMS Interfaces -- - ---------------------------- - - procedure Lib_Stop (I : Integer); - pragma Interface (C, Lib_Stop); - pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value)); - -- Interface to VMS condition handling. Used by RTSfind and pragma - -- {Import,Export}_Exception. Put here because this is the only - -- VMS specific package that doesn't drag in tasking. - - ADA_GNAT : constant Boolean := True; - pragma Export_Object (ADA_GNAT, "ADA$GNAT"); - -- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug. - -- Do not remove! - - end System; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/system-vms_64.ads gcc-4.6.0/gcc/ada/system-vms_64.ads *** gcc-4.5.2/gcc/ada/system-vms_64.ads Fri Apr 10 15:57:48 2009 --- gcc-4.6.0/gcc/ada/system-vms_64.ads Tue Jun 22 17:11:54 2010 *************** *** 7,13 **** -- S p e c -- -- (OpenVMS 64bit GCC_ZCX DEC Threads Version) -- -- -- ! -- Copyright (C) 1992-2009, 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 -- --- 7,13 ---- -- S p e c -- -- (OpenVMS 64bit GCC_ZCX DEC Threads Version) -- -- -- ! -- Copyright (C) 1992-2010, 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 -- *************** private *** 239,245 **** -- Special VMS Interfaces -- ---------------------------- ! procedure Lib_Stop (I : Integer); pragma Interface (C, Lib_Stop); pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value)); -- Interface to VMS condition handling. Used by RTSfind and pragma --- 239,245 ---- -- Special VMS Interfaces -- ---------------------------- ! procedure Lib_Stop (Cond_Value : Integer); pragma Interface (C, Lib_Stop); pragma Import_Procedure (Lib_Stop, "LIB$STOP", Mechanism => (Value)); -- Interface to VMS condition handling. Used by RTSfind and pragma *************** private *** 251,254 **** --- 251,257 ---- -- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug. -- Do not remove! + pragma Ident ("GNAT"); -- Gnat_Static_Version_String + -- Default ident for all VMS images. + end System; diff -Nrcpad gcc-4.5.2/gcc/ada/targext.c gcc-4.6.0/gcc/ada/targext.c *** gcc-4.5.2/gcc/ada/targext.c Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/targext.c Wed Jan 26 22:10:23 2011 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 2005-2009 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 2005-2011, 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,39 **** --- 33,45 ---- /* extension for object and executable files. It is used by the compiler, */ /* binder and tools. */ + #ifdef IN_RTS + #include "tconfig.h" + #include "tsystem.h" + #else + #include "config.h" #include "system.h" + #endif #include "coretypes.h" #include "tm.h" diff -Nrcpad gcc-4.5.2/gcc/ada/targparm.ads gcc-4.6.0/gcc/ada/targparm.ads *** gcc-4.5.2/gcc/ada/targparm.ads Wed May 6 15:15:25 2009 --- gcc-4.6.0/gcc/ada/targparm.ads Thu Oct 7 12:59:00 2010 *************** package Targparm is *** 157,163 **** Run_Time_Name_On_Target : Name_Id := No_Name; -- Set to appropriate names table entry Id value if a Run_Time_Name -- string constant is defined in system.ads. This name is used only ! -- for the configurable run-time case, and is used to parametrize -- messages that complain about non-supported run-time features. -- The name should contain only letters A-Z, digits 1-9, spaces, -- and underscores. --- 157,163 ---- Run_Time_Name_On_Target : Name_Id := No_Name; -- Set to appropriate names table entry Id value if a Run_Time_Name -- string constant is defined in system.ads. This name is used only ! -- for the configurable run-time case, and is used to parameterize -- messages that complain about non-supported run-time features. -- The name should contain only letters A-Z, digits 1-9, spaces, -- and underscores. diff -Nrcpad gcc-4.5.2/gcc/ada/tb-alvxw.c gcc-4.6.0/gcc/ada/tb-alvxw.c *** gcc-4.5.2/gcc/ada/tb-alvxw.c Fri Apr 6 09:43:23 2007 --- gcc-4.6.0/gcc/ada/tb-alvxw.c Mon Dec 20 07:26:57 2010 *************** heuristic_proc_desc (CORE_ADDR start_pc, *** 564,570 **** So we recognize only a few registers (t7, t9, ra) within the procedure prologue as valid return address registers. If we encounter a return instruction, we extract the ! the return address register from it. FIXME: Rewriting GDB to access the procedure descriptors, e.g. via the minimal symbol table, might obviate this hack. */ --- 564,570 ---- So we recognize only a few registers (t7, t9, ra) within the procedure prologue as valid return address registers. If we encounter a return instruction, we extract the ! return address register from it. FIXME: Rewriting GDB to access the procedure descriptors, e.g. via the minimal symbol table, might obviate this hack. */ diff -Nrcpad gcc-4.5.2/gcc/ada/tbuild.adb gcc-4.6.0/gcc/ada/tbuild.adb *** gcc-4.5.2/gcc/ada/tbuild.adb Wed Oct 28 13:50:10 2009 --- gcc-4.6.0/gcc/ada/tbuild.adb Fri Oct 22 09:28:24 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with Sem_Aux; use Sem_Aux; *** 36,42 **** with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; ! with Uintp; use Uintp; package body Tbuild is --- 36,42 ---- with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; ! with Urealp; use Urealp; package body Tbuild is *************** package body Tbuild is *** 198,203 **** --- 198,237 ---- New_Reference_To (First_Tag_Component (Full_Type), Loc))); end Make_DT_Access; + ------------------------ + -- Make_Float_Literal -- + ------------------------ + + function Make_Float_Literal + (Loc : Source_Ptr; + Radix : Uint; + Significand : Uint; + Exponent : Uint) return Node_Id + is + begin + if Radix = 2 and then abs Significand /= 1 then + return + Make_Float_Literal + (Loc, Uint_16, + Significand * Radix**(Exponent mod 4), + Exponent / 4); + + else + declare + N : constant Node_Id := New_Node (N_Real_Literal, Loc); + + begin + Set_Realval (N, + UR_From_Components + (Num => abs Significand, + Den => -Exponent, + Rbase => UI_To_Int (Radix), + Negative => Significand < 0)); + return N; + end; + end if; + end Make_Float_Literal; + ------------------------------------- -- Make_Implicit_Exception_Handler -- ------------------------------------- *************** package body Tbuild is *** 442,450 **** function Make_Temporary (Loc : Source_Ptr; Id : Character; ! Related_Node : Node_Id := Empty) return Node_Id is ! Temp : constant Node_Id := Make_Defining_Identifier (Loc, Chars => New_Internal_Name (Id)); begin --- 476,484 ---- function Make_Temporary (Loc : Source_Ptr; Id : Character; ! Related_Node : Node_Id := Empty) return Entity_Id is ! Temp : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_Internal_Name (Id)); begin *************** package body Tbuild is *** 659,665 **** -- We don't really need these shift operators, since they never -- appear as operators in the source, but the path of least ! -- resistance is to put them in (the aggregate must be complete) N_Op_Rotate_Left => Name_Rotate_Left, N_Op_Rotate_Right => Name_Rotate_Right, --- 693,699 ---- -- We don't really need these shift operators, since they never -- appear as operators in the source, but the path of least ! -- resistance is to put them in (the aggregate must be complete). N_Op_Rotate_Left => Name_Rotate_Left, N_Op_Rotate_Right => Name_Rotate_Right, *************** package body Tbuild is *** 686,692 **** Loc : Source_Ptr) return Node_Id is Occurrence : Node_Id; - begin Occurrence := New_Node (N_Identifier, Loc); Set_Chars (Occurrence, Chars (Def_Id)); --- 720,725 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/tbuild.ads gcc-4.6.0/gcc/ada/tbuild.ads *** gcc-4.5.2/gcc/ada/tbuild.ads Wed Oct 28 13:31:51 2009 --- gcc-4.6.0/gcc/ada/tbuild.ads Fri Oct 22 09:28:24 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,34 **** -- -- ------------------------------------------------------------------------------ ! -- This package contains various utility procedures to assist in ! -- building specific types of tree nodes. with Namet; use Namet; with Sinfo; use Sinfo; with Types; use Types; package Tbuild is --- 23,35 ---- -- -- ------------------------------------------------------------------------------ ! -- This package contains various utility procedures to assist in building ! -- specific types of tree nodes. with Namet; use Namet; with Sinfo; use Sinfo; with Types; use Types; + with Uintp; use Uintp; package Tbuild is *************** package Tbuild is *** 75,80 **** --- 76,89 ---- -- Create an access to the Dispatch Table by using the Tag field of a -- tagged record : Acc_Dt (Rec.tag).all + function Make_Float_Literal + (Loc : Source_Ptr; + Radix : Uint; + Significand : Uint; + Exponent : Uint) return Node_Id; + -- Create a real literal for the floating point expression value + -- Significand * Radix ** Exponent. Radix must be greater than 1. + function Make_Implicit_Exception_Handler (Sloc : Source_Ptr; Choice_Parameter : Node_Id := Empty; *************** package Tbuild is *** 167,196 **** Condition : Node_Id := Empty; Reason : RT_Exception_Code) return Node_Id; pragma Inline (Make_Raise_Storage_Error); ! -- A convenient form of Make_Raise_Storage_Error where the Reason ! -- is given simply as an enumeration value, rather than a Uint code. function Make_String_Literal (Sloc : Source_Ptr; Strval : String) return Node_Id; ! -- A convenient form of Make_String_Literal, where the string value ! -- is given as a normal string instead of a String_Id value. function Make_Temporary (Loc : Source_Ptr; Id : Character; ! Related_Node : Node_Id := Empty) return Node_Id; ! -- Create a defining identifier to capture the value of an expression ! -- or aggregate, and link it to the expression that it replaces, in ! -- order to provide better CodePeer reports. The defining identifier ! -- name is obtained by Make_Internal_Name (Id). function Make_Unsuppress_Block (Loc : Source_Ptr; Check : Name_Id; Stmts : List_Id) return Node_Id; ! -- Build a block with a pragma Suppress on 'Check'. Stmts is the ! -- statements list that needs protection against the check function New_Constraint_Error (Loc : Source_Ptr) return Node_Id; -- This function builds a tree corresponding to the Ada statement --- 176,214 ---- Condition : Node_Id := Empty; Reason : RT_Exception_Code) return Node_Id; pragma Inline (Make_Raise_Storage_Error); ! -- A convenient form of Make_Raise_Storage_Error where the Reason is given ! -- simply as an enumeration value, rather than a Uint code. function Make_String_Literal (Sloc : Source_Ptr; Strval : String) return Node_Id; ! -- A convenient form of Make_String_Literal, where the string value is ! -- given as a normal string instead of a String_Id value. function Make_Temporary (Loc : Source_Ptr; Id : Character; ! Related_Node : Node_Id := Empty) return Entity_Id; ! -- This function should be used for all cases where a defining identifier ! -- is to be built with a name to be obtained by New_Internal_Name (here Id ! -- is the character passed as the argument to New_Internal_Name). Loc is ! -- the location for the Sloc value of the resulting Entity. Note that this ! -- can be used for all kinds of temporary defining identifiers used in ! -- expansion (objects, subtypes, functions etc). ! -- ! -- Related_Node is used when the defining identifier is for an object that ! -- captures the value of an expression (e.g. an aggregate). It should be ! -- set whenever possible to point to the expression that is being captured. ! -- This is provided to get better error messages, e.g. from CodePeer. ! -- ! -- Make_Temp_Id would probably be a better name for this function??? function Make_Unsuppress_Block (Loc : Source_Ptr; Check : Name_Id; Stmts : List_Id) return Node_Id; ! -- Build a block with a pragma Suppress on 'Check'. Stmts is the statements ! -- list that needs protection against the check function New_Constraint_Error (Loc : Source_Ptr) return Node_Id; -- This function builds a tree corresponding to the Ada statement *************** package Tbuild is *** 268,273 **** --- 286,294 ---- -- if the identical unit is compiled with a semantically consistent set -- of sources, the numbers will be consistent. This means that it is fine -- to use these as public symbols. + -- + -- Note: Nearly all uses of this function are via calls to Make_Temporary, + -- but there are just a few cases where it is called directly. function New_Occurrence_Of (Def_Id : Entity_Id; *************** package Tbuild is *** 281,288 **** function New_Reference_To (Def_Id : Entity_Id; Loc : Source_Ptr) return Node_Id; ! -- This is like New_Occurrence_Of, but it does not set the Etype field. ! -- It is used from the expander, where Etype fields are generally not set, -- since they are set when the expanded tree is reanalyzed. function New_Suffixed_Name --- 302,309 ---- function New_Reference_To (Def_Id : Entity_Id; Loc : Source_Ptr) return Node_Id; ! -- This is like New_Occurrence_Of, but it does not set the Etype field. It ! -- is used from the expander, where Etype fields are generally not set, -- since they are set when the expanded tree is reanalyzed. function New_Suffixed_Name *************** package Tbuild is *** 295,307 **** -- fixed-point type (as passed in Related_Id), and Suffix is "SMALL". function OK_Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id; ! -- Like Convert_To, except that a conversion node is always generated, ! -- and the Conversion_OK flag is set on this conversion node. function Unchecked_Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id; ! -- Like Convert_To, but if a conversion is actually needed, constructs ! -- an N_Unchecked_Type_Conversion node to do the required conversion. end Tbuild; --- 316,328 ---- -- fixed-point type (as passed in Related_Id), and Suffix is "SMALL". function OK_Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id; ! -- Like Convert_To, except that a conversion node is always generated, and ! -- the Conversion_OK flag is set on this conversion node. function Unchecked_Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id; ! -- Like Convert_To, but if a conversion is actually needed, constructs an ! -- N_Unchecked_Type_Conversion node to do the required conversion. end Tbuild; diff -Nrcpad gcc-4.5.2/gcc/ada/tempdir.ads gcc-4.6.0/gcc/ada/tempdir.ads *** gcc-4.5.2/gcc/ada/tempdir.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/tempdir.ads Tue Jun 22 12:57:07 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2010, 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,36 **** with Namet; use Namet; ! with System.OS_Lib; use System.OS_Lib; package Tempdir is --- 30,36 ---- with Namet; use Namet; ! with GNAT.OS_Lib; use GNAT.OS_Lib; package Tempdir is diff -Nrcpad gcc-4.5.2/gcc/ada/tracebak.c gcc-4.6.0/gcc/ada/tracebak.c *** gcc-4.5.2/gcc/ada/tracebak.c Sat Jul 4 10:11:57 2009 --- gcc-4.6.0/gcc/ada/tracebak.c Sat Aug 21 13:25:33 2010 *************** *** 6,12 **** * * * C Implementation File * * * ! * Copyright (C) 2000-2009, 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- * --- 6,12 ---- * * * C Implementation File * * * ! * Copyright (C) 2000-2010, 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- * *************** struct layout *** 303,309 **** --- 303,316 ---- #define IS_BAD_PTR(ptr) 0 #endif + /* Starting with GCC 4.6, -fomit-frame-pointer is turned on by default for + 32-bit x86/Linux as well and DWARF 2 unwind tables are emitted instead. + See the x86-64 case below for the drawbacks with this approach. */ + #if defined (linux) && (__GNUC__ * 10 + __GNUC_MINOR__ > 45) + #define USE_GCC_UNWINDER + #else #define USE_GENERIC_UNWINDER + #endif struct layout { *************** __gnat_backtrace (void **array, *** 435,441 **** { struct layout *current; void *top_frame; ! void *top_stack; int cnt = 0; if (FORCE_CALL) --- 442,448 ---- { struct layout *current; void *top_frame; ! void *top_stack ATTRIBUTE_UNUSED; int cnt = 0; if (FORCE_CALL) *************** __gnat_backtrace (void **array, *** 486,493 **** #else ! /* No target specific implementation and neither USE_GCC_UNWINDER not ! USE_GCC_UNWINDER defined. */ /*------------------------------* *-- The dummy implementation --* --- 493,500 ---- #else ! /* No target specific implementation and neither USE_GCC_UNWINDER nor ! USE_GENERIC_UNWINDER defined. */ /*------------------------------* *-- The dummy implementation --* diff -Nrcpad gcc-4.5.2/gcc/ada/tree_gen.adb gcc-4.6.0/gcc/ada/tree_gen.adb *** gcc-4.5.2/gcc/ada/tree_gen.adb Tue Apr 8 06:45:25 2008 --- gcc-4.6.0/gcc/ada/tree_gen.adb Mon Oct 11 15:47:23 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,29 **** --- 23,31 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; with Atree; + with Debug; with Elists; with Fname; with Lib; *************** begin *** 50,55 **** --- 52,64 ---- if Opt.Tree_Output then Osint.C.Tree_Create; Opt.Tree_Write; + + -- For now, only write aspect specifications hash table if -gnatd.A set + + if Debug.Debug_Flag_Dot_AA then + Aspects.Tree_Write; + end if; + Atree.Tree_Write; Elists.Tree_Write; Fname.Tree_Write; diff -Nrcpad gcc-4.5.2/gcc/ada/tree_in.adb gcc-4.6.0/gcc/ada/tree_in.adb *** gcc-4.5.2/gcc/ada/tree_in.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/tree_in.adb Mon Oct 11 15:47:23 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,36 **** --- 29,38 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; with Atree; with Csets; + with Debug; with Elists; with Fname; with Lib; *************** procedure Tree_In (Desc : File_Descripto *** 50,55 **** --- 52,64 ---- begin Tree_IO.Tree_Read_Initialize (Desc); Opt.Tree_Read; + + -- For now, only read aspect specifications hash table if -gnatd.A is set + + if Debug.Debug_Flag_Dot_AA then + Aspects.Tree_Read; + end if; + Atree.Tree_Read; Elists.Tree_Read; Fname.Tree_Read; diff -Nrcpad gcc-4.5.2/gcc/ada/tree_io.ads gcc-4.6.0/gcc/ada/tree_io.ads *** gcc-4.5.2/gcc/ada/tree_io.ads Wed Jul 15 10:15:49 2009 --- gcc-4.6.0/gcc/ada/tree_io.ads Tue Jun 22 13:26:32 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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,43 **** -- create and close routines are elsewhere (in Osint in the compiler, and in -- the tree read driver for the tree read interface). ! with Types; use Types; ! with System; use System; with System.OS_Lib; use System.OS_Lib; package Tree_IO is --- 34,46 ---- -- create and close routines are elsewhere (in Osint in the compiler, and in -- the tree read driver for the tree read interface). ! with Types; use Types; ! with System; use System; ! pragma Warnings (Off); ! -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; + pragma Warnings (On); package Tree_IO is diff -Nrcpad gcc-4.5.2/gcc/ada/treepr.adb gcc-4.6.0/gcc/ada/treepr.adb *** gcc-4.5.2/gcc/ada/treepr.adb Fri Jul 10 09:36:00 2009 --- gcc-4.6.0/gcc/ada/treepr.adb Tue Oct 19 10:37:41 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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,28 **** --- 23,29 ---- -- -- ------------------------------------------------------------------------------ + with Aspects; use Aspects; with Atree; use Atree; with Csets; use Csets; with Debug; use Debug; *************** with Snames; use Snames; *** 38,43 **** --- 39,45 ---- with Sinput; use Sinput; with Stand; use Stand; with Stringt; use Stringt; + with SCIL_LL; use SCIL_LL; with Treeprs; use Treeprs; with Uintp; use Uintp; with Urealp; use Urealp; *************** package body Treepr is *** 626,631 **** --- 628,649 ---- Print_Eol; end if; + if Field_Present (Field28 (Ent)) then + Print_Str (Prefix); + Write_Field28_Name (Ent); + Write_Str (" = "); + Print_Field (Field28 (Ent)); + Print_Eol; + end if; + + if Field_Present (Field29 (Ent)) then + Print_Str (Prefix); + Write_Field29_Name (Ent); + Write_Str (" = "); + Print_Field (Field29 (Ent)); + Print_Eol; + end if; + Write_Entity_Flags (Ent, Prefix); end Print_Entity_Info; *************** package body Treepr is *** 1001,1006 **** --- 1019,1030 ---- Print_Eol; end if; + if Has_Aspects (N) then + Print_Str (Prefix_Str_Char); + Print_Str ("Has_Aspects = True"); + Print_Eol; + end if; + if Has_Dynamic_Range_Check (N) then Print_Str (Prefix_Str_Char); Print_Str ("Has_Dynamic_Range_Check = True"); *************** package body Treepr is *** 1090,1095 **** --- 1114,1123 ---- when F_Field5 => Field_To_Be_Printed := Field5 (N) /= Union_Id (Empty); + -- Flag3 is obsolete, so this probably gets removed ??? + + when F_Flag3 => Field_To_Be_Printed := Has_Aspects (N); + when F_Flag4 => Field_To_Be_Printed := Flag4 (N); when F_Flag5 => Field_To_Be_Printed := Flag5 (N); when F_Flag6 => Field_To_Be_Printed := Flag6 (N); *************** package body Treepr is *** 1106,1117 **** when F_Flag17 => Field_To_Be_Printed := Flag17 (N); when F_Flag18 => Field_To_Be_Printed := Flag18 (N); ! -- Flag1,2,3 are no longer used when F_Flag1 => raise Program_Error; when F_Flag2 => raise Program_Error; - when F_Flag3 => raise Program_Error; - end case; -- Print field if it is to be printed --- 1134,1143 ---- when F_Flag17 => Field_To_Be_Printed := Flag17 (N); when F_Flag18 => Field_To_Be_Printed := Flag18 (N); ! -- Flag1,2 are no longer used when F_Flag1 => raise Program_Error; when F_Flag2 => raise Program_Error; end case; -- Print field if it is to be printed *************** package body Treepr is *** 1161,1171 **** when F_Flag17 => Print_Flag (Flag17 (N)); when F_Flag18 => Print_Flag (Flag18 (N)); ! -- Flag1,2,3 are no longer used when F_Flag1 => raise Program_Error; when F_Flag2 => raise Program_Error; ! when F_Flag3 => raise Program_Error; end case; Print_Eol; --- 1187,1200 ---- when F_Flag17 => Print_Flag (Flag17 (N)); when F_Flag18 => Print_Flag (Flag18 (N)); ! -- Flag1,2 are no longer used when F_Flag1 => raise Program_Error; when F_Flag2 => raise Program_Error; ! ! -- Not clear why we need the following ??? ! ! when F_Flag3 => Print_Flag (Has_Aspects (N)); end case; Print_Eol; *************** package body Treepr is *** 1179,1193 **** P := P + 1; end loop; end if; - end loop; -- Print entity information for entities if Nkind (N) in N_Entity then Print_Entity_Info (N, Prefix_Str_Char); end if; end Print_Node; --------------------- --- 1208,1238 ---- P := P + 1; end loop; end if; end loop; + -- Print aspects if present + + if Has_Aspects (N) then + Print_Str (Prefix_Str_Char); + Print_Str ("Aspect_Specifications = "); + Print_Field (Union_Id (Aspect_Specifications (N))); + Print_Eol; + end if; + -- Print entity information for entities if Nkind (N) in N_Entity then Print_Entity_Info (N, Prefix_Str_Char); end if; + -- Print the SCIL node (if available) + + if Present (Get_SCIL_Node (N)) then + Print_Str (Prefix_Str_Char); + Print_Str ("SCIL_Node = "); + Print_Node_Ref (Get_SCIL_Node (N)); + Print_Eol; + end if; end Print_Node; --------------------- *************** package body Treepr is *** 1890,1895 **** --- 1935,1944 ---- Visit_Descendent (Field4 (N)); Visit_Descendent (Field5 (N)); + if Has_Aspects (N) then + Visit_Descendent (Union_Id (Aspect_Specifications (N))); + end if; + -- Entity case else diff -Nrcpad gcc-4.5.2/gcc/ada/ttypef.ads gcc-4.6.0/gcc/ada/ttypef.ads *** gcc-4.5.2/gcc/ada/ttypef.ads Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/ttypef.ads Thu Jan 1 00:00:00 1970 *************** *** 1,204 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT COMPILER COMPONENTS -- - -- -- - -- T T Y P E F -- - -- -- - -- S p e c -- - -- -- - -- 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. -- - -- -- - ------------------------------------------------------------------------------ - - -- This module contains values for the predefined floating-point attributes. - -- All references to these attribute values in a program being compiled must - -- use the values in this package, not the values returned by referencing - -- the corresponding attributes (since that would give host machine values). - -- Boolean-valued attributes are defined in System.Parameters, because they - -- need a finer control than what is provided by the formats described below. - - -- The codes for the eight floating-point formats supported are: - - -- IEEES - IEEE Single Float - -- IEEEL - IEEE Double Float - -- IEEEX - IEEE Double Extended Float - -- VAXFF - VAX F Float - -- VAXDF - VAX D Float - -- VAXGF - VAX G Float - -- AAMPS - AAMP 32-bit Float - -- AAMPL - AAMP 48-bit Float - - package Ttypef is - - ---------------------------------- - -- Universal Integer Attributes -- - ---------------------------------- - - -- Note that the constant declarations below specify values - -- using the Ada model, so IEEES_Machine_Emax does not specify - -- the IEEE definition of the single precision float type, - -- but the value of the Ada attribute which is one higher - -- as the binary point is at a different location. - - IEEES_Digits : constant := 6; - IEEEL_Digits : constant := 15; - IEEEX_Digits : constant := 18; - VAXFF_Digits : constant := 6; - VAXDF_Digits : constant := 9; - VAXGF_Digits : constant := 15; - AAMPS_Digits : constant := 6; - AAMPL_Digits : constant := 9; - - IEEES_Machine_Emax : constant := 128; - IEEEL_Machine_Emax : constant := 1024; - IEEEX_Machine_Emax : constant := 16384; - VAXFF_Machine_Emax : constant := 127; - VAXDF_Machine_Emax : constant := 127; - VAXGF_Machine_Emax : constant := 1023; - AAMPS_Machine_Emax : constant := 127; - AAMPL_Machine_Emax : constant := 127; - - IEEES_Machine_Emin : constant := -125; - IEEEL_Machine_Emin : constant := -1021; - IEEEX_Machine_Emin : constant := -16381; - VAXFF_Machine_Emin : constant := -127; - VAXDF_Machine_Emin : constant := -127; - VAXGF_Machine_Emin : constant := -1023; - AAMPS_Machine_Emin : constant := -127; - AAMPL_Machine_Emin : constant := -127; - - IEEES_Machine_Mantissa : constant := 24; - IEEEL_Machine_Mantissa : constant := 53; - IEEEX_Machine_Mantissa : constant := 64; - VAXFF_Machine_Mantissa : constant := 24; - VAXDF_Machine_Mantissa : constant := 56; - VAXGF_Machine_Mantissa : constant := 53; - AAMPS_Machine_Mantissa : constant := 24; - AAMPL_Machine_Mantissa : constant := 40; - - IEEES_Model_Emin : constant := -125; - IEEEL_Model_Emin : constant := -1021; - IEEEX_Model_Emin : constant := -16381; - VAXFF_Model_Emin : constant := -127; - VAXDF_Model_Emin : constant := -127; - VAXGF_Model_Emin : constant := -1023; - AAMPS_Model_Emin : constant := -127; - AAMPL_Model_Emin : constant := -127; - - IEEES_Model_Mantissa : constant := 24; - IEEEL_Model_Mantissa : constant := 53; - IEEEX_Model_Mantissa : constant := 64; - VAXFF_Model_Mantissa : constant := 24; - VAXDF_Model_Mantissa : constant := 56; - VAXGF_Model_Mantissa : constant := 53; - AAMPS_Model_Mantissa : constant := 24; - AAMPL_Model_Mantissa : constant := 40; - - IEEES_Safe_Emax : constant := 128; - IEEEL_Safe_Emax : constant := 1024; - IEEEX_Safe_Emax : constant := 16384; - VAXFF_Safe_Emax : constant := 127; - VAXDF_Safe_Emax : constant := 127; - VAXGF_Safe_Emax : constant := 1023; - AAMPS_Safe_Emax : constant := 127; - AAMPL_Safe_Emax : constant := 127; - - ------------------------------- - -- Universal Real Attributes -- - ------------------------------- - - IEEES_Model_Epsilon : constant := 2#1.0#E-23; - IEEEL_Model_Epsilon : constant := 2#1.0#E-52; - IEEEX_Model_Epsilon : constant := 2#1.0#E-63; - VAXFF_Model_Epsilon : constant := 16#0.1000_000#E-4; - VAXDF_Model_Epsilon : constant := 16#0.4000_0000_0000_000#E-7; - VAXGF_Model_Epsilon : constant := 16#0.4000_0000_0000_00#E-12; - AAMPS_Model_Epsilon : constant := 2#1.0#E-23; - AAMPL_Model_Epsilon : constant := 2#1.0#E-39; - - IEEES_Model_Small : constant := 2#1.0#E-126; - IEEEL_Model_Small : constant := 2#1.0#E-1022; - IEEEX_Model_Small : constant := 2#1.0#E-16381; - VAXFF_Model_Small : constant := 16#0.8000_000#E-21; - VAXDF_Model_Small : constant := 16#0.8000_0000_0000_000#E-31; - VAXGF_Model_Small : constant := 16#0.8000_0000_0000_00#E-51; - AAMPS_Model_Small : constant := 16#0.8000_000#E-21; - AAMPL_Model_Small : constant := 16#0.8000_0000_000#E-31; - - IEEES_Safe_First : constant := -16#0.FFFF_FF#E+32; - IEEEL_Safe_First : constant := -16#0.FFFF_FFFF_FFFF_F8#E+256; - IEEEX_Safe_First : constant := -16#0.FFFF_FFFF_FFFF_FFFF#E+4096; - VAXFF_Safe_First : constant := -16#0.7FFF_FF8#E+32; - VAXDF_Safe_First : constant := -16#0.7FFF_FFFF_FFFF_FC0#E+32; - VAXGF_Safe_First : constant := -16#0.7FFF_FFFF_FFFF_FC#E+256; - AAMPS_Safe_First : constant := -16#0.7FFF_FF8#E+32; - AAMPL_Safe_First : constant := -16#0.7FFF_FFFF_FF8#E+32; - - IEEES_Safe_Large : constant := 16#0.FFFF_FF#E+32; - IEEEL_Safe_Large : constant := 16#0.FFFF_FFFF_FFFF_F8#E+256; - IEEEX_Safe_Large : constant := 16#0.FFFF_FFFF_FFFF_FFFF#E+4096; - VAXFF_Safe_Large : constant := 16#0.7FFF_FC0#E+32; - VAXDF_Safe_Large : constant := 16#0.7FFF_FFFF_0000_000#E+32; - VAXGF_Safe_Large : constant := 16#0.7FFF_FFFF_FFFF_F0#E+256; - AAMPS_Safe_Large : constant := 16#0.7FFF_FC0#E+32; - AAMPL_Safe_Large : constant := 16#0.7FFF_FFFF#E+32; - - IEEES_Safe_Last : constant := 16#0.FFFF_FF#E+32; - IEEEL_Safe_Last : constant := 16#0.FFFF_FFFF_FFFF_F8#E+256; - IEEEX_Safe_Last : constant := 16#0.FFFF_FFFF_FFFF_FFFF#E+4096; - VAXFF_Safe_Last : constant := 16#0.7FFF_FF8#E+32; - VAXDF_Safe_Last : constant := 16#0.7FFF_FFFF_FFFF_FC0#E+32; - VAXGF_Safe_Last : constant := 16#0.7FFF_FFFF_FFFF_FC#E+256; - AAMPS_Safe_Last : constant := 16#0.7FFF_FF8#E+32; - AAMPL_Safe_Last : constant := 16#0.7FFF_FFFF_FF8#E+32; - - IEEES_Safe_Small : constant := 2#1.0#E-126; - IEEEL_Safe_Small : constant := 2#1.0#E-1022; - IEEEX_Safe_Small : constant := 2#1.0#E-16381; - VAXFF_Safe_Small : constant := 16#0.1000_000#E-31; - VAXDF_Safe_Small : constant := 16#0.1000_0000_0000_000#E-31; - VAXGF_Safe_Small : constant := 16#0.1000_0000_0000_00#E-255; - AAMPS_Safe_Small : constant := 16#0.1000_000#E-31; - AAMPL_Safe_Small : constant := 16#0.1000_0000_000#E-31; - - ---------------------- - -- Typed Attributes -- - ---------------------- - - -- The attributes First and Last are typed attributes in Ada, and yield - -- values of the appropriate float type. However we still describe them - -- as universal real values in this file, since we are talking about the - -- target floating-point types, not the host floating-point types. - - IEEES_First : constant := -16#0.FFFF_FF#E+32; - IEEEL_First : constant := -16#0.FFFF_FFFF_FFFF_F8#E+256; - IEEEX_First : constant := -16#0.FFFF_FFFF_FFFF_FFFF#E+4096; - VAXFF_First : constant := -16#0.7FFF_FF8#E+32; - VAXDF_First : constant := -16#0.7FFF_FFFF_FFFF_FF8#E+32; - VAXGF_First : constant := -16#0.7FFF_FFFF_FFFF_FC#E+256; - AAMPS_First : constant := -16#0.7FFF_FF8#E+32; - AAMPL_First : constant := -16#0.7FFF_FFFF_FF8#E+32; - - IEEES_Last : constant := 16#0.FFFF_FF#E+32; - IEEEL_Last : constant := 16#0.FFFF_FFFF_FFFF_F8#E+256; - IEEEX_Last : constant := 16#0.FFFF_FFFF_FFFF_FFFF#E+4096; - VAXFF_Last : constant := 16#0.7FFF_FF8#E+32; - VAXDF_Last : constant := 16#0.7FFF_FFFF_FFFF_FC0#E+32; - VAXGF_Last : constant := 16#0.7FFF_FFFF_FFFF_FC#E+256; - AAMPS_Last : constant := 16#0.7FFF_FF8#E+32; - AAMPL_Last : constant := 16#0.7FFF_FFFF_FF8#E+32; - - end Ttypef; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/types.ads gcc-4.6.0/gcc/ada/types.ads *** gcc-4.5.2/gcc/ada/types.ads Wed Oct 28 13:50:10 2009 --- gcc-4.6.0/gcc/ada/types.ads Fri Oct 22 13:58:49 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Types is *** 59,67 **** type Int is range -2 ** 31 .. +2 ** 31 - 1; -- Signed 32-bit integer - type Dint is range -2 ** 63 .. +2 ** 63 - 1; - -- Double length (64-bit) integer - subtype Nat is Int range 0 .. Int'Last; -- Non-negative Int values --- 59,64 ---- *************** package Types is *** 125,132 **** 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); --- 122,130 ---- subtype Big_String is String (Positive); type Big_String_Ptr is access all Big_String; ! -- Virtual type for handling imported big strings. Note that we should ! -- never have any allocators for this type, but we don't give a storage ! -- size of zero, since there are legitimate deallocations going on. function To_Big_String_Ptr is new Unchecked_Conversion (System.Address, Big_String_Ptr); *************** package Types is *** 200,212 **** -- 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 -- Source_Buffer. The address is adjusted so that the virtual origin -- addressing works correctly. See Osint.Read_Source_Buffer for further ! -- details. subtype Source_Ptr is Text_Ptr; -- Type used to represent a source location, which is a subscript of a --- 198,211 ---- -- Source_Buffer_Ptr, see Osint.Read_Source_File for details. type Source_Buffer_Ptr is access all Big_Source_Buffer; -- 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 -- Source_Buffer. The address is adjusted so that the virtual origin -- addressing works correctly. See Osint.Read_Source_Buffer for further ! -- details. Again, as for Big_String_Ptr, we should never allocate using ! -- this type, but we don't give a storage size clause of zero, since we ! -- may end up doing deallocations of instances allocated manually. subtype Source_Ptr is Text_Ptr; -- Type used to represent a source location, which is a subscript of a *************** package Types is *** 254,266 **** -- Universal integers (type Uint) -- Universal reals (type Ureal) ! -- In most contexts, the strongly typed interface determines which of ! -- these types is present. However, there are some situations (involving ! -- untyped traversals of the tree), where it is convenient to be easily ! -- able to distinguish these values. The underlying representation in all ! -- cases is an integer type Union_Id, and we ensure that the range of ! -- the various possible values for each of the above types is disjoint ! -- so that this distinction is possible. type Union_Id is new Int; -- The type in the tree for a union of possible ID values --- 253,265 ---- -- Universal integers (type Uint) -- Universal reals (type Ureal) ! -- In most contexts, the strongly typed interface determines which of these ! -- types is present. However, there are some situations (involving untyped ! -- traversals of the tree), where it is convenient to be easily able to ! -- distinguish these values. The underlying representation in all cases is ! -- an integer type Union_Id, and we ensure that the range of the various ! -- possible values for each of the above types is disjoint so that this ! -- distinction is possible. type Union_Id is new Int; -- The type in the tree for a union of possible ID values *************** package Types is *** 348,363 **** -- lie in. Such tests appear only in the lowest level packages. subtype List_Range is Union_Id ! range List_Low_Bound .. List_High_Bound; subtype Node_Range is Union_Id ! range Node_Low_Bound .. Node_High_Bound; subtype Elist_Range is Union_Id ! range Elist_Low_Bound .. Elist_High_Bound; subtype Elmt_Range is Union_Id ! range Elmt_Low_Bound .. Elmt_High_Bound; subtype Names_Range is Union_Id range Names_Low_Bound .. Names_High_Bound; --- 347,362 ---- -- lie in. Such tests appear only in the lowest level packages. subtype List_Range is Union_Id ! range List_Low_Bound .. List_High_Bound; subtype Node_Range is Union_Id ! range Node_Low_Bound .. Node_High_Bound; subtype Elist_Range is Union_Id ! range Elist_Low_Bound .. Elist_High_Bound; subtype Elmt_Range is Union_Id ! range Elmt_Low_Bound .. Elmt_High_Bound; subtype Names_Range is Union_Id range Names_Low_Bound .. Names_High_Bound; *************** package Types is *** 369,391 **** range Uint_Low_Bound .. Uint_High_Bound; subtype Ureal_Range is Union_Id ! range Ureal_Low_Bound .. Ureal_High_Bound; ! ---------------------------- -- Types for Atree Package -- ! ---------------------------- -- Node_Id values are used to identify nodes in the tree. They are ! -- subscripts into the Node table declared in package Tree. Note that ! -- the special values Empty and Error are subscripts into this table, -- See package Atree for further details. type Node_Id is range Node_Low_Bound .. Node_High_Bound; -- Type used to identify nodes in the tree subtype Entity_Id is Node_Id; ! -- A synonym for node types, used in the entity package to refer to nodes ! -- that are entities (i.e. nodes with an Nkind of N_Defining_xxx) All such -- nodes are extended nodes and these are the only extended nodes, so that -- in practice entity and extended nodes are synonymous. --- 368,390 ---- range Uint_Low_Bound .. Uint_High_Bound; subtype Ureal_Range is Union_Id ! range Ureal_Low_Bound .. Ureal_High_Bound; ! ----------------------------- -- Types for Atree Package -- ! ----------------------------- -- Node_Id values are used to identify nodes in the tree. They are ! -- subscripts into the Nodes table declared in package Atree. Note that ! -- the special values Empty and Error are subscripts into this table. -- See package Atree for further details. type Node_Id is range Node_Low_Bound .. Node_High_Bound; -- Type used to identify nodes in the tree subtype Entity_Id is Node_Id; ! -- A synonym for node types, used in the Einfo package to refer to nodes ! -- that are entities (i.e. nodes with an Nkind of N_Defining_xxx). All such -- nodes are extended nodes and these are the only extended nodes, so that -- in practice entity and extended nodes are synonymous. *************** package Types is *** 402,413 **** Empty_List_Or_Node : constant := 0; -- This constant is used in situations (e.g. initializing empty fields) ! -- where the value set will be used to represent either an empty node ! -- or a non-existent list, depending on the context. Error : constant Node_Id := Node_Low_Bound + 1; ! -- Used to indicate that there was an error in the source program. A node ! -- is actually allocated at this address, so that Nkind (Error) = N_Error. Empty_Or_Error : constant Node_Id := Error; -- Since Empty and Error are the first two Node_Id values, the test for --- 401,412 ---- Empty_List_Or_Node : constant := 0; -- This constant is used in situations (e.g. initializing empty fields) ! -- where the value set will be used to represent either an empty node or ! -- a non-existent list, depending on the context. Error : constant Node_Id := Node_Low_Bound + 1; ! -- Used to indicate an error in the source program. A node is actually ! -- allocated with this Id value, so that Nkind (Error) = N_Error. Empty_Or_Error : constant Node_Id := Error; -- Since Empty and Error are the first two Node_Id values, the test for *************** package Types is *** 422,432 **** -- Types for Nlists Package -- ------------------------------ ! -- List_Id values are used to identify node lists in the tree. They are ! -- subscripts into the Lists table declared in package Tree. Note that the ! -- special value Error_List is a subscript in this table, but the value ! -- No_List is *not* a valid subscript, and any attempt to apply list ! -- operations to No_List will cause a (detected) error. type List_Id is range List_Low_Bound .. List_High_Bound; -- Type used to identify a node list --- 421,432 ---- -- Types for Nlists Package -- ------------------------------ ! -- List_Id values are used to identify node lists stored in the tree, so ! -- that each node can be on at most one such list (see package Nlists for ! -- further details). Note that the special value Error_List is a subscript ! -- in this table, but the value No_List is *not* a valid subscript, and any ! -- attempt to apply list operations to No_List will cause a (detected) ! -- error. type List_Id is range List_Low_Bound .. List_High_Bound; -- Type used to identify a node list *************** package Types is *** 449,472 **** -- Types for Elists Package -- ------------------------------ ! -- Element list Id values are used to identify element lists stored in the ! -- tree (see package Atree for further details). They are formed by adding ! -- a bias (Element_List_Bias) to subscript values in the same array that is ! -- used for node list headers. type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound; -- Type used to identify an element list (Elist header table subscript) No_Elist : constant Elist_Id := Elist_Low_Bound; ! -- 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. First_Elist_Id : constant Elist_Id := No_Elist + 1; -- Subscript of first allocated Elist header ! -- Element Id values are used to identify individual elements of an ! -- element list (see package Elists for further details). type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound; -- Type used to identify an element list --- 449,471 ---- -- Types for Elists Package -- ------------------------------ ! -- Element list Id values are used to identify element lists stored outside ! -- of the tree, allowing nodes to be members of more than one such list ! -- (see package Elists for further details). type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound; -- Type used to identify an element list (Elist header table subscript) No_Elist : constant Elist_Id := Elist_Low_Bound; ! -- 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. First_Elist_Id : constant Elist_Id := No_Elist + 1; -- Subscript of first allocated Elist header ! -- Element Id values are used to identify individual elements of an element ! -- list (see package Elists for further details). type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound; -- Type used to identify an element list *************** package Types is *** 482,492 **** ------------------------------- -- String_Id values are used to identify entries in the strings table. They ! -- are subscripts into the strings table defined in package Strings. -- Note that with only a few exceptions, which are clearly documented, the -- type String_Id should be regarded as a private type. In particular it is -- never appropriate to perform arithmetic operations using this type. type String_Id is range Strings_Low_Bound .. Strings_High_Bound; -- Type used to identify entries in the strings table --- 481,492 ---- ------------------------------- -- String_Id values are used to identify entries in the strings table. They ! -- are subscripts into the Strings table defined in package Stringt. -- Note that with only a few exceptions, which are clearly documented, the -- type String_Id should be regarded as a private type. In particular it is -- never appropriate to perform arithmetic operations using this type. + -- Doesn't this also apply to all other *_Id types??? type String_Id is range Strings_Low_Bound .. Strings_High_Bound; -- Type used to identify entries in the strings table *************** package Types is *** 505,514 **** -- The type Char is used for character data internally in the compiler, but -- character codes in the source are represented by the Char_Code type. -- 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 ! -- 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. --- 505,514 ---- -- The type Char is used for character data internally in the compiler, but -- character codes in the source are represented by the Char_Code type. -- Each character literal in the source is interpreted as being one of the ! -- 16#7FFF_FFFF# possible Wide_Wide_Character codes, and a unique Integer ! -- value is assigned, corresponding to the UTF-32 value, which 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. *************** package Types is *** 554,560 **** type Unit_Number_Type is new Int; -- Unit number. The main source is unit 0, and subsidiary sources have -- non-zero numbers starting with 1. Unit numbers are used to index the ! -- file table in Lib. Main_Unit : constant Unit_Number_Type := 0; -- Unit number value for main unit --- 554,560 ---- type Unit_Number_Type is new Int; -- Unit number. The main source is unit 0, and subsidiary sources have -- non-zero numbers starting with 1. Unit numbers are used to index the ! -- Units table in package Lib. Main_Unit : constant Unit_Number_Type := 0; -- Unit number value for main unit *************** package Types is *** 730,743 **** -- Parameter Mechanism Control -- --------------------------------- ! -- Function and parameter entities have a field that records the ! -- passing mechanism. See specification of Sem_Mech for full details. ! -- The following subtype is used to represent values of this type: subtype Mechanism_Type is Int range -18 .. Int'Last; ! -- Type used to represent a mechanism value. This is a subtype rather ! -- than a type to avoid some annoying processing problems with certain ! -- routines in Einfo (processing them to create the corresponding C). ------------------------------ -- Run-Time Exception Codes -- --- 730,743 ---- -- Parameter Mechanism Control -- --------------------------------- ! -- Function and parameter entities have a field that records the passing ! -- mechanism. See specification of Sem_Mech for full details. The following ! -- subtype is used to represent values of this type: subtype Mechanism_Type is Int range -18 .. Int'Last; ! -- Type used to represent a mechanism value. This is a subtype rather than ! -- a type to avoid some annoying processing problems with certain routines ! -- in Einfo (processing them to create the corresponding C). ------------------------------ -- Run-Time Exception Codes -- *************** package Types is *** 762,773 **** -- 1. Modify the type and subtype declarations below appropriately, -- keeping things in alphabetical order. ! -- 2. Modify the corresponding definitions in types.h, including ! -- the definition of last_reason_code. ! -- 3. Add a new routine in Ada.Exceptions with the appropriate call ! -- and static string constant. Note that there is more than one ! -- version of a-except.adb which must be modified. type RT_Exception_Code is (CE_Access_Check_Failed, -- 00 --- 762,773 ---- -- 1. Modify the type and subtype declarations below appropriately, -- keeping things in alphabetical order. ! -- 2. Modify the corresponding definitions in types.h, including the ! -- definition of last_reason_code. ! -- 3. Add a new routine in Ada.Exceptions with the appropriate call and ! -- static string constant. Note that there is more than one version ! -- of a-except.adb which must be modified. type RT_Exception_Code is (CE_Access_Check_Failed, -- 00 *************** package Types is *** 789,811 **** PE_Accessibility_Check_Failed, -- 15 PE_Address_Of_Intrinsic, -- 16 PE_All_Guards_Closed, -- 17 ! PE_Current_Task_In_Entry_Body, -- 18 ! PE_Duplicated_Entry_Address, -- 19 ! PE_Explicit_Raise, -- 20 ! PE_Finalize_Raised_Exception, -- 21 ! PE_Implicit_Return, -- 22 ! PE_Misaligned_Address_Value, -- 23 ! PE_Missing_Return, -- 24 ! PE_Overlaid_Controlled_Object, -- 25 ! PE_Potentially_Blocking_Operation, -- 26 ! PE_Stubbed_Subprogram_Called, -- 27 ! PE_Unchecked_Union_Restriction, -- 28 ! PE_Non_Transportable_Actual, -- 29 ! SE_Empty_Storage_Pool, -- 30 ! SE_Explicit_Raise, -- 31 ! SE_Infinite_Recursion, -- 32 ! SE_Object_Too_Large); -- 33 subtype RT_CE_Exceptions is RT_Exception_Code range CE_Access_Check_Failed .. --- 789,812 ---- PE_Accessibility_Check_Failed, -- 15 PE_Address_Of_Intrinsic, -- 16 PE_All_Guards_Closed, -- 17 ! PE_Bad_Predicated_Generic_Type, -- 18 ! PE_Current_Task_In_Entry_Body, -- 19 ! PE_Duplicated_Entry_Address, -- 20 ! PE_Explicit_Raise, -- 21 ! PE_Finalize_Raised_Exception, -- 22 ! PE_Implicit_Return, -- 23 ! PE_Misaligned_Address_Value, -- 24 ! PE_Missing_Return, -- 25 ! PE_Overlaid_Controlled_Object, -- 26 ! PE_Potentially_Blocking_Operation, -- 27 ! PE_Stubbed_Subprogram_Called, -- 28 ! PE_Unchecked_Union_Restriction, -- 29 ! PE_Non_Transportable_Actual, -- 30 ! SE_Empty_Storage_Pool, -- 31 ! SE_Explicit_Raise, -- 32 ! SE_Infinite_Recursion, -- 33 ! SE_Object_Too_Large); -- 34 subtype RT_CE_Exceptions is RT_Exception_Code range CE_Access_Check_Failed .. diff -Nrcpad gcc-4.5.2/gcc/ada/types.h gcc-4.6.0/gcc/ada/types.h *** gcc-4.5.2/gcc/ada/types.h Fri Apr 17 09:06:20 2009 --- gcc-4.6.0/gcc/ada/types.h Fri Oct 22 10:41:17 2010 *************** *** 6,12 **** * * * C Header File * * * ! * 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** typedef Int Mechanism_Type; *** 361,382 **** #define PE_Accessibility_Check_Failed 15 #define PE_Address_Of_Intrinsic 16 #define PE_All_Guards_Closed 17 ! #define PE_Current_Task_In_Entry_Body 18 ! #define PE_Duplicated_Entry_Address 19 ! #define PE_Explicit_Raise 20 ! #define PE_Finalize_Raised_Exception 21 ! #define PE_Implicit_Return 22 ! #define PE_Misaligned_Address_Value 23 ! #define PE_Missing_Return 24 ! #define PE_Overlaid_Controlled_Object 25 ! #define PE_Potentially_Blocking_Operation 26 ! #define PE_Stubbed_Subprogram_Called 27 ! #define PE_Unchecked_Union_Restriction 28 ! #define PE_Non_Transportable_Actual 29 ! #define SE_Empty_Storage_Pool 30 ! #define SE_Explicit_Raise 31 ! #define SE_Infinite_Recursion 32 ! #define SE_Object_Too_Large 33 ! #define LAST_REASON_CODE 33 --- 361,383 ---- #define PE_Accessibility_Check_Failed 15 #define PE_Address_Of_Intrinsic 16 #define PE_All_Guards_Closed 17 ! #define PE_Bad_Attribute_For_Predicate 18 ! #define PE_Current_Task_In_Entry_Body 19 ! #define PE_Duplicated_Entry_Address 20 ! #define PE_Explicit_Raise 21 ! #define PE_Finalize_Raised_Exception 22 ! #define PE_Implicit_Return 23 ! #define PE_Misaligned_Address_Value 24 ! #define PE_Missing_Return 25 ! #define PE_Overlaid_Controlled_Object 26 ! #define PE_Potentially_Blocking_Operation 27 ! #define PE_Stubbed_Subprogram_Called 28 ! #define PE_Unchecked_Union_Restriction 29 ! #define PE_Non_Transportable_Actual 30 ! #define SE_Empty_Storage_Pool 31 ! #define SE_Explicit_Raise 32 ! #define SE_Infinite_Recursion 33 ! #define SE_Object_Too_Large 34 ! #define LAST_REASON_CODE 34 diff -Nrcpad gcc-4.5.2/gcc/ada/ug_words gcc-4.6.0/gcc/ada/ug_words *** gcc-4.5.2/gcc/ada/ug_words Wed Jul 22 15:56:47 2009 --- gcc-4.6.0/gcc/ada/ug_words Thu Oct 21 10:19:58 2010 *************** gnatfind ^ GNAT FIND *** 24,31 **** Gnatfind ^ GNAT FIND gnatkr ^ GNAT KRUNCH Gnatkr ^ GNAT KRUNCH - gnatlbr ^ GNAT LIBRARY - Gnatlbr ^ GNAT LIBRARY gnatlink ^ GNAT LINK Gnatlink ^ GNAT LINK gnatls ^ GNAT LIST --- 24,29 ---- *************** gcc -c ^ GNAT COMPILE *** 61,66 **** --- 59,65 ---- -gnatDG ^ /XDEBUG /EXPAND_SOURCEA -gnatD ^ /XDEBUG -gnatec ^ /CONFIGURATION_PRAGMAS_FILE + -gnateE ^ /EXTRA_EXCEPTION_INFORMATION -gnateD ^ /SYMBOL_PREPROCESSING -gnatef ^ /FULL_PATH_IN_BRIEF_MESSAGES -gnateG ^ /GENERATE_PROCESSED_SOURCE *************** gcc -c ^ GNAT COMPILE *** 85,90 **** --- 84,90 ---- -gnatN ^ /INLINE=FULL -gnato ^ /CHECKS=OVERFLOW -gnatp ^ /CHECKS=SUPPRESS_ALL + -gnat-p ^ /CHECKS=UNSUPPRESS_ALL -gnatP ^ /POLLING -gnatR ^ /REPRESENTATION_INFO -gnatR0 ^ /REPRESENTATION_INFO=NONE *************** gcc -c ^ GNAT COMPILE *** 139,144 **** --- 139,146 ---- -gnatwG ^ /WARNINGS=NOUNRECOGNIZED_PRAGMAS -gnatwh ^ /WARNINGS=HIDING -gnatwH ^ /WARNINGS=NOHIDING + -gnatw.h ^ /WARNINGS=AVOIDGAPS + -gnatw.H ^ /WARNINGS=NOAVOIDGAPS -gnatwi ^ /WARNINGS=IMPLEMENTATION -gnatwI ^ /WARNINGS=NOIMPLEMENTATION -gnatwj ^ /WARNINGS=OBSOLESCENT *************** gcc -c ^ GNAT COMPILE *** 160,165 **** --- 162,169 ---- -gnatwP ^ /WARNINGS=NOINEFFECTIVE_INLINE -gnatw.p ^ /WARNINGS=PARAMETER_ORDER -gnatw.P ^ /WARNINGS=NO_PARAMETER_ORDER + -gnatw.h ^ /WARNINGS=OVERRIDING_SIZE + -gnatw.H ^ /WARNINGS=NOOVERRIDING_SIZE -gnatwq ^ /WARNINGS=MISSING_PARENS -gnatwQ ^ /WARNINGS=NOMISSING_PARENS -gnatwr ^ /WARNINGS=REDUNDANT *************** gcc -c ^ GNAT COMPILE *** 169,174 **** --- 173,180 ---- -gnatwT ^ /WARNINGS=NODELETED_CODE -gnatwu ^ /WARNINGS=UNUSED -gnatwU ^ /WARNINGS=NOUNUSED + -gnatw.u ^ /WARNINGS=UNORDERED_ENUMERATIONS + -gnatw.U ^ /WARNINGS=NOUNORDERED_ENUMERATIONS -gnatwv ^ /WARNINGS=VARIABLES_UNINITIALIZED -gnatwV ^ /WARNINGS=NOVARIABLES_UNINITIALIZED -gnatww ^ /WARNINGS=LOWBOUND_ASSUMED *************** gcc -c ^ GNAT COMPILE *** 194,199 **** --- 200,208 ---- -gnat83 ^ /83 -gnat95 ^ /95 -gnat05 ^ /05 + -gnat2005 ^ /2005 + -gnat12 ^ /12 + -gnat2012 ^ /2012 -gnatx ^ /XREF=SUPPRESS -gnatX ^ /EXTENSIONS_ALLOWED --RTS ^ /RUNTIME_SYSTEM *************** stderr ^ SYS$ERROR *** 217,219 **** --- 226,230 ---- -O1 ^ /OPTIMIZE=SOME -O2 ^ /OPTIMIZE=ALL -O3 ^ /OPTIMIZE=INLINING + -H32 ^ /32_MALLOC + -H64 ^ /64_MALLOC diff -Nrcpad gcc-4.5.2/gcc/ada/uintp.adb gcc-4.6.0/gcc/ada/uintp.adb *** gcc-4.5.2/gcc/ada/uintp.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/uintp.adb Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Uintp is *** 168,180 **** (Left, Right : Uint; Quotient : out Uint; Remainder : out Uint; ! Discard_Quotient : Boolean; ! Discard_Remainder : Boolean); ! -- 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. ! -- If Discard_Remainder is True, Remainder is left unchanged. function Vector_To_Uint (In_Vec : UI_Vector; --- 168,182 ---- (Left, Right : Uint; Quotient : out Uint; Remainder : out Uint; ! Discard_Quotient : Boolean := False; ! Discard_Remainder : Boolean := False); ! -- Compute Euclidean division of Left by Right. If Discard_Quotient is ! -- False then the quotient is returned in Quotient (otherwise Quotient is ! -- set to No_Uint). If Discard_Remainder is False, then the remainder is ! -- returned in Remainder (otherwise Remainder is set to No_Uint). -- ! -- If Discard_Quotient is True, Quotient is set to No_Uint ! -- If Discard_Remainder is True, Remainder is set to No_Uint function Vector_To_Uint (In_Vec : UI_Vector; *************** package body Uintp is *** 239,245 **** function Hash_Num (F : Int) return Hnum is begin ! return Standard."mod" (F, Hnum'Range_Length); end Hash_Num; --------------- --- 241,247 ---- function Hash_Num (F : Int) return Hnum is begin ! return Types."mod" (F, Hnum'Range_Length); end Hash_Num; --------------- *************** package body Uintp is *** 1253,1259 **** UI_Div_Rem (Left, Right, Quotient, Remainder, - Discard_Quotient => False, Discard_Remainder => True); return Quotient; end UI_Div; --- 1255,1260 ---- *************** package body Uintp is *** 1266,1279 **** (Left, Right : Uint; Quotient : out Uint; Remainder : out Uint; ! Discard_Quotient : Boolean; ! Discard_Remainder : Boolean) is pragma Warnings (Off, Quotient); pragma Warnings (Off, Remainder); begin pragma Assert (Right /= Uint_0); -- Cases where both operands are represented directly if Direct (Left) and then Direct (Right) then --- 1267,1283 ---- (Left, Right : Uint; Quotient : out Uint; Remainder : out Uint; ! Discard_Quotient : Boolean := False; ! Discard_Remainder : Boolean := False) is pragma Warnings (Off, Quotient); pragma Warnings (Off, Remainder); begin pragma Assert (Right /= Uint_0); + Quotient := No_Uint; + Remainder := No_Uint; + -- Cases where both operands are represented directly if Direct (Left) and then Direct (Right) then *************** package body Uintp is *** 1345,1353 **** --- 1349,1359 ---- if not Discard_Quotient then Quotient := Uint_0; end if; + if not Discard_Remainder then Remainder := Left; end if; + return; end if; *************** package body Uintp is *** 1377,1382 **** --- 1383,1389 ---- if not Discard_Remainder then Remainder := UI_From_Int (Remainder_I); end if; + return; end; end if; *************** package body Uintp is *** 1679,1727 **** function UI_From_CC (Input : Char_Code) return Uint is begin ! return UI_From_Dint (Dint (Input)); end UI_From_CC; - ------------------ - -- UI_From_Dint -- - ------------------ - - function UI_From_Dint (Input : Dint) return Uint is - begin - - if Dint (Min_Direct) <= Input and then Input <= Dint (Max_Direct) then - return Uint (Dint (Uint_Direct_Bias) + Input); - - -- For values of larger magnitude, compute digits into a vector and call - -- Vector_To_Uint. - - else - declare - Max_For_Dint : constant := 5; - -- Base is defined so that 5 Uint digits is sufficient to hold the - -- largest possible Dint value. - - V : UI_Vector (1 .. Max_For_Dint); - - Temp_Integer : Dint; - - begin - for J in V'Range loop - V (J) := 0; - end loop; - - Temp_Integer := Input; - - for J in reverse V'Range loop - V (J) := Int (abs (Temp_Integer rem Dint (Base))); - Temp_Integer := Temp_Integer / Dint (Base); - end loop; - - return Vector_To_Uint (V, Input < Dint'(0)); - end; - end if; - end UI_From_Dint; - ----------------- -- UI_From_Int -- ----------------- --- 1686,1694 ---- function UI_From_CC (Input : Char_Code) return Uint is begin ! return UI_From_Int (Int (Input)); end UI_From_CC; ----------------- -- UI_From_Int -- ----------------- *************** package body Uintp is *** 1752,1766 **** V : UI_Vector (1 .. Max_For_Int); ! Temp_Integer : Int; begin - for J in V'Range loop - V (J) := 0; - end loop; - - Temp_Integer := Input; - for J in reverse V'Range loop V (J) := abs (Temp_Integer rem Base); Temp_Integer := Temp_Integer / Base; --- 1719,1727 ---- V : UI_Vector (1 .. Max_For_Int); ! Temp_Integer : Int := Input; begin for J in reverse V'Range loop V (J) := abs (Temp_Integer rem Base); Temp_Integer := Temp_Integer / Base; *************** package body Uintp is *** 2200,2210 **** Y := Uint_0; loop ! UI_Div_Rem ! (U, V, ! Quotient => Q, Remainder => R, ! Discard_Quotient => False, ! Discard_Remainder => False); U := V; V := R; --- 2161,2167 ---- Y := Uint_0; loop ! UI_Div_Rem (U, V, Quotient => Q, Remainder => R); U := V; V := R; *************** package body Uintp is *** 2241,2252 **** function UI_Mul (Left : Uint; Right : Uint) return Uint is begin ! -- Simple case of single length operands ! if Direct (Left) and then Direct (Right) then ! return ! UI_From_Dint ! (Dint (Direct_Val (Left)) * Dint (Direct_Val (Right))); end if; -- Otherwise we have the general case (Algorithm M in Knuth) --- 2198,2210 ---- function UI_Mul (Left : Uint; Right : Uint) return Uint is begin ! -- Case where product fits in the range of a 32-bit integer ! if Int (Left) <= Int (Uint_Max_Simple_Mul) ! and then ! Int (Right) <= Int (Uint_Max_Simple_Mul) ! then ! return UI_From_Int (Direct_Val (Left) * Direct_Val (Right)); end if; -- Otherwise we have the general case (Algorithm M in Knuth) *************** package body Uintp is *** 2569,2577 **** pragma Warnings (Off, Quotient); begin UI_Div_Rem ! (Left, Right, Quotient, Remainder, ! Discard_Quotient => True, ! Discard_Remainder => False); return Remainder; end; end UI_Rem; --- 2527,2533 ---- pragma Warnings (Off, Quotient); begin UI_Div_Rem ! (Left, Right, Quotient, Remainder, Discard_Quotient => True); return Remainder; end; end UI_Rem; diff -Nrcpad gcc-4.5.2/gcc/ada/uintp.ads gcc-4.6.0/gcc/ada/uintp.ads *** gcc-4.5.2/gcc/ada/uintp.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/uintp.ads Thu Oct 21 10:19:58 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Uintp is *** 233,241 **** -- given Modulo (uses Euclid's algorithm). Note: the call is considered -- 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 - function UI_From_Int (Input : Int) return Uint; -- Converts Int value to universal integer form --- 233,238 ---- *************** package Uintp is *** 264,270 **** -- or decimal format. Auto, the default setting, lets the routine make -- a decision based on the value. ! UI_Image_Max : constant := 32; UI_Image_Buffer : String (1 .. UI_Image_Max); UI_Image_Length : Natural; -- Buffer used for UI_Image as described below --- 261,267 ---- -- or decimal format. Auto, the default setting, lets the routine make -- a decision based on the value. ! UI_Image_Max : constant := 48; -- Enough for a 128-bit number UI_Image_Buffer : String (1 .. UI_Image_Max); UI_Image_Length : Natural; -- Buffer used for UI_Image as described below *************** private *** 404,410 **** -- Base is defined to allow efficient execution of the primitive operations -- (a0, b0, c0) defined in the section "The Classical Algorithms" -- (sec. 4.3.1) of Donald Knuth's "The Art of Computer Programming", ! -- Vol. 2. These algorithms are used in this package. Base_Bits : constant := 15; -- Number of bits in base value --- 401,408 ---- -- Base is defined to allow efficient execution of the primitive operations -- (a0, b0, c0) defined in the section "The Classical Algorithms" -- (sec. 4.3.1) of Donald Knuth's "The Art of Computer Programming", ! -- Vol. 2. These algorithms are used in this package. In particular, ! -- the product of two single digits in this base fits in a 32-bit integer. Base_Bits : constant := 15; -- Number of bits in base value *************** private *** 470,475 **** --- 468,478 ---- Uint_Minus_80 : constant Uint := Uint (Uint_Direct_Bias - 80); Uint_Minus_128 : constant Uint := Uint (Uint_Direct_Bias - 128); + Uint_Max_Simple_Mul : constant := Uint_Direct_Bias + 2 ** 15; + -- If two values are directly represented and less than or equal to this + -- value, then we know the product fits in a 32-bit integer. This allows + -- UI_Mul to efficiently compute the product in this case. + type Save_Mark is record Save_Uint : Uint; Save_Udigit : Int; diff -Nrcpad gcc-4.5.2/gcc/ada/uintp.h gcc-4.6.0/gcc/ada/uintp.h *** gcc-4.5.2/gcc/ada/uintp.h Mon Sep 10 12:47:10 2007 --- gcc-4.6.0/gcc/ada/uintp.h Sat Apr 17 14:16:36 2010 *************** *** 6,12 **** * * * C Header 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- * --- 6,12 ---- * * * C Header File * * * ! * Copyright (C) 1992-2010, 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- * *************** struct Uint_Entry *** 38,64 **** #define UI_Is_In_Int_Range uintp__ui_is_in_int_range extern Boolean UI_Is_In_Int_Range (Uint); ! /* Obtain Char_Code value from Uint input. Value must be in range. */ #define UI_To_CC uintp__ui_to_cc ! extern Char_Code UI_To_CC (Uint); ! /* Obtain Int value from Uint input. This will abort if the result is ! out of range. */ #define UI_To_Int uintp__ui_to_int extern Int UI_To_Int (Uint); /* Convert an Int into a Uint. */ #define UI_From_Int uintp__ui_from_int extern Uint UI_From_Int (int); ! /* Convert a Char_Code into a Uint. */ ! #define UI_From_CC uintp__ui_from_cc ! extern Uint UI_From_CC (Char_Code); ! /* Similarly, but return a GCC INTEGER_CST. Overflow is tested by the ! constant-folding used to build the node. TYPE is the GCC type of the ! resulting node. */ ! extern tree UI_To_gnu (Uint, tree); /* Universal integers are represented by the Uint type which is an index into the Uints_Ptr table containing Uint_Entry values. A Uint_Entry contains an --- 38,83 ---- #define UI_Is_In_Int_Range uintp__ui_is_in_int_range extern Boolean UI_Is_In_Int_Range (Uint); ! /* Obtain Char_Code value from Uint input. Value must be in range. */ #define UI_To_CC uintp__ui_to_cc ! extern Char_Code UI_To_CC (Uint); ! /* Convert a Char_Code into a Uint. */ ! #define UI_From_CC uintp__ui_from_cc ! extern Uint UI_From_CC (Char_Code); ! ! /* Obtain Int value from Uint input. Abort if the result is out of range. */ #define UI_To_Int uintp__ui_to_int extern Int UI_To_Int (Uint); + /* Similarly, but return a GCC INTEGER_CST. */ + extern tree UI_To_gnu (Uint, tree); + /* Convert an Int into a Uint. */ #define UI_From_Int uintp__ui_from_int extern Uint UI_From_Int (int); ! /* Similarly, but take a GCC INTEGER_CST. */ ! extern Uint UI_From_gnu (tree); ! /* Uint values are represented as multiple precision integers stored in a ! multi-digit format using UI_Base as the base. This value is chosen so ! that the product UI_Base*UI_Base is within the range of Int values. */ ! #define UI_Base uintp__base ! extern const int UI_Base; ! ! /* Types for the fat pointer of Int vectors and the template it points to. */ ! typedef struct {int Low_Bound, High_Bound; } Vector_Template; ! typedef struct {const int *Array; Vector_Template *Bounds; } ! __attribute ((aligned (sizeof (char *) * 2))) Int_Vector; ! ! /* Create and return the Uint value from the Int vector. */ ! #define Vector_To_Uint uintp__vector_to_uint ! extern Uint Vector_To_Uint (Int_Vector, Boolean); ! ! /* Compare integer values for less than. */ ! #define UI_Lt uintp__ui_lt ! extern Boolean UI_Lt (Uint, Uint); /* Universal integers are represented by the Uint type which is an index into the Uints_Ptr table containing Uint_Entry values. A Uint_Entry contains an *************** extern struct Uint_Entry *uintp__uints__ *** 75,80 **** #define Udigits_Ptr uintp__udigits__table extern int *uintp__udigits__table; - - #define Uint_0 (Uint_Direct_Bias + 0) - #define Uint_1 (Uint_Direct_Bias + 1) --- 94,96 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/uname.adb gcc-4.6.0/gcc/ada/uname.adb *** gcc-4.5.2/gcc/ada/uname.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/uname.adb Mon Oct 25 13:50:29 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- diff -Nrcpad gcc-4.5.2/gcc/ada/urealp.adb gcc-4.6.0/gcc/ada/urealp.adb *** gcc-4.5.2/gcc/ada/urealp.adb Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/urealp.adb Thu Oct 21 10:25:12 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package body Urealp is *** 44,50 **** Num : Uint; -- Numerator (always non-negative) ! Den : Uint; -- Denominator (always non-zero, always positive if base is zero) Rbase : Nat; --- 44,50 ---- Num : Uint; -- Numerator (always non-negative) ! Den : Uint; -- Denominator (always non-zero, always positive if base is zero) Rbase : Nat; *************** package body Urealp is *** 80,99 **** -- The following universal reals are the values returned by the constant -- functions. They are initialized by the initialization procedure. ! UR_0 : Ureal; ! UR_M_0 : Ureal; ! UR_Tenth : Ureal; ! UR_Half : Ureal; ! UR_1 : Ureal; ! UR_2 : Ureal; ! UR_10 : Ureal; ! UR_10_36 : Ureal; ! UR_M_10_36 : Ureal; ! UR_100 : Ureal; ! UR_2_128 : Ureal; ! UR_2_80 : Ureal; ! UR_2_M_128 : Ureal; ! UR_2_M_80 : Ureal; Num_Ureal_Constants : constant := 10; -- This is used for an assertion check in Tree_Read and Tree_Write to --- 80,99 ---- -- The following universal reals are the values returned by the constant -- functions. They are initialized by the initialization procedure. ! UR_0 : Ureal; ! UR_M_0 : Ureal; ! UR_Tenth : Ureal; ! UR_Half : Ureal; ! UR_1 : Ureal; ! UR_2 : Ureal; ! UR_10 : Ureal; ! UR_10_36 : Ureal; ! UR_M_10_36 : Ureal; ! UR_100 : Ureal; ! UR_2_128 : Ureal; ! UR_2_80 : Ureal; ! UR_2_M_128 : Ureal; ! UR_2_M_80 : Ureal; Num_Ureal_Constants : constant := 10; -- This is used for an assertion check in Tree_Read and Tree_Write to *************** package body Urealp is *** 134,151 **** -- Return true if the real quotient of Num / Den is an integer value function Normalize (Val : Ureal_Entry) return Ureal_Entry; ! -- Normalizes the Ureal_Entry by reducing it to lowest terms (with a ! -- base value of 0). function Same (U1, U2 : Ureal) return Boolean; pragma Inline (Same); -- Determines if U1 and U2 are the same Ureal. Note that we cannot use ! -- the equals operator for this test, since that tests for equality, ! -- not identity. function Store_Ureal (Val : Ureal_Entry) return Ureal; ! -- This store a new entry in the universal reals table and return ! -- its index in the table. ------------------------- -- Decimal_Exponent_Hi -- --- 134,155 ---- -- Return true if the real quotient of Num / Den is an integer value function Normalize (Val : Ureal_Entry) return Ureal_Entry; ! -- Normalizes the Ureal_Entry by reducing it to lowest terms (with a base ! -- value of 0). function Same (U1, U2 : Ureal) return Boolean; pragma Inline (Same); -- Determines if U1 and U2 are the same Ureal. Note that we cannot use ! -- the equals operator for this test, since that tests for equality, not ! -- identity. function Store_Ureal (Val : Ureal_Entry) return Ureal; ! -- This store a new entry in the universal reals table and return its index ! -- in the table. ! ! function Store_Ureal_Normalized (Val : Ureal_Entry) return Ureal; ! pragma Inline (Store_Ureal_Normalized); ! -- Like Store_Ureal, but normalizes its operand first. ------------------------- -- Decimal_Exponent_Hi -- *************** package body Urealp is *** 451,456 **** --- 455,469 ---- return Ureals.Last; end Store_Ureal; + ---------------------------- + -- Store_Ureal_Normalized -- + ---------------------------- + + function Store_Ureal_Normalized (Val : Ureal_Entry) return Ureal is + begin + return Store_Ureal (Normalize (Val)); + end Store_Ureal_Normalized; + --------------- -- Tree_Read -- --------------- *************** package body Urealp is *** 505,515 **** Val : constant Ureal_Entry := Ureals.Table (Real); begin ! return Store_Ureal ( ! (Num => Val.Num, ! Den => Val.Den, ! Rbase => Val.Rbase, ! Negative => False)); end UR_Abs; ------------ --- 518,528 ---- Val : constant Ureal_Entry := Ureals.Table (Real); begin ! return Store_Ureal ! ((Num => Val.Num, ! Den => Val.Den, ! Rbase => Val.Rbase, ! Negative => False)); end UR_Abs; ------------ *************** package body Urealp is *** 529,535 **** function UR_Add (Left : Ureal; Right : Ureal) return Ureal is Lval : Ureal_Entry := Ureals.Table (Left); Rval : Ureal_Entry := Ureals.Table (Right); - Num : Uint; begin --- 542,547 ---- *************** package body Urealp is *** 538,544 **** -- be negative, even though in stored entries this can never be so) if Lval.Rbase /= 0 and then Lval.Rbase = Rval.Rbase then - declare Opd_Min, Opd_Max : Ureal_Entry; Exp_Min, Exp_Max : Uint; --- 550,555 ---- *************** package body Urealp is *** 568,585 **** Opd_Min.Num * Lval.Rbase ** (Exp_Max - Exp_Min) + Opd_Max.Num; if Num = 0 then ! return Store_Ureal ( ! (Num => Uint_0, ! Den => Uint_1, ! Rbase => 0, ! Negative => Lval.Negative)); else ! return Store_Ureal ( ! (Num => abs Num, ! Den => Exp_Max, ! Rbase => Lval.Rbase, ! Negative => (Num < 0))); end if; end; --- 579,596 ---- Opd_Min.Num * Lval.Rbase ** (Exp_Max - Exp_Min) + Opd_Max.Num; if Num = 0 then ! return Store_Ureal ! ((Num => Uint_0, ! Den => Uint_1, ! Rbase => 0, ! Negative => Lval.Negative)); else ! return Store_Ureal ! ((Num => abs Num, ! Den => Exp_Max, ! Rbase => Lval.Rbase, ! Negative => (Num < 0))); end if; end; *************** package body Urealp is *** 600,618 **** Num := (Ln.Num * Rn.Den) + (Rn.Num * Ln.Den); if Num = 0 then ! return Store_Ureal ( ! (Num => Uint_0, ! Den => Uint_1, ! Rbase => 0, ! Negative => Lval.Negative)); else ! return Store_Ureal ( ! Normalize ( ! (Num => abs Num, ! Den => Ln.Den * Rn.Den, ! Rbase => 0, ! Negative => (Num < 0)))); end if; end; end if; --- 611,628 ---- Num := (Ln.Num * Rn.Den) + (Rn.Num * Ln.Den); if Num = 0 then ! return Store_Ureal ! ((Num => Uint_0, ! Den => Uint_1, ! Rbase => 0, ! Negative => Lval.Negative)); else ! return Store_Ureal_Normalized ! ((Num => abs Num, ! Den => Ln.Den * Rn.Den, ! Rbase => 0, ! Negative => (Num < 0))); end if; end; end if; *************** package body Urealp is *** 624,630 **** function UR_Ceiling (Real : Ureal) return Uint is Val : constant Ureal_Entry := Normalize (Ureals.Table (Real)); - begin if Val.Negative then return UI_Negate (Val.Num / Val.Den); --- 634,639 ---- *************** package body Urealp is *** 656,711 **** pragma Assert (Rval.Num /= Uint_0); if Lval.Rbase = 0 then - if Rval.Rbase = 0 then ! return Store_Ureal ( ! Normalize ( ! (Num => Lval.Num * Rval.Den, ! Den => Lval.Den * Rval.Num, ! Rbase => 0, ! Negative => Rneg))); elsif Is_Integer (Lval.Num, Rval.Num * Lval.Den) then ! return Store_Ureal ( ! (Num => Lval.Num / (Rval.Num * Lval.Den), ! Den => (-Rval.Den), ! Rbase => Rval.Rbase, ! Negative => Rneg)); elsif Rval.Den < 0 then ! return Store_Ureal ( ! Normalize ( ! (Num => Lval.Num, ! Den => Rval.Rbase ** (-Rval.Den) * ! Rval.Num * ! Lval.Den, ! Rbase => 0, ! Negative => Rneg))); else ! return Store_Ureal ( ! Normalize ( ! (Num => Lval.Num * Rval.Rbase ** Rval.Den, ! Den => Rval.Num * Lval.Den, ! Rbase => 0, ! Negative => Rneg))); end if; elsif Is_Integer (Lval.Num, Rval.Num) then - if Rval.Rbase = Lval.Rbase then ! return Store_Ureal ( ! (Num => Lval.Num / Rval.Num, ! Den => Lval.Den - Rval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Rval.Rbase = 0 then ! return Store_Ureal ( ! (Num => (Lval.Num / Rval.Num) * Rval.Den, ! Den => Lval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Rval.Den < 0 then declare --- 665,715 ---- pragma Assert (Rval.Num /= Uint_0); if Lval.Rbase = 0 then if Rval.Rbase = 0 then ! return Store_Ureal_Normalized ! ((Num => Lval.Num * Rval.Den, ! Den => Lval.Den * Rval.Num, ! Rbase => 0, ! Negative => Rneg)); elsif Is_Integer (Lval.Num, Rval.Num * Lval.Den) then ! return Store_Ureal ! ((Num => Lval.Num / (Rval.Num * Lval.Den), ! Den => (-Rval.Den), ! Rbase => Rval.Rbase, ! Negative => Rneg)); elsif Rval.Den < 0 then ! return Store_Ureal_Normalized ! ((Num => Lval.Num, ! Den => Rval.Rbase ** (-Rval.Den) * ! Rval.Num * ! Lval.Den, ! Rbase => 0, ! Negative => Rneg)); else ! return Store_Ureal_Normalized ! ((Num => Lval.Num * Rval.Rbase ** Rval.Den, ! Den => Rval.Num * Lval.Den, ! Rbase => 0, ! Negative => Rneg)); end if; elsif Is_Integer (Lval.Num, Rval.Num) then if Rval.Rbase = Lval.Rbase then ! return Store_Ureal ! ((Num => Lval.Num / Rval.Num, ! Den => Lval.Den - Rval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Rval.Rbase = 0 then ! return Store_Ureal ! ((Num => (Lval.Num / Rval.Num) * Rval.Den, ! Den => Lval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Rval.Den < 0 then declare *************** package body Urealp is *** 721,740 **** (Rval.Rbase ** (-Rval.Den)); end if; ! return Store_Ureal ( ! (Num => Num, ! Den => Den, ! Rbase => 0, ! Negative => Rneg)); end; else ! return Store_Ureal ( ! (Num => (Lval.Num / Rval.Num) * ! (Rval.Rbase ** Rval.Den), ! Den => Lval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); end if; else --- 725,744 ---- (Rval.Rbase ** (-Rval.Den)); end if; ! return Store_Ureal ! ((Num => Num, ! Den => Den, ! Rbase => 0, ! Negative => Rneg)); end; else ! return Store_Ureal ! ((Num => (Lval.Num / Rval.Num) * ! (Rval.Rbase ** Rval.Den), ! Den => Lval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); end if; else *************** package body Urealp is *** 745,751 **** if Lval.Den < 0 then Num := Lval.Num * (Lval.Rbase ** (-Lval.Den)); Den := Rval.Num; - else Num := Lval.Num; Den := Rval.Num * (Lval.Rbase ** Lval.Den); --- 749,754 ---- *************** package body Urealp is *** 762,773 **** Num := Num * Rval.Den; end if; ! return Store_Ureal ( ! Normalize ( ! (Num => Num, ! Den => Den, ! Rbase => 0, ! Negative => Rneg))); end; end if; end UR_Div; --- 765,775 ---- Num := Num * Rval.Den; end if; ! return Store_Ureal_Normalized ! ((Num => Num, ! Den => Den, ! Rbase => 0, ! Negative => Rneg)); end; end if; end UR_Div; *************** package body Urealp is *** 814,824 **** if IBas <= 16 and then UR_From_Uint (IBas) = Bas then ! return Store_Ureal ( ! (Num => Uint_1, ! Den => -N, ! Rbase => UI_To_Int (UR_Trunc (Bas)), ! Negative => Neg)); -- If the exponent is negative then we raise the numerator and the -- denominator (after normalization) to the absolute value of the --- 816,826 ---- if IBas <= 16 and then UR_From_Uint (IBas) = Bas then ! return Store_Ureal ! ((Num => Uint_1, ! Den => -N, ! Rbase => UI_To_Int (UR_Trunc (Bas)), ! Negative => Neg)); -- If the exponent is negative then we raise the numerator and the -- denominator (after normalization) to the absolute value of the *************** package body Urealp is *** 829,839 **** pragma Assert (Val.Num /= 0); Val := Normalize (Val); ! return Store_Ureal ( ! (Num => Val.Den ** X, ! Den => Val.Num ** X, ! Rbase => 0, ! Negative => Neg)); -- If positive, we distinguish the case when the base is not zero, in -- which case the new denominator is just the product of the old one --- 831,841 ---- pragma Assert (Val.Num /= 0); Val := Normalize (Val); ! return Store_Ureal ! ((Num => Val.Den ** X, ! Den => Val.Num ** X, ! Rbase => 0, ! Negative => Neg)); -- If positive, we distinguish the case when the base is not zero, in -- which case the new denominator is just the product of the old one *************** package body Urealp is *** 842,862 **** else if Val.Rbase /= 0 then ! return Store_Ureal ( ! (Num => Val.Num ** X, ! Den => Val.Den * X, ! Rbase => Val.Rbase, ! Negative => Neg)); -- And when the base is zero, in which case we exponentiate -- the old denominator. else ! return Store_Ureal ( ! (Num => Val.Num ** X, ! Den => Val.Den ** X, ! Rbase => 0, ! Negative => Neg)); end if; end if; end UR_Exponentiate; --- 844,864 ---- else if Val.Rbase /= 0 then ! return Store_Ureal ! ((Num => Val.Num ** X, ! Den => Val.Den * X, ! Rbase => Val.Rbase, ! Negative => Neg)); -- And when the base is zero, in which case we exponentiate -- the old denominator. else ! return Store_Ureal ! ((Num => Val.Num ** X, ! Den => Val.Den ** X, ! Rbase => 0, ! Negative => Neg)); end if; end if; end UR_Exponentiate; *************** package body Urealp is *** 867,873 **** function UR_Floor (Real : Ureal) return Uint is Val : constant Ureal_Entry := Normalize (Ureals.Table (Real)); - begin if Val.Negative then return UI_Negate ((Val.Num + Val.Den - 1) / Val.Den); --- 869,874 ---- *************** package body Urealp is *** 888,898 **** return Ureal is begin ! return Store_Ureal ( ! (Num => Num, ! Den => Den, ! Rbase => Rbase, ! Negative => Negative)); end UR_From_Components; ------------------ --- 889,899 ---- return Ureal is begin ! return Store_Ureal ! ((Num => Num, ! Den => Den, ! Rbase => Rbase, ! Negative => Negative)); end UR_From_Components; ------------------ *************** package body Urealp is *** 902,908 **** function UR_From_Uint (UI : Uint) return Ureal is begin return UR_From_Components ! (abs UI, Uint_1, Negative => (UI < 0)); end UR_From_Uint; ----------- --- 903,909 ---- function UR_From_Uint (UI : Uint) return Ureal is begin return UR_From_Components ! (abs UI, Uint_1, Negative => (UI < 0)); end UR_From_Uint; ----------- *************** package body Urealp is *** 1095,1161 **** begin if Lval.Rbase = 0 then if Rval.Rbase = 0 then ! return Store_Ureal ( ! Normalize ( ! (Num => Num, ! Den => Lval.Den * Rval.Den, ! Rbase => 0, ! Negative => Rneg))); elsif Is_Integer (Num, Lval.Den) then ! return Store_Ureal ( ! (Num => Num / Lval.Den, ! Den => Rval.Den, ! Rbase => Rval.Rbase, ! Negative => Rneg)); elsif Rval.Den < 0 then ! return Store_Ureal ( ! Normalize ( ! (Num => Num * (Rval.Rbase ** (-Rval.Den)), ! Den => Lval.Den, ! Rbase => 0, ! Negative => Rneg))); else ! return Store_Ureal ( ! Normalize ( ! (Num => Num, ! Den => Lval.Den * (Rval.Rbase ** Rval.Den), ! Rbase => 0, ! Negative => Rneg))); end if; elsif Lval.Rbase = Rval.Rbase then ! return Store_Ureal ( ! (Num => Num, ! Den => Lval.Den + Rval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Rval.Rbase = 0 then if Is_Integer (Num, Rval.Den) then ! return Store_Ureal ( ! (Num => Num / Rval.Den, ! Den => Lval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Lval.Den < 0 then ! return Store_Ureal ( ! Normalize ( ! (Num => Num * (Lval.Rbase ** (-Lval.Den)), ! Den => Rval.Den, ! Rbase => 0, ! Negative => Rneg))); else ! return Store_Ureal ( ! Normalize ( ! (Num => Num, ! Den => Rval.Den * (Lval.Rbase ** Lval.Den), ! Rbase => 0, ! Negative => Rneg))); end if; else --- 1096,1157 ---- begin if Lval.Rbase = 0 then if Rval.Rbase = 0 then ! return Store_Ureal_Normalized ! ((Num => Num, ! Den => Lval.Den * Rval.Den, ! Rbase => 0, ! Negative => Rneg)); elsif Is_Integer (Num, Lval.Den) then ! return Store_Ureal ! ((Num => Num / Lval.Den, ! Den => Rval.Den, ! Rbase => Rval.Rbase, ! Negative => Rneg)); elsif Rval.Den < 0 then ! return Store_Ureal_Normalized ! ((Num => Num * (Rval.Rbase ** (-Rval.Den)), ! Den => Lval.Den, ! Rbase => 0, ! Negative => Rneg)); else ! return Store_Ureal_Normalized ! ((Num => Num, ! Den => Lval.Den * (Rval.Rbase ** Rval.Den), ! Rbase => 0, ! Negative => Rneg)); end if; elsif Lval.Rbase = Rval.Rbase then ! return Store_Ureal ! ((Num => Num, ! Den => Lval.Den + Rval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Rval.Rbase = 0 then if Is_Integer (Num, Rval.Den) then ! return Store_Ureal ! ((Num => Num / Rval.Den, ! Den => Lval.Den, ! Rbase => Lval.Rbase, ! Negative => Rneg)); elsif Lval.Den < 0 then ! return Store_Ureal_Normalized ! ((Num => Num * (Lval.Rbase ** (-Lval.Den)), ! Den => Rval.Den, ! Rbase => 0, ! Negative => Rneg)); else ! return Store_Ureal_Normalized ! ((Num => Num, ! Den => Rval.Den * (Lval.Rbase ** Lval.Den), ! Rbase => 0, ! Negative => Rneg)); end if; else *************** package body Urealp is *** 1173,1184 **** Den := Den * (Rval.Rbase ** Rval.Den); end if; ! return Store_Ureal ( ! Normalize ( ! (Num => Num, ! Den => Den, ! Rbase => 0, ! Negative => Rneg))); end if; end UR_Mul; --- 1169,1179 ---- Den := Den * (Rval.Rbase ** Rval.Den); end if; ! return Store_Ureal_Normalized ! ((Num => Num, ! Den => Den, ! Rbase => 0, ! Negative => Rneg)); end if; end UR_Mul; *************** package body Urealp is *** 1228,1235 **** else Result := Rval.Negative /= Lval.Negative ! or else Rval.Num /= Lval.Num ! or else Rval.Den /= Lval.Den; Release (Imrk); Release (Rmrk); return Result; --- 1223,1230 ---- else Result := Rval.Negative /= Lval.Negative ! or else Rval.Num /= Lval.Num ! or else Rval.Den /= Lval.Den; Release (Imrk); Release (Rmrk); return Result; *************** package body Urealp is *** 1244,1254 **** function UR_Negate (Real : Ureal) return Ureal is begin ! return Store_Ureal ( ! (Num => Ureals.Table (Real).Num, ! Den => Ureals.Table (Real).Den, ! Rbase => Ureals.Table (Real).Rbase, ! Negative => not Ureals.Table (Real).Negative)); end UR_Negate; ------------ --- 1239,1249 ---- function UR_Negate (Real : Ureal) return Ureal is begin ! return Store_Ureal ! ((Num => Ureals.Table (Real).Num, ! Den => Ureals.Table (Real).Den, ! Rbase => Ureals.Table (Real).Rbase, ! Negative => not Ureals.Table (Real).Negative)); end UR_Negate; ------------ *************** package body Urealp is *** 1294,1300 **** function UR_Trunc (Real : Ureal) return Uint is Val : constant Ureal_Entry := Normalize (Ureals.Table (Real)); - begin if Val.Negative then return -(Val.Num / Val.Den); --- 1289,1294 ---- *************** package body Urealp is *** 1307,1338 **** -- UR_Write -- -------------- ! procedure UR_Write (Real : Ureal) is Val : constant Ureal_Entry := Ureals.Table (Real); begin -- If value is negative, we precede the constant by a minus sign - -- and add an extra layer of parentheses on the outside since the - -- minus sign is part of the value, not a negation operator. if Val.Negative then ! Write_Str ("(-"); end if; ! -- Constants in base 10 can be written in normal Ada literal style ! if Val.Rbase = 10 then ! UI_Write (Val.Num / 10); ! Write_Char ('.'); ! UI_Write (Val.Num mod 10); - if Val.Den /= 0 then Write_Char ('E'); ! UI_Write (1 - Val.Den); end if; ! -- Constants in a base other than 10 can still be easily written ! -- in normal Ada literal style if the numerator is one. elsif Val.Rbase /= 0 and then Val.Num = 1 then Write_Int (Val.Rbase); --- 1301,1444 ---- -- UR_Write -- -------------- ! procedure UR_Write (Real : Ureal; Brackets : Boolean := False) is Val : constant Ureal_Entry := Ureals.Table (Real); + T : Uint; begin -- If value is negative, we precede the constant by a minus sign if Val.Negative then ! Write_Char ('-'); end if; ! -- Zero is zero ! if Val.Num = 0 then ! Write_Str ("0.0"); ! ! -- For constants with a denominator of zero, the value is simply the ! -- numerator value, since we are dividing by base**0, which is 1. ! ! elsif Val.Den = 0 then ! UI_Write (Val.Num, Decimal); ! Write_Str (".0"); ! ! -- Small powers of 2 get written in decimal fixed-point format ! ! elsif Val.Rbase = 2 ! and then Val.Den <= 3 ! and then Val.Den >= -16 ! then ! if Val.Den = 1 then ! T := Val.Num * (10/2); ! UI_Write (T / 10, Decimal); ! Write_Char ('.'); ! UI_Write (T mod 10, Decimal); ! ! elsif Val.Den = 2 then ! T := Val.Num * (100/4); ! UI_Write (T / 100, Decimal); ! Write_Char ('.'); ! UI_Write (T mod 100 / 10, Decimal); ! ! if T mod 10 /= 0 then ! UI_Write (T mod 10, Decimal); ! end if; ! ! elsif Val.Den = 3 then ! T := Val.Num * (1000 / 8); ! UI_Write (T / 1000, Decimal); ! Write_Char ('.'); ! UI_Write (T mod 1000 / 100, Decimal); ! ! if T mod 100 /= 0 then ! UI_Write (T mod 100 / 10, Decimal); ! ! if T mod 10 /= 0 then ! UI_Write (T mod 10, Decimal); ! end if; ! end if; ! ! else ! UI_Write (Val.Num * (Uint_2 ** (-Val.Den)), Decimal); ! Write_Str (".0"); ! end if; ! ! -- Constants in base 10 or 16 can be written in normal Ada literal ! -- style, as long as they fit in the UI_Image_Buffer. Using hexadecimal ! -- notation, 4 bytes are required for the 16# # part, and every fifth ! -- character is an underscore. So, a buffer of size N has room for ! -- ((N - 4) - (N - 4) / 5) * 4 bits, ! -- or at least ! -- N * 16 / 5 - 12 bits. ! ! elsif (Val.Rbase = 10 or else Val.Rbase = 16) ! and then Num_Bits (Val.Num) < UI_Image_Buffer'Length * 16 / 5 - 12 ! then ! pragma Assert (Val.Den /= 0); ! ! -- Use fixed-point format for small scaling values ! ! if (Val.Rbase = 10 and then Val.Den < 0 and then Val.Den > -3) ! or else (Val.Rbase = 16 and then Val.Den = -1) ! then ! UI_Write (Val.Num * Val.Rbase**(-Val.Den), Decimal); ! Write_Str (".0"); ! ! -- Write hexadecimal constants in exponential notation with a zero ! -- unit digit. This matches the Ada canonical form for floating point ! -- numbers, and also ensures that the underscores end up in the ! -- correct place. ! ! elsif Val.Rbase = 16 then ! UI_Image (Val.Num, Hex); ! pragma Assert (Val.Rbase = 16); ! ! Write_Str ("16#0."); ! Write_Str (UI_Image_Buffer (4 .. UI_Image_Length)); ! ! -- For exponent, exclude 16# # and underscores from length ! ! UI_Image_Length := UI_Image_Length - 4; ! UI_Image_Length := UI_Image_Length - UI_Image_Length / 5; Write_Char ('E'); ! UI_Write (Int (UI_Image_Length) - Val.Den, Decimal); ! ! elsif Val.Den = 1 then ! UI_Write (Val.Num / 10, Decimal); ! Write_Char ('.'); ! UI_Write (Val.Num mod 10, Decimal); ! ! elsif Val.Den = 2 then ! UI_Write (Val.Num / 100, Decimal); ! Write_Char ('.'); ! UI_Write (Val.Num / 10 mod 10, Decimal); ! UI_Write (Val.Num mod 10, Decimal); ! ! -- Else use decimal exponential format ! ! else ! -- Write decimal constants with a non-zero unit digit. This ! -- matches usual scientific notation. ! ! UI_Image (Val.Num, Decimal); ! Write_Char (UI_Image_Buffer (1)); ! Write_Char ('.'); ! ! if UI_Image_Length = 1 then ! Write_Char ('0'); ! else ! Write_Str (UI_Image_Buffer (2 .. UI_Image_Length)); ! end if; ! ! Write_Char ('E'); ! UI_Write (Int (UI_Image_Length - 1) - Val.Den, Decimal); end if; ! -- Constants in a base other than 10 can still be easily written in ! -- normal Ada literal style if the numerator is one. elsif Val.Rbase /= 0 and then Val.Num = 1 then Write_Int (Val.Rbase); *************** package body Urealp is *** 1343,1390 **** -- of the following forms, depending on the sign of the number -- and the sign of the exponent (= minus denominator value) ! -- (numerator.0*base**exponent) ! -- (numerator.0*base**(-exponent)) elsif Val.Rbase /= 0 then ! Write_Char ('('); UI_Write (Val.Num, Decimal); ! Write_Str (".0*"); ! Write_Int (Val.Rbase); ! Write_Str ("**"); ! if Val.Den <= 0 then ! UI_Write (-Val.Den, Decimal); ! else ! Write_Str ("(-"); ! UI_Write (Val.Den, Decimal); ! Write_Char (')'); end if; ! Write_Char (')'); ! -- Rational constants with a denominator of 1 can be written as ! -- a real literal for the numerator integer. ! elsif Val.Den = 1 then ! UI_Write (Val.Num, Decimal); Write_Str (".0"); ! -- Non-based (rational) constants are written in (num/den) style else ! Write_Char ('('); UI_Write (Val.Num, Decimal); Write_Str (".0/"); UI_Write (Val.Den, Decimal); ! Write_Str (".0)"); ! end if; ! ! -- Add trailing paren for negative values ! if Val.Negative then ! Write_Char (')'); end if; end UR_Write; --- 1449,1508 ---- -- of the following forms, depending on the sign of the number -- and the sign of the exponent (= minus denominator value) ! -- numerator.0*base**exponent ! -- numerator.0*base**-exponent ! ! -- And of course an exponent of 0 can be omitted elsif Val.Rbase /= 0 then ! if Brackets then ! Write_Char ('['); ! end if; ! UI_Write (Val.Num, Decimal); ! Write_Str (".0"); ! if Val.Den /= 0 then ! Write_Char ('*'); ! Write_Int (Val.Rbase); ! Write_Str ("**"); ! if Val.Den <= 0 then ! UI_Write (-Val.Den, Decimal); ! else ! Write_Str ("(-"); ! UI_Write (Val.Den, Decimal); ! Write_Char (')'); ! end if; end if; ! if Brackets then ! Write_Char (']'); ! end if; ! -- Rationals where numerator is divisible by denominator can be output ! -- as literals after we do the division. This includes the common case ! -- where the denominator is 1. ! elsif Val.Num mod Val.Den = 0 then ! UI_Write (Val.Num / Val.Den, Decimal); Write_Str (".0"); ! -- Other non-based (rational) constants are written in num/den style else ! if Brackets then ! Write_Char ('['); ! end if; ! UI_Write (Val.Num, Decimal); Write_Str (".0/"); UI_Write (Val.Den, Decimal); ! Write_Str (".0"); ! if Brackets then ! Write_Char (']'); ! end if; end if; end UR_Write; diff -Nrcpad gcc-4.5.2/gcc/ada/urealp.ads gcc-4.6.0/gcc/ada/urealp.ads *** gcc-4.5.2/gcc/ada/urealp.ads Thu Apr 9 15:00:19 2009 --- gcc-4.6.0/gcc/ada/urealp.ads Fri Sep 10 11:01:37 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2009 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** package Urealp is *** 264,277 **** function UR_Is_Positive (Real : Ureal) return Boolean; -- Test if real value is greater than zero ! procedure UR_Write (Real : Ureal); ! -- Writes value of Real to standard output. Used only for debugging and ! -- tree/source output. If the result is easily representable as a standard ! -- Ada literal, it will be given that way, but as a result of evaluation ! -- of static expressions, it is possible to generate constants (e.g. 1/13) ! -- which have no such representation. In such cases (and in cases where it ! -- is too much work to figure out the Ada literal), the string that is ! -- output is of the form [numerator/denominator]. procedure pr (Real : Ureal); pragma Export (Ada, pr); --- 264,280 ---- function UR_Is_Positive (Real : Ureal) return Boolean; -- Test if real value is greater than zero ! procedure UR_Write (Real : Ureal; Brackets : Boolean := False); ! -- Writes value of Real to standard output. Used for debugging and ! -- tree/source output, and also for -gnatR representation output. If the ! -- result is easily representable as a standard Ada literal, it will be ! -- given that way, but as a result of evaluation of static expressions, it ! -- is possible to generate constants (e.g. 1/13) which have no such ! -- representation. In such cases (and in cases where it is too much work to ! -- figure out the Ada literal), the string that is output is of the form ! -- of some expression such as integer/integer, or integer*integer**integer. ! -- In the case where an expression is output, if Brackets is set to True, ! -- the expression is surrounded by square brackets. procedure pr (Real : Ureal); pragma Export (Ada, pr); diff -Nrcpad gcc-4.5.2/gcc/ada/usage.adb gcc-4.6.0/gcc/ada/usage.adb *** gcc-4.5.2/gcc/ada/usage.adb Tue Jan 26 14:02:25 2010 --- gcc-4.6.0/gcc/ada/usage.adb Tue Oct 26 12:45:45 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** begin *** 177,182 **** --- 177,187 ---- Write_Switch_Char ("eD?"); Write_Line ("Define or redefine preprocessing symbol, e.g. -gnateDsym=val"); + -- Line for -gnateE switch + + Write_Switch_Char ("eE"); + Write_Line ("Generate extra information in exception messages"); + -- Line for -gnatef switch Write_Switch_Char ("ef"); *************** begin *** 202,207 **** --- 207,217 ---- Write_Switch_Char ("ep=?"); Write_Line ("Specify preprocessing data file, e.g. -gnatep=prep.data"); + -- Line for -gnateP switch + + Write_Switch_Char ("eP"); + Write_Line ("Pure/Prelaborate errors generate warnings rather than errors"); + -- Line for -gnateS switch Write_Switch_Char ("eS"); *************** begin *** 279,285 **** -- Line for -gnatn switch Write_Switch_Char ("n"); ! Write_Line ("Inlining of subprograms (apply pragma Inline across units)"); -- Line for -gnatN switch --- 289,295 ---- -- Line for -gnatn switch Write_Switch_Char ("n"); ! Write_Line ("Enable pragma Inline (both within and across units)"); -- Line for -gnatN switch *************** begin *** 397,443 **** Write_Switch_Char ("wxx"); Write_Line ("Enable selected warning modes, xx = list of parameters:"); ! Write_Line (" a turn on all optional info/warnings " & ! "(except dhl.ot.w)"); Write_Line (" A turn off all optional info/warnings"); ! Write_Line (" .a* turn on warnings for failing assertion"); Write_Line (" .A turn off warnings for failing assertion"); ! Write_Line (" b turn on warnings for bad fixed value " & "(not multiple of small)"); Write_Line (" B* turn off warnings for bad fixed value " & "(not multiple of small)"); ! Write_Line (" .b* turn on warnings for biased representation"); Write_Line (" .B turn off warnings for biased representation"); ! Write_Line (" c turn on warnings for constant conditional"); Write_Line (" C* turn off warnings for constant conditional"); ! Write_Line (" .c turn on warnings for unrepped components"); Write_Line (" .C* turn off warnings for unrepped components"); Write_Line (" d turn on warnings for implicit dereference"); Write_Line (" D* turn off warnings for implicit dereference"); Write_Line (" e treat all warnings (but not info) as errors"); Write_Line (" .e turn on every optional info/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"); Write_Line (" G turn off warnings for unrecognized pragma"); ! Write_Line (" h turn on warnings for hiding variable"); ! Write_Line (" H* turn off warnings for hiding variable"); ! Write_Line (" i* turn on warnings for implementation unit"); Write_Line (" I turn off warnings for implementation unit"); Write_Line (" .i turn on warnings for overlapping actuals"); Write_Line (" .I* turn off warnings for overlapping actuals"); ! Write_Line (" j turn on warnings for obsolescent " & "(annex J) feature"); Write_Line (" J* turn off warnings for obsolescent " & "(annex J) feature"); ! Write_Line (" k turn on warnings on constant variable"); Write_Line (" K* turn off warnings on constant variable"); Write_Line (" l turn on warnings for missing " & "elaboration pragma"); Write_Line (" L* turn off warnings for missing " & "elaboration pragma"); ! Write_Line (" m turn on warnings for variable assigned " & "but not read"); Write_Line (" M* turn off warnings for variable assigned " & "but not read"); --- 407,456 ---- Write_Switch_Char ("wxx"); Write_Line ("Enable selected warning modes, xx = list of parameters:"); ! Write_Line (" a turn on all info/warnings marked below with +"); Write_Line (" A turn off all optional info/warnings"); ! Write_Line (" .a*+ turn on warnings for failing assertion"); Write_Line (" .A turn off warnings for failing assertion"); ! Write_Line (" b+ turn on warnings for bad fixed value " & "(not multiple of small)"); Write_Line (" B* turn off warnings for bad fixed value " & "(not multiple of small)"); ! Write_Line (" .b*+ turn on warnings for biased representation"); Write_Line (" .B turn off warnings for biased representation"); ! Write_Line (" c+ turn on warnings for constant conditional"); Write_Line (" C* turn off warnings for constant conditional"); ! Write_Line (" .c+ turn on warnings for unrepped components"); Write_Line (" .C* turn off warnings for unrepped components"); Write_Line (" d turn on warnings for implicit dereference"); Write_Line (" D* turn off warnings for implicit dereference"); Write_Line (" e treat all warnings (but not info) as errors"); Write_Line (" .e turn on every optional info/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"); Write_Line (" G turn off warnings for unrecognized pragma"); ! Write_Line (" h turn on warnings for hiding declarations"); ! Write_Line (" H* turn off warnings for hiding declarations"); ! Write_Line (" .h turn on warnings for holes in records"); ! Write_Line (" .H* turn off warnings for holes in records"); ! Write_Line (" i*+ turn on warnings for implementation unit"); Write_Line (" I turn off warnings for implementation unit"); Write_Line (" .i turn on warnings for overlapping actuals"); Write_Line (" .I* turn off warnings for overlapping actuals"); ! Write_Line (" j+ turn on warnings for obsolescent " & "(annex J) feature"); Write_Line (" J* turn off warnings for obsolescent " & "(annex J) feature"); ! Write_Line (" k+ turn on warnings on constant variable"); Write_Line (" K* turn off warnings on constant variable"); Write_Line (" l turn on warnings for missing " & "elaboration pragma"); Write_Line (" L* turn off warnings for missing " & "elaboration pragma"); ! Write_Line (" .l* turn on info messages for inherited aspects"); ! Write_Line (" .L turn off info messages for inherited aspects"); ! Write_Line (" m+ turn on warnings for variable assigned " & "but not read"); Write_Line (" M* turn off warnings for variable assigned " & "but not read"); *************** begin *** 450,496 **** "but not read"); 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"); Write_Line (" P* turn off warnings for ineffective pragma " & "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 parenthesis"); Write_Line (" Q turn off warnings for questionable " & "missing parenthesis"); ! Write_Line (" r turn on warnings for redundant construct"); Write_Line (" R* turn off warnings for redundant construct"); ! Write_Line (" .r turn on warnings for object renaming function"); Write_Line (" .R* turn off warnings for object renaming function"); Write_Line (" s suppress all info/warnings"); Write_Line (" t turn on warnings for tracking deleted code"); Write_Line (" T* turn off warnings for tracking deleted code"); ! Write_Line (" u turn on warnings for unused entity"); Write_Line (" U* turn off warnings for unused entity"); ! Write_Line (" v* turn on warnings for unassigned variable"); Write_Line (" V turn off warnings for unassigned variable"); ! Write_Line (" .v* turn on info messages for reverse bit order"); Write_Line (" .V turn off info messages for reverse bit order"); ! Write_Line (" w* turn on warnings for wrong low bound assumption"); Write_Line (" W turn off warnings for wrong low bound " & "assumption"); Write_Line (" .w turn on warnings on pragma Warnings Off"); Write_Line (" .W* turn off warnings on pragma Warnings Off"); ! Write_Line (" x* turn on warnings for export/import"); Write_Line (" X turn off warnings for export/import"); ! Write_Line (" .x turn on warnings for non-local exception"); Write_Line (" .X* turn off warnings for non-local exception"); ! Write_Line (" y* turn on warnings for Ada 2005 incompatibility"); Write_Line (" Y turn off warnings for Ada 2005 incompatibility"); ! Write_Line (" z* turn on warnings for suspicious " & "unchecked conversion"); Write_Line (" Z turn off warnings for suspicious " & "unchecked conversion"); Write_Line (" * indicates default in above list"); -- Line for -gnatW switch --- 463,514 ---- "but not read"); 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"); Write_Line (" P* turn off warnings for ineffective pragma " & "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 parenthesis"); Write_Line (" Q turn off warnings for questionable " & "missing parenthesis"); ! Write_Line (" r+ turn on warnings for redundant construct"); Write_Line (" R* turn off warnings for redundant construct"); ! Write_Line (" .r+ turn on warnings for object renaming function"); Write_Line (" .R* turn off warnings for object renaming function"); Write_Line (" s suppress all info/warnings"); + Write_Line (" .s turn on warnings for overridden size clause"); + Write_Line (" .S* turn off warnings for overridden size clause"); Write_Line (" t turn on warnings for tracking deleted code"); Write_Line (" T* turn off warnings for tracking deleted code"); ! Write_Line (" u+ turn on warnings for unused entity"); Write_Line (" U* turn off warnings for unused entity"); ! Write_Line (" .u turn on warnings for unordered enumeration"); ! Write_Line (" .U* turn off warnings for unordered enumeration"); ! Write_Line (" v*+ turn on warnings for unassigned variable"); Write_Line (" V turn off warnings for unassigned variable"); ! Write_Line (" .v*+ turn on info messages for reverse bit order"); Write_Line (" .V turn off info messages for reverse bit order"); ! Write_Line (" w*+ turn on warnings for wrong low bound assumption"); Write_Line (" W turn off warnings for wrong low bound " & "assumption"); Write_Line (" .w turn on warnings on pragma Warnings Off"); Write_Line (" .W* turn off warnings on pragma Warnings Off"); ! Write_Line (" x*+ turn on warnings for export/import"); Write_Line (" X turn off warnings for export/import"); ! Write_Line (" .x+ turn on warnings for non-local exception"); Write_Line (" .X* turn off warnings for non-local exception"); ! Write_Line (" y*+ turn on warnings for Ada 2005 incompatibility"); Write_Line (" Y turn off warnings for Ada 2005 incompatibility"); ! Write_Line (" z*+ turn on warnings for suspicious " & "unchecked conversion"); Write_Line (" Z turn off warnings for suspicious " & "unchecked conversion"); Write_Line (" * indicates default in above list"); + Write_Line (" + indicates warning flag included in -gnatwa"); -- Line for -gnatW switch *************** begin *** 592,601 **** Write_Switch_Char ("05"); ! if Ada_Version_Default = Ada_05 then Write_Line ("Ada 2005 mode (default)"); else ! Write_Line ("Allow Ada 2005 extensions"); end if; end Usage; --- 610,634 ---- Write_Switch_Char ("05"); ! if Ada_Version_Default = Ada_2005 then Write_Line ("Ada 2005 mode (default)"); else ! Write_Line ("Enforce Ada 2005 restrictions"); ! end if; ! ! -- Line for -gnat12 switch ! ! Write_Switch_Char ("12"); ! ! if Ada_Version_Default = Ada_2012 then ! Write_Line ("Ada 2012 mode (default)"); ! else ! Write_Line ("Allow Ada 2012 extensions"); end if; + -- Line for -gnat-p switch + + Write_Switch_Char ("-p"); + Write_Line ("Cancel effect of previous -gnatp switch"); + end Usage; diff -Nrcpad gcc-4.5.2/gcc/ada/vms_cmds.ads gcc-4.6.0/gcc/ada/vms_cmds.ads *** gcc-4.5.2/gcc/ada/vms_cmds.ads Thu Jan 1 00:00:00 1970 --- gcc-4.6.0/gcc/ada/vms_cmds.ads Fri Sep 10 10:41:02 2010 *************** *** 0 **** --- 1,52 ---- + ------------------------------------------------------------------------------ + -- -- + -- GNAT COMPILER COMPONENTS -- + -- -- + -- V M S _ C M D S -- + -- -- + -- S p e c -- + -- -- + -- Copyright (C) 2010, 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 package is part of the GNAT driver. It contains the declaration of + -- Command_Type which list all the commands supported by the gnat driver. + + package VMS_Cmds is + type Command_Type is + (Bind, + Chop, + Clean, + Compile, + Check, + Sync, + Elim, + Find, + Krunch, + Link, + List, + Make, + Metric, + Name, + Preprocess, + Pretty, + Shared, + Stack, + Stub, + Xref, + Undefined); + end VMS_Cmds; diff -Nrcpad gcc-4.5.2/gcc/ada/vms_conv.adb gcc-4.6.0/gcc/ada/vms_conv.adb *** gcc-4.5.2/gcc/ada/vms_conv.adb Wed Jul 22 10:25:32 2009 --- gcc-4.6.0/gcc/ada/vms_conv.adb Thu Sep 9 10:39:19 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** package body VMS_Conv is *** 314,329 **** loop declare Dir : constant String_Access := ! String_Access (Get_Next_Dir_In_Path (Object_Dir_Name)); begin exit when Dir = null; Object_Dirs := Object_Dirs + 1; Object_Dir (Object_Dirs) := new String'("-L" & To_Canonical_Dir_Spec ! (To_Host_Dir_Spec ! (Normalize_Directory_Name (Dir.all).all, ! True).all, True).all); end; end loop; --- 314,329 ---- loop declare Dir : constant String_Access := ! Get_Next_Dir_In_Path (Object_Dir_Name); begin exit when Dir = null; Object_Dirs := Object_Dirs + 1; Object_Dir (Object_Dirs) := new String'("-L" & To_Canonical_Dir_Spec ! (To_Host_Dir_Spec ! (Normalize_Directory_Name (Dir.all).all, ! True).all, True).all); end; end loop; *************** package body VMS_Conv is *** 2274,2282 **** New_Line; while Commands /= null loop ! Put (Commands.Usage.all); ! Set_Col (53); ! Put_Line (Commands.Unix_String.all); Commands := Commands.Next; end loop; --- 2274,2288 ---- New_Line; while Commands /= null loop ! ! -- No usage for GNAT SYNC ! ! if Commands.Command /= Sync then ! Put (Commands.Usage.all); ! Set_Col (53); ! Put_Line (Commands.Unix_String.all); ! end if; ! Commands := Commands.Next; end loop; diff -Nrcpad gcc-4.5.2/gcc/ada/vms_conv.ads gcc-4.6.0/gcc/ada/vms_conv.ads *** gcc-4.5.2/gcc/ada/vms_conv.ads Sun Apr 13 18:03:09 2008 --- gcc-4.6.0/gcc/ada/vms_conv.ads Thu Sep 9 13:38:12 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 2003-2010, 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,35 **** --- 30,36 ---- with Table; with VMS_Data; use VMS_Data; + with VMS_Cmds; use VMS_Cmds; with GNAT.OS_Lib; use GNAT.OS_Lib; *************** package VMS_Conv is *** 92,120 **** type Parameter_Array is array (Natural range <>) of Parameter_Type; type Parameter_Ref is access all Parameter_Array; - type Command_Type is - (Bind, - Chop, - Clean, - Compile, - Check, - Sync, - Elim, - Find, - Krunch, - Link, - List, - Make, - Metric, - Name, - Preprocess, - Pretty, - Shared, - Stack, - Stub, - Xref, - Undefined); - type Alternate_Command is (Comp, Ls, Kr, Pp, Prep); -- Alternate command label for non VMS system use --- 93,98 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/vms_data.ads gcc-4.6.0/gcc/ada/vms_data.ads *** gcc-4.5.2/gcc/ada/vms_data.ads Mon Nov 30 16:31:31 2009 --- gcc-4.6.0/gcc/ada/vms_data.ads Tue Oct 26 10:51:36 2010 *************** *** 6,12 **** -- -- -- S p e c -- -- -- ! -- Copyright (C) 1996-2009, 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- -- --- 6,12 ---- -- -- -- S p e c -- -- -- ! -- Copyright (C) 1996-2010, 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- -- *************** package VMS_Data is *** 196,201 **** --- 196,209 ---- -- -- Add directories to the project search path. + S_Bind_ALI : aliased constant S := "/ALI_LIST " & + "-A"; + -- /NOALI_LIST (D) + -- /ALI_LIST + -- + -- Output full names of all the ALI files in the partition. The output is + -- written to SYS$OUTPUT. + S_Bind_Bind : aliased constant S := "/BIND_FILE=" & "ADA " & "-A " & *************** package VMS_Data is *** 345,350 **** --- 353,372 ---- -- -- The main program is not in Ada. + S_Bind_Alloc32 : aliased constant S := "/32_MALLOC " & + "-H32"; + -- /32_MALLOC + -- + -- Use 32-bit allocations for `__gnat_malloc' (and thus for + -- access types). + + S_Bind_Alloc64 : aliased constant S := "/64_MALLOC " & + "-H64"; + -- /64_MALLOC + -- + -- Use 64-bit allocations for `__gnat_malloc' (and thus for + -- access types). + S_Bind_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" & "DEFAULT " & "-vP0 " & *************** package VMS_Data is *** 385,391 **** -- /NOOBJECT_LIST (D) -- /OBJECT_LIST -- ! -- Output full names of all the object files that must be linker to -- provide the Ada component of the program. The output is written to -- SYS$OUTPUT. --- 407,413 ---- -- /NOOBJECT_LIST (D) -- /OBJECT_LIST -- ! -- Output full names of all the object files that must be linked to -- provide the Ada component of the program. The output is written to -- SYS$OUTPUT. *************** package VMS_Data is *** 669,674 **** --- 691,697 ---- Bind_Switches : aliased constant Switches := (S_Bind_Add 'Access, + S_Bind_ALI 'Access, S_Bind_Bind 'Access, S_Bind_Build 'Access, S_Bind_Current 'Access, *************** package VMS_Data is *** 685,690 **** --- 708,715 ---- S_Bind_Library 'Access, S_Bind_Linker 'Access, S_Bind_Main 'Access, + S_Bind_Alloc32 'Access, + S_Bind_Alloc64 'Access, S_Bind_Mess 'Access, S_Bind_Nostinc 'Access, S_Bind_Nostlib 'Access, *************** package VMS_Data is *** 834,870 **** -- -- Duplicate all the output sent to Stderr into a log file. - S_Check_Sections : aliased constant S := "/SECTIONS=" & - "DEFAULT " & - "-s123 " & - "COMPILER_STYLE " & - "-s1 " & - "BY_RULES " & - "-s2 " & - "BY_FILES_BY_RULES " & - "-s3"; - -- /SECTIONS[=section-option, section-option, ...] - -- - -- Specify what sections should be included into the report file. - -- 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 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 diagnostics grouped first by rules and - -- then by files - -- 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 - -- only sections set by these options - S_Check_Short : aliased constant S := "/SHORT " & "-s"; -- /NOSHORT (D) --- 859,864 ---- *************** package VMS_Data is *** 872,877 **** --- 866,879 ---- -- -- Generate a short form of the report file. + S_Check_Include : aliased constant S := "/INCLUDE_FILE=@" & + "--include-file=@"; + + -- /INCLUDE_FILE=filename + -- + -- Add the content of the specified text file to the generated report + -- file. + S_Check_Subdirs : aliased constant S := "/SUBDIRS=<" & "--subdirs=>"; -- /SUBDIRS=dir *************** package VMS_Data is *** 896,919 **** -- Specify the name of the output file. Check_Switches : aliased constant Switches := ! (S_Check_Add 'Access, ! S_Check_All 'Access, ! S_Diagnosis '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, ! S_Check_Project 'Access, ! S_Check_Quiet 'Access, ! S_Check_Time 'Access, ! S_Check_Log 'Access, ! S_Check_Sections 'Access, ! S_Check_Short 'Access, ! S_Check_Subdirs 'Access, ! S_Check_Verb 'Access, ! S_Check_Out 'Access); ---------------------------- -- Switches for GNAT CHOP -- --- 898,921 ---- -- Specify the name of the output file. Check_Switches : aliased constant Switches := ! (S_Check_Add 'Access, ! S_Check_All 'Access, ! S_Diagnosis '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, ! S_Check_Project'Access, ! S_Check_Quiet 'Access, ! S_Check_Time 'Access, ! S_Check_Log 'Access, ! S_Check_Short 'Access, ! S_Check_Include'Access, ! S_Check_Subdirs'Access, ! S_Check_Verb 'Access, ! S_Check_Out 'Access); ---------------------------- -- Switches for GNAT CHOP -- *************** package VMS_Data is *** 1168,1173 **** --- 1170,1182 ---- -- of the directory specified in the project file. If the subdirectory -- does not exist, it is created automatically. + S_Clean_USL : aliased constant S := "/UNCHECKED_SHARED_LIB_IMPORTS " & + "--unchecked-shared-lib-imports"; + -- /NOUNCHECKED_SHARED_LIB_IMPORTS (D) + -- /UNCHECKED_SHARED_LIB_IMPORTS + -- + -- Allow shared library projects to import static library projects + S_Clean_Verbose : aliased constant S := "/VERBOSE " & "-v"; -- /NOVERBOSE (D) *************** package VMS_Data is *** 1193,1199 **** S_Clean_Recurs 'Access, S_Clean_Search 'Access, S_Clean_Subdirs'Access, ! S_Clean_Verbose'Access); ------------------------------- -- Switches for GNAT COMPILE -- --- 1202,1209 ---- S_Clean_Recurs 'Access, S_Clean_Search 'Access, S_Clean_Subdirs'Access, ! S_Clean_Verbose'Access, ! S_Clean_USL 'Access); ------------------------------- -- Switches for GNAT COMPILE -- *************** package VMS_Data is *** 1233,1241 **** "-gnat05"; -- /05 (D) -- ! -- Allows GNAT to recognize all implemented proposed Ada 2005 -- extensions. See features file for list of implemented features. S_GCC_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) --- 1243,1272 ---- "-gnat05"; -- /05 (D) -- ! -- Allows GNAT to recognize the full range of Ada 2005 constructs. ! ! S_GCC_Ada_2005 : aliased constant S := "/2005 " & ! "-gnat2005"; ! -- /05 (D) ! -- ! -- Allows GNAT to recognize the full range of Ada 2005 constructs. ! -- Equivalent to /05 (/2005 is the preferred usage). ! ! S_GCC_Ada_12 : aliased constant S := "/12 " & ! "-gnat12"; ! -- /05 (D) ! -- ! -- Allows GNAT to recognize all implemented proposed Ada 2012 -- extensions. See features file for list of implemented features. + S_GCC_Ada_2012 : aliased constant S := "/2012 " & + "-gnat2012"; + -- /05 (D) + -- + -- Allows GNAT to recognize all implemented proposed Ada 2012 + -- extensions. See features file for list of implemented features. + -- Equivalent to /12 (/2012 is the preferred usage). + S_GCC_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" & "-aP*"; -- /ADD_PROJECT_SEARCH_PATH=(directory[,...]) *************** package VMS_Data is *** 1276,1282 **** "STACK " & "-fstack-check " & "SUPPRESS_ALL " & ! "-gnatp"; -- /NOCHECKS -- /CHECKS[=(keyword[,...])] -- --- 1307,1315 ---- "STACK " & "-fstack-check " & "SUPPRESS_ALL " & ! "-gnatp " & ! "UNSUPPRESS_ALL " & ! "-gnat-p"; -- /NOCHECKS -- /CHECKS[=(keyword[,...])] -- *************** package VMS_Data is *** 1290,1336 **** -- You may specify one or more of the following keywords to the /CHECKS -- qualifier to modify this behavior: -- ! -- DEFAULT The behavior described above. This is the default ! -- if the /CHECKS qualifier is not present on the ! -- command line. Same as /NOCHECKS. -- ! -- OVERFLOW Enables overflow checking for integer operations and ! -- checks for access before elaboration on subprogram ! -- calls. This causes GNAT to generate slower and larger ! -- executable programs by adding code to check for both ! -- overflow and division by zero (resulting in raising ! -- "Constraint_Error" as required by Ada semantics). ! -- Similarly, GNAT does not generate elaboration check ! -- by default, and you must specify this keyword to ! -- enable them. -- ! -- Note that this keyword does not affect the code ! -- generated for any floating-point operations; it ! -- applies only to integer operations. For floating-point, ! -- GNAT has the "Machine_Overflows" attribute set to ! -- "False" and the normal mode of operation is to generate ! -- IEEE NaN and infinite values on overflow or invalid ! -- operations (such as dividing 0.0 by 0.0). -- ! -- ELABORATION Enables dynamic checks for access-before-elaboration ! -- on subprogram calls and generic instantiations. -- ! -- ASSERTIONS The pragmas "Assert" and "Debug" normally have no ! -- effect and are ignored. This keyword causes "Assert" ! -- 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 ! -- to improve the performance of the code at the expense ! -- of safety in the presence of invalid data or program ! -- bugs. -- ! -- DEFAULT Suppress the effect of any option OVERFLOW or ! -- ASSERTIONS. -- ! -- FULL (D) Similar to OVERFLOW, but suppress the effect of any ! -- option ELABORATION or SUPPRESS_ALL. -- -- These keywords only control the default setting of the checks. You -- may modify them using either "Suppress" (to remove checks) or --- 1323,1372 ---- -- You may specify one or more of the following keywords to the /CHECKS -- qualifier to modify this behavior: -- ! -- DEFAULT The behavior described above. This is the default ! -- if the /CHECKS qualifier is not present on the ! -- command line. Same as /NOCHECKS. -- ! -- OVERFLOW Enables overflow checking for integer operations and ! -- checks for access before elaboration on subprogram ! -- calls. This causes GNAT to generate slower and larger ! -- executable programs by adding code to check for both ! -- overflow and division by zero (resulting in raising ! -- "Constraint_Error" as required by Ada semantics). ! -- Similarly, GNAT does not generate elaboration check ! -- by default, and you must specify this keyword to ! -- enable them. -- ! -- Note that this keyword does not affect the code ! -- generated for any floating-point operations; it ! -- applies only to integer operations. For the case of ! -- floating-point, GNAT has the "Machine_Overflows" ! -- attribute set to "False" and the normal mode of ! -- operation is to generate IEEE NaN and infinite values ! -- on overflow or invalid operations (such as dividing ! -- 0.0 by 0.0). -- ! -- ELABORATION Enables dynamic checks for access-before-elaboration ! -- on subprogram calls and generic instantiations. -- ! -- ASSERTIONS The pragmas "Assert" and "Debug" normally have no ! -- effect and are ignored. This keyword causes "Assert" ! -- 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 to improve the performance of the code at ! -- the expense of safety in the presence of invalid data ! -- or program bugs. -- ! -- UNSUPPRESS_ALL Cancels effect of previous SUPPRESS_ALL. -- ! -- DEFAULT Suppress the effect of any option OVERFLOW or ! -- ASSERTIONS. ! -- ! -- FULL (D) Similar to OVERFLOW, but suppress the effect of any ! -- option ELABORATION or SUPPRESS_ALL. -- -- These keywords only control the default setting of the checks. You -- may modify them using either "Suppress" (to remove checks) or *************** package VMS_Data is *** 1507,1512 **** --- 1543,1557 ---- "-gnatm999999"; -- NODOC (see /ERROR_LIMIT) + S_GCC_Except : aliased constant S := "/EXTRA_EXCEPTION_INFORMATION " & + "-gnateE"; + -- /EXTRA_EXCEPTION_INFORMATION + -- + -- Generate extra information in exception messages, in particular + -- display extra column information and the value and range associated + -- with index and range check failures, and extra column information for + -- access checks. + S_GCC_Expand : aliased constant S := "/EXPAND_SOURCE " & "-gnatG"; -- /NOEXPAND_SOURCE (D) *************** package VMS_Data is *** 2206,2211 **** --- 2251,2263 ---- -- -- When looking for source files also look in directories specified. + S_GCC_Src_Info : aliased constant S := "/SRC_INFO=<" & + "--source-info=>"; + -- /SRC_INFO=source-info-file + -- + -- Specify a source info file to be read or written by the Project + -- Manager when project files are used. + S_GCC_Style : aliased constant S := "/STYLE_CHECKS=" & "ALL_BUILTIN " & "-gnatyy " & *************** package VMS_Data is *** 2239,2248 **** "-gnaty-A " & "BLANKS " & "-gnatyb " & - "BOOLEAN_OPERATORS " & - "-gnatyB " & "NOBLANKS " & "-gnaty-b " & "COMMENTS " & "-gnatyc " & "NOCOMMENTS " & --- 2291,2302 ---- "-gnaty-A " & "BLANKS " & "-gnatyb " & "NOBLANKS " & "-gnaty-b " & + "BOOLEAN_OPERATORS " & + "-gnatyB " & + "NOBOOLEAN_OPERATORS " & + "-gnaty-B " & "COMMENTS " & "-gnatyc " & "NOCOMMENTS " & *************** package VMS_Data is *** 2738,2743 **** --- 2792,2804 ---- -- semantic analyzer is more likely to encounter some internal fatal -- error when given a syntactically invalid tree. + S_GCC_USL : aliased constant S := "/UNCHECKED_SHARED_LIB_IMPORTS " & + "--unchecked-shared-lib-imports"; + -- /NOUNCHECKED_SHARED_LIB_IMPORTS (D) + -- /UNCHECKED_SHARED_LIB_IMPORTS + -- + -- Allow shared library projects to import static library projects + S_GCC_Units : aliased constant S := "/UNITS_LIST " & "-gnatu"; -- /NOUNITS_LIST (D) *************** package VMS_Data is *** 2913,2918 **** --- 2974,2983 ---- "-gnatwh " & "NOHIDING " & "-gnatwH " & + "AVOIDGAPS " & + "-gnatw.h " & + "NOAVOIDGAPS " & + "-gnatw.H " & "IMPLEMENTATION " & "-gnatwi " & "NOIMPLEMENTATION " & *************** package VMS_Data is *** 2969,2974 **** --- 3034,3043 ---- "-gnatw.R " & "SUPPRESS " & "-gnatws " & + "OVERRIDING_SIZE " & + "-gnatw.s " & + "NOOVERRIDING_SIZE " & + "-gnatw.S " & "DELETED_CODE " & "-gnatwt " & "NODELETED_CODE " & *************** package VMS_Data is *** 2979,2984 **** --- 3048,3057 ---- "-gnatwu " & "NOUNUSED " & "-gnatwU " & + "UNORDERED_ENUMERATIONS " & + "-gnatw.u " & + "NOUNORDERED_ENUMERATIONS " & + "-gnatw.U " & "VARIABLES_UNINITIALIZED " & "-gnatwv " & "NOVARIABLES_UNINITIALIZED " & *************** package VMS_Data is *** 3438,3443 **** --- 3511,3519 ---- (S_GCC_Ada_83 'Access, S_GCC_Ada_95 'Access, S_GCC_Ada_05 'Access, + S_GCC_Ada_2005'Access, + S_GCC_Ada_12 'Access, + S_GCC_Ada_2012'Access, S_GCC_Add 'Access, S_GCC_Asm 'Access, S_GCC_AValid 'Access, *************** package VMS_Data is *** 3455,3460 **** --- 3531,3537 ---- S_GCC_ErrorX 'Access, S_GCC_Expand 'Access, S_GCC_Lexpand 'Access, + S_GCC_Except 'Access, S_GCC_Extend 'Access, S_GCC_Ext 'Access, S_GCC_File 'Access, *************** package VMS_Data is *** 3498,3503 **** --- 3575,3581 ---- S_GCC_RTS 'Access, S_GCC_SCO 'Access, S_GCC_Search 'Access, + S_GCC_Src_Info'Access, S_GCC_Style 'Access, S_GCC_StyleX 'Access, S_GCC_Subdirs 'Access, *************** package VMS_Data is *** 3507,3512 **** --- 3585,3591 ---- S_GCC_Trace 'Access, S_GCC_Tree 'Access, S_GCC_Trys 'Access, + S_GCC_USL 'Access, S_GCC_Units 'Access, S_GCC_Unique 'Access, S_GCC_Upcase 'Access, *************** package VMS_Data is *** 3615,3620 **** --- 3694,3713 ---- -- HIGH A great number of messages are output, most of them not -- being useful for the user. + S_Elim_Nodisp : aliased constant S := "/NO_DISPATCH " & + "--no-elim-dispatch"; + -- /NONO_DISPATCH (D) + -- /NO_DISPATCH + -- + -- Do not generate pragmas for dispatching operations. + + S_Elim_Ignore : aliased constant S := "/IGNORE=@" & + "--ignore=@"; + -- /IGNORE=filename + -- + -- Do not generate pragmas for subprograms declared in the sources + -- listed in a specified file + S_Elim_Project : aliased constant S := "/PROJECT_FILE=<" & "-P>"; -- /PROJECT_FILE=filename *************** package VMS_Data is *** 3624,3630 **** -- gnatelim. The source directories to be searched will be communicated -- to gnatelim through logical name ADA_PRJ_INCLUDE_FILE. ! S_Elim_Quiet : aliased constant S := "/QUIET " & "-q"; -- /NOQUIET (D) -- /QUIET --- 3717,3723 ---- -- gnatelim. The source directories to be searched will be communicated -- to gnatelim through logical name ADA_PRJ_INCLUDE_FILE. ! S_Elim_Quiet : aliased constant S := "/QUIET " & "-q"; -- /NOQUIET (D) -- /QUIET *************** package VMS_Data is *** 3633,3638 **** --- 3726,3773 ---- -- the number of program units left to be processed. This option turns -- this trace off. + S_Elim_Files : aliased constant S := "/FILES=@" & + "-files=@"; + + -- /FILES=filename + -- + -- Take as arguments the files that are listed in the specified + -- text file. + + S_Elim_Log : aliased constant S := "/LOG " & + "-l"; + -- /NOLOG (D) + -- /LOG + -- + -- Duplicate all the output sent to Stderr into a default log file. + + S_Elim_Logfile : aliased constant S := "/LOGFILE=@" & + "-l@"; + + -- /LOGFILE=logfilename + -- + -- Duplicate all the output sent to Stderr into a specified log file. + + S_Elim_Main : aliased constant S := "/MAIN=@" & + "-main=@"; + + -- /MAIN=filename + -- + -- Specify the main subprogram of the partition to analyse. + + S_Elim_Out : aliased constant S := "/OUTPUT=@" & + "-o@"; + -- /OUTPUT=filename + -- + -- Specify the name of the output file. + + S_Elim_Time : aliased constant S := "/TIME " & + "-t"; + -- /NOTIME (D) + -- /TIME + -- + -- Print out execution time + S_Elim_Search : aliased constant S := "/SEARCH=*" & "-I*"; -- /SEARCH=(directory, ...) *************** package VMS_Data is *** 3657,3662 **** --- 3792,3810 ---- -- program units left, GNAT ELIM will output the name of the current unit -- being processed. + S_Elim_Warn : aliased constant S := "/WARNINGS=" & + "NORMAL " & + "-wn " & + "QUIET " & + "-ws"; + + -- /WARNINGS[=(keyword[,...])] + -- + -- The following keywords are supported: + -- + -- NORMAL (D) Print warning all the messages. + -- QUIET Some warning messages are suppressed + Elim_Switches : aliased constant Switches := (S_Elim_Add 'Access, S_Elim_All 'Access, *************** package VMS_Data is *** 3665,3678 **** 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); ---------------------------- -- Switches for GNAT FIND -- --- 3813,3834 ---- S_Elim_Config 'Access, S_Elim_Current 'Access, S_Elim_Ext 'Access, + S_Elim_Files 'Access, S_Elim_Follow 'Access, S_Elim_GNATMAKE'Access, + S_Elim_Log 'Access, + S_Elim_Logfile 'Access, + S_Elim_Main 'Access, S_Elim_Mess 'Access, + S_Elim_Nodisp 'Access, + S_Elim_Out 'Access, S_Elim_Project 'Access, S_Elim_Quiet 'Access, S_Elim_Search 'Access, S_Elim_Subdirs 'Access, ! S_Elim_Time 'Access, ! S_Elim_Verb 'Access, ! S_Elim_Warn 'Access); ---------------------------- -- Switches for GNAT FIND -- *************** package VMS_Data is *** 4759,4764 **** --- 4915,4928 ---- -- -- Search the specified directories for both source and object files. + S_Make_Single : aliased constant S := "/SINGLE_COMPILE_PER_OBJ_DIR " & + "--single-compile-per-obj-dir"; + -- /NOSINGLE_COMPILE_PER_OBJ_DIR (D) + -- /SINGLE_COMPILE_PER_OBJ_DIR + -- + -- When project files are used, do not allow simultaneous compilations + -- for the same object directory. + S_Make_Skip : aliased constant S := "/SKIP_MISSING=*" & "-aL*"; -- /SKIP_MISSING=(directory[,...]) *************** package VMS_Data is *** 4771,4776 **** --- 4935,4947 ---- -- -- When looking for source files also look in the specified directories. + S_Make_Src_Info : aliased constant S := "/SRC_INFO=<" & + "--source-info=>"; + -- /SRC_INFO=source-info-file + -- + -- Specify a source info file to be read or written by the Project + -- Manager when project files are used. + S_Make_Stand : aliased constant S := "/STANDARD_OUTPUT_FOR_COMMANDS " & "-eS"; -- /NOSTANDARD_OUTPUT_FOR_COMMANDS (D) *************** package VMS_Data is *** 4799,4804 **** --- 4970,4982 ---- -- For example, -O -O2 is different than -O2 -O, but -g -O is equivalent -- to -O -g. + S_Make_USL : aliased constant S := "/UNCHECKED_SHARED_LIB_IMPORTS " & + "--unchecked-shared-lib-imports"; + -- /NOUNCHECKED_SHARED_LIB_IMPORTS (D) + -- /UNCHECKED_SHARED_LIB_IMPORTS + -- + -- Allow shared library projects to import static library projects + S_Make_Unique : aliased constant S := "/UNIQUE " & "-u"; -- /NOUNIQUE (D) *************** package VMS_Data is *** 4871,4881 **** --- 5049,5062 ---- S_Make_Reason 'Access, S_Make_RTS 'Access, S_Make_Search 'Access, + S_Make_Single 'Access, S_Make_Skip 'Access, S_Make_Source 'Access, + S_Make_Src_Info'Access, S_Make_Stand 'Access, S_Make_Subdirs 'Access, S_Make_Switch 'Access, + S_Make_USL 'Access, S_Make_Unique 'Access, S_Make_Use_Map 'Access, S_Make_Verbose 'Access); diff -Nrcpad gcc-4.5.2/gcc/ada/xeinfo.adb gcc-4.6.0/gcc/ada/xeinfo.adb *** gcc-4.5.2/gcc/ada/xeinfo.adb Sun Apr 13 18:03:09 2008 --- gcc-4.6.0/gcc/ada/xeinfo.adb Tue Oct 26 12:19:56 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** with GNAT.Spitbol; use *** 57,62 **** --- 57,64 ---- with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns; with GNAT.Spitbol.Table_Boolean; use GNAT.Spitbol.Table_Boolean; + with CEinfo; + procedure XEinfo is package TB renames GNAT.Spitbol.Table_Boolean; *************** procedure XEinfo is *** 241,246 **** --- 243,253 ---- -- Start of processing for XEinfo begin + -- First run CEinfo to check for errors. Note that CEinfo is also a + -- stand-alone program that can be run separately. + + CEinfo; + Anchored_Mode := True; if Argument_Count > 0 then *************** begin *** 348,353 **** --- 355,361 ---- -- Case of type declaration elsif Match (Line, F_Typ) then + -- Process type declaration (must be enumeration type) Ctr := 0; *************** begin *** 371,376 **** --- 379,385 ---- end loop; -- Process function declarations + -- Note: Lastinlined used to control blank lines Put_Line (Ofile, ""); *************** begin *** 487,492 **** --- 496,504 ---- (Ofile, "/* End of einfo.h (C version of Einfo package specification) */"); + Close (InF); + Close (Ofile); + exception when Err => Put_Line (Standard_Error, Lineno & ". " & Line); diff -Nrcpad gcc-4.5.2/gcc/ada/xgnatugn.adb gcc-4.6.0/gcc/ada/xgnatugn.adb *** gcc-4.5.2/gcc/ada/xgnatugn.adb Mon Apr 14 09:39:39 2008 --- gcc-4.6.0/gcc/ada/xgnatugn.adb Tue Oct 5 09:16:23 2010 *************** procedure Xgnatugn is *** 127,133 **** -- 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; --- 127,132 ---- *************** procedure Xgnatugn is *** 369,379 **** 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 -- ----------- --- 368,373 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/xoscons.adb gcc-4.6.0/gcc/ada/xoscons.adb *** gcc-4.5.2/gcc/ada/xoscons.adb Mon Nov 30 09:35:30 2009 --- gcc-4.6.0/gcc/ada/xoscons.adb Mon Dec 20 07:26:57 2010 *************** procedure XOSCons is *** 64,70 **** -- is not available in older base compilers. -- We need to deal with integer values that can be signed or unsigned, so ! -- we need to accomodate the maximum range of both cases. type Int_Value_Type is record Positive : Boolean; --- 64,70 ---- -- is not available in older base compilers. -- We need to deal with integer values that can be signed or unsigned, so ! -- we need to accommodate the maximum range of both cases. type Int_Value_Type is record Positive : Boolean; diff -Nrcpad gcc-4.5.2/gcc/ada/xr_tabls.adb gcc-4.6.0/gcc/ada/xr_tabls.adb *** gcc-4.5.2/gcc/ada/xr_tabls.adb Mon Jul 27 13:47:11 2009 --- gcc-4.6.0/gcc/ada/xr_tabls.adb Mon Oct 11 10:03:01 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body Xr_Tabls is *** 395,401 **** begin case Ref_Type is ! when 'b' | 'c' | 'm' | 'r' | 'R' | 'i' | ' ' | 'x' => null; when 'l' | 'w' => --- 395,402 ---- begin case Ref_Type is ! when 'b' | 'c' | 'H' | 'm' | 'o' | 'r' | 'R' | ! 's' | 'i' | ' ' | 'x' => null; when 'l' | 'w' => *************** package body Xr_Tabls is *** 419,425 **** (Symbol_Length => 0, Symbol => "", Key => new String'(Key), ! Decl => null, Is_Parameter => True, Decl_Type => ' ', Body_Ref => null, --- 420,431 ---- (Symbol_Length => 0, Symbol => "", Key => new String'(Key), ! Decl => new Reference_Record' ! (File => File_Ref, ! Line => Line, ! Column => Column, ! Source_Line => null, ! Next => null), Is_Parameter => True, Decl_Type => ' ', Body_Ref => null, *************** package body Xr_Tabls is *** 447,464 **** Source_Line => null, Next => null); ! -- We can insert the reference in the list directly, since all ! -- the references will appear only once in the ALI file ! -- corresponding to the file where they are referenced. ! -- This saves a lot of time compared to checking the list to check ! -- if it exists. case Ref_Type is when 'b' | 'c' => New_Ref.Next := Declaration.Body_Ref; Declaration.Body_Ref := New_Ref; ! when 'r' | 'R' | 'i' | 'l' | ' ' | 'x' | 'w' => New_Ref.Next := Declaration.Ref_Ref; Declaration.Ref_Ref := New_Ref; --- 453,469 ---- Source_Line => null, Next => null); ! -- We can insert the reference into the list directly, since all the ! -- references will appear only once in the ALI file corresponding to the ! -- file where they are referenced. This saves a lot of time compared to ! -- checking the list to check if it exists. case Ref_Type is when 'b' | 'c' => New_Ref.Next := Declaration.Body_Ref; Declaration.Body_Ref := New_Ref; ! when 'r' | 'R' | 's' | 'H' | 'i' | 'l' | 'o' | ' ' | 'x' | 'w' => New_Ref.Next := Declaration.Ref_Ref; Declaration.Ref_Ref := New_Ref; diff -Nrcpad gcc-4.5.2/gcc/ada/xref_lib.adb gcc-4.6.0/gcc/ada/xref_lib.adb *** gcc-4.5.2/gcc/ada/xref_lib.adb Mon Aug 10 08:25:05 2009 --- gcc-4.6.0/gcc/ada/xref_lib.adb Tue Oct 12 12:51:37 2010 *************** *** 6,12 **** -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2009, 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1998-2010, 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- -- *************** package body Xref_Lib is *** 231,237 **** Line_Start := Index (Entity (File_Start .. Entity'Last), ":"); ! -- Check if it was a disk:\directory item (for NT and OS/2) if File_Start = Line_Start - 1 and then Line_Start < Entity'Last --- 231,237 ---- Line_Start := Index (Entity (File_Start .. Entity'Last), ":"); ! -- Check if it was a disk:\directory item (for Windows) if File_Start = Line_Start - 1 and then Line_Start < Entity'Last *************** package body Xref_Lib is *** 508,513 **** --- 508,514 ---- when 'D' => return "decimal type"; when 'E' => return "enumeration type"; when 'F' => return "float type"; + when 'H' => return "abstract type"; when 'I' => return "integer type"; when 'M' => return "modular type"; when 'O' => return "fixed type"; *************** package body Xref_Lib is *** 517,530 **** when 'T' => return "task type"; when 'W' => return "protected type"; ! when 'a' => return "array type"; when 'b' => return Param_String & "boolean object"; when 'c' => return Param_String & "class-wide object"; when 'd' => return Param_String & "decimal object"; when 'e' => return Param_String & "enumeration object"; when 'f' => return Param_String & "float object"; - when 'h' => return "interface"; when 'i' => return Param_String & "integer object"; when 'm' => return Param_String & "modular object"; when 'o' => return Param_String & "fixed object"; when 'p' => return Param_String & "access object"; --- 518,531 ---- when 'T' => return "task type"; when 'W' => return "protected type"; ! when 'a' => return Param_String & "array object"; when 'b' => return Param_String & "boolean object"; when 'c' => return Param_String & "class-wide object"; when 'd' => return Param_String & "decimal object"; when 'e' => return Param_String & "enumeration object"; when 'f' => return Param_String & "float object"; when 'i' => return Param_String & "integer object"; + when 'j' => return Param_String & "class object"; when 'm' => return Param_String & "modular object"; when 'o' => return Param_String & "fixed object"; when 'p' => return Param_String & "access object"; *************** package body Xref_Lib is *** 535,540 **** --- 536,544 ---- when 'x' => return Param_String & "abstract procedure"; when 'y' => return Param_String & "abstract function"; + when 'h' => return "interface"; + when 'g' => return "macro"; + when 'J' => return "class"; when 'K' => return "package"; when 'k' => return "generic package"; when 'L' => return "statement label"; *************** package body Xref_Lib is *** 542,547 **** --- 546,552 ---- when 'N' => return "named number"; when 'n' => return "enumeration literal"; when 'q' => return "block label"; + when 'Q' => return "include file"; when 'U' => return "procedure"; when 'u' => return "generic procedure"; when 'V' => return "function"; *************** package body Xref_Lib is *** 550,555 **** --- 555,561 ---- when 'Y' => return "entry"; when '+' => return "private type"; + when '*' => return "private variable"; -- The above should be the only possibilities, but for this kind -- of informational output, we don't want to bomb if we find *************** package body Xref_Lib is *** 557,563 **** -- have an unknown Abbrev value when others => ! return "??? (" & Get_Type (Decl) & ")"; end case; end Get_Full_Type; --- 563,573 ---- -- have an unknown Abbrev value when others => ! if Is_Parameter (Decl) then ! return "parameter"; ! else ! return "??? (" & Get_Type (Decl) & ")"; ! end if; end case; end Get_Full_Type; *************** package body Xref_Lib is *** 1587,1594 **** File := Get_File_Ref (Arr (R)); F := Osint.To_Host_File_Spec (Get_Gnatchop_File (Arr (R), Full_Path_Name)); ! Write_Str (F.all & ' '); ! Free (F); end if; Print_Ref (Get_Line (Arr (R)), Get_Column (Arr (R))); --- 1597,1609 ---- File := Get_File_Ref (Arr (R)); F := Osint.To_Host_File_Spec (Get_Gnatchop_File (Arr (R), Full_Path_Name)); ! ! if F = null then ! Write_Str (" "); ! else ! Write_Str (F.all & ' '); ! Free (F); ! end if; end if; Print_Ref (Get_Line (Arr (R)), Get_Column (Arr (R))); *************** package body Xref_Lib is *** 1637,1644 **** Write_Str (" Decl: "); F := Osint.To_Host_File_Spec (Get_Gnatchop_File (Decl, Full_Path_Name)); ! Print80 (F.all & ' '); ! Free (F); Print_Ref (Get_Line (Decl), Get_Column (Decl)); Print_List --- 1652,1665 ---- Write_Str (" Decl: "); F := Osint.To_Host_File_Spec (Get_Gnatchop_File (Decl, Full_Path_Name)); ! ! if F = null then ! Print80 (" "); ! else ! Print80 (F.all & ' '); ! Free (F); ! end if; ! Print_Ref (Get_Line (Decl), Get_Column (Decl)); Print_List diff -Nrcpad gcc-4.5.2/gcc/ada/xsinfo.adb gcc-4.6.0/gcc/ada/xsinfo.adb *** gcc-4.5.2/gcc/ada/xsinfo.adb Sun Apr 13 18:03:09 2008 --- gcc-4.6.0/gcc/ada/xsinfo.adb Tue Oct 26 12:32:21 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** *** 35,44 **** -- sinfo.h Corresponding c header file - -- 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 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. --- 35,40 ---- *************** with Ada.Text_IO; use *** 50,55 **** --- 46,53 ---- with GNAT.Spitbol; use GNAT.Spitbol; with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns; + with CSinfo; + procedure XSinfo is Done : exception; *************** procedure XSinfo is *** 115,120 **** --- 113,123 ---- -- Start of processing for XSinfo begin + -- First run CSinfo to check for errors. Note that CSinfo is also a + -- stand-alone program that can be run separately. + + CSinfo; + Set_Exit_Status (1); Anchored_Mode := True; *************** begin *** 239,247 **** --- 242,254 ---- Getline; end loop; + -- Can't get here since above loop only left via raise + exception when Done => + Close (InS); Put_Line (Ofile, ""); + Close (Ofile); Set_Exit_Status (0); end XSinfo; diff -Nrcpad gcc-4.5.2/gcc/ada/xsnames.adb gcc-4.6.0/gcc/ada/xsnames.adb *** gcc-4.5.2/gcc/ada/xsnames.adb Tue May 27 08:50:31 2008 --- gcc-4.6.0/gcc/ada/xsnames.adb Thu Jan 1 00:00:00 1970 *************** *** 1,244 **** - ------------------------------------------------------------------------------ - -- -- - -- GNAT SYSTEM UTILITIES -- - -- -- - -- X S N A M E S -- - -- -- - -- 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. -- - -- -- - -- GNAT was originally developed by the GNAT team at New York University. -- - -- Extensive contributions were provided by Ada Core Technologies Inc. -- - -- -- - ------------------------------------------------------------------------------ - - -- This utility is used to make a new version of the Snames package when new - -- names are added to the spec, the existing versions of snames.ads and - -- snames.adb and snames.h are read, and updated to match the set of names in - -- snames.ads. The updated versions are written to snames.ns, snames.nb (new - -- spec/body), and snames.nh (new header file). - - with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; - with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; - with Ada.Strings.Maps; use Ada.Strings.Maps; - with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; - with Ada.Text_IO; use Ada.Text_IO; - - with GNAT.Spitbol; use GNAT.Spitbol; - with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns; - - procedure XSnames is - - InB : File_Type; - InS : File_Type; - OutS : File_Type; - OutB : File_Type; - InH : File_Type; - OutH : File_Type; - - A, B : VString := Nul; - Line : VString := Nul; - Name : VString := Nul; - Name1 : VString := Nul; - Oval : VString := Nul; - Restl : VString := Nul; - - Tdigs : constant Pattern := Any (Decimal_Digit_Set) & - Any (Decimal_Digit_Set) & - Any (Decimal_Digit_Set); - - Name_Ref : constant Pattern := Span (' ') * A & Break (' ') * Name - & Span (' ') * B - & ": constant Name_Id := N + " & Tdigs - & ';' & Rest * Restl; - - Get_Name : constant Pattern := "Name_" & Rest * Name1; - Chk_Low : constant Pattern := Pos (0) & Any (Lower_Set) & Rest & Pos (1); - Findu : constant Pattern := Span ('u') * A; - - Val : Natural; - - Xlate_U_Und : constant Character_Mapping := To_Mapping ("u", "_"); - - M : Match_Result; - - type Header_Symbol is (None, Attr, Conv, Prag); - -- A symbol in the header file - - procedure Output_Header_Line (S : Header_Symbol); - -- Output header line - - Header_Attr : aliased String := "Attr"; - Header_Conv : aliased String := "Convention"; - Header_Prag : aliased String := "Pragma"; - -- Prefixes used in the header file - - type String_Ptr is access all String; - Header_Prefix : constant array (Header_Symbol) of String_Ptr := - (null, - Header_Attr'Access, - Header_Conv'Access, - Header_Prag'Access); - - -- Patterns used in the spec file - - Get_Attr : constant Pattern := Span (' ') & "Attribute_" - & Break (",)") * Name1; - Get_Conv : constant Pattern := Span (' ') & "Convention_" - & Break (",)") * Name1; - Get_Prag : constant Pattern := Span (' ') & "Pragma_" - & Break (",)") * Name1; - - type Header_Symbol_Counter is array (Header_Symbol) of Natural; - Header_Counter : Header_Symbol_Counter := (0, 0, 0, 0); - - Header_Current_Symbol : Header_Symbol := None; - Header_Pending_Line : VString := Nul; - - ------------------------ - -- Output_Header_Line -- - ------------------------ - - procedure Output_Header_Line (S : Header_Symbol) is - begin - -- Skip all the #define for S-prefixed symbols in the header. - -- Of course we are making implicit assumptions: - -- (1) No newline between symbols with the same prefix. - -- (2) Prefix order is the same as in snames.ads. - - if Header_Current_Symbol /= S then - declare - Pat : constant String := "#define " & Header_Prefix (S).all; - In_Pat : Boolean := False; - - begin - if Header_Current_Symbol /= None then - Put_Line (OutH, Header_Pending_Line); - end if; - - loop - Line := Get_Line (InH); - - if Match (Line, Pat) then - In_Pat := True; - elsif In_Pat then - Header_Pending_Line := Line; - exit; - else - Put_Line (OutH, Line); - end if; - end loop; - - Header_Current_Symbol := S; - end; - end if; - - -- Now output the line - - Put_Line (OutH, "#define " & Header_Prefix (S).all - & "_" & Name1 & (30 - Length (Name1)) * ' ' - & Header_Counter (S)); - Header_Counter (S) := Header_Counter (S) + 1; - end Output_Header_Line; - - -- Start of processing for XSnames - - begin - Open (InB, In_File, "snames.adb"); - Open (InS, In_File, "snames.ads"); - Open (InH, In_File, "snames.h"); - - Create (OutS, Out_File, "snames.ns"); - Create (OutB, Out_File, "snames.nb"); - Create (OutH, Out_File, "snames.nh"); - - Anchored_Mode := True; - Val := 0; - - loop - Line := Get_Line (InB); - exit when Match (Line, " Preset_Names"); - Put_Line (OutB, Line); - end loop; - - Put_Line (OutB, Line); - - LoopN : while not End_Of_File (InS) loop - Line := Get_Line (InS); - - if not Match (Line, Name_Ref) then - Put_Line (OutS, Line); - - if Match (Line, Get_Attr) then - Output_Header_Line (Attr); - elsif Match (Line, Get_Conv) then - Output_Header_Line (Conv); - elsif Match (Line, Get_Prag) then - Output_Header_Line (Prag); - end if; - else - Oval := Lpad (V (Val), 3, '0'); - - if Match (Name, "Last_") then - Oval := Lpad (V (Val - 1), 3, '0'); - end if; - - Put_Line - (OutS, A & Name & B & ": constant Name_Id := N + " - & Oval & ';' & Restl); - - if Match (Name, Get_Name) then - Name := Name1; - Val := Val + 1; - - if Match (Name, Findu, M) then - Replace (M, Translate (A, Xlate_U_Und)); - Translate (Name, Lower_Case_Map); - - elsif not Match (Name, "Op_", "") then - Translate (Name, Lower_Case_Map); - - else - Name := 'O' & Translate (Name, Lower_Case_Map); - end if; - - if Name = "error" then - Name := V (""); - end if; - - if not Match (Name, Chk_Low) then - Put_Line (OutB, " """ & Name & "#"" &"); - end if; - end if; - end if; - end loop LoopN; - - loop - Line := Get_Line (InB); - exit when Match (Line, " ""#"";"); - end loop; - - Put_Line (OutB, Line); - - while not End_Of_File (InB) loop - Line := Get_Line (InB); - Put_Line (OutB, Line); - end loop; - - Put_Line (OutH, Header_Pending_Line); - while not End_Of_File (InH) loop - Line := Get_Line (InH); - Put_Line (OutH, Line); - end loop; - end XSnames; --- 0 ---- diff -Nrcpad gcc-4.5.2/gcc/ada/xtreeprs.adb gcc-4.6.0/gcc/ada/xtreeprs.adb *** gcc-4.5.2/gcc/ada/xtreeprs.adb Fri Feb 20 15:20:38 2009 --- gcc-4.6.0/gcc/ada/xtreeprs.adb Mon Oct 11 10:43:04 2010 *************** *** 6,12 **** -- -- -- 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- -- --- 6,12 ---- -- -- -- B o d y -- -- -- ! -- Copyright (C) 1992-2010, 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- -- *************** begin *** 252,260 **** -- Field3 '%' -- Field4 '&' -- Field5 "'" - -- Flag1 "(" - -- Flag2 ")" - -- Flag3 '*' -- Flag4 '+' -- Flag5 ',' -- Flag6 '-' --- 252,257 ---- diff -Nrcpad gcc-4.5.2/gnattools/ChangeLog gcc-4.6.0/gnattools/ChangeLog *** gcc-4.5.2/gnattools/ChangeLog Thu Dec 16 12:30:12 2010 --- gcc-4.6.0/gnattools/ChangeLog Fri Mar 25 16:55:34 2011 *************** *** 1,14 **** ! 2010-12-16 Release Manager ! ! * GCC 4.5.2 released. ! ! 2010-07-31 Release Manager ! * GCC 4.5.1 released. ! 2010-04-14 Release Manager ! * GCC 4.5.0 released. 2010-01-09 Simon Wright --- 1,14 ---- ! 2011-03-25 Release Manager ! * GCC 4.6.0 released. ! 2010-11-20 Ralf Wildenhues ! PR other/46202 ! * Makefile.in (install-strip): New phony target. ! (check, installcheck, info, dvi, pdf, html, install) ! (install-info, install-pdf, install-html, mostlyclean) ! (clean, distclean, maintainer-clean): Mark phony. 2010-01-09 Simon Wright diff -Nrcpad gcc-4.5.2/gnattools/Makefile.in gcc-4.6.0/gnattools/Makefile.in *** gcc-4.5.2/gnattools/Makefile.in Thu Jul 30 22:33:49 2009 --- gcc-4.6.0/gnattools/Makefile.in Sat Nov 20 19:37:08 2010 *************** *** 1,5 **** # Makefile for gnattools ! # Copyright 2003, 2004, 2009 Free Software Foundation, Inc. # # 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 --- 1,5 ---- # Makefile for gnattools ! # Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc. # # 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 *************** pdf: *** 274,291 **** --- 274,297 ---- # Build HTML (none here). html: + .PHONY: check installcheck info dvi pdf html + # Build TAGS (none here). TAGS: # Installation rules. install: + install-strip: install + install-info: install-pdf: install-html: + .PHONY: install install-strip install-info install-pdf install-html + # Cleaning rules. mostlyclean: *************** distclean: *** 296,301 **** --- 302,309 ---- maintainer-clean: + .PHONY: mostlyclean clean distclean maintainer-clean + # Rules for rebuilding this Makefile. Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ ; \ diff -Nrcpad gcc-4.5.2/libada/ChangeLog gcc-4.6.0/libada/ChangeLog *** gcc-4.5.2/libada/ChangeLog Thu Dec 16 12:31:11 2010 --- gcc-4.6.0/libada/ChangeLog Fri Mar 25 16:55:47 2011 *************** *** 1,14 **** ! 2010-12-16 Release Manager ! ! * GCC 4.5.2 released. ! ! 2010-07-31 Release Manager ! * GCC 4.5.1 released. ! 2010-04-14 Release Manager ! * GCC 4.5.0 released. 2009-10-24 Eric Botcazou --- 1,14 ---- ! 2011-03-25 Release Manager ! * GCC 4.6.0 released. ! 2010-11-20 Ralf Wildenhues ! PR other/46202 ! * Makefile.in (install-strip): New phony target. ! (check, installcheck, info, dvi, pdf, html, install) ! (install-info, install-pdf, install-html, mostlyclean) ! (clean, distclean, maintainer-clean): Mark phony. 2009-10-24 Eric Botcazou diff -Nrcpad gcc-4.5.2/libada/Makefile.in gcc-4.6.0/libada/Makefile.in *** gcc-4.5.2/libada/Makefile.in Sat Oct 24 10:58:31 2009 --- gcc-4.6.0/libada/Makefile.in Sat Nov 20 19:37:08 2010 *************** *** 1,5 **** # Makefile for libada. ! # Copyright 2003, 2004, 2009 Free Software Foundation, Inc. # # 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 --- 1,5 ---- # Makefile for libada. ! # Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc. # # 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 *************** *** 19,25 **** all: gnatlib $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE) ! .PHONY: all install ## Multilib support variables. MULTISRCTOP = --- 19,25 ---- all: gnatlib $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE) ! .PHONY: all ## Multilib support variables. MULTISRCTOP = *************** html: *** 144,159 **** --- 144,165 ---- # Build TAGS (none here). TAGS: + .PHONY: check installcheck info dvi pdf html + # Installation rules. install: install-gnatlib $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE) + install-strip: install + install-info: install-pdf: install-html: + .PHONY: install install-strip install-info install-pdf install-html + # Cleaning rules. mostlyclean: $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE) *************** distclean: *** 167,172 **** --- 173,180 ---- maintainer-clean: + .PHONY: mostlyclean clean distclean maintainer-clean + # Rules for rebuilding this Makefile. Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ ; \